MCPcopy
hub / github.com/numpy/numpy / _from_string

Function _from_string

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

Source from the content-addressed store, hash-verified

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

Callers 1

bmatFunction · 0.85

Calls 3

splitMethod · 0.80
stripMethod · 0.80
concatenateFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…