@@ -14,10 +14,10 @@ def finish(self):
1414
1515
1616class FileMapBuilder (MapBuilder ):
17- def __init__ (self , fpath ):
17+ def __init__ (self , path ):
1818 self ._ctx = lib .fst_context_new ()
1919 self ._writer_p = checked_call (
20- lib .fst_bufwriter_new , self ._ctx , fpath .encode ('utf8' ))
20+ lib .fst_bufwriter_new , self ._ctx , path .encode ('utf8' ))
2121 self ._builder_p = checked_call (
2222 lib .fst_filemapbuilder_new , self ._ctx , self ._writer_p )
2323
@@ -122,7 +122,7 @@ class Map(object):
122122
123123 @staticmethod
124124 @contextmanager
125- def build (fpath = None ):
125+ def build (path = None ):
126126 """ Context manager to build a new map.
127127
128128 Call :py:meth:`insert` on the returned builder object to insert
@@ -133,15 +133,15 @@ def build(fpath=None):
133133 in memory
134134 :returns: :py:class:`MapBuilder`
135135 """
136- if fpath :
137- builder = FileMapBuilder (fpath )
136+ if path :
137+ builder = FileMapBuilder (path )
138138 else :
139139 builder = MemMapBuilder ()
140140 yield builder
141141 builder .finish ()
142142
143143 @classmethod
144- def from_iter (cls , it , fpath = None ):
144+ def from_iter (cls , it , path = None ):
145145 """ Build a new map from an iterator.
146146
147147 Keep in mind that the iterator must return lexicographically sorted
@@ -157,11 +157,11 @@ def from_iter(cls, it, fpath=None):
157157 """
158158 if isinstance (it , dict ):
159159 it = sorted (it .items (), key = lambda x : x [0 ])
160- with cls .build (fpath ) as builder :
160+ with cls .build (path ) as builder :
161161 for key , val in it :
162162 builder .insert (key , val )
163- if fpath :
164- return cls (path = fpath )
163+ if path :
164+ return cls (path = path )
165165 else :
166166 return builder .get_map ()
167167
0 commit comments