MCPcopy Index your code
hub / github.com/jisaacks/GitGutter / python_friendly_encoding

Method python_friendly_encoding

modules/view.py:144–160  ·  view source on GitHub ↗

Read view encoding and transform it for use with python. This method reads `origin_encoding` used by ConvertToUTF8 plugin and goes on with ST's encoding setting if required. The encoding is transformed to work with python's `codecs` module. Returns: stri

(self)

Source from the content-addressed store, hash-verified

142 return True
143
144 def python_friendly_encoding(self):
145 """Read view encoding and transform it for use with python.
146
147 This method reads `origin_encoding` used by ConvertToUTF8 plugin and
148 goes on with ST's encoding setting if required. The encoding is
149 transformed to work with python's `codecs` module.
150
151 Returns:
152 string: python compatible view encoding
153 """
154 encoding = self.view.settings().get('origin_encoding')
155 if not encoding:
156 encoding = self.view.encoding()
157 if encoding == 'Undefined':
158 encoding = self.view.settings().get('default_encoding', '')
159 return ENCODING_MAP.get(encoding, 'utf-8')
160 return encoding.replace(' ', '')

Callers 3

updateMethod · 0.95
_check_git_fileMethod · 0.80
_decode_diffMethod · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected