id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
9,800
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_license
def com_google_fonts_check_metadata_license(family_metadata): """METADATA.pb license is "APACHE2", "UFL" or "OFL"?""" licenses = ["APACHE2", "OFL", "UFL"] if family_metadata.license in licenses: yield PASS, ("Font license is declared" " in METADATA.pb as \"{}\"").format(family_metadata.licens...
python
def com_google_fonts_check_metadata_license(family_metadata): """METADATA.pb license is "APACHE2", "UFL" or "OFL"?""" licenses = ["APACHE2", "OFL", "UFL"] if family_metadata.license in licenses: yield PASS, ("Font license is declared" " in METADATA.pb as \"{}\"").format(family_metadata.licens...
[ "def", "com_google_fonts_check_metadata_license", "(", "family_metadata", ")", ":", "licenses", "=", "[", "\"APACHE2\"", ",", "\"OFL\"", ",", "\"UFL\"", "]", "if", "family_metadata", ".", "license", "in", "licenses", ":", "yield", "PASS", ",", "(", "\"Font license...
METADATA.pb license is "APACHE2", "UFL" or "OFL"?
[ "METADATA", ".", "pb", "license", "is", "APACHE2", "UFL", "or", "OFL", "?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1448-L1458
9,801
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_menu_and_latin
def com_google_fonts_check_metadata_menu_and_latin(family_metadata): """METADATA.pb should contain at least "menu" and "latin" subsets.""" missing = [] for s in ["menu", "latin"]: if s not in list(family_metadata.subsets): missing.append(s) if missing != []: yield FAIL, ("Subsets \"menu\" and \"l...
python
def com_google_fonts_check_metadata_menu_and_latin(family_metadata): """METADATA.pb should contain at least "menu" and "latin" subsets.""" missing = [] for s in ["menu", "latin"]: if s not in list(family_metadata.subsets): missing.append(s) if missing != []: yield FAIL, ("Subsets \"menu\" and \"l...
[ "def", "com_google_fonts_check_metadata_menu_and_latin", "(", "family_metadata", ")", ":", "missing", "=", "[", "]", "for", "s", "in", "[", "\"menu\"", ",", "\"latin\"", "]", ":", "if", "s", "not", "in", "list", "(", "family_metadata", ".", "subsets", ")", "...
METADATA.pb should contain at least "menu" and "latin" subsets.
[ "METADATA", ".", "pb", "should", "contain", "at", "least", "menu", "and", "latin", "subsets", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1465-L1477
9,802
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_subsets_order
def com_google_fonts_check_metadata_subsets_order(family_metadata): """METADATA.pb subsets should be alphabetically ordered.""" expected = list(sorted(family_metadata.subsets)) if list(family_metadata.subsets) != expected: yield FAIL, ("METADATA.pb subsets are not sorted " "in alphabetical o...
python
def com_google_fonts_check_metadata_subsets_order(family_metadata): """METADATA.pb subsets should be alphabetically ordered.""" expected = list(sorted(family_metadata.subsets)) if list(family_metadata.subsets) != expected: yield FAIL, ("METADATA.pb subsets are not sorted " "in alphabetical o...
[ "def", "com_google_fonts_check_metadata_subsets_order", "(", "family_metadata", ")", ":", "expected", "=", "list", "(", "sorted", "(", "family_metadata", ".", "subsets", ")", ")", "if", "list", "(", "family_metadata", ".", "subsets", ")", "!=", "expected", ":", ...
METADATA.pb subsets should be alphabetically ordered.
[ "METADATA", ".", "pb", "subsets", "should", "be", "alphabetically", "ordered", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1484-L1494
9,803
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_familyname
def com_google_fonts_check_metadata_familyname(family_metadata): """Check that METADATA.pb family values are all the same.""" name = "" fail = False for f in family_metadata.fonts: if name and f.name != name: fail = True name = f.name if fail: yield FAIL, ("METADATA.pb: Family name is not th...
python
def com_google_fonts_check_metadata_familyname(family_metadata): """Check that METADATA.pb family values are all the same.""" name = "" fail = False for f in family_metadata.fonts: if name and f.name != name: fail = True name = f.name if fail: yield FAIL, ("METADATA.pb: Family name is not th...
[ "def", "com_google_fonts_check_metadata_familyname", "(", "family_metadata", ")", ":", "name", "=", "\"\"", "fail", "=", "False", "for", "f", "in", "family_metadata", ".", "fonts", ":", "if", "name", "and", "f", ".", "name", "!=", "name", ":", "fail", "=", ...
Check that METADATA.pb family values are all the same.
[ "Check", "that", "METADATA", ".", "pb", "family", "values", "are", "all", "the", "same", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1520-L1533
9,804
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_nameid_family_name
def com_google_fonts_check_metadata_nameid_family_name(ttFont, font_metadata): """Checks METADATA.pb font.name field matches family name declared on the name table. """ from fontbakery.utils import get_name_entry_strings familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAPHIC_FAMILY_NAME) if not...
python
def com_google_fonts_check_metadata_nameid_family_name(ttFont, font_metadata): """Checks METADATA.pb font.name field matches family name declared on the name table. """ from fontbakery.utils import get_name_entry_strings familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAPHIC_FAMILY_NAME) if not...
[ "def", "com_google_fonts_check_metadata_nameid_family_name", "(", "ttFont", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "familynames", "=", "get_name_entry_strings", "(", "ttFont", ",", "NameID", ".", "TYPOGRAPHI...
Checks METADATA.pb font.name field matches family name declared on the name table.
[ "Checks", "METADATA", ".", "pb", "font", ".", "name", "field", "matches", "family", "name", "declared", "on", "the", "name", "table", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1593-L1617
9,805
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_nameid_post_script_name
def com_google_fonts_check_metadata_nameid_post_script_name(ttFont, font_metadata): """Checks METADATA.pb font.post_script_name matches postscript name declared on the name table. """ failed = False from fontbakery.utils import get_name_entry_strings postscript_names = get_name_entry_strings(ttFont, Nam...
python
def com_google_fonts_check_metadata_nameid_post_script_name(ttFont, font_metadata): """Checks METADATA.pb font.post_script_name matches postscript name declared on the name table. """ failed = False from fontbakery.utils import get_name_entry_strings postscript_names = get_name_entry_strings(ttFont, Nam...
[ "def", "com_google_fonts_check_metadata_nameid_post_script_name", "(", "ttFont", ",", "font_metadata", ")", ":", "failed", "=", "False", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "postscript_names", "=", "get_name_entry_strings", "(", "ttFont",...
Checks METADATA.pb font.post_script_name matches postscript name declared on the name table.
[ "Checks", "METADATA", ".", "pb", "font", ".", "post_script_name", "matches", "postscript", "name", "declared", "on", "the", "name", "table", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1623-L1650
9,806
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_nameid_full_name
def com_google_fonts_check_metadata_nameid_full_name(ttFont, font_metadata): """METADATA.pb font.full_name value matches fullname declared on the name table? """ from fontbakery.utils import get_name_entry_strings full_fontnames = get_name_entry_strings(ttFont, NameID.FULL_FONT_NAME) if len(full_fontnam...
python
def com_google_fonts_check_metadata_nameid_full_name(ttFont, font_metadata): """METADATA.pb font.full_name value matches fullname declared on the name table? """ from fontbakery.utils import get_name_entry_strings full_fontnames = get_name_entry_strings(ttFont, NameID.FULL_FONT_NAME) if len(full_fontnam...
[ "def", "com_google_fonts_check_metadata_nameid_full_name", "(", "ttFont", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "full_fontnames", "=", "get_name_entry_strings", "(", "ttFont", ",", "NameID", ".", "FULL_FONT...
METADATA.pb font.full_name value matches fullname declared on the name table?
[ "METADATA", ".", "pb", "font", ".", "full_name", "value", "matches", "fullname", "declared", "on", "the", "name", "table?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1657-L1680
9,807
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_nameid_font_name
def com_google_fonts_check_metadata_nameid_font_name(ttFont, style, font_metadata): """METADATA.pb font.name value should be same as the family name declared on the name table. """ from fontbakery.utils import get_name_entry_strings from fontbakery.constants import RIBBI_STYLE_NAMES if style in RIBBI_ST...
python
def com_google_fonts_check_metadata_nameid_font_name(ttFont, style, font_metadata): """METADATA.pb font.name value should be same as the family name declared on the name table. """ from fontbakery.utils import get_name_entry_strings from fontbakery.constants import RIBBI_STYLE_NAMES if style in RIBBI_ST...
[ "def", "com_google_fonts_check_metadata_nameid_font_name", "(", "ttFont", ",", "style", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "from", "fontbakery", ".", "constants", "import", "RIBBI_STYLE_NAMES", "if", "...
METADATA.pb font.name value should be same as the family name declared on the name table.
[ "METADATA", ".", "pb", "font", ".", "name", "value", "should", "be", "same", "as", "the", "family", "name", "declared", "on", "the", "name", "table", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1687-L1716
9,808
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_match_fullname_postscript
def com_google_fonts_check_metadata_match_fullname_postscript(font_metadata): """METADATA.pb font.full_name and font.post_script_name fields have equivalent values ? """ import re regex = re.compile(r"\W") post_script_name = regex.sub("", font_metadata.post_script_name) fullname = regex.sub("", font_me...
python
def com_google_fonts_check_metadata_match_fullname_postscript(font_metadata): """METADATA.pb font.full_name and font.post_script_name fields have equivalent values ? """ import re regex = re.compile(r"\W") post_script_name = regex.sub("", font_metadata.post_script_name) fullname = regex.sub("", font_me...
[ "def", "com_google_fonts_check_metadata_match_fullname_postscript", "(", "font_metadata", ")", ":", "import", "re", "regex", "=", "re", ".", "compile", "(", "r\"\\W\"", ")", "post_script_name", "=", "regex", ".", "sub", "(", "\"\"", ",", "font_metadata", ".", "pos...
METADATA.pb font.full_name and font.post_script_name fields have equivalent values ?
[ "METADATA", ".", "pb", "font", ".", "full_name", "and", "font", ".", "post_script_name", "fields", "have", "equivalent", "values", "?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1723-L1738
9,809
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_match_filename_postscript
def com_google_fonts_check_metadata_match_filename_postscript(font_metadata): """METADATA.pb font.filename and font.post_script_name fields have equivalent values? """ post_script_name = font_metadata.post_script_name filename = os.path.splitext(font_metadata.filename)[0] if filename != post_script_name...
python
def com_google_fonts_check_metadata_match_filename_postscript(font_metadata): """METADATA.pb font.filename and font.post_script_name fields have equivalent values? """ post_script_name = font_metadata.post_script_name filename = os.path.splitext(font_metadata.filename)[0] if filename != post_script_name...
[ "def", "com_google_fonts_check_metadata_match_filename_postscript", "(", "font_metadata", ")", ":", "post_script_name", "=", "font_metadata", ".", "post_script_name", "filename", "=", "os", ".", "path", ".", "splitext", "(", "font_metadata", ".", "filename", ")", "[", ...
METADATA.pb font.filename and font.post_script_name fields have equivalent values?
[ "METADATA", ".", "pb", "font", ".", "filename", "and", "font", ".", "post_script_name", "fields", "have", "equivalent", "values?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1748-L1762
9,810
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_valid_name_values
def com_google_fonts_check_metadata_valid_name_values(style, font_metadata, font_familynames, typographic_familynames): """METADATA.pb font.name field conta...
python
def com_google_fonts_check_metadata_valid_name_values(style, font_metadata, font_familynames, typographic_familynames): """METADATA.pb font.name field conta...
[ "def", "com_google_fonts_check_metadata_valid_name_values", "(", "style", ",", "font_metadata", ",", "font_familynames", ",", "typographic_familynames", ")", ":", "from", "fontbakery", ".", "constants", "import", "RIBBI_STYLE_NAMES", "if", "style", "in", "RIBBI_STYLE_NAMES"...
METADATA.pb font.name field contains font name in right format?
[ "METADATA", ".", "pb", "font", ".", "name", "field", "contains", "font", "name", "in", "right", "format?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1792-L1813
9,811
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_valid_full_name_values
def com_google_fonts_check_metadata_valid_full_name_values(style, font_metadata, font_familynames, typographic_familynames): """METADATA.pb f...
python
def com_google_fonts_check_metadata_valid_full_name_values(style, font_metadata, font_familynames, typographic_familynames): """METADATA.pb f...
[ "def", "com_google_fonts_check_metadata_valid_full_name_values", "(", "style", ",", "font_metadata", ",", "font_familynames", ",", "typographic_familynames", ")", ":", "from", "fontbakery", ".", "constants", "import", "RIBBI_STYLE_NAMES", "if", "style", "in", "RIBBI_STYLE_N...
METADATA.pb font.full_name field contains font name in right format?
[ "METADATA", ".", "pb", "font", ".", "full_name", "field", "contains", "font", "name", "in", "right", "format?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1821-L1846
9,812
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_valid_filename_values
def com_google_fonts_check_metadata_valid_filename_values(font, family_metadata): """METADATA.pb font.filename field contains font name in right format?""" expected = os.path.basename(font) failed = True for font_metadata in family_metadata.fonts: if...
python
def com_google_fonts_check_metadata_valid_filename_values(font, family_metadata): """METADATA.pb font.filename field contains font name in right format?""" expected = os.path.basename(font) failed = True for font_metadata in family_metadata.fonts: if...
[ "def", "com_google_fonts_check_metadata_valid_filename_values", "(", "font", ",", "family_metadata", ")", ":", "expected", "=", "os", ".", "path", ".", "basename", "(", "font", ")", "failed", "=", "True", "for", "font_metadata", "in", "family_metadata", ".", "font...
METADATA.pb font.filename field contains font name in right format?
[ "METADATA", ".", "pb", "font", ".", "filename", "field", "contains", "font", "name", "in", "right", "format?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1855-L1868
9,813
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_valid_post_script_name_values
def com_google_fonts_check_metadata_valid_post_script_name_values(font_metadata, font_familynames): """METADATA.pb font.post_script_name field contains font name in right format? """ for font_familyname in font_familynames: psname = "".joi...
python
def com_google_fonts_check_metadata_valid_post_script_name_values(font_metadata, font_familynames): """METADATA.pb font.post_script_name field contains font name in right format? """ for font_familyname in font_familynames: psname = "".joi...
[ "def", "com_google_fonts_check_metadata_valid_post_script_name_values", "(", "font_metadata", ",", "font_familynames", ")", ":", "for", "font_familyname", "in", "font_familynames", ":", "psname", "=", "\"\"", ".", "join", "(", "str", "(", "font_familyname", ")", ".", ...
METADATA.pb font.post_script_name field contains font name in right format?
[ "METADATA", ".", "pb", "font", ".", "post_script_name", "field", "contains", "font", "name", "in", "right", "format?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1876-L1890
9,814
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_valid_copyright
def com_google_fonts_check_metadata_valid_copyright(font_metadata): """Copyright notices match canonical pattern in METADATA.pb""" import re string = font_metadata.copyright does_match = re.search(r'Copyright [0-9]{4} The .* Project Authors \([^\@]*\)', string) if does_match: yi...
python
def com_google_fonts_check_metadata_valid_copyright(font_metadata): """Copyright notices match canonical pattern in METADATA.pb""" import re string = font_metadata.copyright does_match = re.search(r'Copyright [0-9]{4} The .* Project Authors \([^\@]*\)', string) if does_match: yi...
[ "def", "com_google_fonts_check_metadata_valid_copyright", "(", "font_metadata", ")", ":", "import", "re", "string", "=", "font_metadata", ".", "copyright", "does_match", "=", "re", ".", "search", "(", "r'Copyright [0-9]{4} The .* Project Authors \\([^\\@]*\\)'", ",", "strin...
Copyright notices match canonical pattern in METADATA.pb
[ "Copyright", "notices", "match", "canonical", "pattern", "in", "METADATA", ".", "pb" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1897-L1911
9,815
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_font_copyright
def com_google_fonts_check_font_copyright(ttFont): """Copyright notices match canonical pattern in fonts""" import re from fontbakery.utils import get_name_entry_strings failed = False for string in get_name_entry_strings(ttFont, NameID.COPYRIGHT_NOTICE): does_match = re.search(r'Copyright [0-9]{4} The ....
python
def com_google_fonts_check_font_copyright(ttFont): """Copyright notices match canonical pattern in fonts""" import re from fontbakery.utils import get_name_entry_strings failed = False for string in get_name_entry_strings(ttFont, NameID.COPYRIGHT_NOTICE): does_match = re.search(r'Copyright [0-9]{4} The ....
[ "def", "com_google_fonts_check_font_copyright", "(", "ttFont", ")", ":", "import", "re", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "failed", "=", "False", "for", "string", "in", "get_name_entry_strings", "(", "ttFont", ",", "NameID", "....
Copyright notices match canonical pattern in fonts
[ "Copyright", "notices", "match", "canonical", "pattern", "in", "fonts" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1917-L1938
9,816
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_italic_style
def com_google_fonts_check_metadata_italic_style(ttFont, font_metadata): """METADATA.pb font.style "italic" matches font internals?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import MacStyle if font_metadata.style != "italic": yield SKIP, "This check only applies to it...
python
def com_google_fonts_check_metadata_italic_style(ttFont, font_metadata): """METADATA.pb font.style "italic" matches font internals?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import MacStyle if font_metadata.style != "italic": yield SKIP, "This check only applies to it...
[ "def", "com_google_fonts_check_metadata_italic_style", "(", "ttFont", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "from", "fontbakery", ".", "constants", "import", "MacStyle", "if", "font_metadata", ".", "style...
METADATA.pb font.style "italic" matches font internals?
[ "METADATA", ".", "pb", "font", ".", "style", "italic", "matches", "font", "internals?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2029-L2061
9,817
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_normal_style
def com_google_fonts_check_metadata_normal_style(ttFont, font_metadata): """METADATA.pb font.style "normal" matches font internals?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import MacStyle if font_metadata.style != "normal": yield SKIP, "This check only applies to no...
python
def com_google_fonts_check_metadata_normal_style(ttFont, font_metadata): """METADATA.pb font.style "normal" matches font internals?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import MacStyle if font_metadata.style != "normal": yield SKIP, "This check only applies to no...
[ "def", "com_google_fonts_check_metadata_normal_style", "(", "ttFont", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "from", "fontbakery", ".", "constants", "import", "MacStyle", "if", "font_metadata", ".", "style...
METADATA.pb font.style "normal" matches font internals?
[ "METADATA", ".", "pb", "font", ".", "style", "normal", "matches", "font", "internals?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2068-L2106
9,818
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_nameid_family_and_full_names
def com_google_fonts_check_metadata_nameid_family_and_full_names(ttFont, font_metadata): """METADATA.pb font.name and font.full_name fields match the values declared on the name table? """ from fontbakery.utils import get_name_entry_strings font_familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAP...
python
def com_google_fonts_check_metadata_nameid_family_and_full_names(ttFont, font_metadata): """METADATA.pb font.name and font.full_name fields match the values declared on the name table? """ from fontbakery.utils import get_name_entry_strings font_familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAP...
[ "def", "com_google_fonts_check_metadata_nameid_family_and_full_names", "(", "ttFont", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "font_familynames", "=", "get_name_entry_strings", "(", "ttFont", ",", "NameID", "."...
METADATA.pb font.name and font.full_name fields match the values declared on the name table?
[ "METADATA", ".", "pb", "font", ".", "name", "and", "font", ".", "full_name", "fields", "match", "the", "values", "declared", "on", "the", "name", "table?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2113-L2141
9,819
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_match_weight_postscript
def com_google_fonts_check_metadata_match_weight_postscript(font_metadata): """METADATA.pb weight matches postScriptName.""" WEIGHTS = { "Thin": 100, "ThinItalic": 100, "ExtraLight": 200, "ExtraLightItalic": 200, "Light": 300, "LightItalic": 300, "Regular": 400, "Italic": 400, "M...
python
def com_google_fonts_check_metadata_match_weight_postscript(font_metadata): """METADATA.pb weight matches postScriptName.""" WEIGHTS = { "Thin": 100, "ThinItalic": 100, "ExtraLight": 200, "ExtraLightItalic": 200, "Light": 300, "LightItalic": 300, "Regular": 400, "Italic": 400, "M...
[ "def", "com_google_fonts_check_metadata_match_weight_postscript", "(", "font_metadata", ")", ":", "WEIGHTS", "=", "{", "\"Thin\"", ":", "100", ",", "\"ThinItalic\"", ":", "100", ",", "\"ExtraLight\"", ":", "200", ",", "\"ExtraLightItalic\"", ":", "200", ",", "\"Ligh...
METADATA.pb weight matches postScriptName.
[ "METADATA", ".", "pb", "weight", "matches", "postScriptName", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2259-L2299
9,820
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_unitsperem_strict
def com_google_fonts_check_unitsperem_strict(ttFont): """ Stricter unitsPerEm criteria for Google Fonts. """ upm_height = ttFont["head"].unitsPerEm ACCEPTABLE = [16, 32, 64, 128, 256, 500, 512, 1000, 1024, 2000, 2048] if upm_height not in ACCEPTABLE: yield FAIL, (f"Font em size (unitsPerEm) ...
python
def com_google_fonts_check_unitsperem_strict(ttFont): """ Stricter unitsPerEm criteria for Google Fonts. """ upm_height = ttFont["head"].unitsPerEm ACCEPTABLE = [16, 32, 64, 128, 256, 500, 512, 1000, 1024, 2000, 2048] if upm_height not in ACCEPTABLE: yield FAIL, (f"Font em size (unitsPerEm) ...
[ "def", "com_google_fonts_check_unitsperem_strict", "(", "ttFont", ")", ":", "upm_height", "=", "ttFont", "[", "\"head\"", "]", ".", "unitsPerEm", "ACCEPTABLE", "=", "[", "16", ",", "32", ",", "64", ",", "128", ",", "256", ",", "500", ",", "512", ",", "10...
Stricter unitsPerEm criteria for Google Fonts.
[ "Stricter", "unitsPerEm", "criteria", "for", "Google", "Fonts", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2367-L2387
9,821
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
remote_styles
def remote_styles(family_metadata): """Get a dictionary of TTFont objects of all font files of a given family as currently hosted at Google Fonts. """ def download_family_from_Google_Fonts(family_name): """Return a zipfile containing a font family hosted on fonts.google.com""" from zipfile import Zi...
python
def remote_styles(family_metadata): """Get a dictionary of TTFont objects of all font files of a given family as currently hosted at Google Fonts. """ def download_family_from_Google_Fonts(family_name): """Return a zipfile containing a font family hosted on fonts.google.com""" from zipfile import Zi...
[ "def", "remote_styles", "(", "family_metadata", ")", ":", "def", "download_family_from_Google_Fonts", "(", "family_name", ")", ":", "\"\"\"Return a zipfile containing a font family hosted on fonts.google.com\"\"\"", "from", "zipfile", "import", "ZipFile", "from", "fontbakery", ...
Get a dictionary of TTFont objects of all font files of a given family as currently hosted at Google Fonts.
[ "Get", "a", "dictionary", "of", "TTFont", "objects", "of", "all", "font", "files", "of", "a", "given", "family", "as", "currently", "hosted", "at", "Google", "Fonts", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2391-L2428
9,822
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
github_gfonts_ttFont
def github_gfonts_ttFont(ttFont, license): """Get a TTFont object of a font downloaded from Google Fonts git repository. """ if not license: return from fontbakery.utils import download_file from fontTools.ttLib import TTFont from urllib.request import HTTPError LICENSE_DIRECTORY = { "OFL.tx...
python
def github_gfonts_ttFont(ttFont, license): """Get a TTFont object of a font downloaded from Google Fonts git repository. """ if not license: return from fontbakery.utils import download_file from fontTools.ttLib import TTFont from urllib.request import HTTPError LICENSE_DIRECTORY = { "OFL.tx...
[ "def", "github_gfonts_ttFont", "(", "ttFont", ",", "license", ")", ":", "if", "not", "license", ":", "return", "from", "fontbakery", ".", "utils", "import", "download_file", "from", "fontTools", ".", "ttLib", "import", "TTFont", "from", "urllib", ".", "request...
Get a TTFont object of a font downloaded from Google Fonts git repository.
[ "Get", "a", "TTFont", "object", "of", "a", "font", "downloaded", "from", "Google", "Fonts", "git", "repository", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2442-L2467
9,823
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_version_bump
def com_google_fonts_check_version_bump(ttFont, api_gfonts_ttFont, github_gfonts_ttFont): """Version number has increased since previous release on Google Fonts?""" v_number = ttFont["head"].fontRevision api_gfonts_v_number = api_gfon...
python
def com_google_fonts_check_version_bump(ttFont, api_gfonts_ttFont, github_gfonts_ttFont): """Version number has increased since previous release on Google Fonts?""" v_number = ttFont["head"].fontRevision api_gfonts_v_number = api_gfon...
[ "def", "com_google_fonts_check_version_bump", "(", "ttFont", ",", "api_gfonts_ttFont", ",", "github_gfonts_ttFont", ")", ":", "v_number", "=", "ttFont", "[", "\"head\"", "]", ".", "fontRevision", "api_gfonts_v_number", "=", "api_gfonts_ttFont", "[", "\"head\"", "]", "...
Version number has increased since previous release on Google Fonts?
[ "Version", "number", "has", "increased", "since", "previous", "release", "on", "Google", "Fonts?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2475-L2515
9,824
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_production_glyphs_similarity
def com_google_fonts_check_production_glyphs_similarity(ttFont, api_gfonts_ttFont): """Glyphs are similiar to Google Fonts version?""" def glyphs_surface_area(ttFont): """Calculate the surface area of a glyph's ink""" from fontTools.pens.areaPen import AreaPen glyphs = {} glyph_set = ttFont.getGlyp...
python
def com_google_fonts_check_production_glyphs_similarity(ttFont, api_gfonts_ttFont): """Glyphs are similiar to Google Fonts version?""" def glyphs_surface_area(ttFont): """Calculate the surface area of a glyph's ink""" from fontTools.pens.areaPen import AreaPen glyphs = {} glyph_set = ttFont.getGlyp...
[ "def", "com_google_fonts_check_production_glyphs_similarity", "(", "ttFont", ",", "api_gfonts_ttFont", ")", ":", "def", "glyphs_surface_area", "(", "ttFont", ")", ":", "\"\"\"Calculate the surface area of a glyph's ink\"\"\"", "from", "fontTools", ".", "pens", ".", "areaPen",...
Glyphs are similiar to Google Fonts version?
[ "Glyphs", "are", "similiar", "to", "Google", "Fonts", "version?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2522-L2562
9,825
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_italic_angle
def com_google_fonts_check_italic_angle(ttFont, style): """Checking post.italicAngle value.""" failed = False value = ttFont["post"].italicAngle # Checking that italicAngle <= 0 if value > 0: failed = True yield FAIL, Message("positive", ("The value of post.italicAngle is posi...
python
def com_google_fonts_check_italic_angle(ttFont, style): """Checking post.italicAngle value.""" failed = False value = ttFont["post"].italicAngle # Checking that italicAngle <= 0 if value > 0: failed = True yield FAIL, Message("positive", ("The value of post.italicAngle is posi...
[ "def", "com_google_fonts_check_italic_angle", "(", "ttFont", ",", "style", ")", ":", "failed", "=", "False", "value", "=", "ttFont", "[", "\"post\"", "]", ".", "italicAngle", "# Checking that italicAngle <= 0", "if", "value", ">", "0", ":", "failed", "=", "True"...
Checking post.italicAngle value.
[ "Checking", "post", ".", "italicAngle", "value", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2610-L2655
9,826
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_mac_style
def com_google_fonts_check_mac_style(ttFont, style): """Checking head.macStyle value.""" from fontbakery.utils import check_bit_entry from fontbakery.constants import MacStyle # Checking macStyle ITALIC bit: expected = "Italic" in style yield check_bit_entry(ttFont, "head", "macStyle", ...
python
def com_google_fonts_check_mac_style(ttFont, style): """Checking head.macStyle value.""" from fontbakery.utils import check_bit_entry from fontbakery.constants import MacStyle # Checking macStyle ITALIC bit: expected = "Italic" in style yield check_bit_entry(ttFont, "head", "macStyle", ...
[ "def", "com_google_fonts_check_mac_style", "(", "ttFont", ",", "style", ")", ":", "from", "fontbakery", ".", "utils", "import", "check_bit_entry", "from", "fontbakery", ".", "constants", "import", "MacStyle", "# Checking macStyle ITALIC bit:", "expected", "=", "\"Italic...
Checking head.macStyle value.
[ "Checking", "head", ".", "macStyle", "value", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2668-L2685
9,827
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_contour_count
def com_google_fonts_check_contour_count(ttFont): """Check if each glyph has the recommended amount of contours. This check is useful to assure glyphs aren't incorrectly constructed. The desired_glyph_data module contains the 'recommended' countour count for encoded glyphs. The contour counts are derived from...
python
def com_google_fonts_check_contour_count(ttFont): """Check if each glyph has the recommended amount of contours. This check is useful to assure glyphs aren't incorrectly constructed. The desired_glyph_data module contains the 'recommended' countour count for encoded glyphs. The contour counts are derived from...
[ "def", "com_google_fonts_check_contour_count", "(", "ttFont", ")", ":", "from", "fontbakery", ".", "glyphdata", "import", "desired_glyph_data", "as", "glyph_data", "from", "fontbakery", ".", "utils", "import", "(", "get_font_glyph_data", ",", "pretty_print_list", ")", ...
Check if each glyph has the recommended amount of contours. This check is useful to assure glyphs aren't incorrectly constructed. The desired_glyph_data module contains the 'recommended' countour count for encoded glyphs. The contour counts are derived from fonts which were chosen for their quality and unique...
[ "Check", "if", "each", "glyph", "has", "the", "recommended", "amount", "of", "contours", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2706-L2772
9,828
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_metadata_nameid_copyright
def com_google_fonts_check_metadata_nameid_copyright(ttFont, font_metadata): """Copyright field for this font on METADATA.pb matches all copyright notice entries on the name table ?""" failed = False for nameRecord in ttFont['name'].names: string = nameRecord.string.decode(nameRecord.getEncoding()) i...
python
def com_google_fonts_check_metadata_nameid_copyright(ttFont, font_metadata): """Copyright field for this font on METADATA.pb matches all copyright notice entries on the name table ?""" failed = False for nameRecord in ttFont['name'].names: string = nameRecord.string.decode(nameRecord.getEncoding()) i...
[ "def", "com_google_fonts_check_metadata_nameid_copyright", "(", "ttFont", ",", "font_metadata", ")", ":", "failed", "=", "False", "for", "nameRecord", "in", "ttFont", "[", "'name'", "]", ".", "names", ":", "string", "=", "nameRecord", ".", "string", ".", "decode...
Copyright field for this font on METADATA.pb matches all copyright notice entries on the name table ?
[ "Copyright", "field", "for", "this", "font", "on", "METADATA", ".", "pb", "matches", "all", "copyright", "notice", "entries", "on", "the", "name", "table", "?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2800-L2816
9,829
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_name_mandatory_entries
def com_google_fonts_check_name_mandatory_entries(ttFont, style): """Font has all mandatory 'name' table entries ?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import RIBBI_STYLE_NAMES required_nameIDs = [NameID.FONT_FAMILY_NAME, NameID.FONT_SUBFAMILY_N...
python
def com_google_fonts_check_name_mandatory_entries(ttFont, style): """Font has all mandatory 'name' table entries ?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import RIBBI_STYLE_NAMES required_nameIDs = [NameID.FONT_FAMILY_NAME, NameID.FONT_SUBFAMILY_N...
[ "def", "com_google_fonts_check_name_mandatory_entries", "(", "ttFont", ",", "style", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "from", "fontbakery", ".", "constants", "import", "RIBBI_STYLE_NAMES", "required_nameIDs", "=", "[", "N...
Font has all mandatory 'name' table entries ?
[ "Font", "has", "all", "mandatory", "name", "table", "entries", "?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2868-L2888
9,830
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_name_copyright_length
def com_google_fonts_check_name_copyright_length(ttFont): """ Length of copyright notice must not exceed 500 characters. """ from fontbakery.utils import get_name_entries failed = False for notice in get_name_entries(ttFont, NameID.COPYRIGHT_NOTICE): notice_str = notice.string.decode(notice.getEncoding()) ...
python
def com_google_fonts_check_name_copyright_length(ttFont): """ Length of copyright notice must not exceed 500 characters. """ from fontbakery.utils import get_name_entries failed = False for notice in get_name_entries(ttFont, NameID.COPYRIGHT_NOTICE): notice_str = notice.string.decode(notice.getEncoding()) ...
[ "def", "com_google_fonts_check_name_copyright_length", "(", "ttFont", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entries", "failed", "=", "False", "for", "notice", "in", "get_name_entries", "(", "ttFont", ",", "NameID", ".", "COPYRIGHT_NOTICE", ...
Length of copyright notice must not exceed 500 characters.
[ "Length", "of", "copyright", "notice", "must", "not", "exceed", "500", "characters", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3181-L3196
9,831
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_fontv
def com_google_fonts_check_fontv(ttFont): """ Check for font-v versioning """ from fontv.libfv import FontVersion fv = FontVersion(ttFont) if fv.version and (fv.is_development or fv.is_release): yield PASS, "Font version string looks GREAT!" else: yield INFO, ("Version string is: \"{}\"\n" ...
python
def com_google_fonts_check_fontv(ttFont): """ Check for font-v versioning """ from fontv.libfv import FontVersion fv = FontVersion(ttFont) if fv.version and (fv.is_development or fv.is_release): yield PASS, "Font version string looks GREAT!" else: yield INFO, ("Version string is: \"{}\"\n" ...
[ "def", "com_google_fonts_check_fontv", "(", "ttFont", ")", ":", "from", "fontv", ".", "libfv", "import", "FontVersion", "fv", "=", "FontVersion", "(", "ttFont", ")", "if", "fv", ".", "version", "and", "(", "fv", ".", "is_development", "or", "fv", ".", "is_...
Check for font-v versioning
[ "Check", "for", "font", "-", "v", "versioning" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3239-L3252
9,832
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_negative_advance_width
def com_google_fonts_check_negative_advance_width(ttFont): """ Check that advance widths cannot be inferred as negative. """ failed = False for glyphName in ttFont["glyf"].glyphs: coords = ttFont["glyf"][glyphName].coordinates rightX = coords[-3][0] leftX = coords[-4][0] advwidth = rightX - leftX ...
python
def com_google_fonts_check_negative_advance_width(ttFont): """ Check that advance widths cannot be inferred as negative. """ failed = False for glyphName in ttFont["glyf"].glyphs: coords = ttFont["glyf"][glyphName].coordinates rightX = coords[-3][0] leftX = coords[-4][0] advwidth = rightX - leftX ...
[ "def", "com_google_fonts_check_negative_advance_width", "(", "ttFont", ")", ":", "failed", "=", "False", "for", "glyphName", "in", "ttFont", "[", "\"glyf\"", "]", ".", "glyphs", ":", "coords", "=", "ttFont", "[", "\"glyf\"", "]", "[", "glyphName", "]", ".", ...
Check that advance widths cannot be inferred as negative.
[ "Check", "that", "advance", "widths", "cannot", "be", "inferred", "as", "negative", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3284-L3300
9,833
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_varfont_generate_static
def com_google_fonts_check_varfont_generate_static(ttFont): """ Check a static ttf can be generated from a variable font. """ import tempfile from fontTools.varLib import mutator try: loc = {k.axisTag: float((k.maxValue + k.minValue) / 2) for k in ttFont['fvar'].axes} with tempfile.Temporary...
python
def com_google_fonts_check_varfont_generate_static(ttFont): """ Check a static ttf can be generated from a variable font. """ import tempfile from fontTools.varLib import mutator try: loc = {k.axisTag: float((k.maxValue + k.minValue) / 2) for k in ttFont['fvar'].axes} with tempfile.Temporary...
[ "def", "com_google_fonts_check_varfont_generate_static", "(", "ttFont", ")", ":", "import", "tempfile", "from", "fontTools", ".", "varLib", "import", "mutator", "try", ":", "loc", "=", "{", "k", ".", "axisTag", ":", "float", "(", "(", "k", ".", "maxValue", "...
Check a static ttf can be generated from a variable font.
[ "Check", "a", "static", "ttf", "can", "be", "generated", "from", "a", "variable", "font", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3326-L3341
9,834
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_smart_dropout
def com_google_fonts_check_smart_dropout(ttFont): """Font enables smart dropout control in "prep" table instructions? B8 01 FF PUSHW 0x01FF 85 SCANCTRL (unconditinally turn on dropout control mode) B0 04 PUSHB 0x04 8D SCANTYPE (enable smart dropout control) ...
python
def com_google_fonts_check_smart_dropout(ttFont): """Font enables smart dropout control in "prep" table instructions? B8 01 FF PUSHW 0x01FF 85 SCANCTRL (unconditinally turn on dropout control mode) B0 04 PUSHB 0x04 8D SCANTYPE (enable smart dropout control) ...
[ "def", "com_google_fonts_check_smart_dropout", "(", "ttFont", ")", ":", "INSTRUCTIONS", "=", "b\"\\xb8\\x01\\xff\\x85\\xb0\\x04\\x8d\"", "if", "(", "\"prep\"", "in", "ttFont", "and", "INSTRUCTIONS", "in", "ttFont", "[", "\"prep\"", "]", ".", "program", ".", "getByteco...
Font enables smart dropout control in "prep" table instructions? B8 01 FF PUSHW 0x01FF 85 SCANCTRL (unconditinally turn on dropout control mode) B0 04 PUSHB 0x04 8D SCANTYPE (enable smart dropout control) Smart dropout control means activating rules 1, 2 an...
[ "Font", "enables", "smart", "dropout", "control", "in", "prep", "table", "instructions?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3417-L3450
9,835
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_aat
def com_google_fonts_check_aat(ttFont): """Are there unwanted Apple tables?""" UNWANTED_TABLES = { 'EBSC', 'Zaph', 'acnt', 'ankr', 'bdat', 'bhed', 'bloc', 'bmap', 'bsln', 'fdsc', 'feat', 'fond', 'gcid', 'just', 'kerx', 'lcar', 'ltag', 'mort', 'morx', 'opbd', 'prop', 'trak', 'xref' } unwanted_tab...
python
def com_google_fonts_check_aat(ttFont): """Are there unwanted Apple tables?""" UNWANTED_TABLES = { 'EBSC', 'Zaph', 'acnt', 'ankr', 'bdat', 'bhed', 'bloc', 'bmap', 'bsln', 'fdsc', 'feat', 'fond', 'gcid', 'just', 'kerx', 'lcar', 'ltag', 'mort', 'morx', 'opbd', 'prop', 'trak', 'xref' } unwanted_tab...
[ "def", "com_google_fonts_check_aat", "(", "ttFont", ")", ":", "UNWANTED_TABLES", "=", "{", "'EBSC'", ",", "'Zaph'", ",", "'acnt'", ",", "'ankr'", ",", "'bdat'", ",", "'bhed'", ",", "'bloc'", ",", "'bmap'", ",", "'bsln'", ",", "'fdsc'", ",", "'feat'", ",", ...
Are there unwanted Apple tables?
[ "Are", "there", "unwanted", "Apple", "tables?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3477-L3497
9,836
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_fvar_name_entries
def com_google_fonts_check_fvar_name_entries(ttFont): """All name entries referenced by fvar instances exist on the name table?""" failed = False for instance in ttFont["fvar"].instances: entries = [entry for entry in ttFont["name"].names if entry.nameID == instance.subfamilyNameID] if len(entries) == 0...
python
def com_google_fonts_check_fvar_name_entries(ttFont): """All name entries referenced by fvar instances exist on the name table?""" failed = False for instance in ttFont["fvar"].instances: entries = [entry for entry in ttFont["name"].names if entry.nameID == instance.subfamilyNameID] if len(entries) == 0...
[ "def", "com_google_fonts_check_fvar_name_entries", "(", "ttFont", ")", ":", "failed", "=", "False", "for", "instance", "in", "ttFont", "[", "\"fvar\"", "]", ".", "instances", ":", "entries", "=", "[", "entry", "for", "entry", "in", "ttFont", "[", "\"name\"", ...
All name entries referenced by fvar instances exist on the name table?
[ "All", "name", "entries", "referenced", "by", "fvar", "instances", "exist", "on", "the", "name", "table?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3509-L3522
9,837
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_varfont_weight_instances
def com_google_fonts_check_varfont_weight_instances(ttFont): """Variable font weight coordinates must be multiples of 100.""" failed = False for instance in ttFont["fvar"].instances: if 'wght' in instance.coordinates and instance.coordinates['wght'] % 100 != 0: failed = True yield FAIL, ("Found a...
python
def com_google_fonts_check_varfont_weight_instances(ttFont): """Variable font weight coordinates must be multiples of 100.""" failed = False for instance in ttFont["fvar"].instances: if 'wght' in instance.coordinates and instance.coordinates['wght'] % 100 != 0: failed = True yield FAIL, ("Found a...
[ "def", "com_google_fonts_check_varfont_weight_instances", "(", "ttFont", ")", ":", "failed", "=", "False", "for", "instance", "in", "ttFont", "[", "\"fvar\"", "]", ".", "instances", ":", "if", "'wght'", "in", "instance", ".", "coordinates", "and", "instance", "....
Variable font weight coordinates must be multiples of 100.
[ "Variable", "font", "weight", "coordinates", "must", "be", "multiples", "of", "100", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3549-L3561
9,838
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_family_tnum_horizontal_metrics
def com_google_fonts_check_family_tnum_horizontal_metrics(fonts): """All tabular figures must have the same width across the RIBBI-family.""" from fontbakery.constants import RIBBI_STYLE_NAMES from fontTools.ttLib import TTFont RIBBI_ttFonts = [TTFont(f) for f in fonts if s...
python
def com_google_fonts_check_family_tnum_horizontal_metrics(fonts): """All tabular figures must have the same width across the RIBBI-family.""" from fontbakery.constants import RIBBI_STYLE_NAMES from fontTools.ttLib import TTFont RIBBI_ttFonts = [TTFont(f) for f in fonts if s...
[ "def", "com_google_fonts_check_family_tnum_horizontal_metrics", "(", "fonts", ")", ":", "from", "fontbakery", ".", "constants", "import", "RIBBI_STYLE_NAMES", "from", "fontTools", ".", "ttLib", "import", "TTFont", "RIBBI_ttFonts", "=", "[", "TTFont", "(", "f", ")", ...
All tabular figures must have the same width across the RIBBI-family.
[ "All", "tabular", "figures", "must", "have", "the", "same", "width", "across", "the", "RIBBI", "-", "family", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3579-L3611
9,839
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_ligature_carets
def com_google_fonts_check_ligature_carets(ttFont, ligature_glyphs): """Are there caret positions declared for every ligature?""" if ligature_glyphs == -1: yield FAIL, Message("malformed", "Failed to lookup ligatures." " This font file seems to be malformed." " Fo...
python
def com_google_fonts_check_ligature_carets(ttFont, ligature_glyphs): """Are there caret positions declared for every ligature?""" if ligature_glyphs == -1: yield FAIL, Message("malformed", "Failed to lookup ligatures." " This font file seems to be malformed." " Fo...
[ "def", "com_google_fonts_check_ligature_carets", "(", "ttFont", ",", "ligature_glyphs", ")", ":", "if", "ligature_glyphs", "==", "-", "1", ":", "yield", "FAIL", ",", "Message", "(", "\"malformed\"", ",", "\"Failed to lookup ligatures.\"", "\" This font file seems to be ma...
Are there caret positions declared for every ligature?
[ "Are", "there", "caret", "positions", "declared", "for", "every", "ligature?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3660-L3693
9,840
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_kerning_for_non_ligated_sequences
def com_google_fonts_check_kerning_for_non_ligated_sequences(ttFont, ligatures, has_kerning_info): """Is there kerning info for non-ligated sequences?""" def look_for_nonligated_kern_info(table): for pairpos in table.SubTable: for i, glyph in enumerate(pairpos.Coverage.glyphs): if not hasattr(pai...
python
def com_google_fonts_check_kerning_for_non_ligated_sequences(ttFont, ligatures, has_kerning_info): """Is there kerning info for non-ligated sequences?""" def look_for_nonligated_kern_info(table): for pairpos in table.SubTable: for i, glyph in enumerate(pairpos.Coverage.glyphs): if not hasattr(pai...
[ "def", "com_google_fonts_check_kerning_for_non_ligated_sequences", "(", "ttFont", ",", "ligatures", ",", "has_kerning_info", ")", ":", "def", "look_for_nonligated_kern_info", "(", "table", ")", ":", "for", "pairpos", "in", "table", ".", "SubTable", ":", "for", "i", ...
Is there kerning info for non-ligated sequences?
[ "Is", "there", "kerning", "info", "for", "non", "-", "ligated", "sequences?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3708-L3755
9,841
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_name_family_and_style_max_length
def com_google_fonts_check_name_family_and_style_max_length(ttFont): """Combined length of family and style must not exceed 27 characters.""" from fontbakery.utils import (get_name_entries, get_name_entry_strings) failed = False for familyname in get_name_entries(ttFont, ...
python
def com_google_fonts_check_name_family_and_style_max_length(ttFont): """Combined length of family and style must not exceed 27 characters.""" from fontbakery.utils import (get_name_entries, get_name_entry_strings) failed = False for familyname in get_name_entries(ttFont, ...
[ "def", "com_google_fonts_check_name_family_and_style_max_length", "(", "ttFont", ")", ":", "from", "fontbakery", ".", "utils", "import", "(", "get_name_entries", ",", "get_name_entry_strings", ")", "failed", "=", "False", "for", "familyname", "in", "get_name_entries", "...
Combined length of family and style must not exceed 27 characters.
[ "Combined", "length", "of", "family", "and", "style", "must", "not", "exceed", "27", "characters", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3781-L3807
9,842
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_family_control_chars
def com_google_fonts_check_family_control_chars(ttFonts): """Does font file include unacceptable control character glyphs?""" # list of unacceptable control character glyph names # definition includes the entire control character Unicode block except: # - .null (U+0000) # - CR (U+000D) unacceptable_cc...
python
def com_google_fonts_check_family_control_chars(ttFonts): """Does font file include unacceptable control character glyphs?""" # list of unacceptable control character glyph names # definition includes the entire control character Unicode block except: # - .null (U+0000) # - CR (U+000D) unacceptable_cc...
[ "def", "com_google_fonts_check_family_control_chars", "(", "ttFonts", ")", ":", "# list of unacceptable control character glyph names", "# definition includes the entire control character Unicode block except:", "# - .null (U+0000)", "# - CR (U+000D)", "unacceptable_cc_list", "=", "[",...
Does font file include unacceptable control character glyphs?
[ "Does", "font", "file", "include", "unacceptable", "control", "character", "glyphs?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3818-L3882
9,843
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
gfonts_repo_structure
def gfonts_repo_structure(fonts): """ The family at the given font path follows the files and directory structure typical of a font project hosted on the Google Fonts repo on GitHub ? """ from fontbakery.utils import get_absolute_path # FIXME: Improve this with more details # about the...
python
def gfonts_repo_structure(fonts): """ The family at the given font path follows the files and directory structure typical of a font project hosted on the Google Fonts repo on GitHub ? """ from fontbakery.utils import get_absolute_path # FIXME: Improve this with more details # about the...
[ "def", "gfonts_repo_structure", "(", "fonts", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_absolute_path", "# FIXME: Improve this with more details", "# about the expected structure.", "abspath", "=", "get_absolute_path", "(", "fonts", "[", "0", "]", ...
The family at the given font path follows the files and directory structure typical of a font project hosted on the Google Fonts repo on GitHub ?
[ "The", "family", "at", "the", "given", "font", "path", "follows", "the", "files", "and", "directory", "structure", "typical", "of", "a", "font", "project", "hosted", "on", "the", "Google", "Fonts", "repo", "on", "GitHub", "?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3886-L3896
9,844
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
com_google_fonts_check_repo_dirname_match_nameid_1
def com_google_fonts_check_repo_dirname_match_nameid_1(fonts, gfonts_repo_structure): """Directory name in GFonts repo structure must match NameID 1 of the regular.""" from fontTools.ttLib import TTFont from fontbakery.utils import (get_name_entry_string...
python
def com_google_fonts_check_repo_dirname_match_nameid_1(fonts, gfonts_repo_structure): """Directory name in GFonts repo structure must match NameID 1 of the regular.""" from fontTools.ttLib import TTFont from fontbakery.utils import (get_name_entry_string...
[ "def", "com_google_fonts_check_repo_dirname_match_nameid_1", "(", "fonts", ",", "gfonts_repo_structure", ")", ":", "from", "fontTools", ".", "ttLib", "import", "TTFont", "from", "fontbakery", ".", "utils", "import", "(", "get_name_entry_strings", ",", "get_absolute_path",...
Directory name in GFonts repo structure must match NameID 1 of the regular.
[ "Directory", "name", "in", "GFonts", "repo", "structure", "must", "match", "NameID", "1", "of", "the", "regular", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3906-L3929
9,845
googlefonts/fontbakery
Lib/fontbakery/profiles/os2.py
com_google_fonts_check_family_panose_proportion
def com_google_fonts_check_family_panose_proportion(ttFonts): """Fonts have consistent PANOSE proportion?""" failed = False proportion = None for ttFont in ttFonts: if proportion is None: proportion = ttFont['OS/2'].panose.bProportion if proportion != ttFont['OS/2'].panose.bProportion: faile...
python
def com_google_fonts_check_family_panose_proportion(ttFonts): """Fonts have consistent PANOSE proportion?""" failed = False proportion = None for ttFont in ttFonts: if proportion is None: proportion = ttFont['OS/2'].panose.bProportion if proportion != ttFont['OS/2'].panose.bProportion: faile...
[ "def", "com_google_fonts_check_family_panose_proportion", "(", "ttFonts", ")", ":", "failed", "=", "False", "proportion", "=", "None", "for", "ttFont", "in", "ttFonts", ":", "if", "proportion", "is", "None", ":", "proportion", "=", "ttFont", "[", "'OS/2'", "]", ...
Fonts have consistent PANOSE proportion?
[ "Fonts", "have", "consistent", "PANOSE", "proportion?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/os2.py#L14-L32
9,846
googlefonts/fontbakery
Lib/fontbakery/profiles/os2.py
com_google_fonts_check_family_panose_familytype
def com_google_fonts_check_family_panose_familytype(ttFonts): """Fonts have consistent PANOSE family type?""" failed = False familytype = None for ttfont in ttFonts: if familytype is None: familytype = ttfont['OS/2'].panose.bFamilyType if familytype != ttfont['OS/2'].panose.bFamilyType: fail...
python
def com_google_fonts_check_family_panose_familytype(ttFonts): """Fonts have consistent PANOSE family type?""" failed = False familytype = None for ttfont in ttFonts: if familytype is None: familytype = ttfont['OS/2'].panose.bFamilyType if familytype != ttfont['OS/2'].panose.bFamilyType: fail...
[ "def", "com_google_fonts_check_family_panose_familytype", "(", "ttFonts", ")", ":", "failed", "=", "False", "familytype", "=", "None", "for", "ttfont", "in", "ttFonts", ":", "if", "familytype", "is", "None", ":", "familytype", "=", "ttfont", "[", "'OS/2'", "]", ...
Fonts have consistent PANOSE family type?
[ "Fonts", "have", "consistent", "PANOSE", "family", "type?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/os2.py#L38-L56
9,847
googlefonts/fontbakery
Lib/fontbakery/profiles/os2.py
com_google_fonts_check_code_pages
def com_google_fonts_check_code_pages(ttFont): """Check code page character ranges""" if not hasattr(ttFont['OS/2'], "ulCodePageRange1") or \ not hasattr(ttFont['OS/2'], "ulCodePageRange2") or \ (ttFont['OS/2'].ulCodePageRange1 == 0 and \ ttFont['OS/2'].ulCodePageRange2 == 0): yield FAIL, ("No ...
python
def com_google_fonts_check_code_pages(ttFont): """Check code page character ranges""" if not hasattr(ttFont['OS/2'], "ulCodePageRange1") or \ not hasattr(ttFont['OS/2'], "ulCodePageRange2") or \ (ttFont['OS/2'].ulCodePageRange1 == 0 and \ ttFont['OS/2'].ulCodePageRange2 == 0): yield FAIL, ("No ...
[ "def", "com_google_fonts_check_code_pages", "(", "ttFont", ")", ":", "if", "not", "hasattr", "(", "ttFont", "[", "'OS/2'", "]", ",", "\"ulCodePageRange1\"", ")", "or", "not", "hasattr", "(", "ttFont", "[", "'OS/2'", "]", ",", "\"ulCodePageRange2\"", ")", "or",...
Check code page character ranges
[ "Check", "code", "page", "character", "ranges" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/os2.py#L245-L255
9,848
googlefonts/fontbakery
Lib/fontbakery/profiles/glyf.py
com_google_fonts_check_glyf_unused_data
def com_google_fonts_check_glyf_unused_data(ttFont): """Is there any unused data at the end of the glyf table?""" try: expected_glyphs = len(ttFont.getGlyphOrder()) actual_glyphs = len(ttFont['glyf'].glyphs) diff = actual_glyphs - expected_glyphs if diff < 0: yield FAIL, Message("unreachable-...
python
def com_google_fonts_check_glyf_unused_data(ttFont): """Is there any unused data at the end of the glyf table?""" try: expected_glyphs = len(ttFont.getGlyphOrder()) actual_glyphs = len(ttFont['glyf'].glyphs) diff = actual_glyphs - expected_glyphs if diff < 0: yield FAIL, Message("unreachable-...
[ "def", "com_google_fonts_check_glyf_unused_data", "(", "ttFont", ")", ":", "try", ":", "expected_glyphs", "=", "len", "(", "ttFont", ".", "getGlyphOrder", "(", ")", ")", "actual_glyphs", "=", "len", "(", "ttFont", "[", "'glyf'", "]", ".", "glyphs", ")", "dif...
Is there any unused data at the end of the glyf table?
[ "Is", "there", "any", "unused", "data", "at", "the", "end", "of", "the", "glyf", "table?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/glyf.py#L13-L39
9,849
googlefonts/fontbakery
Lib/fontbakery/profiles/glyf.py
com_google_fonts_check_points_out_of_bounds
def com_google_fonts_check_points_out_of_bounds(ttFont): """Check for points out of bounds.""" failed = False out_of_bounds = [] for glyphName in ttFont['glyf'].keys(): glyph = ttFont['glyf'][glyphName] coords = glyph.getCoordinates(ttFont['glyf'])[0] for x, y in coords: if x < glyph.xMin or x...
python
def com_google_fonts_check_points_out_of_bounds(ttFont): """Check for points out of bounds.""" failed = False out_of_bounds = [] for glyphName in ttFont['glyf'].keys(): glyph = ttFont['glyf'][glyphName] coords = glyph.getCoordinates(ttFont['glyf'])[0] for x, y in coords: if x < glyph.xMin or x...
[ "def", "com_google_fonts_check_points_out_of_bounds", "(", "ttFont", ")", ":", "failed", "=", "False", "out_of_bounds", "=", "[", "]", "for", "glyphName", "in", "ttFont", "[", "'glyf'", "]", ".", "keys", "(", ")", ":", "glyph", "=", "ttFont", "[", "'glyf'", ...
Check for points out of bounds.
[ "Check", "for", "points", "out", "of", "bounds", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/glyf.py#L51-L75
9,850
googlefonts/fontbakery
Lib/fontbakery/profiles/ufo_sources.py
com_daltonmaag_check_ufolint
def com_daltonmaag_check_ufolint(font): """Run ufolint on UFO source directory.""" import subprocess ufolint_cmd = ["ufolint", font] try: subprocess.check_output(ufolint_cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: yield FAIL, ("ufolint failed the UFO source. Output follo...
python
def com_daltonmaag_check_ufolint(font): """Run ufolint on UFO source directory.""" import subprocess ufolint_cmd = ["ufolint", font] try: subprocess.check_output(ufolint_cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: yield FAIL, ("ufolint failed the UFO source. Output follo...
[ "def", "com_daltonmaag_check_ufolint", "(", "font", ")", ":", "import", "subprocess", "ufolint_cmd", "=", "[", "\"ufolint\"", ",", "font", "]", "try", ":", "subprocess", ".", "check_output", "(", "ufolint_cmd", ",", "stderr", "=", "subprocess", ".", "STDOUT", ...
Run ufolint on UFO source directory.
[ "Run", "ufolint", "on", "UFO", "source", "directory", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/ufo_sources.py#L91-L104
9,851
googlefonts/fontbakery
Lib/fontbakery/profiles/ufo_sources.py
com_daltonmaag_check_required_fields
def com_daltonmaag_check_required_fields(ufo_font): """Check that required fields are present in the UFO fontinfo. ufo2ft requires these info fields to compile a font binary: unitsPerEm, ascender, descender, xHeight, capHeight and familyName. """ recommended_fields = [] for field in [ "unitsPe...
python
def com_daltonmaag_check_required_fields(ufo_font): """Check that required fields are present in the UFO fontinfo. ufo2ft requires these info fields to compile a font binary: unitsPerEm, ascender, descender, xHeight, capHeight and familyName. """ recommended_fields = [] for field in [ "unitsPe...
[ "def", "com_daltonmaag_check_required_fields", "(", "ufo_font", ")", ":", "recommended_fields", "=", "[", "]", "for", "field", "in", "[", "\"unitsPerEm\"", ",", "\"ascender\"", ",", "\"descender\"", ",", "\"xHeight\"", ",", "\"capHeight\"", ",", "\"familyName\"", "]...
Check that required fields are present in the UFO fontinfo. ufo2ft requires these info fields to compile a font binary: unitsPerEm, ascender, descender, xHeight, capHeight and familyName.
[ "Check", "that", "required", "fields", "are", "present", "in", "the", "UFO", "fontinfo", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/ufo_sources.py#L111-L129
9,852
googlefonts/fontbakery
Lib/fontbakery/profiles/ufo_sources.py
com_daltonmaag_check_recommended_fields
def com_daltonmaag_check_recommended_fields(ufo_font): """Check that recommended fields are present in the UFO fontinfo. This includes fields that should be in any production font. """ recommended_fields = [] for field in [ "postscriptUnderlineThickness", "postscriptUnderlinePosition", "vers...
python
def com_daltonmaag_check_recommended_fields(ufo_font): """Check that recommended fields are present in the UFO fontinfo. This includes fields that should be in any production font. """ recommended_fields = [] for field in [ "postscriptUnderlineThickness", "postscriptUnderlinePosition", "vers...
[ "def", "com_daltonmaag_check_recommended_fields", "(", "ufo_font", ")", ":", "recommended_fields", "=", "[", "]", "for", "field", "in", "[", "\"postscriptUnderlineThickness\"", ",", "\"postscriptUnderlinePosition\"", ",", "\"versionMajor\"", ",", "\"versionMinor\"", ",", ...
Check that recommended fields are present in the UFO fontinfo. This includes fields that should be in any production font.
[ "Check", "that", "recommended", "fields", "are", "present", "in", "the", "UFO", "fontinfo", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/ufo_sources.py#L136-L154
9,853
googlefonts/fontbakery
Lib/fontbakery/profiles/ufo_sources.py
com_daltonmaag_check_unnecessary_fields
def com_daltonmaag_check_unnecessary_fields(ufo_font): """Check that no unnecessary fields are present in the UFO fontinfo. ufo2ft will generate these. openTypeOS2UnicodeRanges and openTypeOS2CodePageRanges are exempted because it is useful to toggle a range when not _all_ the glyphs in that region ...
python
def com_daltonmaag_check_unnecessary_fields(ufo_font): """Check that no unnecessary fields are present in the UFO fontinfo. ufo2ft will generate these. openTypeOS2UnicodeRanges and openTypeOS2CodePageRanges are exempted because it is useful to toggle a range when not _all_ the glyphs in that region ...
[ "def", "com_daltonmaag_check_unnecessary_fields", "(", "ufo_font", ")", ":", "unnecessary_fields", "=", "[", "]", "for", "field", "in", "[", "\"openTypeNameUniqueID\"", ",", "\"openTypeNameVersion\"", ",", "\"postscriptUniqueID\"", ",", "\"year\"", "]", ":", "if", "uf...
Check that no unnecessary fields are present in the UFO fontinfo. ufo2ft will generate these. openTypeOS2UnicodeRanges and openTypeOS2CodePageRanges are exempted because it is useful to toggle a range when not _all_ the glyphs in that region are present. year is deprecated since UFO v2.
[ "Check", "that", "no", "unnecessary", "fields", "are", "present", "in", "the", "UFO", "fontinfo", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/ufo_sources.py#L161-L184
9,854
googlefonts/fontbakery
Lib/fontbakery/profiles/ufo_sources.py
UFOProfile.setup_argparse
def setup_argparse(self, argument_parser): """Set up custom arguments needed for this profile.""" import glob import logging import argparse def get_fonts(pattern): fonts_to_check = [] # use glob.glob to accept *.ufo for fullpath in glob.glob(pattern): fullpath_absolute ...
python
def setup_argparse(self, argument_parser): """Set up custom arguments needed for this profile.""" import glob import logging import argparse def get_fonts(pattern): fonts_to_check = [] # use glob.glob to accept *.ufo for fullpath in glob.glob(pattern): fullpath_absolute ...
[ "def", "setup_argparse", "(", "self", ",", "argument_parser", ")", ":", "import", "glob", "import", "logging", "import", "argparse", "def", "get_fonts", "(", "pattern", ")", ":", "fonts_to_check", "=", "[", "]", "# use glob.glob to accept *.ufo", "for", "fullpath"...
Set up custom arguments needed for this profile.
[ "Set", "up", "custom", "arguments", "needed", "for", "this", "profile", "." ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/ufo_sources.py#L11-L49
9,855
googlefonts/fontbakery
Lib/fontbakery/profiles/hmtx.py
com_google_fonts_check_whitespace_widths
def com_google_fonts_check_whitespace_widths(ttFont): """Whitespace and non-breaking space have the same width?""" from fontbakery.utils import get_glyph_name space_name = get_glyph_name(ttFont, 0x0020) nbsp_name = get_glyph_name(ttFont, 0x00A0) space_width = ttFont['hmtx'][space_name][0] nbsp_width = ttF...
python
def com_google_fonts_check_whitespace_widths(ttFont): """Whitespace and non-breaking space have the same width?""" from fontbakery.utils import get_glyph_name space_name = get_glyph_name(ttFont, 0x0020) nbsp_name = get_glyph_name(ttFont, 0x00A0) space_width = ttFont['hmtx'][space_name][0] nbsp_width = ttF...
[ "def", "com_google_fonts_check_whitespace_widths", "(", "ttFont", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_glyph_name", "space_name", "=", "get_glyph_name", "(", "ttFont", ",", "0x0020", ")", "nbsp_name", "=", "get_glyph_name", "(", "ttFont", ","...
Whitespace and non-breaking space have the same width?
[ "Whitespace", "and", "non", "-", "breaking", "space", "have", "the", "same", "width?" ]
b355aea2e619a4477769e060d24c32448aa65399
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/hmtx.py#L13-L30
9,856
Kuniwak/vint
vint/linting/policy_set.py
PolicySet.update_by_config
def update_by_config(self, config_dict): """ Update policies set by the config dictionary. Expect the policy_enabling_map structure to be (represented by YAML): - PolicyFoo: enabled: True - PolicyBar: enabled: False additional_field: 'is...
python
def update_by_config(self, config_dict): """ Update policies set by the config dictionary. Expect the policy_enabling_map structure to be (represented by YAML): - PolicyFoo: enabled: True - PolicyBar: enabled: False additional_field: 'is...
[ "def", "update_by_config", "(", "self", ",", "config_dict", ")", ":", "policy_enabling_map", "=", "self", ".", "_get_enabling_map", "(", "config_dict", ")", "self", ".", "enabled_policies", "=", "[", "]", "for", "policy_name", ",", "is_policy_enabled", "in", "po...
Update policies set by the config dictionary. Expect the policy_enabling_map structure to be (represented by YAML): - PolicyFoo: enabled: True - PolicyBar: enabled: False additional_field: 'is_ok'
[ "Update", "policies", "set", "by", "the", "config", "dictionary", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/linting/policy_set.py#L48-L68
9,857
Kuniwak/vint
vint/linting/cli.py
_build_cmdargs
def _build_cmdargs(argv): """ Build command line arguments dict to use; - displaying usages - vint.linting.env.build_environment This method take an argv parameter to make function pure. """ parser = _build_arg_parser() namespace = parser.parse_args(argv[1:]) cmdargs = vars(namespace) ...
python
def _build_cmdargs(argv): """ Build command line arguments dict to use; - displaying usages - vint.linting.env.build_environment This method take an argv parameter to make function pure. """ parser = _build_arg_parser() namespace = parser.parse_args(argv[1:]) cmdargs = vars(namespace) ...
[ "def", "_build_cmdargs", "(", "argv", ")", ":", "parser", "=", "_build_arg_parser", "(", ")", "namespace", "=", "parser", ".", "parse_args", "(", "argv", "[", "1", ":", "]", ")", "cmdargs", "=", "vars", "(", "namespace", ")", "return", "cmdargs" ]
Build command line arguments dict to use; - displaying usages - vint.linting.env.build_environment This method take an argv parameter to make function pure.
[ "Build", "command", "line", "arguments", "dict", "to", "use", ";", "-", "displaying", "usages", "-", "vint", ".", "linting", ".", "env", ".", "build_environment" ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/linting/cli.py#L79-L90
9,858
Kuniwak/vint
vint/ast/parsing.py
Parser.parse
def parse(self, lint_target): # type: (AbstractLintTarget) -> Dict[str, Any] """ Parse vim script file and return the AST. """ decoder = Decoder(default_decoding_strategy) decoded = decoder.decode(lint_target.read()) decoded_and_lf_normalized = decoded.replace('\r\n', '\n') ret...
python
def parse(self, lint_target): # type: (AbstractLintTarget) -> Dict[str, Any] """ Parse vim script file and return the AST. """ decoder = Decoder(default_decoding_strategy) decoded = decoder.decode(lint_target.read()) decoded_and_lf_normalized = decoded.replace('\r\n', '\n') ret...
[ "def", "parse", "(", "self", ",", "lint_target", ")", ":", "# type: (AbstractLintTarget) -> Dict[str, Any]", "decoder", "=", "Decoder", "(", "default_decoding_strategy", ")", "decoded", "=", "decoder", ".", "decode", "(", "lint_target", ".", "read", "(", ")", ")",...
Parse vim script file and return the AST.
[ "Parse", "vim", "script", "file", "and", "return", "the", "AST", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/parsing.py#L19-L25
9,859
Kuniwak/vint
vint/ast/parsing.py
Parser.parse_string
def parse_string(self, string): # type: (str) -> Dict[str, Any] """ Parse vim script string and return the AST. """ lines = string.split('\n') reader = vimlparser.StringReader(lines) parser = vimlparser.VimLParser(self._enable_neovim) ast = parser.parse(reader) # TOPLE...
python
def parse_string(self, string): # type: (str) -> Dict[str, Any] """ Parse vim script string and return the AST. """ lines = string.split('\n') reader = vimlparser.StringReader(lines) parser = vimlparser.VimLParser(self._enable_neovim) ast = parser.parse(reader) # TOPLE...
[ "def", "parse_string", "(", "self", ",", "string", ")", ":", "# type: (str) -> Dict[str, Any]", "lines", "=", "string", ".", "split", "(", "'\\n'", ")", "reader", "=", "vimlparser", ".", "StringReader", "(", "lines", ")", "parser", "=", "vimlparser", ".", "V...
Parse vim script string and return the AST.
[ "Parse", "vim", "script", "string", "and", "return", "the", "AST", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/parsing.py#L28-L42
9,860
Kuniwak/vint
vint/ast/parsing.py
Parser.parse_string_expr
def parse_string_expr(self, string_expr_node): """ Parse a string node content. """ string_expr_node_value = string_expr_node['value'] string_expr_str = string_expr_node_value[1:-1] # Care escaped string literals if string_expr_node_value[0] == "'": string_expr_str =...
python
def parse_string_expr(self, string_expr_node): """ Parse a string node content. """ string_expr_node_value = string_expr_node['value'] string_expr_str = string_expr_node_value[1:-1] # Care escaped string literals if string_expr_node_value[0] == "'": string_expr_str =...
[ "def", "parse_string_expr", "(", "self", ",", "string_expr_node", ")", ":", "string_expr_node_value", "=", "string_expr_node", "[", "'value'", "]", "string_expr_str", "=", "string_expr_node_value", "[", "1", ":", "-", "1", "]", "# Care escaped string literals", "if", ...
Parse a string node content.
[ "Parse", "a", "string", "node", "content", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/parsing.py#L87-L121
9,861
Kuniwak/vint
vint/ast/plugin/scope_plugin/scope_detector.py
is_builtin_variable
def is_builtin_variable(id_node): # type: (Dict[str, Any]) -> bool """ Whether the specified node is a builtin identifier. """ # Builtin variables are always IDENTIFIER. if NodeType(id_node['type']) is not NodeType.IDENTIFIER: return False id_value = id_node['value'] if id_value.startswit...
python
def is_builtin_variable(id_node): # type: (Dict[str, Any]) -> bool """ Whether the specified node is a builtin identifier. """ # Builtin variables are always IDENTIFIER. if NodeType(id_node['type']) is not NodeType.IDENTIFIER: return False id_value = id_node['value'] if id_value.startswit...
[ "def", "is_builtin_variable", "(", "id_node", ")", ":", "# type: (Dict[str, Any]) -> bool", "# Builtin variables are always IDENTIFIER.", "if", "NodeType", "(", "id_node", "[", "'type'", "]", ")", "is", "not", "NodeType", ".", "IDENTIFIER", ":", "return", "False", "id...
Whether the specified node is a builtin identifier.
[ "Whether", "the", "specified", "node", "is", "a", "builtin", "identifier", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/plugin/scope_plugin/scope_detector.py#L69-L90
9,862
Kuniwak/vint
vint/ast/plugin/scope_plugin/scope_detector.py
is_builtin_function
def is_builtin_function(id_node): # type: (Dict[str, Any]) -> bool """ Whether the specified node is a builtin function name identifier. The given identifier should be a child node of NodeType.CALL. """ # Builtin functions are always IDENTIFIER. if NodeType(id_node['type']) is not NodeType.IDENTIFI...
python
def is_builtin_function(id_node): # type: (Dict[str, Any]) -> bool """ Whether the specified node is a builtin function name identifier. The given identifier should be a child node of NodeType.CALL. """ # Builtin functions are always IDENTIFIER. if NodeType(id_node['type']) is not NodeType.IDENTIFI...
[ "def", "is_builtin_function", "(", "id_node", ")", ":", "# type: (Dict[str, Any]) -> bool", "# Builtin functions are always IDENTIFIER.", "if", "NodeType", "(", "id_node", "[", "'type'", "]", ")", "is", "not", "NodeType", ".", "IDENTIFIER", ":", "return", "False", "id...
Whether the specified node is a builtin function name identifier. The given identifier should be a child node of NodeType.CALL.
[ "Whether", "the", "specified", "node", "is", "a", "builtin", "function", "name", "identifier", ".", "The", "given", "identifier", "should", "be", "a", "child", "node", "of", "NodeType", ".", "CALL", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/plugin/scope_plugin/scope_detector.py#L93-L112
9,863
Kuniwak/vint
vint/ast/plugin/scope_plugin/identifier_classifier.py
IdentifierClassifier.attach_identifier_attributes
def attach_identifier_attributes(self, ast): # type: (Dict[str, Any]) -> Dict[str, Any] """ Attach 5 flags to the AST. - is dynamic: True if the identifier name can be determined by static analysis. - is member: True if the identifier is a member of a subscription/dot/slice node. - is ...
python
def attach_identifier_attributes(self, ast): # type: (Dict[str, Any]) -> Dict[str, Any] """ Attach 5 flags to the AST. - is dynamic: True if the identifier name can be determined by static analysis. - is member: True if the identifier is a member of a subscription/dot/slice node. - is ...
[ "def", "attach_identifier_attributes", "(", "self", ",", "ast", ")", ":", "# type: (Dict[str, Any]) -> Dict[str, Any]", "redir_assignment_parser", "=", "RedirAssignmentParser", "(", ")", "ast_with_parsed_redir", "=", "redir_assignment_parser", ".", "process", "(", "ast", ")...
Attach 5 flags to the AST. - is dynamic: True if the identifier name can be determined by static analysis. - is member: True if the identifier is a member of a subscription/dot/slice node. - is declaring: True if the identifier is used to declare. - is autoload: True if the identifier i...
[ "Attach", "5", "flags", "to", "the", "AST", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/plugin/scope_plugin/identifier_classifier.py#L118-L150
9,864
Kuniwak/vint
vint/linting/policy/abstract_policy.py
AbstractPolicy.create_violation_report
def create_violation_report(self, node, lint_context): """ Returns a violation report for the node. """ return { 'name': self.name, 'level': self.level, 'description': self.description, 'reference': self.reference, 'position': { ...
python
def create_violation_report(self, node, lint_context): """ Returns a violation report for the node. """ return { 'name': self.name, 'level': self.level, 'description': self.description, 'reference': self.reference, 'position': { ...
[ "def", "create_violation_report", "(", "self", ",", "node", ",", "lint_context", ")", ":", "return", "{", "'name'", ":", "self", ".", "name", ",", "'level'", ":", "self", ".", "level", ",", "'description'", ":", "self", ".", "description", ",", "'reference...
Returns a violation report for the node.
[ "Returns", "a", "violation", "report", "for", "the", "node", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/linting/policy/abstract_policy.py#L22-L34
9,865
Kuniwak/vint
vint/linting/policy/abstract_policy.py
AbstractPolicy.get_policy_config
def get_policy_config(self, lint_context): """ Returns a config of the concrete policy. For example, a config of ProhibitSomethingEvil is located on config.policies.ProhibitSomethingEvil. """ policy_config = lint_context['config']\ .get('policies', {})\ .g...
python
def get_policy_config(self, lint_context): """ Returns a config of the concrete policy. For example, a config of ProhibitSomethingEvil is located on config.policies.ProhibitSomethingEvil. """ policy_config = lint_context['config']\ .get('policies', {})\ .g...
[ "def", "get_policy_config", "(", "self", ",", "lint_context", ")", ":", "policy_config", "=", "lint_context", "[", "'config'", "]", ".", "get", "(", "'policies'", ",", "{", "}", ")", ".", "get", "(", "self", ".", "__class__", ".", "__name__", ",", "{", ...
Returns a config of the concrete policy. For example, a config of ProhibitSomethingEvil is located on config.policies.ProhibitSomethingEvil.
[ "Returns", "a", "config", "of", "the", "concrete", "policy", ".", "For", "example", "a", "config", "of", "ProhibitSomethingEvil", "is", "located", "on", "config", ".", "policies", ".", "ProhibitSomethingEvil", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/linting/policy/abstract_policy.py#L37-L46
9,866
Kuniwak/vint
vint/linting/policy/abstract_policy.py
AbstractPolicy.get_violation_if_found
def get_violation_if_found(self, node, lint_context): """ Returns a violation if the node is invalid. """ if self.is_valid(node, lint_context): return None return self.create_violation_report(node, lint_context)
python
def get_violation_if_found(self, node, lint_context): """ Returns a violation if the node is invalid. """ if self.is_valid(node, lint_context): return None return self.create_violation_report(node, lint_context)
[ "def", "get_violation_if_found", "(", "self", ",", "node", ",", "lint_context", ")", ":", "if", "self", ".", "is_valid", "(", "node", ",", "lint_context", ")", ":", "return", "None", "return", "self", ".", "create_violation_report", "(", "node", ",", "lint_c...
Returns a violation if the node is invalid.
[ "Returns", "a", "violation", "if", "the", "node", "is", "invalid", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/linting/policy/abstract_policy.py#L49-L54
9,867
Kuniwak/vint
vint/bootstrap.py
import_all_policies
def import_all_policies(): """ Import all policies that were registered by vint.linting.policy_registry. Dynamic policy importing is comprised of the 3 steps 1. Try to import all policy modules (then we can't know what policies exist) 2. In policy module, register itself by using vint.linting.polic...
python
def import_all_policies(): """ Import all policies that were registered by vint.linting.policy_registry. Dynamic policy importing is comprised of the 3 steps 1. Try to import all policy modules (then we can't know what policies exist) 2. In policy module, register itself by using vint.linting.polic...
[ "def", "import_all_policies", "(", ")", ":", "pkg_name", "=", "_get_policy_package_name_for_test", "(", ")", "pkg_path_list", "=", "pkg_name", ".", "split", "(", "'.'", ")", "pkg_path", "=", "str", "(", "Path", "(", "_get_vint_root", "(", ")", ",", "*", "pkg...
Import all policies that were registered by vint.linting.policy_registry. Dynamic policy importing is comprised of the 3 steps 1. Try to import all policy modules (then we can't know what policies exist) 2. In policy module, register itself by using vint.linting.policy_registry 3. After all polic...
[ "Import", "all", "policies", "that", "were", "registered", "by", "vint", ".", "linting", ".", "policy_registry", "." ]
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/bootstrap.py#L24-L41
9,868
Kuniwak/vint
vint/ast/plugin/scope_plugin/scope_linker.py
ScopeLinker.process
def process(self, ast): # type: (Dict[str, Any]) -> None """ Build a scope tree and links between scopes and identifiers by the specified ast. You can access the built scope tree and the built links by .scope_tree and .link_registry. """ id_classifier = IdentifierClassifier() ...
python
def process(self, ast): # type: (Dict[str, Any]) -> None """ Build a scope tree and links between scopes and identifiers by the specified ast. You can access the built scope tree and the built links by .scope_tree and .link_registry. """ id_classifier = IdentifierClassifier() ...
[ "def", "process", "(", "self", ",", "ast", ")", ":", "# type: (Dict[str, Any]) -> None", "id_classifier", "=", "IdentifierClassifier", "(", ")", "attached_ast", "=", "id_classifier", ".", "attach_identifier_attributes", "(", "ast", ")", "# We are already in script local s...
Build a scope tree and links between scopes and identifiers by the specified ast. You can access the built scope tree and the built links by .scope_tree and .link_registry.
[ "Build", "a", "scope", "tree", "and", "links", "between", "scopes", "and", "identifiers", "by", "the", "specified", "ast", ".", "You", "can", "access", "the", "built", "scope", "tree", "and", "the", "built", "links", "by", ".", "scope_tree", "and", ".", ...
db29337d859d88239c282c2e9d84c858f23a4a09
https://github.com/Kuniwak/vint/blob/db29337d859d88239c282c2e9d84c858f23a4a09/vint/ast/plugin/scope_plugin/scope_linker.py#L326-L342
9,869
mozilla/mozdownload
mozdownload/cli.py
cli
def cli(argv=None): """CLI entry point for mozdownload.""" kwargs = parse_arguments(argv or sys.argv[1:]) log_level = kwargs.pop('log_level') logging.basicConfig(format='%(levelname)s | %(message)s', level=log_level) logger = logging.getLogger(__name__) # Configure logging levels for sub modul...
python
def cli(argv=None): """CLI entry point for mozdownload.""" kwargs = parse_arguments(argv or sys.argv[1:]) log_level = kwargs.pop('log_level') logging.basicConfig(format='%(levelname)s | %(message)s', level=log_level) logger = logging.getLogger(__name__) # Configure logging levels for sub modul...
[ "def", "cli", "(", "argv", "=", "None", ")", ":", "kwargs", "=", "parse_arguments", "(", "argv", "or", "sys", ".", "argv", "[", "1", ":", "]", ")", "log_level", "=", "kwargs", ".", "pop", "(", "'log_level'", ")", "logging", ".", "basicConfig", "(", ...
CLI entry point for mozdownload.
[ "CLI", "entry", "point", "for", "mozdownload", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/cli.py#L146-L175
9,870
mozilla/mozdownload
mozdownload/treeherder.py
Treeherder.query_builds_by_revision
def query_builds_by_revision(self, revision, job_type_name='Build', debug_build=False): """Retrieve build folders for a given revision with the help of Treeherder. :param revision: Revision of the build to download. :param job_type_name: Name of the job to look for. For builds it should be ...
python
def query_builds_by_revision(self, revision, job_type_name='Build', debug_build=False): """Retrieve build folders for a given revision with the help of Treeherder. :param revision: Revision of the build to download. :param job_type_name: Name of the job to look for. For builds it should be ...
[ "def", "query_builds_by_revision", "(", "self", ",", "revision", ",", "job_type_name", "=", "'Build'", ",", "debug_build", "=", "False", ")", ":", "builds", "=", "set", "(", ")", "try", ":", "self", ".", "logger", ".", "info", "(", "'Querying {url} for list ...
Retrieve build folders for a given revision with the help of Treeherder. :param revision: Revision of the build to download. :param job_type_name: Name of the job to look for. For builds it should be 'Build', 'Nightly', and 'L10n Nightly'. Defaults to `Build`. :param debug_build: Do...
[ "Retrieve", "build", "folders", "for", "a", "given", "revision", "with", "the", "help", "of", "Treeherder", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/treeherder.py#L60-L107
9,871
mozilla/mozdownload
mozdownload/utils.py
urljoin
def urljoin(*fragments): """Concatenate multi part strings into urls.""" # Strip possible already existent final slashes of fragments except for the last one parts = [fragment.rstrip('/') for fragment in fragments[:len(fragments) - 1]] parts.append(fragments[-1]) return '/'.join(parts)
python
def urljoin(*fragments): """Concatenate multi part strings into urls.""" # Strip possible already existent final slashes of fragments except for the last one parts = [fragment.rstrip('/') for fragment in fragments[:len(fragments) - 1]] parts.append(fragments[-1]) return '/'.join(parts)
[ "def", "urljoin", "(", "*", "fragments", ")", ":", "# Strip possible already existent final slashes of fragments except for the last one", "parts", "=", "[", "fragment", ".", "rstrip", "(", "'/'", ")", "for", "fragment", "in", "fragments", "[", ":", "len", "(", "fra...
Concatenate multi part strings into urls.
[ "Concatenate", "multi", "part", "strings", "into", "urls", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/utils.py#L12-L18
9,872
mozilla/mozdownload
mozdownload/utils.py
create_md5
def create_md5(path): """Create the md5 hash of a file using the hashlib library.""" m = hashlib.md5() # rb necessary to run correctly in windows. with open(path, "rb") as f: while True: data = f.read(8192) if not data: break m.update(data) ...
python
def create_md5(path): """Create the md5 hash of a file using the hashlib library.""" m = hashlib.md5() # rb necessary to run correctly in windows. with open(path, "rb") as f: while True: data = f.read(8192) if not data: break m.update(data) ...
[ "def", "create_md5", "(", "path", ")", ":", "m", "=", "hashlib", ".", "md5", "(", ")", "# rb necessary to run correctly in windows.", "with", "open", "(", "path", ",", "\"rb\"", ")", "as", "f", ":", "while", "True", ":", "data", "=", "f", ".", "read", ...
Create the md5 hash of a file using the hashlib library.
[ "Create", "the", "md5", "hash", "of", "a", "file", "using", "the", "hashlib", "library", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/utils.py#L21-L32
9,873
mozilla/mozdownload
mozdownload/parser.py
DirectoryParser.filter
def filter(self, filter): """Filter entries by calling function or applying regex.""" if hasattr(filter, '__call__'): return [entry for entry in self.entries if filter(entry)] else: pattern = re.compile(filter, re.IGNORECASE) return [entry for entry in self.en...
python
def filter(self, filter): """Filter entries by calling function or applying regex.""" if hasattr(filter, '__call__'): return [entry for entry in self.entries if filter(entry)] else: pattern = re.compile(filter, re.IGNORECASE) return [entry for entry in self.en...
[ "def", "filter", "(", "self", ",", "filter", ")", ":", "if", "hasattr", "(", "filter", ",", "'__call__'", ")", ":", "return", "[", "entry", "for", "entry", "in", "self", ".", "entries", "if", "filter", "(", "entry", ")", "]", "else", ":", "pattern", ...
Filter entries by calling function or applying regex.
[ "Filter", "entries", "by", "calling", "function", "or", "applying", "regex", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/parser.py#L53-L59
9,874
mozilla/mozdownload
mozdownload/parser.py
DirectoryParser.handle_starttag
def handle_starttag(self, tag, attrs): """Callback for when a tag gets opened.""" if not tag == 'a': return for attr in attrs: if attr[0] == 'href': # Links look like: /pub/firefox/nightly/2015/ # We have to trim the fragment down to the l...
python
def handle_starttag(self, tag, attrs): """Callback for when a tag gets opened.""" if not tag == 'a': return for attr in attrs: if attr[0] == 'href': # Links look like: /pub/firefox/nightly/2015/ # We have to trim the fragment down to the l...
[ "def", "handle_starttag", "(", "self", ",", "tag", ",", "attrs", ")", ":", "if", "not", "tag", "==", "'a'", ":", "return", "for", "attr", "in", "attrs", ":", "if", "attr", "[", "0", "]", "==", "'href'", ":", "# Links look like: /pub/firefox/nightly/2015/",...
Callback for when a tag gets opened.
[ "Callback", "for", "when", "a", "tag", "gets", "opened", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/parser.py#L61-L74
9,875
mozilla/mozdownload
mozdownload/parser.py
DirectoryParser.handle_data
def handle_data(self, data): """Callback when the data of a tag has been collected.""" # Only process the data when we are in an active a tag and have an URL. if not self.active_url: return # The visible text can have a final slash so strip it off if data.strip('/') ...
python
def handle_data(self, data): """Callback when the data of a tag has been collected.""" # Only process the data when we are in an active a tag and have an URL. if not self.active_url: return # The visible text can have a final slash so strip it off if data.strip('/') ...
[ "def", "handle_data", "(", "self", ",", "data", ")", ":", "# Only process the data when we are in an active a tag and have an URL.", "if", "not", "self", ".", "active_url", ":", "return", "# The visible text can have a final slash so strip it off", "if", "data", ".", "strip",...
Callback when the data of a tag has been collected.
[ "Callback", "when", "the", "data", "of", "a", "tag", "has", "been", "collected", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/parser.py#L81-L89
9,876
mozilla/mozdownload
mozdownload/timezones.py
PacificTimezone.dst
def dst(self, dt): """Calculate delta for daylight saving.""" # Daylight saving starts on the second Sunday of March at 2AM standard dst_start_date = self.first_sunday(dt.year, 3) + timedelta(days=7) \ + timedelta(hours=2) # Daylight...
python
def dst(self, dt): """Calculate delta for daylight saving.""" # Daylight saving starts on the second Sunday of March at 2AM standard dst_start_date = self.first_sunday(dt.year, 3) + timedelta(days=7) \ + timedelta(hours=2) # Daylight...
[ "def", "dst", "(", "self", ",", "dt", ")", ":", "# Daylight saving starts on the second Sunday of March at 2AM standard", "dst_start_date", "=", "self", ".", "first_sunday", "(", "dt", ".", "year", ",", "3", ")", "+", "timedelta", "(", "days", "=", "7", ")", "...
Calculate delta for daylight saving.
[ "Calculate", "delta", "for", "daylight", "saving", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/timezones.py#L23-L34
9,877
mozilla/mozdownload
mozdownload/timezones.py
PacificTimezone.first_sunday
def first_sunday(self, year, month): """Get the first sunday of a month.""" date = datetime(year, month, 1, 0) days_until_sunday = 6 - date.weekday() return date + timedelta(days=days_until_sunday)
python
def first_sunday(self, year, month): """Get the first sunday of a month.""" date = datetime(year, month, 1, 0) days_until_sunday = 6 - date.weekday() return date + timedelta(days=days_until_sunday)
[ "def", "first_sunday", "(", "self", ",", "year", ",", "month", ")", ":", "date", "=", "datetime", "(", "year", ",", "month", ",", "1", ",", "0", ")", "days_until_sunday", "=", "6", "-", "date", ".", "weekday", "(", ")", "return", "date", "+", "time...
Get the first sunday of a month.
[ "Get", "the", "first", "sunday", "of", "a", "month", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/timezones.py#L36-L41
9,878
mozilla/mozdownload
mozdownload/scraper.py
Scraper.binary
def binary(self): """Return the name of the build.""" def _get_binary(): # Retrieve all entries from the remote virtual folder parser = self._create_directory_parser(self.path) if not parser.entries: raise errors.NotFoundError('No entries found', self....
python
def binary(self): """Return the name of the build.""" def _get_binary(): # Retrieve all entries from the remote virtual folder parser = self._create_directory_parser(self.path) if not parser.entries: raise errors.NotFoundError('No entries found', self....
[ "def", "binary", "(", "self", ")", ":", "def", "_get_binary", "(", ")", ":", "# Retrieve all entries from the remote virtual folder", "parser", "=", "self", ".", "_create_directory_parser", "(", "self", ".", "path", ")", "if", "not", "parser", ".", "entries", ":...
Return the name of the build.
[ "Return", "the", "name", "of", "the", "build", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L165-L188
9,879
mozilla/mozdownload
mozdownload/scraper.py
Scraper.url
def url(self): """Return the URL of the build.""" return urllib.quote(urljoin(self.path, self.binary), safe='%/:=&?~#+!$,;\'@()*[]|')
python
def url(self): """Return the URL of the build.""" return urllib.quote(urljoin(self.path, self.binary), safe='%/:=&?~#+!$,;\'@()*[]|')
[ "def", "url", "(", "self", ")", ":", "return", "urllib", ".", "quote", "(", "urljoin", "(", "self", ".", "path", ",", "self", ".", "binary", ")", ",", "safe", "=", "'%/:=&?~#+!$,;\\'@()*[]|'", ")" ]
Return the URL of the build.
[ "Return", "the", "URL", "of", "the", "build", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L196-L199
9,880
mozilla/mozdownload
mozdownload/scraper.py
Scraper.filename
def filename(self): """Return the local filename of the build.""" if self._filename is None: if os.path.splitext(self.destination)[1]: # If the filename has been given make use of it target_file = self.destination else: # Otherwise ...
python
def filename(self): """Return the local filename of the build.""" if self._filename is None: if os.path.splitext(self.destination)[1]: # If the filename has been given make use of it target_file = self.destination else: # Otherwise ...
[ "def", "filename", "(", "self", ")", ":", "if", "self", ".", "_filename", "is", "None", ":", "if", "os", ".", "path", ".", "splitext", "(", "self", ".", "destination", ")", "[", "1", "]", ":", "# If the filename has been given make use of it", "target_file",...
Return the local filename of the build.
[ "Return", "the", "local", "filename", "of", "the", "build", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L217-L230
9,881
mozilla/mozdownload
mozdownload/scraper.py
Scraper.download
def download(self): """Download the specified file.""" def total_seconds(td): # Keep backward compatibility with Python 2.6 which doesn't have # this method if hasattr(td, 'total_seconds'): return td.total_seconds() else: re...
python
def download(self): """Download the specified file.""" def total_seconds(td): # Keep backward compatibility with Python 2.6 which doesn't have # this method if hasattr(td, 'total_seconds'): return td.total_seconds() else: re...
[ "def", "download", "(", "self", ")", ":", "def", "total_seconds", "(", "td", ")", ":", "# Keep backward compatibility with Python 2.6 which doesn't have", "# this method", "if", "hasattr", "(", "td", ",", "'total_seconds'", ")", ":", "return", "td", ".", "total_seco...
Download the specified file.
[ "Download", "the", "specified", "file", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L249-L324
9,882
mozilla/mozdownload
mozdownload/scraper.py
Scraper.show_matching_builds
def show_matching_builds(self, builds): """Output the matching builds.""" self.logger.info('Found %s build%s: %s' % ( len(builds), len(builds) > 1 and 's' or '', len(builds) > 10 and ' ... '.join([', '.join(builds[:5]), ', '.join(builds[-5:])]) or ...
python
def show_matching_builds(self, builds): """Output the matching builds.""" self.logger.info('Found %s build%s: %s' % ( len(builds), len(builds) > 1 and 's' or '', len(builds) > 10 and ' ... '.join([', '.join(builds[:5]), ', '.join(builds[-5:])]) or ...
[ "def", "show_matching_builds", "(", "self", ",", "builds", ")", ":", "self", ".", "logger", ".", "info", "(", "'Found %s build%s: %s'", "%", "(", "len", "(", "builds", ")", ",", "len", "(", "builds", ")", ">", "1", "and", "'s'", "or", "''", ",", "len...
Output the matching builds.
[ "Output", "the", "matching", "builds", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L326-L333
9,883
mozilla/mozdownload
mozdownload/scraper.py
DailyScraper.is_build_dir
def is_build_dir(self, folder_name): """Return whether or not the given dir contains a build.""" # Cannot move up to base scraper due to parser.entries call in # get_build_info_for_date (see below) url = '%s/' % urljoin(self.base_url, self.monthly_build_list_regex, folder_name) ...
python
def is_build_dir(self, folder_name): """Return whether or not the given dir contains a build.""" # Cannot move up to base scraper due to parser.entries call in # get_build_info_for_date (see below) url = '%s/' % urljoin(self.base_url, self.monthly_build_list_regex, folder_name) ...
[ "def", "is_build_dir", "(", "self", ",", "folder_name", ")", ":", "# Cannot move up to base scraper due to parser.entries call in", "# get_build_info_for_date (see below)", "url", "=", "'%s/'", "%", "urljoin", "(", "self", ".", "base_url", ",", "self", ".", "monthly_build...
Return whether or not the given dir contains a build.
[ "Return", "whether", "or", "not", "the", "given", "dir", "contains", "a", "build", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L435-L455
9,884
mozilla/mozdownload
mozdownload/scraper.py
DailyScraper.get_build_info_for_date
def get_build_info_for_date(self, date, build_index=None): """Return the build information for a given date.""" url = urljoin(self.base_url, self.monthly_build_list_regex) has_time = date and date.time() self.logger.info('Retrieving list of builds from %s' % url) parser = self._...
python
def get_build_info_for_date(self, date, build_index=None): """Return the build information for a given date.""" url = urljoin(self.base_url, self.monthly_build_list_regex) has_time = date and date.time() self.logger.info('Retrieving list of builds from %s' % url) parser = self._...
[ "def", "get_build_info_for_date", "(", "self", ",", "date", ",", "build_index", "=", "None", ")", ":", "url", "=", "urljoin", "(", "self", ".", "base_url", ",", "self", ".", "monthly_build_list_regex", ")", "has_time", "=", "date", "and", "date", ".", "tim...
Return the build information for a given date.
[ "Return", "the", "build", "information", "for", "a", "given", "date", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L457-L500
9,885
mozilla/mozdownload
mozdownload/scraper.py
DailyScraper.monthly_build_list_regex
def monthly_build_list_regex(self): """Return the regex for the folder containing builds of a month.""" # Regex for possible builds for the given date return r'nightly/%(YEAR)s/%(MONTH)s/' % { 'YEAR': self.date.year, 'MONTH': str(self.date.month).zfill(2)}
python
def monthly_build_list_regex(self): """Return the regex for the folder containing builds of a month.""" # Regex for possible builds for the given date return r'nightly/%(YEAR)s/%(MONTH)s/' % { 'YEAR': self.date.year, 'MONTH': str(self.date.month).zfill(2)}
[ "def", "monthly_build_list_regex", "(", "self", ")", ":", "# Regex for possible builds for the given date", "return", "r'nightly/%(YEAR)s/%(MONTH)s/'", "%", "{", "'YEAR'", ":", "self", ".", "date", ".", "year", ",", "'MONTH'", ":", "str", "(", "self", ".", "date", ...
Return the regex for the folder containing builds of a month.
[ "Return", "the", "regex", "for", "the", "folder", "containing", "builds", "of", "a", "month", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L544-L549
9,886
mozilla/mozdownload
mozdownload/scraper.py
DirectScraper.filename
def filename(self): """File name of the downloaded file.""" if os.path.splitext(self.destination)[1]: # If the filename has been given make use of it target_file = self.destination else: # Otherwise determine it from the url. parsed_url = urlparse(...
python
def filename(self): """File name of the downloaded file.""" if os.path.splitext(self.destination)[1]: # If the filename has been given make use of it target_file = self.destination else: # Otherwise determine it from the url. parsed_url = urlparse(...
[ "def", "filename", "(", "self", ")", ":", "if", "os", ".", "path", ".", "splitext", "(", "self", ".", "destination", ")", "[", "1", "]", ":", "# If the filename has been given make use of it", "target_file", "=", "self", ".", "destination", "else", ":", "# O...
File name of the downloaded file.
[ "File", "name", "of", "the", "downloaded", "file", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L577-L589
9,887
mozilla/mozdownload
mozdownload/scraper.py
ReleaseScraper.query_versions
def query_versions(self, version=None): """Check specified version and resolve special values.""" if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS: return [version] url = urljoin(self.base_url, 'releases/') parser = self._create_directory_parser(url) if versio...
python
def query_versions(self, version=None): """Check specified version and resolve special values.""" if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS: return [version] url = urljoin(self.base_url, 'releases/') parser = self._create_directory_parser(url) if versio...
[ "def", "query_versions", "(", "self", ",", "version", "=", "None", ")", ":", "if", "version", "not", "in", "RELEASE_AND_CANDIDATE_LATEST_VERSIONS", ":", "return", "[", "version", "]", "url", "=", "urljoin", "(", "self", ".", "base_url", ",", "'releases/'", "...
Check specified version and resolve special values.
[ "Check", "specified", "version", "and", "resolve", "special", "values", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L657-L670
9,888
mozilla/mozdownload
mozdownload/scraper.py
TinderboxScraper.build_list_regex
def build_list_regex(self): """Return the regex for the folder which contains the list of builds.""" regex = 'tinderbox-builds/%(BRANCH)s-%(PLATFORM)s%(L10N)s%(DEBUG)s/' return regex % { 'BRANCH': self.branch, 'PLATFORM': '' if self.locale_build else self.platform_regex,...
python
def build_list_regex(self): """Return the regex for the folder which contains the list of builds.""" regex = 'tinderbox-builds/%(BRANCH)s-%(PLATFORM)s%(L10N)s%(DEBUG)s/' return regex % { 'BRANCH': self.branch, 'PLATFORM': '' if self.locale_build else self.platform_regex,...
[ "def", "build_list_regex", "(", "self", ")", ":", "regex", "=", "'tinderbox-builds/%(BRANCH)s-%(PLATFORM)s%(L10N)s%(DEBUG)s/'", "return", "regex", "%", "{", "'BRANCH'", ":", "self", ".", "branch", ",", "'PLATFORM'", ":", "''", "if", "self", ".", "locale_build", "e...
Return the regex for the folder which contains the list of builds.
[ "Return", "the", "regex", "for", "the", "folder", "which", "contains", "the", "list", "of", "builds", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L845-L853
9,889
mozilla/mozdownload
mozdownload/scraper.py
TinderboxScraper.date_matches
def date_matches(self, timestamp): """Determine whether the timestamp date is equal to the argument date.""" if self.date is None: return False timestamp = datetime.fromtimestamp(float(timestamp), self.timezone) if self.date.date() == timestamp.date(): return Tru...
python
def date_matches(self, timestamp): """Determine whether the timestamp date is equal to the argument date.""" if self.date is None: return False timestamp = datetime.fromtimestamp(float(timestamp), self.timezone) if self.date.date() == timestamp.date(): return Tru...
[ "def", "date_matches", "(", "self", ",", "timestamp", ")", ":", "if", "self", ".", "date", "is", "None", ":", "return", "False", "timestamp", "=", "datetime", ".", "fromtimestamp", "(", "float", "(", "timestamp", ")", ",", "self", ".", "timezone", ")", ...
Determine whether the timestamp date is equal to the argument date.
[ "Determine", "whether", "the", "timestamp", "date", "is", "equal", "to", "the", "argument", "date", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L855-L864
9,890
mozilla/mozdownload
mozdownload/scraper.py
TinderboxScraper.get_build_info_for_index
def get_build_info_for_index(self, build_index=None): """Get additional information for the build at the given index.""" url = urljoin(self.base_url, self.build_list_regex) self.logger.info('Retrieving list of builds from %s' % url) parser = self._create_directory_parser(url) pa...
python
def get_build_info_for_index(self, build_index=None): """Get additional information for the build at the given index.""" url = urljoin(self.base_url, self.build_list_regex) self.logger.info('Retrieving list of builds from %s' % url) parser = self._create_directory_parser(url) pa...
[ "def", "get_build_info_for_index", "(", "self", ",", "build_index", "=", "None", ")", ":", "url", "=", "urljoin", "(", "self", ".", "base_url", ",", "self", ".", "build_list_regex", ")", "self", ".", "logger", ".", "info", "(", "'Retrieving list of builds from...
Get additional information for the build at the given index.
[ "Get", "additional", "information", "for", "the", "build", "at", "the", "given", "index", "." ]
97796a028455bb5200434562d23b66d5a5eb537b
https://github.com/mozilla/mozdownload/blob/97796a028455bb5200434562d23b66d5a5eb537b/mozdownload/scraper.py#L900-L935
9,891
romanz/trezor-agent
libagent/device/ui.py
create_default_options_getter
def create_default_options_getter(): """Return current TTY and DISPLAY settings for GnuPG pinentry.""" options = [] try: ttyname = subprocess.check_output(args=['tty']).strip() options.append(b'ttyname=' + ttyname) except subprocess.CalledProcessError as e: log.warning('no TTY fo...
python
def create_default_options_getter(): """Return current TTY and DISPLAY settings for GnuPG pinentry.""" options = [] try: ttyname = subprocess.check_output(args=['tty']).strip() options.append(b'ttyname=' + ttyname) except subprocess.CalledProcessError as e: log.warning('no TTY fo...
[ "def", "create_default_options_getter", "(", ")", ":", "options", "=", "[", "]", "try", ":", "ttyname", "=", "subprocess", ".", "check_output", "(", "args", "=", "[", "'tty'", "]", ")", ".", "strip", "(", ")", "options", ".", "append", "(", "b'ttyname='"...
Return current TTY and DISPLAY settings for GnuPG pinentry.
[ "Return", "current", "TTY", "and", "DISPLAY", "settings", "for", "GnuPG", "pinentry", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/ui.py#L64-L80
9,892
romanz/trezor-agent
libagent/device/ui.py
write
def write(p, line): """Send and flush a single line to the subprocess' stdin.""" log.debug('%s <- %r', p.args, line) p.stdin.write(line) p.stdin.flush()
python
def write(p, line): """Send and flush a single line to the subprocess' stdin.""" log.debug('%s <- %r', p.args, line) p.stdin.write(line) p.stdin.flush()
[ "def", "write", "(", "p", ",", "line", ")", ":", "log", ".", "debug", "(", "'%s <- %r'", ",", "p", ".", "args", ",", "line", ")", "p", ".", "stdin", ".", "write", "(", "line", ")", "p", ".", "stdin", ".", "flush", "(", ")" ]
Send and flush a single line to the subprocess' stdin.
[ "Send", "and", "flush", "a", "single", "line", "to", "the", "subprocess", "stdin", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/ui.py#L83-L87
9,893
romanz/trezor-agent
libagent/device/ui.py
expect
def expect(p, prefixes, confidential=False): """Read a line and return it without required prefix.""" resp = p.stdout.readline() log.debug('%s -> %r', p.args, resp if not confidential else '********') for prefix in prefixes: if resp.startswith(prefix): return resp[len(prefix):] r...
python
def expect(p, prefixes, confidential=False): """Read a line and return it without required prefix.""" resp = p.stdout.readline() log.debug('%s -> %r', p.args, resp if not confidential else '********') for prefix in prefixes: if resp.startswith(prefix): return resp[len(prefix):] r...
[ "def", "expect", "(", "p", ",", "prefixes", ",", "confidential", "=", "False", ")", ":", "resp", "=", "p", ".", "stdout", ".", "readline", "(", ")", "log", ".", "debug", "(", "'%s -> %r'", ",", "p", ".", "args", ",", "resp", "if", "not", "confident...
Read a line and return it without required prefix.
[ "Read", "a", "line", "and", "return", "it", "without", "required", "prefix", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/ui.py#L94-L101
9,894
romanz/trezor-agent
libagent/device/ui.py
interact
def interact(title, description, prompt, binary, options): """Use GPG pinentry program to interact with the user.""" args = [binary] p = subprocess.Popen(args=args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=os.environ) p...
python
def interact(title, description, prompt, binary, options): """Use GPG pinentry program to interact with the user.""" args = [binary] p = subprocess.Popen(args=args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=os.environ) p...
[ "def", "interact", "(", "title", ",", "description", ",", "prompt", ",", "binary", ",", "options", ")", ":", "args", "=", "[", "binary", "]", "p", "=", "subprocess", ".", "Popen", "(", "args", "=", "args", ",", "stdin", "=", "subprocess", ".", "PIPE"...
Use GPG pinentry program to interact with the user.
[ "Use", "GPG", "pinentry", "program", "to", "interact", "with", "the", "user", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/ui.py#L104-L141
9,895
romanz/trezor-agent
libagent/device/ui.py
UI.get_passphrase
def get_passphrase(self, prompt='Passphrase:'): """Ask the user for passphrase.""" passphrase = None if self.cached_passphrase_ack: passphrase = self.cached_passphrase_ack.get() if passphrase is None: passphrase = interact( title='{} passphrase'.fo...
python
def get_passphrase(self, prompt='Passphrase:'): """Ask the user for passphrase.""" passphrase = None if self.cached_passphrase_ack: passphrase = self.cached_passphrase_ack.get() if passphrase is None: passphrase = interact( title='{} passphrase'.fo...
[ "def", "get_passphrase", "(", "self", ",", "prompt", "=", "'Passphrase:'", ")", ":", "passphrase", "=", "None", "if", "self", ".", "cached_passphrase_ack", ":", "passphrase", "=", "self", ".", "cached_passphrase_ack", ".", "get", "(", ")", "if", "passphrase", ...
Ask the user for passphrase.
[ "Ask", "the", "user", "for", "passphrase", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/ui.py#L43-L57
9,896
romanz/trezor-agent
libagent/ssh/client.py
Client.export_public_keys
def export_public_keys(self, identities): """Export SSH public keys from the device.""" public_keys = [] with self.device: for i in identities: pubkey = self.device.pubkey(identity=i) vk = formats.decompress_pubkey(pubkey=pubkey, ...
python
def export_public_keys(self, identities): """Export SSH public keys from the device.""" public_keys = [] with self.device: for i in identities: pubkey = self.device.pubkey(identity=i) vk = formats.decompress_pubkey(pubkey=pubkey, ...
[ "def", "export_public_keys", "(", "self", ",", "identities", ")", ":", "public_keys", "=", "[", "]", "with", "self", ".", "device", ":", "for", "i", "in", "identities", ":", "pubkey", "=", "self", ".", "device", ".", "pubkey", "(", "identity", "=", "i"...
Export SSH public keys from the device.
[ "Export", "SSH", "public", "keys", "from", "the", "device", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/ssh/client.py#L21-L32
9,897
romanz/trezor-agent
libagent/ssh/client.py
Client.sign_ssh_challenge
def sign_ssh_challenge(self, blob, identity): """Sign given blob using a private key on the device.""" msg = _parse_ssh_blob(blob) log.debug('%s: user %r via %r (%r)', msg['conn'], msg['user'], msg['auth'], msg['key_type']) log.debug('nonce: %r', msg['nonce']) f...
python
def sign_ssh_challenge(self, blob, identity): """Sign given blob using a private key on the device.""" msg = _parse_ssh_blob(blob) log.debug('%s: user %r via %r (%r)', msg['conn'], msg['user'], msg['auth'], msg['key_type']) log.debug('nonce: %r', msg['nonce']) f...
[ "def", "sign_ssh_challenge", "(", "self", ",", "blob", ",", "identity", ")", ":", "msg", "=", "_parse_ssh_blob", "(", "blob", ")", "log", ".", "debug", "(", "'%s: user %r via %r (%r)'", ",", "msg", "[", "'conn'", "]", ",", "msg", "[", "'user'", "]", ",",...
Sign given blob using a private key on the device.
[ "Sign", "given", "blob", "using", "a", "private", "key", "on", "the", "device", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/ssh/client.py#L34-L49
9,898
romanz/trezor-agent
libagent/formats.py
fingerprint
def fingerprint(blob): """ Compute SSH fingerprint for specified blob. See https://en.wikipedia.org/wiki/Public_key_fingerprint for details. """ digest = hashlib.md5(blob).digest() return ':'.join('{:02x}'.format(c) for c in bytearray(digest))
python
def fingerprint(blob): """ Compute SSH fingerprint for specified blob. See https://en.wikipedia.org/wiki/Public_key_fingerprint for details. """ digest = hashlib.md5(blob).digest() return ':'.join('{:02x}'.format(c) for c in bytearray(digest))
[ "def", "fingerprint", "(", "blob", ")", ":", "digest", "=", "hashlib", ".", "md5", "(", "blob", ")", ".", "digest", "(", ")", "return", "':'", ".", "join", "(", "'{:02x}'", ".", "format", "(", "c", ")", "for", "c", "in", "bytearray", "(", "digest",...
Compute SSH fingerprint for specified blob. See https://en.wikipedia.org/wiki/Public_key_fingerprint for details.
[ "Compute", "SSH", "fingerprint", "for", "specified", "blob", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/formats.py#L34-L41
9,899
romanz/trezor-agent
libagent/formats.py
parse_pubkey
def parse_pubkey(blob): """ Parse SSH public key from given blob. Construct a verifier for ECDSA signatures. The verifier returns the signatures in the required SSH format. Currently, NIST256P1 and ED25519 elliptic curves are supported. """ fp = fingerprint(blob) s = io.BytesIO(blob) ...
python
def parse_pubkey(blob): """ Parse SSH public key from given blob. Construct a verifier for ECDSA signatures. The verifier returns the signatures in the required SSH format. Currently, NIST256P1 and ED25519 elliptic curves are supported. """ fp = fingerprint(blob) s = io.BytesIO(blob) ...
[ "def", "parse_pubkey", "(", "blob", ")", ":", "fp", "=", "fingerprint", "(", "blob", ")", "s", "=", "io", ".", "BytesIO", "(", "blob", ")", "key_type", "=", "util", ".", "read_frame", "(", "s", ")", "log", ".", "debug", "(", "'key type: %s'", ",", ...
Parse SSH public key from given blob. Construct a verifier for ECDSA signatures. The verifier returns the signatures in the required SSH format. Currently, NIST256P1 and ED25519 elliptic curves are supported.
[ "Parse", "SSH", "public", "key", "from", "given", "blob", "." ]
513b1259c4d7aca5f88cd958edc11828d0712f1b
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/formats.py#L44-L97