partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
count_cycles
Count cycles in the series. Parameters ---------- series : iterable sequence of numbers ndigits : int, optional Round cycle magnitudes to the given number of digits before counting. left: bool, optional If True, treat the first point in the series as a reversal. right: bool, opt...
src/rainflow.py
def count_cycles(series, ndigits=None, left=False, right=False): """Count cycles in the series. Parameters ---------- series : iterable sequence of numbers ndigits : int, optional Round cycle magnitudes to the given number of digits before counting. left: bool, optional If True,...
def count_cycles(series, ndigits=None, left=False, right=False): """Count cycles in the series. Parameters ---------- series : iterable sequence of numbers ndigits : int, optional Round cycle magnitudes to the given number of digits before counting. left: bool, optional If True,...
[ "Count", "cycles", "in", "the", "series", "." ]
iamlikeme/rainflow
python
https://github.com/iamlikeme/rainflow/blob/7725ea2c591ad3d4aab688d1c1d8385d665a07d4/src/rainflow.py#L125-L150
[ "def", "count_cycles", "(", "series", ",", "ndigits", "=", "None", ",", "left", "=", "False", ",", "right", "=", "False", ")", ":", "counts", "=", "defaultdict", "(", "float", ")", "round_", "=", "_get_round_function", "(", "ndigits", ")", "for", "low", ...
7725ea2c591ad3d4aab688d1c1d8385d665a07d4
valid
render
Recipe to render a given FST node. The FST is composed of branch nodes which are either lists or dicts and of leaf nodes which are strings. Branch nodes can have other list, dict or leaf nodes as childs. To render a string, simply output it. To render a list, render each of its elements in order. ...
baron/render.py
def render(node, strict=False): """Recipe to render a given FST node. The FST is composed of branch nodes which are either lists or dicts and of leaf nodes which are strings. Branch nodes can have other list, dict or leaf nodes as childs. To render a string, simply output it. To render a list, ren...
def render(node, strict=False): """Recipe to render a given FST node. The FST is composed of branch nodes which are either lists or dicts and of leaf nodes which are strings. Branch nodes can have other list, dict or leaf nodes as childs. To render a string, simply output it. To render a list, ren...
[ "Recipe", "to", "render", "a", "given", "FST", "node", "." ]
PyCQA/baron
python
https://github.com/PyCQA/baron/blob/a475654f7f40c445746577ff410e1e7dceb52097/baron/render.py#L5-L45
[ "def", "render", "(", "node", ",", "strict", "=", "False", ")", ":", "if", "isinstance", "(", "node", ",", "list", ")", ":", "return", "render_list", "(", "node", ")", "elif", "isinstance", "(", "node", ",", "dict", ")", ":", "return", "render_node", ...
a475654f7f40c445746577ff410e1e7dceb52097
valid
path_to_node
FST node located at the given path
baron/path.py
def path_to_node(tree, path): """FST node located at the given path""" if path is None: return None node = tree for key in path: node = child_by_key(node, key) return node
def path_to_node(tree, path): """FST node located at the given path""" if path is None: return None node = tree for key in path: node = child_by_key(node, key) return node
[ "FST", "node", "located", "at", "the", "given", "path" ]
PyCQA/baron
python
https://github.com/PyCQA/baron/blob/a475654f7f40c445746577ff410e1e7dceb52097/baron/path.py#L14-L24
[ "def", "path_to_node", "(", "tree", ",", "path", ")", ":", "if", "path", "is", "None", ":", "return", "None", "node", "=", "tree", "for", "key", "in", "path", ":", "node", "=", "child_by_key", "(", "node", ",", "key", ")", "return", "node" ]
a475654f7f40c445746577ff410e1e7dceb52097
valid
PositionFinder.before_constant
Determine if we're on the targetted node. If the targetted column is reached, `stop` and `path_found` are set. If the targetted line is passed, only `stop` is set. This prevents unnecessary tree travelling when the targetted column is out of bounds.
baron/path.py
def before_constant(self, constant, key): """Determine if we're on the targetted node. If the targetted column is reached, `stop` and `path_found` are set. If the targetted line is passed, only `stop` is set. This prevents unnecessary tree travelling when the targetted column is...
def before_constant(self, constant, key): """Determine if we're on the targetted node. If the targetted column is reached, `stop` and `path_found` are set. If the targetted line is passed, only `stop` is set. This prevents unnecessary tree travelling when the targetted column is...
[ "Determine", "if", "we", "re", "on", "the", "targetted", "node", "." ]
PyCQA/baron
python
https://github.com/PyCQA/baron/blob/a475654f7f40c445746577ff410e1e7dceb52097/baron/path.py#L200-L222
[ "def", "before_constant", "(", "self", ",", "constant", ",", "key", ")", ":", "newlines_split", "=", "split_on_newlines", "(", "constant", ")", "for", "c", "in", "newlines_split", ":", "if", "is_newline", "(", "c", ")", ":", "self", ".", "current", ".", ...
a475654f7f40c445746577ff410e1e7dceb52097
valid
get_prefix
Returns prefix for a given multicodec :param str multicodec: multicodec codec name :return: the prefix for the given multicodec :rtype: byte :raises ValueError: if an invalid multicodec name is provided
multicodec/multicodec.py
def get_prefix(multicodec): """ Returns prefix for a given multicodec :param str multicodec: multicodec codec name :return: the prefix for the given multicodec :rtype: byte :raises ValueError: if an invalid multicodec name is provided """ try: prefix = varint.encode(NAME_TABLE[m...
def get_prefix(multicodec): """ Returns prefix for a given multicodec :param str multicodec: multicodec codec name :return: the prefix for the given multicodec :rtype: byte :raises ValueError: if an invalid multicodec name is provided """ try: prefix = varint.encode(NAME_TABLE[m...
[ "Returns", "prefix", "for", "a", "given", "multicodec" ]
multiformats/py-multicodec
python
https://github.com/multiformats/py-multicodec/blob/23213b8b40b21e17e2e1844224498cbd8e359bfa/multicodec/multicodec.py#L21-L34
[ "def", "get_prefix", "(", "multicodec", ")", ":", "try", ":", "prefix", "=", "varint", ".", "encode", "(", "NAME_TABLE", "[", "multicodec", "]", ")", "except", "KeyError", ":", "raise", "ValueError", "(", "'{} multicodec is not supported.'", ".", "format", "("...
23213b8b40b21e17e2e1844224498cbd8e359bfa
valid
add_prefix
Adds multicodec prefix to the given bytes input :param str multicodec: multicodec to use for prefixing :param bytes bytes_: data to prefix :return: prefixed byte data :rtype: bytes
multicodec/multicodec.py
def add_prefix(multicodec, bytes_): """ Adds multicodec prefix to the given bytes input :param str multicodec: multicodec to use for prefixing :param bytes bytes_: data to prefix :return: prefixed byte data :rtype: bytes """ prefix = get_prefix(multicodec) return b''.join([prefix, b...
def add_prefix(multicodec, bytes_): """ Adds multicodec prefix to the given bytes input :param str multicodec: multicodec to use for prefixing :param bytes bytes_: data to prefix :return: prefixed byte data :rtype: bytes """ prefix = get_prefix(multicodec) return b''.join([prefix, b...
[ "Adds", "multicodec", "prefix", "to", "the", "given", "bytes", "input" ]
multiformats/py-multicodec
python
https://github.com/multiformats/py-multicodec/blob/23213b8b40b21e17e2e1844224498cbd8e359bfa/multicodec/multicodec.py#L37-L47
[ "def", "add_prefix", "(", "multicodec", ",", "bytes_", ")", ":", "prefix", "=", "get_prefix", "(", "multicodec", ")", "return", "b''", ".", "join", "(", "[", "prefix", ",", "bytes_", "]", ")" ]
23213b8b40b21e17e2e1844224498cbd8e359bfa
valid
remove_prefix
Removes prefix from a prefixed data :param bytes bytes_: multicodec prefixed data bytes :return: prefix removed data bytes :rtype: bytes
multicodec/multicodec.py
def remove_prefix(bytes_): """ Removes prefix from a prefixed data :param bytes bytes_: multicodec prefixed data bytes :return: prefix removed data bytes :rtype: bytes """ prefix_int = extract_prefix(bytes_) prefix = varint.encode(prefix_int) return bytes_[len(prefix):]
def remove_prefix(bytes_): """ Removes prefix from a prefixed data :param bytes bytes_: multicodec prefixed data bytes :return: prefix removed data bytes :rtype: bytes """ prefix_int = extract_prefix(bytes_) prefix = varint.encode(prefix_int) return bytes_[len(prefix):]
[ "Removes", "prefix", "from", "a", "prefixed", "data" ]
multiformats/py-multicodec
python
https://github.com/multiformats/py-multicodec/blob/23213b8b40b21e17e2e1844224498cbd8e359bfa/multicodec/multicodec.py#L50-L60
[ "def", "remove_prefix", "(", "bytes_", ")", ":", "prefix_int", "=", "extract_prefix", "(", "bytes_", ")", "prefix", "=", "varint", ".", "encode", "(", "prefix_int", ")", "return", "bytes_", "[", "len", "(", "prefix", ")", ":", "]" ]
23213b8b40b21e17e2e1844224498cbd8e359bfa
valid
get_codec
Gets the codec used for prefix the multicodec prefixed data :param bytes bytes_: multicodec prefixed data bytes :return: name of the multicodec used to prefix :rtype: str
multicodec/multicodec.py
def get_codec(bytes_): """ Gets the codec used for prefix the multicodec prefixed data :param bytes bytes_: multicodec prefixed data bytes :return: name of the multicodec used to prefix :rtype: str """ prefix = extract_prefix(bytes_) try: return CODE_TABLE[prefix] except Key...
def get_codec(bytes_): """ Gets the codec used for prefix the multicodec prefixed data :param bytes bytes_: multicodec prefixed data bytes :return: name of the multicodec used to prefix :rtype: str """ prefix = extract_prefix(bytes_) try: return CODE_TABLE[prefix] except Key...
[ "Gets", "the", "codec", "used", "for", "prefix", "the", "multicodec", "prefixed", "data" ]
multiformats/py-multicodec
python
https://github.com/multiformats/py-multicodec/blob/23213b8b40b21e17e2e1844224498cbd8e359bfa/multicodec/multicodec.py#L63-L75
[ "def", "get_codec", "(", "bytes_", ")", ":", "prefix", "=", "extract_prefix", "(", "bytes_", ")", "try", ":", "return", "CODE_TABLE", "[", "prefix", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "'Prefix {} not present in the lookup table'", ".", "...
23213b8b40b21e17e2e1844224498cbd8e359bfa
valid
capture
Archives the provided URL using archive.is Returns the URL where the capture is stored.
archiveis/api.py
def capture( target_url, user_agent="archiveis (https://github.com/pastpages/archiveis)", proxies={} ): """ Archives the provided URL using archive.is Returns the URL where the capture is stored. """ # Put together the URL that will save our request domain = "http://archive.vn" ...
def capture( target_url, user_agent="archiveis (https://github.com/pastpages/archiveis)", proxies={} ): """ Archives the provided URL using archive.is Returns the URL where the capture is stored. """ # Put together the URL that will save our request domain = "http://archive.vn" ...
[ "Archives", "the", "provided", "URL", "using", "archive", ".", "is" ]
pastpages/archiveis
python
https://github.com/pastpages/archiveis/blob/1268066c0e4ef1b82a32a5fafd2e136113e63576/archiveis/api.py#L10-L94
[ "def", "capture", "(", "target_url", ",", "user_agent", "=", "\"archiveis (https://github.com/pastpages/archiveis)\"", ",", "proxies", "=", "{", "}", ")", ":", "# Put together the URL that will save our request", "domain", "=", "\"http://archive.vn\"", "save_url", "=", "url...
1268066c0e4ef1b82a32a5fafd2e136113e63576
valid
cli
Archives the provided URL using archive.is.
archiveis/api.py
def cli(url, user_agent): """ Archives the provided URL using archive.is. """ kwargs = {} if user_agent: kwargs['user_agent'] = user_agent archive_url = capture(url, **kwargs) click.echo(archive_url)
def cli(url, user_agent): """ Archives the provided URL using archive.is. """ kwargs = {} if user_agent: kwargs['user_agent'] = user_agent archive_url = capture(url, **kwargs) click.echo(archive_url)
[ "Archives", "the", "provided", "URL", "using", "archive", ".", "is", "." ]
pastpages/archiveis
python
https://github.com/pastpages/archiveis/blob/1268066c0e4ef1b82a32a5fafd2e136113e63576/archiveis/api.py#L100-L108
[ "def", "cli", "(", "url", ",", "user_agent", ")", ":", "kwargs", "=", "{", "}", "if", "user_agent", ":", "kwargs", "[", "'user_agent'", "]", "=", "user_agent", "archive_url", "=", "capture", "(", "url", ",", "*", "*", "kwargs", ")", "click", ".", "ec...
1268066c0e4ef1b82a32a5fafd2e136113e63576
valid
LiveboxPlayTv.get_channel_image
Get the logo for a channel
liveboxplaytv/liveboxplaytv.py
def get_channel_image(self, channel, img_size=300, skip_cache=False): """Get the logo for a channel""" from bs4 import BeautifulSoup from wikipedia.exceptions import PageError import re import wikipedia wikipedia.set_lang('fr') if not channel: _LOGGER...
def get_channel_image(self, channel, img_size=300, skip_cache=False): """Get the logo for a channel""" from bs4 import BeautifulSoup from wikipedia.exceptions import PageError import re import wikipedia wikipedia.set_lang('fr') if not channel: _LOGGER...
[ "Get", "the", "logo", "for", "a", "channel" ]
pschmitt/python-liveboxplaytv
python
https://github.com/pschmitt/python-liveboxplaytv/blob/26bf53421f701e7687836649d133d4eeed2ccc51/liveboxplaytv/liveboxplaytv.py#L180-L227
[ "def", "get_channel_image", "(", "self", ",", "channel", ",", "img_size", "=", "300", ",", "skip_cache", "=", "False", ")", ":", "from", "bs4", "import", "BeautifulSoup", "from", "wikipedia", ".", "exceptions", "import", "PageError", "import", "re", "import", ...
26bf53421f701e7687836649d133d4eeed2ccc51
valid
LiveboxPlayTv.press_key
modes: 0 -> simple press 1 -> long press 2 -> release after long press
liveboxplaytv/liveboxplaytv.py
def press_key(self, key, mode=0): ''' modes: 0 -> simple press 1 -> long press 2 -> release after long press ''' if isinstance(key, str): assert key in KEYS, 'No such key: {}'.format(key) key = KEYS[key] _LOGGER.info('Pr...
def press_key(self, key, mode=0): ''' modes: 0 -> simple press 1 -> long press 2 -> release after long press ''' if isinstance(key, str): assert key in KEYS, 'No such key: {}'.format(key) key = KEYS[key] _LOGGER.info('Pr...
[ "modes", ":", "0", "-", ">", "simple", "press", "1", "-", ">", "long", "press", "2", "-", ">", "release", "after", "long", "press" ]
pschmitt/python-liveboxplaytv
python
https://github.com/pschmitt/python-liveboxplaytv/blob/26bf53421f701e7687836649d133d4eeed2ccc51/liveboxplaytv/liveboxplaytv.py#L291-L302
[ "def", "press_key", "(", "self", ",", "key", ",", "mode", "=", "0", ")", ":", "if", "isinstance", "(", "key", ",", "str", ")", ":", "assert", "key", "in", "KEYS", ",", "'No such key: {}'", ".", "format", "(", "key", ")", "key", "=", "KEYS", "[", ...
26bf53421f701e7687836649d133d4eeed2ccc51
valid
Migration.forwards
Write your forwards methods here.
people/south_migrations/0006_copy_names_into_roman_or_non_roman_fields.py
def forwards(self, orm): "Write your forwards methods here." # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..." for translation in orm['people.PersonTranslation'].objects.all(): if translation.language in ['en', 'de']: translation.ro...
def forwards(self, orm): "Write your forwards methods here." # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..." for translation in orm['people.PersonTranslation'].objects.all(): if translation.language in ['en', 'de']: translation.ro...
[ "Write", "your", "forwards", "methods", "here", "." ]
bitlabstudio/django-people
python
https://github.com/bitlabstudio/django-people/blob/d276d767787a0b9fd963fb42094326b3b242b27f/people/south_migrations/0006_copy_names_into_roman_or_non_roman_fields.py#L10-L20
[ "def", "forwards", "(", "self", ",", "orm", ")", ":", "# Note: Remember to use orm['appname.ModelName'] rather than \"from appname.models...\"", "for", "translation", "in", "orm", "[", "'people.PersonTranslation'", "]", ".", "objects", ".", "all", "(", ")", ":", "if", ...
d276d767787a0b9fd963fb42094326b3b242b27f
valid
Migration.forwards
Write your forwards methods here.
people/south_migrations/0009_move_name_fields_to_person_model.py
def forwards(self, orm): "Write your forwards methods here." for translation in orm['people.PersonTranslation'].objects.all(): translation.person.roman_first_name = translation.roman_first_name translation.person.roman_last_name = translation.roman_last_name translati...
def forwards(self, orm): "Write your forwards methods here." for translation in orm['people.PersonTranslation'].objects.all(): translation.person.roman_first_name = translation.roman_first_name translation.person.roman_last_name = translation.roman_last_name translati...
[ "Write", "your", "forwards", "methods", "here", "." ]
bitlabstudio/django-people
python
https://github.com/bitlabstudio/django-people/blob/d276d767787a0b9fd963fb42094326b3b242b27f/people/south_migrations/0009_move_name_fields_to_person_model.py#L10-L17
[ "def", "forwards", "(", "self", ",", "orm", ")", ":", "for", "translation", "in", "orm", "[", "'people.PersonTranslation'", "]", ".", "objects", ".", "all", "(", ")", ":", "translation", ".", "person", ".", "roman_first_name", "=", "translation", ".", "rom...
d276d767787a0b9fd963fb42094326b3b242b27f
valid
Block.parse
Parse block node. args: scope (Scope): Current scope raises: SyntaxError returns: self
lesscpy/plib/block.py
def parse(self, scope): """Parse block node. args: scope (Scope): Current scope raises: SyntaxError returns: self """ if not self.parsed: scope.push() self.name, inner = self.tokens scope.current = se...
def parse(self, scope): """Parse block node. args: scope (Scope): Current scope raises: SyntaxError returns: self """ if not self.parsed: scope.push() self.name, inner = self.tokens scope.current = se...
[ "Parse", "block", "node", ".", "args", ":", "scope", "(", "Scope", ")", ":", "Current", "scope", "raises", ":", "SyntaxError", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/block.py#L24-L137
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "if", "not", "self", ".", "parsed", ":", "scope", ".", "push", "(", ")", "self", ".", "name", ",", "inner", "=", "self", ".", "tokens", "scope", ".", "current", "=", "self", ".", "name", "scope...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Block.raw
Raw block name args: clean (bool): clean name returns: str
lesscpy/plib/block.py
def raw(self, clean=False): """Raw block name args: clean (bool): clean name returns: str """ try: return self.tokens[0].raw(clean) except (AttributeError, TypeError): pass
def raw(self, clean=False): """Raw block name args: clean (bool): clean name returns: str """ try: return self.tokens[0].raw(clean) except (AttributeError, TypeError): pass
[ "Raw", "block", "name", "args", ":", "clean", "(", "bool", ")", ":", "clean", "name", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/block.py#L139-L149
[ "def", "raw", "(", "self", ",", "clean", "=", "False", ")", ":", "try", ":", "return", "self", ".", "tokens", "[", "0", "]", ".", "raw", "(", "clean", ")", "except", "(", "AttributeError", ",", "TypeError", ")", ":", "pass" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Block.fmt
Format block (CSS) args: fills (dict): Fill elements returns: str (CSS)
lesscpy/plib/block.py
def fmt(self, fills): """Format block (CSS) args: fills (dict): Fill elements returns: str (CSS) """ f = "%(identifier)s%(ws)s{%(nl)s%(proplist)s}%(eb)s" out = [] name = self.name.fmt(fills) if self.parsed and any( p...
def fmt(self, fills): """Format block (CSS) args: fills (dict): Fill elements returns: str (CSS) """ f = "%(identifier)s%(ws)s{%(nl)s%(proplist)s}%(eb)s" out = [] name = self.name.fmt(fills) if self.parsed and any( p...
[ "Format", "block", "(", "CSS", ")", "args", ":", "fills", "(", "dict", ")", ":", "Fill", "elements", "returns", ":", "str", "(", "CSS", ")" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/block.py#L151-L186
[ "def", "fmt", "(", "self", ",", "fills", ")", ":", "f", "=", "\"%(identifier)s%(ws)s{%(nl)s%(proplist)s}%(eb)s\"", "out", "=", "[", "]", "name", "=", "self", ".", "name", ".", "fmt", "(", "fills", ")", "if", "self", ".", "parsed", "and", "any", "(", "p...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Block.copy
Return a full copy of self returns: Block object
lesscpy/plib/block.py
def copy(self): """ Return a full copy of self returns: Block object """ name, inner = self.tokens if inner: inner = [u.copy() if u else u for u in inner] if name: name = name.copy() return Block([name, inner], 0)
def copy(self): """ Return a full copy of self returns: Block object """ name, inner = self.tokens if inner: inner = [u.copy() if u else u for u in inner] if name: name = name.copy() return Block([name, inner], 0)
[ "Return", "a", "full", "copy", "of", "self", "returns", ":", "Block", "object" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/block.py#L188-L197
[ "def", "copy", "(", "self", ")", ":", "name", ",", "inner", "=", "self", ".", "tokens", "if", "inner", ":", "inner", "=", "[", "u", ".", "copy", "(", ")", "if", "u", "else", "u", "for", "u", "in", "inner", "]", "if", "name", ":", "name", "=",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Block.copy_inner
Copy block contents (properties, inner blocks). Renames inner block from current scope. Used for mixins. args: scope (Scope): Current scope returns: list (block contents)
lesscpy/plib/block.py
def copy_inner(self, scope): """Copy block contents (properties, inner blocks). Renames inner block from current scope. Used for mixins. args: scope (Scope): Current scope returns: list (block contents) """ if self.tokens[1]: to...
def copy_inner(self, scope): """Copy block contents (properties, inner blocks). Renames inner block from current scope. Used for mixins. args: scope (Scope): Current scope returns: list (block contents) """ if self.tokens[1]: to...
[ "Copy", "block", "contents", "(", "properties", "inner", "blocks", ")", ".", "Renames", "inner", "block", "from", "current", "scope", ".", "Used", "for", "mixins", ".", "args", ":", "scope", "(", "Scope", ")", ":", "Current", "scope", "returns", ":", "li...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/block.py#L199-L213
[ "def", "copy_inner", "(", "self", ",", "scope", ")", ":", "if", "self", ".", "tokens", "[", "1", "]", ":", "tokens", "=", "[", "u", ".", "copy", "(", ")", "if", "u", "else", "u", "for", "u", "in", "self", ".", "tokens", "[", "1", "]", "]", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Statement.parse
Parse node args: scope (Scope): current scope raises: SyntaxError returns: self
lesscpy/plib/statement.py
def parse(self, scope): """Parse node args: scope (Scope): current scope raises: SyntaxError returns: self """ self.parsed = list(utility.flatten(self.tokens)) if self.parsed[0] == '@import': if len(self.parsed) > 4:...
def parse(self, scope): """Parse node args: scope (Scope): current scope raises: SyntaxError returns: self """ self.parsed = list(utility.flatten(self.tokens)) if self.parsed[0] == '@import': if len(self.parsed) > 4:...
[ "Parse", "node", "args", ":", "scope", "(", "Scope", ")", ":", "current", "scope", "raises", ":", "SyntaxError", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/statement.py#L18-L32
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "self", ".", "parsed", "=", "list", "(", "utility", ".", "flatten", "(", "self", ".", "tokens", ")", ")", "if", "self", ".", "parsed", "[", "0", "]", "==", "'@import'", ":", "if", "len", "(", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Deferred.parse
Parse function. We search for mixins first within current scope then fallback to global scope. The special scope.deferred is used when local scope mixins are called within parent mixins. If nothing is found we fallback to block-mixin as lessc.js allows calls to blocks and...
lesscpy/plib/deferred.py
def parse(self, scope, error=False, depth=0): """ Parse function. We search for mixins first within current scope then fallback to global scope. The special scope.deferred is used when local scope mixins are called within parent mixins. If nothing is found we fallback to ...
def parse(self, scope, error=False, depth=0): """ Parse function. We search for mixins first within current scope then fallback to global scope. The special scope.deferred is used when local scope mixins are called within parent mixins. If nothing is found we fallback to ...
[ "Parse", "function", ".", "We", "search", "for", "mixins", "first", "within", "current", "scope", "then", "fallback", "to", "global", "scope", ".", "The", "special", "scope", ".", "deferred", "is", "used", "when", "local", "scope", "mixins", "are", "called",...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/deferred.py#L26-L111
[ "def", "parse", "(", "self", ",", "scope", ",", "error", "=", "False", ",", "depth", "=", "0", ")", ":", "res", "=", "False", "ident", ",", "args", "=", "self", ".", "tokens", "ident", ".", "parse", "(", "scope", ")", "mixins", "=", "scope", ".",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
ldirectory
Compile all *.less files in directory Args: inpath (str): Path to compile outpath (str): Output directory args (object): Argparse Object scope (Scope): Scope object or None
lesscpy/scripts/compiler.py
def ldirectory(inpath, outpath, args, scope): """Compile all *.less files in directory Args: inpath (str): Path to compile outpath (str): Output directory args (object): Argparse Object scope (Scope): Scope object or None """ yacctab = 'yacctab' if args.debug else None ...
def ldirectory(inpath, outpath, args, scope): """Compile all *.less files in directory Args: inpath (str): Path to compile outpath (str): Output directory args (object): Argparse Object scope (Scope): Scope object or None """ yacctab = 'yacctab' if args.debug else None ...
[ "Compile", "all", "*", ".", "less", "files", "in", "directory", "Args", ":", "inpath", "(", "str", ")", ":", "Path", "to", "compile", "outpath", "(", "str", ")", ":", "Output", "directory", "args", "(", "object", ")", ":", "Argparse", "Object", "scope"...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/scripts/compiler.py#L29-L80
[ "def", "ldirectory", "(", "inpath", ",", "outpath", ",", "args", ",", "scope", ")", ":", "yacctab", "=", "'yacctab'", "if", "args", ".", "debug", "else", "None", "if", "not", "outpath", ":", "sys", ".", "exit", "(", "\"Compile directory option needs -o ...\"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
run
Run compiler
lesscpy/scripts/compiler.py
def run(): """Run compiler """ aparse = argparse.ArgumentParser( description='LessCss Compiler', epilog='<< jtm@robot.is @_o >>') aparse.add_argument( '-v', '--version', action='version', version=VERSION_STR) aparse.add_argument( '-I', '--include', action="sto...
def run(): """Run compiler """ aparse = argparse.ArgumentParser( description='LessCss Compiler', epilog='<< jtm@robot.is @_o >>') aparse.add_argument( '-v', '--version', action='version', version=VERSION_STR) aparse.add_argument( '-I', '--include', action="sto...
[ "Run", "compiler" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/scripts/compiler.py#L83-L255
[ "def", "run", "(", ")", ":", "aparse", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'LessCss Compiler'", ",", "epilog", "=", "'<< jtm@robot.is @_o >>'", ")", "aparse", ".", "add_argument", "(", "'-v'", ",", "'--version'", ",", "action", "=...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
KeyframeSelector.parse
Parse node. args: scope (Scope): Current scope raises: SyntaxError returns: self
lesscpy/plib/keyframe_selector.py
def parse(self, scope): """Parse node. args: scope (Scope): Current scope raises: SyntaxError returns: self """ self.keyframe, = [ e[0] if isinstance(e, tuple) else e for e in self.tokens if str(e).strip() ...
def parse(self, scope): """Parse node. args: scope (Scope): Current scope raises: SyntaxError returns: self """ self.keyframe, = [ e[0] if isinstance(e, tuple) else e for e in self.tokens if str(e).strip() ...
[ "Parse", "node", ".", "args", ":", "scope", "(", "Scope", ")", ":", "Current", "scope", "raises", ":", "SyntaxError", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/keyframe_selector.py#L21-L35
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "self", ".", "keyframe", ",", "=", "[", "e", "[", "0", "]", "if", "isinstance", "(", "e", ",", "tuple", ")", "else", "e", "for", "e", "in", "self", ".", "tokens", "if", "str", "(", "e", ")"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_mediaquery_t_semicolon
r';
lesscpy/lessc/lexer.py
def t_mediaquery_t_semicolon(self, t): r';' # This can happen only as part of a CSS import statement. The # "mediaquery" state is reused there. Ordinary media queries always # end at '{', i.e. when a block is opened. t.lexer.pop_state() # state mediaquery # We have to po...
def t_mediaquery_t_semicolon(self, t): r';' # This can happen only as part of a CSS import statement. The # "mediaquery" state is reused there. Ordinary media queries always # end at '{', i.e. when a block is opened. t.lexer.pop_state() # state mediaquery # We have to po...
[ "r", ";" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L234-L243
[ "def", "t_mediaquery_t_semicolon", "(", "self", ",", "t", ")", ":", "# This can happen only as part of a CSS import statement. The", "# \"mediaquery\" state is reused there. Ordinary media queries always", "# end at '{', i.e. when a block is opened.", "t", ".", "lexer", ".", "pop_state...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_less_variable
r'@@?[\w-]+|@\{[^@\}]+\}
lesscpy/lessc/lexer.py
def t_less_variable(self, t): r'@@?[\w-]+|@\{[^@\}]+\}' v = t.value.lower() if v in reserved.tokens: t.type = reserved.tokens[v] if t.type == "css_media": t.lexer.push_state("mediaquery") elif t.type == "css_import": t.lexer.pus...
def t_less_variable(self, t): r'@@?[\w-]+|@\{[^@\}]+\}' v = t.value.lower() if v in reserved.tokens: t.type = reserved.tokens[v] if t.type == "css_media": t.lexer.push_state("mediaquery") elif t.type == "css_import": t.lexer.pus...
[ "r" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L258-L267
[ "def", "t_less_variable", "(", "self", ",", "t", ")", ":", "v", "=", "t", ".", "value", ".", "lower", "(", ")", "if", "v", "in", "reserved", ".", "tokens", ":", "t", ".", "type", "=", "reserved", ".", "tokens", "[", "v", "]", "if", "t", ".", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_t_eopen
r'~"|~\
lesscpy/lessc/lexer.py
def t_t_eopen(self, t): r'~"|~\'' if t.value[1] == '"': t.lexer.push_state('escapequotes') elif t.value[1] == '\'': t.lexer.push_state('escapeapostrophe') return t
def t_t_eopen(self, t): r'~"|~\'' if t.value[1] == '"': t.lexer.push_state('escapequotes') elif t.value[1] == '\'': t.lexer.push_state('escapeapostrophe') return t
[ "r", "~", "|~", "\\" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L340-L346
[ "def", "t_t_eopen", "(", "self", ",", "t", ")", ":", "if", "t", ".", "value", "[", "1", "]", "==", "'\"'", ":", "t", ".", "lexer", ".", "push_state", "(", "'escapequotes'", ")", "elif", "t", ".", "value", "[", "1", "]", "==", "'\\''", ":", "t",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_css_string
r'"[^"@]*"|\'[^\'@]*\
lesscpy/lessc/lexer.py
def t_css_string(self, t): r'"[^"@]*"|\'[^\'@]*\'' t.lexer.lineno += t.value.count('\n') return t
def t_css_string(self, t): r'"[^"@]*"|\'[^\'@]*\'' t.lexer.lineno += t.value.count('\n') return t
[ "r", "[", "^" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L370-L373
[ "def", "t_css_string", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "t", ".", "value", ".", "count", "(", "'\\n'", ")", "return", "t" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_t_isopen
r'"|\
lesscpy/lessc/lexer.py
def t_t_isopen(self, t): r'"|\'' if t.value[0] == '"': t.lexer.push_state('istringquotes') elif t.value[0] == '\'': t.lexer.push_state('istringapostrophe') return t
def t_t_isopen(self, t): r'"|\'' if t.value[0] == '"': t.lexer.push_state('istringquotes') elif t.value[0] == '\'': t.lexer.push_state('istringapostrophe') return t
[ "r", "|", "\\" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L375-L381
[ "def", "t_t_isopen", "(", "self", ",", "t", ")", ":", "if", "t", ".", "value", "[", "0", "]", "==", "'\"'", ":", "t", ".", "lexer", ".", "push_state", "(", "'istringquotes'", ")", "elif", "t", ".", "value", "[", "0", "]", "==", "'\\''", ":", "t...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_istringapostrophe_css_string
r'[^\'@]+
lesscpy/lessc/lexer.py
def t_istringapostrophe_css_string(self, t): r'[^\'@]+' t.lexer.lineno += t.value.count('\n') return t
def t_istringapostrophe_css_string(self, t): r'[^\'@]+' t.lexer.lineno += t.value.count('\n') return t
[ "r", "[", "^", "\\" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L391-L394
[ "def", "t_istringapostrophe_css_string", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "t", ".", "value", ".", "count", "(", "'\\n'", ")", "return", "t" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.t_istringquotes_css_string
r'[^"@]+
lesscpy/lessc/lexer.py
def t_istringquotes_css_string(self, t): r'[^"@]+' t.lexer.lineno += t.value.count('\n') return t
def t_istringquotes_css_string(self, t): r'[^"@]+' t.lexer.lineno += t.value.count('\n') return t
[ "r", "[", "^" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L396-L399
[ "def", "t_istringquotes_css_string", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "t", ".", "value", ".", "count", "(", "'\\n'", ")", "return", "t" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.file
Lex file.
lesscpy/lessc/lexer.py
def file(self, filename): """ Lex file. """ with open(filename) as f: self.lexer.input(f.read()) return self
def file(self, filename): """ Lex file. """ with open(filename) as f: self.lexer.input(f.read()) return self
[ "Lex", "file", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L423-L429
[ "def", "file", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "f", ":", "self", ".", "lexer", ".", "input", "(", "f", ".", "read", "(", ")", ")", "return", "self" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.input
Load lexer with content from `file` which can be a path or a file like object.
lesscpy/lessc/lexer.py
def input(self, file): """ Load lexer with content from `file` which can be a path or a file like object. """ if isinstance(file, string_types): with open(file) as f: self.lexer.input(f.read()) else: self.lexer.input(file.read())
def input(self, file): """ Load lexer with content from `file` which can be a path or a file like object. """ if isinstance(file, string_types): with open(file) as f: self.lexer.input(f.read()) else: self.lexer.input(file.read())
[ "Load", "lexer", "with", "content", "from", "file", "which", "can", "be", "a", "path", "or", "a", "file", "like", "object", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L431-L440
[ "def", "input", "(", "self", ",", "file", ")", ":", "if", "isinstance", "(", "file", ",", "string_types", ")", ":", "with", "open", "(", "file", ")", "as", "f", ":", "self", ".", "lexer", ".", "input", "(", "f", ".", "read", "(", ")", ")", "els...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
LessLexer.token
Token function. Contains 2 hacks: 1. Injects ';' into blocks where the last property leaves out the ; 2. Strips out whitespace from nonsignificant locations to ease parsing.
lesscpy/lessc/lexer.py
def token(self): """ Token function. Contains 2 hacks: 1. Injects ';' into blocks where the last property leaves out the ; 2. Strips out whitespace from nonsignificant locations to ease parsing. """ if self.next_: t = ...
def token(self): """ Token function. Contains 2 hacks: 1. Injects ';' into blocks where the last property leaves out the ; 2. Strips out whitespace from nonsignificant locations to ease parsing. """ if self.next_: t = ...
[ "Token", "function", ".", "Contains", "2", "hacks", ":", "1", ".", "Injects", ";", "into", "blocks", "where", "the", "last", "property", "leaves", "out", "the", ";", "2", ".", "Strips", "out", "whitespace", "from", "nonsignificant", "locations", "to", "eas...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L442-L476
[ "def", "token", "(", "self", ")", ":", "if", "self", ".", "next_", ":", "t", "=", "self", ".", "next_", "self", ".", "next_", "=", "None", "return", "t", "while", "True", ":", "t", "=", "self", ".", "lexer", ".", "token", "(", ")", "if", "not",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Identifier.parse
Parse node. Block identifiers are stored as strings with spaces replaced with ? args: scope (Scope): Current scope raises: SyntaxError returns: self
lesscpy/plib/identifier.py
def parse(self, scope): """Parse node. Block identifiers are stored as strings with spaces replaced with ? args: scope (Scope): Current scope raises: SyntaxError returns: self """ names = [] name = [] self._subp ...
def parse(self, scope): """Parse node. Block identifiers are stored as strings with spaces replaced with ? args: scope (Scope): Current scope raises: SyntaxError returns: self """ names = [] name = [] self._subp ...
[ "Parse", "node", ".", "Block", "identifiers", "are", "stored", "as", "strings", "with", "spaces", "replaced", "with", "?", "args", ":", "scope", "(", "Scope", ")", ":", "Current", "scope", "raises", ":", "SyntaxError", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/identifier.py#L20-L90
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "names", "=", "[", "]", "name", "=", "[", "]", "self", ".", "_subp", "=", "(", "'@media'", ",", "'@keyframes'", ",", "'@-moz-keyframes'", ",", "'@-webkit-keyframes'", ",", "'@-ms-keyframes'", ")", "if"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Identifier.root
Find root of identifier, from scope args: scope (Scope): current scope names (list): identifier name list (, separated identifiers) returns: list
lesscpy/plib/identifier.py
def root(self, scope, names): """Find root of identifier, from scope args: scope (Scope): current scope names (list): identifier name list (, separated identifiers) returns: list """ parent = scope.scopename if parent: paren...
def root(self, scope, names): """Find root of identifier, from scope args: scope (Scope): current scope names (list): identifier name list (, separated identifiers) returns: list """ parent = scope.scopename if parent: paren...
[ "Find", "root", "of", "identifier", "from", "scope", "args", ":", "scope", "(", "Scope", ")", ":", "current", "scope", "names", "(", "list", ")", ":", "identifier", "name", "list", "(", "separated", "identifiers", ")", "returns", ":", "list" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/identifier.py#L92-L144
[ "def", "root", "(", "self", ",", "scope", ",", "names", ")", ":", "parent", "=", "scope", ".", "scopename", "if", "parent", ":", "parent", "=", "parent", "[", "-", "1", "]", "if", "parent", ".", "parsed", ":", "parsed_names", "=", "[", "]", "for", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Identifier.raw
Raw identifier. args: clean (bool): clean name returns: str
lesscpy/plib/identifier.py
def raw(self, clean=False): """Raw identifier. args: clean (bool): clean name returns: str """ if clean: return ''.join(''.join(p) for p in self.parsed).replace('?', ' ') return '%'.join('%'.join(p) for p in self.parsed).strip().strip('...
def raw(self, clean=False): """Raw identifier. args: clean (bool): clean name returns: str """ if clean: return ''.join(''.join(p) for p in self.parsed).replace('?', ' ') return '%'.join('%'.join(p) for p in self.parsed).strip().strip('...
[ "Raw", "identifier", ".", "args", ":", "clean", "(", "bool", ")", ":", "clean", "name", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/identifier.py#L146-L155
[ "def", "raw", "(", "self", ",", "clean", "=", "False", ")", ":", "if", "clean", ":", "return", "''", ".", "join", "(", "''", ".", "join", "(", "p", ")", "for", "p", "in", "self", ".", "parsed", ")", ".", "replace", "(", "'?'", ",", "' '", ")"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Identifier.copy
Return copy of self Returns: Identifier object
lesscpy/plib/identifier.py
def copy(self): """ Return copy of self Returns: Identifier object """ tokens = ([t for t in self.tokens] if isinstance(self.tokens, list) else self.tokens) return Identifier(tokens, 0)
def copy(self): """ Return copy of self Returns: Identifier object """ tokens = ([t for t in self.tokens] if isinstance(self.tokens, list) else self.tokens) return Identifier(tokens, 0)
[ "Return", "copy", "of", "self", "Returns", ":", "Identifier", "object" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/identifier.py#L157-L164
[ "def", "copy", "(", "self", ")", ":", "tokens", "=", "(", "[", "t", "for", "t", "in", "self", ".", "tokens", "]", "if", "isinstance", "(", "self", ".", "tokens", ",", "list", ")", "else", "self", ".", "tokens", ")", "return", "Identifier", "(", "...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Identifier.fmt
Format identifier args: fills (dict): replacements returns: str (CSS)
lesscpy/plib/identifier.py
def fmt(self, fills): """Format identifier args: fills (dict): replacements returns: str (CSS) """ name = ',$$'.join(''.join(p).strip() for p in self.parsed) name = re.sub('\?(.)\?', '%(ws)s\\1%(ws)s', name) % fills return name.replace('$$'...
def fmt(self, fills): """Format identifier args: fills (dict): replacements returns: str (CSS) """ name = ',$$'.join(''.join(p).strip() for p in self.parsed) name = re.sub('\?(.)\?', '%(ws)s\\1%(ws)s', name) % fills return name.replace('$$'...
[ "Format", "identifier", "args", ":", "fills", "(", "dict", ")", ":", "replacements", "returns", ":", "str", "(", "CSS", ")" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/identifier.py#L166-L175
[ "def", "fmt", "(", "self", ",", "fills", ")", ":", "name", "=", "',$$'", ".", "join", "(", "''", ".", "join", "(", "p", ")", ".", "strip", "(", ")", "for", "p", "in", "self", ".", "parsed", ")", "name", "=", "re", ".", "sub", "(", "'\\?(.)\\?...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.add_block
Add block element to scope Args: block (Block): Block object
lesscpy/lessc/scope.py
def add_block(self, block): """Add block element to scope Args: block (Block): Block object """ self[-1]['__blocks__'].append(block) self[-1]['__names__'].append(block.raw())
def add_block(self, block): """Add block element to scope Args: block (Block): Block object """ self[-1]['__blocks__'].append(block) self[-1]['__names__'].append(block.raw())
[ "Add", "block", "element", "to", "scope", "Args", ":", "block", "(", "Block", ")", ":", "Block", "object" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L57-L63
[ "def", "add_block", "(", "self", ",", "block", ")", ":", "self", "[", "-", "1", "]", "[", "'__blocks__'", "]", ".", "append", "(", "block", ")", "self", "[", "-", "1", "]", "[", "'__names__'", "]", ".", "append", "(", "block", ".", "raw", "(", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.remove_block
Remove block element from scope Args: block (Block): Block object
lesscpy/lessc/scope.py
def remove_block(self, block, index="-1"): """Remove block element from scope Args: block (Block): Block object """ self[index]["__blocks__"].remove(block) self[index]["__names__"].remove(block.raw())
def remove_block(self, block, index="-1"): """Remove block element from scope Args: block (Block): Block object """ self[index]["__blocks__"].remove(block) self[index]["__names__"].remove(block.raw())
[ "Remove", "block", "element", "from", "scope", "Args", ":", "block", "(", "Block", ")", ":", "Block", "object" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L65-L71
[ "def", "remove_block", "(", "self", ",", "block", ",", "index", "=", "\"-1\"", ")", ":", "self", "[", "index", "]", "[", "\"__blocks__\"", "]", ".", "remove", "(", "block", ")", "self", "[", "index", "]", "[", "\"__names__\"", "]", ".", "remove", "("...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.add_mixin
Add mixin to scope Args: mixin (Mixin): Mixin object
lesscpy/lessc/scope.py
def add_mixin(self, mixin): """Add mixin to scope Args: mixin (Mixin): Mixin object """ raw = mixin.tokens[0][0].raw() if raw in self._mixins: self._mixins[raw].append(mixin) else: self._mixins[raw] = [mixin]
def add_mixin(self, mixin): """Add mixin to scope Args: mixin (Mixin): Mixin object """ raw = mixin.tokens[0][0].raw() if raw in self._mixins: self._mixins[raw].append(mixin) else: self._mixins[raw] = [mixin]
[ "Add", "mixin", "to", "scope", "Args", ":", "mixin", "(", "Mixin", ")", ":", "Mixin", "object" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L73-L82
[ "def", "add_mixin", "(", "self", ",", "mixin", ")", ":", "raw", "=", "mixin", ".", "tokens", "[", "0", "]", "[", "0", "]", ".", "raw", "(", ")", "if", "raw", "in", "self", ".", "_mixins", ":", "self", ".", "_mixins", "[", "raw", "]", ".", "ap...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.variables
Search for variable by name. Searches scope top down Args: name (string): Search term Returns: Variable object OR False
lesscpy/lessc/scope.py
def variables(self, name): """Search for variable by name. Searches scope top down Args: name (string): Search term Returns: Variable object OR False """ if isinstance(name, tuple): name = name[0] if name.startswith('@{'): n...
def variables(self, name): """Search for variable by name. Searches scope top down Args: name (string): Search term Returns: Variable object OR False """ if isinstance(name, tuple): name = name[0] if name.startswith('@{'): n...
[ "Search", "for", "variable", "by", "name", ".", "Searches", "scope", "top", "down", "Args", ":", "name", "(", "string", ")", ":", "Search", "term", "Returns", ":", "Variable", "object", "OR", "False" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L91-L107
[ "def", "variables", "(", "self", ",", "name", ")", ":", "if", "isinstance", "(", "name", ",", "tuple", ")", ":", "name", "=", "name", "[", "0", "]", "if", "name", ".", "startswith", "(", "'@{'", ")", ":", "name", "=", "'@'", "+", "name", "[", "...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.mixins
Search mixins for name. Allow '>' to be ignored. '.a .b()' == '.a > .b()' Args: name (string): Search term Returns: Mixin object list OR False
lesscpy/lessc/scope.py
def mixins(self, name): """ Search mixins for name. Allow '>' to be ignored. '.a .b()' == '.a > .b()' Args: name (string): Search term Returns: Mixin object list OR False """ m = self._smixins(name) if m: return m return...
def mixins(self, name): """ Search mixins for name. Allow '>' to be ignored. '.a .b()' == '.a > .b()' Args: name (string): Search term Returns: Mixin object list OR False """ m = self._smixins(name) if m: return m return...
[ "Search", "mixins", "for", "name", ".", "Allow", ">", "to", "be", "ignored", ".", ".", "a", ".", "b", "()", "==", ".", "a", ">", ".", "b", "()", "Args", ":", "name", "(", "string", ")", ":", "Search", "term", "Returns", ":", "Mixin", "object", ...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L109-L120
[ "def", "mixins", "(", "self", ",", "name", ")", ":", "m", "=", "self", ".", "_smixins", "(", "name", ")", "if", "m", ":", "return", "m", "return", "self", ".", "_smixins", "(", "name", ".", "replace", "(", "'?>?'", ",", "' '", ")", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope._smixins
Inner wrapper to search for mixins by name.
lesscpy/lessc/scope.py
def _smixins(self, name): """Inner wrapper to search for mixins by name. """ return (self._mixins[name] if name in self._mixins else False)
def _smixins(self, name): """Inner wrapper to search for mixins by name. """ return (self._mixins[name] if name in self._mixins else False)
[ "Inner", "wrapper", "to", "search", "for", "mixins", "by", "name", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L122-L125
[ "def", "_smixins", "(", "self", ",", "name", ")", ":", "return", "(", "self", ".", "_mixins", "[", "name", "]", "if", "name", "in", "self", ".", "_mixins", "else", "False", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.blocks
Search for defined blocks recursively. Allow '>' to be ignored. '.a .b' == '.a > .b' Args: name (string): Search term Returns: Block object OR False
lesscpy/lessc/scope.py
def blocks(self, name): """ Search for defined blocks recursively. Allow '>' to be ignored. '.a .b' == '.a > .b' Args: name (string): Search term Returns: Block object OR False """ b = self._blocks(name) if b: return b ...
def blocks(self, name): """ Search for defined blocks recursively. Allow '>' to be ignored. '.a .b' == '.a > .b' Args: name (string): Search term Returns: Block object OR False """ b = self._blocks(name) if b: return b ...
[ "Search", "for", "defined", "blocks", "recursively", ".", "Allow", ">", "to", "be", "ignored", ".", ".", "a", ".", "b", "==", ".", "a", ">", ".", "b", "Args", ":", "name", "(", "string", ")", ":", "Search", "term", "Returns", ":", "Block", "object"...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L127-L139
[ "def", "blocks", "(", "self", ",", "name", ")", ":", "b", "=", "self", ".", "_blocks", "(", "name", ")", "if", "b", ":", "return", "b", "return", "self", ".", "_blocks", "(", "name", ".", "replace", "(", "'?>?'", ",", "' '", ")", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope._blocks
Inner wrapper to search for blocks by name.
lesscpy/lessc/scope.py
def _blocks(self, name): """Inner wrapper to search for blocks by name. """ i = len(self) while i >= 0: i -= 1 if name in self[i]['__names__']: for b in self[i]['__blocks__']: r = b.raw() if r and r == name: ...
def _blocks(self, name): """Inner wrapper to search for blocks by name. """ i = len(self) while i >= 0: i -= 1 if name in self[i]['__names__']: for b in self[i]['__blocks__']: r = b.raw() if r and r == name: ...
[ "Inner", "wrapper", "to", "search", "for", "blocks", "by", "name", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L141-L159
[ "def", "_blocks", "(", "self", ",", "name", ")", ":", "i", "=", "len", "(", "self", ")", "while", "i", ">=", "0", ":", "i", "-=", "1", "if", "name", "in", "self", "[", "i", "]", "[", "'__names__'", "]", ":", "for", "b", "in", "self", "[", "...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.update
Update scope. Add another scope to this one. Args: scope (Scope): Scope object Kwargs: at (int): Level to update
lesscpy/lessc/scope.py
def update(self, scope, at=0): """Update scope. Add another scope to this one. Args: scope (Scope): Scope object Kwargs: at (int): Level to update """ if hasattr(scope, '_mixins') and not at: self._mixins.update(scope._mixins) self[at][...
def update(self, scope, at=0): """Update scope. Add another scope to this one. Args: scope (Scope): Scope object Kwargs: at (int): Level to update """ if hasattr(scope, '_mixins') and not at: self._mixins.update(scope._mixins) self[at][...
[ "Update", "scope", ".", "Add", "another", "scope", "to", "this", "one", ".", "Args", ":", "scope", "(", "Scope", ")", ":", "Scope", "object", "Kwargs", ":", "at", "(", "int", ")", ":", "Level", "to", "update" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L161-L172
[ "def", "update", "(", "self", ",", "scope", ",", "at", "=", "0", ")", ":", "if", "hasattr", "(", "scope", ",", "'_mixins'", ")", "and", "not", "at", ":", "self", ".", "_mixins", ".", "update", "(", "scope", ".", "_mixins", ")", "self", "[", "at",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Scope.swap
Swap variable name for variable value Args: name (str): Variable name Returns: Variable value (Mixed)
lesscpy/lessc/scope.py
def swap(self, name): """ Swap variable name for variable value Args: name (str): Variable name Returns: Variable value (Mixed) """ if name.startswith('@@'): var = self.variables(name[1:]) if var is False: raise Synt...
def swap(self, name): """ Swap variable name for variable value Args: name (str): Variable name Returns: Variable value (Mixed) """ if name.startswith('@@'): var = self.variables(name[1:]) if var is False: raise Synt...
[ "Swap", "variable", "name", "for", "variable", "value", "Args", ":", "name", "(", "str", ")", ":", "Variable", "name", "Returns", ":", "Variable", "value", "(", "Mixed", ")" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/scope.py#L174-L199
[ "def", "swap", "(", "self", ",", "name", ")", ":", "if", "name", ".", "startswith", "(", "'@@'", ")", ":", "var", "=", "self", ".", "variables", "(", "name", "[", "1", ":", "]", ")", "if", "var", "is", "False", ":", "raise", "SyntaxError", "(", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Node.process
Process tokenslist, flattening and parsing it args: tokens (list): tokenlist scope (Scope): Current scope returns: list
lesscpy/plib/node.py
def process(self, tokens, scope): """ Process tokenslist, flattening and parsing it args: tokens (list): tokenlist scope (Scope): Current scope returns: list """ while True: tokens = list(utility.flatten(tokens)) done = ...
def process(self, tokens, scope): """ Process tokenslist, flattening and parsing it args: tokens (list): tokenlist scope (Scope): Current scope returns: list """ while True: tokens = list(utility.flatten(tokens)) done = ...
[ "Process", "tokenslist", "flattening", "and", "parsing", "it", "args", ":", "tokens", "(", "list", ")", ":", "tokenlist", "scope", "(", "Scope", ")", ":", "Current", "scope", "returns", ":", "list" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/node.py#L33-L58
[ "def", "process", "(", "self", ",", "tokens", ",", "scope", ")", ":", "while", "True", ":", "tokens", "=", "list", "(", "utility", ".", "flatten", "(", "tokens", ")", ")", "done", "=", "True", "if", "any", "(", "t", "for", "t", "in", "tokens", "i...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Node.replace_variables
Replace variables in tokenlist args: tokens (list): tokenlist scope (Scope): Current scope returns: list
lesscpy/plib/node.py
def replace_variables(self, tokens, scope): """ Replace variables in tokenlist args: tokens (list): tokenlist scope (Scope): Current scope returns: list """ list = [] for t in tokens: if utility.is_variable(t): ...
def replace_variables(self, tokens, scope): """ Replace variables in tokenlist args: tokens (list): tokenlist scope (Scope): Current scope returns: list """ list = [] for t in tokens: if utility.is_variable(t): ...
[ "Replace", "variables", "in", "tokenlist", "args", ":", "tokens", "(", "list", ")", ":", "tokenlist", "scope", "(", "Scope", ")", ":", "Current", "scope", "returns", ":", "list" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/node.py#L60-L76
[ "def", "replace_variables", "(", "self", ",", "tokens", ",", "scope", ")", ":", "list", "=", "[", "]", "for", "t", "in", "tokens", ":", "if", "utility", ".", "is_variable", "(", "t", ")", ":", "list", ".", "append", "(", "scope", ".", "swap", "(", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Property.parse
Parse node args: scope (Scope): current scope raises: SyntaxError returns: self
lesscpy/plib/property.py
def parse(self, scope): """Parse node args: scope (Scope): current scope raises: SyntaxError returns: self """ if not self.parsed: if len(self.tokens) > 2: property, style, _ = self.tokens sel...
def parse(self, scope): """Parse node args: scope (Scope): current scope raises: SyntaxError returns: self """ if not self.parsed: if len(self.tokens) > 2: property, style, _ = self.tokens sel...
[ "Parse", "node", "args", ":", "scope", "(", "Scope", ")", ":", "current", "scope", "raises", ":", "SyntaxError", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/property.py#L18-L39
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "if", "not", "self", ".", "parsed", ":", "if", "len", "(", "self", ".", "tokens", ")", ">", "2", ":", "property", ",", "style", ",", "_", "=", "self", ".", "tokens", "self", ".", "important", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Property.preprocess
Hackish preprocessing from font shorthand tags. Skips expression parse on certain tags. args: style (list): . returns: list
lesscpy/plib/property.py
def preprocess(self, style): """Hackish preprocessing from font shorthand tags. Skips expression parse on certain tags. args: style (list): . returns: list """ if self.property == 'font': style = [ ''.join(u.expression()...
def preprocess(self, style): """Hackish preprocessing from font shorthand tags. Skips expression parse on certain tags. args: style (list): . returns: list """ if self.property == 'font': style = [ ''.join(u.expression()...
[ "Hackish", "preprocessing", "from", "font", "shorthand", "tags", ".", "Skips", "expression", "parse", "on", "certain", "tags", ".", "args", ":", "style", "(", "list", ")", ":", ".", "returns", ":", "list" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/property.py#L41-L57
[ "def", "preprocess", "(", "self", ",", "style", ")", ":", "if", "self", ".", "property", "==", "'font'", ":", "style", "=", "[", "''", ".", "join", "(", "u", ".", "expression", "(", ")", ")", "if", "hasattr", "(", "u", ",", "'expression'", ")", "...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Property.fmt
Format node args: fills (dict): replacements returns: str
lesscpy/plib/property.py
def fmt(self, fills): """ Format node args: fills (dict): replacements returns: str """ f = "%(tab)s%(property)s:%(ws)s%(style)s%(important)s;%(nl)s" imp = ' !important' if self.important else '' if fills['nl']: self.parsed = [ ...
def fmt(self, fills): """ Format node args: fills (dict): replacements returns: str """ f = "%(tab)s%(property)s:%(ws)s%(style)s%(important)s;%(nl)s" imp = ' !important' if self.important else '' if fills['nl']: self.parsed = [ ...
[ "Format", "node", "args", ":", "fills", "(", "dict", ")", ":", "replacements", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/property.py#L59-L82
[ "def", "fmt", "(", "self", ",", "fills", ")", ":", "f", "=", "\"%(tab)s%(property)s:%(ws)s%(style)s%(important)s;%(nl)s\"", "imp", "=", "' !important'", "if", "self", ".", "important", "else", "''", "if", "fills", "[", "'nl'", "]", ":", "self", ".", "parsed", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Mixin.parse
Parse node args: scope (Scope): current scope raises: SyntaxError returns: self
lesscpy/plib/mixin.py
def parse(self, scope): """Parse node args: scope (Scope): current scope raises: SyntaxError returns: self """ self.name, args, self.guards = self.tokens[0] self.args = [a for a in utility.flatten(args) if a] self.body =...
def parse(self, scope): """Parse node args: scope (Scope): current scope raises: SyntaxError returns: self """ self.name, args, self.guards = self.tokens[0] self.args = [a for a in utility.flatten(args) if a] self.body =...
[ "Parse", "node", "args", ":", "scope", "(", "Scope", ")", ":", "current", "scope", "raises", ":", "SyntaxError", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/mixin.py#L24-L40
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "self", ".", "name", ",", "args", ",", "self", ".", "guards", "=", "self", ".", "tokens", "[", "0", "]", "self", ".", "args", "=", "[", "a", "for", "a", "in", "utility", ".", "flatten", "(", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Mixin.parse_args
Parse arguments to mixin. Add them to scope as variables. Sets upp special variable @arguments as well. args: args (list): arguments scope (Scope): current scope raises: SyntaxError
lesscpy/plib/mixin.py
def parse_args(self, args, scope): """Parse arguments to mixin. Add them to scope as variables. Sets upp special variable @arguments as well. args: args (list): arguments scope (Scope): current scope raises: SyntaxError """ argu...
def parse_args(self, args, scope): """Parse arguments to mixin. Add them to scope as variables. Sets upp special variable @arguments as well. args: args (list): arguments scope (Scope): current scope raises: SyntaxError """ argu...
[ "Parse", "arguments", "to", "mixin", ".", "Add", "them", "to", "scope", "as", "variables", ".", "Sets", "upp", "special", "variable" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/mixin.py#L49-L79
[ "def", "parse_args", "(", "self", ",", "args", ",", "scope", ")", ":", "arguments", "=", "list", "(", "zip", "(", "args", ",", "[", "' '", "]", "*", "len", "(", "args", ")", ")", ")", "if", "args", "and", "args", "[", "0", "]", "else", "None", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Mixin._parse_arg
Parse a single argument to mixin. args: var (Variable object): variable arg (mixed): argument scope (Scope object): current scope returns: Variable object or None
lesscpy/plib/mixin.py
def _parse_arg(self, var, arg, scope): """ Parse a single argument to mixin. args: var (Variable object): variable arg (mixed): argument scope (Scope object): current scope returns: Variable object or None """ if isinstance(var, Var...
def _parse_arg(self, var, arg, scope): """ Parse a single argument to mixin. args: var (Variable object): variable arg (mixed): argument scope (Scope object): current scope returns: Variable object or None """ if isinstance(var, Var...
[ "Parse", "a", "single", "argument", "to", "mixin", ".", "args", ":", "var", "(", "Variable", "object", ")", ":", "variable", "arg", "(", "mixed", ")", ":", "argument", "scope", "(", "Scope", "object", ")", ":", "current", "scope", "returns", ":", "Vari...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/mixin.py#L81-L116
[ "def", "_parse_arg", "(", "self", ",", "var", ",", "arg", ",", "scope", ")", ":", "if", "isinstance", "(", "var", ",", "Variable", ")", ":", "# kwarg", "if", "arg", ":", "if", "utility", ".", "is_variable", "(", "arg", "[", "0", "]", ")", ":", "t...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Mixin.parse_guards
Parse guards on mixin. args: scope (Scope): current scope raises: SyntaxError returns: bool (passes guards)
lesscpy/plib/mixin.py
def parse_guards(self, scope): """Parse guards on mixin. args: scope (Scope): current scope raises: SyntaxError returns: bool (passes guards) """ if self.guards: cor = True if ',' in self.guards else False for g ...
def parse_guards(self, scope): """Parse guards on mixin. args: scope (Scope): current scope raises: SyntaxError returns: bool (passes guards) """ if self.guards: cor = True if ',' in self.guards else False for g ...
[ "Parse", "guards", "on", "mixin", ".", "args", ":", "scope", "(", "Scope", ")", ":", "current", "scope", "raises", ":", "SyntaxError", "returns", ":", "bool", "(", "passes", "guards", ")" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/mixin.py#L118-L138
[ "def", "parse_guards", "(", "self", ",", "scope", ")", ":", "if", "self", ".", "guards", ":", "cor", "=", "True", "if", "','", "in", "self", ".", "guards", "else", "False", "for", "g", "in", "self", ".", "guards", ":", "if", "isinstance", "(", "g",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Mixin.call
Call mixin. Parses a copy of the mixins body in the current scope and returns it. args: scope (Scope): current scope args (list): arguments raises: SyntaxError returns: list or False
lesscpy/plib/mixin.py
def call(self, scope, args=[]): """Call mixin. Parses a copy of the mixins body in the current scope and returns it. args: scope (Scope): current scope args (list): arguments raises: SyntaxError returns: list or False """ ...
def call(self, scope, args=[]): """Call mixin. Parses a copy of the mixins body in the current scope and returns it. args: scope (Scope): current scope args (list): arguments raises: SyntaxError returns: list or False """ ...
[ "Call", "mixin", ".", "Parses", "a", "copy", "of", "the", "mixins", "body", "in", "the", "current", "scope", "and", "returns", "it", ".", "args", ":", "scope", "(", "Scope", ")", ":", "current", "scope", "args", "(", "list", ")", ":", "arguments", "r...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/mixin.py#L140-L166
[ "def", "call", "(", "self", ",", "scope", ",", "args", "=", "[", "]", ")", ":", "ret", "=", "False", "if", "args", ":", "args", "=", "[", "[", "a", ".", "parse", "(", "scope", ")", "if", "isinstance", "(", "a", ",", "Expression", ")", "else", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Variable.parse
Parse function args: scope (Scope): Scope object returns: self
lesscpy/plib/variable.py
def parse(self, scope): """ Parse function args: scope (Scope): Scope object returns: self """ self.name, _, self.value = self.tokens if isinstance(self.name, tuple): if len(self.name) > 1: self.name, pad = self.name ...
def parse(self, scope): """ Parse function args: scope (Scope): Scope object returns: self """ self.name, _, self.value = self.tokens if isinstance(self.name, tuple): if len(self.name) > 1: self.name, pad = self.name ...
[ "Parse", "function", "args", ":", "scope", "(", "Scope", ")", ":", "Scope", "object", "returns", ":", "self" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/variable.py#L14-L29
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "self", ".", "name", ",", "_", ",", "self", ".", "value", "=", "self", ".", "tokens", "if", "isinstance", "(", "self", ".", "name", ",", "tuple", ")", ":", "if", "len", "(", "self", ".", "nam...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.parse
Parse Node within scope. the functions ~( and e( map to self.escape and %( maps to self.sformat args: scope (Scope): Current scope
lesscpy/plib/call.py
def parse(self, scope): """Parse Node within scope. the functions ~( and e( map to self.escape and %( maps to self.sformat args: scope (Scope): Current scope """ name = ''.join(self.tokens[0]) parsed = self.process(self.tokens[1:], scope) if n...
def parse(self, scope): """Parse Node within scope. the functions ~( and e( map to self.escape and %( maps to self.sformat args: scope (Scope): Current scope """ name = ''.join(self.tokens[0]) parsed = self.process(self.tokens[1:], scope) if n...
[ "Parse", "Node", "within", "scope", ".", "the", "functions", "~", "(", "and", "e", "(", "map", "to", "self", ".", "escape", "and", "%", "(", "maps", "to", "self", ".", "sformat", "args", ":", "scope", "(", "Scope", ")", ":", "Current", "scope" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L32-L66
[ "def", "parse", "(", "self", ",", "scope", ")", ":", "name", "=", "''", ".", "join", "(", "self", ".", "tokens", "[", "0", "]", ")", "parsed", "=", "self", ".", "process", "(", "self", ".", "tokens", "[", "1", ":", "]", ",", "scope", ")", "if...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.sformat
String format. args: string (str): string to format args (list): format options returns: str
lesscpy/plib/call.py
def sformat(self, string, *args): """ String format. args: string (str): string to format args (list): format options returns: str """ format = string items = [] m = re.findall('(%[asdA])', format) if m and not args: ...
def sformat(self, string, *args): """ String format. args: string (str): string to format args (list): format options returns: str """ format = string items = [] m = re.findall('(%[asdA])', format) if m and not args: ...
[ "String", "format", ".", "args", ":", "string", "(", "str", ")", ":", "string", "to", "format", "args", "(", "list", ")", ":", "format", "options", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L77-L100
[ "def", "sformat", "(", "self", ",", "string", ",", "*", "args", ")", ":", "format", "=", "string", "items", "=", "[", "]", "m", "=", "re", ".", "findall", "(", "'(%[asdA])'", ",", "format", ")", "if", "m", "and", "not", "args", ":", "raise", "Syn...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.isnumber
Is number args: string (str): match returns: bool
lesscpy/plib/call.py
def isnumber(self, string, *args): """Is number args: string (str): match returns: bool """ try: n, u = utility.analyze_number(string) except SyntaxError: return False return True
def isnumber(self, string, *args): """Is number args: string (str): match returns: bool """ try: n, u = utility.analyze_number(string) except SyntaxError: return False return True
[ "Is", "number", "args", ":", "string", "(", "str", ")", ":", "match", "returns", ":", "bool" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L102-L113
[ "def", "isnumber", "(", "self", ",", "string", ",", "*", "args", ")", ":", "try", ":", "n", ",", "u", "=", "utility", ".", "analyze_number", "(", "string", ")", "except", "SyntaxError", ":", "return", "False", "return", "True" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.isurl
Is url args: string (str): match returns: bool
lesscpy/plib/call.py
def isurl(self, string, *args): """Is url args: string (str): match returns: bool """ arg = utility.destring(string) regex = re.compile( r'^(?:http|ftp)s?://' # http:// or https:// r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9]...
def isurl(self, string, *args): """Is url args: string (str): match returns: bool """ arg = utility.destring(string) regex = re.compile( r'^(?:http|ftp)s?://' # http:// or https:// r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9]...
[ "Is", "url", "args", ":", "string", "(", "str", ")", ":", "match", "returns", ":", "bool" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L124-L143
[ "def", "isurl", "(", "self", ",", "string", ",", "*", "args", ")", ":", "arg", "=", "utility", ".", "destring", "(", "string", ")", "regex", "=", "re", ".", "compile", "(", "r'^(?:http|ftp)s?://'", "# http:// or https://", "r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.isstring
Is string args: string (str): match returns: bool
lesscpy/plib/call.py
def isstring(self, string, *args): """Is string args: string (str): match returns: bool """ regex = re.compile(r'\'[^\']*\'|"[^"]*"') return regex.match(string)
def isstring(self, string, *args): """Is string args: string (str): match returns: bool """ regex = re.compile(r'\'[^\']*\'|"[^"]*"') return regex.match(string)
[ "Is", "string", "args", ":", "string", "(", "str", ")", ":", "match", "returns", ":", "bool" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L145-L153
[ "def", "isstring", "(", "self", ",", "string", ",", "*", "args", ")", ":", "regex", "=", "re", ".", "compile", "(", "r'\\'[^\\']*\\'|\"[^\"]*\"'", ")", "return", "regex", ".", "match", "(", "string", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.increment
Increment function args: value (str): target returns: str
lesscpy/plib/call.py
def increment(self, value, *args): """ Increment function args: value (str): target returns: str """ n, u = utility.analyze_number(value) return utility.with_unit(n + 1, u)
def increment(self, value, *args): """ Increment function args: value (str): target returns: str """ n, u = utility.analyze_number(value) return utility.with_unit(n + 1, u)
[ "Increment", "function", "args", ":", "value", "(", "str", ")", ":", "target", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L164-L172
[ "def", "increment", "(", "self", ",", "value", ",", "*", "args", ")", ":", "n", ",", "u", "=", "utility", ".", "analyze_number", "(", "value", ")", "return", "utility", ".", "with_unit", "(", "n", "+", "1", ",", "u", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.add
Add integers args: args (list): target returns: str
lesscpy/plib/call.py
def add(self, *args): """ Add integers args: args (list): target returns: str """ if (len(args) <= 1): return 0 return sum([int(v) for v in args])
def add(self, *args): """ Add integers args: args (list): target returns: str """ if (len(args) <= 1): return 0 return sum([int(v) for v in args])
[ "Add", "integers", "args", ":", "args", "(", "list", ")", ":", "target", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L184-L193
[ "def", "add", "(", "self", ",", "*", "args", ")", ":", "if", "(", "len", "(", "args", ")", "<=", "1", ")", ":", "return", "0", "return", "sum", "(", "[", "int", "(", "v", ")", "for", "v", "in", "args", "]", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.round
Round number args: value (str): target returns: str
lesscpy/plib/call.py
def round(self, value, *args): """ Round number args: value (str): target returns: str """ n, u = utility.analyze_number(value) return utility.with_unit( int(utility.away_from_zero_round(float(n))), u)
def round(self, value, *args): """ Round number args: value (str): target returns: str """ n, u = utility.analyze_number(value) return utility.with_unit( int(utility.away_from_zero_round(float(n))), u)
[ "Round", "number", "args", ":", "value", "(", "str", ")", ":", "target", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L195-L204
[ "def", "round", "(", "self", ",", "value", ",", "*", "args", ")", ":", "n", ",", "u", "=", "utility", ".", "analyze_number", "(", "value", ")", "return", "utility", ".", "with_unit", "(", "int", "(", "utility", ".", "away_from_zero_round", "(", "float"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.ceil
Ceil number args: value (str): target returns: str
lesscpy/plib/call.py
def ceil(self, value, *args): """ Ceil number args: value (str): target returns: str """ n, u = utility.analyze_number(value) return utility.with_unit(int(math.ceil(n)), u)
def ceil(self, value, *args): """ Ceil number args: value (str): target returns: str """ n, u = utility.analyze_number(value) return utility.with_unit(int(math.ceil(n)), u)
[ "Ceil", "number", "args", ":", "value", "(", "str", ")", ":", "target", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L206-L214
[ "def", "ceil", "(", "self", ",", "value", ",", "*", "args", ")", ":", "n", ",", "u", "=", "utility", ".", "analyze_number", "(", "value", ")", "return", "utility", ".", "with_unit", "(", "int", "(", "math", ".", "ceil", "(", "n", ")", ")", ",", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Call.percentage
Return percentage value args: value (str): target returns: str
lesscpy/plib/call.py
def percentage(self, value, *args): """ Return percentage value args: value (str): target returns: str """ n, u = utility.analyze_number(value) n = int(n * 100.0) u = '%' return utility.with_unit(n, u)
def percentage(self, value, *args): """ Return percentage value args: value (str): target returns: str """ n, u = utility.analyze_number(value) n = int(n * 100.0) u = '%' return utility.with_unit(n, u)
[ "Return", "percentage", "value", "args", ":", "value", "(", "str", ")", ":", "target", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/plib/call.py#L226-L236
[ "def", "percentage", "(", "self", ",", "value", ",", "*", "args", ")", ":", "n", ",", "u", "=", "utility", ".", "analyze_number", "(", "value", ")", "n", "=", "int", "(", "n", "*", "100.0", ")", "u", "=", "'%'", "return", "utility", ".", "with_un...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.process
Process color expression args: expression (tuple): color expression returns: str
lesscpy/lessc/color.py
def process(self, expression): """ Process color expression args: expression (tuple): color expression returns: str """ a, o, b = expression c1 = self._hextorgb(a) c2 = self._hextorgb(b) r = ['#'] for i in range(3): ...
def process(self, expression): """ Process color expression args: expression (tuple): color expression returns: str """ a, o, b = expression c1 = self._hextorgb(a) c2 = self._hextorgb(b) r = ['#'] for i in range(3): ...
[ "Process", "color", "expression", "args", ":", "expression", "(", "tuple", ")", ":", "color", "expression", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L21-L39
[ "def", "process", "(", "self", ",", "expression", ")", ":", "a", ",", "o", ",", "b", "=", "expression", "c1", "=", "self", ".", "_hextorgb", "(", "a", ")", "c2", "=", "self", ".", "_hextorgb", "(", "b", ")", "r", "=", "[", "'#'", "]", "for", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.operate
Do operation on colors args: left (str): left side right (str): right side operation (str): Operation returns: str
lesscpy/lessc/color.py
def operate(self, left, right, operation): """ Do operation on colors args: left (str): left side right (str): right side operation (str): Operation returns: str """ operation = { '+': operator.add, '-': oper...
def operate(self, left, right, operation): """ Do operation on colors args: left (str): left side right (str): right side operation (str): Operation returns: str """ operation = { '+': operator.add, '-': oper...
[ "Do", "operation", "on", "colors", "args", ":", "left", "(", "str", ")", ":", "left", "side", "right", "(", "str", ")", ":", "right", "side", "operation", "(", "str", ")", ":", "Operation", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L41-L56
[ "def", "operate", "(", "self", ",", "left", ",", "right", ",", "operation", ")", ":", "operation", "=", "{", "'+'", ":", "operator", ".", "add", ",", "'-'", ":", "operator", ".", "sub", ",", "'*'", ":", "operator", ".", "mul", ",", "'/'", ":", "o...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.rgb
Translate rgb(...) to color string raises: ValueError returns: str
lesscpy/lessc/color.py
def rgb(self, *args): """ Translate rgb(...) to color string raises: ValueError returns: str """ if len(args) == 4: args = args[:3] if len(args) == 3: try: return self._rgbatohex(list(map(int, args))) ...
def rgb(self, *args): """ Translate rgb(...) to color string raises: ValueError returns: str """ if len(args) == 4: args = args[:3] if len(args) == 3: try: return self._rgbatohex(list(map(int, args))) ...
[ "Translate", "rgb", "(", "...", ")", "to", "color", "string", "raises", ":", "ValueError", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L58-L75
[ "def", "rgb", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "4", ":", "args", "=", "args", "[", ":", "3", "]", "if", "len", "(", "args", ")", "==", "3", ":", "try", ":", "return", "self", ".", "_rgbatohex", "...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.rgba
Translate rgba(...) to color string raises: ValueError returns: str
lesscpy/lessc/color.py
def rgba(self, *args): """ Translate rgba(...) to color string raises: ValueError returns: str """ if len(args) == 4: try: falpha = float(list(args)[3]) if falpha > 1: args = args[:3] ...
def rgba(self, *args): """ Translate rgba(...) to color string raises: ValueError returns: str """ if len(args) == 4: try: falpha = float(list(args)[3]) if falpha > 1: args = args[:3] ...
[ "Translate", "rgba", "(", "...", ")", "to", "color", "string", "raises", ":", "ValueError", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L77-L103
[ "def", "rgba", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "4", ":", "try", ":", "falpha", "=", "float", "(", "list", "(", "args", ")", "[", "3", "]", ")", "if", "falpha", ">", "1", ":", "args", "=", "args"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.argb
Translate argb(...) to color string Creates a hex representation of a color in #AARRGGBB format (NOT #RRGGBBAA!). This format is used in Internet Explorer, and .NET and Android development. raises: ValueError returns: str
lesscpy/lessc/color.py
def argb(self, *args): """ Translate argb(...) to color string Creates a hex representation of a color in #AARRGGBB format (NOT #RRGGBBAA!). This format is used in Internet Explorer, and .NET and Android development. raises: ValueError returns: s...
def argb(self, *args): """ Translate argb(...) to color string Creates a hex representation of a color in #AARRGGBB format (NOT #RRGGBBAA!). This format is used in Internet Explorer, and .NET and Android development. raises: ValueError returns: s...
[ "Translate", "argb", "(", "...", ")", "to", "color", "string" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L105-L146
[ "def", "argb", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "1", "and", "type", "(", "args", "[", "0", "]", ")", "is", "str", ":", "match", "=", "re", ".", "match", "(", "r'rgba\\((.*)\\)'", ",", "args", "[", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.hsl
Translate hsl(...) to color string raises: ValueError returns: str
lesscpy/lessc/color.py
def hsl(self, *args): """ Translate hsl(...) to color string raises: ValueError returns: str """ if len(args) == 4: return self.hsla(*args) elif len(args) == 3: h, s, l = args rgb = colorsys.hls_to_rgb( ...
def hsl(self, *args): """ Translate hsl(...) to color string raises: ValueError returns: str """ if len(args) == 4: return self.hsla(*args) elif len(args) == 3: h, s, l = args rgb = colorsys.hls_to_rgb( ...
[ "Translate", "hsl", "(", "...", ")", "to", "color", "string", "raises", ":", "ValueError", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L148-L163
[ "def", "hsl", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "4", ":", "return", "self", ".", "hsla", "(", "*", "args", ")", "elif", "len", "(", "args", ")", "==", "3", ":", "h", ",", "s", ",", "l", "=", "ar...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.hsla
Translate hsla(...) to color string raises: ValueError returns: str
lesscpy/lessc/color.py
def hsla(self, *args): """ Translate hsla(...) to color string raises: ValueError returns: str """ if len(args) == 4: h, s, l, a = args rgb = colorsys.hls_to_rgb( int(h) / 360.0, utility.pc_or_float(l), utility.pc_or...
def hsla(self, *args): """ Translate hsla(...) to color string raises: ValueError returns: str """ if len(args) == 4: h, s, l, a = args rgb = colorsys.hls_to_rgb( int(h) / 360.0, utility.pc_or_float(l), utility.pc_or...
[ "Translate", "hsla", "(", "...", ")", "to", "color", "string", "raises", ":", "ValueError", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L165-L179
[ "def", "hsla", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "4", ":", "h", ",", "s", ",", "l", ",", "a", "=", "args", "rgb", "=", "colorsys", ".", "hls_to_rgb", "(", "int", "(", "h", ")", "/", "360.0", ",", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.hue
Return the hue value of a color args: color (str): color raises: ValueError returns: float
lesscpy/lessc/color.py
def hue(self, color, *args): """ Return the hue value of a color args: color (str): color raises: ValueError returns: float """ if color: h, l, s = self._hextohls(color) return utility.convergent_round(h * 360.0,...
def hue(self, color, *args): """ Return the hue value of a color args: color (str): color raises: ValueError returns: float """ if color: h, l, s = self._hextohls(color) return utility.convergent_round(h * 360.0,...
[ "Return", "the", "hue", "value", "of", "a", "color", "args", ":", "color", "(", "str", ")", ":", "color", "raises", ":", "ValueError", "returns", ":", "float" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L181-L193
[ "def", "hue", "(", "self", ",", "color", ",", "*", "args", ")", ":", "if", "color", ":", "h", ",", "l", ",", "s", "=", "self", ".", "_hextohls", "(", "color", ")", "return", "utility", ".", "convergent_round", "(", "h", "*", "360.0", ",", "3", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.saturation
Return the saturation value of a color args: color (str): color raises: ValueError returns: float
lesscpy/lessc/color.py
def saturation(self, color, *args): """ Return the saturation value of a color args: color (str): color raises: ValueError returns: float """ if color: h, l, s = self._hextohls(color) return s * 100.0 rai...
def saturation(self, color, *args): """ Return the saturation value of a color args: color (str): color raises: ValueError returns: float """ if color: h, l, s = self._hextohls(color) return s * 100.0 rai...
[ "Return", "the", "saturation", "value", "of", "a", "color", "args", ":", "color", "(", "str", ")", ":", "color", "raises", ":", "ValueError", "returns", ":", "float" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L195-L207
[ "def", "saturation", "(", "self", ",", "color", ",", "*", "args", ")", ":", "if", "color", ":", "h", ",", "l", ",", "s", "=", "self", ".", "_hextohls", "(", "color", ")", "return", "s", "*", "100.0", "raise", "ValueError", "(", "'Illegal color values...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.lighten
Lighten a color args: color (str): color diff (str): percentage returns: str
lesscpy/lessc/color.py
def lighten(self, color, diff, *args): """ Lighten a color args: color (str): color diff (str): percentage returns: str """ if color and diff: return self._ophsl(color, diff, 1, operator.add) raise ValueError('Illegal color ...
def lighten(self, color, diff, *args): """ Lighten a color args: color (str): color diff (str): percentage returns: str """ if color and diff: return self._ophsl(color, diff, 1, operator.add) raise ValueError('Illegal color ...
[ "Lighten", "a", "color", "args", ":", "color", "(", "str", ")", ":", "color", "diff", "(", "str", ")", ":", "percentage", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L228-L238
[ "def", "lighten", "(", "self", ",", "color", ",", "diff", ",", "*", "args", ")", ":", "if", "color", "and", "diff", ":", "return", "self", ".", "_ophsl", "(", "color", ",", "diff", ",", "1", ",", "operator", ".", "add", ")", "raise", "ValueError", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.darken
Darken a color args: color (str): color diff (str): percentage returns: str
lesscpy/lessc/color.py
def darken(self, color, diff, *args): """ Darken a color args: color (str): color diff (str): percentage returns: str """ if color and diff: return self._ophsl(color, diff, 1, operator.sub) raise ValueError('Illegal color va...
def darken(self, color, diff, *args): """ Darken a color args: color (str): color diff (str): percentage returns: str """ if color and diff: return self._ophsl(color, diff, 1, operator.sub) raise ValueError('Illegal color va...
[ "Darken", "a", "color", "args", ":", "color", "(", "str", ")", ":", "color", "diff", "(", "str", ")", ":", "percentage", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L240-L250
[ "def", "darken", "(", "self", ",", "color", ",", "diff", ",", "*", "args", ")", ":", "if", "color", "and", "diff", ":", "return", "self", ".", "_ophsl", "(", "color", ",", "diff", ",", "1", ",", "operator", ".", "sub", ")", "raise", "ValueError", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.spin
Spin color by degree. (Increase / decrease hue) args: color (str): color degree (str): percentage raises: ValueError returns: str
lesscpy/lessc/color.py
def spin(self, color, degree, *args): """ Spin color by degree. (Increase / decrease hue) args: color (str): color degree (str): percentage raises: ValueError returns: str """ if color and degree: if isinstance(d...
def spin(self, color, degree, *args): """ Spin color by degree. (Increase / decrease hue) args: color (str): color degree (str): percentage raises: ValueError returns: str """ if color and degree: if isinstance(d...
[ "Spin", "color", "by", "degree", ".", "(", "Increase", "/", "decrease", "hue", ")", "args", ":", "color", "(", "str", ")", ":", "color", "degree", "(", "str", ")", ":", "percentage", "raises", ":", "ValueError", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L296-L315
[ "def", "spin", "(", "self", ",", "color", ",", "degree", ",", "*", "args", ")", ":", "if", "color", "and", "degree", ":", "if", "isinstance", "(", "degree", ",", "string_types", ")", ":", "degree", "=", "float", "(", "degree", ".", "strip", "(", "'...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.mix
This algorithm factors in both the user-provided weight and the difference between the alpha values of the two colors to decide how to perform the weighted average of the two RGB values. It works by first normalizing both parameters to be within [-1, 1], where 1 indicates "only use colo...
lesscpy/lessc/color.py
def mix(self, color1, color2, weight=50, *args): """This algorithm factors in both the user-provided weight and the difference between the alpha values of the two colors to decide how to perform the weighted average of the two RGB values. It works by first normalizing both parameters to...
def mix(self, color1, color2, weight=50, *args): """This algorithm factors in both the user-provided weight and the difference between the alpha values of the two colors to decide how to perform the weighted average of the two RGB values. It works by first normalizing both parameters to...
[ "This", "algorithm", "factors", "in", "both", "the", "user", "-", "provided", "weight", "and", "the", "difference", "between", "the", "alpha", "values", "of", "the", "two", "colors", "to", "decide", "how", "to", "perform", "the", "weighted", "average", "of",...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L317-L367
[ "def", "mix", "(", "self", ",", "color1", ",", "color2", ",", "weight", "=", "50", ",", "*", "args", ")", ":", "if", "color1", "and", "color2", ":", "if", "isinstance", "(", "weight", ",", "string_types", ")", ":", "weight", "=", "float", "(", "wei...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
Color.fmt
Format CSS Hex color code. uppercase becomes lowercase, 3 digit codes expand to 6 digit. args: color (str): color raises: ValueError returns: str
lesscpy/lessc/color.py
def fmt(self, color): """ Format CSS Hex color code. uppercase becomes lowercase, 3 digit codes expand to 6 digit. args: color (str): color raises: ValueError returns: str """ if utility.is_color(color): color = colo...
def fmt(self, color): """ Format CSS Hex color code. uppercase becomes lowercase, 3 digit codes expand to 6 digit. args: color (str): color raises: ValueError returns: str """ if utility.is_color(color): color = colo...
[ "Format", "CSS", "Hex", "color", "code", ".", "uppercase", "becomes", "lowercase", "3", "digit", "codes", "expand", "to", "6", "digit", ".", "args", ":", "color", "(", "str", ")", ":", "color", "raises", ":", "ValueError", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/color.py#L369-L384
[ "def", "fmt", "(", "self", ",", "color", ")", ":", "if", "utility", ".", "is_color", "(", "color", ")", ":", "color", "=", "color", ".", "lower", "(", ")", ".", "strip", "(", "'#'", ")", "if", "len", "(", "color", ")", "in", "[", "3", ",", "4...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
flatten
Flatten list. Args: lst (list): List to flatten Returns: generator
lesscpy/lessc/utility.py
def flatten(lst): """Flatten list. Args: lst (list): List to flatten Returns: generator """ for elm in lst: if isinstance(elm, collections.Iterable) and not isinstance( elm, string_types): for sub in flatten(elm): yield sub ...
def flatten(lst): """Flatten list. Args: lst (list): List to flatten Returns: generator """ for elm in lst: if isinstance(elm, collections.Iterable) and not isinstance( elm, string_types): for sub in flatten(elm): yield sub ...
[ "Flatten", "list", ".", "Args", ":", "lst", "(", "list", ")", ":", "List", "to", "flatten", "Returns", ":", "generator" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L21-L34
[ "def", "flatten", "(", "lst", ")", ":", "for", "elm", "in", "lst", ":", "if", "isinstance", "(", "elm", ",", "collections", ".", "Iterable", ")", "and", "not", "isinstance", "(", "elm", ",", "string_types", ")", ":", "for", "sub", "in", "flatten", "(...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
pairwise
yield item i and item i+1 in lst. e.g. (lst[0], lst[1]), (lst[1], lst[2]), ..., (lst[-1], None) Args: lst (list): List to process Returns: list
lesscpy/lessc/utility.py
def pairwise(lst): """ yield item i and item i+1 in lst. e.g. (lst[0], lst[1]), (lst[1], lst[2]), ..., (lst[-1], None) Args: lst (list): List to process Returns: list """ if not lst: return length = len(lst) for i in range(length - 1): yield lst[i], ls...
def pairwise(lst): """ yield item i and item i+1 in lst. e.g. (lst[0], lst[1]), (lst[1], lst[2]), ..., (lst[-1], None) Args: lst (list): List to process Returns: list """ if not lst: return length = len(lst) for i in range(length - 1): yield lst[i], ls...
[ "yield", "item", "i", "and", "item", "i", "+", "1", "in", "lst", ".", "e", ".", "g", ".", "(", "lst", "[", "0", "]", "lst", "[", "1", "]", ")", "(", "lst", "[", "1", "]", "lst", "[", "2", "]", ")", "...", "(", "lst", "[", "-", "1", "]...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L37-L50
[ "def", "pairwise", "(", "lst", ")", ":", "if", "not", "lst", ":", "return", "length", "=", "len", "(", "lst", ")", "for", "i", "in", "range", "(", "length", "-", "1", ")", ":", "yield", "lst", "[", "i", "]", ",", "lst", "[", "i", "+", "1", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
rename
Rename all sub-blocks moved under another block. (mixins) Args: lst (list): block list scope (object): Scope object
lesscpy/lessc/utility.py
def rename(blocks, scope, stype): """ Rename all sub-blocks moved under another block. (mixins) Args: lst (list): block list scope (object): Scope object """ for p in blocks: if isinstance(p, stype): p.tokens[0].parse(scope) if p.tokens[1]: ...
def rename(blocks, scope, stype): """ Rename all sub-blocks moved under another block. (mixins) Args: lst (list): block list scope (object): Scope object """ for p in blocks: if isinstance(p, stype): p.tokens[0].parse(scope) if p.tokens[1]: ...
[ "Rename", "all", "sub", "-", "blocks", "moved", "under", "another", "block", ".", "(", "mixins", ")", "Args", ":", "lst", "(", "list", ")", ":", "block", "list", "scope", "(", "object", ")", ":", "Scope", "object" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L53-L67
[ "def", "rename", "(", "blocks", ",", "scope", ",", "stype", ")", ":", "for", "p", "in", "blocks", ":", "if", "isinstance", "(", "p", ",", "stype", ")", ":", "p", ".", "tokens", "[", "0", "]", ".", "parse", "(", "scope", ")", "if", "p", ".", "...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
blocksearch
Recursive search for name in block (inner blocks) Args: name (str): search term Returns: Block OR False
lesscpy/lessc/utility.py
def blocksearch(block, name): """ Recursive search for name in block (inner blocks) Args: name (str): search term Returns: Block OR False """ if hasattr(block, 'tokens'): for b in block.tokens[1]: b = (b if hasattr(b, 'raw') and b.raw() == name else blocksearch( ...
def blocksearch(block, name): """ Recursive search for name in block (inner blocks) Args: name (str): search term Returns: Block OR False """ if hasattr(block, 'tokens'): for b in block.tokens[1]: b = (b if hasattr(b, 'raw') and b.raw() == name else blocksearch( ...
[ "Recursive", "search", "for", "name", "in", "block", "(", "inner", "blocks", ")", "Args", ":", "name", "(", "str", ")", ":", "search", "term", "Returns", ":", "Block", "OR", "False" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L70-L83
[ "def", "blocksearch", "(", "block", ",", "name", ")", ":", "if", "hasattr", "(", "block", ",", "'tokens'", ")", ":", "for", "b", "in", "block", ".", "tokens", "[", "1", "]", ":", "b", "=", "(", "b", "if", "hasattr", "(", "b", ",", "'raw'", ")",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
reverse_guard
Reverse guard expression. not (@a > 5) -> (@a =< 5) Args: lst (list): Expression returns: list
lesscpy/lessc/utility.py
def reverse_guard(lst): """ Reverse guard expression. not (@a > 5) -> (@a =< 5) Args: lst (list): Expression returns: list """ rev = {'<': '>=', '>': '=<', '>=': '<', '=<': '>'} return [rev[l] if l in rev else l for l in lst]
def reverse_guard(lst): """ Reverse guard expression. not (@a > 5) -> (@a =< 5) Args: lst (list): Expression returns: list """ rev = {'<': '>=', '>': '=<', '>=': '<', '=<': '>'} return [rev[l] if l in rev else l for l in lst]
[ "Reverse", "guard", "expression", ".", "not", "(" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L86-L95
[ "def", "reverse_guard", "(", "lst", ")", ":", "rev", "=", "{", "'<'", ":", "'>='", ",", "'>'", ":", "'=<'", ",", "'>='", ":", "'<'", ",", "'=<'", ":", "'>'", "}", "return", "[", "rev", "[", "l", "]", "if", "l", "in", "rev", "else", "l", "for"...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
debug_print
Print scope tree args: lst (list): parse result lvl (int): current nesting level
lesscpy/lessc/utility.py
def debug_print(lst, lvl=0): """ Print scope tree args: lst (list): parse result lvl (int): current nesting level """ pad = ''.join(['\t.'] * lvl) t = type(lst) if t is list: for p in lst: debug_print(p, lvl) elif hasattr(lst, 'tokens'): print(pad,...
def debug_print(lst, lvl=0): """ Print scope tree args: lst (list): parse result lvl (int): current nesting level """ pad = ''.join(['\t.'] * lvl) t = type(lst) if t is list: for p in lst: debug_print(p, lvl) elif hasattr(lst, 'tokens'): print(pad,...
[ "Print", "scope", "tree", "args", ":", "lst", "(", "list", ")", ":", "parse", "result", "lvl", "(", "int", ")", ":", "current", "nesting", "level" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L98-L111
[ "def", "debug_print", "(", "lst", ",", "lvl", "=", "0", ")", ":", "pad", "=", "''", ".", "join", "(", "[", "'\\t.'", "]", "*", "lvl", ")", "t", "=", "type", "(", "lst", ")", "if", "t", "is", "list", ":", "for", "p", "in", "lst", ":", "debug...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
analyze_number
Analyse number for type and split from unit 1px -> (q, 'px') args: var (str): number string kwargs: err (str): Error message raises: SyntaxError returns: tuple
lesscpy/lessc/utility.py
def analyze_number(var, err=''): """ Analyse number for type and split from unit 1px -> (q, 'px') args: var (str): number string kwargs: err (str): Error message raises: SyntaxError returns: tuple """ n, u = split_unit(var) if not isinstance(var, s...
def analyze_number(var, err=''): """ Analyse number for type and split from unit 1px -> (q, 'px') args: var (str): number string kwargs: err (str): Error message raises: SyntaxError returns: tuple """ n, u = split_unit(var) if not isinstance(var, s...
[ "Analyse", "number", "for", "type", "and", "split", "from", "unit", "1px", "-", ">", "(", "q", "px", ")", "args", ":", "var", "(", "str", ")", ":", "number", "string", "kwargs", ":", "err", "(", "str", ")", ":", "Error", "message", "raises", ":", ...
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L124-L147
[ "def", "analyze_number", "(", "var", ",", "err", "=", "''", ")", ":", "n", ",", "u", "=", "split_unit", "(", "var", ")", "if", "not", "isinstance", "(", "var", ",", "string_types", ")", ":", "return", "(", "var", ",", "u", ")", "if", "is_color", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
with_unit
Return number with unit args: number (mixed): Number unit (str): Unit returns: str
lesscpy/lessc/utility.py
def with_unit(number, unit=None): """ Return number with unit args: number (mixed): Number unit (str): Unit returns: str """ if isinstance(number, tuple): number, unit = number if number == 0: return '0' if unit: number = str(number) if...
def with_unit(number, unit=None): """ Return number with unit args: number (mixed): Number unit (str): Unit returns: str """ if isinstance(number, tuple): number, unit = number if number == 0: return '0' if unit: number = str(number) if...
[ "Return", "number", "with", "unit", "args", ":", "number", "(", "mixed", ")", ":", "Number", "unit", "(", "str", ")", ":", "Unit", "returns", ":", "str" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L150-L167
[ "def", "with_unit", "(", "number", ",", "unit", "=", "None", ")", ":", "if", "isinstance", "(", "number", ",", "tuple", ")", ":", "number", ",", "unit", "=", "number", "if", "number", "==", "0", ":", "return", "'0'", "if", "unit", ":", "number", "=...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
is_color
Is string CSS color args: value (str): string returns: bool
lesscpy/lessc/utility.py
def is_color(value): """ Is string CSS color args: value (str): string returns: bool """ if not value or not isinstance(value, string_types): return False if value[0] == '#' and len(value) in [4, 5, 7, 9]: try: int(value[1:], 16) return Tru...
def is_color(value): """ Is string CSS color args: value (str): string returns: bool """ if not value or not isinstance(value, string_types): return False if value[0] == '#' and len(value) in [4, 5, 7, 9]: try: int(value[1:], 16) return Tru...
[ "Is", "string", "CSS", "color", "args", ":", "value", "(", "str", ")", ":", "string", "returns", ":", "bool" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L170-L185
[ "def", "is_color", "(", "value", ")", ":", "if", "not", "value", "or", "not", "isinstance", "(", "value", ",", "string_types", ")", ":", "return", "False", "if", "value", "[", "0", "]", "==", "'#'", "and", "len", "(", "value", ")", "in", "[", "4", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
is_variable
Check if string is LESS variable args: value (str): string returns: bool
lesscpy/lessc/utility.py
def is_variable(value): """ Check if string is LESS variable args: value (str): string returns: bool """ if isinstance(value, string_types): return (value.startswith('@') or value.startswith('-@')) elif isinstance(value, tuple): value = ''.join(value) retu...
def is_variable(value): """ Check if string is LESS variable args: value (str): string returns: bool """ if isinstance(value, string_types): return (value.startswith('@') or value.startswith('-@')) elif isinstance(value, tuple): value = ''.join(value) retu...
[ "Check", "if", "string", "is", "LESS", "variable", "args", ":", "value", "(", "str", ")", ":", "string", "returns", ":", "bool" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L188-L200
[ "def", "is_variable", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "string_types", ")", ":", "return", "(", "value", ".", "startswith", "(", "'@'", ")", "or", "value", ".", "startswith", "(", "'-@'", ")", ")", "elif", "isinstance", "(...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
is_float
Is value float args: value (str): string returns: bool
lesscpy/lessc/utility.py
def is_float(value): """ Is value float args: value (str): string returns: bool """ if not is_int(value): try: float(str(value)) return True except (ValueError, TypeError): pass return False
def is_float(value): """ Is value float args: value (str): string returns: bool """ if not is_int(value): try: float(str(value)) return True except (ValueError, TypeError): pass return False
[ "Is", "value", "float", "args", ":", "value", "(", "str", ")", ":", "string", "returns", ":", "bool" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L218-L231
[ "def", "is_float", "(", "value", ")", ":", "if", "not", "is_int", "(", "value", ")", ":", "try", ":", "float", "(", "str", "(", "value", ")", ")", "return", "True", "except", "(", "ValueError", ",", "TypeError", ")", ":", "pass", "return", "False" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
split_unit
Split a number from its unit 1px -> (q, 'px') Args: value (str): input returns: tuple
lesscpy/lessc/utility.py
def split_unit(value): """ Split a number from its unit 1px -> (q, 'px') Args: value (str): input returns: tuple """ r = re.search('^(\-?[\d\.]+)(.*)$', str(value)) return r.groups() if r else ('', '')
def split_unit(value): """ Split a number from its unit 1px -> (q, 'px') Args: value (str): input returns: tuple """ r = re.search('^(\-?[\d\.]+)(.*)$', str(value)) return r.groups() if r else ('', '')
[ "Split", "a", "number", "from", "its", "unit", "1px", "-", ">", "(", "q", "px", ")", "Args", ":", "value", "(", "str", ")", ":", "input", "returns", ":", "tuple" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L234-L243
[ "def", "split_unit", "(", "value", ")", ":", "r", "=", "re", ".", "search", "(", "'^(\\-?[\\d\\.]+)(.*)$'", ",", "str", "(", "value", ")", ")", "return", "r", ".", "groups", "(", ")", "if", "r", "else", "(", "''", ",", "''", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
away_from_zero_round
Round half-way away from zero. Python2's round() method.
lesscpy/lessc/utility.py
def away_from_zero_round(value, ndigits=0): """Round half-way away from zero. Python2's round() method. """ if sys.version_info[0] >= 3: p = 10**ndigits return float(math.floor((value * p) + math.copysign(0.5, value))) / p else: return round(value, ndigits)
def away_from_zero_round(value, ndigits=0): """Round half-way away from zero. Python2's round() method. """ if sys.version_info[0] >= 3: p = 10**ndigits return float(math.floor((value * p) + math.copysign(0.5, value))) / p else: return round(value, ndigits)
[ "Round", "half", "-", "way", "away", "from", "zero", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L246-L255
[ "def", "away_from_zero_round", "(", "value", ",", "ndigits", "=", "0", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "p", "=", "10", "**", "ndigits", "return", "float", "(", "math", ".", "floor", "(", "(", "value", "*",...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
convergent_round
Convergent rounding. Round to neareas even, similar to Python3's round() method.
lesscpy/lessc/utility.py
def convergent_round(value, ndigits=0): """Convergent rounding. Round to neareas even, similar to Python3's round() method. """ if sys.version_info[0] < 3: if value < 0.0: return -convergent_round(-value) epsilon = 0.0000001 integral_part, _ = divmod(value, 1) ...
def convergent_round(value, ndigits=0): """Convergent rounding. Round to neareas even, similar to Python3's round() method. """ if sys.version_info[0] < 3: if value < 0.0: return -convergent_round(-value) epsilon = 0.0000001 integral_part, _ = divmod(value, 1) ...
[ "Convergent", "rounding", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L258-L276
[ "def", "convergent_round", "(", "value", ",", "ndigits", "=", "0", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "if", "value", "<", "0.0", ":", "return", "-", "convergent_round", "(", "-", "value", ")", "epsilon", "=", ...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
pc_or_float
Utility function to process strings that contain either percentiles or floats args: str: s returns: float
lesscpy/lessc/utility.py
def pc_or_float(s): """ Utility function to process strings that contain either percentiles or floats args: str: s returns: float """ if isinstance(s, string_types) and '%' in s: return float(s.strip('%')) / 100.0 return float(s)
def pc_or_float(s): """ Utility function to process strings that contain either percentiles or floats args: str: s returns: float """ if isinstance(s, string_types) and '%' in s: return float(s.strip('%')) / 100.0 return float(s)
[ "Utility", "function", "to", "process", "strings", "that", "contain", "either", "percentiles", "or", "floats", "args", ":", "str", ":", "s", "returns", ":", "float" ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L279-L288
[ "def", "pc_or_float", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "string_types", ")", "and", "'%'", "in", "s", ":", "return", "float", "(", "s", ".", "strip", "(", "'%'", ")", ")", "/", "100.0", "return", "float", "(", "s", ")" ]
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126
valid
permutations_with_replacement
Return successive r length permutations of elements in the iterable. Similar to itertools.permutation but withouth repeated values filtering.
lesscpy/lessc/utility.py
def permutations_with_replacement(iterable, r=None): """Return successive r length permutations of elements in the iterable. Similar to itertools.permutation but withouth repeated values filtering. """ pool = tuple(iterable) n = len(pool) r = n if r is None else r for indices in itertools.p...
def permutations_with_replacement(iterable, r=None): """Return successive r length permutations of elements in the iterable. Similar to itertools.permutation but withouth repeated values filtering. """ pool = tuple(iterable) n = len(pool) r = n if r is None else r for indices in itertools.p...
[ "Return", "successive", "r", "length", "permutations", "of", "elements", "in", "the", "iterable", "." ]
lesscpy/lesscpy
python
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/utility.py#L291-L300
[ "def", "permutations_with_replacement", "(", "iterable", ",", "r", "=", "None", ")", ":", "pool", "=", "tuple", "(", "iterable", ")", "n", "=", "len", "(", "pool", ")", "r", "=", "n", "if", "r", "is", "None", "else", "r", "for", "indices", "in", "i...
51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126