id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
175,162
from .base import Directive def render_ast_theading(children, level, tid): return { 'type': 'heading', 'children': children, 'level': level, 'id': tid, }
null
175,163
from .base import Directive def render_toc_ul(toc): """Render a <ul> table of content HTML. The param "toc" should be formatted into this structure:: [ (toc_id, text, level), ] For example:: [ ('toc-intro', 'Introduction', 1), ('toc-install', 'Install', ...
null
175,164
from .base import Directive def render_html_theading(text, level, tid): tag = 'h' + str(level) return '<' + tag + ' id="' + tid + '">' + text + '</' + tag + '>\n'
null
175,165
from .base import Directive def _cleanup_headings_text(inline, items, state): for item in items: text = item[1] tokens = inline._scan(text, state, inline.rules) text = ''.join(_inline_token_text(tok) for tok in tokens) yield item[0], text, item[2] The provided code snippet includes ...
Extract TOC headings into list structure of:: [ ('toc_1', 'Introduction', 1), ('toc_2', 'Install', 2), ('toc_3', 'Upgrade', 2), ('toc_4', 'License', 1), ] :param md: Markdown Instance with TOC plugin. :param s: text string.
175,166
import os from mistune.markdown import preprocess from .base import Directive def render_ast_include(text, relpath, abspath=None, options=None): return { 'type': 'include', 'text': text, 'relpath': relpath, 'abspath': abspath, 'options': options, }
null
175,167
import os from mistune.markdown import preprocess from .base import Directive def render_html_include(text, relpath, abspath=None, options=None): html = '<section class="directive-include" data-relpath="' return html + relpath + '">\n' + text + '</section>\n'
null
175,168
import re from .scanner import ScannerParser, Matcher from .inline_parser import ESCAPE_CHAR, LINK_LABEL from .util import unikey def _create_list_item_pattern(spaces, marker): prefix = r'( {0,' + str(len(spaces) + len(marker)) + r'})' if len(marker) > 1: if marker[-1] == '.': prefix = prefi...
null
175,169
import re DEFINITION_LIST_PATTERN = re.compile(r"([^\n]+\n(:[ \t][^\n]+\n)+\n?)+") def parse_def_list(block, m, state): lines = m.group(0).split("\n") definition_list_items = [] for line in lines: if not line: continue if line.strip()[0] == ":": definition_list_items....
null
175,170
import re def task_lists_hook(md, tokens, state): return _rewrite_all_list_items(tokens) def render_ast_task_list_item(children, level, checked): return { 'type': 'task_list_item', 'children': children, 'level': level, 'checked': checked, } def render_html_task_list_item(text...
null
175,171
import re TABLE_PATTERN = re.compile( r' {0,3}\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*' ) NP_TABLE_PATTERN = re.compile( r' {0,3}(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*' ) def parse_table(self, m, state): header = HEADER_SUB.sub('', m.group(1)).strip() align = HEADER_SUB...
null
175,172
from ..util import escape_url, ESCAPE_TEXT URL_LINK_PATTERN = r'''(https?:\/\/[^\s<]+[^<.,:;"')\]\s])''' def parse_url_link(inline, m, state): url = m.group(0) if state.get('_in_link'): return 'text', url return 'link', escape_url(url) def plugin_url(md): md.inline.register_rule('url_link', URL...
null
175,173
from ..util import escape_url, ESCAPE_TEXT STRIKETHROUGH_PATTERN = ( r'~~(?=[^\s~])(' r'(?:\\~|[^~])*' r'(?:' + ESCAPE_TEXT + r'|[^\s~]))~~' ) def parse_strikethrough(inline, m, state): text = m.group(1) return 'strikethrough', inline.render(text, state) def render_html_strikethrough(text): retu...
null
175,174
import re from ..inline_parser import LINK_LABEL from ..util import unikey INLINE_FOOTNOTE_PATTERN = r'\[\^(' + LINK_LABEL + r')\]' DEF_FOOTNOTE = re.compile( r'( {0,3})\[\^(' + LINK_LABEL + r')\]:[ \t]*(' r'[^\n]*\n+' r'(?:\1 {1,3}(?! )[^\n]*\n+)*' r')' ) def parse_inline_footnote(inline, m, state): ...
null
175,175
import re from ..util import escape_html DEF_ABBR = re.compile( # *[HTML]: # *[HTML]: Hyper Text Markup Language # *[HTML]: # Hyper Text Markup Language r'\*\[([^\]]+)\]:' r'((?:[ \t]*\n(?: {3,}|\t)[^\n]+)|(?:[^\n]*))\n*' ) def parse_def_abbr(block, m, state): def_abbrs = state.get('def_...
null
175,176
import socket import ssl import socks def merge_dict(a, b): d = a.copy() d.update(b) return d
null
175,177
import socket import ssl import socks def is_ip(s): try: if ':' in s: socket.inet_pton(socket.AF_INET6, s) elif '.' in s: socket.inet_aton(s) else: return False except: return False else: return True
null
175,178
import asyncio import codecs import itertools import logging import os import select import signal import warnings from collections import deque from concurrent import futures from tornado.ioloop import IOLoop def preexec_fn(): signal.signal(signal.SIGPIPE, signal.SIG_DFL)
null
175,179
import asyncio import codecs import itertools import logging import os import select import signal import warnings from collections import deque from concurrent import futures from tornado.ioloop import IOLoop The provided code snippet includes necessary dependencies for implementing the `_update_removing` function. W...
Like dict.update(), but remove keys where the value is None.
175,180
import asyncio import codecs import itertools import logging import os import select import signal import warnings from collections import deque from concurrent import futures from tornado.ioloop import IOLoop The provided code snippet includes necessary dependencies for implementing the `_poll` function. Write a Pyth...
Poll using poll() on posix systems and select() elsewhere (e.g., Windows)
175,181
import json import logging import os import tornado.websocket from tornado import gen from tornado.concurrent import run_on_executor def _cast_unicode(s): if isinstance(s, bytes): return s.decode("utf-8") return s
null
175,182
from fontTools.misc.arrayTools import pairwise from fontTools.pens.filterPen import ContourFilterPen def pairwise(iterable, reverse=False): """Iterate over current and next items in iterable. Args: iterable: An iterable reverse: If true, iterate in reverse order. Returns: A iterab...
Generator that takes a list of pen's (operator, operands) tuples, and yields them with the winding direction reversed.
175,183
from fontTools.pens.basePen import BasePen from fontTools.misc.bezierTools import ( approximateQuadraticArcLengthC, calcQuadraticArcLengthC, approximateCubicArcLengthC, calcCubicArcLengthC, ) import math def _distance(p0, p1): return math.hypot(p0[0] - p1[0], p0[1] - p1[1])
null
175,184
from typing import Tuple, Dict from fontTools.misc.loggingTools import LogMixin from fontTools.misc.transform import DecomposedTransform The provided code snippet includes necessary dependencies for implementing the `decomposeSuperBezierSegment` function. Write a Python function `def decomposeSuperBezierSegment(points...
Split the SuperBezier described by 'points' into a list of regular bezier segments. The 'points' argument must be a sequence with length 3 or greater, containing (x, y) coordinates. The last point is the destination on-curve point, the rest of the points are off-curve points. The start point should not be supplied. Thi...
175,185
from typing import Tuple, Dict from fontTools.misc.loggingTools import LogMixin from fontTools.misc.transform import DecomposedTransform The provided code snippet includes necessary dependencies for implementing the `decomposeQuadraticSegment` function. Write a Python function `def decomposeQuadraticSegment(points)` t...
Split the quadratic curve segment described by 'points' into a list of "atomic" quadratic segments. The 'points' argument must be a sequence with length 2 or greater, containing (x, y) coordinates. The last point is the destination on-curve point, the rest of the points are off-curve points. The start point should not ...
175,186
from array import array from typing import Any, Dict, Optional, Tuple from fontTools.misc.fixedTools import MAX_F2DOT14, floatToFixedToFloat from fontTools.misc.loggingTools import LogMixin from fontTools.pens.pointPen import AbstractPointPen from fontTools.misc.roundTools import otRound from fontTools.pens.basePen imp...
null
175,187
import math from fontTools.pens.momentsPen import MomentsPen class StatisticsPen(MomentsPen): """Pen calculating area, center of mass, variance and standard-deviation, covariance and correlation, and slant, of glyph shapes. Note that all the calculated values are 'signed'. Ie. if the glyph shape is ...
null
175,188
from fontTools.pens.basePen import AbstractPen, DecomposingPen from fontTools.pens.pointPen import AbstractPointPen The provided code snippet includes necessary dependencies for implementing the `replayRecording` function. Write a Python function `def replayRecording(recording, pen)` to solve the following problem: Re...
Replay a recording, as produced by RecordingPen or DecomposingRecordingPen, to a pen. Note that recording does not have to be produced by those pens. It can be any iterable of tuples of method name and tuple-of-arguments. Likewise, pen can be any objects receiving those method calls.
175,189
from typing import Callable from fontTools.pens.basePen import BasePen def pointToString(pt, ntos=str): return " ".join(ntos(i) for i in pt)
null
175,190
from __future__ import annotations from dataclasses import dataclass from typing import Dict, List, Optional, Union, cast from fontTools.designspaceLib import ( AxisDescriptor, DesignSpaceDocument, DesignSpaceDocumentError, RangeAxisSubsetDescriptor, SimpleLocationDict, ValueAxisSubsetDescriptor...
null
175,191
from __future__ import annotations import itertools import logging import math from typing import Any, Callable, Dict, Iterator, List, Tuple, cast from fontTools.designspaceLib import ( AxisDescriptor, DesignSpaceDocument, DiscreteAxisDescriptor, InstanceDescriptor, RuleDescriptor, SimpleLocatio...
Convert each variable font listed in this document into a standalone format 4 designspace. This can be used to compile all the variable fonts from a format 5 designspace using tools that only know about format 4. .. versionadded:: 5.0
175,192
import os import argparse import logging import shutil import multiprocessing as mp from contextlib import closing from functools import partial import fontTools from .ufo import font_to_quadratic, fonts_to_quadratic def _cpu_count(): try: return mp.cpu_count() except NotImplementedError: # pragma: no...
null
175,193
import os import argparse import logging import shutil import multiprocessing as mp from contextlib import closing from functools import partial import fontTools from .ufo import font_to_quadratic, fonts_to_quadratic logger = logging.getLogger("fontTools.cu2qu") def open_ufo(path): if hasattr(ufo_module.Font, "open...
null
175,194
import math from .errors import Error as Cu2QuError, ApproxNotFoundError MAX_N = 100 def cubic_approx_spline(cubic, n, tolerance, all_quadratic, _2_3=2 / 3): """Approximate a cubic Bezier curve with a spline of n quadratics. Args: cubic (sequence): Four complex numbers representing control points of ...
Approximate a cubic Bezier curve with a spline of n quadratics. Args: cubic (sequence): Four 2D tuples representing control points of the cubic Bezier curve. max_err (double): Permitted deviation from the original curve. all_quadratic (bool): If True (default) returned value is a quadratic spline. If False, it's either...
175,195
import math from .errors import Error as Cu2QuError, ApproxNotFoundError MAX_N = 100 def cubic_approx_spline(cubic, n, tolerance, all_quadratic, _2_3=2 / 3): """Approximate a cubic Bezier curve with a spline of n quadratics. Args: cubic (sequence): Four complex numbers representing control points of ...
Return quadratic Bezier splines approximating the input cubic Beziers. Args: curves: A sequence of *n* curves, each curve being a sequence of four 2D tuples. max_errors: A sequence of *n* floats representing the maximum permissible deviation from each of the cubic Bezier curves. all_quadratic (bool): If True (default) ...
175,196
import logging from fontTools.pens.basePen import AbstractPen from fontTools.pens.pointPen import PointToSegmentPen from fontTools.pens.reverseContourPen import ReverseContourPen from . import curves_to_quadratic from .errors import ( UnequalZipLengthsError, IncompatibleSegmentNumberError, IncompatibleSegme...
Convenience wrapper around glyphs_to_quadratic, for just one glyph. Return True if the glyph was modified, else return False.
175,197
from .cu2qu import * import random import timeit MAX_ERR = 0.05 def generate_curve(): ) ) ) ) ) ) ) ) ) ) ) ) ) ) def setup_curve_to_quadratic(): return generate_curve(), MAX_ERR
null
175,198
from .cu2qu import * import random import timeit MAX_ERR = 0.05 def generate_curve(): return [ tuple(float(random.randint(0, 2048)) for coord in range(2)) for point in range(4) ] ) ) ) ) ) ) ) ) ) ) ) ) ) ) def setup_curves_to_quadratic(): num_...
null
175,199
from .cu2qu import * import random import timeit ) ) ) ) ) ) ) ) ) ) ) ) ) ) def run_benchmark(module, function, setup_suffix="", repeat=5, number=1000): setup_func = "setup_" + function if setup_suffix: print("%s with %s:" % (function, setup_suffix), end=...
null
175,200
from fontTools.misc.textTools import tostr import re _aglText = """\ # ----------------------------------------------------------- # Copyright 2002-2019 Adobe (http://www.adobe.com/). # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the # following condi...
null
175,201
from fontTools.misc.textTools import tostr import re def _glyphComponentToUnicode(component, isZapfDingbats): # If the font is Zapf Dingbats (PostScript FontName: ZapfDingbats), # and the component is in the ITC Zapf Dingbats Glyph List, then # map it to the corresponding character in that list. dingbat...
Convert glyph names to Unicode, such as ``'longs_t.oldstyle'`` --> ``u'ſt'`` If ``isZapfDingbats`` is ``True``, the implementation recognizes additional glyph names (as required by the AGL specification).
175,202
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.location import FeatureLibLocation from fontTools.misc.encodingTools import getEncoding from fontTools.misc.textTools import byteord, tobytes from collections import OrderedDict import itertools def deviceToString(device): if device is None: ...
null
175,203
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.location import FeatureLibLocation from fontTools.misc.encodingTools import getEncoding from fontTools.misc.textTools import byteord, tobytes from collections import OrderedDict import itertools fea_keywords = set( [ "anchor", ...
null
175,204
from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.location import FeatureLibLocation from fontTools.misc.encodingTools import getEncoding from fontTools.misc.textTools import byteord, tobytes from collections import OrderedDict import itertools def simplify_name_attributes(pid, eid, lid): if...
null
175,205
from fontTools.misc import sstruct from fontTools.misc.textTools import Tag, tostr, binary2num, safeEval from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.lookupDebugInfo import ( LookupDebugInfo, LOOKUP_DEBUG_INFO_KEY, LOOKUP_DEBUG_ENV_VAR, ) from fontTools.feaLib.parser import Parse...
Add features from a string to a font. Note that this replaces any features currently present. Args: font (feaLib.ttLib.TTFont): The font object. features: A string containing feature code. filename: The directory containing ``filename`` is used as the root of relative ``include()`` paths; if ``None`` is provided, the c...
175,206
from fontTools.varLib.models import VariationModel, normalizeValue, piecewiseLinearMap def Location(loc): return tuple(sorted(loc.items()))
null
175,207
import warnings import functools The provided code snippet includes necessary dependencies for implementing the `deprecated` function. Write a Python function `def deprecated(msg="")` to solve the following problem: Decorator factory to mark functions as deprecated with given message. >>> @deprecated("Enough!") ... de...
Decorator factory to mark functions as deprecated with given message. >>> @deprecated("Enough!") ... def some_function(): ... "I just print 'hello world'." ... print("hello world") >>> some_function() hello world >>> some_function.__doc__ == "I just print 'hello world'." True
175,208
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
Wrapper around the userNameToFileName function in filenames.py Note that existingFileNames should be a set for large glyphsets or performance will suffer.
175,209
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
Read .glif data from a string into a glyph object. The 'glyphObject' argument can be any kind of object (even None); the readGlyphFromString() method will attempt to set the following attributes on it: width the advance width of the glyph height the advance height of the glyph unicodes a list of unicode values for this...
175,210
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
Return .glif data for a glyph as a string. The XML declaration's encoding is always set to "UTF-8". The 'glyphObject' argument can be any kind of object (even None); the writeGlyphToString() method will attempt to get the following attributes from it: width the advance width of the glyph height the advance height of th...
175,211
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
This performs very basic validation of the value for infoData following the UFO 3 layerinfo.plist specification. The results of this should not be interpretted as *correct* for the font that they are part of. This merely indicates that the values are of the proper type and, where the specification defines a set range o...
175,212
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
null
175,213
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
null
175,214
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
null
175,215
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
Get a list of unicodes listed in glif.
175,216
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
The image file name (if any) from glif.
175,217
from __future__ import annotations import logging import enum from warnings import warn from collections import OrderedDict import fs import fs.base import fs.errors import fs.osfs import fs.path from fontTools.misc.textTools import tobytes from fontTools.misc import plistlib from fontTools.pens.pointPen import Abstrac...
Get a list of component base glyphs listed in glif.
175,218
def findKnownKerningGroups(groups): """ This will find kerning groups with known prefixes. In some cases not all kerning groups will be referenced by the kerning pairs. The algorithm for locating groups in convertUFO1OrUFO2KerningToUFO3Kerning will miss these unreferenced groups. By scanning for...
null
175,219
from fontTools.misc.plistlib import dump, dumps, load, loads from fontTools.misc.textTools import tobytes from fontTools.ufoLib.utils import deprecated def load( fp: IO[bytes], use_builtin_types: Optional[bool] = None, dict_type: Type[MutableMapping[str, Any]] = dict, ) -> Any: """Load a plist file int...
null
175,220
from fontTools.misc.plistlib import dump, dumps, load, loads from fontTools.misc.textTools import tobytes from fontTools.ufoLib.utils import deprecated def dump( value: PlistEncodable, fp: IO[bytes], sort_keys: bool = True, skipkeys: bool = False, use_builtin_types: Optional[bool] = None, prett...
null
175,221
from fontTools.misc.plistlib import dump, dumps, load, loads from fontTools.misc.textTools import tobytes from fontTools.ufoLib.utils import deprecated def loads( value: bytes, use_builtin_types: Optional[bool] = None, dict_type: Type[MutableMapping[str, Any]] = dict, ) -> Any: """Load a plist file fro...
null
175,222
from fontTools.misc.plistlib import dump, dumps, load, loads from fontTools.misc.textTools import tobytes from fontTools.ufoLib.utils import deprecated def dumps( value: PlistEncodable, sort_keys: bool = True, skipkeys: bool = False, use_builtin_types: Optional[bool] = None, pretty_print: bool = Tr...
null
175,223
The provided code snippet includes necessary dependencies for implementing the `lookupKerningValue` function. Write a Python function `def lookupKerningValue( pair, kerning, groups, fallback=0, glyphToFirstGroup=None, glyphToSecondGroup=None )` to solve the following problem: Note: This expects kerning to be a fl...
Note: This expects kerning to be a flat dictionary of kerning pairs, not the nested structure used in kerning.plist. >>> groups = { ... "public.kern1.O" : ["O", "D", "Q"], ... "public.kern2.E" : ["E", "F"] ... } >>> kerning = { ... ("public.kern1.O", "public.kern2.E") : -100, ... ("public.kern1.O", "F") : -200, ... ("D...
175,224
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes numberTypes = (int, float) The provided code snippet includes necessary dependencies for implementing the `genericNonNegativeNumberValidator` function. Write a Python fu...
Generic. (Added at version 3.)
175,225
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoStyleMapStyleNameValidator` function. Write a Python function `def fontInfoStyleMa...
Version 2+.
175,226
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericIntListValidator(values, validValues): """ Generic. (Added at version 2.) """ if not isinstance(values, (list, tuple)): return False ...
Version 3+.
175,227
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoOpenTypeHeadCreatedValidator` function. Write a Python function `def fontInfoOpenT...
Version 2+.
175,228
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,229
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoOpenTypeOS2WeightClassValidator` function. Write a Python function `def fontInfoOp...
Version 2+.
175,230
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoOpenTypeOS2WidthClassValidator` function. Write a Python function `def fontInfoOpe...
Version 2+.
175,231
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoVersion2OpenTypeOS2PanoseValidator` function. Write a Python function `def fontInf...
Version 2.
175,232
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoVersion3OpenTypeOS2PanoseValidator` function. Write a Python function `def fontInf...
Version 3+.
175,233
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoOpenTypeOS2FamilyClassValidator` function. Write a Python function `def fontInfoOp...
Version 2+.
175,234
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes numberTypes = (int, float) The provided code snippet includes necessary dependencies for implementing the `fontInfoPostscriptBluesValidator` function. Write a Python fun...
Version 2+.
175,235
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes numberTypes = (int, float) The provided code snippet includes necessary dependencies for implementing the `fontInfoPostscriptOtherBluesValidator` function. Write a Pytho...
Version 2+.
175,236
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes numberTypes = (int, float) The provided code snippet includes necessary dependencies for implementing the `fontInfoPostscriptStemsValidator` function. Write a Python fun...
Version 2+.
175,237
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `fontInfoPostscriptWindowsCharacterSetValidator` function. Write a Python function `def fon...
Version 2+.
175,238
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,239
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,240
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,241
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,242
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,243
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,244
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,245
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def genericDictValidator(value, prototype): """ Generic. (Added at version 3.) """ # not a dict if not isinstance(value, Mapping): return False...
Version 3+.
175,246
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def fontInfoWOFFMetadataExtensionValidator(value): """ Version 3+. """ dictPrototype = dict(names=(list, False), items=(list, True), id=(str, False)) i...
Version 3+.
175,247
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes pngSignature = b"\x89PNG\r\n\x1a\n" open = builtins.open The provided code snippet includes necessary dependencies for implementing the `pngValidator` function. Write a ...
Version 3+. This checks the signature of the image data.
175,248
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes The provided code snippet includes necessary dependencies for implementing the `layerContentsValidator` function. Write a Python function `def layerContentsValidator(valu...
Check the validity of layercontents.plist. Version 3+.
175,249
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def isDictEnough(value): """ Some objects will likely come in that aren't dicts but are dict-ish enough. """ if isinstance(value, Mapping): ret...
Check the validity of the groups. Version 3+ (though it's backwards compatible with UFO 1 and UFO 2). >>> groups = {"A" : ["A", "A"], "A2" : ["A"]} >>> groupsValidator(groups) (True, None) >>> groups = {"" : ["A"]} >>> valid, msg = groupsValidator(groups) >>> valid False >>> print(msg) A group has an empty name. >>> gr...
175,250
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes numberTypes = (int, float) The provided code snippet includes necessary dependencies for implementing the `kerningValidator` function. Write a Python function `def kerni...
Check the validity of the kerning data structure. Version 3+ (though it's backwards compatible with UFO 1 and UFO 2). >>> kerning = {"A" : {"B" : 100}} >>> kerningValidator(kerning) (True, None) >>> kerning = {"A" : ["B"]} >>> valid, msg = kerningValidator(kerning) >>> valid False >>> print(msg) The kerning data is not...
175,251
import calendar from io import open import fs.base import fs.osfs from collections.abc import Mapping from fontTools.ufoLib.utils import numberTypes def isDictEnough(value): """ Some objects will likely come in that aren't dicts but are dict-ish enough. """ if isinstance(value, Mapping): ret...
Check the validity of the lib. Version 3+ (though it's backwards compatible with UFO 1 and UFO 2). >>> lib = {"foo" : "bar"} >>> fontLibValidator(lib) (True, None) >>> lib = {"public.awesome" : "hello"} >>> fontLibValidator(lib) (True, None) >>> lib = {"public.glyphOrder" : ["A", "C", "B"]} >>> fontLibValidator(lib) (T...
175,252
import collections import enum from fontTools.ttLib.tables.otBase import ( BaseTable, FormatSwitchingBaseTable, UInt8FormatSwitchingBaseTable, ) from fontTools.ttLib.tables.otConverters import ( ComputedInt, SimpleValue, Struct, Short, UInt8, UShort, IntValue, FloatValue, ...
null
175,253
import collections import enum from fontTools.ttLib.tables.otBase import ( BaseTable, FormatSwitchingBaseTable, UInt8FormatSwitchingBaseTable, ) from fontTools.ttLib.tables.otConverters import ( ComputedInt, SimpleValue, Struct, Short, UInt8, UShort, IntValue, FloatValue, ...
null
175,254
import collections import copy import enum from functools import partial from math import ceil, log from typing import ( Any, Dict, Generator, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, ) from fontTools.misc.arrayTools import intRect from fo...
null
175,255
import collections import copy import enum from functools import partial from math import ceil, log from typing import ( Any, Dict, Generator, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, ) from fontTools.misc.arrayTools import intRect from fo...
Build COLR table from color layers mapping. Args: colorGlyphs: map of base glyph name to, either list of (layer glyph name, color palette index) tuples for COLRv0; or a single ``Paint`` (dict) or list of ``Paint`` for COLRv1. version: the version of COLR table. If None, the version is determined by the presence of COLR...
175,256
import collections import copy import enum from functools import partial from math import ceil, log from typing import ( Any, Dict, Generator, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, ) from fontTools.misc.arrayTools import intRect from fo...
Build CPAL table from list of color palettes. Args: palettes: list of lists of colors encoded as tuples of (R, G, B, A) floats in the range [0..1]. paletteTypes: optional list of ColorPaletteType, one for each palette. paletteLabels: optional list of palette labels. Each lable can be either: None (no label), a string (...
175,257
import collections import copy import enum from functools import partial from math import ceil, log from typing import ( Any, Dict, Generator, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, ) from fontTools.misc.arrayTools import intRect from fo...
null
175,258
from fontTools.ttLib.tables import otTables as ot from .table_builder import TableUnbuilder class LayerListUnbuilder: def __init__(self, layers): self.layers = layers callbacks = { ( ot.Paint, ot.PaintFormat.PaintColrLayers, ): self._unbuildPai...
null
175,259
from fontTools.ttLib.tables import otTables as ot from .table_builder import TableUnbuilder def _flatten_layers(lst): for paint in lst: if paint["Format"] == ot.PaintFormat.PaintColrLayers: yield from _flatten_layers(paint["Layers"]) else: yield paint
null
175,260
from math import copysign, cos, hypot, isclose, pi from fontTools.misc.roundTools import otRound def otRound(value): def _round_point(pt): return (otRound(pt[0]), otRound(pt[1]))
null
175,261
from __future__ import annotations from typing import Dict, List, Union import fontTools.otlLib.builder from fontTools.designspaceLib import ( AxisLabelDescriptor, DesignSpaceDocument, DesignSpaceDocumentError, LocationLabelDescriptor, ) from fontTools.designspaceLib.types import Region, getVFUserRegion...
Build the STAT table for the variable font identified by its name in the given document. Knowing which variable we're building STAT data for is needed to subset the STAT locations to only include what the variable font actually ships. .. versionadded:: 5.0 .. seealso:: - :func:`getStatAxes()` - :func:`getStatLocations(...