MCPcopy
hub / github.com/django/django / has_bom

Function has_bom

django/core/management/commands/compilemessages.py:12–17  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

10
11
12def has_bom(fn):
13 with fn.open("rb") as f:
14 sample = f.read(4)
15 return sample.startswith(
16 (codecs.BOM_UTF8, codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE)
17 )
18
19
20def is_dir_writable(path):

Callers 1

compile_messagesMethod · 0.85

Calls 2

openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected