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
plaid/plaid-python
8c60fca608e426f3ff30da8857775946d29e122c
plaid/model/wallet_balance.py
python
WalletBalance.__init__
(self, iso_currency_code, current, *args, **kwargs)
WalletBalance - a model defined in OpenAPI Args: iso_currency_code (str): The ISO-4217 currency code of the balance current (float): The total amount of funds in the account Keyword Args: _check_type (bool): if True, values for parameters in openapi_types ...
WalletBalance - a model defined in OpenAPI
[ "WalletBalance", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, iso_currency_code, current, *args, **kwargs): # noqa: E501 """WalletBalance - a model defined in OpenAPI Args: iso_currency_code (str): The ISO-4217 currency code of the balance current (float): The total amount of funds in the account Keyword Args: ...
[ "def", "__init__", "(", "self", ",", "iso_currency_code", ",", "current", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "...
https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/wallet_balance.py#L105-L177
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/asn1crypto/x509.py
python
Name.sha256
(self)
return self._sha256
:return: The SHA-256 hash of the DER-encoded bytes of this name
:return: The SHA-256 hash of the DER-encoded bytes of this name
[ ":", "return", ":", "The", "SHA", "-", "256", "hash", "of", "the", "DER", "-", "encoded", "bytes", "of", "this", "name" ]
def sha256(self): """ :return: The SHA-256 hash of the DER-encoded bytes of this name """ if self._sha256 is None: self._sha256 = hashlib.sha256(self.dump()).digest() return self._sha256
[ "def", "sha256", "(", "self", ")", ":", "if", "self", ".", "_sha256", "is", "None", ":", "self", ".", "_sha256", "=", "hashlib", ".", "sha256", "(", "self", ".", "dump", "(", ")", ")", ".", "digest", "(", ")", "return", "self", ".", "_sha256" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/asn1crypto/x509.py#L1145-L1153
appu1232/Discord-Selfbot
2305be70cdd8499c4ddb8b79101c70ac2f3fbb0d
cogs/utility.py
python
Utility.hb
(self, ctx, *, msg)
Posts to Hastebin
Posts to Hastebin
[ "Posts", "to", "Hastebin" ]
async def hb(self, ctx, *, msg): """Posts to Hastebin""" if ctx.invoked_subcommand is None: pre = cmd_prefix_len() url = await hastebin(msg, self.bot.session) await ctx.send(self.bot.bot_prefix + 'Hastebin output: ' + url) await ctx.message.delete()
[ "async", "def", "hb", "(", "self", ",", "ctx", ",", "*", ",", "msg", ")", ":", "if", "ctx", ".", "invoked_subcommand", "is", "None", ":", "pre", "=", "cmd_prefix_len", "(", ")", "url", "=", "await", "hastebin", "(", "msg", ",", "self", ".", "bot", ...
https://github.com/appu1232/Discord-Selfbot/blob/2305be70cdd8499c4ddb8b79101c70ac2f3fbb0d/cogs/utility.py#L269-L275
ayoolaolafenwa/PixelLib
ae56003c416a98780141a1170c9d888fe9a31317
pixellib/instance/mask_rcnn.py
python
mrcnn_mask_loss_graph
(target_masks, target_class_ids, pred_masks)
return loss
Mask binary cross-entropy loss for the masks head. target_masks: [batch, num_rois, height, width]. A float32 tensor of values 0 or 1. Uses zero padding to fill array. target_class_ids: [batch, num_rois]. Integer class IDs. Zero padded. pred_masks: [batch, proposals, height, width, num_classes] float...
Mask binary cross-entropy loss for the masks head. target_masks: [batch, num_rois, height, width]. A float32 tensor of values 0 or 1. Uses zero padding to fill array. target_class_ids: [batch, num_rois]. Integer class IDs. Zero padded. pred_masks: [batch, proposals, height, width, num_classes] float...
[ "Mask", "binary", "cross", "-", "entropy", "loss", "for", "the", "masks", "head", ".", "target_masks", ":", "[", "batch", "num_rois", "height", "width", "]", ".", "A", "float32", "tensor", "of", "values", "0", "or", "1", ".", "Uses", "zero", "padding", ...
def mrcnn_mask_loss_graph(target_masks, target_class_ids, pred_masks): """Mask binary cross-entropy loss for the masks head. target_masks: [batch, num_rois, height, width]. A float32 tensor of values 0 or 1. Uses zero padding to fill array. target_class_ids: [batch, num_rois]. Integer class IDs. Zer...
[ "def", "mrcnn_mask_loss_graph", "(", "target_masks", ",", "target_class_ids", ",", "pred_masks", ")", ":", "# Reshape for simplicity. Merge first two dimensions into one.", "target_class_ids", "=", "K", ".", "reshape", "(", "target_class_ids", ",", "(", "-", "1", ",", "...
https://github.com/ayoolaolafenwa/PixelLib/blob/ae56003c416a98780141a1170c9d888fe9a31317/pixellib/instance/mask_rcnn.py#L1145-L1180
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/circuit/library/n_local/qaoa_ansatz.py
python
QAOAAnsatz.parameter_bounds
( self, bounds: Optional[List[Tuple[Optional[float], Optional[float]]]] )
Set the parameter bounds. Args: bounds: The new parameter bounds.
Set the parameter bounds.
[ "Set", "the", "parameter", "bounds", "." ]
def parameter_bounds( self, bounds: Optional[List[Tuple[Optional[float], Optional[float]]]] ) -> None: """Set the parameter bounds. Args: bounds: The new parameter bounds. """ self._bounds = bounds
[ "def", "parameter_bounds", "(", "self", ",", "bounds", ":", "Optional", "[", "List", "[", "Tuple", "[", "Optional", "[", "float", "]", ",", "Optional", "[", "float", "]", "]", "]", "]", ")", "->", "None", ":", "self", ".", "_bounds", "=", "bounds" ]
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/circuit/library/n_local/qaoa_ansatz.py#L137-L145
hatRiot/zarp
2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad
src/lib/libmproxy/contrib/jsbeautifier/unpackers/__init__.py
python
filtercomments
(source)
return '\n'.join(trailing_comments) + source
NOT USED: strips trailing comments and put them at the top.
NOT USED: strips trailing comments and put them at the top.
[ "NOT", "USED", ":", "strips", "trailing", "comments", "and", "put", "them", "at", "the", "top", "." ]
def filtercomments(source): """NOT USED: strips trailing comments and put them at the top.""" trailing_comments = [] comment = True while comment: if re.search(r'^\s*\/\*', source): comment = source[0, source.index('*/') + 2] elif re.search(r'^\s*\/\/', source): ...
[ "def", "filtercomments", "(", "source", ")", ":", "trailing_comments", "=", "[", "]", "comment", "=", "True", "while", "comment", ":", "if", "re", ".", "search", "(", "r'^\\s*\\/\\*'", ",", "source", ")", ":", "comment", "=", "source", "[", "0", ",", "...
https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/libmproxy/contrib/jsbeautifier/unpackers/__init__.py#L50-L67
facebookresearch/open_lth
2ce732fe48abd5a80c10a153c45d397b048e980c
training/train.py
python
train
( training_hparams: hparams.TrainingHparams, model: Model, train_loader: DataLoader, output_location: str, callbacks: typing.List[typing.Callable] = [], start_step: Step = None, end_step: Step = None )
The main training loop for this framework. Args: * training_hparams: The training hyperparameters whose schema is specified in hparams.py. * model: The model to train. Must be a models.base.Model * train_loader: The training data. Must be a datasets.base.DataLoader * output_location: The st...
The main training loop for this framework.
[ "The", "main", "training", "loop", "for", "this", "framework", "." ]
def train( training_hparams: hparams.TrainingHparams, model: Model, train_loader: DataLoader, output_location: str, callbacks: typing.List[typing.Callable] = [], start_step: Step = None, end_step: Step = None ): """The main training loop for this framework. Args: * training_h...
[ "def", "train", "(", "training_hparams", ":", "hparams", ".", "TrainingHparams", ",", "model", ":", "Model", ",", "train_loader", ":", "DataLoader", ",", "output_location", ":", "str", ",", "callbacks", ":", "typing", ".", "List", "[", "typing", ".", "Callab...
https://github.com/facebookresearch/open_lth/blob/2ce732fe48abd5a80c10a153c45d397b048e980c/training/train.py#L29-L131
DataBiosphere/toil
2e148eee2114ece8dcc3ec8a83f36333266ece0d
src/toil/fileStores/cachingFileStore.py
python
CachingFileStore._tryToFreeUpSpace
(self)
If disk space is overcommitted, try one round of collecting files to upload/download/delete/evict. Return whether we manage to get any space freed or not.
If disk space is overcommitted, try one round of collecting files to upload/download/delete/evict. Return whether we manage to get any space freed or not.
[ "If", "disk", "space", "is", "overcommitted", "try", "one", "round", "of", "collecting", "files", "to", "upload", "/", "download", "/", "delete", "/", "evict", ".", "Return", "whether", "we", "manage", "to", "get", "any", "space", "freed", "or", "not", "...
def _tryToFreeUpSpace(self): """ If disk space is overcommitted, try one round of collecting files to upload/download/delete/evict. Return whether we manage to get any space freed or not. """ # First we want to make sure that dead jobs aren't holding # references to file...
[ "def", "_tryToFreeUpSpace", "(", "self", ")", ":", "# First we want to make sure that dead jobs aren't holding", "# references to files and keeping them from looking unused.", "self", ".", "_removeDeadJobs", "(", "self", ".", "workDir", ",", "self", ".", "con", ")", "# Adopt ...
https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/fileStores/cachingFileStore.py#L862-L927
quantumlib/OpenFermion
6187085f2a7707012b68370b625acaeed547e62b
src/openfermion/transforms/repconversions/conversions.py
python
get_interaction_operator
(fermion_operator, n_qubits=None)
return interaction_operator
r"""Convert a 2-body fermionic operator to InteractionOperator. This function should only be called on fermionic operators which consist of only a_p^\dagger a_q and a_p^\dagger a_q^\dagger a_r a_s terms. The one-body terms are stored in a matrix, one_body[p, q], and the two-body terms are stored in a t...
r"""Convert a 2-body fermionic operator to InteractionOperator.
[ "r", "Convert", "a", "2", "-", "body", "fermionic", "operator", "to", "InteractionOperator", "." ]
def get_interaction_operator(fermion_operator, n_qubits=None): r"""Convert a 2-body fermionic operator to InteractionOperator. This function should only be called on fermionic operators which consist of only a_p^\dagger a_q and a_p^\dagger a_q^\dagger a_r a_s terms. The one-body terms are stored in a m...
[ "def", "get_interaction_operator", "(", "fermion_operator", ",", "n_qubits", "=", "None", ")", ":", "if", "not", "isinstance", "(", "fermion_operator", ",", "FermionOperator", ")", ":", "raise", "TypeError", "(", "'Input must be a FermionOperator.'", ")", "check_no_sy...
https://github.com/quantumlib/OpenFermion/blob/6187085f2a7707012b68370b625acaeed547e62b/src/openfermion/transforms/repconversions/conversions.py#L240-L314
django-nonrel/django-nonrel
4fbfe7344481a5eab8698f79207f09124310131b
django/contrib/gis/geos/geometry.py
python
GEOSGeometry.intersection
(self, other)
return self._topology(capi.geos_intersection(self.ptr, other.ptr))
Returns a Geometry representing the points shared by this Geometry and other.
Returns a Geometry representing the points shared by this Geometry and other.
[ "Returns", "a", "Geometry", "representing", "the", "points", "shared", "by", "this", "Geometry", "and", "other", "." ]
def intersection(self, other): "Returns a Geometry representing the points shared by this Geometry and other." return self._topology(capi.geos_intersection(self.ptr, other.ptr))
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_intersection", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ")" ]
https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/contrib/gis/geos/geometry.py#L586-L588
plasticityai/supersqlite
d74da749c6fa5df021df3968b854b9a59f829e17
supersqlite/third_party/_apsw/tools/shell.py
python
Shell.command_schema
(self, cmd)
schema ?TABLE? [TABLE...]: Shows SQL for table If you give one or more tables then their schema is listed (including indices). If you don't specify any then all schemas are listed. TABLE is a like pattern so you can % for wildcards.
schema ?TABLE? [TABLE...]: Shows SQL for table
[ "schema", "?TABLE?", "[", "TABLE", "...", "]", ":", "Shows", "SQL", "for", "table" ]
def command_schema(self, cmd): """schema ?TABLE? [TABLE...]: Shows SQL for table If you give one or more tables then their schema is listed (including indices). If you don't specify any then all schemas are listed. TABLE is a like pattern so you can % for wildcards. """...
[ "def", "command_schema", "(", "self", ",", "cmd", ")", ":", "self", ".", "push_output", "(", ")", "self", ".", "output", "=", "self", ".", "output_list", "self", ".", "header", "=", "False", "try", ":", "if", "len", "(", "cmd", ")", "==", "0", ":",...
https://github.com/plasticityai/supersqlite/blob/d74da749c6fa5df021df3968b854b9a59f829e17/supersqlite/third_party/_apsw/tools/shell.py#L2185-L2207
microsoft/NimbusML
f6be39ce9359786976429bab0ccd837e849b4ba5
src/python/nimbusml/datasets/image.py
python
get_RevolutionAnalyticslogo
()
return os.path.join(this, "images", "RevolutionAnalyticslogo.png")
Return a path to *RevolutionAnalyticslogo.png*. .. image:: images/RevolutionAnalyticslogo.png
Return a path to *RevolutionAnalyticslogo.png*.
[ "Return", "a", "path", "to", "*", "RevolutionAnalyticslogo", ".", "png", "*", "." ]
def get_RevolutionAnalyticslogo(): """ Return a path to *RevolutionAnalyticslogo.png*. .. image:: images/RevolutionAnalyticslogo.png """ this = os.path.abspath(os.path.dirname(__file__)) return os.path.join(this, "images", "RevolutionAnalyticslogo.png")
[ "def", "get_RevolutionAnalyticslogo", "(", ")", ":", "this", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "return", "os", ".", "path", ".", "join", "(", "this", ",", "\"images\"", ",", "\"...
https://github.com/microsoft/NimbusML/blob/f6be39ce9359786976429bab0ccd837e849b4ba5/src/python/nimbusml/datasets/image.py#L11-L18
hyperspy/hyperspy
1ffb3fab33e607045a37f30c1463350b72617e10
hyperspy/roi.py
python
BaseROI.is_valid
(self)
return t.Undefined not in tuple(self)
Determine if the ROI is in a valid state. This is typically determined by all the coordinates being defined, and that the values makes sense relative to each other.
Determine if the ROI is in a valid state.
[ "Determine", "if", "the", "ROI", "is", "in", "a", "valid", "state", "." ]
def is_valid(self): """ Determine if the ROI is in a valid state. This is typically determined by all the coordinates being defined, and that the values makes sense relative to each other. """ return t.Undefined not in tuple(self)
[ "def", "is_valid", "(", "self", ")", ":", "return", "t", ".", "Undefined", "not", "in", "tuple", "(", "self", ")" ]
https://github.com/hyperspy/hyperspy/blob/1ffb3fab33e607045a37f30c1463350b72617e10/hyperspy/roi.py#L129-L136
BIGBALLON/CIFAR-ZOO
94b4c75e02d0c62ec1c7ce862863b0a810d9d0a5
models/lenet.py
python
lenet
(num_classes)
return LeNet(num_classes=num_classes)
[]
def lenet(num_classes): return LeNet(num_classes=num_classes)
[ "def", "lenet", "(", "num_classes", ")", ":", "return", "LeNet", "(", "num_classes", "=", "num_classes", ")" ]
https://github.com/BIGBALLON/CIFAR-ZOO/blob/94b4c75e02d0c62ec1c7ce862863b0a810d9d0a5/models/lenet.py#L29-L30
yzhao062/combo
229d578de498b47ae03cf2580472aceebf8c2766
combo/models/classifier_dcs.py
python
DCS_LA.predict
(self, X)
return self._predict_internal(X, predict_proba=False)
Predict the class labels for the provided data. Parameters ---------- X : numpy array of shape (n_samples, n_features) The input samples. Returns ------- labels : numpy array of shape (n_samples,) Class labels for each data sample.
Predict the class labels for the provided data.
[ "Predict", "the", "class", "labels", "for", "the", "provided", "data", "." ]
def predict(self, X): """Predict the class labels for the provided data. Parameters ---------- X : numpy array of shape (n_samples, n_features) The input samples. Returns ------- labels : numpy array of shape (n_samples,) Class labels for...
[ "def", "predict", "(", "self", ",", "X", ")", ":", "return", "self", ".", "_predict_internal", "(", "X", ",", "predict_proba", "=", "False", ")" ]
https://github.com/yzhao062/combo/blob/229d578de498b47ae03cf2580472aceebf8c2766/combo/models/classifier_dcs.py#L115-L128
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/third_party/boto/boto/opsworks/layer1.py
python
OpsWorksConnection.create_stack
(self, name, region, service_role_arn, default_instance_profile_arn, vpc_id=None, attributes=None, default_os=None, hostname_theme=None, default_availability_zone=None, default_subnet_id=None, custom_json=None, configuration_manager=Non...
return self.make_request(action='CreateStack', body=json.dumps(params))
Creates a new stack. For more information, see `Create a New Stack`_. **Required Permissions**: To use this action, an IAM user must have an attached policy that explicitly grants permissions. For more information on user permissions, see `Managing User Permissions`_. :...
Creates a new stack. For more information, see `Create a New Stack`_.
[ "Creates", "a", "new", "stack", ".", "For", "more", "information", "see", "Create", "a", "New", "Stack", "_", "." ]
def create_stack(self, name, region, service_role_arn, default_instance_profile_arn, vpc_id=None, attributes=None, default_os=None, hostname_theme=None, default_availability_zone=None, default_subnet_id=None, custom_json=None, configura...
[ "def", "create_stack", "(", "self", ",", "name", ",", "region", ",", "service_role_arn", ",", "default_instance_profile_arn", ",", "vpc_id", "=", "None", ",", "attributes", "=", "None", ",", "default_os", "=", "None", ",", "hostname_theme", "=", "None", ",", ...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/opsworks/layer1.py#L796-L976
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/permutation.py
python
StandardPermutations_avoiding_312.cardinality
(self)
return catalan_number(self.n)
EXAMPLES:: sage: Permutations(5, avoiding=[3, 1, 2]).cardinality() 42 sage: len( Permutations(5, avoiding=[3, 1, 2]).list() ) 42
EXAMPLES::
[ "EXAMPLES", "::" ]
def cardinality(self): """ EXAMPLES:: sage: Permutations(5, avoiding=[3, 1, 2]).cardinality() 42 sage: len( Permutations(5, avoiding=[3, 1, 2]).list() ) 42 """ return catalan_number(self.n)
[ "def", "cardinality", "(", "self", ")", ":", "return", "catalan_number", "(", "self", ".", "n", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/permutation.py#L9127-L9136
mirumee/ariadne
1b8b7ef0ed65cde95a6bd9e25500584a38393b71
ariadne/graphql.py
python
handle_graphql_errors
( errors: Sequence[GraphQLError], *, logger, error_formatter, debug, extension_manager=None, )
return False, response
[]
def handle_graphql_errors( errors: Sequence[GraphQLError], *, logger, error_formatter, debug, extension_manager=None, ) -> GraphQLResult: for error in errors: log_error(error, logger) response = {"errors": [error_formatter(error, debug) for error in errors]} if extension_mana...
[ "def", "handle_graphql_errors", "(", "errors", ":", "Sequence", "[", "GraphQLError", "]", ",", "*", ",", "logger", ",", "error_formatter", ",", "debug", ",", "extension_manager", "=", "None", ",", ")", "->", "GraphQLResult", ":", "for", "error", "in", "error...
https://github.com/mirumee/ariadne/blob/1b8b7ef0ed65cde95a6bd9e25500584a38393b71/ariadne/graphql.py#L291-L305
SpockBotMC/SpockBot
f89911551f18357720034fbaa52837a0d09f66ea
spockbot/mcp/nbt.py
python
TagList.__repr__
(self)
return "%i entries of type %s" % ( len(self.tags), TAGLIST[self.tagID].__name__)
[]
def __repr__(self): return "%i entries of type %s" % ( len(self.tags), TAGLIST[self.tagID].__name__)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"%i entries of type %s\"", "%", "(", "len", "(", "self", ".", "tags", ")", ",", "TAGLIST", "[", "self", ".", "tagID", "]", ".", "__name__", ")" ]
https://github.com/SpockBotMC/SpockBot/blob/f89911551f18357720034fbaa52837a0d09f66ea/spockbot/mcp/nbt.py#L382-L384
markj3d/Red9_StudioPack
1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919
core/Red9_AnimationUtils.py
python
AnimationUI.getPosePath
(self)
return os.path.join(self.getPoseDir(), '%s.pose' % self.getPoseSelected())
Return the full posePath for loading
Return the full posePath for loading
[ "Return", "the", "full", "posePath", "for", "loading" ]
def getPosePath(self): ''' Return the full posePath for loading ''' return os.path.join(self.getPoseDir(), '%s.pose' % self.getPoseSelected())
[ "def", "getPosePath", "(", "self", ")", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "getPoseDir", "(", ")", ",", "'%s.pose'", "%", "self", ".", "getPoseSelected", "(", ")", ")" ]
https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/core/Red9_AnimationUtils.py#L2176-L2180
cbaziotis/ekphrasis
e70c29f3c0c27e274a40a5ad45a5f2a0e24d432d
ekphrasis/classes/segmenter.py
python
Segmenter.splits
(self, text)
return [(text[:i + 1], text[i + 1:]) for i in range(min(len(text), self.L))]
Return a list of all possible (first, rem) pairs with max length of first <=L :param text: :return:
Return a list of all possible (first, rem) pairs with max length of first <=L :param text: :return:
[ "Return", "a", "list", "of", "all", "possible", "(", "first", "rem", ")", "pairs", "with", "max", "length", "of", "first", "<", "=", "L", ":", "param", "text", ":", ":", "return", ":" ]
def splits(self, text): """ Return a list of all possible (first, rem) pairs with max length of first <=L :param text: :return: """ return [(text[:i + 1], text[i + 1:]) for i in range(min(len(text), self.L))]
[ "def", "splits", "(", "self", ",", "text", ")", ":", "return", "[", "(", "text", "[", ":", "i", "+", "1", "]", ",", "text", "[", "i", "+", "1", ":", "]", ")", "for", "i", "in", "range", "(", "min", "(", "len", "(", "text", ")", ",", "self...
https://github.com/cbaziotis/ekphrasis/blob/e70c29f3c0c27e274a40a5ad45a5f2a0e24d432d/ekphrasis/classes/segmenter.py#L107-L114
MozillaSecurity/grizzly
1c41478e32f323189a2c322ec041c3e0902a158a
grizzly/common/status.py
python
Status.rate
(self)
return self.iteration / float(runtime) if runtime else 0
Calculate the number of iterations performed per second since start() was called. Args: None Returns: float: Number of iterations performed per second.
Calculate the number of iterations performed per second since start() was called.
[ "Calculate", "the", "number", "of", "iterations", "performed", "per", "second", "since", "start", "()", "was", "called", "." ]
def rate(self): """Calculate the number of iterations performed per second since start() was called. Args: None Returns: float: Number of iterations performed per second. """ runtime = self.runtime return self.iteration / float(runtime) i...
[ "def", "rate", "(", "self", ")", ":", "runtime", "=", "self", ".", "runtime", "return", "self", ".", "iteration", "/", "float", "(", "runtime", ")", "if", "runtime", "else", "0" ]
https://github.com/MozillaSecurity/grizzly/blob/1c41478e32f323189a2c322ec041c3e0902a158a/grizzly/common/status.py#L279-L290
thautwarm/restrain-jit
f76b3e9ae8a34d2eef87a42cc87197153f14634c
restrain_jit/becython/cy_loader.py
python
compile_module
(under_dir: Path, mod_name: str, source_code: str, libs=())
return mod
[]
def compile_module(under_dir: Path, mod_name: str, source_code: str, libs=()): # TODO: # tempfile.TemporaryDirectory will close unexpectedly before removing the generated module. # Since that we don't delete the temporary dir as a workaround. mod_name = mod_name dirname = tempfile.mkdtemp(dir=str(u...
[ "def", "compile_module", "(", "under_dir", ":", "Path", ",", "mod_name", ":", "str", ",", "source_code", ":", "str", ",", "libs", "=", "(", ")", ")", ":", "# TODO:", "# tempfile.TemporaryDirectory will close unexpectedly before removing the generated module.", "# Since ...
https://github.com/thautwarm/restrain-jit/blob/f76b3e9ae8a34d2eef87a42cc87197153f14634c/restrain_jit/becython/cy_loader.py#L71-L108
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/ipythonconsole/widgets/shell.py
python
ShellWidget.interrupt_kernel
(self)
Attempts to interrupt the running kernel.
Attempts to interrupt the running kernel.
[ "Attempts", "to", "interrupt", "the", "running", "kernel", "." ]
def interrupt_kernel(self): """Attempts to interrupt the running kernel.""" # Empty queue when interrupting # Fixes spyder-ide/spyder#7293. self._execute_queue = [] super(ShellWidget, self).interrupt_kernel()
[ "def", "interrupt_kernel", "(", "self", ")", ":", "# Empty queue when interrupting", "# Fixes spyder-ide/spyder#7293.", "self", ".", "_execute_queue", "=", "[", "]", "super", "(", "ShellWidget", ",", "self", ")", ".", "interrupt_kernel", "(", ")" ]
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/ipythonconsole/widgets/shell.py#L242-L247
Droidtown/ArticutAPI
ee415bb30c9722a85334d54d7015d5ad3870205f
ArticutAPI/Toolkit/NER.py
python
GenericNER.getDecimal
(self, ArticutResultDICT, indexWithPOS=True)
return resultLIST
依 MSRA (微軟亞洲研究院, Microsoft Research Lab Asia) NER 標準取出文本中的描述「小數」的字串
依 MSRA (微軟亞洲研究院, Microsoft Research Lab Asia) NER 標準取出文本中的描述「小數」的字串
[ "依", "MSRA", "(", "微軟亞洲研究院", "Microsoft", "Research", "Lab", "Asia", ")", "NER", "標準取出文本中的描述「小數」的字串" ]
def getDecimal(self, ArticutResultDICT, indexWithPOS=True): ''' 依 MSRA (微軟亞洲研究院, Microsoft Research Lab Asia) NER 標準取出文本中的描述「小數」的字串 ''' if self.decimalPat !=None: pass else: self.decimalPat = re.compile("<ENTITY_num>[^<..點]*?[..點][^<..點]+?</ENTITY_num>") ...
[ "def", "getDecimal", "(", "self", ",", "ArticutResultDICT", ",", "indexWithPOS", "=", "True", ")", ":", "if", "self", ".", "decimalPat", "!=", "None", ":", "pass", "else", ":", "self", ".", "decimalPat", "=", "re", ".", "compile", "(", "\"<ENTITY_num>[^<.....
https://github.com/Droidtown/ArticutAPI/blob/ee415bb30c9722a85334d54d7015d5ad3870205f/ArticutAPI/Toolkit/NER.py#L340-L351
GoogleCloudPlatform/appengine-mapreduce
2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6
python/src/mapreduce/shuffler.py
python
_MergingReader.split_input
(cls, mapper_spec)
return [cls([0] * len(files), max_values_count, max_values_size) for files in filelists]
Split input into multiple shards.
Split input into multiple shards.
[ "Split", "input", "into", "multiple", "shards", "." ]
def split_input(cls, mapper_spec): """Split input into multiple shards.""" filelists = mapper_spec.params[cls.FILES_PARAM] max_values_count = mapper_spec.params.get(cls.MAX_VALUES_COUNT_PARAM, -1) max_values_size = mapper_spec.params.get(cls.MAX_VALUES_SIZE_PARAM, -1) return [cls([0] * len(files), m...
[ "def", "split_input", "(", "cls", ",", "mapper_spec", ")", ":", "filelists", "=", "mapper_spec", ".", "params", "[", "cls", ".", "FILES_PARAM", "]", "max_values_count", "=", "mapper_spec", ".", "params", ".", "get", "(", "cls", ".", "MAX_VALUES_COUNT_PARAM", ...
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/shuffler.py#L386-L392
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3/s3gis.py
python
S3GIS.get_locations
(table, query, join = True, geojson = True, )
return output
Returns the locations for an XML export - used by S3GIS.get_location_data() and S3PivotTable.geojson() TODO: Support multiple locations for a single resource (e.g. a Project working in multiple Communities)
Returns the locations for an XML export - used by S3GIS.get_location_data() and S3PivotTable.geojson()
[ "Returns", "the", "locations", "for", "an", "XML", "export", "-", "used", "by", "S3GIS", ".", "get_location_data", "()", "and", "S3PivotTable", ".", "geojson", "()" ]
def get_locations(table, query, join = True, geojson = True, ): """ Returns the locations for an XML export - used by S3GIS.get_location_data() and S3PivotTable.geojson() TODO: ...
[ "def", "get_locations", "(", "table", ",", "query", ",", "join", "=", "True", ",", "geojson", "=", "True", ",", ")", ":", "db", "=", "current", ".", "db", "tablename", "=", "table", ".", "_tablename", "gtable", "=", "current", ".", "s3db", ".", "gis_...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3gis.py#L2426-L2550
PyCQA/pylint
3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb
pylint/reporters/ureports/base_writer.py
python
BaseWriter.write
(self, string: str)
write a string in the output buffer
write a string in the output buffer
[ "write", "a", "string", "in", "the", "output", "buffer" ]
def write(self, string: str) -> None: """write a string in the output buffer""" self.out.write(string)
[ "def", "write", "(", "self", ",", "string", ":", "str", ")", "->", "None", ":", "self", ".", "out", ".", "write", "(", "string", ")" ]
https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/reporters/ureports/base_writer.py#L63-L65
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/database.py
python
EggInfoDistribution.check_installed_files
(self)
return mismatches
Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is ...
Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is ...
[ "Checks", "that", "the", "hashes", "and", "sizes", "of", "the", "files", "in", "RECORD", "are", "matched", "by", "the", "files", "themselves", ".", "Returns", "a", "(", "possibly", "empty", ")", "list", "of", "mismatches", ".", "Each", "entry", "in", "th...
def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' ...
[ "def", "check_installed_files", "(", "self", ")", ":", "mismatches", "=", "[", "]", "record_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'installed-files.txt'", ")", "if", "os", ".", "path", ".", "exists", "(", "record_path...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/database.py#L958-L975
ucsb-seclab/karonte
427ac313e596f723e40768b95d13bd7a9fc92fd8
eval/multi_bin/all_bins/binary_dependency_graph/utils.py
python
run_command
(cmd)
return o, e
Run shell commands :param cmd: command :return: stdout and stderr
Run shell commands :param cmd: command :return: stdout and stderr
[ "Run", "shell", "commands", ":", "param", "cmd", ":", "command", ":", "return", ":", "stdout", "and", "stderr" ]
def run_command(cmd): """ Run shell commands :param cmd: command :return: stdout and stderr """ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) o, e = p.communicate() return o, e
[ "def", "run_command", "(", "cmd", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "shell", "=", "True", ")", "o", ",", "e", "=", "p", "...
https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/eval/multi_bin/all_bins/binary_dependency_graph/utils.py#L60-L69
alan-turing-institute/sktime
79cc513346b1257a6f3fa8e4ed855b5a2a7de716
sktime/benchmarking/orchestration.py
python
Orchestrator.fit_predict
( self, overwrite_predictions=False, predict_on_train=False, save_fitted_strategies=True, overwrite_fitted_strategies=False, verbose=False, )
Fit and predict.
Fit and predict.
[ "Fit", "and", "predict", "." ]
def fit_predict( self, overwrite_predictions=False, predict_on_train=False, save_fitted_strategies=True, overwrite_fitted_strategies=False, verbose=False, ): """Fit and predict.""" # check that for fitted strategies overwrite option is only set when ...
[ "def", "fit_predict", "(", "self", ",", "overwrite_predictions", "=", "False", ",", "predict_on_train", "=", "False", ",", "save_fitted_strategies", "=", "True", ",", "overwrite_fitted_strategies", "=", "False", ",", "verbose", "=", "False", ",", ")", ":", "# ch...
https://github.com/alan-turing-institute/sktime/blob/79cc513346b1257a6f3fa8e4ed855b5a2a7de716/sktime/benchmarking/orchestration.py#L114-L236
datamllab/rlcard
c21ea82519c453a42e3bdc6848bd3356e9b6ac43
rlcard/games/uno/round.py
python
UnoRound.flip_top_card
(self)
return top
Flip the top card of the card pile Returns: (object of UnoCard): the top card in game
Flip the top card of the card pile
[ "Flip", "the", "top", "card", "of", "the", "card", "pile" ]
def flip_top_card(self): ''' Flip the top card of the card pile Returns: (object of UnoCard): the top card in game ''' top = self.dealer.flip_top_card() if top.trait == 'wild': top.color = self.np_random.choice(UnoCard.info['color']) self.target ...
[ "def", "flip_top_card", "(", "self", ")", ":", "top", "=", "self", ".", "dealer", ".", "flip_top_card", "(", ")", "if", "top", ".", "trait", "==", "'wild'", ":", "top", ".", "color", "=", "self", ".", "np_random", ".", "choice", "(", "UnoCard", ".", ...
https://github.com/datamllab/rlcard/blob/c21ea82519c453a42e3bdc6848bd3356e9b6ac43/rlcard/games/uno/round.py#L24-L36
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/set/src/core/scapy.py
python
merge
(x,y)
return m
[]
def merge(x,y): if len(x) > len(y): y += "\x00"*(len(x)-len(y)) elif len(x) < len(y): x += "\x00"*(len(y)-len(x)) m = "" for i in range(len(x)/ss): m += x[ss*i:ss*(i+1)]+y[ss*i:ss*(i+1)] return m
[ "def", "merge", "(", "x", ",", "y", ")", ":", "if", "len", "(", "x", ")", ">", "len", "(", "y", ")", ":", "y", "+=", "\"\\x00\"", "*", "(", "len", "(", "x", ")", "-", "len", "(", "y", ")", ")", "elif", "len", "(", "x", ")", "<", "len", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L12484-L12492
KovenYu/MAR
860031695e4e1b623b48a7a1228a3cf8051d8dcf
src/utils.py
python
DiscriminativeLoss._partition_sets
(self, features, multilabels, labels)
return P, N
partition the batch into confident positive, hard negative and others :param features: shape=(BS, dim) :param multilabels: shape=(BS, n_class) :param labels: shape=(BS,) :return: P: positive pair set. tuple of 2 np.array i and j. i contains smaller indices and j large...
partition the batch into confident positive, hard negative and others :param features: shape=(BS, dim) :param multilabels: shape=(BS, n_class) :param labels: shape=(BS,) :return: P: positive pair set. tuple of 2 np.array i and j. i contains smaller indices and j large...
[ "partition", "the", "batch", "into", "confident", "positive", "hard", "negative", "and", "others", ":", "param", "features", ":", "shape", "=", "(", "BS", "dim", ")", ":", "param", "multilabels", ":", "shape", "=", "(", "BS", "n_class", ")", ":", "param"...
def _partition_sets(self, features, multilabels, labels): """ partition the batch into confident positive, hard negative and others :param features: shape=(BS, dim) :param multilabels: shape=(BS, n_class) :param labels: shape=(BS,) :return: P: positive pair set. t...
[ "def", "_partition_sets", "(", "self", ",", "features", ",", "multilabels", ",", "labels", ")", ":", "f_np", "=", "features", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "ml_np", "=", "multilabels", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "...
https://github.com/KovenYu/MAR/blob/860031695e4e1b623b48a7a1228a3cf8051d8dcf/src/utils.py#L143-L169
MozillaSecurity/funfuzz
fe5cc4710f82e68a171bf1255f43519f9c1bf784
src/funfuzz/js/compile_shell.py
python
CompiledShell.get_s3_tar_with_ext_full_path
(self)
return sm_compile_helpers.ensure_cache_dir(Path.home()) / self.get_s3_tar_name_with_ext()
Retrieve the path to the tarball downloaded from S3. Returns: Path: Full path to the tarball in the local shell cache directory
Retrieve the path to the tarball downloaded from S3.
[ "Retrieve", "the", "path", "to", "the", "tarball", "downloaded", "from", "S3", "." ]
def get_s3_tar_with_ext_full_path(self): """Retrieve the path to the tarball downloaded from S3. Returns: Path: Full path to the tarball in the local shell cache directory """ return sm_compile_helpers.ensure_cache_dir(Path.home()) / self.get_s3_tar_name_with_ext()
[ "def", "get_s3_tar_with_ext_full_path", "(", "self", ")", ":", "return", "sm_compile_helpers", ".", "ensure_cache_dir", "(", "Path", ".", "home", "(", ")", ")", "/", "self", ".", "get_s3_tar_name_with_ext", "(", ")" ]
https://github.com/MozillaSecurity/funfuzz/blob/fe5cc4710f82e68a171bf1255f43519f9c1bf784/src/funfuzz/js/compile_shell.py#L243-L249
mozilla/mozillians
bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9
mozillians/phonebook/validators.py
python
validate_twitter
(username)
return username
Return a twitter username given '@' or http(s) strings.
Return a twitter username given '
[ "Return", "a", "twitter", "username", "given" ]
def validate_twitter(username): """Return a twitter username given '@' or http(s) strings.""" if username: username = re.sub(r'https?://(www\.)?twitter\.com/|@', '', username) # Twitter accounts must be alphanumeric ASCII including underscore, and <= 15 chars. # https://support.twitter...
[ "def", "validate_twitter", "(", "username", ")", ":", "if", "username", ":", "username", "=", "re", ".", "sub", "(", "r'https?://(www\\.)?twitter\\.com/|@'", ",", "''", ",", "username", ")", "# Twitter accounts must be alphanumeric ASCII including underscore, and <= 15 char...
https://github.com/mozilla/mozillians/blob/bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9/mozillians/phonebook/validators.py#L10-L24
NVlabs/Deep_Object_Pose
c50e5fcd3741802484bf59c0f7bcf507b918e417
src/dope/inference/detector.py
python
ObjectDetector.find_objects
(vertex2, aff, config, numvertex=8)
return objects, all_peaks
Detects objects given network belief maps and affinities, using heuristic method
Detects objects given network belief maps and affinities, using heuristic method
[ "Detects", "objects", "given", "network", "belief", "maps", "and", "affinities", "using", "heuristic", "method" ]
def find_objects(vertex2, aff, config, numvertex=8): '''Detects objects given network belief maps and affinities, using heuristic method''' all_peaks = [] peak_counter = 0 for j in range(vertex2.size()[0]): belief = vertex2[j].clone() map_ori = belief.cpu().data....
[ "def", "find_objects", "(", "vertex2", ",", "aff", ",", "config", ",", "numvertex", "=", "8", ")", ":", "all_peaks", "=", "[", "]", "peak_counter", "=", "0", "for", "j", "in", "range", "(", "vertex2", ".", "size", "(", ")", "[", "0", "]", ")", ":...
https://github.com/NVlabs/Deep_Object_Pose/blob/c50e5fcd3741802484bf59c0f7bcf507b918e417/src/dope/inference/detector.py#L331-L494
scottlawsonbc/audio-reactive-led-strip
a278cf8a4455b56b1f5d5238929bf8817f9a4e8e
python/led.py
python
_update_blinkstick
()
Writes new LED values to the Blinkstick. This function updates the LED strip with new values.
Writes new LED values to the Blinkstick. This function updates the LED strip with new values.
[ "Writes", "new", "LED", "values", "to", "the", "Blinkstick", ".", "This", "function", "updates", "the", "LED", "strip", "with", "new", "values", "." ]
def _update_blinkstick(): """Writes new LED values to the Blinkstick. This function updates the LED strip with new values. """ global pixels # Truncate values and cast to integer pixels = np.clip(pixels, 0, 255).astype(int) # Optional gamma correction p = _gamma[pixels] if confi...
[ "def", "_update_blinkstick", "(", ")", ":", "global", "pixels", "# Truncate values and cast to integer", "pixels", "=", "np", ".", "clip", "(", "pixels", ",", "0", ",", "255", ")", ".", "astype", "(", "int", ")", "# Optional gamma correction", "p", "=", "_gamm...
https://github.com/scottlawsonbc/audio-reactive-led-strip/blob/a278cf8a4455b56b1f5d5238929bf8817f9a4e8e/python/led.py#L112-L136
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/logging/__init__.py
python
Manager.setLoggerClass
(self, klass)
Set the class to be used when instantiating a logger with this Manager.
Set the class to be used when instantiating a logger with this Manager.
[ "Set", "the", "class", "to", "be", "used", "when", "instantiating", "a", "logger", "with", "this", "Manager", "." ]
def setLoggerClass(self, klass): """ Set the class to be used when instantiating a logger with this Manager. """ if klass != Logger: if not issubclass(klass, Logger): raise TypeError("logger not derived from logging.Logger: " + ...
[ "def", "setLoggerClass", "(", "self", ",", "klass", ")", ":", "if", "klass", "!=", "Logger", ":", "if", "not", "issubclass", "(", "klass", ",", "Logger", ")", ":", "raise", "TypeError", "(", "\"logger not derived from logging.Logger: \"", "+", "klass", ".", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/logging/__init__.py#L1026-L1034
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/audit/dav.py
python
dav.__init__
(self)
[]
def __init__(self): AuditPlugin.__init__(self) # Internal variables self._already_tested_dirs = ScalableBloomFilter()
[ "def", "__init__", "(", "self", ")", ":", "AuditPlugin", ".", "__init__", "(", "self", ")", "# Internal variables", "self", ".", "_already_tested_dirs", "=", "ScalableBloomFilter", "(", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/audit/dav.py#L44-L48
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/module/math/interp_math.py
python
erf
(space, w_x)
return math1(space, rfloat.erf, w_x)
The error function
The error function
[ "The", "error", "function" ]
def erf(space, w_x): """The error function""" return math1(space, rfloat.erf, w_x)
[ "def", "erf", "(", "space", ",", "w_x", ")", ":", "return", "math1", "(", "space", ",", "rfloat", ".", "erf", ",", "w_x", ")" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/math/interp_math.py#L383-L385
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/numpy/polynomial/polynomial.py
python
polyroots
(c)
return r
Compute the roots of a polynomial. Return the roots (a.k.a. "zeros") of the polynomial .. math:: p(x) = \\sum_i c[i] * x^i. Parameters ---------- c : 1-D array_like 1-D array of polynomial coefficients. Returns ------- out : ndarray Array of the roots of the polynomia...
Compute the roots of a polynomial.
[ "Compute", "the", "roots", "of", "a", "polynomial", "." ]
def polyroots(c): """ Compute the roots of a polynomial. Return the roots (a.k.a. "zeros") of the polynomial .. math:: p(x) = \\sum_i c[i] * x^i. Parameters ---------- c : 1-D array_like 1-D array of polynomial coefficients. Returns ------- out : ndarray Array...
[ "def", "polyroots", "(", "c", ")", ":", "# c is a trimmed copy", "[", "c", "]", "=", "pu", ".", "as_series", "(", "[", "c", "]", ")", "if", "len", "(", "c", ")", "<", "2", ":", "return", "np", ".", "array", "(", "[", "]", ",", "dtype", "=", "...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/polynomial/polynomial.py#L1431-L1486
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/zypperpkg.py
python
_find_types
(pkgs)
return sorted({pkg.split(":", 1)[0] for pkg in pkgs if len(pkg.split(":", 1)) == 2})
Form a package names list, find prefixes of packages types.
Form a package names list, find prefixes of packages types.
[ "Form", "a", "package", "names", "list", "find", "prefixes", "of", "packages", "types", "." ]
def _find_types(pkgs): """Form a package names list, find prefixes of packages types.""" return sorted({pkg.split(":", 1)[0] for pkg in pkgs if len(pkg.split(":", 1)) == 2})
[ "def", "_find_types", "(", "pkgs", ")", ":", "return", "sorted", "(", "{", "pkg", ".", "split", "(", "\":\"", ",", "1", ")", "[", "0", "]", "for", "pkg", "in", "pkgs", "if", "len", "(", "pkg", ".", "split", "(", "\":\"", ",", "1", ")", ")", "...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/zypperpkg.py#L1415-L1417
zyfra/ebonite
b01b662c43709d152940f488574d78ff25f89ecf
src/ebonite/ext/s3/artifact.py
python
S3Blob.materialize
(self, path)
[]
def materialize(self, path): logger.debug('Downloading file from %s to %s', self.s3path, path) os.makedirs(os.path.dirname(path), exist_ok=True) self._s3.download_file(self.bucket_name, self.s3path, path)
[ "def", "materialize", "(", "self", ",", "path", ")", ":", "logger", ".", "debug", "(", "'Downloading file from %s to %s'", ",", "self", ".", "s3path", ",", "path", ")", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ",...
https://github.com/zyfra/ebonite/blob/b01b662c43709d152940f488574d78ff25f89ecf/src/ebonite/ext/s3/artifact.py#L68-L71
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/KindleBookstore/PyAl/Request/requests/packages/oauthlib/oauth2/draft25/parameters.py
python
parse_authorization_code_response
(uri, state=None)
return params
Parse authorization grant response URI into a dict. If the resource owner grants the access request, the authorization server issues an authorization code and delivers it to the client by adding the following parameters to the query component of the redirection URI using the "application/x-www-form-url...
Parse authorization grant response URI into a dict.
[ "Parse", "authorization", "grant", "response", "URI", "into", "a", "dict", "." ]
def parse_authorization_code_response(uri, state=None): """Parse authorization grant response URI into a dict. If the resource owner grants the access request, the authorization server issues an authorization code and delivers it to the client by adding the following parameters to the query component o...
[ "def", "parse_authorization_code_response", "(", "uri", ",", "state", "=", "None", ")", ":", "query", "=", "urlparse", ".", "urlparse", "(", "uri", ")", ".", "query", "params", "=", "dict", "(", "urlparse", ".", "parse_qsl", "(", "query", ")", ")", "if",...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/KindleBookstore/PyAl/Request/requests/packages/oauthlib/oauth2/draft25/parameters.py#L95-L136
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
p2pool/util/forest.py
python
DistanceSkipList.apply_delta
(self, (dist1, to_hash1), (from_hash2, dist2, to_hash2), (n,))
return dist1 + dist2, to_hash2
[]
def apply_delta(self, (dist1, to_hash1), (from_hash2, dist2, to_hash2), (n,)): if to_hash1 != from_hash2: raise AssertionError() return dist1 + dist2, to_hash2
[ "def", "apply_delta", "(", "self", ",", "(", "dist1", ",", "to_hash1", ")", ",", "(", "from_hash2", ",", "dist2", ",", "to_hash2", ")", ",", "(", "n", ",", ")", ")", ":", "if", "to_hash1", "!=", "from_hash2", ":", "raise", "AssertionError", "(", ")",...
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/p2pool/util/forest.py#L33-L36
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/contrib/formtools/wizard/views.py
python
WizardView.post
(self, *args, **kwargs)
return self.render(form)
This method handles POST requests. The wizard will render either the current step (if form validation wasn't successful), the next step (if the current step was stored successful) or the done view (if no more steps are available)
This method handles POST requests.
[ "This", "method", "handles", "POST", "requests", "." ]
def post(self, *args, **kwargs): """ This method handles POST requests. The wizard will render either the current step (if form validation wasn't successful), the next step (if the current step was stored successful) or the done view (if no more steps are available) """ ...
[ "def", "post", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Look for a wizard_goto_step element in the posted data which", "# contains a valid step name. If one was found, render the requested", "# form. (This makes stepping back a lot easier).", "wizard_goto_...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/contrib/formtools/wizard/views.py#L247-L294
datacenter/acitoolkit
629b84887dd0f0183b81efc8adb16817f985541a
applications/search/aciSearchDb.py
python
SearchObjectStore.get_by_uids_short
(self, uids)
return result
Will return a dictionary indexed by uid, where each entry is a dictionary holding the class and name of the object refereced by the uid. :param uids: list of UIDs
Will return a dictionary indexed by uid, where each entry is a dictionary holding the class and name of the object refereced by the uid. :param uids: list of UIDs
[ "Will", "return", "a", "dictionary", "indexed", "by", "uid", "where", "each", "entry", "is", "a", "dictionary", "holding", "the", "class", "and", "name", "of", "the", "object", "refereced", "by", "the", "uid", ".", ":", "param", "uids", ":", "list", "of"...
def get_by_uids_short(self, uids): """ Will return a dictionary indexed by uid, where each entry is a dictionary holding the class and name of the object refereced by the uid. :param uids: list of UIDs """ result = {} if not APIC: for uid in uids: ...
[ "def", "get_by_uids_short", "(", "self", ",", "uids", ")", ":", "result", "=", "{", "}", "if", "not", "APIC", ":", "for", "uid", "in", "uids", ":", "atk_obj", "=", "self", ".", "object_directory", "[", "uid", "]", "record", "=", "{", "'class'", ":", ...
https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/applications/search/aciSearchDb.py#L910-L931
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/lib-tk/Tix.py
python
TixWidget.subwidgets_all
(self)
return retlist
Return all subwidgets.
Return all subwidgets.
[ "Return", "all", "subwidgets", "." ]
def subwidgets_all(self): """Return all subwidgets.""" names = self._subwidget_names() if not names: return [] retlist = [] for name in names: name = name[len(self._w)+1:] try: retlist.append(self._nametowidget(name)) ...
[ "def", "subwidgets_all", "(", "self", ")", ":", "names", "=", "self", ".", "_subwidget_names", "(", ")", "if", "not", "names", ":", "return", "[", "]", "retlist", "=", "[", "]", "for", "name", "in", "names", ":", "name", "=", "name", "[", "len", "(...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/Tix.py#L357-L370
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/common/setuptools/_vendor/pyparsing.py
python
oneOf
( strs, caseless=False, useRegex=True )
return MatchFirst(parseElementClass(sym) for sym in symbols).setName(' | '.join(symbols))
Helper to quickly define a set of alternative Literals, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a C{L{MatchFirst}} for best performance. Parameters: - strs - a string of space-delimited literals, or a collection of string literals...
Helper to quickly define a set of alternative Literals, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a C{L{MatchFirst}} for best performance.
[ "Helper", "to", "quickly", "define", "a", "set", "of", "alternative", "Literals", "and", "makes", "sure", "to", "do", "longest", "-", "first", "testing", "when", "there", "is", "a", "conflict", "regardless", "of", "the", "input", "order", "but", "returns", ...
def oneOf( strs, caseless=False, useRegex=True ): """ Helper to quickly define a set of alternative Literals, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a C{L{MatchFirst}} for best performance. Parameters: - strs - a string o...
[ "def", "oneOf", "(", "strs", ",", "caseless", "=", "False", ",", "useRegex", "=", "True", ")", ":", "if", "caseless", ":", "isequal", "=", "(", "lambda", "a", ",", "b", ":", "a", ".", "upper", "(", ")", "==", "b", ".", "upper", "(", ")", ")", ...
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/setuptools/_vendor/pyparsing.py#L4573-L4644
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_env.py
python
Utils.openshift_installed
()
return rpmquery.count() > 0
check if openshift is installed
check if openshift is installed
[ "check", "if", "openshift", "is", "installed" ]
def openshift_installed(): ''' check if openshift is installed ''' import rpm transaction_set = rpm.TransactionSet() rpmquery = transaction_set.dbMatch("name", "atomic-openshift") return rpmquery.count() > 0
[ "def", "openshift_installed", "(", ")", ":", "import", "rpm", "transaction_set", "=", "rpm", ".", "TransactionSet", "(", ")", "rpmquery", "=", "transaction_set", ".", "dbMatch", "(", "\"name\"", ",", "\"atomic-openshift\"", ")", "return", "rpmquery", ".", "count...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_env.py#L1325-L1332
guillermooo/Vintageous
f958207009902052aed5fcac09745f1742648604
ex_main.py
python
ViColonInput.__init__
(self, window)
[]
def __init__(self, window): sublime_plugin.WindowCommand.__init__(self, window)
[ "def", "__init__", "(", "self", ",", "window", ")", ":", "sublime_plugin", ".", "WindowCommand", ".", "__init__", "(", "self", ",", "window", ")" ]
https://github.com/guillermooo/Vintageous/blob/f958207009902052aed5fcac09745f1742648604/ex_main.py#L55-L56
HaoZhang95/Python24
b897224b8a0e6a5734f408df8c24846a98c553bf
00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/treewalkers/base.py
python
TreeWalker.comment
(self, data)
return {"type": "Comment", "data": data}
Generates a Comment token :arg data: the comment :returns: Comment token
Generates a Comment token
[ "Generates", "a", "Comment", "token" ]
def comment(self, data): """Generates a Comment token :arg data: the comment :returns: Comment token """ return {"type": "Comment", "data": data}
[ "def", "comment", "(", "self", ",", "data", ")", ":", "return", "{", "\"type\"", ":", "\"Comment\"", ",", "\"data\"", ":", "data", "}" ]
https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/treewalkers/base.py#L138-L146
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/图片项目/5、迁移学习/VGG迁移学习/查看pb文件的op名.py
python
print_ops_shape
()
[]
def print_ops_shape(): tensor_name_transfer_layer = "pool5:0" graph = tf.Graph() with graph.as_default(): create_graph() with tf.Session() as sess: # ops = sess.graph.get_operations() # for op in ops: # print(op.name) transfer_layer = graph...
[ "def", "print_ops_shape", "(", ")", ":", "tensor_name_transfer_layer", "=", "\"pool5:0\"", "graph", "=", "tf", ".", "Graph", "(", ")", "with", "graph", ".", "as_default", "(", ")", ":", "create_graph", "(", ")", "with", "tf", ".", "Session", "(", ")", "a...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/图片项目/5、迁移学习/VGG迁移学习/查看pb文件的op名.py#L25-L35
google/TensorNetwork
e12580f1749493dbe05f474d2fecdec4eaba73c5
tensornetwork/backends/pytorch/decompositions.py
python
qr
( torch: Any, tensor: Tensor, pivot_axis: int, non_negative_diagonal: bool = False )
return q, r
Computes the QR decomposition of a tensor. The QR decomposition is performed by treating the tensor as a matrix, with an effective left (row) index resulting from combining the axes `tensor.shape[:pivot_axis]` and an effective right (column) index resulting from combining the axes `tensor.shape[pivot_axis:]`. ...
Computes the QR decomposition of a tensor.
[ "Computes", "the", "QR", "decomposition", "of", "a", "tensor", "." ]
def qr( torch: Any, tensor: Tensor, pivot_axis: int, non_negative_diagonal: bool = False ) -> Tuple[Tensor, Tensor]: """Computes the QR decomposition of a tensor. The QR decomposition is performed by treating the tensor as a matrix, with an effective left (row) index resulting from combining the ...
[ "def", "qr", "(", "torch", ":", "Any", ",", "tensor", ":", "Tensor", ",", "pivot_axis", ":", "int", ",", "non_negative_diagonal", ":", "bool", "=", "False", ")", "->", "Tuple", "[", "Tensor", ",", "Tensor", "]", ":", "left_dims", "=", "list", "(", "t...
https://github.com/google/TensorNetwork/blob/e12580f1749493dbe05f474d2fecdec4eaba73c5/tensornetwork/backends/pytorch/decompositions.py#L124-L170
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/idlelib/OutputWindow.py
python
OutputWindow.writelines
(self, lines)
[]
def writelines(self, lines): for line in lines: self.write(line)
[ "def", "writelines", "(", "self", ",", "lines", ")", ":", "for", "line", "in", "lines", ":", "self", ".", "write", "(", "line", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/idlelib/OutputWindow.py#L50-L52
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
tensorflow2/tf2cv/models/seresnet_cifar.py
python
seresnet56_svhn
(classes=10, **kwargs)
return get_seresnet_cifar(classes=classes, blocks=56, bottleneck=False, model_name="seresnet56_svhn", **kwargs)
SE-ResNet-56 model for SVHN from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False Whether to load the pretrained weights for model. root : str, def...
SE-ResNet-56 model for SVHN from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507.
[ "SE", "-", "ResNet", "-", "56", "model", "for", "SVHN", "from", "Squeeze", "-", "and", "-", "Excitation", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1709", ".", "01507", "." ]
def seresnet56_svhn(classes=10, **kwargs): """ SE-ResNet-56 model for SVHN from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False Whether to loa...
[ "def", "seresnet56_svhn", "(", "classes", "=", "10", ",", "*", "*", "kwargs", ")", ":", "return", "get_seresnet_cifar", "(", "classes", "=", "classes", ",", "blocks", "=", "56", ",", "bottleneck", "=", "False", ",", "model_name", "=", "\"seresnet56_svhn\"", ...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow2/tf2cv/models/seresnet_cifar.py#L241-L254
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/imghdr.py
python
test_pbm
(h, f)
PBM (portable bitmap)
PBM (portable bitmap)
[ "PBM", "(", "portable", "bitmap", ")" ]
def test_pbm(h, f): """PBM (portable bitmap)""" if len(h) >= 3 and \ h[0] == ord(b'P') and h[1] in b'14' and h[2] in b' \t\n\r': return 'pbm'
[ "def", "test_pbm", "(", "h", ",", "f", ")", ":", "if", "len", "(", "h", ")", ">=", "3", "and", "h", "[", "0", "]", "==", "ord", "(", "b'P'", ")", "and", "h", "[", "1", "]", "in", "b'14'", "and", "h", "[", "2", "]", "in", "b' \\t\\n\\r'", ...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/imghdr.py#L71-L75
rsalmei/alive-progress
767445917e7cb384981c0dc29b3b3204384353b1
alive_progress/core/progress.py
python
_create_bars
(local_config)
return bar(local_config.length, local_config.unknown)
[]
def _create_bars(local_config): bar = local_config.bar if bar is None: obj = __noop obj.unknown, obj.end = obj, obj return obj return bar(local_config.length, local_config.unknown)
[ "def", "_create_bars", "(", "local_config", ")", ":", "bar", "=", "local_config", ".", "bar", "if", "bar", "is", "None", ":", "obj", "=", "__noop", "obj", ".", "unknown", ",", "obj", ".", "end", "=", "obj", ",", "obj", "return", "obj", "return", "bar...
https://github.com/rsalmei/alive-progress/blob/767445917e7cb384981c0dc29b3b3204384353b1/alive_progress/core/progress.py#L277-L283
pysmt/pysmt
ade4dc2a825727615033a96d31c71e9f53ce4764
pysmt/parsing.py
python
InfixOrUnaryOpAdapter.__init__
(self, b_operator, u_operator, b_lbp, u_lbp)
[]
def __init__(self, b_operator, u_operator, b_lbp, u_lbp): GrammarSymbol.__init__(self) self.b_operator = b_operator self.u_operator = u_operator self.lbp = b_lbp self.u_lbp = u_lbp
[ "def", "__init__", "(", "self", ",", "b_operator", ",", "u_operator", ",", "b_lbp", ",", "u_lbp", ")", ":", "GrammarSymbol", ".", "__init__", "(", "self", ")", "self", ".", "b_operator", "=", "b_operator", "self", ".", "u_operator", "=", "u_operator", "sel...
https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/parsing.py#L558-L563
thu-coai/CrossWOZ
265e97379b34221f5949beb46f3eec0e2dc943c4
convlab2/util/allennlp_file_utils.py
python
read_set_from_file
(filename: str)
return collection
Extract a de-duped collection (set) of text from a file. Expected file format is one item per line.
Extract a de-duped collection (set) of text from a file. Expected file format is one item per line.
[ "Extract", "a", "de", "-", "duped", "collection", "(", "set", ")", "of", "text", "from", "a", "file", ".", "Expected", "file", "format", "is", "one", "item", "per", "line", "." ]
def read_set_from_file(filename: str) -> Set[str]: """ Extract a de-duped collection (set) of text from a file. Expected file format is one item per line. """ collection = set() with open(filename, 'r') as file_: for line in file_: collection.add(line.rstrip()) return col...
[ "def", "read_set_from_file", "(", "filename", ":", "str", ")", "->", "Set", "[", "str", "]", ":", "collection", "=", "set", "(", ")", "with", "open", "(", "filename", ",", "'r'", ")", "as", "file_", ":", "for", "line", "in", "file_", ":", "collection...
https://github.com/thu-coai/CrossWOZ/blob/265e97379b34221f5949beb46f3eec0e2dc943c4/convlab2/util/allennlp_file_utils.py#L312-L321
pyglet/pyglet
2833c1df902ca81aeeffa786c12e7e87d402434b
pyglet/com.py
python
COMObject.pointers
(self)
return self._pointers
Returns pointers to the implemented interfaces in this COMObject. Read-only. :type: dict
Returns pointers to the implemented interfaces in this COMObject. Read-only.
[ "Returns", "pointers", "to", "the", "implemented", "interfaces", "in", "this", "COMObject", ".", "Read", "-", "only", "." ]
def pointers(self): """Returns pointers to the implemented interfaces in this COMObject. Read-only. :type: dict """ return self._pointers
[ "def", "pointers", "(", "self", ")", ":", "return", "self", ".", "_pointers" ]
https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/com.py#L350-L355
guoqiangqi/PFLD
d2696963bb023c11cd5e8a8ee38a66085e26537f
mtcnn/detect_face.py
python
Network.prelu
(self, inp, name)
return output
[]
def prelu(self, inp, name): with tf.variable_scope(name): i = int(inp.get_shape()[-1]) alpha = self.make_var('alpha', shape=(i,)) output = tf.nn.relu(inp) + tf.multiply(alpha, -tf.nn.relu(-inp)) return output
[ "def", "prelu", "(", "self", ",", "inp", ",", "name", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ")", ":", "i", "=", "int", "(", "inp", ".", "get_shape", "(", ")", "[", "-", "1", "]", ")", "alpha", "=", "self", ".", "make_var",...
https://github.com/guoqiangqi/PFLD/blob/d2696963bb023c11cd5e8a8ee38a66085e26537f/mtcnn/detect_face.py#L141-L146
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
third_party/dnspython/dns/rdtypes/nsbase.py
python
NSBase.to_text
(self, origin=None, relativize=True, **kw)
return str(target)
[]
def to_text(self, origin=None, relativize=True, **kw): target = self.target.choose_relativity(origin, relativize) return str(target)
[ "def", "to_text", "(", "self", ",", "origin", "=", "None", ",", "relativize", "=", "True", ",", "*", "*", "kw", ")", ":", "target", "=", "self", ".", "target", ".", "choose_relativity", "(", "origin", ",", "relativize", ")", "return", "str", "(", "ta...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/rdtypes/nsbase.py#L36-L38
openstack/heat
ea6633c35b04bb49c4a2858edc9df0a82d039478
heat/engine/timestamp.py
python
Timestamp.__init__
(self, db_fetch, attribute)
Initialise the timestamp descriptor. Initialise with a function to fetch the database representation of an object (given a context and ID) and the name of the attribute to retrieve.
Initialise the timestamp descriptor.
[ "Initialise", "the", "timestamp", "descriptor", "." ]
def __init__(self, db_fetch, attribute): """Initialise the timestamp descriptor. Initialise with a function to fetch the database representation of an object (given a context and ID) and the name of the attribute to retrieve. """ self.db_fetch = db_fetch self.att...
[ "def", "__init__", "(", "self", ",", "db_fetch", ",", "attribute", ")", ":", "self", ".", "db_fetch", "=", "db_fetch", "self", ".", "attribute", "=", "attribute" ]
https://github.com/openstack/heat/blob/ea6633c35b04bb49c4a2858edc9df0a82d039478/heat/engine/timestamp.py#L20-L28
flyyufelix/DenseNet-Keras
8c42d8092b2616a9fbf025c756b14c67be708685
densenet121.py
python
transition_block
(x, stage, nb_filter, compression=1.0, dropout_rate=None, weight_decay=1E-4)
return x
Apply BatchNorm, 1x1 Convolution, averagePooling, optional compression, dropout # Arguments x: input tensor stage: index for dense block nb_filter: number of filters compression: calculated as 1 - reduction. Reduces the number of feature maps in the transition bl...
Apply BatchNorm, 1x1 Convolution, averagePooling, optional compression, dropout # Arguments x: input tensor stage: index for dense block nb_filter: number of filters compression: calculated as 1 - reduction. Reduces the number of feature maps in the transition bl...
[ "Apply", "BatchNorm", "1x1", "Convolution", "averagePooling", "optional", "compression", "dropout", "#", "Arguments", "x", ":", "input", "tensor", "stage", ":", "index", "for", "dense", "block", "nb_filter", ":", "number", "of", "filters", "compression", ":", "c...
def transition_block(x, stage, nb_filter, compression=1.0, dropout_rate=None, weight_decay=1E-4): ''' Apply BatchNorm, 1x1 Convolution, averagePooling, optional compression, dropout # Arguments x: input tensor stage: index for dense block nb_filter: number of filters ...
[ "def", "transition_block", "(", "x", ",", "stage", ",", "nb_filter", ",", "compression", "=", "1.0", ",", "dropout_rate", "=", "None", ",", "weight_decay", "=", "1E-4", ")", ":", "eps", "=", "1.1e-5", "conv_name_base", "=", "'conv'", "+", "str", "(", "st...
https://github.com/flyyufelix/DenseNet-Keras/blob/8c42d8092b2616a9fbf025c756b14c67be708685/densenet121.py#L117-L143
intrig-unicamp/mininet-wifi
3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba
mn_wifi/sixLoWPAN/node.py
python
OVSSensor.setup
(cls)
Make sure Open vSwitch is installed and working
Make sure Open vSwitch is installed and working
[ "Make", "sure", "Open", "vSwitch", "is", "installed", "and", "working" ]
def setup(cls): "Make sure Open vSwitch is installed and working" pathCheck('ovs-vsctl', moduleName='Open vSwitch (openvswitch.org)') # This should no longer be needed, and it breaks # with OVS 1.7 which has renamed the kernel module: # moduleDeps( subtract=OF_...
[ "def", "setup", "(", "cls", ")", ":", "pathCheck", "(", "'ovs-vsctl'", ",", "moduleName", "=", "'Open vSwitch (openvswitch.org)'", ")", "# This should no longer be needed, and it breaks", "# with OVS 1.7 which has renamed the kernel module:", "# moduleDeps( subtract=OF_KMOD, add=OVS...
https://github.com/intrig-unicamp/mininet-wifi/blob/3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba/mn_wifi/sixLoWPAN/node.py#L278-L297
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/_vendor/colorama/ansi.py
python
code_to_chars
(code)
return CSI + str(code) + 'm'
[]
def code_to_chars(code): return CSI + str(code) + 'm'
[ "def", "code_to_chars", "(", "code", ")", ":", "return", "CSI", "+", "str", "(", "code", ")", "+", "'m'" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/colorama/ansi.py#L12-L13
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
python
HTMPredictionModelClassifierHelper._recomputeRecordFromKNN
(self, record)
return None
return the classified labeling of record
return the classified labeling of record
[ "return", "the", "classified", "labeling", "of", "record" ]
def _recomputeRecordFromKNN(self, record): """ return the classified labeling of record """ inputs = { "categoryIn": [None], "bottomUpIn": self._getStateAnomalyVector(record), } outputs = {"categoriesOut": numpy.zeros((1,)), "bestPrototypeIndices":numpy.zeros((1,)), ...
[ "def", "_recomputeRecordFromKNN", "(", "self", ",", "record", ")", ":", "inputs", "=", "{", "\"categoryIn\"", ":", "[", "None", "]", ",", "\"bottomUpIn\"", ":", "self", ".", "_getStateAnomalyVector", "(", "record", ")", ",", "}", "outputs", "=", "{", "\"ca...
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L394-L435
SickChill/SickChill
01020f3636d01535f60b83464d8127ea0efabfc7
sickchill/adba/__init__.py
python
Connection.producer
(self, pid=None, pname=None, callback=None)
return self.handle(ProducerCommand(pid, pname), callback)
Get information about a producer parameters: pid - producer id pname - name of the producer structure of parameters: (pid|pname)
Get information about a producer
[ "Get", "information", "about", "a", "producer" ]
def producer(self, pid=None, pname=None, callback=None): """ Get information about a producer parameters: pid - producer id pname - name of the producer structure of parameters: (pid|pname) """ return self.handle(ProducerCommand(pid, pnam...
[ "def", "producer", "(", "self", ",", "pid", "=", "None", ",", "pname", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "handle", "(", "ProducerCommand", "(", "pid", ",", "pname", ")", ",", "callback", ")" ]
https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/adba/__init__.py#L612-L625
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/feaLib/ast.py
python
LanguageSystemStatement.build
(self, builder)
Calls the builder object's ``add_language_system`` callback.
Calls the builder object's ``add_language_system`` callback.
[ "Calls", "the", "builder", "object", "s", "add_language_system", "callback", "." ]
def build(self, builder): """Calls the builder object's ``add_language_system`` callback.""" builder.add_language_system(self.location, self.script, self.language)
[ "def", "build", "(", "self", ",", "builder", ")", ":", "builder", ".", "add_language_system", "(", "self", ".", "location", ",", "self", ".", "script", ",", "self", ".", "language", ")" ]
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/feaLib/ast.py#L982-L984
libtcod/python-tcod
e12c4172baa9efdfd74aff6ee9bab8454a835248
tcod/libtcodpy.py
python
heightmap_add_voronoi
( hm: NDArray[np.float32], nbPoints: Any, nbCoef: int, coef: Sequence[float], rnd: Optional[tcod.random.Random] = None, )
Add values from a Voronoi diagram to the heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. nbPoints (Any): Number of Voronoi sites. nbCoef (int): The diagram value is calculated from the nbCoef closest sites. coef (Sequence...
Add values from a Voronoi diagram to the heightmap.
[ "Add", "values", "from", "a", "Voronoi", "diagram", "to", "the", "heightmap", "." ]
def heightmap_add_voronoi( hm: NDArray[np.float32], nbPoints: Any, nbCoef: int, coef: Sequence[float], rnd: Optional[tcod.random.Random] = None, ) -> None: """Add values from a Voronoi diagram to the heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functi...
[ "def", "heightmap_add_voronoi", "(", "hm", ":", "NDArray", "[", "np", ".", "float32", "]", ",", "nbPoints", ":", "Any", ",", "nbCoef", ":", "int", ",", "coef", ":", "Sequence", "[", "float", "]", ",", "rnd", ":", "Optional", "[", "tcod", ".", "random...
https://github.com/libtcod/python-tcod/blob/e12c4172baa9efdfd74aff6ee9bab8454a835248/tcod/libtcodpy.py#L2636-L2664
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/mechanize/mechanize/_mechanize.py
python
Browser.set_handle_referer
(self, handle)
Set whether to add Referer header to each request.
Set whether to add Referer header to each request.
[ "Set", "whether", "to", "add", "Referer", "header", "to", "each", "request", "." ]
def set_handle_referer(self, handle): """Set whether to add Referer header to each request.""" self._set_handler("_referer", handle) self._handle_referer = bool(handle)
[ "def", "set_handle_referer", "(", "self", ",", "handle", ")", ":", "self", ".", "_set_handler", "(", "\"_referer\"", ",", "handle", ")", "self", ".", "_handle_referer", "=", "bool", "(", "handle", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/mechanize/mechanize/_mechanize.py#L160-L163
abisee/pointer-generator
b29e986f24fdd01a6b6d6008187c5c887f0be282
model.py
python
SummarizationModel._reduce_states
(self, fw_st, bw_st)
Add to the graph a linear layer to reduce the encoder's final FW and BW state into a single initial state for the decoder. This is needed because the encoder is bidirectional but the decoder is not. Args: fw_st: LSTMStateTuple with hidden_dim units. bw_st: LSTMStateTuple with hidden_dim units. Ret...
Add to the graph a linear layer to reduce the encoder's final FW and BW state into a single initial state for the decoder. This is needed because the encoder is bidirectional but the decoder is not.
[ "Add", "to", "the", "graph", "a", "linear", "layer", "to", "reduce", "the", "encoder", "s", "final", "FW", "and", "BW", "state", "into", "a", "single", "initial", "state", "for", "the", "decoder", ".", "This", "is", "needed", "because", "the", "encoder",...
def _reduce_states(self, fw_st, bw_st): """Add to the graph a linear layer to reduce the encoder's final FW and BW state into a single initial state for the decoder. This is needed because the encoder is bidirectional but the decoder is not. Args: fw_st: LSTMStateTuple with hidden_dim units. bw_st:...
[ "def", "_reduce_states", "(", "self", ",", "fw_st", ",", "bw_st", ")", ":", "hidden_dim", "=", "self", ".", "_hps", ".", "hidden_dim", "with", "tf", ".", "variable_scope", "(", "'reduce_final_st'", ")", ":", "# Define weights and biases to reduce the cell and reduce...
https://github.com/abisee/pointer-generator/blob/b29e986f24fdd01a6b6d6008187c5c887f0be282/model.py#L97-L121
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/contrib/gis/gdal/geometries.py
python
OGRGeometry.union
(self, other)
return self._geomgen(capi.geom_union, other)
Returns a new geometry consisting of the region which is the union of this geometry and the other.
Returns a new geometry consisting of the region which is the union of this geometry and the other.
[ "Returns", "a", "new", "geometry", "consisting", "of", "the", "region", "which", "is", "the", "union", "of", "this", "geometry", "and", "the", "other", "." ]
def union(self, other): """ Returns a new geometry consisting of the region which is the union of this geometry and the other. """ return self._geomgen(capi.geom_union, other)
[ "def", "union", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_union", ",", "other", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/gdal/geometries.py#L487-L492
abe-winter/automigrate
ebad8c503028bc36e6f0b07c4c9cfa350d278685
automig/lib/githelp.py
python
get_paths
(tree, pattern, root=())
return found
given tree (a git tree at a desired ref) return list of paths matching pattern note: this matches paths that existed at the time of ref, including files that don't exist now and excluding ones that exist on disk but were missing at ref
given tree (a git tree at a desired ref) return list of paths matching pattern note: this matches paths that existed at the time of ref, including files that don't exist now and excluding ones that exist on disk but were missing at ref
[ "given", "tree", "(", "a", "git", "tree", "at", "a", "desired", "ref", ")", "return", "list", "of", "paths", "matching", "pattern", "note", ":", "this", "matches", "paths", "that", "existed", "at", "the", "time", "of", "ref", "including", "files", "that"...
def get_paths(tree, pattern, root=()): """given tree (a git tree at a desired ref) return list of paths matching pattern note: this matches paths that existed at the time of ref, including files that don't exist now and excluding ones that exist on disk but were missing at ref """ found = [] for item in tree:...
[ "def", "get_paths", "(", "tree", ",", "pattern", ",", "root", "=", "(", ")", ")", ":", "found", "=", "[", "]", "for", "item", "in", "tree", ":", "if", "isinstance", "(", "item", ",", "git", ".", "Blob", ")", ":", "if", "fnmatch", ".", "fnmatch", ...
https://github.com/abe-winter/automigrate/blob/ebad8c503028bc36e6f0b07c4c9cfa350d278685/automig/lib/githelp.py#L15-L28
aws/aws-cli
d697e0ed79fca0f853ce53efe1f83ee41a478134
awscli/customizations/s3uploader.py
python
S3Uploader.upload
(self, file_name, remote_path)
Uploads given file to S3 :param file_name: Path to the file that will be uploaded :param remote_path: be uploaded :return: VersionId of the latest upload
Uploads given file to S3 :param file_name: Path to the file that will be uploaded :param remote_path: be uploaded :return: VersionId of the latest upload
[ "Uploads", "given", "file", "to", "S3", ":", "param", "file_name", ":", "Path", "to", "the", "file", "that", "will", "be", "uploaded", ":", "param", "remote_path", ":", "be", "uploaded", ":", "return", ":", "VersionId", "of", "the", "latest", "upload" ]
def upload(self, file_name, remote_path): """ Uploads given file to S3 :param file_name: Path to the file that will be uploaded :param remote_path: be uploaded :return: VersionId of the latest upload """ if self.prefix and len(self.prefix) > 0: remot...
[ "def", "upload", "(", "self", ",", "file_name", ",", "remote_path", ")", ":", "if", "self", ".", "prefix", "and", "len", "(", "self", ".", "prefix", ")", ">", "0", ":", "remote_path", "=", "\"{0}/{1}\"", ".", "format", "(", "self", ".", "prefix", ","...
https://github.com/aws/aws-cli/blob/d697e0ed79fca0f853ce53efe1f83ee41a478134/awscli/customizations/s3uploader.py#L80-L127
open-mmlab/mmediting
6a08a728c63e76f0427eeebcd2db236839bbd11d
tools/data/matting/comp1k/preprocess_comp1k_dataset.py
python
fix_png_file
(filename, folder)
Fix png files in the target filename using pngfix. pngfix is a tool to fix PNG files. It's installed on Linux or MacOS by default. Args: filename (str): png file to run pngfix.
Fix png files in the target filename using pngfix.
[ "Fix", "png", "files", "in", "the", "target", "filename", "using", "pngfix", "." ]
def fix_png_file(filename, folder): """Fix png files in the target filename using pngfix. pngfix is a tool to fix PNG files. It's installed on Linux or MacOS by default. Args: filename (str): png file to run pngfix. """ subprocess.call( f'pngfix --quiet --strip=color --prefix=f...
[ "def", "fix_png_file", "(", "filename", ",", "folder", ")", ":", "subprocess", ".", "call", "(", "f'pngfix --quiet --strip=color --prefix=fixed_ \"{filename}\"'", ",", "cwd", "=", "f'{folder}'", ",", "shell", "=", "True", ")", "subprocess", ".", "call", "(", "f'mv...
https://github.com/open-mmlab/mmediting/blob/6a08a728c63e76f0427eeebcd2db236839bbd11d/tools/data/matting/comp1k/preprocess_comp1k_dataset.py#L32-L46
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/sndhdr.py
python
test_aifc
(h, f)
return (fmt, a.getframerate(), a.getnchannels(), a.getnframes(), 8 * a.getsampwidth())
[]
def test_aifc(h, f): import aifc if not h.startswith(b'FORM'): return None if h[8:12] == b'AIFC': fmt = 'aifc' elif h[8:12] == b'AIFF': fmt = 'aiff' else: return None f.seek(0) try: a = aifc.open(f, 'r') except (EOFError, aifc.Error): retur...
[ "def", "test_aifc", "(", "h", ",", "f", ")", ":", "import", "aifc", "if", "not", "h", ".", "startswith", "(", "b'FORM'", ")", ":", "return", "None", "if", "h", "[", "8", ":", "12", "]", "==", "b'AIFC'", ":", "fmt", "=", "'aifc'", "elif", "h", "...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/sndhdr.py#L75-L91
ThibaultGROUEIX/AtlasNet
22a0504b00e7a36d6bb00328f7df4952d36ccc80
auxiliary/meter.py
python
Logs.reset
(self)
Reset all meters :return:
Reset all meters :return:
[ "Reset", "all", "meters", ":", "return", ":" ]
def reset(self): """ Reset all meters :return: """ for name in self.curves_names: self.meters[name].reset()
[ "def", "reset", "(", "self", ")", ":", "for", "name", "in", "self", ".", "curves_names", ":", "self", ".", "meters", "[", "name", "]", ".", "reset", "(", ")" ]
https://github.com/ThibaultGROUEIX/AtlasNet/blob/22a0504b00e7a36d6bb00328f7df4952d36ccc80/auxiliary/meter.py#L52-L58
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/features/enterprise_support/api.py
python
get_enterprise_consent_url
(request, course_id, user=None, return_to=None, enrollment_exists=False)
return full_url
Build a URL to redirect the user to the Enterprise app to provide data sharing consent for a specific course ID. Arguments: * request: Request object * course_id: Course key/identifier string. * user: user to check for consent. If None, uses request.user * return_to: url name label for the page...
Build a URL to redirect the user to the Enterprise app to provide data sharing consent for a specific course ID.
[ "Build", "a", "URL", "to", "redirect", "the", "user", "to", "the", "Enterprise", "app", "to", "provide", "data", "sharing", "consent", "for", "a", "specific", "course", "ID", "." ]
def get_enterprise_consent_url(request, course_id, user=None, return_to=None, enrollment_exists=False): """ Build a URL to redirect the user to the Enterprise app to provide data sharing consent for a specific course ID. Arguments: * request: Request object * course_id: Course key/identifier st...
[ "def", "get_enterprise_consent_url", "(", "request", ",", "course_id", ",", "user", "=", "None", ",", "return_to", "=", "None", ",", "enrollment_exists", "=", "False", ")", ":", "user", "=", "user", "or", "request", ".", "user", "LOGGER", ".", "info", "(",...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/features/enterprise_support/api.py#L720-L764
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/future/backports/datetime.py
python
tzinfo.dst
(self, dt)
datetime -> DST offset in minutes east of UTC. Return 0 if DST not in effect. utcoffset() must include the DST offset.
datetime -> DST offset in minutes east of UTC.
[ "datetime", "-", ">", "DST", "offset", "in", "minutes", "east", "of", "UTC", "." ]
def dst(self, dt): """datetime -> DST offset in minutes east of UTC. Return 0 if DST not in effect. utcoffset() must include the DST offset. """ raise NotImplementedError("tzinfo subclass must override dst()")
[ "def", "dst", "(", "self", ",", "dt", ")", ":", "raise", "NotImplementedError", "(", "\"tzinfo subclass must override dst()\"", ")" ]
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/future/backports/datetime.py#L933-L939
adamcharnock/lightbus
5e7069da06cd37a8131e8c592ee957ccb73603d5
lightbus_experiments/structured_logging.py
python
event_dict_ordering
(logger, method_name, event_dict)
return ordered
[]
def event_dict_ordering(logger, method_name, event_dict): ordered = {"event": event_dict.pop("event")} ordered.update(**event_dict) return ordered
[ "def", "event_dict_ordering", "(", "logger", ",", "method_name", ",", "event_dict", ")", ":", "ordered", "=", "{", "\"event\"", ":", "event_dict", ".", "pop", "(", "\"event\"", ")", "}", "ordered", ".", "update", "(", "*", "*", "event_dict", ")", "return",...
https://github.com/adamcharnock/lightbus/blob/5e7069da06cd37a8131e8c592ee957ccb73603d5/lightbus_experiments/structured_logging.py#L9-L12
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/PhishTank/Integrations/PhishTankV2/PhishTankV2.py
python
reload
(client: Client)
return parsed_response
This function is responsible for: 1. request a csv file from PhishTank API (calling to client.get_http_request) 2. parsing an API response and saving all relevant information into a dictionary Args: client: (Client) : client to use in the PhisTankV2 integration. Returns: dict...
This function is responsible for: 1. request a csv file from PhishTank API (calling to client.get_http_request) 2. parsing an API response and saving all relevant information into a dictionary
[ "This", "function", "is", "responsible", "for", ":", "1", ".", "request", "a", "csv", "file", "from", "PhishTank", "API", "(", "calling", "to", "client", ".", "get_http_request", ")", "2", ".", "parsing", "an", "API", "response", "and", "saving", "all", ...
def reload(client: Client) -> dict: """ This function is responsible for: 1. request a csv file from PhishTank API (calling to client.get_http_request) 2. parsing an API response and saving all relevant information into a dictionary Args: client: (Client) : client to use in the Ph...
[ "def", "reload", "(", "client", ":", "Client", ")", "->", "dict", ":", "response", "=", "client", ".", "get_http_request", "(", "RELOAD_DATA_URL_SUFFIX", ")", "response_is_empty", "=", "not", "response", "if", "response_is_empty", ":", "return", "dict", "(", "...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/PhishTank/Integrations/PhishTankV2/PhishTankV2.py#L224-L261
Cadene/bootstrap.pytorch
e7d55b52fe8d819de7ea3da8b1027d4a3dcc9e0c
bootstrap/lib/options.py
python
Options.__new__
(cls, source=None, arguments_callback=None, lock=False, run_parser=True)
return Options.__instance
[]
def __new__(cls, source=None, arguments_callback=None, lock=False, run_parser=True): # Options is a singleton, we will only build if it has not been built before if not Options.__instance: Options.__instance = object.__new__(Options) if source: cls.source = sourc...
[ "def", "__new__", "(", "cls", ",", "source", "=", "None", ",", "arguments_callback", "=", "None", ",", "lock", "=", "False", ",", "run_parser", "=", "True", ")", ":", "# Options is a singleton, we will only build if it has not been built before", "if", "not", "Optio...
https://github.com/Cadene/bootstrap.pytorch/blob/e7d55b52fe8d819de7ea3da8b1027d4a3dcc9e0c/bootstrap/lib/options.py#L164-L206
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idc.py
python
MakeFrame
(ea, lvsize, frregs, argsize)
return func.frame
Make function frame @param ea: any address belonging to the function @param lvsize: size of function local variables @param frregs: size of saved registers @param argsize: size of function arguments @return: ID of function frame or -1 If the function did not have a frame, the frame ...
Make function frame
[ "Make", "function", "frame" ]
def MakeFrame(ea, lvsize, frregs, argsize): """ Make function frame @param ea: any address belonging to the function @param lvsize: size of function local variables @param frregs: size of saved registers @param argsize: size of function arguments @return: ID of function frame or -1 ...
[ "def", "MakeFrame", "(", "ea", ",", "lvsize", ",", "frregs", ",", "argsize", ")", ":", "func", "=", "idaapi", ".", "get_func", "(", "ea", ")", "if", "func", "is", "None", ":", "return", "-", "1", "frameid", "=", "idaapi", ".", "add_frame", "(", "fu...
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idc.py#L4397-L4420
mlcommons/training
4a4d5a0b7efe99c680306b1940749211d4238a84
translation/tensorflow/bert/run_classifier.py
python
input_fn_builder
(features, seq_length, is_training, drop_remainder)
return input_fn
Creates an `input_fn` closure to be passed to TPUEstimator.
Creates an `input_fn` closure to be passed to TPUEstimator.
[ "Creates", "an", "input_fn", "closure", "to", "be", "passed", "to", "TPUEstimator", "." ]
def input_fn_builder(features, seq_length, is_training, drop_remainder): """Creates an `input_fn` closure to be passed to TPUEstimator.""" all_input_ids = [] all_input_mask = [] all_segment_ids = [] all_label_ids = [] for feature in features: all_input_ids.append(feature.input_ids) all_input_mask....
[ "def", "input_fn_builder", "(", "features", ",", "seq_length", ",", "is_training", ",", "drop_remainder", ")", ":", "all_input_ids", "=", "[", "]", "all_input_mask", "=", "[", "]", "all_segment_ids", "=", "[", "]", "all_label_ids", "=", "[", "]", "for", "fea...
https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/translation/tensorflow/bert/run_classifier.py#L713-L762
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/scmtools/forms.py
python
RepositoryForm._populate_hosting_service_fields
(self)
Populates all the main hosting service fields in the form. This populates the hosting service type and the repository plan on the form. These are only set if operating on an existing repository.
Populates all the main hosting service fields in the form.
[ "Populates", "all", "the", "main", "hosting", "service", "fields", "in", "the", "form", "." ]
def _populate_hosting_service_fields(self): """Populates all the main hosting service fields in the form. This populates the hosting service type and the repository plan on the form. These are only set if operating on an existing repository. """ # NOTE: This method *cann...
[ "def", "_populate_hosting_service_fields", "(", "self", ")", ":", "# NOTE: This method *cannot* access anything in the loaded forms or", "# hosting_service_info attributes.", "hosting_account", "=", "self", ".", "instance", ".", "hosting_account", "if", "hosting_account", ":"...
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/scmtools/forms.py#L1395-L1421
livid/v2ex-gae
32be3a77d535e7c9df85a333e01ab8834d0e8581
twitter/twitter.py
python
User.AsDict
(self)
return data
A dict representation of this twitter.User instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.User instance
A dict representation of this twitter.User instance.
[ "A", "dict", "representation", "of", "this", "twitter", ".", "User", "instance", "." ]
def AsDict(self): '''A dict representation of this twitter.User instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.User instance ''' data = {} if self.id: data['id'] = self.id if self.name: data['name'] ...
[ "def", "AsDict", "(", "self", ")", ":", "data", "=", "{", "}", "if", "self", ".", "id", ":", "data", "[", "'id'", "]", "=", "self", ".", "id", "if", "self", ".", "name", ":", "data", "[", "'name'", "]", "=", "self", ".", "name", "if", "self",...
https://github.com/livid/v2ex-gae/blob/32be3a77d535e7c9df85a333e01ab8834d0e8581/twitter/twitter.py#L877-L926
isce-framework/isce2
0e5114a8bede3caf1d533d98e44dfe4b983e3f48
contrib/geo_autoRIFT/autoRIFT/autoRIFT.py
python
autoRIFT.preprocess_filt_wal
(self)
Do the pre processing using wallis filter (10 min vs 15 min in Matlab).
Do the pre processing using wallis filter (10 min vs 15 min in Matlab).
[ "Do", "the", "pre", "processing", "using", "wallis", "filter", "(", "10", "min", "vs", "15", "min", "in", "Matlab", ")", "." ]
def preprocess_filt_wal(self): ''' Do the pre processing using wallis filter (10 min vs 15 min in Matlab). ''' import cv2 import numpy as np # import scipy.io as sio self.zeroMask = (self.I1 == 0) kernel = np.ones((self.WallisFilt...
[ "def", "preprocess_filt_wal", "(", "self", ")", ":", "import", "cv2", "import", "numpy", "as", "np", "# import scipy.io as sio", "self", ".", "zeroMask", "=", "(", "self", ".", "I1", "==", "0", ")", "kernel", "=", "np", ".", "ones", "(", "(", "sel...
https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/contrib/geo_autoRIFT/autoRIFT/autoRIFT.py#L50-L83
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/imaplib.py
python
IMAP4.recent
(self)
return self._untagged_response(typ, dat, name)
Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command. (typ, [data]) = <instance>.recent() 'data' is None if no new messages, else list of RECENT responses, most recent last.
Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command.
[ "Return", "most", "recent", "RECENT", "responses", "if", "any", "exist", "else", "prompt", "server", "for", "an", "update", "using", "the", "NOOP", "command", "." ]
def recent(self): """Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command. (typ, [data]) = <instance>.recent() 'data' is None if no new messages, else list of RECENT responses, most recent last. """ name =...
[ "def", "recent", "(", "self", ")", ":", "name", "=", "'RECENT'", "typ", ",", "dat", "=", "self", ".", "_untagged_response", "(", "'OK'", ",", "[", "None", "]", ",", "name", ")", "if", "dat", "[", "-", "1", "]", ":", "return", "typ", ",", "dat", ...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/imaplib.py#L286-L300
freelawproject/courtlistener
ab3ae7bb6e5e836b286749113e7dbb403d470912
cl/search/models.py
python
sort_cites
(c)
Sort a list or QuerySet of citations according to BlueBook ordering. This is intended as a parameter to the 'key' argument of a sorting method like `sort` or `sorted`. It intends to take a single citation and give it a numeric score as to where it should occur in a list of other citations. For example...
Sort a list or QuerySet of citations according to BlueBook ordering.
[ "Sort", "a", "list", "or", "QuerySet", "of", "citations", "according", "to", "BlueBook", "ordering", "." ]
def sort_cites(c): """Sort a list or QuerySet of citations according to BlueBook ordering. This is intended as a parameter to the 'key' argument of a sorting method like `sort` or `sorted`. It intends to take a single citation and give it a numeric score as to where it should occur in a list of other c...
[ "def", "sort_cites", "(", "c", ")", ":", "if", "c", ".", "type", "==", "Citation", ".", "NEUTRAL", ":", "return", "0", "if", "c", ".", "type", "==", "Citation", ".", "FEDERAL", ":", "if", "c", ".", "reporter", "==", "\"U.S.\"", ":", "return", "1.1"...
https://github.com/freelawproject/courtlistener/blob/ab3ae7bb6e5e836b286749113e7dbb403d470912/cl/search/models.py#L2492-L2533
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/graph/gvrelgraph.py
python
RelGraphReport.add_child_links_to_families
(self, person_handles)
returns string of Graphviz edges linking parents to families or children
returns string of Graphviz edges linking parents to families or children
[ "returns", "string", "of", "Graphviz", "edges", "linking", "parents", "to", "families", "or", "children" ]
def add_child_links_to_families(self, person_handles): """ returns string of Graphviz edges linking parents to families or children """ for person_handle in person_handles: if self._user: self._user.step_progress() person = self._db.get_per...
[ "def", "add_child_links_to_families", "(", "self", ",", "person_handles", ")", ":", "for", "person_handle", "in", "person_handles", ":", "if", "self", ".", "_user", ":", "self", ".", "_user", ".", "step_progress", "(", ")", "person", "=", "self", ".", "_db",...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/graph/gvrelgraph.py#L284-L316
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
Tools/PyTorch/TimeSeriesPredictionPlatform/data/script_download_data.py
python
download_from_url
(url, output_path)
Downloads a file froma url.
Downloads a file froma url.
[ "Downloads", "a", "file", "froma", "url", "." ]
def download_from_url(url, output_path): """Downloads a file froma url.""" print("Pulling data from {} to {}".format(url, output_path)) wget.download(url, output_path) print("done")
[ "def", "download_from_url", "(", "url", ",", "output_path", ")", ":", "print", "(", "\"Pulling data from {} to {}\"", ".", "format", "(", "url", ",", "output_path", ")", ")", "wget", ".", "download", "(", "url", ",", "output_path", ")", "print", "(", "\"done...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/Tools/PyTorch/TimeSeriesPredictionPlatform/data/script_download_data.py#L65-L70
dagster-io/dagster
b27d569d5fcf1072543533a0c763815d96f90b8f
python_modules/libraries/dagster-gcp/dagster_gcp/bigquery/ops.py
python
bq_solid_for_queries
(sql_queries)
return _bq_core_command(solid, "solid", sql_queries)
Executes BigQuery SQL queries. Expects a BQ client to be provisioned in resources as context.resources.bigquery.
Executes BigQuery SQL queries.
[ "Executes", "BigQuery", "SQL", "queries", "." ]
def bq_solid_for_queries(sql_queries): """ Executes BigQuery SQL queries. Expects a BQ client to be provisioned in resources as context.resources.bigquery. """ return _bq_core_command(solid, "solid", sql_queries)
[ "def", "bq_solid_for_queries", "(", "sql_queries", ")", ":", "return", "_bq_core_command", "(", "solid", ",", "\"solid\"", ",", "sql_queries", ")" ]
https://github.com/dagster-io/dagster/blob/b27d569d5fcf1072543533a0c763815d96f90b8f/python_modules/libraries/dagster-gcp/dagster_gcp/bigquery/ops.py#L72-L79
Grokzen/redis-py-cluster
f0627c91ce23e8784dbc996078428c9bdbacb20b
rediscluster/client.py
python
RedisCluster.cluster_addslots
(self, node_id, *slots)
return self.execute_command('CLUSTER ADDSLOTS', *slots, node_id=node_id)
Assign new hash slots to receiving node Sends to specified node
Assign new hash slots to receiving node
[ "Assign", "new", "hash", "slots", "to", "receiving", "node" ]
def cluster_addslots(self, node_id, *slots): """ Assign new hash slots to receiving node Sends to specified node """ return self.execute_command('CLUSTER ADDSLOTS', *slots, node_id=node_id)
[ "def", "cluster_addslots", "(", "self", ",", "node_id", ",", "*", "slots", ")", ":", "return", "self", ".", "execute_command", "(", "'CLUSTER ADDSLOTS'", ",", "*", "slots", ",", "node_id", "=", "node_id", ")" ]
https://github.com/Grokzen/redis-py-cluster/blob/f0627c91ce23e8784dbc996078428c9bdbacb20b/rediscluster/client.py#L773-L779
modelop/hadrian
7c63e539d79e6e3cad959792d313dfc8b0c523ea
titus/titus/inspector/defs.py
python
CommandGroup.__init__
(self, name, commands)
:type name: string :param name: name of the group :type commands: list of titus.inspector.defs.Command :param commands: commands in this group
:type name: string :param name: name of the group :type commands: list of titus.inspector.defs.Command :param commands: commands in this group
[ ":", "type", "name", ":", "string", ":", "param", "name", ":", "name", "of", "the", "group", ":", "type", "commands", ":", "list", "of", "titus", ".", "inspector", ".", "defs", ".", "Command", ":", "param", "commands", ":", "commands", "in", "this", ...
def __init__(self, name, commands): """:type name: string :param name: name of the group :type commands: list of titus.inspector.defs.Command :param commands: commands in this group """ self.name = name self.commands = dict((x.name, x) for x in commands) ...
[ "def", "__init__", "(", "self", ",", "name", ",", "commands", ")", ":", "self", ".", "name", "=", "name", "self", ".", "commands", "=", "dict", "(", "(", "x", ".", "name", ",", "x", ")", "for", "x", "in", "commands", ")", "if", "name", "is", "N...
https://github.com/modelop/hadrian/blob/7c63e539d79e6e3cad959792d313dfc8b0c523ea/titus/titus/inspector/defs.py#L538-L553
saltstack/raet
54858029568115550c7cb7d93e999d9c52b1494a
raet/road/transacting.py
python
Joiner.pend
(self)
Process ack pend to join packet
Process ack pend to join packet
[ "Process", "ack", "pend", "to", "join", "packet" ]
def pend(self): ''' Process ack pend to join packet ''' if not self.stack.parseInner(self.rxPacket): return self.pended = True
[ "def", "pend", "(", "self", ")", ":", "if", "not", "self", ".", "stack", ".", "parseInner", "(", "self", ".", "rxPacket", ")", ":", "return", "self", ".", "pended", "=", "True" ]
https://github.com/saltstack/raet/blob/54858029568115550c7cb7d93e999d9c52b1494a/raet/road/transacting.py#L590-L596
mlcommons/training
4a4d5a0b7efe99c680306b1940749211d4238a84
image_classification/tensorflow2/common.py
python
PiecewiseConstantDecayWithWarmup._get_learning_rate
(self, step)
Compute learning rate at given step.
Compute learning rate at given step.
[ "Compute", "learning", "rate", "at", "given", "step", "." ]
def _get_learning_rate(self, step): """Compute learning rate at given step.""" with tf.compat.v1.name_scope(self.name, 'PiecewiseConstantDecayWithWarmup', [self.rescaled_lr, self.step_boundaries, self.lr_values, self.warmup_steps, ...
[ "def", "_get_learning_rate", "(", "self", ",", "step", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "self", ".", "name", ",", "'PiecewiseConstantDecayWithWarmup'", ",", "[", "self", ".", "rescaled_lr", ",", "self", ".", "step_b...
https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/image_classification/tensorflow2/common.py#L156-L171
TesterlifeRaymond/doraemon
d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333
venv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py
python
CacheController.cached_request
(self, request)
return False
Return a cached response if it exists in the cache, otherwise return False.
Return a cached response if it exists in the cache, otherwise return False.
[ "Return", "a", "cached", "response", "if", "it", "exists", "in", "the", "cache", "otherwise", "return", "False", "." ]
def cached_request(self, request): """ Return a cached response if it exists in the cache, otherwise return False. """ cache_url = self.cache_url(request.url) logger.debug('Looking up "%s" in the cache', cache_url) cc = self.parse_cache_control(request.headers) ...
[ "def", "cached_request", "(", "self", ",", "request", ")", ":", "cache_url", "=", "self", ".", "cache_url", "(", "request", ".", "url", ")", "logger", ".", "debug", "(", "'Looking up \"%s\" in the cache'", ",", "cache_url", ")", "cc", "=", "self", ".", "pa...
https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py#L86-L205