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
elbayadm/attn2d
982653439dedc7306e484e00b3dfb90e2cd7c9e1
examples/pervasive/modules/archive/dilated_resnet.py
python
DilatedResnet.forward
(self, x, encoder_mask=None, decoder_mask=None, incremental_state=None)
return add_up
Input : N, Tt, Ts, C Output : N, Tt, Ts, C
Input : N, Tt, Ts, C Output : N, Tt, Ts, C
[ "Input", ":", "N", "Tt", "Ts", "C", "Output", ":", "N", "Tt", "Ts", "C" ]
def forward(self, x, encoder_mask=None, decoder_mask=None, incremental_state=None): """ Input : N, Tt, Ts, C Output : N, Tt, Ts, C """ if self.reduce_channels is not None: x = self.reduce_channels(x) add_up = se...
[ "def", "forward", "(", "self", ",", "x", ",", "encoder_mask", "=", "None", ",", "decoder_mask", "=", "None", ",", "incremental_state", "=", "None", ")", ":", "if", "self", ".", "reduce_channels", "is", "not", "None", ":", "x", "=", "self", ".", "reduce...
https://github.com/elbayadm/attn2d/blob/982653439dedc7306e484e00b3dfb90e2cd7c9e1/examples/pervasive/modules/archive/dilated_resnet.py#L50-L67
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_internal/vcs/subversion.py
python
Subversion.is_commit_id_equal
(cls, dest, name)
return False
Always assume the versions don't match
Always assume the versions don't match
[ "Always", "assume", "the", "versions", "don", "t", "match" ]
def is_commit_id_equal(cls, dest, name): """Always assume the versions don't match""" return False
[ "def", "is_commit_id_equal", "(", "cls", ",", "dest", ",", "name", ")", ":", "return", "False" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_internal/vcs/subversion.py#L229-L231
google/coursebuilder-core
08f809db3226d9269e30d5edd0edd33bd22041f4
coursebuilder/modules/analytics/clustering.py
python
_has_right_side
(dim)
return dim.get(DIM_HIGH) != None and dim.get(DIM_HIGH) != ''
Returns True if the value of dim[DIM_HIGH] is not None or ''.
Returns True if the value of dim[DIM_HIGH] is not None or ''.
[ "Returns", "True", "if", "the", "value", "of", "dim", "[", "DIM_HIGH", "]", "is", "not", "None", "or", "." ]
def _has_right_side(dim): """Returns True if the value of dim[DIM_HIGH] is not None or ''.""" return dim.get(DIM_HIGH) != None and dim.get(DIM_HIGH) != ''
[ "def", "_has_right_side", "(", "dim", ")", ":", "return", "dim", ".", "get", "(", "DIM_HIGH", ")", "!=", "None", "and", "dim", ".", "get", "(", "DIM_HIGH", ")", "!=", "''" ]
https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/modules/analytics/clustering.py#L188-L190
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/studio/v2/flow/__init__.py
python
FlowInstance.delete
(self)
return self._proxy.delete()
Deletes the FlowInstance :returns: True if delete succeeds, False otherwise :rtype: bool
Deletes the FlowInstance
[ "Deletes", "the", "FlowInstance" ]
def delete(self): """ Deletes the FlowInstance :returns: True if delete succeeds, False otherwise :rtype: bool """ return self._proxy.delete()
[ "def", "delete", "(", "self", ")", ":", "return", "self", ".", "_proxy", ".", "delete", "(", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/studio/v2/flow/__init__.py#L523-L530
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py
python
PyPIJSONLocator.get_distribution_names
(self)
Return all the distribution names known to this locator.
Return all the distribution names known to this locator.
[ "Return", "all", "the", "distribution", "names", "known", "to", "this", "locator", "." ]
def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Not available from this locator')
[ "def", "get_distribution_names", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Not available from this locator'", ")" ]
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py#L461-L465
fredrik-johansson/mpmath
c11db84b3237bd8fc6721f5a0c5d7c0c98a24dc1
mpmath/math2.py
python
erfc
(x)
return 1.0 - _erf_taylor(x)
erfc of a real number.
erfc of a real number.
[ "erfc", "of", "a", "real", "number", "." ]
def erfc(x): """ erfc of a real number. """ x = float(x) if x != x: return x if x < 0.0: if x < -6.0: return 2.0 return 2.0-erfc(-x) if x > 9.0: return _erfc_asymp(x) if x >= 1.0: return _erfc_mid(x) return 1.0 - _erf_taylor(x)
[ "def", "erfc", "(", "x", ")", ":", "x", "=", "float", "(", "x", ")", "if", "x", "!=", "x", ":", "return", "x", "if", "x", "<", "0.0", ":", "if", "x", "<", "-", "6.0", ":", "return", "2.0", "return", "2.0", "-", "erfc", "(", "-", "x", ")",...
https://github.com/fredrik-johansson/mpmath/blob/c11db84b3237bd8fc6721f5a0c5d7c0c98a24dc1/mpmath/math2.py#L440-L455
napari/napari
dbf4158e801fa7a429de8ef1cdee73bf6d64c61e
napari/utils/context/_expressions.py
python
parse_expression
(expr: str)
Parse string expression into an :class:`Expr` instance. Parameters ---------- expr : str Expression to parse. Returns ------- Expr Instance of `Expr`. Raises ------ SyntaxError If the provided string is not an expression (e.g. it's a statement), or ...
Parse string expression into an :class:`Expr` instance.
[ "Parse", "string", "expression", "into", "an", ":", "class", ":", "Expr", "instance", "." ]
def parse_expression(expr: str) -> Expr: """Parse string expression into an :class:`Expr` instance. Parameters ---------- expr : str Expression to parse. Returns ------- Expr Instance of `Expr`. Raises ------ SyntaxError If the provided string is not an...
[ "def", "parse_expression", "(", "expr", ":", "str", ")", "->", "Expr", ":", "try", ":", "# mode='eval' means the expr must consist of a single expression", "tree", "=", "ast", ".", "parse", "(", "expr", ",", "mode", "=", "'eval'", ")", "if", "not", "isinstance",...
https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/context/_expressions.py#L59-L94
djaodjin/djaodjin-saas
17f66871bd571741b06d93876da401a05a2cc162
saas/utils.py
python
get_user_serializer
()
return import_string(settings.USER_SERIALIZER)
Returns the user serializer model that is active in this project.
Returns the user serializer model that is active in this project.
[ "Returns", "the", "user", "serializer", "model", "that", "is", "active", "in", "this", "project", "." ]
def get_user_serializer(): """ Returns the user serializer model that is active in this project. """ from . import settings return import_string(settings.USER_SERIALIZER)
[ "def", "get_user_serializer", "(", ")", ":", "from", ".", "import", "settings", "return", "import_string", "(", "settings", ".", "USER_SERIALIZER", ")" ]
https://github.com/djaodjin/djaodjin-saas/blob/17f66871bd571741b06d93876da401a05a2cc162/saas/utils.py#L195-L200
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/asr/parts/submodules/multi_head_attention.py
python
MultiHeadAttention.__init__
(self, n_head, n_feat, dropout_rate)
Construct an MultiHeadedAttention object.
Construct an MultiHeadedAttention object.
[ "Construct", "an", "MultiHeadedAttention", "object", "." ]
def __init__(self, n_head, n_feat, dropout_rate): """Construct an MultiHeadedAttention object.""" super(MultiHeadAttention, self).__init__() assert n_feat % n_head == 0 # We assume d_v always equals d_k self.d_k = n_feat // n_head self.h = n_head self.linear_q = n...
[ "def", "__init__", "(", "self", ",", "n_head", ",", "n_feat", ",", "dropout_rate", ")", ":", "super", "(", "MultiHeadAttention", ",", "self", ")", ".", "__init__", "(", ")", "assert", "n_feat", "%", "n_head", "==", "0", "# We assume d_v always equals d_k", "...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/asr/parts/submodules/multi_head_attention.py#L55-L66
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/layers/base.py
python
Layer._settable_attrs
(self)
return ('weights', 'state', 'rng')
We only allow to set these attributes in Trax layers to prevent typos.
We only allow to set these attributes in Trax layers to prevent typos.
[ "We", "only", "allow", "to", "set", "these", "attributes", "in", "Trax", "layers", "to", "prevent", "typos", "." ]
def _settable_attrs(self): """We only allow to set these attributes in Trax layers to prevent typos.""" return ('weights', 'state', 'rng')
[ "def", "_settable_attrs", "(", "self", ")", ":", "return", "(", "'weights'", ",", "'state'", ",", "'rng'", ")" ]
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/layers/base.py#L676-L678
pyvista/pyvista
012dbb95a9aae406c3cd4cd94fc8c477f871e426
pyvista/plotting/charts.py
python
StackPlot.update
(self, x, ys)
Update the locations and/or size of the stacks (areas) in this plot. Parameters ---------- x : array_like The new x coordinates of the stacks (areas) to draw. ys : list or tuple of array_like The new sizes of the stacks (areas) to draw. Examples ...
Update the locations and/or size of the stacks (areas) in this plot.
[ "Update", "the", "locations", "and", "/", "or", "size", "of", "the", "stacks", "(", "areas", ")", "in", "this", "plot", "." ]
def update(self, x, ys): """Update the locations and/or size of the stacks (areas) in this plot. Parameters ---------- x : array_like The new x coordinates of the stacks (areas) to draw. ys : list or tuple of array_like The new sizes of the stacks (areas...
[ "def", "update", "(", "self", ",", "x", ",", "ys", ")", ":", "if", "len", "(", "x", ")", ">", "0", ":", "if", "not", "isinstance", "(", "ys", "[", "0", "]", ",", "(", "Sequence", ",", "np", ".", "ndarray", ")", ")", ":", "ys", "=", "(", "...
https://github.com/pyvista/pyvista/blob/012dbb95a9aae406c3cd4cd94fc8c477f871e426/pyvista/plotting/charts.py#L2669-L2702
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/boto/elasticache/layer1.py
python
ElastiCacheConnection.describe_reserved_cache_nodes
(self, reserved_cache_node_id=None, reserved_cache_nodes_offering_id=None, cache_node_type=None, duration=None, product_description=None, offering_type=None, max_record...
return self._make_request( action='DescribeReservedCacheNodes', verb='POST', path='/', params=params)
The DescribeReservedCacheNodes operation returns information about reserved cache nodes for this account, or about a specified reserved cache node. :type reserved_cache_node_id: string :param reserved_cache_node_id: The reserved cache node identifier filter value. Use this p...
The DescribeReservedCacheNodes operation returns information about reserved cache nodes for this account, or about a specified reserved cache node.
[ "The", "DescribeReservedCacheNodes", "operation", "returns", "information", "about", "reserved", "cache", "nodes", "for", "this", "account", "or", "about", "a", "specified", "reserved", "cache", "node", "." ]
def describe_reserved_cache_nodes(self, reserved_cache_node_id=None, reserved_cache_nodes_offering_id=None, cache_node_type=None, duration=None, product_description=None, ...
[ "def", "describe_reserved_cache_nodes", "(", "self", ",", "reserved_cache_node_id", "=", "None", ",", "reserved_cache_nodes_offering_id", "=", "None", ",", "cache_node_type", "=", "None", ",", "duration", "=", "None", ",", "product_description", "=", "None", ",", "o...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/elasticache/layer1.py#L1007-L1087
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_group.py
python
OCGroup.needs_update
(self)
return not Utils.check_def_equal(self.config.data, self.group.yaml_dict, skip_keys=['users'], debug=True)
verify an update is needed
verify an update is needed
[ "verify", "an", "update", "is", "needed" ]
def needs_update(self): ''' verify an update is needed ''' return not Utils.check_def_equal(self.config.data, self.group.yaml_dict, skip_keys=['users'], debug=True)
[ "def", "needs_update", "(", "self", ")", ":", "return", "not", "Utils", ".", "check_def_equal", "(", "self", ".", "config", ".", "data", ",", "self", ".", "group", ".", "yaml_dict", ",", "skip_keys", "=", "[", "'users'", "]", ",", "debug", "=", "True",...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_group.py#L1541-L1543
benedekrozemberczki/role2vec
d43fc337d00f8fe50475165c0e3695ba795df89a
src/walkers.py
python
alias_setup
(probs)
return J, q
Compute utility lists for non-uniform sampling from discrete distributions. Refer to https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/ for details
Compute utility lists for non-uniform sampling from discrete distributions. Refer to https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/ for details
[ "Compute", "utility", "lists", "for", "non", "-", "uniform", "sampling", "from", "discrete", "distributions", ".", "Refer", "to", "https", ":", "//", "hips", ".", "seas", ".", "harvard", ".", "edu", "/", "blog", "/", "2013", "/", "03", "/", "03", "/", ...
def alias_setup(probs): """ Compute utility lists for non-uniform sampling from discrete distributions. Refer to https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/ for details """ K = len(probs) q = np.zeros(K) J = np.zeros(K, d...
[ "def", "alias_setup", "(", "probs", ")", ":", "K", "=", "len", "(", "probs", ")", "q", "=", "np", ".", "zeros", "(", "K", ")", "J", "=", "np", ".", "zeros", "(", "K", ",", "dtype", "=", "np", ".", "int", ")", "smaller", "=", "[", "]", "larg...
https://github.com/benedekrozemberczki/role2vec/blob/d43fc337d00f8fe50475165c0e3695ba795df89a/src/walkers.py#L118-L148
GalSim-developers/GalSim
a05d4ec3b8d8574f99d3b0606ad882cbba53f345
galsim/nfw_halo.py
python
NFWHalo.getMagnification
(self, pos, z_s, units=arcsec)
return self._getMagnification(pos_x, pos_y, z_s)
Calculate magnification of halo at specified positions. Parameters: pos: Position(s) of the source(s), assumed to be post-lensing! Valid ways to input this: - single `Position` instance - tuple of floats: (x,y) ...
Calculate magnification of halo at specified positions.
[ "Calculate", "magnification", "of", "halo", "at", "specified", "positions", "." ]
def getMagnification(self, pos, z_s, units=arcsec): """Calculate magnification of halo at specified positions. Parameters: pos: Position(s) of the source(s), assumed to be post-lensing! Valid ways to input this: - single `Position` ins...
[ "def", "getMagnification", "(", "self", ",", "pos", ",", "z_s", ",", "units", "=", "arcsec", ")", ":", "# Convert to numpy arrays for internal usage:", "pos_x", ",", "pos_y", "=", "utilities", ".", "_convertPositions", "(", "pos", ",", "units", ",", "'getMagnifi...
https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/nfw_halo.py#L391-L414
cunjian/pytorch_face_landmark
f575be168a24af6f4807c852173fdfedf6d2c67d
FaceBoxes/utils/box_utils.py
python
intersect
(box_a, box_b)
return inter[:, :, 0] * inter[:, :, 1]
We resize both tensors to [A,B,2] without new malloc: [A,2] -> [A,1,2] -> [A,B,2] [B,2] -> [1,B,2] -> [A,B,2] Then we compute the area of intersect between box_a and box_b. Args: box_a: (tensor) bounding boxes, Shape: [A,4]. box_b: (tensor) bounding boxes, Shape: [B,4]. Return: (te...
We resize both tensors to [A,B,2] without new malloc: [A,2] -> [A,1,2] -> [A,B,2] [B,2] -> [1,B,2] -> [A,B,2] Then we compute the area of intersect between box_a and box_b. Args: box_a: (tensor) bounding boxes, Shape: [A,4]. box_b: (tensor) bounding boxes, Shape: [B,4]. Return: (te...
[ "We", "resize", "both", "tensors", "to", "[", "A", "B", "2", "]", "without", "new", "malloc", ":", "[", "A", "2", "]", "-", ">", "[", "A", "1", "2", "]", "-", ">", "[", "A", "B", "2", "]", "[", "B", "2", "]", "-", ">", "[", "1", "B", ...
def intersect(box_a, box_b): """ We resize both tensors to [A,B,2] without new malloc: [A,2] -> [A,1,2] -> [A,B,2] [B,2] -> [1,B,2] -> [A,B,2] Then we compute the area of intersect between box_a and box_b. Args: box_a: (tensor) bounding boxes, Shape: [A,4]. box_b: (tensor) bounding boxes...
[ "def", "intersect", "(", "box_a", ",", "box_b", ")", ":", "A", "=", "box_a", ".", "size", "(", "0", ")", "B", "=", "box_b", ".", "size", "(", "0", ")", "max_xy", "=", "torch", ".", "min", "(", "box_a", "[", ":", ",", "2", ":", "]", ".", "un...
https://github.com/cunjian/pytorch_face_landmark/blob/f575be168a24af6f4807c852173fdfedf6d2c67d/FaceBoxes/utils/box_utils.py#L31-L49
TobyPDE/FRRN
20041107a4625106d6acef1dcc903d4352220d3e
check_dependencies.py
python
check_python
()
Issues a warning if you're not running P2.7 or P3.4.
Issues a warning if you're not running P2.7 or P3.4.
[ "Issues", "a", "warning", "if", "you", "re", "not", "running", "P2", ".", "7", "or", "P3", ".", "4", "." ]
def check_python(): """Issues a warning if you're not running P2.7 or P3.4.""" version = sys.version[:3] if version != "2.7" and version != "3.4": logging.warning("You are running Python {}. We only officially support " "Python 2.7 and 3.4. This software may " ...
[ "def", "check_python", "(", ")", ":", "version", "=", "sys", ".", "version", "[", ":", "3", "]", "if", "version", "!=", "\"2.7\"", "and", "version", "!=", "\"3.4\"", ":", "logging", ".", "warning", "(", "\"You are running Python {}. We only officially support \"...
https://github.com/TobyPDE/FRRN/blob/20041107a4625106d6acef1dcc903d4352220d3e/check_dependencies.py#L99-L107
pyparsing/pyparsing
1ccf846394a055924b810faaf9628dac53633848
examples/booleansearchparser.py
python
BooleanSearchParser.evaluateQuotes
(self, argument)
return self.GetQuotes(" ".join(search_terms), r)
Evaluate quoted strings First is does an 'and' on the individual search terms, then it asks the function GetQuoted to only return the subset of ID's that contain the literal string.
Evaluate quoted strings
[ "Evaluate", "quoted", "strings" ]
def evaluateQuotes(self, argument): """Evaluate quoted strings First is does an 'and' on the individual search terms, then it asks the function GetQuoted to only return the subset of ID's that contain the literal string. """ # r = set() r = False search_t...
[ "def", "evaluateQuotes", "(", "self", ",", "argument", ")", ":", "# r = set()", "r", "=", "False", "search_terms", "=", "[", "]", "for", "item", "in", "argument", ":", "search_terms", ".", "append", "(", "item", "[", "0", "]", ")", "r", "=", "r", "an...
https://github.com/pyparsing/pyparsing/blob/1ccf846394a055924b810faaf9628dac53633848/examples/booleansearchparser.py#L220-L233
chainer/chainercv
7159616642e0be7c5b3ef380b848e16b7e99355b
chainercv/links/model/faster_rcnn/faster_rcnn_train_chain.py
python
FasterRCNNTrainChain.__init__
(self, faster_rcnn, rpn_sigma=3., roi_sigma=1., anchor_target_creator=AnchorTargetCreator(), proposal_target_creator=ProposalTargetCreator())
[]
def __init__(self, faster_rcnn, rpn_sigma=3., roi_sigma=1., anchor_target_creator=AnchorTargetCreator(), proposal_target_creator=ProposalTargetCreator()): super(FasterRCNNTrainChain, self).__init__() with self.init_scope(): self.faster_rcnn = faster_rcnn ...
[ "def", "__init__", "(", "self", ",", "faster_rcnn", ",", "rpn_sigma", "=", "3.", ",", "roi_sigma", "=", "1.", ",", "anchor_target_creator", "=", "AnchorTargetCreator", "(", ")", ",", "proposal_target_creator", "=", "ProposalTargetCreator", "(", ")", ")", ":", ...
https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv/links/model/faster_rcnn/faster_rcnn_train_chain.py#L48-L61
mongodb/mongo-python-driver
c760f900f2e4109a247c2ffc8ad3549362007772
pymongo/client_session.py
python
_reraise_with_unknown_commit
(exc)
Re-raise an exception with the UnknownTransactionCommitResult label.
Re-raise an exception with the UnknownTransactionCommitResult label.
[ "Re", "-", "raise", "an", "exception", "with", "the", "UnknownTransactionCommitResult", "label", "." ]
def _reraise_with_unknown_commit(exc): """Re-raise an exception with the UnknownTransactionCommitResult label.""" exc._add_error_label("UnknownTransactionCommitResult") raise
[ "def", "_reraise_with_unknown_commit", "(", "exc", ")", ":", "exc", ".", "_add_error_label", "(", "\"UnknownTransactionCommitResult\"", ")", "raise" ]
https://github.com/mongodb/mongo-python-driver/blob/c760f900f2e4109a247c2ffc8ad3549362007772/pymongo/client_session.py#L400-L403
NeuromorphicProcessorProject/snn_toolbox
a85ada7b5d060500703285ef8a68f06ea1ffda65
snntoolbox/simulation/backends/inisim/temporal_pattern.py
python
SpikeDense.build
(self, input_shape)
Creates the layer neurons and connections. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tuple of Keras tensors to reference for weight shape computations.
Creates the layer neurons and connections.
[ "Creates", "the", "layer", "neurons", "and", "connections", "." ]
def build(self, input_shape): """Creates the layer neurons and connections. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tuple of Keras tensors to reference for weight shape computations. """ ...
[ "def", "build", "(", "self", ",", "input_shape", ")", ":", "Dense", ".", "build", "(", "self", ",", "input_shape", ")", "self", ".", "init_neurons", "(", "input_shape", ")" ]
https://github.com/NeuromorphicProcessorProject/snn_toolbox/blob/a85ada7b5d060500703285ef8a68f06ea1ffda65/snntoolbox/simulation/backends/inisim/temporal_pattern.py#L243-L255
lesscpy/lesscpy
1172a1693df2f4bc929a88b1bebb920e666c0c9f
lesscpy/lessc/color.py
python
Color.darken
(self, color, diff, *args)
Darken a color args: color (str): color diff (str): percentage returns: str
Darken a color args: color (str): color diff (str): percentage returns: str
[ "Darken", "a", "color", "args", ":", "color", "(", "str", ")", ":", "color", "diff", "(", "str", ")", ":", "percentage", "returns", ":", "str" ]
def darken(self, color, diff, *args): """ Darken a color args: color (str): color diff (str): percentage returns: str """ if color and diff: return self._ophsl(color, diff, 1, operator.sub) raise ValueError('Illegal color va...
[ "def", "darken", "(", "self", ",", "color", ",", "diff", ",", "*", "args", ")", ":", "if", "color", "and", "diff", ":", "return", "self", ".", "_ophsl", "(", "color", ",", "diff", ",", "1", ",", "operator", ".", "sub", ")", "raise", "ValueError", ...
https://github.com/lesscpy/lesscpy/blob/1172a1693df2f4bc929a88b1bebb920e666c0c9f/lesscpy/lessc/color.py#L240-L250
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
hyperv/datadog_checks/hyperv/config_models/defaults.py
python
instance_min_collection_interval
(field, value)
return 15
[]
def instance_min_collection_interval(field, value): return 15
[ "def", "instance_min_collection_interval", "(", "field", ",", "value", ")", ":", "return", "15" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/hyperv/datadog_checks/hyperv/config_models/defaults.py#L53-L54
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
bin/x86/Debug/scripting_engine/Lib/site-packages/lxml/html/html5parser.py
python
fragment_fromstring
(html, create_parent=False, guess_charset=False, parser=None)
return result
Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encapsulate the HTML in a single element. In this case, leading or traili...
Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element.
[ "Parses", "a", "single", "HTML", "element", ";", "it", "is", "an", "error", "if", "there", "is", "more", "than", "one", "element", "or", "if", "anything", "but", "whitespace", "precedes", "or", "follows", "the", "element", "." ]
def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) the...
[ "def", "fragment_fromstring", "(", "html", ",", "create_parent", "=", "False", ",", "guess_charset", "=", "False", ",", "parser", "=", "None", ")", ":", "if", "not", "isinstance", "(", "html", ",", "_strings", ")", ":", "raise", "TypeError", "(", "'string ...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/site-packages/lxml/html/html5parser.py#L92-L130
Fizzadar/pyinfra
ff0913d6a172966760b63fe59e55dff9ea852e0d
pyinfra/api/connectors/ssh.py
python
rsync
( state, host, src, dest, flags, print_output=False, print_input=False, sudo=False, sudo_user=None, **ignored_kwargs )
return True
[]
def rsync( state, host, src, dest, flags, print_output=False, print_input=False, sudo=False, sudo_user=None, **ignored_kwargs ): hostname = host.data.ssh_hostname or host.name user = '' if host.data.ssh_user: user = '{0}@'.format(host.data.ssh_user) ssh_flags = [] port ...
[ "def", "rsync", "(", "state", ",", "host", ",", "src", ",", "dest", ",", "flags", ",", "print_output", "=", "False", ",", "print_input", "=", "False", ",", "sudo", "=", "False", ",", "sudo_user", "=", "None", ",", "*", "*", "ignored_kwargs", ")", ":"...
https://github.com/Fizzadar/pyinfra/blob/ff0913d6a172966760b63fe59e55dff9ea852e0d/pyinfra/api/connectors/ssh.py#L523-L579
facebookresearch/detectron2
cb92ae1763cd7d3777c243f07749574cdaec6cb8
projects/DensePose/densepose/data/build.py
python
has_inference_based_loaders
(cfg: CfgNode)
return len(cfg.BOOTSTRAP_DATASETS) > 0
Returns True, if at least one inferense-based loader must be instantiated for training
Returns True, if at least one inferense-based loader must be instantiated for training
[ "Returns", "True", "if", "at", "least", "one", "inferense", "-", "based", "loader", "must", "be", "instantiated", "for", "training" ]
def has_inference_based_loaders(cfg: CfgNode) -> bool: """ Returns True, if at least one inferense-based loader must be instantiated for training """ return len(cfg.BOOTSTRAP_DATASETS) > 0
[ "def", "has_inference_based_loaders", "(", "cfg", ":", "CfgNode", ")", "->", "bool", ":", "return", "len", "(", "cfg", ".", "BOOTSTRAP_DATASETS", ")", ">", "0" ]
https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/projects/DensePose/densepose/data/build.py#L679-L684
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/rfc822.py
python
Message.__getitem__
(self, name)
return self.dict[name.lower()]
Get a specific header, as from a dictionary.
Get a specific header, as from a dictionary.
[ "Get", "a", "specific", "header", "as", "from", "a", "dictionary", "." ]
def __getitem__(self, name): """Get a specific header, as from a dictionary.""" return self.dict[name.lower()]
[ "def", "__getitem__", "(", "self", ",", "name", ")", ":", "return", "self", ".", "dict", "[", "name", ".", "lower", "(", ")", "]" ]
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/rfc822.py#L387-L389
pypa/setuptools
9f37366aab9cd8f6baa23e6a77cfdb8daf97757e
pkg_resources/__init__.py
python
WorkingSet._build_master
(cls)
return ws
Prepare the master working set.
Prepare the master working set.
[ "Prepare", "the", "master", "working", "set", "." ]
def _build_master(cls): """ Prepare the master working set. """ ws = cls() try: from __main__ import __requires__ except ImportError: # The main program does not list any requirements return ws # ensure the requirements are met...
[ "def", "_build_master", "(", "cls", ")", ":", "ws", "=", "cls", "(", ")", "try", ":", "from", "__main__", "import", "__requires__", "except", "ImportError", ":", "# The main program does not list any requirements", "return", "ws", "# ensure the requirements are met", ...
https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/__init__.py#L560-L577
awslabs/aws-data-wrangler
548f5197bacd91bd50ebc66a0173eff9c56f69b1
awswrangler/redshift.py
python
copy_from_files
( # pylint: disable=too-many-locals,too-many-arguments path: str, con: redshift_connector.Connection, table: str, schema: str, iam_role: Optional[str] = None, aws_access_key_id: Optional[str] = None, aws_secret_access_key: Optional[str] = None, aws_session_token: Optional[str] = None, ...
Load Parquet files from S3 to a Table on Amazon Redshift (Through COPY command). https://docs.aws.amazon.com/redshift/latest/dg/r_COPY.html Note ---- If the table does not exist yet, it will be automatically created for you using the Parquet metadata to infer the columns data types. N...
Load Parquet files from S3 to a Table on Amazon Redshift (Through COPY command).
[ "Load", "Parquet", "files", "from", "S3", "to", "a", "Table", "on", "Amazon", "Redshift", "(", "Through", "COPY", "command", ")", "." ]
def copy_from_files( # pylint: disable=too-many-locals,too-many-arguments path: str, con: redshift_connector.Connection, table: str, schema: str, iam_role: Optional[str] = None, aws_access_key_id: Optional[str] = None, aws_secret_access_key: Optional[str] = None, aws_session_token: Opti...
[ "def", "copy_from_files", "(", "# pylint: disable=too-many-locals,too-many-arguments", "path", ":", "str", ",", "con", ":", "redshift_connector", ".", "Connection", ",", "table", ":", "str", ",", "schema", ":", "str", ",", "iam_role", ":", "Optional", "[", "str", ...
https://github.com/awslabs/aws-data-wrangler/blob/548f5197bacd91bd50ebc66a0173eff9c56f69b1/awswrangler/redshift.py#L1133-L1329
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/imputil.py
python
ImportManager.uninstall
(self)
Restore the previous import mechanism.
Restore the previous import mechanism.
[ "Restore", "the", "previous", "import", "mechanism", "." ]
def uninstall(self): "Restore the previous import mechanism." self.namespace['__import__'] = self.previous_importer
[ "def", "uninstall", "(", "self", ")", ":", "self", ".", "namespace", "[", "'__import__'", "]", "=", "self", ".", "previous_importer" ]
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/imputil.py#L49-L51
windelbouwman/ppci
915c069e0667042c085ec42c78e9e3c9a5295324
ppci/lang/c/semantics.py
python
CSemantics.init_store
(self, init_cursor, value)
Store an initial value at position pointed by cursor.
Store an initial value at position pointed by cursor.
[ "Store", "an", "initial", "value", "at", "position", "pointed", "by", "cursor", "." ]
def init_store(self, init_cursor, value): """ Store an initial value at position pointed by cursor. """ if init_cursor.at_end(): self.warning("Excess elements!", value.location) # Determine if we need implicit init levels: target_typ = init_cursor.at_typ() while not...
[ "def", "init_store", "(", "self", ",", "init_cursor", ",", "value", ")", ":", "if", "init_cursor", ".", "at_end", "(", ")", ":", "self", ".", "warning", "(", "\"Excess elements!\"", ",", "value", ".", "location", ")", "# Determine if we need implicit init levels...
https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/lang/c/semantics.py#L201-L228
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/docutils/utils/math/math2html.py
python
TaggedBit.complete
(self, contents, tag, breaklines = False)
return self
Set the constant and the tag
Set the constant and the tag
[ "Set", "the", "constant", "and", "the", "tag" ]
def complete(self, contents, tag, breaklines = False): "Set the constant and the tag" self.contents = contents self.output = TaggedOutput().settag(tag, breaklines) return self
[ "def", "complete", "(", "self", ",", "contents", ",", "tag", ",", "breaklines", "=", "False", ")", ":", "self", ".", "contents", "=", "contents", "self", ".", "output", "=", "TaggedOutput", "(", ")", ".", "settag", "(", "tag", ",", "breaklines", ")", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/docutils/utils/math/math2html.py#L2540-L2544
adafruit/Adafruit_Python_BluefruitLE
a01dec2c88fa38143afb855e1df4f9ac774156b7
Adafruit_BluefruitLE/services/colorific.py
python
Colorific.set_color
(self, r, g, b)
Set the red, green, blue color of the bulb.
Set the red, green, blue color of the bulb.
[ "Set", "the", "red", "green", "blue", "color", "of", "the", "bulb", "." ]
def set_color(self, r, g, b): """Set the red, green, blue color of the bulb.""" # See more details on the bulb's protocol from this guide: # https://learn.adafruit.com/reverse-engineering-a-bluetooth-low-energy-light-bulb/overview command = '\x58\x01\x03\x01\xFF\x00{0}{1}{2}'.format(ch...
[ "def", "set_color", "(", "self", ",", "r", ",", "g", ",", "b", ")", ":", "# See more details on the bulb's protocol from this guide:", "# https://learn.adafruit.com/reverse-engineering-a-bluetooth-low-energy-light-bulb/overview", "command", "=", "'\\x58\\x01\\x03\\x01\\xFF\\x00{0}{...
https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/a01dec2c88fa38143afb855e1df4f9ac774156b7/Adafruit_BluefruitLE/services/colorific.py#L47-L54
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/classify/naivebayes.py
python
NaiveBayesClassifier.__init__
(self, label_probdist, feature_probdist)
:param label_probdist: P(label), the probability distribution over labels. It is expressed as a ``ProbDistI`` whose samples are labels. I.e., P(label) = ``label_probdist.prob(label)``. :param feature_probdist: P(fname=fval|label), the probability distribution f...
:param label_probdist: P(label), the probability distribution over labels. It is expressed as a ``ProbDistI`` whose samples are labels. I.e., P(label) = ``label_probdist.prob(label)``.
[ ":", "param", "label_probdist", ":", "P", "(", "label", ")", "the", "probability", "distribution", "over", "labels", ".", "It", "is", "expressed", "as", "a", "ProbDistI", "whose", "samples", "are", "labels", ".", "I", ".", "e", ".", "P", "(", "label", ...
def __init__(self, label_probdist, feature_probdist): """ :param label_probdist: P(label), the probability distribution over labels. It is expressed as a ``ProbDistI`` whose samples are labels. I.e., P(label) = ``label_probdist.prob(label)``. :param feature...
[ "def", "__init__", "(", "self", ",", "label_probdist", ",", "feature_probdist", ")", ":", "self", ".", "_label_probdist", "=", "label_probdist", "self", ".", "_feature_probdist", "=", "feature_probdist", "self", ".", "_labels", "=", "list", "(", "label_probdist", ...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/classify/naivebayes.py#L64-L83
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
CGAT/scripts/gtfs2graph.py
python
CounterGenes.run
(self, filename1, filename2)
count overlap between two gtf files.
count overlap between two gtf files.
[ "count", "overlap", "between", "two", "gtf", "files", "." ]
def run(self, filename1, filename2): """count overlap between two gtf files.""" E.info("counting started for %s versus %s" % (filename1, filename2)) idx2 = self.buildIndex(filename2) self._run(filename1, idx2)
[ "def", "run", "(", "self", ",", "filename1", ",", "filename2", ")", ":", "E", ".", "info", "(", "\"counting started for %s versus %s\"", "%", "(", "filename1", ",", "filename2", ")", ")", "idx2", "=", "self", ".", "buildIndex", "(", "filename2", ")", "self...
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/scripts/gtfs2graph.py#L204-L210
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/categories/diagram_drawing.py
python
DiagramGrid._build_skeleton
(morphisms)
return edges
Creates a dictionary which maps edges to corresponding morphisms. Thus for a morphism `f:A\rightarrow B`, the edge `(A, B)` will be associated with `f`. This function also adds to the list those edges which are formed by juxtaposition of two edges already in the list. These new edges ...
Creates a dictionary which maps edges to corresponding morphisms. Thus for a morphism `f:A\rightarrow B`, the edge `(A, B)` will be associated with `f`. This function also adds to the list those edges which are formed by juxtaposition of two edges already in the list. These new edges ...
[ "Creates", "a", "dictionary", "which", "maps", "edges", "to", "corresponding", "morphisms", ".", "Thus", "for", "a", "morphism", "f", ":", "A", "\\", "rightarrow", "B", "the", "edge", "(", "A", "B", ")", "will", "be", "associated", "with", "f", ".", "T...
def _build_skeleton(morphisms): """ Creates a dictionary which maps edges to corresponding morphisms. Thus for a morphism `f:A\rightarrow B`, the edge `(A, B)` will be associated with `f`. This function also adds to the list those edges which are formed by juxtaposition of ...
[ "def", "_build_skeleton", "(", "morphisms", ")", ":", "edges", "=", "{", "}", "# Create edges for morphisms.", "for", "morphism", "in", "morphisms", ":", "DiagramGrid", ".", "_add_edge_append", "(", "edges", ",", "frozenset", "(", "[", "morphism", ".", "domain",...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/categories/diagram_drawing.py#L372-L396
taylorlu/Speaker-Diarization
ed0985950cbac6dc699bf54f58dbbc813110d3f7
uisrnn/utils.py
python
enforce_cluster_id_uniqueness
(cluster_ids)
return new_cluster_ids
Enforce uniqueness of cluster id across sequences. Args: cluster_ids: a list of 1-dim list/numpy.ndarray of strings Returns: a new list with same length of cluster_ids Raises: TypeError: if cluster_ids or its element has wrong type
Enforce uniqueness of cluster id across sequences.
[ "Enforce", "uniqueness", "of", "cluster", "id", "across", "sequences", "." ]
def enforce_cluster_id_uniqueness(cluster_ids): """Enforce uniqueness of cluster id across sequences. Args: cluster_ids: a list of 1-dim list/numpy.ndarray of strings Returns: a new list with same length of cluster_ids Raises: TypeError: if cluster_ids or its element has wrong type """ if not...
[ "def", "enforce_cluster_id_uniqueness", "(", "cluster_ids", ")", ":", "if", "not", "isinstance", "(", "cluster_ids", ",", "list", ")", ":", "raise", "TypeError", "(", "'cluster_ids must be a list'", ")", "new_cluster_ids", "=", "[", "]", "for", "cluster_id", "in",...
https://github.com/taylorlu/Speaker-Diarization/blob/ed0985950cbac6dc699bf54f58dbbc813110d3f7/uisrnn/utils.py#L55-L78
gradientinstitute/aboleth
53a3de23dce4d607ffec92be936e83d2dd7ebb3c
aboleth/layers.py
python
MaxPool2D._build
(self, X)
return Net, KL
Build the graph of this layer.
Build the graph of this layer.
[ "Build", "the", "graph", "of", "this", "layer", "." ]
def _build(self, X): """Build the graph of this layer.""" Net = tf.map_fn(lambda inputs: tf.nn.max_pool(inputs, ksize=self.ksize, strides=self.strides, ...
[ "def", "_build", "(", "self", ",", "X", ")", ":", "Net", "=", "tf", ".", "map_fn", "(", "lambda", "inputs", ":", "tf", ".", "nn", ".", "max_pool", "(", "inputs", ",", "ksize", "=", "self", ".", "ksize", ",", "strides", "=", "self", ".", "strides"...
https://github.com/gradientinstitute/aboleth/blob/53a3de23dce4d607ffec92be936e83d2dd7ebb3c/aboleth/layers.py#L228-L235
CLUEbenchmark/CLUE
5bd39732734afecb490cf18a5212e692dbf2c007
baselines/models/roberta_wwm_ext/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/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/roberta_wwm_ext/run_classifier.py#L640-L689
xonsh/xonsh
b76d6f994f22a4078f602f8b386f4ec280c8461f
xonsh/completers/path.py
python
_normpath
(p)
return p
Wraps os.normpath() to avoid removing './' at the beginning and '/' at the end. On windows it does the same with backslashes
Wraps os.normpath() to avoid removing './' at the beginning and '/' at the end. On windows it does the same with backslashes
[ "Wraps", "os", ".", "normpath", "()", "to", "avoid", "removing", ".", "/", "at", "the", "beginning", "and", "/", "at", "the", "end", ".", "On", "windows", "it", "does", "the", "same", "with", "backslashes" ]
def _normpath(p): """ Wraps os.normpath() to avoid removing './' at the beginning and '/' at the end. On windows it does the same with backslashes """ initial_dotslash = p.startswith(os.curdir + os.sep) initial_dotslash |= xp.ON_WINDOWS and p.startswith(os.curdir + os.altsep) p = p.rstrip() ...
[ "def", "_normpath", "(", "p", ")", ":", "initial_dotslash", "=", "p", ".", "startswith", "(", "os", ".", "curdir", "+", "os", ".", "sep", ")", "initial_dotslash", "|=", "xp", ".", "ON_WINDOWS", "and", "p", ".", "startswith", "(", "os", ".", "curdir", ...
https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/completers/path.py#L91-L108
JBakamovic/cxxd
142c19649b036bd6f6bdcd4684de735ea11a6c94
services/source_code_model/indexer/symbol_database.py
python
SymbolDatabase.delete_all_entries
(self)
[]
def delete_all_entries(self): try: self.db_connection.cursor().execute('DELETE FROM symbol') self.db_connection.cursor().execute('DELETE FROM diagnostics') except: logging.error(sys.exc_info())
[ "def", "delete_all_entries", "(", "self", ")", ":", "try", ":", "self", ".", "db_connection", ".", "cursor", "(", ")", ".", "execute", "(", "'DELETE FROM symbol'", ")", "self", ".", "db_connection", ".", "cursor", "(", ")", ".", "execute", "(", "'DELETE FR...
https://github.com/JBakamovic/cxxd/blob/142c19649b036bd6f6bdcd4684de735ea11a6c94/services/source_code_model/indexer/symbol_database.py#L312-L317
UDST/urbansim
0db75668ada0005352b7c7e0a405265f78ccadd7
urbansim/utils/misc.py
python
compute_range
(travel_data, attr, travel_time_attr, dist, agg=np.sum)
return travel_data.groupby(level=0).attr.apply(agg)
Compute a zone-based accessibility query using the urbansim format travel data dataframe. Parameters ---------- travel_data : dataframe The dataframe of urbansim format travel data. Has from_zone_id as first index, to_zone_id as second index, and different impedances between zo...
Compute a zone-based accessibility query using the urbansim format travel data dataframe.
[ "Compute", "a", "zone", "-", "based", "accessibility", "query", "using", "the", "urbansim", "format", "travel", "data", "dataframe", "." ]
def compute_range(travel_data, attr, travel_time_attr, dist, agg=np.sum): """ Compute a zone-based accessibility query using the urbansim format travel data dataframe. Parameters ---------- travel_data : dataframe The dataframe of urbansim format travel data. Has from_zone_id as ...
[ "def", "compute_range", "(", "travel_data", ",", "attr", ",", "travel_time_attr", ",", "dist", ",", "agg", "=", "np", ".", "sum", ")", ":", "travel_data", "=", "travel_data", ".", "reset_index", "(", "level", "=", "1", ")", "travel_data", "=", "travel_data...
https://github.com/UDST/urbansim/blob/0db75668ada0005352b7c7e0a405265f78ccadd7/urbansim/utils/misc.py#L118-L142
aws/aws-parallelcluster
f1fe5679a01c524e7ea904c329bd6d17318c6cd9
awsbatch-cli/src/awsbatch/awsbout.py
python
main
()
Command entrypoint.
Command entrypoint.
[ "Command", "entrypoint", "." ]
def main(): """Command entrypoint.""" try: # parse input parameters and config file args = _get_parser().parse_args() _validate_parameters(args) log = config_logger(args.log_level) log.info("Input parameters: %s", args) config = AWSBatchCliConfig(log=log, cluster=...
[ "def", "main", "(", ")", ":", "try", ":", "# parse input parameters and config file", "args", "=", "_get_parser", "(", ")", ".", "parse_args", "(", ")", "_validate_parameters", "(", "args", ")", "log", "=", "config_logger", "(", "args", ".", "log_level", ")", ...
https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/awsbatch-cli/src/awsbatch/awsbout.py#L194-L213
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/calendar.py
python
Calendar.yeardays2calendar
(self, year, width=3)
return [months[i:i+width] for i in range(0, len(months), width) ]
Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are (day number, weekday number) tuples. Day numbers outside this month are zero.
Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are (day number, weekday number) tuples. Day numbers outside this month are zero.
[ "Return", "the", "data", "for", "the", "specified", "year", "ready", "for", "formatting", "(", "similar", "to", "yeardatescalendar", "()", ")", ".", "Entries", "in", "the", "week", "lists", "are", "(", "day", "number", "weekday", "number", ")", "tuples", "...
def yeardays2calendar(self, year, width=3): """ Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are (day number, weekday number) tuples. Day numbers outside this month are zero. """ months = [...
[ "def", "yeardays2calendar", "(", "self", ",", "year", ",", "width", "=", "3", ")", ":", "months", "=", "[", "self", ".", "monthdays2calendar", "(", "year", ",", "i", ")", "for", "i", "in", "range", "(", "January", ",", "January", "+", "12", ")", "]...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/calendar.py#L233-L244
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/setuptools/msvc.py
python
SystemInfo._find_dot_net_versions
(self, bits=32)
return frameworkver
Find Microsoft .NET Framework versions. Parameters ---------- bits: int Platform number of bits: 32 or 64.
Find Microsoft .NET Framework versions.
[ "Find", "Microsoft", ".", "NET", "Framework", "versions", "." ]
def _find_dot_net_versions(self, bits=32): """ Find Microsoft .NET Framework versions. Parameters ---------- bits: int Platform number of bits: 32 or 64. """ # Find actual .NET version ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits) ...
[ "def", "_find_dot_net_versions", "(", "self", ",", "bits", "=", "32", ")", ":", "# Find actual .NET version", "ver", "=", "self", ".", "ri", ".", "lookup", "(", "self", ".", "ri", ".", "vc", ",", "'frameworkver%d'", "%", "bits", ")", "or", "''", "# Set ....
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/setuptools/msvc.py#L716-L738
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/contrib/gis/db/models/query.py
python
GeoQuerySet._spatial_attribute
(self, att, settings, field_name=None, model_att=None)
return self.extra(select={model_att : fmt % settings['procedure_args']}, select_params=settings['select_params'])
DRY routine for calling a spatial stored procedure on a geometry column and attaching its output as an attribute of the model. Arguments: att: The name of the spatial attribute that holds the spatial SQL function to call. settings: Dictonary of internal ...
DRY routine for calling a spatial stored procedure on a geometry column and attaching its output as an attribute of the model.
[ "DRY", "routine", "for", "calling", "a", "spatial", "stored", "procedure", "on", "a", "geometry", "column", "and", "attaching", "its", "output", "as", "an", "attribute", "of", "the", "model", "." ]
def _spatial_attribute(self, att, settings, field_name=None, model_att=None): """ DRY routine for calling a spatial stored procedure on a geometry column and attaching its output as an attribute of the model. Arguments: att: The name of the spatial attribute that hold...
[ "def", "_spatial_attribute", "(", "self", ",", "att", ",", "settings", ",", "field_name", "=", "None", ",", "model_att", "=", "None", ")", ":", "# Default settings.", "settings", ".", "setdefault", "(", "'desc'", ",", "None", ")", "settings", ".", "setdefaul...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/contrib/gis/db/models/query.py#L492-L569
salopensource/sal
464414a2666e39bdf5b4b0033a84d5129c93c053
sal/plugin.py
python
BasePlugin.checkin_processor
(self, machine, report_data)
Process checkin data prior to recording in DB. The default implementation does nothing. Plugins can define a checkin processor method by overriding this. This processor is run at the conclusion of the client checkin, and includes the report data processed during that run. ...
Process checkin data prior to recording in DB.
[ "Process", "checkin", "data", "prior", "to", "recording", "in", "DB", "." ]
def checkin_processor(self, machine, report_data): """Process checkin data prior to recording in DB. The default implementation does nothing. Plugins can define a checkin processor method by overriding this. This processor is run at the conclusion of the client checkin, and inc...
[ "def", "checkin_processor", "(", "self", ",", "machine", ",", "report_data", ")", ":", "pass" ]
https://github.com/salopensource/sal/blob/464414a2666e39bdf5b4b0033a84d5129c93c053/sal/plugin.py#L266-L280
facebookresearch/mobile-vision
f40401a44e86bb3ba9c1b66e7700e15f96b880cb
runtime_lut/code/api.py
python
OpLut.add_op
(self, op_record)
Add a new record to the OpLut Args: op_record: a LUTSchema instance to be added
Add a new record to the OpLut Args: op_record: a LUTSchema instance to be added
[ "Add", "a", "new", "record", "to", "the", "OpLut", "Args", ":", "op_record", ":", "a", "LUTSchema", "instance", "to", "be", "added" ]
def add_op(self, op_record): """ Add a new record to the OpLut Args: op_record: a LUTSchema instance to be added """ assert isinstance(op_record, LUTSchema) if self.find_op(op_record) != []: print("Operator already exists.") return ...
[ "def", "add_op", "(", "self", ",", "op_record", ")", ":", "assert", "isinstance", "(", "op_record", ",", "LUTSchema", ")", "if", "self", ".", "find_op", "(", "op_record", ")", "!=", "[", "]", ":", "print", "(", "\"Operator already exists.\"", ")", "return"...
https://github.com/facebookresearch/mobile-vision/blob/f40401a44e86bb3ba9c1b66e7700e15f96b880cb/runtime_lut/code/api.py#L97-L108
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/core/conv_layers_with_time_padding.py
python
CausalConv2DLayerWithPadding.zero_state
(self, batch_size)
return py_utils.NestedMap(context=context)
Returns the initial state given the batch size. Args: batch_size: the batch size. Returns: state0: A NestedMap of tensors including: - context: A Tensor of shape [b, filter_shape[0]-1, 1, c].
Returns the initial state given the batch size.
[ "Returns", "the", "initial", "state", "given", "the", "batch", "size", "." ]
def zero_state(self, batch_size): """Returns the initial state given the batch size. Args: batch_size: the batch size. Returns: state0: A NestedMap of tensors including: - context: A Tensor of shape [b, filter_shape[0]-1, 1, c]. """ p = self.params assert p.filter_shape[1] ...
[ "def", "zero_state", "(", "self", ",", "batch_size", ")", ":", "p", "=", "self", ".", "params", "assert", "p", ".", "filter_shape", "[", "1", "]", "==", "1", ",", "(", "'zero_state() only supports 1d causal convolution.'", ")", "context", "=", "tf", ".", "...
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/conv_layers_with_time_padding.py#L503-L521
napalm-automation/napalm
ad1ff72000d0de59f25c8847694f51a4ad5aca86
docs/conf.py
python
build_getters_support_matrix
(app)
Build the getters support matrix.
Build the getters support matrix.
[ "Build", "the", "getters", "support", "matrix", "." ]
def build_getters_support_matrix(app): """Build the getters support matrix.""" status = subprocess.call("./test.sh", stdout=sys.stdout, stderr=sys.stderr) if status != 0: print("Something bad happened when processing the test reports.") sys.exit(-1) drivers = set() matrix = { ...
[ "def", "build_getters_support_matrix", "(", "app", ")", ":", "status", "=", "subprocess", ".", "call", "(", "\"./test.sh\"", ",", "stdout", "=", "sys", ".", "stdout", ",", "stderr", "=", "sys", ".", "stderr", ")", "if", "status", "!=", "0", ":", "print",...
https://github.com/napalm-automation/napalm/blob/ad1ff72000d0de59f25c8847694f51a4ad5aca86/docs/conf.py#L359-L406
bungnoid/glTools
8ff0899de43784a18bd4543285655e68e28fb5e5
utils/boundingBox.py
python
getBoundingBox
(geometry,worldSpace=True)
return glTools.utils.base.getMBoundingBox(geometry,worldSpace=worldSpace)
Return bounding box for the specified geometry. @param geometry: Geometry to return bounding box for @type geometry: str @param worldSpace: Calculate bounding box in world or local space @type worldSpace: bool
Return bounding box for the specified geometry.
[ "Return", "bounding", "box", "for", "the", "specified", "geometry", "." ]
def getBoundingBox(geometry,worldSpace=True): ''' Return bounding box for the specified geometry. @param geometry: Geometry to return bounding box for @type geometry: str @param worldSpace: Calculate bounding box in world or local space @type worldSpace: bool ''' return glTools.utils.base.getMBoundingBox(geomet...
[ "def", "getBoundingBox", "(", "geometry", ",", "worldSpace", "=", "True", ")", ":", "return", "glTools", ".", "utils", ".", "base", ".", "getMBoundingBox", "(", "geometry", ",", "worldSpace", "=", "worldSpace", ")" ]
https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/utils/boundingBox.py#L59-L67
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/jinja2/utils.py
python
LRUCache.iteritems
(self)
return iter(self.items())
Iterate over all items.
Iterate over all items.
[ "Iterate", "over", "all", "items", "." ]
def iteritems(self): """Iterate over all items.""" return iter(self.items())
[ "def", "iteritems", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "items", "(", ")", ")" ]
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/jinja2/utils.py#L500-L502
openstack/kuryr-kubernetes
513ada72685ef02cd9f3aca418ac1b2e0dc1b8ba
kuryr_kubernetes/os_vif_util.py
python
_make_vif_subnets
(neutron_port, subnets)
return list(vif_subnets.values())
Gets a list of os-vif Subnet objects for port. :param neutron_port: dict containing port information as returned by neutron client's 'show_port' or openstack.network.v2.port.Port object :param subnets: subnet mapping as returned by PodSubnetsDriver.get_subnets ...
Gets a list of os-vif Subnet objects for port.
[ "Gets", "a", "list", "of", "os", "-", "vif", "Subnet", "objects", "for", "port", "." ]
def _make_vif_subnets(neutron_port, subnets): """Gets a list of os-vif Subnet objects for port. :param neutron_port: dict containing port information as returned by neutron client's 'show_port' or openstack.network.v2.port.Port object :param subnets: subnet...
[ "def", "_make_vif_subnets", "(", "neutron_port", ",", "subnets", ")", ":", "vif_subnets", "=", "{", "}", "try", ":", "fixed_ips", "=", "neutron_port", ".", "get", "(", "'fixed_ips'", ",", "[", "]", ")", "port_id", "=", "neutron_port", ".", "get", "(", "'...
https://github.com/openstack/kuryr-kubernetes/blob/513ada72685ef02cd9f3aca418ac1b2e0dc1b8ba/kuryr_kubernetes/os_vif_util.py#L126-L164
fofix/fofix
7730d1503c66562b901f62b33a5bd46c3d5e5c34
fofix/core/Font.py
python
Font.drawSquare
(self, w, h, tw, th)
New drawing relaying only on pygame.font.render Use arrays to increase performance :param w: width :param h: height :param tw: texture width :param th: texture height
New drawing relaying only on pygame.font.render Use arrays to increase performance
[ "New", "drawing", "relaying", "only", "on", "pygame", ".", "font", ".", "render", "Use", "arrays", "to", "increase", "performance" ]
def drawSquare(self, w, h, tw, th): """ New drawing relaying only on pygame.font.render Use arrays to increase performance :param w: width :param h: height :param tw: texture width :param th: texture height """ self.square_prim[1, 0] = self.square...
[ "def", "drawSquare", "(", "self", ",", "w", ",", "h", ",", "tw", ",", "th", ")", ":", "self", ".", "square_prim", "[", "1", ",", "0", "]", "=", "self", ".", "square_prim", "[", "3", ",", "0", "]", "=", "w", "self", ".", "square_prim", "[", "2...
https://github.com/fofix/fofix/blob/7730d1503c66562b901f62b33a5bd46c3d5e5c34/fofix/core/Font.py#L148-L162
fabioz/PyDev.Debugger
0f8c02a010fe5690405da1dd30ed72326191ce63
third_party/pep8/autopep8.py
python
get_encoding
()
return locale.getpreferredencoding() or sys.getdefaultencoding()
Return preferred encoding.
Return preferred encoding.
[ "Return", "preferred", "encoding", "." ]
def get_encoding(): """Return preferred encoding.""" return locale.getpreferredencoding() or sys.getdefaultencoding()
[ "def", "get_encoding", "(", ")", ":", "return", "locale", ".", "getpreferredencoding", "(", ")", "or", "sys", ".", "getdefaultencoding", "(", ")" ]
https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/third_party/pep8/autopep8.py#L3752-L3754
microsoft/botbuilder-python
3d410365461dc434df59bdfeaa2f16d28d9df868
libraries/botbuilder-schema/botbuilder/schema/_models_py3.py
python
Activity.create_event_activity
()
return Activity(type=ActivityTypes.event)
Creates an instance of the :class:`Activity` class as an EventActivity object. :returns: The new event activity.
Creates an instance of the :class:`Activity` class as an EventActivity object.
[ "Creates", "an", "instance", "of", "the", ":", "class", ":", "Activity", "class", "as", "an", "EventActivity", "object", "." ]
def create_event_activity(): """ Creates an instance of the :class:`Activity` class as an EventActivity object. :returns: The new event activity. """ return Activity(type=ActivityTypes.event)
[ "def", "create_event_activity", "(", ")", ":", "return", "Activity", "(", "type", "=", "ActivityTypes", ".", "event", ")" ]
https://github.com/microsoft/botbuilder-python/blob/3d410365461dc434df59bdfeaa2f16d28d9df868/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py#L584-L590
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/importlib/abc.py
python
ResourceReader.open_resource
(self, resource)
Return an opened, file-like object for binary reading. The 'resource' argument is expected to represent only a file name and thus not contain any subdirectory components. If the resource cannot be found, FileNotFoundError is raised.
Return an opened, file-like object for binary reading.
[ "Return", "an", "opened", "file", "-", "like", "object", "for", "binary", "reading", "." ]
def open_resource(self, resource): """Return an opened, file-like object for binary reading. The 'resource' argument is expected to represent only a file name and thus not contain any subdirectory components. If the resource cannot be found, FileNotFoundError is raised. """ ...
[ "def", "open_resource", "(", "self", ",", "resource", ")", ":", "raise", "FileNotFoundError" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/importlib/abc.py#L355-L363
makerdao/pymaker
9245b3e22bcb257004d54337df6c2b0c9cbe42c8
pymaker/sai.py
python
Tub.approve
(self, approval_function)
Approve the `Tub` to access our GEM, SKR, SAI and GOV balances. For available approval functions (i.e. approval modes) see `directly` and `via_tx_manager` in `pymaker.approval`. Args: approval_function: Approval function (i.e. approval mode).
Approve the `Tub` to access our GEM, SKR, SAI and GOV balances.
[ "Approve", "the", "Tub", "to", "access", "our", "GEM", "SKR", "SAI", "and", "GOV", "balances", "." ]
def approve(self, approval_function): """Approve the `Tub` to access our GEM, SKR, SAI and GOV balances. For available approval functions (i.e. approval modes) see `directly` and `via_tx_manager` in `pymaker.approval`. Args: approval_function: Approval function (i.e. approv...
[ "def", "approve", "(", "self", ",", "approval_function", ")", ":", "assert", "(", "callable", "(", "approval_function", ")", ")", "approval_function", "(", "ERC20Token", "(", "web3", "=", "self", ".", "web3", ",", "address", "=", "self", ".", "gem", "(", ...
https://github.com/makerdao/pymaker/blob/9245b3e22bcb257004d54337df6c2b0c9cbe42c8/pymaker/sai.py#L104-L118
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/ply-3.11/example/ansic/cparse.py
python
p_direct_declarator_5
(t)
direct_declarator : direct_declarator LPAREN identifier_list RPAREN
direct_declarator : direct_declarator LPAREN identifier_list RPAREN
[ "direct_declarator", ":", "direct_declarator", "LPAREN", "identifier_list", "RPAREN" ]
def p_direct_declarator_5(t): 'direct_declarator : direct_declarator LPAREN identifier_list RPAREN ' pass
[ "def", "p_direct_declarator_5", "(", "t", ")", ":", "pass" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/ply-3.11/example/ansic/cparse.py#L351-L353
rq/rq
c5a1ef17345e17269085e7f72858ac9bd6faf1dd
rq/local.py
python
LocalProxy.__getattr__
(self, name)
return getattr(self._get_current_object(), name)
[]
def __getattr__(self, name): if name == '__members__': return dir(self._get_current_object()) return getattr(self._get_current_object(), name)
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "if", "name", "==", "'__members__'", ":", "return", "dir", "(", "self", ".", "_get_current_object", "(", ")", ")", "return", "getattr", "(", "self", ".", "_get_current_object", "(", ")", ",", "nam...
https://github.com/rq/rq/blob/c5a1ef17345e17269085e7f72858ac9bd6faf1dd/rq/local.py#L318-L321
facebookresearch/votenet
2f6d6d36ff98d96901182e935afe48ccee82d566
sunrgbd/sunrgbd_utils.py
python
SUNRGBD_Calibration.project_upright_camera_to_upright_depth
(self, pc)
return flip_axis_to_depth(pc)
[]
def project_upright_camera_to_upright_depth(self, pc): return flip_axis_to_depth(pc)
[ "def", "project_upright_camera_to_upright_depth", "(", "self", ",", "pc", ")", ":", "return", "flip_axis_to_depth", "(", "pc", ")" ]
https://github.com/facebookresearch/votenet/blob/2f6d6d36ff98d96901182e935afe48ccee82d566/sunrgbd/sunrgbd_utils.py#L119-L120
pabigot/pyxb
14737c23a125fd12c954823ad64fc4497816fae3
pyxb/xmlschema/structures.py
python
_NamedComponent_mixin.__new__
(cls, *args, **kw)
return rv
Pickling support. Normally, we just create a new instance of this class. However, if we're unpickling a reference in a loadable schema, we need to return the existing component instance by looking up the name in the component map of the desired namespace. We can tell the differ...
Pickling support.
[ "Pickling", "support", "." ]
def __new__ (cls, *args, **kw): """Pickling support. Normally, we just create a new instance of this class. However, if we're unpickling a reference in a loadable schema, we need to return the existing component instance by looking up the name in the component map of the desired...
[ "def", "__new__", "(", "cls", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "0", "==", "len", "(", "args", ")", ":", "rv", "=", "super", "(", "_NamedComponent_mixin", ",", "cls", ")", ".", "__new__", "(", "cls", ")", "return", "rv", "(...
https://github.com/pabigot/pyxb/blob/14737c23a125fd12c954823ad64fc4497816fae3/pyxb/xmlschema/structures.py#L706-L768
googleapis/python-dialogflow
e48ea001b7c8a4a5c1fe4b162bad49ea397458e9
google/cloud/dialogflow_v2/services/intents/async_client.py
python
IntentsAsyncClient.list_intents
( self, request: Union[intent.ListIntentsRequest, dict] = None, *, parent: str = None, language_code: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), )
return response
r"""Returns the list of all intents in the specified agent. Args: request (Union[google.cloud.dialogflow_v2.types.ListIntentsRequest, dict]): The request object. The request message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. ...
r"""Returns the list of all intents in the specified agent.
[ "r", "Returns", "the", "list", "of", "all", "intents", "in", "the", "specified", "agent", "." ]
async def list_intents( self, request: Union[intent.ListIntentsRequest, dict] = None, *, parent: str = None, language_code: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -...
[ "async", "def", "list_intents", "(", "self", ",", "request", ":", "Union", "[", "intent", ".", "ListIntentsRequest", ",", "dict", "]", "=", "None", ",", "*", ",", "parent", ":", "str", "=", "None", ",", "language_code", ":", "str", "=", "None", ",", ...
https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2/services/intents/async_client.py#L170-L271
windelbouwman/ppci
915c069e0667042c085ec42c78e9e3c9a5295324
ppci/programs/ir_program.py
python
IrProgram.to_x86
(self, **options)
return self._new('x86', [ob])
Compile to X86 machine code. Status: ...
Compile to X86 machine code.
[ "Compile", "to", "X86", "machine", "code", "." ]
def to_x86(self, **options): """ Compile to X86 machine code. Status: ... """ if options.get('win', ''): arch = get_arch('x86_64:wincc') else: arch = get_arch('x86_64') # todo: don't we want to be able to pass debug_db here? ppci_modules...
[ "def", "to_x86", "(", "self", ",", "*", "*", "options", ")", ":", "if", "options", ".", "get", "(", "'win'", ",", "''", ")", ":", "arch", "=", "get_arch", "(", "'x86_64:wincc'", ")", "else", ":", "arch", "=", "get_arch", "(", "'x86_64'", ")", "# to...
https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/programs/ir_program.py#L41-L59
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/lib-tk/Tkinter.py
python
IntVar.__init__
(self, master=None, value=None, name=None)
Construct an integer variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained.
Construct an integer variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained.
[ "Construct", "an", "integer", "variable", ".", "MASTER", "can", "be", "given", "as", "master", "widget", ".", "VALUE", "is", "an", "optional", "value", "(", "defaults", "to", "0", ")", "NAME", "is", "an", "optional", "Tcl", "name", "(", "defaults", "to",...
def __init__(self, master=None, value=None, name=None): """Construct an integer variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable ...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "value", "=", "None", ",", "name", "=", "None", ")", ":", "Variable", ".", "__init__", "(", "self", ",", "master", ",", "value", ",", "name", ")" ]
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/lib-tk/Tkinter.py#L291-L301
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1beta1_flow_schema_list.py
python
V1beta1FlowSchemaList.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1beta1_flow_schema_list.py#L189-L191
ysrc/xunfeng
40d40ecf55910019b8b904ef70ae1eebb6b6d26f
vulscan/vuldb/crack_supervisor_web.py
python
get_plugin_info
()
return plugin_info
[]
def get_plugin_info(): plugin_info = { "name": "Supervisor CVE-2017-11610", "info": "Supervisor 接口未授权访问、弱口令、代码执行漏洞", "level": "高危", "type": "弱口令", "author": "unknown", "url": "https://github.com/Medicean/VulApps/blob/master/s/supervisor/1/", "keyword": "port:9...
[ "def", "get_plugin_info", "(", ")", ":", "plugin_info", "=", "{", "\"name\"", ":", "\"Supervisor CVE-2017-11610\"", ",", "\"info\"", ":", "\"Supervisor 接口未授权访问、弱口令、代码执行漏洞\",", "", "\"level\"", ":", "\"高危\",", "", "\"type\"", ":", "\"弱口令\",", "", "\"author\"", ":", ...
https://github.com/ysrc/xunfeng/blob/40d40ecf55910019b8b904ef70ae1eebb6b6d26f/vulscan/vuldb/crack_supervisor_web.py#L8-L19
DEAP/deap
2f63dcf6aaa341b8fe5d66d99e9e003a21312fef
deap/benchmarks/gp.py
python
salustowicz_2d
(data)
return exp(-data[0]) * data[0]**3 * cos(data[0]) * sin(data[0]) * (cos(data[0]) * sin(data[0])**2 - 1) * (data[1] - 5)
Salustowicz benchmark function. .. list-table:: :widths: 10 50 :stub-columns: 1 * - Range - :math:`\mathbf{x} \in [0, 7]^2` * - Function - :math:`f(\mathbf{x}) = e^{-x_1} x_1^3 \cos(x_1) \sin(x_1) (\cos(x_1) \sin^2(x_1) - 1) (x_2 -5)`
Salustowicz benchmark function.
[ "Salustowicz", "benchmark", "function", "." ]
def salustowicz_2d(data): """Salustowicz benchmark function. .. list-table:: :widths: 10 50 :stub-columns: 1 * - Range - :math:`\mathbf{x} \in [0, 7]^2` * - Function - :math:`f(\mathbf{x}) = e^{-x_1} x_1^3 \cos(x_1) \sin(x_1) (\cos(x_1) \sin^2(x_1) - 1) (x_2 -5)`...
[ "def", "salustowicz_2d", "(", "data", ")", ":", "return", "exp", "(", "-", "data", "[", "0", "]", ")", "*", "data", "[", "0", "]", "**", "3", "*", "cos", "(", "data", "[", "0", "]", ")", "*", "sin", "(", "data", "[", "0", "]", ")", "*", "...
https://github.com/DEAP/deap/blob/2f63dcf6aaa341b8fe5d66d99e9e003a21312fef/deap/benchmarks/gp.py#L46-L58
rwth-i6/returnn
f2d718a197a280b0d5f0fd91a7fcb8658560dddb
returnn/import_/common.py
python
_normalize_pkg_name
(name)
return name
:param str name: :rtype: str
:param str name: :rtype: str
[ ":", "param", "str", "name", ":", ":", "rtype", ":", "str" ]
def _normalize_pkg_name(name): """ :param str name: :rtype: str """ name = name.replace(".", "_") name = name.replace("-", "_") return name
[ "def", "_normalize_pkg_name", "(", "name", ")", ":", "name", "=", "name", ".", "replace", "(", "\".\"", ",", "\"_\"", ")", "name", "=", "name", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "return", "name" ]
https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/import_/common.py#L128-L135
rwth-i6/returnn
f2d718a197a280b0d5f0fd91a7fcb8658560dddb
returnn/util/basic.py
python
NativeCodeCompiler.__init__
(self, base_name, code_version, code, is_cpp=True, c_macro_defines=None, ld_flags=None, include_paths=(), include_deps=None, static_version_name=None, should_cleanup_old_all=True, should_cleanup_old_mydir=False, use_cxx11_abi=False, log_stream=None, verbose=Fa...
:param str base_name: base name for the module, e.g. "zero_out" :param int|tuple[int] code_version: check for the cache whether to reuse :param str code: the source code itself :param bool is_cpp: if False, C is assumed :param dict[str,str|int]|None c_macro_defines: e.g. {"TENSORFLOW": 1} :param lis...
:param str base_name: base name for the module, e.g. "zero_out" :param int|tuple[int] code_version: check for the cache whether to reuse :param str code: the source code itself :param bool is_cpp: if False, C is assumed :param dict[str,str|int]|None c_macro_defines: e.g. {"TENSORFLOW": 1} :param lis...
[ ":", "param", "str", "base_name", ":", "base", "name", "for", "the", "module", "e", ".", "g", ".", "zero_out", ":", "param", "int|tuple", "[", "int", "]", "code_version", ":", "check", "for", "the", "cache", "whether", "to", "reuse", ":", "param", "str...
def __init__(self, base_name, code_version, code, is_cpp=True, c_macro_defines=None, ld_flags=None, include_paths=(), include_deps=None, static_version_name=None, should_cleanup_old_all=True, should_cleanup_old_mydir=False, use_cxx11_abi=False, log_stream=None...
[ "def", "__init__", "(", "self", ",", "base_name", ",", "code_version", ",", "code", ",", "is_cpp", "=", "True", ",", "c_macro_defines", "=", "None", ",", "ld_flags", "=", "None", ",", "include_paths", "=", "(", ")", ",", "include_deps", "=", "None", ",",...
https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/util/basic.py#L3327-L3373
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/trakt/sync.py
python
Scrobbler.update
(self, progress)
Update the scobbling progress of this :class:`Scrobbler`'s *media* object
Update the scobbling progress of this :class:`Scrobbler`'s *media* object
[ "Update", "the", "scobbling", "progress", "of", "this", ":", "class", ":", "Scrobbler", "s", "*", "media", "*", "object" ]
def update(self, progress): """Update the scobbling progress of this :class:`Scrobbler`'s *media* object """ self.progress = progress self.start()
[ "def", "update", "(", "self", ",", "progress", ")", ":", "self", ".", "progress", "=", "progress", "self", ".", "start", "(", ")" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/trakt/sync.py#L475-L480
EricSteinberger/PokerRL
e02ea667061b96912e424231da071b6f20a262f7
PokerRL/game/_/rl_env/base/PokerEnv.py
python
PokerEnv._get_step_reward
(self, is_terminal)
return [(p.stack - p.starting_stack_this_episode) / self.REWARD_SCALAR for p in self.seats]
[]
def _get_step_reward(self, is_terminal): if not is_terminal: return np.zeros(shape=self.N_SEATS, dtype=np.float32) return [(p.stack - p.starting_stack_this_episode) / self.REWARD_SCALAR for p in self.seats]
[ "def", "_get_step_reward", "(", "self", ",", "is_terminal", ")", ":", "if", "not", "is_terminal", ":", "return", "np", ".", "zeros", "(", "shape", "=", "self", ".", "N_SEATS", ",", "dtype", "=", "np", ".", "float32", ")", "return", "[", "(", "p", "."...
https://github.com/EricSteinberger/PokerRL/blob/e02ea667061b96912e424231da071b6f20a262f7/PokerRL/game/_/rl_env/base/PokerEnv.py#L1069-L1072
MaslowCNC/GroundControl
294a05dea5b9753383e24b07ea47d78e76e49422
CalibrationWidgets/computeCalibrationSteps.py
python
ComputeCalibrationSteps.on_Enter
(self)
This function runs when the step is entered
This function runs when the step is entered
[ "This", "function", "runs", "when", "the", "step", "is", "entered" ]
def on_Enter(self): ''' This function runs when the step is entered ''' self.setupListOfSteps() Clock.schedule_once(self.loadNextStep, 5)
[ "def", "on_Enter", "(", "self", ")", ":", "self", ".", "setupListOfSteps", "(", ")", "Clock", ".", "schedule_once", "(", "self", ".", "loadNextStep", ",", "5", ")" ]
https://github.com/MaslowCNC/GroundControl/blob/294a05dea5b9753383e24b07ea47d78e76e49422/CalibrationWidgets/computeCalibrationSteps.py#L16-L24
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/lib2to3/refactor.py
python
RefactoringTool.processed_file
(self, new_text, filename, old_text=None, write=False, encoding=None)
Called when a file has been refactored, and there are changes.
Called when a file has been refactored, and there are changes.
[ "Called", "when", "a", "file", "has", "been", "refactored", "and", "there", "are", "changes", "." ]
def processed_file(self, new_text, filename, old_text=None, write=False, encoding=None): """ Called when a file has been refactored, and there are changes. """ self.files.append(filename) if old_text is None: old_text = self._read_python_source(...
[ "def", "processed_file", "(", "self", ",", "new_text", ",", "filename", ",", "old_text", "=", "None", ",", "write", "=", "False", ",", "encoding", "=", "None", ")", ":", "self", ".", "files", ".", "append", "(", "filename", ")", "if", "old_text", "is",...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/lib2to3/refactor.py#L502-L520
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/factortools.py
python
dmp_zz_wang_lead_coeffs
(f, T, cs, E, H, A, u, K)
return f, HHH, CCC
Wang/EEZ: Compute correct leading coefficients.
Wang/EEZ: Compute correct leading coefficients.
[ "Wang", "/", "EEZ", ":", "Compute", "correct", "leading", "coefficients", "." ]
def dmp_zz_wang_lead_coeffs(f, T, cs, E, H, A, u, K): """Wang/EEZ: Compute correct leading coefficients. """ C, J, v = [], [0]*len(E), u - 1 for h in H: c = dmp_one(v, K) d = dup_LC(h, K)*cs for i in reversed(xrange(len(E))): k, e, (t, _) = 0, E[i], T[i] wh...
[ "def", "dmp_zz_wang_lead_coeffs", "(", "f", ",", "T", ",", "cs", ",", "E", ",", "H", ",", "A", ",", "u", ",", "K", ")", ":", "C", ",", "J", ",", "v", "=", "[", "]", ",", "[", "0", "]", "*", "len", "(", "E", ")", ",", "u", "-", "1", "f...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/factortools.py#L672-L723
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/code.py
python
InteractiveInterpreter.write
(self, data)
Write a string. The base implementation writes to sys.stderr; a subclass may replace this with a different implementation.
Write a string.
[ "Write", "a", "string", "." ]
def write(self, data): """Write a string. The base implementation writes to sys.stderr; a subclass may replace this with a different implementation. """ sys.stderr.write(data)
[ "def", "write", "(", "self", ",", "data", ")", ":", "sys", ".", "stderr", ".", "write", "(", "data", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/code.py#L164-L171
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/ply-3.11/example/ansic/cparse.py
python
p_equality_expression_2
(t)
equality_expression : equality_expression EQ relational_expression
equality_expression : equality_expression EQ relational_expression
[ "equality_expression", ":", "equality_expression", "EQ", "relational_expression" ]
def p_equality_expression_2(t): 'equality_expression : equality_expression EQ relational_expression' pass
[ "def", "p_equality_expression_2", "(", "t", ")", ":", "pass" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/ply-3.11/example/ansic/cparse.py#L817-L819
MushroomRL/mushroom-rl
a0eaa2cf8001e433419234a9fc48b64170e3f61c
mushroom_rl/approximators/parametric/cmac.py
python
CMAC.diff
(self, state, action=None)
return super().diff(phi, action)
Compute the derivative of the output w.r.t. ``state``, and ``action`` if provided. Args: state (np.ndarray): the state; action (np.ndarray, None): the action. Returns: The derivative of the output w.r.t. ``state``, and ``action`` if provided.
Compute the derivative of the output w.r.t. ``state``, and ``action`` if provided.
[ "Compute", "the", "derivative", "of", "the", "output", "w", ".", "r", ".", "t", ".", "state", "and", "action", "if", "provided", "." ]
def diff(self, state, action=None): """ Compute the derivative of the output w.r.t. ``state``, and ``action`` if provided. Args: state (np.ndarray): the state; action (np.ndarray, None): the action. Returns: The derivative of the output w.r.t...
[ "def", "diff", "(", "self", ",", "state", ",", "action", "=", "None", ")", ":", "phi", "=", "self", ".", "_phi", "(", "state", ")", "return", "super", "(", ")", ".", "diff", "(", "phi", ",", "action", ")" ]
https://github.com/MushroomRL/mushroom-rl/blob/a0eaa2cf8001e433419234a9fc48b64170e3f61c/mushroom_rl/approximators/parametric/cmac.py#L85-L101
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/core/grr_response_core/lib/casing.py
python
SnakeToCamel
(snake_str: str)
return words[0] + "".join(map(str.capitalize, words[1:]))
Convert a snake_case string representing one identifier to lowerCamelCase. The function uses a best-effort approach to convert the given string to a valid lowerCamelCase string, meaning that it converts even strings that use multiple consecutive underscores between words and/or that start/end with an underscor...
Convert a snake_case string representing one identifier to lowerCamelCase.
[ "Convert", "a", "snake_case", "string", "representing", "one", "identifier", "to", "lowerCamelCase", "." ]
def SnakeToCamel(snake_str: str) -> str: """Convert a snake_case string representing one identifier to lowerCamelCase. The function uses a best-effort approach to convert the given string to a valid lowerCamelCase string, meaning that it converts even strings that use multiple consecutive underscores between w...
[ "def", "SnakeToCamel", "(", "snake_str", ":", "str", ")", "->", "str", ":", "# Extract the words from the snake_case string.", "words", "=", "[", "word", "for", "word", "in", "snake_str", ".", "split", "(", "\"_\"", ")", "if", "word", "]", "if", "not", "word...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/lib/casing.py#L6-L27
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
xtune/src/transformers/modeling_tf_openai.py
python
TFOpenAIGPTMainLayer._prune_heads
(self, heads_to_prune)
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
[ "Prunes", "heads", "of", "the", "model", ".", "heads_to_prune", ":", "dict", "of", "{", "layer_num", ":", "list", "of", "heads", "to", "prune", "in", "this", "layer", "}" ]
def _prune_heads(self, heads_to_prune): """ Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} """ raise NotImplementedError
[ "def", "_prune_heads", "(", "self", ",", "heads_to_prune", ")", ":", "raise", "NotImplementedError" ]
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/modeling_tf_openai.py#L227-L231
Mailu/Mailu
1e53530164e9eaf77a89c322e34bff447ace5a28
core/admin/migrations/env.py
python
run_migrations_online
()
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
Run migrations in 'online' mode.
[ "Run", "migrations", "in", "online", "mode", "." ]
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ # this callback is used to prevent an auto-migration from being generated # when there are no changes to the schema # reference: h...
[ "def", "run_migrations_online", "(", ")", ":", "# this callback is used to prevent an auto-migration from being generated", "# when there are no changes to the schema", "# reference: http://alembic.readthedocs.org/en/latest/cookbook.html", "def", "process_revision_directives", "(", "context", ...
https://github.com/Mailu/Mailu/blob/1e53530164e9eaf77a89c322e34bff447ace5a28/core/admin/migrations/env.py#L48-L94
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/modules/payloads/source/harddrive/initialization.py
python
SetUpHardDriveSourceTask.run
(self)
Run Hard drive installation source setup. Always sets up two mount points: First for the device, and second for the ISO image or a bind for unpacked ISO. These depend on each other, and must be destroyed in the correct order again. :raise: SourceSetupError :return: named tuple ...
Run Hard drive installation source setup.
[ "Run", "Hard", "drive", "installation", "source", "setup", "." ]
def run(self): """Run Hard drive installation source setup. Always sets up two mount points: First for the device, and second for the ISO image or a bind for unpacked ISO. These depend on each other, and must be destroyed in the correct order again. :raise: SourceSetupError ...
[ "def", "run", "(", "self", ")", ":", "log", ".", "debug", "(", "\"Setting up Hard drive source\"", ")", "for", "mount_point", "in", "[", "self", ".", "_device_mount", ",", "self", ".", "_iso_mount", "]", ":", "if", "os", ".", "path", ".", "ismount", "(",...
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/payloads/source/harddrive/initialization.py#L51-L93
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/http/cookiejar.py
python
Cookie.__str__
(self)
return "<Cookie %s for %s>" % (namevalue, limit)
[]
def __str__(self): if self.port is None: p = "" else: p = ":"+self.port limit = self.domain + p + self.path if self.value is not None: namevalue = "%s=%s" % (self.name, self.value) else: namevalue = self.name return "<Cookie %s for %s>" % (namevalu...
[ "def", "__str__", "(", "self", ")", ":", "if", "self", ".", "port", "is", "None", ":", "p", "=", "\"\"", "else", ":", "p", "=", "\":\"", "+", "self", ".", "port", "limit", "=", "self", ".", "domain", "+", "p", "+", "self", ".", "path", "if", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/http/cookiejar.py#L817-L825
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/bdf/cards/material_deps.py
python
MATT2.uncross_reference
(self)
Removes cross-reference links
Removes cross-reference links
[ "Removes", "cross", "-", "reference", "links" ]
def uncross_reference(self) -> None: """Removes cross-reference links""" self.mid = self.Mid() self.g11_table = self.G11_table() self.g12_table = self.G12_table() self.g13_table = self.G13_table() self.g22_table = self.G22_table() self.g23_table = self.G23_table()...
[ "def", "uncross_reference", "(", "self", ")", "->", "None", ":", "self", ".", "mid", "=", "self", ".", "Mid", "(", ")", "self", ".", "g11_table", "=", "self", ".", "G11_table", "(", ")", "self", ".", "g12_table", "=", "self", ".", "G12_table", "(", ...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/material_deps.py#L697-L714
Azure/azure-cli
6c1b085a0910c6c2139006fcbd8ade44006eb6dd
src/azure-cli/azure/cli/command_modules/apim/_format.py
python
_get_value_as_str
(item, *args)
Get a nested value from a dict. :param dict item: The dict object
Get a nested value from a dict. :param dict item: The dict object
[ "Get", "a", "nested", "value", "from", "a", "dict", ".", ":", "param", "dict", "item", ":", "The", "dict", "object" ]
def _get_value_as_str(item, *args): """Get a nested value from a dict. :param dict item: The dict object """ try: for arg in args: item = item[arg] return str(item) if item else ' ' except (KeyError, TypeError, IndexError): return ' '
[ "def", "_get_value_as_str", "(", "item", ",", "*", "args", ")", ":", "try", ":", "for", "arg", "in", "args", ":", "item", "=", "item", "[", "arg", "]", "return", "str", "(", "item", ")", "if", "item", "else", "' '", "except", "(", "KeyError", ",", ...
https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli/azure/cli/command_modules/apim/_format.py#L43-L52
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/docutils/writers/__init__.py
python
Writer.write
(self, document, destination)
return output
Process a document into its final form. Translate `document` (a Docutils document tree) into the Writer's native format, and write it out to its `destination` (a `docutils.io.Output` subclass object). Normally not overridden or extended in subclasses.
Process a document into its final form.
[ "Process", "a", "document", "into", "its", "final", "form", "." ]
def write(self, document, destination): """ Process a document into its final form. Translate `document` (a Docutils document tree) into the Writer's native format, and write it out to its `destination` (a `docutils.io.Output` subclass object). Normally not overridden o...
[ "def", "write", "(", "self", ",", "document", ",", "destination", ")", ":", "self", ".", "document", "=", "document", "self", ".", "language", "=", "languages", ".", "get_language", "(", "document", ".", "settings", ".", "language_code", ",", "document", "...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/docutils/writers/__init__.py#L65-L82
ceph/teuthology
6fc2011361437a9dfe4e45b50de224392eed8abc
teuthology/report.py
python
ResultsReporter.get_run
(self, run_name, fields=None)
return response.json()
Query the results server for a run :param run_name: The name of the run :param fields: Optional. A list of fields to include in the result. Defaults to returning all fields.
Query the results server for a run
[ "Query", "the", "results", "server", "for", "a", "run" ]
def get_run(self, run_name, fields=None): """ Query the results server for a run :param run_name: The name of the run :param fields: Optional. A list of fields to include in the result. Defaults to returning all fields. """ uri = "{base}/runs/{...
[ "def", "get_run", "(", "self", ",", "run_name", ",", "fields", "=", "None", ")", ":", "uri", "=", "\"{base}/runs/{name}\"", ".", "format", "(", "base", "=", "self", ".", "base_uri", ",", "name", "=", "run_name", ")", "if", "fields", ":", "uri", "+=", ...
https://github.com/ceph/teuthology/blob/6fc2011361437a9dfe4e45b50de224392eed8abc/teuthology/report.py#L376-L389
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/winobject/bits.py
python
BitsCopyCallbackSetEvent.JobError
(self, this, job, error)
return True
[]
def JobError(self, this, job, error): job = BitsCopyJob(job) error = BitsCopyError(error) errcode, errctx = error.error print("Copy failed with error code <{0:#x}> (ctx={1})".format(errcode, errctx)) print("see <https://msdn.microsoft.com/en-us/library/windows/desktop/aa362823(v=...
[ "def", "JobError", "(", "self", ",", "this", ",", "job", ",", "error", ")", ":", "job", "=", "BitsCopyJob", "(", "job", ")", "error", "=", "BitsCopyError", "(", "error", ")", "errcode", ",", "errctx", "=", "error", ".", "error", "print", "(", "\"Copy...
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winobject/bits.py#L48-L55
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/news/nntp.py
python
NNTPClient.fetchGroup
(self, group)
Get group information for the specified group from the server. gotGroup() is called on success, getGroupFailed() on failure.
Get group information for the specified group from the server. gotGroup() is called on success, getGroupFailed() on failure.
[ "Get", "group", "information", "for", "the", "specified", "group", "from", "the", "server", ".", "gotGroup", "()", "is", "called", "on", "success", "getGroupFailed", "()", "on", "failure", "." ]
def fetchGroup(self, group): """ Get group information for the specified group from the server. gotGroup() is called on success, getGroupFailed() on failure. """ self.sendLine('GROUP %s' % (group,)) self._newState(None, self.getGroupFailed, self._headerGroup)
[ "def", "fetchGroup", "(", "self", ",", "group", ")", ":", "self", ".", "sendLine", "(", "'GROUP %s'", "%", "(", "group", ",", ")", ")", "self", ".", "_newState", "(", "None", ",", "self", ".", "getGroupFailed", ",", "self", ".", "_headerGroup", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/news/nntp.py#L226-L232
pyscf/pyscf
0adfb464333f5ceee07b664f291d4084801bae64
pyscf/scf/hf.py
python
get_ovlp
(mol)
return mol.intor_symmetric('int1e_ovlp')
Overlap matrix
Overlap matrix
[ "Overlap", "matrix" ]
def get_ovlp(mol): '''Overlap matrix ''' return mol.intor_symmetric('int1e_ovlp')
[ "def", "get_ovlp", "(", "mol", ")", ":", "return", "mol", ".", "intor_symmetric", "(", "'int1e_ovlp'", ")" ]
https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/scf/hf.py#L327-L330
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3/codecs/pdf.py
python
S3html2pdf.parse
(self, html)
return result
Entry point for class
Entry point for class
[ "Entry", "point", "for", "class" ]
def parse(self, html): """ Entry point for class """ result = self.select_tag(html) return result
[ "def", "parse", "(", "self", ",", "html", ")", ":", "result", "=", "self", ".", "select_tag", "(", "html", ")", "return", "result" ]
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/codecs/pdf.py#L1834-L1840
bugcrowd/HUNT
ed3e1adee724bf6c98750f377f6c40cd656c82d3
Burp/lib/scanner_table_models.py
python
ScannerTableModels.set_scanner_table_model
(self, scanner_issue, issue_name, issue_param, vuln_param)
[]
def set_scanner_table_model(self, scanner_issue, issue_name, issue_param, vuln_param): key = issue_name + "." + vuln_param scanner_issue_id = str(scanner_issue.getRequestResponse()).split("@")[1] scanner_table_model = self.scanner_table_models[key] # Using the addRow() method requires t...
[ "def", "set_scanner_table_model", "(", "self", ",", "scanner_issue", ",", "issue_name", ",", "issue_param", ",", "vuln_param", ")", ":", "key", "=", "issue_name", "+", "\".\"", "+", "vuln_param", "scanner_issue_id", "=", "str", "(", "scanner_issue", ".", "getReq...
https://github.com/bugcrowd/HUNT/blob/ed3e1adee724bf6c98750f377f6c40cd656c82d3/Burp/lib/scanner_table_models.py#L26-L41
pinax/django-user-accounts
e83effdd4a23cd8d830169904c261ff6677ee3e6
account/auth_backends.py
python
EmailAuthenticationBackend.authenticate
(self, request, username=None, password=None, **kwargs)
Authenticate the user based email
Authenticate the user based email
[ "Authenticate", "the", "user", "based", "email" ]
def authenticate(self, request, username=None, password=None, **kwargs): """Authenticate the user based email""" qs = EmailAddress.objects.filter(Q(primary=True) | Q(verified=True)) if username is None or password is None: return None try: email_address = qs.get...
[ "def", "authenticate", "(", "self", ",", "request", ",", "username", "=", "None", ",", "password", "=", "None", ",", "*", "*", "kwargs", ")", ":", "qs", "=", "EmailAddress", ".", "objects", ".", "filter", "(", "Q", "(", "primary", "=", "True", ")", ...
https://github.com/pinax/django-user-accounts/blob/e83effdd4a23cd8d830169904c261ff6677ee3e6/account/auth_backends.py#L48-L62
wzzheng/HDML
fa03ef0eb0be2256df7aab928bcc596c41d44fb3
lib/nn_Ops.py
python
weight_variable
(shape, name, wd=True)
return weight
A function to create weight variables :param shape: The shape of weight :param name: The name of the weight :param wd: Whether or not this variable should be weight decade :return: A weight-variable
A function to create weight variables :param shape: The shape of weight :param name: The name of the weight :param wd: Whether or not this variable should be weight decade :return: A weight-variable
[ "A", "function", "to", "create", "weight", "variables", ":", "param", "shape", ":", "The", "shape", "of", "weight", ":", "param", "name", ":", "The", "name", "of", "the", "weight", ":", "param", "wd", ":", "Whether", "or", "not", "this", "variable", "s...
def weight_variable(shape, name, wd=True): """ A function to create weight variables :param shape: The shape of weight :param name: The name of the weight :param wd: Whether or not this variable should be weight decade :return: A weight-variable """ initializer = tf.glorot_uniform_initia...
[ "def", "weight_variable", "(", "shape", ",", "name", ",", "wd", "=", "True", ")", ":", "initializer", "=", "tf", ".", "glorot_uniform_initializer", "(", ")", "#tf.contrib.layers.xavier_initializer() # tf.truncated_normal_initializer(stddev=0.1)", "if", "wd", ":", "weig...
https://github.com/wzzheng/HDML/blob/fa03ef0eb0be2256df7aab928bcc596c41d44fb3/lib/nn_Ops.py#L10-L28
ialbert/biostar-central
2dc7bd30691a50b2da9c2833ba354056bc686afa
biostar/forum/markdown.py
python
BiostarInlineLexer.output_anchor_link
(self, m)
return f'<a href="{link}">{title}</a>'
[]
def output_anchor_link(self, m): uid = m.group("uid") link = m.group(0) post = Post.objects.filter(uid=uid).first() title = post.root.title if post else "Post not found" return f'<a href="{link}">{title}</a>'
[ "def", "output_anchor_link", "(", "self", ",", "m", ")", ":", "uid", "=", "m", ".", "group", "(", "\"uid\"", ")", "link", "=", "m", ".", "group", "(", "0", ")", "post", "=", "Post", ".", "objects", ".", "filter", "(", "uid", "=", "uid", ")", "....
https://github.com/ialbert/biostar-central/blob/2dc7bd30691a50b2da9c2833ba354056bc686afa/biostar/forum/markdown.py#L269-L274
openstack/trove
be86b79119d16ee77f596172f43b0c97cb2617bd
trove/guestagent/datastore/postgres/query.py
python
UserQuery.update_password
(cls, name, password, encrypt_password=None)
return cls.alter_user(name, password, encrypt_password)
Query to update the password for a user.
Query to update the password for a user.
[ "Query", "to", "update", "the", "password", "for", "a", "user", "." ]
def update_password(cls, name, password, encrypt_password=None): """Query to update the password for a user.""" return cls.alter_user(name, password, encrypt_password)
[ "def", "update_password", "(", "cls", ",", "name", ",", "password", ",", "encrypt_password", "=", "None", ")", ":", "return", "cls", ".", "alter_user", "(", "name", ",", "password", ",", "encrypt_password", ")" ]
https://github.com/openstack/trove/blob/be86b79119d16ee77f596172f43b0c97cb2617bd/trove/guestagent/datastore/postgres/query.py#L116-L119
tensorflow/kfac
fe90e36c3e0b42c73e4a34835a66f6d45e2a442d
kfac/python/ops/fisher_factors.py
python
ConvInputSUAKroneckerFactor.instantiate_inv_variables
(self)
Makes the internal "inverse" variable(s).
Makes the internal "inverse" variable(s).
[ "Makes", "the", "internal", "inverse", "variable", "(", "s", ")", "." ]
def instantiate_inv_variables(self): """Makes the internal "inverse" variable(s).""" for (exp, damping_id) in self._matpower_registrations: if exp != -1.: raise ValueError("ConvInputSUAKroneckerFactor only supports inverse" "computation") exp_string = scalar_or_ten...
[ "def", "instantiate_inv_variables", "(", "self", ")", ":", "for", "(", "exp", ",", "damping_id", ")", "in", "self", ".", "_matpower_registrations", ":", "if", "exp", "!=", "-", "1.", ":", "raise", "ValueError", "(", "\"ConvInputSUAKroneckerFactor only supports inv...
https://github.com/tensorflow/kfac/blob/fe90e36c3e0b42c73e4a34835a66f6d45e2a442d/kfac/python/ops/fisher_factors.py#L2247-L2293
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/exportimport/setupdata/__init__.py
python
Invoice_Batches.Import
(self)
[]
def Import(self): folder = self.context.invoices for row in self.get_rows(3): obj = _createObjectByType("InvoiceBatch", folder, tmpID()) if not row['title']: message = _("InvoiceBatch has no Title") raise Exception(t(message)) if not ro...
[ "def", "Import", "(", "self", ")", ":", "folder", "=", "self", ".", "context", ".", "invoices", "for", "row", "in", "self", ".", "get_rows", "(", "3", ")", ":", "obj", "=", "_createObjectByType", "(", "\"InvoiceBatch\"", ",", "folder", ",", "tmpID", "(...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/exportimport/setupdata/__init__.py#L2262-L2280
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/validators.py
python
InterimFieldsValidator.__call__
(self, value, *args, **kwargs)
return True
[]
def __call__(self, value, *args, **kwargs): instance = kwargs['instance'] fieldname = kwargs['field'].getName() request = kwargs.get('REQUEST', {}) form = request.form interim_fields = form.get(fieldname, []) translate = getToolByName(instance, 'translation_service').tra...
[ "def", "__call__", "(", "self", ",", "value", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "fieldname", "=", "kwargs", "[", "'field'", "]", ".", "getName", "(", ")", "request", "=", "kwargs",...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/validators.py#L247-L352
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
chap19/monitor/python-monitorclient-1.1/build/lib.linux-x86_64-2.7/monitorclient/openstack/common/memorycache.py
python
Client.incr
(self, key, delta=1)
return new_value
Increments the value for a key.
Increments the value for a key.
[ "Increments", "the", "value", "for", "a", "key", "." ]
def incr(self, key, delta=1): """Increments the value for a key.""" value = self.get(key) if value is None: return None new_value = int(value) + delta self.cache[key] = (self.cache[key][0], str(new_value)) return new_value
[ "def", "incr", "(", "self", ",", "key", ",", "delta", "=", "1", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "if", "value", "is", "None", ":", "return", "None", "new_value", "=", "int", "(", "value", ")", "+", "delta", "self", "...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/python-monitorclient-1.1/build/lib.linux-x86_64-2.7/monitorclient/openstack/common/memorycache.py#L84-L91