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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40,500 | mardix/Yass | yass/yass.py | Yass.publish | def publish(self, target="S3", sitename=None, purge_files=True):
"""
To publish programatically
:param target: Where to pusblish at, S3
:param sitename: The site name
:param purge_files: if True, it will delete old files
:return:
"""
self.build()
... | python | def publish(self, target="S3", sitename=None, purge_files=True):
"""
To publish programatically
:param target: Where to pusblish at, S3
:param sitename: The site name
:param purge_files: if True, it will delete old files
:return:
"""
self.build()
... | [
"def",
"publish",
"(",
"self",
",",
"target",
"=",
"\"S3\"",
",",
"sitename",
"=",
"None",
",",
"purge_files",
"=",
"True",
")",
":",
"self",
".",
"build",
"(",
")",
"endpoint",
"=",
"self",
".",
"config",
".",
"get",
"(",
"\"hosting.%s\"",
"%",
"tar... | To publish programatically
:param target: Where to pusblish at, S3
:param sitename: The site name
:param purge_files: if True, it will delete old files
:return: | [
"To",
"publish",
"programatically"
] | 32f804c1a916f5b0a13d13fa750e52be3b6d666d | https://github.com/mardix/Yass/blob/32f804c1a916f5b0a13d13fa750e52be3b6d666d/yass/yass.py#L480-L511 |
40,501 | azraq27/gini | gini/semantics.py | sort_matches | def sort_matches(matches):
'''Sorts a ``list`` of matches best to worst'''
multipliers = {'exact':10**5,'fname':10**4,'fuzzy':10**2,'fuzzy_fragment':1}
matches = [(multipliers[x.type]*(x.amount if x.amount else 1),x) for x in matches]
return [x[1] for x in sorted(matches,reverse=True)] | python | def sort_matches(matches):
'''Sorts a ``list`` of matches best to worst'''
multipliers = {'exact':10**5,'fname':10**4,'fuzzy':10**2,'fuzzy_fragment':1}
matches = [(multipliers[x.type]*(x.amount if x.amount else 1),x) for x in matches]
return [x[1] for x in sorted(matches,reverse=True)] | [
"def",
"sort_matches",
"(",
"matches",
")",
":",
"multipliers",
"=",
"{",
"'exact'",
":",
"10",
"**",
"5",
",",
"'fname'",
":",
"10",
"**",
"4",
",",
"'fuzzy'",
":",
"10",
"**",
"2",
",",
"'fuzzy_fragment'",
":",
"1",
"}",
"matches",
"=",
"[",
"(",... | Sorts a ``list`` of matches best to worst | [
"Sorts",
"a",
"list",
"of",
"matches",
"best",
"to",
"worst"
] | 3c2b5265d096d606b303bfe25ac9adb74b8cee14 | https://github.com/azraq27/gini/blob/3c2b5265d096d606b303bfe25ac9adb74b8cee14/gini/semantics.py#L29-L33 |
40,502 | objectrocket/python-client | objectrocket/instances/__init__.py | Instances.all | def all(self):
"""Get all ObjectRocket instances the current client has access to.
:returns: A list of :py:class:`bases.BaseInstance` instances.
:rtype: list
"""
response = requests.get(self._url, **self._default_request_kwargs)
data = self._get_response_data(response)
... | python | def all(self):
"""Get all ObjectRocket instances the current client has access to.
:returns: A list of :py:class:`bases.BaseInstance` instances.
:rtype: list
"""
response = requests.get(self._url, **self._default_request_kwargs)
data = self._get_response_data(response)
... | [
"def",
"all",
"(",
"self",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"_url",
",",
"*",
"*",
"self",
".",
"_default_request_kwargs",
")",
"data",
"=",
"self",
".",
"_get_response_data",
"(",
"response",
")",
"return",
"self",
... | Get all ObjectRocket instances the current client has access to.
:returns: A list of :py:class:`bases.BaseInstance` instances.
:rtype: list | [
"Get",
"all",
"ObjectRocket",
"instances",
"the",
"current",
"client",
"has",
"access",
"to",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/instances/__init__.py#L33-L41 |
40,503 | objectrocket/python-client | objectrocket/instances/__init__.py | Instances.create | def create(self, name, plan, zone,
service_type='mongodb', instance_type='mongodb_sharded', version='2.4.6'):
"""Create an ObjectRocket instance.
:param str name: The name to give to the new instance.
:param int plan: The plan size of the new instance.
:param str zone: Th... | python | def create(self, name, plan, zone,
service_type='mongodb', instance_type='mongodb_sharded', version='2.4.6'):
"""Create an ObjectRocket instance.
:param str name: The name to give to the new instance.
:param int plan: The plan size of the new instance.
:param str zone: Th... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"plan",
",",
"zone",
",",
"service_type",
"=",
"'mongodb'",
",",
"instance_type",
"=",
"'mongodb_sharded'",
",",
"version",
"=",
"'2.4.6'",
")",
":",
"# Build up request data.",
"url",
"=",
"self",
".",
"_url",... | Create an ObjectRocket instance.
:param str name: The name to give to the new instance.
:param int plan: The plan size of the new instance.
:param str zone: The zone that the new instance is to exist in.
:param str service_type: The type of service that the new instance is to provide.
... | [
"Create",
"an",
"ObjectRocket",
"instance",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/instances/__init__.py#L44-L81 |
40,504 | objectrocket/python-client | objectrocket/instances/__init__.py | Instances.get | def get(self, instance_name):
"""Get an ObjectRocket instance by name.
:param str instance_name: The name of the instance to retrieve.
:returns: A subclass of :py:class:`bases.BaseInstance`, or None if instance does not exist.
:rtype: :py:class:`bases.BaseInstance`
"""
u... | python | def get(self, instance_name):
"""Get an ObjectRocket instance by name.
:param str instance_name: The name of the instance to retrieve.
:returns: A subclass of :py:class:`bases.BaseInstance`, or None if instance does not exist.
:rtype: :py:class:`bases.BaseInstance`
"""
u... | [
"def",
"get",
"(",
"self",
",",
"instance_name",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"instance_name",
"+",
"'/'",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"*",
"*",
"self",
".",
"_default_request_kwargs",
")",
"data",
"=",
... | Get an ObjectRocket instance by name.
:param str instance_name: The name of the instance to retrieve.
:returns: A subclass of :py:class:`bases.BaseInstance`, or None if instance does not exist.
:rtype: :py:class:`bases.BaseInstance` | [
"Get",
"an",
"ObjectRocket",
"instance",
"by",
"name",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/instances/__init__.py#L84-L94 |
40,505 | objectrocket/python-client | objectrocket/instances/__init__.py | Instances._concrete_instance | def _concrete_instance(self, instance_doc):
"""Concretize an instance document.
:param dict instance_doc: A document describing an instance. Should come from the API.
:returns: A subclass of :py:class:`bases.BaseInstance`, or None.
:rtype: :py:class:`bases.BaseInstance`
"""
... | python | def _concrete_instance(self, instance_doc):
"""Concretize an instance document.
:param dict instance_doc: A document describing an instance. Should come from the API.
:returns: A subclass of :py:class:`bases.BaseInstance`, or None.
:rtype: :py:class:`bases.BaseInstance`
"""
... | [
"def",
"_concrete_instance",
"(",
"self",
",",
"instance_doc",
")",
":",
"if",
"not",
"isinstance",
"(",
"instance_doc",
",",
"dict",
")",
":",
"return",
"None",
"# Attempt to instantiate the appropriate class for the given instance document.",
"try",
":",
"service",
"=... | Concretize an instance document.
:param dict instance_doc: A document describing an instance. Should come from the API.
:returns: A subclass of :py:class:`bases.BaseInstance`, or None.
:rtype: :py:class:`bases.BaseInstance` | [
"Concretize",
"an",
"instance",
"document",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/instances/__init__.py#L99-L123 |
40,506 | objectrocket/python-client | objectrocket/instances/__init__.py | Instances._concrete_instance_list | def _concrete_instance_list(self, instance_docs):
"""Concretize a list of instance documents.
:param list instance_docs: A list of instance documents. Should come from the API.
:returns: A list of :py:class:`bases.BaseInstance`s.
:rtype: list
"""
if not instance_docs:
... | python | def _concrete_instance_list(self, instance_docs):
"""Concretize a list of instance documents.
:param list instance_docs: A list of instance documents. Should come from the API.
:returns: A list of :py:class:`bases.BaseInstance`s.
:rtype: list
"""
if not instance_docs:
... | [
"def",
"_concrete_instance_list",
"(",
"self",
",",
"instance_docs",
")",
":",
"if",
"not",
"instance_docs",
":",
"return",
"[",
"]",
"return",
"list",
"(",
"filter",
"(",
"None",
",",
"[",
"self",
".",
"_concrete_instance",
"(",
"instance_doc",
"=",
"doc",
... | Concretize a list of instance documents.
:param list instance_docs: A list of instance documents. Should come from the API.
:returns: A list of :py:class:`bases.BaseInstance`s.
:rtype: list | [
"Concretize",
"a",
"list",
"of",
"instance",
"documents",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/objectrocket/instances/__init__.py#L125-L137 |
40,507 | TissueMAPS/TmDeploy | elasticluster/elasticluster/repository.py | DiskRepository.get | def get(self, name):
"""Retrieves the cluster with the given name.
:param str name: name of the cluster (identifier)
:return: :py:class:`elasticluster.cluster.Cluster`
"""
path = self._get_cluster_storage_path(name)
try:
with open(path, 'r') as storage:
... | python | def get(self, name):
"""Retrieves the cluster with the given name.
:param str name: name of the cluster (identifier)
:return: :py:class:`elasticluster.cluster.Cluster`
"""
path = self._get_cluster_storage_path(name)
try:
with open(path, 'r') as storage:
... | [
"def",
"get",
"(",
"self",
",",
"name",
")",
":",
"path",
"=",
"self",
".",
"_get_cluster_storage_path",
"(",
"name",
")",
"try",
":",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"storage",
":",
"cluster",
"=",
"self",
".",
"load",
"(",
"st... | Retrieves the cluster with the given name.
:param str name: name of the cluster (identifier)
:return: :py:class:`elasticluster.cluster.Cluster` | [
"Retrieves",
"the",
"cluster",
"with",
"the",
"given",
"name",
"."
] | f891b4ffb21431988bc4a063ae871da3bf284a45 | https://github.com/TissueMAPS/TmDeploy/blob/f891b4ffb21431988bc4a063ae871da3bf284a45/elasticluster/elasticluster/repository.py#L178-L198 |
40,508 | TissueMAPS/TmDeploy | elasticluster/elasticluster/repository.py | DiskRepository.save_or_update | def save_or_update(self, cluster):
"""Save or update the cluster to persistent state.
:param cluster: cluster to save or update
:type cluster: :py:class:`elasticluster.cluster.Cluster`
"""
if not os.path.exists(self.storage_path):
os.makedirs(self.storage_path)
... | python | def save_or_update(self, cluster):
"""Save or update the cluster to persistent state.
:param cluster: cluster to save or update
:type cluster: :py:class:`elasticluster.cluster.Cluster`
"""
if not os.path.exists(self.storage_path):
os.makedirs(self.storage_path)
... | [
"def",
"save_or_update",
"(",
"self",
",",
"cluster",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"storage_path",
")",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"storage_path",
")",
"path",
"=",
"self",
".",
"_get_c... | Save or update the cluster to persistent state.
:param cluster: cluster to save or update
:type cluster: :py:class:`elasticluster.cluster.Cluster` | [
"Save",
"or",
"update",
"the",
"cluster",
"to",
"persistent",
"state",
"."
] | f891b4ffb21431988bc4a063ae871da3bf284a45 | https://github.com/TissueMAPS/TmDeploy/blob/f891b4ffb21431988bc4a063ae871da3bf284a45/elasticluster/elasticluster/repository.py#L200-L212 |
40,509 | trevisanj/a99 | a99/gui/syntax.py | _format | def _format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
_format.setForeground(_color)
if 'bold' in style:
_format.setFontWeight(QFont.Bold)
if 'italic' in style:
... | python | def _format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
_format.setForeground(_color)
if 'bold' in style:
_format.setFontWeight(QFont.Bold)
if 'italic' in style:
... | [
"def",
"_format",
"(",
"color",
",",
"style",
"=",
"''",
")",
":",
"_color",
"=",
"QColor",
"(",
")",
"_color",
".",
"setNamedColor",
"(",
"color",
")",
"_format",
"=",
"QTextCharFormat",
"(",
")",
"_format",
".",
"setForeground",
"(",
"_color",
")",
"... | Return a QTextCharFormat with the given attributes. | [
"Return",
"a",
"QTextCharFormat",
"with",
"the",
"given",
"attributes",
"."
] | 193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539 | https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/syntax.py#L12-L25 |
40,510 | trevisanj/a99 | a99/gui/syntax.py | PythonHighlighter.highlightBlock | def highlightBlock(self, text):
"""Apply syntax highlighting to the given block of text.
"""
# Do other syntax formatting
for expression, nth, format in self.rules:
index = expression.indexIn(text, 0)
while index >= 0:
# We actually want t... | python | def highlightBlock(self, text):
"""Apply syntax highlighting to the given block of text.
"""
# Do other syntax formatting
for expression, nth, format in self.rules:
index = expression.indexIn(text, 0)
while index >= 0:
# We actually want t... | [
"def",
"highlightBlock",
"(",
"self",
",",
"text",
")",
":",
"# Do other syntax formatting\r",
"for",
"expression",
",",
"nth",
",",
"format",
"in",
"self",
".",
"rules",
":",
"index",
"=",
"expression",
".",
"indexIn",
"(",
"text",
",",
"0",
")",
"while",... | Apply syntax highlighting to the given block of text. | [
"Apply",
"syntax",
"highlighting",
"to",
"the",
"given",
"block",
"of",
"text",
"."
] | 193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539 | https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/syntax.py#L120-L139 |
40,511 | trevisanj/a99 | a99/gui/syntax.py | PythonHighlighter.match_multiline | def match_multiline(self, text, delimiter, in_state, style):
"""Do highlighting of multi-line strings. ``delimiter`` should be a
``QRegExp`` for triple-single-quotes or triple-double-quotes, and
``in_state`` should be a unique integer to represent the corresponding
state changes when... | python | def match_multiline(self, text, delimiter, in_state, style):
"""Do highlighting of multi-line strings. ``delimiter`` should be a
``QRegExp`` for triple-single-quotes or triple-double-quotes, and
``in_state`` should be a unique integer to represent the corresponding
state changes when... | [
"def",
"match_multiline",
"(",
"self",
",",
"text",
",",
"delimiter",
",",
"in_state",
",",
"style",
")",
":",
"# If inside triple-single quotes, start at 0\r",
"if",
"self",
".",
"previousBlockState",
"(",
")",
"==",
"in_state",
":",
"start",
"=",
"0",
"add",
... | Do highlighting of multi-line strings. ``delimiter`` should be a
``QRegExp`` for triple-single-quotes or triple-double-quotes, and
``in_state`` should be a unique integer to represent the corresponding
state changes when inside those strings. Returns True if we're still
inside a mult... | [
"Do",
"highlighting",
"of",
"multi",
"-",
"line",
"strings",
".",
"delimiter",
"should",
"be",
"a",
"QRegExp",
"for",
"triple",
"-",
"single",
"-",
"quotes",
"or",
"triple",
"-",
"double",
"-",
"quotes",
"and",
"in_state",
"should",
"be",
"a",
"unique",
... | 193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539 | https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/syntax.py#L142-L180 |
40,512 | MechanisM/django-confy | confy/search.py | config | def config(name='SEARCH_URL', default='simple://'):
"""Returns configured SEARCH dictionary from SEARCH_URL"""
config = {}
s = env(name, default)
if s:
config = parse_search_url(s)
return config | python | def config(name='SEARCH_URL', default='simple://'):
"""Returns configured SEARCH dictionary from SEARCH_URL"""
config = {}
s = env(name, default)
if s:
config = parse_search_url(s)
return config | [
"def",
"config",
"(",
"name",
"=",
"'SEARCH_URL'",
",",
"default",
"=",
"'simple://'",
")",
":",
"config",
"=",
"{",
"}",
"s",
"=",
"env",
"(",
"name",
",",
"default",
")",
"if",
"s",
":",
"config",
"=",
"parse_search_url",
"(",
"s",
")",
"return",
... | Returns configured SEARCH dictionary from SEARCH_URL | [
"Returns",
"configured",
"SEARCH",
"dictionary",
"from",
"SEARCH_URL"
] | 53818db22d1f05623d257aac2abdc625f5972d88 | https://github.com/MechanisM/django-confy/blob/53818db22d1f05623d257aac2abdc625f5972d88/confy/search.py#L66-L75 |
40,513 | inveniosoftware-attic/invenio-utils | invenio_utils/washers.py | wash_urlargd | def wash_urlargd(form, content):
"""Wash the complete form based on the specification in content.
Content is a dictionary containing the field names as a
key, and a tuple (type, default) as value.
'type' can be list, unicode, legacy.wsgi.utils.StringField, int,
tuple, or legacy.wsgi.utils.Field (f... | python | def wash_urlargd(form, content):
"""Wash the complete form based on the specification in content.
Content is a dictionary containing the field names as a
key, and a tuple (type, default) as value.
'type' can be list, unicode, legacy.wsgi.utils.StringField, int,
tuple, or legacy.wsgi.utils.Field (f... | [
"def",
"wash_urlargd",
"(",
"form",
",",
"content",
")",
":",
"result",
"=",
"{",
"}",
"for",
"k",
",",
"(",
"dst_type",
",",
"default",
")",
"in",
"content",
".",
"items",
"(",
")",
":",
"try",
":",
"value",
"=",
"form",
"[",
"k",
"]",
"except",... | Wash the complete form based on the specification in content.
Content is a dictionary containing the field names as a
key, and a tuple (type, default) as value.
'type' can be list, unicode, legacy.wsgi.utils.StringField, int,
tuple, or legacy.wsgi.utils.Field (for file uploads).
The specification... | [
"Wash",
"the",
"complete",
"form",
"based",
"on",
"the",
"specification",
"in",
"content",
"."
] | 9a1c6db4e3f1370901f329f510480dd8df188296 | https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/washers.py#L25-L105 |
40,514 | inveniosoftware-attic/invenio-utils | invenio_utils/washers.py | wash_html_id | def wash_html_id(dirty):
"""Strip non-alphabetic or newline characters from a given string.
It can be used as a HTML element ID (also with jQuery and in all browsers).
:param dirty: the string to wash
:returns: the HTML ID ready string
"""
import re
if not dirty[0].isalpha():
# we ... | python | def wash_html_id(dirty):
"""Strip non-alphabetic or newline characters from a given string.
It can be used as a HTML element ID (also with jQuery and in all browsers).
:param dirty: the string to wash
:returns: the HTML ID ready string
"""
import re
if not dirty[0].isalpha():
# we ... | [
"def",
"wash_html_id",
"(",
"dirty",
")",
":",
"import",
"re",
"if",
"not",
"dirty",
"[",
"0",
"]",
".",
"isalpha",
"(",
")",
":",
"# we make sure that the first character is a lowercase letter",
"dirty",
"=",
"'i'",
"+",
"dirty",
"non_word",
"=",
"re",
".",
... | Strip non-alphabetic or newline characters from a given string.
It can be used as a HTML element ID (also with jQuery and in all browsers).
:param dirty: the string to wash
:returns: the HTML ID ready string | [
"Strip",
"non",
"-",
"alphabetic",
"or",
"newline",
"characters",
"from",
"a",
"given",
"string",
"."
] | 9a1c6db4e3f1370901f329f510480dd8df188296 | https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/washers.py#L108-L121 |
40,515 | micha030201/aionationstates | aionationstates/region_.py | Post.quote | def quote(self, text=None):
"""Quote this post.
Parameters
----------
text : str
Text to quote. Defaults to the whole text of the post.
Returns
-------
str
A NationStates bbCode quote of the post.
"""
text = text or re.su... | python | def quote(self, text=None):
"""Quote this post.
Parameters
----------
text : str
Text to quote. Defaults to the whole text of the post.
Returns
-------
str
A NationStates bbCode quote of the post.
"""
text = text or re.su... | [
"def",
"quote",
"(",
"self",
",",
"text",
"=",
"None",
")",
":",
"text",
"=",
"text",
"or",
"re",
".",
"sub",
"(",
"r'\\[quote=.+?\\[/quote\\]'",
",",
"''",
",",
"self",
".",
"text",
",",
"flags",
"=",
"re",
".",
"DOTALL",
")",
".",
"strip",
"(",
... | Quote this post.
Parameters
----------
text : str
Text to quote. Defaults to the whole text of the post.
Returns
-------
str
A NationStates bbCode quote of the post. | [
"Quote",
"this",
"post",
"."
] | dc86b86d994cbab830b69ab8023601c73e778b3a | https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/region_.py#L251-L267 |
40,516 | micha030201/aionationstates | aionationstates/region_.py | Region.factbook | async def factbook(self, root):
"""Region's World Factbook Entry.
Returns
-------
an :class:`ApiQuery` of str
"""
# This lib might have been a mistake, but the line below
# definitely isn't.
return html.unescape(html.unescape(root.find('FACTBOOK').text)) | python | async def factbook(self, root):
"""Region's World Factbook Entry.
Returns
-------
an :class:`ApiQuery` of str
"""
# This lib might have been a mistake, but the line below
# definitely isn't.
return html.unescape(html.unescape(root.find('FACTBOOK').text)) | [
"async",
"def",
"factbook",
"(",
"self",
",",
"root",
")",
":",
"# This lib might have been a mistake, but the line below",
"# definitely isn't.",
"return",
"html",
".",
"unescape",
"(",
"html",
".",
"unescape",
"(",
"root",
".",
"find",
"(",
"'FACTBOOK'",
")",
".... | Region's World Factbook Entry.
Returns
-------
an :class:`ApiQuery` of str | [
"Region",
"s",
"World",
"Factbook",
"Entry",
"."
] | dc86b86d994cbab830b69ab8023601c73e778b3a | https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/region_.py#L310-L319 |
40,517 | micha030201/aionationstates | aionationstates/region_.py | Region.delegate | async def delegate(self, root):
"""Regional World Assembly Delegate.
Returns
-------
an :class:`ApiQuery` of :class:`Nation`
an :class:`ApiQuery` of None
If the region has no delegate.
"""
nation = root.find('DELEGATE').text
if nation == '0':
... | python | async def delegate(self, root):
"""Regional World Assembly Delegate.
Returns
-------
an :class:`ApiQuery` of :class:`Nation`
an :class:`ApiQuery` of None
If the region has no delegate.
"""
nation = root.find('DELEGATE').text
if nation == '0':
... | [
"async",
"def",
"delegate",
"(",
"self",
",",
"root",
")",
":",
"nation",
"=",
"root",
".",
"find",
"(",
"'DELEGATE'",
")",
".",
"text",
"if",
"nation",
"==",
"'0'",
":",
"return",
"None",
"return",
"aionationstates",
".",
"Nation",
"(",
"nation",
")"
... | Regional World Assembly Delegate.
Returns
-------
an :class:`ApiQuery` of :class:`Nation`
an :class:`ApiQuery` of None
If the region has no delegate. | [
"Regional",
"World",
"Assembly",
"Delegate",
"."
] | dc86b86d994cbab830b69ab8023601c73e778b3a | https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/region_.py#L398-L410 |
40,518 | micha030201/aionationstates | aionationstates/region_.py | Region.founder | async def founder(self, root):
"""Regional Founder. Returned even if the nation has ceased to
exist.
Returns
-------
an :class:`ApiQuery` of :class:`Nation`
an :class:`ApiQuery` of None
If the region is Game-Created and doesn't have a founder.
"""
... | python | async def founder(self, root):
"""Regional Founder. Returned even if the nation has ceased to
exist.
Returns
-------
an :class:`ApiQuery` of :class:`Nation`
an :class:`ApiQuery` of None
If the region is Game-Created and doesn't have a founder.
"""
... | [
"async",
"def",
"founder",
"(",
"self",
",",
"root",
")",
":",
"nation",
"=",
"root",
".",
"find",
"(",
"'FOUNDER'",
")",
".",
"text",
"if",
"nation",
"==",
"'0'",
":",
"return",
"None",
"return",
"aionationstates",
".",
"Nation",
"(",
"nation",
")"
] | Regional Founder. Returned even if the nation has ceased to
exist.
Returns
-------
an :class:`ApiQuery` of :class:`Nation`
an :class:`ApiQuery` of None
If the region is Game-Created and doesn't have a founder. | [
"Regional",
"Founder",
".",
"Returned",
"even",
"if",
"the",
"nation",
"has",
"ceased",
"to",
"exist",
"."
] | dc86b86d994cbab830b69ab8023601c73e778b3a | https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/region_.py#L424-L437 |
40,519 | micha030201/aionationstates | aionationstates/region_.py | Region.officers | async def officers(self, root):
"""Regional Officers. Does not include the Founder or
the Delegate, unless they have additional titles as Officers.
In the correct order.
Returns
-------
an :class:`ApiQuery` of a list of :class:`Officer`
"""
officers = s... | python | async def officers(self, root):
"""Regional Officers. Does not include the Founder or
the Delegate, unless they have additional titles as Officers.
In the correct order.
Returns
-------
an :class:`ApiQuery` of a list of :class:`Officer`
"""
officers = s... | [
"async",
"def",
"officers",
"(",
"self",
",",
"root",
")",
":",
"officers",
"=",
"sorted",
"(",
"root",
".",
"find",
"(",
"'OFFICERS'",
")",
",",
"# I struggle to say what else this tag would be useful for.",
"key",
"=",
"lambda",
"elem",
":",
"int",
"(",
"ele... | Regional Officers. Does not include the Founder or
the Delegate, unless they have additional titles as Officers.
In the correct order.
Returns
-------
an :class:`ApiQuery` of a list of :class:`Officer` | [
"Regional",
"Officers",
".",
"Does",
"not",
"include",
"the",
"Founder",
"or",
"the",
"Delegate",
"unless",
"they",
"have",
"additional",
"titles",
"as",
"Officers",
"."
] | dc86b86d994cbab830b69ab8023601c73e778b3a | https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/region_.py#L451-L466 |
40,520 | micha030201/aionationstates | aionationstates/region_.py | Region.messages | async def messages(self):
"""Iterate through RMB posts from newest to oldest.
Returns
-------
an asynchronous generator that yields :class:`Post`
"""
# Messages may be posted on the RMB while the generator is running.
oldest_id_seen = float('inf')
for off... | python | async def messages(self):
"""Iterate through RMB posts from newest to oldest.
Returns
-------
an asynchronous generator that yields :class:`Post`
"""
# Messages may be posted on the RMB while the generator is running.
oldest_id_seen = float('inf')
for off... | [
"async",
"def",
"messages",
"(",
"self",
")",
":",
"# Messages may be posted on the RMB while the generator is running.",
"oldest_id_seen",
"=",
"float",
"(",
"'inf'",
")",
"for",
"offset",
"in",
"count",
"(",
"step",
"=",
"100",
")",
":",
"posts_bunch",
"=",
"awa... | Iterate through RMB posts from newest to oldest.
Returns
-------
an asynchronous generator that yields :class:`Post` | [
"Iterate",
"through",
"RMB",
"posts",
"from",
"newest",
"to",
"oldest",
"."
] | dc86b86d994cbab830b69ab8023601c73e778b3a | https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/region_.py#L503-L519 |
40,521 | consbio/parserutils | parserutils/collections.py | filter_empty | def filter_empty(values, default=None):
"""
Eliminates None or empty items from lists, tuples or sets passed in.
If values is None or empty after filtering, the default is returned.
"""
if values is None:
return default
elif hasattr(values, '__len__') and len(values) == 0:
retur... | python | def filter_empty(values, default=None):
"""
Eliminates None or empty items from lists, tuples or sets passed in.
If values is None or empty after filtering, the default is returned.
"""
if values is None:
return default
elif hasattr(values, '__len__') and len(values) == 0:
retur... | [
"def",
"filter_empty",
"(",
"values",
",",
"default",
"=",
"None",
")",
":",
"if",
"values",
"is",
"None",
":",
"return",
"default",
"elif",
"hasattr",
"(",
"values",
",",
"'__len__'",
")",
"and",
"len",
"(",
"values",
")",
"==",
"0",
":",
"return",
... | Eliminates None or empty items from lists, tuples or sets passed in.
If values is None or empty after filtering, the default is returned. | [
"Eliminates",
"None",
"or",
"empty",
"items",
"from",
"lists",
"tuples",
"or",
"sets",
"passed",
"in",
".",
"If",
"values",
"is",
"None",
"or",
"empty",
"after",
"filtering",
"the",
"default",
"is",
"returned",
"."
] | f13f80db99ed43479336b116e38512e3566e4623 | https://github.com/consbio/parserutils/blob/f13f80db99ed43479336b116e38512e3566e4623/parserutils/collections.py#L107-L124 |
40,522 | tradenity/python-sdk | tradenity/resources/dimensions.py | Dimensions.unit | def unit(self, unit):
"""Sets the unit of this Dimensions.
:param unit: The unit of this Dimensions.
:type: str
"""
allowed_values = ["cm", "inch", "foot"] # noqa: E501
if unit is not None and unit not in allowed_values:
raise ValueError(
"I... | python | def unit(self, unit):
"""Sets the unit of this Dimensions.
:param unit: The unit of this Dimensions.
:type: str
"""
allowed_values = ["cm", "inch", "foot"] # noqa: E501
if unit is not None and unit not in allowed_values:
raise ValueError(
"I... | [
"def",
"unit",
"(",
"self",
",",
"unit",
")",
":",
"allowed_values",
"=",
"[",
"\"cm\"",
",",
"\"inch\"",
",",
"\"foot\"",
"]",
"# noqa: E501",
"if",
"unit",
"is",
"not",
"None",
"and",
"unit",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"... | Sets the unit of this Dimensions.
:param unit: The unit of this Dimensions.
:type: str | [
"Sets",
"the",
"unit",
"of",
"this",
"Dimensions",
"."
] | d13fbe23f4d6ff22554c6d8d2deaf209371adaf1 | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/dimensions.py#L126-L140 |
40,523 | hackedd/gw2api | gw2api/map.py | map_names | def map_names(lang="en"):
"""This resource returns an dictionary of the localized map names for
the specified language. Only maps with events are listed - if you need a
list of all maps, use ``maps.json`` instead.
:param lang: The language to query the names for.
:return: the response is a dictiona... | python | def map_names(lang="en"):
"""This resource returns an dictionary of the localized map names for
the specified language. Only maps with events are listed - if you need a
list of all maps, use ``maps.json`` instead.
:param lang: The language to query the names for.
:return: the response is a dictiona... | [
"def",
"map_names",
"(",
"lang",
"=",
"\"en\"",
")",
":",
"cache_name",
"=",
"\"map_names.%s.json\"",
"%",
"lang",
"data",
"=",
"get_cached",
"(",
"\"map_names.json\"",
",",
"cache_name",
",",
"params",
"=",
"dict",
"(",
"lang",
"=",
"lang",
")",
")",
"ret... | This resource returns an dictionary of the localized map names for
the specified language. Only maps with events are listed - if you need a
list of all maps, use ``maps.json`` instead.
:param lang: The language to query the names for.
:return: the response is a dictionary where the key is the map id an... | [
"This",
"resource",
"returns",
"an",
"dictionary",
"of",
"the",
"localized",
"map",
"names",
"for",
"the",
"specified",
"language",
".",
"Only",
"maps",
"with",
"events",
"are",
"listed",
"-",
"if",
"you",
"need",
"a",
"list",
"of",
"all",
"maps",
"use",
... | 5543a78e6e3ed0573b7e84c142c44004b4779eac | https://github.com/hackedd/gw2api/blob/5543a78e6e3ed0573b7e84c142c44004b4779eac/gw2api/map.py#L35-L47 |
40,524 | hackedd/gw2api | gw2api/map.py | maps | def maps(map_id=None, lang="en"):
"""This resource returns details about maps in the game, including details
about floor and translation data on how to translate between world
coordinates and map coordinates.
:param map_id: Only list this map.
:param lang: Show localized texts in the specified lang... | python | def maps(map_id=None, lang="en"):
"""This resource returns details about maps in the game, including details
about floor and translation data on how to translate between world
coordinates and map coordinates.
:param map_id: Only list this map.
:param lang: Show localized texts in the specified lang... | [
"def",
"maps",
"(",
"map_id",
"=",
"None",
",",
"lang",
"=",
"\"en\"",
")",
":",
"if",
"map_id",
":",
"cache_name",
"=",
"\"maps.%s.%s.json\"",
"%",
"(",
"map_id",
",",
"lang",
")",
"params",
"=",
"{",
"\"map_id\"",
":",
"map_id",
",",
"\"lang\"",
":",... | This resource returns details about maps in the game, including details
about floor and translation data on how to translate between world
coordinates and map coordinates.
:param map_id: Only list this map.
:param lang: Show localized texts in the specified language.
The response is a dictionary w... | [
"This",
"resource",
"returns",
"details",
"about",
"maps",
"in",
"the",
"game",
"including",
"details",
"about",
"floor",
"and",
"translation",
"data",
"on",
"how",
"to",
"translate",
"between",
"world",
"coordinates",
"and",
"map",
"coordinates",
"."
] | 5543a78e6e3ed0573b7e84c142c44004b4779eac | https://github.com/hackedd/gw2api/blob/5543a78e6e3ed0573b7e84c142c44004b4779eac/gw2api/map.py#L50-L105 |
40,525 | hackedd/gw2api | gw2api/map.py | map_floor | def map_floor(continent_id, floor, lang="en"):
"""This resource returns details about a map floor, used to populate a
world map. All coordinates are map coordinates.
The returned data only contains static content. Dynamic content, such as
vendors, is not currently available.
:param continent_id: T... | python | def map_floor(continent_id, floor, lang="en"):
"""This resource returns details about a map floor, used to populate a
world map. All coordinates are map coordinates.
The returned data only contains static content. Dynamic content, such as
vendors, is not currently available.
:param continent_id: T... | [
"def",
"map_floor",
"(",
"continent_id",
",",
"floor",
",",
"lang",
"=",
"\"en\"",
")",
":",
"cache_name",
"=",
"\"map_floor.%s-%s.%s.json\"",
"%",
"(",
"continent_id",
",",
"floor",
",",
"lang",
")",
"params",
"=",
"{",
"\"continent_id\"",
":",
"continent_id"... | This resource returns details about a map floor, used to populate a
world map. All coordinates are map coordinates.
The returned data only contains static content. Dynamic content, such as
vendors, is not currently available.
:param continent_id: The continent.
:param floor: The map floor.
:pa... | [
"This",
"resource",
"returns",
"details",
"about",
"a",
"map",
"floor",
"used",
"to",
"populate",
"a",
"world",
"map",
".",
"All",
"coordinates",
"are",
"map",
"coordinates",
"."
] | 5543a78e6e3ed0573b7e84c142c44004b4779eac | https://github.com/hackedd/gw2api/blob/5543a78e6e3ed0573b7e84c142c44004b4779eac/gw2api/map.py#L108-L236 |
40,526 | agamdua/mixtures | mixtures/field_values.py | FieldHelperMixin.get_value_based_inclusive_interval | def get_value_based_inclusive_interval(cls, field, max_value=None):
"""
This is applicable to fields with max_value and min_value as
validators.
Note:
1. This is different from fields with max_length as a validator
2. This means that the two methods based on valu... | python | def get_value_based_inclusive_interval(cls, field, max_value=None):
"""
This is applicable to fields with max_value and min_value as
validators.
Note:
1. This is different from fields with max_length as a validator
2. This means that the two methods based on valu... | [
"def",
"get_value_based_inclusive_interval",
"(",
"cls",
",",
"field",
",",
"max_value",
"=",
"None",
")",
":",
"if",
"field",
".",
"max_value",
"is",
"None",
":",
"field",
".",
"max_value",
"=",
"max_value",
"or",
"MAX_LENGTH",
"if",
"field",
".",
"min_valu... | This is applicable to fields with max_value and min_value as
validators.
Note:
1. This is different from fields with max_length as a validator
2. This means that the two methods based on value and length
are almost the same method but for the max_* attribute
... | [
"This",
"is",
"applicable",
"to",
"fields",
"with",
"max_value",
"and",
"min_value",
"as",
"validators",
"."
] | 9c67f3684ddac53d8a636a4353a266e98d09e54c | https://github.com/agamdua/mixtures/blob/9c67f3684ddac53d8a636a4353a266e98d09e54c/mixtures/field_values.py#L62-L82 |
40,527 | kageurufu/AsyncIRC | asyncirc/ircclient.py | IRCClient._async_recv | def _async_recv(self):
"""No raw bytes should escape from this, all byte encoding and
decoding should be handling inside this function"""
logging.info("Receive loop started")
recbuffer = b""
while not self._stop_event.is_set():
time.sleep(0.01)
try:
... | python | def _async_recv(self):
"""No raw bytes should escape from this, all byte encoding and
decoding should be handling inside this function"""
logging.info("Receive loop started")
recbuffer = b""
while not self._stop_event.is_set():
time.sleep(0.01)
try:
... | [
"def",
"_async_recv",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"Receive loop started\"",
")",
"recbuffer",
"=",
"b\"\"",
"while",
"not",
"self",
".",
"_stop_event",
".",
"is_set",
"(",
")",
":",
"time",
".",
"sleep",
"(",
"0.01",
")",
"try",... | No raw bytes should escape from this, all byte encoding and
decoding should be handling inside this function | [
"No",
"raw",
"bytes",
"should",
"escape",
"from",
"this",
"all",
"byte",
"encoding",
"and",
"decoding",
"should",
"be",
"handling",
"inside",
"this",
"function"
] | 73e2c14ad87a2e86a64c7e79fc5289b0333246f9 | https://github.com/kageurufu/AsyncIRC/blob/73e2c14ad87a2e86a64c7e79fc5289b0333246f9/asyncirc/ircclient.py#L111-L129 |
40,528 | thespacedoctor/fundamentals | fundamentals/mysql/directory_script_runner.py | main | def main(arguments=None):
"""
The main function used when ``directory_script_runner.py`` is run as a single script from the cl, or when installed as a cl command
"""
# setup the command-line util settings
su = tools(
arguments=arguments,
docString=__doc__,
logLevel="WARNING"... | python | def main(arguments=None):
"""
The main function used when ``directory_script_runner.py`` is run as a single script from the cl, or when installed as a cl command
"""
# setup the command-line util settings
su = tools(
arguments=arguments,
docString=__doc__,
logLevel="WARNING"... | [
"def",
"main",
"(",
"arguments",
"=",
"None",
")",
":",
"# setup the command-line util settings",
"su",
"=",
"tools",
"(",
"arguments",
"=",
"arguments",
",",
"docString",
"=",
"__doc__",
",",
"logLevel",
"=",
"\"WARNING\"",
",",
"options_first",
"=",
"False",
... | The main function used when ``directory_script_runner.py`` is run as a single script from the cl, or when installed as a cl command | [
"The",
"main",
"function",
"used",
"when",
"directory_script_runner",
".",
"py",
"is",
"run",
"as",
"a",
"single",
"script",
"from",
"the",
"cl",
"or",
"when",
"installed",
"as",
"a",
"cl",
"command"
] | 1d2c007ac74442ec2eabde771cfcacdb9c1ab382 | https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/mysql/directory_script_runner.py#L215-L259 |
40,529 | tradenity/python-sdk | tradenity/resources/measurement_settings.py | MeasurementSettings.weight_unit | def weight_unit(self, weight_unit):
"""Sets the weight_unit of this MeasurementSettings.
:param weight_unit: The weight_unit of this MeasurementSettings.
:type: str
"""
allowed_values = ["pound", "kilogram"] # noqa: E501
if weight_unit is not None and weight_unit not i... | python | def weight_unit(self, weight_unit):
"""Sets the weight_unit of this MeasurementSettings.
:param weight_unit: The weight_unit of this MeasurementSettings.
:type: str
"""
allowed_values = ["pound", "kilogram"] # noqa: E501
if weight_unit is not None and weight_unit not i... | [
"def",
"weight_unit",
"(",
"self",
",",
"weight_unit",
")",
":",
"allowed_values",
"=",
"[",
"\"pound\"",
",",
"\"kilogram\"",
"]",
"# noqa: E501",
"if",
"weight_unit",
"is",
"not",
"None",
"and",
"weight_unit",
"not",
"in",
"allowed_values",
":",
"raise",
"Va... | Sets the weight_unit of this MeasurementSettings.
:param weight_unit: The weight_unit of this MeasurementSettings.
:type: str | [
"Sets",
"the",
"weight_unit",
"of",
"this",
"MeasurementSettings",
"."
] | d13fbe23f4d6ff22554c6d8d2deaf209371adaf1 | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/measurement_settings.py#L55-L69 |
40,530 | tradenity/python-sdk | tradenity/resources/measurement_settings.py | MeasurementSettings.dimensions_unit | def dimensions_unit(self, dimensions_unit):
"""Sets the dimensions_unit of this MeasurementSettings.
:param dimensions_unit: The dimensions_unit of this MeasurementSettings.
:type: str
"""
allowed_values = ["inch", "cm", "foot", "meter"] # noqa: E501
if dimensions_unit... | python | def dimensions_unit(self, dimensions_unit):
"""Sets the dimensions_unit of this MeasurementSettings.
:param dimensions_unit: The dimensions_unit of this MeasurementSettings.
:type: str
"""
allowed_values = ["inch", "cm", "foot", "meter"] # noqa: E501
if dimensions_unit... | [
"def",
"dimensions_unit",
"(",
"self",
",",
"dimensions_unit",
")",
":",
"allowed_values",
"=",
"[",
"\"inch\"",
",",
"\"cm\"",
",",
"\"foot\"",
",",
"\"meter\"",
"]",
"# noqa: E501",
"if",
"dimensions_unit",
"is",
"not",
"None",
"and",
"dimensions_unit",
"not",... | Sets the dimensions_unit of this MeasurementSettings.
:param dimensions_unit: The dimensions_unit of this MeasurementSettings.
:type: str | [
"Sets",
"the",
"dimensions_unit",
"of",
"this",
"MeasurementSettings",
"."
] | d13fbe23f4d6ff22554c6d8d2deaf209371adaf1 | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/measurement_settings.py#L82-L96 |
40,531 | hsolbrig/sparql_slurper | sparql_slurper/_slurpygraph.py | SlurpyGraph.already_resolved | def already_resolved(self, pattern: QueryTriple) -> bool:
""" Determine whether pattern has already been loaded into the cache.
The "wild card" - `(None, None, None)` - always counts as resolved.
:param pattern: pattern to check
:return: True it is a subset of elements already loaded
... | python | def already_resolved(self, pattern: QueryTriple) -> bool:
""" Determine whether pattern has already been loaded into the cache.
The "wild card" - `(None, None, None)` - always counts as resolved.
:param pattern: pattern to check
:return: True it is a subset of elements already loaded
... | [
"def",
"already_resolved",
"(",
"self",
",",
"pattern",
":",
"QueryTriple",
")",
"->",
"bool",
":",
"if",
"self",
".",
"sparql_locked",
"or",
"pattern",
"==",
"(",
"None",
",",
"None",
",",
"None",
")",
":",
"return",
"True",
"for",
"resolved_node",
"in"... | Determine whether pattern has already been loaded into the cache.
The "wild card" - `(None, None, None)` - always counts as resolved.
:param pattern: pattern to check
:return: True it is a subset of elements already loaded | [
"Determine",
"whether",
"pattern",
"has",
"already",
"been",
"loaded",
"into",
"the",
"cache",
"."
] | 9e338549337a6268d6f9c52e7fbf5b493b80cf59 | https://github.com/hsolbrig/sparql_slurper/blob/9e338549337a6268d6f9c52e7fbf5b493b80cf59/sparql_slurper/_slurpygraph.py#L63-L79 |
40,532 | ale5000-git/pycompatlayer | pycompatlayer/pycompatlayer.py | fix_base | def fix_base(fix_environ):
"""Activate the base compatibility."""
def _is_android():
import os
vm_path = os.sep+"system"+os.sep+"bin"+os.sep+"dalvikvm"
if os.path.exists(vm_path) or os.path.exists(os.sep+"system"+vm_path):
return True
try:
import android
... | python | def fix_base(fix_environ):
"""Activate the base compatibility."""
def _is_android():
import os
vm_path = os.sep+"system"+os.sep+"bin"+os.sep+"dalvikvm"
if os.path.exists(vm_path) or os.path.exists(os.sep+"system"+vm_path):
return True
try:
import android
... | [
"def",
"fix_base",
"(",
"fix_environ",
")",
":",
"def",
"_is_android",
"(",
")",
":",
"import",
"os",
"vm_path",
"=",
"os",
".",
"sep",
"+",
"\"system\"",
"+",
"os",
".",
"sep",
"+",
"\"bin\"",
"+",
"os",
".",
"sep",
"+",
"\"dalvikvm\"",
"if",
"os",
... | Activate the base compatibility. | [
"Activate",
"the",
"base",
"compatibility",
"."
] | f24b10984bfe4be76479e31b1e6b0089967283fa | https://github.com/ale5000-git/pycompatlayer/blob/f24b10984bfe4be76479e31b1e6b0089967283fa/pycompatlayer/pycompatlayer.py#L94-L148 |
40,533 | ale5000-git/pycompatlayer | pycompatlayer/pycompatlayer.py | fix_subprocess | def fix_subprocess(override_debug=False, override_exception=False):
"""Activate the subprocess compatibility."""
import subprocess
# Exceptions
if subprocess.__dict__.get("SubprocessError") is None:
subprocess.SubprocessError = _Internal.SubprocessError
if _InternalReferences.UsedCalledProc... | python | def fix_subprocess(override_debug=False, override_exception=False):
"""Activate the subprocess compatibility."""
import subprocess
# Exceptions
if subprocess.__dict__.get("SubprocessError") is None:
subprocess.SubprocessError = _Internal.SubprocessError
if _InternalReferences.UsedCalledProc... | [
"def",
"fix_subprocess",
"(",
"override_debug",
"=",
"False",
",",
"override_exception",
"=",
"False",
")",
":",
"import",
"subprocess",
"# Exceptions",
"if",
"subprocess",
".",
"__dict__",
".",
"get",
"(",
"\"SubprocessError\"",
")",
"is",
"None",
":",
"subproc... | Activate the subprocess compatibility. | [
"Activate",
"the",
"subprocess",
"compatibility",
"."
] | f24b10984bfe4be76479e31b1e6b0089967283fa | https://github.com/ale5000-git/pycompatlayer/blob/f24b10984bfe4be76479e31b1e6b0089967283fa/pycompatlayer/pycompatlayer.py#L250-L283 |
40,534 | ale5000-git/pycompatlayer | pycompatlayer/pycompatlayer.py | fix_all | def fix_all(override_debug=False, override_all=False):
"""Activate the full compatibility."""
fix_base(True)
fix_builtins(override_debug)
fix_subprocess(override_debug, override_all)
return True | python | def fix_all(override_debug=False, override_all=False):
"""Activate the full compatibility."""
fix_base(True)
fix_builtins(override_debug)
fix_subprocess(override_debug, override_all)
return True | [
"def",
"fix_all",
"(",
"override_debug",
"=",
"False",
",",
"override_all",
"=",
"False",
")",
":",
"fix_base",
"(",
"True",
")",
"fix_builtins",
"(",
"override_debug",
")",
"fix_subprocess",
"(",
"override_debug",
",",
"override_all",
")",
"return",
"True"
] | Activate the full compatibility. | [
"Activate",
"the",
"full",
"compatibility",
"."
] | f24b10984bfe4be76479e31b1e6b0089967283fa | https://github.com/ale5000-git/pycompatlayer/blob/f24b10984bfe4be76479e31b1e6b0089967283fa/pycompatlayer/pycompatlayer.py#L286-L291 |
40,535 | a2liu/mr-clean | mr_clean/core/functions/scrub.py | smart_scrub | def smart_scrub(df,col_name,error_rate = 0):
""" Scrubs from the front and back of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been... | python | def smart_scrub(df,col_name,error_rate = 0):
""" Scrubs from the front and back of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been... | [
"def",
"smart_scrub",
"(",
"df",
",",
"col_name",
",",
"error_rate",
"=",
"0",
")",
":",
"scrubf",
"=",
"smart_scrubf",
"(",
"df",
",",
"col_name",
",",
"error_rate",
")",
"scrubb",
"=",
"smart_scrubb",
"(",
"df",
",",
"col_name",
",",
"error_rate",
")",... | Scrubs from the front and back of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbed is appended to the dataframe. Returns a tup... | [
"Scrubs",
"from",
"the",
"front",
"and",
"back",
"of",
"an",
"object",
"column",
"in",
"a",
"DataFrame",
"until",
"the",
"scrub",
"would",
"semantically",
"alter",
"the",
"contents",
"of",
"the",
"column",
".",
"If",
"only",
"a",
"subset",
"of",
"the",
"... | 0ee4ee5639f834dec4b59b94442fa84373f3c176 | https://github.com/a2liu/mr-clean/blob/0ee4ee5639f834dec4b59b94442fa84373f3c176/mr_clean/core/functions/scrub.py#L5-L21 |
40,536 | a2liu/mr-clean | mr_clean/core/functions/scrub.py | smart_scrubf | def smart_scrubf(df,col_name,error_rate = 0):
""" Scrubs from the front of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbe... | python | def smart_scrubf(df,col_name,error_rate = 0):
""" Scrubs from the front of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbe... | [
"def",
"smart_scrubf",
"(",
"df",
",",
"col_name",
",",
"error_rate",
"=",
"0",
")",
":",
"scrubbed",
"=",
"\"\"",
"while",
"True",
":",
"valcounts",
"=",
"df",
"[",
"col_name",
"]",
".",
"str",
"[",
":",
"len",
"(",
"scrubbed",
")",
"+",
"1",
"]",... | Scrubs from the front of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbed is appended to the dataframe. Returns the string tha... | [
"Scrubs",
"from",
"the",
"front",
"of",
"an",
"object",
"column",
"in",
"a",
"DataFrame",
"until",
"the",
"scrub",
"would",
"semantically",
"alter",
"the",
"contents",
"of",
"the",
"column",
".",
"If",
"only",
"a",
"subset",
"of",
"the",
"elements",
"in",
... | 0ee4ee5639f834dec4b59b94442fa84373f3c176 | https://github.com/a2liu/mr-clean/blob/0ee4ee5639f834dec4b59b94442fa84373f3c176/mr_clean/core/functions/scrub.py#L23-L51 |
40,537 | a2liu/mr-clean | mr_clean/core/functions/scrub.py | smart_scrubb | def smart_scrubb(df,col_name,error_rate = 0):
""" Scrubs from the back of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbed... | python | def smart_scrubb(df,col_name,error_rate = 0):
""" Scrubs from the back of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbed... | [
"def",
"smart_scrubb",
"(",
"df",
",",
"col_name",
",",
"error_rate",
"=",
"0",
")",
":",
"scrubbed",
"=",
"\"\"",
"while",
"True",
":",
"valcounts",
"=",
"df",
"[",
"col_name",
"]",
".",
"str",
"[",
"-",
"len",
"(",
"scrubbed",
")",
"-",
"1",
":",... | Scrubs from the back of an 'object' column in a DataFrame
until the scrub would semantically alter the contents of the column. If only a
subset of the elements in the column are scrubbed, then a boolean array indicating which
elements have been scrubbed is appended to the dataframe. Returns the string that... | [
"Scrubs",
"from",
"the",
"back",
"of",
"an",
"object",
"column",
"in",
"a",
"DataFrame",
"until",
"the",
"scrub",
"would",
"semantically",
"alter",
"the",
"contents",
"of",
"the",
"column",
".",
"If",
"only",
"a",
"subset",
"of",
"the",
"elements",
"in",
... | 0ee4ee5639f834dec4b59b94442fa84373f3c176 | https://github.com/a2liu/mr-clean/blob/0ee4ee5639f834dec4b59b94442fa84373f3c176/mr_clean/core/functions/scrub.py#L53-L81 |
40,538 | tradenity/python-sdk | tradenity/resources/shipping_method.py | ShippingMethod.find_all_for_order | def find_all_for_order(cls, order_id, **kwargs):
"""Find shipping methods for order.
Find all shipping methods suitable for an order.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.find_all_f... | python | def find_all_for_order(cls, order_id, **kwargs):
"""Find shipping methods for order.
Find all shipping methods suitable for an order.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.find_all_f... | [
"def",
"find_all_for_order",
"(",
"cls",
",",
"order_id",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'async'",
")",
":",
"return",
"cls",
".",
"_find_all_for_order_with_ht... | Find shipping methods for order.
Find all shipping methods suitable for an order.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.find_all_for_order(order_id, async=True)
>>> result = thread.g... | [
"Find",
"shipping",
"methods",
"for",
"order",
"."
] | d13fbe23f4d6ff22554c6d8d2deaf209371adaf1 | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/shipping_method.py#L388-L408 |
40,539 | cdumay/kser | src/kser/tracing/proxy.py | KserSpan.extract | def extract(cls, obj):
""" Extract span context from the given object
:param Any obj: Object to use as context
:return: a SpanContext instance extracted from the inner span object or None if no
such span context could be found.
"""
span = cls.extract_span(obj)
... | python | def extract(cls, obj):
""" Extract span context from the given object
:param Any obj: Object to use as context
:return: a SpanContext instance extracted from the inner span object or None if no
such span context could be found.
"""
span = cls.extract_span(obj)
... | [
"def",
"extract",
"(",
"cls",
",",
"obj",
")",
":",
"span",
"=",
"cls",
".",
"extract_span",
"(",
"obj",
")",
"if",
"span",
":",
"return",
"span",
".",
"context"
] | Extract span context from the given object
:param Any obj: Object to use as context
:return: a SpanContext instance extracted from the inner span object or None if no
such span context could be found. | [
"Extract",
"span",
"context",
"from",
"the",
"given",
"object"
] | fbd6fe9ab34b8b89d9937e5ff727614304af48c1 | https://github.com/cdumay/kser/blob/fbd6fe9ab34b8b89d9937e5ff727614304af48c1/src/kser/tracing/proxy.py#L35-L44 |
40,540 | cdumay/kser | src/kser/tracing/proxy.py | KserSpan.fix_additional_fields | def fix_additional_fields(data):
"""description of fix_additional_fields"""
result = dict()
for key, value in data.items():
if isinstance(value, dict):
result.update(KserSpan.to_flat_dict(key, value))
else:
result[key] = value
retur... | python | def fix_additional_fields(data):
"""description of fix_additional_fields"""
result = dict()
for key, value in data.items():
if isinstance(value, dict):
result.update(KserSpan.to_flat_dict(key, value))
else:
result[key] = value
retur... | [
"def",
"fix_additional_fields",
"(",
"data",
")",
":",
"result",
"=",
"dict",
"(",
")",
"for",
"key",
",",
"value",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"result",
".",
"update",
"(",
"K... | description of fix_additional_fields | [
"description",
"of",
"fix_additional_fields"
] | fbd6fe9ab34b8b89d9937e5ff727614304af48c1 | https://github.com/cdumay/kser/blob/fbd6fe9ab34b8b89d9937e5ff727614304af48c1/src/kser/tracing/proxy.py#L95-L103 |
40,541 | cdumay/kser | src/kser/tracing/proxy.py | KserSpan.filter_keys | def filter_keys(cls, data):
"""Filter GELF record keys using exclude_patterns
:param dict data: Log record has dict
:return: the filtered log record
:rtype: dict
"""
keys = list(data.keys())
for pattern in cls.EXCLUDE_PATTERNS:
for key in keys:
... | python | def filter_keys(cls, data):
"""Filter GELF record keys using exclude_patterns
:param dict data: Log record has dict
:return: the filtered log record
:rtype: dict
"""
keys = list(data.keys())
for pattern in cls.EXCLUDE_PATTERNS:
for key in keys:
... | [
"def",
"filter_keys",
"(",
"cls",
",",
"data",
")",
":",
"keys",
"=",
"list",
"(",
"data",
".",
"keys",
"(",
")",
")",
"for",
"pattern",
"in",
"cls",
".",
"EXCLUDE_PATTERNS",
":",
"for",
"key",
"in",
"keys",
":",
"if",
"re",
".",
"match",
"(",
"p... | Filter GELF record keys using exclude_patterns
:param dict data: Log record has dict
:return: the filtered log record
:rtype: dict | [
"Filter",
"GELF",
"record",
"keys",
"using",
"exclude_patterns"
] | fbd6fe9ab34b8b89d9937e5ff727614304af48c1 | https://github.com/cdumay/kser/blob/fbd6fe9ab34b8b89d9937e5ff727614304af48c1/src/kser/tracing/proxy.py#L122-L134 |
40,542 | blockadeio/analyst_toolbench | blockade/config.py | Config.write_config | def write_config(self):
"""Write the configuration to a local file.
:return: Boolean if successful
"""
json.dump(
self.config,
open(CONFIG_FILE, 'w'),
indent=4,
separators=(',', ': ')
)
return True | python | def write_config(self):
"""Write the configuration to a local file.
:return: Boolean if successful
"""
json.dump(
self.config,
open(CONFIG_FILE, 'w'),
indent=4,
separators=(',', ': ')
)
return True | [
"def",
"write_config",
"(",
"self",
")",
":",
"json",
".",
"dump",
"(",
"self",
".",
"config",
",",
"open",
"(",
"CONFIG_FILE",
",",
"'w'",
")",
",",
"indent",
"=",
"4",
",",
"separators",
"=",
"(",
"','",
",",
"': '",
")",
")",
"return",
"True"
] | Write the configuration to a local file.
:return: Boolean if successful | [
"Write",
"the",
"configuration",
"to",
"a",
"local",
"file",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/config.py#L30-L41 |
40,543 | blockadeio/analyst_toolbench | blockade/config.py | Config.load_config | def load_config(self, **kwargs):
"""Load the configuration for the user or seed it with defaults.
:return: Boolean if successful
"""
virgin_config = False
if not os.path.exists(CONFIG_PATH):
virgin_config = True
os.makedirs(CONFIG_PATH)
if not os.... | python | def load_config(self, **kwargs):
"""Load the configuration for the user or seed it with defaults.
:return: Boolean if successful
"""
virgin_config = False
if not os.path.exists(CONFIG_PATH):
virgin_config = True
os.makedirs(CONFIG_PATH)
if not os.... | [
"def",
"load_config",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"virgin_config",
"=",
"False",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"CONFIG_PATH",
")",
":",
"virgin_config",
"=",
"True",
"os",
".",
"makedirs",
"(",
"CONFIG_PATH",
"... | Load the configuration for the user or seed it with defaults.
:return: Boolean if successful | [
"Load",
"the",
"configuration",
"for",
"the",
"user",
"or",
"seed",
"it",
"with",
"defaults",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/config.py#L43-L87 |
40,544 | limix/chi2comb-py | chi2comb/_chi2comb.py | chi2comb_cdf | def chi2comb_cdf(q, chi2s, gcoef, lim=1000, atol=1e-4):
r"""Function distribution of combination of chi-squared distributions.
Parameters
----------
q : float
Value point at which distribution function is to be evaluated.
chi2s : ChiSquared
Chi-squared distributions.
gcoef : flo... | python | def chi2comb_cdf(q, chi2s, gcoef, lim=1000, atol=1e-4):
r"""Function distribution of combination of chi-squared distributions.
Parameters
----------
q : float
Value point at which distribution function is to be evaluated.
chi2s : ChiSquared
Chi-squared distributions.
gcoef : flo... | [
"def",
"chi2comb_cdf",
"(",
"q",
",",
"chi2s",
",",
"gcoef",
",",
"lim",
"=",
"1000",
",",
"atol",
"=",
"1e-4",
")",
":",
"int_type",
"=",
"\"i\"",
"if",
"array",
"(",
"int_type",
",",
"[",
"0",
"]",
")",
".",
"itemsize",
"!=",
"ffi",
".",
"sizeo... | r"""Function distribution of combination of chi-squared distributions.
Parameters
----------
q : float
Value point at which distribution function is to be evaluated.
chi2s : ChiSquared
Chi-squared distributions.
gcoef : float
Coefficient of the standard Normal distribution.
... | [
"r",
"Function",
"distribution",
"of",
"combination",
"of",
"chi",
"-",
"squared",
"distributions",
"."
] | 07120382ef6237d17fe7982f4a9fe8206b9fa136 | https://github.com/limix/chi2comb-py/blob/07120382ef6237d17fe7982f4a9fe8206b9fa136/chi2comb/_chi2comb.py#L41-L102 |
40,545 | mypebble/django-feature-flipper | feature_flipper/models.py | get_feature_model | def get_feature_model():
"""Return the FeatureFlipper model defined in settings.py
"""
try:
return apps.get_model(flipper_settings.FEATURE_FLIPPER_MODEL)
except ValueError:
raise ImproperlyConfigured(
"FEATURE_FLIPPER_MODEL must be of the form 'app_label.model_name'")
exc... | python | def get_feature_model():
"""Return the FeatureFlipper model defined in settings.py
"""
try:
return apps.get_model(flipper_settings.FEATURE_FLIPPER_MODEL)
except ValueError:
raise ImproperlyConfigured(
"FEATURE_FLIPPER_MODEL must be of the form 'app_label.model_name'")
exc... | [
"def",
"get_feature_model",
"(",
")",
":",
"try",
":",
"return",
"apps",
".",
"get_model",
"(",
"flipper_settings",
".",
"FEATURE_FLIPPER_MODEL",
")",
"except",
"ValueError",
":",
"raise",
"ImproperlyConfigured",
"(",
"\"FEATURE_FLIPPER_MODEL must be of the form 'app_labe... | Return the FeatureFlipper model defined in settings.py | [
"Return",
"the",
"FeatureFlipper",
"model",
"defined",
"in",
"settings",
".",
"py"
] | 53ff52296955f2ff8b5b6ae4ea426b3f0665960e | https://github.com/mypebble/django-feature-flipper/blob/53ff52296955f2ff8b5b6ae4ea426b3f0665960e/feature_flipper/models.py#L10-L21 |
40,546 | mypebble/django-feature-flipper | feature_flipper/models.py | FeatureFlipperQuerySet.show_feature | def show_feature(self, user, feature):
"""Return True or False for the given feature.
"""
user_filter = {
self.model.USER_FEATURE_FIELD: user,
}
return self.get_feature(feature).filter(
models.Q(**user_filter) | models.Q(everyone=True)).exists() | python | def show_feature(self, user, feature):
"""Return True or False for the given feature.
"""
user_filter = {
self.model.USER_FEATURE_FIELD: user,
}
return self.get_feature(feature).filter(
models.Q(**user_filter) | models.Q(everyone=True)).exists() | [
"def",
"show_feature",
"(",
"self",
",",
"user",
",",
"feature",
")",
":",
"user_filter",
"=",
"{",
"self",
".",
"model",
".",
"USER_FEATURE_FIELD",
":",
"user",
",",
"}",
"return",
"self",
".",
"get_feature",
"(",
"feature",
")",
".",
"filter",
"(",
"... | Return True or False for the given feature. | [
"Return",
"True",
"or",
"False",
"for",
"the",
"given",
"feature",
"."
] | 53ff52296955f2ff8b5b6ae4ea426b3f0665960e | https://github.com/mypebble/django-feature-flipper/blob/53ff52296955f2ff8b5b6ae4ea426b3f0665960e/feature_flipper/models.py#L32-L39 |
40,547 | Titan-C/slaveparticles | slaveparticles/utils/plotter.py | calc_z | def calc_z(bands, filling, interaction, hund_cu, name):
"""Calculates the quasiparticle weight of degenerate system of N-bands
at a given filling within an interaction range and saves the file"""
while True:
try:
data = np.load(name+'.npz')
break
except IOError:
... | python | def calc_z(bands, filling, interaction, hund_cu, name):
"""Calculates the quasiparticle weight of degenerate system of N-bands
at a given filling within an interaction range and saves the file"""
while True:
try:
data = np.load(name+'.npz')
break
except IOError:
... | [
"def",
"calc_z",
"(",
"bands",
",",
"filling",
",",
"interaction",
",",
"hund_cu",
",",
"name",
")",
":",
"while",
"True",
":",
"try",
":",
"data",
"=",
"np",
".",
"load",
"(",
"name",
"+",
"'.npz'",
")",
"break",
"except",
"IOError",
":",
"dopout",
... | Calculates the quasiparticle weight of degenerate system of N-bands
at a given filling within an interaction range and saves the file | [
"Calculates",
"the",
"quasiparticle",
"weight",
"of",
"degenerate",
"system",
"of",
"N",
"-",
"bands",
"at",
"a",
"given",
"filling",
"within",
"an",
"interaction",
"range",
"and",
"saves",
"the",
"file"
] | e4c2f5afb1a7b195517ef2f1b5cc758965036aab | https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L29-L45 |
40,548 | Titan-C/slaveparticles | slaveparticles/utils/plotter.py | label_saves | def label_saves(name):
"""Labels plots and saves file"""
plt.legend(loc=0)
plt.ylim([0, 1.025])
plt.xlabel('$U/D$', fontsize=20)
plt.ylabel('$Z$', fontsize=20)
plt.savefig(name, dpi=300, format='png',
transparent=False, bbox_inches='tight', pad_inches=0.05) | python | def label_saves(name):
"""Labels plots and saves file"""
plt.legend(loc=0)
plt.ylim([0, 1.025])
plt.xlabel('$U/D$', fontsize=20)
plt.ylabel('$Z$', fontsize=20)
plt.savefig(name, dpi=300, format='png',
transparent=False, bbox_inches='tight', pad_inches=0.05) | [
"def",
"label_saves",
"(",
"name",
")",
":",
"plt",
".",
"legend",
"(",
"loc",
"=",
"0",
")",
"plt",
".",
"ylim",
"(",
"[",
"0",
",",
"1.025",
"]",
")",
"plt",
".",
"xlabel",
"(",
"'$U/D$'",
",",
"fontsize",
"=",
"20",
")",
"plt",
".",
"ylabel"... | Labels plots and saves file | [
"Labels",
"plots",
"and",
"saves",
"file"
] | e4c2f5afb1a7b195517ef2f1b5cc758965036aab | https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L47-L54 |
40,549 | Titan-C/slaveparticles | slaveparticles/utils/plotter.py | plot_curves_z | def plot_curves_z(data, name, title=None):
"""Generates a simple plot of the quasiparticle weight decay curves given
data object with doping setup"""
plt.figure()
for zet, c in zip(data['zeta'], data['doping']):
plt.plot(data['u_int'], zet[:, 0], label='$n={}$'.format(str(c)))
if title !... | python | def plot_curves_z(data, name, title=None):
"""Generates a simple plot of the quasiparticle weight decay curves given
data object with doping setup"""
plt.figure()
for zet, c in zip(data['zeta'], data['doping']):
plt.plot(data['u_int'], zet[:, 0], label='$n={}$'.format(str(c)))
if title !... | [
"def",
"plot_curves_z",
"(",
"data",
",",
"name",
",",
"title",
"=",
"None",
")",
":",
"plt",
".",
"figure",
"(",
")",
"for",
"zet",
",",
"c",
"in",
"zip",
"(",
"data",
"[",
"'zeta'",
"]",
",",
"data",
"[",
"'doping'",
"]",
")",
":",
"plt",
"."... | Generates a simple plot of the quasiparticle weight decay curves given
data object with doping setup | [
"Generates",
"a",
"simple",
"plot",
"of",
"the",
"quasiparticle",
"weight",
"decay",
"curves",
"given",
"data",
"object",
"with",
"doping",
"setup"
] | e4c2f5afb1a7b195517ef2f1b5cc758965036aab | https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L56-L65 |
40,550 | Titan-C/slaveparticles | slaveparticles/utils/plotter.py | pick_flat_z | def pick_flat_z(data):
"""Generate a 2D array of the quasiparticle weight by only selecting the
first particle data"""
zmes = []
for i in data['zeta']:
zmes.append(i[:, 0])
return np.asarray(zmes) | python | def pick_flat_z(data):
"""Generate a 2D array of the quasiparticle weight by only selecting the
first particle data"""
zmes = []
for i in data['zeta']:
zmes.append(i[:, 0])
return np.asarray(zmes) | [
"def",
"pick_flat_z",
"(",
"data",
")",
":",
"zmes",
"=",
"[",
"]",
"for",
"i",
"in",
"data",
"[",
"'zeta'",
"]",
":",
"zmes",
".",
"append",
"(",
"i",
"[",
":",
",",
"0",
"]",
")",
"return",
"np",
".",
"asarray",
"(",
"zmes",
")"
] | Generate a 2D array of the quasiparticle weight by only selecting the
first particle data | [
"Generate",
"a",
"2D",
"array",
"of",
"the",
"quasiparticle",
"weight",
"by",
"only",
"selecting",
"the",
"first",
"particle",
"data"
] | e4c2f5afb1a7b195517ef2f1b5cc758965036aab | https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L67-L73 |
40,551 | Titan-C/slaveparticles | slaveparticles/utils/plotter.py | imshow_z | def imshow_z(data, name):
"""2D color plot of the quasiparticle weight as a function of interaction
and doping"""
zmes = pick_flat_z(data)
plt.figure()
plt.imshow(zmes.T, origin='lower', \
extent=[data['doping'].min(), data['doping'].max(), \
0, data['u_int'].max()], asp... | python | def imshow_z(data, name):
"""2D color plot of the quasiparticle weight as a function of interaction
and doping"""
zmes = pick_flat_z(data)
plt.figure()
plt.imshow(zmes.T, origin='lower', \
extent=[data['doping'].min(), data['doping'].max(), \
0, data['u_int'].max()], asp... | [
"def",
"imshow_z",
"(",
"data",
",",
"name",
")",
":",
"zmes",
"=",
"pick_flat_z",
"(",
"data",
")",
"plt",
".",
"figure",
"(",
")",
"plt",
".",
"imshow",
"(",
"zmes",
".",
"T",
",",
"origin",
"=",
"'lower'",
",",
"extent",
"=",
"[",
"data",
"[",... | 2D color plot of the quasiparticle weight as a function of interaction
and doping | [
"2D",
"color",
"plot",
"of",
"the",
"quasiparticle",
"weight",
"as",
"a",
"function",
"of",
"interaction",
"and",
"doping"
] | e4c2f5afb1a7b195517ef2f1b5cc758965036aab | https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L75-L89 |
40,552 | Titan-C/slaveparticles | slaveparticles/utils/plotter.py | plot_mean_field_conv | def plot_mean_field_conv(N=1, n=0.5, Uspan=np.arange(0, 3.6, 0.5)):
"""Generates the plot on the convergenge of the mean field in single
site spin hamiltonian under with N degenerate half-filled orbitals """
sl = Spinon(slaves=2*N, orbitals=N, avg_particles=2*n,
hopping=[0.5]*2*N,... | python | def plot_mean_field_conv(N=1, n=0.5, Uspan=np.arange(0, 3.6, 0.5)):
"""Generates the plot on the convergenge of the mean field in single
site spin hamiltonian under with N degenerate half-filled orbitals """
sl = Spinon(slaves=2*N, orbitals=N, avg_particles=2*n,
hopping=[0.5]*2*N,... | [
"def",
"plot_mean_field_conv",
"(",
"N",
"=",
"1",
",",
"n",
"=",
"0.5",
",",
"Uspan",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"3.6",
",",
"0.5",
")",
")",
":",
"sl",
"=",
"Spinon",
"(",
"slaves",
"=",
"2",
"*",
"N",
",",
"orbitals",
"=",
"N... | Generates the plot on the convergenge of the mean field in single
site spin hamiltonian under with N degenerate half-filled orbitals | [
"Generates",
"the",
"plot",
"on",
"the",
"convergenge",
"of",
"the",
"mean",
"field",
"in",
"single",
"site",
"spin",
"hamiltonian",
"under",
"with",
"N",
"degenerate",
"half",
"-",
"filled",
"orbitals"
] | e4c2f5afb1a7b195517ef2f1b5cc758965036aab | https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L120-L139 |
40,553 | tradenity/python-sdk | tradenity/resources/payment.py | Payment.to_dict | def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if has... | python | def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if has... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"swagger_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
... | Returns the model properties as a dict | [
"Returns",
"the",
"model",
"properties",
"as",
"a",
"dict"
] | d13fbe23f4d6ff22554c6d8d2deaf209371adaf1 | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/payment.py#L215-L240 |
40,554 | blockadeio/analyst_toolbench | blockade/api.py | Client.from_config | def from_config(cls):
"""Method to return back a loaded instance."""
config = Config()
client = cls(
email=config.get('email'),
api_key=config.get('api_key'),
server=config.get('api_server'),
http_proxy=config.get('http_proxy'),
https_p... | python | def from_config(cls):
"""Method to return back a loaded instance."""
config = Config()
client = cls(
email=config.get('email'),
api_key=config.get('api_key'),
server=config.get('api_server'),
http_proxy=config.get('http_proxy'),
https_p... | [
"def",
"from_config",
"(",
"cls",
")",
":",
"config",
"=",
"Config",
"(",
")",
"client",
"=",
"cls",
"(",
"email",
"=",
"config",
".",
"get",
"(",
"'email'",
")",
",",
"api_key",
"=",
"config",
".",
"get",
"(",
"'api_key'",
")",
",",
"server",
"=",... | Method to return back a loaded instance. | [
"Method",
"to",
"return",
"back",
"a",
"loaded",
"instance",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/api.py#L51-L61 |
40,555 | blockadeio/analyst_toolbench | blockade/api.py | Client.set_debug | def set_debug(self, status):
"""Control the logging state."""
if status:
self.logger.setLevel('DEBUG')
else:
self.logger.setLevel('INFO') | python | def set_debug(self, status):
"""Control the logging state."""
if status:
self.logger.setLevel('DEBUG')
else:
self.logger.setLevel('INFO') | [
"def",
"set_debug",
"(",
"self",
",",
"status",
")",
":",
"if",
"status",
":",
"self",
".",
"logger",
".",
"setLevel",
"(",
"'DEBUG'",
")",
"else",
":",
"self",
".",
"logger",
".",
"setLevel",
"(",
"'INFO'",
")"
] | Control the logging state. | [
"Control",
"the",
"logging",
"state",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/api.py#L63-L68 |
40,556 | blockadeio/analyst_toolbench | blockade/api.py | Client._endpoint | def _endpoint(self, endpoint, action, *url_args):
"""Return the URL for the action.
:param str endpoint: The controller
:param str action: The action provided by the controller
:param url_args: Additional endpoints(for endpoints that take part of
the url as opti... | python | def _endpoint(self, endpoint, action, *url_args):
"""Return the URL for the action.
:param str endpoint: The controller
:param str action: The action provided by the controller
:param url_args: Additional endpoints(for endpoints that take part of
the url as opti... | [
"def",
"_endpoint",
"(",
"self",
",",
"endpoint",
",",
"action",
",",
"*",
"url_args",
")",
":",
"args",
"=",
"(",
"self",
".",
"api_base",
",",
"endpoint",
",",
"action",
")",
"if",
"action",
"==",
"''",
":",
"args",
"=",
"(",
"self",
".",
"api_ba... | Return the URL for the action.
:param str endpoint: The controller
:param str action: The action provided by the controller
:param url_args: Additional endpoints(for endpoints that take part of
the url as option)
:return: Full URL for the requested action | [
"Return",
"the",
"URL",
"for",
"the",
"action",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/api.py#L70-L88 |
40,557 | blockadeio/analyst_toolbench | blockade/api.py | Client._json | def _json(self, response):
"""JSON response from server.
:param response: Response from the server
:throws ValueError: from requests' response.json() error
:return: response deserialized from JSON
"""
if response.status_code == 204:
return None
try:
... | python | def _json(self, response):
"""JSON response from server.
:param response: Response from the server
:throws ValueError: from requests' response.json() error
:return: response deserialized from JSON
"""
if response.status_code == 204:
return None
try:
... | [
"def",
"_json",
"(",
"self",
",",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"204",
":",
"return",
"None",
"try",
":",
"return",
"response",
".",
"json",
"(",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"ValueError",
"(... | JSON response from server.
:param response: Response from the server
:throws ValueError: from requests' response.json() error
:return: response deserialized from JSON | [
"JSON",
"response",
"from",
"server",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/api.py#L90-L108 |
40,558 | blockadeio/analyst_toolbench | blockade/api.py | Client._get | def _get(self, endpoint, action, *url_args, **url_params):
"""Request API Endpoint - for GET methods.
:param str endpoint: Endpoint
:param str action: Endpoint Action
:param url_args: Additional endpoints(for endpoints that take part of
the url as option)
... | python | def _get(self, endpoint, action, *url_args, **url_params):
"""Request API Endpoint - for GET methods.
:param str endpoint: Endpoint
:param str action: Endpoint Action
:param url_args: Additional endpoints(for endpoints that take part of
the url as option)
... | [
"def",
"_get",
"(",
"self",
",",
"endpoint",
",",
"action",
",",
"*",
"url_args",
",",
"*",
"*",
"url_params",
")",
":",
"api_url",
"=",
"self",
".",
"_endpoint",
"(",
"endpoint",
",",
"action",
",",
"*",
"url_args",
")",
"kwargs",
"=",
"{",
"'header... | Request API Endpoint - for GET methods.
:param str endpoint: Endpoint
:param str action: Endpoint Action
:param url_args: Additional endpoints(for endpoints that take part of
the url as option)
:param url_params: Parameters to pass to url, typically query string... | [
"Request",
"API",
"Endpoint",
"-",
"for",
"GET",
"methods",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/api.py#L110-L127 |
40,559 | blockadeio/analyst_toolbench | blockade/api.py | Client._send_data | def _send_data(self, method, endpoint, action,
data, *url_args, **url_params):
"""Submit to API Endpoint - for DELETE, PUT, POST methods.
:param str method: Method to use for the request
:param str endpoint: Endpoint
:param str action: Endpoint Action
:param u... | python | def _send_data(self, method, endpoint, action,
data, *url_args, **url_params):
"""Submit to API Endpoint - for DELETE, PUT, POST methods.
:param str method: Method to use for the request
:param str endpoint: Endpoint
:param str action: Endpoint Action
:param u... | [
"def",
"_send_data",
"(",
"self",
",",
"method",
",",
"endpoint",
",",
"action",
",",
"data",
",",
"*",
"url_args",
",",
"*",
"*",
"url_params",
")",
":",
"api_url",
"=",
"self",
".",
"_endpoint",
"(",
"endpoint",
",",
"action",
",",
"*",
"url_args",
... | Submit to API Endpoint - for DELETE, PUT, POST methods.
:param str method: Method to use for the request
:param str endpoint: Endpoint
:param str action: Endpoint Action
:param url_args: Additional endpoints(for endpoints that take part of
the url as option)
... | [
"Submit",
"to",
"API",
"Endpoint",
"-",
"for",
"DELETE",
"PUT",
"POST",
"methods",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/api.py#L129-L153 |
40,560 | blockadeio/analyst_toolbench | blockade/aws/lambda-scripts/Blockade-Store-Events.py | process_events | def process_events(events, source_ip):
"""Process all the events for logging and S3."""
s3 = boto3.resource('s3')
table = boto3.resource("dynamodb").Table(os.environ['database'])
with table.batch_writer() as batch:
for idx, event in enumerate(events):
event = convert_keys_to_string(e... | python | def process_events(events, source_ip):
"""Process all the events for logging and S3."""
s3 = boto3.resource('s3')
table = boto3.resource("dynamodb").Table(os.environ['database'])
with table.batch_writer() as batch:
for idx, event in enumerate(events):
event = convert_keys_to_string(e... | [
"def",
"process_events",
"(",
"events",
",",
"source_ip",
")",
":",
"s3",
"=",
"boto3",
".",
"resource",
"(",
"'s3'",
")",
"table",
"=",
"boto3",
".",
"resource",
"(",
"\"dynamodb\"",
")",
".",
"Table",
"(",
"os",
".",
"environ",
"[",
"'database'",
"]"... | Process all the events for logging and S3. | [
"Process",
"all",
"the",
"events",
"for",
"logging",
"and",
"S3",
"."
] | 159b6f8cf8a91c5ff050f1579636ea90ab269863 | https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/aws/lambda-scripts/Blockade-Store-Events.py#L20-L46 |
40,561 | tradenity/python-sdk | tradenity/resources/table_rate_shipping.py | TableRateShipping.cost_type | def cost_type(self, cost_type):
"""Sets the cost_type of this TableRateShipping.
:param cost_type: The cost_type of this TableRateShipping.
:type: str
"""
allowed_values = ["orderSubtotal", "weight"]
if cost_type is not None and cost_type not in allowed_values:
... | python | def cost_type(self, cost_type):
"""Sets the cost_type of this TableRateShipping.
:param cost_type: The cost_type of this TableRateShipping.
:type: str
"""
allowed_values = ["orderSubtotal", "weight"]
if cost_type is not None and cost_type not in allowed_values:
... | [
"def",
"cost_type",
"(",
"self",
",",
"cost_type",
")",
":",
"allowed_values",
"=",
"[",
"\"orderSubtotal\"",
",",
"\"weight\"",
"]",
"if",
"cost_type",
"is",
"not",
"None",
"and",
"cost_type",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
... | Sets the cost_type of this TableRateShipping.
:param cost_type: The cost_type of this TableRateShipping.
:type: str | [
"Sets",
"the",
"cost_type",
"of",
"this",
"TableRateShipping",
"."
] | d13fbe23f4d6ff22554c6d8d2deaf209371adaf1 | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/table_rate_shipping.py#L340-L354 |
40,562 | CodyKochmann/generators | generate_readme.py | get_source | def get_source(path):
''' yields all non-empty lines in a file '''
for line in read(path):
if 'import' in line or len(line.strip()) == 0 or line.startswith('#'):
continue
if '__name__' in line and '__main__' in line:
break
else:
yield line | python | def get_source(path):
''' yields all non-empty lines in a file '''
for line in read(path):
if 'import' in line or len(line.strip()) == 0 or line.startswith('#'):
continue
if '__name__' in line and '__main__' in line:
break
else:
yield line | [
"def",
"get_source",
"(",
"path",
")",
":",
"for",
"line",
"in",
"read",
"(",
"path",
")",
":",
"if",
"'import'",
"in",
"line",
"or",
"len",
"(",
"line",
".",
"strip",
"(",
")",
")",
"==",
"0",
"or",
"line",
".",
"startswith",
"(",
"'#'",
")",
... | yields all non-empty lines in a file | [
"yields",
"all",
"non",
"-",
"empty",
"lines",
"in",
"a",
"file"
] | e4ca4dd25d5023a94b0349c69d6224070cc2526f | https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/generate_readme.py#L22-L30 |
40,563 | wuher/devil | devil/auth.py | HttpBasic.authenticate | def authenticate(self, request):
""" Authenticate request using HTTP Basic authentication protocl.
If the user is successfully identified, the corresponding user
object is stored in `request.user`. If the request has already
been authenticated (i.e. `request.user` has authenticated user... | python | def authenticate(self, request):
""" Authenticate request using HTTP Basic authentication protocl.
If the user is successfully identified, the corresponding user
object is stored in `request.user`. If the request has already
been authenticated (i.e. `request.user` has authenticated user... | [
"def",
"authenticate",
"(",
"self",
",",
"request",
")",
":",
"# todo: can we trust that request.user variable is even defined?",
"if",
"request",
".",
"user",
"and",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
":",
"return",
"request",
".",
"user",
... | Authenticate request using HTTP Basic authentication protocl.
If the user is successfully identified, the corresponding user
object is stored in `request.user`. If the request has already
been authenticated (i.e. `request.user` has authenticated user
object), this function does nothing.... | [
"Authenticate",
"request",
"using",
"HTTP",
"Basic",
"authentication",
"protocl",
"."
] | a8834d4f88d915a21754c6b96f99d0ad9123ad4d | https://github.com/wuher/devil/blob/a8834d4f88d915a21754c6b96f99d0ad9123ad4d/devil/auth.py#L15-L47 |
40,564 | ymotongpoo/pyoauth2 | pavement.py | clean | def clean():
"""Clean up previous garbage"""
os.chdir(os.path.join(project_root, 'docs'))
sh("make clean")
os.chdir(project_root)
sh("rm -rf pyoauth2.egg-info") | python | def clean():
"""Clean up previous garbage"""
os.chdir(os.path.join(project_root, 'docs'))
sh("make clean")
os.chdir(project_root)
sh("rm -rf pyoauth2.egg-info") | [
"def",
"clean",
"(",
")",
":",
"os",
".",
"chdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"project_root",
",",
"'docs'",
")",
")",
"sh",
"(",
"\"make clean\"",
")",
"os",
".",
"chdir",
"(",
"project_root",
")",
"sh",
"(",
"\"rm -rf pyoauth2.egg-info... | Clean up previous garbage | [
"Clean",
"up",
"previous",
"garbage"
] | 7fddaf5fba190cfbc025961ce5948267d3d688ad | https://github.com/ymotongpoo/pyoauth2/blob/7fddaf5fba190cfbc025961ce5948267d3d688ad/pavement.py#L53-L58 |
40,565 | CodyKochmann/generators | generators/average.py | average | def average():
""" generator that holds a rolling average """
count = 0
total = total()
i=0
while 1:
i = yield ((total.send(i)*1.0)/count if count else 0)
count += 1 | python | def average():
""" generator that holds a rolling average """
count = 0
total = total()
i=0
while 1:
i = yield ((total.send(i)*1.0)/count if count else 0)
count += 1 | [
"def",
"average",
"(",
")",
":",
"count",
"=",
"0",
"total",
"=",
"total",
"(",
")",
"i",
"=",
"0",
"while",
"1",
":",
"i",
"=",
"yield",
"(",
"(",
"total",
".",
"send",
"(",
"i",
")",
"*",
"1.0",
")",
"/",
"count",
"if",
"count",
"else",
"... | generator that holds a rolling average | [
"generator",
"that",
"holds",
"a",
"rolling",
"average"
] | e4ca4dd25d5023a94b0349c69d6224070cc2526f | https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/generators/average.py#L14-L21 |
40,566 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.args | def args(self):
"""Parsed command-line arguments."""
if self._args is None:
parser = self._build_parser()
self._args = parser.parse_args()
return self._args | python | def args(self):
"""Parsed command-line arguments."""
if self._args is None:
parser = self._build_parser()
self._args = parser.parse_args()
return self._args | [
"def",
"args",
"(",
"self",
")",
":",
"if",
"self",
".",
"_args",
"is",
"None",
":",
"parser",
"=",
"self",
".",
"_build_parser",
"(",
")",
"self",
".",
"_args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"return",
"self",
".",
"_args"
] | Parsed command-line arguments. | [
"Parsed",
"command",
"-",
"line",
"arguments",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L33-L38 |
40,567 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.build_pypackage_basename | def build_pypackage_basename(self, pytree, base):
"""Build the string representing the parsed package basename.
:param str pytree: The pytree absolute path.
:param str pytree: The absolute path of the pytree sub-package of which determine the
parsed name.
:rtype: str
... | python | def build_pypackage_basename(self, pytree, base):
"""Build the string representing the parsed package basename.
:param str pytree: The pytree absolute path.
:param str pytree: The absolute path of the pytree sub-package of which determine the
parsed name.
:rtype: str
... | [
"def",
"build_pypackage_basename",
"(",
"self",
",",
"pytree",
",",
"base",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"pytree",
")",
"parsed_package_name",
"=",
"base",
".",
"replace",
"(",
"dirname",
",",
"''",
")",
".",
"strip",... | Build the string representing the parsed package basename.
:param str pytree: The pytree absolute path.
:param str pytree: The absolute path of the pytree sub-package of which determine the
parsed name.
:rtype: str | [
"Build",
"the",
"string",
"representing",
"the",
"parsed",
"package",
"basename",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L40-L50 |
40,568 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck._build_parser | def _build_parser(self):
"""Build the needed command-line parser."""
parser = argparse.ArgumentParser()
parser.add_argument('--pytree',
required=True,
type=self._valid_directory,
help='This is the path, absolute... | python | def _build_parser(self):
"""Build the needed command-line parser."""
parser = argparse.ArgumentParser()
parser.add_argument('--pytree',
required=True,
type=self._valid_directory,
help='This is the path, absolute... | [
"def",
"_build_parser",
"(",
"self",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--pytree'",
",",
"required",
"=",
"True",
",",
"type",
"=",
"self",
".",
"_valid_directory",
",",
"help",
"=",
... | Build the needed command-line parser. | [
"Build",
"the",
"needed",
"command",
"-",
"line",
"parser",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L52-L77 |
40,569 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.build_pyfile_path_from_docname | def build_pyfile_path_from_docname(self, docfile):
"""Build the expected Python file name based on the given documentation file name.
:param str docfile: The documentation file name from which to build the Python file name.
:rtype: str
"""
name, ext = os.path.splitext(docfile)
... | python | def build_pyfile_path_from_docname(self, docfile):
"""Build the expected Python file name based on the given documentation file name.
:param str docfile: The documentation file name from which to build the Python file name.
:rtype: str
"""
name, ext = os.path.splitext(docfile)
... | [
"def",
"build_pyfile_path_from_docname",
"(",
"self",
",",
"docfile",
")",
":",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"docfile",
")",
"expected_py_name",
"=",
"name",
".",
"replace",
"(",
"'.'",
",",
"'/'",
")",
"+",
"'.py'",
... | Build the expected Python file name based on the given documentation file name.
:param str docfile: The documentation file name from which to build the Python file name.
:rtype: str | [
"Build",
"the",
"expected",
"Python",
"file",
"name",
"based",
"on",
"the",
"given",
"documentation",
"file",
"name",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L89-L97 |
40,570 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.calculate_tree_differences | def calculate_tree_differences(self, pytree, doctree):
"""Calculate the differences between the given trees.
:param dict pytree: The dictionary of the parsed Python tree.
:param dict doctree: The dictionary of the parsed documentation tree.
:rtype: tuple
:returns: A two-tuple of... | python | def calculate_tree_differences(self, pytree, doctree):
"""Calculate the differences between the given trees.
:param dict pytree: The dictionary of the parsed Python tree.
:param dict doctree: The dictionary of the parsed documentation tree.
:rtype: tuple
:returns: A two-tuple of... | [
"def",
"calculate_tree_differences",
"(",
"self",
",",
"pytree",
",",
"doctree",
")",
":",
"pykeys",
"=",
"set",
"(",
"pytree",
".",
"keys",
"(",
")",
")",
"dockeys",
"=",
"set",
"(",
"doctree",
".",
"keys",
"(",
")",
")",
"# Calculate the missing document... | Calculate the differences between the given trees.
:param dict pytree: The dictionary of the parsed Python tree.
:param dict doctree: The dictionary of the parsed documentation tree.
:rtype: tuple
:returns: A two-tuple of sets, where the first is the missing Python files, and the second... | [
"Calculate",
"the",
"differences",
"between",
"the",
"given",
"trees",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L99-L119 |
40,571 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.compare_trees | def compare_trees(self, parsed_pytree, parsed_doctree):
"""Compare the given parsed trees.
:param dict parsed_pytree: A dictionary representing the parsed Python tree where each
key is a parsed Python file and its key is its expected rst file name.
"""
if parsed_pytree == pa... | python | def compare_trees(self, parsed_pytree, parsed_doctree):
"""Compare the given parsed trees.
:param dict parsed_pytree: A dictionary representing the parsed Python tree where each
key is a parsed Python file and its key is its expected rst file name.
"""
if parsed_pytree == pa... | [
"def",
"compare_trees",
"(",
"self",
",",
"parsed_pytree",
",",
"parsed_doctree",
")",
":",
"if",
"parsed_pytree",
"==",
"parsed_doctree",
":",
"return",
"0",
"missing_pys",
",",
"missing_docs",
"=",
"self",
".",
"calculate_tree_differences",
"(",
"pytree",
"=",
... | Compare the given parsed trees.
:param dict parsed_pytree: A dictionary representing the parsed Python tree where each
key is a parsed Python file and its key is its expected rst file name. | [
"Compare",
"the",
"given",
"parsed",
"trees",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L121-L133 |
40,572 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.parse_doc_tree | def parse_doc_tree(self, doctree, pypackages):
"""Parse the given documentation tree.
:param str doctree: The absolute path to the documentation tree which is to be parsed.
:param set pypackages: A set of all Python packages found in the pytree.
:rtype: dict
:returns: A dict whe... | python | def parse_doc_tree(self, doctree, pypackages):
"""Parse the given documentation tree.
:param str doctree: The absolute path to the documentation tree which is to be parsed.
:param set pypackages: A set of all Python packages found in the pytree.
:rtype: dict
:returns: A dict whe... | [
"def",
"parse_doc_tree",
"(",
"self",
",",
"doctree",
",",
"pypackages",
")",
":",
"parsed_doctree",
"=",
"{",
"}",
"for",
"filename",
"in",
"os",
".",
"listdir",
"(",
"doctree",
")",
":",
"if",
"self",
".",
"_ignore_docfile",
"(",
"filename",
")",
":",
... | Parse the given documentation tree.
:param str doctree: The absolute path to the documentation tree which is to be parsed.
:param set pypackages: A set of all Python packages found in the pytree.
:rtype: dict
:returns: A dict where each key is the path of an expected Python module and i... | [
"Parse",
"the",
"given",
"documentation",
"tree",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L165-L183 |
40,573 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.parse_py_tree | def parse_py_tree(self, pytree):
"""Parse the given Python package tree.
:param str pytree: The absolute path to the Python tree which is to be parsed.
:rtype: dict
:returns: A two-tuple. The first element is a dict where each key is the path of a parsed
Python module (relat... | python | def parse_py_tree(self, pytree):
"""Parse the given Python package tree.
:param str pytree: The absolute path to the Python tree which is to be parsed.
:rtype: dict
:returns: A two-tuple. The first element is a dict where each key is the path of a parsed
Python module (relat... | [
"def",
"parse_py_tree",
"(",
"self",
",",
"pytree",
")",
":",
"parsed_pytree",
"=",
"{",
"}",
"pypackages",
"=",
"set",
"(",
")",
"for",
"base",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"pytree",
")",
":",
"if",
"self",
".",
"_ignor... | Parse the given Python package tree.
:param str pytree: The absolute path to the Python tree which is to be parsed.
:rtype: dict
:returns: A two-tuple. The first element is a dict where each key is the path of a parsed
Python module (relative to the Python tree) and its value is the... | [
"Parse",
"the",
"given",
"Python",
"package",
"tree",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L185-L217 |
40,574 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.pprint_tree_differences | def pprint_tree_differences(self, missing_pys, missing_docs):
"""Pprint the missing files of each given set.
:param set missing_pys: The set of missing Python files.
:param set missing_docs: The set of missing documentation files.
:rtype: None
"""
if missing_pys:
... | python | def pprint_tree_differences(self, missing_pys, missing_docs):
"""Pprint the missing files of each given set.
:param set missing_pys: The set of missing Python files.
:param set missing_docs: The set of missing documentation files.
:rtype: None
"""
if missing_pys:
... | [
"def",
"pprint_tree_differences",
"(",
"self",
",",
"missing_pys",
",",
"missing_docs",
")",
":",
"if",
"missing_pys",
":",
"print",
"(",
"'The following Python files appear to be missing:'",
")",
"for",
"pyfile",
"in",
"missing_pys",
":",
"print",
"(",
"pyfile",
")... | Pprint the missing files of each given set.
:param set missing_pys: The set of missing Python files.
:param set missing_docs: The set of missing documentation files.
:rtype: None | [
"Pprint",
"the",
"missing",
"files",
"of",
"each",
"given",
"set",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L219-L236 |
40,575 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck._valid_directory | def _valid_directory(self, path):
"""Ensure that the given path is valid.
:param str path: A valid directory path.
:raises: :py:class:`argparse.ArgumentTypeError`
:returns: An absolute directory path.
"""
abspath = os.path.abspath(path)
if not os.path.isdir(abspa... | python | def _valid_directory(self, path):
"""Ensure that the given path is valid.
:param str path: A valid directory path.
:raises: :py:class:`argparse.ArgumentTypeError`
:returns: An absolute directory path.
"""
abspath = os.path.abspath(path)
if not os.path.isdir(abspa... | [
"def",
"_valid_directory",
"(",
"self",
",",
"path",
")",
":",
"abspath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"abspath",
")",
":",
"raise",
"argparse",
".",
"ArgumentTypeError",
... | Ensure that the given path is valid.
:param str path: A valid directory path.
:raises: :py:class:`argparse.ArgumentTypeError`
:returns: An absolute directory path. | [
"Ensure",
"that",
"the",
"given",
"path",
"is",
"valid",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L238-L248 |
40,576 | objectrocket/python-client | scripts/check_docs.py | DocParityCheck.main | def main(self):
"""Parse package trees and report on any discrepancies."""
args = self.args
parsed_pytree, pypackages = self.parse_py_tree(pytree=args.pytree)
parsed_doctree = self.parse_doc_tree(doctree=args.doctree, pypackages=pypackages)
return self.compare_trees(parsed_pytree... | python | def main(self):
"""Parse package trees and report on any discrepancies."""
args = self.args
parsed_pytree, pypackages = self.parse_py_tree(pytree=args.pytree)
parsed_doctree = self.parse_doc_tree(doctree=args.doctree, pypackages=pypackages)
return self.compare_trees(parsed_pytree... | [
"def",
"main",
"(",
"self",
")",
":",
"args",
"=",
"self",
".",
"args",
"parsed_pytree",
",",
"pypackages",
"=",
"self",
".",
"parse_py_tree",
"(",
"pytree",
"=",
"args",
".",
"pytree",
")",
"parsed_doctree",
"=",
"self",
".",
"parse_doc_tree",
"(",
"doc... | Parse package trees and report on any discrepancies. | [
"Parse",
"package",
"trees",
"and",
"report",
"on",
"any",
"discrepancies",
"."
] | a65868c7511ff49a5fbe304e53bf592b7fc6d5ef | https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L250-L255 |
40,577 | AtomHash/evernode | evernode/models/fail2ban_model.py | Fail2BanModel.where_unique | def where_unique(cls, ip, object_id, location):
""" Get db model by username """
return cls.query.filter_by(
ip=ip,
object_id=object_id,
location=location).first() | python | def where_unique(cls, ip, object_id, location):
""" Get db model by username """
return cls.query.filter_by(
ip=ip,
object_id=object_id,
location=location).first() | [
"def",
"where_unique",
"(",
"cls",
",",
"ip",
",",
"object_id",
",",
"location",
")",
":",
"return",
"cls",
".",
"query",
".",
"filter_by",
"(",
"ip",
"=",
"ip",
",",
"object_id",
"=",
"object_id",
",",
"location",
"=",
"location",
")",
".",
"first",
... | Get db model by username | [
"Get",
"db",
"model",
"by",
"username"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/fail2ban_model.py#L27-L32 |
40,578 | AtomHash/evernode | evernode/models/fail2ban_model.py | Fail2BanModel.delete_where_unique | def delete_where_unique(cls, ip, object_id, location):
""" delete by ip and object id """
result = cls.where_unique(ip, object_id, location)
if result is None:
return None
result.delete()
return True | python | def delete_where_unique(cls, ip, object_id, location):
""" delete by ip and object id """
result = cls.where_unique(ip, object_id, location)
if result is None:
return None
result.delete()
return True | [
"def",
"delete_where_unique",
"(",
"cls",
",",
"ip",
",",
"object_id",
",",
"location",
")",
":",
"result",
"=",
"cls",
".",
"where_unique",
"(",
"ip",
",",
"object_id",
",",
"location",
")",
"if",
"result",
"is",
"None",
":",
"return",
"None",
"result",... | delete by ip and object id | [
"delete",
"by",
"ip",
"and",
"object",
"id"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/fail2ban_model.py#L40-L46 |
40,579 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.do_req | def do_req(self, method, url, body=None, headers=None, status=None):
"""Used internally to send a request to the API, left public
so it can be used to talk to the API more directly.
"""
if body is None:
body = ''
else:
body = json.dumps(body)
res =... | python | def do_req(self, method, url, body=None, headers=None, status=None):
"""Used internally to send a request to the API, left public
so it can be used to talk to the API more directly.
"""
if body is None:
body = ''
else:
body = json.dumps(body)
res =... | [
"def",
"do_req",
"(",
"self",
",",
"method",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"status",
"=",
"None",
")",
":",
"if",
"body",
"is",
"None",
":",
"body",
"=",
"''",
"else",
":",
"body",
"=",
"json",
".",
"du... | Used internally to send a request to the API, left public
so it can be used to talk to the API more directly. | [
"Used",
"internally",
"to",
"send",
"a",
"request",
"to",
"the",
"API",
"left",
"public",
"so",
"it",
"can",
"be",
"used",
"to",
"talk",
"to",
"the",
"API",
"more",
"directly",
"."
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L68-L89 |
40,580 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient._depaginate_all | def _depaginate_all(self, url):
"""GETs the url provided and traverses the 'next' url that's
returned while storing the data in a list. Returns a single list of all
items.
"""
items = []
for x in self._depagination_generator(url):
items += x
return ite... | python | def _depaginate_all(self, url):
"""GETs the url provided and traverses the 'next' url that's
returned while storing the data in a list. Returns a single list of all
items.
"""
items = []
for x in self._depagination_generator(url):
items += x
return ite... | [
"def",
"_depaginate_all",
"(",
"self",
",",
"url",
")",
":",
"items",
"=",
"[",
"]",
"for",
"x",
"in",
"self",
".",
"_depagination_generator",
"(",
"url",
")",
":",
"items",
"+=",
"x",
"return",
"items"
] | GETs the url provided and traverses the 'next' url that's
returned while storing the data in a list. Returns a single list of all
items. | [
"GETs",
"the",
"url",
"provided",
"and",
"traverses",
"the",
"next",
"url",
"that",
"s",
"returned",
"while",
"storing",
"the",
"data",
"in",
"a",
"list",
".",
"Returns",
"a",
"single",
"list",
"of",
"all",
"items",
"."
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L101-L109 |
40,581 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.create_user | def create_user(self, user_id,
roles=None, netmask=None,
secret=None, pubkey=None):
u"""Create user for the Merchant given in the X-Mcash-Merchant header.
Arguments:
user_id:
Identifier for the user
roles:
R... | python | def create_user(self, user_id,
roles=None, netmask=None,
secret=None, pubkey=None):
u"""Create user for the Merchant given in the X-Mcash-Merchant header.
Arguments:
user_id:
Identifier for the user
roles:
R... | [
"def",
"create_user",
"(",
"self",
",",
"user_id",
",",
"roles",
"=",
"None",
",",
"netmask",
"=",
"None",
",",
"secret",
"=",
"None",
",",
"pubkey",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'id'",
":",
"user_id",
",",
"'roles'",
":",
"roles",
... | u"""Create user for the Merchant given in the X-Mcash-Merchant header.
Arguments:
user_id:
Identifier for the user
roles:
Role
netmask:
Limit user connections by netmask, for example 192.168.1.0/24
secret:
... | [
"u",
"Create",
"user",
"for",
"the",
"Merchant",
"given",
"in",
"the",
"X",
"-",
"Mcash",
"-",
"Merchant",
"header",
"."
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L139-L161 |
40,582 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.update_user | def update_user(self, user_id,
roles=None, netmask=None,
secret=None, pubkey=None):
"""Update user. Returns the raw response object.
Arguments:
user_id:
User id of user to update
roles:
Role
netm... | python | def update_user(self, user_id,
roles=None, netmask=None,
secret=None, pubkey=None):
"""Update user. Returns the raw response object.
Arguments:
user_id:
User id of user to update
roles:
Role
netm... | [
"def",
"update_user",
"(",
"self",
",",
"user_id",
",",
"roles",
"=",
"None",
",",
"netmask",
"=",
"None",
",",
"secret",
"=",
"None",
",",
"pubkey",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'roles'",
":",
"roles",
",",
"'netmask'",
":",
"netma... | Update user. Returns the raw response object.
Arguments:
user_id:
User id of user to update
roles:
Role
netmask:
Limit user connections by netmask, for example 192.168.1.0/24
secret:
Secret used when... | [
"Update",
"user",
".",
"Returns",
"the",
"raw",
"response",
"object",
"."
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L164-L187 |
40,583 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.create_pos | def create_pos(self, name, pos_type,
pos_id, location=None):
"""Create POS resource
Arguments:
name:
Human-readable name of the POS, used for displaying payment
request origin to end user
pos_type:
POS type
... | python | def create_pos(self, name, pos_type,
pos_id, location=None):
"""Create POS resource
Arguments:
name:
Human-readable name of the POS, used for displaying payment
request origin to end user
pos_type:
POS type
... | [
"def",
"create_pos",
"(",
"self",
",",
"name",
",",
"pos_type",
",",
"pos_id",
",",
"location",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'name'",
":",
"name",
",",
"'type'",
":",
"pos_type",
",",
"'id'",
":",
"pos_id",
",",
"'location'",
":",
"... | Create POS resource
Arguments:
name:
Human-readable name of the POS, used for displaying payment
request origin to end user
pos_type:
POS type
location:
Merchant location
pos_id:
The ... | [
"Create",
"POS",
"resource"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L201-L221 |
40,584 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.update_pos | def update_pos(self, pos_id, name, pos_type, location=None):
"""Update POS resource. Returns the raw response object.
Arguments:
pos_id:
POS id as chosen on registration
name:
Human-readable name of the POS, used for displaying payment
... | python | def update_pos(self, pos_id, name, pos_type, location=None):
"""Update POS resource. Returns the raw response object.
Arguments:
pos_id:
POS id as chosen on registration
name:
Human-readable name of the POS, used for displaying payment
... | [
"def",
"update_pos",
"(",
"self",
",",
"pos_id",
",",
"name",
",",
"pos_type",
",",
"location",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'name'",
":",
"name",
",",
"'type'",
":",
"pos_type",
",",
"'location'",
":",
"location",
"}",
"return",
"sel... | Update POS resource. Returns the raw response object.
Arguments:
pos_id:
POS id as chosen on registration
name:
Human-readable name of the POS, used for displaying payment
request origin to end user
pos_type:
PO... | [
"Update",
"POS",
"resource",
".",
"Returns",
"the",
"raw",
"response",
"object",
"."
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L229-L248 |
40,585 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.create_payment_request | def create_payment_request(self, customer, currency, amount, allow_credit,
pos_id, pos_tid, action, ledger=None,
display_message_uri=None, callback_uri=None,
additional_amount=None, additional_edit=None,
... | python | def create_payment_request(self, customer, currency, amount, allow_credit,
pos_id, pos_tid, action, ledger=None,
display_message_uri=None, callback_uri=None,
additional_amount=None, additional_edit=None,
... | [
"def",
"create_payment_request",
"(",
"self",
",",
"customer",
",",
"currency",
",",
"amount",
",",
"allow_credit",
",",
"pos_id",
",",
"pos_tid",
",",
"action",
",",
"ledger",
"=",
"None",
",",
"display_message_uri",
"=",
"None",
",",
"callback_uri",
"=",
"... | Post payment request. The call is idempotent; that is, if one posts
the same pos_id and pos_tid twice, only one payment request is created.
Arguments:
ledger:
Log entries will be added to the open report on the specified
ledger
display_message_uri... | [
"Post",
"payment",
"request",
".",
"The",
"call",
"is",
"idempotent",
";",
"that",
"is",
"if",
"one",
"posts",
"the",
"same",
"pos_id",
"and",
"pos_tid",
"twice",
"only",
"one",
"payment",
"request",
"is",
"created",
"."
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L273-L369 |
40,586 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.update_payment_request | def update_payment_request(self, tid, currency=None, amount=None,
action=None, ledger=None, callback_uri=None,
display_message_uri=None, capture_id=None,
additional_amount=None, text=None, refund_id=None,
... | python | def update_payment_request(self, tid, currency=None, amount=None,
action=None, ledger=None, callback_uri=None,
display_message_uri=None, capture_id=None,
additional_amount=None, text=None, refund_id=None,
... | [
"def",
"update_payment_request",
"(",
"self",
",",
"tid",
",",
"currency",
"=",
"None",
",",
"amount",
"=",
"None",
",",
"action",
"=",
"None",
",",
"ledger",
"=",
"None",
",",
"callback_uri",
"=",
"None",
",",
"display_message_uri",
"=",
"None",
",",
"c... | Update payment request, reauthorize, capture, release or abort
It is possible to update ledger and the callback URIs for a payment
request. Changes are always appended to the open report of a ledger,
and notifications are sent to the callback registered at the time of
notification.
... | [
"Update",
"payment",
"request",
"reauthorize",
"capture",
"release",
"or",
"abort"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L372-L455 |
40,587 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.post_chat_message | def post_chat_message(self, merchant_id, channel_id, message):
"""post a chat message
Arguments:
channel_id:
Scan token
"""
return self.do_req('POST',
self.base_url + '/chat/v1/merchant/%s/channel/%s/message/' % (merchant_id, chann... | python | def post_chat_message(self, merchant_id, channel_id, message):
"""post a chat message
Arguments:
channel_id:
Scan token
"""
return self.do_req('POST',
self.base_url + '/chat/v1/merchant/%s/channel/%s/message/' % (merchant_id, chann... | [
"def",
"post_chat_message",
"(",
"self",
",",
"merchant_id",
",",
"channel_id",
",",
"message",
")",
":",
"return",
"self",
".",
"do_req",
"(",
"'POST'",
",",
"self",
".",
"base_url",
"+",
"'/chat/v1/merchant/%s/channel/%s/message/'",
"%",
"(",
"merchant_id",
",... | post a chat message
Arguments:
channel_id:
Scan token | [
"post",
"a",
"chat",
"message"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L479-L489 |
40,588 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.create_shortlink | def create_shortlink(self, callback_uri=None,
description=None, serial_number=None):
"""Register new shortlink
Arguments:
callback_uri:
URI called by mCASH when user scans shortlink
description:
Shortlink description displ... | python | def create_shortlink(self, callback_uri=None,
description=None, serial_number=None):
"""Register new shortlink
Arguments:
callback_uri:
URI called by mCASH when user scans shortlink
description:
Shortlink description displ... | [
"def",
"create_shortlink",
"(",
"self",
",",
"callback_uri",
"=",
"None",
",",
"description",
"=",
"None",
",",
"serial_number",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'callback_uri'",
":",
"callback_uri",
",",
"'description'",
":",
"description",
",",... | Register new shortlink
Arguments:
callback_uri:
URI called by mCASH when user scans shortlink
description:
Shortlink description displayed in confirmation dialogs
serial_number:
Serial number on printed QR codes. This field is ... | [
"Register",
"new",
"shortlink"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L515-L532 |
40,589 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.update_shortlink | def update_shortlink(self, shortlink_id, callback_uri=None,
description=None):
"""Update existing shortlink registration
Arguments:
shortlink_id:
Shortlink id assigned by mCASH
"""
arguments = {'callback_uri': callback_uri,
... | python | def update_shortlink(self, shortlink_id, callback_uri=None,
description=None):
"""Update existing shortlink registration
Arguments:
shortlink_id:
Shortlink id assigned by mCASH
"""
arguments = {'callback_uri': callback_uri,
... | [
"def",
"update_shortlink",
"(",
"self",
",",
"shortlink_id",
",",
"callback_uri",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'callback_uri'",
":",
"callback_uri",
",",
"'description'",
":",
"description",
"}",
"return",
"se... | Update existing shortlink registration
Arguments:
shortlink_id:
Shortlink id assigned by mCASH | [
"Update",
"existing",
"shortlink",
"registration"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L547-L559 |
40,590 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.get_shortlink | def get_shortlink(self, shortlink_id_or_url):
"""Retrieve registered shortlink info
Arguments:
shortlink_id_or_url:
Shortlink id or url, assigned by mCASH
"""
if "://" not in shortlink_id_or_url:
shortlink_id_or_url = self.merchant_api_base_url + ... | python | def get_shortlink(self, shortlink_id_or_url):
"""Retrieve registered shortlink info
Arguments:
shortlink_id_or_url:
Shortlink id or url, assigned by mCASH
"""
if "://" not in shortlink_id_or_url:
shortlink_id_or_url = self.merchant_api_base_url + ... | [
"def",
"get_shortlink",
"(",
"self",
",",
"shortlink_id_or_url",
")",
":",
"if",
"\"://\"",
"not",
"in",
"shortlink_id_or_url",
":",
"shortlink_id_or_url",
"=",
"self",
".",
"merchant_api_base_url",
"+",
"'/shortlink/'",
"+",
"shortlink_id_or_url",
"+",
"'/'",
"retu... | Retrieve registered shortlink info
Arguments:
shortlink_id_or_url:
Shortlink id or url, assigned by mCASH | [
"Retrieve",
"registered",
"shortlink",
"info"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L572-L582 |
40,591 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.create_ledger | def create_ledger(self, currency, description=None):
"""Create a ledger
"""
arguments = {'currency': currency,
'description': description}
return self.do_req('POST',
self.merchant_api_base_url + '/ledger/', arguments).json() | python | def create_ledger(self, currency, description=None):
"""Create a ledger
"""
arguments = {'currency': currency,
'description': description}
return self.do_req('POST',
self.merchant_api_base_url + '/ledger/', arguments).json() | [
"def",
"create_ledger",
"(",
"self",
",",
"currency",
",",
"description",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'currency'",
":",
"currency",
",",
"'description'",
":",
"description",
"}",
"return",
"self",
".",
"do_req",
"(",
"'POST'",
",",
"self... | Create a ledger | [
"Create",
"a",
"ledger"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L585-L591 |
40,592 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.update_ledger | def update_ledger(self, ledger_id, description=None):
"""Update ledger info
Arguments:
ledger_id:
Ledger id assigned by mCASH
description:
Description of the Ledger and it's usage
"""
arguments = {'description': description}
... | python | def update_ledger(self, ledger_id, description=None):
"""Update ledger info
Arguments:
ledger_id:
Ledger id assigned by mCASH
description:
Description of the Ledger and it's usage
"""
arguments = {'description': description}
... | [
"def",
"update_ledger",
"(",
"self",
",",
"ledger_id",
",",
"description",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'description'",
":",
"description",
"}",
"return",
"self",
".",
"do_req",
"(",
"'PUT'",
",",
"self",
".",
"merchant_api_base_url",
"+",
... | Update ledger info
Arguments:
ledger_id:
Ledger id assigned by mCASH
description:
Description of the Ledger and it's usage | [
"Update",
"ledger",
"info"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L599-L611 |
40,593 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.close_report | def close_report(self, ledger_id, report_id, callback_uri=None):
u"""Close Report
When you PUT to a report, it will start the process of closing it. When
the closing process is complete (i.e. when report.status == 'closed')
mCASH does a POST call to callback_uri, if provided. This call ... | python | def close_report(self, ledger_id, report_id, callback_uri=None):
u"""Close Report
When you PUT to a report, it will start the process of closing it. When
the closing process is complete (i.e. when report.status == 'closed')
mCASH does a POST call to callback_uri, if provided. This call ... | [
"def",
"close_report",
"(",
"self",
",",
"ledger_id",
",",
"report_id",
",",
"callback_uri",
"=",
"None",
")",
":",
"arguments",
"=",
"{",
"'callback_uri'",
":",
"callback_uri",
"}",
"return",
"self",
".",
"do_req",
"(",
"'PUT'",
",",
"self",
".",
"merchan... | u"""Close Report
When you PUT to a report, it will start the process of closing it. When
the closing process is complete (i.e. when report.status == 'closed')
mCASH does a POST call to callback_uri, if provided. This call will
contain JSON data similar to when GETing the Report.
... | [
"u",
"Close",
"Report"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L648-L675 |
40,594 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.get_report | def get_report(self, ledger_id, report_id):
"""Get report info
Arguments:
ledger_id:
Id for ledger for report
report_id:
Report id assigned by mCASH
"""
return self.do_req('GET',
self.merchant_api_base_ur... | python | def get_report(self, ledger_id, report_id):
"""Get report info
Arguments:
ledger_id:
Id for ledger for report
report_id:
Report id assigned by mCASH
"""
return self.do_req('GET',
self.merchant_api_base_ur... | [
"def",
"get_report",
"(",
"self",
",",
"ledger_id",
",",
"report_id",
")",
":",
"return",
"self",
".",
"do_req",
"(",
"'GET'",
",",
"self",
".",
"merchant_api_base_url",
"+",
"'/ledger/'",
"+",
"ledger_id",
"+",
"'/report/'",
"+",
"report_id",
"+",
"'/'",
... | Get report info
Arguments:
ledger_id:
Id for ledger for report
report_id:
Report id assigned by mCASH | [
"Get",
"report",
"info"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L677-L689 |
40,595 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.create_permission_request | def create_permission_request(self, customer, pos_id, pos_tid, scope,
ledger=None, text=None, callback_uri=None,
expires_in=None):
"""Create permission request
The call is idempotent; that is, if one posts the same pos_id and
p... | python | def create_permission_request(self, customer, pos_id, pos_tid, scope,
ledger=None, text=None, callback_uri=None,
expires_in=None):
"""Create permission request
The call is idempotent; that is, if one posts the same pos_id and
p... | [
"def",
"create_permission_request",
"(",
"self",
",",
"customer",
",",
"pos_id",
",",
"pos_tid",
",",
"scope",
",",
"ledger",
"=",
"None",
",",
"text",
"=",
"None",
",",
"callback_uri",
"=",
"None",
",",
"expires_in",
"=",
"None",
")",
":",
"arguments",
... | Create permission request
The call is idempotent; that is, if one posts the same pos_id and
pos_tid twice, only one Permission request is created. | [
"Create",
"permission",
"request"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L723-L741 |
40,596 | mcash/merchant-api-python-sdk | mcash/mapi_client/mapi_client.py | MapiClient.upload_receipt | def upload_receipt(self, url, data):
"""Upload a receipt to the give url
:param url:
:param data:
:return:
"""
return self.upload_attachment(url=url, data=data, mime_type='application/vnd.mcash.receipt.v1+json') | python | def upload_receipt(self, url, data):
"""Upload a receipt to the give url
:param url:
:param data:
:return:
"""
return self.upload_attachment(url=url, data=data, mime_type='application/vnd.mcash.receipt.v1+json') | [
"def",
"upload_receipt",
"(",
"self",
",",
"url",
",",
"data",
")",
":",
"return",
"self",
".",
"upload_attachment",
"(",
"url",
"=",
"url",
",",
"data",
"=",
"data",
",",
"mime_type",
"=",
"'application/vnd.mcash.receipt.v1+json'",
")"
] | Upload a receipt to the give url
:param url:
:param data:
:return: | [
"Upload",
"a",
"receipt",
"to",
"the",
"give",
"url"
] | ebe8734126790354b71077aca519ff263235944e | https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client.py#L777-L784 |
40,597 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/twitter_util.py | safe_twitter_request_handler | def safe_twitter_request_handler(twitter_api_func,
call_rate_limit,
call_counter,
time_window_start,
max_retries,
wait_period,
... | python | def safe_twitter_request_handler(twitter_api_func,
call_rate_limit,
call_counter,
time_window_start,
max_retries,
wait_period,
... | [
"def",
"safe_twitter_request_handler",
"(",
"twitter_api_func",
",",
"call_rate_limit",
",",
"call_counter",
",",
"time_window_start",
",",
"max_retries",
",",
"wait_period",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"error_count",
"=",
"0",
"while",
"Tru... | This is a safe function handler for any twitter request.
Inputs: - twitter_api_func: The twython function object to be safely called.
- call_rate_limit: THe call rate limit for this specific Twitter API function.
- call_counter: A counter that keeps track of the number of function calls ... | [
"This",
"is",
"a",
"safe",
"function",
"handler",
"for",
"any",
"twitter",
"request",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/twitter_util.py#L27-L94 |
40,598 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/twitter_util.py | handle_twitter_http_error | def handle_twitter_http_error(e, error_count, call_counter, time_window_start, wait_period):
"""
This function handles the twitter request in case of an HTTP error.
Inputs: - e: A twython.TwythonError instance to be handled.
- error_count: Number of failed retries of the call until now.
... | python | def handle_twitter_http_error(e, error_count, call_counter, time_window_start, wait_period):
"""
This function handles the twitter request in case of an HTTP error.
Inputs: - e: A twython.TwythonError instance to be handled.
- error_count: Number of failed retries of the call until now.
... | [
"def",
"handle_twitter_http_error",
"(",
"e",
",",
"error_count",
",",
"call_counter",
",",
"time_window_start",
",",
"wait_period",
")",
":",
"if",
"e",
".",
"error_code",
"==",
"401",
":",
"# Encountered 401 Error (Not Authorized)",
"raise",
"e",
"elif",
"e",
".... | This function handles the twitter request in case of an HTTP error.
Inputs: - e: A twython.TwythonError instance to be handled.
- error_count: Number of failed retries of the call until now.
- call_counter: A counter that keeps track of the number of function calls in the current 15-minu... | [
"This",
"function",
"handles",
"the",
"twitter",
"request",
"in",
"case",
"of",
"an",
"HTTP",
"error",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/twitter_util.py#L97-L134 |
40,599 | sdcooke/django_bundles | django_bundles/management/commands/create_bundles.py | make_bundle | def make_bundle(bundle, fixed_version=None):
"""
Does all of the processing required to create a bundle and write it to disk, returning its hash version
"""
tmp_output_file_name = '%s.%s.%s' % (os.path.join(bundle.bundle_file_root, bundle.bundle_filename), 'temp', bundle.bundle_type)
iter_input = i... | python | def make_bundle(bundle, fixed_version=None):
"""
Does all of the processing required to create a bundle and write it to disk, returning its hash version
"""
tmp_output_file_name = '%s.%s.%s' % (os.path.join(bundle.bundle_file_root, bundle.bundle_filename), 'temp', bundle.bundle_type)
iter_input = i... | [
"def",
"make_bundle",
"(",
"bundle",
",",
"fixed_version",
"=",
"None",
")",
":",
"tmp_output_file_name",
"=",
"'%s.%s.%s'",
"%",
"(",
"os",
".",
"path",
".",
"join",
"(",
"bundle",
".",
"bundle_file_root",
",",
"bundle",
".",
"bundle_filename",
")",
",",
... | Does all of the processing required to create a bundle and write it to disk, returning its hash version | [
"Does",
"all",
"of",
"the",
"processing",
"required",
"to",
"create",
"a",
"bundle",
"and",
"write",
"it",
"to",
"disk",
"returning",
"its",
"hash",
"version"
] | 2810fc455ec7391283792c1f108f4e8340f5d12f | https://github.com/sdcooke/django_bundles/blob/2810fc455ec7391283792c1f108f4e8340f5d12f/django_bundles/management/commands/create_bundles.py#L76-L99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.