MCPcopy Index your code
hub / github.com/PyMySQL/PyMySQL / Charset

Class Charset

pymysql/charset.py:6–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class Charset:
7 def __init__(self, id, name, collation, is_default=False):
8 self.id, self.name, self.collation = id, name, collation
9 self.is_default = is_default
10
11 def __repr__(self):
12 return (
13 f"Charset(id={self.id}, name={self.name!r}, collation={self.collation!r})"
14 )
15
16 @property
17 def encoding(self):
18 name = self.name
19 if name in ("utf8mb4", "utf8mb3"):
20 return "utf8"
21 if name == "latin1":
22 return "cp1252"
23 if name == "koi8r":
24 return "koi8_r"
25 if name == "koi8u":
26 return "koi8_u"
27 return name
28
29 @property
30 def is_binary(self):
31 return self.id == 63
32
33
34class Charsets:

Callers 1

charset.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…