MCPcopy Create free account
hub / github.com/numpy/numpy / from_filename

Method from_filename

tools/npy_tempita/__init__.py:152–161  ·  view source on GitHub ↗
(cls, filename, namespace=None, encoding=None,
                      default_inherit=None, get_template=get_file_template)

Source from the content-addressed store, hash-verified

150 self.default_inherit = default_inherit
151
152 def from_filename(cls, filename, namespace=None, encoding=None,
153 default_inherit=None, get_template=get_file_template):
154 with open(filename, 'rb') as f:
155 c = f.read()
156 if encoding:
157 c = c.decode(encoding)
158 else:
159 c = c.decode('latin-1')
160 return cls(content=c, name=filename, namespace=namespace,
161 default_inherit=default_inherit, get_template=get_template)
162
163 from_filename = classmethod(from_filename)
164

Callers 1

get_file_templateFunction · 0.80

Calls 3

openFunction · 0.85
decodeMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected