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 sequence | function stringlengths 18 4.83M | function_tokens sequence | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google-research/rigl | f18abc7d82ae3acc6736068408a0186c9efa575c | rigl/experimental/jax/pruning/masked.py | python | _PerNeuronShuffle.__init__ | (self, init_rng, sparsity) | Creates the per-neuron shuffle class, with initial RNG state.
Args:
init_rng: The initial random number generator state to use.
sparsity: The per-layer sparsity of the mask (i.e. % of zeroes), 1.0 will
mask all weights, while 0 will mask none. | Creates the per-neuron shuffle class, with initial RNG state. | [
"Creates",
"the",
"per",
"-",
"neuron",
"shuffle",
"class",
"with",
"initial",
"RNG",
"state",
"."
] | def __init__(self, init_rng, sparsity):
"""Creates the per-neuron shuffle class, with initial RNG state.
Args:
init_rng: The initial random number generator state to use.
sparsity: The per-layer sparsity of the mask (i.e. % of zeroes), 1.0 will
mask all weights, while 0 will mask none.
... | [
"def",
"__init__",
"(",
"self",
",",
"init_rng",
",",
"sparsity",
")",
":",
"self",
".",
"_rng",
"=",
"init_rng",
"self",
".",
"_sparsity",
"=",
"sparsity"
] | https://github.com/google-research/rigl/blob/f18abc7d82ae3acc6736068408a0186c9efa575c/rigl/experimental/jax/pruning/masked.py#L380-L389 | ||
facebookresearch/pytorch_GAN_zoo | b75dee40918caabb4fe7ec561522717bf096a8cb | models/trainer/DCGAN_trainer.py | python | DCGANTrainer.initModel | (self) | [] | def initModel(self):
self.model = DCGAN(useGPU=self.useGPU,
**vars(self.modelConfig)) | [
"def",
"initModel",
"(",
"self",
")",
":",
"self",
".",
"model",
"=",
"DCGAN",
"(",
"useGPU",
"=",
"self",
".",
"useGPU",
",",
"*",
"*",
"vars",
"(",
"self",
".",
"modelConfig",
")",
")"
] | https://github.com/facebookresearch/pytorch_GAN_zoo/blob/b75dee40918caabb4fe7ec561522717bf096a8cb/models/trainer/DCGAN_trainer.py#L33-L35 | ||||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/SearchIO/HmmerIO/hmmer3_tab.py | python | Hmmer3TabWriter.write_file | (self, qresults) | return qresult_counter, hit_counter, hsp_counter, frag_counter | Write to the handle.
Returns a tuple of how many QueryResult, Hit, and HSP objects were written. | Write to the handle. | [
"Write",
"to",
"the",
"handle",
"."
] | def write_file(self, qresults):
"""Write to the handle.
Returns a tuple of how many QueryResult, Hit, and HSP objects were written.
"""
handle = self.handle
qresult_counter, hit_counter, hsp_counter, frag_counter = 0, 0, 0, 0
try:
first_qresult = next(qresu... | [
"def",
"write_file",
"(",
"self",
",",
"qresults",
")",
":",
"handle",
"=",
"self",
".",
"handle",
"qresult_counter",
",",
"hit_counter",
",",
"hsp_counter",
",",
"frag_counter",
"=",
"0",
",",
"0",
",",
"0",
",",
"0",
"try",
":",
"first_qresult",
"=",
... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SearchIO/HmmerIO/hmmer3_tab.py#L222-L247 | |
nansencenter/nansat | 5700ec673fbf522c19b8dedcb01cc15f7cd29a6a | nansat/vrt.py | python | VRT.fix_global_metadata | (self, rm_metadata) | Remove unwanted global metadata and escape special characters | Remove unwanted global metadata and escape special characters | [
"Remove",
"unwanted",
"global",
"metadata",
"and",
"escape",
"special",
"characters"
] | def fix_global_metadata(self, rm_metadata):
"""Remove unwanted global metadata and escape special characters"""
metadata = remove_keys(self.dataset.GetMetadata(), rm_metadata)
# Apply escaping to metadata strings to preserve special characters (in XML/HTML format)
metadata_escaped = {}
... | [
"def",
"fix_global_metadata",
"(",
"self",
",",
"rm_metadata",
")",
":",
"metadata",
"=",
"remove_keys",
"(",
"self",
".",
"dataset",
".",
"GetMetadata",
"(",
")",
",",
"rm_metadata",
")",
"# Apply escaping to metadata strings to preserve special characters (in XML/HTML f... | https://github.com/nansencenter/nansat/blob/5700ec673fbf522c19b8dedcb01cc15f7cd29a6a/nansat/vrt.py#L801-L810 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/_structures.py | python | Infinity.__eq__ | (self, other) | return isinstance(other, self.__class__) | [] | def __eq__(self, other):
return isinstance(other, self.__class__) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/_structures.py#L21-L22 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tci/v20190318/models.py | python | ModifyLibraryResponse.__init__ | (self) | r"""
:param LibraryId: 人员库唯一标识符
:type LibraryId: str
:param LibraryName: 人员库名称
:type LibraryName: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param LibraryId: 人员库唯一标识符
:type LibraryId: str
:param LibraryName: 人员库名称
:type LibraryName: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"LibraryId",
":",
"人员库唯一标识符",
":",
"type",
"LibraryId",
":",
"str",
":",
"param",
"LibraryName",
":",
"人员库名称",
":",
"type",
"LibraryName",
":",
"str",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
... | def __init__(self):
r"""
:param LibraryId: 人员库唯一标识符
:type LibraryId: str
:param LibraryName: 人员库名称
:type LibraryName: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.LibraryId = None
self.Libra... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"LibraryId",
"=",
"None",
"self",
".",
"LibraryName",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tci/v20190318/models.py#L3152-L3163 | ||
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/api_phonopy.py | python | Phonopy._shape_supercell_matrix | (self, smat) | return shape_supercell_matrix(smat) | [] | def _shape_supercell_matrix(self, smat):
return shape_supercell_matrix(smat) | [
"def",
"_shape_supercell_matrix",
"(",
"self",
",",
"smat",
")",
":",
"return",
"shape_supercell_matrix",
"(",
"smat",
")"
] | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/api_phonopy.py#L3543-L3544 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_group.py | python | SecurityContextConstraints.groups | (self) | return self._groups | groups property getter | groups property getter | [
"groups",
"property",
"getter"
] | def groups(self):
''' groups property getter '''
if self._groups is None:
self._groups = self.get_groups()
return self._groups | [
"def",
"groups",
"(",
"self",
")",
":",
"if",
"self",
".",
"_groups",
"is",
"None",
":",
"self",
".",
"_groups",
"=",
"self",
".",
"get_groups",
"(",
")",
"return",
"self",
".",
"_groups"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_group.py#L1872-L1876 | |
cournape/Bento | 37de23d784407a7c98a4a15770ffc570d5f32d70 | bento/private/version.py | python | NormalizedVersion.__eq__ | (self, other) | return self.parts == other.parts | [] | def __eq__(self, other):
if not isinstance(other, NormalizedVersion):
self._cannot_compare(other)
return self.parts == other.parts | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"NormalizedVersion",
")",
":",
"self",
".",
"_cannot_compare",
"(",
"other",
")",
"return",
"self",
".",
"parts",
"==",
"other",
".",
"parts"
] | https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/private/version.py#L197-L200 | |||
david8862/keras-YOLOv3-model-set | e9f0f94109430973525219e66eeafe8a2f51363d | common/backbones/shufflenet.py | python | ShuffleNet | (include_top=True,
input_tensor=None,
scale_factor=1.0,
pooling=None,
input_shape=None,
groups=1,
weights='imagenet',
num_shuffle_units=[3, 7, 3],
bottleneck_ratio=0.25,
classes=1000,
... | return model | ShuffleNet implementation for Keras 2
ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices
Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, Jian Sun
https://arxiv.org/pdf/1707.01083.pdf
Note that only TensorFlow is supported for now, therefore it only works
with the data format... | ShuffleNet implementation for Keras 2
ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices
Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, Jian Sun
https://arxiv.org/pdf/1707.01083.pdf
Note that only TensorFlow is supported for now, therefore it only works
with the data format... | [
"ShuffleNet",
"implementation",
"for",
"Keras",
"2",
"ShuffleNet",
":",
"An",
"Extremely",
"Efficient",
"Convolutional",
"Neural",
"Network",
"for",
"Mobile",
"Devices",
"Xiangyu",
"Zhang",
"Xinyu",
"Zhou",
"Mengxiao",
"Lin",
"Jian",
"Sun",
"https",
":",
"//",
"... | def ShuffleNet(include_top=True,
input_tensor=None,
scale_factor=1.0,
pooling=None,
input_shape=None,
groups=1,
weights='imagenet',
num_shuffle_units=[3, 7, 3],
bottleneck_ratio=0.25,
c... | [
"def",
"ShuffleNet",
"(",
"include_top",
"=",
"True",
",",
"input_tensor",
"=",
"None",
",",
"scale_factor",
"=",
"1.0",
",",
"pooling",
"=",
"None",
",",
"input_shape",
"=",
"None",
",",
"groups",
"=",
"1",
",",
"weights",
"=",
"'imagenet'",
",",
"num_s... | https://github.com/david8862/keras-YOLOv3-model-set/blob/e9f0f94109430973525219e66eeafe8a2f51363d/common/backbones/shufflenet.py#L23-L181 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/PIL/ImageDraw.py | python | _color_diff | (rgb1, rgb2) | return abs(rgb1[0]-rgb2[0]) + abs(rgb1[1]-rgb2[1]) + abs(rgb1[2]-rgb2[2]) | Uses 1-norm distance to calculate difference between two rgb values. | Uses 1-norm distance to calculate difference between two rgb values. | [
"Uses",
"1",
"-",
"norm",
"distance",
"to",
"calculate",
"difference",
"between",
"two",
"rgb",
"values",
"."
] | def _color_diff(rgb1, rgb2):
"""
Uses 1-norm distance to calculate difference between two rgb values.
"""
return abs(rgb1[0]-rgb2[0]) + abs(rgb1[1]-rgb2[1]) + abs(rgb1[2]-rgb2[2]) | [
"def",
"_color_diff",
"(",
"rgb1",
",",
"rgb2",
")",
":",
"return",
"abs",
"(",
"rgb1",
"[",
"0",
"]",
"-",
"rgb2",
"[",
"0",
"]",
")",
"+",
"abs",
"(",
"rgb1",
"[",
"1",
"]",
"-",
"rgb2",
"[",
"1",
"]",
")",
"+",
"abs",
"(",
"rgb1",
"[",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/PIL/ImageDraw.py#L383-L387 | |
intel/IntelSEAPI | 7997a782fd3fa5621e275bd31060f9795564e6ca | runtool/exporters/DGML.py | python | DGML.get_targets | (self) | return [self.args.output + ".dgml"] | [] | def get_targets(self):
return [self.args.output + ".dgml"] | [
"def",
"get_targets",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"args",
".",
"output",
"+",
"\".dgml\"",
"]"
] | https://github.com/intel/IntelSEAPI/blob/7997a782fd3fa5621e275bd31060f9795564e6ca/runtool/exporters/DGML.py#L15-L16 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/wifitap/scapy.py | python | PacketListField.do_copy | (self, x) | return map(lambda p:p.copy(), x) | [] | def do_copy(self, x):
return map(lambda p:p.copy(), x) | [
"def",
"do_copy",
"(",
"self",
",",
"x",
")",
":",
"return",
"map",
"(",
"lambda",
"p",
":",
"p",
".",
"copy",
"(",
")",
",",
"x",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/wifitap/scapy.py#L4029-L4030 | |||
boto/boto | b2a6f08122b2f1b89888d2848e730893595cd001 | boto/gs/bucket.py | python | Bucket.set_def_xml_acl | (self, acl_str, headers=None) | return self.set_xml_acl(acl_str, '', headers,
query_args=DEF_OBJ_ACL) | Sets a bucket's default ACL to an XML string.
:type acl_str: string
:param acl_str: A string containing the ACL XML.
:type headers: dict
:param headers: Additional headers to set during the request. | Sets a bucket's default ACL to an XML string. | [
"Sets",
"a",
"bucket",
"s",
"default",
"ACL",
"to",
"an",
"XML",
"string",
"."
] | def set_def_xml_acl(self, acl_str, headers=None):
"""Sets a bucket's default ACL to an XML string.
:type acl_str: string
:param acl_str: A string containing the ACL XML.
:type headers: dict
:param headers: Additional headers to set during the request.
"""
return... | [
"def",
"set_def_xml_acl",
"(",
"self",
",",
"acl_str",
",",
"headers",
"=",
"None",
")",
":",
"return",
"self",
".",
"set_xml_acl",
"(",
"acl_str",
",",
"''",
",",
"headers",
",",
"query_args",
"=",
"DEF_OBJ_ACL",
")"
] | https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/gs/bucket.py#L574-L584 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/api/v2010/account/usage/record/__init__.py | python | RecordInstance.uri | (self) | return self._properties['uri'] | :returns: The URI of the resource, relative to `https://api.twilio.com`
:rtype: unicode | :returns: The URI of the resource, relative to `https://api.twilio.com`
:rtype: unicode | [
":",
"returns",
":",
"The",
"URI",
"of",
"the",
"resource",
"relative",
"to",
"https",
":",
"//",
"api",
".",
"twilio",
".",
"com",
":",
"rtype",
":",
"unicode"
] | def uri(self):
"""
:returns: The URI of the resource, relative to `https://api.twilio.com`
:rtype: unicode
"""
return self._properties['uri'] | [
"def",
"uri",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'uri'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/usage/record/__init__.py#L687-L692 | |
Bitmessage/PyBitmessage | 97612b049e0453867d6d90aa628f8e7b007b4d85 | src/network/tcp.py | python | TCPConnection.antiIntersectionDelay | (self, initial=False) | This is a defense against the so called intersection attacks.
It is called when you notice peer is requesting non-existing
objects, or right after the connection is established. It will
estimate how long an object will take to propagate across the
network, and skip processing "getdata" ... | This is a defense against the so called intersection attacks. | [
"This",
"is",
"a",
"defense",
"against",
"the",
"so",
"called",
"intersection",
"attacks",
"."
] | def antiIntersectionDelay(self, initial=False):
"""
This is a defense against the so called intersection attacks.
It is called when you notice peer is requesting non-existing
objects, or right after the connection is established. It will
estimate how long an object will take to ... | [
"def",
"antiIntersectionDelay",
"(",
"self",
",",
"initial",
"=",
"False",
")",
":",
"# estimated time for a small object to propagate across the",
"# whole network",
"max_known_nodes",
"=",
"max",
"(",
"len",
"(",
"knownnodes",
".",
"knownNodes",
"[",
"x",
"]",
")",
... | https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/network/tcp.py#L96-L127 | ||
Axelrod-Python/Axelrod | 00e18323c1b1af74df873773e44f31e1b9a299c6 | axelrod/strategy_transformers.py | python | mixed_reclassifier | (original_classifier, probability, m_player) | return original_classifier | Function to reclassify the strategy | Function to reclassify the strategy | [
"Function",
"to",
"reclassify",
"the",
"strategy"
] | def mixed_reclassifier(original_classifier, probability, m_player):
"""Function to reclassify the strategy"""
# If a single probability, player is passed
if isinstance(probability, float) or isinstance(probability, int):
m_player = [m_player]
probability = [probability]
if min(probabili... | [
"def",
"mixed_reclassifier",
"(",
"original_classifier",
",",
"probability",
",",
"m_player",
")",
":",
"# If a single probability, player is passed",
"if",
"isinstance",
"(",
"probability",
",",
"float",
")",
"or",
"isinstance",
"(",
"probability",
",",
"int",
")",
... | https://github.com/Axelrod-Python/Axelrod/blob/00e18323c1b1af74df873773e44f31e1b9a299c6/axelrod/strategy_transformers.py#L621-L638 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/gui/api_labels_restricted_call_router.py | python | ApiLabelsRestrictedCallRouter.ListClientApprovals | (self, args, context=None) | return self.delegate.ListClientApprovals(args, context=context) | [] | def ListClientApprovals(self, args, context=None):
# Everybody can list their own user client approvals.
return self.delegate.ListClientApprovals(args, context=context) | [
"def",
"ListClientApprovals",
"(",
"self",
",",
"args",
",",
"context",
"=",
"None",
")",
":",
"# Everybody can list their own user client approvals.",
"return",
"self",
".",
"delegate",
".",
"ListClientApprovals",
"(",
"args",
",",
"context",
"=",
"context",
")"
] | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_labels_restricted_call_router.py#L265-L268 | |||
makelove/OpenCV-Python-Tutorial | e428d648f7aa50d6a0fb4f4d0fb1bd1a600fef41 | cv-Tkinter-GUI/kivy-GUI/kivy_cv1.py | python | KivyCamera.__init__ | (self, capture, fps, **kwargs) | [] | def __init__(self, capture, fps, **kwargs):
super(KivyCamera, self).__init__(**kwargs)
self.capture = capture
Clock.schedule_interval(self.update, 1.0 / fps) | [
"def",
"__init__",
"(",
"self",
",",
"capture",
",",
"fps",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"KivyCamera",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"capture",
"=",
"capture",
"Clock",
".",
"sched... | https://github.com/makelove/OpenCV-Python-Tutorial/blob/e428d648f7aa50d6a0fb4f4d0fb1bd1a600fef41/cv-Tkinter-GUI/kivy-GUI/kivy_cv1.py#L27-L30 | ||||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/docutils/utils/math/math2html.py | python | Newline.process | (self) | Process contents | Process contents | [
"Process",
"contents"
] | def process(self):
"Process contents"
self.html = ['<br/>\n'] | [
"def",
"process",
"(",
"self",
")",
":",
"self",
".",
"html",
"=",
"[",
"'<br/>\\n'",
"]"
] | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/utils/math/math2html.py#L3718-L3720 | ||
gpodder/mygpo | 7a028ad621d05d4ca0d58fd22fb92656c8835e43 | mygpo/search/index.py | python | search_podcasts | (query) | return results | Search for podcasts according to 'query | Search for podcasts according to 'query | [
"Search",
"for",
"podcasts",
"according",
"to",
"query"
] | def search_podcasts(query):
"""Search for podcasts according to 'query'"""
if is_query_too_short(query):
logger.debug('Found no podcasts for "{query}". Query is too short', query=query)
return Podcast.objects.none()
logger.debug('Searching for "{query}" podcasts"', query=query)
query =... | [
"def",
"search_podcasts",
"(",
"query",
")",
":",
"if",
"is_query_too_short",
"(",
"query",
")",
":",
"logger",
".",
"debug",
"(",
"'Found no podcasts for \"{query}\". Query is too short'",
",",
"query",
"=",
"query",
")",
"return",
"Podcast",
".",
"objects",
".",... | https://github.com/gpodder/mygpo/blob/7a028ad621d05d4ca0d58fd22fb92656c8835e43/mygpo/search/index.py#L24-L50 | |
n1nj4sec/pupy | a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39 | pupy/network/lib/rpc/core/protocol.py | python | Connection._handle_getattr | (self, oid, name) | return self._access_attr(oid, name, (), "_rpyc_getattr", "allow_getattr", getattr) | [] | def _handle_getattr(self, oid, name):
return self._access_attr(oid, name, (), "_rpyc_getattr", "allow_getattr", getattr) | [
"def",
"_handle_getattr",
"(",
"self",
",",
"oid",
",",
"name",
")",
":",
"return",
"self",
".",
"_access_attr",
"(",
"oid",
",",
"name",
",",
"(",
")",
",",
"\"_rpyc_getattr\"",
",",
"\"allow_getattr\"",
",",
"getattr",
")"
] | https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/network/lib/rpc/core/protocol.py#L662-L663 | |||
zhanghe06/python | a678ce38a3770c91ad12e617810bf9f5ccf7898b | fuck/pconline.py | python | get_link | (url, token) | return down_link | 组装下载链接 | 组装下载链接 | [
"组装下载链接"
] | def get_link(url, token):
"""
组装下载链接
"""
file_name = url.split('/')[-1]
print file_name
print token
down_link = url.rstrip(file_name)+token+'/'+file_name
print down_link
return down_link | [
"def",
"get_link",
"(",
"url",
",",
"token",
")",
":",
"file_name",
"=",
"url",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]",
"print",
"file_name",
"print",
"token",
"down_link",
"=",
"url",
".",
"rstrip",
"(",
"file_name",
")",
"+",
"token",
... | https://github.com/zhanghe06/python/blob/a678ce38a3770c91ad12e617810bf9f5ccf7898b/fuck/pconline.py#L43-L52 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/geometry/polyhedron/plot.py | python | Projection.tikz | (self, view=[0, 0, 1], angle=0, scale=1,
edge_color='blue!95!black', facet_color='blue!95!black',
opacity=0.8, vertex_color='green', axis=False) | r"""
Return a string ``tikz_pic`` consisting of a tikz picture of ``self``
according to a projection ``view`` and an angle ``angle``
obtained via Jmol through the current state property.
INPUT:
- ``view`` - list (default: [0,0,1]) representing the rotation axis (see note below)... | r"""
Return a string ``tikz_pic`` consisting of a tikz picture of ``self``
according to a projection ``view`` and an angle ``angle``
obtained via Jmol through the current state property. | [
"r",
"Return",
"a",
"string",
"tikz_pic",
"consisting",
"of",
"a",
"tikz",
"picture",
"of",
"self",
"according",
"to",
"a",
"projection",
"view",
"and",
"an",
"angle",
"angle",
"obtained",
"via",
"Jmol",
"through",
"the",
"current",
"state",
"property",
"."
... | def tikz(self, view=[0, 0, 1], angle=0, scale=1,
edge_color='blue!95!black', facet_color='blue!95!black',
opacity=0.8, vertex_color='green', axis=False):
r"""
Return a string ``tikz_pic`` consisting of a tikz picture of ``self``
according to a projection ``view`` and an... | [
"def",
"tikz",
"(",
"self",
",",
"view",
"=",
"[",
"0",
",",
"0",
",",
"1",
"]",
",",
"angle",
"=",
"0",
",",
"scale",
"=",
"1",
",",
"edge_color",
"=",
"'blue!95!black'",
",",
"facet_color",
"=",
"'blue!95!black'",
",",
"opacity",
"=",
"0.8",
",",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/polyhedron/plot.py#L1181-L1309 | ||
SymbiFlow/prjxray | 5349556bc2c230801d6df0cf11bccb9cfd171639 | prjxray/tile_segbits.py | python | parsebit | (val) | return Bit(
word_column=int(seg_word_column),
word_bit=int(word_bit_n),
isset=isset,
) | Return "!012_23" => (12, 23, False) | Return "!012_23" => (12, 23, False) | [
"Return",
"!012_23",
"=",
">",
"(",
"12",
"23",
"False",
")"
] | def parsebit(val):
'''Return "!012_23" => (12, 23, False)'''
isset = True
# Default is 0. Skip explicit call outs
if val[0] == '!':
isset = False
val = val[1:]
# 28_05 => 28, 05
parts = val.split('_')
assert len(parts) == 2, val
seg_word_column, word_bit_n = parts
re... | [
"def",
"parsebit",
"(",
"val",
")",
":",
"isset",
"=",
"True",
"# Default is 0. Skip explicit call outs",
"if",
"val",
"[",
"0",
"]",
"==",
"'!'",
":",
"isset",
"=",
"False",
"val",
"=",
"val",
"[",
"1",
":",
"]",
"# 28_05 => 28, 05",
"parts",
"=",
"val"... | https://github.com/SymbiFlow/prjxray/blob/5349556bc2c230801d6df0cf11bccb9cfd171639/prjxray/tile_segbits.py#L41-L57 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/python/mxnet/symbol/symbol.py | python | Symbol.broadcast_like | (self, *args, **kwargs) | return op.broadcast_like(self, *args, **kwargs) | Convenience fluent method for :py:func:`broadcast_like`.
The arguments are the same as for :py:func:`broadcast_like`, with
this array as data. | Convenience fluent method for :py:func:`broadcast_like`. | [
"Convenience",
"fluent",
"method",
"for",
":",
"py",
":",
"func",
":",
"broadcast_like",
"."
] | def broadcast_like(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`broadcast_like`.
The arguments are the same as for :py:func:`broadcast_like`, with
this array as data.
"""
return op.broadcast_like(self, *args, **kwargs) | [
"def",
"broadcast_like",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"op",
".",
"broadcast_like",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/python/mxnet/symbol/symbol.py#L2018-L2024 | |
miyakogi/pyppeteer | f5313d0e7f973c57ed31fa443cea1834e223a96c | pyppeteer/dialog.py | python | Dialog.accept | (self, promptText: str = '') | Accept the dialog.
* ``promptText`` (str): A text to enter in prompt. If the dialog's type
is not prompt, this does not cause any effect. | Accept the dialog. | [
"Accept",
"the",
"dialog",
"."
] | async def accept(self, promptText: str = '') -> None:
"""Accept the dialog.
* ``promptText`` (str): A text to enter in prompt. If the dialog's type
is not prompt, this does not cause any effect.
"""
self._handled = True
await self._client.send('Page.handleJavaScriptDia... | [
"async",
"def",
"accept",
"(",
"self",
",",
"promptText",
":",
"str",
"=",
"''",
")",
"->",
"None",
":",
"self",
".",
"_handled",
"=",
"True",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Page.handleJavaScriptDialog'",
",",
"{",
"'accept'",
":",
... | https://github.com/miyakogi/pyppeteer/blob/f5313d0e7f973c57ed31fa443cea1834e223a96c/pyppeteer/dialog.py#L71-L81 | ||
AI-ON/Multitask-and-Transfer-Learning | 31e0798d436e314ddbc64c4a6b935df1b2160e50 | architectures/chainer/models/predictive_autoencoder.py | python | normalize_2d | (x) | return exp / denominator | [] | def normalize_2d(x):
exp = F.exp(x[0])
sums = F.sum(F.sum(exp, axis=-1), axis=-1)
expanded = F.expand_dims(F.expand_dims(sums, axis=-1), axis=-1)
denominator = F.tile(expanded, (1, 160, 210))
return exp / denominator | [
"def",
"normalize_2d",
"(",
"x",
")",
":",
"exp",
"=",
"F",
".",
"exp",
"(",
"x",
"[",
"0",
"]",
")",
"sums",
"=",
"F",
".",
"sum",
"(",
"F",
".",
"sum",
"(",
"exp",
",",
"axis",
"=",
"-",
"1",
")",
",",
"axis",
"=",
"-",
"1",
")",
"exp... | https://github.com/AI-ON/Multitask-and-Transfer-Learning/blob/31e0798d436e314ddbc64c4a6b935df1b2160e50/architectures/chainer/models/predictive_autoencoder.py#L247-L252 | |||
Tencent/bk-bcs-saas | 2b437bf2f5fd5ce2078f7787c3a12df609f7679d | bcs-app/backend/container_service/clusters/views/node.py | python | NodeLabelQueryCreateViewSet.create_node_labels | (self, request, project_id) | return Response({"code": 0, "message": _("创建成功!")}) | 添加节点标签 | 添加节点标签 | [
"添加节点标签"
] | def create_node_labels(self, request, project_id):
"""添加节点标签"""
# 解析参数
node_id_list, node_label_info = self.get_create_label_params(request)
# 校验label中key和value
self.label_regex(node_label_info)
# 获取数据库中节点的label
# NOTE: 节点为正常状态时,才允许设置标签
project_node_info =... | [
"def",
"create_node_labels",
"(",
"self",
",",
"request",
",",
"project_id",
")",
":",
"# 解析参数",
"node_id_list",
",",
"node_label_info",
"=",
"self",
".",
"get_create_label_params",
"(",
"request",
")",
"# 校验label中key和value",
"self",
".",
"label_regex",
"(",
"node... | https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/container_service/clusters/views/node.py#L725-L767 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/setuptools/command/sdist.py | python | sdist.make_distribution | (self) | Workaround for #516 | Workaround for #516 | [
"Workaround",
"for",
"#516"
] | def make_distribution(self):
"""
Workaround for #516
"""
with self._remove_os_link():
orig.sdist.make_distribution(self) | [
"def",
"make_distribution",
"(",
"self",
")",
":",
"with",
"self",
".",
"_remove_os_link",
"(",
")",
":",
"orig",
".",
"sdist",
".",
"make_distribution",
"(",
"self",
")"
] | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/setuptools/command/sdist.py#L73-L78 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/hotshot/__init__.py | python | Profile.stop | (self) | Stop the profiler. | Stop the profiler. | [
"Stop",
"the",
"profiler",
"."
] | def stop(self):
"""Stop the profiler."""
self._prof.stop() | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"_prof",
".",
"stop",
"(",
")"
] | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/hotshot/__init__.py#L38-L40 | ||
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/app.py | python | SoftwareCenterAppGtk3.show_available_packages | (self, packages) | Show packages given as arguments in the available_pane
If the list of packages is only one element long show that,
otherwise turn it into a comma seperated search | Show packages given as arguments in the available_pane
If the list of packages is only one element long show that,
otherwise turn it into a comma seperated search | [
"Show",
"packages",
"given",
"as",
"arguments",
"in",
"the",
"available_pane",
"If",
"the",
"list",
"of",
"packages",
"is",
"only",
"one",
"element",
"long",
"show",
"that",
"otherwise",
"turn",
"it",
"into",
"a",
"comma",
"seperated",
"search"
] | def show_available_packages(self, packages):
""" Show packages given as arguments in the available_pane
If the list of packages is only one element long show that,
otherwise turn it into a comma seperated search
"""
try:
search_text, app = parse_packages_args(... | [
"def",
"show_available_packages",
"(",
"self",
",",
"packages",
")",
":",
"try",
":",
"search_text",
",",
"app",
"=",
"parse_packages_args",
"(",
"packages",
")",
"except",
"DebFileOpenError",
"as",
"e",
":",
"LOG",
".",
"exception",
"(",
"\"show_available_packa... | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/app.py#L1324-L1350 | ||
NervanaSystems/ngraph-python | ac032c83c7152b615a9ad129d54d350f9d6a2986 | ngraph/transformers/exop.py | python | TensorViewDecl.key | (self) | return self.tensor_description.parameter_key | Returns: A tuple unique to this view of the tensor. | Returns: A tuple unique to this view of the tensor. | [
"Returns",
":",
"A",
"tuple",
"unique",
"to",
"this",
"view",
"of",
"the",
"tensor",
"."
] | def key(self):
"""
Returns: A tuple unique to this view of the tensor.
"""
return self.tensor_description.parameter_key | [
"def",
"key",
"(",
"self",
")",
":",
"return",
"self",
".",
"tensor_description",
".",
"parameter_key"
] | https://github.com/NervanaSystems/ngraph-python/blob/ac032c83c7152b615a9ad129d54d350f9d6a2986/ngraph/transformers/exop.py#L1175-L1180 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/html5lib/treebuilders/base.py | python | TreeBuilder.elementInActiveFormattingElements | (self, name) | return False | Check if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return false | Check if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return false | [
"Check",
"if",
"an",
"element",
"exists",
"between",
"the",
"end",
"of",
"the",
"active",
"formatting",
"elements",
"and",
"the",
"last",
"marker",
".",
"If",
"it",
"does",
"return",
"it",
"else",
"return",
"false"
] | def elementInActiveFormattingElements(self, name):
"""Check if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return false"""
for item in self.activeFormattingElements[::-1]:
# Check for Marker first becau... | [
"def",
"elementInActiveFormattingElements",
"(",
"self",
",",
"name",
")",
":",
"for",
"item",
"in",
"self",
".",
"activeFormattingElements",
"[",
":",
":",
"-",
"1",
"]",
":",
"# Check for Marker first because if it's a Marker it doesn't have a",
"# name attribute.",
"... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/html5lib/treebuilders/base.py#L269-L281 | |
ducksboard/libsaas | 615981a3336f65be9d51ae95a48aed9ad3bd1c3c | libsaas/services/bitbucket/issues.py | python | RepoIssues.filter | (self, filters) | return http.Request('GET', url), parsers.parse_json | Search through the issues applying filters.
Look at https://confluence.atlassian.com/display/BITBUCKET/Issues
to get a complete list of possible filters.
:var filters: A dictionary of filters. Keys are strings corresponding
to the filter names and values are ether string filter val... | Search through the issues applying filters. | [
"Search",
"through",
"the",
"issues",
"applying",
"filters",
"."
] | def filter(self, filters):
"""
Search through the issues applying filters.
Look at https://confluence.atlassian.com/display/BITBUCKET/Issues
to get a complete list of possible filters.
:var filters: A dictionary of filters. Keys are strings corresponding
to the filt... | [
"def",
"filter",
"(",
"self",
",",
"filters",
")",
":",
"# because http.Request needs params to be a dict of strings to strings",
"# (roughly) and since BitBucket wants repeated parameters to express",
"# OR, we'll do the quoting by hand ourselves",
"def",
"flatten_conditions",
"(",
"fil... | https://github.com/ducksboard/libsaas/blob/615981a3336f65be9d51ae95a48aed9ad3bd1c3c/libsaas/services/bitbucket/issues.py#L128-L157 | |
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/zonemanager/utils.py | python | get_formatted_wwn | (wwn_str) | Utility API that formats WWN to insert ':'. | Utility API that formats WWN to insert ':'. | [
"Utility",
"API",
"that",
"formats",
"WWN",
"to",
"insert",
":",
"."
] | def get_formatted_wwn(wwn_str):
"""Utility API that formats WWN to insert ':'."""
if (len(wwn_str) != 16):
return wwn_str.lower()
else:
return (':'.join([wwn_str[i:i + 2]
for i in range(0, len(wwn_str), 2)])).lower() | [
"def",
"get_formatted_wwn",
"(",
"wwn_str",
")",
":",
"if",
"(",
"len",
"(",
"wwn_str",
")",
"!=",
"16",
")",
":",
"return",
"wwn_str",
".",
"lower",
"(",
")",
"else",
":",
"return",
"(",
"':'",
".",
"join",
"(",
"[",
"wwn_str",
"[",
"i",
":",
"i... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/zonemanager/utils.py#L67-L73 | ||
ailabx/ailabx | 4a8c701a3604bbc34157167224588041944ac1a2 | codes/qlib-main/qlib/workflow/online/utils.py | python | OnlineToolR.get_online_tag | (self, recorder: Recorder) | return tags.get(self.ONLINE_KEY, self.OFFLINE_TAG) | Given a model recorder and return its online tag.
Args:
recorder (Recorder): an instance of recorder
Returns:
str: the online tag | Given a model recorder and return its online tag. | [
"Given",
"a",
"model",
"recorder",
"and",
"return",
"its",
"online",
"tag",
"."
] | def get_online_tag(self, recorder: Recorder) -> str:
"""
Given a model recorder and return its online tag.
Args:
recorder (Recorder): an instance of recorder
Returns:
str: the online tag
"""
tags = recorder.list_tags()
return tags.get(sel... | [
"def",
"get_online_tag",
"(",
"self",
",",
"recorder",
":",
"Recorder",
")",
"->",
"str",
":",
"tags",
"=",
"recorder",
".",
"list_tags",
"(",
")",
"return",
"tags",
".",
"get",
"(",
"self",
".",
"ONLINE_KEY",
",",
"self",
".",
"OFFLINE_TAG",
")"
] | https://github.com/ailabx/ailabx/blob/4a8c701a3604bbc34157167224588041944ac1a2/codes/qlib-main/qlib/workflow/online/utils.py#L118-L129 | |
bruceyang2012/Face-detection-with-mobilenet-ssd | 58fafb6e93d28531797aac1e9a4436730c8cee7c | keras_ssd_loss.py | python | SSDLoss.compute_loss | (self, y_true, y_pred) | return total_loss | Compute the loss of the SSD model prediction against the ground truth.
Arguments:
y_true (array): A Numpy array of shape `(batch_size, #boxes, #classes + 8)`,
where `#boxes` is the total number of boxes that the model predicts
per image. Be careful to make sure that ... | Compute the loss of the SSD model prediction against the ground truth. | [
"Compute",
"the",
"loss",
"of",
"the",
"SSD",
"model",
"prediction",
"against",
"the",
"ground",
"truth",
"."
] | def compute_loss(self, y_true, y_pred):
'''
Compute the loss of the SSD model prediction against the ground truth.
Arguments:
y_true (array): A Numpy array of shape `(batch_size, #boxes, #classes + 8)`,
where `#boxes` is the total number of boxes that the model predi... | [
"def",
"compute_loss",
"(",
"self",
",",
"y_true",
",",
"y_pred",
")",
":",
"batch_size",
"=",
"tf",
".",
"shape",
"(",
"y_pred",
")",
"[",
"0",
"]",
"# Output dtype: tf.int32",
"n_boxes",
"=",
"tf",
".",
"shape",
"(",
"y_pred",
")",
"[",
"1",
"]",
"... | https://github.com/bruceyang2012/Face-detection-with-mobilenet-ssd/blob/58fafb6e93d28531797aac1e9a4436730c8cee7c/keras_ssd_loss.py#L101-L215 | |
getting-things-gnome/gtg | 4b02c43744b32a00facb98174f04ec5953bd055d | GTG/core/datastore.py | python | TaskSource.get_task_filter_for_backend | (self) | return lambda task: backend_filter(self.requester, task,
{"tags": set(attached_tags)}) | Filter that checks if the task should be stored in this backend.
@returns function: a function that accepts a task and returns
True/False whether the task should be stored or not | Filter that checks if the task should be stored in this backend. | [
"Filter",
"that",
"checks",
"if",
"the",
"task",
"should",
"be",
"stored",
"in",
"this",
"backend",
"."
] | def get_task_filter_for_backend(self):
"""
Filter that checks if the task should be stored in this backend.
@returns function: a function that accepts a task and returns
True/False whether the task should be stored or not
"""
def backend_filter(req, task, param... | [
"def",
"get_task_filter_for_backend",
"(",
"self",
")",
":",
"def",
"backend_filter",
"(",
"req",
",",
"task",
",",
"parameters",
")",
":",
"\"\"\"\n Filter that checks if two tags sets intersect. It is used to check\n if a task should be stored inside a backend... | https://github.com/getting-things-gnome/gtg/blob/4b02c43744b32a00facb98174f04ec5953bd055d/GTG/core/datastore.py#L699-L726 | |
kobiso/CBAM-keras | 796ae9ea31253d87f46ac4908e94ad5d799fbdd5 | models/.ipynb_checkpoints/mobilenets-checkpoint.py | python | _depthwise_conv_block | (inputs, pointwise_conv_filters, alpha,
depth_multiplier=1, strides=(1, 1), block_id=1, attention_module=None) | return x | Adds a depthwise convolution block.
A depthwise convolution block consists of a depthwise conv,
batch normalization, relu6, pointwise convolution,
batch normalization and relu6 activation.
# Arguments
inputs: Input tensor of shape `(rows, cols, channels)`
(with `channels_last` data f... | Adds a depthwise convolution block.
A depthwise convolution block consists of a depthwise conv,
batch normalization, relu6, pointwise convolution,
batch normalization and relu6 activation.
# Arguments
inputs: Input tensor of shape `(rows, cols, channels)`
(with `channels_last` data f... | [
"Adds",
"a",
"depthwise",
"convolution",
"block",
".",
"A",
"depthwise",
"convolution",
"block",
"consists",
"of",
"a",
"depthwise",
"conv",
"batch",
"normalization",
"relu6",
"pointwise",
"convolution",
"batch",
"normalization",
"and",
"relu6",
"activation",
".",
... | def _depthwise_conv_block(inputs, pointwise_conv_filters, alpha,
depth_multiplier=1, strides=(1, 1), block_id=1, attention_module=None):
"""Adds a depthwise convolution block.
A depthwise convolution block consists of a depthwise conv,
batch normalization, relu6, pointwise convolut... | [
"def",
"_depthwise_conv_block",
"(",
"inputs",
",",
"pointwise_conv_filters",
",",
"alpha",
",",
"depth_multiplier",
"=",
"1",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
",",
"block_id",
"=",
"1",
",",
"attention_module",
"=",
"None",
")",
":",
"channel... | https://github.com/kobiso/CBAM-keras/blob/796ae9ea31253d87f46ac4908e94ad5d799fbdd5/models/.ipynb_checkpoints/mobilenets-checkpoint.py#L477-L546 | |
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | infoxlm/fairseq/fairseq/progress_bar.py | python | simple_progress_bar.print | (self, stats, tag='', step=None) | Print end-of-epoch stats. | Print end-of-epoch stats. | [
"Print",
"end",
"-",
"of",
"-",
"epoch",
"stats",
"."
] | def print(self, stats, tag='', step=None):
"""Print end-of-epoch stats."""
postfix = self._str_pipes(self._format_stats(stats))
print('{} | {}'.format(self.prefix, postfix), flush=True) | [
"def",
"print",
"(",
"self",
",",
"stats",
",",
"tag",
"=",
"''",
",",
"step",
"=",
"None",
")",
":",
"postfix",
"=",
"self",
".",
"_str_pipes",
"(",
"self",
".",
"_format_stats",
"(",
"stats",
")",
")",
"print",
"(",
"'{} | {}'",
".",
"format",
"(... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/fairseq/progress_bar.py#L194-L197 | ||
Yelp/mrjob | 091572e87bc24cc64be40278dd0f5c3617c98d4b | mrjob/emr.py | python | EMRJobRunner.get_cluster_id | (self) | return self._cluster_id | Get the ID of the cluster our job is running on, or ``None``. | Get the ID of the cluster our job is running on, or ``None``. | [
"Get",
"the",
"ID",
"of",
"the",
"cluster",
"our",
"job",
"is",
"running",
"on",
"or",
"None",
"."
] | def get_cluster_id(self):
"""Get the ID of the cluster our job is running on, or ``None``."""
return self._cluster_id | [
"def",
"get_cluster_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cluster_id"
] | https://github.com/Yelp/mrjob/blob/091572e87bc24cc64be40278dd0f5c3617c98d4b/mrjob/emr.py#L2388-L2390 | |
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | contrib/paramiko/paramiko/transport.py | python | Transport.open_channel | (self,
kind,
dest_addr=None,
src_addr=None,
window_size=None,
max_packet_size=None,
timeout=None) | Request a new channel to the server. `Channels <.Channel>` are
socket-like objects used for the actual transfer of data across the
session. You may only request a channel after negotiating encryption
(using `connect` or `start_client`) and authenticating.
.. note:: Modifying the the win... | Request a new channel to the server. `Channels <.Channel>` are
socket-like objects used for the actual transfer of data across the
session. You may only request a channel after negotiating encryption
(using `connect` or `start_client`) and authenticating. | [
"Request",
"a",
"new",
"channel",
"to",
"the",
"server",
".",
"Channels",
"<",
".",
"Channel",
">",
"are",
"socket",
"-",
"like",
"objects",
"used",
"for",
"the",
"actual",
"transfer",
"of",
"data",
"across",
"the",
"session",
".",
"You",
"may",
"only",
... | def open_channel(self,
kind,
dest_addr=None,
src_addr=None,
window_size=None,
max_packet_size=None,
timeout=None):
"""
Request a new channel to the server. `Channels <.Channel>` ... | [
"def",
"open_channel",
"(",
"self",
",",
"kind",
",",
"dest_addr",
"=",
"None",
",",
"src_addr",
"=",
"None",
",",
"window_size",
"=",
"None",
",",
"max_packet_size",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"active... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/contrib/paramiko/paramiko/transport.py#L746-L836 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppTaskQueue/appscale/taskqueue/queue.py | python | PostgresPullQueue.get_task | (self, task, omit_payload=False) | return self._task_from_row(columns, row, id=task.id) | Gets a task from the queue.
Args:
task: A Task object.
omit_payload: A boolean indicating that the payload should not be
fetched.
Returns:
A task object or None. | Gets a task from the queue. | [
"Gets",
"a",
"task",
"from",
"the",
"queue",
"."
] | def get_task(self, task, omit_payload=False):
""" Gets a task from the queue.
Args:
task: A Task object.
omit_payload: A boolean indicating that the payload should not be
fetched.
Returns:
A task object or None.
"""
if omit_payload:
columns = ['task_name', 'time_enqu... | [
"def",
"get_task",
"(",
"self",
",",
"task",
",",
"omit_payload",
"=",
"False",
")",
":",
"if",
"omit_payload",
":",
"columns",
"=",
"[",
"'task_name'",
",",
"'time_enqueued'",
",",
"'lease_expires'",
",",
"'lease_count'",
",",
"'tag'",
"]",
"else",
":",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppTaskQueue/appscale/taskqueue/queue.py#L313-L345 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/tools/proxywin.py | python | ProxiedRequests.reload_options | (self) | Reload options.
1. Stop proxy
2. Try to start proxy with new params
3. If can't => alert
4. If everything is ok then start proxy
5. Set Trap options
6. Save options | Reload options.
1. Stop proxy
2. Try to start proxy with new params
3. If can't => alert
4. If everything is ok then start proxy
5. Set Trap options
6. Save options | [
"Reload",
"options",
".",
"1",
".",
"Stop",
"proxy",
"2",
".",
"Try",
"to",
"start",
"proxy",
"with",
"new",
"params",
"3",
".",
"If",
"can",
"t",
"=",
">",
"alert",
"4",
".",
"If",
"everything",
"is",
"ok",
"then",
"start",
"proxy",
"5",
".",
"S... | def reload_options(self):
"""Reload options.
1. Stop proxy
2. Try to start proxy with new params
3. If can't => alert
4. If everything is ok then start proxy
5. Set Trap options
6. Save options
"""
new_port = self.pref.get_v... | [
"def",
"reload_options",
"(",
"self",
")",
":",
"new_port",
"=",
"self",
".",
"pref",
".",
"get_value",
"(",
"'proxy'",
",",
"'ipport'",
")",
"if",
"new_port",
"!=",
"self",
".",
"_prev_ip_port",
":",
"self",
".",
"w3af",
".",
"mainwin",
".",
"sb",
"("... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/tools/proxywin.py#L238-L291 | ||
mathics/Mathics | 318e06dea8f1c70758a50cb2f95c9900150e3a68 | mathics/builtin/structure.py | python | Apply.apply_invalidlevel | (self, f, expr, ls, evaluation, options={}) | Apply[f_, expr_, ls_, OptionsPattern[Apply]] | Apply[f_, expr_, ls_, OptionsPattern[Apply]] | [
"Apply",
"[",
"f_",
"expr_",
"ls_",
"OptionsPattern",
"[",
"Apply",
"]]"
] | def apply_invalidlevel(self, f, expr, ls, evaluation, options={}):
"Apply[f_, expr_, ls_, OptionsPattern[Apply]]"
evaluation.message("Apply", "level", ls) | [
"def",
"apply_invalidlevel",
"(",
"self",
",",
"f",
",",
"expr",
",",
"ls",
",",
"evaluation",
",",
"options",
"=",
"{",
"}",
")",
":",
"evaluation",
".",
"message",
"(",
"\"Apply\"",
",",
"\"level\"",
",",
"ls",
")"
] | https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/builtin/structure.py#L434-L437 | ||
Trusted-AI/adversarial-robustness-toolbox | 9fabffdbb92947efa1ecc5d825d634d30dfbaf29 | art/attacks/evasion/pe_malware_attack.py | python | MalwareGDTensorFlow.check_valid_size | (
self,
y: np.ndarray,
sample_sizes: np.ndarray,
append_perturbation_size: np.ndarray,
) | return adv_label_vector | Checks that we can append the l0 perturbation to the malware sample and not exceed the
maximum file size. A new label vector with just the valid files indicated is created.
:param y: Labels.
:param sample_sizes: The size of the original file, before it was padded to the input size required by M... | Checks that we can append the l0 perturbation to the malware sample and not exceed the
maximum file size. A new label vector with just the valid files indicated is created. | [
"Checks",
"that",
"we",
"can",
"append",
"the",
"l0",
"perturbation",
"to",
"the",
"malware",
"sample",
"and",
"not",
"exceed",
"the",
"maximum",
"file",
"size",
".",
"A",
"new",
"label",
"vector",
"with",
"just",
"the",
"valid",
"files",
"indicated",
"is"... | def check_valid_size(
self,
y: np.ndarray,
sample_sizes: np.ndarray,
append_perturbation_size: np.ndarray,
) -> np.ndarray:
"""
Checks that we can append the l0 perturbation to the malware sample and not exceed the
maximum file size. A new label vector with ju... | [
"def",
"check_valid_size",
"(",
"self",
",",
"y",
":",
"np",
".",
"ndarray",
",",
"sample_sizes",
":",
"np",
".",
"ndarray",
",",
"append_perturbation_size",
":",
"np",
".",
"ndarray",
",",
")",
"->",
"np",
".",
"ndarray",
":",
"adv_label_vector",
"=",
"... | https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/9fabffdbb92947efa1ecc5d825d634d30dfbaf29/art/attacks/evasion/pe_malware_attack.py#L170-L194 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/importlib/metadata/__init__.py | python | distributions | (**kwargs) | return Distribution.discover(**kwargs) | Get all ``Distribution`` instances in the current environment.
:return: An iterable of ``Distribution`` instances. | Get all ``Distribution`` instances in the current environment. | [
"Get",
"all",
"Distribution",
"instances",
"in",
"the",
"current",
"environment",
"."
] | def distributions(**kwargs):
"""Get all ``Distribution`` instances in the current environment.
:return: An iterable of ``Distribution`` instances.
"""
return Distribution.discover(**kwargs) | [
"def",
"distributions",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"Distribution",
".",
"discover",
"(",
"*",
"*",
"kwargs",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/importlib/metadata/__init__.py#L956-L961 | |
nitishsrivastava/deepnet | f4e4ff207923e01552c96038a1e2c29eb5d16160 | eigenmat/eigenmat.py | python | EigenMatrix.overwrite | (self, array) | Overwrites self with array.
'array' should have a size smaller than that of the array used to
initialize the EigenMatrix. The method will not throw an Exception just
yet if this is not true. It will throw exceptions or behave in strange
ways later on. | Overwrites self with array.
'array' should have a size smaller than that of the array used to
initialize the EigenMatrix. The method will not throw an Exception just
yet if this is not true. It will throw exceptions or behave in strange
ways later on. | [
"Overwrites",
"self",
"with",
"array",
".",
"array",
"should",
"have",
"a",
"size",
"smaller",
"than",
"that",
"of",
"the",
"array",
"used",
"to",
"initialize",
"the",
"EigenMatrix",
".",
"The",
"method",
"will",
"not",
"throw",
"an",
"Exception",
"just",
... | def overwrite(self, array):
"""Overwrites self with array.
'array' should have a size smaller than that of the array used to
initialize the EigenMatrix. The method will not throw an Exception just
yet if this is not true. It will throw exceptions or behave in strange
ways later on.
"""
... | [
"def",
"overwrite",
"(",
"self",
",",
"array",
")",
":",
"assert",
"type",
"(",
"array",
")",
"==",
"np",
".",
"ndarray",
",",
"'array must be a np.ndarray.'",
"array",
"=",
"reformat",
"(",
"array",
")",
"self",
".",
"numpy_array",
"=",
"array",
"_eigenma... | https://github.com/nitishsrivastava/deepnet/blob/f4e4ff207923e01552c96038a1e2c29eb5d16160/eigenmat/eigenmat.py#L88-L99 | ||
XUSean0118/DVSNet | 2b67d991ca13de0a1210fbfbab4ad68f8c2f193a | inference.py | python | get_arguments | () | return parser.parse_args() | Parse all the arguments provided from the CLI.
Returns:
A list of parsed arguments. | Parse all the arguments provided from the CLI.
Returns:
A list of parsed arguments. | [
"Parse",
"all",
"the",
"arguments",
"provided",
"from",
"the",
"CLI",
".",
"Returns",
":",
"A",
"list",
"of",
"parsed",
"arguments",
"."
] | def get_arguments():
"""Parse all the arguments provided from the CLI.
Returns:
A list of parsed arguments.
"""
parser = argparse.ArgumentParser(description="Dynamic Video Segmentation Network")
parser.add_argument("--data_dir", type=str, default=DATA_DIRECTORY,
he... | [
"def",
"get_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Dynamic Video Segmentation Network\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--data_dir\"",
",",
"type",
"=",
"str",
",",
"default",
"=",
"... | https://github.com/XUSean0118/DVSNet/blob/2b67d991ca13de0a1210fbfbab4ad68f8c2f193a/inference.py#L29-L54 | |
pallets/werkzeug | 9efe8c00dcb2b6fc086961ba304729db01912652 | src/werkzeug/datastructures.py | python | MultiDict.getlist | (self, key, type=None) | return result | Return the list of items for a given key. If that key is not in the
`MultiDict`, the return value will be an empty list. Just like `get`,
`getlist` accepts a `type` parameter. All items will be converted
with the callable defined there.
:param key: The key to be looked up.
:pa... | Return the list of items for a given key. If that key is not in the
`MultiDict`, the return value will be an empty list. Just like `get`,
`getlist` accepts a `type` parameter. All items will be converted
with the callable defined there. | [
"Return",
"the",
"list",
"of",
"items",
"for",
"a",
"given",
"key",
".",
"If",
"that",
"key",
"is",
"not",
"in",
"the",
"MultiDict",
"the",
"return",
"value",
"will",
"be",
"an",
"empty",
"list",
".",
"Just",
"like",
"get",
"getlist",
"accepts",
"a",
... | def getlist(self, key, type=None):
"""Return the list of items for a given key. If that key is not in the
`MultiDict`, the return value will be an empty list. Just like `get`,
`getlist` accepts a `type` parameter. All items will be converted
with the callable defined there.
:p... | [
"def",
"getlist",
"(",
"self",
",",
"key",
",",
"type",
"=",
"None",
")",
":",
"try",
":",
"rv",
"=",
"dict",
".",
"__getitem__",
"(",
"self",
",",
"key",
")",
"except",
"KeyError",
":",
"return",
"[",
"]",
"if",
"type",
"is",
"None",
":",
"retur... | https://github.com/pallets/werkzeug/blob/9efe8c00dcb2b6fc086961ba304729db01912652/src/werkzeug/datastructures.py#L395-L419 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/lfads/synth_data/synthetic_data_utils.py | python | spikify_data | (data_e, rng, dt=1.0, max_firing_rate=100) | return spikes_e | Apply spikes to a continuous dataset whose values are between 0.0 and 1.0
Args:
data_e: nexamples length list of NxT trials
dt: how often the data are sampled
max_firing_rate: the firing rate that is associated with a value of 1.0
Returns:
spikified_e: a list of length b of the data represented as s... | Apply spikes to a continuous dataset whose values are between 0.0 and 1.0
Args:
data_e: nexamples length list of NxT trials
dt: how often the data are sampled
max_firing_rate: the firing rate that is associated with a value of 1.0
Returns:
spikified_e: a list of length b of the data represented as s... | [
"Apply",
"spikes",
"to",
"a",
"continuous",
"dataset",
"whose",
"values",
"are",
"between",
"0",
".",
"0",
"and",
"1",
".",
"0",
"Args",
":",
"data_e",
":",
"nexamples",
"length",
"list",
"of",
"NxT",
"trials",
"dt",
":",
"how",
"often",
"the",
"data",... | def spikify_data(data_e, rng, dt=1.0, max_firing_rate=100):
""" Apply spikes to a continuous dataset whose values are between 0.0 and 1.0
Args:
data_e: nexamples length list of NxT trials
dt: how often the data are sampled
max_firing_rate: the firing rate that is associated with a value of 1.0
Returns... | [
"def",
"spikify_data",
"(",
"data_e",
",",
"rng",
",",
"dt",
"=",
"1.0",
",",
"max_firing_rate",
"=",
"100",
")",
":",
"E",
"=",
"len",
"(",
"data_e",
")",
"spikes_e",
"=",
"[",
"]",
"for",
"e",
"in",
"range",
"(",
"E",
")",
":",
"data",
"=",
"... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/lfads/synth_data/synthetic_data_utils.py#L128-L151 | |
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/sqlalchemy/orm/strategy_options.py | python | subqueryload | (loadopt, attr) | return loadopt.set_relationship_strategy(attr, {"lazy": "subquery"}) | Indicate that the given attribute should be loaded using
subquery eager loading.
This function is part of the :class:`.Load` interface and supports
both method-chained and standalone operation.
examples::
# subquery-load the "orders" collection on "User"
query(User).options(subquerylo... | Indicate that the given attribute should be loaded using
subquery eager loading. | [
"Indicate",
"that",
"the",
"given",
"attribute",
"should",
"be",
"loaded",
"using",
"subquery",
"eager",
"loading",
"."
] | def subqueryload(loadopt, attr):
"""Indicate that the given attribute should be loaded using
subquery eager loading.
This function is part of the :class:`.Load` interface and supports
both method-chained and standalone operation.
examples::
# subquery-load the "orders" collection on "User... | [
"def",
"subqueryload",
"(",
"loadopt",
",",
"attr",
")",
":",
"return",
"loadopt",
".",
"set_relationship_strategy",
"(",
"attr",
",",
"{",
"\"lazy\"",
":",
"\"subquery\"",
"}",
")"
] | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/orm/strategy_options.py#L770-L801 | |
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/calculators/base.py | python | create_gmf_data | (dstore, prim_imts, sec_imts=(), data=None) | Create and possibly populate the datasets in the gmf_data group | Create and possibly populate the datasets in the gmf_data group | [
"Create",
"and",
"possibly",
"populate",
"the",
"datasets",
"in",
"the",
"gmf_data",
"group"
] | def create_gmf_data(dstore, prim_imts, sec_imts=(), data=None):
"""
Create and possibly populate the datasets in the gmf_data group
"""
oq = dstore['oqparam']
R = dstore['full_lt'].get_num_rlzs()
M = len(prim_imts)
n = 0 if data is None else len(data['sid'])
items = [('sid', U32 if n == ... | [
"def",
"create_gmf_data",
"(",
"dstore",
",",
"prim_imts",
",",
"sec_imts",
"=",
"(",
")",
",",
"data",
"=",
"None",
")",
":",
"oq",
"=",
"dstore",
"[",
"'oqparam'",
"]",
"R",
"=",
"dstore",
"[",
"'full_lt'",
"]",
".",
"get_num_rlzs",
"(",
")",
"M",
... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/calculators/base.py#L1141-L1171 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/ipaddress.py | python | _BaseNetwork.hostmask | (self) | return x | [] | def hostmask(self):
x = self._cache.get('hostmask')
if x is None:
x = self._address_class(int(self.netmask) ^ self._ALL_ONES)
self._cache['hostmask'] = x
return x | [
"def",
"hostmask",
"(",
"self",
")",
":",
"x",
"=",
"self",
".",
"_cache",
".",
"get",
"(",
"'hostmask'",
")",
"if",
"x",
"is",
"None",
":",
"x",
"=",
"self",
".",
"_address_class",
"(",
"int",
"(",
"self",
".",
"netmask",
")",
"^",
"self",
".",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/ipaddress.py#L826-L831 | |||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/base.py | python | DropboxBase.sharing_create_shared_link | (self,
path,
short_url=False,
pending_upload=None) | return r | Create a shared link. If a shared link already exists for the given
path, that link is returned. Previously, it was technically possible to
break a shared link by moving or renaming the corresponding file or
folder. In the future, this will no longer be the case, so your app
shouldn't re... | Create a shared link. If a shared link already exists for the given
path, that link is returned. Previously, it was technically possible to
break a shared link by moving or renaming the corresponding file or
folder. In the future, this will no longer be the case, so your app
shouldn't re... | [
"Create",
"a",
"shared",
"link",
".",
"If",
"a",
"shared",
"link",
"already",
"exists",
"for",
"the",
"given",
"path",
"that",
"link",
"is",
"returned",
".",
"Previously",
"it",
"was",
"technically",
"possible",
"to",
"break",
"a",
"shared",
"link",
"by",
... | def sharing_create_shared_link(self,
path,
short_url=False,
pending_upload=None):
"""
Create a shared link. If a shared link already exists for the given
path, that link is returned. Previous... | [
"def",
"sharing_create_shared_link",
"(",
"self",
",",
"path",
",",
"short_url",
"=",
"False",
",",
"pending_upload",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"'create_shared_link is deprecated. Use create_shared_link_with_settings.'",
",",
"DeprecationWarning... | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/base.py#L4071-L4109 | |
cisco/mindmeld | 809c36112e9ea8019fe29d54d136ca14eb4fd8db | mindmeld/system_entity_recognizer.py | python | SystemEntityRecognizer.load_from_app_path | (app_path) | If the application configuration is empty, we do not use Duckling.
Otherwise, we return the Duckling recognizer with the URL defined in the application's
config, default to the DEFAULT_DUCKLING_URL.
Args:
app_path (str): Application path
Returns:
(SystemEnt... | If the application configuration is empty, we do not use Duckling. | [
"If",
"the",
"application",
"configuration",
"is",
"empty",
"we",
"do",
"not",
"use",
"Duckling",
"."
] | def load_from_app_path(app_path):
"""If the application configuration is empty, we do not use Duckling.
Otherwise, we return the Duckling recognizer with the URL defined in the application's
config, default to the DEFAULT_DUCKLING_URL.
Args:
app_path (str): Application ... | [
"def",
"load_from_app_path",
"(",
"app_path",
")",
":",
"if",
"not",
"app_path",
":",
"raise",
"SystemEntityError",
"(",
"\"App path must be valid to load entity recognizer config.\"",
")",
"if",
"is_duckling_configured",
"(",
"app_path",
")",
":",
"url",
"=",
"get_syst... | https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/system_entity_recognizer.py#L118-L139 | ||
Delta-ML/delta | 31dfebc8f20b7cb282b62f291ff25a87e403cc86 | delta/utils/solver/utils/callbacks.py | python | ParallelModelCheckpoint.__init__ | (self,
model,
filepath,
monitor='val_loss',
verbose=0,
save_best_only=False,
save_weights_only=False,
mode='auto',
save_freq='epoch',
load_weights_on_restart=False,
perio... | [] | def __init__(self,
model,
filepath,
monitor='val_loss',
verbose=0,
save_best_only=False,
save_weights_only=False,
mode='auto',
save_freq='epoch',
load_weights_on_restart=False,
... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"filepath",
",",
"monitor",
"=",
"'val_loss'",
",",
"verbose",
"=",
"0",
",",
"save_best_only",
"=",
"False",
",",
"save_weights_only",
"=",
"False",
",",
"mode",
"=",
"'auto'",
",",
"save_freq",
"=",
"'... | https://github.com/Delta-ML/delta/blob/31dfebc8f20b7cb282b62f291ff25a87e403cc86/delta/utils/solver/utils/callbacks.py#L160-L181 | ||||
vmware/vsphere-automation-sdk-python | ba7d4e0742f58a641dfed9538ecbbb1db4f3891e | samples/vmc/draas/site_recovery_activation_ops.py | python | SiteRecoveryActivationOperations.deactivate_srm | (self) | [] | def deactivate_srm(self):
if self.cleanup:
try:
srm_deactivation_task = self.vmc_client.draas.SiteRecovery.delete(self.org_id,
self.sddc_id,
... | [
"def",
"deactivate_srm",
"(",
"self",
")",
":",
"if",
"self",
".",
"cleanup",
":",
"try",
":",
"srm_deactivation_task",
"=",
"self",
".",
"vmc_client",
".",
"draas",
".",
"SiteRecovery",
".",
"delete",
"(",
"self",
".",
"org_id",
",",
"self",
".",
"sddc_... | https://github.com/vmware/vsphere-automation-sdk-python/blob/ba7d4e0742f58a641dfed9538ecbbb1db4f3891e/samples/vmc/draas/site_recovery_activation_ops.py#L81-L95 | ||||
chainer/chainer-chemistry | efe323aa21f63a815130d673781e7cca1ccb72d2 | chainer_chemistry/dataset/networkx_preprocessors/reddit_coo.py | python | get_reddit_coo_data | (dirpath) | return PaddingGraphData(
x=reddit_data['feature'].astype(numpy.float32),
adj=adj,
y=reddit_data['label'].astype(numpy.int32),
label_num=41
) | Temporary function to obtain reddit coo data for GIN
(because it takes to much time to convert it to networkx)
Returns:
PaddingGraphData: `PaddingGraphData` of reddit | Temporary function to obtain reddit coo data for GIN | [
"Temporary",
"function",
"to",
"obtain",
"reddit",
"coo",
"data",
"for",
"GIN"
] | def get_reddit_coo_data(dirpath):
"""Temporary function to obtain reddit coo data for GIN
(because it takes to much time to convert it to networkx)
Returns:
PaddingGraphData: `PaddingGraphData` of reddit
"""
print("Loading node feature and label")
reddit_data = numpy.load(os.path.join... | [
"def",
"get_reddit_coo_data",
"(",
"dirpath",
")",
":",
"print",
"(",
"\"Loading node feature and label\"",
")",
"reddit_data",
"=",
"numpy",
".",
"load",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirpath",
",",
"\"reddit_data.npz\"",
")",
")",
"print",
"(",
... | https://github.com/chainer/chainer-chemistry/blob/efe323aa21f63a815130d673781e7cca1ccb72d2/chainer_chemistry/dataset/networkx_preprocessors/reddit_coo.py#L11-L46 | |
Symbo1/wsltools | 0b6e536fc85c707a1c81f0296c4e91ca835396a1 | wsltools/utils/faker/providers/address/fr_FR/__init__.py | python | Provider.street_prefix | (self) | return self.random_element(self.street_prefixes) | :example 'rue' | :example 'rue' | [
":",
"example",
"rue"
] | def street_prefix(self):
"""
:example 'rue'
"""
return self.random_element(self.street_prefixes) | [
"def",
"street_prefix",
"(",
"self",
")",
":",
"return",
"self",
".",
"random_element",
"(",
"self",
".",
"street_prefixes",
")"
] | https://github.com/Symbo1/wsltools/blob/0b6e536fc85c707a1c81f0296c4e91ca835396a1/wsltools/utils/faker/providers/address/fr_FR/__init__.py#L141-L145 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/numpy/ma/core.py | python | asanyarray | (a, dtype=None) | return masked_array(a, dtype=dtype, copy=False, keep_mask=True, subok=True) | Convert the input to a masked array, conserving subclasses.
If `a` is a subclass of `MaskedArray`, its class is conserved.
No copy is performed if the input is already an `ndarray`.
Parameters
----------
a : array_like
Input data, in any form that can be converted to an array.
dtype : ... | Convert the input to a masked array, conserving subclasses. | [
"Convert",
"the",
"input",
"to",
"a",
"masked",
"array",
"conserving",
"subclasses",
"."
] | def asanyarray(a, dtype=None):
"""
Convert the input to a masked array, conserving subclasses.
If `a` is a subclass of `MaskedArray`, its class is conserved.
No copy is performed if the input is already an `ndarray`.
Parameters
----------
a : array_like
Input data, in any form that... | [
"def",
"asanyarray",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"masked_array",
"(",
"a",
",",
"dtype",
"=",
"dtype",
",",
"copy",
"=",
"False",
",",
"keep_mask",
"=",
"True",
",",
"subok",
"=",
"True",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/numpy/ma/core.py#L7566-L7609 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/mailbox.py | python | MH.get_message | (self, key) | return msg | Return a Message representation or raise a KeyError. | Return a Message representation or raise a KeyError. | [
"Return",
"a",
"Message",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
try:
if self._locked:
f = open(os.path.join(self._path, str(key)), 'r+')
else:
f = open(os.path.join(self._path, str(key)), 'r')
except IOError, e:
... | [
"def",
"get_message",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"if",
"self",
".",
"_locked",
":",
"f",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"str",
"(",
"key",
")",
")",
",",
"'r+'",
")",
"els... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/mailbox.py#L1004-L1029 | |
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | plugin.video.torrent.gnu/resources/lib/torr2xbmc.py | python | stream | (params) | [] | def stream (params):
torr_link='f4a94963c11a47f213b145697f494b5fc5485b02'
TSplayer=tsengine()
out=TSplayer.load_torrent(torr_link,'INFOHASH',port=aceport)
if out=='Ok':
TSplayer.play_url_ind(0,'stream',None)
TSplayer.end() | [
"def",
"stream",
"(",
"params",
")",
":",
"torr_link",
"=",
"'f4a94963c11a47f213b145697f494b5fc5485b02'",
"TSplayer",
"=",
"tsengine",
"(",
")",
"out",
"=",
"TSplayer",
".",
"load_torrent",
"(",
"torr_link",
",",
"'INFOHASH'",
",",
"port",
"=",
"aceport",
")",
... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.torrent.gnu/resources/lib/torr2xbmc.py#L112-L118 | ||||
plaid/plaid-python | 8c60fca608e426f3ff30da8857775946d29e122c | plaid/model/payment_initiation_optional_restriction_bacs.py | python | PaymentInitiationOptionalRestrictionBacs.openapi_types | () | return {
'account': (str,), # noqa: E501
'sort_code': (str,), # noqa: E501
} | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type. | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | [
"This",
"must",
"be",
"a",
"method",
"because",
"a",
"model",
"may",
"have",
"properties",
"that",
"are",
"of",
"type",
"self",
"this",
"must",
"run",
"after",
"the",
"class",
"is",
"loaded"
] | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy... | [
"def",
"openapi_types",
"(",
")",
":",
"lazy_import",
"(",
")",
"return",
"{",
"'account'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'sort_code'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"}"
] | https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/payment_initiation_optional_restriction_bacs.py#L82-L95 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/utils/feedgenerator.py | python | SyndicationFeed.root_attributes | (self) | return {} | Return extra attributes to place on the root (i.e. feed/channel) element.
Called from write(). | Return extra attributes to place on the root (i.e. feed/channel) element.
Called from write(). | [
"Return",
"extra",
"attributes",
"to",
"place",
"on",
"the",
"root",
"(",
"i",
".",
"e",
".",
"feed",
"/",
"channel",
")",
"element",
".",
"Called",
"from",
"write",
"()",
"."
] | def root_attributes(self):
"""
Return extra attributes to place on the root (i.e. feed/channel) element.
Called from write().
"""
return {} | [
"def",
"root_attributes",
"(",
"self",
")",
":",
"return",
"{",
"}"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/utils/feedgenerator.py#L170-L175 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 87