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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
245,400 | GemHQ/round-py | round/accounts.py | Accounts.create | def create(self, name, network):
"""Create a new Account object and add it to this Accounts collection.
Args:
name (str): Account name
network (str): Type of cryptocurrency. Can be one of, 'bitcoin', '
bitcoin_testnet', 'litecoin', 'dogecoin'.
Returns: The new ... | python | def create(self, name, network):
"""Create a new Account object and add it to this Accounts collection.
Args:
name (str): Account name
network (str): Type of cryptocurrency. Can be one of, 'bitcoin', '
bitcoin_testnet', 'litecoin', 'dogecoin'.
Returns: The new ... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"network",
")",
":",
"if",
"not",
"network",
"in",
"SUPPORTED_NETWORKS",
":",
"raise",
"ValueError",
"(",
"'Network not valid!'",
")",
"account",
"=",
"self",
".",
"wrap",
"(",
"self",
".",
"resource",
".",
... | Create a new Account object and add it to this Accounts collection.
Args:
name (str): Account name
network (str): Type of cryptocurrency. Can be one of, 'bitcoin', '
bitcoin_testnet', 'litecoin', 'dogecoin'.
Returns: The new round.Account | [
"Create",
"a",
"new",
"Account",
"object",
"and",
"add",
"it",
"to",
"this",
"Accounts",
"collection",
"."
] | d0838f849cd260b1eb5df67ed3c6f2fe56c91c21 | https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L50-L65 |
245,401 | GemHQ/round-py | round/accounts.py | Account.update | def update(self, **kwargs):
"""Update the Account resource with specified content.
Args:
name (str): Human-readable name for the account
Returns: the updated Account object.
"""
return self.__class__(self.resource.update(kwargs),
self.cli... | python | def update(self, **kwargs):
"""Update the Account resource with specified content.
Args:
name (str): Human-readable name for the account
Returns: the updated Account object.
"""
return self.__class__(self.resource.update(kwargs),
self.cli... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"resource",
".",
"update",
"(",
"kwargs",
")",
",",
"self",
".",
"client",
",",
"wallet",
"=",
"self",
".",
"wallet",
")"
] | Update the Account resource with specified content.
Args:
name (str): Human-readable name for the account
Returns: the updated Account object. | [
"Update",
"the",
"Account",
"resource",
"with",
"specified",
"content",
"."
] | d0838f849cd260b1eb5df67ed3c6f2fe56c91c21 | https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L89-L99 |
245,402 | GemHQ/round-py | round/accounts.py | Account.pay | def pay(self, payees, change_account=None, utxo_confirmations=6,
mfa_token=None, redirect_uri=None):
"""Create, verify, and sign a new Transaction.
If this Account is owned by a User object, the user must be redirected to
a URL (`mfa_uri`) returned by this call to input their MFA to... | python | def pay(self, payees, change_account=None, utxo_confirmations=6,
mfa_token=None, redirect_uri=None):
"""Create, verify, and sign a new Transaction.
If this Account is owned by a User object, the user must be redirected to
a URL (`mfa_uri`) returned by this call to input their MFA to... | [
"def",
"pay",
"(",
"self",
",",
"payees",
",",
"change_account",
"=",
"None",
",",
"utxo_confirmations",
"=",
"6",
",",
"mfa_token",
"=",
"None",
",",
"redirect_uri",
"=",
"None",
")",
":",
"# Check that wallet is unlocked",
"if",
"self",
".",
"wallet",
".",... | Create, verify, and sign a new Transaction.
If this Account is owned by a User object, the user must be redirected to
a URL (`mfa_uri`) returned by this call to input their MFA token. After
they complete that step, the Transaction will be approved and published
to the bitcoin network. I... | [
"Create",
"verify",
"and",
"sign",
"a",
"new",
"Transaction",
"."
] | d0838f849cd260b1eb5df67ed3c6f2fe56c91c21 | https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L101-L191 |
245,403 | GemHQ/round-py | round/accounts.py | Account.get_addresses | def get_addresses(self, fetch=False):
"""Return the Account's addresses object, populating it if fetch is True."""
return Addresses(self.resource.addresses, self.client, populate=fetch) | python | def get_addresses(self, fetch=False):
"""Return the Account's addresses object, populating it if fetch is True."""
return Addresses(self.resource.addresses, self.client, populate=fetch) | [
"def",
"get_addresses",
"(",
"self",
",",
"fetch",
"=",
"False",
")",
":",
"return",
"Addresses",
"(",
"self",
".",
"resource",
".",
"addresses",
",",
"self",
".",
"client",
",",
"populate",
"=",
"fetch",
")"
] | Return the Account's addresses object, populating it if fetch is True. | [
"Return",
"the",
"Account",
"s",
"addresses",
"object",
"populating",
"it",
"if",
"fetch",
"is",
"True",
"."
] | d0838f849cd260b1eb5df67ed3c6f2fe56c91c21 | https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L251-L253 |
245,404 | GemHQ/round-py | round/accounts.py | Account.get_netki_names | def get_netki_names(self, fetch=False):
"""Return the Account's NetkiNames object, populating it if fetch is True."""
return NetkiNames(self.resource.netki_names, self.client, populate=fetch) | python | def get_netki_names(self, fetch=False):
"""Return the Account's NetkiNames object, populating it if fetch is True."""
return NetkiNames(self.resource.netki_names, self.client, populate=fetch) | [
"def",
"get_netki_names",
"(",
"self",
",",
"fetch",
"=",
"False",
")",
":",
"return",
"NetkiNames",
"(",
"self",
".",
"resource",
".",
"netki_names",
",",
"self",
".",
"client",
",",
"populate",
"=",
"fetch",
")"
] | Return the Account's NetkiNames object, populating it if fetch is True. | [
"Return",
"the",
"Account",
"s",
"NetkiNames",
"object",
"populating",
"it",
"if",
"fetch",
"is",
"True",
"."
] | d0838f849cd260b1eb5df67ed3c6f2fe56c91c21 | https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L261-L263 |
245,405 | tonyseek/html5lib-truncation | html5lib_truncation/shortcuts.py | truncate_html | def truncate_html(html, *args, **kwargs):
"""Truncates HTML string.
:param html: The HTML string or parsed element tree (with
:func:`html5lib.parse`).
:param kwargs: Similar with :class:`.filters.TruncationFilter`.
:return: The truncated HTML string.
"""
if hasattr(html, 'getc... | python | def truncate_html(html, *args, **kwargs):
"""Truncates HTML string.
:param html: The HTML string or parsed element tree (with
:func:`html5lib.parse`).
:param kwargs: Similar with :class:`.filters.TruncationFilter`.
:return: The truncated HTML string.
"""
if hasattr(html, 'getc... | [
"def",
"truncate_html",
"(",
"html",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"html",
",",
"'getchildren'",
")",
":",
"etree",
"=",
"html",
"else",
":",
"etree",
"=",
"html5lib",
".",
"parse",
"(",
"html",
")",
"wa... | Truncates HTML string.
:param html: The HTML string or parsed element tree (with
:func:`html5lib.parse`).
:param kwargs: Similar with :class:`.filters.TruncationFilter`.
:return: The truncated HTML string. | [
"Truncates",
"HTML",
"string",
"."
] | b5551e345e583d04dbdf6b97dc2a43a266eec8d6 | https://github.com/tonyseek/html5lib-truncation/blob/b5551e345e583d04dbdf6b97dc2a43a266eec8d6/html5lib_truncation/shortcuts.py#L8-L30 |
245,406 | s-m-i-t-a/flask-musers | flask_musers/models.py | is_allowed | def is_allowed(func):
"""Check user password, when is correct, then run decorated function.
:returns: decorated function
"""
@wraps(func)
def _is_allowed(user, *args, **kwargs):
password = kwargs.pop('password', None)
if user.check_password(password):
return func(user, ... | python | def is_allowed(func):
"""Check user password, when is correct, then run decorated function.
:returns: decorated function
"""
@wraps(func)
def _is_allowed(user, *args, **kwargs):
password = kwargs.pop('password', None)
if user.check_password(password):
return func(user, ... | [
"def",
"is_allowed",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"_is_allowed",
"(",
"user",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"password",
"=",
"kwargs",
".",
"pop",
"(",
"'password'",
",",
"None",
")",
"if",
... | Check user password, when is correct, then run decorated function.
:returns: decorated function | [
"Check",
"user",
"password",
"when",
"is",
"correct",
"then",
"run",
"decorated",
"function",
"."
] | 6becb5de4e8908f878ce173560c3cab4b297b0e0 | https://github.com/s-m-i-t-a/flask-musers/blob/6becb5de4e8908f878ce173560c3cab4b297b0e0/flask_musers/models.py#L78-L100 |
245,407 | dossier/dossier.label | dossier/label/run.py | App.do_get | def do_get(self, args):
'''Get labels directly connected to a content item.'''
for label in self.label_store.directly_connected(args.content_id):
if args.value is None or label.value.value == args.value:
self.stdout.write('{0}\n'.format(label)) | python | def do_get(self, args):
'''Get labels directly connected to a content item.'''
for label in self.label_store.directly_connected(args.content_id):
if args.value is None or label.value.value == args.value:
self.stdout.write('{0}\n'.format(label)) | [
"def",
"do_get",
"(",
"self",
",",
"args",
")",
":",
"for",
"label",
"in",
"self",
".",
"label_store",
".",
"directly_connected",
"(",
"args",
".",
"content_id",
")",
":",
"if",
"args",
".",
"value",
"is",
"None",
"or",
"label",
".",
"value",
".",
"v... | Get labels directly connected to a content item. | [
"Get",
"labels",
"directly",
"connected",
"to",
"a",
"content",
"item",
"."
] | d445e56b02ffd91ad46b0872cfbff62b9afef7ec | https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/run.py#L155-L159 |
245,408 | dossier/dossier.label | dossier/label/run.py | App.do_connected | def do_connected(self, args):
'''Find a connected component from positive labels on an item.'''
connected = self.label_store.connected_component(args.content_id)
for label in connected:
self.stdout.write('{0}\n'.format(label)) | python | def do_connected(self, args):
'''Find a connected component from positive labels on an item.'''
connected = self.label_store.connected_component(args.content_id)
for label in connected:
self.stdout.write('{0}\n'.format(label)) | [
"def",
"do_connected",
"(",
"self",
",",
"args",
")",
":",
"connected",
"=",
"self",
".",
"label_store",
".",
"connected_component",
"(",
"args",
".",
"content_id",
")",
"for",
"label",
"in",
"connected",
":",
"self",
".",
"stdout",
".",
"write",
"(",
"'... | Find a connected component from positive labels on an item. | [
"Find",
"a",
"connected",
"component",
"from",
"positive",
"labels",
"on",
"an",
"item",
"."
] | d445e56b02ffd91ad46b0872cfbff62b9afef7ec | https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/run.py#L165-L169 |
245,409 | IntegralDefense/vxstreamlib | bin/vxstreamlib.py | VxStreamSubmissionManager.wait | def wait(self):
"""Waits for all submitted jobs to complete."""
logging.info("waiting for {} jobs to complete".format(len(self.submissions)))
while not self.shutdown:
time.sleep(1) | python | def wait(self):
"""Waits for all submitted jobs to complete."""
logging.info("waiting for {} jobs to complete".format(len(self.submissions)))
while not self.shutdown:
time.sleep(1) | [
"def",
"wait",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"waiting for {} jobs to complete\"",
".",
"format",
"(",
"len",
"(",
"self",
".",
"submissions",
")",
")",
")",
"while",
"not",
"self",
".",
"shutdown",
":",
"time",
".",
"sleep",
"(",
... | Waits for all submitted jobs to complete. | [
"Waits",
"for",
"all",
"submitted",
"jobs",
"to",
"complete",
"."
] | cd82e3975215085cf929c5976f37083b9a3ac869 | https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L185-L189 |
245,410 | IntegralDefense/vxstreamlib | bin/vxstreamlib.py | VxStreamServer.download_dropped_files | def download_dropped_files(self, sha256, environment_id, target_dir):
"""Downloads the dropped files for this sample into target_dir. Returns the list of files extracted."""
download_url = '{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'.format(
self.url,
s... | python | def download_dropped_files(self, sha256, environment_id, target_dir):
"""Downloads the dropped files for this sample into target_dir. Returns the list of files extracted."""
download_url = '{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'.format(
self.url,
s... | [
"def",
"download_dropped_files",
"(",
"self",
",",
"sha256",
",",
"environment_id",
",",
"target_dir",
")",
":",
"download_url",
"=",
"'{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'",
".",
"format",
"(",
"self",
".",
"url",
",",
"sha256",
",",
"... | Downloads the dropped files for this sample into target_dir. Returns the list of files extracted. | [
"Downloads",
"the",
"dropped",
"files",
"for",
"this",
"sample",
"into",
"target_dir",
".",
"Returns",
"the",
"list",
"of",
"files",
"extracted",
"."
] | cd82e3975215085cf929c5976f37083b9a3ac869 | https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L355-L436 |
245,411 | IntegralDefense/vxstreamlib | bin/vxstreamlib.py | VxStreamServer.download_memory_dump | def download_memory_dump(self, sha256, environment_id, dest_dir):
"""Downloads the given memory dump into the given directory. Returns a tuple of a list of files extracted from what was downloaded, and the path to the combined memory dump."""
dest_path = os.path.join(dest_dir, 'memory.zip')
if... | python | def download_memory_dump(self, sha256, environment_id, dest_dir):
"""Downloads the given memory dump into the given directory. Returns a tuple of a list of files extracted from what was downloaded, and the path to the combined memory dump."""
dest_path = os.path.join(dest_dir, 'memory.zip')
if... | [
"def",
"download_memory_dump",
"(",
"self",
",",
"sha256",
",",
"environment_id",
",",
"dest_dir",
")",
":",
"dest_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dest_dir",
",",
"'memory.zip'",
")",
"if",
"self",
".",
"download",
"(",
"sha256",
",",
"... | Downloads the given memory dump into the given directory. Returns a tuple of a list of files extracted from what was downloaded, and the path to the combined memory dump. | [
"Downloads",
"the",
"given",
"memory",
"dump",
"into",
"the",
"given",
"directory",
".",
"Returns",
"a",
"tuple",
"of",
"a",
"list",
"of",
"files",
"extracted",
"from",
"what",
"was",
"downloaded",
"and",
"the",
"path",
"to",
"the",
"combined",
"memory",
"... | cd82e3975215085cf929c5976f37083b9a3ac869 | https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L438-L472 |
245,412 | emory-libraries/eulcommon | eulcommon/binfile/outlookexpress.py | MacMailMessage.data | def data(self):
'''email content for this message'''
# return data after any initial offset, plus content offset to
# skip header, up to the size of this message
return self.mmap[self.content_offset + self._offset: self._offset + self.size] | python | def data(self):
'''email content for this message'''
# return data after any initial offset, plus content offset to
# skip header, up to the size of this message
return self.mmap[self.content_offset + self._offset: self._offset + self.size] | [
"def",
"data",
"(",
"self",
")",
":",
"# return data after any initial offset, plus content offset to",
"# skip header, up to the size of this message",
"return",
"self",
".",
"mmap",
"[",
"self",
".",
"content_offset",
"+",
"self",
".",
"_offset",
":",
"self",
".",
"_o... | email content for this message | [
"email",
"content",
"for",
"this",
"message"
] | dc63a9b3b5e38205178235e0d716d1b28158d3a9 | https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/outlookexpress.py#L166-L170 |
245,413 | fakedrake/overlay_parse | overlay_parse/overlays.py | Overlay.copy | def copy(self, props=None, value=None):
"""
Copy the Overlay possibly overriding props.
"""
return Overlay(self.text,
(self.start, self.end),
props=props or self.props,
value=value or self.value) | python | def copy(self, props=None, value=None):
"""
Copy the Overlay possibly overriding props.
"""
return Overlay(self.text,
(self.start, self.end),
props=props or self.props,
value=value or self.value) | [
"def",
"copy",
"(",
"self",
",",
"props",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"return",
"Overlay",
"(",
"self",
".",
"text",
",",
"(",
"self",
".",
"start",
",",
"self",
".",
"end",
")",
",",
"props",
"=",
"props",
"or",
"self",
"... | Copy the Overlay possibly overriding props. | [
"Copy",
"the",
"Overlay",
"possibly",
"overriding",
"props",
"."
] | 9ac362d6aef1ea41aff7375af088c6ebef93d0cd | https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L41-L49 |
245,414 | fakedrake/overlay_parse | overlay_parse/overlays.py | Overlay.match | def match(self, props=None, rng=None, offset=None):
"""
Provide any of the args and match or dont.
:param props: Should be a subset of my props.
:param rng: Exactly match my range.
:param offset: I start after this offset.
:returns: True if all the provided predicates ma... | python | def match(self, props=None, rng=None, offset=None):
"""
Provide any of the args and match or dont.
:param props: Should be a subset of my props.
:param rng: Exactly match my range.
:param offset: I start after this offset.
:returns: True if all the provided predicates ma... | [
"def",
"match",
"(",
"self",
",",
"props",
"=",
"None",
",",
"rng",
"=",
"None",
",",
"offset",
"=",
"None",
")",
":",
"if",
"rng",
":",
"s",
",",
"e",
"=",
"rng",
"else",
":",
"e",
"=",
"s",
"=",
"None",
"return",
"(",
"(",
"e",
"is",
"Non... | Provide any of the args and match or dont.
:param props: Should be a subset of my props.
:param rng: Exactly match my range.
:param offset: I start after this offset.
:returns: True if all the provided predicates match or are None | [
"Provide",
"any",
"of",
"the",
"args",
"and",
"match",
"or",
"dont",
"."
] | 9ac362d6aef1ea41aff7375af088c6ebef93d0cd | https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L106-L124 |
245,415 | fakedrake/overlay_parse | overlay_parse/overlays.py | OverlayedText.overlays_at | def overlays_at(self, key):
"""
Key may be a slice or a point.
"""
if isinstance(key, slice):
s, e, _ = key.indices(len(self.text))
else:
s = e = key
return [o for o in self.overlays if o.start in Rng(s, e)] | python | def overlays_at(self, key):
"""
Key may be a slice or a point.
"""
if isinstance(key, slice):
s, e, _ = key.indices(len(self.text))
else:
s = e = key
return [o for o in self.overlays if o.start in Rng(s, e)] | [
"def",
"overlays_at",
"(",
"self",
",",
"key",
")",
":",
"if",
"isinstance",
"(",
"key",
",",
"slice",
")",
":",
"s",
",",
"e",
",",
"_",
"=",
"key",
".",
"indices",
"(",
"len",
"(",
"self",
".",
"text",
")",
")",
"else",
":",
"s",
"=",
"e",
... | Key may be a slice or a point. | [
"Key",
"may",
"be",
"a",
"slice",
"or",
"a",
"point",
"."
] | 9ac362d6aef1ea41aff7375af088c6ebef93d0cd | https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L164-L174 |
245,416 | fakedrake/overlay_parse | overlay_parse/overlays.py | OverlayedText.overlay | def overlay(self, matchers, force=False):
"""
Given a list of matchers create overlays based on them. Normally I
will remember what overlays were run this way and will avoid
re-running them but you can `force` me to. This is the
recommended way of running overlays.c
"""
... | python | def overlay(self, matchers, force=False):
"""
Given a list of matchers create overlays based on them. Normally I
will remember what overlays were run this way and will avoid
re-running them but you can `force` me to. This is the
recommended way of running overlays.c
"""
... | [
"def",
"overlay",
"(",
"self",
",",
"matchers",
",",
"force",
"=",
"False",
")",
":",
"for",
"m",
"in",
"matchers",
":",
"if",
"m",
"in",
"self",
".",
"_ran_matchers",
":",
"continue",
"self",
".",
"_ran_matchers",
".",
"append",
"(",
"m",
")",
"self... | Given a list of matchers create overlays based on them. Normally I
will remember what overlays were run this way and will avoid
re-running them but you can `force` me to. This is the
recommended way of running overlays.c | [
"Given",
"a",
"list",
"of",
"matchers",
"create",
"overlays",
"based",
"on",
"them",
".",
"Normally",
"I",
"will",
"remember",
"what",
"overlays",
"were",
"run",
"this",
"way",
"and",
"will",
"avoid",
"re",
"-",
"running",
"them",
"but",
"you",
"can",
"f... | 9ac362d6aef1ea41aff7375af088c6ebef93d0cd | https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L176-L191 |
245,417 | icio/evil | evil/__init__.py | evil | def evil(expr, lookup, operators, cast, reducer, tokenizer):
"""evil evaluates an expression according to the eval description given.
:param expr: An expression to evaluate.
:param lookup: A callable which takes a single pattern argument and returns
a set of results. The pattern can be a... | python | def evil(expr, lookup, operators, cast, reducer, tokenizer):
"""evil evaluates an expression according to the eval description given.
:param expr: An expression to evaluate.
:param lookup: A callable which takes a single pattern argument and returns
a set of results. The pattern can be a... | [
"def",
"evil",
"(",
"expr",
",",
"lookup",
",",
"operators",
",",
"cast",
",",
"reducer",
",",
"tokenizer",
")",
":",
"operators",
"=",
"OrderedDict",
"(",
"(",
"op",
"[",
"0",
"]",
",",
"op",
"[",
"1",
":",
"]",
")",
"for",
"op",
"in",
"operator... | evil evaluates an expression according to the eval description given.
:param expr: An expression to evaluate.
:param lookup: A callable which takes a single pattern argument and returns
a set of results. The pattern can be anything that is not an
operator token or round br... | [
"evil",
"evaluates",
"an",
"expression",
"according",
"to",
"the",
"eval",
"description",
"given",
"."
] | 6f12d16652951fb60ac238cef203eaa585ec0a28 | https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L13-L137 |
245,418 | icio/evil | evil/__init__.py | op | def op(token, func, left=False, right=False):
"""op provides a more verbose syntax for declaring operators.
:param token: The string token of the operator. Usually a single character.
:param func: A callable used to evaluate its arguments. Where the operator
is both-sided the callable shou... | python | def op(token, func, left=False, right=False):
"""op provides a more verbose syntax for declaring operators.
:param token: The string token of the operator. Usually a single character.
:param func: A callable used to evaluate its arguments. Where the operator
is both-sided the callable shou... | [
"def",
"op",
"(",
"token",
",",
"func",
",",
"left",
"=",
"False",
",",
"right",
"=",
"False",
")",
":",
"both",
"=",
"(",
"left",
"==",
"right",
")",
"return",
"(",
"token",
",",
"func",
",",
"OP_BOTH",
"if",
"both",
"else",
"OP_LEFT",
"if",
"le... | op provides a more verbose syntax for declaring operators.
:param token: The string token of the operator. Usually a single character.
:param func: A callable used to evaluate its arguments. Where the operator
is both-sided the callable should accept two arguments. Where
it is... | [
"op",
"provides",
"a",
"more",
"verbose",
"syntax",
"for",
"declaring",
"operators",
"."
] | 6f12d16652951fb60ac238cef203eaa585ec0a28 | https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L164-L180 |
245,419 | icio/evil | evil/__init__.py | globlookup | def globlookup(pattern, root):
"""globlookup finds filesystem objects whose relative path matches the
given pattern.
:param pattern: The pattern to wish to match relative filepaths to.
:param root: The root director to search within.
"""
for subdir, dirnames, filenames in os.walk(root):
... | python | def globlookup(pattern, root):
"""globlookup finds filesystem objects whose relative path matches the
given pattern.
:param pattern: The pattern to wish to match relative filepaths to.
:param root: The root director to search within.
"""
for subdir, dirnames, filenames in os.walk(root):
... | [
"def",
"globlookup",
"(",
"pattern",
",",
"root",
")",
":",
"for",
"subdir",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"root",
")",
":",
"d",
"=",
"subdir",
"[",
"len",
"(",
"root",
")",
"+",
"1",
":",
"]",
"files",
"=",
... | globlookup finds filesystem objects whose relative path matches the
given pattern.
:param pattern: The pattern to wish to match relative filepaths to.
:param root: The root director to search within. | [
"globlookup",
"finds",
"filesystem",
"objects",
"whose",
"relative",
"path",
"matches",
"the",
"given",
"pattern",
"."
] | 6f12d16652951fb60ac238cef203eaa585ec0a28 | https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L193-L205 |
245,420 | sassoo/goldman | goldman/resources/related.py | Resource.on_get | def on_get(self, req, resp, rid, related):
""" Find the related model & serialize it back
If the parent resource of the related model doesn't
exist then abort on a 404.
"""
signals.pre_req.send(self.model)
signals.pre_req_find.send(self.model)
if not hasattr(se... | python | def on_get(self, req, resp, rid, related):
""" Find the related model & serialize it back
If the parent resource of the related model doesn't
exist then abort on a 404.
"""
signals.pre_req.send(self.model)
signals.pre_req_find.send(self.model)
if not hasattr(se... | [
"def",
"on_get",
"(",
"self",
",",
"req",
",",
"resp",
",",
"rid",
",",
"related",
")",
":",
"signals",
".",
"pre_req",
".",
"send",
"(",
"self",
".",
"model",
")",
"signals",
".",
"pre_req_find",
".",
"send",
"(",
"self",
".",
"model",
")",
"if",
... | Find the related model & serialize it back
If the parent resource of the related model doesn't
exist then abort on a 404. | [
"Find",
"the",
"related",
"model",
"&",
"serialize",
"it",
"back"
] | b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2 | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/related.py#L43-L76 |
245,421 | PyMLGame/pymlgame | emulator.py | Emu.recv_data | def recv_data(self):
"""
Grab the next frame and put it on the matrix.
"""
data, addr = self.sock.recvfrom(self.packetsize)
matrix = map(ord, data.strip())
if len(matrix) == self.packetsize:
self.matrix = matrix[:-4] | python | def recv_data(self):
"""
Grab the next frame and put it on the matrix.
"""
data, addr = self.sock.recvfrom(self.packetsize)
matrix = map(ord, data.strip())
if len(matrix) == self.packetsize:
self.matrix = matrix[:-4] | [
"def",
"recv_data",
"(",
"self",
")",
":",
"data",
",",
"addr",
"=",
"self",
".",
"sock",
".",
"recvfrom",
"(",
"self",
".",
"packetsize",
")",
"matrix",
"=",
"map",
"(",
"ord",
",",
"data",
".",
"strip",
"(",
")",
")",
"if",
"len",
"(",
"matrix"... | Grab the next frame and put it on the matrix. | [
"Grab",
"the",
"next",
"frame",
"and",
"put",
"it",
"on",
"the",
"matrix",
"."
] | 450fe77d35f9a26c107586d6954f69c3895bf504 | https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/emulator.py#L67-L74 |
245,422 | PyMLGame/pymlgame | emulator.py | Emu.update | def update(self):
"""
Generate the output from the matrix.
"""
pixels = len(self.matrix)
for x in range(self.width):
for y in range(self.height):
pixel = y * self.width * 3 + x * 3
#TODO: sometimes the matrix is not as big as it should
... | python | def update(self):
"""
Generate the output from the matrix.
"""
pixels = len(self.matrix)
for x in range(self.width):
for y in range(self.height):
pixel = y * self.width * 3 + x * 3
#TODO: sometimes the matrix is not as big as it should
... | [
"def",
"update",
"(",
"self",
")",
":",
"pixels",
"=",
"len",
"(",
"self",
".",
"matrix",
")",
"for",
"x",
"in",
"range",
"(",
"self",
".",
"width",
")",
":",
"for",
"y",
"in",
"range",
"(",
"self",
".",
"height",
")",
":",
"pixel",
"=",
"y",
... | Generate the output from the matrix. | [
"Generate",
"the",
"output",
"from",
"the",
"matrix",
"."
] | 450fe77d35f9a26c107586d6954f69c3895bf504 | https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/emulator.py#L76-L88 |
245,423 | PyMLGame/pymlgame | emulator.py | Emu.gameloop | def gameloop(self):
"""
Loop through all the necessary stuff and end execution when Ctrl+C was hit.
"""
try:
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
i... | python | def gameloop(self):
"""
Loop through all the necessary stuff and end execution when Ctrl+C was hit.
"""
try:
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
i... | [
"def",
"gameloop",
"(",
"self",
")",
":",
"try",
":",
"while",
"True",
":",
"for",
"event",
"in",
"pygame",
".",
"event",
".",
"get",
"(",
")",
":",
"if",
"event",
".",
"type",
"==",
"pygame",
".",
"QUIT",
":",
"sys",
".",
"exit",
"(",
")",
"if... | Loop through all the necessary stuff and end execution when Ctrl+C was hit. | [
"Loop",
"through",
"all",
"the",
"necessary",
"stuff",
"and",
"end",
"execution",
"when",
"Ctrl",
"+",
"C",
"was",
"hit",
"."
] | 450fe77d35f9a26c107586d6954f69c3895bf504 | https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/emulator.py#L97-L114 |
245,424 | maxfischer2781/chainlet | chainlet/wrapper.py | getname | def getname(obj):
"""
Return the most qualified name of an object
:param obj: object to fetch name
:return: name of ``obj``
"""
for name_attribute in ('__qualname__', '__name__'):
try:
# an object always has a class, as per Python data model
return getattr(obj, n... | python | def getname(obj):
"""
Return the most qualified name of an object
:param obj: object to fetch name
:return: name of ``obj``
"""
for name_attribute in ('__qualname__', '__name__'):
try:
# an object always has a class, as per Python data model
return getattr(obj, n... | [
"def",
"getname",
"(",
"obj",
")",
":",
"for",
"name_attribute",
"in",
"(",
"'__qualname__'",
",",
"'__name__'",
")",
":",
"try",
":",
"# an object always has a class, as per Python data model",
"return",
"getattr",
"(",
"obj",
",",
"name_attribute",
",",
"getattr",... | Return the most qualified name of an object
:param obj: object to fetch name
:return: name of ``obj`` | [
"Return",
"the",
"most",
"qualified",
"name",
"of",
"an",
"object"
] | 4e17f9992b4780bd0d9309202e2847df640bffe8 | https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/wrapper.py#L5-L18 |
245,425 | maxfischer2781/chainlet | chainlet/wrapper.py | WrapperMixin.wraplet | def wraplet(cls, *cls_args, **cls_kwargs):
"""
Create a factory to produce a Wrapper from a slave factory
:param cls_args: positional arguments to provide to the Wrapper class
:param cls_kwargs: keyword arguments to provide to the Wrapper class
:return:
.. code:: python... | python | def wraplet(cls, *cls_args, **cls_kwargs):
"""
Create a factory to produce a Wrapper from a slave factory
:param cls_args: positional arguments to provide to the Wrapper class
:param cls_kwargs: keyword arguments to provide to the Wrapper class
:return:
.. code:: python... | [
"def",
"wraplet",
"(",
"cls",
",",
"*",
"cls_args",
",",
"*",
"*",
"cls_kwargs",
")",
":",
"if",
"cls",
".",
"__init_slave__",
"in",
"(",
"None",
",",
"WrapperMixin",
".",
"__init_slave__",
")",
":",
"raise",
"TypeError",
"(",
"'type %r does not implement th... | Create a factory to produce a Wrapper from a slave factory
:param cls_args: positional arguments to provide to the Wrapper class
:param cls_kwargs: keyword arguments to provide to the Wrapper class
:return:
.. code:: python
cls_wrapper_factory = cls.wraplet(*cls_args, **cl... | [
"Create",
"a",
"factory",
"to",
"produce",
"a",
"Wrapper",
"from",
"a",
"slave",
"factory"
] | 4e17f9992b4780bd0d9309202e2847df640bffe8 | https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/wrapper.py#L87-L164 |
245,426 | ronaldguillen/wave | wave/authentication.py | BasicAuthentication.authenticate | def authenticate(self, request):
"""
Returns a `User` if a correct username and password have been supplied
using HTTP Basic authentication. Otherwise returns `None`.
"""
auth = get_authorization_header(request).split()
if not auth or auth[0].lower() != b'basic':
... | python | def authenticate(self, request):
"""
Returns a `User` if a correct username and password have been supplied
using HTTP Basic authentication. Otherwise returns `None`.
"""
auth = get_authorization_header(request).split()
if not auth or auth[0].lower() != b'basic':
... | [
"def",
"authenticate",
"(",
"self",
",",
"request",
")",
":",
"auth",
"=",
"get_authorization_header",
"(",
"request",
")",
".",
"split",
"(",
")",
"if",
"not",
"auth",
"or",
"auth",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"!=",
"b'basic'",
":",
"retu... | Returns a `User` if a correct username and password have been supplied
using HTTP Basic authentication. Otherwise returns `None`. | [
"Returns",
"a",
"User",
"if",
"a",
"correct",
"username",
"and",
"password",
"have",
"been",
"supplied",
"using",
"HTTP",
"Basic",
"authentication",
".",
"Otherwise",
"returns",
"None",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/authentication.py#L61-L85 |
245,427 | ronaldguillen/wave | wave/authentication.py | BasicAuthentication.authenticate_credentials | def authenticate_credentials(self, userid, password):
"""
Authenticate the userid and password against username and password.
"""
credentials = {
get_user_model().USERNAME_FIELD: userid,
'password': password
}
user = authenticate(**credentials)
... | python | def authenticate_credentials(self, userid, password):
"""
Authenticate the userid and password against username and password.
"""
credentials = {
get_user_model().USERNAME_FIELD: userid,
'password': password
}
user = authenticate(**credentials)
... | [
"def",
"authenticate_credentials",
"(",
"self",
",",
"userid",
",",
"password",
")",
":",
"credentials",
"=",
"{",
"get_user_model",
"(",
")",
".",
"USERNAME_FIELD",
":",
"userid",
",",
"'password'",
":",
"password",
"}",
"user",
"=",
"authenticate",
"(",
"*... | Authenticate the userid and password against username and password. | [
"Authenticate",
"the",
"userid",
"and",
"password",
"against",
"username",
"and",
"password",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/authentication.py#L87-L103 |
245,428 | ronaldguillen/wave | wave/authentication.py | SessionAuthentication.enforce_csrf | def enforce_csrf(self, request):
"""
Enforce CSRF validation for session based authentication.
"""
reason = CSRFCheck().process_view(request, None, (), {})
if reason:
# CSRF failed, bail with explicit error message
raise exceptions.PermissionDenied('CSRF F... | python | def enforce_csrf(self, request):
"""
Enforce CSRF validation for session based authentication.
"""
reason = CSRFCheck().process_view(request, None, (), {})
if reason:
# CSRF failed, bail with explicit error message
raise exceptions.PermissionDenied('CSRF F... | [
"def",
"enforce_csrf",
"(",
"self",
",",
"request",
")",
":",
"reason",
"=",
"CSRFCheck",
"(",
")",
".",
"process_view",
"(",
"request",
",",
"None",
",",
"(",
")",
",",
"{",
"}",
")",
"if",
"reason",
":",
"# CSRF failed, bail with explicit error message",
... | Enforce CSRF validation for session based authentication. | [
"Enforce",
"CSRF",
"validation",
"for",
"session",
"based",
"authentication",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/authentication.py#L132-L139 |
245,429 | fusionapp/fusion-util | fusion_util/enums.py | filter_enum | def filter_enum(pred, enum):
"""
Create a new enumeration containing only items filtered from another
enumeration.
Hidden enum items in the original enumeration are excluded.
:type pred: ``Callable[[`EnumItem`], bool]``
:param pred: Predicate that will keep items for which the result is true.
... | python | def filter_enum(pred, enum):
"""
Create a new enumeration containing only items filtered from another
enumeration.
Hidden enum items in the original enumeration are excluded.
:type pred: ``Callable[[`EnumItem`], bool]``
:param pred: Predicate that will keep items for which the result is true.
... | [
"def",
"filter_enum",
"(",
"pred",
",",
"enum",
")",
":",
"def",
"_items",
"(",
")",
":",
"for",
"item",
"in",
"enum",
":",
"yield",
"EnumItem",
"(",
"item",
".",
"value",
",",
"item",
".",
"desc",
",",
"not",
"pred",
"(",
"item",
")",
",",
"*",
... | Create a new enumeration containing only items filtered from another
enumeration.
Hidden enum items in the original enumeration are excluded.
:type pred: ``Callable[[`EnumItem`], bool]``
:param pred: Predicate that will keep items for which the result is true.
:type enum: Enum
:param enum: Enu... | [
"Create",
"a",
"new",
"enumeration",
"containing",
"only",
"items",
"filtered",
"from",
"another",
"enumeration",
"."
] | 089c525799926c8b8bf1117ab22ed055dc99c7e6 | https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L299-L320 |
245,430 | fusionapp/fusion-util | fusion_util/enums.py | Enum.from_pairs | def from_pairs(cls, doc, pairs):
"""
Construct an enumeration from an iterable of pairs.
:param doc: See `Enum.__init__`.
:type pairs: ``Iterable[Tuple[unicode, unicode]]``
:param pairs: Iterable to construct the enumeration from.
:rtype: Enum
"""
values ... | python | def from_pairs(cls, doc, pairs):
"""
Construct an enumeration from an iterable of pairs.
:param doc: See `Enum.__init__`.
:type pairs: ``Iterable[Tuple[unicode, unicode]]``
:param pairs: Iterable to construct the enumeration from.
:rtype: Enum
"""
values ... | [
"def",
"from_pairs",
"(",
"cls",
",",
"doc",
",",
"pairs",
")",
":",
"values",
"=",
"(",
"EnumItem",
"(",
"value",
",",
"desc",
")",
"for",
"value",
",",
"desc",
"in",
"pairs",
")",
"return",
"cls",
"(",
"doc",
"=",
"doc",
",",
"values",
"=",
"va... | Construct an enumeration from an iterable of pairs.
:param doc: See `Enum.__init__`.
:type pairs: ``Iterable[Tuple[unicode, unicode]]``
:param pairs: Iterable to construct the enumeration from.
:rtype: Enum | [
"Construct",
"an",
"enumeration",
"from",
"an",
"iterable",
"of",
"pairs",
"."
] | 089c525799926c8b8bf1117ab22ed055dc99c7e6 | https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L69-L79 |
245,431 | fusionapp/fusion-util | fusion_util/enums.py | Enum.get | def get(self, value):
"""
Get an enumeration item for an enumeration value.
:param unicode value: Enumeration value.
:raise InvalidEnumItem: If ``value`` does not match any known
enumeration value.
:rtype: EnumItem
"""
_nothing = object()
item = s... | python | def get(self, value):
"""
Get an enumeration item for an enumeration value.
:param unicode value: Enumeration value.
:raise InvalidEnumItem: If ``value`` does not match any known
enumeration value.
:rtype: EnumItem
"""
_nothing = object()
item = s... | [
"def",
"get",
"(",
"self",
",",
"value",
")",
":",
"_nothing",
"=",
"object",
"(",
")",
"item",
"=",
"self",
".",
"_values",
".",
"get",
"(",
"value",
",",
"_nothing",
")",
"if",
"item",
"is",
"_nothing",
":",
"raise",
"InvalidEnumItem",
"(",
"value"... | Get an enumeration item for an enumeration value.
:param unicode value: Enumeration value.
:raise InvalidEnumItem: If ``value`` does not match any known
enumeration value.
:rtype: EnumItem | [
"Get",
"an",
"enumeration",
"item",
"for",
"an",
"enumeration",
"value",
"."
] | 089c525799926c8b8bf1117ab22ed055dc99c7e6 | https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L89-L102 |
245,432 | fusionapp/fusion-util | fusion_util/enums.py | Enum.extra | def extra(self, value, extra_name, default=None):
"""
Get the additional enumeration value for ``extra_name``.
:param unicode value: Enumeration value.
:param str extra_name: Extra name.
:param default: Default value in the case ``extra_name`` doesn't exist.
"""
... | python | def extra(self, value, extra_name, default=None):
"""
Get the additional enumeration value for ``extra_name``.
:param unicode value: Enumeration value.
:param str extra_name: Extra name.
:param default: Default value in the case ``extra_name`` doesn't exist.
"""
... | [
"def",
"extra",
"(",
"self",
",",
"value",
",",
"extra_name",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"get",
"(",
"value",
")",
".",
"get",
"(",
"extra_name",
",",
"default",
")",
"except",
"InvalidEnumItem",
":",
"r... | Get the additional enumeration value for ``extra_name``.
:param unicode value: Enumeration value.
:param str extra_name: Extra name.
:param default: Default value in the case ``extra_name`` doesn't exist. | [
"Get",
"the",
"additional",
"enumeration",
"value",
"for",
"extra_name",
"."
] | 089c525799926c8b8bf1117ab22ed055dc99c7e6 | https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L123-L134 |
245,433 | fusionapp/fusion-util | fusion_util/enums.py | Enum.find_all | def find_all(self, **names):
"""
Find all items with matching extra values.
:param \*\*names: Extra values to match.
:rtype: ``Iterable[`EnumItem`]``
"""
values = names.items()
if len(values) != 1:
raise ValueError('Only one query is allowed at a time... | python | def find_all(self, **names):
"""
Find all items with matching extra values.
:param \*\*names: Extra values to match.
:rtype: ``Iterable[`EnumItem`]``
"""
values = names.items()
if len(values) != 1:
raise ValueError('Only one query is allowed at a time... | [
"def",
"find_all",
"(",
"self",
",",
"*",
"*",
"names",
")",
":",
"values",
"=",
"names",
".",
"items",
"(",
")",
"if",
"len",
"(",
"values",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"'Only one query is allowed at a time'",
")",
"name",
",",
"v... | Find all items with matching extra values.
:param \*\*names: Extra values to match.
:rtype: ``Iterable[`EnumItem`]`` | [
"Find",
"all",
"items",
"with",
"matching",
"extra",
"values",
"."
] | 089c525799926c8b8bf1117ab22ed055dc99c7e6 | https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L156-L169 |
245,434 | SkyLothar/shcmd | shcmd/utils.py | expand_args | def expand_args(cmd_args):
"""split command args to args list
returns a list of args
:param cmd_args: command args, can be tuple, list or str
"""
if isinstance(cmd_args, (tuple, list)):
args_list = list(cmd_args)
else:
args_list = shlex.split(cmd_args)
return args_list | python | def expand_args(cmd_args):
"""split command args to args list
returns a list of args
:param cmd_args: command args, can be tuple, list or str
"""
if isinstance(cmd_args, (tuple, list)):
args_list = list(cmd_args)
else:
args_list = shlex.split(cmd_args)
return args_list | [
"def",
"expand_args",
"(",
"cmd_args",
")",
":",
"if",
"isinstance",
"(",
"cmd_args",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"args_list",
"=",
"list",
"(",
"cmd_args",
")",
"else",
":",
"args_list",
"=",
"shlex",
".",
"split",
"(",
"cmd_args",
... | split command args to args list
returns a list of args
:param cmd_args: command args, can be tuple, list or str | [
"split",
"command",
"args",
"to",
"args",
"list",
"returns",
"a",
"list",
"of",
"args"
] | d8cad6311a4da7ef09f3419c86b58e30388b7ee3 | https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/utils.py#L6-L16 |
245,435 | etcher-be/emiz | emiz/avwx/service.py | get_service | def get_service(station: str) -> Service:
"""
Returns the preferred service for a given station
"""
for prefix in PREFERRED:
if station.startswith(prefix):
return PREFERRED[prefix] # type: ignore
return NOAA | python | def get_service(station: str) -> Service:
"""
Returns the preferred service for a given station
"""
for prefix in PREFERRED:
if station.startswith(prefix):
return PREFERRED[prefix] # type: ignore
return NOAA | [
"def",
"get_service",
"(",
"station",
":",
"str",
")",
"->",
"Service",
":",
"for",
"prefix",
"in",
"PREFERRED",
":",
"if",
"station",
".",
"startswith",
"(",
"prefix",
")",
":",
"return",
"PREFERRED",
"[",
"prefix",
"]",
"# type: ignore",
"return",
"NOAA"... | Returns the preferred service for a given station | [
"Returns",
"the",
"preferred",
"service",
"for",
"a",
"given",
"station"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L143-L150 |
245,436 | etcher-be/emiz | emiz/avwx/service.py | Service.make_err | def make_err(self, body: str, key: str = 'report path') -> InvalidRequest:
"""
Returns an InvalidRequest exception with formatted error message
"""
msg = f'Could not find {key} in {self.__class__.__name__} response\n'
return InvalidRequest(msg + body) | python | def make_err(self, body: str, key: str = 'report path') -> InvalidRequest:
"""
Returns an InvalidRequest exception with formatted error message
"""
msg = f'Could not find {key} in {self.__class__.__name__} response\n'
return InvalidRequest(msg + body) | [
"def",
"make_err",
"(",
"self",
",",
"body",
":",
"str",
",",
"key",
":",
"str",
"=",
"'report path'",
")",
"->",
"InvalidRequest",
":",
"msg",
"=",
"f'Could not find {key} in {self.__class__.__name__} response\\n'",
"return",
"InvalidRequest",
"(",
"msg",
"+",
"b... | Returns an InvalidRequest exception with formatted error message | [
"Returns",
"an",
"InvalidRequest",
"exception",
"with",
"formatted",
"error",
"message"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L27-L32 |
245,437 | etcher-be/emiz | emiz/avwx/service.py | Service.fetch | def fetch(self, station: str) -> str:
"""
Fetches a report string from the service
"""
valid_station(station)
try:
resp = getattr(requests, self.method.lower())(self.url.format(self.rtype, station))
if resp.status_code != 200:
raise SourceE... | python | def fetch(self, station: str) -> str:
"""
Fetches a report string from the service
"""
valid_station(station)
try:
resp = getattr(requests, self.method.lower())(self.url.format(self.rtype, station))
if resp.status_code != 200:
raise SourceE... | [
"def",
"fetch",
"(",
"self",
",",
"station",
":",
"str",
")",
"->",
"str",
":",
"valid_station",
"(",
"station",
")",
"try",
":",
"resp",
"=",
"getattr",
"(",
"requests",
",",
"self",
".",
"method",
".",
"lower",
"(",
")",
")",
"(",
"self",
".",
... | Fetches a report string from the service | [
"Fetches",
"a",
"report",
"string",
"from",
"the",
"service"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L40-L53 |
245,438 | etcher-be/emiz | emiz/avwx/service.py | NOAA._extract | def _extract(self, raw: str, station: str = None) -> str:
"""
Extracts the raw_report element from XML response
"""
resp = parsexml(raw)
try:
report = resp['response']['data'][self.rtype.upper()]
except KeyError:
raise self.make_err(raw)
# ... | python | def _extract(self, raw: str, station: str = None) -> str:
"""
Extracts the raw_report element from XML response
"""
resp = parsexml(raw)
try:
report = resp['response']['data'][self.rtype.upper()]
except KeyError:
raise self.make_err(raw)
# ... | [
"def",
"_extract",
"(",
"self",
",",
"raw",
":",
"str",
",",
"station",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"resp",
"=",
"parsexml",
"(",
"raw",
")",
"try",
":",
"report",
"=",
"resp",
"[",
"'response'",
"]",
"[",
"'data'",
"]",
"[",
... | Extracts the raw_report element from XML response | [
"Extracts",
"the",
"raw_report",
"element",
"from",
"XML",
"response"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L70-L90 |
245,439 | etcher-be/emiz | emiz/avwx/service.py | AMO._extract | def _extract(self, raw: str, station: str = None) -> str:
"""
Extracts the report message from XML response
"""
resp = parsexml(raw)
try:
report = resp['response']['body']['items']['item'][self.rtype.lower() + 'Msg']
except KeyError:
raise self.mak... | python | def _extract(self, raw: str, station: str = None) -> str:
"""
Extracts the report message from XML response
"""
resp = parsexml(raw)
try:
report = resp['response']['body']['items']['item'][self.rtype.lower() + 'Msg']
except KeyError:
raise self.mak... | [
"def",
"_extract",
"(",
"self",
",",
"raw",
":",
"str",
",",
"station",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"resp",
"=",
"parsexml",
"(",
"raw",
")",
"try",
":",
"report",
"=",
"resp",
"[",
"'response'",
"]",
"[",
"'body'",
"]",
"[",
... | Extracts the report message from XML response | [
"Extracts",
"the",
"report",
"message",
"from",
"XML",
"response"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L100-L117 |
245,440 | etcher-be/emiz | emiz/avwx/service.py | MAC._extract | def _extract(self, raw: str, station: str) -> str: # type: ignore
"""
Extracts the reports message using string finding
"""
report = raw[raw.find(station.upper() + ' '):]
report = report[:report.find(' =')]
return report | python | def _extract(self, raw: str, station: str) -> str: # type: ignore
"""
Extracts the reports message using string finding
"""
report = raw[raw.find(station.upper() + ' '):]
report = report[:report.find(' =')]
return report | [
"def",
"_extract",
"(",
"self",
",",
"raw",
":",
"str",
",",
"station",
":",
"str",
")",
"->",
"str",
":",
"# type: ignore",
"report",
"=",
"raw",
"[",
"raw",
".",
"find",
"(",
"station",
".",
"upper",
"(",
")",
"+",
"' '",
")",
":",
"]",
"report... | Extracts the reports message using string finding | [
"Extracts",
"the",
"reports",
"message",
"using",
"string",
"finding"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L128-L134 |
245,441 | etcher-be/emiz | emiz/weather/mizfile/mizfile_set_metar.py | set_weather_from_metar | def set_weather_from_metar(
metar: typing.Union[Metar.Metar, str],
in_file: typing.Union[str, Path],
out_file: typing.Union[str, Path] = None
) -> typing.Tuple[typing.Union[str, None], typing.Union[str, None]]:
"""
Applies the weather from a METAR object to a MIZ file
Args:
... | python | def set_weather_from_metar(
metar: typing.Union[Metar.Metar, str],
in_file: typing.Union[str, Path],
out_file: typing.Union[str, Path] = None
) -> typing.Tuple[typing.Union[str, None], typing.Union[str, None]]:
"""
Applies the weather from a METAR object to a MIZ file
Args:
... | [
"def",
"set_weather_from_metar",
"(",
"metar",
":",
"typing",
".",
"Union",
"[",
"Metar",
".",
"Metar",
",",
"str",
"]",
",",
"in_file",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"Path",
"]",
",",
"out_file",
":",
"typing",
".",
"Union",
"[",
"st... | Applies the weather from a METAR object to a MIZ file
Args:
metar: metar object
in_file: path to MIZ file
out_file: path to output MIZ file (will default to in_file)
Returns: tuple of error, success | [
"Applies",
"the",
"weather",
"from",
"a",
"METAR",
"object",
"to",
"a",
"MIZ",
"file"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/mizfile/mizfile_set_metar.py#L18-L63 |
245,442 | bwesterb/tkbd | src/state.py | State._pull_schedule_loop | def _pull_schedule_loop(self):
""" Called every 16 minutes to pull a new version of the schedule """
try:
self.pull_schedule()
delay = 16*60
except ScheduleError, e:
self.l.exception("ScheduleError while pulling schedule. "+
"Retr... | python | def _pull_schedule_loop(self):
""" Called every 16 minutes to pull a new version of the schedule """
try:
self.pull_schedule()
delay = 16*60
except ScheduleError, e:
self.l.exception("ScheduleError while pulling schedule. "+
"Retr... | [
"def",
"_pull_schedule_loop",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"pull_schedule",
"(",
")",
"delay",
"=",
"16",
"*",
"60",
"except",
"ScheduleError",
",",
"e",
":",
"self",
".",
"l",
".",
"exception",
"(",
"\"ScheduleError while pulling schedule... | Called every 16 minutes to pull a new version of the schedule | [
"Called",
"every",
"16",
"minutes",
"to",
"pull",
"a",
"new",
"version",
"of",
"the",
"schedule"
] | fcf16977d38a93fe9b7fa198513007ab9921b650 | https://github.com/bwesterb/tkbd/blob/fcf16977d38a93fe9b7fa198513007ab9921b650/src/state.py#L75-L86 |
245,443 | matthewdeanmartin/jiggle_version | jiggle_version/jiggle_class.py | JiggleVersion.jiggle_source_code | def jiggle_source_code(self): # type: () ->int
"""
Updates version of central package
"""
changed = 0
for file_name in self.file_inventory.source_files:
to_write = []
# self.create_missing(file_name, file_name)
if not os.path.isfile(file_name)... | python | def jiggle_source_code(self): # type: () ->int
"""
Updates version of central package
"""
changed = 0
for file_name in self.file_inventory.source_files:
to_write = []
# self.create_missing(file_name, file_name)
if not os.path.isfile(file_name)... | [
"def",
"jiggle_source_code",
"(",
"self",
")",
":",
"# type: () ->int",
"changed",
"=",
"0",
"for",
"file_name",
"in",
"self",
".",
"file_inventory",
".",
"source_files",
":",
"to_write",
"=",
"[",
"]",
"# self.create_missing(file_name, file_name)",
"if",
"not",
"... | Updates version of central package | [
"Updates",
"version",
"of",
"central",
"package"
] | 963656a0a47b7162780a5f6c8f4b8bbbebc148f5 | https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L176-L227 |
245,444 | matthewdeanmartin/jiggle_version | jiggle_version/jiggle_class.py | JiggleVersion.jiggle_config_file | def jiggle_config_file(self): # type: () ->int
"""
Update ini, cfg, conf
"""
changed = 0
# setup.py related. setup.py itself should read __init__.py or __version__.py
other_files = ["setup.cfg"]
for file_name in other_files:
filepath = os.path.join(... | python | def jiggle_config_file(self): # type: () ->int
"""
Update ini, cfg, conf
"""
changed = 0
# setup.py related. setup.py itself should read __init__.py or __version__.py
other_files = ["setup.cfg"]
for file_name in other_files:
filepath = os.path.join(... | [
"def",
"jiggle_config_file",
"(",
"self",
")",
":",
"# type: () ->int",
"changed",
"=",
"0",
"# setup.py related. setup.py itself should read __init__.py or __version__.py",
"other_files",
"=",
"[",
"\"setup.cfg\"",
"]",
"for",
"file_name",
"in",
"other_files",
":",
"filepa... | Update ini, cfg, conf | [
"Update",
"ini",
"cfg",
"conf"
] | 963656a0a47b7162780a5f6c8f4b8bbbebc148f5 | https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L356-L389 |
245,445 | Nixiware/viper | nx/viper/application.py | Application._getConfiguration | def _getConfiguration(self):
"""
Load application configuration files.
:return: <dict>
"""
configDirectoryPath = os.path.join("application", "config")
config = Config(configDirectoryPath)
configData = config.getData()
# setting application parameters
... | python | def _getConfiguration(self):
"""
Load application configuration files.
:return: <dict>
"""
configDirectoryPath = os.path.join("application", "config")
config = Config(configDirectoryPath)
configData = config.getData()
# setting application parameters
... | [
"def",
"_getConfiguration",
"(",
"self",
")",
":",
"configDirectoryPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"\"application\"",
",",
"\"config\"",
")",
"config",
"=",
"Config",
"(",
"configDirectoryPath",
")",
"configData",
"=",
"config",
".",
"getData"... | Load application configuration files.
:return: <dict> | [
"Load",
"application",
"configuration",
"files",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L42-L57 |
245,446 | Nixiware/viper | nx/viper/application.py | Application._getInterfaces | def _getInterfaces(self):
"""
Load application communication interfaces.
:return: <dict>
"""
interfaces = {}
interfacesPath = os.path.join("application", "interface")
interfaceList = os.listdir(interfacesPath)
for file in interfaceList:
inte... | python | def _getInterfaces(self):
"""
Load application communication interfaces.
:return: <dict>
"""
interfaces = {}
interfacesPath = os.path.join("application", "interface")
interfaceList = os.listdir(interfacesPath)
for file in interfaceList:
inte... | [
"def",
"_getInterfaces",
"(",
"self",
")",
":",
"interfaces",
"=",
"{",
"}",
"interfacesPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"\"application\"",
",",
"\"interface\"",
")",
"interfaceList",
"=",
"os",
".",
"listdir",
"(",
"interfacesPath",
")",
"... | Load application communication interfaces.
:return: <dict> | [
"Load",
"application",
"communication",
"interfaces",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L62-L98 |
245,447 | Nixiware/viper | nx/viper/application.py | Application._getModules | def _getModules(self):
"""
Import and load application modules.
:return: <dict>
"""
modules = {}
modulesPath = os.path.join("application", "module")
moduleList = os.listdir(modulesPath)
for moduleName in moduleList:
modulePath = os.path.join(... | python | def _getModules(self):
"""
Import and load application modules.
:return: <dict>
"""
modules = {}
modulesPath = os.path.join("application", "module")
moduleList = os.listdir(modulesPath)
for moduleName in moduleList:
modulePath = os.path.join(... | [
"def",
"_getModules",
"(",
"self",
")",
":",
"modules",
"=",
"{",
"}",
"modulesPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"\"application\"",
",",
"\"module\"",
")",
"moduleList",
"=",
"os",
".",
"listdir",
"(",
"modulesPath",
")",
"for",
"moduleNam... | Import and load application modules.
:return: <dict> | [
"Import",
"and",
"load",
"application",
"modules",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L111-L138 |
245,448 | Nixiware/viper | nx/viper/application.py | Application.addModel | def addModel(self, moduleName, modelName, model):
"""
Add a model instance to the application model pool.
:param moduleName: <str> module name in which the model is located
:param modelName: <str> model name
:param model: <object> model instance
:return: <void>
"... | python | def addModel(self, moduleName, modelName, model):
"""
Add a model instance to the application model pool.
:param moduleName: <str> module name in which the model is located
:param modelName: <str> model name
:param model: <object> model instance
:return: <void>
"... | [
"def",
"addModel",
"(",
"self",
",",
"moduleName",
",",
"modelName",
",",
"model",
")",
":",
"modelIdentifier",
"=",
"\"{}.{}\"",
".",
"format",
"(",
"moduleName",
",",
"modelName",
")",
"if",
"modelIdentifier",
"not",
"in",
"self",
".",
"_models",
":",
"s... | Add a model instance to the application model pool.
:param moduleName: <str> module name in which the model is located
:param modelName: <str> model name
:param model: <object> model instance
:return: <void> | [
"Add",
"a",
"model",
"instance",
"to",
"the",
"application",
"model",
"pool",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L155-L171 |
245,449 | Nixiware/viper | nx/viper/application.py | Application.getModel | def getModel(self, modelIdentifier):
"""
Return the requested model.
:param modelIdentifier: <str> model identifier
:return: <object> model instance
"""
if modelIdentifier in self._models:
return self._models[modelIdentifier]
else:
message... | python | def getModel(self, modelIdentifier):
"""
Return the requested model.
:param modelIdentifier: <str> model identifier
:return: <object> model instance
"""
if modelIdentifier in self._models:
return self._models[modelIdentifier]
else:
message... | [
"def",
"getModel",
"(",
"self",
",",
"modelIdentifier",
")",
":",
"if",
"modelIdentifier",
"in",
"self",
".",
"_models",
":",
"return",
"self",
".",
"_models",
"[",
"modelIdentifier",
"]",
"else",
":",
"message",
"=",
"\"Application - getModel() - \"",
"\"Model ... | Return the requested model.
:param modelIdentifier: <str> model identifier
:return: <object> model instance | [
"Return",
"the",
"requested",
"model",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L173-L186 |
245,450 | Nixiware/viper | nx/viper/application.py | Application._loadViperServices | def _loadViperServices(self):
"""
Load application bundled services.
:return: <void>
"""
servicesPath = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"service"
)
for serviceFile in os.listdir(servicesPath):
if serv... | python | def _loadViperServices(self):
"""
Load application bundled services.
:return: <void>
"""
servicesPath = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"service"
)
for serviceFile in os.listdir(servicesPath):
if serv... | [
"def",
"_loadViperServices",
"(",
"self",
")",
":",
"servicesPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
",",
"\"service\"",
")",
"for",
"serv... | Load application bundled services.
:return: <void> | [
"Load",
"application",
"bundled",
"services",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L191-L223 |
245,451 | Nixiware/viper | nx/viper/application.py | Application.addService | def addService(self, moduleName, serviceName, service):
"""
Add a service instance to the application service pool.
:param moduleName: <str> module name in which the service is located
:param serviceName: <str> service name
:param service: <object> service instance
:retu... | python | def addService(self, moduleName, serviceName, service):
"""
Add a service instance to the application service pool.
:param moduleName: <str> module name in which the service is located
:param serviceName: <str> service name
:param service: <object> service instance
:retu... | [
"def",
"addService",
"(",
"self",
",",
"moduleName",
",",
"serviceName",
",",
"service",
")",
":",
"serviceIdentifier",
"=",
"\"{}.{}\"",
".",
"format",
"(",
"moduleName",
",",
"serviceName",
")",
"if",
"serviceIdentifier",
"not",
"in",
"self",
".",
"_services... | Add a service instance to the application service pool.
:param moduleName: <str> module name in which the service is located
:param serviceName: <str> service name
:param service: <object> service instance
:return: <void> | [
"Add",
"a",
"service",
"instance",
"to",
"the",
"application",
"service",
"pool",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L225-L241 |
245,452 | Nixiware/viper | nx/viper/application.py | Application.getService | def getService(self, serviceIdentifier):
"""
Return the requested service instance.
:param serviceIdentifier: <str> service identifier
:return: <object> service instance
"""
if serviceIdentifier in self._services:
return self._services[serviceIdentifier]
... | python | def getService(self, serviceIdentifier):
"""
Return the requested service instance.
:param serviceIdentifier: <str> service identifier
:return: <object> service instance
"""
if serviceIdentifier in self._services:
return self._services[serviceIdentifier]
... | [
"def",
"getService",
"(",
"self",
",",
"serviceIdentifier",
")",
":",
"if",
"serviceIdentifier",
"in",
"self",
".",
"_services",
":",
"return",
"self",
".",
"_services",
"[",
"serviceIdentifier",
"]",
"else",
":",
"message",
"=",
"\"Application - getService() - \"... | Return the requested service instance.
:param serviceIdentifier: <str> service identifier
:return: <object> service instance | [
"Return",
"the",
"requested",
"service",
"instance",
"."
] | fbe6057facd8d46103e9955880dfd99e63b7acb3 | https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L243-L256 |
245,453 | neumark/microcli | example.py | Calculator.add | def add(self, *number):
"""Adds all parameters interpreted as integers"""
return self._format_result(sum(
# positional arguments are always strings
[int(n) for n in number])) | python | def add(self, *number):
"""Adds all parameters interpreted as integers"""
return self._format_result(sum(
# positional arguments are always strings
[int(n) for n in number])) | [
"def",
"add",
"(",
"self",
",",
"*",
"number",
")",
":",
"return",
"self",
".",
"_format_result",
"(",
"sum",
"(",
"# positional arguments are always strings",
"[",
"int",
"(",
"n",
")",
"for",
"n",
"in",
"number",
"]",
")",
")"
] | Adds all parameters interpreted as integers | [
"Adds",
"all",
"parameters",
"interpreted",
"as",
"integers"
] | fa31a35a95f63593ca12d246a5a84e2dff522dd6 | https://github.com/neumark/microcli/blob/fa31a35a95f63593ca12d246a5a84e2dff522dd6/example.py#L27-L31 |
245,454 | neumark/microcli | example.py | Calculator.subtract | def subtract(self, number1, number2):
"""Subtracts number2 from number1"""
return self._format_result(int(number1) - int(number2)) | python | def subtract(self, number1, number2):
"""Subtracts number2 from number1"""
return self._format_result(int(number1) - int(number2)) | [
"def",
"subtract",
"(",
"self",
",",
"number1",
",",
"number2",
")",
":",
"return",
"self",
".",
"_format_result",
"(",
"int",
"(",
"number1",
")",
"-",
"int",
"(",
"number2",
")",
")"
] | Subtracts number2 from number1 | [
"Subtracts",
"number2",
"from",
"number1"
] | fa31a35a95f63593ca12d246a5a84e2dff522dd6 | https://github.com/neumark/microcli/blob/fa31a35a95f63593ca12d246a5a84e2dff522dd6/example.py#L34-L36 |
245,455 | johnnoone/facts | facts/logical.py | Logical.items | async def items(self):
"""Expose all grafts.
"""
accumulator = Accumulator()
for graft in load_grafts():
accumulator.spawn(graft())
response = await accumulator.join()
return response.items() | python | async def items(self):
"""Expose all grafts.
"""
accumulator = Accumulator()
for graft in load_grafts():
accumulator.spawn(graft())
response = await accumulator.join()
return response.items() | [
"async",
"def",
"items",
"(",
"self",
")",
":",
"accumulator",
"=",
"Accumulator",
"(",
")",
"for",
"graft",
"in",
"load_grafts",
"(",
")",
":",
"accumulator",
".",
"spawn",
"(",
"graft",
"(",
")",
")",
"response",
"=",
"await",
"accumulator",
".",
"jo... | Expose all grafts. | [
"Expose",
"all",
"grafts",
"."
] | 82d38a46c15d9c01200445526f4c0d1825fc1e51 | https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/logical.py#L12-L20 |
245,456 | edeposit/edeposit.amqp.ftp | src/edeposit/amqp/ftp/settings.py | conf_merger | def conf_merger(user_dict, variable):
"""
Merge global configuration with user's personal configuration.
Global configuration has always higher priority.
"""
if variable not in globals().keys():
raise NameError("Unknown variable '%s'." % variable)
if variable not in user_dict:
... | python | def conf_merger(user_dict, variable):
"""
Merge global configuration with user's personal configuration.
Global configuration has always higher priority.
"""
if variable not in globals().keys():
raise NameError("Unknown variable '%s'." % variable)
if variable not in user_dict:
... | [
"def",
"conf_merger",
"(",
"user_dict",
",",
"variable",
")",
":",
"if",
"variable",
"not",
"in",
"globals",
"(",
")",
".",
"keys",
"(",
")",
":",
"raise",
"NameError",
"(",
"\"Unknown variable '%s'.\"",
"%",
"variable",
")",
"if",
"variable",
"not",
"in",... | Merge global configuration with user's personal configuration.
Global configuration has always higher priority. | [
"Merge",
"global",
"configuration",
"with",
"user",
"s",
"personal",
"configuration",
"."
] | fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71 | https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/settings.py#L121-L133 |
245,457 | toastdriven/alligator | alligator/backends/beanstalk_backend.py | Client.len | def len(self, queue_name):
"""
Returns the length of the queue.
:param queue_name: The name of the queue. Usually handled by the
``Gator`` instance.
:type queue_name: string
:returns: The length of the queue
:rtype: integer
"""
try:
... | python | def len(self, queue_name):
"""
Returns the length of the queue.
:param queue_name: The name of the queue. Usually handled by the
``Gator`` instance.
:type queue_name: string
:returns: The length of the queue
:rtype: integer
"""
try:
... | [
"def",
"len",
"(",
"self",
",",
"queue_name",
")",
":",
"try",
":",
"stats",
"=",
"self",
".",
"conn",
".",
"stats_tube",
"(",
"queue_name",
")",
"except",
"beanstalkc",
".",
"CommandFailed",
"as",
"err",
":",
"if",
"err",
"[",
"1",
"]",
"==",
"'NOT_... | Returns the length of the queue.
:param queue_name: The name of the queue. Usually handled by the
``Gator`` instance.
:type queue_name: string
:returns: The length of the queue
:rtype: integer | [
"Returns",
"the",
"length",
"of",
"the",
"queue",
"."
] | f18bcb35b350fc6b0886393f5246d69c892b36c7 | https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/backends/beanstalk_backend.py#L34-L53 |
245,458 | dossier/dossier.models | dossier/models/pairwise.py | add_facets | def add_facets(engine_result, facet_features=None):
'''Adds facets to search results.
Construct a new result payload with `facets` added as a new
top-level property that carries a mapping from unicode strings to
lists of content_ids. The `facet_features` lists the names of
:class:`~dossier.fc.Stri... | python | def add_facets(engine_result, facet_features=None):
'''Adds facets to search results.
Construct a new result payload with `facets` added as a new
top-level property that carries a mapping from unicode strings to
lists of content_ids. The `facet_features` lists the names of
:class:`~dossier.fc.Stri... | [
"def",
"add_facets",
"(",
"engine_result",
",",
"facet_features",
"=",
"None",
")",
":",
"if",
"facet_features",
"is",
"None",
":",
"facet_features",
"=",
"[",
"'bowNP_sip'",
"]",
"phrases",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"r... | Adds facets to search results.
Construct a new result payload with `facets` added as a new
top-level property that carries a mapping from unicode strings to
lists of content_ids. The `facet_features` lists the names of
:class:`~dossier.fc.StringCounter` features in each result
:class:`~dossier.fc.... | [
"Adds",
"facets",
"to",
"search",
"results",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/pairwise.py#L98-L120 |
245,459 | dossier/dossier.models | dossier/models/pairwise.py | vectorizable_features | def vectorizable_features(fcs):
'''Discovers the ordered set of vectorizable features in ``fcs``.
Returns a list of feature names, sorted lexicographically.
Feature names are only included if the corresponding
features are vectorizable (i.e., they are an instance of
:class:`collections.Mapping`).
... | python | def vectorizable_features(fcs):
'''Discovers the ordered set of vectorizable features in ``fcs``.
Returns a list of feature names, sorted lexicographically.
Feature names are only included if the corresponding
features are vectorizable (i.e., they are an instance of
:class:`collections.Mapping`).
... | [
"def",
"vectorizable_features",
"(",
"fcs",
")",
":",
"is_mapping",
"=",
"lambda",
"obj",
":",
"isinstance",
"(",
"obj",
",",
"collections",
".",
"Mapping",
")",
"return",
"sorted",
"(",
"set",
"(",
"[",
"name",
"for",
"fc",
"in",
"fcs",
"for",
"name",
... | Discovers the ordered set of vectorizable features in ``fcs``.
Returns a list of feature names, sorted lexicographically.
Feature names are only included if the corresponding
features are vectorizable (i.e., they are an instance of
:class:`collections.Mapping`). | [
"Discovers",
"the",
"ordered",
"set",
"of",
"vectorizable",
"features",
"in",
"fcs",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/pairwise.py#L501-L510 |
245,460 | dossier/dossier.models | dossier/models/pairwise.py | dissimilarities | def dissimilarities(feature_names, fcs):
'''Computes the pairwise dissimilarity matrices.
This returns a dictionary mapping each name in ``feature_names``
to a pairwise dissimilarities matrix. The dissimilaritiy scores
correspond to ``1 - kernel`` between each feature of each
pair of feature collec... | python | def dissimilarities(feature_names, fcs):
'''Computes the pairwise dissimilarity matrices.
This returns a dictionary mapping each name in ``feature_names``
to a pairwise dissimilarities matrix. The dissimilaritiy scores
correspond to ``1 - kernel`` between each feature of each
pair of feature collec... | [
"def",
"dissimilarities",
"(",
"feature_names",
",",
"fcs",
")",
":",
"dis",
"=",
"{",
"}",
"for",
"count",
",",
"name",
"in",
"enumerate",
"(",
"feature_names",
",",
"1",
")",
":",
"logger",
".",
"info",
"(",
"'computing pairwise dissimilarity matrix '",
"'... | Computes the pairwise dissimilarity matrices.
This returns a dictionary mapping each name in ``feature_names``
to a pairwise dissimilarities matrix. The dissimilaritiy scores
correspond to ``1 - kernel`` between each feature of each
pair of feature collections in ``fcs``.
(The kernel used is curre... | [
"Computes",
"the",
"pairwise",
"dissimilarity",
"matrices",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/pairwise.py#L513-L536 |
245,461 | dossier/dossier.models | dossier/models/pairwise.py | PairwiseFeatureLearner.probabilities | def probabilities(self):
'''Trains a model and predicts recommendations.
If the query feature collection could not be found or if there
is insufficient training data, an empty list is returned.
Otherwise, a list of content objects (tuples of content
id and feature collection) a... | python | def probabilities(self):
'''Trains a model and predicts recommendations.
If the query feature collection could not be found or if there
is insufficient training data, an empty list is returned.
Otherwise, a list of content objects (tuples of content
id and feature collection) a... | [
"def",
"probabilities",
"(",
"self",
")",
":",
"self",
".",
"query_fc",
"=",
"self",
".",
"store",
".",
"get",
"(",
"self",
".",
"query_content_id",
")",
"if",
"self",
".",
"query_fc",
"is",
"None",
":",
"logger",
".",
"warning",
"(",
"'Could not find FC... | Trains a model and predicts recommendations.
If the query feature collection could not be found or if there
is insufficient training data, an empty list is returned.
Otherwise, a list of content objects (tuples of content
id and feature collection) and probabilities is returned.
... | [
"Trains",
"a",
"model",
"and",
"predicts",
"recommendations",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/pairwise.py#L210-L269 |
245,462 | dossier/dossier.models | dossier/models/pairwise.py | PairwiseFeatureLearner.train | def train(self, content_objs, idx_labels):
'''Trains and returns a model using sklearn.
If there are new labels to add, they can be added, returns an
sklearn model which can be used for prediction and getting
features.
This method may return ``None`` if there is insufficient
... | python | def train(self, content_objs, idx_labels):
'''Trains and returns a model using sklearn.
If there are new labels to add, they can be added, returns an
sklearn model which can be used for prediction and getting
features.
This method may return ``None`` if there is insufficient
... | [
"def",
"train",
"(",
"self",
",",
"content_objs",
",",
"idx_labels",
")",
":",
"# We have insufficient training data when there is only one or",
"# fewer classes of labels.",
"if",
"len",
"(",
"set",
"(",
"[",
"lab",
"[",
"0",
"]",
"for",
"lab",
"in",
"idx_labels",
... | Trains and returns a model using sklearn.
If there are new labels to add, they can be added, returns an
sklearn model which can be used for prediction and getting
features.
This method may return ``None`` if there is insufficient
training data to produce a model.
:para... | [
"Trains",
"and",
"returns",
"a",
"model",
"using",
"sklearn",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/pairwise.py#L271-L307 |
245,463 | dossier/dossier.models | dossier/models/features/sip.py | noun_phrases_as_tokens | def noun_phrases_as_tokens(text):
'''Generate a bag of lists of unnormalized tokens representing noun
phrases from ``text``.
This is built around python's nltk library for getting Noun
Phrases (NPs). This is all documented in the NLTK Book
http://www.nltk.org/book/ch03.html and blog posts that cite... | python | def noun_phrases_as_tokens(text):
'''Generate a bag of lists of unnormalized tokens representing noun
phrases from ``text``.
This is built around python's nltk library for getting Noun
Phrases (NPs). This is all documented in the NLTK Book
http://www.nltk.org/book/ch03.html and blog posts that cite... | [
"def",
"noun_phrases_as_tokens",
"(",
"text",
")",
":",
"## from NLTK Book:",
"sentence_re",
"=",
"r'''(?x) # set flag to allow verbose regexps\n ([A-Z])(\\.[A-Z])+\\.? # abbreviations, e.g. U.S.A.\n | \\w+(-\\w+)* # words with optional internal hyphens\n | ... | Generate a bag of lists of unnormalized tokens representing noun
phrases from ``text``.
This is built around python's nltk library for getting Noun
Phrases (NPs). This is all documented in the NLTK Book
http://www.nltk.org/book/ch03.html and blog posts that cite the
book.
:rtype: list of lists... | [
"Generate",
"a",
"bag",
"of",
"lists",
"of",
"unnormalized",
"tokens",
"representing",
"noun",
"phrases",
"from",
"text",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/features/sip.py#L27-L87 |
245,464 | dossier/dossier.models | dossier/models/features/sip.py | noun_phrases | def noun_phrases(text, included_unnormalized=False):
'''applies normalization to the terms found by noun_phrases_as_tokens
and joins on '_'.
:rtype: list of phrase strings with spaces replaced by ``_``.
'''
lemmatizer = nltk.WordNetLemmatizer()
stemmer = nltk.stem.porter.PorterStemmer()
d... | python | def noun_phrases(text, included_unnormalized=False):
'''applies normalization to the terms found by noun_phrases_as_tokens
and joins on '_'.
:rtype: list of phrase strings with spaces replaced by ``_``.
'''
lemmatizer = nltk.WordNetLemmatizer()
stemmer = nltk.stem.porter.PorterStemmer()
d... | [
"def",
"noun_phrases",
"(",
"text",
",",
"included_unnormalized",
"=",
"False",
")",
":",
"lemmatizer",
"=",
"nltk",
".",
"WordNetLemmatizer",
"(",
")",
"stemmer",
"=",
"nltk",
".",
"stem",
".",
"porter",
".",
"PorterStemmer",
"(",
")",
"def",
"normalize",
... | applies normalization to the terms found by noun_phrases_as_tokens
and joins on '_'.
:rtype: list of phrase strings with spaces replaced by ``_``. | [
"applies",
"normalization",
"to",
"the",
"terms",
"found",
"by",
"noun_phrases_as_tokens",
"and",
"joins",
"on",
"_",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/features/sip.py#L90-L118 |
245,465 | crypto101/clarent | clarent/certificate.py | _makeCertificate | def _makeCertificate(key, email, _utcnow=datetime.utcnow):
"""Make the certificate for the client using the given key and e-mail
address.
"""
# Create a certificate for this key.
cert = X509()
cert.set_pubkey(key)
# Set the subject.
subject = cert.get_subject()
subject.CN = u"Crypt... | python | def _makeCertificate(key, email, _utcnow=datetime.utcnow):
"""Make the certificate for the client using the given key and e-mail
address.
"""
# Create a certificate for this key.
cert = X509()
cert.set_pubkey(key)
# Set the subject.
subject = cert.get_subject()
subject.CN = u"Crypt... | [
"def",
"_makeCertificate",
"(",
"key",
",",
"email",
",",
"_utcnow",
"=",
"datetime",
".",
"utcnow",
")",
":",
"# Create a certificate for this key.",
"cert",
"=",
"X509",
"(",
")",
"cert",
".",
"set_pubkey",
"(",
"key",
")",
"# Set the subject.",
"subject",
"... | Make the certificate for the client using the given key and e-mail
address. | [
"Make",
"the",
"certificate",
"for",
"the",
"client",
"using",
"the",
"given",
"key",
"and",
"e",
"-",
"mail",
"address",
"."
] | 2b441d7933e85ee948cfb78506b7ca0a32e9588d | https://github.com/crypto101/clarent/blob/2b441d7933e85ee948cfb78506b7ca0a32e9588d/clarent/certificate.py#L19-L44 |
245,466 | crypto101/clarent | clarent/certificate.py | makeCredentials | def makeCredentials(path, email):
"""Make credentials for the client from given e-mail address and store
them in the directory at path.
"""
key = _generateKey()
cert = _makeCertificate(key, email)
certPath = path.child("client.pem")
certPath.alwaysCreate = True
with certPath.open("wb"... | python | def makeCredentials(path, email):
"""Make credentials for the client from given e-mail address and store
them in the directory at path.
"""
key = _generateKey()
cert = _makeCertificate(key, email)
certPath = path.child("client.pem")
certPath.alwaysCreate = True
with certPath.open("wb"... | [
"def",
"makeCredentials",
"(",
"path",
",",
"email",
")",
":",
"key",
"=",
"_generateKey",
"(",
")",
"cert",
"=",
"_makeCertificate",
"(",
"key",
",",
"email",
")",
"certPath",
"=",
"path",
".",
"child",
"(",
"\"client.pem\"",
")",
"certPath",
".",
"alwa... | Make credentials for the client from given e-mail address and store
them in the directory at path. | [
"Make",
"credentials",
"for",
"the",
"client",
"from",
"given",
"e",
"-",
"mail",
"address",
"and",
"store",
"them",
"in",
"the",
"directory",
"at",
"path",
"."
] | 2b441d7933e85ee948cfb78506b7ca0a32e9588d | https://github.com/crypto101/clarent/blob/2b441d7933e85ee948cfb78506b7ca0a32e9588d/clarent/certificate.py#L59-L72 |
245,467 | crypto101/clarent | clarent/certificate.py | getContextFactory | def getContextFactory(path):
"""Get a context factory for the client from keys already stored at
path.
Raises IOError if the credentials didn't exist.
"""
with path.child("client.pem").open() as pemFile:
cert = PrivateCertificate.loadPEM(pemFile.read())
certOptions = cert.options() # ... | python | def getContextFactory(path):
"""Get a context factory for the client from keys already stored at
path.
Raises IOError if the credentials didn't exist.
"""
with path.child("client.pem").open() as pemFile:
cert = PrivateCertificate.loadPEM(pemFile.read())
certOptions = cert.options() # ... | [
"def",
"getContextFactory",
"(",
"path",
")",
":",
"with",
"path",
".",
"child",
"(",
"\"client.pem\"",
")",
".",
"open",
"(",
")",
"as",
"pemFile",
":",
"cert",
"=",
"PrivateCertificate",
".",
"loadPEM",
"(",
"pemFile",
".",
"read",
"(",
")",
")",
"ce... | Get a context factory for the client from keys already stored at
path.
Raises IOError if the credentials didn't exist. | [
"Get",
"a",
"context",
"factory",
"for",
"the",
"client",
"from",
"keys",
"already",
"stored",
"at",
"path",
"."
] | 2b441d7933e85ee948cfb78506b7ca0a32e9588d | https://github.com/crypto101/clarent/blob/2b441d7933e85ee948cfb78506b7ca0a32e9588d/clarent/certificate.py#L76-L89 |
245,468 | kankiri/pabiana | demos/smarthome/smarthome/__init__.py | schedule | def schedule(demand: dict, alterations: set, looped: set=None, altered: set=None):
"""Prioritizes Triggers called from outside."""
if looped is not None and len(demand) != len(looped):
for func in looped: del demand[func]
if keep_temp in demand:
demand.pop(increase_temp, None)
demand.pop(lower_temp, None)
eli... | python | def schedule(demand: dict, alterations: set, looped: set=None, altered: set=None):
"""Prioritizes Triggers called from outside."""
if looped is not None and len(demand) != len(looped):
for func in looped: del demand[func]
if keep_temp in demand:
demand.pop(increase_temp, None)
demand.pop(lower_temp, None)
eli... | [
"def",
"schedule",
"(",
"demand",
":",
"dict",
",",
"alterations",
":",
"set",
",",
"looped",
":",
"set",
"=",
"None",
",",
"altered",
":",
"set",
"=",
"None",
")",
":",
"if",
"looped",
"is",
"not",
"None",
"and",
"len",
"(",
"demand",
")",
"!=",
... | Prioritizes Triggers called from outside. | [
"Prioritizes",
"Triggers",
"called",
"from",
"outside",
"."
] | 74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b | https://github.com/kankiri/pabiana/blob/74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b/demos/smarthome/smarthome/__init__.py#L41-L50 |
245,469 | cykerway/logging-ext | logging_ext/__init__.py | d | def d(msg, *args, **kwargs):
'''
log a message at debug level;
'''
return logging.log(DEBUG, msg, *args, **kwargs) | python | def d(msg, *args, **kwargs):
'''
log a message at debug level;
'''
return logging.log(DEBUG, msg, *args, **kwargs) | [
"def",
"d",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"logging",
".",
"log",
"(",
"DEBUG",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | log a message at debug level; | [
"log",
"a",
"message",
"at",
"debug",
"level",
";"
] | ed6700bdd602fa26276e1f194d255e74c7f255b4 | https://github.com/cykerway/logging-ext/blob/ed6700bdd602fa26276e1f194d255e74c7f255b4/logging_ext/__init__.py#L24-L30 |
245,470 | cykerway/logging-ext | logging_ext/__init__.py | v | def v(msg, *args, **kwargs):
'''
log a message at verbose level;
'''
return logging.log(VERBOSE, msg, *args, **kwargs) | python | def v(msg, *args, **kwargs):
'''
log a message at verbose level;
'''
return logging.log(VERBOSE, msg, *args, **kwargs) | [
"def",
"v",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"logging",
".",
"log",
"(",
"VERBOSE",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | log a message at verbose level; | [
"log",
"a",
"message",
"at",
"verbose",
"level",
";"
] | ed6700bdd602fa26276e1f194d255e74c7f255b4 | https://github.com/cykerway/logging-ext/blob/ed6700bdd602fa26276e1f194d255e74c7f255b4/logging_ext/__init__.py#L32-L38 |
245,471 | cykerway/logging-ext | logging_ext/__init__.py | i | def i(msg, *args, **kwargs):
'''
log a message at info level;
'''
return logging.log(INFO, msg, *args, **kwargs) | python | def i(msg, *args, **kwargs):
'''
log a message at info level;
'''
return logging.log(INFO, msg, *args, **kwargs) | [
"def",
"i",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"logging",
".",
"log",
"(",
"INFO",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | log a message at info level; | [
"log",
"a",
"message",
"at",
"info",
"level",
";"
] | ed6700bdd602fa26276e1f194d255e74c7f255b4 | https://github.com/cykerway/logging-ext/blob/ed6700bdd602fa26276e1f194d255e74c7f255b4/logging_ext/__init__.py#L40-L46 |
245,472 | cykerway/logging-ext | logging_ext/__init__.py | w | def w(msg, *args, **kwargs):
'''
log a message at warn level;
'''
return logging.log(WARN, msg, *args, **kwargs) | python | def w(msg, *args, **kwargs):
'''
log a message at warn level;
'''
return logging.log(WARN, msg, *args, **kwargs) | [
"def",
"w",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"logging",
".",
"log",
"(",
"WARN",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | log a message at warn level; | [
"log",
"a",
"message",
"at",
"warn",
"level",
";"
] | ed6700bdd602fa26276e1f194d255e74c7f255b4 | https://github.com/cykerway/logging-ext/blob/ed6700bdd602fa26276e1f194d255e74c7f255b4/logging_ext/__init__.py#L48-L54 |
245,473 | cykerway/logging-ext | logging_ext/__init__.py | e | def e(msg, *args, **kwargs):
'''
log a message at error level;
'''
return logging.log(ERROR, msg, *args, **kwargs) | python | def e(msg, *args, **kwargs):
'''
log a message at error level;
'''
return logging.log(ERROR, msg, *args, **kwargs) | [
"def",
"e",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"logging",
".",
"log",
"(",
"ERROR",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | log a message at error level; | [
"log",
"a",
"message",
"at",
"error",
"level",
";"
] | ed6700bdd602fa26276e1f194d255e74c7f255b4 | https://github.com/cykerway/logging-ext/blob/ed6700bdd602fa26276e1f194d255e74c7f255b4/logging_ext/__init__.py#L56-L62 |
245,474 | cykerway/logging-ext | logging_ext/__init__.py | getLogger | def getLogger(name=None):
'''
return a logger instrumented with additional 1-letter logging methods;
'''
logger = logging.getLogger(name=name)
if not hasattr(logger, 'd'):
def d(self, msg, *args, **kwargs):
return self.log(DEBUG, msg, *args, **kwargs)
logger.d = types.... | python | def getLogger(name=None):
'''
return a logger instrumented with additional 1-letter logging methods;
'''
logger = logging.getLogger(name=name)
if not hasattr(logger, 'd'):
def d(self, msg, *args, **kwargs):
return self.log(DEBUG, msg, *args, **kwargs)
logger.d = types.... | [
"def",
"getLogger",
"(",
"name",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
"=",
"name",
")",
"if",
"not",
"hasattr",
"(",
"logger",
",",
"'d'",
")",
":",
"def",
"d",
"(",
"self",
",",
"msg",
",",
"*",
"args",... | return a logger instrumented with additional 1-letter logging methods; | [
"return",
"a",
"logger",
"instrumented",
"with",
"additional",
"1",
"-",
"letter",
"logging",
"methods",
";"
] | ed6700bdd602fa26276e1f194d255e74c7f255b4 | https://github.com/cykerway/logging-ext/blob/ed6700bdd602fa26276e1f194d255e74c7f255b4/logging_ext/__init__.py#L68-L101 |
245,475 | Diaoul/pyextdirect | pyextdirect/router.py | create_instances | def create_instances(configuration):
"""Create necessary class instances from a configuration with no argument to the constructor
:param dict configuration: configuration dict like in :attr:`~pyextdirect.configuration.Base.configuration`
:return: a class-instance mapping
:rtype: dict
"""
insta... | python | def create_instances(configuration):
"""Create necessary class instances from a configuration with no argument to the constructor
:param dict configuration: configuration dict like in :attr:`~pyextdirect.configuration.Base.configuration`
:return: a class-instance mapping
:rtype: dict
"""
insta... | [
"def",
"create_instances",
"(",
"configuration",
")",
":",
"instances",
"=",
"{",
"}",
"for",
"methods",
"in",
"configuration",
".",
"itervalues",
"(",
")",
":",
"for",
"element",
"in",
"methods",
".",
"itervalues",
"(",
")",
":",
"if",
"not",
"isinstance"... | Create necessary class instances from a configuration with no argument to the constructor
:param dict configuration: configuration dict like in :attr:`~pyextdirect.configuration.Base.configuration`
:return: a class-instance mapping
:rtype: dict | [
"Create",
"necessary",
"class",
"instances",
"from",
"a",
"configuration",
"with",
"no",
"argument",
"to",
"the",
"constructor"
] | 34ddfe882d467b3769644e8131fb90fe472eff80 | https://github.com/Diaoul/pyextdirect/blob/34ddfe882d467b3769644e8131fb90fe472eff80/pyextdirect/router.py#L117-L133 |
245,476 | Diaoul/pyextdirect | pyextdirect/router.py | Router.call | def call(self, request):
"""Call the appropriate function
:param dict request: request that describes the function to call
:return: response linked to the request that holds the value returned by the called function
:rtype: dict
"""
result = None
try:
... | python | def call(self, request):
"""Call the appropriate function
:param dict request: request that describes the function to call
:return: response linked to the request that holds the value returned by the called function
:rtype: dict
"""
result = None
try:
... | [
"def",
"call",
"(",
"self",
",",
"request",
")",
":",
"result",
"=",
"None",
"try",
":",
"if",
"'extAction'",
"in",
"request",
":",
"# DirectSubmit method",
"tid",
"=",
"request",
"[",
"'extTID'",
"]",
"action",
"=",
"request",
"[",
"'extAction'",
"]",
"... | Call the appropriate function
:param dict request: request that describes the function to call
:return: response linked to the request that holds the value returned by the called function
:rtype: dict | [
"Call",
"the",
"appropriate",
"function"
] | 34ddfe882d467b3769644e8131fb90fe472eff80 | https://github.com/Diaoul/pyextdirect/blob/34ddfe882d467b3769644e8131fb90fe472eff80/pyextdirect/router.py#L59-L114 |
245,477 | lambdalisue/django-roughpages | src/roughpages/utils.py | url_to_filename | def url_to_filename(url):
"""
Safely translate url to relative filename
Args:
url (str): A target url string
Returns:
str
"""
# remove leading/trailing slash
if url.startswith('/'):
url = url[1:]
if url.endswith('/'):
url = url[:-1]
# remove pardir s... | python | def url_to_filename(url):
"""
Safely translate url to relative filename
Args:
url (str): A target url string
Returns:
str
"""
# remove leading/trailing slash
if url.startswith('/'):
url = url[1:]
if url.endswith('/'):
url = url[:-1]
# remove pardir s... | [
"def",
"url_to_filename",
"(",
"url",
")",
":",
"# remove leading/trailing slash",
"if",
"url",
".",
"startswith",
"(",
"'/'",
")",
":",
"url",
"=",
"url",
"[",
"1",
":",
"]",
"if",
"url",
".",
"endswith",
"(",
"'/'",
")",
":",
"url",
"=",
"url",
"["... | Safely translate url to relative filename
Args:
url (str): A target url string
Returns:
str | [
"Safely",
"translate",
"url",
"to",
"relative",
"filename"
] | f6a2724ece729c5deced2c2546d172561ef785ec | https://github.com/lambdalisue/django-roughpages/blob/f6a2724ece729c5deced2c2546d172561ef785ec/src/roughpages/utils.py#L8-L27 |
245,478 | lambdalisue/django-roughpages | src/roughpages/utils.py | remove_pardir_symbols | def remove_pardir_symbols(path, sep=os.sep, pardir=os.pardir):
"""
Remove relative path symobls such as '..'
Args:
path (str): A target path string
sep (str): A strint to refer path delimiter (Default: `os.sep`)
pardir (str): A string to refer parent directory (Default: `os.pardir`)... | python | def remove_pardir_symbols(path, sep=os.sep, pardir=os.pardir):
"""
Remove relative path symobls such as '..'
Args:
path (str): A target path string
sep (str): A strint to refer path delimiter (Default: `os.sep`)
pardir (str): A string to refer parent directory (Default: `os.pardir`)... | [
"def",
"remove_pardir_symbols",
"(",
"path",
",",
"sep",
"=",
"os",
".",
"sep",
",",
"pardir",
"=",
"os",
".",
"pardir",
")",
":",
"bits",
"=",
"path",
".",
"split",
"(",
"sep",
")",
"bits",
"=",
"(",
"x",
"for",
"x",
"in",
"bits",
"if",
"x",
"... | Remove relative path symobls such as '..'
Args:
path (str): A target path string
sep (str): A strint to refer path delimiter (Default: `os.sep`)
pardir (str): A string to refer parent directory (Default: `os.pardir`)
Returns:
str | [
"Remove",
"relative",
"path",
"symobls",
"such",
"as",
".."
] | f6a2724ece729c5deced2c2546d172561ef785ec | https://github.com/lambdalisue/django-roughpages/blob/f6a2724ece729c5deced2c2546d172561ef785ec/src/roughpages/utils.py#L30-L44 |
245,479 | pyokagan/pyglreg | glreg.py | _load | def _load(root):
"""Load from an xml.etree.ElementTree"""
types = _load_types(root)
enums = _load_enums(root)
commands = _load_commands(root)
features = _load_features(root)
extensions = _load_extensions(root)
return Registry(None, types, enums, commands, features, extensions) | python | def _load(root):
"""Load from an xml.etree.ElementTree"""
types = _load_types(root)
enums = _load_enums(root)
commands = _load_commands(root)
features = _load_features(root)
extensions = _load_extensions(root)
return Registry(None, types, enums, commands, features, extensions) | [
"def",
"_load",
"(",
"root",
")",
":",
"types",
"=",
"_load_types",
"(",
"root",
")",
"enums",
"=",
"_load_enums",
"(",
"root",
")",
"commands",
"=",
"_load_commands",
"(",
"root",
")",
"features",
"=",
"_load_features",
"(",
"root",
")",
"extensions",
"... | Load from an xml.etree.ElementTree | [
"Load",
"from",
"an",
"xml",
".",
"etree",
".",
"ElementTree"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L616-L623 |
245,480 | pyokagan/pyglreg | glreg.py | import_type | def import_type(dest, src, name, api=None, filter_symbol=None):
"""Import Type `name` and its dependencies from Registry `src`
to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of type to import
:param str api: Prefer to im... | python | def import_type(dest, src, name, api=None, filter_symbol=None):
"""Import Type `name` and its dependencies from Registry `src`
to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of type to import
:param str api: Prefer to im... | [
"def",
"import_type",
"(",
"dest",
",",
"src",
",",
"name",
",",
"api",
"=",
"None",
",",
"filter_symbol",
"=",
"None",
")",
":",
"if",
"not",
"filter_symbol",
":",
"filter_symbol",
"=",
"_default_filter_symbol",
"type",
"=",
"src",
".",
"get_type",
"(",
... | Import Type `name` and its dependencies from Registry `src`
to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of type to import
:param str api: Prefer to import Types with api Name `api`, or None to
import T... | [
"Import",
"Type",
"name",
"and",
"its",
"dependencies",
"from",
"Registry",
"src",
"to",
"Registry",
"dest",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L794-L814 |
245,481 | pyokagan/pyglreg | glreg.py | import_command | def import_command(dest, src, name, api=None, filter_symbol=None):
"""Import Command `name` and its dependencies from Registry `src`
to Registry `dest`
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Command to import
:param str api: Pref... | python | def import_command(dest, src, name, api=None, filter_symbol=None):
"""Import Command `name` and its dependencies from Registry `src`
to Registry `dest`
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Command to import
:param str api: Pref... | [
"def",
"import_command",
"(",
"dest",
",",
"src",
",",
"name",
",",
"api",
"=",
"None",
",",
"filter_symbol",
"=",
"None",
")",
":",
"if",
"not",
"filter_symbol",
":",
"filter_symbol",
"=",
"_default_filter_symbol",
"cmd",
"=",
"src",
".",
"commands",
"[",... | Import Command `name` and its dependencies from Registry `src`
to Registry `dest`
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Command to import
:param str api: Prefer to import Types with api name `api`, or None to
imp... | [
"Import",
"Command",
"name",
"and",
"its",
"dependencies",
"from",
"Registry",
"src",
"to",
"Registry",
"dest"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L817-L837 |
245,482 | pyokagan/pyglreg | glreg.py | import_enum | def import_enum(dest, src, name):
"""Import Enum `name` from Registry `src` to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Enum to import
"""
dest.enums[name] = src.enums[name] | python | def import_enum(dest, src, name):
"""Import Enum `name` from Registry `src` to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Enum to import
"""
dest.enums[name] = src.enums[name] | [
"def",
"import_enum",
"(",
"dest",
",",
"src",
",",
"name",
")",
":",
"dest",
".",
"enums",
"[",
"name",
"]",
"=",
"src",
".",
"enums",
"[",
"name",
"]"
] | Import Enum `name` from Registry `src` to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Enum to import | [
"Import",
"Enum",
"name",
"from",
"Registry",
"src",
"to",
"Registry",
"dest",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L840-L847 |
245,483 | pyokagan/pyglreg | glreg.py | import_feature | def import_feature(dest, src, name, api=None, profile=None,
filter_symbol=None):
"""Imports Feature `name`, and all its dependencies, from
Registry `src` to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of F... | python | def import_feature(dest, src, name, api=None, profile=None,
filter_symbol=None):
"""Imports Feature `name`, and all its dependencies, from
Registry `src` to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of F... | [
"def",
"import_feature",
"(",
"dest",
",",
"src",
",",
"name",
",",
"api",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"filter_symbol",
"=",
"None",
")",
":",
"if",
"filter_symbol",
"is",
"None",
":",
"filter_symbol",
"=",
"_default_filter_symbol",
"ft"... | Imports Feature `name`, and all its dependencies, from
Registry `src` to Registry `dest`.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Feature to import
:param str api: Prefer to import dependencies with api name `api`,
... | [
"Imports",
"Feature",
"name",
"and",
"all",
"its",
"dependencies",
"from",
"Registry",
"src",
"to",
"Registry",
"dest",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L850-L890 |
245,484 | pyokagan/pyglreg | glreg.py | import_extension | def import_extension(dest, src, name, api=None, profile=None,
filter_symbol=None):
"""Imports Extension `name`, and all its dependencies.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Extension to import
:param str api:... | python | def import_extension(dest, src, name, api=None, profile=None,
filter_symbol=None):
"""Imports Extension `name`, and all its dependencies.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Extension to import
:param str api:... | [
"def",
"import_extension",
"(",
"dest",
",",
"src",
",",
"name",
",",
"api",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"filter_symbol",
"=",
"None",
")",
":",
"if",
"filter_symbol",
"is",
"None",
":",
"filter_symbol",
"=",
"_default_filter_symbol",
"e... | Imports Extension `name`, and all its dependencies.
:param Registry dest: Destination Registry
:param Registry src: Source Registry
:param str name: Name of Extension to import
:param str api: Prefer to import types with API name `api`,
or None to prefer Types with no API name.
:typ... | [
"Imports",
"Extension",
"name",
"and",
"all",
"its",
"dependencies",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L893-L923 |
245,485 | pyokagan/pyglreg | glreg.py | import_registry | def import_registry(dest, src, api=None, profile=None, support=None,
filter_symbol=None):
"""Imports all features and extensions and all their dependencies.
:param Registry dest: Destination API
:param Registry src: Source Registry
:param str api: Only import Features with API name ... | python | def import_registry(dest, src, api=None, profile=None, support=None,
filter_symbol=None):
"""Imports all features and extensions and all their dependencies.
:param Registry dest: Destination API
:param Registry src: Source Registry
:param str api: Only import Features with API name ... | [
"def",
"import_registry",
"(",
"dest",
",",
"src",
",",
"api",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"support",
"=",
"None",
",",
"filter_symbol",
"=",
"None",
")",
":",
"if",
"filter_symbol",
"is",
"None",
":",
"filter_symbol",
"=",
"_default_f... | Imports all features and extensions and all their dependencies.
:param Registry dest: Destination API
:param Registry src: Source Registry
:param str api: Only import Features with API name `api`, or None
to import all features.
:param str profile: Only import Features with profile ... | [
"Imports",
"all",
"features",
"and",
"extensions",
"and",
"all",
"their",
"dependencies",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L926-L947 |
245,486 | pyokagan/pyglreg | glreg.py | extension_sort_key | def extension_sort_key(extension):
"""Returns the sorting key for an extension.
The sorting key can be used to sort a list of extensions
into the order that is used in the Khronos C OpenGL headers.
:param Extension extension: Extension to produce sort key for
:returns: A sorting key
"""
nam... | python | def extension_sort_key(extension):
"""Returns the sorting key for an extension.
The sorting key can be used to sort a list of extensions
into the order that is used in the Khronos C OpenGL headers.
:param Extension extension: Extension to produce sort key for
:returns: A sorting key
"""
nam... | [
"def",
"extension_sort_key",
"(",
"extension",
")",
":",
"name",
"=",
"extension",
".",
"name",
"category",
"=",
"name",
".",
"split",
"(",
"'_'",
",",
"2",
")",
"[",
"1",
"]",
"return",
"(",
"0",
",",
"name",
")",
"if",
"category",
"in",
"(",
"'AR... | Returns the sorting key for an extension.
The sorting key can be used to sort a list of extensions
into the order that is used in the Khronos C OpenGL headers.
:param Extension extension: Extension to produce sort key for
:returns: A sorting key | [
"Returns",
"the",
"sorting",
"key",
"for",
"an",
"extension",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L950-L960 |
245,487 | pyokagan/pyglreg | glreg.py | group_apis | def group_apis(reg, features=None, extensions=None, api=None, profile=None,
support=None):
"""Groups Types, Enums, Commands with their respective Features, Extensions
Similar to :py:func:`import_registry`, but generates a new Registry object
for every feature or extension.
:param Regist... | python | def group_apis(reg, features=None, extensions=None, api=None, profile=None,
support=None):
"""Groups Types, Enums, Commands with their respective Features, Extensions
Similar to :py:func:`import_registry`, but generates a new Registry object
for every feature or extension.
:param Regist... | [
"def",
"group_apis",
"(",
"reg",
",",
"features",
"=",
"None",
",",
"extensions",
"=",
"None",
",",
"api",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"support",
"=",
"None",
")",
":",
"features",
"=",
"(",
"reg",
".",
"get_features",
"(",
"api",
... | Groups Types, Enums, Commands with their respective Features, Extensions
Similar to :py:func:`import_registry`, but generates a new Registry object
for every feature or extension.
:param Registry reg: Input registry
:param features: Feature names to import, or None to import all.
:type features: I... | [
"Groups",
"Types",
"Enums",
"Commands",
"with",
"their",
"respective",
"Features",
"Extensions"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L963-L1009 |
245,488 | pyokagan/pyglreg | glreg.py | main | def main(args=None, prog=None):
"""Generates a C header file"""
args = args if args is not None else sys.argv[1:]
prog = prog if prog is not None else sys.argv[0]
# Prevent broken pipe exception from being raised.
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
stdin = sys.stdin.buffer if hasattr(... | python | def main(args=None, prog=None):
"""Generates a C header file"""
args = args if args is not None else sys.argv[1:]
prog = prog if prog is not None else sys.argv[0]
# Prevent broken pipe exception from being raised.
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
stdin = sys.stdin.buffer if hasattr(... | [
"def",
"main",
"(",
"args",
"=",
"None",
",",
"prog",
"=",
"None",
")",
":",
"args",
"=",
"args",
"if",
"args",
"is",
"not",
"None",
"else",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"prog",
"=",
"prog",
"if",
"prog",
"is",
"not",
"None",
"else",... | Generates a C header file | [
"Generates",
"a",
"C",
"header",
"file"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L1012-L1065 |
245,489 | pyokagan/pyglreg | glreg.py | Command.required_types | def required_types(self):
"""Set of names of types which the Command depends on.
"""
required_types = set(x.type for x in self.params)
required_types.add(self.type)
required_types.discard(None)
return required_types | python | def required_types(self):
"""Set of names of types which the Command depends on.
"""
required_types = set(x.type for x in self.params)
required_types.add(self.type)
required_types.discard(None)
return required_types | [
"def",
"required_types",
"(",
"self",
")",
":",
"required_types",
"=",
"set",
"(",
"x",
".",
"type",
"for",
"x",
"in",
"self",
".",
"params",
")",
"required_types",
".",
"add",
"(",
"self",
".",
"type",
")",
"required_types",
".",
"discard",
"(",
"None... | Set of names of types which the Command depends on. | [
"Set",
"of",
"names",
"of",
"types",
"which",
"the",
"Command",
"depends",
"on",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L202-L208 |
245,490 | pyokagan/pyglreg | glreg.py | Command.proto_text | def proto_text(self):
"""Formatted Command identifier.
Equivalent to ``self.proto_template.format(type=self.type,
name=self.name)``.
"""
return self.proto_template.format(type=self.type, name=self.name) | python | def proto_text(self):
"""Formatted Command identifier.
Equivalent to ``self.proto_template.format(type=self.type,
name=self.name)``.
"""
return self.proto_template.format(type=self.type, name=self.name) | [
"def",
"proto_text",
"(",
"self",
")",
":",
"return",
"self",
".",
"proto_template",
".",
"format",
"(",
"type",
"=",
"self",
".",
"type",
",",
"name",
"=",
"self",
".",
"name",
")"
] | Formatted Command identifier.
Equivalent to ``self.proto_template.format(type=self.type,
name=self.name)``. | [
"Formatted",
"Command",
"identifier",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L211-L217 |
245,491 | pyokagan/pyglreg | glreg.py | Command.text | def text(self):
"""Formatted Command declaration.
This is the C declaration for the command.
"""
params = ', '.join(x.text for x in self.params)
return '{0} ({1})'.format(self.proto_text, params) | python | def text(self):
"""Formatted Command declaration.
This is the C declaration for the command.
"""
params = ', '.join(x.text for x in self.params)
return '{0} ({1})'.format(self.proto_text, params) | [
"def",
"text",
"(",
"self",
")",
":",
"params",
"=",
"', '",
".",
"join",
"(",
"x",
".",
"text",
"for",
"x",
"in",
"self",
".",
"params",
")",
"return",
"'{0} ({1})'",
".",
"format",
"(",
"self",
".",
"proto_text",
",",
"params",
")"
] | Formatted Command declaration.
This is the C declaration for the command. | [
"Formatted",
"Command",
"declaration",
"."
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L220-L226 |
245,492 | pyokagan/pyglreg | glreg.py | Param.text | def text(self):
"""Formatted param definition
Equivalent to ``self.template.format(name=self.name, type=self.type)``.
"""
return self.template.format(name=self.name, type=self.type) | python | def text(self):
"""Formatted param definition
Equivalent to ``self.template.format(name=self.name, type=self.type)``.
"""
return self.template.format(name=self.name, type=self.type) | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
".",
"template",
".",
"format",
"(",
"name",
"=",
"self",
".",
"name",
",",
"type",
"=",
"self",
".",
"type",
")"
] | Formatted param definition
Equivalent to ``self.template.format(name=self.name, type=self.type)``. | [
"Formatted",
"param",
"definition"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L243-L248 |
245,493 | pyokagan/pyglreg | glreg.py | Require.as_symbols | def as_symbols(self):
"""Set of symbols required by this Require
:return: set of ``(symbol type, symbol name)`` tuples
"""
out = set()
for name in self.types:
out.add(('type', name))
for name in self.enums:
out.add(('enum', name))
for name... | python | def as_symbols(self):
"""Set of symbols required by this Require
:return: set of ``(symbol type, symbol name)`` tuples
"""
out = set()
for name in self.types:
out.add(('type', name))
for name in self.enums:
out.add(('enum', name))
for name... | [
"def",
"as_symbols",
"(",
"self",
")",
":",
"out",
"=",
"set",
"(",
")",
"for",
"name",
"in",
"self",
".",
"types",
":",
"out",
".",
"add",
"(",
"(",
"'type'",
",",
"name",
")",
")",
"for",
"name",
"in",
"self",
".",
"enums",
":",
"out",
".",
... | Set of symbols required by this Require
:return: set of ``(symbol type, symbol name)`` tuples | [
"Set",
"of",
"symbols",
"required",
"by",
"this",
"Require"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L274-L286 |
245,494 | pyokagan/pyglreg | glreg.py | Feature.get_profiles | def get_profiles(self):
"""Returns set of profile names referenced in this Feature
:returns: set of profile names
"""
out = set(x.profile for x in self.requires if x.profile)
out.update(x.profile for x in self.removes if x.profile)
return out | python | def get_profiles(self):
"""Returns set of profile names referenced in this Feature
:returns: set of profile names
"""
out = set(x.profile for x in self.requires if x.profile)
out.update(x.profile for x in self.removes if x.profile)
return out | [
"def",
"get_profiles",
"(",
"self",
")",
":",
"out",
"=",
"set",
"(",
"x",
".",
"profile",
"for",
"x",
"in",
"self",
".",
"requires",
"if",
"x",
".",
"profile",
")",
"out",
".",
"update",
"(",
"x",
".",
"profile",
"for",
"x",
"in",
"self",
".",
... | Returns set of profile names referenced in this Feature
:returns: set of profile names | [
"Returns",
"set",
"of",
"profile",
"names",
"referenced",
"in",
"this",
"Feature"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L355-L362 |
245,495 | pyokagan/pyglreg | glreg.py | Feature.get_requires | def get_requires(self, profile=None):
"""Get filtered list of Require objects in this Feature
:param str profile: Return Require objects with this profile or None
to return all Require objects.
:return: list of Require objects
"""
out = []
for... | python | def get_requires(self, profile=None):
"""Get filtered list of Require objects in this Feature
:param str profile: Return Require objects with this profile or None
to return all Require objects.
:return: list of Require objects
"""
out = []
for... | [
"def",
"get_requires",
"(",
"self",
",",
"profile",
"=",
"None",
")",
":",
"out",
"=",
"[",
"]",
"for",
"req",
"in",
"self",
".",
"requires",
":",
"# Filter Require by profile",
"if",
"(",
"(",
"req",
".",
"profile",
"and",
"not",
"profile",
")",
"or",... | Get filtered list of Require objects in this Feature
:param str profile: Return Require objects with this profile or None
to return all Require objects.
:return: list of Require objects | [
"Get",
"filtered",
"list",
"of",
"Require",
"objects",
"in",
"this",
"Feature"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L364-L378 |
245,496 | pyokagan/pyglreg | glreg.py | Feature.get_removes | def get_removes(self, profile=None):
"""Get filtered list of Remove objects in this Feature
:param str profile: Return Remove objects with this profile or None
to return all Remove objects.
:return: list of Remove objects
"""
out = []
for rem ... | python | def get_removes(self, profile=None):
"""Get filtered list of Remove objects in this Feature
:param str profile: Return Remove objects with this profile or None
to return all Remove objects.
:return: list of Remove objects
"""
out = []
for rem ... | [
"def",
"get_removes",
"(",
"self",
",",
"profile",
"=",
"None",
")",
":",
"out",
"=",
"[",
"]",
"for",
"rem",
"in",
"self",
".",
"removes",
":",
"# Filter Remove by profile",
"if",
"(",
"(",
"rem",
".",
"profile",
"and",
"not",
"profile",
")",
"or",
... | Get filtered list of Remove objects in this Feature
:param str profile: Return Remove objects with this profile or None
to return all Remove objects.
:return: list of Remove objects | [
"Get",
"filtered",
"list",
"of",
"Remove",
"objects",
"in",
"this",
"Feature"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L380-L394 |
245,497 | pyokagan/pyglreg | glreg.py | Extension.get_apis | def get_apis(self):
"""Returns set of api names referenced in this Extension
:return: set of api name strings
"""
out = set()
out.update(x.api for x in self.requires if x.api)
return out | python | def get_apis(self):
"""Returns set of api names referenced in this Extension
:return: set of api name strings
"""
out = set()
out.update(x.api for x in self.requires if x.api)
return out | [
"def",
"get_apis",
"(",
"self",
")",
":",
"out",
"=",
"set",
"(",
")",
"out",
".",
"update",
"(",
"x",
".",
"api",
"for",
"x",
"in",
"self",
".",
"requires",
"if",
"x",
".",
"api",
")",
"return",
"out"
] | Returns set of api names referenced in this Extension
:return: set of api name strings | [
"Returns",
"set",
"of",
"api",
"names",
"referenced",
"in",
"this",
"Extension"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L416-L423 |
245,498 | pyokagan/pyglreg | glreg.py | Extension.get_profiles | def get_profiles(self):
"""Returns set of profile names referenced in this Extension
:return: set of profile name strings
"""
return set(x.profile for x in self.requires if x.profile) | python | def get_profiles(self):
"""Returns set of profile names referenced in this Extension
:return: set of profile name strings
"""
return set(x.profile for x in self.requires if x.profile) | [
"def",
"get_profiles",
"(",
"self",
")",
":",
"return",
"set",
"(",
"x",
".",
"profile",
"for",
"x",
"in",
"self",
".",
"requires",
"if",
"x",
".",
"profile",
")"
] | Returns set of profile names referenced in this Extension
:return: set of profile name strings | [
"Returns",
"set",
"of",
"profile",
"names",
"referenced",
"in",
"this",
"Extension"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L425-L430 |
245,499 | pyokagan/pyglreg | glreg.py | Extension.get_requires | def get_requires(self, api=None, profile=None):
"""Return filtered list of Require objects in this Extension
:param str api: Return Require objects with this api name or None to
return all Require objects.
:param str profile: Return Require objects with this profile or N... | python | def get_requires(self, api=None, profile=None):
"""Return filtered list of Require objects in this Extension
:param str api: Return Require objects with this api name or None to
return all Require objects.
:param str profile: Return Require objects with this profile or N... | [
"def",
"get_requires",
"(",
"self",
",",
"api",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"out",
"=",
"[",
"]",
"for",
"req",
"in",
"self",
".",
"requires",
":",
"# Filter Remove by API",
"if",
"(",
"req",
".",
"api",
"and",
"not",
"api",
... | Return filtered list of Require objects in this Extension
:param str api: Return Require objects with this api name or None to
return all Require objects.
:param str profile: Return Require objects with this profile or None
to return all Require objec... | [
"Return",
"filtered",
"list",
"of",
"Require",
"objects",
"in",
"this",
"Extension"
] | 68fa5a6c6cee8667879840fbbcc7d30f52852915 | https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L439-L458 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.