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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3DLIRIOUS/MeshLabXML | e19fdc911644474f74463aabba1e6860cfad818e | meshlabxml/transform.py | python | wrap2cylinder | (script, radius=1, pitch=0, taper=0, pitch_func=None,
taper_func=None) | return None | Deform mesh around cylinder of radius and axis z
y = 0 will be on the surface of radius "radius"
pitch != 0 will create a helix, with distance "pitch" traveled in z for each rotation
taper = change in r over z. E.g. a value of 0.5 will shrink r by 0.5 for every z length of 1 | Deform mesh around cylinder of radius and axis z | [
"Deform",
"mesh",
"around",
"cylinder",
"of",
"radius",
"and",
"axis",
"z"
] | def wrap2cylinder(script, radius=1, pitch=0, taper=0, pitch_func=None,
taper_func=None):
"""Deform mesh around cylinder of radius and axis z
y = 0 will be on the surface of radius "radius"
pitch != 0 will create a helix, with distance "pitch" traveled in z for each rotation
taper = ch... | [
"def",
"wrap2cylinder",
"(",
"script",
",",
"radius",
"=",
"1",
",",
"pitch",
"=",
"0",
",",
"taper",
"=",
"0",
",",
"pitch_func",
"=",
"None",
",",
"taper_func",
"=",
"None",
")",
":",
"\"\"\"vert_function(s=s, x='(%s+y-taper)*sin(x/(%s+y))' % (radius, radius),\n... | https://github.com/3DLIRIOUS/MeshLabXML/blob/e19fdc911644474f74463aabba1e6860cfad818e/meshlabxml/transform.py#L702-L734 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | TensorFlow2/LanguageModeling/BERT/official/nlp/transformer/model_utils.py | python | get_decoder_self_attention_bias | (length, dtype=tf.float32) | return decoder_bias | Calculate bias for decoder that maintains model's autoregressive property.
Creates a tensor that masks out locations that correspond to illegal
connections, so prediction at position i cannot draw information from future
positions.
Args:
length: int length of sequences in batch.
dtype: The dtype of th... | Calculate bias for decoder that maintains model's autoregressive property. | [
"Calculate",
"bias",
"for",
"decoder",
"that",
"maintains",
"model",
"s",
"autoregressive",
"property",
"."
] | def get_decoder_self_attention_bias(length, dtype=tf.float32):
"""Calculate bias for decoder that maintains model's autoregressive property.
Creates a tensor that masks out locations that correspond to illegal
connections, so prediction at position i cannot draw information from future
positions.
Args:
... | [
"def",
"get_decoder_self_attention_bias",
"(",
"length",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
":",
"neg_inf",
"=",
"_NEG_INF_FP16",
"if",
"dtype",
"==",
"tf",
".",
"float16",
"else",
"_NEG_INF_FP32",
"with",
"tf",
".",
"name_scope",
"(",
"\"decoder_se... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow2/LanguageModeling/BERT/official/nlp/transformer/model_utils.py#L64-L84 | |
santatic/web2attack | 44b6e481a3d56cf0d98073ae0fb69833dda563d9 | w2a/lib/mysql/connector/connection.py | python | MySQLConnection.ping | (self, reconnect=False, attempts=1, delay=0) | Check availability to the MySQL server
When reconnect is set to True, one or more attempts are made to try
to reconnect to the MySQL server using the reconnect()-method.
delay is the number of seconds to wait between each retry.
When the connection is not available, an InterfaceError ... | Check availability to the MySQL server | [
"Check",
"availability",
"to",
"the",
"MySQL",
"server"
] | def ping(self, reconnect=False, attempts=1, delay=0):
"""Check availability to the MySQL server
When reconnect is set to True, one or more attempts are made to try
to reconnect to the MySQL server using the reconnect()-method.
delay is the number of seconds to wait between each retry.
... | [
"def",
"ping",
"(",
"self",
",",
"reconnect",
"=",
"False",
",",
"attempts",
"=",
"1",
",",
"delay",
"=",
"0",
")",
":",
"try",
":",
"self",
".",
"cmd_ping",
"(",
")",
"except",
":",
"if",
"not",
"reconnect",
":",
"raise",
"errors",
".",
"Interface... | https://github.com/santatic/web2attack/blob/44b6e481a3d56cf0d98073ae0fb69833dda563d9/w2a/lib/mysql/connector/connection.py#L721-L742 | ||
fedspendingtransparency/usaspending-api | b13bd5bcba0369ff8512f61a34745626c3969391 | usaspending_api/common/helpers/date_helper.py | python | _compare_datetimes | (first_datetime: datetime, second_datetime: datetime, op_func: Callable) | return bool(op_func(dt_1, dt_2)) | Comparison of datetimes using provided function. If TZ-unaware, assumes UTC | Comparison of datetimes using provided function. If TZ-unaware, assumes UTC | [
"Comparison",
"of",
"datetimes",
"using",
"provided",
"function",
".",
"If",
"TZ",
"-",
"unaware",
"assumes",
"UTC"
] | def _compare_datetimes(first_datetime: datetime, second_datetime: datetime, op_func: Callable) -> bool:
"""Comparison of datetimes using provided function. If TZ-unaware, assumes UTC"""
dt_1 = cast_datetime_to_utc(first_datetime)
dt_2 = cast_datetime_to_utc(second_datetime)
return bool(op_func(dt_1, dt_... | [
"def",
"_compare_datetimes",
"(",
"first_datetime",
":",
"datetime",
",",
"second_datetime",
":",
"datetime",
",",
"op_func",
":",
"Callable",
")",
"->",
"bool",
":",
"dt_1",
"=",
"cast_datetime_to_utc",
"(",
"first_datetime",
")",
"dt_2",
"=",
"cast_datetime_to_u... | https://github.com/fedspendingtransparency/usaspending-api/blob/b13bd5bcba0369ff8512f61a34745626c3969391/usaspending_api/common/helpers/date_helper.py#L112-L116 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/tablib-0.12.1/tablib/packages/dbfpy3/fields.py | python | DbfMemoFieldDef.encodeValue | (self, value) | Return raw data string encoded from a ``value``.
Note: this is an internal method. | Return raw data string encoded from a ``value``. | [
"Return",
"raw",
"data",
"string",
"encoded",
"from",
"a",
"value",
"."
] | def encodeValue(self, value):
"""Return raw data string encoded from a ``value``.
Note: this is an internal method.
"""
#return str(value)[:self.length].ljust(self.length)
raise NotImplementedError | [
"def",
"encodeValue",
"(",
"self",
",",
"value",
")",
":",
"#return str(value)[:self.length].ljust(self.length)",
"raise",
"NotImplementedError"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/tablib-0.12.1/tablib/packages/dbfpy3/fields.py#L345-L352 | ||
renerocksai/sublimeless_zk | 6738375c0e371f0c2fde0aa9e539242cfd2b4777 | src/libzk2setevi/convert.py | python | Zk2Setevi.find_all_notes_all_tags | (self) | Manual implementation to get a dict mapping note_ids to tags
and tags to note ids. Also record note titles.
Added Filtering based on date range and tag black / whitelists | Manual implementation to get a dict mapping note_ids to tags
and tags to note ids. Also record note titles.
Added Filtering based on date range and tag black / whitelists | [
"Manual",
"implementation",
"to",
"get",
"a",
"dict",
"mapping",
"note_ids",
"to",
"tags",
"and",
"tags",
"to",
"note",
"ids",
".",
"Also",
"record",
"note",
"titles",
".",
"Added",
"Filtering",
"based",
"on",
"date",
"range",
"and",
"tag",
"black",
"/",
... | def find_all_notes_all_tags(self):
"""
Manual implementation to get a dict mapping note_ids to tags
and tags to note ids. Also record note titles.
Added Filtering based on date range and tag black / whitelists
"""
# manual implementation
for filn in self.get_all_n... | [
"def",
"find_all_notes_all_tags",
"(",
"self",
")",
":",
"# manual implementation",
"for",
"filn",
"in",
"self",
".",
"get_all_notes",
"(",
")",
":",
"note_id",
"=",
"self",
".",
"get_note_id_of_file",
"(",
"filn",
")",
"if",
"not",
"note_id",
":",
"continue",... | https://github.com/renerocksai/sublimeless_zk/blob/6738375c0e371f0c2fde0aa9e539242cfd2b4777/src/libzk2setevi/convert.py#L141-L191 | ||
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/tutorials/rnn/ptb/reader.py | python | ptb_producer | (raw_data, batch_size, num_steps, name=None) | Iterate on the raw PTB data.
This chunks up raw_data into batches of examples and returns Tensors that
are drawn from these batches.
Args:
raw_data: one of the raw data outputs from ptb_raw_data.
batch_size: int, the batch size.
num_steps: int, the number of unrolls.
name: the name of this opera... | Iterate on the raw PTB data. | [
"Iterate",
"on",
"the",
"raw",
"PTB",
"data",
"."
] | def ptb_producer(raw_data, batch_size, num_steps, name=None):
"""Iterate on the raw PTB data.
This chunks up raw_data into batches of examples and returns Tensors that
are drawn from these batches.
Args:
raw_data: one of the raw data outputs from ptb_raw_data.
batch_size: int, the batch size.
num_... | [
"def",
"ptb_producer",
"(",
"raw_data",
",",
"batch_size",
",",
"num_steps",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"\"PTBProducer\"",
",",
"[",
"raw_data",
",",
"batch_size",
",",
"num_steps",
"]",
")",
":... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/tutorials/rnn/ptb/reader.py#L86-L127 | ||
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/core/leoKeys.py | python | KeyHandlerClass.stroke2char | (self, stroke) | return stroke.toInsertableChar() | Convert a stroke to an (insertable) char.
This method allows Leo to use strokes everywhere. | Convert a stroke to an (insertable) char.
This method allows Leo to use strokes everywhere. | [
"Convert",
"a",
"stroke",
"to",
"an",
"(",
"insertable",
")",
"char",
".",
"This",
"method",
"allows",
"Leo",
"to",
"use",
"strokes",
"everywhere",
"."
] | def stroke2char(self, stroke):
"""
Convert a stroke to an (insertable) char.
This method allows Leo to use strokes everywhere.
"""
if not stroke:
return ''
if not g.isStroke(stroke):
# vim commands pass a plain key.
stroke = g.KeyStroke... | [
"def",
"stroke2char",
"(",
"self",
",",
"stroke",
")",
":",
"if",
"not",
"stroke",
":",
"return",
"''",
"if",
"not",
"g",
".",
"isStroke",
"(",
"stroke",
")",
":",
"# vim commands pass a plain key.",
"stroke",
"=",
"g",
".",
"KeyStroke",
"(",
"stroke",
"... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoKeys.py#L3958-L3968 | |
nortikin/sverchok | 7b460f01317c15f2681bfa3e337c5e7346f3711b | utils/manifolds.py | python | intersect_curve_plane | (curve, plane, method = EQUATION, **kwargs) | Call for intersect_curve_plane_equation, intersect_curve_plane_ortho,
or intersect_curve_plane_nurbs, depending on `method` parameter.
Inputs and outputs: see corresponding method docs. | Call for intersect_curve_plane_equation, intersect_curve_plane_ortho,
or intersect_curve_plane_nurbs, depending on `method` parameter.
Inputs and outputs: see corresponding method docs. | [
"Call",
"for",
"intersect_curve_plane_equation",
"intersect_curve_plane_ortho",
"or",
"intersect_curve_plane_nurbs",
"depending",
"on",
"method",
"parameter",
".",
"Inputs",
"and",
"outputs",
":",
"see",
"corresponding",
"method",
"docs",
"."
] | def intersect_curve_plane(curve, plane, method = EQUATION, **kwargs):
"""
Call for intersect_curve_plane_equation, intersect_curve_plane_ortho,
or intersect_curve_plane_nurbs, depending on `method` parameter.
Inputs and outputs: see corresponding method docs.
"""
if method == EQUATION:
r... | [
"def",
"intersect_curve_plane",
"(",
"curve",
",",
"plane",
",",
"method",
"=",
"EQUATION",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"method",
"==",
"EQUATION",
":",
"return",
"intersect_curve_plane_equation",
"(",
"curve",
",",
"plane",
",",
"*",
"*",
"kw... | https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/utils/manifolds.py#L941-L954 | ||
rlworkgroup/garage | b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507 | src/garage/examples/tf/dqn_cartpole.py | python | dqn_cartpole | (ctxt=None, seed=1) | Train TRPO with CubeCrash-v0 environment.
Args:
ctxt (garage.experiment.ExperimentContext): The experiment
configuration used by Trainer to create the snapshotter.
seed (int): Used to seed the random number generator to produce
determinism. | Train TRPO with CubeCrash-v0 environment. | [
"Train",
"TRPO",
"with",
"CubeCrash",
"-",
"v0",
"environment",
"."
] | def dqn_cartpole(ctxt=None, seed=1):
"""Train TRPO with CubeCrash-v0 environment.
Args:
ctxt (garage.experiment.ExperimentContext): The experiment
configuration used by Trainer to create the snapshotter.
seed (int): Used to seed the random number generator to produce
det... | [
"def",
"dqn_cartpole",
"(",
"ctxt",
"=",
"None",
",",
"seed",
"=",
"1",
")",
":",
"set_seed",
"(",
"seed",
")",
"with",
"TFTrainer",
"(",
"ctxt",
")",
"as",
"trainer",
":",
"n_epochs",
"=",
"10",
"steps_per_epoch",
"=",
"10",
"sampler_batch_size",
"=",
... | https://github.com/rlworkgroup/garage/blob/b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507/src/garage/examples/tf/dqn_cartpole.py#L19-L68 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/framemanager.py | python | AuiPaneInfo.Maximize | (self) | return self.SetFlag(self.optionMaximized, True) | Makes the pane take up the full area. | Makes the pane take up the full area. | [
"Makes",
"the",
"pane",
"take",
"up",
"the",
"full",
"area",
"."
] | def Maximize(self):
""" Makes the pane take up the full area."""
return self.SetFlag(self.optionMaximized, True) | [
"def",
"Maximize",
"(",
"self",
")",
":",
"return",
"self",
".",
"SetFlag",
"(",
"self",
".",
"optionMaximized",
",",
"True",
")"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/framemanager.py#L1121-L1124 | |
TKkk-iOSer/wechat-alfred-workflow | 449995275dd700bcb3686abcfe2ed9c63ea826a3 | src/workflow/workflow.py | python | Workflow.stored_data | (self, name) | return data | Retrieve data from data directory.
Returns ``None`` if there are no data stored under ``name``.
.. versionadded:: 1.8
:param name: name of datastore | Retrieve data from data directory. | [
"Retrieve",
"data",
"from",
"data",
"directory",
"."
] | def stored_data(self, name):
"""Retrieve data from data directory.
Returns ``None`` if there are no data stored under ``name``.
.. versionadded:: 1.8
:param name: name of datastore
"""
metadata_path = self.datafile('.{0}.alfred-workflow'.format(name))
if not ... | [
"def",
"stored_data",
"(",
"self",
",",
"name",
")",
":",
"metadata_path",
"=",
"self",
".",
"datafile",
"(",
"'.{0}.alfred-workflow'",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"metadata_path",
")",
":",
... | https://github.com/TKkk-iOSer/wechat-alfred-workflow/blob/449995275dd700bcb3686abcfe2ed9c63ea826a3/src/workflow/workflow.py#L1552-L1596 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | examples/digital/digitalWriteColorsLed_JS/main.py | python | myProcess | () | [] | def myProcess():
print("Hello world") | [
"def",
"myProcess",
"(",
")",
":",
"print",
"(",
"\"Hello world\"",
")"
] | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/examples/digital/digitalWriteColorsLed_JS/main.py#L6-L7 | ||||
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/urllib2.py | python | request_host | (request) | return host.lower() | Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison. | Return request-host, as defined by RFC 2965. | [
"Return",
"request",
"-",
"host",
"as",
"defined",
"by",
"RFC",
"2965",
"."
] | def request_host(request):
"""Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison.
"""
url = request.get_full_url()
host = urlparse.urlparse(url)[1]
if host == "":
host = request.get_header("Host", "")
# remo... | [
"def",
"request_host",
"(",
"request",
")",
":",
"url",
"=",
"request",
".",
"get_full_url",
"(",
")",
"host",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
"[",
"1",
"]",
"if",
"host",
"==",
"\"\"",
":",
"host",
"=",
"request",
".",
"get_header... | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/urllib2.py#L208-L222 | |
marionmari/pyGPs | 792f3c6cb91126ade9f23a8e39d9cbcd30cfbc7b | pyGPs/Core/gp.py | python | GP.predict | (self, xs, ys=None) | Prediction of test points (given by xs) based on training data of the current model.
This method will output the following value:\n
predictive output means(ym),\n
predictive output variances(ys2),\n
predictive latent means(fm),\n
predictive latent variances(fs2),\n
log pr... | Prediction of test points (given by xs) based on training data of the current model.
This method will output the following value:\n
predictive output means(ym),\n
predictive output variances(ys2),\n
predictive latent means(fm),\n
predictive latent variances(fs2),\n
log pr... | [
"Prediction",
"of",
"test",
"points",
"(",
"given",
"by",
"xs",
")",
"based",
"on",
"training",
"data",
"of",
"the",
"current",
"model",
".",
"This",
"method",
"will",
"output",
"the",
"following",
"value",
":",
"\\",
"n",
"predictive",
"output",
"means",
... | def predict(self, xs, ys=None):
'''
Prediction of test points (given by xs) based on training data of the current model.
This method will output the following value:\n
predictive output means(ym),\n
predictive output variances(ys2),\n
predictive latent means(fm),\n
... | [
"def",
"predict",
"(",
"self",
",",
"xs",
",",
"ys",
"=",
"None",
")",
":",
"# check the shape of inputs",
"# transform to correct shape if neccessary",
"if",
"xs",
".",
"ndim",
"==",
"1",
":",
"xs",
"=",
"np",
".",
"reshape",
"(",
"xs",
",",
"(",
"xs",
... | https://github.com/marionmari/pyGPs/blob/792f3c6cb91126ade9f23a8e39d9cbcd30cfbc7b/pyGPs/Core/gp.py#L349-L437 | ||
cheind/pytorch-blender | ef35c5b3eec884515d4f343671a8a3337b8aa1fb | pkg_blender/blendtorch/btb/animation.py | python | AnimationController._set_frame | (self, frame_index) | Step to a specific frame. | Step to a specific frame. | [
"Step",
"to",
"a",
"specific",
"frame",
"."
] | def _set_frame(self, frame_index):
'''Step to a specific frame.'''
with self._plyctx.enable_events(): # needed for env support?
bpy.context.scene.frame_set(frame_index) | [
"def",
"_set_frame",
"(",
"self",
",",
"frame_index",
")",
":",
"with",
"self",
".",
"_plyctx",
".",
"enable_events",
"(",
")",
":",
"# needed for env support?",
"bpy",
".",
"context",
".",
"scene",
".",
"frame_set",
"(",
"frame_index",
")"
] | https://github.com/cheind/pytorch-blender/blob/ef35c5b3eec884515d4f343671a8a3337b8aa1fb/pkg_blender/blendtorch/btb/animation.py#L194-L197 | ||
hasegaw/IkaLog | bd476da541fcc296f792d4db76a6b9174c4777ad | tools/statink/reprocess_screenshots.py | python | _get_args | () | return parser.parse_args() | [] | def _get_args():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--bind', '-b', dest='bind_addr',
type=str, default='localhost')
parser.add_argument('--port', '-p', dest='bind_port',
type=int, default=8888)
parser.add_argument('... | [
"def",
"_get_args",
"(",
")",
":",
"import",
"argparse",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--bind'",
",",
"'-b'",
",",
"dest",
"=",
"'bind_addr'",
",",
"type",
"=",
"str",
",",
"default",
"=... | https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/tools/statink/reprocess_screenshots.py#L487-L503 | |||
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/address_book.py | python | ContactFolder.get_folder | (self, folder_id=None, folder_name=None) | return self.__class__(con=self.con, protocol=self.protocol,
main_resource=self.main_resource,
**{self._cloud_data_key: folder}) | Returns a Contact Folder by it's id or child folders by name
:param folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param folder_name: the folder name to be retrieved.
Must be a child of this folder
:return: a single contact folder
:rtype... | Returns a Contact Folder by it's id or child folders by name | [
"Returns",
"a",
"Contact",
"Folder",
"by",
"it",
"s",
"id",
"or",
"child",
"folders",
"by",
"name"
] | def get_folder(self, folder_id=None, folder_name=None):
""" Returns a Contact Folder by it's id or child folders by name
:param folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param folder_name: the folder name to be retrieved.
Must be a child of... | [
"def",
"get_folder",
"(",
"self",
",",
"folder_id",
"=",
"None",
",",
"folder_name",
"=",
"None",
")",
":",
"if",
"folder_id",
"and",
"folder_name",
":",
"raise",
"RuntimeError",
"(",
"'Provide only one of the options'",
")",
"if",
"not",
"folder_id",
"and",
"... | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/address_book.py#L751-L801 | |
fastavro/fastavro | dc1179d6d0e63c1d6e7cbeb5e0886bf70672745f | fastavro/_logical_writers_py.py | python | prepare_timestamp_micros | (data, schema) | Converts datetime.datetime to int timestamp with microseconds | Converts datetime.datetime to int timestamp with microseconds | [
"Converts",
"datetime",
".",
"datetime",
"to",
"int",
"timestamp",
"with",
"microseconds"
] | def prepare_timestamp_micros(data, schema):
"""Converts datetime.datetime to int timestamp with microseconds"""
if isinstance(data, datetime.datetime):
if data.tzinfo is not None:
delta = data - epoch
return (
delta.days * 24 * 3600 + delta.seconds
) *... | [
"def",
"prepare_timestamp_micros",
"(",
"data",
",",
"schema",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"datetime",
".",
"datetime",
")",
":",
"if",
"data",
".",
"tzinfo",
"is",
"not",
"None",
":",
"delta",
"=",
"data",
"-",
"epoch",
"return",
"... | https://github.com/fastavro/fastavro/blob/dc1179d6d0e63c1d6e7cbeb5e0886bf70672745f/fastavro/_logical_writers_py.py#L68-L89 | ||
xuanjihe/speech-emotion-recognition | b0ba1255b2977faeaf93818a3a5a92c0be4c7c59 | model1.py | python | dense_to_one_hot | (labels_dense, num_classes) | return labels_one_hot | Convert class labels from scalars to one-hot vectors. | Convert class labels from scalars to one-hot vectors. | [
"Convert",
"class",
"labels",
"from",
"scalars",
"to",
"one",
"-",
"hot",
"vectors",
"."
] | def dense_to_one_hot(labels_dense, num_classes):
"""Convert class labels from scalars to one-hot vectors."""
num_labels = labels_dense.shape[0]
index_offset = np.arange(num_labels) * num_classes
labels_one_hot = np.zeros((num_labels, num_classes))
labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
... | [
"def",
"dense_to_one_hot",
"(",
"labels_dense",
",",
"num_classes",
")",
":",
"num_labels",
"=",
"labels_dense",
".",
"shape",
"[",
"0",
"]",
"index_offset",
"=",
"np",
".",
"arange",
"(",
"num_labels",
")",
"*",
"num_classes",
"labels_one_hot",
"=",
"np",
"... | https://github.com/xuanjihe/speech-emotion-recognition/blob/b0ba1255b2977faeaf93818a3a5a92c0be4c7c59/model1.py#L71-L77 | |
nedbat/coveragepy | d004b18a1ad59ec89b89c96c03a789a55cc51693 | coverage/debug.py | python | add_pid_and_tid | (text) | return text | A filter to add pid and tid to debug messages. | A filter to add pid and tid to debug messages. | [
"A",
"filter",
"to",
"add",
"pid",
"and",
"tid",
"to",
"debug",
"messages",
"."
] | def add_pid_and_tid(text):
"""A filter to add pid and tid to debug messages."""
# Thread ids are useful, but too long. Make a shorter one.
tid = f"{short_id(_thread.get_ident()):04x}"
text = f"{os.getpid():5d}.{tid}: {text}"
return text | [
"def",
"add_pid_and_tid",
"(",
"text",
")",
":",
"# Thread ids are useful, but too long. Make a shorter one.",
"tid",
"=",
"f\"{short_id(_thread.get_ident()):04x}\"",
"text",
"=",
"f\"{os.getpid():5d}.{tid}: {text}\"",
"return",
"text"
] | https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/debug.py#L181-L186 | |
HariSekhon/Nagios-Plugins | a436fc63e10ab8a64d623df109777dea2eda5758 | check_logserver.py | python | LogServerTester.vprint | (self, verbosity, message) | Prints messages based on the verbosity level. Takes 2 arguments,
verbosity, and the message. If verbosity is equal to or greater than
the minimum verbosity then the message is printed | Prints messages based on the verbosity level. Takes 2 arguments,
verbosity, and the message. If verbosity is equal to or greater than
the minimum verbosity then the message is printed | [
"Prints",
"messages",
"based",
"on",
"the",
"verbosity",
"level",
".",
"Takes",
"2",
"arguments",
"verbosity",
"and",
"the",
"message",
".",
"If",
"verbosity",
"is",
"equal",
"to",
"or",
"greater",
"than",
"the",
"minimum",
"verbosity",
"then",
"the",
"messa... | def vprint(self, verbosity, message):
"""Prints messages based on the verbosity level. Takes 2 arguments,
verbosity, and the message. If verbosity is equal to or greater than
the minimum verbosity then the message is printed"""
if self.verbosity >= verbosity:
print(str(messa... | [
"def",
"vprint",
"(",
"self",
",",
"verbosity",
",",
"message",
")",
":",
"if",
"self",
".",
"verbosity",
">=",
"verbosity",
":",
"print",
"(",
"str",
"(",
"message",
")",
")"
] | https://github.com/HariSekhon/Nagios-Plugins/blob/a436fc63e10ab8a64d623df109777dea2eda5758/check_logserver.py#L508-L514 | ||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/urllib3/connectionpool.py | python | connection_from_url | (url, **kw) | Given a url, return an :class:`.ConnectionPool` instance of its host.
This is a shortcut for not having to parse out the scheme, host, and port
of the url before creating an :class:`.ConnectionPool` instance.
:param url:
Absolute URL string that must include the scheme. Port is optional.
:par... | Given a url, return an :class:`.ConnectionPool` instance of its host. | [
"Given",
"a",
"url",
"return",
"an",
":",
"class",
":",
".",
"ConnectionPool",
"instance",
"of",
"its",
"host",
"."
] | def connection_from_url(url, **kw):
"""
Given a url, return an :class:`.ConnectionPool` instance of its host.
This is a shortcut for not having to parse out the scheme, host, and port
of the url before creating an :class:`.ConnectionPool` instance.
:param url:
Absolute URL string that must... | [
"def",
"connection_from_url",
"(",
"url",
",",
"*",
"*",
"kw",
")",
":",
"scheme",
",",
"host",
",",
"port",
"=",
"get_host",
"(",
"url",
")",
"port",
"=",
"port",
"or",
"port_by_scheme",
".",
"get",
"(",
"scheme",
",",
"80",
")",
"if",
"scheme",
"... | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/urllib3/connectionpool.py#L861-L886 | ||
scrapinghub/frontera | 84f9e1034d2868447db88e865596c0fbb32e70f6 | frontera/contrib/backends/hbase/domaincache.py | python | DomainCache.get | (self, key, default=None) | HBase-optimized get | HBase-optimized get | [
"HBase",
"-",
"optimized",
"get"
] | def get(self, key, default=None):
"""
HBase-optimized get
"""
self._key_check(key)
self._log_and_rotate_stats()
if super(DomainCache, self).__contains__(key) or key in self._second_gen:
self.stats["gets_memory_hit"] += 1
return self[key]
tr... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_key_check",
"(",
"key",
")",
"self",
".",
"_log_and_rotate_stats",
"(",
")",
"if",
"super",
"(",
"DomainCache",
",",
"self",
")",
".",
"__contains__",
"(",
"... | https://github.com/scrapinghub/frontera/blob/84f9e1034d2868447db88e865596c0fbb32e70f6/frontera/contrib/backends/hbase/domaincache.py#L192-L208 | ||
inkstitch/inkstitch | 0db5548567aa2bc3bc06461f030716a1382afeeb | lib/elements/satin_column.py | python | SatinColumn._find_cut_points | (self, split_point) | Find the points on each satin corresponding to the split point.
split_point is a point that is near but not necessarily touching one
of the rails. It is projected onto that rail to obtain the cut point
for that rail. A corresponding cut point will be chosen on the other
rail, taking i... | Find the points on each satin corresponding to the split point. | [
"Find",
"the",
"points",
"on",
"each",
"satin",
"corresponding",
"to",
"the",
"split",
"point",
"."
] | def _find_cut_points(self, split_point):
"""Find the points on each satin corresponding to the split point.
split_point is a point that is near but not necessarily touching one
of the rails. It is projected onto that rail to obtain the cut point
for that rail. A corresponding cut poin... | [
"def",
"_find_cut_points",
"(",
"self",
",",
"split_point",
")",
":",
"# like in do_satin()",
"points",
"=",
"list",
"(",
"chain",
".",
"from_iterable",
"(",
"zip",
"(",
"*",
"self",
".",
"plot_points_on_rails",
"(",
"self",
".",
"zigzag_spacing",
",",
"0",
... | https://github.com/inkstitch/inkstitch/blob/0db5548567aa2bc3bc06461f030716a1382afeeb/lib/elements/satin_column.py#L475-L506 | ||
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/protocols/amp.py | python | AmpBox.serialize | (self) | return b"".join(L) | Convert me into a wire-encoded string.
@return: a C{bytes} encoded according to the rules described in the
module docstring. | Convert me into a wire-encoded string. | [
"Convert",
"me",
"into",
"a",
"wire",
"-",
"encoded",
"string",
"."
] | def serialize(self):
"""
Convert me into a wire-encoded string.
@return: a C{bytes} encoded according to the rules described in the
module docstring.
"""
i = sorted(self.items())
L = []
w = L.append
for k, v in i:
if type(k) == str... | [
"def",
"serialize",
"(",
"self",
")",
":",
"i",
"=",
"sorted",
"(",
"self",
".",
"items",
"(",
")",
")",
"L",
"=",
"[",
"]",
"w",
"=",
"L",
".",
"append",
"for",
"k",
",",
"v",
"in",
"i",
":",
"if",
"type",
"(",
"k",
")",
"==",
"str",
":"... | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/protocols/amp.py#L659-L682 | |
yiranran/Audio-driven-TalkingFace-HeadPose | d062a00a46a5d0ebb4bf66751e7a9af92ee418e8 | render-to-video/models/memory_network.py | python | Memory_Network.get_feature | (self, k, _bs) | return feat, self.top_index[k] | [] | def get_feature(self, k, _bs):
feat = torch.cat([torch.unsqueeze(self.color_value[k, :], dim = 0) for i in range(_bs)], dim = 0)
return feat, self.top_index[k] | [
"def",
"get_feature",
"(",
"self",
",",
"k",
",",
"_bs",
")",
":",
"feat",
"=",
"torch",
".",
"cat",
"(",
"[",
"torch",
".",
"unsqueeze",
"(",
"self",
".",
"color_value",
"[",
"k",
",",
":",
"]",
",",
"dim",
"=",
"0",
")",
"for",
"i",
"in",
"... | https://github.com/yiranran/Audio-driven-TalkingFace-HeadPose/blob/d062a00a46a5d0ebb4bf66751e7a9af92ee418e8/render-to-video/models/memory_network.py#L126-L128 | |||
iopsgroup/imoocc | de810eb6d4c1697b7139305925a5b0ba21225f3f | scanhosts/modules/paramiko1_9/transport.py | python | Transport.set_subsystem_handler | (self, name, handler, *larg, **kwarg) | Set the handler class for a subsystem in server mode. If a request
for this subsystem is made on an open ssh channel later, this handler
will be constructed and called -- see L{SubsystemHandler} for more
detailed documentation.
Any extra parameters (including keyword arguments) are sav... | Set the handler class for a subsystem in server mode. If a request
for this subsystem is made on an open ssh channel later, this handler
will be constructed and called -- see L{SubsystemHandler} for more
detailed documentation. | [
"Set",
"the",
"handler",
"class",
"for",
"a",
"subsystem",
"in",
"server",
"mode",
".",
"If",
"a",
"request",
"for",
"this",
"subsystem",
"is",
"made",
"on",
"an",
"open",
"ssh",
"channel",
"later",
"this",
"handler",
"will",
"be",
"constructed",
"and",
... | def set_subsystem_handler(self, name, handler, *larg, **kwarg):
"""
Set the handler class for a subsystem in server mode. If a request
for this subsystem is made on an open ssh channel later, this handler
will be constructed and called -- see L{SubsystemHandler} for more
detaile... | [
"def",
"set_subsystem_handler",
"(",
"self",
",",
"name",
",",
"handler",
",",
"*",
"larg",
",",
"*",
"*",
"kwarg",
")",
":",
"try",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"subsystem_table",
"[",
"name",
"]",
"=",
"(",
"ha... | https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/scanhosts/modules/paramiko1_9/transport.py#L1049-L1069 | ||
glm-tools/pyglmnet | 6ddc9bc1ef95afce0a03f9f440c4e6a5322f68e4 | pyglmnet/pyglmnet.py | python | _L2penalty | (beta, Tau) | return L2penalty | The L2 penalty. | The L2 penalty. | [
"The",
"L2",
"penalty",
"."
] | def _L2penalty(beta, Tau):
"""The L2 penalty."""
# Compute the L2 penalty
if Tau is None:
# Ridge=like penalty
L2penalty = np.linalg.norm(beta, 2) ** 2
else:
# Tikhonov penalty
if (Tau.shape[0] != beta.shape[0] or
Tau.shape[1] != beta.shape[0]):
... | [
"def",
"_L2penalty",
"(",
"beta",
",",
"Tau",
")",
":",
"# Compute the L2 penalty",
"if",
"Tau",
"is",
"None",
":",
"# Ridge=like penalty",
"L2penalty",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"beta",
",",
"2",
")",
"**",
"2",
"else",
":",
"# Tikhono... | https://github.com/glm-tools/pyglmnet/blob/6ddc9bc1ef95afce0a03f9f440c4e6a5322f68e4/pyglmnet/pyglmnet.py#L170-L183 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | DemoPrograms/Demo_Desktop_Widget_RAM_Square.py | python | main | (location) | [] | def main(location):
graph = sg.Graph(GSIZE, (0, 0), GSIZE, key='-GRAPH-', enable_events=True)
layout = [[graph]]
window = sg.Window('RAM Usage Widget Square', layout, location=location, no_titlebar=True, grab_anywhere=True, margins=(0, 0), element_padding=(0, 0), alpha_channel=ALPHA, finalize=True, right_... | [
"def",
"main",
"(",
"location",
")",
":",
"graph",
"=",
"sg",
".",
"Graph",
"(",
"GSIZE",
",",
"(",
"0",
",",
"0",
")",
",",
"GSIZE",
",",
"key",
"=",
"'-GRAPH-'",
",",
"enable_events",
"=",
"True",
")",
"layout",
"=",
"[",
"[",
"graph",
"]",
"... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Desktop_Widget_RAM_Square.py#L28-L54 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/wrapper_util.py | python | Paths.scrub_path | (self, script_name, paths) | return [path for path in paths
if os.path.normcase(path) not in sys_paths_to_scrub] | Removes bad paths from a list of paths.
Args:
script_name: the basename of the script, for example 'appcfg.py'.
paths: a list of paths
Returns:
The list of paths with any bad paths removed. | Removes bad paths from a list of paths. | [
"Removes",
"bad",
"paths",
"from",
"a",
"list",
"of",
"paths",
"."
] | def scrub_path(self, script_name, paths):
"""Removes bad paths from a list of paths.
Args:
script_name: the basename of the script, for example 'appcfg.py'.
paths: a list of paths
Returns:
The list of paths with any bad paths removed.
"""
sys_paths_to_scrub = self._sys_paths_to_s... | [
"def",
"scrub_path",
"(",
"self",
",",
"script_name",
",",
"paths",
")",
":",
"sys_paths_to_scrub",
"=",
"self",
".",
"_sys_paths_to_scrub",
".",
"get",
"(",
"script_name",
",",
"[",
"]",
")",
"return",
"[",
"path",
"for",
"path",
"in",
"paths",
"if",
"o... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/wrapper_util.py#L307-L321 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/mailbox.py | python | Mailbox.popitem | (self) | Delete an arbitrary (key, message) pair and return it. | Delete an arbitrary (key, message) pair and return it. | [
"Delete",
"an",
"arbitrary",
"(",
"key",
"message",
")",
"pair",
"and",
"return",
"it",
"."
] | def popitem(self):
"""Delete an arbitrary (key, message) pair and return it."""
for key in self.iterkeys():
return (key, self.pop(key)) # This is only run once.
else:
raise KeyError('No messages in mailbox') | [
"def",
"popitem",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"iterkeys",
"(",
")",
":",
"return",
"(",
"key",
",",
"self",
".",
"pop",
"(",
"key",
")",
")",
"# This is only run once.",
"else",
":",
"raise",
"KeyError",
"(",
"'No messages i... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/mailbox.py#L160-L165 | ||
open-cogsci/OpenSesame | c4a3641b097a80a76937edbd8c365f036bcc9705 | libqtopensesame/widgets/font_widget.py | python | font_widget_base.initialize | (
self,
experiment=None,
family=None,
italic=None,
bold=None,
size=None,
parent=None
) | desc:
Initializes the widget.
arguments:
experiment: The experiment.
keywords:
family: The font family or None to use experiment default.
italic: The font italic state or None to use experiment
default.
bold: font bold state or None to use experiment default.
size: The font size or None to... | desc:
Initializes the widget. | [
"desc",
":",
"Initializes",
"the",
"widget",
"."
] | def initialize(
self,
experiment=None,
family=None,
italic=None,
bold=None,
size=None,
parent=None
):
"""
desc:
Initializes the widget.
arguments:
experiment: The experiment.
keywords:
family: The font family or None to use experiment default.
italic: The font italic state or None... | [
"def",
"initialize",
"(",
"self",
",",
"experiment",
"=",
"None",
",",
"family",
"=",
"None",
",",
"italic",
"=",
"None",
",",
"bold",
"=",
"None",
",",
"size",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"self",
".",
"_parent",
"=",
"parent... | https://github.com/open-cogsci/OpenSesame/blob/c4a3641b097a80a76937edbd8c365f036bcc9705/libqtopensesame/widgets/font_widget.py#L116-L166 | ||
PRBonn/bonnet | 7bf03b06e48faec46d39ea6b4b4706a73ff6ce48 | train_py/dataset/general.py | python | read_data_sets | (DATA) | return data_sets | Get the dataset in the format that we need it
and give it to the main app
-*- coding: utf-8 -*-
Args:
DATA: Dictionary with dataset information.
Structure for the input dir:
Dataset
├── test
│ ├── img
│ │ └── pic3.jpg
│ └... | Get the dataset in the format that we need it
and give it to the main app
-*- coding: utf-8 -*-
Args:
DATA: Dictionary with dataset information.
Structure for the input dir:
Dataset
├── test
│ ├── img
│ │ └── pic3.jpg
│ └... | [
"Get",
"the",
"dataset",
"in",
"the",
"format",
"that",
"we",
"need",
"it",
"and",
"give",
"it",
"to",
"the",
"main",
"app",
"-",
"*",
"-",
"coding",
":",
"utf",
"-",
"8",
"-",
"*",
"-",
"Args",
":",
"DATA",
":",
"Dictionary",
"with",
"dataset",
... | def read_data_sets(DATA):
"""Get the dataset in the format that we need it
and give it to the main app
-*- coding: utf-8 -*-
Args:
DATA: Dictionary with dataset information.
Structure for the input dir:
Dataset
├── test
│ ├── img
│ │ └... | [
"def",
"read_data_sets",
"(",
"DATA",
")",
":",
"# get the datasets from the folders",
"data_dir",
"=",
"DATA",
"[",
"'data_dir'",
"]",
"directories",
"=",
"[",
"\"/train\"",
",",
"\"/valid\"",
",",
"\"/test\"",
"]",
"types",
"=",
"[",
"\"/img\"",
",",
"\"/lbl\"... | https://github.com/PRBonn/bonnet/blob/7bf03b06e48faec46d39ea6b4b4706a73ff6ce48/train_py/dataset/general.py#L184-L277 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib2to3/pgen2/pgen.py | python | ParserGenerator.addfirstsets | (self) | [] | def addfirstsets(self):
names = self.dfas.keys()
names.sort()
for name in names:
if name not in self.first:
self.calcfirst(name) | [
"def",
"addfirstsets",
"(",
"self",
")",
":",
"names",
"=",
"self",
".",
"dfas",
".",
"keys",
"(",
")",
"names",
".",
"sort",
"(",
")",
"for",
"name",
"in",
"names",
":",
"if",
"name",
"not",
"in",
"self",
".",
"first",
":",
"self",
".",
"calcfir... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib2to3/pgen2/pgen.py#L107-L112 | ||||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/PIL/PdfParser.py | python | PdfParser.start_writing | (self) | [] | def start_writing(self):
self.close_buf()
self.seek_end() | [
"def",
"start_writing",
"(",
"self",
")",
":",
"self",
".",
"close_buf",
"(",
")",
"self",
".",
"seek_end",
"(",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/PIL/PdfParser.py#L392-L394 | ||||
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/readers/__init__.py | python | load_readers | (filenames=None, reader=None, reader_kwargs=None) | return reader_instances | Create specified readers and assign files to them.
Args:
filenames (iterable or dict): A sequence of files that will be used to load data from. A ``dict`` object
should map reader names to a list of filenames for that reader.
reader (str or list): The name of t... | Create specified readers and assign files to them. | [
"Create",
"specified",
"readers",
"and",
"assign",
"files",
"to",
"them",
"."
] | def load_readers(filenames=None, reader=None, reader_kwargs=None):
"""Create specified readers and assign files to them.
Args:
filenames (iterable or dict): A sequence of files that will be used to load data from. A ``dict`` object
should map reader names to a list... | [
"def",
"load_readers",
"(",
"filenames",
"=",
"None",
",",
"reader",
"=",
"None",
",",
"reader_kwargs",
"=",
"None",
")",
":",
"reader_instances",
"=",
"{",
"}",
"if",
"_early_exit",
"(",
"filenames",
",",
"reader",
")",
":",
"return",
"{",
"}",
"reader"... | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/readers/__init__.py#L525-L579 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/urllib/request.py | python | urlcleanup | () | Clean up temporary files from urlretrieve calls. | Clean up temporary files from urlretrieve calls. | [
"Clean",
"up",
"temporary",
"files",
"from",
"urlretrieve",
"calls",
"."
] | def urlcleanup():
"""Clean up temporary files from urlretrieve calls."""
for temp_file in _url_tempfiles:
try:
os.unlink(temp_file)
except OSError:
pass
del _url_tempfiles[:]
global _opener
if _opener:
_opener = None | [
"def",
"urlcleanup",
"(",
")",
":",
"for",
"temp_file",
"in",
"_url_tempfiles",
":",
"try",
":",
"os",
".",
"unlink",
"(",
"temp_file",
")",
"except",
"OSError",
":",
"pass",
"del",
"_url_tempfiles",
"[",
":",
"]",
"global",
"_opener",
"if",
"_opener",
"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/urllib/request.py#L286-L297 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/PIL/PdfParser.py | python | PdfParser.read_xref_table | (self, xref_section_offset) | return offset | [] | def read_xref_table(self, xref_section_offset):
subsection_found = False
m = self.re_xref_section_start.match(self.buf, xref_section_offset + self.start_offset)
check_format_condition(m, "xref section start not found")
offset = m.end()
while True:
m = self.re_xref_sub... | [
"def",
"read_xref_table",
"(",
"self",
",",
"xref_section_offset",
")",
":",
"subsection_found",
"=",
"False",
"m",
"=",
"self",
".",
"re_xref_section_start",
".",
"match",
"(",
"self",
".",
"buf",
",",
"xref_section_offset",
"+",
"self",
".",
"start_offset",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/PIL/PdfParser.py#L799-L823 | |||
Erotemic/ubelt | 221d5f6262d5c8e78638e1a38e3adcc9cc9a15e9 | ubelt/orderedset.py | python | OrderedSet.intersection | (self, *sets) | return cls(items) | Returns elements in common between all sets. Order is defined only
by the first set.
Example:
>>> oset = OrderedSet.intersection(OrderedSet([0, 1, 2, 3]), [1, 2, 3])
>>> print(oset)
OrderedSet([1, 2, 3])
>>> oset.intersection([2, 4, 5], [1, 2, 3, 4])
... | Returns elements in common between all sets. Order is defined only
by the first set. | [
"Returns",
"elements",
"in",
"common",
"between",
"all",
"sets",
".",
"Order",
"is",
"defined",
"only",
"by",
"the",
"first",
"set",
"."
] | def intersection(self, *sets):
"""
Returns elements in common between all sets. Order is defined only
by the first set.
Example:
>>> oset = OrderedSet.intersection(OrderedSet([0, 1, 2, 3]), [1, 2, 3])
>>> print(oset)
OrderedSet([1, 2, 3])
... | [
"def",
"intersection",
"(",
"self",
",",
"*",
"sets",
")",
":",
"cls",
"=",
"self",
".",
"__class__",
"if",
"isinstance",
"(",
"self",
",",
"OrderedSet",
")",
"else",
"OrderedSet",
"if",
"sets",
":",
"common",
"=",
"set",
".",
"intersection",
"(",
"*",... | https://github.com/Erotemic/ubelt/blob/221d5f6262d5c8e78638e1a38e3adcc9cc9a15e9/ubelt/orderedset.py#L363-L383 | |
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Gui/SigmaAnalysis/matplotlibwidget.py | python | MatplotlibWidget.redraw | (self) | Redraw the interface
Returns: | Redraw the interface
Returns: | [
"Redraw",
"the",
"interface",
"Returns",
":"
] | def redraw(self):
"""
Redraw the interface
Returns:
"""
self.canvas.ax.figure.canvas.draw() | [
"def",
"redraw",
"(",
"self",
")",
":",
"self",
".",
"canvas",
".",
"ax",
".",
"figure",
".",
"canvas",
".",
"draw",
"(",
")"
] | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/SigmaAnalysis/matplotlibwidget.py#L216-L222 | ||
cloudant/python-cloudant | 5b1ecc215b2caea22ccc2d7310462df56be6e848 | src/cloudant/design_document.py | python | DesignDocument.updates | (self) | return self.get('updates') | Provides an accessor property to the updates dictionary in the locally
cached DesignDocument. Update handlers are custom functions stored on
Cloudant's server that will create or update a document.
To execute the update handler function, see
:func:`~cloudant.database.CouchDatabase.update... | Provides an accessor property to the updates dictionary in the locally
cached DesignDocument. Update handlers are custom functions stored on
Cloudant's server that will create or update a document.
To execute the update handler function, see
:func:`~cloudant.database.CouchDatabase.update... | [
"Provides",
"an",
"accessor",
"property",
"to",
"the",
"updates",
"dictionary",
"in",
"the",
"locally",
"cached",
"DesignDocument",
".",
"Update",
"handlers",
"are",
"custom",
"functions",
"stored",
"on",
"Cloudant",
"s",
"server",
"that",
"will",
"create",
"or"... | def updates(self):
"""
Provides an accessor property to the updates dictionary in the locally
cached DesignDocument. Update handlers are custom functions stored on
Cloudant's server that will create or update a document.
To execute the update handler function, see
:func:`... | [
"def",
"updates",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"'updates'",
")"
] | https://github.com/cloudant/python-cloudant/blob/5b1ecc215b2caea22ccc2d7310462df56be6e848/src/cloudant/design_document.py#L127-L162 | |
mgear-dev/mgear | 06ddc26c5adb5eab07ca470c7fafa77404c8a1de | scripts/mgear/maya/synoptic/utils.py | python | keyObj | (model, object_names) | Set the keyframe in the controls pass by a list in obj_names variable
Args:
model (Str): Name of the namespace that will define de the model
object_names (Str): names of the controls, without the name space
Returns:
None | Set the keyframe in the controls pass by a list in obj_names variable | [
"Set",
"the",
"keyframe",
"in",
"the",
"controls",
"pass",
"by",
"a",
"list",
"in",
"obj_names",
"variable"
] | def keyObj(model, object_names):
"""Set the keyframe in the controls pass by a list in obj_names variable
Args:
model (Str): Name of the namespace that will define de the model
object_names (Str): names of the controls, without the name space
Returns:
None
"""
with pm.UndoC... | [
"def",
"keyObj",
"(",
"model",
",",
"object_names",
")",
":",
"with",
"pm",
".",
"UndoChunk",
"(",
")",
":",
"nodes",
"=",
"[",
"]",
"nameSpace",
"=",
"getNamespace",
"(",
"model",
")",
"for",
"name",
"in",
"object_names",
":",
"if",
"nameSpace",
":",
... | https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/synoptic/utils.py#L435-L467 | ||
armory3d/armory | 5a7d41e39710b658029abcc32627435a79b9c02d | blender/arm/props_exporter.py | python | ArmExporterListDeleteItem.poll | (self, context) | return len(mdata.arm_exporterlist) > 0 | Enable if there's something in the list | Enable if there's something in the list | [
"Enable",
"if",
"there",
"s",
"something",
"in",
"the",
"list"
] | def poll(self, context):
""" Enable if there's something in the list """
mdata = bpy.data.worlds['Arm']
return len(mdata.arm_exporterlist) > 0 | [
"def",
"poll",
"(",
"self",
",",
"context",
")",
":",
"mdata",
"=",
"bpy",
".",
"data",
".",
"worlds",
"[",
"'Arm'",
"]",
"return",
"len",
"(",
"mdata",
".",
"arm_exporterlist",
")",
">",
"0"
] | https://github.com/armory3d/armory/blob/5a7d41e39710b658029abcc32627435a79b9c02d/blender/arm/props_exporter.py#L231-L234 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site.py | python | aliasmbcs | () | On Windows, some default encodings are not provided by Python,
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case. | On Windows, some default encodings are not provided by Python,
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case. | [
"On",
"Windows",
"some",
"default",
"encodings",
"are",
"not",
"provided",
"by",
"Python",
"while",
"they",
"are",
"always",
"available",
"as",
"mbcs",
"in",
"each",
"locale",
".",
"Make",
"them",
"usable",
"by",
"aliasing",
"to",
"mbcs",
"in",
"such",
"a"... | def aliasmbcs():
"""On Windows, some default encodings are not provided by Python,
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case."""
if sys.platform == 'win32':
import locale, codecs
enc = locale.getdefaultlocale()[1]
... | [
"def",
"aliasmbcs",
"(",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"import",
"locale",
",",
"codecs",
"enc",
"=",
"locale",
".",
"getdefaultlocale",
"(",
")",
"[",
"1",
"]",
"if",
"enc",
".",
"startswith",
"(",
"'cp'",
")",
":",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site.py#L510-L523 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/transactional_update.py | python | single | (fun, name, test=None, activate_transaction=False, queue=False, **kwargs) | return _create_and_execute_salt_state(
chunks, file_refs, test, hash_type, activate_transaction
) | Execute a single state function with the named kwargs, returns
False if insufficient data is sent to the command
By default, the values of the kwargs will be parsed as YAML. So,
you can specify lists values, or lists of single entry key-value
maps, as you would in a YAML salt file. Alternatively, JSON ... | Execute a single state function with the named kwargs, returns
False if insufficient data is sent to the command | [
"Execute",
"a",
"single",
"state",
"function",
"with",
"the",
"named",
"kwargs",
"returns",
"False",
"if",
"insufficient",
"data",
"is",
"sent",
"to",
"the",
"command"
] | def single(fun, name, test=None, activate_transaction=False, queue=False, **kwargs):
"""Execute a single state function with the named kwargs, returns
False if insufficient data is sent to the command
By default, the values of the kwargs will be parsed as YAML. So,
you can specify lists values, or list... | [
"def",
"single",
"(",
"fun",
",",
"name",
",",
"test",
"=",
"None",
",",
"activate_transaction",
"=",
"False",
",",
"queue",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"conflict",
"=",
"_check_queue",
"(",
"queue",
",",
"kwargs",
")",
"if",
"co... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/transactional_update.py#L1252-L1325 | |
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/data/experiment.py | python | ExperimentHandler.abort | (self) | Inform the ExperimentHandler that the run was aborted.
Experiment handler will attempt automatically to save data
(even in the event of a crash if possible). So if you quit your
script early you may want to tell the Handler not to save out
the data files for this run. This is the method... | Inform the ExperimentHandler that the run was aborted. | [
"Inform",
"the",
"ExperimentHandler",
"that",
"the",
"run",
"was",
"aborted",
"."
] | def abort(self):
"""Inform the ExperimentHandler that the run was aborted.
Experiment handler will attempt automatically to save data
(even in the event of a crash if possible). So if you quit your
script early you may want to tell the Handler not to save out
the data files for ... | [
"def",
"abort",
"(",
"self",
")",
":",
"self",
".",
"savePickle",
"=",
"False",
"self",
".",
"saveWideText",
"=",
"False"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/data/experiment.py#L413-L423 | ||
dropbox/PyHive | b21c507a24ed2f2b0cf15b0b6abb1c43f31d3ee0 | pyhive/sqlalchemy_hive.py | python | HiveDialect.has_table | (self, connection, table_name, schema=None) | [] | def has_table(self, connection, table_name, schema=None):
try:
self._get_table_columns(connection, table_name, schema)
return True
except exc.NoSuchTableError:
return False | [
"def",
"has_table",
"(",
"self",
",",
"connection",
",",
"table_name",
",",
"schema",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"_get_table_columns",
"(",
"connection",
",",
"table_name",
",",
"schema",
")",
"return",
"True",
"except",
"exc",
".",
... | https://github.com/dropbox/PyHive/blob/b21c507a24ed2f2b0cf15b0b6abb1c43f31d3ee0/pyhive/sqlalchemy_hive.py#L299-L304 | ||||
lvpengyuan/corner | f37ef0e1d2068c5fbd643855acd21787a2c122c5 | utils/augmentations_synth.py | python | RandomBrightness.__init__ | (self, delta=32) | [] | def __init__(self, delta=32):
assert delta >= 0.0
assert delta <= 255.0
self.delta = delta | [
"def",
"__init__",
"(",
"self",
",",
"delta",
"=",
"32",
")",
":",
"assert",
"delta",
">=",
"0.0",
"assert",
"delta",
"<=",
"255.0",
"self",
".",
"delta",
"=",
"delta"
] | https://github.com/lvpengyuan/corner/blob/f37ef0e1d2068c5fbd643855acd21787a2c122c5/utils/augmentations_synth.py#L171-L174 | ||||
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/future/backports/email/headerregistry.py | python | BaseHeader.__new__ | (cls, name, value) | return self | [] | def __new__(cls, name, value):
kwds = {'defects': []}
cls.parse(value, kwds)
if utils._has_surrogates(kwds['decoded']):
kwds['decoded'] = utils._sanitize(kwds['decoded'])
self = str.__new__(cls, kwds['decoded'])
# del kwds['decoded']
self.init(name, **kwds)
... | [
"def",
"__new__",
"(",
"cls",
",",
"name",
",",
"value",
")",
":",
"kwds",
"=",
"{",
"'defects'",
":",
"[",
"]",
"}",
"cls",
".",
"parse",
"(",
"value",
",",
"kwds",
")",
"if",
"utils",
".",
"_has_surrogates",
"(",
"kwds",
"[",
"'decoded'",
"]",
... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/future/backports/email/headerregistry.py#L198-L206 | |||
openfisca/openfisca-france | 207a58191be6830716693f94d37846f1e5037b51 | openfisca_france/model/prelevements_obligatoires/impot_revenu/ir.py | python | rpns_info.formula_2019_01_01 | (individu, period, parameters) | return (
cncn_info_red1
+ cncn_info_red2
+ arag_info
+ abic_info
+ aacc_info
+ abnc_info
) | Plus values de cession | Plus values de cession | [
"Plus",
"values",
"de",
"cession"
] | def formula_2019_01_01(individu, period, parameters):
'''
Plus values de cession
'''
cncn_info_red1 = individu('cncn_info_red1', period)
cncn_info_red2 = individu('cncn_info_red2', period)
arag_info = individu('arag_info', period)
abic_info = individu('abic_info',... | [
"def",
"formula_2019_01_01",
"(",
"individu",
",",
"period",
",",
"parameters",
")",
":",
"cncn_info_red1",
"=",
"individu",
"(",
"'cncn_info_red1'",
",",
"period",
")",
"cncn_info_red2",
"=",
"individu",
"(",
"'cncn_info_red2'",
",",
"period",
")",
"arag_info",
... | https://github.com/openfisca/openfisca-france/blob/207a58191be6830716693f94d37846f1e5037b51/openfisca_france/model/prelevements_obligatoires/impot_revenu/ir.py#L2327-L2345 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_headers | (self, headers) | Prepares the given HTTP headers. | Prepares the given HTTP headers. | [
"Prepares",
"the",
"given",
"HTTP",
"headers",
"."
] | def prepare_headers(self, headers):
"""Prepares the given HTTP headers."""
self.headers = CaseInsensitiveDict()
if headers:
for header in headers.items():
# Raise exception on invalid header value.
check_header_validity(header)
name, v... | [
"def",
"prepare_headers",
"(",
"self",
",",
"headers",
")",
":",
"self",
".",
"headers",
"=",
"CaseInsensitiveDict",
"(",
")",
"if",
"headers",
":",
"for",
"header",
"in",
"headers",
".",
"items",
"(",
")",
":",
"# Raise exception on invalid header value.",
"c... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/requests/models.py#L441-L450 | ||
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | skeinforge_application/skeinforge_plugins/craft_plugins/skirt.py | python | SkirtSkein.__init__ | (self) | Initialize variables. | Initialize variables. | [
"Initialize",
"variables",
"."
] | def __init__(self):
'Initialize variables.'
self.distanceFeedRate = gcodec.DistanceFeedRate()
self.feedRateMinute = None
self.isExtruderActive = False
self.isSupportLayer = False
self.layerIndex = -1
self.brimLine = 0
self.lineIndex = 0
self.lines = None
self.oldFlowRate = None
self.oldLocation = ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"distanceFeedRate",
"=",
"gcodec",
".",
"DistanceFeedRate",
"(",
")",
"self",
".",
"feedRateMinute",
"=",
"None",
"self",
".",
"isExtruderActive",
"=",
"False",
"self",
".",
"isSupportLayer",
"=",
"False... | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/skirt.py#L159-L175 | ||
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/build.py | python | BuildTarget.get_pch | (self, language: str) | return self.pch.get(language, []) | [] | def get_pch(self, language: str) -> T.List[str]:
return self.pch.get(language, []) | [
"def",
"get_pch",
"(",
"self",
",",
"language",
":",
"str",
")",
"->",
"T",
".",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"pch",
".",
"get",
"(",
"language",
",",
"[",
"]",
")"
] | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/build.py#L1297-L1298 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/formtools/wizard/views.py | python | WizardView.get_initkwargs | (cls, form_list, initial_dict=None,
instance_dict=None, condition_dict=None, *args, **kwargs) | return kwargs | Creates a dict with all needed parameters for the form wizard instances.
* `form_list` - is a list of forms. The list entries can be single form
classes or tuples of (`step_name`, `form_class`). If you pass a list
of forms, the wizardview will convert the class list to
(`zero_base... | Creates a dict with all needed parameters for the form wizard instances. | [
"Creates",
"a",
"dict",
"with",
"all",
"needed",
"parameters",
"for",
"the",
"form",
"wizard",
"instances",
"."
] | def get_initkwargs(cls, form_list, initial_dict=None,
instance_dict=None, condition_dict=None, *args, **kwargs):
"""
Creates a dict with all needed parameters for the form wizard instances.
* `form_list` - is a list of forms. The list entries can be single form
classes or ... | [
"def",
"get_initkwargs",
"(",
"cls",
",",
"form_list",
",",
"initial_dict",
"=",
"None",
",",
"instance_dict",
"=",
"None",
",",
"condition_dict",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"{",
"'in... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/formtools/wizard/views.py#L122-L179 | |
megvii-model/MABN | db1ef7bc396c8aa6f4eec9e3c5875d73f74da3de | det/maskrcnn_benchmark/modeling/rpn/retinanet/inference.py | python | RetinaNetPostProcessor.add_gt_proposals | (self, proposals, targets) | This function is not used in RetinaNet | This function is not used in RetinaNet | [
"This",
"function",
"is",
"not",
"used",
"in",
"RetinaNet"
] | def add_gt_proposals(self, proposals, targets):
"""
This function is not used in RetinaNet
"""
pass | [
"def",
"add_gt_proposals",
"(",
"self",
",",
"proposals",
",",
"targets",
")",
":",
"pass"
] | https://github.com/megvii-model/MABN/blob/db1ef7bc396c8aa6f4eec9e3c5875d73f74da3de/det/maskrcnn_benchmark/modeling/rpn/retinanet/inference.py#L53-L57 | ||
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | solutionbox/image_classification/mltoolbox/image/classification/_preprocess.py | python | EmbeddingsGraph.build_graph | (self) | return input_jpeg, embedding | Forms the core by building a wrapper around the inception graph.
Here we add the necessary input & output tensors, to decode jpegs,
serialize embeddings, restore from checkpoint etc.
To use other Inception models modify this file. Note that to use other
models beside Inception, you should make... | Forms the core by building a wrapper around the inception graph. | [
"Forms",
"the",
"core",
"by",
"building",
"a",
"wrapper",
"around",
"the",
"inception",
"graph",
"."
] | def build_graph(self):
"""Forms the core by building a wrapper around the inception graph.
Here we add the necessary input & output tensors, to decode jpegs,
serialize embeddings, restore from checkpoint etc.
To use other Inception models modify this file. Note that to use other
models bes... | [
"def",
"build_graph",
"(",
"self",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"input_jpeg",
"=",
"tf",
".",
"placeholder",
"(",
"tf",
".",
"string",
",",
"shape",
"=",
"None",
")",
"image",
"=",
"tf",
".",
"image",
".",
"decode_jpeg",
"(",
"input_jp... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/solutionbox/image_classification/mltoolbox/image/classification/_preprocess.py#L126-L167 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v5_1/member_entitlement_management/member_entitlement_management_client.py | python | MemberEntitlementManagementClient.get_group_entitlement | (self, group_id) | return self._deserialize('GroupEntitlement', response) | GetGroupEntitlement.
[Preview API] Get a group entitlement.
:param str group_id: ID of the group.
:rtype: :class:`<GroupEntitlement> <azure.devops.v5_1.member_entitlement_management.models.GroupEntitlement>` | GetGroupEntitlement.
[Preview API] Get a group entitlement.
:param str group_id: ID of the group.
:rtype: :class:`<GroupEntitlement> <azure.devops.v5_1.member_entitlement_management.models.GroupEntitlement>` | [
"GetGroupEntitlement",
".",
"[",
"Preview",
"API",
"]",
"Get",
"a",
"group",
"entitlement",
".",
":",
"param",
"str",
"group_id",
":",
"ID",
"of",
"the",
"group",
".",
":",
"rtype",
":",
":",
"class",
":",
"<GroupEntitlement",
">",
"<azure",
".",
"devops... | def get_group_entitlement(self, group_id):
"""GetGroupEntitlement.
[Preview API] Get a group entitlement.
:param str group_id: ID of the group.
:rtype: :class:`<GroupEntitlement> <azure.devops.v5_1.member_entitlement_management.models.GroupEntitlement>`
"""
route_values =... | [
"def",
"get_group_entitlement",
"(",
"self",
",",
"group_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"group_id",
"is",
"not",
"None",
":",
"route_values",
"[",
"'groupId'",
"]",
"=",
"self",
".",
"_serialize",
".",
"url",
"(",
"'group_id'",
",",
... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_1/member_entitlement_management/member_entitlement_management_client.py#L69-L82 | |
open-cogsci/OpenSesame | c4a3641b097a80a76937edbd8c365f036bcc9705 | libqtopensesame/widgets/tree_base_item.py | python | tree_base_item.expand | (self) | desc:
Expands this item and all items under it. | desc:
Expands this item and all items under it. | [
"desc",
":",
"Expands",
"this",
"item",
"and",
"all",
"items",
"under",
"it",
"."
] | def expand(self):
"""
desc:
Expands this item and all items under it.
"""
self.setExpanded(True)
for i in range(self.childCount()):
self.child(i).expand() | [
"def",
"expand",
"(",
"self",
")",
":",
"self",
".",
"setExpanded",
"(",
"True",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"childCount",
"(",
")",
")",
":",
"self",
".",
"child",
"(",
"i",
")",
".",
"expand",
"(",
")"
] | https://github.com/open-cogsci/OpenSesame/blob/c4a3641b097a80a76937edbd8c365f036bcc9705/libqtopensesame/widgets/tree_base_item.py#L119-L128 | ||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/opflow/state_fns/cvar_measurement.py | python | CVaRMeasurement.to_circuit_op | (self) | Not defined. | Not defined. | [
"Not",
"defined",
"."
] | def to_circuit_op(self):
"""Not defined."""
raise NotImplementedError | [
"def",
"to_circuit_op",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/opflow/state_fns/cvar_measurement.py#L141-L143 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/editors/displaytabs/addrembedlist.py | python | AddrEmbedList.add_callback | (self, name) | Called to update the screen when a new address is added | Called to update the screen when a new address is added | [
"Called",
"to",
"update",
"the",
"screen",
"when",
"a",
"new",
"address",
"is",
"added"
] | def add_callback(self, name):
"""
Called to update the screen when a new address is added
"""
data = self.get_data()
data.append(name)
self.rebuild()
GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) | [
"def",
"add_callback",
"(",
"self",
",",
"name",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
")",
"data",
".",
"append",
"(",
"name",
")",
"self",
".",
"rebuild",
"(",
")",
"GLib",
".",
"idle_add",
"(",
"self",
".",
"tree",
".",
"scroll_to... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/editors/displaytabs/addrembedlist.py#L118-L125 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/locations/models.py | python | LocationType.expand_from | (self, value) | [] | def expand_from(self, value):
if self._expand_from_root is True:
self._expand_from_root = False
self._expand_from = value | [
"def",
"expand_from",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_expand_from_root",
"is",
"True",
":",
"self",
".",
"_expand_from_root",
"=",
"False",
"self",
".",
"_expand_from",
"=",
"value"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/locations/models.py#L136-L139 | ||||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/op2/op2_interface/op2_f06_common.py | python | OP2_F06_Common.__objects_vector_init__ | (self) | All OUG table is simple to vectorize, so we declere it in __objects_init__
On the other hand, the rodForces object contains CROD/CTUBE/CONROD elements.
It is difficult to handle initializing the CRODs/CONRODs given a
mixed type case, so we split out the elements. | All OUG table is simple to vectorize, so we declere it in __objects_init__
On the other hand, the rodForces object contains CROD/CTUBE/CONROD elements.
It is difficult to handle initializing the CRODs/CONRODs given a
mixed type case, so we split out the elements. | [
"All",
"OUG",
"table",
"is",
"simple",
"to",
"vectorize",
"so",
"we",
"declere",
"it",
"in",
"__objects_init__",
"On",
"the",
"other",
"hand",
"the",
"rodForces",
"object",
"contains",
"CROD",
"/",
"CTUBE",
"/",
"CONROD",
"elements",
".",
"It",
"is",
"diff... | def __objects_vector_init__(self):
"""
All OUG table is simple to vectorize, so we declere it in __objects_init__
On the other hand, the rodForces object contains CROD/CTUBE/CONROD elements.
It is difficult to handle initializing the CRODs/CONRODs given a
mixed type case, so we s... | [
"def",
"__objects_vector_init__",
"(",
"self",
")",
":",
"self",
".",
"matrices",
"=",
"{",
"}",
"self",
".",
"matdicts",
"=",
"{",
"}",
"#======================================================================",
"# rods",
"self",
".",
"op2_results",
"=",
"Results",
... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/op2_interface/op2_f06_common.py#L761-L871 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | osh/builtin_assign.py | python | Readonly.Run | (self, cmd_val) | return 0 | [] | def Run(self, cmd_val):
# type: (cmd_value__Assign) -> int
arg_r = args.Reader(cmd_val.argv, spids=cmd_val.arg_spids)
arg_r.Next()
attrs = flag_spec.Parse('readonly', arg_r)
arg = arg_types.readonly(attrs.attrs)
if arg.p or len(cmd_val.pairs) == 0:
return _PrintVariables(self.mem, cmd_val... | [
"def",
"Run",
"(",
"self",
",",
"cmd_val",
")",
":",
"# type: (cmd_value__Assign) -> int",
"arg_r",
"=",
"args",
".",
"Reader",
"(",
"cmd_val",
".",
"argv",
",",
"spids",
"=",
"cmd_val",
".",
"arg_spids",
")",
"arg_r",
".",
"Next",
"(",
")",
"attrs",
"="... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/osh/builtin_assign.py#L288-L316 | |||
cournape/Bento | 37de23d784407a7c98a4a15770ffc570d5f32d70 | bento/commands/registries.py | python | OutputRegistry.register_category | (self, category, installed_category) | [] | def register_category(self, category, installed_category):
if category in self.categories:
raise ValueError("Category %r already registered")
else:
self.categories[category] = {}
self.installed_categories[category] = installed_category | [
"def",
"register_category",
"(",
"self",
",",
"category",
",",
"installed_category",
")",
":",
"if",
"category",
"in",
"self",
".",
"categories",
":",
"raise",
"ValueError",
"(",
"\"Category %r already registered\"",
")",
"else",
":",
"self",
".",
"categories",
... | https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/commands/registries.py#L136-L141 | ||||
katerakelly/oyster | 44e20fddf181d8ca3852bdf9b6927d6b8c6f48fc | rlkit/core/eval_util.py | python | get_generic_path_information | (paths, stat_prefix='') | return statistics | Get an OrderedDict with a bunch of statistic names and values. | Get an OrderedDict with a bunch of statistic names and values. | [
"Get",
"an",
"OrderedDict",
"with",
"a",
"bunch",
"of",
"statistic",
"names",
"and",
"values",
"."
] | def get_generic_path_information(paths, stat_prefix=''):
"""
Get an OrderedDict with a bunch of statistic names and values.
"""
statistics = OrderedDict()
returns = [sum(path["rewards"]) for path in paths]
rewards = np.vstack([path["rewards"] for path in paths])
statistics.update(create_sta... | [
"def",
"get_generic_path_information",
"(",
"paths",
",",
"stat_prefix",
"=",
"''",
")",
":",
"statistics",
"=",
"OrderedDict",
"(",
")",
"returns",
"=",
"[",
"sum",
"(",
"path",
"[",
"\"rewards\"",
"]",
")",
"for",
"path",
"in",
"paths",
"]",
"rewards",
... | https://github.com/katerakelly/oyster/blob/44e20fddf181d8ca3852bdf9b6927d6b8c6f48fc/rlkit/core/eval_util.py#L17-L39 | |
IntelAI/nauta | bbedb114a755cf1f43b834a58fc15fb6e3a4b291 | applications/cli/example-python/package_examples/resnet/flags/_performance.py | python | define_performance | (num_parallel_calls=True, inter_op=True, intra_op=True,
synthetic_data=True, max_train_steps=True, dtype=True) | return key_flags | Register flags for specifying performance tuning arguments.
Args:
num_parallel_calls: Create a flag to specify parallelism of data loading.
inter_op: Create a flag to allow specification of inter op threads.
intra_op: Create a flag to allow specification of intra op threads.
synthetic_data: Create a ... | Register flags for specifying performance tuning arguments. | [
"Register",
"flags",
"for",
"specifying",
"performance",
"tuning",
"arguments",
"."
] | def define_performance(num_parallel_calls=True, inter_op=True, intra_op=True,
synthetic_data=True, max_train_steps=True, dtype=True):
"""Register flags for specifying performance tuning arguments.
Args:
num_parallel_calls: Create a flag to specify parallelism of data loading.
inter_o... | [
"def",
"define_performance",
"(",
"num_parallel_calls",
"=",
"True",
",",
"inter_op",
"=",
"True",
",",
"intra_op",
"=",
"True",
",",
"synthetic_data",
"=",
"True",
",",
"max_train_steps",
"=",
"True",
",",
"dtype",
"=",
"True",
")",
":",
"key_flags",
"=",
... | https://github.com/IntelAI/nauta/blob/bbedb114a755cf1f43b834a58fc15fb6e3a4b291/applications/cli/example-python/package_examples/resnet/flags/_performance.py#L46-L132 | |
getavalon/core | 31e8cb4760e00e3db64443f6f932b7fd8e96d41d | avalon/vendor/requests/models.py | python | Response.ok | (self) | return True | Returns True if :attr:`status_code` is less than 400.
This attribute checks if the status code of the response is between
400 and 600 to see if there was a client error or a server error. If
the status code, is between 200 and 400, this will return True. This
is **not** a check to see i... | Returns True if :attr:`status_code` is less than 400. | [
"Returns",
"True",
"if",
":",
"attr",
":",
"status_code",
"is",
"less",
"than",
"400",
"."
] | def ok(self):
"""Returns True if :attr:`status_code` is less than 400.
This attribute checks if the status code of the response is between
400 and 600 to see if there was a client error or a server error. If
the status code, is between 200 and 400, this will return True. This
is... | [
"def",
"ok",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"raise_for_status",
"(",
")",
"except",
"HTTPError",
":",
"return",
"False",
"return",
"True"
] | https://github.com/getavalon/core/blob/31e8cb4760e00e3db64443f6f932b7fd8e96d41d/avalon/vendor/requests/models.py#L686-L698 | |
python-telegram-bot/python-telegram-bot | ade1529986f5b6d394a65372d6a27045a70725b2 | telegram/ext/callbackdatacache.py | python | CallbackDataCache.__drop_keyboard | (self, keyboard_uuid: str) | [] | def __drop_keyboard(self, keyboard_uuid: str) -> None:
try:
self._keyboard_data.pop(keyboard_uuid)
except KeyError:
return | [
"def",
"__drop_keyboard",
"(",
"self",
",",
"keyboard_uuid",
":",
"str",
")",
"->",
"None",
":",
"try",
":",
"self",
".",
"_keyboard_data",
".",
"pop",
"(",
"keyboard_uuid",
")",
"except",
"KeyError",
":",
"return"
] | https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/ext/callbackdatacache.py#L368-L372 | ||||
emmetio/livestyle-sublime-old | c42833c046e9b2f53ebce3df3aa926528f5a33b5 | tornado/platform/caresresolver.py | python | CaresResolver.resolve | (self, host, port, family=0) | [] | def resolve(self, host, port, family=0):
if is_valid_ip(host):
addresses = [host]
else:
# gethostbyname doesn't take callback as a kwarg
self.channel.gethostbyname(host, family, (yield gen.Callback(1)))
callback_args = yield gen.Wait(1)
assert ... | [
"def",
"resolve",
"(",
"self",
",",
"host",
",",
"port",
",",
"family",
"=",
"0",
")",
":",
"if",
"is_valid_ip",
"(",
"host",
")",
":",
"addresses",
"=",
"[",
"host",
"]",
"else",
":",
"# gethostbyname doesn't take callback as a kwarg",
"self",
".",
"chann... | https://github.com/emmetio/livestyle-sublime-old/blob/c42833c046e9b2f53ebce3df3aa926528f5a33b5/tornado/platform/caresresolver.py#L49-L75 | ||||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Scripts/xbbtools/xbb_blast.py | python | BlastIt._Run | (self) | Initialise options for Blast commandline (PRIVATE). | Initialise options for Blast commandline (PRIVATE). | [
"Initialise",
"options",
"for",
"Blast",
"commandline",
"(",
"PRIVATE",
")",
"."
] | def _Run(self):
"""Initialise options for Blast commandline (PRIVATE)."""
command_options = self.option.get()
options = ""
if len(command_options.strip()):
options = command_options.strip()
db = self.convert_dbname_to_dbpath(self.dbs.get())
prog = self.blast_... | [
"def",
"_Run",
"(",
"self",
")",
":",
"command_options",
"=",
"self",
".",
"option",
".",
"get",
"(",
")",
"options",
"=",
"\"\"",
"if",
"len",
"(",
"command_options",
".",
"strip",
"(",
")",
")",
":",
"options",
"=",
"command_options",
".",
"strip",
... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Scripts/xbbtools/xbb_blast.py#L184-L195 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/components/components.py | python | ComponentMeta.get_meta | (cls, name) | return cls.__name_to_obj[name] | [] | def get_meta(cls, name):
return cls.__name_to_obj[name] | [
"def",
"get_meta",
"(",
"cls",
",",
"name",
")",
":",
"return",
"cls",
".",
"__name_to_obj",
"[",
"name",
"]"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/components/components.py#L95-L96 | |||
webcompat/webcompat.com | c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef | webcompat/helpers.py | python | to_bytes | (bytes_or_str) | return value | Convert to bytes. | Convert to bytes. | [
"Convert",
"to",
"bytes",
"."
] | def to_bytes(bytes_or_str):
"""Convert to bytes."""
if isinstance(bytes_or_str, str):
value = bytes_or_str.encode('utf-8') # uses 'utf-8' for encoding
else:
value = bytes_or_str
return value | [
"def",
"to_bytes",
"(",
"bytes_or_str",
")",
":",
"if",
"isinstance",
"(",
"bytes_or_str",
",",
"str",
")",
":",
"value",
"=",
"bytes_or_str",
".",
"encode",
"(",
"'utf-8'",
")",
"# uses 'utf-8' for encoding",
"else",
":",
"value",
"=",
"bytes_or_str",
"return... | https://github.com/webcompat/webcompat.com/blob/c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef/webcompat/helpers.py#L664-L670 | |
Ericsson/codechecker | c4e43f62dc3acbf71d3109b337db7c97f7852f43 | web/server/codechecker_server/api/report_server.py | python | ThriftRequestHandler.__add_comment | (self, bug_id, message, kind=CommentKindValue.USER,
date=None) | return Comment(bug_id,
user,
message.encode('utf-8'),
kind,
date or datetime.now()) | Creates a new comment object. | Creates a new comment object. | [
"Creates",
"a",
"new",
"comment",
"object",
"."
] | def __add_comment(self, bug_id, message, kind=CommentKindValue.USER,
date=None):
""" Creates a new comment object. """
user = self._get_username()
return Comment(bug_id,
user,
message.encode('utf-8'),
kind... | [
"def",
"__add_comment",
"(",
"self",
",",
"bug_id",
",",
"message",
",",
"kind",
"=",
"CommentKindValue",
".",
"USER",
",",
"date",
"=",
"None",
")",
":",
"user",
"=",
"self",
".",
"_get_username",
"(",
")",
"return",
"Comment",
"(",
"bug_id",
",",
"us... | https://github.com/Ericsson/codechecker/blob/c4e43f62dc3acbf71d3109b337db7c97f7852f43/web/server/codechecker_server/api/report_server.py#L1142-L1150 | |
edwardlib/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | observations/r/suicide.py | python | suicide | (path) | return x_train, metadata | Suicide Rates in Germany
Data from Heuer (1979) on suicide rates in West Germany classified by
age, sex, and method of suicide.
A data frame with 306 observations and 6 variables.
Freq
frequency of suicides.
sex
factor indicating sex (male, female).
method
factor indicating method use... | Suicide Rates in Germany | [
"Suicide",
"Rates",
"in",
"Germany"
] | def suicide(path):
"""Suicide Rates in Germany
Data from Heuer (1979) on suicide rates in West Germany classified by
age, sex, and method of suicide.
A data frame with 306 observations and 6 variables.
Freq
frequency of suicides.
sex
factor indicating sex (male, female).
method
fact... | [
"def",
"suicide",
"(",
"path",
")",
":",
"import",
"pandas",
"as",
"pd",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
"filename",
"=",
"'suicide.csv'",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
"... | https://github.com/edwardlib/observations/blob/2c8b1ac31025938cb17762e540f2f592e302d5de/observations/r/suicide.py#L14-L69 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/plugins/lib/libgedcom.py | python | GedcomParser.__lds_plac | (self, line, state) | Parses the PLAC tag attached to the LdsOrd. Create a new place if
needed and set the title.
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState | Parses the PLAC tag attached to the LdsOrd. Create a new place if
needed and set the title. | [
"Parses",
"the",
"PLAC",
"tag",
"attached",
"to",
"the",
"LdsOrd",
".",
"Create",
"a",
"new",
"place",
"if",
"needed",
"and",
"set",
"the",
"title",
"."
] | def __lds_plac(self, line, state):
"""
Parses the PLAC tag attached to the LdsOrd. Create a new place if
needed and set the title.
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
... | [
"def",
"__lds_plac",
"(",
"self",
",",
"line",
",",
"state",
")",
":",
"try",
":",
"title",
"=",
"line",
".",
"data",
"place",
"=",
"self",
".",
"__find_place",
"(",
"title",
",",
"None",
",",
"None",
")",
"if",
"place",
"is",
"None",
":",
"place",... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/lib/libgedcom.py#L4659-L4682 | ||
ambakick/Person-Detection-and-Tracking | f925394ac29b5cf321f1ce89a71b193381519a0b | models/faster_rcnn_inception_resnet_v2_feature_extractor.py | python | FasterRCNNInceptionResnetV2FeatureExtractor._extract_box_classifier_features | (self, proposal_feature_maps, scope) | Extracts second stage box classifier features.
This function reconstructs the "second half" of the Inception ResNet v2
network after the part defined in `_extract_proposal_features`.
Args:
proposal_feature_maps: A 4-D float tensor with shape
[batch_size * self.max_num_proposals, crop_height,... | Extracts second stage box classifier features. | [
"Extracts",
"second",
"stage",
"box",
"classifier",
"features",
"."
] | def _extract_box_classifier_features(self, proposal_feature_maps, scope):
"""Extracts second stage box classifier features.
This function reconstructs the "second half" of the Inception ResNet v2
network after the part defined in `_extract_proposal_features`.
Args:
proposal_feature_maps: A 4-D f... | [
"def",
"_extract_box_classifier_features",
"(",
"self",
",",
"proposal_feature_maps",
",",
"scope",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"'InceptionResnetV2'",
",",
"reuse",
"=",
"self",
".",
"_reuse_weights",
")",
":",
"with",
"slim",
".",
"arg_s... | https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/models/faster_rcnn_inception_resnet_v2_feature_extractor.py#L113-L169 | ||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | script.common.plugin.cache/lib/StorageServer.py | python | StorageServer.getMulti | (self, name, items) | return "" | [] | def getMulti(self, name, items):
self._log(name, 1)
if self._connect() and self.table:
self._send(self.soccon, repr({"action": "get_multi", "table": self.table, "name": name, "items": items}))
self._log(u"Receive", 3)
res = self._recv(self.soccon)
self._l... | [
"def",
"getMulti",
"(",
"self",
",",
"name",
",",
"items",
")",
":",
"self",
".",
"_log",
"(",
"name",
",",
"1",
")",
"if",
"self",
".",
"_connect",
"(",
")",
"and",
"self",
".",
"table",
":",
"self",
".",
"_send",
"(",
"self",
".",
"soccon",
"... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.common.plugin.cache/lib/StorageServer.py#L672-L688 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/db/models/query.py | python | QuerySet.extra | (self, select=None, where=None, params=None, tables=None,
order_by=None, select_params=None) | return clone | Adds extra SQL fragments to the query. | Adds extra SQL fragments to the query. | [
"Adds",
"extra",
"SQL",
"fragments",
"to",
"the",
"query",
"."
] | def extra(self, select=None, where=None, params=None, tables=None,
order_by=None, select_params=None):
"""
Adds extra SQL fragments to the query.
"""
assert self.query.can_filter(), \
"Cannot change a query once a slice has been taken"
clone = self._clon... | [
"def",
"extra",
"(",
"self",
",",
"select",
"=",
"None",
",",
"where",
"=",
"None",
",",
"params",
"=",
"None",
",",
"tables",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"select_params",
"=",
"None",
")",
":",
"assert",
"self",
".",
"query",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/models/query.py#L947-L956 | |
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/layers/tracks/tracks.py | python | Tracks.properties_to_color_by | (self) | return list(self.properties.keys()) | track properties that can be used for coloring etc... | track properties that can be used for coloring etc... | [
"track",
"properties",
"that",
"can",
"be",
"used",
"for",
"coloring",
"etc",
"..."
] | def properties_to_color_by(self) -> List[str]:
"""track properties that can be used for coloring etc..."""
return list(self.properties.keys()) | [
"def",
"properties_to_color_by",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"self",
".",
"properties",
".",
"keys",
"(",
")",
")"
] | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/layers/tracks/tracks.py#L423-L425 | |
dexy/dexy | 323c1806e51f75435e11d2265703e68f46c8aef3 | dexy/reporter.py | python | Reporter.key_for_log | (self) | return "reporter:%s" % self.aliases[0] | [] | def key_for_log(self):
return "reporter:%s" % self.aliases[0] | [
"def",
"key_for_log",
"(",
"self",
")",
":",
"return",
"\"reporter:%s\"",
"%",
"self",
".",
"aliases",
"[",
"0",
"]"
] | https://github.com/dexy/dexy/blob/323c1806e51f75435e11d2265703e68f46c8aef3/dexy/reporter.py#L104-L105 | |||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/likelihoods/link_functions.py | python | Reciprocal.dtransf_df | (self, f) | return -1./f2 | [] | def dtransf_df(self, f):
f2 = safe_square(f)
return -1./f2 | [
"def",
"dtransf_df",
"(",
"self",
",",
"f",
")",
":",
"f2",
"=",
"safe_square",
"(",
"f",
")",
"return",
"-",
"1.",
"/",
"f2"
] | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/likelihoods/link_functions.py#L253-L255 | |||
SiCKRAGE/SiCKRAGE | 45fb67c0c730fc22a34c695b5a62b11970621c53 | sickrage/core/caches/name_cache.py | python | NameCache.get | (self, name) | Looks up the given name in the scene_names table in cache db
:param name: The show name to look up.
:return: the TVDB id that resulted from the cache lookup or None if the show wasn't found in the cache | Looks up the given name in the scene_names table in cache db | [
"Looks",
"up",
"the",
"given",
"name",
"in",
"the",
"scene_names",
"table",
"in",
"cache",
"db"
] | def get(self, name):
"""
Looks up the given name in the scene_names table in cache db
:param name: The show name to look up.
:return: the TVDB id that resulted from the cache lookup or None if the show wasn't found in the cache
"""
name = full_sanitize_scene_name(name)
... | [
"def",
"get",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"full_sanitize_scene_name",
"(",
"name",
")",
"if",
"name",
"in",
"self",
".",
"cache",
":",
"return",
"int",
"(",
"self",
".",
"cache",
"[",
"name",
"]",
")"
] | https://github.com/SiCKRAGE/SiCKRAGE/blob/45fb67c0c730fc22a34c695b5a62b11970621c53/sickrage/core/caches/name_cache.py#L69-L78 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/pip/pip/_internal/resolution/resolvelib/requirements.py | python | UnsatisfiableRequirement.__init__ | (self, name) | [] | def __init__(self, name):
# type: (str) -> None
self._name = name | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"# type: (str) -> None",
"self",
".",
"_name",
"=",
"name"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_internal/resolution/resolvelib/requirements.py#L166-L168 | ||||
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py | python | ResourceManager.resource_exists | (self, package_or_requirement, resource_name) | return get_provider(package_or_requirement).has_resource(resource_name) | Does the named resource exist? | Does the named resource exist? | [
"Does",
"the",
"named",
"resource",
"exist?"
] | def resource_exists(self, package_or_requirement, resource_name):
"""Does the named resource exist?"""
return get_provider(package_or_requirement).has_resource(resource_name) | [
"def",
"resource_exists",
"(",
"self",
",",
"package_or_requirement",
",",
"resource_name",
")",
":",
"return",
"get_provider",
"(",
"package_or_requirement",
")",
".",
"has_resource",
"(",
"resource_name",
")"
] | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py#L1190-L1192 | |
madscheme/introducing-python | a0eaab9c523cd0af8877dc6175fd4a60ab000cb5 | ch19/ftoc1.py | python | ftoc | (f_temp) | return c_temp | Convert Fahrenheit temperature <f_temp> to Celsius and return it. | Convert Fahrenheit temperature <f_temp> to Celsius and return it. | [
"Convert",
"Fahrenheit",
"temperature",
"<f_temp",
">",
"to",
"Celsius",
"and",
"return",
"it",
"."
] | def ftoc(f_temp):
"Convert Fahrenheit temperature <f_temp> to Celsius and return it."
f_boil_temp = 212.0
f_freeze_temp = 32.0
c_boil_temp = 100.0
c_freeze_temp = 0.0
f_range = f_boil_temp - f_freeze_temp
c_range = c_boil_temp - c_freeze_temp
f_c_ratio = c_range / f_range
c_temp = (f... | [
"def",
"ftoc",
"(",
"f_temp",
")",
":",
"f_boil_temp",
"=",
"212.0",
"f_freeze_temp",
"=",
"32.0",
"c_boil_temp",
"=",
"100.0",
"c_freeze_temp",
"=",
"0.0",
"f_range",
"=",
"f_boil_temp",
"-",
"f_freeze_temp",
"c_range",
"=",
"c_boil_temp",
"-",
"c_freeze_temp",... | https://github.com/madscheme/introducing-python/blob/a0eaab9c523cd0af8877dc6175fd4a60ab000cb5/ch19/ftoc1.py#L1-L11 | |
hildogjr/KiCost | 227f246d8c0f5dab145390d15c94ee2c3d6c790c | kicost/kicost_gui.py | python | formKiCost.button_saveas | (self, event) | @brief Create and show the Save As... FileDialog. | [] | def button_saveas(self, event):
""" @brief Create and show the Save As... FileDialog."""
event.Skip()
wildcard = ("Open format (*.ods)|*.ods" if self.m_checkBox_XLSXtoODS.GetValue()
else "Microsoft Excel (*.xlsx)|*.xlsx")
actualFile = (os.getcwd() if self.m_text_savea... | [
"def",
"button_saveas",
"(",
"self",
",",
"event",
")",
":",
"event",
".",
"Skip",
"(",
")",
"wildcard",
"=",
"(",
"\"Open format (*.ods)|*.ods\"",
"if",
"self",
".",
"m_checkBox_XLSXtoODS",
".",
"GetValue",
"(",
")",
"else",
"\"Microsoft Excel (*.xlsx)|*.xlsx\"",... | https://github.com/hildogjr/KiCost/blob/227f246d8c0f5dab145390d15c94ee2c3d6c790c/kicost/kicost_gui.py#L771-L786 | |||
poodarchu/Det3D | 01258d8cb26656c5b950f8d41f9dcc1dd62a391e | det3d/torchie/parallel/data_container.py | python | DataContainer.datatype | (self) | [] | def datatype(self):
if isinstance(self.data, torch.Tensor):
return self.data.type()
else:
return type(self.data) | [
"def",
"datatype",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"data",
",",
"torch",
".",
"Tensor",
")",
":",
"return",
"self",
".",
"data",
".",
"type",
"(",
")",
"else",
":",
"return",
"type",
"(",
"self",
".",
"data",
")"
] | https://github.com/poodarchu/Det3D/blob/01258d8cb26656c5b950f8d41f9dcc1dd62a391e/det3d/torchie/parallel/data_container.py#L53-L57 | ||||
scikit-learn-contrib/DESlib | 64260ae7c6dd745ef0003cc6322c9f829c807708 | deslib/base.py | python | BaseDS.select | (self, competences) | Select the most competent classifier for
the classification of the query sample x.
The most competent classifier (dcs) or an ensemble
with the most competent classifiers (des) is returned
Parameters
----------
competences : array of shape (n_samples, n_classifiers)
... | Select the most competent classifier for
the classification of the query sample x.
The most competent classifier (dcs) or an ensemble
with the most competent classifiers (des) is returned | [
"Select",
"the",
"most",
"competent",
"classifier",
"for",
"the",
"classification",
"of",
"the",
"query",
"sample",
"x",
".",
"The",
"most",
"competent",
"classifier",
"(",
"dcs",
")",
"or",
"an",
"ensemble",
"with",
"the",
"most",
"competent",
"classifiers",
... | def select(self, competences):
"""Select the most competent classifier for
the classification of the query sample x.
The most competent classifier (dcs) or an ensemble
with the most competent classifiers (des) is returned
Parameters
----------
competences : array... | [
"def",
"select",
"(",
"self",
",",
"competences",
")",
":",
"pass"
] | https://github.com/scikit-learn-contrib/DESlib/blob/64260ae7c6dd745ef0003cc6322c9f829c807708/deslib/base.py#L179-L197 | ||
mila-iqia/myia | 56774a39579b4ec4123f44843ad4ca688acc859b | examples/mlp.py | python | run_helper | (epochs, n, batch_size, layer_sizes) | Run a model with the specified layer sizes on n random batches.
Arguments:
epochs: How many epochs to run.
n: Number of training batches to generate.
batch_size: Number of samples per batch.
layer_sizes: Sizes of the model's layers. | Run a model with the specified layer sizes on n random batches. | [
"Run",
"a",
"model",
"with",
"the",
"specified",
"layer",
"sizes",
"on",
"n",
"random",
"batches",
"."
] | def run_helper(epochs, n, batch_size, layer_sizes):
"""Run a model with the specified layer sizes on n random batches.
Arguments:
epochs: How many epochs to run.
n: Number of training batches to generate.
batch_size: Number of samples per batch.
layer_sizes: Sizes of the model's... | [
"def",
"run_helper",
"(",
"epochs",
",",
"n",
",",
"batch_size",
",",
"layer_sizes",
")",
":",
"layers",
"=",
"[",
"]",
"for",
"W",
",",
"b",
"in",
"mlp_parameters",
"(",
"*",
"layer_sizes",
")",
":",
"layers",
".",
"append",
"(",
"Linear",
"(",
"W",... | https://github.com/mila-iqia/myia/blob/56774a39579b4ec4123f44843ad4ca688acc859b/examples/mlp.py#L146-L174 | ||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/winobject/system.py | python | System.etw | (self) | return event_trace.EtwManager() | An object to interact with ETW (Event Tracing for Windows)
:type: :class:`~windows.winobject.event_trace.EtwManager` | An object to interact with ETW (Event Tracing for Windows) | [
"An",
"object",
"to",
"interact",
"with",
"ETW",
"(",
"Event",
"Tracing",
"for",
"Windows",
")"
] | def etw(self):
"""An object to interact with ETW (Event Tracing for Windows)
:type: :class:`~windows.winobject.event_trace.EtwManager`
"""
return event_trace.EtwManager() | [
"def",
"etw",
"(",
"self",
")",
":",
"return",
"event_trace",
".",
"EtwManager",
"(",
")"
] | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winobject/system.py#L117-L122 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/api/search/search.py | python | _ListIndexesResponsePbToGetResponse | (response) | return GetResponse(
results=[_NewIndexFromPb(index)
for index in response.index_metadata_list()]) | Returns a GetResponse constructed from get_indexes response pb. | Returns a GetResponse constructed from get_indexes response pb. | [
"Returns",
"a",
"GetResponse",
"constructed",
"from",
"get_indexes",
"response",
"pb",
"."
] | def _ListIndexesResponsePbToGetResponse(response):
"""Returns a GetResponse constructed from get_indexes response pb."""
return GetResponse(
results=[_NewIndexFromPb(index)
for index in response.index_metadata_list()]) | [
"def",
"_ListIndexesResponsePbToGetResponse",
"(",
"response",
")",
":",
"return",
"GetResponse",
"(",
"results",
"=",
"[",
"_NewIndexFromPb",
"(",
"index",
")",
"for",
"index",
"in",
"response",
".",
"index_metadata_list",
"(",
")",
"]",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/search/search.py#L715-L719 | |
rossant/galry | 6201fa32fb5c9ef3cea700cc22caf52fb69ebe31 | galry/glrenderer.py | python | GLVisualRenderer.initialize_framebuffer | (self, name) | [] | def initialize_framebuffer(self, name):
variable = self.get_variable(name)
variable['buffer'] = FrameBuffer.create()
# bind the frame buffer
FrameBuffer.bind(variable['buffer'])
# variable['texture'] is a list of texture names in the current visual
if is... | [
"def",
"initialize_framebuffer",
"(",
"self",
",",
"name",
")",
":",
"variable",
"=",
"self",
".",
"get_variable",
"(",
"name",
")",
"variable",
"[",
"'buffer'",
"]",
"=",
"FrameBuffer",
".",
"create",
"(",
")",
"# bind the frame buffer",
"FrameBuffer",
".",
... | https://github.com/rossant/galry/blob/6201fa32fb5c9ef3cea700cc22caf52fb69ebe31/galry/glrenderer.py#L882-L903 | ||||
bwohlberg/sporco | df67462abcf83af6ab1961bcb0d51b87a66483fa | sporco/admm/bpdn.py | python | ElasticNet.xstep | (self) | r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{x}`. | r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{x}`. | [
"r",
"Minimise",
"Augmented",
"Lagrangian",
"with",
"respect",
"to",
":",
"math",
":",
"\\",
"mathbf",
"{",
"x",
"}",
"."
] | def xstep(self):
r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{x}`.
"""
self.X = np.asarray(sl.cho_solve_ATAI(
self.D, self.mu + self.rho, self.DTS +
self.rho * (self.Y - self.U),
self.lu, self.piv), dtype=self.dtype)
if se... | [
"def",
"xstep",
"(",
"self",
")",
":",
"self",
".",
"X",
"=",
"np",
".",
"asarray",
"(",
"sl",
".",
"cho_solve_ATAI",
"(",
"self",
".",
"D",
",",
"self",
".",
"mu",
"+",
"self",
".",
"rho",
",",
"self",
".",
"DTS",
"+",
"self",
".",
"rho",
"*... | https://github.com/bwohlberg/sporco/blob/df67462abcf83af6ab1961bcb0d51b87a66483fa/sporco/admm/bpdn.py#L710-L725 | ||
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | venv/__init__.py | python | EnvBuilder.replace_variables | (self, text, context) | return text | Replace variable placeholders in script text with context-specific
variables.
Return the text passed in , but with variables replaced.
:param text: The text in which to replace placeholder variables.
:param context: The information for the environment creation request
... | Replace variable placeholders in script text with context-specific
variables. | [
"Replace",
"variable",
"placeholders",
"in",
"script",
"text",
"with",
"context",
"-",
"specific",
"variables",
"."
] | def replace_variables(self, text, context):
"""
Replace variable placeholders in script text with context-specific
variables.
Return the text passed in , but with variables replaced.
:param text: The text in which to replace placeholder variables.
:param context: The in... | [
"def",
"replace_variables",
"(",
"self",
",",
"text",
",",
"context",
")",
":",
"text",
"=",
"text",
".",
"replace",
"(",
"'__VENV_DIR__'",
",",
"context",
".",
"env_dir",
")",
"text",
"=",
"text",
".",
"replace",
"(",
"'__VENV_NAME__'",
",",
"context",
... | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/venv/__init__.py#L253-L268 | |
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/volume/drivers/dell_emc/powermax/common.py | python | PowerMaxCommon.unmanage | (self, volume) | Export PowerMax/VMAX volume from Cinder.
Leave the volume intact on the backend array.
:param volume: the volume object | Export PowerMax/VMAX volume from Cinder. | [
"Export",
"PowerMax",
"/",
"VMAX",
"volume",
"from",
"Cinder",
"."
] | def unmanage(self, volume):
"""Export PowerMax/VMAX volume from Cinder.
Leave the volume intact on the backend array.
:param volume: the volume object
"""
volume_name = volume.name
volume_id = volume.id
LOG.info("Unmanage volume %(name)s, id=%(id)s",
... | [
"def",
"unmanage",
"(",
"self",
",",
"volume",
")",
":",
"volume_name",
"=",
"volume",
".",
"name",
"volume_id",
"=",
"volume",
".",
"id",
"LOG",
".",
"info",
"(",
"\"Unmanage volume %(name)s, id=%(id)s\"",
",",
"{",
"'name'",
":",
"volume_name",
",",
"'id'"... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/dell_emc/powermax/common.py#L3378-L3437 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_ca_server_cert.py | python | Utils.cleanup | (files) | Clean up on exit | Clean up on exit | [
"Clean",
"up",
"on",
"exit"
] | def cleanup(files):
'''Clean up on exit '''
for sfile in files:
if os.path.exists(sfile):
if os.path.isdir(sfile):
shutil.rmtree(sfile)
elif os.path.isfile(sfile):
os.remove(sfile) | [
"def",
"cleanup",
"(",
"files",
")",
":",
"for",
"sfile",
"in",
"files",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"sfile",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"sfile",
")",
":",
"shutil",
".",
"rmtree",
"(",
"sfile",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_ca_server_cert.py#L1252-L1259 | ||
bravoserver/bravo | 7be5d792871a8447499911fa1502c6a7c1437dc3 | bravo/terrain/trees.py | python | MangroveTree.make_trunk | (self, world) | Make the trunk, roots, buttresses, branches, etc. | Make the trunk, roots, buttresses, branches, etc. | [
"Make",
"the",
"trunk",
"roots",
"buttresses",
"branches",
"etc",
"."
] | def make_trunk(self, world):
"""
Make the trunk, roots, buttresses, branches, etc.
"""
height = self.height
trunkheight = self.trunkheight
trunkradius = self.trunkradius
starty = self.pos[1]
midy = self.pos[1] + int(trunkheight * 1 / (PHI + 1))
to... | [
"def",
"make_trunk",
"(",
"self",
",",
"world",
")",
":",
"height",
"=",
"self",
".",
"height",
"trunkheight",
"=",
"self",
".",
"trunkheight",
"trunkradius",
"=",
"self",
".",
"trunkradius",
"starty",
"=",
"self",
".",
"pos",
"[",
"1",
"]",
"midy",
"=... | https://github.com/bravoserver/bravo/blob/7be5d792871a8447499911fa1502c6a7c1437dc3/bravo/terrain/trees.py#L606-L662 | ||
tensorflow/datasets | 2e496976d7d45550508395fb2f35cf958c8a3414 | tensorflow_datasets/core/load.py | python | list_full_names | (current_version_only: bool = False) | return sorted(_iter_full_names(current_version_only=current_version_only)) | Lists all registered datasets full_names.
Args:
current_version_only: If True, only returns the current version.
Returns:
The list of all registered dataset full names. | Lists all registered datasets full_names. | [
"Lists",
"all",
"registered",
"datasets",
"full_names",
"."
] | def list_full_names(current_version_only: bool = False) -> List[str]:
"""Lists all registered datasets full_names.
Args:
current_version_only: If True, only returns the current version.
Returns:
The list of all registered dataset full names.
"""
return sorted(_iter_full_names(current_version_only=cu... | [
"def",
"list_full_names",
"(",
"current_version_only",
":",
"bool",
"=",
"False",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"sorted",
"(",
"_iter_full_names",
"(",
"current_version_only",
"=",
"current_version_only",
")",
")"
] | https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/core/load.py#L392-L401 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/ldap3/protocol/microsoft.py | python | extended_dn_control | (criticality=False, hex_format=False) | return build_control('1.2.840.113556.1.4.529', criticality, control_value) | [] | def extended_dn_control(criticality=False, hex_format=False):
control_value = ExtendedDN()
control_value.setComponentByName('option', Integer(not hex_format))
return build_control('1.2.840.113556.1.4.529', criticality, control_value) | [
"def",
"extended_dn_control",
"(",
"criticality",
"=",
"False",
",",
"hex_format",
"=",
"False",
")",
":",
"control_value",
"=",
"ExtendedDN",
"(",
")",
"control_value",
".",
"setComponentByName",
"(",
"'option'",
",",
"Integer",
"(",
"not",
"hex_format",
")",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/ldap3/protocol/microsoft.py#L126-L129 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.