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

Function _from_string

numpy/matrixlib/defmatrix.py:1011–1033  ·  view source on GitHub ↗
(str, gdict, ldict)

Source from the content-addressed store, hash-verified

1009 getI = I.fget
1010
1011def _from_string(str, gdict, ldict):
1012 rows = str.split(';')
1013 rowtup = []
1014 for row in rows:
1015 trow = row.split(',')
1016 newrow = []
1017 for x in trow:
1018 newrow.extend(x.split())
1019 trow = newrow
1020 coltup = []
1021 for col in trow:
1022 col = col.strip()
1023 try:
1024 thismat = ldict[col]
1025 except KeyError:
1026 try:
1027 thismat = gdict[col]
1028 except KeyError as e:
1029 raise NameError(f"name {col!r} is not defined") from None
1030
1031 coltup.append(thismat)
1032 rowtup.append(concatenate(coltup, axis=-1))
1033 return concatenate(rowtup, axis=0)
1034
1035
1036@set_module('numpy')

Callers 1

bmatFunction · 0.85

Calls 3

stripMethod · 0.80
concatenateFunction · 0.50
splitMethod · 0.45

Tested by

no test coverage detected