MCPcopy
hub / github.com/PyMySQL/PyMySQL / escape_item

Function escape_item

pymysql/converters.py:10–26  ·  view source on GitHub ↗
(val, charset, mapping=None)

Source from the content-addressed store, hash-verified

8
9
10def escape_item(val, charset, mapping=None):
11 if mapping is None:
12 mapping = encoders
13 encoder = mapping.get(type(val))
14
15 # Fallback to default when no encoder found
16 if not encoder:
17 try:
18 encoder = mapping[str]
19 except KeyError:
20 raise TypeError("no default type converter defined")
21
22 if encoder in (escape_dict, escape_sequence):
23 val = encoder(val, charset, mapping)
24 else:
25 val = encoder(val, mapping)
26 return val
27
28
29def escape_dict(val, charset, mapping=None):

Callers 2

escape_sequenceFunction · 0.85
escape_setFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…