1515class Bunch (dict ):
1616 """A dict with attribute-access
1717
18- :class:`Bunch` is used to store :class:`DataItem ` objects.
18+ :class:`Bunch` is used to store :class:`Dataset ` objects.
1919 """
2020
2121 def __getattr__ (self , key ):
@@ -31,8 +31,8 @@ def _repr_html_(self, inside=False):
3131
3232 children = ""
3333 for key in self .keys ():
34- if isinstance (self [key ], DataItem ):
35- obj = "geodatasets.DataItem "
34+ if isinstance (self [key ], Dataset ):
35+ obj = "geodatasets.Dataset "
3636 else :
3737 obj = "geodatasets.Bunch"
3838 uid = str (uuid .uuid4 ())
@@ -69,19 +69,19 @@ def _repr_html_(self, inside=False):
6969 def flatten (self ) -> dict :
7070 """Return the nested :class:`Bunch` collapsed into the one level dictionary.
7171
72- Dictionary keys are :class:`DataItem ` names (e.g. ``geoda.airbnb``)
73- and its values are :class:`DataItem ` objects.
72+ Dictionary keys are :class:`Dataset ` names (e.g. ``geoda.airbnb``)
73+ and its values are :class:`Dataset ` objects.
7474
7575 Returns
7676 -------
7777 flattened : dict
78- dictionary of :class:`DataItem ` objects
78+ dictionary of :class:`Dataset ` objects
7979 """
8080
8181 flat = {}
8282
8383 def _get_items (item ):
84- if isinstance (item , DataItem ):
84+ if isinstance (item , Dataset ):
8585 flat [item .name ] = item
8686 else :
8787 for prov in item .values ():
@@ -91,10 +91,10 @@ def _get_items(item):
9191
9292 return flat
9393
94- def query_name (self , name : str ) -> DataItem :
95- """Return :class:`DataItem ` based on the name query
94+ def query_name (self , name : str ) -> Dataset :
95+ """Return :class:`Dataset ` based on the name query
9696
97- Returns a matching :class:`DataItem ` from the :class:`Bunch` if the ``name``
97+ Returns a matching :class:`Dataset ` from the :class:`Bunch` if the ``name``
9898 contains the same letters in the same order as the item's name irrespective
9999 of the letter case, spaces, dashes and other characters.
100100 See examples for details.
@@ -106,7 +106,7 @@ def query_name(self, name: str) -> DataItem:
106106
107107 Returns
108108 -------
109- match: DataItem
109+ match: Dataset
110110 """
111111 xyz_flat_lower = {
112112 k .translate (QUERY_NAME_TRANSLATION ).lower (): v
@@ -119,7 +119,7 @@ def query_name(self, name: str) -> DataItem:
119119 raise ValueError (f"No matching item found for the query '{ name } '." )
120120
121121
122- class DataItem (Bunch ):
122+ class Dataset (Bunch ):
123123 """
124124 A dict with attribute-access and that
125125 can be called to update keys
@@ -136,18 +136,18 @@ def __init__(self, *args, **kwargs):
136136 msg = (
137137 f"The attributes { required } "
138138 f"are required to initialise "
139- f"a `DataItem `. Please provide values for: "
139+ f"a `Dataset `. Please provide values for: "
140140 f'`{ "`, `" .join (missing )} `'
141141 )
142142 raise AttributeError (msg )
143143
144- def __call__ (self , ** kwargs ) -> DataItem :
145- new = DataItem (self ) # takes a copy preserving the class
144+ def __call__ (self , ** kwargs ) -> Dataset :
145+ new = Dataset (self ) # takes a copy preserving the class
146146 new .update (kwargs )
147147 return new
148148
149- def copy (self , ** kwargs ) -> DataItem :
150- new = DataItem (self ) # takes a copy preserving the class
149+ def copy (self , ** kwargs ) -> Dataset :
150+ new = Dataset (self ) # takes a copy preserving the class
151151 return new
152152
153153 def _repr_html_ (self , inside = False ):
@@ -162,7 +162,7 @@ def _repr_html_(self, inside=False):
162162 { style }
163163 <div class="xyz-wrap">
164164 <div class="xyz-header">
165- <div class="xyz-obj">geodatasets.DataItem </div>
165+ <div class="xyz-obj">geodatasets.Dataset </div>
166166 <div class="xyz-name">{ self .name } </div>
167167 </div>
168168 <div class="xyz-details">
@@ -187,9 +187,9 @@ def _load_json(f):
187187 item = data [item_name ]
188188
189189 if "url" in item .keys ():
190- items [item_name ] = DataItem (item )
190+ items [item_name ] = Dataset (item )
191191 else :
192- items [item_name ] = Bunch ({i : DataItem (item [i ]) for i in item })
192+ items [item_name ] = Bunch ({i : Dataset (item [i ]) for i in item })
193193
194194 return items
195195
0 commit comments