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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/display_keyword_view_service/client.py | python | DisplayKeywordViewServiceClient.parse_common_folder_path | (path: str) | return m.groupdict() if m else {} | Parse a folder path into its component segments. | Parse a folder path into its component segments. | [
"Parse",
"a",
"folder",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_common_folder_path(path: str) -> Dict[str, str]:
"""Parse a folder path into its component segments."""
m = re.match(r"^folders/(?P<folder>.+?)$", path)
return m.groupdict() if m else {} | [
"def",
"parse_common_folder_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^folders/(?P<folder>.+?)$\"",
",",
"path",
")",
"return",
"m",
".",
"groupdict",
"(",
")",
"if",
"m"... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/display_keyword_view_service/client.py#L202-L205 | |
tensorflow/ranking | 94cccec8b4e71d2cc4489c61e2623522738c2924 | tensorflow_ranking/python/losses_impl.py | python | _RankingLoss.compute_unreduced_loss | (self, labels, logits, mask=None) | return self._compute_unreduced_loss_impl(labels, logits, mask) | Computes the unreduced loss.
Args:
labels: A `Tensor` or `RaggedTensor` of the same shape as `logits`
representing graded relevance.
logits: A `Tensor` or `RaggedTensor` with shape [batch_size, list_size].
Each value is the ranking score of the corresponding item.
mask: An optiona... | Computes the unreduced loss. | [
"Computes",
"the",
"unreduced",
"loss",
"."
] | def compute_unreduced_loss(self, labels, logits, mask=None):
"""Computes the unreduced loss.
Args:
labels: A `Tensor` or `RaggedTensor` of the same shape as `logits`
representing graded relevance.
logits: A `Tensor` or `RaggedTensor` with shape [batch_size, list_size].
Each value is... | [
"def",
"compute_unreduced_loss",
"(",
"self",
",",
"labels",
",",
"logits",
",",
"mask",
"=",
"None",
")",
":",
"labels",
",",
"logits",
",",
"_",
",",
"mask",
"=",
"self",
".",
"_prepare_and_validate_params",
"(",
"labels",
",",
"logits",
",",
"None",
"... | https://github.com/tensorflow/ranking/blob/94cccec8b4e71d2cc4489c61e2623522738c2924/tensorflow_ranking/python/losses_impl.py#L602-L619 | |
styxit/HTPC-Manager | 490697460b4fa1797106aece27d873bc256b2ff1 | modules/plex.py | python | Plex.ping | (self, plex_host='', plex_port='', **kwargs) | Tests settings, returns server name on success and null on fail | Tests settings, returns server name on success and null on fail | [
"Tests",
"settings",
"returns",
"server",
"name",
"on",
"success",
"and",
"null",
"on",
"fail"
] | def ping(self, plex_host='', plex_port='', **kwargs):
""" Tests settings, returns server name on success and null on fail """
try:
self.logger.debug("Testing Plex connectivity")
url = "http://%s:%s" % (plex_host, plex_port)
self.logger.debug("Trying to contact Plex vi... | [
"def",
"ping",
"(",
"self",
",",
"plex_host",
"=",
"''",
",",
"plex_port",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Testing Plex connectivity\"",
")",
"url",
"=",
"\"http://%s:%s\"",
"%",
"(... | https://github.com/styxit/HTPC-Manager/blob/490697460b4fa1797106aece27d873bc256b2ff1/modules/plex.py#L56-L67 | ||
AmesCornish/buttersink | 5cc37e30d9f8071fcf3497dca8b8a91b910321ea | buttersink/send.py | python | TLV_GET_STRING | (attrs, attrNum) | return t.readString(TLV_GET_BYTES(attrs, attrNum)) | Get a tag-length-value encoded attribute as a string. | Get a tag-length-value encoded attribute as a string. | [
"Get",
"a",
"tag",
"-",
"length",
"-",
"value",
"encoded",
"attribute",
"as",
"a",
"string",
"."
] | def TLV_GET_STRING(attrs, attrNum):
""" Get a tag-length-value encoded attribute as a string. """
return t.readString(TLV_GET_BYTES(attrs, attrNum)) | [
"def",
"TLV_GET_STRING",
"(",
"attrs",
",",
"attrNum",
")",
":",
"return",
"t",
".",
"readString",
"(",
"TLV_GET_BYTES",
"(",
"attrs",
",",
"attrNum",
")",
")"
] | https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/send.py#L158-L160 | |
grow/grow | 97fc21730b6a674d5d33948d94968e79447ce433 | grow/pods/pods.py | python | Pod.read_csv | (self, path, locale=utils.SENTINEL) | [] | def read_csv(self, path, locale=utils.SENTINEL):
with self.profile.timer('Pod.read_csv', label=path, meta={'path': path}):
return utils.get_rows_from_csv(pod=self, path=path, locale=locale) | [
"def",
"read_csv",
"(",
"self",
",",
"path",
",",
"locale",
"=",
"utils",
".",
"SENTINEL",
")",
":",
"with",
"self",
".",
"profile",
".",
"timer",
"(",
"'Pod.read_csv'",
",",
"label",
"=",
"path",
",",
"meta",
"=",
"{",
"'path'",
":",
"path",
"}",
... | https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/pods/pods.py#L873-L875 | ||||
michaelhush/M-LOOP | cd0bf2d0de0bfe7f533156399a94b576f7f34a35 | mloop/learners.py | python | NeuralNetLearner.run | (self) | Starts running the neural network learner. When the new parameters event is triggered, reads the cost information provided and updates the neural network with the information. Then searches the neural network for new optimal parameters to test based on the biased cost. Parameters to test next are put on the output para... | Starts running the neural network learner. When the new parameters event is triggered, reads the cost information provided and updates the neural network with the information. Then searches the neural network for new optimal parameters to test based on the biased cost. Parameters to test next are put on the output para... | [
"Starts",
"running",
"the",
"neural",
"network",
"learner",
".",
"When",
"the",
"new",
"parameters",
"event",
"is",
"triggered",
"reads",
"the",
"cost",
"information",
"provided",
"and",
"updates",
"the",
"neural",
"network",
"with",
"the",
"information",
".",
... | def run(self):
'''
Starts running the neural network learner. When the new parameters event is triggered, reads the cost information provided and updates the neural network with the information. Then searches the neural network for new optimal parameters to test based on the biased cost. Parameters to t... | [
"def",
"run",
"(",
"self",
")",
":",
"#logging to the main log file from a process (as apposed to a thread) in cpython is currently buggy on windows and/or python 2.7",
"#current solution is to only log to the console for warning and above from a process",
"self",
".",
"log",
"=",
"mp",
".... | https://github.com/michaelhush/M-LOOP/blob/cd0bf2d0de0bfe7f533156399a94b576f7f34a35/mloop/learners.py#L2351-L2414 | ||
faucetsdn/ryu | 537f35f4b2bc634ef05e3f28373eb5e24609f989 | ryu/services/protocols/bgp/bgpspeaker.py | python | BGPSpeaker.attribute_map_get | (self, address, route_dist=None,
route_family=RF_VPN_V4) | return call(func_name, **param) | This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
``route_dist`` specifies route distinguisher that has attribute_maps.
``route_family`` specifies route family of the VRF.
This parameter must be one of the following.
... | This method gets in-bound filters of the specified neighbor. | [
"This",
"method",
"gets",
"in",
"-",
"bound",
"filters",
"of",
"the",
"specified",
"neighbor",
"."
] | def attribute_map_get(self, address, route_dist=None,
route_family=RF_VPN_V4):
"""This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
``route_dist`` specifies route distinguisher that has attribute_maps.
... | [
"def",
"attribute_map_get",
"(",
"self",
",",
"address",
",",
"route_dist",
"=",
"None",
",",
"route_family",
"=",
"RF_VPN_V4",
")",
":",
"if",
"route_family",
"not",
"in",
"SUPPORTED_VRF_RF",
":",
"raise",
"ValueError",
"(",
"'Unsupported route_family: %s'",
"%",... | https://github.com/faucetsdn/ryu/blob/537f35f4b2bc634ef05e3f28373eb5e24609f989/ryu/services/protocols/bgp/bgpspeaker.py#L1371-L1399 | |
google-research/mixmatch | 1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e | libml/layers.py | python | PData.__init__ | (self, dataset: DataSet) | [] | def __init__(self, dataset: DataSet):
self.has_update = False
if dataset.p_unlabeled is not None:
self.p_data = tf.constant(dataset.p_unlabeled, name='p_data')
elif dataset.p_labeled is not None:
self.p_data = tf.constant(dataset.p_labeled, name='p_data')
else:
... | [
"def",
"__init__",
"(",
"self",
",",
"dataset",
":",
"DataSet",
")",
":",
"self",
".",
"has_update",
"=",
"False",
"if",
"dataset",
".",
"p_unlabeled",
"is",
"not",
"None",
":",
"self",
".",
"p_data",
"=",
"tf",
".",
"constant",
"(",
"dataset",
".",
... | https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/libml/layers.py#L136-L144 | ||||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/scipy/cluster/hierarchy.py | python | dendrogram | (Z, p=30, truncate_mode=None, color_threshold=None,
get_leaves=True, orientation='top', labels=None,
count_sort=False, distance_sort=False, show_leaf_counts=True,
no_plot=False, no_labels=False, leaf_font_size=None,
leaf_rotation=None, leaf_label_func=None,
... | return R | Plots the hierarchical clustering as a dendrogram.
The dendrogram illustrates how each cluster is
composed by drawing a U-shaped link between a non-singleton
cluster and its children. The top of the U-link indicates a
cluster merge. The two legs of the U-link indicate which clusters
were merged. ... | Plots the hierarchical clustering as a dendrogram. | [
"Plots",
"the",
"hierarchical",
"clustering",
"as",
"a",
"dendrogram",
"."
] | def dendrogram(Z, p=30, truncate_mode=None, color_threshold=None,
get_leaves=True, orientation='top', labels=None,
count_sort=False, distance_sort=False, show_leaf_counts=True,
no_plot=False, no_labels=False, leaf_font_size=None,
leaf_rotation=None, leaf_label... | [
"def",
"dendrogram",
"(",
"Z",
",",
"p",
"=",
"30",
",",
"truncate_mode",
"=",
"None",
",",
"color_threshold",
"=",
"None",
",",
"get_leaves",
"=",
"True",
",",
"orientation",
"=",
"'top'",
",",
"labels",
"=",
"None",
",",
"count_sort",
"=",
"False",
"... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/cluster/hierarchy.py#L2029-L2377 | |
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/corpus/classes.py | python | Utterance.__repr__ | (self) | return f'<Utterance "{self.name}">' | Object representation | Object representation | [
"Object",
"representation"
] | def __repr__(self) -> str:
"""Object representation"""
return f'<Utterance "{self.name}">' | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f'<Utterance \"{self.name}\">'"
] | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/corpus/classes.py#L924-L926 | |
aroberge/friendly | 0b82326ba1cb982f8612885ac60957f095d7476f | friendly/runtime_errors/value_error.py | python | unrecognized_message | (_value, frame, tb_data) | return {"cause": cause} | This attempts to provide some help when a message is not recognized. | This attempts to provide some help when a message is not recognized. | [
"This",
"attempts",
"to",
"provide",
"some",
"help",
"when",
"a",
"message",
"is",
"not",
"recognized",
"."
] | def unrecognized_message(_value, frame, tb_data):
"""This attempts to provide some help when a message is not recognized."""
_ = current_lang.translate
bad_line = tb_data.bad_line.strip()
if bad_line.startswith("raise ") or bad_line.startswith("raise\t"):
try:
name = inspect.getframe... | [
"def",
"unrecognized_message",
"(",
"_value",
",",
"frame",
",",
"tb_data",
")",
":",
"_",
"=",
"current_lang",
".",
"translate",
"bad_line",
"=",
"tb_data",
".",
"bad_line",
".",
"strip",
"(",
")",
"if",
"bad_line",
".",
"startswith",
"(",
"\"raise \"",
"... | https://github.com/aroberge/friendly/blob/0b82326ba1cb982f8612885ac60957f095d7476f/friendly/runtime_errors/value_error.py#L212-L247 | |
awslabs/aws-lambda-powertools-python | 0c6ac0fe183476140ee1df55fe9fa1cc20925577 | aws_lambda_powertools/utilities/data_classes/s3_event.py | python | S3EventRecordGlacierRestoreEventData.lifecycle_restoration_expiry_time | (self) | return self["restoreEventData"]["lifecycleRestorationExpiryTime"] | Time when the object restoration will be expired. | Time when the object restoration will be expired. | [
"Time",
"when",
"the",
"object",
"restoration",
"will",
"be",
"expired",
"."
] | def lifecycle_restoration_expiry_time(self) -> str:
"""Time when the object restoration will be expired."""
return self["restoreEventData"]["lifecycleRestorationExpiryTime"] | [
"def",
"lifecycle_restoration_expiry_time",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
"[",
"\"restoreEventData\"",
"]",
"[",
"\"lifecycleRestorationExpiryTime\"",
"]"
] | https://github.com/awslabs/aws-lambda-powertools-python/blob/0c6ac0fe183476140ee1df55fe9fa1cc20925577/aws_lambda_powertools/utilities/data_classes/s3_event.py#L85-L87 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/analysis/chemenv/connectivity/connected_components.py | python | ConnectedComponent.is_2d | (self) | return len(self._periodicity_vectors) == 2 | Returns: | [] | def is_2d(self):
"""
Returns:
"""
if self._periodicity_vectors is None:
self.compute_periodicity()
return len(self._periodicity_vectors) == 2 | [
"def",
"is_2d",
"(",
"self",
")",
":",
"if",
"self",
".",
"_periodicity_vectors",
"is",
"None",
":",
"self",
".",
"compute_periodicity",
"(",
")",
"return",
"len",
"(",
"self",
".",
"_periodicity_vectors",
")",
"==",
"2"
] | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/chemenv/connectivity/connected_components.py#L634-L642 | ||
istresearch/scrapy-cluster | 01861c2dca1563aab740417d315cc4ebf9b73f72 | kafka-monitor/plugins/scraper_handler.py | python | ScraperHandler.setup | (self, settings) | Setup redis and tldextract | Setup redis and tldextract | [
"Setup",
"redis",
"and",
"tldextract"
] | def setup(self, settings):
'''
Setup redis and tldextract
'''
self.extract = tldextract.TLDExtract()
self.redis_conn = redis.Redis(host=settings['REDIS_HOST'],
port=settings['REDIS_PORT'],
db=settings.get... | [
"def",
"setup",
"(",
"self",
",",
"settings",
")",
":",
"self",
".",
"extract",
"=",
"tldextract",
".",
"TLDExtract",
"(",
")",
"self",
".",
"redis_conn",
"=",
"redis",
".",
"Redis",
"(",
"host",
"=",
"settings",
"[",
"'REDIS_HOST'",
"]",
",",
"port",
... | https://github.com/istresearch/scrapy-cluster/blob/01861c2dca1563aab740417d315cc4ebf9b73f72/kafka-monitor/plugins/scraper_handler.py#L14-L33 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpl_toolkits/axes_grid1/axes_divider.py | python | Divider.set_horizontal | (self, h) | :param horizontal: list of sizes
(:mod:`~mpl_toolkits.axes_grid.axes_size`)
for horizontal division
. | :param horizontal: list of sizes
(:mod:`~mpl_toolkits.axes_grid.axes_size`)
for horizontal division | [
":",
"param",
"horizontal",
":",
"list",
"of",
"sizes",
"(",
":",
"mod",
":",
"~mpl_toolkits",
".",
"axes_grid",
".",
"axes_size",
")",
"for",
"horizontal",
"division"
] | def set_horizontal(self, h):
"""
:param horizontal: list of sizes
(:mod:`~mpl_toolkits.axes_grid.axes_size`)
for horizontal division
.
"""
self._horizontal = h | [
"def",
"set_horizontal",
"(",
"self",
",",
"h",
")",
":",
"self",
".",
"_horizontal",
"=",
"h"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpl_toolkits/axes_grid1/axes_divider.py#L150-L158 | ||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/traceback.py | python | format_tb | (tb, limit = None) | return format_list(extract_tb(tb, limit)) | A shorthand for 'format_list(extract_tb(tb, limit))'. | A shorthand for 'format_list(extract_tb(tb, limit))'. | [
"A",
"shorthand",
"for",
"format_list",
"(",
"extract_tb",
"(",
"tb",
"limit",
"))",
"."
] | def format_tb(tb, limit = None):
"""A shorthand for 'format_list(extract_tb(tb, limit))'."""
return format_list(extract_tb(tb, limit)) | [
"def",
"format_tb",
"(",
"tb",
",",
"limit",
"=",
"None",
")",
":",
"return",
"format_list",
"(",
"extract_tb",
"(",
"tb",
",",
"limit",
")",
")"
] | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/traceback.py#L74-L76 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | py2manager/gluon/contrib/login_methods/openid_auth.py | python | Web2pyStore.useNonce | (self, server_url, timestamp, salt) | This method returns Falase if a nonce has been used before or its
timestamp is not current. | This method returns Falase if a nonce has been used before or its
timestamp is not current. | [
"This",
"method",
"returns",
"Falase",
"if",
"a",
"nonce",
"has",
"been",
"used",
"before",
"or",
"its",
"timestamp",
"is",
"not",
"current",
"."
] | def useNonce(self, server_url, timestamp, salt):
"""
This method returns Falase if a nonce has been used before or its
timestamp is not current.
"""
db = self.database
if abs(timestamp - time.time()) > nonce.SKEW:
return False
query = (db.oid_nonces.s... | [
"def",
"useNonce",
"(",
"self",
",",
"server_url",
",",
"timestamp",
",",
"salt",
")",
":",
"db",
"=",
"self",
".",
"database",
"if",
"abs",
"(",
"timestamp",
"-",
"time",
".",
"time",
"(",
")",
")",
">",
"nonce",
".",
"SKEW",
":",
"return",
"False... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/py2manager/gluon/contrib/login_methods/openid_auth.py#L588-L604 | ||
uqfoundation/mystic | 154e6302d1f2f94e8f13e88ecc5f24241cc28ac7 | cache/archive.py | python | _write_func | (archive, func, dist, keymap=None) | return | write stored function and distance information to archive
Args:
archive (klepto.archive): function archive (output of ``_read_func``)
func (function): with interface ``y = f(x)``, ``x`` is a list of floats
dist (dict): distance information
keymap (klepto.keymap): keymap used for key... | write stored function and distance information to archive | [
"write",
"stored",
"function",
"and",
"distance",
"information",
"to",
"archive"
] | def _write_func(archive, func, dist, keymap=None):
"""write stored function and distance information to archive
Args:
archive (klepto.archive): function archive (output of ``_read_func``)
func (function): with interface ``y = f(x)``, ``x`` is a list of floats
dist (dict): distance infor... | [
"def",
"_write_func",
"(",
"archive",
",",
"func",
",",
"dist",
",",
"keymap",
"=",
"None",
")",
":",
"arxiv",
"=",
"getattr",
"(",
"archive",
",",
"'__archive__'",
",",
"archive",
")",
"entries",
"=",
"{",
"len",
"(",
"arxiv",
")",
":",
"(",
"func",... | https://github.com/uqfoundation/mystic/blob/154e6302d1f2f94e8f13e88ecc5f24241cc28ac7/cache/archive.py#L120-L135 | |
tensorflow/privacy | 867f3d4c5566b21433a6a1bed998094d1479b4d5 | tensorflow_privacy/privacy/analysis/rdp_privacy_accountant.py | python | _log_add | (logx, logy) | return math.log1p(math.exp(a - b)) + b | Adds two numbers in the log space. | Adds two numbers in the log space. | [
"Adds",
"two",
"numbers",
"in",
"the",
"log",
"space",
"."
] | def _log_add(logx, logy):
"""Adds two numbers in the log space."""
a, b = min(logx, logy), max(logx, logy)
if a == -np.inf: # adding 0
return b
# Use exp(a) + exp(b) = (exp(a - b) + 1) * exp(b)
return math.log1p(math.exp(a - b)) + b | [
"def",
"_log_add",
"(",
"logx",
",",
"logy",
")",
":",
"a",
",",
"b",
"=",
"min",
"(",
"logx",
",",
"logy",
")",
",",
"max",
"(",
"logx",
",",
"logy",
")",
"if",
"a",
"==",
"-",
"np",
".",
"inf",
":",
"# adding 0",
"return",
"b",
"# Use exp(a) ... | https://github.com/tensorflow/privacy/blob/867f3d4c5566b21433a6a1bed998094d1479b4d5/tensorflow_privacy/privacy/analysis/rdp_privacy_accountant.py#L29-L35 | |
liuslnlp/ProxyPool | 0dabf9aae980a493f904362d70d23467ede66127 | proxypool/webapi.py | python | get_conn | () | return g.redis_connect | 获取 Redis 连接
:return: RedisOperator | 获取 Redis 连接
:return: RedisOperator | [
"获取",
"Redis",
"连接",
":",
"return",
":",
"RedisOperator"
] | def get_conn():
"""获取 Redis 连接
:return: RedisOperator
"""
if not hasattr(g, 'redis_connect'):
g.redis_connect = RedisOperator()
return g.redis_connect | [
"def",
"get_conn",
"(",
")",
":",
"if",
"not",
"hasattr",
"(",
"g",
",",
"'redis_connect'",
")",
":",
"g",
".",
"redis_connect",
"=",
"RedisOperator",
"(",
")",
"return",
"g",
".",
"redis_connect"
] | https://github.com/liuslnlp/ProxyPool/blob/0dabf9aae980a493f904362d70d23467ede66127/proxypool/webapi.py#L10-L16 | |
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_access_control/models/community.py | python | Community.get_effective_group_privilege | (self, this_group) | return GroupCommunityPrivilege.get_privilege(group=this_group, community=self) | [] | def get_effective_group_privilege(self, this_group):
from hs_access_control.models.privilege import GroupCommunityPrivilege
return GroupCommunityPrivilege.get_privilege(group=this_group, community=self) | [
"def",
"get_effective_group_privilege",
"(",
"self",
",",
"this_group",
")",
":",
"from",
"hs_access_control",
".",
"models",
".",
"privilege",
"import",
"GroupCommunityPrivilege",
"return",
"GroupCommunityPrivilege",
".",
"get_privilege",
"(",
"group",
"=",
"this_group... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_access_control/models/community.py#L142-L144 | |||
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/mwclient/image.py | python | Image.imagehistory | (self) | return listing.PageProperty(
self, 'imageinfo', 'ii', iiprop='timestamp|user|comment|url|size|sha1|metadata|archivename') | Get file revision info for the given file.
API doc: https://www.mediawiki.org/wiki/API:Imageinfo | Get file revision info for the given file. | [
"Get",
"file",
"revision",
"info",
"for",
"the",
"given",
"file",
"."
] | def imagehistory(self):
"""
Get file revision info for the given file.
API doc: https://www.mediawiki.org/wiki/API:Imageinfo
"""
return listing.PageProperty(
self, 'imageinfo', 'ii', iiprop='timestamp|user|comment|url|size|sha1|metadata|archivename') | [
"def",
"imagehistory",
"(",
"self",
")",
":",
"return",
"listing",
".",
"PageProperty",
"(",
"self",
",",
"'imageinfo'",
",",
"'ii'",
",",
"iiprop",
"=",
"'timestamp|user|comment|url|size|sha1|metadata|archivename'",
")"
] | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/mwclient/image.py#L27-L34 | |
fastnlp/fastNLP | fb645d370f4cc1b00c7dbb16c1ff4542327c46e5 | fastNLP/embeddings/elmo_embedding.py | python | ElmoEmbedding.__init__ | (self, vocab: Vocabulary, model_dir_or_name: str = 'en', layers: str = '2', requires_grad: bool = True,
word_dropout=0.0, dropout=0.0, cache_word_reprs: bool = False) | r"""
:param vocab: 词表
:param model_dir_or_name: 可以有两种方式调用预训练好的ELMo embedding:第一种是传入ELMo所在文件夹,该文件夹下面应该有两个文件,
其中一个是以json为后缀的配置文件,另一个是以pkl为后缀的权重文件;第二种是传入ELMo版本的名称,将自动查看缓存中是否存在该模型,
没有的话将自动下载并缓存。
:param layers: str, 指定返回的层数(从0开始), 以,隔开不同的层。如果要返回第二层的结果'2', 返回后两层的结果'1,2... | r"""
:param vocab: 词表
:param model_dir_or_name: 可以有两种方式调用预训练好的ELMo embedding:第一种是传入ELMo所在文件夹,该文件夹下面应该有两个文件,
其中一个是以json为后缀的配置文件,另一个是以pkl为后缀的权重文件;第二种是传入ELMo版本的名称,将自动查看缓存中是否存在该模型,
没有的话将自动下载并缓存。
:param layers: str, 指定返回的层数(从0开始), 以,隔开不同的层。如果要返回第二层的结果'2', 返回后两层的结果'1,2... | [
"r",
":",
"param",
"vocab",
":",
"词表",
":",
"param",
"model_dir_or_name",
":",
"可以有两种方式调用预训练好的ELMo",
"embedding:第一种是传入ELMo所在文件夹,该文件夹下面应该有两个文件,",
"其中一个是以json为后缀的配置文件,另一个是以pkl为后缀的权重文件;第二种是传入ELMo版本的名称,将自动查看缓存中是否存在该模型,",
"没有的话将自动下载并缓存。",
":",
"param",
"layers",
":",
"str",
"指定返回的层数... | def __init__(self, vocab: Vocabulary, model_dir_or_name: str = 'en', layers: str = '2', requires_grad: bool = True,
word_dropout=0.0, dropout=0.0, cache_word_reprs: bool = False):
r"""
:param vocab: 词表
:param model_dir_or_name: 可以有两种方式调用预训练好的ELMo embedding:第一种是传入ELMo所在文... | [
"def",
"__init__",
"(",
"self",
",",
"vocab",
":",
"Vocabulary",
",",
"model_dir_or_name",
":",
"str",
"=",
"'en'",
",",
"layers",
":",
"str",
"=",
"'2'",
",",
"requires_grad",
":",
"bool",
"=",
"True",
",",
"word_dropout",
"=",
"0.0",
",",
"dropout",
... | https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/fastNLP/embeddings/elmo_embedding.py#L57-L103 | ||
openstack-archive/dragonflow | 4dc36ed6490e2ed53b47dece883cdbd78ea96033 | dragonflow/cli/utils.py | python | print_dict | (dct, dict_property="Property", wrap=0) | Print a `dict` as a table of two columns.
:param dct: `dict` to print
:param dict_property: name of the first column
:param wrap: wrapping for the second column | Print a `dict` as a table of two columns. | [
"Print",
"a",
"dict",
"as",
"a",
"table",
"of",
"two",
"columns",
"."
] | def print_dict(dct, dict_property="Property", wrap=0):
"""Print a `dict` as a table of two columns.
:param dct: `dict` to print
:param dict_property: name of the first column
:param wrap: wrapping for the second column
"""
pt = prettytable.PrettyTable([dict_property, 'Value'])
pt.align = 'l... | [
"def",
"print_dict",
"(",
"dct",
",",
"dict_property",
"=",
"\"Property\"",
",",
"wrap",
"=",
"0",
")",
":",
"pt",
"=",
"prettytable",
".",
"PrettyTable",
"(",
"[",
"dict_property",
",",
"'Value'",
"]",
")",
"pt",
".",
"align",
"=",
"'l'",
"for",
"k",
... | https://github.com/openstack-archive/dragonflow/blob/4dc36ed6490e2ed53b47dece883cdbd78ea96033/dragonflow/cli/utils.py#L130-L166 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/xml/sax/xmlreader.py | python | XMLReader.setLocale | (self, locale) | Allow an application to set the locale for errors and warnings.
SAX parsers are not required to provide localization for errors
and warnings; if they cannot support the requested locale,
however, they must throw a SAX exception. Applications may
request a locale change in the middle of ... | Allow an application to set the locale for errors and warnings. | [
"Allow",
"an",
"application",
"to",
"set",
"the",
"locale",
"for",
"errors",
"and",
"warnings",
"."
] | def setLocale(self, locale):
"""Allow an application to set the locale for errors and warnings.
SAX parsers are not required to provide localization for errors
and warnings; if they cannot support the requested locale,
however, they must throw a SAX exception. Applications may
r... | [
"def",
"setLocale",
"(",
"self",
",",
"locale",
")",
":",
"raise",
"SAXNotSupportedException",
"(",
"\"Locale support not implemented\"",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/xml/sax/xmlreader.py#L66-L73 | ||
researchmm/TracKit | 510e240faf71b4a225d6f18bcf49b3eebf8b436e | lib/utils/utils.py | python | corner2center | (corner) | [x1, y1, x2, y2] --> [cx, cy, w, h] | [x1, y1, x2, y2] --> [cx, cy, w, h] | [
"[",
"x1",
"y1",
"x2",
"y2",
"]",
"--",
">",
"[",
"cx",
"cy",
"w",
"h",
"]"
] | def corner2center(corner):
"""
[x1, y1, x2, y2] --> [cx, cy, w, h]
"""
if isinstance(corner, Corner):
x1, y1, x2, y2 = corner
return Center((x1 + x2) * 0.5, (y1 + y2) * 0.5, (x2 - x1), (y2 - y1))
else:
x1, y1, x2, y2 = corner[0], corner[1], corner[2], corner[3]
x = (x... | [
"def",
"corner2center",
"(",
"corner",
")",
":",
"if",
"isinstance",
"(",
"corner",
",",
"Corner",
")",
":",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"=",
"corner",
"return",
"Center",
"(",
"(",
"x1",
"+",
"x2",
")",
"*",
"0.5",
",",
"(",
"y1",
"... | https://github.com/researchmm/TracKit/blob/510e240faf71b4a225d6f18bcf49b3eebf8b436e/lib/utils/utils.py#L698-L711 | ||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/email/parser.py | python | BytesParser.parse | (self, fp, headersonly=False) | Create a message structure from the data in a binary file.
Reads all the data from the file and returns the root of the message
structure. Optional headersonly is a flag specifying whether to stop
parsing after reading the headers or not. The default is False,
meaning it parses the en... | Create a message structure from the data in a binary file. | [
"Create",
"a",
"message",
"structure",
"from",
"the",
"data",
"in",
"a",
"binary",
"file",
"."
] | def parse(self, fp, headersonly=False):
"""Create a message structure from the data in a binary file.
Reads all the data from the file and returns the root of the message
structure. Optional headersonly is a flag specifying whether to stop
parsing after reading the headers or not. The... | [
"def",
"parse",
"(",
"self",
",",
"fp",
",",
"headersonly",
"=",
"False",
")",
":",
"fp",
"=",
"TextIOWrapper",
"(",
"fp",
",",
"encoding",
"=",
"'ascii'",
",",
"errors",
"=",
"'surrogateescape'",
")",
"with",
"fp",
":",
"return",
"self",
".",
"parser"... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/email/parser.py#L102-L112 | ||
21dotco/two1-python | 4e833300fd5a58363e3104ed4c097631e5d296d3 | two1/crypto/ecdsa_base.py | python | EllipticCurveBase._nonce_rfc6979 | (self, private_key, message) | Computes a deterministic nonce (k) for use when signing
according to RFC6979 (https://tools.ietf.org/html/rfc6979),
Section 3.2.
Args:
private_key (int): The private key.
message (bytes): A hash of the input message.
Returns:
int: A determini... | Computes a deterministic nonce (k) for use when signing
according to RFC6979 (https://tools.ietf.org/html/rfc6979),
Section 3.2. | [
"Computes",
"a",
"deterministic",
"nonce",
"(",
"k",
")",
"for",
"use",
"when",
"signing",
"according",
"to",
"RFC6979",
"(",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc6979",
")",
"Section",
"3",
".",
"2",
"."
] | def _nonce_rfc6979(self, private_key, message):
""" Computes a deterministic nonce (k) for use when signing
according to RFC6979 (https://tools.ietf.org/html/rfc6979),
Section 3.2.
Args:
private_key (int): The private key.
message (bytes): A hash of the i... | [
"def",
"_nonce_rfc6979",
"(",
"self",
",",
"private_key",
",",
"message",
")",
":",
"hash_bytes",
"=",
"32",
"x",
"=",
"private_key",
".",
"to_bytes",
"(",
"hash_bytes",
",",
"'big'",
")",
"# Message should already be hashed by the time it gets here,",
"# so don't bot... | https://github.com/21dotco/two1-python/blob/4e833300fd5a58363e3104ed4c097631e5d296d3/two1/crypto/ecdsa_base.py#L127-L178 | ||
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/ui/tagsfromfilenames.py | python | TagMatchExpression.match_file | (self, filename) | [] | def match_file(self, filename):
match = self._format_re.search(filename.replace('\\', '/'))
if match:
result = {}
for group, tag in self._group_map.items():
value = match.group(group).strip()
if tag in self._numeric_tags:
value ... | [
"def",
"match_file",
"(",
"self",
",",
"filename",
")",
":",
"match",
"=",
"self",
".",
"_format_re",
".",
"search",
"(",
"filename",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
")",
"if",
"match",
":",
"result",
"=",
"{",
"}",
"for",
"group",
... | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/ui/tagsfromfilenames.py#L81-L96 | ||||
spotify/chartify | 5ac3a88e54cf620389741f396cc19d60fe032822 | chartify/_core/chart.py | python | Chart.source_text | (self) | return self._source.text | str: Data source of the chart. | str: Data source of the chart. | [
"str",
":",
"Data",
"source",
"of",
"the",
"chart",
"."
] | def source_text(self):
"""str: Data source of the chart."""
return self._source.text | [
"def",
"source_text",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source",
".",
"text"
] | https://github.com/spotify/chartify/blob/5ac3a88e54cf620389741f396cc19d60fe032822/chartify/_core/chart.py#L236-L238 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/os.py | python | _Environ.__iter__ | (self) | [] | def __iter__(self):
# list() from dict object is an atomic operation
keys = list(self._data)
for key in keys:
yield self.decodekey(key) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"# list() from dict object is an atomic operation",
"keys",
"=",
"list",
"(",
"self",
".",
"_data",
")",
"for",
"key",
"in",
"keys",
":",
"yield",
"self",
".",
"decodekey",
"(",
"key",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/os.py#L697-L701 | ||||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/core/management/commands/startproject.py | python | Command.handle | (self, project_name=None, target=None, *args, **options) | [] | def handle(self, project_name=None, target=None, *args, **options):
if project_name is None:
raise CommandError("you must provide a project name")
# Check that the project_name cannot be imported.
try:
import_module(project_name)
except ImportError:
p... | [
"def",
"handle",
"(",
"self",
",",
"project_name",
"=",
"None",
",",
"target",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"if",
"project_name",
"is",
"None",
":",
"raise",
"CommandError",
"(",
"\"you must provide a project name\"",
... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/core/management/commands/startproject.py#L12-L31 | ||||
quantopian/trading_calendars | 19c4b677f13147928d34be5a3da50ba4161be45d | versioneer.py | python | render_pep440 | (pieces) | return rendered | Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] | Build up version string, with post-release "local version identifier". | [
"Build",
"up",
"version",
"string",
"with",
"post",
"-",
"release",
"local",
"version",
"identifier",
"."
] | def render_pep440(pieces):
"""Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHE... | [
"def",
"render_pep440",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
"or",
"pieces",
"[",
"\"dirty\"",
"]",
":",
"rendered",
"+=... | https://github.com/quantopian/trading_calendars/blob/19c4b677f13147928d34be5a3da50ba4161be45d/versioneer.py#L1236-L1258 | |
lazzyfu/YaSQL | 2e73941aaca2a9b69d49e360d3a2376029a8ec1d | yasql/apps/sqlquery/api/verifyUserPrivs.py | python | VerifyUserPrivs._get_group_deny_tables | (self) | return list(models.DbQueryGroupDenyTables.objects.filter(
group_privs__user__username=self.username,
tables__schema__cid=self.cid,
tables__schema__schema=self.schema
).annotate(deny_tables=F('tables__table')).values_list('deny_tables', flat=True)) | 获取当前库禁止用户所在组访问的表名 | 获取当前库禁止用户所在组访问的表名 | [
"获取当前库禁止用户所在组访问的表名"
] | def _get_group_deny_tables(self):
"""获取当前库禁止用户所在组访问的表名"""
return list(models.DbQueryGroupDenyTables.objects.filter(
group_privs__user__username=self.username,
tables__schema__cid=self.cid,
tables__schema__schema=self.schema
).annotate(deny_tables=F('tables__ta... | [
"def",
"_get_group_deny_tables",
"(",
"self",
")",
":",
"return",
"list",
"(",
"models",
".",
"DbQueryGroupDenyTables",
".",
"objects",
".",
"filter",
"(",
"group_privs__user__username",
"=",
"self",
".",
"username",
",",
"tables__schema__cid",
"=",
"self",
".",
... | https://github.com/lazzyfu/YaSQL/blob/2e73941aaca2a9b69d49e360d3a2376029a8ec1d/yasql/apps/sqlquery/api/verifyUserPrivs.py#L67-L73 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/SafariBookmark/workflow/workflow.py | python | Workflow.bundleid | (self) | return self._bundleid | Workflow bundle ID from environmental vars or ``info.plist``.
:returns: bundle ID
:rtype: ``unicode`` | Workflow bundle ID from environmental vars or ``info.plist``. | [
"Workflow",
"bundle",
"ID",
"from",
"environmental",
"vars",
"or",
"info",
".",
"plist",
"."
] | def bundleid(self):
"""Workflow bundle ID from environmental vars or ``info.plist``.
:returns: bundle ID
:rtype: ``unicode``
"""
if not self._bundleid:
if self.alfred_env.get('workflow_bundleid'):
self._bundleid = self.alfred_env.get('workflow_bundle... | [
"def",
"bundleid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_bundleid",
":",
"if",
"self",
".",
"alfred_env",
".",
"get",
"(",
"'workflow_bundleid'",
")",
":",
"self",
".",
"_bundleid",
"=",
"self",
".",
"alfred_env",
".",
"get",
"(",
"'workfl... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SafariBookmark/workflow/workflow.py#L1289-L1302 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/lathe.py | python | LatheDerivation.__init__ | (self, elementNode) | Set defaults. | Set defaults. | [
"Set",
"defaults",
"."
] | def __init__(self, elementNode):
'Set defaults.'
self.axisEnd = evaluate.getVector3ByPrefix(None, elementNode, 'axisEnd')
self.axisStart = evaluate.getVector3ByPrefix(None, elementNode, 'axisStart')
self.end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
self.loop = evaluate.getTransformedPathByKey([... | [
"def",
"__init__",
"(",
"self",
",",
"elementNode",
")",
":",
"self",
".",
"axisEnd",
"=",
"evaluate",
".",
"getVector3ByPrefix",
"(",
"None",
",",
"elementNode",
",",
"'axisEnd'",
")",
"self",
".",
"axisStart",
"=",
"evaluate",
".",
"getVector3ByPrefix",
"(... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/lathe.py#L126-L176 | ||
SHI-Labs/Decoupled-Classification-Refinement | 16202b48eb9cbf79a9b130a98e8c209d4f24693e | faster_rcnn_dcr/core/dcr.py | python | sample_rois_bg | (roi_rec, cfg, sample_per_img) | return keep_indexes, pad_indexes | [] | def sample_rois_bg(roi_rec, cfg, sample_per_img):
pred_classes = roi_rec['pred_classes']
pred_scores = roi_rec['scores']
max_classes = roi_rec['max_classes']
max_overlaps = roi_rec['max_overlaps']
# sample_per_img = cfg.train.sample_per_image
if sample_per_img > len(max_classes):
keep_... | [
"def",
"sample_rois_bg",
"(",
"roi_rec",
",",
"cfg",
",",
"sample_per_img",
")",
":",
"pred_classes",
"=",
"roi_rec",
"[",
"'pred_classes'",
"]",
"pred_scores",
"=",
"roi_rec",
"[",
"'scores'",
"]",
"max_classes",
"=",
"roi_rec",
"[",
"'max_classes'",
"]",
"ma... | https://github.com/SHI-Labs/Decoupled-Classification-Refinement/blob/16202b48eb9cbf79a9b130a98e8c209d4f24693e/faster_rcnn_dcr/core/dcr.py#L164-L195 | |||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_funnelarea.py | python | Funnelarea.__init__ | (
self,
arg=None,
aspectratio=None,
baseratio=None,
customdata=None,
customdatasrc=None,
dlabel=None,
domain=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
hovertemplate=None,
hovertemplatesrc=None,
... | Construct a new Funnelarea object
Visualize stages in a process using area-encoded trapezoids.
This trace can be used to show data in a part-to-whole
representation similar to a "pie" trace, wherein each item
appears in a single stage. See also the "funnel" trace type for
... | Construct a new Funnelarea object
Visualize stages in a process using area-encoded trapezoids.
This trace can be used to show data in a part-to-whole
representation similar to a "pie" trace, wherein each item
appears in a single stage. See also the "funnel" trace type for
... | [
"Construct",
"a",
"new",
"Funnelarea",
"object",
"Visualize",
"stages",
"in",
"a",
"process",
"using",
"area",
"-",
"encoded",
"trapezoids",
".",
"This",
"trace",
"can",
"be",
"used",
"to",
"show",
"data",
"in",
"a",
"part",
"-",
"to",
"-",
"whole",
"rep... | def __init__(
self,
arg=None,
aspectratio=None,
baseratio=None,
customdata=None,
customdatasrc=None,
dlabel=None,
domain=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
hovertemplate=None,
hovertemplatesrc=... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"aspectratio",
"=",
"None",
",",
"baseratio",
"=",
"None",
",",
"customdata",
"=",
"None",
",",
"customdatasrc",
"=",
"None",
",",
"dlabel",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"... | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_funnelarea.py#L1471-L1975 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/asr/v20190614/asr_client.py | python | AsrClient.GetAsrVocabList | (self, request) | 用户通过该接口,可获得所有的热词表及其信息。
:param request: Request instance for GetAsrVocabList.
:type request: :class:`tencentcloud.asr.v20190614.models.GetAsrVocabListRequest`
:rtype: :class:`tencentcloud.asr.v20190614.models.GetAsrVocabListResponse` | 用户通过该接口,可获得所有的热词表及其信息。 | [
"用户通过该接口,可获得所有的热词表及其信息。"
] | def GetAsrVocabList(self, request):
"""用户通过该接口,可获得所有的热词表及其信息。
:param request: Request instance for GetAsrVocabList.
:type request: :class:`tencentcloud.asr.v20190614.models.GetAsrVocabListRequest`
:rtype: :class:`tencentcloud.asr.v20190614.models.GetAsrVocabListResponse`
"""
... | [
"def",
"GetAsrVocabList",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"GetAsrVocabList\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loads",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/asr/v20190614/asr_client.py#L392-L417 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/idlelib/UndoDelegator.py | python | CommandSequence.__init__ | (self) | [] | def __init__(self):
self.cmds = []
self.depth = 0 | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"cmds",
"=",
"[",
"]",
"self",
".",
"depth",
"=",
"0"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/UndoDelegator.py#L305-L307 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/projections/polar.py | python | PolarAxes.__init__ | (self, *args,
theta_offset=0, theta_direction=1, rlabel_position=22.5,
**kwargs) | Create a new Polar Axes for a polar plot. | Create a new Polar Axes for a polar plot. | [
"Create",
"a",
"new",
"Polar",
"Axes",
"for",
"a",
"polar",
"plot",
"."
] | def __init__(self, *args,
theta_offset=0, theta_direction=1, rlabel_position=22.5,
**kwargs):
"""
Create a new Polar Axes for a polar plot.
"""
self._default_theta_offset = theta_offset
self._default_theta_direction = theta_direction
self... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"theta_offset",
"=",
"0",
",",
"theta_direction",
"=",
"1",
",",
"rlabel_position",
"=",
"22.5",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_default_theta_offset",
"=",
"theta_offset",
"self",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/projections/polar.py#L841-L854 | ||
ReactionMechanismGenerator/RMG-Py | 2b7baf51febf27157def58fb3f6cee03fb6a684c | rmgpy/molecule/group.py | python | GroupAtom.is_specific_case_of | (self, other) | return True | Returns ``True`` if `self` is the same as `other` or is a more
specific case of `other`. Returns ``False`` if some of `self` is not
included in `other` or they are mutually exclusive. | Returns ``True`` if `self` is the same as `other` or is a more
specific case of `other`. Returns ``False`` if some of `self` is not
included in `other` or they are mutually exclusive. | [
"Returns",
"True",
"if",
"self",
"is",
"the",
"same",
"as",
"other",
"or",
"is",
"a",
"more",
"specific",
"case",
"of",
"other",
".",
"Returns",
"False",
"if",
"some",
"of",
"self",
"is",
"not",
"included",
"in",
"other",
"or",
"they",
"are",
"mutually... | def is_specific_case_of(self, other):
"""
Returns ``True`` if `self` is the same as `other` or is a more
specific case of `other`. Returns ``False`` if some of `self` is not
included in `other` or they are mutually exclusive.
"""
cython.declare(group=GroupAtom)
i... | [
"def",
"is_specific_case_of",
"(",
"self",
",",
"other",
")",
":",
"cython",
".",
"declare",
"(",
"group",
"=",
"GroupAtom",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"GroupAtom",
")",
":",
"# Let the is_specific_case_of method of other handle it",
"# We ... | https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/rmgpy/molecule/group.py#L415-L475 | |
jsikyoon/Interaction-networks_tensorflow | 2e1a3ee5bef8ace14630e0ed8f9714f40edbba38 | interaction_network.py | python | variable_summaries | (var,idx) | Attach a lot of summaries to a Tensor (for TensorBoard visualization). | Attach a lot of summaries to a Tensor (for TensorBoard visualization). | [
"Attach",
"a",
"lot",
"of",
"summaries",
"to",
"a",
"Tensor",
"(",
"for",
"TensorBoard",
"visualization",
")",
"."
] | def variable_summaries(var,idx):
"""Attach a lot of summaries to a Tensor (for TensorBoard visualization)."""
with tf.name_scope('summaries_'+str(idx)):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
... | [
"def",
"variable_summaries",
"(",
"var",
",",
"idx",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"'summaries_'",
"+",
"str",
"(",
"idx",
")",
")",
":",
"mean",
"=",
"tf",
".",
"reduce_mean",
"(",
"var",
")",
"tf",
".",
"summary",
".",
"scalar",
... | https://github.com/jsikyoon/Interaction-networks_tensorflow/blob/2e1a3ee5bef8ace14630e0ed8f9714f40edbba38/interaction_network.py#L17-L27 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/makeconf.py | python | append_var | (var, value) | return {var: {"old": old_value, "new": new_value}} | Add to or create a new variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.append_var 'LINGUAS' 'en' | Add to or create a new variable in the make.conf | [
"Add",
"to",
"or",
"create",
"a",
"new",
"variable",
"in",
"the",
"make",
".",
"conf"
] | def append_var(var, value):
"""
Add to or create a new variable in the make.conf
Return a dict containing the new value for variable::
{'<variable>': {'old': '<old-value>',
'new': '<new-value>'}}
CLI Example:
.. code-block:: bash
salt '*' makeconf.append_... | [
"def",
"append_var",
"(",
"var",
",",
"value",
")",
":",
"makeconf",
"=",
"_get_makeconf",
"(",
")",
"old_value",
"=",
"get_var",
"(",
"var",
")",
"# If var already in file, add to its value",
"if",
"old_value",
"is",
"not",
"None",
":",
"appended_value",
"=",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/makeconf.py#L117-L146 | |
trezor/trezor-core | 18c3a6a5bd45923380312b064be96155f5a7377d | src/trezor/crypto/bech32.py | python | encode | (hrp, witver, witprog) | return ret | Encode a segwit address. | Encode a segwit address. | [
"Encode",
"a",
"segwit",
"address",
"."
] | def encode(hrp, witver, witprog):
"""Encode a segwit address."""
ret = bech32_encode(hrp, [witver] + convertbits(witprog, 8, 5))
if decode(hrp, ret) == (None, None):
return None
return ret | [
"def",
"encode",
"(",
"hrp",
",",
"witver",
",",
"witprog",
")",
":",
"ret",
"=",
"bech32_encode",
"(",
"hrp",
",",
"[",
"witver",
"]",
"+",
"convertbits",
"(",
"witprog",
",",
"8",
",",
"5",
")",
")",
"if",
"decode",
"(",
"hrp",
",",
"ret",
")",... | https://github.com/trezor/trezor-core/blob/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/crypto/bech32.py#L119-L124 | |
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/contrib/formtools/wizard/legacy.py | python | FormWizard.num_steps | (self) | return len(self.form_list) | Helper method that returns the number of steps. | Helper method that returns the number of steps. | [
"Helper",
"method",
"that",
"returns",
"the",
"number",
"of",
"steps",
"."
] | def num_steps(self):
"Helper method that returns the number of steps."
# You might think we should just set "self.num_steps = len(form_list)"
# in __init__(), but this calculation needs to be dynamic, because some
# hook methods might alter self.form_list.
return len(self.form_li... | [
"def",
"num_steps",
"(",
"self",
")",
":",
"# You might think we should just set \"self.num_steps = len(form_list)\"",
"# in __init__(), but this calculation needs to be dynamic, because some",
"# hook methods might alter self.form_list.",
"return",
"len",
"(",
"self",
".",
"form_list",
... | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/formtools/wizard/legacy.py#L54-L59 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/vpc/__init__.py | python | VPCConnection.detach_classic_link_vpc | (self, vpc_id, instance_id, dry_run=False) | return self.get_status('DetachClassicLinkVpc', params) | Unlinks a linked EC2-Classic instance from a VPC. After the instance
has been unlinked, the VPC security groups are no longer associated
with it. An instance is automatically unlinked from a VPC when
it's stopped.
:type vpc_id: str
:param vpc_id: The ID of the instance to unlink... | Unlinks a linked EC2-Classic instance from a VPC. After the instance
has been unlinked, the VPC security groups are no longer associated
with it. An instance is automatically unlinked from a VPC when
it's stopped. | [
"Unlinks",
"a",
"linked",
"EC2",
"-",
"Classic",
"instance",
"from",
"a",
"VPC",
".",
"After",
"the",
"instance",
"has",
"been",
"unlinked",
"the",
"VPC",
"security",
"groups",
"are",
"no",
"longer",
"associated",
"with",
"it",
".",
"An",
"instance",
"is",... | def detach_classic_link_vpc(self, vpc_id, instance_id, dry_run=False):
"""
Unlinks a linked EC2-Classic instance from a VPC. After the instance
has been unlinked, the VPC security groups are no longer associated
with it. An instance is automatically unlinked from a VPC when
it's ... | [
"def",
"detach_classic_link_vpc",
"(",
"self",
",",
"vpc_id",
",",
"instance_id",
",",
"dry_run",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'VpcId'",
":",
"vpc_id",
",",
"'InstanceId'",
":",
"instance_id",
"}",
"if",
"dry_run",
":",
"params",
"[",
"'Dry... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/vpc/__init__.py#L1763-L1785 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/lyric/climate.py | python | LyricClimate.max_temp | (self) | return device.maxCoolSetpoint | Identify max_temp in Lyric API or defaults if not available. | Identify max_temp in Lyric API or defaults if not available. | [
"Identify",
"max_temp",
"in",
"Lyric",
"API",
"or",
"defaults",
"if",
"not",
"available",
"."
] | def max_temp(self) -> float:
"""Identify max_temp in Lyric API or defaults if not available."""
device = self.device
if LYRIC_HVAC_MODE_HEAT in device.allowedModes:
return device.maxHeatSetpoint
return device.maxCoolSetpoint | [
"def",
"max_temp",
"(",
"self",
")",
"->",
"float",
":",
"device",
"=",
"self",
".",
"device",
"if",
"LYRIC_HVAC_MODE_HEAT",
"in",
"device",
".",
"allowedModes",
":",
"return",
"device",
".",
"maxHeatSetpoint",
"return",
"device",
".",
"maxCoolSetpoint"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/lyric/climate.py#L250-L255 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/visualization/plot_container.py | python | PlotContainer.set_ylabel | (self, label) | return self | r"""
Allow the user to modify the Y-axis title
Defaults to the global value.
Parameters
----------
label : str
The new string for the y-axis.
>>> plot.set_ylabel("Temperature (K)") | r"""
Allow the user to modify the Y-axis title
Defaults to the global value. | [
"r",
"Allow",
"the",
"user",
"to",
"modify",
"the",
"Y",
"-",
"axis",
"title",
"Defaults",
"to",
"the",
"global",
"value",
"."
] | def set_ylabel(self, label):
r"""
Allow the user to modify the Y-axis title
Defaults to the global value.
Parameters
----------
label : str
The new string for the y-axis.
>>> plot.set_ylabel("Temperature (K)")
"""
self._ylabel = labe... | [
"def",
"set_ylabel",
"(",
"self",
",",
"label",
")",
":",
"self",
".",
"_ylabel",
"=",
"label",
"return",
"self"
] | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/plot_container.py#L703-L717 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/tabart.py | python | AuiSimpleTabArt.GetAGWFlags | (self) | return self._agwFlags | Returns the tab art flags.
:see: :meth:`~AuiSimpleTabArt.SetAGWFlags` for a list of possible return values. | Returns the tab art flags. | [
"Returns",
"the",
"tab",
"art",
"flags",
"."
] | def GetAGWFlags(self):
"""
Returns the tab art flags.
:see: :meth:`~AuiSimpleTabArt.SetAGWFlags` for a list of possible return values.
"""
return self._agwFlags | [
"def",
"GetAGWFlags",
"(",
"self",
")",
":",
"return",
"self",
".",
"_agwFlags"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/tabart.py#L1082-L1089 | |
sharppy/SHARPpy | 19175269ab11fe06c917b5d10376862a4716e1db | sharppy/sharptab/prof_collection.py | python | ProfCollection._backgroundCopy | (self, member, max_procs=2) | return | Copies the profile objects in the background while the user can continue to do things.
This upgrades the project object types from Profile to ConvectiveProfile via the
_target_type variable.
member: the key indicating a specific member
max_procs: max number of processors to... | Copies the profile objects in the background while the user can continue to do things.
This upgrades the project object types from Profile to ConvectiveProfile via the
_target_type variable.
member: the key indicating a specific member
max_procs: max number of processors to... | [
"Copies",
"the",
"profile",
"objects",
"in",
"the",
"background",
"while",
"the",
"user",
"can",
"continue",
"to",
"do",
"things",
".",
"This",
"upgrades",
"the",
"project",
"object",
"types",
"from",
"Profile",
"to",
"ConvectiveProfile",
"via",
"the",
"_targe... | def _backgroundCopy(self, member, max_procs=2):
"""
Copies the profile objects in the background while the user can continue to do things.
This upgrades the project object types from Profile to ConvectiveProfile via the
_target_type variable.
member: the key indicati... | [
"def",
"_backgroundCopy",
"(",
"self",
",",
"member",
",",
"max_procs",
"=",
"2",
")",
":",
"pipe",
"=",
"Queue",
"(",
"max_procs",
")",
"for",
"idx",
",",
"prof",
"in",
"enumerate",
"(",
"self",
".",
"_profs",
"[",
"member",
"]",
")",
":",
"proc",
... | https://github.com/sharppy/SHARPpy/blob/19175269ab11fe06c917b5d10376862a4716e1db/sharppy/sharptab/prof_collection.py#L64-L92 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cpython/listobj.py | python | ListInstance.define_dtor | (self) | return fn | Define the destructor if not already defined | Define the destructor if not already defined | [
"Define",
"the",
"destructor",
"if",
"not",
"already",
"defined"
] | def define_dtor(self):
"Define the destructor if not already defined"
context = self._context
builder = self._builder
mod = builder.module
# Declare dtor
fnty = ir.FunctionType(ir.VoidType(), [cgutils.voidptr_t])
fn = cgutils.get_or_insert_function(mod, fnty,
... | [
"def",
"define_dtor",
"(",
"self",
")",
":",
"context",
"=",
"self",
".",
"_context",
"builder",
"=",
"self",
".",
"_builder",
"mod",
"=",
"builder",
".",
"module",
"# Declare dtor",
"fnty",
"=",
"ir",
".",
"FunctionType",
"(",
"ir",
".",
"VoidType",
"("... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cpython/listobj.py#L275-L303 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/set/src/core/scapy.py | python | UDP.mysummary | (self) | [] | def mysummary(self):
if isinstance(self.underlayer, IP):
return self.underlayer.sprintf("UDP %IP.src%:%UDP.sport% > %IP.dst%:%UDP.dport%")
elif isinstance(self.underlayer, IPv6):
return self.underlayer.sprintf("UDP %IPv6.src%:%UDP.sport% > %IPv6.dst%:%UDP.dport%")
else:
... | [
"def",
"mysummary",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"underlayer",
",",
"IP",
")",
":",
"return",
"self",
".",
"underlayer",
".",
"sprintf",
"(",
"\"UDP %IP.src%:%UDP.sport% > %IP.dst%:%UDP.dport%\"",
")",
"elif",
"isinstance",
"(",
... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L6446-L6452 | ||||
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | gui/sliderwidget.py | python | InputSlider._swap_back | (self, reset_value=False) | Return to scale mode, optionally resetting the value | Return to scale mode, optionally resetting the value | [
"Return",
"to",
"scale",
"mode",
"optionally",
"resetting",
"the",
"value"
] | def _swap_back(self, reset_value=False):
"""Return to scale mode, optionally resetting the value"""
spin_button = self.get_child()
spin_button.disconnect(self._focus_cb_id)
self.remove(spin_button)
self.add(self._scale)
self._scale.set_sensitive(True)
if reset_val... | [
"def",
"_swap_back",
"(",
"self",
",",
"reset_value",
"=",
"False",
")",
":",
"spin_button",
"=",
"self",
".",
"get_child",
"(",
")",
"spin_button",
".",
"disconnect",
"(",
"self",
".",
"_focus_cb_id",
")",
"self",
".",
"remove",
"(",
"spin_button",
")",
... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/gui/sliderwidget.py#L222-L231 | ||
PacketPerception/pychievements | 8b8b21a5be8fface4393fdf16154f02c09464a7a | examples/cli.py | python | MyCLIProgram.do_ls | (self, arg) | List created objects | List created objects | [
"List",
"created",
"objects"
] | def do_ls(self, arg):
""" List created objects """
for _ in self._objects:
print(_)
# every time we run 'ls', increment the level for TheListener
tracker.increment('userid', TheLister) | [
"def",
"do_ls",
"(",
"self",
",",
"arg",
")",
":",
"for",
"_",
"in",
"self",
".",
"_objects",
":",
"print",
"(",
"_",
")",
"# every time we run 'ls', increment the level for TheListener",
"tracker",
".",
"increment",
"(",
"'userid'",
",",
"TheLister",
")"
] | https://github.com/PacketPerception/pychievements/blob/8b8b21a5be8fface4393fdf16154f02c09464a7a/examples/cli.py#L103-L108 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/component.py | python | ConnectComponentAuthenticator.__init__ | (self, componentjid, password) | @type componentjid: C{str}
@param componentjid: Jabber ID that this component wishes to bind to.
@type password: C{str}
@param password: Password/secret this component uses to authenticate. | @type componentjid: C{str}
@param componentjid: Jabber ID that this component wishes to bind to. | [
"@type",
"componentjid",
":",
"C",
"{",
"str",
"}",
"@param",
"componentjid",
":",
"Jabber",
"ID",
"that",
"this",
"component",
"wishes",
"to",
"bind",
"to",
"."
] | def __init__(self, componentjid, password):
"""
@type componentjid: C{str}
@param componentjid: Jabber ID that this component wishes to bind to.
@type password: C{str}
@param password: Password/secret this component uses to authenticate.
"""
# Note that we are se... | [
"def",
"__init__",
"(",
"self",
",",
"componentjid",
",",
"password",
")",
":",
"# Note that we are sending 'to' our desired component JID.",
"xmlstream",
".",
"ConnectAuthenticator",
".",
"__init__",
"(",
"self",
",",
"componentjid",
")",
"self",
".",
"password",
"="... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/component.py#L88-L98 | ||
ricequant/rqalpha-mod-vnpy | 60038b6fc07e46133da0e9bba2df32b83c2103bc | rqalpha_mod_vnpy/ctp/api.py | python | CtpMdApi.onRspUnSubMarketData | (self, data, error, n, last) | 退订合约回报 | 退订合约回报 | [
"退订合约回报"
] | def onRspUnSubMarketData(self, data, error, n, last):
"""退订合约回报"""
pass | [
"def",
"onRspUnSubMarketData",
"(",
"self",
",",
"data",
",",
"error",
",",
"n",
",",
"last",
")",
":",
"pass"
] | https://github.com/ricequant/rqalpha-mod-vnpy/blob/60038b6fc07e46133da0e9bba2df32b83c2103bc/rqalpha_mod_vnpy/ctp/api.py#L108-L110 | ||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/_options.py | python | Options.write_home_config | (self) | Write current configuration into file "~/.config/ezdxf/ezdxf.ini" or
"XDG_CONFIG_HOME/ezdxf/ezdxf.ini". | Write current configuration into file "~/.config/ezdxf/ezdxf.ini" or
"XDG_CONFIG_HOME/ezdxf/ezdxf.ini". | [
"Write",
"current",
"configuration",
"into",
"file",
"~",
"/",
".",
"config",
"/",
"ezdxf",
"/",
"ezdxf",
".",
"ini",
"or",
"XDG_CONFIG_HOME",
"/",
"ezdxf",
"/",
"ezdxf",
".",
"ini",
"."
] | def write_home_config(self):
"""Write current configuration into file "~/.config/ezdxf/ezdxf.ini" or
"XDG_CONFIG_HOME/ezdxf/ezdxf.ini".
"""
home_path = config_home_path()
if not home_path.exists():
try:
home_path.mkdir(parents=True)
except... | [
"def",
"write_home_config",
"(",
"self",
")",
":",
"home_path",
"=",
"config_home_path",
"(",
")",
"if",
"not",
"home_path",
".",
"exists",
"(",
")",
":",
"try",
":",
"home_path",
".",
"mkdir",
"(",
"parents",
"=",
"True",
")",
"except",
"IOError",
"as",... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/_options.py#L311-L329 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/redis/client.py | python | BitFieldOperation.get | (self, fmt, offset) | return self | Get the value of a given bitfield.
:param fmt: format-string for the bitfield being read, e.g. 'u8' for
an unsigned 8-bit integer.
:param offset: offset (in number of bits). If prefixed with a
'#', this is an offset multiplier, e.g. given the arguments
fmt='u8', offse... | Get the value of a given bitfield.
:param fmt: format-string for the bitfield being read, e.g. 'u8' for
an unsigned 8-bit integer.
:param offset: offset (in number of bits). If prefixed with a
'#', this is an offset multiplier, e.g. given the arguments
fmt='u8', offse... | [
"Get",
"the",
"value",
"of",
"a",
"given",
"bitfield",
".",
":",
"param",
"fmt",
":",
"format",
"-",
"string",
"for",
"the",
"bitfield",
"being",
"read",
"e",
".",
"g",
".",
"u8",
"for",
"an",
"unsigned",
"8",
"-",
"bit",
"integer",
".",
":",
"para... | def get(self, fmt, offset):
"""
Get the value of a given bitfield.
:param fmt: format-string for the bitfield being read, e.g. 'u8' for
an unsigned 8-bit integer.
:param offset: offset (in number of bits). If prefixed with a
'#', this is an offset multiplier, e.g.... | [
"def",
"get",
"(",
"self",
",",
"fmt",
",",
"offset",
")",
":",
"self",
".",
"operations",
".",
"append",
"(",
"(",
"'GET'",
",",
"fmt",
",",
"offset",
")",
")",
"return",
"self"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/redis/client.py#L3805-L3816 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py | python | egg_info.write_or_delete_file | (self, what, filename, data, force=False) | Write `data` to `filename` or delete if empty
If `data` is non-empty, this routine is the same as ``write_file()``.
If `data` is empty but not ``None``, this is the same as calling
``delete_file(filename)`. If `data` is ``None``, then this is a no-op
unless `filename` exists, in which ... | Write `data` to `filename` or delete if empty | [
"Write",
"data",
"to",
"filename",
"or",
"delete",
"if",
"empty"
] | def write_or_delete_file(self, what, filename, data, force=False):
"""Write `data` to `filename` or delete if empty
If `data` is non-empty, this routine is the same as ``write_file()``.
If `data` is empty but not ``None``, this is the same as calling
``delete_file(filename)`. If `data`... | [
"def",
"write_or_delete_file",
"(",
"self",
",",
"what",
",",
"filename",
",",
"data",
",",
"force",
"=",
"False",
")",
":",
"if",
"data",
":",
"self",
".",
"write_file",
"(",
"what",
",",
"filename",
",",
"data",
")",
"elif",
"os",
".",
"path",
".",... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py#L242-L260 | ||
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/datastore/data_handler.py | python | get_testcase_ids_in_group | (group_id) | return [key.id() for key in query] | Return the all testcase ids in the specified group. | Return the all testcase ids in the specified group. | [
"Return",
"the",
"all",
"testcase",
"ids",
"in",
"the",
"specified",
"group",
"."
] | def get_testcase_ids_in_group(group_id):
"""Return the all testcase ids in the specified group."""
if not group_id or not str(group_id).isdigit():
return []
query = ndb_utils.get_all_from_query(
data_types.Testcase.query(data_types.Testcase.group_id == int(group_id)),
keys_only=True)
return [ke... | [
"def",
"get_testcase_ids_in_group",
"(",
"group_id",
")",
":",
"if",
"not",
"group_id",
"or",
"not",
"str",
"(",
"group_id",
")",
".",
"isdigit",
"(",
")",
":",
"return",
"[",
"]",
"query",
"=",
"ndb_utils",
".",
"get_all_from_query",
"(",
"data_types",
".... | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/datastore/data_handler.py#L1441-L1449 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/index.py | python | PackageIndex._reader | (self, name, stream, outbuf) | Thread runner for reading lines of from a subprocess into a buffer.
:param name: The logical name of the stream (used for logging only).
:param stream: The stream to read from. This will typically a pipe
connected to the output stream of a subprocess.
:param outbuf: The l... | Thread runner for reading lines of from a subprocess into a buffer. | [
"Thread",
"runner",
"for",
"reading",
"lines",
"of",
"from",
"a",
"subprocess",
"into",
"a",
"buffer",
"."
] | def _reader(self, name, stream, outbuf):
"""
Thread runner for reading lines of from a subprocess into a buffer.
:param name: The logical name of the stream (used for logging only).
:param stream: The stream to read from. This will typically a pipe
connected to th... | [
"def",
"_reader",
"(",
"self",
",",
"name",
",",
"stream",
",",
"outbuf",
")",
":",
"while",
"True",
":",
"s",
"=",
"stream",
".",
"readline",
"(",
")",
"if",
"not",
"s",
":",
"break",
"s",
"=",
"s",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"rs... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/index.py#L134-L150 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py | python | CodingStateMachine.reset | (self) | [] | def reset(self):
self._mCurrentState = eStart | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_mCurrentState",
"=",
"eStart"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py#L39-L40 | ||||
naoto0804/cross-domain-detection | afe7637273ff434318ad56c7a26a5067c40a7eb1 | lib/voc_io.py | python | PascalVocWriter.prettify | (self, elem) | return etree.tostring(root, pretty_print=True) | Return a pretty-printed XML string for the Element. | Return a pretty-printed XML string for the Element. | [
"Return",
"a",
"pretty",
"-",
"printed",
"XML",
"string",
"for",
"the",
"Element",
"."
] | def prettify(self, elem):
"""
Return a pretty-printed XML string for the Element.
"""
rough_string = ElementTree.tostring(elem, 'utf8')
root = etree.fromstring(rough_string)
return etree.tostring(root, pretty_print=True) | [
"def",
"prettify",
"(",
"self",
",",
"elem",
")",
":",
"rough_string",
"=",
"ElementTree",
".",
"tostring",
"(",
"elem",
",",
"'utf8'",
")",
"root",
"=",
"etree",
".",
"fromstring",
"(",
"rough_string",
")",
"return",
"etree",
".",
"tostring",
"(",
"root... | https://github.com/naoto0804/cross-domain-detection/blob/afe7637273ff434318ad56c7a26a5067c40a7eb1/lib/voc_io.py#L27-L33 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/telnetlib.py | python | Telnet._read_until_with_select | (self, match, timeout=None) | return self.read_very_lazy() | Read until a given string is encountered or until timeout.
The timeout is implemented using select.select(). | Read until a given string is encountered or until timeout. | [
"Read",
"until",
"a",
"given",
"string",
"is",
"encountered",
"or",
"until",
"timeout",
"."
] | def _read_until_with_select(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
"""
n = len(match)
self.process_rawq()
i = self.cookedq.find(match)
if i >= 0:
i = ... | [
"def",
"_read_until_with_select",
"(",
"self",
",",
"match",
",",
"timeout",
"=",
"None",
")",
":",
"n",
"=",
"len",
"(",
"match",
")",
"self",
".",
"process_rawq",
"(",
")",
"i",
"=",
"self",
".",
"cookedq",
".",
"find",
"(",
"match",
")",
"if",
"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/telnetlib.py#L342-L376 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | plexpy/helpers.py | python | momentjs_to_arrow | (format, duration=False) | return format | [] | def momentjs_to_arrow(format, duration=False):
invalid_formats = ['Mo', 'DDDo', 'do']
if duration:
invalid_formats += ['A', 'a']
for f in invalid_formats:
format = format.replace(f, '')
return format | [
"def",
"momentjs_to_arrow",
"(",
"format",
",",
"duration",
"=",
"False",
")",
":",
"invalid_formats",
"=",
"[",
"'Mo'",
",",
"'DDDo'",
",",
"'do'",
"]",
"if",
"duration",
":",
"invalid_formats",
"+=",
"[",
"'A'",
",",
"'a'",
"]",
"for",
"f",
"in",
"in... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/helpers.py#L1223-L1229 | |||
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/setting/settings.py | python | ArraySetting._get_element_values | (self) | return tuple(setting.value for setting in self._elements) | [] | def _get_element_values(self):
return tuple(setting.value for setting in self._elements) | [
"def",
"_get_element_values",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"setting",
".",
"value",
"for",
"setting",
"in",
"self",
".",
"_elements",
")"
] | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/setting/settings.py#L2121-L2122 | |||
Yukinoshita47/Yuki-Chan-The-Auto-Pentest | bea1af4e1d544eadc166f728be2f543ea10af191 | Module/dirsearch/thirdparty/requests/cookies.py | python | cookiejar_from_dict | (cookie_dict, cookiejar=None, overwrite=True) | return cookiejar | Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:param cookiejar: (optional) A cookiejar to add the cookies to.
:param overwrite: (optional) If False, will not replace cookies
already in the jar with new ones. | Returns a CookieJar from a key/value dictionary. | [
"Returns",
"a",
"CookieJar",
"from",
"a",
"key",
"/",
"value",
"dictionary",
"."
] | def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True):
"""Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:param cookiejar: (optional) A cookiejar to add the cookies to.
:param overwrite: (optional) If False, will not repl... | [
"def",
"cookiejar_from_dict",
"(",
"cookie_dict",
",",
"cookiejar",
"=",
"None",
",",
"overwrite",
"=",
"True",
")",
":",
"if",
"cookiejar",
"is",
"None",
":",
"cookiejar",
"=",
"RequestsCookieJar",
"(",
")",
"if",
"cookie_dict",
"is",
"not",
"None",
":",
... | https://github.com/Yukinoshita47/Yuki-Chan-The-Auto-Pentest/blob/bea1af4e1d544eadc166f728be2f543ea10af191/Module/dirsearch/thirdparty/requests/cookies.py#L443-L460 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/asymptotic/term_monoid.py | python | ExactTerm._factorial_ | (self) | return self.parent()._create_element_in_extension_(
self.growth, factorial(self.coefficient)) | r"""
Return the factorial of this exact term if it is constant
(i.e., has growth `1`).
OUTPUT:
A term.
TESTS::
sage: from sage.rings.asymptotic.term_monoid import DefaultTermMonoidFactory as TermMonoid
sage: T = TermMonoid('exact', 'z^QQ', QQ)
... | r"""
Return the factorial of this exact term if it is constant
(i.e., has growth `1`). | [
"r",
"Return",
"the",
"factorial",
"of",
"this",
"exact",
"term",
"if",
"it",
"is",
"constant",
"(",
"i",
".",
"e",
".",
"has",
"growth",
"1",
")",
"."
] | def _factorial_(self):
r"""
Return the factorial of this exact term if it is constant
(i.e., has growth `1`).
OUTPUT:
A term.
TESTS::
sage: from sage.rings.asymptotic.term_monoid import DefaultTermMonoidFactory as TermMonoid
sage: T = TermMonoi... | [
"def",
"_factorial_",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"growth",
".",
"is_one",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'Cannot build the factorial of {} since it has growth '",
"'!= 1.'",
".",
"format",
"(",
"self",
")",
")",
"from",
"sage... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/term_monoid.py#L4329-L4359 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/compat/dictconfig.py | python | BaseConfigurator.configure_custom | (self, config) | return result | Configure an object with a user-supplied factory. | Configure an object with a user-supplied factory. | [
"Configure",
"an",
"object",
"with",
"a",
"user",
"-",
"supplied",
"factory",
"."
] | def configure_custom(self, config):
"""Configure an object with a user-supplied factory."""
c = config.pop('()')
if not hasattr(c, '__call__') and hasattr(types, 'ClassType') and type(c) != types.ClassType:
c = self.resolve(c)
props = config.pop('.', None)
# Check for... | [
"def",
"configure_custom",
"(",
"self",
",",
"config",
")",
":",
"c",
"=",
"config",
".",
"pop",
"(",
"'()'",
")",
"if",
"not",
"hasattr",
"(",
"c",
",",
"'__call__'",
")",
"and",
"hasattr",
"(",
"types",
",",
"'ClassType'",
")",
"and",
"type",
"(",
... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/compat/dictconfig.py#L256-L268 | |
chainer/chainer | e9da1423255c58c37be9733f51b158aa9b39dc93 | chainer/links/rnn/n_step_lstm.py | python | NStepLSTMBase.forward | (self, hx, cx, xs, **kwargs) | return hy, cy, ys | forward(self, hx, cx, xs)
Calculates all of the hidden states and the cell states.
Args:
hx (:class:`~chainer.Variable` or None):
Initial hidden states. If ``None`` is specified zero-vector
is used. Its shape is ``(S, B, N)`` for uni-directional LSTM
... | forward(self, hx, cx, xs) | [
"forward",
"(",
"self",
"hx",
"cx",
"xs",
")"
] | def forward(self, hx, cx, xs, **kwargs):
"""forward(self, hx, cx, xs)
Calculates all of the hidden states and the cell states.
Args:
hx (:class:`~chainer.Variable` or None):
Initial hidden states. If ``None`` is specified zero-vector
is used. Its sha... | [
"def",
"forward",
"(",
"self",
",",
"hx",
",",
"cx",
",",
"xs",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"hy",
",",
"cy",
")",
",",
"ys",
"=",
"self",
".",
"_call",
"(",
"[",
"hx",
",",
"cx",
"]",
",",
"xs",
",",
"*",
"*",
"kwargs",
")",
... | https://github.com/chainer/chainer/blob/e9da1423255c58c37be9733f51b158aa9b39dc93/chainer/links/rnn/n_step_lstm.py#L28-L66 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/app/annotations.py | python | prepare | (annotations) | return [expand_annotation(anno) for anno in annotations] | Expand the :setting:`task_annotations` setting. | Expand the :setting:`task_annotations` setting. | [
"Expand",
"the",
":",
"setting",
":",
"task_annotations",
"setting",
"."
] | def prepare(annotations):
"""Expand the :setting:`task_annotations` setting."""
def expand_annotation(annotation):
if isinstance(annotation, dict):
return MapAnnotation(annotation)
elif isinstance(annotation, string_t):
return mlazy(instantiate, annotation)
return... | [
"def",
"prepare",
"(",
"annotations",
")",
":",
"def",
"expand_annotation",
"(",
"annotation",
")",
":",
"if",
"isinstance",
"(",
"annotation",
",",
"dict",
")",
":",
"return",
"MapAnnotation",
"(",
"annotation",
")",
"elif",
"isinstance",
"(",
"annotation",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/app/annotations.py#L37-L50 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/codecs.py | python | getwriter | (encoding) | return lookup(encoding).streamwriter | Lookup up the codec for the given encoding and return
its StreamWriter class or factory function.
Raises a LookupError in case the encoding cannot be found. | Lookup up the codec for the given encoding and return
its StreamWriter class or factory function. | [
"Lookup",
"up",
"the",
"codec",
"for",
"the",
"given",
"encoding",
"and",
"return",
"its",
"StreamWriter",
"class",
"or",
"factory",
"function",
"."
] | def getwriter(encoding):
""" Lookup up the codec for the given encoding and return
its StreamWriter class or factory function.
Raises a LookupError in case the encoding cannot be found.
"""
return lookup(encoding).streamwriter | [
"def",
"getwriter",
"(",
"encoding",
")",
":",
"return",
"lookup",
"(",
"encoding",
")",
".",
"streamwriter"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/codecs.py#L1010-L1018 | |
microsoft/msticpy | 2a401444ee529114004f496f4c0376ff25b5268a | msticpy/sectools/tiproviders/ti_provider_base.py | python | entropy | (input_str: str) | return -sum(
map(
lambda a: (a / str_len) * math.log2(a / str_len),
Counter(input_str).values(),
)
) | Compute entropy of input string. | Compute entropy of input string. | [
"Compute",
"entropy",
"of",
"input",
"string",
"."
] | def entropy(input_str: str) -> float:
"""Compute entropy of input string."""
str_len = float(len(input_str))
return -sum(
map(
lambda a: (a / str_len) * math.log2(a / str_len),
Counter(input_str).values(),
)
) | [
"def",
"entropy",
"(",
"input_str",
":",
"str",
")",
"->",
"float",
":",
"str_len",
"=",
"float",
"(",
"len",
"(",
"input_str",
")",
")",
"return",
"-",
"sum",
"(",
"map",
"(",
"lambda",
"a",
":",
"(",
"a",
"/",
"str_len",
")",
"*",
"math",
".",
... | https://github.com/microsoft/msticpy/blob/2a401444ee529114004f496f4c0376ff25b5268a/msticpy/sectools/tiproviders/ti_provider_base.py#L713-L721 | |
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | ResourceCode/wswp-places-c573d29efa3a/web2py/gluon/contrib/fpdf/fpdf.py | python | FPDF.close | (self) | Terminate document | Terminate document | [
"Terminate",
"document"
] | def close(self):
"Terminate document"
if(self.state==3):
return
if(self.page==0):
self.add_page()
#Page footer
self.in_footer=1
self.footer()
self.in_footer=0
#close page
self._endpage()
#close document
self.... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"state",
"==",
"3",
")",
":",
"return",
"if",
"(",
"self",
".",
"page",
"==",
"0",
")",
":",
"self",
".",
"add_page",
"(",
")",
"#Page footer",
"self",
".",
"in_footer",
"=",
"1",
"... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/ResourceCode/wswp-places-c573d29efa3a/web2py/gluon/contrib/fpdf/fpdf.py#L231-L244 | ||
Dvlv/Tkinter-By-Example | 30721f15f7bea41489a7c46819beb5282781e563 | Code/Chapter4-2.py | python | Game.add_inventory_item | (self, item_name) | [] | def add_inventory_item(self, item_name):
next_available_inventory_slot = len(self.inventory_slots_in_use)
if next_available_inventory_slot < len(self.inventory_slots):
next_slot = self.inventory_slots[next_available_inventory_slot]
next_label_var = self.item_label_vars[next_avail... | [
"def",
"add_inventory_item",
"(",
"self",
",",
"item_name",
")",
":",
"next_available_inventory_slot",
"=",
"len",
"(",
"self",
".",
"inventory_slots_in_use",
")",
"if",
"next_available_inventory_slot",
"<",
"len",
"(",
"self",
".",
"inventory_slots",
")",
":",
"n... | https://github.com/Dvlv/Tkinter-By-Example/blob/30721f15f7bea41489a7c46819beb5282781e563/Code/Chapter4-2.py#L166-L176 | ||||
fzlee/alipay | 0f8eab30fea7adb43284182cc6bcac08f51b2e08 | alipay/__init__.py | python | BaseAliPay._get_string_to_be_signed | (self, raw_string, response_type) | return raw_string[start:end] | https://docs.open.alipay.com/200/106120
从同步返回的接口里面找到待签名的字符串 | https://docs.open.alipay.com/200/106120
从同步返回的接口里面找到待签名的字符串 | [
"https",
":",
"//",
"docs",
".",
"open",
".",
"alipay",
".",
"com",
"/",
"200",
"/",
"106120",
"从同步返回的接口里面找到待签名的字符串"
] | def _get_string_to_be_signed(self, raw_string, response_type):
"""
https://docs.open.alipay.com/200/106120
从同步返回的接口里面找到待签名的字符串
"""
balance = 0
start = end = raw_string.find("{", raw_string.find(response_type))
# 从response_type之后的第一个{的下一位开始匹配,
# 如果是{则balanc... | [
"def",
"_get_string_to_be_signed",
"(",
"self",
",",
"raw_string",
",",
"response_type",
")",
":",
"balance",
"=",
"0",
"start",
"=",
"end",
"=",
"raw_string",
".",
"find",
"(",
"\"{\"",
",",
"raw_string",
".",
"find",
"(",
"response_type",
")",
")",
"# 从r... | https://github.com/fzlee/alipay/blob/0f8eab30fea7adb43284182cc6bcac08f51b2e08/alipay/__init__.py#L605-L622 | |
Gallopsled/pwntools | 1573957cc8b1957399b7cc9bfae0c6f80630d5d4 | pwnlib/util/fiddling.py | python | randoms | (count, alphabet = string.ascii_lowercase) | return ''.join(random.choice(alphabet) for _ in range(count)) | randoms(count, alphabet = string.ascii_lowercase) -> str
Returns a random string of a given length using only the specified alphabet.
Arguments:
count (int): The length of the desired string.
alphabet: The alphabet of allowed characters. Defaults to all lowercase characters.
Returns:
... | randoms(count, alphabet = string.ascii_lowercase) -> str | [
"randoms",
"(",
"count",
"alphabet",
"=",
"string",
".",
"ascii_lowercase",
")",
"-",
">",
"str"
] | def randoms(count, alphabet = string.ascii_lowercase):
"""randoms(count, alphabet = string.ascii_lowercase) -> str
Returns a random string of a given length using only the specified alphabet.
Arguments:
count (int): The length of the desired string.
alphabet: The alphabet of allowed charac... | [
"def",
"randoms",
"(",
"count",
",",
"alphabet",
"=",
"string",
".",
"ascii_lowercase",
")",
":",
"return",
"''",
".",
"join",
"(",
"random",
".",
"choice",
"(",
"alphabet",
")",
"for",
"_",
"in",
"range",
"(",
"count",
")",
")"
] | https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/util/fiddling.py#L445-L463 | |
mjwestcott/Goodrich | dc2516591bd28488516c0337a62e64248debe47c | ch03/disjoint.py | python | disjoint2 | (A, B, C) | return True | Return True if there is no element common to all three lists. | Return True if there is no element common to all three lists. | [
"Return",
"True",
"if",
"there",
"is",
"no",
"element",
"common",
"to",
"all",
"three",
"lists",
"."
] | def disjoint2(A, B, C):
"""Return True if there is no element common to all three lists."""
for a in A:
for b in B:
if a == b: # only check C if we found match from A and B
for c in C:
if a == c # (and thus a == b == c)
return False # we found a common v... | [
"def",
"disjoint2",
"(",
"A",
",",
"B",
",",
"C",
")",
":",
"for",
"a",
"in",
"A",
":",
"for",
"b",
"in",
"B",
":",
"if",
"a",
"==",
"b",
":",
"# only check C if we found match from A and B",
"for",
"c",
"in",
"C",
":",
"if",
"a",
"==",
"c",
"# (... | https://github.com/mjwestcott/Goodrich/blob/dc2516591bd28488516c0337a62e64248debe47c/ch03/disjoint.py#L31-L39 | |
encode/django-rest-framework | c5be86a6dbf3d21b00a296af5994fa075826bf0b | rest_framework/request.py | python | wrap_attributeerrors | () | Used to re-raise AttributeErrors caught during authentication, preventing
these errors from otherwise being handled by the attribute access protocol. | Used to re-raise AttributeErrors caught during authentication, preventing
these errors from otherwise being handled by the attribute access protocol. | [
"Used",
"to",
"re",
"-",
"raise",
"AttributeErrors",
"caught",
"during",
"authentication",
"preventing",
"these",
"errors",
"from",
"otherwise",
"being",
"handled",
"by",
"the",
"attribute",
"access",
"protocol",
"."
] | def wrap_attributeerrors():
"""
Used to re-raise AttributeErrors caught during authentication, preventing
these errors from otherwise being handled by the attribute access protocol.
"""
try:
yield
except AttributeError:
info = sys.exc_info()
exc = WrappedAttributeError(st... | [
"def",
"wrap_attributeerrors",
"(",
")",
":",
"try",
":",
"yield",
"except",
"AttributeError",
":",
"info",
"=",
"sys",
".",
"exc_info",
"(",
")",
"exc",
"=",
"WrappedAttributeError",
"(",
"str",
"(",
"info",
"[",
"1",
"]",
")",
")",
"raise",
"exc",
".... | https://github.com/encode/django-rest-framework/blob/c5be86a6dbf3d21b00a296af5994fa075826bf0b/rest_framework/request.py#L68-L78 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_serviceaccount.py | python | Yedit.process_edits | (edits, yamlfile) | return {'changed': len(results) > 0, 'results': results} | run through a list of edits and process them one-by-one | run through a list of edits and process them one-by-one | [
"run",
"through",
"a",
"list",
"of",
"edits",
"and",
"process",
"them",
"one",
"-",
"by",
"-",
"one"
] | def process_edits(edits, yamlfile):
'''run through a list of edits and process them one-by-one'''
results = []
for edit in edits:
value = Yedit.parse_value(edit['value'], edit.get('value_type', ''))
if edit.get('action') == 'update':
# pylint: disable=line... | [
"def",
"process_edits",
"(",
"edits",
",",
"yamlfile",
")",
":",
"results",
"=",
"[",
"]",
"for",
"edit",
"in",
"edits",
":",
"value",
"=",
"Yedit",
".",
"parse_value",
"(",
"edit",
"[",
"'value'",
"]",
",",
"edit",
".",
"get",
"(",
"'value_type'",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_serviceaccount.py#L700-L725 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/skeinforge_application/skeinforge_utilities/skeinforge_profile.py | python | ProfilePluginRadioButtonsSaveListener.save | (self) | Profile has been saved and profile radio plugins should be updated. | Profile has been saved and profile radio plugins should be updated. | [
"Profile",
"has",
"been",
"saved",
"and",
"profile",
"radio",
"plugins",
"should",
"be",
"updated",
"."
] | def save(self):
"Profile has been saved and profile radio plugins should be updated."
craftTypeName = getCraftTypeName()
for radioPlugin in self.radioPlugins:
if radioPlugin.name == craftTypeName:
radioPlugin.setSelect()
self.repository.pluginFrame.update()
return | [
"def",
"save",
"(",
"self",
")",
":",
"craftTypeName",
"=",
"getCraftTypeName",
"(",
")",
"for",
"radioPlugin",
"in",
"self",
".",
"radioPlugins",
":",
"if",
"radioPlugin",
".",
"name",
"==",
"craftTypeName",
":",
"radioPlugin",
".",
"setSelect",
"(",
")",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_utilities/skeinforge_profile.py#L335-L342 | ||
mlcommons/inference | 078e21f2bc0a37c7fd0e435d64f5a49760dca823 | speech_recognition/rnnt/pytorch/helpers.py | python | process_evaluation_epoch | (global_vars: dict, tag=None) | return wer | Processes results from each worker at the end of evaluation and combine to final result
Args:
global_vars: dictionary containing information of entire evaluation
Return:
wer: final word error rate
loss: final loss | Processes results from each worker at the end of evaluation and combine to final result
Args:
global_vars: dictionary containing information of entire evaluation
Return:
wer: final word error rate
loss: final loss | [
"Processes",
"results",
"from",
"each",
"worker",
"at",
"the",
"end",
"of",
"evaluation",
"and",
"combine",
"to",
"final",
"result",
"Args",
":",
"global_vars",
":",
"dictionary",
"containing",
"information",
"of",
"entire",
"evaluation",
"Return",
":",
"wer",
... | def process_evaluation_epoch(global_vars: dict, tag=None):
"""
Processes results from each worker at the end of evaluation and combine to final result
Args:
global_vars: dictionary containing information of entire evaluation
Return:
wer: final word error rate
loss: final loss
... | [
"def",
"process_evaluation_epoch",
"(",
"global_vars",
":",
"dict",
",",
"tag",
"=",
"None",
")",
":",
"hypotheses",
"=",
"global_vars",
"[",
"'predictions'",
"]",
"references",
"=",
"global_vars",
"[",
"'transcripts'",
"]",
"wer",
",",
"scores",
",",
"num_wor... | https://github.com/mlcommons/inference/blob/078e21f2bc0a37c7fd0e435d64f5a49760dca823/speech_recognition/rnnt/pytorch/helpers.py#L101-L115 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/dev/bdf_vectorized2/cards/elements/shells.py | python | ShellElement.__init__ | (self, model) | initializes the ShellElement | initializes the ShellElement | [
"initializes",
"the",
"ShellElement"
] | def __init__(self, model):
"""initializes the ShellElement"""
self.model = model
self.is_current = True
self.eid = np.array([], dtype='int32')
self.pid = np.array([], dtype='int32')
self.nids = np.array([], dtype='float64')
self.theta = np.array([], dtype='int32')... | [
"def",
"__init__",
"(",
"self",
",",
"model",
")",
":",
"self",
".",
"model",
"=",
"model",
"self",
".",
"is_current",
"=",
"True",
"self",
".",
"eid",
"=",
"np",
".",
"array",
"(",
"[",
"]",
",",
"dtype",
"=",
"'int32'",
")",
"self",
".",
"pid",... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized2/cards/elements/shells.py#L19-L45 | ||
klen/graphite-beacon | c1f071e9f557693bc90f6acbc314994985dc3b77 | graphite_beacon/handlers/opsgenie.py | python | OpsgenieHandler.init_handler | (self) | [] | def init_handler(self):
self.api_key = self.options.get('api_key')
assert self.api_key, "Opsgenie API key not defined."
self.client = httpclient.AsyncHTTPClient() | [
"def",
"init_handler",
"(",
"self",
")",
":",
"self",
".",
"api_key",
"=",
"self",
".",
"options",
".",
"get",
"(",
"'api_key'",
")",
"assert",
"self",
".",
"api_key",
",",
"\"Opsgenie API key not defined.\"",
"self",
".",
"client",
"=",
"httpclient",
".",
... | https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/handlers/opsgenie.py#L17-L20 | ||||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py | python | BbsBlsSignatureProof2020._transform_blank_node_ids_into_placeholder_node_ids | (
self,
statements: List[str],
) | return transformed_statements | Transform blank node identifiers for the input into actual node identifiers.
e.g _:c14n0 => urn:bnid:_:c14n0
Args:
statements (List[str]): List with possible blank node identifiers
Returns:
List[str]: List of transformed output statements | Transform blank node identifiers for the input into actual node identifiers. | [
"Transform",
"blank",
"node",
"identifiers",
"for",
"the",
"input",
"into",
"actual",
"node",
"identifiers",
"."
] | def _transform_blank_node_ids_into_placeholder_node_ids(
self,
statements: List[str],
) -> List[str]:
"""Transform blank node identifiers for the input into actual node identifiers.
e.g _:c14n0 => urn:bnid:_:c14n0
Args:
statements (List[str]): List with possible... | [
"def",
"_transform_blank_node_ids_into_placeholder_node_ids",
"(",
"self",
",",
"statements",
":",
"List",
"[",
"str",
"]",
",",
")",
"->",
"List",
"[",
"str",
"]",
":",
"# replace all occurrences of _:c14nX with <urn:bnid:_:c14nX>",
"transformed_statements",
"=",
"[",
... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py#L320-L341 | |
PanJinquan/nlp-learning-tutorials | b5c3c5b8a507e853c753a389cad0b8215e87b26e | THUCNews/utils/create_word2vec.py | python | pos_neg_test | () | 转换词向量提供有两种方法:
[1]直接转换:根据字词直接映射到词向量:word2vector_lookup
[2]间接转换:先将字词转为索引矩阵,再由索引矩阵映射到词向量:word2indexMat->indexMat2vector_lookup | 转换词向量提供有两种方法:
[1]直接转换:根据字词直接映射到词向量:word2vector_lookup
[2]间接转换:先将字词转为索引矩阵,再由索引矩阵映射到词向量:word2indexMat->indexMat2vector_lookup | [
"转换词向量提供有两种方法:",
"[",
"1",
"]",
"直接转换:根据字词直接映射到词向量:word2vector_lookup",
"[",
"2",
"]",
"间接转换:先将字词转为索引矩阵,再由索引矩阵映射到词向量:word2indexMat",
"-",
">",
"indexMat2vector_lookup"
] | def pos_neg_test():
positive_data_file = "./data/ham_5000.utf8"
negative_data_file = './data/spam_5000.utf8'
word2vec_path = 'out/trained_word2vec.model'
sentences, labels = files_processing.load_pos_neg_files(positive_data_file, negative_data_file)
# embedding_test(positive_data_file,negative_data... | [
"def",
"pos_neg_test",
"(",
")",
":",
"positive_data_file",
"=",
"\"./data/ham_5000.utf8\"",
"negative_data_file",
"=",
"'./data/spam_5000.utf8'",
"word2vec_path",
"=",
"'out/trained_word2vec.model'",
"sentences",
",",
"labels",
"=",
"files_processing",
".",
"load_pos_neg_fil... | https://github.com/PanJinquan/nlp-learning-tutorials/blob/b5c3c5b8a507e853c753a389cad0b8215e87b26e/THUCNews/utils/create_word2vec.py#L186-L210 | ||
has2k1/plotnine | 6c82cdc20d6f81c96772da73fc07a672a0a0a6ef | plotnine/facets/layout.py | python | Layout.xlabel | (self, labels) | Determine x-axis label
Parameters
----------
labels : dict
Labels as specified by the user through the ``labs`` or
``xlab`` calls.
Returns
-------
out : str
x-axis label | Determine x-axis label | [
"Determine",
"x",
"-",
"axis",
"label"
] | def xlabel(self, labels):
"""
Determine x-axis label
Parameters
----------
labels : dict
Labels as specified by the user through the ``labs`` or
``xlab`` calls.
Returns
-------
out : str
x-axis label
"""
... | [
"def",
"xlabel",
"(",
"self",
",",
"labels",
")",
":",
"if",
"self",
".",
"panel_scales_x",
"[",
"0",
"]",
".",
"name",
"is",
"not",
"None",
":",
"return",
"self",
".",
"panel_scales_x",
"[",
"0",
"]",
".",
"name",
"else",
":",
"return",
"labels",
... | https://github.com/has2k1/plotnine/blob/6c82cdc20d6f81c96772da73fc07a672a0a0a6ef/plotnine/facets/layout.py#L205-L223 | ||
amundsen-io/amundsendatabuilder | a0af611350fde12438450d4bfd83b226ef220c3f | databuilder/models/dashboard/dashboard_usage.py | python | DashboardUsage.__init__ | (self,
dashboard_group_id: Optional[str],
dashboard_id: Optional[str],
email: str,
view_count: int,
should_create_user_node: Optional[bool] = False,
product: Optional[str] = '',
cluster: Optional[str] ... | :param dashboard_group_id:
:param dashboard_id:
:param email:
:param view_count:
:param should_create_user_node: Enable this if it is fine to create/update User node with only with email
address. Please be advised that other fields will be emptied. Current use case is to create a... | [] | def __init__(self,
dashboard_group_id: Optional[str],
dashboard_id: Optional[str],
email: str,
view_count: int,
should_create_user_node: Optional[bool] = False,
product: Optional[str] = '',
cluster: Op... | [
"def",
"__init__",
"(",
"self",
",",
"dashboard_group_id",
":",
"Optional",
"[",
"str",
"]",
",",
"dashboard_id",
":",
"Optional",
"[",
"str",
"]",
",",
"email",
":",
"str",
",",
"view_count",
":",
"int",
",",
"should_create_user_node",
":",
"Optional",
"[... | https://github.com/amundsen-io/amundsendatabuilder/blob/a0af611350fde12438450d4bfd83b226ef220c3f/databuilder/models/dashboard/dashboard_usage.py#L30-L63 | |||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/tkinter/__init__.py | python | PhotoImage.subsample | (self, x, y='') | return destImage | Return a new PhotoImage based on the same image as this widget
but use only every Xth or Yth pixel. If y is not given, the
default value is the same as x. | Return a new PhotoImage based on the same image as this widget
but use only every Xth or Yth pixel. If y is not given, the
default value is the same as x. | [
"Return",
"a",
"new",
"PhotoImage",
"based",
"on",
"the",
"same",
"image",
"as",
"this",
"widget",
"but",
"use",
"only",
"every",
"Xth",
"or",
"Yth",
"pixel",
".",
"If",
"y",
"is",
"not",
"given",
"the",
"default",
"value",
"is",
"the",
"same",
"as",
... | def subsample(self, x, y=''):
"""Return a new PhotoImage based on the same image as this widget
but use only every Xth or Yth pixel. If y is not given, the
default value is the same as x.
"""
destImage = PhotoImage(master=self.tk)
if y=='': y=x
self.tk.call(destI... | [
"def",
"subsample",
"(",
"self",
",",
"x",
",",
"y",
"=",
"''",
")",
":",
"destImage",
"=",
"PhotoImage",
"(",
"master",
"=",
"self",
".",
"tk",
")",
"if",
"y",
"==",
"''",
":",
"y",
"=",
"x",
"self",
".",
"tk",
".",
"call",
"(",
"destImage",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/__init__.py#L4123-L4131 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/amcrest/camera.py | python | AmcrestCam.handle_async_mjpeg_stream | (
self, request: web.Request
) | Return an MJPEG stream. | Return an MJPEG stream. | [
"Return",
"an",
"MJPEG",
"stream",
"."
] | async def handle_async_mjpeg_stream(
self, request: web.Request
) -> web.StreamResponse | None:
"""Return an MJPEG stream."""
# The snapshot implementation is handled by the parent class
if self._stream_source == "snapshot":
return await super().handle_async_mjpeg_stream(... | [
"async",
"def",
"handle_async_mjpeg_stream",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
"->",
"web",
".",
"StreamResponse",
"|",
"None",
":",
"# The snapshot implementation is handled by the parent class",
"if",
"self",
".",
"_stream_source",
"==",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/amcrest/camera.py#L242-L283 | ||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | xtune/src/transformers/data/processors/xglue.py | python | XnliProcessor.get_labels | (self) | return ["contradiction", "entailment", "neutral"] | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_labels(self):
"""See base class."""
return ["contradiction", "entailment", "neutral"] | [
"def",
"get_labels",
"(",
"self",
")",
":",
"return",
"[",
"\"contradiction\"",
",",
"\"entailment\"",
",",
"\"neutral\"",
"]"
] | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/data/processors/xglue.py#L1030-L1032 | |
Cog-Creators/Red-DiscordBot | b05933274a11fb097873ab0d1b246d37b06aa306 | redbot/core/settings_caches.py | python | I18nManager.set_locale | (
self, guild: Union[discord.Guild, None], locale: Union[str, None]
) | Set the locale in the config and cache | Set the locale in the config and cache | [
"Set",
"the",
"locale",
"in",
"the",
"config",
"and",
"cache"
] | async def set_locale(
self, guild: Union[discord.Guild, None], locale: Union[str, None]
) -> None:
"""Set the locale in the config and cache"""
if guild is None:
if locale is None:
# this method should never be called like this
raise ValueError("Gl... | [
"async",
"def",
"set_locale",
"(",
"self",
",",
"guild",
":",
"Union",
"[",
"discord",
".",
"Guild",
",",
"None",
"]",
",",
"locale",
":",
"Union",
"[",
"str",
",",
"None",
"]",
")",
"->",
"None",
":",
"if",
"guild",
"is",
"None",
":",
"if",
"loc... | https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/core/settings_caches.py#L97-L109 | ||
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/orm/nodes/process/process.py | python | ProcessNode.process_status | (self) | return self.get_attribute(self.PROCESS_STATUS_KEY, None) | Return the process status
The process status is a generic status message e.g. the reason it might be paused or when it is being killed
:returns: the process status | Return the process status | [
"Return",
"the",
"process",
"status"
] | def process_status(self) -> Optional[str]:
"""
Return the process status
The process status is a generic status message e.g. the reason it might be paused or when it is being killed
:returns: the process status
"""
return self.get_attribute(self.PROCESS_STATUS_KEY, None... | [
"def",
"process_status",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"get_attribute",
"(",
"self",
".",
"PROCESS_STATUS_KEY",
",",
"None",
")"
] | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/nodes/process/process.py#L184-L192 | |
natashamjaques/neural_chat | ddb977bb4602a67c460d02231e7bbf7b2cb49a97 | ParlAI/parlai/mturk/core/legacy_2018/mturk_manager.py | python | MTurkManager.block_worker | (self, worker_id, reason) | Block a worker by id using the mturk client, passes reason along | Block a worker by id using the mturk client, passes reason along | [
"Block",
"a",
"worker",
"by",
"id",
"using",
"the",
"mturk",
"client",
"passes",
"reason",
"along"
] | def block_worker(self, worker_id, reason):
"""Block a worker by id using the mturk client, passes reason along"""
client = mturk_utils.get_mturk_client(self.is_sandbox)
client.create_worker_block(WorkerId=worker_id, Reason=reason)
shared_utils.print_and_log(
logging.INFO,
... | [
"def",
"block_worker",
"(",
"self",
",",
"worker_id",
",",
"reason",
")",
":",
"client",
"=",
"mturk_utils",
".",
"get_mturk_client",
"(",
"self",
".",
"is_sandbox",
")",
"client",
".",
"create_worker_block",
"(",
"WorkerId",
"=",
"worker_id",
",",
"Reason",
... | https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/mturk/core/legacy_2018/mturk_manager.py#L1735-L1742 | ||
PreOS-Security/fwaudit | f38d8ace3c1be487edc2d66d689aa5bb9ff07f56 | fwaudit.py | python | intel_amt_discovery | (toolns, tool, prd, ptd, erc) | return spawn_process(cmd, ptd, erc, toolns) | Run live command: 'INTEL-SA-00075-Discovery-Tool'. | Run live command: 'INTEL-SA-00075-Discovery-Tool'. | [
"Run",
"live",
"command",
":",
"INTEL",
"-",
"SA",
"-",
"00075",
"-",
"Discovery",
"-",
"Tool",
"."
] | def intel_amt_discovery(toolns, tool, prd, ptd, erc):
'''Run live command: 'INTEL-SA-00075-Discovery-Tool'.'''
if not os_is_linux():
error(tool + ' only works on Linux')
return -1 # XXX generate exception
info('Executing ' + toolns + ' variation of tool: ' + tool)
cmd = [tool]
retur... | [
"def",
"intel_amt_discovery",
"(",
"toolns",
",",
"tool",
",",
"prd",
",",
"ptd",
",",
"erc",
")",
":",
"if",
"not",
"os_is_linux",
"(",
")",
":",
"error",
"(",
"tool",
"+",
"' only works on Linux'",
")",
"return",
"-",
"1",
"# XXX generate exception",
"in... | https://github.com/PreOS-Security/fwaudit/blob/f38d8ace3c1be487edc2d66d689aa5bb9ff07f56/fwaudit.py#L4772-L4779 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/html5lib/_inputstream.py | python | EncodingBytes.__new__ | (self, value) | return bytes.__new__(self, value.lower()) | [] | def __new__(self, value):
assert isinstance(value, bytes)
return bytes.__new__(self, value.lower()) | [
"def",
"__new__",
"(",
"self",
",",
"value",
")",
":",
"assert",
"isinstance",
"(",
"value",
",",
"bytes",
")",
"return",
"bytes",
".",
"__new__",
"(",
"self",
",",
"value",
".",
"lower",
"(",
")",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/html5lib/_inputstream.py#L582-L584 | |||
googlefonts/nototools | 903a218f62256a286cde48c76b3051703f8a1de5 | nototools/lint_config.py | python | TestSpec._process_data | (data) | return tag_data | data is a hierarchy of tags. any level down to root can be enabled or disabled. this
builds a representation of the tag hierarchy from the text description. | data is a hierarchy of tags. any level down to root can be enabled or disabled. this
builds a representation of the tag hierarchy from the text description. | [
"data",
"is",
"a",
"hierarchy",
"of",
"tags",
".",
"any",
"level",
"down",
"to",
"root",
"can",
"be",
"enabled",
"or",
"disabled",
".",
"this",
"builds",
"a",
"representation",
"of",
"the",
"tag",
"hierarchy",
"from",
"the",
"text",
"description",
"."
] | def _process_data(data):
"""data is a hierarchy of tags. any level down to root can be enabled or disabled. this
builds a representation of the tag hierarchy from the text description."""
_data_line_re = re.compile(
r"(\s*)([a-z0-9_]+)(?:\s+([^\s]+)\s+([^\s]+))?\s*(?:--\s*(.+)\s*)?$... | [
"def",
"_process_data",
"(",
"data",
")",
":",
"_data_line_re",
"=",
"re",
".",
"compile",
"(",
"r\"(\\s*)([a-z0-9_]+)(?:\\s+([^\\s]+)\\s+([^\\s]+))?\\s*(?:--\\s*(.+)\\s*)?$\"",
")",
"tag_data",
"=",
"{",
"}",
"indent",
"=",
"(",
"0",
",",
"\"\"",
",",
"None",
")"... | https://github.com/googlefonts/nototools/blob/903a218f62256a286cde48c76b3051703f8a1de5/nototools/lint_config.py#L504-L537 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/settings.py | python | PerfectDomainContextHandler.encode_setting | (self, context, setting, value) | Same as is domain context handler, but handles separately stored
class_vars. | Same as is domain context handler, but handles separately stored
class_vars. | [
"Same",
"as",
"is",
"domain",
"context",
"handler",
"but",
"handles",
"separately",
"stored",
"class_vars",
"."
] | def encode_setting(self, context, setting, value):
"""Same as is domain context handler, but handles separately stored
class_vars."""
if isinstance(setting, ContextSetting) and isinstance(value, str):
def _candidate_variables():
if not setting.exclude_attributes:
... | [
"def",
"encode_setting",
"(",
"self",
",",
"context",
",",
"setting",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"setting",
",",
"ContextSetting",
")",
"and",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"def",
"_candidate_variables",
"(",
")",
... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/settings.py#L357-L376 | ||
timy90022/One-Shot-Object-Detection | 26ca16238f2c4f17685ea57b646d58a2d7542fdb | lib/datasets/pascal_voc_rbg.py | python | pascal_voc._do_matlab_eval | (self, output_dir='output') | [] | def _do_matlab_eval(self, output_dir='output'):
print('-----------------------------------------------------')
print('Computing results with the official MATLAB eval code.')
print('-----------------------------------------------------')
path = os.path.join(cfg.ROOT_DIR, 'lib', 'datasets',
... | [
"def",
"_do_matlab_eval",
"(",
"self",
",",
"output_dir",
"=",
"'output'",
")",
":",
"print",
"(",
"'-----------------------------------------------------'",
")",
"print",
"(",
"'Computing results with the official MATLAB eval code.'",
")",
"print",
"(",
"'-------------------... | https://github.com/timy90022/One-Shot-Object-Detection/blob/26ca16238f2c4f17685ea57b646d58a2d7542fdb/lib/datasets/pascal_voc_rbg.py#L268-L281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.