Python numpy.testing.temppath() Examples
The following are 30
code examples of numpy.testing.temppath().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.testing
, or try the search function
.
Example #1
Source File: test_mrecords.py From pySINDy with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #2
Source File: util.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #3
Source File: util.py From recruit with Apache License 2.0 | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #4
Source File: test_mrecords.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #5
Source File: test_mrecords.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') self.assertTrue(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #6
Source File: util.py From keras-lambda with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #7
Source File: test_mrecords.py From recruit with Apache License 2.0 | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #8
Source File: util.py From twitter-stock-recommendation with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #9
Source File: test_mrecords.py From lambda-packs with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') self.assertTrue(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #10
Source File: test_mrecords.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #11
Source File: util.py From lambda-packs with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #12
Source File: util.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #13
Source File: util.py From vnpy_crypto with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #14
Source File: test_mrecords.py From vnpy_crypto with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #15
Source File: test_mrecords.py From coffeegrindsize with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #16
Source File: util.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #17
Source File: util.py From coffeegrindsize with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #18
Source File: test_mrecords.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #19
Source File: util.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #20
Source File: test_mrecords.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') self.assertTrue(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #21
Source File: test_mrecords.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #22
Source File: util.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #23
Source File: util.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #24
Source File: test_mrecords.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') assert_(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #25
Source File: test_mrecords.py From mxnet-lambda with Apache License 2.0 | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') self.assertTrue(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #26
Source File: util.py From mxnet-lambda with Apache License 2.0 | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #27
Source File: util.py From pySINDy with MIT License | 6 votes |
def build_code(source_code, options=[], skip=[], only=[], suffix=None, module_name=None): """ Compile and import Fortran code using f2py. """ if suffix is None: suffix = '.f' with temppath(suffix=suffix) as path: with open(path, 'w') as f: f.write(source_code) return build_module([path], options=options, skip=skip, only=only, module_name=module_name) # # Check if compilers are available at all... #
Example #28
Source File: test_mrecords.py From keras-lambda with MIT License | 6 votes |
def test_fromtextfile(self): # Tests reading from a text file. fcontent = ( """# 'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)' 'strings',1,1.0,'mixed column',,1 'with embedded "double quotes"',2,2.0,1.0,,1 'strings',3,3.0E5,3,,1 'strings',4,-1e-10,,,1 """) with temppath() as path: with open(path, 'w') as f: f.write(fcontent) mrectxt = fromtextfile(path, delimitor=',', varnames='ABCDEFG') self.assertTrue(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1, 1, 1, 1]) assert_equal(mrectxt.E._mask, [1, 1, 1, 1]) assert_equal(mrectxt.C, [1, 2, 3.e+5, -1e-10])
Example #29
Source File: test_npy_pkg_config.py From pySINDy with MIT License | 5 votes |
def test_simple(self): with temppath('foo.ini') as path: with open(path, 'w') as f: f.write(simple) pkg = os.path.splitext(path)[0] out = read_config(pkg) assert_(out.cflags() == simple_d['cflags']) assert_(out.libs() == simple_d['libflags']) assert_(out.name == simple_d['name']) assert_(out.version == simple_d['version'])
Example #30
Source File: test_npy_pkg_config.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_simple(self): with temppath('foo.ini') as path: with open(path, 'w') as f: f.write(simple) pkg = os.path.splitext(path)[0] out = read_config(pkg) self.assertTrue(out.cflags() == simple_d['cflags']) self.assertTrue(out.libs() == simple_d['libflags']) self.assertTrue(out.name == simple_d['name']) self.assertTrue(out.version == simple_d['version'])