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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/Genomics.py | python | CalculatePairIndices | (seq1, seq2, gap_char="-", with_codons=False) | return result | returns number of idential and transitions/transversions substitutions
in the alignment.
If with-codons = True, synonymous and nonsynonymous changes will
be recorded as well. The routine assumes no frame-shifts and will
count more than one change as non-synonymous. | returns number of idential and transitions/transversions substitutions
in the alignment. | [
"returns",
"number",
"of",
"idential",
"and",
"transitions",
"/",
"transversions",
"substitutions",
"in",
"the",
"alignment",
"."
] | def CalculatePairIndices(seq1, seq2, gap_char="-", with_codons=False):
"""returns number of idential and transitions/transversions substitutions
in the alignment.
If with-codons = True, synonymous and nonsynonymous changes will
be recorded as well. The routine assumes no frame-shifts and will
count... | [
"def",
"CalculatePairIndices",
"(",
"seq1",
",",
"seq2",
",",
"gap_char",
"=",
"\"-\"",
",",
"with_codons",
"=",
"False",
")",
":",
"alphabet",
"=",
"\"ACGT\"",
"+",
"gap_char",
"map_char2pos",
"=",
"{",
"}",
"for",
"x",
"in",
"alphabet",
":",
"map_char2po... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/Genomics.py#L1478-L1542 | |
hongyuanmei/neurawkes | 808d3ec28c3aebd907c63616e133acd52380246f | run_models.py | python | test_neural_hawkes_ctsm_and_save_time | (input_test) | this function is called to test neural hawkes ctsm with time encoder | this function is called to test neural hawkes ctsm with time encoder | [
"this",
"function",
"is",
"called",
"to",
"test",
"neural",
"hawkes",
"ctsm",
"with",
"time",
"encoder"
] | def test_neural_hawkes_ctsm_and_save_time(input_test):
'''
this function is called to test neural hawkes ctsm with time encoder
'''
#TODO: pre-settings like random states
numpy.random.seed(
input_test['seed_random']
)
#
log_dict = {
'log_file': None,
'save_file_pa... | [
"def",
"test_neural_hawkes_ctsm_and_save_time",
"(",
"input_test",
")",
":",
"#TODO: pre-settings like random states",
"numpy",
".",
"random",
".",
"seed",
"(",
"input_test",
"[",
"'seed_random'",
"]",
")",
"#",
"log_dict",
"=",
"{",
"'log_file'",
":",
"None",
",",
... | https://github.com/hongyuanmei/neurawkes/blob/808d3ec28c3aebd907c63616e133acd52380246f/run_models.py#L3473-L3680 | ||
SCons/scons | 309f0234d1d9cc76955818be47c5c722f577dac6 | SCons/Tool/ninja/Methods.py | python | get_command | (env, node, action) | return ninja_build | Get the command to execute for node. | Get the command to execute for node. | [
"Get",
"the",
"command",
"to",
"execute",
"for",
"node",
"."
] | def get_command(env, node, action): # pylint: disable=too-many-branches
"""Get the command to execute for node."""
if node.env:
sub_env = node.env
else:
sub_env = env
executor = node.get_executor()
tlist, slist = get_targets_sources(node)
# Generate a real CommandAction
if ... | [
"def",
"get_command",
"(",
"env",
",",
"node",
",",
"action",
")",
":",
"# pylint: disable=too-many-branches",
"if",
"node",
".",
"env",
":",
"sub_env",
"=",
"node",
".",
"env",
"else",
":",
"sub_env",
"=",
"env",
"executor",
"=",
"node",
".",
"get_executo... | https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Tool/ninja/Methods.py#L121-L213 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/stats/_stats_py.py | python | tmin | (a, lowerlimit=None, axis=0, inclusive=True, nan_policy='propagate') | return res | Compute the trimmed minimum.
This function finds the miminum value of an array `a` along the
specified axis, but only considering values greater than a specified
lower limit.
Parameters
----------
a : array_like
Array of values.
lowerlimit : None or float, optional
Values i... | Compute the trimmed minimum. | [
"Compute",
"the",
"trimmed",
"minimum",
"."
] | def tmin(a, lowerlimit=None, axis=0, inclusive=True, nan_policy='propagate'):
"""Compute the trimmed minimum.
This function finds the miminum value of an array `a` along the
specified axis, but only considering values greater than a specified
lower limit.
Parameters
----------
a : array_li... | [
"def",
"tmin",
"(",
"a",
",",
"lowerlimit",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"inclusive",
"=",
"True",
",",
"nan_policy",
"=",
"'propagate'",
")",
":",
"a",
",",
"axis",
"=",
"_chk_asarray",
"(",
"a",
",",
"axis",
")",
"am",
"=",
"_mask_to_... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_stats_py.py#L621-L680 | |
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/scapy/arch/windows/__init__.py | python | NetworkInterface_Win.setmonitor | (self, enable=True) | return tmp if enable else (not tmp) | Alias for setmode('monitor') or setmode('managed')
Only available with Npcap | Alias for setmode('monitor') or setmode('managed')
Only available with Npcap | [
"Alias",
"for",
"setmode",
"(",
"monitor",
")",
"or",
"setmode",
"(",
"managed",
")",
"Only",
"available",
"with",
"Npcap"
] | def setmonitor(self, enable=True):
"""Alias for setmode('monitor') or setmode('managed')
Only available with Npcap"""
# We must reset the monitor cache
if enable:
res = self.setmode('monitor')
else:
res = self.setmode('managed')
if not res:
... | [
"def",
"setmonitor",
"(",
"self",
",",
"enable",
"=",
"True",
")",
":",
"# We must reset the monitor cache",
"if",
"enable",
":",
"res",
"=",
"self",
".",
"setmode",
"(",
"'monitor'",
")",
"else",
":",
"res",
"=",
"self",
".",
"setmode",
"(",
"'managed'",
... | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/scapy/arch/windows/__init__.py#L383-L395 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distro.py | python | LinuxDistribution.distro_release_attr | (self, attribute) | return self._distro_release_info.get(attribute, '') | Return a single named information item from the distro release file
data source of the OS distribution.
For details, see :func:`distro.distro_release_attr`. | Return a single named information item from the distro release file
data source of the OS distribution. | [
"Return",
"a",
"single",
"named",
"information",
"item",
"from",
"the",
"distro",
"release",
"file",
"data",
"source",
"of",
"the",
"OS",
"distribution",
"."
] | def distro_release_attr(self, attribute):
"""
Return a single named information item from the distro release file
data source of the OS distribution.
For details, see :func:`distro.distro_release_attr`.
"""
return self._distro_release_info.get(attribute, '') | [
"def",
"distro_release_attr",
"(",
"self",
",",
"attribute",
")",
":",
"return",
"self",
".",
"_distro_release_info",
".",
"get",
"(",
"attribute",
",",
"''",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distro.py#L901-L908 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/Django/django/contrib/gis/geos/geometry.py | python | GEOSGeometry.transform | (self, ct, clone=False) | Requires GDAL. Transforms the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, the geometry is transformed in-place and
nothing is returned. However if the `clone` keyword is set, then this
geometry will not be mod... | Requires GDAL. Transforms the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, the geometry is transformed in-place and
nothing is returned. However if the `clone` keyword is set, then this
geometry will not be mod... | [
"Requires",
"GDAL",
".",
"Transforms",
"the",
"geometry",
"according",
"to",
"the",
"given",
"transformation",
"object",
"which",
"may",
"be",
"an",
"integer",
"SRID",
"and",
"WKT",
"or",
"PROJ",
".",
"4",
"string",
".",
"By",
"default",
"the",
"geometry",
... | def transform(self, ct, clone=False):
"""
Requires GDAL. Transforms the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, the geometry is transformed in-place and
nothing is returned. However if the `clone` ... | [
"def",
"transform",
"(",
"self",
",",
"ct",
",",
"clone",
"=",
"False",
")",
":",
"srid",
"=",
"self",
".",
"srid",
"if",
"ct",
"==",
"srid",
":",
"# short-circuit where source & dest SRIDs match",
"if",
"clone",
":",
"return",
"self",
".",
"clone",
"(",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/contrib/gis/geos/geometry.py#L487-L526 | ||
flow-project/flow | a511c41c48e6b928bb2060de8ad1ef3c3e3d9554 | flow/envs/multiagent/traffic_light_grid.py | python | MultiTrafficLightGridPOEnv.get_state | (self) | return obs | Observations for each traffic light agent.
:return: dictionary which contains agent-wise observations as follows:
- For the self.num_observed number of vehicles closest and incoming
towards traffic light agent, gives the vehicle velocity, distance to
intersection, edge number.
-... | Observations for each traffic light agent. | [
"Observations",
"for",
"each",
"traffic",
"light",
"agent",
"."
] | def get_state(self):
"""Observations for each traffic light agent.
:return: dictionary which contains agent-wise observations as follows:
- For the self.num_observed number of vehicles closest and incoming
towards traffic light agent, gives the vehicle velocity, distance to
inte... | [
"def",
"get_state",
"(",
"self",
")",
":",
"# Normalization factors",
"max_speed",
"=",
"max",
"(",
"self",
".",
"k",
".",
"network",
".",
"speed_limit",
"(",
"edge",
")",
"for",
"edge",
"in",
"self",
".",
"k",
".",
"network",
".",
"get_edge_list",
"(",
... | https://github.com/flow-project/flow/blob/a511c41c48e6b928bb2060de8ad1ef3c3e3d9554/flow/envs/multiagent/traffic_light_grid.py#L90-L200 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/numpy/lib/recfunctions.py | python | izip_records | (seqarrays, fill_value=None, flatten=True) | Returns an iterator of concatenated items from a sequence of arrays.
Parameters
----------
seqarrays : sequence of arrays
Sequence of arrays.
fill_value : {None, integer}
Value used to pad shorter iterables.
flatten : {True, False},
Whether to | Returns an iterator of concatenated items from a sequence of arrays. | [
"Returns",
"an",
"iterator",
"of",
"concatenated",
"items",
"from",
"a",
"sequence",
"of",
"arrays",
"."
] | def izip_records(seqarrays, fill_value=None, flatten=True):
"""
Returns an iterator of concatenated items from a sequence of arrays.
Parameters
----------
seqarrays : sequence of arrays
Sequence of arrays.
fill_value : {None, integer}
Value used to pad shorter iterables.
fla... | [
"def",
"izip_records",
"(",
"seqarrays",
",",
"fill_value",
"=",
"None",
",",
"flatten",
"=",
"True",
")",
":",
"# OK, that's a complete ripoff from Python2.6 itertools.izip_longest",
"def",
"sentinel",
"(",
"counter",
"=",
"(",
"[",
"fill_value",
"]",
"*",
"(",
"... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/numpy/lib/recfunctions.py#L265-L295 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/pysaml2-4.9.0/src/saml2/client.py | python | Saml2Client.handle_logout_request | (self, request, name_id, binding, sign=False,
sign_alg=None, relay_state="") | return self.apply_binding(rinfo["binding"], response,
rinfo["destination"], relay_state,
response=True, sign=sign) | Deal with a LogoutRequest
:param request: The request as text string
:param name_id: The id of the current user
:param binding: Which binding the message came in over
:param sign: Whether the response will be signed or not
:return: Keyword arguments which can be used to send the... | Deal with a LogoutRequest | [
"Deal",
"with",
"a",
"LogoutRequest"
] | def handle_logout_request(self, request, name_id, binding, sign=False,
sign_alg=None, relay_state=""):
"""
Deal with a LogoutRequest
:param request: The request as text string
:param name_id: The id of the current user
:param binding: Which binding ... | [
"def",
"handle_logout_request",
"(",
"self",
",",
"request",
",",
"name_id",
",",
"binding",
",",
"sign",
"=",
"False",
",",
"sign_alg",
"=",
"None",
",",
"relay_state",
"=",
"\"\"",
")",
":",
"logger",
".",
"info",
"(",
"\"logout request: %s\"",
",",
"req... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pysaml2-4.9.0/src/saml2/client.py#L485-L538 | |
SeldonIO/alibi | ce961caf995d22648a8338857822c90428af4765 | alibi/explainers/shap_wrappers.py | python | KernelShap._ | (self, background_data, *args, **kwargs) | Initialises background data if the user passes an `np.ndarray` object as input.
If the user specifies feature grouping then a `shap_utils.DenseData` object
is returned. Weights are handled separately to avoid triggering assertion
correct inside `shap` library. Otherwise, the original data is ret... | Initialises background data if the user passes an `np.ndarray` object as input.
If the user specifies feature grouping then a `shap_utils.DenseData` object
is returned. Weights are handled separately to avoid triggering assertion
correct inside `shap` library. Otherwise, the original data is ret... | [
"Initialises",
"background",
"data",
"if",
"the",
"user",
"passes",
"an",
"np",
".",
"ndarray",
"object",
"as",
"input",
".",
"If",
"the",
"user",
"specifies",
"feature",
"grouping",
"then",
"a",
"shap_utils",
".",
"DenseData",
"object",
"is",
"returned",
".... | def _(self, background_data, *args, **kwargs) -> Union[np.ndarray, shap_utils.Data]:
"""
Initialises background data if the user passes an `np.ndarray` object as input.
If the user specifies feature grouping then a `shap_utils.DenseData` object
is returned. Weights are handled separately... | [
"def",
"_",
"(",
"self",
",",
"background_data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"->",
"Union",
"[",
"np",
".",
"ndarray",
",",
"shap_utils",
".",
"Data",
"]",
":",
"group_names",
",",
"groups",
",",
"weights",
"=",
"args",
"new_args"... | https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/explainers/shap_wrappers.py#L580-L594 | ||
MrGiovanni/UNetPlusPlus | e145ba63862982bf1099cf2ec11d5466b434ae0b | keras/segmentation_models/pspnet/model.py | python | PSPNet | (backbone_name='vgg16',
input_shape=(384, 384, 3),
input_tensor=None,
encoder_weights='imagenet',
freeze_encoder=False,
downsample_factor=8,
psp_conv_filters=512,
psp_pooling_type='avg',
use_batchnorm=True,
dropout=None,
... | return model | Exploit the capability of global context information by different-regionbased
context aggregation through pyramid pooling module together with the proposed
pyramid scene parsing network (PSPNet).
https://arxiv.org/pdf/1612.01105.pdf
Args:
backbone_name: (str) look at list of available backbone... | Exploit the capability of global context information by different-regionbased
context aggregation through pyramid pooling module together with the proposed
pyramid scene parsing network (PSPNet). | [
"Exploit",
"the",
"capability",
"of",
"global",
"context",
"information",
"by",
"different",
"-",
"regionbased",
"context",
"aggregation",
"through",
"pyramid",
"pooling",
"module",
"together",
"with",
"the",
"proposed",
"pyramid",
"scene",
"parsing",
"network",
"("... | def PSPNet(backbone_name='vgg16',
input_shape=(384, 384, 3),
input_tensor=None,
encoder_weights='imagenet',
freeze_encoder=False,
downsample_factor=8,
psp_conv_filters=512,
psp_pooling_type='avg',
use_batchnorm=True,
drop... | [
"def",
"PSPNet",
"(",
"backbone_name",
"=",
"'vgg16'",
",",
"input_shape",
"=",
"(",
"384",
",",
"384",
",",
"3",
")",
",",
"input_tensor",
"=",
"None",
",",
"encoder_weights",
"=",
"'imagenet'",
",",
"freeze_encoder",
"=",
"False",
",",
"downsample_factor",... | https://github.com/MrGiovanni/UNetPlusPlus/blob/e145ba63862982bf1099cf2ec11d5466b434ae0b/keras/segmentation_models/pspnet/model.py#L47-L121 | |
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | parlai/agents/rag/rag.py | python | RagAgent._convert_model | (self, opt: Opt) | return self._generation_agent._convert_model(self, opt) | Override BartAgent._convert_model to use RagConversionScript. | Override BartAgent._convert_model to use RagConversionScript. | [
"Override",
"BartAgent",
".",
"_convert_model",
"to",
"use",
"RagConversionScript",
"."
] | def _convert_model(self, opt: Opt) -> Opt:
"""
Override BartAgent._convert_model to use RagConversionScript.
"""
return self._generation_agent._convert_model(self, opt) | [
"def",
"_convert_model",
"(",
"self",
",",
"opt",
":",
"Opt",
")",
"->",
"Opt",
":",
"return",
"self",
".",
"_generation_agent",
".",
"_convert_model",
"(",
"self",
",",
"opt",
")"
] | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/agents/rag/rag.py#L271-L275 | |
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/requests/api.py | python | post | (url, data=None, json=None, **kwargs) | return request('post', url, data=data, json=json, **kwargs) | Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments tha... | Sends a POST request. | [
"Sends",
"a",
"POST",
"request",
"."
] | def post(url, data=None, json=None, **kwargs):
"""Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`R... | [
"def",
"post",
"(",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'post'",
",",
"url",
",",
"data",
"=",
"data",
",",
"json",
"=",
"json",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/requests/api.py#L96-L107 | |
openstack/barbican | a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce | barbican/tasks/resources.py | python | BeginTypeOrder.get_name | (self) | return u._('Process TypeOrder') | [] | def get_name(self):
return u._('Process TypeOrder') | [
"def",
"get_name",
"(",
"self",
")",
":",
"return",
"u",
".",
"_",
"(",
"'Process TypeOrder'",
")"
] | https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/tasks/resources.py#L231-L232 | |||
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/resample.py | python | _LegacySatpyEWAResampler.resample | (self, *args, **kwargs) | return super(_LegacySatpyEWAResampler, self).resample(*args, **kwargs) | Run precompute and compute methods.
.. note::
This sets the default of 'mask_area' to False since it is
not needed in EWA resampling currently. | Run precompute and compute methods. | [
"Run",
"precompute",
"and",
"compute",
"methods",
"."
] | def resample(self, *args, **kwargs):
"""Run precompute and compute methods.
.. note::
This sets the default of 'mask_area' to False since it is
not needed in EWA resampling currently.
"""
kwargs.setdefault('mask_area', False)
return super(_LegacySatpyEW... | [
"def",
"resample",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'mask_area'",
",",
"False",
")",
"return",
"super",
"(",
"_LegacySatpyEWAResampler",
",",
"self",
")",
".",
"resample",
"(",
"*",
"a... | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/resample.py#L683-L693 | |
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/pip/_vendor/retrying.py | python | retry | (*dargs, **dkw) | Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object | Decorator function that instantiates the Retrying object | [
"Decorator",
"function",
"that",
"instantiates",
"the",
"Retrying",
"object"
] | def retry(*dargs, **dkw):
"""
Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object
"""
# support both @retry and @retry() as valid syntax
if len(dargs) == 1 and cal... | [
"def",
"retry",
"(",
"*",
"dargs",
",",
"*",
"*",
"dkw",
")",
":",
"# support both @retry and @retry() as valid syntax",
"if",
"len",
"(",
"dargs",
")",
"==",
"1",
"and",
"callable",
"(",
"dargs",
"[",
"0",
"]",
")",
":",
"def",
"wrap_simple",
"(",
"f",
... | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/_vendor/retrying.py#L26-L53 | ||
Tencent/GAutomator | 0ac9f849d1ca2c59760a91c5c94d3db375a380cd | GAutomatorIos/ga2/cloud/httptools/remote_connection.py | python | Request.get_method | (self) | return self._method | Returns the HTTP method used by this request. | Returns the HTTP method used by this request. | [
"Returns",
"the",
"HTTP",
"method",
"used",
"by",
"this",
"request",
"."
] | def get_method(self):
"""
Returns the HTTP method used by this request.
"""
return self._method | [
"def",
"get_method",
"(",
"self",
")",
":",
"return",
"self",
".",
"_method"
] | https://github.com/Tencent/GAutomator/blob/0ac9f849d1ca2c59760a91c5c94d3db375a380cd/GAutomatorIos/ga2/cloud/httptools/remote_connection.py#L67-L71 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/stats/_multivariate.py | python | multivariate_normal_gen.entropy | (self, mean=None, cov=1) | return 0.5 * logdet | Compute the differential entropy of the multivariate normal.
Parameters
----------
%(_mvn_doc_default_callparams)s
Returns
-------
h : scalar
Entropy of the multivariate normal distribution
Notes
-----
%(_mvn_doc_callparams_note)s | Compute the differential entropy of the multivariate normal. | [
"Compute",
"the",
"differential",
"entropy",
"of",
"the",
"multivariate",
"normal",
"."
] | def entropy(self, mean=None, cov=1):
"""
Compute the differential entropy of the multivariate normal.
Parameters
----------
%(_mvn_doc_default_callparams)s
Returns
-------
h : scalar
Entropy of the multivariate normal distribution
No... | [
"def",
"entropy",
"(",
"self",
",",
"mean",
"=",
"None",
",",
"cov",
"=",
"1",
")",
":",
"dim",
",",
"mean",
",",
"cov",
"=",
"self",
".",
"_process_parameters",
"(",
"None",
",",
"mean",
",",
"cov",
")",
"_",
",",
"logdet",
"=",
"np",
".",
"li... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/stats/_multivariate.py#L536-L556 | |
ninja-ide/ninja-ide | 87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0 | ninja_ide/gui/editor/editor.py | python | NEditor.__manage_key_home | (self, event) | Performs home key action | Performs home key action | [
"Performs",
"home",
"key",
"action"
] | def __manage_key_home(self, event):
"""Performs home key action"""
cursor = self.textCursor()
indent = self.line_indent()
# For selection
move = QTextCursor.MoveAnchor
if event.modifiers() == Qt.ShiftModifier:
move = QTextCursor.KeepAnchor
# Operation
... | [
"def",
"__manage_key_home",
"(",
"self",
",",
"event",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"indent",
"=",
"self",
".",
"line_indent",
"(",
")",
"# For selection",
"move",
"=",
"QTextCursor",
".",
"MoveAnchor",
"if",
"event",
".",
... | https://github.com/ninja-ide/ninja-ide/blob/87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0/ninja_ide/gui/editor/editor.py#L477-L494 | ||
hirofumi0810/tensorflow_end2end_speech_recognition | 65b9728089d5e92b25b92384a67419d970399a64 | examples/timit/data/load_dataset_joint_ctc_attention.py | python | Dataset.__init__ | (self, data_type, label_type, batch_size, map_file_path,
max_epoch=None, splice=1,
num_stack=1, num_skip=1,
shuffle=False, sort_utt=False, sort_stop_epoch=None,
progressbar=False) | A class for loading dataset.
Args:
data_type (string): train or dev or test
label_type (string): phone39 or phone48 or phone61 or
character or character_capital_divide
batch_size (int): the size of mini-batch
map_file_path (string): path to the map... | A class for loading dataset.
Args:
data_type (string): train or dev or test
label_type (string): phone39 or phone48 or phone61 or
character or character_capital_divide
batch_size (int): the size of mini-batch
map_file_path (string): path to the map... | [
"A",
"class",
"for",
"loading",
"dataset",
".",
"Args",
":",
"data_type",
"(",
"string",
")",
":",
"train",
"or",
"dev",
"or",
"test",
"label_type",
"(",
"string",
")",
":",
"phone39",
"or",
"phone48",
"or",
"phone61",
"or",
"character",
"or",
"character... | def __init__(self, data_type, label_type, batch_size, map_file_path,
max_epoch=None, splice=1,
num_stack=1, num_skip=1,
shuffle=False, sort_utt=False, sort_stop_epoch=None,
progressbar=False):
"""A class for loading dataset.
Args:
... | [
"def",
"__init__",
"(",
"self",
",",
"data_type",
",",
"label_type",
",",
"batch_size",
",",
"map_file_path",
",",
"max_epoch",
"=",
"None",
",",
"splice",
"=",
"1",
",",
"num_stack",
"=",
"1",
",",
"num_skip",
"=",
"1",
",",
"shuffle",
"=",
"False",
"... | https://github.com/hirofumi0810/tensorflow_end2end_speech_recognition/blob/65b9728089d5e92b25b92384a67419d970399a64/examples/timit/data/load_dataset_joint_ctc_attention.py#L22-L97 | ||
akanazawa/hmr | f149abeb0a7e2a3412eb68274a94a9232f7cb667 | src/tf_smpl/batch_lbs.py | python | batch_skew | (vec, batch_size=None) | vec is N x 3, batch_size is int
returns N x 3 x 3. Skew_sym version of each matrix. | vec is N x 3, batch_size is int | [
"vec",
"is",
"N",
"x",
"3",
"batch_size",
"is",
"int"
] | def batch_skew(vec, batch_size=None):
"""
vec is N x 3, batch_size is int
returns N x 3 x 3. Skew_sym version of each matrix.
"""
with tf.name_scope("batch_skew", [vec]):
if batch_size is None:
batch_size = vec.shape.as_list()[0]
col_inds = tf.constant([1, 2, 3, 5, 6, 7]... | [
"def",
"batch_skew",
"(",
"vec",
",",
"batch_size",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"batch_skew\"",
",",
"[",
"vec",
"]",
")",
":",
"if",
"batch_size",
"is",
"None",
":",
"batch_size",
"=",
"vec",
".",
"shape",
".",
"as... | https://github.com/akanazawa/hmr/blob/f149abeb0a7e2a3412eb68274a94a9232f7cb667/src/tf_smpl/batch_lbs.py#L15-L39 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/text.py | python | TextWithDash.draw | (self, renderer) | Draw the :class:`TextWithDash` object to the given *renderer*. | Draw the :class:`TextWithDash` object to the given *renderer*. | [
"Draw",
"the",
":",
"class",
":",
"TextWithDash",
"object",
"to",
"the",
"given",
"*",
"renderer",
"*",
"."
] | def draw(self, renderer):
"""
Draw the :class:`TextWithDash` object to the given *renderer*.
"""
self.update_coords(renderer)
Text.draw(self, renderer)
if self.get_dashlength() > 0.0:
self.dashline.draw(renderer)
self.stale = False | [
"def",
"draw",
"(",
"self",
",",
"renderer",
")",
":",
"self",
".",
"update_coords",
"(",
"renderer",
")",
"Text",
".",
"draw",
"(",
"self",
",",
"renderer",
")",
"if",
"self",
".",
"get_dashlength",
"(",
")",
">",
"0.0",
":",
"self",
".",
"dashline"... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/text.py#L1410-L1418 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/decimal.py | python | Decimal._compare_check_nans | (self, other, context) | return 0 | Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__.
Signal InvalidOperation if either self or other is a (quiet
or signaling) NaN. Signaling NaNs take precedence over quiet
NaNs.
Return 0 if neither operand is a NaN. | Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__. | [
"Version",
"of",
"_check_nans",
"used",
"for",
"the",
"signaling",
"comparisons",
"compare_signal",
"__le__",
"__lt__",
"__ge__",
"__gt__",
"."
] | def _compare_check_nans(self, other, context):
"""Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__.
Signal InvalidOperation if either self or other is a (quiet
or signaling) NaN. Signaling NaNs take precedence over quiet
N... | [
"def",
"_compare_check_nans",
"(",
"self",
",",
"other",
",",
"context",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"if",
"self",
".",
"_is_special",
"or",
"other",
".",
"_is_special",
":",
"if",
"self",
".",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/decimal.py#L760-L791 | |
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/ncaab/boxscore.py | python | Boxscore.home_points | (self) | return self._home_points | Returns an ``int`` of the number of points the home team scored. | Returns an ``int`` of the number of points the home team scored. | [
"Returns",
"an",
"int",
"of",
"the",
"number",
"of",
"points",
"the",
"home",
"team",
"scored",
"."
] | def home_points(self):
"""
Returns an ``int`` of the number of points the home team scored.
"""
return self._home_points | [
"def",
"home_points",
"(",
"self",
")",
":",
"return",
"self",
".",
"_home_points"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/ncaab/boxscore.py#L1467-L1471 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/np/npyfuncs.py | python | np_real_log_impl | (context, builder, sig, args) | return mathimpl.log_impl(context, builder, sig, args) | [] | def np_real_log_impl(context, builder, sig, args):
_check_arity_and_homogeneity(sig, args, 1)
return mathimpl.log_impl(context, builder, sig, args) | [
"def",
"np_real_log_impl",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
")",
":",
"_check_arity_and_homogeneity",
"(",
"sig",
",",
"args",
",",
"1",
")",
"return",
"mathimpl",
".",
"log_impl",
"(",
"context",
",",
"builder",
",",
"sig",
",",
... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/np/npyfuncs.py#L626-L628 | |||
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | jina/peapods/pods/k8slib/kubernetes_tools.py | python | _patch_deployment_with_device_plugins | (yaml_content: str, params: Dict) | return json.dumps(deployment) | [] | def _patch_deployment_with_device_plugins(yaml_content: str, params: Dict):
import yaml
device_plugins = _create_device_plugins(params['device_plugins'])
deployment = yaml.safe_load(yaml_content)
deployment['spec']['template']['spec']['containers'][0][
'resources'
] = device_plugins
re... | [
"def",
"_patch_deployment_with_device_plugins",
"(",
"yaml_content",
":",
"str",
",",
"params",
":",
"Dict",
")",
":",
"import",
"yaml",
"device_plugins",
"=",
"_create_device_plugins",
"(",
"params",
"[",
"'device_plugins'",
"]",
")",
"deployment",
"=",
"yaml",
"... | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/peapods/pods/k8slib/kubernetes_tools.py#L142-L151 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ecm/v20190719/models.py | python | SetSecurityGroupForLoadbalancersRequest.__init__ | (self) | r"""
:param LoadBalancerIds: 负载均衡实例ID数组
:type LoadBalancerIds: list of str
:param SecurityGroup: 安全组ID,如 esg-12345678
:type SecurityGroup: str
:param OperationType: ADD 绑定安全组;
DEL 解绑安全组
:type OperationType: str | r"""
:param LoadBalancerIds: 负载均衡实例ID数组
:type LoadBalancerIds: list of str
:param SecurityGroup: 安全组ID,如 esg-12345678
:type SecurityGroup: str
:param OperationType: ADD 绑定安全组;
DEL 解绑安全组
:type OperationType: str | [
"r",
":",
"param",
"LoadBalancerIds",
":",
"负载均衡实例ID数组",
":",
"type",
"LoadBalancerIds",
":",
"list",
"of",
"str",
":",
"param",
"SecurityGroup",
":",
"安全组ID,如",
"esg",
"-",
"12345678",
":",
"type",
"SecurityGroup",
":",
"str",
":",
"param",
"OperationType",
... | def __init__(self):
r"""
:param LoadBalancerIds: 负载均衡实例ID数组
:type LoadBalancerIds: list of str
:param SecurityGroup: 安全组ID,如 esg-12345678
:type SecurityGroup: str
:param OperationType: ADD 绑定安全组;
DEL 解绑安全组
:type OperationType: str
"""
self.LoadBala... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"LoadBalancerIds",
"=",
"None",
"self",
".",
"SecurityGroup",
"=",
"None",
"self",
".",
"OperationType",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ecm/v20190719/models.py#L11399-L11411 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/sysconfig.py | python | get_config_h_filename | () | return os.path.join(inc_dir, 'pyconfig.h') | Returns the path of pyconfig.h. | Returns the path of pyconfig.h. | [
"Returns",
"the",
"path",
"of",
"pyconfig",
".",
"h",
"."
] | def get_config_h_filename():
"""Returns the path of pyconfig.h."""
if _PYTHON_BUILD:
if os.name == "nt":
inc_dir = os.path.join(_PROJECT_BASE, "PC")
else:
inc_dir = _PROJECT_BASE
else:
inc_dir = get_path('platinclude')
return os.path.join(inc_dir, 'pyconfi... | [
"def",
"get_config_h_filename",
"(",
")",
":",
"if",
"_PYTHON_BUILD",
":",
"if",
"os",
".",
"name",
"==",
"\"nt\"",
":",
"inc_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_PROJECT_BASE",
",",
"\"PC\"",
")",
"else",
":",
"inc_dir",
"=",
"_PROJECT_BASE... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/sysconfig.py#L401-L410 | |
python-social-auth/social-core | 1ea27e8989657bb35dd37b6ee2e038e1358fbc96 | social_core/backends/weibo.py | python | WeiboOAuth2.get_uid | (self, access_token) | return data['uid'] | Return uid by access_token | Return uid by access_token | [
"Return",
"uid",
"by",
"access_token"
] | def get_uid(self, access_token):
"""Return uid by access_token"""
data = self.get_json(
'https://api.weibo.com/oauth2/get_token_info',
method='POST',
params={'access_token': access_token}
)
return data['uid'] | [
"def",
"get_uid",
"(",
"self",
",",
"access_token",
")",
":",
"data",
"=",
"self",
".",
"get_json",
"(",
"'https://api.weibo.com/oauth2/get_token_info'",
",",
"method",
"=",
"'POST'",
",",
"params",
"=",
"{",
"'access_token'",
":",
"access_token",
"}",
")",
"r... | https://github.com/python-social-auth/social-core/blob/1ea27e8989657bb35dd37b6ee2e038e1358fbc96/social_core/backends/weibo.py#L41-L48 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/language_constant_service/client.py | python | LanguageConstantServiceClient.get_language_constant | (
self,
request: Union[
language_constant_service.GetLanguageConstantRequest, dict
] = None,
*,
resource_name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) | return response | r"""Returns the requested language constant.
List of thrown errors: `AuthenticationError <>`__
`AuthorizationError <>`__ `HeaderError <>`__
`InternalError <>`__ `QuotaError <>`__ `RequestError <>`__
Args:
request (Union[google.ads.googleads.v9.services.types.GetLanguageCons... | r"""Returns the requested language constant. | [
"r",
"Returns",
"the",
"requested",
"language",
"constant",
"."
] | def get_language_constant(
self,
request: Union[
language_constant_service.GetLanguageConstantRequest, dict
] = None,
*,
resource_name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[... | [
"def",
"get_language_constant",
"(",
"self",
",",
"request",
":",
"Union",
"[",
"language_constant_service",
".",
"GetLanguageConstantRequest",
",",
"dict",
"]",
"=",
"None",
",",
"*",
",",
"resource_name",
":",
"str",
"=",
"None",
",",
"retry",
":",
"Optional... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/language_constant_service/client.py#L375-L457 | |
sacmehta/EdgeNets | 2b232d3f7fb60658755dad1ebca0ffc895cc795e | model/detection/ssd.py | python | SSD300.init_params | (self) | Function to initialze the parameters | Function to initialze the parameters | [
"Function",
"to",
"initialze",
"the",
"parameters"
] | def init_params(self):
'''
Function to initialze the parameters
'''
print_info_message('Initializaing Conv Layers with Xavier Unifrom')
# initializing matters a lot
# changing to Kaiming He's init functionaity, does not let the model to converge.
# probably becaus... | [
"def",
"init_params",
"(",
"self",
")",
":",
"print_info_message",
"(",
"'Initializaing Conv Layers with Xavier Unifrom'",
")",
"# initializing matters a lot",
"# changing to Kaiming He's init functionaity, does not let the model to converge.",
"# probably because, smooth function struggles ... | https://github.com/sacmehta/EdgeNets/blob/2b232d3f7fb60658755dad1ebca0ffc895cc795e/model/detection/ssd.py#L47-L58 | ||
jelmer/xandikos | 3149a633c388a6f1dffbc6686763fca00f72e3bc | xandikos/scheduling.py | python | ScheduleInbox.get_max_date_time | (self) | Return maximum datetime property. | Return maximum datetime property. | [
"Return",
"maximum",
"datetime",
"property",
"."
] | def get_max_date_time(self):
"""Return maximum datetime property."""
raise NotImplementedError(self.get_max_date_time) | [
"def",
"get_max_date_time",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"self",
".",
"get_max_date_time",
")"
] | https://github.com/jelmer/xandikos/blob/3149a633c388a6f1dffbc6686763fca00f72e3bc/xandikos/scheduling.py#L91-L93 | ||
networkx/networkx | 1620568e36702b1cfeaf1c0277b167b6cb93e48d | networkx/linalg/bethehessianmatrix.py | python | bethe_hessian_matrix | (G, r=None, nodelist=None) | return (r ** 2 - 1) * I - r * A + D | r"""Returns the Bethe Hessian matrix of G.
The Bethe Hessian is a family of matrices parametrized by r, defined as
H(r) = (r^2 - 1) I - r A + D where A is the adjacency matrix, D is the
diagonal matrix of node degrees, and I is the identify matrix. It is equal
to the graph laplacian when the regularize... | r"""Returns the Bethe Hessian matrix of G. | [
"r",
"Returns",
"the",
"Bethe",
"Hessian",
"matrix",
"of",
"G",
"."
] | def bethe_hessian_matrix(G, r=None, nodelist=None):
r"""Returns the Bethe Hessian matrix of G.
The Bethe Hessian is a family of matrices parametrized by r, defined as
H(r) = (r^2 - 1) I - r A + D where A is the adjacency matrix, D is the
diagonal matrix of node degrees, and I is the identify matrix. It... | [
"def",
"bethe_hessian_matrix",
"(",
"G",
",",
"r",
"=",
"None",
",",
"nodelist",
"=",
"None",
")",
":",
"import",
"scipy",
"as",
"sp",
"import",
"scipy",
".",
"sparse",
"# call as sp.sparse",
"if",
"nodelist",
"is",
"None",
":",
"nodelist",
"=",
"list",
... | https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/networkx/linalg/bethehessianmatrix.py#L10-L76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.