id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,300 | smarie/python-parsyfiles | parsyfiles/converting_core.py | ConversionChain._convert | def _convert(self, desired_type: Type[T], obj: S, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T:
"""
Apply the converters of the chain in order to produce the desired result. Only the last converter will see the
'desired type', the others will be asked to produce their declared to_typ... | python | def _convert(self, desired_type: Type[T], obj: S, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T:
"""
Apply the converters of the chain in order to produce the desired result. Only the last converter will see the
'desired type', the others will be asked to produce their declared to_typ... | [
"def",
"_convert",
"(",
"self",
",",
"desired_type",
":",
"Type",
"[",
"T",
"]",
",",
"obj",
":",
"S",
",",
"logger",
":",
"Logger",
",",
"options",
":",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
")",
"->",
"T",
":",
... | Apply the converters of the chain in order to produce the desired result. Only the last converter will see the
'desired type', the others will be asked to produce their declared to_type.
:param desired_type:
:param obj:
:param logger:
:param options:
:return: | [
"Apply",
"the",
"converters",
"of",
"the",
"chain",
"in",
"order",
"to",
"produce",
"the",
"desired",
"result",
".",
"Only",
"the",
"last",
"converter",
"will",
"see",
"the",
"desired",
"type",
"the",
"others",
"will",
"be",
"asked",
"to",
"produce",
"thei... | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L754-L770 |
38,301 | frascoweb/frasco | frasco/signals.py | listens_to | def listens_to(name, sender=None, weak=True):
"""Listens to a named signal
"""
def decorator(f):
if sender:
return signal(name).connect(f, sender=sender, weak=weak)
return signal(name).connect(f, weak=weak)
return decorator | python | def listens_to(name, sender=None, weak=True):
"""Listens to a named signal
"""
def decorator(f):
if sender:
return signal(name).connect(f, sender=sender, weak=weak)
return signal(name).connect(f, weak=weak)
return decorator | [
"def",
"listens_to",
"(",
"name",
",",
"sender",
"=",
"None",
",",
"weak",
"=",
"True",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"if",
"sender",
":",
"return",
"signal",
"(",
"name",
")",
".",
"connect",
"(",
"f",
",",
"sender",
"=",
"se... | Listens to a named signal | [
"Listens",
"to",
"a",
"named",
"signal"
] | ea519d69dd5ca6deaf3650175692ee4a1a02518f | https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/signals.py#L9-L16 |
38,302 | korfuri/pip-prometheus | pip_prometheus/__init__.py | LoadInstallations | def LoadInstallations(counter):
"""Load installed packages and export the version map.
This function may be called multiple times, but the counters will
be increased each time. Since Prometheus counters are never
decreased, the aggregated results will not make sense.
"""
process = subprocess.Po... | python | def LoadInstallations(counter):
"""Load installed packages and export the version map.
This function may be called multiple times, but the counters will
be increased each time. Since Prometheus counters are never
decreased, the aggregated results will not make sense.
"""
process = subprocess.Po... | [
"def",
"LoadInstallations",
"(",
"counter",
")",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"pip\"",
",",
"\"list\"",
",",
"\"--format=json\"",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"output",
",",
"_",
"=",
"process",
... | Load installed packages and export the version map.
This function may be called multiple times, but the counters will
be increased each time. Since Prometheus counters are never
decreased, the aggregated results will not make sense. | [
"Load",
"installed",
"packages",
"and",
"export",
"the",
"version",
"map",
"."
] | 0be5d55739312828365833b87399183dc838e0b7 | https://github.com/korfuri/pip-prometheus/blob/0be5d55739312828365833b87399183dc838e0b7/pip_prometheus/__init__.py#L7-L19 |
38,303 | EnricoGiampieri/keggrest | keggrest/keggrest.py | RESTrequest | def RESTrequest(*args, **kwargs):
"""return and save the blob of data that is returned
from kegg without caring to the format"""
verbose = kwargs.get('verbose', False)
force_download = kwargs.get('force', False)
save = kwargs.get('force', True)
# so you can copy paste from kegg
args = list(... | python | def RESTrequest(*args, **kwargs):
"""return and save the blob of data that is returned
from kegg without caring to the format"""
verbose = kwargs.get('verbose', False)
force_download = kwargs.get('force', False)
save = kwargs.get('force', True)
# so you can copy paste from kegg
args = list(... | [
"def",
"RESTrequest",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"verbose",
"=",
"kwargs",
".",
"get",
"(",
"'verbose'",
",",
"False",
")",
"force_download",
"=",
"kwargs",
".",
"get",
"(",
"'force'",
",",
"False",
")",
"save",
"=",
"kwargs... | return and save the blob of data that is returned
from kegg without caring to the format | [
"return",
"and",
"save",
"the",
"blob",
"of",
"data",
"that",
"is",
"returned",
"from",
"kegg",
"without",
"caring",
"to",
"the",
"format"
] | 012c15d6ac591bebec875946d8f9493b000fb1ee | https://github.com/EnricoGiampieri/keggrest/blob/012c15d6ac591bebec875946d8f9493b000fb1ee/keggrest/keggrest.py#L12-L44 |
38,304 | nikcub/floyd | floyd/core/multiopt.py | MultioptHelpFormatter.command_help_long | def command_help_long(self):
"""
Return command help for use in global parser usage string
@TODO update to support self.current_indent from formatter
"""
indent = " " * 2 # replace with current_indent
help = "Command must be one of:\n"
for action_name in self.parser.valid_commands... | python | def command_help_long(self):
"""
Return command help for use in global parser usage string
@TODO update to support self.current_indent from formatter
"""
indent = " " * 2 # replace with current_indent
help = "Command must be one of:\n"
for action_name in self.parser.valid_commands... | [
"def",
"command_help_long",
"(",
"self",
")",
":",
"indent",
"=",
"\" \"",
"*",
"2",
"# replace with current_indent",
"help",
"=",
"\"Command must be one of:\\n\"",
"for",
"action_name",
"in",
"self",
".",
"parser",
".",
"valid_commands",
":",
"help",
"+=",
"\"%s%... | Return command help for use in global parser usage string
@TODO update to support self.current_indent from formatter | [
"Return",
"command",
"help",
"for",
"use",
"in",
"global",
"parser",
"usage",
"string"
] | 5772d0047efb11c9ce5f7d234a9da4576ce24edc | https://github.com/nikcub/floyd/blob/5772d0047efb11c9ce5f7d234a9da4576ce24edc/floyd/core/multiopt.py#L66-L77 |
38,305 | nikcub/floyd | floyd/core/multiopt.py | MultioptParser.run | def run(self):
"""
Run the multiopt parser
"""
self.parser = MultioptOptionParser(
usage="%prog <command> [options] [args]",
prog=self.clsname,
version=self.version,
option_list=self.global_options,
description=self.desc_short,
commands=self.command_set,
epilo... | python | def run(self):
"""
Run the multiopt parser
"""
self.parser = MultioptOptionParser(
usage="%prog <command> [options] [args]",
prog=self.clsname,
version=self.version,
option_list=self.global_options,
description=self.desc_short,
commands=self.command_set,
epilo... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"parser",
"=",
"MultioptOptionParser",
"(",
"usage",
"=",
"\"%prog <command> [options] [args]\"",
",",
"prog",
"=",
"self",
".",
"clsname",
",",
"version",
"=",
"self",
".",
"version",
",",
"option_list",
"="... | Run the multiopt parser | [
"Run",
"the",
"multiopt",
"parser"
] | 5772d0047efb11c9ce5f7d234a9da4576ce24edc | https://github.com/nikcub/floyd/blob/5772d0047efb11c9ce5f7d234a9da4576ce24edc/floyd/core/multiopt.py#L383-L441 |
38,306 | KvasirSecurity/kvasirapi-python | KvasirAPI/jsonrpc/snmp.py | SNMP.add | def add(self, host=None, f_community=None, f_access=None, f_version=None):
"""
Add an SNMP community string to a host
:param host: t_hosts.id or t_hosts.f_ipaddr
:param f_community: Community string to add
:param f_access: READ or WRITE
:param f_version: v1, v2c or v3
... | python | def add(self, host=None, f_community=None, f_access=None, f_version=None):
"""
Add an SNMP community string to a host
:param host: t_hosts.id or t_hosts.f_ipaddr
:param f_community: Community string to add
:param f_access: READ or WRITE
:param f_version: v1, v2c or v3
... | [
"def",
"add",
"(",
"self",
",",
"host",
"=",
"None",
",",
"f_community",
"=",
"None",
",",
"f_access",
"=",
"None",
",",
"f_version",
"=",
"None",
")",
":",
"return",
"self",
".",
"send",
".",
"snmp_add",
"(",
"host",
",",
"f_community",
",",
"f_acce... | Add an SNMP community string to a host
:param host: t_hosts.id or t_hosts.f_ipaddr
:param f_community: Community string to add
:param f_access: READ or WRITE
:param f_version: v1, v2c or v3
:return: (True/False, t_snmp.id/Error string) | [
"Add",
"an",
"SNMP",
"community",
"string",
"to",
"a",
"host"
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/jsonrpc/snmp.py#L39-L49 |
38,307 | memphis-iis/GLUDB | gludb/backends/mongodb.py | delete_collection | def delete_collection(db_name, collection_name, host='localhost', port=27017):
"""Almost exclusively for testing."""
client = MongoClient("mongodb://%s:%d" % (host, port))
client[db_name].drop_collection(collection_name) | python | def delete_collection(db_name, collection_name, host='localhost', port=27017):
"""Almost exclusively for testing."""
client = MongoClient("mongodb://%s:%d" % (host, port))
client[db_name].drop_collection(collection_name) | [
"def",
"delete_collection",
"(",
"db_name",
",",
"collection_name",
",",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"27017",
")",
":",
"client",
"=",
"MongoClient",
"(",
"\"mongodb://%s:%d\"",
"%",
"(",
"host",
",",
"port",
")",
")",
"client",
"[",
"db_... | Almost exclusively for testing. | [
"Almost",
"exclusively",
"for",
"testing",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/mongodb.py#L11-L14 |
38,308 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | _check_1st_line | def _check_1st_line(line, **kwargs):
"""First line check.
Check that the first line has a known component name followed by a colon
and then a short description of the commit.
:param line: first line
:type line: str
:param components: list of known component names
:type line: list
:para... | python | def _check_1st_line(line, **kwargs):
"""First line check.
Check that the first line has a known component name followed by a colon
and then a short description of the commit.
:param line: first line
:type line: str
:param components: list of known component names
:type line: list
:para... | [
"def",
"_check_1st_line",
"(",
"line",
",",
"*",
"*",
"kwargs",
")",
":",
"components",
"=",
"kwargs",
".",
"get",
"(",
"\"components\"",
",",
"(",
")",
")",
"max_first_line",
"=",
"kwargs",
".",
"get",
"(",
"\"max_first_line\"",
",",
"50",
")",
"errors"... | First line check.
Check that the first line has a known component name followed by a colon
and then a short description of the commit.
:param line: first line
:type line: str
:param components: list of known component names
:type line: list
:param max_first_line: maximum length of the firs... | [
"First",
"line",
"check",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L92-L126 |
38,309 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | _check_bullets | def _check_bullets(lines, **kwargs):
"""Check that the bullet point list is well formatted.
Each bullet point shall have one space before and after it. The bullet
character is the "*" and there is no space before it but one after it
meaning the next line are starting with two blanks spaces to respect t... | python | def _check_bullets(lines, **kwargs):
"""Check that the bullet point list is well formatted.
Each bullet point shall have one space before and after it. The bullet
character is the "*" and there is no space before it but one after it
meaning the next line are starting with two blanks spaces to respect t... | [
"def",
"_check_bullets",
"(",
"lines",
",",
"*",
"*",
"kwargs",
")",
":",
"max_length",
"=",
"kwargs",
".",
"get",
"(",
"\"max_length\"",
",",
"72",
")",
"labels",
"=",
"{",
"l",
"for",
"l",
",",
"_",
"in",
"kwargs",
".",
"get",
"(",
"\"commit_msg_la... | Check that the bullet point list is well formatted.
Each bullet point shall have one space before and after it. The bullet
character is the "*" and there is no space before it but one after it
meaning the next line are starting with two blanks spaces to respect the
indentation.
:param lines: all t... | [
"Check",
"that",
"the",
"bullet",
"point",
"list",
"is",
"well",
"formatted",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L129-L190 |
38,310 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | _check_signatures | def _check_signatures(lines, **kwargs):
"""Check that the signatures are valid.
There should be at least three signatures. If not, one of them should be a
trusted developer/reviewer.
Formatting supported being: [signature] full name <email@address>
:param lines: lines (lineno, content) to verify.... | python | def _check_signatures(lines, **kwargs):
"""Check that the signatures are valid.
There should be at least three signatures. If not, one of them should be a
trusted developer/reviewer.
Formatting supported being: [signature] full name <email@address>
:param lines: lines (lineno, content) to verify.... | [
"def",
"_check_signatures",
"(",
"lines",
",",
"*",
"*",
"kwargs",
")",
":",
"trusted",
"=",
"kwargs",
".",
"get",
"(",
"\"trusted\"",
",",
"(",
")",
")",
"signatures",
"=",
"tuple",
"(",
"kwargs",
".",
"get",
"(",
"\"signatures\"",
",",
"(",
")",
")... | Check that the signatures are valid.
There should be at least three signatures. If not, one of them should be a
trusted developer/reviewer.
Formatting supported being: [signature] full name <email@address>
:param lines: lines (lineno, content) to verify.
:type lines: list
:param signatures: l... | [
"Check",
"that",
"the",
"signatures",
"are",
"valid",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L193-L245 |
38,311 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | check_message | def check_message(message, **kwargs):
"""Check the message format.
Rules:
- the first line must start by a component name
- and a short description (52 chars),
- then bullet points are expected
- and finally signatures.
:param components: compontents, e.g. ``('auth', 'utils', 'misc')``
... | python | def check_message(message, **kwargs):
"""Check the message format.
Rules:
- the first line must start by a component name
- and a short description (52 chars),
- then bullet points are expected
- and finally signatures.
:param components: compontents, e.g. ``('auth', 'utils', 'misc')``
... | [
"def",
"check_message",
"(",
"message",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"pop",
"(",
"\"allow_empty\"",
",",
"False",
")",
":",
"if",
"not",
"message",
"or",
"message",
".",
"isspace",
"(",
")",
":",
"return",
"[",
"]",
"lines"... | Check the message format.
Rules:
- the first line must start by a component name
- and a short description (52 chars),
- then bullet points are expected
- and finally signatures.
:param components: compontents, e.g. ``('auth', 'utils', 'misc')``
:type components: `list`
:param signatu... | [
"Check",
"the",
"message",
"format",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L248-L291 |
38,312 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | _register_pyflakes_check | def _register_pyflakes_check():
"""Register the pyFlakes checker into PEP8 set of checks."""
from flake8_isort import Flake8Isort
from flake8_blind_except import check_blind_except
# Resolving conflicts between pep8 and pyflakes.
codes = {
"UnusedImport": "F401",
"ImportShadowedByLo... | python | def _register_pyflakes_check():
"""Register the pyFlakes checker into PEP8 set of checks."""
from flake8_isort import Flake8Isort
from flake8_blind_except import check_blind_except
# Resolving conflicts between pep8 and pyflakes.
codes = {
"UnusedImport": "F401",
"ImportShadowedByLo... | [
"def",
"_register_pyflakes_check",
"(",
")",
":",
"from",
"flake8_isort",
"import",
"Flake8Isort",
"from",
"flake8_blind_except",
"import",
"check_blind_except",
"# Resolving conflicts between pep8 and pyflakes.",
"codes",
"=",
"{",
"\"UnusedImport\"",
":",
"\"F401\"",
",",
... | Register the pyFlakes checker into PEP8 set of checks. | [
"Register",
"the",
"pyFlakes",
"checker",
"into",
"PEP8",
"set",
"of",
"checks",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L307-L338 |
38,313 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | check_pydocstyle | def check_pydocstyle(filename, **kwargs):
"""Perform static analysis on the given file docstrings.
:param filename: path of file to check.
:type filename: str
:param ignore: codes to ignore, e.g. ('D400',)
:type ignore: `list`
:param match: regex the filename has to match to be checked
:typ... | python | def check_pydocstyle(filename, **kwargs):
"""Perform static analysis on the given file docstrings.
:param filename: path of file to check.
:type filename: str
:param ignore: codes to ignore, e.g. ('D400',)
:type ignore: `list`
:param match: regex the filename has to match to be checked
:typ... | [
"def",
"check_pydocstyle",
"(",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"ignore",
"=",
"kwargs",
".",
"get",
"(",
"\"ignore\"",
")",
"match",
"=",
"kwargs",
".",
"get",
"(",
"\"match\"",
",",
"None",
")",
"match_dir",
"=",
"kwargs",
".",
"get",
... | Perform static analysis on the given file docstrings.
:param filename: path of file to check.
:type filename: str
:param ignore: codes to ignore, e.g. ('D400',)
:type ignore: `list`
:param match: regex the filename has to match to be checked
:type match: str
:param match_dir: regex everydir... | [
"Perform",
"static",
"analysis",
"on",
"the",
"given",
"file",
"docstrings",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L405-L457 |
38,314 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | check_license | def check_license(filename, **kwargs):
"""Perform a license check on the given file.
The license format should be commented using # and live at the top of the
file. Also, the year should be the current one.
:param filename: path of file to check.
:type filename: str
:param year: default curren... | python | def check_license(filename, **kwargs):
"""Perform a license check on the given file.
The license format should be commented using # and live at the top of the
file. Also, the year should be the current one.
:param filename: path of file to check.
:type filename: str
:param year: default curren... | [
"def",
"check_license",
"(",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"year",
"=",
"kwargs",
".",
"pop",
"(",
"\"year\"",
",",
"datetime",
".",
"now",
"(",
")",
".",
"year",
")",
"python_style",
"=",
"kwargs",
".",
"pop",
"(",
"\"python_style\"",... | Perform a license check on the given file.
The license format should be commented using # and live at the top of the
file. Also, the year should be the current one.
:param filename: path of file to check.
:type filename: str
:param year: default current year
:type year: int
:param ignore: ... | [
"Perform",
"a",
"license",
"check",
"on",
"the",
"given",
"file",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L460-L547 |
38,315 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | get_options | def get_options(config=None):
"""Build the options from the config object."""
if config is None:
from . import config
config.get = lambda key, default=None: getattr(config, key, default)
base = {
"components": config.get("COMPONENTS"),
"signatures": config.get("SIGNATURES"),... | python | def get_options(config=None):
"""Build the options from the config object."""
if config is None:
from . import config
config.get = lambda key, default=None: getattr(config, key, default)
base = {
"components": config.get("COMPONENTS"),
"signatures": config.get("SIGNATURES"),... | [
"def",
"get_options",
"(",
"config",
"=",
"None",
")",
":",
"if",
"config",
"is",
"None",
":",
"from",
".",
"import",
"config",
"config",
".",
"get",
"=",
"lambda",
"key",
",",
"default",
"=",
"None",
":",
"getattr",
"(",
"config",
",",
"key",
",",
... | Build the options from the config object. | [
"Build",
"the",
"options",
"from",
"the",
"config",
"object",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L640-L671 |
38,316 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | _PyFlakesChecker.run | def run(self):
"""Yield the error messages."""
for msg in self.messages:
col = getattr(msg, 'col', 0)
yield msg.lineno, col, (msg.tpl % msg.message_args), msg.__class__ | python | def run(self):
"""Yield the error messages."""
for msg in self.messages:
col = getattr(msg, 'col', 0)
yield msg.lineno, col, (msg.tpl % msg.message_args), msg.__class__ | [
"def",
"run",
"(",
"self",
")",
":",
"for",
"msg",
"in",
"self",
".",
"messages",
":",
"col",
"=",
"getattr",
"(",
"msg",
",",
"'col'",
",",
"0",
")",
"yield",
"msg",
".",
"lineno",
",",
"col",
",",
"(",
"msg",
".",
"tpl",
"%",
"msg",
".",
"m... | Yield the error messages. | [
"Yield",
"the",
"error",
"messages",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L300-L304 |
38,317 | inveniosoftware/kwalitee | kwalitee/kwalitee.py | _Report.error | def error(self, line_number, offset, text, check):
"""Run the checks and collect the errors."""
code = super(_Report, self).error(line_number, offset, text, check)
if code:
self.errors.append((line_number, offset + 1, code, text, check)) | python | def error(self, line_number, offset, text, check):
"""Run the checks and collect the errors."""
code = super(_Report, self).error(line_number, offset, text, check)
if code:
self.errors.append((line_number, offset + 1, code, text, check)) | [
"def",
"error",
"(",
"self",
",",
"line_number",
",",
"offset",
",",
"text",
",",
"check",
")",
":",
"code",
"=",
"super",
"(",
"_Report",
",",
"self",
")",
".",
"error",
"(",
"line_number",
",",
"offset",
",",
"text",
",",
"check",
")",
"if",
"cod... | Run the checks and collect the errors. | [
"Run",
"the",
"checks",
"and",
"collect",
"the",
"errors",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/kwalitee.py#L353-L357 |
38,318 | toumorokoshi/sprinter | sprinter/lib/__init__.py | prompt | def prompt(prompt_string, default=None, secret=False, boolean=False, bool_type=None):
"""
Prompt user for a string, with a default value
* secret converts to password prompt
* boolean converts return value to boolean, checking for starting with a Y
"""
if boolean or bool_type in BOOLEAN_DEFAULT... | python | def prompt(prompt_string, default=None, secret=False, boolean=False, bool_type=None):
"""
Prompt user for a string, with a default value
* secret converts to password prompt
* boolean converts return value to boolean, checking for starting with a Y
"""
if boolean or bool_type in BOOLEAN_DEFAULT... | [
"def",
"prompt",
"(",
"prompt_string",
",",
"default",
"=",
"None",
",",
"secret",
"=",
"False",
",",
"boolean",
"=",
"False",
",",
"bool_type",
"=",
"None",
")",
":",
"if",
"boolean",
"or",
"bool_type",
"in",
"BOOLEAN_DEFAULTS",
":",
"if",
"bool_type",
... | Prompt user for a string, with a default value
* secret converts to password prompt
* boolean converts return value to boolean, checking for starting with a Y | [
"Prompt",
"user",
"for",
"a",
"string",
"with",
"a",
"default",
"value"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/__init__.py#L32-L53 |
38,319 | BreakingBytes/UncertaintyWrapper | uncertainty_wrapper/core.py | jflatten | def jflatten(j):
"""
Flatten 3_D Jacobian into 2-D.
"""
nobs, nf, nargs = j.shape
nrows, ncols = nf * nobs, nargs * nobs
jflat = np.zeros((nrows, ncols))
for n in xrange(nobs):
r, c = n * nf, n * nargs
jflat[r:(r + nf), c:(c + nargs)] = j[n]
return jflat | python | def jflatten(j):
"""
Flatten 3_D Jacobian into 2-D.
"""
nobs, nf, nargs = j.shape
nrows, ncols = nf * nobs, nargs * nobs
jflat = np.zeros((nrows, ncols))
for n in xrange(nobs):
r, c = n * nf, n * nargs
jflat[r:(r + nf), c:(c + nargs)] = j[n]
return jflat | [
"def",
"jflatten",
"(",
"j",
")",
":",
"nobs",
",",
"nf",
",",
"nargs",
"=",
"j",
".",
"shape",
"nrows",
",",
"ncols",
"=",
"nf",
"*",
"nobs",
",",
"nargs",
"*",
"nobs",
"jflat",
"=",
"np",
".",
"zeros",
"(",
"(",
"nrows",
",",
"ncols",
")",
... | Flatten 3_D Jacobian into 2-D. | [
"Flatten",
"3_D",
"Jacobian",
"into",
"2",
"-",
"D",
"."
] | b2431588fb6c1cf6f2a54e2afc9bfa8e10067bd0 | https://github.com/BreakingBytes/UncertaintyWrapper/blob/b2431588fb6c1cf6f2a54e2afc9bfa8e10067bd0/uncertainty_wrapper/core.py#L104-L114 |
38,320 | BreakingBytes/UncertaintyWrapper | uncertainty_wrapper/core.py | jtosparse | def jtosparse(j):
"""
Generate sparse matrix coordinates from 3-D Jacobian.
"""
data = j.flatten().tolist()
nobs, nf, nargs = j.shape
indices = zip(*[(r, c) for n in xrange(nobs)
for r in xrange(n * nf, (n + 1) * nf)
for c in xrange(n * nargs, (n +... | python | def jtosparse(j):
"""
Generate sparse matrix coordinates from 3-D Jacobian.
"""
data = j.flatten().tolist()
nobs, nf, nargs = j.shape
indices = zip(*[(r, c) for n in xrange(nobs)
for r in xrange(n * nf, (n + 1) * nf)
for c in xrange(n * nargs, (n +... | [
"def",
"jtosparse",
"(",
"j",
")",
":",
"data",
"=",
"j",
".",
"flatten",
"(",
")",
".",
"tolist",
"(",
")",
"nobs",
",",
"nf",
",",
"nargs",
"=",
"j",
".",
"shape",
"indices",
"=",
"zip",
"(",
"*",
"[",
"(",
"r",
",",
"c",
")",
"for",
"n",... | Generate sparse matrix coordinates from 3-D Jacobian. | [
"Generate",
"sparse",
"matrix",
"coordinates",
"from",
"3",
"-",
"D",
"Jacobian",
"."
] | b2431588fb6c1cf6f2a54e2afc9bfa8e10067bd0 | https://github.com/BreakingBytes/UncertaintyWrapper/blob/b2431588fb6c1cf6f2a54e2afc9bfa8e10067bd0/uncertainty_wrapper/core.py#L117-L126 |
38,321 | KvasirSecurity/kvasirapi-python | KvasirAPI/jsonrpc/accounts.py | Accounts.upload_file | def upload_file(self, service_rec=None, host_service=None, filename=None,
pw_data=None, f_type=None, add_to_evidence=True):
"""
Upload a password file
:param service_rec: db.t_services.id
:param host_service: db.t_hosts.id
:param filename: Filename
:p... | python | def upload_file(self, service_rec=None, host_service=None, filename=None,
pw_data=None, f_type=None, add_to_evidence=True):
"""
Upload a password file
:param service_rec: db.t_services.id
:param host_service: db.t_hosts.id
:param filename: Filename
:p... | [
"def",
"upload_file",
"(",
"self",
",",
"service_rec",
"=",
"None",
",",
"host_service",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"pw_data",
"=",
"None",
",",
"f_type",
"=",
"None",
",",
"add_to_evidence",
"=",
"True",
")",
":",
"return",
"self",
... | Upload a password file
:param service_rec: db.t_services.id
:param host_service: db.t_hosts.id
:param filename: Filename
:param pw_data: Content of file
:param f_type: Type of file
:param add_to_evidence: True/False to add to t_evidence
:return: (True/False, Resp... | [
"Upload",
"a",
"password",
"file"
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/jsonrpc/accounts.py#L86-L99 |
38,322 | gtaylor/EVE-Market-Data-Structures | emds/formats/unified/unified_utils.py | parse_datetime | def parse_datetime(time_str):
"""
Wraps dateutil's parser function to set an explicit UTC timezone, and
to make sure microseconds are 0. Unified Uploader format and EMK format
bother don't use microseconds at all.
:param str time_str: The date/time str to parse.
:rtype: datetime.datetime
:r... | python | def parse_datetime(time_str):
"""
Wraps dateutil's parser function to set an explicit UTC timezone, and
to make sure microseconds are 0. Unified Uploader format and EMK format
bother don't use microseconds at all.
:param str time_str: The date/time str to parse.
:rtype: datetime.datetime
:r... | [
"def",
"parse_datetime",
"(",
"time_str",
")",
":",
"try",
":",
"return",
"dateutil",
".",
"parser",
".",
"parse",
"(",
"time_str",
")",
".",
"replace",
"(",
"microsecond",
"=",
"0",
")",
".",
"astimezone",
"(",
"UTC_TZINFO",
")",
"except",
"ValueError",
... | Wraps dateutil's parser function to set an explicit UTC timezone, and
to make sure microseconds are 0. Unified Uploader format and EMK format
bother don't use microseconds at all.
:param str time_str: The date/time str to parse.
:rtype: datetime.datetime
:returns: A parsed, UTC datetime. | [
"Wraps",
"dateutil",
"s",
"parser",
"function",
"to",
"set",
"an",
"explicit",
"UTC",
"timezone",
"and",
"to",
"make",
"sure",
"microseconds",
"are",
"0",
".",
"Unified",
"Uploader",
"format",
"and",
"EMK",
"format",
"bother",
"don",
"t",
"use",
"microsecond... | 77d69b24f2aada3aeff8fba3d75891bfba8fdcf3 | https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/formats/unified/unified_utils.py#L46-L62 |
38,323 | klahnakoski/mo-files | mo_files/__init__.py | File.backup_name | def backup_name(self, timestamp=None):
"""
RETURN A FILENAME THAT CAN SERVE AS A BACKUP FOR THIS FILE
"""
suffix = datetime2string(coalesce(timestamp, datetime.now()), "%Y%m%d_%H%M%S")
return File.add_suffix(self._filename, suffix) | python | def backup_name(self, timestamp=None):
"""
RETURN A FILENAME THAT CAN SERVE AS A BACKUP FOR THIS FILE
"""
suffix = datetime2string(coalesce(timestamp, datetime.now()), "%Y%m%d_%H%M%S")
return File.add_suffix(self._filename, suffix) | [
"def",
"backup_name",
"(",
"self",
",",
"timestamp",
"=",
"None",
")",
":",
"suffix",
"=",
"datetime2string",
"(",
"coalesce",
"(",
"timestamp",
",",
"datetime",
".",
"now",
"(",
")",
")",
",",
"\"%Y%m%d_%H%M%S\"",
")",
"return",
"File",
".",
"add_suffix",... | RETURN A FILENAME THAT CAN SERVE AS A BACKUP FOR THIS FILE | [
"RETURN",
"A",
"FILENAME",
"THAT",
"CAN",
"SERVE",
"AS",
"A",
"BACKUP",
"FOR",
"THIS",
"FILE"
] | f6974a997cdc9fdabccb60c19edee13356a5787a | https://github.com/klahnakoski/mo-files/blob/f6974a997cdc9fdabccb60c19edee13356a5787a/mo_files/__init__.py#L204-L209 |
38,324 | klahnakoski/mo-files | mo_files/__init__.py | File.append | def append(self, content, encoding='utf8'):
"""
add a line to file
"""
if not self.parent.exists:
self.parent.create()
with open(self._filename, "ab") as output_file:
if not is_text(content):
Log.error(u"expecting to write unicode only")
... | python | def append(self, content, encoding='utf8'):
"""
add a line to file
"""
if not self.parent.exists:
self.parent.create()
with open(self._filename, "ab") as output_file:
if not is_text(content):
Log.error(u"expecting to write unicode only")
... | [
"def",
"append",
"(",
"self",
",",
"content",
",",
"encoding",
"=",
"'utf8'",
")",
":",
"if",
"not",
"self",
".",
"parent",
".",
"exists",
":",
"self",
".",
"parent",
".",
"create",
"(",
")",
"with",
"open",
"(",
"self",
".",
"_filename",
",",
"\"a... | add a line to file | [
"add",
"a",
"line",
"to",
"file"
] | f6974a997cdc9fdabccb60c19edee13356a5787a | https://github.com/klahnakoski/mo-files/blob/f6974a997cdc9fdabccb60c19edee13356a5787a/mo_files/__init__.py#L314-L324 |
38,325 | klahnakoski/mo-files | mo_files/url.py | url_param2value | def url_param2value(param):
"""
CONVERT URL QUERY PARAMETERS INTO DICT
"""
if param == None:
return Null
if param == None:
return Null
def _decode(v):
output = []
i = 0
while i < len(v):
c = v[i]
if c == "%":
d = he... | python | def url_param2value(param):
"""
CONVERT URL QUERY PARAMETERS INTO DICT
"""
if param == None:
return Null
if param == None:
return Null
def _decode(v):
output = []
i = 0
while i < len(v):
c = v[i]
if c == "%":
d = he... | [
"def",
"url_param2value",
"(",
"param",
")",
":",
"if",
"param",
"==",
"None",
":",
"return",
"Null",
"if",
"param",
"==",
"None",
":",
"return",
"Null",
"def",
"_decode",
"(",
"v",
")",
":",
"output",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"i",
... | CONVERT URL QUERY PARAMETERS INTO DICT | [
"CONVERT",
"URL",
"QUERY",
"PARAMETERS",
"INTO",
"DICT"
] | f6974a997cdc9fdabccb60c19edee13356a5787a | https://github.com/klahnakoski/mo-files/blob/f6974a997cdc9fdabccb60c19edee13356a5787a/mo_files/url.py#L144-L192 |
38,326 | kevinconway/confpy | confpy/parser.py | configfile_from_path | def configfile_from_path(path, strict=True):
"""Get a ConfigFile object based on a file path.
This method will inspect the file extension and return the appropriate
ConfigFile subclass initialized with the given path.
Args:
path (str): The file path which represents the configuration file.
... | python | def configfile_from_path(path, strict=True):
"""Get a ConfigFile object based on a file path.
This method will inspect the file extension and return the appropriate
ConfigFile subclass initialized with the given path.
Args:
path (str): The file path which represents the configuration file.
... | [
"def",
"configfile_from_path",
"(",
"path",
",",
"strict",
"=",
"True",
")",
":",
"extension",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
"[",
"-",
"1",
"]",
"conf_type",
"=",
"FILE_TYPES",
".",
"get",
"(",
"extension",
")",
"if",
"not",
"conf_type",
... | Get a ConfigFile object based on a file path.
This method will inspect the file extension and return the appropriate
ConfigFile subclass initialized with the given path.
Args:
path (str): The file path which represents the configuration file.
strict (bool): Whether or not to parse the file... | [
"Get",
"a",
"ConfigFile",
"object",
"based",
"on",
"a",
"file",
"path",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L25-L53 |
38,327 | kevinconway/confpy | confpy/parser.py | configuration_from_paths | def configuration_from_paths(paths, strict=True):
"""Get a Configuration object based on multiple file paths.
Args:
paths (iter of str): An iterable of file paths which identify config
files on the system.
strict (bool): Whether or not to parse the files in strict mode.
Returns... | python | def configuration_from_paths(paths, strict=True):
"""Get a Configuration object based on multiple file paths.
Args:
paths (iter of str): An iterable of file paths which identify config
files on the system.
strict (bool): Whether or not to parse the files in strict mode.
Returns... | [
"def",
"configuration_from_paths",
"(",
"paths",
",",
"strict",
"=",
"True",
")",
":",
"for",
"path",
"in",
"paths",
":",
"cfg",
"=",
"configfile_from_path",
"(",
"path",
",",
"strict",
"=",
"strict",
")",
".",
"config",
"return",
"cfg"
] | Get a Configuration object based on multiple file paths.
Args:
paths (iter of str): An iterable of file paths which identify config
files on the system.
strict (bool): Whether or not to parse the files in strict mode.
Returns:
confpy.core.config.Configuration: The loaded co... | [
"Get",
"a",
"Configuration",
"object",
"based",
"on",
"multiple",
"file",
"paths",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L56-L78 |
38,328 | kevinconway/confpy | confpy/parser.py | set_environment_var_options | def set_environment_var_options(config, env=None, prefix='CONFPY'):
"""Set any configuration options which have an environment var set.
Args:
config (confpy.core.config.Configuration): A configuration object which
has been initialized with options.
env (dict): Optional dictionary wh... | python | def set_environment_var_options(config, env=None, prefix='CONFPY'):
"""Set any configuration options which have an environment var set.
Args:
config (confpy.core.config.Configuration): A configuration object which
has been initialized with options.
env (dict): Optional dictionary wh... | [
"def",
"set_environment_var_options",
"(",
"config",
",",
"env",
"=",
"None",
",",
"prefix",
"=",
"'CONFPY'",
")",
":",
"env",
"=",
"env",
"or",
"os",
".",
"environ",
"for",
"section_name",
",",
"section",
"in",
"config",
":",
"for",
"option_name",
",",
... | Set any configuration options which have an environment var set.
Args:
config (confpy.core.config.Configuration): A configuration object which
has been initialized with options.
env (dict): Optional dictionary which contains environment variables.
The default is os.environ i... | [
"Set",
"any",
"configuration",
"options",
"which",
"have",
"an",
"environment",
"var",
"set",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L81-L117 |
38,329 | kevinconway/confpy | confpy/parser.py | set_cli_options | def set_cli_options(config, arguments=None):
"""Set any configuration options which have a CLI value set.
Args:
config (confpy.core.config.Configuration): A configuration object which
has been initialized with options.
arguments (iter of str): An iterable of strings which contains t... | python | def set_cli_options(config, arguments=None):
"""Set any configuration options which have a CLI value set.
Args:
config (confpy.core.config.Configuration): A configuration object which
has been initialized with options.
arguments (iter of str): An iterable of strings which contains t... | [
"def",
"set_cli_options",
"(",
"config",
",",
"arguments",
"=",
"None",
")",
":",
"arguments",
"=",
"arguments",
"or",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"for",
"section_name",
",",
"sectio... | Set any configuration options which have a CLI value set.
Args:
config (confpy.core.config.Configuration): A configuration object which
has been initialized with options.
arguments (iter of str): An iterable of strings which contains the CLI
arguments passed. If nothing is g... | [
"Set",
"any",
"configuration",
"options",
"which",
"have",
"a",
"CLI",
"value",
"set",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L120-L166 |
38,330 | kevinconway/confpy | confpy/parser.py | check_for_missing_options | def check_for_missing_options(config):
"""Iter over a config and raise if a required option is still not set.
Args:
config (confpy.core.config.Configuration): The configuration object
to validate.
Raises:
MissingRequiredOption: If any required options are not set in the
... | python | def check_for_missing_options(config):
"""Iter over a config and raise if a required option is still not set.
Args:
config (confpy.core.config.Configuration): The configuration object
to validate.
Raises:
MissingRequiredOption: If any required options are not set in the
... | [
"def",
"check_for_missing_options",
"(",
"config",
")",
":",
"for",
"section_name",
",",
"section",
"in",
"config",
":",
"for",
"option_name",
",",
"option",
"in",
"section",
":",
"if",
"option",
".",
"required",
"and",
"option",
".",
"value",
"is",
"None",
... | Iter over a config and raise if a required option is still not set.
Args:
config (confpy.core.config.Configuration): The configuration object
to validate.
Raises:
MissingRequiredOption: If any required options are not set in the
configuration object.
Required optio... | [
"Iter",
"over",
"a",
"config",
"and",
"raise",
"if",
"a",
"required",
"option",
"is",
"still",
"not",
"set",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L169-L196 |
38,331 | kevinconway/confpy | confpy/parser.py | parse_options | def parse_options(files, env_prefix='CONFPY', strict=True):
"""Parse configuration options and return a configuration object.
Args:
files (iter of str): File paths which identify configuration files.
These files are processed in order with values in later files
overwriting value... | python | def parse_options(files, env_prefix='CONFPY', strict=True):
"""Parse configuration options and return a configuration object.
Args:
files (iter of str): File paths which identify configuration files.
These files are processed in order with values in later files
overwriting value... | [
"def",
"parse_options",
"(",
"files",
",",
"env_prefix",
"=",
"'CONFPY'",
",",
"strict",
"=",
"True",
")",
":",
"return",
"check_for_missing_options",
"(",
"config",
"=",
"set_cli_options",
"(",
"config",
"=",
"set_environment_var_options",
"(",
"config",
"=",
"... | Parse configuration options and return a configuration object.
Args:
files (iter of str): File paths which identify configuration files.
These files are processed in order with values in later files
overwriting values in earlier files.
env_prefix (str): The static prefix pre... | [
"Parse",
"configuration",
"options",
"and",
"return",
"a",
"configuration",
"object",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L199-L231 |
38,332 | pauleveritt/kaybee | kaybee/plugins/widgets/base_widget.py | BaseWidget.render | def render(self, sphinx_app: Sphinx, context):
""" Given a Sphinx builder and context with sphinx_app in it,
generate HTML """
# Called from kaybee.plugins.widgets.handlers.render_widgets
builder: StandaloneHTMLBuilder = sphinx_app.builder
resource = sphinx_app.env.resources[s... | python | def render(self, sphinx_app: Sphinx, context):
""" Given a Sphinx builder and context with sphinx_app in it,
generate HTML """
# Called from kaybee.plugins.widgets.handlers.render_widgets
builder: StandaloneHTMLBuilder = sphinx_app.builder
resource = sphinx_app.env.resources[s... | [
"def",
"render",
"(",
"self",
",",
"sphinx_app",
":",
"Sphinx",
",",
"context",
")",
":",
"# Called from kaybee.plugins.widgets.handlers.render_widgets",
"builder",
":",
"StandaloneHTMLBuilder",
"=",
"sphinx_app",
".",
"builder",
"resource",
"=",
"sphinx_app",
".",
"e... | Given a Sphinx builder and context with sphinx_app in it,
generate HTML | [
"Given",
"a",
"Sphinx",
"builder",
"and",
"context",
"with",
"sphinx_app",
"in",
"it",
"generate",
"HTML"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/widgets/base_widget.py#L70-L89 |
38,333 | botstory/botstory | botstory/di/desciption.py | desc | def desc(t=None, reg=True):
"""
Describe Class Dependency
:param reg: should we register this class as well
:param t: custom type as well
:return:
"""
def decorated_fn(cls):
if not inspect.isclass(cls):
return NotImplemented('For now we can only describe classes')
... | python | def desc(t=None, reg=True):
"""
Describe Class Dependency
:param reg: should we register this class as well
:param t: custom type as well
:return:
"""
def decorated_fn(cls):
if not inspect.isclass(cls):
return NotImplemented('For now we can only describe classes')
... | [
"def",
"desc",
"(",
"t",
"=",
"None",
",",
"reg",
"=",
"True",
")",
":",
"def",
"decorated_fn",
"(",
"cls",
")",
":",
"if",
"not",
"inspect",
".",
"isclass",
"(",
"cls",
")",
":",
"return",
"NotImplemented",
"(",
"'For now we can only describe classes'",
... | Describe Class Dependency
:param reg: should we register this class as well
:param t: custom type as well
:return: | [
"Describe",
"Class",
"Dependency"
] | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/di/desciption.py#L6-L25 |
38,334 | bitesofcode/projex | projex/enum.py | enum.label | def label(self, value):
"""
Returns a pretty text version of the key for the inputted value.
:param value | <variant>
:return <str>
"""
return self._labels.get(value) or text.pretty(self(value)) | python | def label(self, value):
"""
Returns a pretty text version of the key for the inputted value.
:param value | <variant>
:return <str>
"""
return self._labels.get(value) or text.pretty(self(value)) | [
"def",
"label",
"(",
"self",
",",
"value",
")",
":",
"return",
"self",
".",
"_labels",
".",
"get",
"(",
"value",
")",
"or",
"text",
".",
"pretty",
"(",
"self",
"(",
"value",
")",
")"
] | Returns a pretty text version of the key for the inputted value.
:param value | <variant>
:return <str> | [
"Returns",
"a",
"pretty",
"text",
"version",
"of",
"the",
"key",
"for",
"the",
"inputted",
"value",
"."
] | d31743ec456a41428709968ab11a2cf6c6c76247 | https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/enum.py#L202-L210 |
38,335 | bitesofcode/projex | projex/enum.py | enum.setLabel | def setLabel(self, value, label):
"""
Sets the label text for the inputted value. This will override the default pretty
text label that is used for the key.
:param value | <variant>
label | <str>
"""
if label:
self._labels[value] = l... | python | def setLabel(self, value, label):
"""
Sets the label text for the inputted value. This will override the default pretty
text label that is used for the key.
:param value | <variant>
label | <str>
"""
if label:
self._labels[value] = l... | [
"def",
"setLabel",
"(",
"self",
",",
"value",
",",
"label",
")",
":",
"if",
"label",
":",
"self",
".",
"_labels",
"[",
"value",
"]",
"=",
"label",
"else",
":",
"self",
".",
"_labels",
".",
"pop",
"(",
"value",
",",
"None",
")"
] | Sets the label text for the inputted value. This will override the default pretty
text label that is used for the key.
:param value | <variant>
label | <str> | [
"Sets",
"the",
"label",
"text",
"for",
"the",
"inputted",
"value",
".",
"This",
"will",
"override",
"the",
"default",
"pretty",
"text",
"label",
"that",
"is",
"used",
"for",
"the",
"key",
"."
] | d31743ec456a41428709968ab11a2cf6c6c76247 | https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/enum.py#L221-L232 |
38,336 | bitesofcode/projex | projex/enum.py | enum.valueByLabel | def valueByLabel(self, label):
"""
Determine a given value based on the inputted label.
:param label <str>
:return <int>
"""
keys = self.keys()
labels = [text.pretty(key) for key in keys]
if label in labels:
return self[key... | python | def valueByLabel(self, label):
"""
Determine a given value based on the inputted label.
:param label <str>
:return <int>
"""
keys = self.keys()
labels = [text.pretty(key) for key in keys]
if label in labels:
return self[key... | [
"def",
"valueByLabel",
"(",
"self",
",",
"label",
")",
":",
"keys",
"=",
"self",
".",
"keys",
"(",
")",
"labels",
"=",
"[",
"text",
".",
"pretty",
"(",
"key",
")",
"for",
"key",
"in",
"keys",
"]",
"if",
"label",
"in",
"labels",
":",
"return",
"se... | Determine a given value based on the inputted label.
:param label <str>
:return <int> | [
"Determine",
"a",
"given",
"value",
"based",
"on",
"the",
"inputted",
"label",
"."
] | d31743ec456a41428709968ab11a2cf6c6c76247 | https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/enum.py#L255-L267 |
38,337 | invinst/ResponseBot | responsebot/utils/config_utils.py | ResponseBotConfig.load_config_file | def load_config_file(self):
"""Parse configuration file and get config values."""
config_parser = SafeConfigParser()
config_parser.read(self.CONFIG_FILE)
if config_parser.has_section('handlers'):
self._config['handlers_package'] = config_parser.get('handlers', 'package')
... | python | def load_config_file(self):
"""Parse configuration file and get config values."""
config_parser = SafeConfigParser()
config_parser.read(self.CONFIG_FILE)
if config_parser.has_section('handlers'):
self._config['handlers_package'] = config_parser.get('handlers', 'package')
... | [
"def",
"load_config_file",
"(",
"self",
")",
":",
"config_parser",
"=",
"SafeConfigParser",
"(",
")",
"config_parser",
".",
"read",
"(",
"self",
".",
"CONFIG_FILE",
")",
"if",
"config_parser",
".",
"has_section",
"(",
"'handlers'",
")",
":",
"self",
".",
"_c... | Parse configuration file and get config values. | [
"Parse",
"configuration",
"file",
"and",
"get",
"config",
"values",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/utils/config_utils.py#L29-L53 |
38,338 | invinst/ResponseBot | responsebot/utils/config_utils.py | ResponseBotConfig.load_config_from_cli_arguments | def load_config_from_cli_arguments(self, *args, **kwargs):
"""
Get config values of passed in CLI options.
:param dict kwargs: CLI options
"""
self._load_config_from_cli_argument(key='handlers_package', **kwargs)
self._load_config_from_cli_argument(key='auth', **kwargs)
... | python | def load_config_from_cli_arguments(self, *args, **kwargs):
"""
Get config values of passed in CLI options.
:param dict kwargs: CLI options
"""
self._load_config_from_cli_argument(key='handlers_package', **kwargs)
self._load_config_from_cli_argument(key='auth', **kwargs)
... | [
"def",
"load_config_from_cli_arguments",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_load_config_from_cli_argument",
"(",
"key",
"=",
"'handlers_package'",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_load_config_from_cli_arg... | Get config values of passed in CLI options.
:param dict kwargs: CLI options | [
"Get",
"config",
"values",
"of",
"passed",
"in",
"CLI",
"options",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/utils/config_utils.py#L55-L65 |
38,339 | rogerhil/thegamesdb | thegamesdb/base.py | Resource.get | def get(self, id):
""" Gets the dict data and builds the item object.
"""
data = self.db.get_data(self.get_path, id=id)
return self._build_item(**data['Data'][self.name]) | python | def get(self, id):
""" Gets the dict data and builds the item object.
"""
data = self.db.get_data(self.get_path, id=id)
return self._build_item(**data['Data'][self.name]) | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"data",
"=",
"self",
".",
"db",
".",
"get_data",
"(",
"self",
".",
"get_path",
",",
"id",
"=",
"id",
")",
"return",
"self",
".",
"_build_item",
"(",
"*",
"*",
"data",
"[",
"'Data'",
"]",
"[",
"sel... | Gets the dict data and builds the item object. | [
"Gets",
"the",
"dict",
"data",
"and",
"builds",
"the",
"item",
"object",
"."
] | 795314215f9ee73697c7520dea4ddecfb23ca8e6 | https://github.com/rogerhil/thegamesdb/blob/795314215f9ee73697c7520dea4ddecfb23ca8e6/thegamesdb/base.py#L66-L70 |
38,340 | leodesouza/pyenty | pyenty/entitymanager.py | EntityManager.save | def save(self, entity):
"""Maps entity to dict and returns future"""
assert isinstance(entity, Entity), " entity must have an instance of Entity"
return self.__collection.save(entity.as_dict()) | python | def save(self, entity):
"""Maps entity to dict and returns future"""
assert isinstance(entity, Entity), " entity must have an instance of Entity"
return self.__collection.save(entity.as_dict()) | [
"def",
"save",
"(",
"self",
",",
"entity",
")",
":",
"assert",
"isinstance",
"(",
"entity",
",",
"Entity",
")",
",",
"\" entity must have an instance of Entity\"",
"return",
"self",
".",
"__collection",
".",
"save",
"(",
"entity",
".",
"as_dict",
"(",
")",
"... | Maps entity to dict and returns future | [
"Maps",
"entity",
"to",
"dict",
"and",
"returns",
"future"
] | 20d2834eada4b971208e816b387479c4fb6ffe61 | https://github.com/leodesouza/pyenty/blob/20d2834eada4b971208e816b387479c4fb6ffe61/pyenty/entitymanager.py#L65-L68 |
38,341 | leodesouza/pyenty | pyenty/entitymanager.py | EntityManager.find_one | def find_one(self, **kwargs):
"""Returns future.
Executes collection's find_one method based on keyword args
maps result ( dict to instance ) and return future
Example::
manager = EntityManager(Product)
product_saved = yield manager.find_one(_id=object_id)
... | python | def find_one(self, **kwargs):
"""Returns future.
Executes collection's find_one method based on keyword args
maps result ( dict to instance ) and return future
Example::
manager = EntityManager(Product)
product_saved = yield manager.find_one(_id=object_id)
... | [
"def",
"find_one",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"future",
"=",
"TracebackFuture",
"(",
")",
"def",
"handle_response",
"(",
"result",
",",
"error",
")",
":",
"if",
"error",
":",
"future",
".",
"set_exception",
"(",
"error",
")",
"else... | Returns future.
Executes collection's find_one method based on keyword args
maps result ( dict to instance ) and return future
Example::
manager = EntityManager(Product)
product_saved = yield manager.find_one(_id=object_id) | [
"Returns",
"future",
"."
] | 20d2834eada4b971208e816b387479c4fb6ffe61 | https://github.com/leodesouza/pyenty/blob/20d2834eada4b971208e816b387479c4fb6ffe61/pyenty/entitymanager.py#L83-L107 |
38,342 | leodesouza/pyenty | pyenty/entitymanager.py | EntityManager.update | def update(self, entity):
""" Executes collection's update method based on keyword args.
Example::
manager = EntityManager(Product)
p = Product()
p.name = 'new name'
p.description = 'new description'
p.price = 300.0
yield manager... | python | def update(self, entity):
""" Executes collection's update method based on keyword args.
Example::
manager = EntityManager(Product)
p = Product()
p.name = 'new name'
p.description = 'new description'
p.price = 300.0
yield manager... | [
"def",
"update",
"(",
"self",
",",
"entity",
")",
":",
"assert",
"isinstance",
"(",
"entity",
",",
"Entity",
")",
",",
"\"Error: entity must have an instance of Entity\"",
"return",
"self",
".",
"__collection",
".",
"update",
"(",
"{",
"'_id'",
":",
"entity",
... | Executes collection's update method based on keyword args.
Example::
manager = EntityManager(Product)
p = Product()
p.name = 'new name'
p.description = 'new description'
p.price = 300.0
yield manager.update(p) | [
"Executes",
"collection",
"s",
"update",
"method",
"based",
"on",
"keyword",
"args",
"."
] | 20d2834eada4b971208e816b387479c4fb6ffe61 | https://github.com/leodesouza/pyenty/blob/20d2834eada4b971208e816b387479c4fb6ffe61/pyenty/entitymanager.py#L135-L150 |
38,343 | EricDalrymple91/strawpy | strawpy/asyncstrawpy.py | StrawPoll.open | def open(self, results=False):
""" Open the strawpoll in a browser. Can specify to open the main or results page.
:param results: True/False
"""
webbrowser.open(self.results_url if results else self.url) | python | def open(self, results=False):
""" Open the strawpoll in a browser. Can specify to open the main or results page.
:param results: True/False
"""
webbrowser.open(self.results_url if results else self.url) | [
"def",
"open",
"(",
"self",
",",
"results",
"=",
"False",
")",
":",
"webbrowser",
".",
"open",
"(",
"self",
".",
"results_url",
"if",
"results",
"else",
"self",
".",
"url",
")"
] | Open the strawpoll in a browser. Can specify to open the main or results page.
:param results: True/False | [
"Open",
"the",
"strawpoll",
"in",
"a",
"browser",
".",
"Can",
"specify",
"to",
"open",
"the",
"main",
"or",
"results",
"page",
"."
] | 0c4294fc2dca250a5c13a97e825ae21587278a91 | https://github.com/EricDalrymple91/strawpy/blob/0c4294fc2dca250a5c13a97e825ae21587278a91/strawpy/asyncstrawpy.py#L156-L162 |
38,344 | GeorgeArgyros/symautomata | symautomata/brzozowski.py | main | def main():
"""
Testing function for DFA brzozowski algebraic method Operation
"""
argv = sys.argv
if len(argv) < 2:
targetfile = 'target.y'
else:
targetfile = argv[1]
print 'Parsing ruleset: ' + targetfile,
flex_a = Flexparser()
mma = flex_a.yyparse(targetfile)
p... | python | def main():
"""
Testing function for DFA brzozowski algebraic method Operation
"""
argv = sys.argv
if len(argv) < 2:
targetfile = 'target.y'
else:
targetfile = argv[1]
print 'Parsing ruleset: ' + targetfile,
flex_a = Flexparser()
mma = flex_a.yyparse(targetfile)
p... | [
"def",
"main",
"(",
")",
":",
"argv",
"=",
"sys",
".",
"argv",
"if",
"len",
"(",
"argv",
")",
"<",
"2",
":",
"targetfile",
"=",
"'target.y'",
"else",
":",
"targetfile",
"=",
"argv",
"[",
"1",
"]",
"print",
"'Parsing ruleset: '",
"+",
"targetfile",
",... | Testing function for DFA brzozowski algebraic method Operation | [
"Testing",
"function",
"for",
"DFA",
"brzozowski",
"algebraic",
"method",
"Operation"
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/brzozowski.py#L199-L218 |
38,345 | jasedit/pymmd | pymmd/mmd.py | load_mmd | def load_mmd():
"""Loads libMultiMarkdown for usage"""
global _MMD_LIB
global _LIB_LOCATION
try:
lib_file = 'libMultiMarkdown' + SHLIB_EXT[platform.system()]
_LIB_LOCATION = os.path.abspath(os.path.join(DEFAULT_LIBRARY_DIR, lib_file))
if not os.path.isfile(_LIB_LOCATION):
... | python | def load_mmd():
"""Loads libMultiMarkdown for usage"""
global _MMD_LIB
global _LIB_LOCATION
try:
lib_file = 'libMultiMarkdown' + SHLIB_EXT[platform.system()]
_LIB_LOCATION = os.path.abspath(os.path.join(DEFAULT_LIBRARY_DIR, lib_file))
if not os.path.isfile(_LIB_LOCATION):
... | [
"def",
"load_mmd",
"(",
")",
":",
"global",
"_MMD_LIB",
"global",
"_LIB_LOCATION",
"try",
":",
"lib_file",
"=",
"'libMultiMarkdown'",
"+",
"SHLIB_EXT",
"[",
"platform",
".",
"system",
"(",
")",
"]",
"_LIB_LOCATION",
"=",
"os",
".",
"path",
".",
"abspath",
... | Loads libMultiMarkdown for usage | [
"Loads",
"libMultiMarkdown",
"for",
"usage"
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L15-L28 |
38,346 | jasedit/pymmd | pymmd/mmd.py | _expand_source | def _expand_source(source, dname, fmt):
"""Expands source text to include headers, footers, and expands Multimarkdown transclusion
directives.
Keyword arguments:
source -- string containing the Multimarkdown text to expand
dname -- directory name to use as the base directory for transclusion refere... | python | def _expand_source(source, dname, fmt):
"""Expands source text to include headers, footers, and expands Multimarkdown transclusion
directives.
Keyword arguments:
source -- string containing the Multimarkdown text to expand
dname -- directory name to use as the base directory for transclusion refere... | [
"def",
"_expand_source",
"(",
"source",
",",
"dname",
",",
"fmt",
")",
":",
"_MMD_LIB",
".",
"g_string_new",
".",
"restype",
"=",
"ctypes",
".",
"POINTER",
"(",
"GString",
")",
"_MMD_LIB",
".",
"g_string_new",
".",
"argtypes",
"=",
"[",
"ctypes",
".",
"c... | Expands source text to include headers, footers, and expands Multimarkdown transclusion
directives.
Keyword arguments:
source -- string containing the Multimarkdown text to expand
dname -- directory name to use as the base directory for transclusion references
fmt -- format flag indicating which fo... | [
"Expands",
"source",
"text",
"to",
"include",
"headers",
"footers",
"and",
"expands",
"Multimarkdown",
"transclusion",
"directives",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L74-L101 |
38,347 | jasedit/pymmd | pymmd/mmd.py | has_metadata | def has_metadata(source, ext):
"""Returns a flag indicating if a given block of MultiMarkdown text contains metadata."""
_MMD_LIB.has_metadata.argtypes = [ctypes.c_char_p, ctypes.c_int]
_MMD_LIB.has_metadata.restype = ctypes.c_bool
return _MMD_LIB.has_metadata(source.encode('utf-8'), ext) | python | def has_metadata(source, ext):
"""Returns a flag indicating if a given block of MultiMarkdown text contains metadata."""
_MMD_LIB.has_metadata.argtypes = [ctypes.c_char_p, ctypes.c_int]
_MMD_LIB.has_metadata.restype = ctypes.c_bool
return _MMD_LIB.has_metadata(source.encode('utf-8'), ext) | [
"def",
"has_metadata",
"(",
"source",
",",
"ext",
")",
":",
"_MMD_LIB",
".",
"has_metadata",
".",
"argtypes",
"=",
"[",
"ctypes",
".",
"c_char_p",
",",
"ctypes",
".",
"c_int",
"]",
"_MMD_LIB",
".",
"has_metadata",
".",
"restype",
"=",
"ctypes",
".",
"c_b... | Returns a flag indicating if a given block of MultiMarkdown text contains metadata. | [
"Returns",
"a",
"flag",
"indicating",
"if",
"a",
"given",
"block",
"of",
"MultiMarkdown",
"text",
"contains",
"metadata",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L103-L107 |
38,348 | jasedit/pymmd | pymmd/mmd.py | convert | def convert(source, ext=COMPLETE, fmt=HTML, dname=None):
"""Converts a string of MultiMarkdown text to the requested format.
Transclusion is performed if the COMPATIBILITY extension is not set, and dname is set to a
valid directory
Keyword arguments:
source -- string containing MultiMarkdown text
... | python | def convert(source, ext=COMPLETE, fmt=HTML, dname=None):
"""Converts a string of MultiMarkdown text to the requested format.
Transclusion is performed if the COMPATIBILITY extension is not set, and dname is set to a
valid directory
Keyword arguments:
source -- string containing MultiMarkdown text
... | [
"def",
"convert",
"(",
"source",
",",
"ext",
"=",
"COMPLETE",
",",
"fmt",
"=",
"HTML",
",",
"dname",
"=",
"None",
")",
":",
"if",
"dname",
"and",
"not",
"ext",
"&",
"COMPATIBILITY",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"dname",
")",
... | Converts a string of MultiMarkdown text to the requested format.
Transclusion is performed if the COMPATIBILITY extension is not set, and dname is set to a
valid directory
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield to pass to conversion process
f... | [
"Converts",
"a",
"string",
"of",
"MultiMarkdown",
"text",
"to",
"the",
"requested",
"format",
".",
"Transclusion",
"is",
"performed",
"if",
"the",
"COMPATIBILITY",
"extension",
"is",
"not",
"set",
"and",
"dname",
"is",
"set",
"to",
"a",
"valid",
"directory"
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L109-L127 |
38,349 | jasedit/pymmd | pymmd/mmd.py | convert_from | def convert_from(fname, ext=COMPLETE, fmt=HTML):
"""
Reads in a file and performs MultiMarkdown conversion, with transclusion ocurring based on the
file directory. Returns the converted string.
Keyword arguments:
fname -- Filename of document to convert
ext -- extension bitfield to pass to conv... | python | def convert_from(fname, ext=COMPLETE, fmt=HTML):
"""
Reads in a file and performs MultiMarkdown conversion, with transclusion ocurring based on the
file directory. Returns the converted string.
Keyword arguments:
fname -- Filename of document to convert
ext -- extension bitfield to pass to conv... | [
"def",
"convert_from",
"(",
"fname",
",",
"ext",
"=",
"COMPLETE",
",",
"fmt",
"=",
"HTML",
")",
":",
"dname",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"fname",
")",
")",
"with",
"open",
"(",
"fname",
",... | Reads in a file and performs MultiMarkdown conversion, with transclusion ocurring based on the
file directory. Returns the converted string.
Keyword arguments:
fname -- Filename of document to convert
ext -- extension bitfield to pass to conversion process
fmt -- flag indicating output format to us... | [
"Reads",
"in",
"a",
"file",
"and",
"performs",
"MultiMarkdown",
"conversion",
"with",
"transclusion",
"ocurring",
"based",
"on",
"the",
"file",
"directory",
".",
"Returns",
"the",
"converted",
"string",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L129-L144 |
38,350 | jasedit/pymmd | pymmd/mmd.py | manifest | def manifest(txt, dname):
"""Extracts file manifest for a body of text with the given directory."""
_, files = _expand_source(txt, dname, HTML)
return files | python | def manifest(txt, dname):
"""Extracts file manifest for a body of text with the given directory."""
_, files = _expand_source(txt, dname, HTML)
return files | [
"def",
"manifest",
"(",
"txt",
",",
"dname",
")",
":",
"_",
",",
"files",
"=",
"_expand_source",
"(",
"txt",
",",
"dname",
",",
"HTML",
")",
"return",
"files"
] | Extracts file manifest for a body of text with the given directory. | [
"Extracts",
"file",
"manifest",
"for",
"a",
"body",
"of",
"text",
"with",
"the",
"given",
"directory",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L146-L149 |
38,351 | jasedit/pymmd | pymmd/mmd.py | keys | def keys(source, ext=COMPLETE):
"""Extracts metadata keys from the provided MultiMarkdown text.
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield for extracting MultiMarkdown
"""
_MMD_LIB.extract_metadata_keys.restype = ctypes.c_char_p
_MMD_LIB.extr... | python | def keys(source, ext=COMPLETE):
"""Extracts metadata keys from the provided MultiMarkdown text.
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield for extracting MultiMarkdown
"""
_MMD_LIB.extract_metadata_keys.restype = ctypes.c_char_p
_MMD_LIB.extr... | [
"def",
"keys",
"(",
"source",
",",
"ext",
"=",
"COMPLETE",
")",
":",
"_MMD_LIB",
".",
"extract_metadata_keys",
".",
"restype",
"=",
"ctypes",
".",
"c_char_p",
"_MMD_LIB",
".",
"extract_metadata_keys",
".",
"argtypes",
"=",
"[",
"ctypes",
".",
"c_char_p",
","... | Extracts metadata keys from the provided MultiMarkdown text.
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield for extracting MultiMarkdown | [
"Extracts",
"metadata",
"keys",
"from",
"the",
"provided",
"MultiMarkdown",
"text",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L151-L164 |
38,352 | jasedit/pymmd | pymmd/mmd.py | value | def value(source, key, ext=COMPLETE):
"""Extracts value for the specified metadata key from the given extension set.
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield for processing text
key -- key to extract
"""
_MMD_LIB.extract_metadata_value.rest... | python | def value(source, key, ext=COMPLETE):
"""Extracts value for the specified metadata key from the given extension set.
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield for processing text
key -- key to extract
"""
_MMD_LIB.extract_metadata_value.rest... | [
"def",
"value",
"(",
"source",
",",
"key",
",",
"ext",
"=",
"COMPLETE",
")",
":",
"_MMD_LIB",
".",
"extract_metadata_value",
".",
"restype",
"=",
"ctypes",
".",
"c_char_p",
"_MMD_LIB",
".",
"extract_metadata_value",
".",
"argtypes",
"=",
"[",
"ctypes",
".",
... | Extracts value for the specified metadata key from the given extension set.
Keyword arguments:
source -- string containing MultiMarkdown text
ext -- extension bitfield for processing text
key -- key to extract | [
"Extracts",
"value",
"for",
"the",
"specified",
"metadata",
"key",
"from",
"the",
"given",
"extension",
"set",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L166-L181 |
38,353 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.tweet | def tweet(self, text, in_reply_to=None, filename=None, file=None):
"""
Post a new tweet.
:param text: the text to post
:param in_reply_to: The ID of the tweet to reply to
:param filename: If `file` param is not provided, read file from this path
:param file: A file objec... | python | def tweet(self, text, in_reply_to=None, filename=None, file=None):
"""
Post a new tweet.
:param text: the text to post
:param in_reply_to: The ID of the tweet to reply to
:param filename: If `file` param is not provided, read file from this path
:param file: A file objec... | [
"def",
"tweet",
"(",
"self",
",",
"text",
",",
"in_reply_to",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"file",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"return",
"Tweet",
"(",
"self",
".",
"_client",
".",
"update_status",
"(... | Post a new tweet.
:param text: the text to post
:param in_reply_to: The ID of the tweet to reply to
:param filename: If `file` param is not provided, read file from this path
:param file: A file object, which will be used instead of opening `filename`. `filename` is still required, for
... | [
"Post",
"a",
"new",
"tweet",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L64-L80 |
38,354 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.retweet | def retweet(self, id):
"""
Retweet a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise
"""
try:
self._client.retweet(id=id)
return True
except TweepError as e:
if e.api_code == TWITTER_PAGE... | python | def retweet(self, id):
"""
Retweet a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise
"""
try:
self._client.retweet(id=id)
return True
except TweepError as e:
if e.api_code == TWITTER_PAGE... | [
"def",
"retweet",
"(",
"self",
",",
"id",
")",
":",
"try",
":",
"self",
".",
"_client",
".",
"retweet",
"(",
"id",
"=",
"id",
")",
"return",
"True",
"except",
"TweepError",
"as",
"e",
":",
"if",
"e",
".",
"api_code",
"==",
"TWITTER_PAGE_DOES_NOT_EXISTS... | Retweet a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise | [
"Retweet",
"a",
"tweet",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L82-L95 |
38,355 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.get_tweet | def get_tweet(self, id):
"""
Get an existing tweet.
:param id: ID of the tweet in question
:return: Tweet object. None if not found
"""
try:
return Tweet(self._client.get_status(id=id)._json)
except TweepError as e:
if e.api_code == TWITTE... | python | def get_tweet(self, id):
"""
Get an existing tweet.
:param id: ID of the tweet in question
:return: Tweet object. None if not found
"""
try:
return Tweet(self._client.get_status(id=id)._json)
except TweepError as e:
if e.api_code == TWITTE... | [
"def",
"get_tweet",
"(",
"self",
",",
"id",
")",
":",
"try",
":",
"return",
"Tweet",
"(",
"self",
".",
"_client",
".",
"get_status",
"(",
"id",
"=",
"id",
")",
".",
"_json",
")",
"except",
"TweepError",
"as",
"e",
":",
"if",
"e",
".",
"api_code",
... | Get an existing tweet.
:param id: ID of the tweet in question
:return: Tweet object. None if not found | [
"Get",
"an",
"existing",
"tweet",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L97-L109 |
38,356 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.get_user | def get_user(self, id):
"""
Get a user's info.
:param id: ID of the user in question
:return: User object. None if not found
"""
try:
return User(self._client.get_user(user_id=id)._json)
except TweepError as e:
if e.api_code == TWITTER_USE... | python | def get_user(self, id):
"""
Get a user's info.
:param id: ID of the user in question
:return: User object. None if not found
"""
try:
return User(self._client.get_user(user_id=id)._json)
except TweepError as e:
if e.api_code == TWITTER_USE... | [
"def",
"get_user",
"(",
"self",
",",
"id",
")",
":",
"try",
":",
"return",
"User",
"(",
"self",
".",
"_client",
".",
"get_user",
"(",
"user_id",
"=",
"id",
")",
".",
"_json",
")",
"except",
"TweepError",
"as",
"e",
":",
"if",
"e",
".",
"api_code",
... | Get a user's info.
:param id: ID of the user in question
:return: User object. None if not found | [
"Get",
"a",
"user",
"s",
"info",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L111-L123 |
38,357 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.remove_tweet | def remove_tweet(self, id):
"""
Delete a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise
"""
try:
self._client.destroy_status(id=id)
return True
except TweepError as e:
if e.api_code in [... | python | def remove_tweet(self, id):
"""
Delete a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise
"""
try:
self._client.destroy_status(id=id)
return True
except TweepError as e:
if e.api_code in [... | [
"def",
"remove_tweet",
"(",
"self",
",",
"id",
")",
":",
"try",
":",
"self",
".",
"_client",
".",
"destroy_status",
"(",
"id",
"=",
"id",
")",
"return",
"True",
"except",
"TweepError",
"as",
"e",
":",
"if",
"e",
".",
"api_code",
"in",
"[",
"TWITTER_P... | Delete a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise | [
"Delete",
"a",
"tweet",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L125-L138 |
38,358 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.create_list | def create_list(self, name, mode='public', description=None):
"""
Create a list
:param name: Name of the new list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: Description of the new list
:return: The new list object
:rtype: :cl... | python | def create_list(self, name, mode='public', description=None):
"""
Create a list
:param name: Name of the new list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: Description of the new list
:return: The new list object
:rtype: :cl... | [
"def",
"create_list",
"(",
"self",
",",
"name",
",",
"mode",
"=",
"'public'",
",",
"description",
"=",
"None",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"create_list",
"(",
"name",
"=",
"name",
",",
"mode",... | Create a list
:param name: Name of the new list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: Description of the new list
:return: The new list object
:rtype: :class:`~responsebot.models.List` | [
"Create",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L168-L178 |
38,359 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.destroy_list | def destroy_list(self, list_id):
"""
Destroy a list
:param list_id: list ID number
:return: The destroyed list object
:rtype: :class:`~responsebot.models.List`
"""
return List(tweepy_list_to_json(self._client.destroy_list(list_id=list_id))) | python | def destroy_list(self, list_id):
"""
Destroy a list
:param list_id: list ID number
:return: The destroyed list object
:rtype: :class:`~responsebot.models.List`
"""
return List(tweepy_list_to_json(self._client.destroy_list(list_id=list_id))) | [
"def",
"destroy_list",
"(",
"self",
",",
"list_id",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"destroy_list",
"(",
"list_id",
"=",
"list_id",
")",
")",
")"
] | Destroy a list
:param list_id: list ID number
:return: The destroyed list object
:rtype: :class:`~responsebot.models.List` | [
"Destroy",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L181-L189 |
38,360 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.update_list | def update_list(self, list_id, name=None, mode=None, description=None):
"""
Update a list
:param list_id: list ID number
:param name: New name for the list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: New description of the list
... | python | def update_list(self, list_id, name=None, mode=None, description=None):
"""
Update a list
:param list_id: list ID number
:param name: New name for the list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: New description of the list
... | [
"def",
"update_list",
"(",
"self",
",",
"list_id",
",",
"name",
"=",
"None",
",",
"mode",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"update_list",
"(",
"list_id... | Update a list
:param list_id: list ID number
:param name: New name for the list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: New description of the list
:return: The updated list object
:rtype: :class:`~responsebot.models.List` | [
"Update",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L192-L205 |
38,361 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.list_timeline | def list_timeline(self, list_id, since_id=None, max_id=None, count=20):
"""
List the tweets of specified list.
:param list_id: list ID number
:param since_id: results will have ID greater than specified ID (more recent than)
:param max_id: results will have ID less than specifie... | python | def list_timeline(self, list_id, since_id=None, max_id=None, count=20):
"""
List the tweets of specified list.
:param list_id: list ID number
:param since_id: results will have ID greater than specified ID (more recent than)
:param max_id: results will have ID less than specifie... | [
"def",
"list_timeline",
"(",
"self",
",",
"list_id",
",",
"since_id",
"=",
"None",
",",
"max_id",
"=",
"None",
",",
"count",
"=",
"20",
")",
":",
"statuses",
"=",
"self",
".",
"_client",
".",
"list_timeline",
"(",
"list_id",
"=",
"list_id",
",",
"since... | List the tweets of specified list.
:param list_id: list ID number
:param since_id: results will have ID greater than specified ID (more recent than)
:param max_id: results will have ID less than specified ID (older than)
:param count: number of results per page
:return: list of ... | [
"List",
"the",
"tweets",
"of",
"specified",
"list",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L235-L246 |
38,362 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.get_list | def get_list(self, list_id):
"""
Get info of specified list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.get_list(list_id=list_id))) | python | def get_list(self, list_id):
"""
Get info of specified list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.get_list(list_id=list_id))) | [
"def",
"get_list",
"(",
"self",
",",
"list_id",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"get_list",
"(",
"list_id",
"=",
"list_id",
")",
")",
")"
] | Get info of specified list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object | [
"Get",
"info",
"of",
"specified",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L249-L256 |
38,363 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.add_list_member | def add_list_member(self, list_id, user_id):
"""
Add a user to list
:param list_id: list ID number
:param user_id: user ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.add_list_member(list_id=list_id, u... | python | def add_list_member(self, list_id, user_id):
"""
Add a user to list
:param list_id: list ID number
:param user_id: user ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.add_list_member(list_id=list_id, u... | [
"def",
"add_list_member",
"(",
"self",
",",
"list_id",
",",
"user_id",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"add_list_member",
"(",
"list_id",
"=",
"list_id",
",",
"user_id",
"=",
"user_id",
")",
")",
")... | Add a user to list
:param list_id: list ID number
:param user_id: user ID number
:return: :class:`~responsebot.models.List` object | [
"Add",
"a",
"user",
"to",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L259-L267 |
38,364 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.remove_list_member | def remove_list_member(self, list_id, user_id):
"""
Remove a user from a list
:param list_id: list ID number
:param user_id: user ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.remove_list_member(list_... | python | def remove_list_member(self, list_id, user_id):
"""
Remove a user from a list
:param list_id: list ID number
:param user_id: user ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.remove_list_member(list_... | [
"def",
"remove_list_member",
"(",
"self",
",",
"list_id",
",",
"user_id",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"remove_list_member",
"(",
"list_id",
"=",
"list_id",
",",
"user_id",
"=",
"user_id",
")",
")"... | Remove a user from a list
:param list_id: list ID number
:param user_id: user ID number
:return: :class:`~responsebot.models.List` object | [
"Remove",
"a",
"user",
"from",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L270-L278 |
38,365 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.list_members | def list_members(self, list_id):
"""
List users in a list
:param list_id: list ID number
:return: list of :class:`~responsebot.models.User` objects
"""
return [User(user._json) for user in self._client.list_members(list_id=list_id)] | python | def list_members(self, list_id):
"""
List users in a list
:param list_id: list ID number
:return: list of :class:`~responsebot.models.User` objects
"""
return [User(user._json) for user in self._client.list_members(list_id=list_id)] | [
"def",
"list_members",
"(",
"self",
",",
"list_id",
")",
":",
"return",
"[",
"User",
"(",
"user",
".",
"_json",
")",
"for",
"user",
"in",
"self",
".",
"_client",
".",
"list_members",
"(",
"list_id",
"=",
"list_id",
")",
"]"
] | List users in a list
:param list_id: list ID number
:return: list of :class:`~responsebot.models.User` objects | [
"List",
"users",
"in",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L281-L288 |
38,366 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.is_list_member | def is_list_member(self, list_id, user_id):
"""
Check if a user is member of a list
:param list_id: list ID number
:param user_id: user ID number
:return: :code:`True` if user is member of list, :code:`False` otherwise
"""
try:
return bool(self._clien... | python | def is_list_member(self, list_id, user_id):
"""
Check if a user is member of a list
:param list_id: list ID number
:param user_id: user ID number
:return: :code:`True` if user is member of list, :code:`False` otherwise
"""
try:
return bool(self._clien... | [
"def",
"is_list_member",
"(",
"self",
",",
"list_id",
",",
"user_id",
")",
":",
"try",
":",
"return",
"bool",
"(",
"self",
".",
"_client",
".",
"show_list_member",
"(",
"list_id",
"=",
"list_id",
",",
"user_id",
"=",
"user_id",
")",
")",
"except",
"Tweep... | Check if a user is member of a list
:param list_id: list ID number
:param user_id: user ID number
:return: :code:`True` if user is member of list, :code:`False` otherwise | [
"Check",
"if",
"a",
"user",
"is",
"member",
"of",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L291-L304 |
38,367 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.subscribe_list | def subscribe_list(self, list_id):
"""
Subscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.subscribe_list(list_id=list_id))) | python | def subscribe_list(self, list_id):
"""
Subscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.subscribe_list(list_id=list_id))) | [
"def",
"subscribe_list",
"(",
"self",
",",
"list_id",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"subscribe_list",
"(",
"list_id",
"=",
"list_id",
")",
")",
")"
] | Subscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object | [
"Subscribe",
"to",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L307-L314 |
38,368 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.unsubscribe_list | def unsubscribe_list(self, list_id):
"""
Unsubscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.unsubscribe_list(list_id=list_id))) | python | def unsubscribe_list(self, list_id):
"""
Unsubscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.unsubscribe_list(list_id=list_id))) | [
"def",
"unsubscribe_list",
"(",
"self",
",",
"list_id",
")",
":",
"return",
"List",
"(",
"tweepy_list_to_json",
"(",
"self",
".",
"_client",
".",
"unsubscribe_list",
"(",
"list_id",
"=",
"list_id",
")",
")",
")"
] | Unsubscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object | [
"Unsubscribe",
"to",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L317-L324 |
38,369 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.list_subscribers | def list_subscribers(self, list_id):
"""
List subscribers of a list
:param list_id: list ID number
:return: :class:`~responsebot.models.User` object
"""
return [User(user._json) for user in self._client.list_subscribers(list_id=list_id)] | python | def list_subscribers(self, list_id):
"""
List subscribers of a list
:param list_id: list ID number
:return: :class:`~responsebot.models.User` object
"""
return [User(user._json) for user in self._client.list_subscribers(list_id=list_id)] | [
"def",
"list_subscribers",
"(",
"self",
",",
"list_id",
")",
":",
"return",
"[",
"User",
"(",
"user",
".",
"_json",
")",
"for",
"user",
"in",
"self",
".",
"_client",
".",
"list_subscribers",
"(",
"list_id",
"=",
"list_id",
")",
"]"
] | List subscribers of a list
:param list_id: list ID number
:return: :class:`~responsebot.models.User` object | [
"List",
"subscribers",
"of",
"a",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L327-L334 |
38,370 | invinst/ResponseBot | responsebot/responsebot_client.py | ResponseBotClient.is_subscribed_list | def is_subscribed_list(self, list_id, user_id):
"""
Check if user is a subscribed of specified list
:param list_id: list ID number
:param user_id: user ID number
:return: :code:`True` if user is subscribed of list, :code:`False` otherwise
"""
try:
ret... | python | def is_subscribed_list(self, list_id, user_id):
"""
Check if user is a subscribed of specified list
:param list_id: list ID number
:param user_id: user ID number
:return: :code:`True` if user is subscribed of list, :code:`False` otherwise
"""
try:
ret... | [
"def",
"is_subscribed_list",
"(",
"self",
",",
"list_id",
",",
"user_id",
")",
":",
"try",
":",
"return",
"bool",
"(",
"self",
".",
"_client",
".",
"show_list_subscriber",
"(",
"list_id",
"=",
"list_id",
",",
"user_id",
"=",
"user_id",
")",
")",
"except",
... | Check if user is a subscribed of specified list
:param list_id: list ID number
:param user_id: user ID number
:return: :code:`True` if user is subscribed of list, :code:`False` otherwise | [
"Check",
"if",
"user",
"is",
"a",
"subscribed",
"of",
"specified",
"list"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_client.py#L337-L350 |
38,371 | invinst/ResponseBot | responsebot/utils/auth_utils.py | auth | def auth(config):
"""
Perform authentication with Twitter and return a client instance to communicate with Twitter
:param config: ResponseBot config
:type config: :class:`~responsebot.utils.config_utils.ResponseBotConfig`
:return: client instance to execute twitter action
:rtype: :class:`~respo... | python | def auth(config):
"""
Perform authentication with Twitter and return a client instance to communicate with Twitter
:param config: ResponseBot config
:type config: :class:`~responsebot.utils.config_utils.ResponseBotConfig`
:return: client instance to execute twitter action
:rtype: :class:`~respo... | [
"def",
"auth",
"(",
"config",
")",
":",
"auth",
"=",
"tweepy",
".",
"OAuthHandler",
"(",
"config",
".",
"get",
"(",
"'consumer_key'",
")",
",",
"config",
".",
"get",
"(",
"'consumer_secret'",
")",
")",
"auth",
".",
"set_access_token",
"(",
"config",
".",... | Perform authentication with Twitter and return a client instance to communicate with Twitter
:param config: ResponseBot config
:type config: :class:`~responsebot.utils.config_utils.ResponseBotConfig`
:return: client instance to execute twitter action
:rtype: :class:`~responsebot.responsebot_client.Resp... | [
"Perform",
"authentication",
"with",
"Twitter",
"and",
"return",
"a",
"client",
"instance",
"to",
"communicate",
"with",
"Twitter"
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/utils/auth_utils.py#L15-L39 |
38,372 | mickybart/python-atlasbroker | atlasbroker/service.py | AtlasBroker.bind | def bind(self, instance_id: str, binding_id: str, details: BindDetails) -> Binding:
"""Binding the instance
see openbrokerapi documentation
"""
# Find the instance
instance = self._backend.find(instance_id)
# Find or create the binding
b... | python | def bind(self, instance_id: str, binding_id: str, details: BindDetails) -> Binding:
"""Binding the instance
see openbrokerapi documentation
"""
# Find the instance
instance = self._backend.find(instance_id)
# Find or create the binding
b... | [
"def",
"bind",
"(",
"self",
",",
"instance_id",
":",
"str",
",",
"binding_id",
":",
"str",
",",
"details",
":",
"BindDetails",
")",
"->",
"Binding",
":",
"# Find the instance",
"instance",
"=",
"self",
".",
"_backend",
".",
"find",
"(",
"instance_id",
")",... | Binding the instance
see openbrokerapi documentation | [
"Binding",
"the",
"instance",
"see",
"openbrokerapi",
"documentation"
] | 5b741c1348a6d33b342e0852a8a8900fa9ebf00a | https://github.com/mickybart/python-atlasbroker/blob/5b741c1348a6d33b342e0852a8a8900fa9ebf00a/atlasbroker/service.py#L126-L139 |
38,373 | FreekingDean/insteon-hub | insteon/api.py | InsteonAPI.post | def post(self, path, data={}):
'''Perform POST Request '''
response = requests.post(API_URL + path, data=json.dumps(data), headers=self._set_headers())
return self._check_response(response, self.post, path, data) | python | def post(self, path, data={}):
'''Perform POST Request '''
response = requests.post(API_URL + path, data=json.dumps(data), headers=self._set_headers())
return self._check_response(response, self.post, path, data) | [
"def",
"post",
"(",
"self",
",",
"path",
",",
"data",
"=",
"{",
"}",
")",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"API_URL",
"+",
"path",
",",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
",",
"headers",
"=",
"self",
".",
"_... | Perform POST Request | [
"Perform",
"POST",
"Request"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/api.py#L39-L42 |
38,374 | FreekingDean/insteon-hub | insteon/api.py | InsteonAPI.delete | def delete(self, path, data={}):
'''Perform DELETE Request'''
if len(data) != 0:
parameter_string = ''
for k,v in data.items():
parameter_string += '{}={}'.format(k,v)
parameter_string += '&'
path += '?' + parameter_string
resp... | python | def delete(self, path, data={}):
'''Perform DELETE Request'''
if len(data) != 0:
parameter_string = ''
for k,v in data.items():
parameter_string += '{}={}'.format(k,v)
parameter_string += '&'
path += '?' + parameter_string
resp... | [
"def",
"delete",
"(",
"self",
",",
"path",
",",
"data",
"=",
"{",
"}",
")",
":",
"if",
"len",
"(",
"data",
")",
"!=",
"0",
":",
"parameter_string",
"=",
"''",
"for",
"k",
",",
"v",
"in",
"data",
".",
"items",
"(",
")",
":",
"parameter_string",
... | Perform DELETE Request | [
"Perform",
"DELETE",
"Request"
] | afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e | https://github.com/FreekingDean/insteon-hub/blob/afd60d0a7fa74752f29d63c9bb6ccccd46d7aa3e/insteon/api.py#L49-L59 |
38,375 | kevinconway/confpy | confpy/loaders/ini.py | IniFile.parsed | def parsed(self):
"""Get the ConfigParser object which represents the content.
This property is cached and only parses the content once.
"""
if not self._parsed:
self._parsed = ConfigParser()
self._parsed.readfp(io.StringIO(self.content))
return self._p... | python | def parsed(self):
"""Get the ConfigParser object which represents the content.
This property is cached and only parses the content once.
"""
if not self._parsed:
self._parsed = ConfigParser()
self._parsed.readfp(io.StringIO(self.content))
return self._p... | [
"def",
"parsed",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_parsed",
":",
"self",
".",
"_parsed",
"=",
"ConfigParser",
"(",
")",
"self",
".",
"_parsed",
".",
"readfp",
"(",
"io",
".",
"StringIO",
"(",
"self",
".",
"content",
")",
")",
"retu... | Get the ConfigParser object which represents the content.
This property is cached and only parses the content once. | [
"Get",
"the",
"ConfigParser",
"object",
"which",
"represents",
"the",
"content",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/ini.py#L30-L40 |
38,376 | MacHu-GWU/crawlib-project | crawlib/cache.py | create_cache | def create_cache(directory, compress_level=6, value_type_is_binary=False, **kwargs):
"""
Create a html cache. Html string will be automatically compressed.
:param directory: path for the cache directory.
:param compress_level: 0 ~ 9, 9 is slowest and smallest.
:param kwargs: other arguments.
:r... | python | def create_cache(directory, compress_level=6, value_type_is_binary=False, **kwargs):
"""
Create a html cache. Html string will be automatically compressed.
:param directory: path for the cache directory.
:param compress_level: 0 ~ 9, 9 is slowest and smallest.
:param kwargs: other arguments.
:r... | [
"def",
"create_cache",
"(",
"directory",
",",
"compress_level",
"=",
"6",
",",
"value_type_is_binary",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"cache",
"=",
"diskcache",
".",
"Cache",
"(",
"directory",
",",
"disk",
"=",
"CompressedDisk",
",",
"dis... | Create a html cache. Html string will be automatically compressed.
:param directory: path for the cache directory.
:param compress_level: 0 ~ 9, 9 is slowest and smallest.
:param kwargs: other arguments.
:return: a `diskcache.Cache()` | [
"Create",
"a",
"html",
"cache",
".",
"Html",
"string",
"will",
"be",
"automatically",
"compressed",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/cache.py#L75-L91 |
38,377 | scivision/sciencedates | sciencedates/ticks.py | timeticks | def timeticks(tdiff):
"""
NOTE do NOT use "interval" or ticks are misaligned! use "bysecond" only!
"""
if isinstance(tdiff, xarray.DataArray): # len==1
tdiff = timedelta(seconds=tdiff.values / np.timedelta64(1, 's'))
assert isinstance(tdiff, timedelta), 'expecting datetime.timedelta'
... | python | def timeticks(tdiff):
"""
NOTE do NOT use "interval" or ticks are misaligned! use "bysecond" only!
"""
if isinstance(tdiff, xarray.DataArray): # len==1
tdiff = timedelta(seconds=tdiff.values / np.timedelta64(1, 's'))
assert isinstance(tdiff, timedelta), 'expecting datetime.timedelta'
... | [
"def",
"timeticks",
"(",
"tdiff",
")",
":",
"if",
"isinstance",
"(",
"tdiff",
",",
"xarray",
".",
"DataArray",
")",
":",
"# len==1",
"tdiff",
"=",
"timedelta",
"(",
"seconds",
"=",
"tdiff",
".",
"values",
"/",
"np",
".",
"timedelta64",
"(",
"1",
",",
... | NOTE do NOT use "interval" or ticks are misaligned! use "bysecond" only! | [
"NOTE",
"do",
"NOT",
"use",
"interval",
"or",
"ticks",
"are",
"misaligned!",
"use",
"bysecond",
"only!"
] | a713389e027b42d26875cf227450a5d7c6696000 | https://github.com/scivision/sciencedates/blob/a713389e027b42d26875cf227450a5d7c6696000/sciencedates/ticks.py#L24-L52 |
38,378 | fedora-infra/fedmsg-atomic-composer | fedmsg_atomic_composer/consumer.py | AtomicConsumer.consume | def consume(self, msg):
"""Called with each incoming fedmsg.
From here we trigger an rpm-ostree compose by touching a specific file
under the `touch_dir`. Then our `doRead` method is called with the
output of the rpm-ostree-toolbox treecompose, which we monitor to
determine when... | python | def consume(self, msg):
"""Called with each incoming fedmsg.
From here we trigger an rpm-ostree compose by touching a specific file
under the `touch_dir`. Then our `doRead` method is called with the
output of the rpm-ostree-toolbox treecompose, which we monitor to
determine when... | [
"def",
"consume",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"msg",
")",
"body",
"=",
"msg",
"[",
"'body'",
"]",
"topic",
"=",
"body",
"[",
"'topic'",
"]",
"repo",
"=",
"None",
"if",
"'rawhide'",
"in",
"topic",
":",
... | Called with each incoming fedmsg.
From here we trigger an rpm-ostree compose by touching a specific file
under the `touch_dir`. Then our `doRead` method is called with the
output of the rpm-ostree-toolbox treecompose, which we monitor to
determine when it has completed. | [
"Called",
"with",
"each",
"incoming",
"fedmsg",
"."
] | 9be9fd4955af0568f8743d7a1a243cd8f70020c3 | https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/consumer.py#L41-L75 |
38,379 | phensley/gstatsd | gstatsd/service.py | parse_addr | def parse_addr(text):
"Parse a 1- to 3-part address spec."
if text:
parts = text.split(':')
length = len(parts)
if length== 3:
return parts[0], parts[1], int(parts[2])
elif length == 2:
return None, parts[0], int(parts[1])
elif length == 1:
... | python | def parse_addr(text):
"Parse a 1- to 3-part address spec."
if text:
parts = text.split(':')
length = len(parts)
if length== 3:
return parts[0], parts[1], int(parts[2])
elif length == 2:
return None, parts[0], int(parts[1])
elif length == 1:
... | [
"def",
"parse_addr",
"(",
"text",
")",
":",
"if",
"text",
":",
"parts",
"=",
"text",
".",
"split",
"(",
"':'",
")",
"length",
"=",
"len",
"(",
"parts",
")",
"if",
"length",
"==",
"3",
":",
"return",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1... | Parse a 1- to 3-part address spec. | [
"Parse",
"a",
"1",
"-",
"to",
"3",
"-",
"part",
"address",
"spec",
"."
] | c6d3d22f162d236c1ef916064670c6dc5bce6142 | https://github.com/phensley/gstatsd/blob/c6d3d22f162d236c1ef916064670c6dc5bce6142/gstatsd/service.py#L79-L90 |
38,380 | phensley/gstatsd | gstatsd/service.py | StatsDaemon.start | def start(self):
"Start the service"
# register signals
gevent.signal(signal.SIGINT, self._shutdown)
# spawn the flush trigger
def _flush_impl():
while 1:
gevent.sleep(self._stats.interval)
# rotate stats
stats = self.... | python | def start(self):
"Start the service"
# register signals
gevent.signal(signal.SIGINT, self._shutdown)
# spawn the flush trigger
def _flush_impl():
while 1:
gevent.sleep(self._stats.interval)
# rotate stats
stats = self.... | [
"def",
"start",
"(",
"self",
")",
":",
"# register signals",
"gevent",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"self",
".",
"_shutdown",
")",
"# spawn the flush trigger",
"def",
"_flush_impl",
"(",
")",
":",
"while",
"1",
":",
"gevent",
".",
"sle... | Start the service | [
"Start",
"the",
"service"
] | c6d3d22f162d236c1ef916064670c6dc5bce6142 | https://github.com/phensley/gstatsd/blob/c6d3d22f162d236c1ef916064670c6dc5bce6142/gstatsd/service.py#L147-L182 |
38,381 | phensley/gstatsd | gstatsd/service.py | StatsDaemon._process | def _process(self, data):
"Process a single packet and update the internal tables."
parts = data.split(':')
if self._debug:
self.error('packet: %r' % data)
if not parts:
return
# interpret the packet and update stats
stats = self._stats
ke... | python | def _process(self, data):
"Process a single packet and update the internal tables."
parts = data.split(':')
if self._debug:
self.error('packet: %r' % data)
if not parts:
return
# interpret the packet and update stats
stats = self._stats
ke... | [
"def",
"_process",
"(",
"self",
",",
"data",
")",
":",
"parts",
"=",
"data",
".",
"split",
"(",
"':'",
")",
"if",
"self",
".",
"_debug",
":",
"self",
".",
"error",
"(",
"'packet: %r'",
"%",
"data",
")",
"if",
"not",
"parts",
":",
"return",
"# inter... | Process a single packet and update the internal tables. | [
"Process",
"a",
"single",
"packet",
"and",
"update",
"the",
"internal",
"tables",
"."
] | c6d3d22f162d236c1ef916064670c6dc5bce6142 | https://github.com/phensley/gstatsd/blob/c6d3d22f162d236c1ef916064670c6dc5bce6142/gstatsd/service.py#L188-L223 |
38,382 | pauleveritt/kaybee | kaybee/plugins/articles/base_article.py | BaseArticle.section | def section(self, resources):
""" Which section is this in, if any """
section = [p for p in self.parents(resources) if p.rtype == 'section']
if section:
return section[0]
return None | python | def section(self, resources):
""" Which section is this in, if any """
section = [p for p in self.parents(resources) if p.rtype == 'section']
if section:
return section[0]
return None | [
"def",
"section",
"(",
"self",
",",
"resources",
")",
":",
"section",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"parents",
"(",
"resources",
")",
"if",
"p",
".",
"rtype",
"==",
"'section'",
"]",
"if",
"section",
":",
"return",
"section",
"[",
"... | Which section is this in, if any | [
"Which",
"section",
"is",
"this",
"in",
"if",
"any"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/base_article.py#L35-L41 |
38,383 | pauleveritt/kaybee | kaybee/plugins/articles/base_article.py | BaseArticle.in_navitem | def in_navitem(self, resources, nav_href):
""" Given href of nav item, determine if resource is in it """
# The navhref might end with '/index' so remove it if so
if nav_href.endswith('/index'):
nav_href = nav_href[:-6]
return self.docname.startswith(nav_href) | python | def in_navitem(self, resources, nav_href):
""" Given href of nav item, determine if resource is in it """
# The navhref might end with '/index' so remove it if so
if nav_href.endswith('/index'):
nav_href = nav_href[:-6]
return self.docname.startswith(nav_href) | [
"def",
"in_navitem",
"(",
"self",
",",
"resources",
",",
"nav_href",
")",
":",
"# The navhref might end with '/index' so remove it if so",
"if",
"nav_href",
".",
"endswith",
"(",
"'/index'",
")",
":",
"nav_href",
"=",
"nav_href",
"[",
":",
"-",
"6",
"]",
"return... | Given href of nav item, determine if resource is in it | [
"Given",
"href",
"of",
"nav",
"item",
"determine",
"if",
"resource",
"is",
"in",
"it"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/base_article.py#L43-L50 |
38,384 | pauleveritt/kaybee | kaybee/plugins/articles/base_article.py | BaseArticle.is_published | def is_published(self):
""" Return true if this resource has published date in the past """
now = datetime.now()
published = self.props.published
if published:
return published < now
return False | python | def is_published(self):
""" Return true if this resource has published date in the past """
now = datetime.now()
published = self.props.published
if published:
return published < now
return False | [
"def",
"is_published",
"(",
"self",
")",
":",
"now",
"=",
"datetime",
".",
"now",
"(",
")",
"published",
"=",
"self",
".",
"props",
".",
"published",
"if",
"published",
":",
"return",
"published",
"<",
"now",
"return",
"False"
] | Return true if this resource has published date in the past | [
"Return",
"true",
"if",
"this",
"resource",
"has",
"published",
"date",
"in",
"the",
"past"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/base_article.py#L53-L60 |
38,385 | MacHu-GWU/crawlib-project | crawlib/downloader/selenium_downloader.py | BaseSeleliumDownloader._create_driver | def _create_driver(self, **kwargs):
"""
Create webdriver, assign it to ``self.driver``, and run webdriver
initiation process, which is usually used for manual login.
"""
if self.driver is None:
self.driver = self.create_driver(**kwargs)
self.init_driver_fu... | python | def _create_driver(self, **kwargs):
"""
Create webdriver, assign it to ``self.driver``, and run webdriver
initiation process, which is usually used for manual login.
"""
if self.driver is None:
self.driver = self.create_driver(**kwargs)
self.init_driver_fu... | [
"def",
"_create_driver",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"driver",
"is",
"None",
":",
"self",
".",
"driver",
"=",
"self",
".",
"create_driver",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"init_driver_func",
"(",
"se... | Create webdriver, assign it to ``self.driver``, and run webdriver
initiation process, which is usually used for manual login. | [
"Create",
"webdriver",
"assign",
"it",
"to",
"self",
".",
"driver",
"and",
"run",
"webdriver",
"initiation",
"process",
"which",
"is",
"usually",
"used",
"for",
"manual",
"login",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/downloader/selenium_downloader.py#L86-L93 |
38,386 | Yipit/ejson | ejson/serializers.py | deserialize_time | def deserialize_time(data):
"""Return a time instance based on the values of the data param"""
parsed = parser.parse(data)
return parsed.time().replace(tzinfo=parsed.tzinfo) | python | def deserialize_time(data):
"""Return a time instance based on the values of the data param"""
parsed = parser.parse(data)
return parsed.time().replace(tzinfo=parsed.tzinfo) | [
"def",
"deserialize_time",
"(",
"data",
")",
":",
"parsed",
"=",
"parser",
".",
"parse",
"(",
"data",
")",
"return",
"parsed",
".",
"time",
"(",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"parsed",
".",
"tzinfo",
")"
] | Return a time instance based on the values of the data param | [
"Return",
"a",
"time",
"instance",
"based",
"on",
"the",
"values",
"of",
"the",
"data",
"param"
] | 6665703f1534923d1c30849e08339f0ff97d8230 | https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/serializers.py#L74-L77 |
38,387 | nwhitehead/pineapple-module | pineapple/require.py | require | def require(*args, **kwargs):
'''
Install a set of packages using pip
This is designed to be an interface for IPython notebooks that
replicates the requirements.txt pip format. This lets notebooks
specify which versions of packages they need inside the notebook
itself.
This function is... | python | def require(*args, **kwargs):
'''
Install a set of packages using pip
This is designed to be an interface for IPython notebooks that
replicates the requirements.txt pip format. This lets notebooks
specify which versions of packages they need inside the notebook
itself.
This function is... | [
"def",
"require",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# If called with no arguments, returns requirements list",
"if",
"not",
"args",
"and",
"not",
"kwargs",
":",
"return",
"freeze",
"(",
")",
"# Construct array of requirements",
"requirements",
"=... | Install a set of packages using pip
This is designed to be an interface for IPython notebooks that
replicates the requirements.txt pip format. This lets notebooks
specify which versions of packages they need inside the notebook
itself.
This function is the general-purpose interface that lets
... | [
"Install",
"a",
"set",
"of",
"packages",
"using",
"pip",
"This",
"is",
"designed",
"to",
"be",
"an",
"interface",
"for",
"IPython",
"notebooks",
"that",
"replicates",
"the",
"requirements",
".",
"txt",
"pip",
"format",
".",
"This",
"lets",
"notebooks",
"spec... | d35ac6d9c1d748dbc06ac568829325c36680b0cb | https://github.com/nwhitehead/pineapple-module/blob/d35ac6d9c1d748dbc06ac568829325c36680b0cb/pineapple/require.py#L17-L40 |
38,388 | paltman-archive/nashvegas | nashvegas/management/commands/comparedb.py | Command.handle | def handle(self, *args, **options):
"""
Compares current database with a migrations.
Creates a temporary database, applies all the migrations to it, and
then dumps the schema from both current and temporary, diffs them,
then report the diffs to the user.
"""
... | python | def handle(self, *args, **options):
"""
Compares current database with a migrations.
Creates a temporary database, applies all the migrations to it, and
then dumps the schema from both current and temporary, diffs them,
then report the diffs to the user.
"""
... | [
"def",
"handle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"self",
".",
"db",
"=",
"options",
".",
"get",
"(",
"\"database\"",
",",
"DEFAULT_DB_ALIAS",
")",
"self",
".",
"current_name",
"=",
"connections",
"[",
"self",
".",
"... | Compares current database with a migrations.
Creates a temporary database, applies all the migrations to it, and
then dumps the schema from both current and temporary, diffs them,
then report the diffs to the user. | [
"Compares",
"current",
"database",
"with",
"a",
"migrations",
".",
"Creates",
"a",
"temporary",
"database",
"applies",
"all",
"the",
"migrations",
"to",
"it",
"and",
"then",
"dumps",
"the",
"schema",
"from",
"both",
"current",
"and",
"temporary",
"diffs",
"the... | 14e904a3f5b87e878cd053b554e76e85943d1c11 | https://github.com/paltman-archive/nashvegas/blob/14e904a3f5b87e878cd053b554e76e85943d1c11/nashvegas/management/commands/comparedb.py#L71-L115 |
38,389 | pauleveritt/kaybee | kaybee/plugins/widgets/handlers.py | render_widgets | def render_widgets(kb_app: kb,
sphinx_app: Sphinx,
doctree: doctree,
fromdocname: str,
):
""" Go through docs and replace widget directive with rendering """
builder: StandaloneHTMLBuilder = sphinx_app.builder
for node in doctree.... | python | def render_widgets(kb_app: kb,
sphinx_app: Sphinx,
doctree: doctree,
fromdocname: str,
):
""" Go through docs and replace widget directive with rendering """
builder: StandaloneHTMLBuilder = sphinx_app.builder
for node in doctree.... | [
"def",
"render_widgets",
"(",
"kb_app",
":",
"kb",
",",
"sphinx_app",
":",
"Sphinx",
",",
"doctree",
":",
"doctree",
",",
"fromdocname",
":",
"str",
",",
")",
":",
"builder",
":",
"StandaloneHTMLBuilder",
"=",
"sphinx_app",
".",
"builder",
"for",
"node",
"... | Go through docs and replace widget directive with rendering | [
"Go",
"through",
"docs",
"and",
"replace",
"widget",
"directive",
"with",
"rendering"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/widgets/handlers.py#L63-L84 |
38,390 | jingming/spotify | spotify/auth/client.py | Client.auth_string | def auth_string(self):
"""
Get the auth string. If the token is expired and auto refresh enabled,
a new token will be fetched
:return: the auth string
:rtype: str
"""
if not self._token:
self.execute()
if not self._token.expired:
... | python | def auth_string(self):
"""
Get the auth string. If the token is expired and auto refresh enabled,
a new token will be fetched
:return: the auth string
:rtype: str
"""
if not self._token:
self.execute()
if not self._token.expired:
... | [
"def",
"auth_string",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_token",
":",
"self",
".",
"execute",
"(",
")",
"if",
"not",
"self",
".",
"_token",
".",
"expired",
":",
"return",
"'Bearer {}'",
".",
"format",
"(",
"self",
".",
"_token",
".",
... | Get the auth string. If the token is expired and auto refresh enabled,
a new token will be fetched
:return: the auth string
:rtype: str | [
"Get",
"the",
"auth",
"string",
".",
"If",
"the",
"token",
"is",
"expired",
"and",
"auto",
"refresh",
"enabled",
"a",
"new",
"token",
"will",
"be",
"fetched"
] | d92c71073b2515f3c850604114133a7d2022d1a4 | https://github.com/jingming/spotify/blob/d92c71073b2515f3c850604114133a7d2022d1a4/spotify/auth/client.py#L27-L45 |
38,391 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.admin_penalty | def admin_penalty(self, column=None, value=None, **kwargs):
"""
An enforcement action that results in levying the permit holder with a
penalty or fine. It is used to track judicial hearing dates, penalty
amounts, and type of administrative penalty order.
>>> PCS().admin_penalty(... | python | def admin_penalty(self, column=None, value=None, **kwargs):
"""
An enforcement action that results in levying the permit holder with a
penalty or fine. It is used to track judicial hearing dates, penalty
amounts, and type of administrative penalty order.
>>> PCS().admin_penalty(... | [
"def",
"admin_penalty",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_ADMIN_PENALTY_ORDER'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",... | An enforcement action that results in levying the permit holder with a
penalty or fine. It is used to track judicial hearing dates, penalty
amounts, and type of administrative penalty order.
>>> PCS().admin_penalty('enfor_action_date', '16-MAR-01') | [
"An",
"enforcement",
"action",
"that",
"results",
"in",
"levying",
"the",
"permit",
"holder",
"with",
"a",
"penalty",
"or",
"fine",
".",
"It",
"is",
"used",
"to",
"track",
"judicial",
"hearing",
"dates",
"penalty",
"amounts",
"and",
"type",
"of",
"administra... | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L24-L33 |
38,392 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.compliance_schedule | def compliance_schedule(self, column=None, value=None, **kwargs):
"""
A sequence of activities with associated milestones which pertains to a
given permit.
>>> PCS().compliance_schedule('cmpl_schd_evt', '62099')
"""
return self._resolve_call('PCS_CMPL_SCHD', column, valu... | python | def compliance_schedule(self, column=None, value=None, **kwargs):
"""
A sequence of activities with associated milestones which pertains to a
given permit.
>>> PCS().compliance_schedule('cmpl_schd_evt', '62099')
"""
return self._resolve_call('PCS_CMPL_SCHD', column, valu... | [
"def",
"compliance_schedule",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_CMPL_SCHD'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
"... | A sequence of activities with associated milestones which pertains to a
given permit.
>>> PCS().compliance_schedule('cmpl_schd_evt', '62099') | [
"A",
"sequence",
"of",
"activities",
"with",
"associated",
"milestones",
"which",
"pertains",
"to",
"a",
"given",
"permit",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L58-L65 |
38,393 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.compliance_violation | def compliance_violation(self, column=None, value=None, **kwargs):
"""
A compliance schedule violation reflects the non-achievement of a
given compliance schedule event including the type of violation and ty
pe of resolution.
>>> PCS().compliance_violation('cs_rnc_detect_date', ... | python | def compliance_violation(self, column=None, value=None, **kwargs):
"""
A compliance schedule violation reflects the non-achievement of a
given compliance schedule event including the type of violation and ty
pe of resolution.
>>> PCS().compliance_violation('cs_rnc_detect_date', ... | [
"def",
"compliance_violation",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_CMPL_SCHD_VIOL'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs... | A compliance schedule violation reflects the non-achievement of a
given compliance schedule event including the type of violation and ty
pe of resolution.
>>> PCS().compliance_violation('cs_rnc_detect_date', '16-MAR-04') | [
"A",
"compliance",
"schedule",
"violation",
"reflects",
"the",
"non",
"-",
"achievement",
"of",
"a",
"given",
"compliance",
"schedule",
"event",
"including",
"the",
"type",
"of",
"violation",
"and",
"ty",
"pe",
"of",
"resolution",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L67-L75 |
38,394 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.enforcement_action | def enforcement_action(self, column=None, value=None, **kwargs):
"""
A disciplinary action taken against a permit facility. The action may
be applicable to one or more violations.
>>> PCS().enforcement_action('ea_code', '09')
"""
return self._resolve_call('PCS_ENFOR_A... | python | def enforcement_action(self, column=None, value=None, **kwargs):
"""
A disciplinary action taken against a permit facility. The action may
be applicable to one or more violations.
>>> PCS().enforcement_action('ea_code', '09')
"""
return self._resolve_call('PCS_ENFOR_A... | [
"def",
"enforcement_action",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_ENFOR_ACTION'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
... | A disciplinary action taken against a permit facility. The action may
be applicable to one or more violations.
>>> PCS().enforcement_action('ea_code', '09') | [
"A",
"disciplinary",
"action",
"taken",
"against",
"a",
"permit",
"facility",
".",
"The",
"action",
"may",
"be",
"applicable",
"to",
"one",
"or",
"more",
"violations",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L87-L94 |
38,395 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.hearing | def hearing(self, column=None, value=None, **kwargs):
"""
An evidentiary hearing.
>>> PCS().hearing('event_date', '23-MAY-01')
"""
return self._resolve_call('PCS_EVIDENTIARY_HEARING_EVENT', column,
value, **kwargs) | python | def hearing(self, column=None, value=None, **kwargs):
"""
An evidentiary hearing.
>>> PCS().hearing('event_date', '23-MAY-01')
"""
return self._resolve_call('PCS_EVIDENTIARY_HEARING_EVENT', column,
value, **kwargs) | [
"def",
"hearing",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_EVIDENTIARY_HEARING_EVENT'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",... | An evidentiary hearing.
>>> PCS().hearing('event_date', '23-MAY-01') | [
"An",
"evidentiary",
"hearing",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L115-L122 |
38,396 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.industrial_user | def industrial_user(self, column=None, value=None, **kwargs):
"""
Information from the PCI_AUDIT table pertaining to industrial users,
i.e. the number of significant industrial users.
>>> PCS().industrial_user('insp_date', '16-MAR-01')
"""
return self._resolve_call('PCS_... | python | def industrial_user(self, column=None, value=None, **kwargs):
"""
Information from the PCI_AUDIT table pertaining to industrial users,
i.e. the number of significant industrial users.
>>> PCS().industrial_user('insp_date', '16-MAR-01')
"""
return self._resolve_call('PCS_... | [
"def",
"industrial_user",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_INDUSTRIAL_USER_INFO'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwarg... | Information from the PCI_AUDIT table pertaining to industrial users,
i.e. the number of significant industrial users.
>>> PCS().industrial_user('insp_date', '16-MAR-01') | [
"Information",
"from",
"the",
"PCI_AUDIT",
"table",
"pertaining",
"to",
"industrial",
"users",
"i",
".",
"e",
".",
"the",
"number",
"of",
"significant",
"industrial",
"users",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L124-L132 |
38,397 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.permit_event | def permit_event(self, column=None, value=None, **kwargs):
"""
A permit event tracks the lifecycle of a permit from issuance to
expiration. Examples include 'Application Received' and 'Permit
Issued', etc.
>>> PCS().permit_event('event_actual_date', '16-MAR-04')
"""
... | python | def permit_event(self, column=None, value=None, **kwargs):
"""
A permit event tracks the lifecycle of a permit from issuance to
expiration. Examples include 'Application Received' and 'Permit
Issued', etc.
>>> PCS().permit_event('event_actual_date', '16-MAR-04')
"""
... | [
"def",
"permit_event",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_PERMIT_EVENT'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | A permit event tracks the lifecycle of a permit from issuance to
expiration. Examples include 'Application Received' and 'Permit
Issued', etc.
>>> PCS().permit_event('event_actual_date', '16-MAR-04') | [
"A",
"permit",
"event",
"tracks",
"the",
"lifecycle",
"of",
"a",
"permit",
"from",
"issuance",
"to",
"expiration",
".",
"Examples",
"include",
"Application",
"Received",
"and",
"Permit",
"Issued",
"etc",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L144-L152 |
38,398 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.pipe_schedule | def pipe_schedule(self, column=None, value=None, **kwargs):
"""
Particular discharge points at a permit facility that are governed by
effluent limitations and monitoring and submission requirements.
>>> PCS().pipe_schedule('state_submission_units', 'M')
"""
return self._... | python | def pipe_schedule(self, column=None, value=None, **kwargs):
"""
Particular discharge points at a permit facility that are governed by
effluent limitations and monitoring and submission requirements.
>>> PCS().pipe_schedule('state_submission_units', 'M')
"""
return self._... | [
"def",
"pipe_schedule",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_PIPE_SCHED'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Particular discharge points at a permit facility that are governed by
effluent limitations and monitoring and submission requirements.
>>> PCS().pipe_schedule('state_submission_units', 'M') | [
"Particular",
"discharge",
"points",
"at",
"a",
"permit",
"facility",
"that",
"are",
"governed",
"by",
"effluent",
"limitations",
"and",
"monitoring",
"and",
"submission",
"requirements",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L154-L161 |
38,399 | codeforamerica/epa_python | epa/pcs/pcs.py | PCS.single_violation | def single_violation(self, column=None, value=None, **kwargs):
"""
A single event violation is a one-time event that occurred on a fixed
date, and is associated with one permitted facility.
>>> PCS().single_violation('single_event_viol_date', '16-MAR-01')
"""
return self... | python | def single_violation(self, column=None, value=None, **kwargs):
"""
A single event violation is a one-time event that occurred on a fixed
date, and is associated with one permitted facility.
>>> PCS().single_violation('single_event_viol_date', '16-MAR-01')
"""
return self... | [
"def",
"single_violation",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'PCS_SINGLE_EVENT_VIOL'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs"... | A single event violation is a one-time event that occurred on a fixed
date, and is associated with one permitted facility.
>>> PCS().single_violation('single_event_viol_date', '16-MAR-01') | [
"A",
"single",
"event",
"violation",
"is",
"a",
"one",
"-",
"time",
"event",
"that",
"occurred",
"on",
"a",
"fixed",
"date",
"and",
"is",
"associated",
"with",
"one",
"permitted",
"facility",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L163-L171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.