nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py | python | DDLCompiler.visit_create_sequence | (self, create) | return text | [] | def visit_create_sequence(self, create):
text = "CREATE SEQUENCE %s" % \
self.preparer.format_sequence(create.element)
if create.element.increment is not None:
text += " INCREMENT BY %d" % create.element.increment
if create.element.start is not None:
text += "... | [
"def",
"visit_create_sequence",
"(",
"self",
",",
"create",
")",
":",
"text",
"=",
"\"CREATE SEQUENCE %s\"",
"%",
"self",
".",
"preparer",
".",
"format_sequence",
"(",
"create",
".",
"element",
")",
"if",
"create",
".",
"element",
".",
"increment",
"is",
"no... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py#L2628-L2649 | |||
barseghyanartur/django-dash | dc00513b65e017c40f278a0a7df2a18ec8da9bc3 | src/dash/templatetags/dash_tags.py | python | GetDashPluginNode.__init__ | (self, dashboard_entry, as_var=None) | [] | def __init__(self, dashboard_entry, as_var=None):
self.dashboard_entry = dashboard_entry
self.as_var = as_var | [
"def",
"__init__",
"(",
"self",
",",
"dashboard_entry",
",",
"as_var",
"=",
"None",
")",
":",
"self",
".",
"dashboard_entry",
"=",
"dashboard_entry",
"self",
".",
"as_var",
"=",
"as_var"
] | https://github.com/barseghyanartur/django-dash/blob/dc00513b65e017c40f278a0a7df2a18ec8da9bc3/src/dash/templatetags/dash_tags.py#L35-L37 | ||||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pkg_resources/__init__.py | python | ZipProvider._get_eager_resources | (self) | return self.eagers | [] | def _get_eager_resources(self):
if self.eagers is None:
eagers = []
for name in ('native_libs.txt', 'eager_resources.txt'):
if self.has_metadata(name):
eagers.extend(self.get_metadata_lines(name))
self.eagers = eagers
return self.ea... | [
"def",
"_get_eager_resources",
"(",
"self",
")",
":",
"if",
"self",
".",
"eagers",
"is",
"None",
":",
"eagers",
"=",
"[",
"]",
"for",
"name",
"in",
"(",
"'native_libs.txt'",
",",
"'eager_resources.txt'",
")",
":",
"if",
"self",
".",
"has_metadata",
"(",
... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/__init__.py#L1826-L1833 | |||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/distutils/sysconfig.py | python | customize_compiler | (compiler) | Do any platform-specific customization of a CCompiler instance.
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile. | Do any platform-specific customization of a CCompiler instance. | [
"Do",
"any",
"platform",
"-",
"specific",
"customization",
"of",
"a",
"CCompiler",
"instance",
"."
] | def customize_compiler(compiler):
"""Do any platform-specific customization of a CCompiler instance.
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile.
"""
if compiler.compiler_type == "unix":
if sys.platform == "darwin":
... | [
"def",
"customize_compiler",
"(",
"compiler",
")",
":",
"if",
"compiler",
".",
"compiler_type",
"==",
"\"unix\"",
":",
"if",
"sys",
".",
"platform",
"==",
"\"darwin\"",
":",
"# Perform first-time customization of compiler-related",
"# config vars on OS X now that we know we... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/distutils/sysconfig.py#L151-L222 | ||
PyMVPA/PyMVPA | 76c476b3de8264b0bb849bf226da5674d659564e | mvpa2/measures/anova.py | python | OneWayAnova.__init__ | (self, space='targets', **kwargs) | Parameters
----------
space : str
What samples attribute to use as targets (labels). | Parameters
----------
space : str
What samples attribute to use as targets (labels). | [
"Parameters",
"----------",
"space",
":",
"str",
"What",
"samples",
"attribute",
"to",
"use",
"as",
"targets",
"(",
"labels",
")",
"."
] | def __init__(self, space='targets', **kwargs):
"""
Parameters
----------
space : str
What samples attribute to use as targets (labels).
"""
# set auto-train flag since we have nothing special to be done
# so by default auto train
kwargs['auto_tra... | [
"def",
"__init__",
"(",
"self",
",",
"space",
"=",
"'targets'",
",",
"*",
"*",
"kwargs",
")",
":",
"# set auto-train flag since we have nothing special to be done",
"# so by default auto train",
"kwargs",
"[",
"'auto_train'",
"]",
"=",
"kwargs",
".",
"get",
"(",
"'a... | https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/measures/anova.py#L48-L58 | ||
eriklindernoren/ML-From-Scratch | a2806c6732eee8d27762edd6d864e0c179d8e9e8 | mlfromscratch/supervised_learning/decision_tree.py | python | DecisionTree.print_tree | (self, tree=None, indent=" ") | Recursively print the decision tree | Recursively print the decision tree | [
"Recursively",
"print",
"the",
"decision",
"tree"
] | def print_tree(self, tree=None, indent=" "):
""" Recursively print the decision tree """
if not tree:
tree = self.root
# If we're at leaf => print the label
if tree.value is not None:
print (tree.value)
# Go deeper down the tree
else:
... | [
"def",
"print_tree",
"(",
"self",
",",
"tree",
"=",
"None",
",",
"indent",
"=",
"\" \"",
")",
":",
"if",
"not",
"tree",
":",
"tree",
"=",
"self",
".",
"root",
"# If we're at leaf => print the label",
"if",
"tree",
".",
"value",
"is",
"not",
"None",
":",
... | https://github.com/eriklindernoren/ML-From-Scratch/blob/a2806c6732eee8d27762edd6d864e0c179d8e9e8/mlfromscratch/supervised_learning/decision_tree.py#L167-L184 | ||
ring04h/weakfilescan | b1a3066e3fdcd60b8ecf635526f49cb5ad603064 | libs/requests/cookies.py | python | MockRequest.get_origin_req_host | (self) | return self.get_host() | [] | def get_origin_req_host(self):
return self.get_host() | [
"def",
"get_origin_req_host",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_host",
"(",
")"
] | https://github.com/ring04h/weakfilescan/blob/b1a3066e3fdcd60b8ecf635526f49cb5ad603064/libs/requests/cookies.py#L44-L45 | |||
openstack/barbican | a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce | barbican/api/controllers/secrets.py | python | SecretController._lookup | (self, sub_resource, *remainder) | [] | def _lookup(self, sub_resource, *remainder):
if sub_resource == 'acl':
return acls.SecretACLsController(self.secret), remainder
elif sub_resource == 'metadata':
if len(remainder) == 0 or remainder == ('',):
return secretmeta.SecretMetadataController(self.secret), ... | [
"def",
"_lookup",
"(",
"self",
",",
"sub_resource",
",",
"*",
"remainder",
")",
":",
"if",
"sub_resource",
"==",
"'acl'",
":",
"return",
"acls",
".",
"SecretACLsController",
"(",
"self",
".",
"secret",
")",
",",
"remainder",
"elif",
"sub_resource",
"==",
"... | https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/api/controllers/secrets.py#L85-L104 | ||||
mgear-dev/mgear | 06ddc26c5adb5eab07ca470c7fafa77404c8a1de | scripts/mgear/maya/rigbits/sdk_io.py | python | mirrorSDKkeys | (node, attributes=[], invertDriver=True, invertDriven=True) | mirror/invert the values on the specified node and attrs, get the sdks
and invert those values
Args:
node (pynode): node being driven to have its sdk values inverted
attributes (list, optional): attrs to be inverted
invertDriver (bool, optional): should the driver, "time" values
... | mirror/invert the values on the specified node and attrs, get the sdks
and invert those values | [
"mirror",
"/",
"invert",
"the",
"values",
"on",
"the",
"specified",
"node",
"and",
"attrs",
"get",
"the",
"sdks",
"and",
"invert",
"those",
"values"
] | def mirrorSDKkeys(node, attributes=[], invertDriver=True, invertDriven=True):
"""mirror/invert the values on the specified node and attrs, get the sdks
and invert those values
Args:
node (pynode): node being driven to have its sdk values inverted
attributes (list, optional): attrs to be inv... | [
"def",
"mirrorSDKkeys",
"(",
"node",
",",
"attributes",
"=",
"[",
"]",
",",
"invertDriver",
"=",
"True",
",",
"invertDriven",
"=",
"True",
")",
":",
"sourceSDKInfo",
"=",
"getConnectedSDKs",
"(",
"node",
")",
"sourceSDKInfo",
".",
"extend",
"(",
"getMultiDri... | https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/rigbits/sdk_io.py#L378-L400 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/cherrypy/_cptools.py | python | Toolbox.__enter__ | (self) | return populate | Populate request.toolmaps from tools specified in config. | Populate request.toolmaps from tools specified in config. | [
"Populate",
"request",
".",
"toolmaps",
"from",
"tools",
"specified",
"in",
"config",
"."
] | def __enter__(self):
"""Populate request.toolmaps from tools specified in config."""
cherrypy.serving.request.toolmaps[self.namespace] = map = {}
def populate(k, v):
toolname, arg = k.split(".", 1)
bucket = map.setdefault(toolname, {})
bucket[arg] = v
... | [
"def",
"__enter__",
"(",
"self",
")",
":",
"cherrypy",
".",
"serving",
".",
"request",
".",
"toolmaps",
"[",
"self",
".",
"namespace",
"]",
"=",
"map",
"=",
"{",
"}",
"def",
"populate",
"(",
"k",
",",
"v",
")",
":",
"toolname",
",",
"arg",
"=",
"... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/_cptools.py#L444-L452 | |
salabim/salabim | e0de846b042daf2dc71aaf43d8adc6486b57f376 | salabim_exp.py | python | exp140 | () | [] | def exp140():
@yc
def funcr(event):
yc(event.keysym)
class X(sim.Component):
def process(self):
passrr
env = sim.Environment(trace=True)
env.animate(True)
env.root.bind("r", funcr)
env.root.bind("s", funcr)
env.root.bind("t", funcr)
env.root.bind("<Down... | [
"def",
"exp140",
"(",
")",
":",
"@",
"yc",
"def",
"funcr",
"(",
"event",
")",
":",
"yc",
"(",
"event",
".",
"keysym",
")",
"class",
"X",
"(",
"sim",
".",
"Component",
")",
":",
"def",
"process",
"(",
"self",
")",
":",
"passrr",
"env",
"=",
"sim... | https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim_exp.py#L356-L378 | ||||
Cimbali/pympress | d376c92ede603a305738bd38f0c50b2f68c58fcf | pympress/scribble.py | python | parse_color | (text) | return color | Transform a string to a Gdk object in a single function call
Args:
text (`str`): A string describing a color
Returns:
:class:`~Gdk.RGBA`: A new color object parsed from the string | Transform a string to a Gdk object in a single function call | [
"Transform",
"a",
"string",
"to",
"a",
"Gdk",
"object",
"in",
"a",
"single",
"function",
"call"
] | def parse_color(text):
""" Transform a string to a Gdk object in a single function call
Args:
text (`str`): A string describing a color
Returns:
:class:`~Gdk.RGBA`: A new color object parsed from the string
"""
color = Gdk.RGBA()
color.parse(text... | [
"def",
"parse_color",
"(",
"text",
")",
":",
"color",
"=",
"Gdk",
".",
"RGBA",
"(",
")",
"color",
".",
"parse",
"(",
"text",
")",
"return",
"color"
] | https://github.com/Cimbali/pympress/blob/d376c92ede603a305738bd38f0c50b2f68c58fcf/pympress/scribble.py#L272-L283 | |
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/stock/serializers.py | python | StockAddSerializer.save | (self) | [] | def save(self):
request = self.context['request']
data = self.validated_data
notes = data.get('notes', '')
with transaction.atomic():
for item in data['items']:
stock_item = item['pk']
quantity = item['quantity']
stock_item... | [
"def",
"save",
"(",
"self",
")",
":",
"request",
"=",
"self",
".",
"context",
"[",
"'request'",
"]",
"data",
"=",
"self",
".",
"validated_data",
"notes",
"=",
"data",
".",
"get",
"(",
"'notes'",
",",
"''",
")",
"with",
"transaction",
".",
"atomic",
"... | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/stock/serializers.py#L916-L933 | ||||
airaria/TextBrewer | 14c0b2c805d2b0f6ddd44683c6ca7d117ee94880 | examples/cmrc2018_example/pytorch_pretrained_bert/tokenization.py | python | BertTokenizer.convert_tokens_to_ids | (self, tokens) | return ids | Converts a sequence of tokens into ids using the vocab. | Converts a sequence of tokens into ids using the vocab. | [
"Converts",
"a",
"sequence",
"of",
"tokens",
"into",
"ids",
"using",
"the",
"vocab",
"."
] | def convert_tokens_to_ids(self, tokens):
"""Converts a sequence of tokens into ids using the vocab."""
ids = []
for token in tokens:
ids.append(self.vocab[token])
if len(ids) > self.max_len:
logger.warning(
"Token indices sequence length is longer ... | [
"def",
"convert_tokens_to_ids",
"(",
"self",
",",
"tokens",
")",
":",
"ids",
"=",
"[",
"]",
"for",
"token",
"in",
"tokens",
":",
"ids",
".",
"append",
"(",
"self",
".",
"vocab",
"[",
"token",
"]",
")",
"if",
"len",
"(",
"ids",
")",
">",
"self",
"... | https://github.com/airaria/TextBrewer/blob/14c0b2c805d2b0f6ddd44683c6ca7d117ee94880/examples/cmrc2018_example/pytorch_pretrained_bert/tokenization.py#L117-L128 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/_osx_support.py | python | _supports_universal_builds | () | return bool(osx_version >= (10, 4)) if osx_version else False | Returns True if universal builds are supported on this system | Returns True if universal builds are supported on this system | [
"Returns",
"True",
"if",
"universal",
"builds",
"are",
"supported",
"on",
"this",
"system"
] | def _supports_universal_builds():
"""Returns True if universal builds are supported on this system"""
# As an approximation, we assume that if we are running on 10.4 or above,
# then we are running with an Xcode environment that supports universal
# builds, in particular -isysroot and -arch arguments to... | [
"def",
"_supports_universal_builds",
"(",
")",
":",
"# As an approximation, we assume that if we are running on 10.4 or above,",
"# then we are running with an Xcode environment that supports universal",
"# builds, in particular -isysroot and -arch arguments to the compiler. This",
"# is in support ... | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/_osx_support.py#L128-L141 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/compressor/parser/html5lib.py | python | Html5LibParser.elem_name | (self, elem) | return elem.tag | [] | def elem_name(self, elem):
if '}' in elem.tag:
return elem.tag.split('}')[1]
return elem.tag | [
"def",
"elem_name",
"(",
"self",
",",
"elem",
")",
":",
"if",
"'}'",
"in",
"elem",
".",
"tag",
":",
"return",
"elem",
".",
"tag",
".",
"split",
"(",
"'}'",
")",
"[",
"1",
"]",
"return",
"elem",
".",
"tag"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/compressor/parser/html5lib.py#L50-L53 | |||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | Lib/datetime.py | python | date.isocalendar | (self) | return year, week+1, day+1 | Return a 3-tuple containing ISO year, week number, and weekday.
The first ISO week of the year is the (Mon-Sun) week
containing the year's first Thursday; everything else derives
from that.
The first week is 1; Monday is 1 ... Sunday is 7.
ISO calendar algorithm taken from
... | Return a 3-tuple containing ISO year, week number, and weekday. | [
"Return",
"a",
"3",
"-",
"tuple",
"containing",
"ISO",
"year",
"week",
"number",
"and",
"weekday",
"."
] | def isocalendar(self):
"""Return a 3-tuple containing ISO year, week number, and weekday.
The first ISO week of the year is the (Mon-Sun) week
containing the year's first Thursday; everything else derives
from that.
The first week is 1; Monday is 1 ... Sunday is 7.
ISO... | [
"def",
"isocalendar",
"(",
"self",
")",
":",
"year",
"=",
"self",
".",
"_year",
"week1monday",
"=",
"_isoweek1monday",
"(",
"year",
")",
"today",
"=",
"_ymd2ord",
"(",
"self",
".",
"_year",
",",
"self",
".",
"_month",
",",
"self",
".",
"_day",
")",
"... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/Lib/datetime.py#L1031-L1056 | |
quantumlib/OpenFermion-Cirq | 655b00fee21c94cc96c343c63f7c52ea1aa329dc | openfermioncirq/variational/objective.py | python | VariationalObjective.value | (self,
circuit_output: Union[cirq.TrialResult,
cirq.SimulationTrialResult,
numpy.ndarray]
) | The evaluation function for a circuit output.
A variational quantum algorithm will attempt to minimize this value over
possible settings of the parameters. | The evaluation function for a circuit output. | [
"The",
"evaluation",
"function",
"for",
"a",
"circuit",
"output",
"."
] | def value(self,
circuit_output: Union[cirq.TrialResult,
cirq.SimulationTrialResult,
numpy.ndarray]
) -> float:
"""The evaluation function for a circuit output.
A variational quantum algorithm will attemp... | [
"def",
"value",
"(",
"self",
",",
"circuit_output",
":",
"Union",
"[",
"cirq",
".",
"TrialResult",
",",
"cirq",
".",
"SimulationTrialResult",
",",
"numpy",
".",
"ndarray",
"]",
")",
"->",
"float",
":"
] | https://github.com/quantumlib/OpenFermion-Cirq/blob/655b00fee21c94cc96c343c63f7c52ea1aa329dc/openfermioncirq/variational/objective.py#L38-L47 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/preview/trusted_comms/current_call.py | python | CurrentCallList.__repr__ | (self) | return '<Twilio.Preview.TrustedComms.CurrentCallList>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.Preview.TrustedComms.CurrentCallList>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.Preview.TrustedComms.CurrentCallList>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/trusted_comms/current_call.py#L54-L61 | |
tensorflow/tensor2tensor | 2a33b152d7835af66a6d20afe7961751047e28dd | tensor2tensor/layers/transformer_memory.py | python | TransformerMemory.__init__ | (self, batch_size, key_depth, val_depth, memory_size,
sharpen_factor=1., name="neural_memory") | Initialize the memory object.
Args:
batch_size: the batch size.
key_depth: the depth of the memory keys.
val_depth: the depth of the memory values.
memory_size: the number of items in the memory.
sharpen_factor: the sharpen_factor for addressing the memory.
name: the optional va... | Initialize the memory object. | [
"Initialize",
"the",
"memory",
"object",
"."
] | def __init__(self, batch_size, key_depth, val_depth, memory_size,
sharpen_factor=1., name="neural_memory"):
"""Initialize the memory object.
Args:
batch_size: the batch size.
key_depth: the depth of the memory keys.
val_depth: the depth of the memory values.
memory_size: ... | [
"def",
"__init__",
"(",
"self",
",",
"batch_size",
",",
"key_depth",
",",
"val_depth",
",",
"memory_size",
",",
"sharpen_factor",
"=",
"1.",
",",
"name",
"=",
"\"neural_memory\"",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"batch_size",
"=",
... | https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/layers/transformer_memory.py#L194-L224 | ||
ambakick/Person-Detection-and-Tracking | f925394ac29b5cf321f1ce89a71b193381519a0b | metrics/coco_tools.py | python | COCOEvalWrapper.GetCategory | (self, category_id) | return self.cocoGt.cats[category_id] | Fetches dictionary holding category information given category id.
Args:
category_id: integer id
Returns:
dictionary holding 'id', 'name'. | Fetches dictionary holding category information given category id. | [
"Fetches",
"dictionary",
"holding",
"category",
"information",
"given",
"category",
"id",
"."
] | def GetCategory(self, category_id):
"""Fetches dictionary holding category information given category id.
Args:
category_id: integer id
Returns:
dictionary holding 'id', 'name'.
"""
return self.cocoGt.cats[category_id] | [
"def",
"GetCategory",
"(",
"self",
",",
"category_id",
")",
":",
"return",
"self",
".",
"cocoGt",
".",
"cats",
"[",
"category_id",
"]"
] | https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/metrics/coco_tools.py#L174-L182 | |
jacoxu/encoder_decoder | 6829c3bc42105aedfd1b8a81c81be19df4326c0a | keras/utils/generic_utils.py | python | Progbar.__init__ | (self, target, width=30, verbose=1) | @param target: total number of steps expected | [] | def __init__(self, target, width=30, verbose=1):
'''
@param target: total number of steps expected
'''
self.width = width
self.target = target
self.sum_values = {}
self.unique_values = []
self.start = time.time()
self.total_width = 0
se... | [
"def",
"__init__",
"(",
"self",
",",
"target",
",",
"width",
"=",
"30",
",",
"verbose",
"=",
"1",
")",
":",
"self",
".",
"width",
"=",
"width",
"self",
".",
"target",
"=",
"target",
"self",
".",
"sum_values",
"=",
"{",
"}",
"self",
".",
"unique_val... | https://github.com/jacoxu/encoder_decoder/blob/6829c3bc42105aedfd1b8a81c81be19df4326c0a/keras/utils/generic_utils.py#L29-L40 | |||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/plugins/view/mediaview.py | python | MediaView.drag_data_received | (self, widget, context, x, y, sel_data, info, time) | Handle the standard gtk interface for drag_data_received.
If the selection data is define, extract the value from sel_data.data,
and decide if this is a move or a reorder.
The only data we accept on mediaview is dropping a file, so URI_LIST.
We assume this is what we obtain | Handle the standard gtk interface for drag_data_received. | [
"Handle",
"the",
"standard",
"gtk",
"interface",
"for",
"drag_data_received",
"."
] | def drag_data_received(self, widget, context, x, y, sel_data, info, time):
"""
Handle the standard gtk interface for drag_data_received.
If the selection data is define, extract the value from sel_data.data,
and decide if this is a move or a reorder.
The only data we accept on m... | [
"def",
"drag_data_received",
"(",
"self",
",",
"widget",
",",
"context",
",",
"x",
",",
"y",
",",
"sel_data",
",",
"info",
",",
"time",
")",
":",
"if",
"not",
"sel_data",
":",
"return",
"files",
"=",
"sel_data",
".",
"get_uris",
"(",
")",
"photo",
"=... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/view/mediaview.py#L161-L201 | ||
dragonfly/dragonfly | a579b5eadf452e23b07d4caf27b402703b0012b7 | dragonfly/exd/experiment_caller.py | python | FunctionCaller.__init__ | (self, func, *args, **kwargs) | Constructor. | Constructor. | [
"Constructor",
"."
] | def __init__(self, func, *args, **kwargs):
""" Constructor. """
self.func = func
super(FunctionCaller, self).__init__(func, *args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"func",
"=",
"func",
"super",
"(",
"FunctionCaller",
",",
"self",
")",
".",
"__init__",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
... | https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/exd/experiment_caller.py#L603-L606 | ||
google-research/fixmatch | d4985a158065947dba803e626ee9a6721709c570 | third_party/auto_augment/augmentations.py | python | _posterize_impl | (pil_img, level) | return ImageOps.posterize(pil_img.convert('RGB'), 4 - level).convert('RGBA') | Applies PIL Posterize to `pil_img`. | Applies PIL Posterize to `pil_img`. | [
"Applies",
"PIL",
"Posterize",
"to",
"pil_img",
"."
] | def _posterize_impl(pil_img, level):
"""Applies PIL Posterize to `pil_img`."""
level = int_parameter(level, 4)
return ImageOps.posterize(pil_img.convert('RGB'), 4 - level).convert('RGBA') | [
"def",
"_posterize_impl",
"(",
"pil_img",
",",
"level",
")",
":",
"level",
"=",
"int_parameter",
"(",
"level",
",",
"4",
")",
"return",
"ImageOps",
".",
"posterize",
"(",
"pil_img",
".",
"convert",
"(",
"'RGB'",
")",
",",
"4",
"-",
"level",
")",
".",
... | https://github.com/google-research/fixmatch/blob/d4985a158065947dba803e626ee9a6721709c570/third_party/auto_augment/augmentations.py#L265-L268 | |
google/apitools | 31cad2d904f356872d2965687e84b2d87ee2cdd3 | apitools/base/py/base_api.py | python | BaseApiService.__ConstructRelativePath | (self, method_config, request,
relative_path=None) | return util.ExpandRelativePath(method_config, params,
relative_path=relative_path) | Determine the relative path for request. | Determine the relative path for request. | [
"Determine",
"the",
"relative",
"path",
"for",
"request",
"."
] | def __ConstructRelativePath(self, method_config, request,
relative_path=None):
"""Determine the relative path for request."""
python_param_names = util.MapParamNames(
method_config.path_params, type(request))
params = dict([(param, getattr(request, par... | [
"def",
"__ConstructRelativePath",
"(",
"self",
",",
"method_config",
",",
"request",
",",
"relative_path",
"=",
"None",
")",
":",
"python_param_names",
"=",
"util",
".",
"MapParamNames",
"(",
"method_config",
".",
"path_params",
",",
"type",
"(",
"request",
")",... | https://github.com/google/apitools/blob/31cad2d904f356872d2965687e84b2d87ee2cdd3/apitools/base/py/base_api.py#L581-L590 | |
meduza-corp/interstellar | 40a801ccd7856491726f5a126621d9318cabe2e1 | gsutil/gslib/commands/rsync.py | python | CleanUpTempFiles | () | Cleans up temp files.
This function allows the main (RunCommand) function to clean up at end of
operation, or if gsutil rsync is interrupted (e.g., via ^C). This is necessary
because tempfile.NamedTemporaryFile doesn't allow the created file to be
re-opened in read mode on Windows, so we have to use tempfile.m... | Cleans up temp files. | [
"Cleans",
"up",
"temp",
"files",
"."
] | def CleanUpTempFiles():
"""Cleans up temp files.
This function allows the main (RunCommand) function to clean up at end of
operation, or if gsutil rsync is interrupted (e.g., via ^C). This is necessary
because tempfile.NamedTemporaryFile doesn't allow the created file to be
re-opened in read mode on Windows,... | [
"def",
"CleanUpTempFiles",
"(",
")",
":",
"try",
":",
"for",
"fname",
"in",
"_tmp_files",
":",
"os",
".",
"unlink",
"(",
"fname",
")",
"except",
":",
"# pylint: disable=bare-except",
"pass"
] | https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/gslib/commands/rsync.py#L298-L311 | ||
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/spectrum/dynamic_structure_factor.py | python | DynamicStructureFactor.__next__ | (self) | Calculate at next q-point. | Calculate at next q-point. | [
"Calculate",
"at",
"next",
"q",
"-",
"point",
"."
] | def __next__(self):
"""Calculate at next q-point."""
if self._q_count == len(self._Qpoints):
self._q_count = 0
raise StopIteration
else:
S = self._run_at_Q()
self.dynamic_structure_factors[self._q_count] = S
self._q_count += 1
... | [
"def",
"__next__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_q_count",
"==",
"len",
"(",
"self",
".",
"_Qpoints",
")",
":",
"self",
".",
"_q_count",
"=",
"0",
"raise",
"StopIteration",
"else",
":",
"S",
"=",
"self",
".",
"_run_at_Q",
"(",
")",
"s... | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/spectrum/dynamic_structure_factor.py#L183-L192 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txdav/caldav/datastore/index_file.py | python | AbstractCalendarIndex.__init__ | (self, resource) | @param resource: the L{CalDAVResource} resource to
index. C{resource} must be a calendar collection (ie.
C{resource.isPseudoCalendarCollection()} returns C{True}.) | [] | def __init__(self, resource):
"""
@param resource: the L{CalDAVResource} resource to
index. C{resource} must be a calendar collection (ie.
C{resource.isPseudoCalendarCollection()} returns C{True}.)
"""
self.resource = resource
db_filename = self.resource.f... | [
"def",
"__init__",
"(",
"self",
",",
"resource",
")",
":",
"self",
".",
"resource",
"=",
"resource",
"db_filename",
"=",
"self",
".",
"resource",
".",
"fp",
".",
"child",
"(",
"db_basename",
")",
".",
"path",
"super",
"(",
"AbstractCalendarIndex",
",",
"... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/index_file.py#L88-L99 | |||
ethereum/trinity | 6383280c5044feb06695ac2f7bc1100b7bcf4fe0 | trinity/components/builtin/metrics/registry.py | python | HostMetricsRegistry.dump_metrics | (self) | return metrics | [] | def dump_metrics(self) -> Dict[str, Dict[str, Any]]:
metrics = super().dump_metrics()
for key in metrics:
# We want every metric to include a 'host' identifier to be able to filter accordingly
metrics[key]['host'] = self.host
return metrics | [
"def",
"dump_metrics",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"metrics",
"=",
"super",
"(",
")",
".",
"dump_metrics",
"(",
")",
"for",
"key",
"in",
"metrics",
":",
"# We want every metric to incl... | https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/components/builtin/metrics/registry.py#L24-L31 | |||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/lib-tk/Tkinter.py | python | BooleanVar.__init__ | (self, master=None, value=None, name=None) | Construct a boolean variable.
MASTER can be given as master widget.
VALUE is an optional value (defaults to False)
NAME is an optional Tcl name (defaults to PY_VARnum).
If NAME matches an existing variable and VALUE is omitted
then the existing value is retained. | Construct a boolean variable. | [
"Construct",
"a",
"boolean",
"variable",
"."
] | def __init__(self, master=None, value=None, name=None):
"""Construct a boolean variable.
MASTER can be given as master widget.
VALUE is an optional value (defaults to False)
NAME is an optional Tcl name (defaults to PY_VARnum).
If NAME matches an existing variable and VALUE is ... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"value",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"Variable",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"value",
",",
"name",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/Tkinter.py#L307-L317 | ||
NeuromorphicProcessorProject/snn_toolbox | a85ada7b5d060500703285ef8a68f06ea1ffda65 | snntoolbox/datasets/aedat/ImportAedatHeaders.py | python | import_aedat_headers | (info) | return info | Parameters
----------
info :
Returns
------- | [] | def import_aedat_headers(info):
# Start from the beginning of the file (should not be necessary)
"""
Parameters
----------
info :
Returns
-------
"""
info['fileHandle'].seek(0)
# From version 3.1 there is an unambiguous division between header and
# data: A line like this... | [
"def",
"import_aedat_headers",
"(",
"info",
")",
":",
"# Start from the beginning of the file (should not be necessary)",
"info",
"[",
"'fileHandle'",
"]",
".",
"seek",
"(",
"0",
")",
"# From version 3.1 there is an unambiguous division between header and",
"# data: A line like thi... | https://github.com/NeuromorphicProcessorProject/snn_toolbox/blob/a85ada7b5d060500703285ef8a68f06ea1ffda65/snntoolbox/datasets/aedat/ImportAedatHeaders.py#L19-L158 | ||
BillBillBillBill/Tickeys-linux | 2df31b8665004c58a5d4ab05277f245267d96364 | tickeys/kivy_32/kivy/uix/textinput.py | python | TextInput.cancel_selection | (self) | Cancel current selection (if any). | Cancel current selection (if any). | [
"Cancel",
"current",
"selection",
"(",
"if",
"any",
")",
"."
] | def cancel_selection(self):
'''Cancel current selection (if any).
'''
self._selection_from = self._selection_to = self.cursor_index()
self._selection = False
self._selection_finished = True
self._selection_touch = None
self._trigger_update_graphics() | [
"def",
"cancel_selection",
"(",
"self",
")",
":",
"self",
".",
"_selection_from",
"=",
"self",
".",
"_selection_to",
"=",
"self",
".",
"cursor_index",
"(",
")",
"self",
".",
"_selection",
"=",
"False",
"self",
".",
"_selection_finished",
"=",
"True",
"self",... | https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy_32/kivy/uix/textinput.py#L916-L923 | ||
couchbase/couchbase-python-client | 58ccfd42af320bde6b733acf094fd5a4cf34e0ad | couchbase/search.py | python | _genprop_str | (*apipaths, **kwargs) | return _genprop(unicode, *apipaths, **kwargs) | Convenience function to return a string property in which the value
is converted to a string | Convenience function to return a string property in which the value
is converted to a string | [
"Convenience",
"function",
"to",
"return",
"a",
"string",
"property",
"in",
"which",
"the",
"value",
"is",
"converted",
"to",
"a",
"string"
] | def _genprop_str(*apipaths, **kwargs):
"""
Convenience function to return a string property in which the value
is converted to a string
"""
return _genprop(unicode, *apipaths, **kwargs) | [
"def",
"_genprop_str",
"(",
"*",
"apipaths",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_genprop",
"(",
"unicode",
",",
"*",
"apipaths",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/couchbase/couchbase-python-client/blob/58ccfd42af320bde6b733acf094fd5a4cf34e0ad/couchbase/search.py#L99-L104 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/distutils/command/bdist_rpm.py | python | bdist_rpm._make_spec_file | (self) | return spec_file | Generate the text of an RPM spec file and return it as a
list of strings (one per line). | Generate the text of an RPM spec file and return it as a
list of strings (one per line). | [
"Generate",
"the",
"text",
"of",
"an",
"RPM",
"spec",
"file",
"and",
"return",
"it",
"as",
"a",
"list",
"of",
"strings",
"(",
"one",
"per",
"line",
")",
"."
] | def _make_spec_file(self):
"""Generate the text of an RPM spec file and return it as a
list of strings (one per line).
"""
# definitions and headers
spec_file = [
'%define name ' + self.distribution.get_name(),
'%define version ' + self.distribution.get_ve... | [
"def",
"_make_spec_file",
"(",
"self",
")",
":",
"# definitions and headers",
"spec_file",
"=",
"[",
"'%define name '",
"+",
"self",
".",
"distribution",
".",
"get_name",
"(",
")",
",",
"'%define version '",
"+",
"self",
".",
"distribution",
".",
"get_version",
... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/distutils/command/bdist_rpm.py#L397-L548 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/cipher_compressor/compressor.py | python | NormalCipherPackage.retrieve | (self) | return self._cipher_text | [] | def retrieve(self):
return self._cipher_text | [
"def",
"retrieve",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cipher_text"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/cipher_compressor/compressor.py#L170-L171 | |||
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/kftoolmode.py | python | TLineKeyFrameEditor._draw_value_texts | (self, cr, x, w) | [] | def _draw_value_texts(self, cr, x, w):
# Audio hard coded value lines
TEXT_X_OFF = 4
TEXT_X_OFF_END = -28
TEXT_Y_OFF = 4
active_width = w - 2 * END_PAD
xs = x + END_PAD
xe = xs + active_width
cr.select_font_face ("sans-serif",
... | [
"def",
"_draw_value_texts",
"(",
"self",
",",
"cr",
",",
"x",
",",
"w",
")",
":",
"# Audio hard coded value lines",
"TEXT_X_OFF",
"=",
"4",
"TEXT_X_OFF_END",
"=",
"-",
"28",
"TEXT_Y_OFF",
"=",
"4",
"active_width",
"=",
"w",
"-",
"2",
"*",
"END_PAD",
"xs",
... | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/kftoolmode.py#L776-L881 | ||||
MTG/freesound | 72f234a656ce31f5f625f0bba5376dd4160b478d | accounts/views.py | python | check_username | (request) | return JsonResponse({'result': username_valid}) | AJAX endpoint to check if a specified username is available to be registered.
This checks against the normal username validator, and then also verifies to see
if the username already exists in the database.
Returns JSON {'result': true} if the username is valid and can be used | AJAX endpoint to check if a specified username is available to be registered.
This checks against the normal username validator, and then also verifies to see
if the username already exists in the database. | [
"AJAX",
"endpoint",
"to",
"check",
"if",
"a",
"specified",
"username",
"is",
"available",
"to",
"be",
"registered",
".",
"This",
"checks",
"against",
"the",
"normal",
"username",
"validator",
"and",
"then",
"also",
"verifies",
"to",
"see",
"if",
"the",
"user... | def check_username(request):
"""AJAX endpoint to check if a specified username is available to be registered.
This checks against the normal username validator, and then also verifies to see
if the username already exists in the database.
Returns JSON {'result': true} if the username is valid and can b... | [
"def",
"check_username",
"(",
"request",
")",
":",
"username",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'username'",
",",
"None",
")",
"username_valid",
"=",
"False",
"username_field",
"=",
"UsernameField",
"(",
")",
"if",
"username",
":",
"try",
":",... | https://github.com/MTG/freesound/blob/72f234a656ce31f5f625f0bba5376dd4160b478d/accounts/views.py#L225-L242 | |
4w4k3/rePy2exe | f3ff8efcf9103e4e8d7501e53a5536dcc43cbf9d | rePy2exe.py | python | pp | () | [] | def pp():
print """
....
,''. : __
\|_.' `: _.----._//_
.' .'.`'-._ .' _/ -._ \)-.----O
'._.'.' '--''-'._ '--..--'-`
.'.'___ /`'---'. / ,-'`
* _<__.-._))../ /'----'/.'_____:'.
\_ : \ ] :... | [
"def",
"pp",
"(",
")",
":",
"print",
"\"\"\"\n ....\n ,''. : __\n \\|_.' `: _.----._//_\n .' .'.`'-._ .' _/ -._ \\)-.----O\n '._.'.' '--''-'._ '--..--'-`\n .'.'___ /`'---'. / ,-'`\n * _<__.-._))../ /'----'/.'___... | https://github.com/4w4k3/rePy2exe/blob/f3ff8efcf9103e4e8d7501e53a5536dcc43cbf9d/rePy2exe.py#L151-L170 | ||||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Tools/scripts/fixdiv.py | python | FileContext.__init__ | (self, fp, window=5, lineno=1) | [] | def __init__(self, fp, window=5, lineno=1):
self.fp = fp
self.window = 5
self.lineno = 1
self.eoflookahead = 0
self.lookahead = []
self.buffer = [] | [
"def",
"__init__",
"(",
"self",
",",
"fp",
",",
"window",
"=",
"5",
",",
"lineno",
"=",
"1",
")",
":",
"self",
".",
"fp",
"=",
"fp",
"self",
".",
"window",
"=",
"5",
"self",
".",
"lineno",
"=",
"1",
"self",
".",
"eoflookahead",
"=",
"0",
"self"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/scripts/fixdiv.py#L316-L322 | ||||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/integrals/meijerint.py | python | _check_antecedents_1 | (g, x, helper=False) | return Or(*conds) | Return a condition under which the mellin transform of g exists.
Any power of x has already been absorbed into the G function,
so this is just int_0^\infty g dx.
See [L, section 5.6.1]. (Note that s=1.)
If ``helper`` is True, only check if the MT exists at infinity, i.e. if
int_1^\infty g dx exist... | Return a condition under which the mellin transform of g exists.
Any power of x has already been absorbed into the G function,
so this is just int_0^\infty g dx. | [
"Return",
"a",
"condition",
"under",
"which",
"the",
"mellin",
"transform",
"of",
"g",
"exists",
".",
"Any",
"power",
"of",
"x",
"has",
"already",
"been",
"absorbed",
"into",
"the",
"G",
"function",
"so",
"this",
"is",
"just",
"int_0^",
"\\",
"infty",
"g... | def _check_antecedents_1(g, x, helper=False):
"""
Return a condition under which the mellin transform of g exists.
Any power of x has already been absorbed into the G function,
so this is just int_0^\infty g dx.
See [L, section 5.6.1]. (Note that s=1.)
If ``helper`` is True, only check if the ... | [
"def",
"_check_antecedents_1",
"(",
"g",
",",
"x",
",",
"helper",
"=",
"False",
")",
":",
"# NOTE if you update these conditions, please update the documentation as well",
"from",
"sympy",
"import",
"Eq",
",",
"Not",
",",
"ceiling",
",",
"Ne",
",",
"re",
",",
"unb... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/integrals/meijerint.py#L708-L822 | |
intel/virtual-storage-manager | 00706ab9701acbd0d5e04b19cc80c6b66a2973b8 | source/python-vsmclient/vsmclient/v1/vsms.py | python | VolumeManager.get_server_list | (self, req=None) | return self.api.client.get(url) | host list | host list | [
"host",
"list"
] | def get_server_list(self, req=None):
"""
host list
"""
url = "/cluster/servers"
return self.api.client.get(url) | [
"def",
"get_server_list",
"(",
"self",
",",
"req",
"=",
"None",
")",
":",
"url",
"=",
"\"/cluster/servers\"",
"return",
"self",
".",
"api",
".",
"client",
".",
"get",
"(",
"url",
")"
] | https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/python-vsmclient/vsmclient/v1/vsms.py#L196-L201 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_5.9/pyasn1/type/namedval.py | python | NamedValues.getName | (self, value) | [] | def getName(self, value):
if value in self.valToNameIdx:
return self.valToNameIdx[value] | [
"def",
"getName",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"in",
"self",
".",
"valToNameIdx",
":",
"return",
"self",
".",
"valToNameIdx",
"[",
"value",
"]"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/pyasn1/type/namedval.py#L27-L29 | ||||
pyansys/pymapdl | c07291fc062b359abf0e92b95a92d753a95ef3d7 | ansys/mapdl/core/_commands/preproc/database.py | python | Database.check | (self, sele="", levl="", **kwargs) | return self.run(command, **kwargs) | Checks current database items for completeness.
APDL Command: CHECK
Parameters
----------
sele
Specifies which elements are to be checked:
(blank) - Check all data.
ESEL - Check only elements in the selected set and unselect any elements not produc... | Checks current database items for completeness. | [
"Checks",
"current",
"database",
"items",
"for",
"completeness",
"."
] | def check(self, sele="", levl="", **kwargs):
"""Checks current database items for completeness.
APDL Command: CHECK
Parameters
----------
sele
Specifies which elements are to be checked:
(blank) - Check all data.
ESEL - Check only elements ... | [
"def",
"check",
"(",
"self",
",",
"sele",
"=",
"\"\"",
",",
"levl",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"\"CHECK,%s,%s\"",
"%",
"(",
"str",
"(",
"sele",
")",
",",
"str",
"(",
"levl",
")",
")",
"return",
"self",
".",
... | https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/database.py#L380-L423 | |
ninja-ide/ninja-ide | 87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0 | ninja_ide/tools/console.py | python | Console.return_output | (self) | Reassign the proper values to output and error channel. | Reassign the proper values to output and error channel. | [
"Reassign",
"the",
"proper",
"values",
"to",
"output",
"and",
"error",
"channel",
"."
] | def return_output(self):
"""Reassign the proper values to output and error channel."""
sys.stdout = self.stdout
sys.stderr = self.stderr | [
"def",
"return_output",
"(",
"self",
")",
":",
"sys",
".",
"stdout",
"=",
"self",
".",
"stdout",
"sys",
".",
"stderr",
"=",
"self",
".",
"stderr"
] | https://github.com/ninja-ide/ninja-ide/blob/87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0/ninja_ide/tools/console.py#L82-L85 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/detailed_demographic_service/client.py | python | DetailedDemographicServiceClient.parse_common_billing_account_path | (path: str) | return m.groupdict() if m else {} | Parse a billing_account path into its component segments. | Parse a billing_account path into its component segments. | [
"Parse",
"a",
"billing_account",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_common_billing_account_path(path: str) -> Dict[str, str]:
"""Parse a billing_account path into its component segments."""
m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
return m.groupdict() if m else {} | [
"def",
"parse_common_billing_account_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^billingAccounts/(?P<billing_account>.+?)$\"",
",",
"path",
")",
"return",
"m",
".",
"groupdict",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/detailed_demographic_service/client.py#L190-L193 | |
yangxue0827/FPN_Tensorflow | c72110d2803455e6e55020f69144d9490a3d39ad | libs/rpn/build_rpn.py | python | RPN.rpn_find_positive_negative_samples | (self, anchors) | assign anchors targets: object or background.
:param anchors: [valid_num_of_anchors, 4]. use N to represent valid_num_of_anchors
:return:labels. anchors_matched_gtboxes, object_mask
labels shape is [N, ]. positive is 1, negative is 0, ignored is -1
anchor_matched_gtboxes. each anchor'... | assign anchors targets: object or background.
:param anchors: [valid_num_of_anchors, 4]. use N to represent valid_num_of_anchors | [
"assign",
"anchors",
"targets",
":",
"object",
"or",
"background",
".",
":",
"param",
"anchors",
":",
"[",
"valid_num_of_anchors",
"4",
"]",
".",
"use",
"N",
"to",
"represent",
"valid_num_of_anchors"
] | def rpn_find_positive_negative_samples(self, anchors):
'''
assign anchors targets: object or background.
:param anchors: [valid_num_of_anchors, 4]. use N to represent valid_num_of_anchors
:return:labels. anchors_matched_gtboxes, object_mask
labels shape is [N, ]. positive is 1... | [
"def",
"rpn_find_positive_negative_samples",
"(",
"self",
",",
"anchors",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"'rpn_find_positive_negative_samples'",
")",
":",
"gtboxes",
"=",
"tf",
".",
"reshape",
"(",
"self",
".",
"gtboxes_and_label",
"[",
":",
... | https://github.com/yangxue0827/FPN_Tensorflow/blob/c72110d2803455e6e55020f69144d9490a3d39ad/libs/rpn/build_rpn.py#L241-L303 | ||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/object_storage/transfer/upload_manager.py | python | UploadManager._add_adapter_to_service_client | (object_storage_client, allow_parallel_uploads, parallel_process_count) | [] | def _add_adapter_to_service_client(object_storage_client, allow_parallel_uploads, parallel_process_count):
# No need to mount with a larger pool size if we are not running multiple threads
if not allow_parallel_uploads or not parallel_process_count:
return
endpoint = object_storage_... | [
"def",
"_add_adapter_to_service_client",
"(",
"object_storage_client",
",",
"allow_parallel_uploads",
",",
"parallel_process_count",
")",
":",
"# No need to mount with a larger pool size if we are not running multiple threads",
"if",
"not",
"allow_parallel_uploads",
"or",
"not",
"par... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/object_storage/transfer/upload_manager.py#L370-L392 | ||||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/dns/dnssec.py | python | _validate_rrsig | (rrset, rrsig, keys, origin=None, now=None) | Validate an RRset against a single signature rdata, throwing an
exception if validation is not successful.
*rrset*, the RRset to validate. This can be a
``thirdparty.dns.rrset.RRset`` or a (``thirdparty.dns.name.Name``, ``thirdparty.dns.rdataset.Rdataset``)
tuple.
*rrsig*, a ``thirdparty.dns.rdat... | Validate an RRset against a single signature rdata, throwing an
exception if validation is not successful. | [
"Validate",
"an",
"RRset",
"against",
"a",
"single",
"signature",
"rdata",
"throwing",
"an",
"exception",
"if",
"validation",
"is",
"not",
"successful",
"."
] | def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
"""Validate an RRset against a single signature rdata, throwing an
exception if validation is not successful.
*rrset*, the RRset to validate. This can be a
``thirdparty.dns.rrset.RRset`` or a (``thirdparty.dns.name.Name``, ``thirdparty.dn... | [
"def",
"_validate_rrsig",
"(",
"rrset",
",",
"rrsig",
",",
"keys",
",",
"origin",
"=",
"None",
",",
"now",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"origin",
",",
"str",
")",
":",
"origin",
"=",
"thirdparty",
".",
"dns",
".",
"name",
".",
"f... | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/dns/dnssec.py#L257-L434 | ||
kylejusticemagnuson/pyti | 2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2 | pyti/bollinger_bands.py | python | bandwidth | (data, period, std=2.0) | return bandwidth | Bandwidth.
Formula:
bw = u_bb - l_bb / m_bb | Bandwidth. | [
"Bandwidth",
"."
] | def bandwidth(data, period, std=2.0):
"""
Bandwidth.
Formula:
bw = u_bb - l_bb / m_bb
"""
catch_errors.check_for_period_error(data, period)
period = int(period)
bandwidth = ((upper_bollinger_band(data, period, std) -
lower_bollinger_band(data, period, std)) /
... | [
"def",
"bandwidth",
"(",
"data",
",",
"period",
",",
"std",
"=",
"2.0",
")",
":",
"catch_errors",
".",
"check_for_period_error",
"(",
"data",
",",
"period",
")",
"period",
"=",
"int",
"(",
"period",
")",
"bandwidth",
"=",
"(",
"(",
"upper_bollinger_band",
... | https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/bollinger_bands.py#L68-L83 | |
vcheckzen/FODI | 3bb23644938a33c3fdfb9611a622e35ed4ce6532 | back-end-py/main/3rd/PIL/ImageCms.py | python | buildProofTransform | (
inputProfile,
outputProfile,
proofProfile,
inMode,
outMode,
renderingIntent=INTENT_PERCEPTUAL,
proofRenderingIntent=INTENT_ABSOLUTE_COLORIMETRIC,
flags=FLAGS["SOFTPROOFING"],
) | (pyCMS) Builds an ICC transform mapping from the inputProfile to the
outputProfile, but tries to simulate the result that would be
obtained on the proofProfile device.
If the input, output, or proof profiles specified are not valid
filenames, a PyCMSError will be raised.
If an error occurs during ... | (pyCMS) Builds an ICC transform mapping from the inputProfile to the
outputProfile, but tries to simulate the result that would be
obtained on the proofProfile device. | [
"(",
"pyCMS",
")",
"Builds",
"an",
"ICC",
"transform",
"mapping",
"from",
"the",
"inputProfile",
"to",
"the",
"outputProfile",
"but",
"tries",
"to",
"simulate",
"the",
"result",
"that",
"would",
"be",
"obtained",
"on",
"the",
"proofProfile",
"device",
"."
] | def buildProofTransform(
inputProfile,
outputProfile,
proofProfile,
inMode,
outMode,
renderingIntent=INTENT_PERCEPTUAL,
proofRenderingIntent=INTENT_ABSOLUTE_COLORIMETRIC,
flags=FLAGS["SOFTPROOFING"],
):
"""
(pyCMS) Builds an ICC transform mapping from the inputProfile to the
... | [
"def",
"buildProofTransform",
"(",
"inputProfile",
",",
"outputProfile",
",",
"proofProfile",
",",
"inMode",
",",
"outMode",
",",
"renderingIntent",
"=",
"INTENT_PERCEPTUAL",
",",
"proofRenderingIntent",
"=",
"INTENT_ABSOLUTE_COLORIMETRIC",
",",
"flags",
"=",
"FLAGS",
... | https://github.com/vcheckzen/FODI/blob/3bb23644938a33c3fdfb9611a622e35ed4ce6532/back-end-py/main/3rd/PIL/ImageCms.py#L480-L588 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/udf.py | python | EdgeBatch.batch_size | (self) | return len(self._eid) | Return the number of edges in the batch.
Returns
-------
int
Examples
--------
The following example uses PyTorch backend.
>>> import dgl
>>> import torch
>>> # Instantiate a graph
>>> g = dgl.graph((torch.tensor([0, 1, 1]), torch.tenso... | Return the number of edges in the batch. | [
"Return",
"the",
"number",
"of",
"edges",
"in",
"the",
"batch",
"."
] | def batch_size(self):
"""Return the number of edges in the batch.
Returns
-------
int
Examples
--------
The following example uses PyTorch backend.
>>> import dgl
>>> import torch
>>> # Instantiate a graph
>>> g = dgl.graph((tor... | [
"def",
"batch_size",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_eid",
")"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/udf.py#L182-L217 | |
tanghaibao/goatools | 647e9dd833695f688cd16c2f9ea18f1692e5c6bc | goatools/godag_small.py | python | GODagSmall.__init__ | (self) | [] | def __init__(self):
# Sub-graph of input DAG. User has option of using a subset of children/parents
self.go_sources = None
self.go2obj = {}
self.p_from_cs = defaultdict(set) # GO ids for child->parents
self.c_from_ps = defaultdict(set) | [
"def",
"__init__",
"(",
"self",
")",
":",
"# Sub-graph of input DAG. User has option of using a subset of children/parents",
"self",
".",
"go_sources",
"=",
"None",
"self",
".",
"go2obj",
"=",
"{",
"}",
"self",
".",
"p_from_cs",
"=",
"defaultdict",
"(",
"set",
")",
... | https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/godag_small.py#L11-L16 | ||||
RDFLib/rdflib | c0bd5eaaa983461445b9469d731be4ae0e0cfc54 | rdflib/term.py | python | Literal.__add__ | (self, val) | >>> Literal(1) + 1
rdflib.term.Literal(u'2', datatype=rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'))
>>> Literal("1") + "1"
rdflib.term.Literal(u'11') | >>> Literal(1) + 1
rdflib.term.Literal(u'2', datatype=rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'))
>>> Literal("1") + "1"
rdflib.term.Literal(u'11') | [
">>>",
"Literal",
"(",
"1",
")",
"+",
"1",
"rdflib",
".",
"term",
".",
"Literal",
"(",
"u",
"2",
"datatype",
"=",
"rdflib",
".",
"term",
".",
"URIRef",
"(",
"u",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"2001",
"/",
"XMLSchema#intege... | def __add__(self, val):
"""
>>> Literal(1) + 1
rdflib.term.Literal(u'2', datatype=rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'))
>>> Literal("1") + "1"
rdflib.term.Literal(u'11')
"""
# if no val is supplied, return this Literal
if val is... | [
"def",
"__add__",
"(",
"self",
",",
"val",
")",
":",
"# if no val is supplied, return this Literal",
"if",
"val",
"is",
"None",
":",
"return",
"self",
"# convert the val to a Literal, if it isn't already one",
"if",
"not",
"isinstance",
"(",
"val",
",",
"Literal",
")"... | https://github.com/RDFLib/rdflib/blob/c0bd5eaaa983461445b9469d731be4ae0e0cfc54/rdflib/term.py#L665-L717 | ||
fastnlp/fastNLP | fb645d370f4cc1b00c7dbb16c1ff4542327c46e5 | fastNLP/io/loader/classification.py | python | DBPediaLoader.download | (self, dev_ratio: float = 0.0, re_download: bool = False) | return data_dir | r"""
自动下载数据集,如果你使用了这个数据集,请引用以下的文章
Xiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances
in Neural Information Processing Systems 28 (NIPS 2015)
如果dev_ratio不等于0,则根据dev_ratio的值随机将train中的数据取出一部分作为dev数据。
下载完成后在output_dir中有trai... | r"""
自动下载数据集,如果你使用了这个数据集,请引用以下的文章 | [
"r",
"自动下载数据集,如果你使用了这个数据集,请引用以下的文章"
] | def download(self, dev_ratio: float = 0.0, re_download: bool = False):
r"""
自动下载数据集,如果你使用了这个数据集,请引用以下的文章
Xiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances
in Neural Information Processing Systems 28 (NIPS 2015)
如果dev_r... | [
"def",
"download",
"(",
"self",
",",
"dev_ratio",
":",
"float",
"=",
"0.0",
",",
"re_download",
":",
"bool",
"=",
"False",
")",
":",
"dataset_name",
"=",
"'dbpedia'",
"data_dir",
"=",
"self",
".",
"_get_dataset_path",
"(",
"dataset_name",
"=",
"dataset_name"... | https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/fastNLP/io/loader/classification.py#L139-L160 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/indexes/api.py | python | _get_distinct_objs | (objs) | return res | Return a list with distinct elements of "objs" (different ids).
Preserves order. | Return a list with distinct elements of "objs" (different ids).
Preserves order. | [
"Return",
"a",
"list",
"with",
"distinct",
"elements",
"of",
"objs",
"(",
"different",
"ids",
")",
".",
"Preserves",
"order",
"."
] | def _get_distinct_objs(objs):
"""
Return a list with distinct elements of "objs" (different ids).
Preserves order.
"""
ids = set()
res = []
for obj in objs:
if not id(obj) in ids:
ids.add(id(obj))
res.append(obj)
return res | [
"def",
"_get_distinct_objs",
"(",
"objs",
")",
":",
"ids",
"=",
"set",
"(",
")",
"res",
"=",
"[",
"]",
"for",
"obj",
"in",
"objs",
":",
"if",
"not",
"id",
"(",
"obj",
")",
"in",
"ids",
":",
"ids",
".",
"add",
"(",
"id",
"(",
"obj",
")",
")",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/indexes/api.py#L73-L84 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/networkx/algorithms/cluster.py | python | _directed_weighted_triangles_and_degree_iter | (G, nodes=None, weight = 'weight') | Return an iterator of
(node, total_degree, reciprocal_degree, directed_weighted_triangles).
Used for directed weighted clustering. | Return an iterator of
(node, total_degree, reciprocal_degree, directed_weighted_triangles). | [
"Return",
"an",
"iterator",
"of",
"(",
"node",
"total_degree",
"reciprocal_degree",
"directed_weighted_triangles",
")",
"."
] | def _directed_weighted_triangles_and_degree_iter(G, nodes=None, weight = 'weight'):
""" Return an iterator of
(node, total_degree, reciprocal_degree, directed_weighted_triangles).
Used for directed weighted clustering.
"""
if weight is None or G.number_of_edges() == 0:
max_weight = 1
e... | [
"def",
"_directed_weighted_triangles_and_degree_iter",
"(",
"G",
",",
"nodes",
"=",
"None",
",",
"weight",
"=",
"'weight'",
")",
":",
"if",
"weight",
"is",
"None",
"or",
"G",
".",
"number_of_edges",
"(",
")",
"==",
"0",
":",
"max_weight",
"=",
"1",
"else",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/algorithms/cluster.py#L156-L204 | ||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/dev/bdf_vectorized/cards/bdf_sets.py | python | CSET1.raw_fields | (self) | return list_fields | gets the "raw" card without any processing as a list for printing | gets the "raw" card without any processing as a list for printing | [
"gets",
"the",
"raw",
"card",
"without",
"any",
"processing",
"as",
"a",
"list",
"for",
"printing"
] | def raw_fields(self):
"""gets the "raw" card without any processing as a list for printing"""
list_fields = ['CSET1', self.components] + collapse_thru(self.ids)
return list_fields | [
"def",
"raw_fields",
"(",
"self",
")",
":",
"list_fields",
"=",
"[",
"'CSET1'",
",",
"self",
".",
"components",
"]",
"+",
"collapse_thru",
"(",
"self",
".",
"ids",
")",
"return",
"list_fields"
] | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/cards/bdf_sets.py#L574-L577 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/forms/fields.py | python | MultipleChoiceField.validate | (self, value) | Validates that the input is a list or tuple. | Validates that the input is a list or tuple. | [
"Validates",
"that",
"the",
"input",
"is",
"a",
"list",
"or",
"tuple",
"."
] | def validate(self, value):
"""
Validates that the input is a list or tuple.
"""
if self.required and not value:
raise ValidationError(self.error_messages['required'])
# Validate that each value in the value list is in self.choices.
for val in value:
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"required",
"and",
"not",
"value",
":",
"raise",
"ValidationError",
"(",
"self",
".",
"error_messages",
"[",
"'required'",
"]",
")",
"# Validate that each value in the value list is in self... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/forms/fields.py#L701-L710 | ||
giantbranch/python-hacker-code | addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d | 我手敲的代码(中文注释)/chapter11/volatility/obj.py | python | CType.v | (self) | return long(self.obj_offset) | When a struct is evaluated we just return our offset. | When a struct is evaluated we just return our offset. | [
"When",
"a",
"struct",
"is",
"evaluated",
"we",
"just",
"return",
"our",
"offset",
"."
] | def v(self):
""" When a struct is evaluated we just return our offset.
"""
# Ensure that proxied offsets are converted to longs
# to avoid integer boundaries when doing __rand__ proxying
# (see issue 265)
return long(self.obj_offset) | [
"def",
"v",
"(",
"self",
")",
":",
"# Ensure that proxied offsets are converted to longs",
"# to avoid integer boundaries when doing __rand__ proxying",
"# (see issue 265)",
"return",
"long",
"(",
"self",
".",
"obj_offset",
")"
] | https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility/obj.py#L697-L703 | |
DamnWidget/anaconda | a9998fb362320f907d5ccbc6fcf5b62baca677c0 | anaconda_lib/explore_panel.py | python | ExplorerPanel.on_select | (self, index: int, transient: bool=False) | Called when an option is been made in the quick panel | Called when an option is been made in the quick panel | [
"Called",
"when",
"an",
"option",
"is",
"been",
"made",
"in",
"the",
"quick",
"panel"
] | def on_select(self, index: int, transient: bool=False) -> None:
"""Called when an option is been made in the quick panel
"""
if index == -1:
self._restore_view()
return
cluster = self.last_cluster
node = cluster[index]
if transient and 'options' ... | [
"def",
"on_select",
"(",
"self",
",",
"index",
":",
"int",
",",
"transient",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"if",
"index",
"==",
"-",
"1",
":",
"self",
".",
"_restore_view",
"(",
")",
"return",
"cluster",
"=",
"self",
".",
"last... | https://github.com/DamnWidget/anaconda/blob/a9998fb362320f907d5ccbc6fcf5b62baca677c0/anaconda_lib/explore_panel.py#L77-L99 | ||
TryCatchHCF/DumpsterFire | 43b46a274663ff694763db6e627975e160bc3597 | FireModules/Shenanigans/osx_rickroll_multi_dialogs.py | python | osx_rickroll_multi_dialogs.__init__ | (self) | [] | def __init__(self):
self.commentsStr = "Shenanigans/osx_rickroll_multi_dialogs"
self.textToSayStr = "" | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"commentsStr",
"=",
"\"Shenanigans/osx_rickroll_multi_dialogs\"",
"self",
".",
"textToSayStr",
"=",
"\"\""
] | https://github.com/TryCatchHCF/DumpsterFire/blob/43b46a274663ff694763db6e627975e160bc3597/FireModules/Shenanigans/osx_rickroll_multi_dialogs.py#L27-L29 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/logging/__init__.py | python | warning | (msg, *args, **kwargs) | Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format. | Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format. | [
"Log",
"a",
"message",
"with",
"severity",
"WARNING",
"on",
"the",
"root",
"logger",
".",
"If",
"the",
"logger",
"has",
"no",
"handlers",
"call",
"basicConfig",
"()",
"to",
"add",
"a",
"console",
"handler",
"with",
"a",
"pre",
"-",
"defined",
"format",
"... | def warning(msg, *args, **kwargs):
"""
Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
"""
if len(root.handlers) == 0:
basicConfig()
root.warning(msg, *args, **kwargs) | [
"def",
"warning",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"root",
".",
"handlers",
")",
"==",
"0",
":",
"basicConfig",
"(",
")",
"root",
".",
"warning",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/logging/__init__.py#L2106-L2114 | ||
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/util/debug.py | python | auto_exclude_all_new_threads | (func) | return wrapped | :param T func:
:return: func wrapped
:rtype: T | :param T func:
:return: func wrapped
:rtype: T | [
":",
"param",
"T",
"func",
":",
":",
"return",
":",
"func",
"wrapped",
":",
"rtype",
":",
"T"
] | def auto_exclude_all_new_threads(func):
"""
:param T func:
:return: func wrapped
:rtype: T
"""
def wrapped(*args, **kwargs):
"""
:param args:
:param kwargs:
:return:
"""
# noinspection PyProtectedMember,PyUnresolvedReferences
old_threads = set(sys._current_frames().keys())
re... | [
"def",
"auto_exclude_all_new_threads",
"(",
"func",
")",
":",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"\n :param args:\n :param kwargs:\n :return:\n \"\"\"",
"# noinspection PyProtectedMember,PyUnresolvedReferences",
"old_threads... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/util/debug.py#L24-L45 | |
deepfakes/faceswap | 09c7d8aca3c608d1afad941ea78e9fd9b64d9219 | tools/effmpeg/effmpeg.py | python | Effmpeg.mux_audio | (input_=None, output=None, ref_vid=None, # pylint:disable=unused-argument
exe=None, **kwargs) | Mux Audio | Mux Audio | [
"Mux",
"Audio"
] | def mux_audio(input_=None, output=None, ref_vid=None, # pylint:disable=unused-argument
exe=None, **kwargs):
""" Mux Audio """
_input_opts = Effmpeg._common_ffmpeg_args[:]
_ref_vid_opts = None
_output_opts = '-y -c copy -map 0:0 -map 1:1 -shortest'
_inputs = Ord... | [
"def",
"mux_audio",
"(",
"input_",
"=",
"None",
",",
"output",
"=",
"None",
",",
"ref_vid",
"=",
"None",
",",
"# pylint:disable=unused-argument",
"exe",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"_input_opts",
"=",
"Effmpeg",
".",
"_common_ffmpeg_args"... | https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/tools/effmpeg/effmpeg.py#L400-L408 | ||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_004a.py | python | first_layer | (m:nn.Module) | return flatten_model(m)[0] | Retrieve first layer in a module | Retrieve first layer in a module | [
"Retrieve",
"first",
"layer",
"in",
"a",
"module"
] | def first_layer(m:nn.Module)->nn.Module:
"Retrieve first layer in a module"
return flatten_model(m)[0] | [
"def",
"first_layer",
"(",
"m",
":",
"nn",
".",
"Module",
")",
"->",
"nn",
".",
"Module",
":",
"return",
"flatten_model",
"(",
"m",
")",
"[",
"0",
"]"
] | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_004a.py#L157-L159 | |
bpython/curtsies | 56a0ad1199d346a059635982aa87ca07be17e14a | curtsies/termhelpers.py | python | Nonblocking.__init__ | (self, stream: IO) | [] | def __init__(self, stream: IO) -> None:
self.stream = stream
self.fd = self.stream.fileno() | [
"def",
"__init__",
"(",
"self",
",",
"stream",
":",
"IO",
")",
"->",
"None",
":",
"self",
".",
"stream",
"=",
"stream",
"self",
".",
"fd",
"=",
"self",
".",
"stream",
".",
"fileno",
"(",
")"
] | https://github.com/bpython/curtsies/blob/56a0ad1199d346a059635982aa87ca07be17e14a/curtsies/termhelpers.py#L17-L19 | ||||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py | python | WorkingSet.add | (self, dist, entry=None, insert=True, replace=False) | Add `dist` to working set, associated with `entry`
If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
On exit from this routine, `entry` is added to the end of the working
set's ``.entries`` (if it wasn't already present).
`dist` is only added to the working set if ... | Add `dist` to working set, associated with `entry` | [
"Add",
"dist",
"to",
"working",
"set",
"associated",
"with",
"entry"
] | def add(self, dist, entry=None, insert=True, replace=False):
"""Add `dist` to working set, associated with `entry`
If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
On exit from this routine, `entry` is added to the end of the working
set's ``.entries`` (if it wasn'... | [
"def",
"add",
"(",
"self",
",",
"dist",
",",
"entry",
"=",
"None",
",",
"insert",
"=",
"True",
",",
"replace",
"=",
"False",
")",
":",
"if",
"insert",
":",
"dist",
".",
"insert_on",
"(",
"self",
".",
"entries",
",",
"entry",
",",
"replace",
"=",
... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L683-L711 | ||
danielfrg/copper | 956e9ae607aec461d4fe4f6e7b0ccd9ed556fc79 | dev/ml/gdbn/gdbn/gnumpy.py | python | garray.isreal | (self) | return (self<numpy.inf) * (self>-numpy.inf) | elementwise, checking for real numbers. See also .all_real() | elementwise, checking for real numbers. See also .all_real() | [
"elementwise",
"checking",
"for",
"real",
"numbers",
".",
"See",
"also",
".",
"all_real",
"()"
] | def isreal(self):
""" elementwise, checking for real numbers. See also .all_real() """
return (self<numpy.inf) * (self>-numpy.inf) | [
"def",
"isreal",
"(",
"self",
")",
":",
"return",
"(",
"self",
"<",
"numpy",
".",
"inf",
")",
"*",
"(",
"self",
">",
"-",
"numpy",
".",
"inf",
")"
] | https://github.com/danielfrg/copper/blob/956e9ae607aec461d4fe4f6e7b0ccd9ed556fc79/dev/ml/gdbn/gdbn/gnumpy.py#L875-L877 | |
google/mysql-tools | 02d18542735a528c4a6cca951207393383266bb9 | permissions_lib/utils.py | python | DecryptHash | (key, ciphertext) | Decrypt a hash with a private key. | Decrypt a hash with a private key. | [
"Decrypt",
"a",
"hash",
"with",
"a",
"private",
"key",
"."
] | def DecryptHash(key, ciphertext):
"""Decrypt a hash with a private key."""
encrypted = base64.b64decode(ciphertext)
plaintext = key.decrypt(compat.stringToBytes(encrypted))
if plaintext:
return compat.bytesToString(plaintext)
else:
# decryption failed
return None | [
"def",
"DecryptHash",
"(",
"key",
",",
"ciphertext",
")",
":",
"encrypted",
"=",
"base64",
".",
"b64decode",
"(",
"ciphertext",
")",
"plaintext",
"=",
"key",
".",
"decrypt",
"(",
"compat",
".",
"stringToBytes",
"(",
"encrypted",
")",
")",
"if",
"plaintext"... | https://github.com/google/mysql-tools/blob/02d18542735a528c4a6cca951207393383266bb9/permissions_lib/utils.py#L120-L128 | ||
lebedov/scikit-cuda | 5d3c74f926fe7ce67ecfc85e9623aab7bc0b344f | skcuda/magma.py | python | magma_sgetrf_gpu | (n, m, A, lda, ipiv) | LU factorization. | LU factorization. | [
"LU",
"factorization",
"."
] | def magma_sgetrf_gpu(n, m, A, lda, ipiv):
"""
LU factorization.
"""
info = c_int_type()
status = _libmagma.magma_sgetrf_gpu(n, m, int(A), lda,
int(ipiv), ctypes.byref(info))
magmaCheckStatus(status) | [
"def",
"magma_sgetrf_gpu",
"(",
"n",
",",
"m",
",",
"A",
",",
"lda",
",",
"ipiv",
")",
":",
"info",
"=",
"c_int_type",
"(",
")",
"status",
"=",
"_libmagma",
".",
"magma_sgetrf_gpu",
"(",
"n",
",",
"m",
",",
"int",
"(",
"A",
")",
",",
"lda",
",",
... | https://github.com/lebedov/scikit-cuda/blob/5d3c74f926fe7ce67ecfc85e9623aab7bc0b344f/skcuda/magma.py#L3402-L3410 | ||
Cog-Creators/Red-DiscordBot | b05933274a11fb097873ab0d1b246d37b06aa306 | redbot/cogs/audio/core/commands/audioset.py | python | AudioSetCommands.command_audioset_restart | (self, ctx: commands.Context) | Restarts the lavalink connection. | Restarts the lavalink connection. | [
"Restarts",
"the",
"lavalink",
"connection",
"."
] | async def command_audioset_restart(self, ctx: commands.Context):
"""Restarts the lavalink connection."""
async with ctx.typing():
await lavalink.close(self.bot)
if self.player_manager is not None:
await self.player_manager.shutdown()
self.lavalink_res... | [
"async",
"def",
"command_audioset_restart",
"(",
"self",
",",
"ctx",
":",
"commands",
".",
"Context",
")",
":",
"async",
"with",
"ctx",
".",
"typing",
"(",
")",
":",
"await",
"lavalink",
".",
"close",
"(",
"self",
".",
"bot",
")",
"if",
"self",
".",
... | https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/cogs/audio/core/commands/audioset.py#L1448-L1461 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/events/admin.py | python | StandardRegFormAdmin.edit_regform_view | (self, request) | return render_to_resp(request=request,
template_name='admin/events/standardregform/standard_reg_form_edit.html',
context={'adminform': form}) | [] | def edit_regform_view(self, request):
form = StandardRegAdminForm(request.POST or None)
if request.method == 'POST' and form.is_valid():
form.apply_changes()
delete_settings_cache('module', 'events')
messages.success(request, "Successfully updated Standard Registratio... | [
"def",
"edit_regform_view",
"(",
"self",
",",
"request",
")",
":",
"form",
"=",
"StandardRegAdminForm",
"(",
"request",
".",
"POST",
"or",
"None",
")",
"if",
"request",
".",
"method",
"==",
"'POST'",
"and",
"form",
".",
"is_valid",
"(",
")",
":",
"form",... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/events/admin.py#L274-L284 | |||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/caldav/calendar.py | python | WebDavCalendarData.is_matching | (vevent, search) | return (
hasattr(vevent, "summary")
and pattern.match(vevent.summary.value)
or hasattr(vevent, "location")
and pattern.match(vevent.location.value)
or hasattr(vevent, "description")
and pattern.match(vevent.description.value)
) | Return if the event matches the filter criteria. | Return if the event matches the filter criteria. | [
"Return",
"if",
"the",
"event",
"matches",
"the",
"filter",
"criteria",
"."
] | def is_matching(vevent, search):
"""Return if the event matches the filter criteria."""
if search is None:
return True
pattern = re.compile(search)
return (
hasattr(vevent, "summary")
and pattern.match(vevent.summary.value)
or hasattr(veve... | [
"def",
"is_matching",
"(",
"vevent",
",",
"search",
")",
":",
"if",
"search",
"is",
"None",
":",
"return",
"True",
"pattern",
"=",
"re",
".",
"compile",
"(",
"search",
")",
"return",
"(",
"hasattr",
"(",
"vevent",
",",
"\"summary\"",
")",
"and",
"patte... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/caldav/calendar.py#L274-L287 | |
pytorch/captum | 38b57082d22854013c0a0b80a51c0b85269afdaf | captum/attr/_models/base.py | python | _get_deep_layer_name | (obj, layer_names) | return reduce(getattr, layer_names.split("."), obj) | r"""
Traverses through the layer names that are separated by
dot in order to access the embedding layer. | r"""
Traverses through the layer names that are separated by
dot in order to access the embedding layer. | [
"r",
"Traverses",
"through",
"the",
"layer",
"names",
"that",
"are",
"separated",
"by",
"dot",
"in",
"order",
"to",
"access",
"the",
"embedding",
"layer",
"."
] | def _get_deep_layer_name(obj, layer_names):
r"""
Traverses through the layer names that are separated by
dot in order to access the embedding layer.
"""
return reduce(getattr, layer_names.split("."), obj) | [
"def",
"_get_deep_layer_name",
"(",
"obj",
",",
"layer_names",
")",
":",
"return",
"reduce",
"(",
"getattr",
",",
"layer_names",
".",
"split",
"(",
"\".\"",
")",
",",
"obj",
")"
] | https://github.com/pytorch/captum/blob/38b57082d22854013c0a0b80a51c0b85269afdaf/captum/attr/_models/base.py#L123-L128 | |
DeloitteDigitalUK/jira-agile-metrics | 55a4b1a68c767b65aa03036e481a993e1a233da4 | jira_agile_metrics/querymanager.py | python | QueryManager.resolve_attribute_value | (self, issue, attribute_name) | return self.resolve_field_value(issue, field_id) | Given an attribute name (i.e. one named in the config file and
mapped to a field in JIRA), return its value from the given issue.
Respects the `Known Values` settings and tries to resolve complex
data types. | Given an attribute name (i.e. one named in the config file and
mapped to a field in JIRA), return its value from the given issue.
Respects the `Known Values` settings and tries to resolve complex
data types. | [
"Given",
"an",
"attribute",
"name",
"(",
"i",
".",
"e",
".",
"one",
"named",
"in",
"the",
"config",
"file",
"and",
"mapped",
"to",
"a",
"field",
"in",
"JIRA",
")",
"return",
"its",
"value",
"from",
"the",
"given",
"issue",
".",
"Respects",
"the",
"Kn... | def resolve_attribute_value(self, issue, attribute_name):
"""Given an attribute name (i.e. one named in the config file and
mapped to a field in JIRA), return its value from the given issue.
Respects the `Known Values` settings and tries to resolve complex
data types.
"""
... | [
"def",
"resolve_attribute_value",
"(",
"self",
",",
"issue",
",",
"attribute_name",
")",
":",
"field_id",
"=",
"self",
".",
"attributes_to_fields",
"[",
"attribute_name",
"]",
"return",
"self",
".",
"resolve_field_value",
"(",
"issue",
",",
"field_id",
")"
] | https://github.com/DeloitteDigitalUK/jira-agile-metrics/blob/55a4b1a68c767b65aa03036e481a993e1a233da4/jira_agile_metrics/querymanager.py#L107-L114 | |
Mingtzge/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement | 42ad9686f3c3bde0d29a8bc6bcb0e3afb35fb3c3 | recognize_process/data_provider/write_tfrecord.py | python | _write_tfrecords | (tfrecords_writer) | [] | def _write_tfrecords(tfrecords_writer):
while True:
sample_info = _SAMPLE_INFO_QUEUE.get()
if sample_info == _SENTINEL:
print('Process {:d} finished writing work'.format(os.getpid()))
tfrecords_writer.close()
break
sample_path = sample_info[0]
sam... | [
"def",
"_write_tfrecords",
"(",
"tfrecords_writer",
")",
":",
"while",
"True",
":",
"sample_info",
"=",
"_SAMPLE_INFO_QUEUE",
".",
"get",
"(",
")",
"if",
"sample_info",
"==",
"_SENTINEL",
":",
"print",
"(",
"'Process {:d} finished writing work'",
".",
"format",
"(... | https://github.com/Mingtzge/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement/blob/42ad9686f3c3bde0d29a8bc6bcb0e3afb35fb3c3/recognize_process/data_provider/write_tfrecord.py#L165-L197 | ||||
emmetio/livestyle-sublime-old | c42833c046e9b2f53ebce3df3aa926528f5a33b5 | tornado/curl_httpclient.py | python | _curl_create | () | return curl | [] | def _curl_create():
curl = pycurl.Curl()
if gen_log.isEnabledFor(logging.DEBUG):
curl.setopt(pycurl.VERBOSE, 1)
curl.setopt(pycurl.DEBUGFUNCTION, _curl_debug)
return curl | [
"def",
"_curl_create",
"(",
")",
":",
"curl",
"=",
"pycurl",
".",
"Curl",
"(",
")",
"if",
"gen_log",
".",
"isEnabledFor",
"(",
"logging",
".",
"DEBUG",
")",
":",
"curl",
".",
"setopt",
"(",
"pycurl",
".",
"VERBOSE",
",",
"1",
")",
"curl",
".",
"set... | https://github.com/emmetio/livestyle-sublime-old/blob/c42833c046e9b2f53ebce3df3aa926528f5a33b5/tornado/curl_httpclient.py#L286-L291 | |||
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | qvector_history_t.has | (self, *args) | return _idaapi.qvector_history_t_has(self, *args) | has(self, x) -> bool | has(self, x) -> bool | [
"has",
"(",
"self",
"x",
")",
"-",
">",
"bool"
] | def has(self, *args):
"""
has(self, x) -> bool
"""
return _idaapi.qvector_history_t_has(self, *args) | [
"def",
"has",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"qvector_history_t_has",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L34430-L34434 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/psutil/_common.py | python | conn_to_ntuple | (fd, fam, type_, laddr, raddr, status, status_map, pid=None) | Convert a raw connection tuple to a proper ntuple. | Convert a raw connection tuple to a proper ntuple. | [
"Convert",
"a",
"raw",
"connection",
"tuple",
"to",
"a",
"proper",
"ntuple",
"."
] | def conn_to_ntuple(fd, fam, type_, laddr, raddr, status, status_map, pid=None):
"""Convert a raw connection tuple to a proper ntuple."""
if fam in (socket.AF_INET, AF_INET6):
if laddr:
laddr = addr(*laddr)
if raddr:
raddr = addr(*raddr)
if type_ == socket.SOCK_STREAM ... | [
"def",
"conn_to_ntuple",
"(",
"fd",
",",
"fam",
",",
"type_",
",",
"laddr",
",",
"raddr",
",",
"status",
",",
"status_map",
",",
"pid",
"=",
"None",
")",
":",
"if",
"fam",
"in",
"(",
"socket",
".",
"AF_INET",
",",
"AF_INET6",
")",
":",
"if",
"laddr... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/psutil/_common.py#L574-L590 | ||
Anaconda-Platform/anaconda-project | df5ec33c12591e6512436d38d36c6132fa2e9618 | anaconda_project/project.py | python | _ConfigCache._update_lock_sets | (self, problems, lock_file) | [] | def _update_lock_sets(self, problems, lock_file):
self.lock_sets = dict()
self.locking_globally_enabled = False
enabled = lock_file.get_value(['locking_enabled'], True)
if not isinstance(enabled, bool):
_file_problem(problems, lock_file, "Value for locking_enabled should be ... | [
"def",
"_update_lock_sets",
"(",
"self",
",",
"problems",
",",
"lock_file",
")",
":",
"self",
".",
"lock_sets",
"=",
"dict",
"(",
")",
"self",
".",
"locking_globally_enabled",
"=",
"False",
"enabled",
"=",
"lock_file",
".",
"get_value",
"(",
"[",
"'locking_e... | https://github.com/Anaconda-Platform/anaconda-project/blob/df5ec33c12591e6512436d38d36c6132fa2e9618/anaconda_project/project.py#L487-L564 | ||||
RittmanMead/md_to_conf | 964f6089c49b0e30e3bd9f74e61332c3463109e4 | md2conf.py | python | convert_comment_block | (html) | return html | Convert markdown code bloc to Confluence hidden comment
:param html: string
:return: modified html string | Convert markdown code bloc to Confluence hidden comment | [
"Convert",
"markdown",
"code",
"bloc",
"to",
"Confluence",
"hidden",
"comment"
] | def convert_comment_block(html):
"""
Convert markdown code bloc to Confluence hidden comment
:param html: string
:return: modified html string
"""
open_tag = '<ac:placeholder>'
close_tag = '</ac:placeholder>'
html = html.replace('<!--', open_tag).replace('-->', close_tag)
return h... | [
"def",
"convert_comment_block",
"(",
"html",
")",
":",
"open_tag",
"=",
"'<ac:placeholder>'",
"close_tag",
"=",
"'</ac:placeholder>'",
"html",
"=",
"html",
".",
"replace",
"(",
"'<!--'",
",",
"open_tag",
")",
".",
"replace",
"(",
"'-->'",
",",
"close_tag",
")"... | https://github.com/RittmanMead/md_to_conf/blob/964f6089c49b0e30e3bd9f74e61332c3463109e4/md2conf.py#L127-L139 | |
googleanalytics/google-analytics-super-proxy | f5bad82eb1375d222638423e6ae302173a9a7948 | src/models/db_models.py | python | ApiQuery.modified_timedelta | (self, from_time=None) | return models_helper.GetModifiedTimedelta(self, from_time) | Returns how long since the API Query was updated. | Returns how long since the API Query was updated. | [
"Returns",
"how",
"long",
"since",
"the",
"API",
"Query",
"was",
"updated",
"."
] | def modified_timedelta(self, from_time=None):
"""Returns how long since the API Query was updated."""
return models_helper.GetModifiedTimedelta(self, from_time) | [
"def",
"modified_timedelta",
"(",
"self",
",",
"from_time",
"=",
"None",
")",
":",
"return",
"models_helper",
".",
"GetModifiedTimedelta",
"(",
"self",
",",
"from_time",
")"
] | https://github.com/googleanalytics/google-analytics-super-proxy/blob/f5bad82eb1375d222638423e6ae302173a9a7948/src/models/db_models.py#L102-L104 | |
HuberTRoy/leetCode | e19c670fe09035a55692e2b3d2dd993db3be4725 | Array/3SumWithMultiplicity.py | python | Solution.threeSumMulti | (self, A, target) | return result % mod | :type A: List[int]
:type target: int
:rtype: int | :type A: List[int]
:type target: int
:rtype: int | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"type",
"target",
":",
"int",
":",
"rtype",
":",
"int"
] | def threeSumMulti(self, A, target):
"""
:type A: List[int]
:type target: int
:rtype: int
"""
mod = 10**9 + 7
def get_multiple(time, all_times):
if time==1:
return all_times
elif time==2:
return sum(r... | [
"def",
"threeSumMulti",
"(",
"self",
",",
"A",
",",
"target",
")",
":",
"mod",
"=",
"10",
"**",
"9",
"+",
"7",
"def",
"get_multiple",
"(",
"time",
",",
"all_times",
")",
":",
"if",
"time",
"==",
"1",
":",
"return",
"all_times",
"elif",
"time",
"=="... | https://github.com/HuberTRoy/leetCode/blob/e19c670fe09035a55692e2b3d2dd993db3be4725/Array/3SumWithMultiplicity.py#L81-L144 | |
mrlesmithjr/Ansible | d44f0dc0d942bdf3bf7334b307e6048f0ee16e36 | roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/ipaddress.py | python | _BaseV6._compress_hextets | (cls, hextets) | return hextets | Compresses a list of hextets.
Compresses a list of strings, replacing the longest continuous
sequence of "0" in the list with "" and adding empty strings at
the beginning or at the end of the string such that subsequently
calling ":".join(hextets) will produce the compressed version of
... | Compresses a list of hextets. | [
"Compresses",
"a",
"list",
"of",
"hextets",
"."
] | def _compress_hextets(cls, hextets):
"""Compresses a list of hextets.
Compresses a list of strings, replacing the longest continuous
sequence of "0" in the list with "" and adding empty strings at
the beginning or at the end of the string such that subsequently
calling ":".join(... | [
"def",
"_compress_hextets",
"(",
"cls",
",",
"hextets",
")",
":",
"best_doublecolon_start",
"=",
"-",
"1",
"best_doublecolon_len",
"=",
"0",
"doublecolon_start",
"=",
"-",
"1",
"doublecolon_len",
"=",
"0",
"for",
"index",
",",
"hextet",
"in",
"enumerate",
"(",... | https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L1888-L1933 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/android/device_utils.py | python | DeviceUtils.build_id | (self) | return self.GetProp('ro.build.id', cache=True) | Returns the build ID of the system (e.g. 'KTU84P'). | Returns the build ID of the system (e.g. 'KTU84P'). | [
"Returns",
"the",
"build",
"ID",
"of",
"the",
"system",
"(",
"e",
".",
"g",
".",
"KTU84P",
")",
"."
] | def build_id(self):
"""Returns the build ID of the system (e.g. 'KTU84P')."""
return self.GetProp('ro.build.id', cache=True) | [
"def",
"build_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"GetProp",
"(",
"'ro.build.id'",
",",
"cache",
"=",
"True",
")"
] | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/android/device_utils.py#L2270-L2272 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/matmul.py | python | MatMul.doit | (self, **kwargs) | return canonicalize(MatMul(*args)) | [] | def doit(self, **kwargs):
deep = kwargs.get('deep', False)
if deep:
args = [arg.doit(**kwargs) for arg in self.args]
else:
args = self.args
return canonicalize(MatMul(*args)) | [
"def",
"doit",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"deep",
"=",
"kwargs",
".",
"get",
"(",
"'deep'",
",",
"False",
")",
"if",
"deep",
":",
"args",
"=",
"[",
"arg",
".",
"doit",
"(",
"*",
"*",
"kwargs",
")",
"for",
"arg",
"in",
"se... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/matmul.py#L109-L115 | |||
macadmins/installapplications | 2063c4a2bbec1df62e25e1e4a5820ffe3b5c4e46 | payload/Library/installapplications/gurl.py | python | Gurl.URLSession_task_didReceiveChallenge_completionHandler_ | (
self, _session, _task, challenge, completionHandler) | NSURLSessionTaskDelegate method | NSURLSessionTaskDelegate method | [
"NSURLSessionTaskDelegate",
"method"
] | def URLSession_task_didReceiveChallenge_completionHandler_(
self, _session, _task, challenge, completionHandler):
'''NSURLSessionTaskDelegate method'''
if CALLBACK_HELPER_AVAILABLE:
completionHandler.__block_signature__ = objc_method_signature(b'v@i@')
self.log('URLSessio... | [
"def",
"URLSession_task_didReceiveChallenge_completionHandler_",
"(",
"self",
",",
"_session",
",",
"_task",
",",
"challenge",
",",
"completionHandler",
")",
":",
"if",
"CALLBACK_HELPER_AVAILABLE",
":",
"completionHandler",
".",
"__block_signature__",
"=",
"objc_method_sign... | https://github.com/macadmins/installapplications/blob/2063c4a2bbec1df62e25e1e4a5820ffe3b5c4e46/payload/Library/installapplications/gurl.py#L659-L666 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/contrib/dis_kvstore.py | python | KVClient.pull | (self, name, id_tensor) | Pull message from KVServer.
Parameters
----------
name : str
data name
id_tensor : tensor (mx.ndarray or torch.tensor)
a vector storing the ID list
Returns
-------
tensor
a data tensor with the same row size of id_tensor. | Pull message from KVServer. | [
"Pull",
"message",
"from",
"KVServer",
"."
] | def pull(self, name, id_tensor):
"""Pull message from KVServer.
Parameters
----------
name : str
data name
id_tensor : tensor (mx.ndarray or torch.tensor)
a vector storing the ID list
Returns
-------
tensor
a data tens... | [
"def",
"pull",
"(",
"self",
",",
"name",
",",
"id_tensor",
")",
":",
"assert",
"len",
"(",
"name",
")",
">",
"0",
",",
"'name cannot be empty.'",
"assert",
"F",
".",
"ndim",
"(",
"id_tensor",
")",
"==",
"1",
",",
"'ID must be a vector.'",
"if",
"self",
... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/contrib/dis_kvstore.py#L1057-L1158 | ||
unknown-horizons/unknown-horizons | 7397fb333006d26c3d9fe796c7bd9cb8c3b43a49 | horizons/util/shapes/rect.py | python | Rect.contains_tuple | (self, tup) | return (self.left <= tup[0] <= self.right) and (self.top <= tup[1] <= self.bottom) | Same as contains, but takes a tuple (x, y) as parameter (overloaded function) | Same as contains, but takes a tuple (x, y) as parameter (overloaded function) | [
"Same",
"as",
"contains",
"but",
"takes",
"a",
"tuple",
"(",
"x",
"y",
")",
"as",
"parameter",
"(",
"overloaded",
"function",
")"
] | def contains_tuple(self, tup):
"""Same as contains, but takes a tuple (x, y) as parameter (overloaded function)"""
return (self.left <= tup[0] <= self.right) and (self.top <= tup[1] <= self.bottom) | [
"def",
"contains_tuple",
"(",
"self",
",",
"tup",
")",
":",
"return",
"(",
"self",
".",
"left",
"<=",
"tup",
"[",
"0",
"]",
"<=",
"self",
".",
"right",
")",
"and",
"(",
"self",
".",
"top",
"<=",
"tup",
"[",
"1",
"]",
"<=",
"self",
".",
"bottom"... | https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/util/shapes/rect.py#L192-L194 | |
flow-project/flow | a511c41c48e6b928bb2060de8ad1ef3c3e3d9554 | flow/core/kernel/network/traci.py | python | TraCIKernelNetwork.generate_net | (self,
net_params,
traffic_lights,
nodes,
edges,
types=None,
connections=None) | Generate Net files for the transportation network.
Creates different network configuration files for:
* nodes: x,y position of points which are connected together to form
links. The nodes may also be fitted with traffic lights, or can be
treated as priority or zipper merge regions ... | Generate Net files for the transportation network. | [
"Generate",
"Net",
"files",
"for",
"the",
"transportation",
"network",
"."
] | def generate_net(self,
net_params,
traffic_lights,
nodes,
edges,
types=None,
connections=None):
"""Generate Net files for the transportation network.
Creates different network c... | [
"def",
"generate_net",
"(",
"self",
",",
"net_params",
",",
"traffic_lights",
",",
"nodes",
",",
"edges",
",",
"types",
"=",
"None",
",",
"connections",
"=",
"None",
")",
":",
"# add traffic lights to the nodes",
"tl_ids",
"=",
"list",
"(",
"traffic_lights",
"... | https://github.com/flow-project/flow/blob/a511c41c48e6b928bb2060de8ad1ef3c3e3d9554/flow/core/kernel/network/traci.py#L329-L527 | ||
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/released/client_factory.py | python | ClientFactory.get_profile_client | (self) | return self._connection.get_client('azure.devops.released.profile.profile_client.ProfileClient') | get_profile_client.
Gets the 5.1 version of the ProfileClient
:rtype: :class:`<ProfileClient> <azure.devops.released.profile.profile_client.ProfileClient>` | get_profile_client.
Gets the 5.1 version of the ProfileClient
:rtype: :class:`<ProfileClient> <azure.devops.released.profile.profile_client.ProfileClient>` | [
"get_profile_client",
".",
"Gets",
"the",
"5",
".",
"1",
"version",
"of",
"the",
"ProfileClient",
":",
"rtype",
":",
":",
"class",
":",
"<ProfileClient",
">",
"<azure",
".",
"devops",
".",
"released",
".",
"profile",
".",
"profile_client",
".",
"ProfileClien... | def get_profile_client(self):
"""get_profile_client.
Gets the 5.1 version of the ProfileClient
:rtype: :class:`<ProfileClient> <azure.devops.released.profile.profile_client.ProfileClient>`
"""
return self._connection.get_client('azure.devops.released.profile.profile_client.Profil... | [
"def",
"get_profile_client",
"(",
"self",
")",
":",
"return",
"self",
".",
"_connection",
".",
"get_client",
"(",
"'azure.devops.released.profile.profile_client.ProfileClient'",
")"
] | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/released/client_factory.py#L81-L86 | |
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/e3/cache/PictureCache.py | python | PictureCache.insert_raw | (self, item) | return self.__add_entry(hash_) | insert a new item into the cache
return the information (stamp, hash) on success None otherwise
item -- a file like object containing an image | insert a new item into the cache
return the information (stamp, hash) on success None otherwise
item -- a file like object containing an image | [
"insert",
"a",
"new",
"item",
"into",
"the",
"cache",
"return",
"the",
"information",
"(",
"stamp",
"hash",
")",
"on",
"success",
"None",
"otherwise",
"item",
"--",
"a",
"file",
"like",
"object",
"containing",
"an",
"image"
] | def insert_raw(self, item):
'''insert a new item into the cache
return the information (stamp, hash) on success None otherwise
item -- a file like object containing an image
'''
if item is None:
return None
position = item.tell()
item.seek(0)
... | [
"def",
"insert_raw",
"(",
"self",
",",
"item",
")",
":",
"if",
"item",
"is",
"None",
":",
"return",
"None",
"position",
"=",
"item",
".",
"tell",
"(",
")",
"item",
".",
"seek",
"(",
"0",
")",
"hash_",
"=",
"Cache",
".",
"get_file_hash",
"(",
"item"... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/cache/PictureCache.py#L83-L105 | |
chubin/rate.sx | 1ce1bb37f7dccd76f40e2c23016b6a6f1d6da407 | lib/panela/panela_colors.py | python | Panela.put_line | (self, x1, y1, x2, y2, char=None, color=None, background=None) | Draw line (x1, y1) - (x2, y2) fith foreground color <color>, background color <background>
and charachter <char>, if specified. | Draw line (x1, y1) - (x2, y2) fith foreground color <color>, background color <background>
and charachter <char>, if specified. | [
"Draw",
"line",
"(",
"x1",
"y1",
")",
"-",
"(",
"x2",
"y2",
")",
"fith",
"foreground",
"color",
"<color",
">",
"background",
"color",
"<background",
">",
"and",
"charachter",
"<char",
">",
"if",
"specified",
"."
] | def put_line(self, x1, y1, x2, y2, char=None, color=None, background=None):
"""
Draw line (x1, y1) - (x2, y2) fith foreground color <color>, background color <background>
and charachter <char>, if specified.
"""
def get_line(start, end):
"""Bresenham's Line Algorithm... | [
"def",
"put_line",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"char",
"=",
"None",
",",
"color",
"=",
"None",
",",
"background",
"=",
"None",
")",
":",
"def",
"get_line",
"(",
"start",
",",
"end",
")",
":",
"\"\"\"Bresenham's Lin... | https://github.com/chubin/rate.sx/blob/1ce1bb37f7dccd76f40e2c23016b6a6f1d6da407/lib/panela/panela_colors.py#L300-L385 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/mako/_ast_util.py | python | SourceGenerator.generator_visit | (left, right) | return visit | [] | def generator_visit(left, right):
def visit(self, node):
self.write(left)
self.visit(node.elt)
for comprehension in node.generators:
self.visit(comprehension)
self.write(right)
return visit | [
"def",
"generator_visit",
"(",
"left",
",",
"right",
")",
":",
"def",
"visit",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"write",
"(",
"left",
")",
"self",
".",
"visit",
"(",
"node",
".",
"elt",
")",
"for",
"comprehension",
"in",
"node",
"."... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/mako/_ast_util.py#L784-L791 | |||
blacktop/malice | d318fab96dc011689a0a2be29d1513c71d3866aa | lib/common/objects.py | python | File.get_data | (self) | return self.file_data | Read file contents.
@return: data. | Read file contents. | [
"Read",
"file",
"contents",
"."
] | def get_data(self):
"""Read file contents.
@return: data.
"""
return self.file_data | [
"def",
"get_data",
"(",
"self",
")",
":",
"return",
"self",
".",
"file_data"
] | https://github.com/blacktop/malice/blob/d318fab96dc011689a0a2be29d1513c71d3866aa/lib/common/objects.py#L97-L101 | |
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/astroprint/camera/v4l2/gstreamer/process/__init__.py | python | processInterface._stopLocalVideoAction | (self, reqId) | return self.RESPONSE_ASYNC | [] | def _stopLocalVideoAction(self, reqId):
def doneCb(success):
self.sendResponse(reqId, success)
self._pipeline.stopLocalVideo(doneCb)
return self.RESPONSE_ASYNC | [
"def",
"_stopLocalVideoAction",
"(",
"self",
",",
"reqId",
")",
":",
"def",
"doneCb",
"(",
"success",
")",
":",
"self",
".",
"sendResponse",
"(",
"reqId",
",",
"success",
")",
"self",
".",
"_pipeline",
".",
"stopLocalVideo",
"(",
"doneCb",
")",
"return",
... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/camera/v4l2/gstreamer/process/__init__.py#L152-L159 | |||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/table/_header.py | python | Header.values | (self) | return self["values"] | Header cell values. `values[m][n]` represents the value of the
`n`th point in column `m`, therefore the `values[m]` vector
length for all columns must be the same (longer vectors will be
truncated). Each value must be a finite number or a string.
The 'values' property is an array th... | Header cell values. `values[m][n]` represents the value of the
`n`th point in column `m`, therefore the `values[m]` vector
length for all columns must be the same (longer vectors will be
truncated). Each value must be a finite number or a string.
The 'values' property is an array th... | [
"Header",
"cell",
"values",
".",
"values",
"[",
"m",
"]",
"[",
"n",
"]",
"represents",
"the",
"value",
"of",
"the",
"n",
"th",
"point",
"in",
"column",
"m",
"therefore",
"the",
"values",
"[",
"m",
"]",
"vector",
"length",
"for",
"all",
"columns",
"mu... | def values(self):
"""
Header cell values. `values[m][n]` represents the value of the
`n`th point in column `m`, therefore the `values[m]` vector
length for all columns must be the same (longer vectors will be
truncated). Each value must be a finite number or a string.
... | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"values\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/table/_header.py#L342-L356 | |
zykls/whynot | 86fd2349a83cd43c614b55f5bf2dfc9ece143081 | whynot/causal_graphs.py | python | is_dead_node | (node) | return False | Check if this node adds a spurious dependency, e.g. 0 * constant. | Check if this node adds a spurious dependency, e.g. 0 * constant. | [
"Check",
"if",
"this",
"node",
"adds",
"a",
"spurious",
"dependency",
"e",
".",
"g",
".",
"0",
"*",
"constant",
"."
] | def is_dead_node(node):
"""Check if this node adds a spurious dependency, e.g. 0 * constant."""
if hasattr(node.fun, "fun") and node.fun.fun == np.multiply:
# If we multiplied a parent by a constant 0, skip.
for idx, arg in enumerate(node.args):
if idx not in node.parent_argnums and ... | [
"def",
"is_dead_node",
"(",
"node",
")",
":",
"if",
"hasattr",
"(",
"node",
".",
"fun",
",",
"\"fun\"",
")",
"and",
"node",
".",
"fun",
".",
"fun",
"==",
"np",
".",
"multiply",
":",
"# If we multiplied a parent by a constant 0, skip.",
"for",
"idx",
",",
"... | https://github.com/zykls/whynot/blob/86fd2349a83cd43c614b55f5bf2dfc9ece143081/whynot/causal_graphs.py#L198-L205 | |
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | paddlespeech/t2s/models/transformer_tts/transformer_tts.py | python | GuidedAttentionLoss.forward | (self, att_ws, ilens, olens) | return self.alpha * loss | Calculate forward propagation.
Parameters
----------
att_ws : Tensor
Batch of attention weights (B, T_max_out, T_max_in).
ilens : LongTensor
Batch of input lenghts (B,).
olens : LongTensor
Batch of output lenghts (B,).
Returns
... | Calculate forward propagation. | [
"Calculate",
"forward",
"propagation",
"."
] | def forward(self, att_ws, ilens, olens):
"""Calculate forward propagation.
Parameters
----------
att_ws : Tensor
Batch of attention weights (B, T_max_out, T_max_in).
ilens : LongTensor
Batch of input lenghts (B,).
olens : LongTensor
Ba... | [
"def",
"forward",
"(",
"self",
",",
"att_ws",
",",
"ilens",
",",
"olens",
")",
":",
"if",
"self",
".",
"guided_attn_masks",
"is",
"None",
":",
"self",
".",
"guided_attn_masks",
"=",
"self",
".",
"_make_guided_attention_masks",
"(",
"ilens",
",",
"olens",
"... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/t2s/models/transformer_tts/transformer_tts.py#L916-L944 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.