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
withdk/badusb2-mitm-poc
db2bfdb1dc9ad371aa665b292183c45577adfbaa
GoodFETMAXUSB.py
python
GoodFETMAXUSBHID.type_IN3
(self)
return
Type next letter in buffer.
Type next letter in buffer.
[ "Type", "next", "letter", "in", "buffer", "." ]
def type_IN3(self): """Type next letter in buffer.""" string=self.typestring(); if self.typepos>=len(string): self.typeletter(0); # Send NoEvent to indicate key-up exit(0); self.typepos=0; # Repeat typestring forever! # This would be a great place to enable a typethrough mode so the host operat...
[ "def", "type_IN3", "(", "self", ")", ":", "string", "=", "self", ".", "typestring", "(", ")", "if", "self", ".", "typepos", ">=", "len", "(", "string", ")", ":", "self", ".", "typeletter", "(", "0", ")", "# Send NoEvent to indicate key-up", "exit", "(", ...
https://github.com/withdk/badusb2-mitm-poc/blob/db2bfdb1dc9ad371aa665b292183c45577adfbaa/GoodFETMAXUSB.py#L1595-L1609
firewalld/firewalld
368e5a1e3eeff21ed55d4f2549836d45d8636ab5
src/firewall/core/logger.py
python
Logger.info
(self, level, _format, *args, **kwargs)
Information log using info level [1..info_max]. There are additional infox functions according to info_max from __init__
Information log using info level [1..info_max]. There are additional infox functions according to info_max from __init__
[ "Information", "log", "using", "info", "level", "[", "1", "..", "info_max", "]", ".", "There", "are", "additional", "infox", "functions", "according", "to", "info_max", "from", "__init__" ]
def info(self, level, _format, *args, **kwargs): """ Information log using info level [1..info_max]. There are additional infox functions according to info_max from __init__""" self._checkLogLevel(level, min_level=1, max_level=self.INFO_MAX) self._checkKWargs(kwargs) kwar...
[ "def", "info", "(", "self", ",", "level", ",", "_format", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_checkLogLevel", "(", "level", ",", "min_level", "=", "1", ",", "max_level", "=", "self", ".", "INFO_MAX", ")", "self", "."...
https://github.com/firewalld/firewalld/blob/368e5a1e3eeff21ed55d4f2549836d45d8636ab5/src/firewall/core/logger.py#L448-L455
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/data/batch.py
python
Batch.as_tensor_dict
( self, padding_lengths: Dict[str, Dict[str, int]] = None, verbose: bool = False, )
return { field_name: field_classes[field_name].batch_tensors(field_tensor_list) for field_name, field_tensor_list in field_tensors.items() }
This method converts this `Batch` into a set of pytorch Tensors that can be passed through a model. In order for the tensors to be valid tensors, all `Instances` in this batch need to be padded to the same lengths wherever padding is necessary, so we do that first, then we combine all of the te...
This method converts this `Batch` into a set of pytorch Tensors that can be passed through a model. In order for the tensors to be valid tensors, all `Instances` in this batch need to be padded to the same lengths wherever padding is necessary, so we do that first, then we combine all of the te...
[ "This", "method", "converts", "this", "Batch", "into", "a", "set", "of", "pytorch", "Tensors", "that", "can", "be", "passed", "through", "a", "model", ".", "In", "order", "for", "the", "tensors", "to", "be", "valid", "tensors", "all", "Instances", "in", ...
def as_tensor_dict( self, padding_lengths: Dict[str, Dict[str, int]] = None, verbose: bool = False, ) -> Dict[str, Union[torch.Tensor, Dict[str, torch.Tensor]]]: # This complex return type is actually predefined elsewhere as a DataArray, # but we can't use it because mypy doe...
[ "def", "as_tensor_dict", "(", "self", ",", "padding_lengths", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "int", "]", "]", "=", "None", ",", "verbose", ":", "bool", "=", "False", ",", ")", "->", "Dict", "[", "str", ",", "Union", "[", "...
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/data/batch.py#L85-L166
dbcli/mssql-cli
6509aa2fc226dde8ce6bab7af9cbb5f03717b936
mssqlcli/jsonrpc/jsonrpcclient.py
python
JsonRpcReader.try_read_headers
(self)
return True
Try to read the Header information from the internal buffer expecting the last header to contain '\r\n\r\n'. Exceptions: LookupError The content-length header was not found. ValueError The content-length contained a invalid literal for int.
Try to read the Header information from the internal buffer expecting the last header to contain '\r\n\r\n'. Exceptions: LookupError The content-length header was not found. ValueError The content-length contained a invalid literal for int.
[ "Try", "to", "read", "the", "Header", "information", "from", "the", "internal", "buffer", "expecting", "the", "last", "header", "to", "contain", "\\", "r", "\\", "n", "\\", "r", "\\", "n", ".", "Exceptions", ":", "LookupError", "The", "content", "-", "le...
def try_read_headers(self): """ Try to read the Header information from the internal buffer expecting the last header to contain '\r\n\r\n'. Exceptions: LookupError The content-length header was not found. ValueError The content-len...
[ "def", "try_read_headers", "(", "self", ")", ":", "# Scan the buffer up until right before the CRLFCRLF.", "scan_offset", "=", "self", ".", "read_offset", "while", "(", "scan_offset", "+", "3", "<", "self", ".", "buffer_end_offset", "and", "(", "self", ".", "buffer"...
https://github.com/dbcli/mssql-cli/blob/6509aa2fc226dde8ce6bab7af9cbb5f03717b936/mssqlcli/jsonrpc/jsonrpcclient.py#L334-L394
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.py
python
HTMLTokenizer.rcdataEndTagOpenState
(self)
return True
[]
def rcdataEndTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.temporaryBuffer += data self.state = self.rcdataEndTagNameState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"}) self.stream.unge...
[ "def", "rcdataEndTagOpenState", "(", "self", ")", ":", "data", "=", "self", ".", "stream", ".", "char", "(", ")", "if", "data", "in", "asciiLetters", ":", "self", ".", "temporaryBuffer", "+=", "data", "self", ".", "state", "=", "self", ".", "rcdataEndTag...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.py#L453-L462
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/pwiki/wikidata/FileStorage.py
python
FileStorage.moveFile
(srcPath, dstPath)
Copy file from srcPath to dstPath. dstPath my be overwritten if existing already.
Copy file from srcPath to dstPath. dstPath my be overwritten if existing already.
[ "Copy", "file", "from", "srcPath", "to", "dstPath", ".", "dstPath", "my", "be", "overwritten", "if", "existing", "already", "." ]
def moveFile(srcPath, dstPath): """ Copy file from srcPath to dstPath. dstPath my be overwritten if existing already. """ moveFile(srcPath, dstPath)
[ "def", "moveFile", "(", "srcPath", ",", "dstPath", ")", ":", "moveFile", "(", "srcPath", ",", "dstPath", ")" ]
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/wikidata/FileStorage.py#L318-L323
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/multiprocessing/sharedctypes.py
python
Array
(typecode_or_type, size_or_initializer, **kwds)
return synchronized(obj, lock)
Return a synchronization wrapper for a RawArray
Return a synchronization wrapper for a RawArray
[ "Return", "a", "synchronization", "wrapper", "for", "a", "RawArray" ]
def Array(typecode_or_type, size_or_initializer, **kwds): ''' Return a synchronization wrapper for a RawArray ''' lock = kwds.pop('lock', None) if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawArray(typecode_or_type, size_or_initializer) if loc...
[ "def", "Array", "(", "typecode_or_type", ",", "size_or_initializer", ",", "*", "*", "kwds", ")", ":", "lock", "=", "kwds", ".", "pop", "(", "'lock'", ",", "None", ")", "if", "kwds", ":", "raise", "ValueError", "(", "'unrecognized keyword argument(s): %s'", "...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/multiprocessing/sharedctypes.py#L113-L127
mne-tools/mne-python
f90b303ce66a8415e64edd4605b09ac0179c1ebf
mne/channels/montage.py
python
compute_dev_head_t
(montage)
return Transform(fro='meg', to='head', trans=trans)
Compute device to head transform from a DigMontage. Parameters ---------- montage : instance of DigMontage The DigMontage must contain the fiducials in head coordinate system and hpi points in both head and meg device coordinate system. Returns ------- dev_head_t : inst...
Compute device to head transform from a DigMontage.
[ "Compute", "device", "to", "head", "transform", "from", "a", "DigMontage", "." ]
def compute_dev_head_t(montage): """Compute device to head transform from a DigMontage. Parameters ---------- montage : instance of DigMontage The DigMontage must contain the fiducials in head coordinate system and hpi points in both head and meg device coordinate system. R...
[ "def", "compute_dev_head_t", "(", "montage", ")", ":", "_", ",", "coord_frame", "=", "_get_fid_coords", "(", "montage", ".", "dig", ")", "if", "coord_frame", "!=", "FIFF", ".", "FIFFV_COORD_HEAD", ":", "raise", "ValueError", "(", "'montage should have been set to ...
https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/channels/montage.py#L1408-L1445
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vod/v20180717/models.py
python
SortBy.__init__
(self)
r""" :param Field: 排序字段 :type Field: str :param Order: 排序方式,可选值:Asc(升序)、Desc(降序) :type Order: str
r""" :param Field: 排序字段 :type Field: str :param Order: 排序方式,可选值:Asc(升序)、Desc(降序) :type Order: str
[ "r", ":", "param", "Field", ":", "排序字段", ":", "type", "Field", ":", "str", ":", "param", "Order", ":", "排序方式,可选值:Asc(升序)、Desc(降序)", ":", "type", "Order", ":", "str" ]
def __init__(self): r""" :param Field: 排序字段 :type Field: str :param Order: 排序方式,可选值:Asc(升序)、Desc(降序) :type Order: str """ self.Field = None self.Order = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Field", "=", "None", "self", ".", "Order", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vod/v20180717/models.py#L19832-L19840
scikit-multilearn/scikit-multilearn
4733443b9cbb30f7f1ee7352caf38ce38cfc6163
skmultilearn/adapt/mlknn.py
python
MLkNN._compute_prior
(self, y)
return (prior_prob_true, prior_prob_false)
Helper function to compute for the prior probabilities Parameters ---------- y : numpy.ndarray or scipy.sparse the training labels Returns ------- numpy.ndarray the prior probability given true numpy.ndarray the prior probabil...
Helper function to compute for the prior probabilities
[ "Helper", "function", "to", "compute", "for", "the", "prior", "probabilities" ]
def _compute_prior(self, y): """Helper function to compute for the prior probabilities Parameters ---------- y : numpy.ndarray or scipy.sparse the training labels Returns ------- numpy.ndarray the prior probability given true nump...
[ "def", "_compute_prior", "(", "self", ",", "y", ")", ":", "prior_prob_true", "=", "np", ".", "array", "(", "(", "self", ".", "s", "+", "y", ".", "sum", "(", "axis", "=", "0", ")", ")", "/", "(", "self", ".", "s", "*", "2", "+", "self", ".", ...
https://github.com/scikit-multilearn/scikit-multilearn/blob/4733443b9cbb30f7f1ee7352caf38ce38cfc6163/skmultilearn/adapt/mlknn.py#L126-L144
apache/bloodhound
c3e31294e68af99d4e040e64fbdf52394344df9e
trac/trac/util/text.py
python
unicode_unquote
(value)
return unquote(value).decode('utf-8')
A unicode aware version of `urllib.unquote`. :param str: UTF-8 encoded `str` value (for example, as obtained by `unicode_quote`). :rtype: `unicode`
A unicode aware version of `urllib.unquote`.
[ "A", "unicode", "aware", "version", "of", "urllib", ".", "unquote", "." ]
def unicode_unquote(value): """A unicode aware version of `urllib.unquote`. :param str: UTF-8 encoded `str` value (for example, as obtained by `unicode_quote`). :rtype: `unicode` """ return unquote(value).decode('utf-8')
[ "def", "unicode_unquote", "(", "value", ")", ":", "return", "unquote", "(", "value", ")", ".", "decode", "(", "'utf-8'", ")" ]
https://github.com/apache/bloodhound/blob/c3e31294e68af99d4e040e64fbdf52394344df9e/trac/trac/util/text.py#L187-L194
intrig-unicamp/mininet-wifi
3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba
mn_wifi/sumo/traci/_vehicle.py
python
VehicleDomain.getMinGapLat
(self, vehID)
return self._getUniversal(tc.VAR_MINGAP_LAT, vehID)
getMinGapLat(string) -> double Returns The desired lateral gap of this vehicle at 50km/h in m
getMinGapLat(string) -> double Returns The desired lateral gap of this vehicle at 50km/h in m
[ "getMinGapLat", "(", "string", ")", "-", ">", "double", "Returns", "The", "desired", "lateral", "gap", "of", "this", "vehicle", "at", "50km", "/", "h", "in", "m" ]
def getMinGapLat(self, vehID): """getMinGapLat(string) -> double Returns The desired lateral gap of this vehicle at 50km/h in m """ return self._getUniversal(tc.VAR_MINGAP_LAT, vehID)
[ "def", "getMinGapLat", "(", "self", ",", "vehID", ")", ":", "return", "self", ".", "_getUniversal", "(", "tc", ".", "VAR_MINGAP_LAT", ",", "vehID", ")" ]
https://github.com/intrig-unicamp/mininet-wifi/blob/3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba/mn_wifi/sumo/traci/_vehicle.py#L421-L425
librahfacebook/Detection
84504d086634950224716f4de0e4c8a684493c34
object_detection/utils/np_mask_ops.py
python
area
(masks)
return np.sum(masks, axis=(1, 2), dtype=np.float32)
Computes area of masks. Args: masks: Numpy array with shape [N, height, width] holding N masks. Masks values are of type np.uint8 and values are in {0,1}. Returns: a numpy array with shape [N*1] representing mask areas. Raises: ValueError: If masks.dtype is not np.uint8
Computes area of masks.
[ "Computes", "area", "of", "masks", "." ]
def area(masks): """Computes area of masks. Args: masks: Numpy array with shape [N, height, width] holding N masks. Masks values are of type np.uint8 and values are in {0,1}. Returns: a numpy array with shape [N*1] representing mask areas. Raises: ValueError: If masks.dtype is not np.uint8 ...
[ "def", "area", "(", "masks", ")", ":", "if", "masks", ".", "dtype", "!=", "np", ".", "uint8", ":", "raise", "ValueError", "(", "'Masks type should be np.uint8'", ")", "return", "np", ".", "sum", "(", "masks", ",", "axis", "=", "(", "1", ",", "2", ")"...
https://github.com/librahfacebook/Detection/blob/84504d086634950224716f4de0e4c8a684493c34/object_detection/utils/np_mask_ops.py#L27-L42
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/core/serializers/xml_serializer.py
python
Serializer.handle_fk_field
(self, obj, field)
Called to handle a ForeignKey (we need to treat them slightly differently from regular fields).
Called to handle a ForeignKey (we need to treat them slightly differently from regular fields).
[ "Called", "to", "handle", "a", "ForeignKey", "(", "we", "need", "to", "treat", "them", "slightly", "differently", "from", "regular", "fields", ")", "." ]
def handle_fk_field(self, obj, field): """ Called to handle a ForeignKey (we need to treat them slightly differently from regular fields). """ self._start_relational_field(field) related_att = getattr(obj, field.get_attname()) if related_att is not None: ...
[ "def", "handle_fk_field", "(", "self", ",", "obj", ",", "field", ")", ":", "self", ".", "_start_relational_field", "(", "field", ")", "related_att", "=", "getattr", "(", "obj", ",", "field", ".", "get_attname", "(", ")", ")", "if", "related_att", "is", "...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/core/serializers/xml_serializer.py#L93-L114
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/mlab.py
python
dist_point_to_segment
(p, s0, s1)
return dist(p, pb)
Get the distance of a point to a segment. *p*, *s0*, *s1* are *xy* sequences This algorithm from http://geomalgorithms.com/a02-_lines.html
Get the distance of a point to a segment.
[ "Get", "the", "distance", "of", "a", "point", "to", "a", "segment", "." ]
def dist_point_to_segment(p, s0, s1): """ Get the distance of a point to a segment. *p*, *s0*, *s1* are *xy* sequences This algorithm from http://geomalgorithms.com/a02-_lines.html """ p = np.asarray(p, float) s0 = np.asarray(s0, float) s1 = np.asarray(s1, float) v = s1 - s0 ...
[ "def", "dist_point_to_segment", "(", "p", ",", "s0", ",", "s1", ")", ":", "p", "=", "np", ".", "asarray", "(", "p", ",", "float", ")", "s0", "=", "np", ".", "asarray", "(", "s0", ",", "float", ")", "s1", "=", "np", ".", "asarray", "(", "s1", ...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/mlab.py#L1904-L1929
python/mypy
17850b3bd77ae9efb5d21f656c4e4e05ac48d894
mypy/semanal_infer.py
python
calculate_return_type
(expr: Expression)
return None
Return the return type if we can calculate it. This only uses information available during semantic analysis so this will sometimes return None because of insufficient information (as type inference hasn't run yet).
Return the return type if we can calculate it.
[ "Return", "the", "return", "type", "if", "we", "can", "calculate", "it", "." ]
def calculate_return_type(expr: Expression) -> Optional[ProperType]: """Return the return type if we can calculate it. This only uses information available during semantic analysis so this will sometimes return None because of insufficient information (as type inference hasn't run yet). """ if ...
[ "def", "calculate_return_type", "(", "expr", ":", "Expression", ")", "->", "Optional", "[", "ProperType", "]", ":", "if", "isinstance", "(", "expr", ",", "RefExpr", ")", ":", "if", "isinstance", "(", "expr", ".", "node", ",", "FuncDef", ")", ":", "typ", ...
https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/semanal_infer.py#L75-L96
brjathu/deepcaps
c2f3be37c311028a5ef51f3ea5b942cab3a6d069
capslayers.py
python
Conv2DCaps.__init__
(self, ch_j, n_j, kernel_size=(3, 3), strides=(1, 1), r_num=1, b_alphas=[8, 8, 8], padding='same', data_format='channels_last', dilation_rate=(1, 1), kernel_initializer='glorot_uniform...
[]
def __init__(self, ch_j, n_j, kernel_size=(3, 3), strides=(1, 1), r_num=1, b_alphas=[8, 8, 8], padding='same', data_format='channels_last', dilation_rate=(1, 1), kernel_initializer='gl...
[ "def", "__init__", "(", "self", ",", "ch_j", ",", "n_j", ",", "kernel_size", "=", "(", "3", ",", "3", ")", ",", "strides", "=", "(", "1", ",", "1", ")", ",", "r_num", "=", "1", ",", "b_alphas", "=", "[", "8", ",", "8", ",", "8", "]", ",", ...
https://github.com/brjathu/deepcaps/blob/c2f3be37c311028a5ef51f3ea5b942cab3a6d069/capslayers.py#L78-L109
usb-tools/Facedancer
e688fe61dc34087db333432394e1f90e52ac3794
legacy-applets/USBMassStorage.py
python
DiskImage.get_sector_data
(self, address)
Returns the raw binary data for a given sector.
Returns the raw binary data for a given sector.
[ "Returns", "the", "raw", "binary", "data", "for", "a", "given", "sector", "." ]
def get_sector_data(self, address): """ Returns the raw binary data for a given sector. """ raise NotImplementedError()
[ "def", "get_sector_data", "(", "self", ",", "address", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/usb-tools/Facedancer/blob/e688fe61dc34087db333432394e1f90e52ac3794/legacy-applets/USBMassStorage.py#L457-L459
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-50/fabmetheus_utilities/geometry/geometry_utilities/boolean_solid.py
python
getInsetPointsByInsetLoops
( insetLoops, inside, loops, radius )
return insetPointsByInsetLoops
Get the inset points of the inset loops inside the loops.
Get the inset points of the inset loops inside the loops.
[ "Get", "the", "inset", "points", "of", "the", "inset", "loops", "inside", "the", "loops", "." ]
def getInsetPointsByInsetLoops( insetLoops, inside, loops, radius ): 'Get the inset points of the inset loops inside the loops.' insetPointsByInsetLoops = [] for insetLoop in insetLoops: insetPointsByInsetLoops += getInsetPointsByInsetLoop( insetLoop, inside, loops, radius ) return insetPointsByInsetLoops
[ "def", "getInsetPointsByInsetLoops", "(", "insetLoops", ",", "inside", ",", "loops", ",", "radius", ")", ":", "insetPointsByInsetLoops", "=", "[", "]", "for", "insetLoop", "in", "insetLoops", ":", "insetPointsByInsetLoops", "+=", "getInsetPointsByInsetLoop", "(", "i...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/geometry/geometry_utilities/boolean_solid.py#L104-L109
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/gdata/tlslite/mathtls.py
python
MAC_SSL.__init__
(self, key, msg = None, digestmod = None)
Create a new MAC_SSL object. key: key for the keyed hash object. msg: Initial input for the hash, if provided. digestmod: A module supporting PEP 247. Defaults to the md5 module.
Create a new MAC_SSL object.
[ "Create", "a", "new", "MAC_SSL", "object", "." ]
def __init__(self, key, msg = None, digestmod = None): """Create a new MAC_SSL object. key: key for the keyed hash object. msg: Initial input for the hash, if provided. digestmod: A module supporting PEP 247. Defaults to the md5 module. """ if digestmod is No...
[ "def", "__init__", "(", "self", ",", "key", ",", "msg", "=", "None", ",", "digestmod", "=", "None", ")", ":", "if", "digestmod", "is", "None", ":", "import", "md5", "digestmod", "=", "md5", "if", "key", "==", "None", ":", "#TREVNEW - for faster copying",...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/gdata/tlslite/mathtls.py#L108-L135
lingtengqiu/Deeperlab-pytorch
5c500780a6655ff343d147477402aa20e0ed7a7c
seg_opr/loss_opr.py
python
SigmoidFocalLoss.__init__
(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean')
[]
def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha self.reduction = reduction
[ "def", "__init__", "(", "self", ",", "ignore_label", ",", "gamma", "=", "2.0", ",", "alpha", "=", "0.25", ",", "reduction", "=", "'mean'", ")", ":", "super", "(", "SigmoidFocalLoss", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "ignore_lab...
https://github.com/lingtengqiu/Deeperlab-pytorch/blob/5c500780a6655ff343d147477402aa20e0ed7a7c/seg_opr/loss_opr.py#L14-L20
apeterswu/RL4NMT
3c66a2d8142abc5ce73db63e05d3cc9bf4663b65
tensor2tensor/utils/usr_dir.py
python
import_usr_dir
(usr_dir)
Import module at usr_dir, if provided.
Import module at usr_dir, if provided.
[ "Import", "module", "at", "usr_dir", "if", "provided", "." ]
def import_usr_dir(usr_dir): """Import module at usr_dir, if provided.""" if not usr_dir: return dir_path = os.path.expanduser(usr_dir) if dir_path[-1] == "/": dir_path = dir_path[:-1] containing_dir, module_name = os.path.split(dir_path) tf.logging.info("Importing user module %s from path %s", modu...
[ "def", "import_usr_dir", "(", "usr_dir", ")", ":", "if", "not", "usr_dir", ":", "return", "dir_path", "=", "os", ".", "path", ".", "expanduser", "(", "usr_dir", ")", "if", "dir_path", "[", "-", "1", "]", "==", "\"/\"", ":", "dir_path", "=", "dir_path",...
https://github.com/apeterswu/RL4NMT/blob/3c66a2d8142abc5ce73db63e05d3cc9bf4663b65/tensor2tensor/utils/usr_dir.py#L30-L42
oaubert/python-vlc
908ffdbd0844dc1849728c456e147788798c99da
generated/2.2/vlc.py
python
MediaListPlayer.retain
(self)
return libvlc_media_list_player_retain(self)
Retain a reference to a media player list object. Use L{release}() to decrement reference count.
Retain a reference to a media player list object. Use L{release}() to decrement reference count.
[ "Retain", "a", "reference", "to", "a", "media", "player", "list", "object", ".", "Use", "L", "{", "release", "}", "()", "to", "decrement", "reference", "count", "." ]
def retain(self): '''Retain a reference to a media player list object. Use L{release}() to decrement reference count. ''' return libvlc_media_list_player_retain(self)
[ "def", "retain", "(", "self", ")", ":", "return", "libvlc_media_list_player_retain", "(", "self", ")" ]
https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/2.2/vlc.py#L2572-L2576
jjjake/internetarchive
7b0472464b065477101a847a8332d8b4dc1bf74e
internetarchive/api.py
python
get_session
(config=None, config_file=None, debug=None, http_adapter_kwargs=None)
return session.ArchiveSession(config, config_file, debug, http_adapter_kwargs)
Return a new :class:`ArchiveSession` object. The :class:`ArchiveSession` object is the main interface to the ``internetarchive`` lib. It allows you to persist certain parameters across tasks. :type config: dict :param config: (optional) A dictionary used to configure your session. :type config_fil...
Return a new :class:`ArchiveSession` object. The :class:`ArchiveSession` object is the main interface to the ``internetarchive`` lib. It allows you to persist certain parameters across tasks.
[ "Return", "a", "new", ":", "class", ":", "ArchiveSession", "object", ".", "The", ":", "class", ":", "ArchiveSession", "object", "is", "the", "main", "interface", "to", "the", "internetarchive", "lib", ".", "It", "allows", "you", "to", "persist", "certain", ...
def get_session(config=None, config_file=None, debug=None, http_adapter_kwargs=None): """Return a new :class:`ArchiveSession` object. The :class:`ArchiveSession` object is the main interface to the ``internetarchive`` lib. It allows you to persist certain parameters across tasks. :type config: dict ...
[ "def", "get_session", "(", "config", "=", "None", ",", "config_file", "=", "None", ",", "debug", "=", "None", ",", "http_adapter_kwargs", "=", "None", ")", ":", "return", "session", ".", "ArchiveSession", "(", "config", ",", "config_file", ",", "debug", ",...
https://github.com/jjjake/internetarchive/blob/7b0472464b065477101a847a8332d8b4dc1bf74e/internetarchive/api.py#L41-L75
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/core/grr_response_core/lib/rdfvalues/structs.py
python
ProtoType.SetOwner
(self, owner)
[]
def SetOwner(self, owner): self.owner = owner
[ "def", "SetOwner", "(", "self", ",", "owner", ")", ":", "self", ".", "owner", "=", "owner" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/lib/rdfvalues/structs.py#L314-L315
ospalh/anki-addons
4ece13423bd541e29d9b40ebe26ca0999a6962b1
play_button/__init__.py
python
reduce_format_qa
(self, text)
return original_format_qa(self, unicode(soup))
Remove elements with a given class before displaying.
Remove elements with a given class before displaying.
[ "Remove", "elements", "with", "a", "given", "class", "before", "displaying", "." ]
def reduce_format_qa(self, text): """Remove elements with a given class before displaying.""" soup = BeautifulSoup(text, 'html.parser') for hide in soup.findAll(True, {'class': re.compile( '\\b' + hide_class_name + '\\b')}): hide.extract() return original_format_qa(self, unicode(soup...
[ "def", "reduce_format_qa", "(", "self", ",", "text", ")", ":", "soup", "=", "BeautifulSoup", "(", "text", ",", "'html.parser'", ")", "for", "hide", "in", "soup", ".", "findAll", "(", "True", ",", "{", "'class'", ":", "re", ".", "compile", "(", "'\\\\b'...
https://github.com/ospalh/anki-addons/blob/4ece13423bd541e29d9b40ebe26ca0999a6962b1/play_button/__init__.py#L125-L131
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/rsa-3.4.2/rsa/cli.py
python
SignOperation.perform_operation
(self, indata, priv_key, cli_args)
return rsa.sign(indata, priv_key, hash_method)
Signs files.
Signs files.
[ "Signs", "files", "." ]
def perform_operation(self, indata, priv_key, cli_args): """Signs files.""" hash_method = cli_args[1] if hash_method not in HASH_METHODS: raise SystemExit('Invalid hash method, choose one of %s' % ', '.join(HASH_METHODS)) return rsa.sign(indata,...
[ "def", "perform_operation", "(", "self", ",", "indata", ",", "priv_key", ",", "cli_args", ")", ":", "hash_method", "=", "cli_args", "[", "1", "]", "if", "hash_method", "not", "in", "HASH_METHODS", ":", "raise", "SystemExit", "(", "'Invalid hash method, choose on...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/rsa-3.4.2/rsa/cli.py#L247-L255
partho-maple/coding-interview-gym
f9b28916da31935a27900794cfb8b91be3b38b9b
leetcode.com/python/70_Climbing_Stairs.py
python
Solution.climbStairsHelper
(self, n, memo)
return oneStepCounter + twoStepCounter
:type n: int :rtype: int
:type n: int :rtype: int
[ ":", "type", "n", ":", "int", ":", "rtype", ":", "int" ]
def climbStairsHelper(self, n, memo): """ :type n: int :rtype: int """ if n == 0: memo[n] = 0 return 0 elif n == 1: memo[n] = 1 return 1 elif n == 2: memo[n] = 2 return 2 if n - 1 in m...
[ "def", "climbStairsHelper", "(", "self", ",", "n", ",", "memo", ")", ":", "if", "n", "==", "0", ":", "memo", "[", "n", "]", "=", "0", "return", "0", "elif", "n", "==", "1", ":", "memo", "[", "n", "]", "=", "1", "return", "1", "elif", "n", "...
https://github.com/partho-maple/coding-interview-gym/blob/f9b28916da31935a27900794cfb8b91be3b38b9b/leetcode.com/python/70_Climbing_Stairs.py#L10-L34
datawire/forge
d501be4571dcef5691804c7db7008ee877933c8d
forge/executor.py
python
Result.is_signal
(self, (filename, lineno, funcname, text))
return True
[]
def is_signal(self, (filename, lineno, funcname, text)): noise = {"forge/executor.py": ("run", "do_run", "_capture_stack"), "forge/tasks.py": ("go", "__call__"), "eventlet/greenthread.py": ("main",)} for k, v in noise.items(): if filename.endswith(k) and fun...
[ "def", "is_signal", "(", "self", ",", "(", "filename", ",", "lineno", ",", "funcname", ",", "text", ")", ")", ":", "noise", "=", "{", "\"forge/executor.py\"", ":", "(", "\"run\"", ",", "\"do_run\"", ",", "\"_capture_stack\"", ")", ",", "\"forge/tasks.py\"", ...
https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/forge/executor.py#L126-L133
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/core_v1_api.py
python
CoreV1Api.patch_namespaced_pod_with_http_info
(self, name, namespace, body, **kwargs)
return self.api_client.call_api( '/api/v1/namespaces/{namespace}/pods/{name}', 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='V1Pod', # no...
patch_namespaced_pod # noqa: E501 partially update the specified Pod # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_pod_with_http_info(name, namespace, body, async...
patch_namespaced_pod # noqa: E501
[ "patch_namespaced_pod", "#", "noqa", ":", "E501" ]
def patch_namespaced_pod_with_http_info(self, name, namespace, body, **kwargs): # noqa: E501 """patch_namespaced_pod # noqa: E501 partially update the specified Pod # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass...
[ "def", "patch_namespaced_pod_with_http_info", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "local_var_params", "=", "locals", "(", ")", "all_params", "=", "[", "'name'", ",", "'namespace'", ",", ...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/core_v1_api.py#L19349-L19472
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/packages/bundled/django/db/models/query.py
python
QuerySet._fill_cache
(self, num=None)
Fills the result cache with 'num' more entries (or until the results iterator is exhausted).
Fills the result cache with 'num' more entries (or until the results iterator is exhausted).
[ "Fills", "the", "result", "cache", "with", "num", "more", "entries", "(", "or", "until", "the", "results", "iterator", "is", "exhausted", ")", "." ]
def _fill_cache(self, num=None): """ Fills the result cache with 'num' more entries (or until the results iterator is exhausted). """ if self._iter: try: for i in range(num or ITER_CHUNK_SIZE): self._result_cache.append(next(self._i...
[ "def", "_fill_cache", "(", "self", ",", "num", "=", "None", ")", ":", "if", "self", ".", "_iter", ":", "try", ":", "for", "i", "in", "range", "(", "num", "or", "ITER_CHUNK_SIZE", ")", ":", "self", ".", "_result_cache", ".", "append", "(", "next", "...
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/db/models/query.py#L919-L929
lmb-freiburg/hand3d
9f0063391e7075cf4ab1e4edd0461d38213a3fd6
utils/canonical_trafo.py
python
_get_rot_mat_x
(angle)
return trafo_matrix
Returns a 3D rotation matrix.
Returns a 3D rotation matrix.
[ "Returns", "a", "3D", "rotation", "matrix", "." ]
def _get_rot_mat_x(angle): """ Returns a 3D rotation matrix. """ one_vec = tf.ones_like(angle) zero_vec = one_vec*0.0 trafo_matrix = _stitch_mat_from_vecs([one_vec, zero_vec, zero_vec, zero_vec, tf.cos(angle), tf.sin(angle), ...
[ "def", "_get_rot_mat_x", "(", "angle", ")", ":", "one_vec", "=", "tf", ".", "ones_like", "(", "angle", ")", "zero_vec", "=", "one_vec", "*", "0.0", "trafo_matrix", "=", "_stitch_mat_from_vecs", "(", "[", "one_vec", ",", "zero_vec", ",", "zero_vec", ",", "z...
https://github.com/lmb-freiburg/hand3d/blob/9f0063391e7075cf4ab1e4edd0461d38213a3fd6/utils/canonical_trafo.py#L64-L71
SPFlow/SPFlow
68ce7dac0f41bd3cf86ccb56555a29ef1368fe69
src/spn/experiments/RandomSPNs_layerwise/train_mnist.py
python
make_spn
(S, I, R, D, dropout, device)
return model
Construct the RatSpn
Construct the RatSpn
[ "Construct", "the", "RatSpn" ]
def make_spn(S, I, R, D, dropout, device) -> RatSpn: """Construct the RatSpn""" # Setup RatSpnConfig config = RatSpnConfig() config.F = 28 ** 2 config.R = R config.D = D config.I = I config.S = S config.C = 10 config.dropout = dropout config.leaf_base_class = RatNormal c...
[ "def", "make_spn", "(", "S", ",", "I", ",", "R", ",", "D", ",", "dropout", ",", "device", ")", "->", "RatSpn", ":", "# Setup RatSpnConfig", "config", "=", "RatSpnConfig", "(", ")", "config", ".", "F", "=", "28", "**", "2", "config", ".", "R", "=", ...
https://github.com/SPFlow/SPFlow/blob/68ce7dac0f41bd3cf86ccb56555a29ef1368fe69/src/spn/experiments/RandomSPNs_layerwise/train_mnist.py#L87-L109
facebookresearch/ParlAI
e4d59c30eef44f1f67105961b82a83fd28d7d78b
parlai/core/metrics.py
python
Metrics.clear
(self)
Clear all the metrics.
Clear all the metrics.
[ "Clear", "all", "the", "metrics", "." ]
def clear(self): """ Clear all the metrics. """ self._data.clear() self._recent_data.clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_data", ".", "clear", "(", ")", "self", ".", "_recent_data", ".", "clear", "(", ")" ]
https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/core/metrics.py#L928-L933
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/toric/variety.py
python
CohomologyRing._repr_
(self)
return f'Rational cohomology ring of a {self._variety._repr_()}'
r""" Return a string representation of the cohomology ring. OUTPUT: A string. EXAMPLES:: sage: toric_varieties.P2().cohomology_ring()._repr_() 'Rational cohomology ring of a 2-d CPR-Fano toric variety covered by 3 affine patches'
r""" Return a string representation of the cohomology ring.
[ "r", "Return", "a", "string", "representation", "of", "the", "cohomology", "ring", "." ]
def _repr_(self): r""" Return a string representation of the cohomology ring. OUTPUT: A string. EXAMPLES:: sage: toric_varieties.P2().cohomology_ring()._repr_() 'Rational cohomology ring of a 2-d CPR-Fano toric variety covered by 3 affine patches' ...
[ "def", "_repr_", "(", "self", ")", ":", "return", "f'Rational cohomology ring of a {self._variety._repr_()}'" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/toric/variety.py#L3165-L3178
cltk/cltk
1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1
src/cltk/prosody/lat/verse_scanner.py
python
VerseScanner.transform_i_to_j
(self, line: str)
return "".join(char_list)
Transform instances of consonantal i to j :param line: :return: >>> print(VerseScanner().transform_i_to_j("iactātus")) jactātus >>> print(VerseScanner().transform_i_to_j("bracchia")) bracchia
Transform instances of consonantal i to j :param line: :return:
[ "Transform", "instances", "of", "consonantal", "i", "to", "j", ":", "param", "line", ":", ":", "return", ":" ]
def transform_i_to_j(self, line: str) -> str: """ Transform instances of consonantal i to j :param line: :return: >>> print(VerseScanner().transform_i_to_j("iactātus")) jactātus >>> print(VerseScanner().transform_i_to_j("bracchia")) bracchia """ ...
[ "def", "transform_i_to_j", "(", "self", ",", "line", ":", "str", ")", "->", "str", ":", "words", "=", "line", ".", "split", "(", "\" \"", ")", "space_list", "=", "string_utils", ".", "space_list", "(", "line", ")", "corrected_words", "=", "[", "]", "fo...
https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/prosody/lat/verse_scanner.py#L61-L107
evilhero/mylar
dbee01d7e48e8c717afa01b2de1946c5d0b956cb
lib/transmissionrpc/client.py
python
Client.get_files
(self, ids=None, timeout=None)
return result
Get list of files for provided torrent id(s). If ids is empty, information for all torrents are fetched. This function returns a dictionary for each requested torrent id holding the information about the files. :: { <torrent id>: { <file id>: { 'name': <file name>, ...
Get list of files for provided torrent id(s). If ids is empty, information for all torrents are fetched. This function returns a dictionary for each requested torrent id holding the information about the files.
[ "Get", "list", "of", "files", "for", "provided", "torrent", "id", "(", "s", ")", ".", "If", "ids", "is", "empty", "information", "for", "all", "torrents", "are", "fetched", ".", "This", "function", "returns", "a", "dictionary", "for", "each", "requested", ...
def get_files(self, ids=None, timeout=None): """ Get list of files for provided torrent id(s). If ids is empty, information for all torrents are fetched. This function returns a dictionary for each requested torrent id holding the information about the files. :: { <torrent id>...
[ "def", "get_files", "(", "self", ",", "ids", "=", "None", ",", "timeout", "=", "None", ")", ":", "fields", "=", "[", "'id'", ",", "'name'", ",", "'hashString'", ",", "'files'", ",", "'priorities'", ",", "'wanted'", "]", "request_result", "=", "self", "...
https://github.com/evilhero/mylar/blob/dbee01d7e48e8c717afa01b2de1946c5d0b956cb/lib/transmissionrpc/client.py#L610-L639
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/external/jinja2/compiler.py
python
DependencyFinderVisitor.visit_Block
(self, node)
Stop visiting at blocks.
Stop visiting at blocks.
[ "Stop", "visiting", "at", "blocks", "." ]
def visit_Block(self, node): """Stop visiting at blocks."""
[ "def", "visit_Block", "(", "self", ",", "node", ")", ":" ]
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/external/jinja2/compiler.py#L214-L215
python-gino/gino
968e8da3e92dfc071390261e6ab7e274bf0c3268
src/gino/transaction.py
python
GinoTransaction.commit
(self)
Only available in manual mode: manually commit this transaction.
Only available in manual mode: manually commit this transaction.
[ "Only", "available", "in", "manual", "mode", ":", "manually", "commit", "this", "transaction", "." ]
async def commit(self): """ Only available in manual mode: manually commit this transaction. """ if self._managed: raise AssertionError( "Illegal in managed mode, " "use `raise_commit` instead." ) await self._tx.commit()
[ "async", "def", "commit", "(", "self", ")", ":", "if", "self", ".", "_managed", ":", "raise", "AssertionError", "(", "\"Illegal in managed mode, \"", "\"use `raise_commit` instead.\"", ")", "await", "self", ".", "_tx", ".", "commit", "(", ")" ]
https://github.com/python-gino/gino/blob/968e8da3e92dfc071390261e6ab7e274bf0c3268/src/gino/transaction.py#L121-L130
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/helpers/entity_registry.py
python
async_get_registry
(hass: HomeAssistant)
return async_get(hass)
Get entity registry. This is deprecated and will be removed in the future. Use async_get instead.
Get entity registry.
[ "Get", "entity", "registry", "." ]
async def async_get_registry(hass: HomeAssistant) -> EntityRegistry: """Get entity registry. This is deprecated and will be removed in the future. Use async_get instead. """ return async_get(hass)
[ "async", "def", "async_get_registry", "(", "hass", ":", "HomeAssistant", ")", "->", "EntityRegistry", ":", "return", "async_get", "(", "hass", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/entity_registry.py#L677-L682
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/client/grr_response_client/streaming.py
python
MemoryReader.offset
(self)
return self._offset
[]
def offset(self): return self._offset
[ "def", "offset", "(", "self", ")", ":", "return", "self", ".", "_offset" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/client/grr_response_client/streaming.py#L277-L278
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/urllib3-1.25.8/src/urllib3/util/timeout.py
python
Timeout.get_connect_duration
(self)
return current_time() - self._start_connect
Gets the time elapsed since the call to :meth:`start_connect`. :return: Elapsed time in seconds. :rtype: float :raises urllib3.exceptions.TimeoutStateError: if you attempt to get duration for a timer that hasn't been started.
Gets the time elapsed since the call to :meth:`start_connect`.
[ "Gets", "the", "time", "elapsed", "since", "the", "call", "to", ":", "meth", ":", "start_connect", "." ]
def get_connect_duration(self): """ Gets the time elapsed since the call to :meth:`start_connect`. :return: Elapsed time in seconds. :rtype: float :raises urllib3.exceptions.TimeoutStateError: if you attempt to get duration for a timer that hasn't been started. """ ...
[ "def", "get_connect_duration", "(", "self", ")", ":", "if", "self", ".", "_start_connect", "is", "None", ":", "raise", "TimeoutStateError", "(", "\"Can't get connect duration for timer that has not started.\"", ")", "return", "current_time", "(", ")", "-", "self", "."...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/urllib3-1.25.8/src/urllib3/util/timeout.py#L196-L208
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/waze_travel_time/sensor.py
python
WazeTravelTime.__init__
(self, unique_id, name, origin, destination, waze_data)
Initialize the Waze travel time sensor.
Initialize the Waze travel time sensor.
[ "Initialize", "the", "Waze", "travel", "time", "sensor", "." ]
def __init__(self, unique_id, name, origin, destination, waze_data): """Initialize the Waze travel time sensor.""" self._attr_unique_id = unique_id self._waze_data = waze_data self._attr_name = name self._attr_icon = "mdi:car" self._state = None self._origin_entit...
[ "def", "__init__", "(", "self", ",", "unique_id", ",", "name", ",", "origin", ",", "destination", ",", "waze_data", ")", ":", "self", ".", "_attr_unique_id", "=", "unique_id", "self", ".", "_waze_data", "=", "waze_data", "self", ".", "_attr_name", "=", "na...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/waze_travel_time/sensor.py#L117-L138
django-mptt/django-mptt
7a6a54c6d2572a45ea63bd639c25507108fff3e6
mptt/managers.py
python
TreeManager.disable_mptt_updates
(self)
Context manager. Disables mptt updates. NOTE that this context manager causes inconsistencies! MPTT model methods are not guaranteed to return the correct results. When to use this method: If used correctly, this method can be used to speed up bulk updates. ...
Context manager. Disables mptt updates.
[ "Context", "manager", ".", "Disables", "mptt", "updates", "." ]
def disable_mptt_updates(self): """ Context manager. Disables mptt updates. NOTE that this context manager causes inconsistencies! MPTT model methods are not guaranteed to return the correct results. When to use this method: If used correctly, this method can be use...
[ "def", "disable_mptt_updates", "(", "self", ")", ":", "# Error cases:", "if", "self", ".", "model", ".", "_meta", ".", "abstract", ":", "# an abstract model. Design decision needed - do we disable", "# updates for all concrete models that derive from this model? I", "# vote n...
https://github.com/django-mptt/django-mptt/blob/7a6a54c6d2572a45ea63bd639c25507108fff3e6/mptt/managers.py#L213-L284
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
espnet2/asr/encoder/conformer_encoder.py
python
ConformerEncoder.forward
( self, xs_pad: torch.Tensor, ilens: torch.Tensor, prev_states: torch.Tensor = None, )
return xs_pad, olens, None
Calculate forward propagation. Args: xs_pad (torch.Tensor): Input tensor (#batch, L, input_size). ilens (torch.Tensor): Input length (#batch). prev_states (torch.Tensor): Not to be used now. Returns: torch.Tensor: Output tensor (#batch, L, output_size). ...
Calculate forward propagation.
[ "Calculate", "forward", "propagation", "." ]
def forward( self, xs_pad: torch.Tensor, ilens: torch.Tensor, prev_states: torch.Tensor = None, ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: """Calculate forward propagation. Args: xs_pad (torch.Tensor): Input tensor (#batch, L, input_s...
[ "def", "forward", "(", "self", ",", "xs_pad", ":", "torch", ".", "Tensor", ",", "ilens", ":", "torch", ".", "Tensor", ",", "prev_states", ":", "torch", ".", "Tensor", "=", "None", ",", ")", "->", "Tuple", "[", "torch", ".", "Tensor", ",", "torch", ...
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet2/asr/encoder/conformer_encoder.py#L268-L313
huanghoujing/AlignedReID-Re-Production-Pytorch
2e2d45450d69a3a81e15d18fe85c2eebbde742e4
aligned_reid/utils/utils.py
python
to_scalar
(vt)
Transform a length-1 pytorch Variable or Tensor to scalar. Suppose tx is a torch Tensor with shape tx.size() = torch.Size([1]), then npx = tx.cpu().numpy() has shape (1,), not 1.
Transform a length-1 pytorch Variable or Tensor to scalar. Suppose tx is a torch Tensor with shape tx.size() = torch.Size([1]), then npx = tx.cpu().numpy() has shape (1,), not 1.
[ "Transform", "a", "length", "-", "1", "pytorch", "Variable", "or", "Tensor", "to", "scalar", ".", "Suppose", "tx", "is", "a", "torch", "Tensor", "with", "shape", "tx", ".", "size", "()", "=", "torch", ".", "Size", "(", "[", "1", "]", ")", "then", "...
def to_scalar(vt): """Transform a length-1 pytorch Variable or Tensor to scalar. Suppose tx is a torch Tensor with shape tx.size() = torch.Size([1]), then npx = tx.cpu().numpy() has shape (1,), not 1.""" if isinstance(vt, Variable): return vt.data.cpu().numpy().flatten()[0] if torch.is_tensor(vt): r...
[ "def", "to_scalar", "(", "vt", ")", ":", "if", "isinstance", "(", "vt", ",", "Variable", ")", ":", "return", "vt", ".", "data", ".", "cpu", "(", ")", ".", "numpy", "(", ")", ".", "flatten", "(", ")", "[", "0", "]", "if", "torch", ".", "is_tenso...
https://github.com/huanghoujing/AlignedReID-Re-Production-Pytorch/blob/2e2d45450d69a3a81e15d18fe85c2eebbde742e4/aligned_reid/utils/utils.py#L44-L52
freewizard/SublimeFormatSQL
88771e4b77ab186a09560b495294d11c29cd878c
sqlparse/lexer.py
python
combined.__new__
(cls, *args)
return tuple.__new__(cls, args)
[]
def __new__(cls, *args): return tuple.__new__(cls, args)
[ "def", "__new__", "(", "cls", ",", "*", "args", ")", ":", "return", "tuple", ".", "__new__", "(", "cls", ",", "args", ")" ]
https://github.com/freewizard/SublimeFormatSQL/blob/88771e4b77ab186a09560b495294d11c29cd878c/sqlparse/lexer.py#L29-L30
HackerShackOfficial/Tracking-Turret
2d80171c82c88e13d15276b1ef18e6301ad9540a
turret.py
python
Turret.interactive
(self)
Starts an interactive session. Key presses determine movement. :return:
Starts an interactive session. Key presses determine movement. :return:
[ "Starts", "an", "interactive", "session", ".", "Key", "presses", "determine", "movement", ".", ":", "return", ":" ]
def interactive(self): """ Starts an interactive session. Key presses determine movement. :return: """ Turret.move_forward(self.sm_x, 1) Turret.move_forward(self.sm_y, 1) print 'Commands: Pivot with (a) and (d). Tilt with (w) and (s). Exit with (q)\n' wi...
[ "def", "interactive", "(", "self", ")", ":", "Turret", ".", "move_forward", "(", "self", ".", "sm_x", ",", "1", ")", "Turret", ".", "move_forward", "(", "self", ".", "sm_y", ",", "1", ")", "print", "'Commands: Pivot with (a) and (d). Tilt with (w) and (s). Exit ...
https://github.com/HackerShackOfficial/Tracking-Turret/blob/2d80171c82c88e13d15276b1ef18e6301ad9540a/turret.py#L331-L372
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/elliptic_curves/ell_point.py
python
EllipticCurvePoint_finite_field.discrete_log
(self, Q, ord=None)
r""" Returns discrete log of `Q` with respect to `P` =self. INPUT: - ``Q`` (point) -- another point on the same curve as self. - ``ord`` (integer or ``None`` (default)) -- the order of self. OUTPUT: (integer) -- The discrete log of `Q` with respect to `P`, which is a...
r""" Returns discrete log of `Q` with respect to `P` =self.
[ "r", "Returns", "discrete", "log", "of", "Q", "with", "respect", "to", "P", "=", "self", "." ]
def discrete_log(self, Q, ord=None): r""" Returns discrete log of `Q` with respect to `P` =self. INPUT: - ``Q`` (point) -- another point on the same curve as self. - ``ord`` (integer or ``None`` (default)) -- the order of self. OUTPUT: (integer) -- The discre...
[ "def", "discrete_log", "(", "self", ",", "Q", ",", "ord", "=", "None", ")", ":", "if", "ord", "is", "None", ":", "ord", "=", "self", ".", "order", "(", ")", "try", ":", "return", "generic", ".", "discrete_log", "(", "Q", ",", "self", ",", "ord", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/elliptic_curves/ell_point.py#L3441-L3483
hatRiot/zarp
2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad
src/lib/scapy/crypto/cert.py
python
CRL.verify
(self, anchors)
return "verify OK" in cmdres
Return True if the CRL is signed by one of the provided anchors. False on error (invalid signature, missing anchorand, ...)
Return True if the CRL is signed by one of the provided anchors. False on error (invalid signature, missing anchorand, ...)
[ "Return", "True", "if", "the", "CRL", "is", "signed", "by", "one", "of", "the", "provided", "anchors", ".", "False", "on", "error", "(", "invalid", "signature", "missing", "anchorand", "...", ")" ]
def verify(self, anchors): """ Return True if the CRL is signed by one of the provided anchors. False on error (invalid signature, missing anchorand, ...) """ cafile = create_temporary_ca_file(anchors) if cafile is None: return False try: c...
[ "def", "verify", "(", "self", ",", "anchors", ")", ":", "cafile", "=", "create_temporary_ca_file", "(", "anchors", ")", "if", "cafile", "is", "None", ":", "return", "False", "try", ":", "cmd", "=", "self", ".", "osslcmdbase", "+", "'-noout -CAfile %s 2>&1'",...
https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/crypto/cert.py#L2451-L2466
GeoStat-Framework/PyKrige
f5b39204b18a552f5f162a3c07caeec78c2b8520
pykrige/ok3d.py
python
OrdinaryKriging3D.switch_verbose
(self)
Allows user to switch code talk-back on/off. Takes no arguments.
Allows user to switch code talk-back on/off. Takes no arguments.
[ "Allows", "user", "to", "switch", "code", "talk", "-", "back", "on", "/", "off", ".", "Takes", "no", "arguments", "." ]
def switch_verbose(self): """Allows user to switch code talk-back on/off. Takes no arguments.""" self.verbose = not self.verbose
[ "def", "switch_verbose", "(", "self", ")", ":", "self", ".", "verbose", "=", "not", "self", ".", "verbose" ]
https://github.com/GeoStat-Framework/PyKrige/blob/f5b39204b18a552f5f162a3c07caeec78c2b8520/pykrige/ok3d.py#L563-L565
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/editor/widgets/status.py
python
VCSStatus.get_tooltip
(self)
return _("Git branch")
Return localized tool tip for widget.
Return localized tool tip for widget.
[ "Return", "localized", "tool", "tip", "for", "widget", "." ]
def get_tooltip(self): """Return localized tool tip for widget.""" return _("Git branch")
[ "def", "get_tooltip", "(", "self", ")", ":", "return", "_", "(", "\"Git branch\"", ")" ]
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/editor/widgets/status.py#L136-L138
INK-USC/KagNet
b386661ac5841774b9d17cc132e991a7bef3c5ef
baselines/extract_csqa_bert.py
python
SwagExample.__init__
(self, swag_id, context_sentence, start_ending, ending_0, ending_1, ending_2, ending_3, ending_4, label=None)
[]
def __init__(self, swag_id, context_sentence, start_ending, ending_0, ending_1, ending_2, ending_3, ending_4, label=None): self.swag_id = swag_id self....
[ "def", "__init__", "(", "self", ",", "swag_id", ",", "context_sentence", ",", "start_ending", ",", "ending_0", ",", "ending_1", ",", "ending_2", ",", "ending_3", ",", "ending_4", ",", "label", "=", "None", ")", ":", "self", ".", "swag_id", "=", "swag_id", ...
https://github.com/INK-USC/KagNet/blob/b386661ac5841774b9d17cc132e991a7bef3c5ef/baselines/extract_csqa_bert.py#L34-L54
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/multiprocessing/__init__.py
python
freeze_support
()
Check whether this is a fake forked process in a frozen executable. If so then run code specified by commandline and exit.
Check whether this is a fake forked process in a frozen executable. If so then run code specified by commandline and exit.
[ "Check", "whether", "this", "is", "a", "fake", "forked", "process", "in", "a", "frozen", "executable", ".", "If", "so", "then", "run", "code", "specified", "by", "commandline", "and", "exit", "." ]
def freeze_support(): ''' Check whether this is a fake forked process in a frozen executable. If so then run code specified by commandline and exit. ''' if sys.platform == 'win32' and getattr(sys, 'frozen', False): from multiprocessing.forking import freeze_support freeze_support()
[ "def", "freeze_support", "(", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", "and", "getattr", "(", "sys", ",", "'frozen'", ",", "False", ")", ":", "from", "multiprocessing", ".", "forking", "import", "freeze_support", "freeze_support", "(", ")" ]
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/multiprocessing/__init__.py#L142-L149
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/vendor/pika/channel.py
python
Channel.open
(self)
Open the channel
Open the channel
[ "Open", "the", "channel" ]
def open(self): """Open the channel""" self._set_state(self.OPENING) self._add_callbacks() self._rpc(spec.Channel.Open(), self._on_openok, [spec.Channel.OpenOk])
[ "def", "open", "(", "self", ")", ":", "self", ".", "_set_state", "(", "self", ".", "OPENING", ")", "self", ".", "_add_callbacks", "(", ")", "self", ".", "_rpc", "(", "spec", ".", "Channel", ".", "Open", "(", ")", ",", "self", ".", "_on_openok", ","...
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/pika/channel.py#L755-L759
Eniac-Xie/faster-rcnn-resnet
aba743e8404b47fc9bcccba4920846d1068c7e3c
tools/demo.py
python
demo
(net, image_name)
Detect object classes in an image using pre-computed object proposals.
Detect object classes in an image using pre-computed object proposals.
[ "Detect", "object", "classes", "in", "an", "image", "using", "pre", "-", "computed", "object", "proposals", "." ]
def demo(net, image_name): """Detect object classes in an image using pre-computed object proposals.""" # Load the demo image im_file = os.path.join(cfg.DATA_DIR, 'demo', image_name) im = cv2.imread(im_file) # Detect all object classes and regress object bounds timer = Timer() timer.tic() ...
[ "def", "demo", "(", "net", ",", "image_name", ")", ":", "# Load the demo image", "im_file", "=", "os", ".", "path", ".", "join", "(", "cfg", ".", "DATA_DIR", ",", "'demo'", ",", "image_name", ")", "im", "=", "cv2", ".", "imread", "(", "im_file", ")", ...
https://github.com/Eniac-Xie/faster-rcnn-resnet/blob/aba743e8404b47fc9bcccba4920846d1068c7e3c/tools/demo.py#L72-L98
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
bin/x86/Debug/scripting_engine/Lib/sysconfig.py
python
get_config_var
(name)
return get_config_vars().get(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'.
[ "Return", "the", "value", "of", "a", "single", "variable", "using", "the", "dictionary", "returned", "by", "get_config_vars", "()", "." ]
def get_config_var(name): """Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) """ return get_config_vars().get(name)
[ "def", "get_config_var", "(", "name", ")", ":", "return", "get_config_vars", "(", ")", ".", "get", "(", "name", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/sysconfig.py#L516-L522
Yelp/kafka-utils
74831206648512db1a29426c6ebb428b33820d04
kafka_utils/kafka_corruption_check/main.py
python
ssh_client
(host)
return ssh
Start an ssh client. :param host: the host :type host: str :returns: ssh client :rtype: Paramiko client
Start an ssh client.
[ "Start", "an", "ssh", "client", "." ]
def ssh_client(host): """Start an ssh client. :param host: the host :type host: str :returns: ssh client :rtype: Paramiko client """ ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(host) return ssh
[ "def", "ssh_client", "(", "host", ")", ":", "ssh", "=", "paramiko", ".", "SSHClient", "(", ")", "ssh", ".", "set_missing_host_key_policy", "(", "paramiko", ".", "AutoAddPolicy", "(", ")", ")", "ssh", ".", "connect", "(", "host", ")", "return", "ssh" ]
https://github.com/Yelp/kafka-utils/blob/74831206648512db1a29426c6ebb428b33820d04/kafka_utils/kafka_corruption_check/main.py#L58-L69
bachya/smart-home
536b989e0d7057c7a8a65b2ac9bbffd4b826cce7
hass/settings/custom_components/hacs/helpers/functions/store.py
python
async_load_from_store
(hass, key)
return await get_store_for_key(hass, key).async_load() or {}
Load the retained data from store and return de-serialized data.
Load the retained data from store and return de-serialized data.
[ "Load", "the", "retained", "data", "from", "store", "and", "return", "de", "-", "serialized", "data", "." ]
async def async_load_from_store(hass, key): """Load the retained data from store and return de-serialized data.""" return await get_store_for_key(hass, key).async_load() or {}
[ "async", "def", "async_load_from_store", "(", "hass", ",", "key", ")", ":", "return", "await", "get_store_for_key", "(", "hass", ",", "key", ")", ".", "async_load", "(", ")", "or", "{", "}" ]
https://github.com/bachya/smart-home/blob/536b989e0d7057c7a8a65b2ac9bbffd4b826cce7/hass/settings/custom_components/hacs/helpers/functions/store.py#L40-L42
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmldtd.py
python
ElementType.get_content_model
(self)
return self.content_model_structure
Returns the element content model in (sep,cont,mod) format, where cont is a list of (name,mod) and (sep,cont,mod) tuples. ANY content models are represented as None, and EMPTYs as ("",[],"").
Returns the element content model in (sep,cont,mod) format, where cont is a list of (name,mod) and (sep,cont,mod) tuples. ANY content models are represented as None, and EMPTYs as ("",[],"").
[ "Returns", "the", "element", "content", "model", "in", "(", "sep", "cont", "mod", ")", "format", "where", "cont", "is", "a", "list", "of", "(", "name", "mod", ")", "and", "(", "sep", "cont", "mod", ")", "tuples", ".", "ANY", "content", "models", "are...
def get_content_model(self): """Returns the element content model in (sep,cont,mod) format, where cont is a list of (name,mod) and (sep,cont,mod) tuples. ANY content models are represented as None, and EMPTYs as ("",[],"").""" return self.content_model_structure
[ "def", "get_content_model", "(", "self", ")", ":", "return", "self", ".", "content_model_structure" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmldtd.py#L356-L360
mozilla/elasticutils
b880cc5d51fb1079b0581255ec664c1ec934656e
elasticutils/contrib/django/__init__.py
python
MappingType.search
(cls)
return S(cls)
Returns a typed S for this class. :returns: an `S` for this DjangoMappingType
Returns a typed S for this class.
[ "Returns", "a", "typed", "S", "for", "this", "class", "." ]
def search(cls): """Returns a typed S for this class. :returns: an `S` for this DjangoMappingType """ return S(cls)
[ "def", "search", "(", "cls", ")", ":", "return", "S", "(", "cls", ")" ]
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/contrib/django/__init__.py#L265-L271
MingtaoFu/gliding_vertex
c4470140265140e118725b80a81efe68e44e10af
maskrcnn_benchmark/utils/comm.py
python
synchronize
()
Helper function to synchronize (barrier) among all processes when using distributed training
Helper function to synchronize (barrier) among all processes when using distributed training
[ "Helper", "function", "to", "synchronize", "(", "barrier", ")", "among", "all", "processes", "when", "using", "distributed", "training" ]
def synchronize(): """ Helper function to synchronize (barrier) among all processes when using distributed training """ if not dist.is_available(): return if not dist.is_initialized(): return world_size = dist.get_world_size() if world_size == 1: return dist.b...
[ "def", "synchronize", "(", ")", ":", "if", "not", "dist", ".", "is_available", "(", ")", ":", "return", "if", "not", "dist", ".", "is_initialized", "(", ")", ":", "return", "world_size", "=", "dist", ".", "get_world_size", "(", ")", "if", "world_size", ...
https://github.com/MingtaoFu/gliding_vertex/blob/c4470140265140e118725b80a81efe68e44e10af/maskrcnn_benchmark/utils/comm.py#L33-L45
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/memberships/management/commands/clean_memberships.py
python
Command.handle
(self, *args, **kwargs)
[]
def handle(self, *args, **kwargs): from datetime import datetime from dateutil.relativedelta import relativedelta from tendenci.apps.profiles.models import Profile from tendenci.apps.memberships.models import MembershipDefault, MembershipType from tendenci.apps.user_groups.models...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "datetime", "import", "datetime", "from", "dateutil", ".", "relativedelta", "import", "relativedelta", "from", "tendenci", ".", "apps", ".", "profiles", ".", "models...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/memberships/management/commands/clean_memberships.py#L10-L49
nooperpudd/ctpwrapper
8ea7b7c4ab913fea971b756556d5c18c7a194414
ctpwrapper/Md.py
python
MdApiPy.OnRspUnSubMarketData
(self, pSpecificInstrument, pRspInfo, nRequestID, bIsLast)
取消订阅行情应答 :param pSpecificInstrument: :param pRspInfo: :param nRequestID: :param bIsLast: :return:
取消订阅行情应答 :param pSpecificInstrument: :param pRspInfo: :param nRequestID: :param bIsLast: :return:
[ "取消订阅行情应答", ":", "param", "pSpecificInstrument", ":", ":", "param", "pRspInfo", ":", ":", "param", "nRequestID", ":", ":", "param", "bIsLast", ":", ":", "return", ":" ]
def OnRspUnSubMarketData(self, pSpecificInstrument, pRspInfo, nRequestID, bIsLast) -> None: """ 取消订阅行情应答 :param pSpecificInstrument: :param pRspInfo: :param nRequestID: :param bIsLast: :return: """ pass
[ "def", "OnRspUnSubMarketData", "(", "self", ",", "pSpecificInstrument", ",", "pRspInfo", ",", "nRequestID", ",", "bIsLast", ")", "->", "None", ":", "pass" ]
https://github.com/nooperpudd/ctpwrapper/blob/8ea7b7c4ab913fea971b756556d5c18c7a194414/ctpwrapper/Md.py#L238-L247
andrewf/pcap2har
b13c49ee91c4c4933f18c8fe38d5bffe6c82fd4e
pcap2har/mediatype.py
python
MediaType.__init__
(self, data)
Args: data = string, the media type string
Args: data = string, the media type string
[ "Args", ":", "data", "=", "string", "the", "media", "type", "string" ]
def __init__(self, data): ''' Args: data = string, the media type string ''' if not data: logging.warning( 'Setting empty media type to x-unknown-content-type') self.set_unknown() return match = self.mediatype_re.match(d...
[ "def", "__init__", "(", "self", ",", "data", ")", ":", "if", "not", "data", ":", "logging", ".", "warning", "(", "'Setting empty media type to x-unknown-content-type'", ")", "self", ".", "set_unknown", "(", ")", "return", "match", "=", "self", ".", "mediatype_...
https://github.com/andrewf/pcap2har/blob/b13c49ee91c4c4933f18c8fe38d5bffe6c82fd4e/pcap2har/mediatype.py#L27-L54
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/util/bounced_email_manager.py
python
BouncedEmailManager.logout
(self)
[]
def logout(self): self.mail.close() self.mail.logout()
[ "def", "logout", "(", "self", ")", ":", "self", ".", "mail", ".", "close", "(", ")", "self", ".", "mail", ".", "logout", "(", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/util/bounced_email_manager.py#L337-L339
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/cinder/api/xmlutil.py
python
Template.serialize
(self, obj, *args, **kwargs)
return etree.tostring(elem, *args, **kwargs)
Serialize an object. Serializes an object against the template. Returns a string with the serialized XML. Positional and keyword arguments are passed to etree.tostring(). :param obj: The object to serialize.
Serialize an object.
[ "Serialize", "an", "object", "." ]
def serialize(self, obj, *args, **kwargs): """Serialize an object. Serializes an object against the template. Returns a string with the serialized XML. Positional and keyword arguments are passed to etree.tostring(). :param obj: The object to serialize. """ e...
[ "def", "serialize", "(", "self", ",", "obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "elem", "=", "self", ".", "make_tree", "(", "obj", ")", "if", "elem", "is", "None", ":", "return", "''", "for", "k", ",", "v", "in", "self", ".", ...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/api/xmlutil.py#L578-L596
suavecode/SUAVE
4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5
trunk/SUAVE/Components/Energy/Converters/Motor_Lo_Fid.py
python
Motor_Lo_Fid.current
(self,conditions)
return i
Calculates the motor's rotation rate Assumptions: Cp (power coefficient) is constant Source: N/A Inputs: self.inputs.voltage [V] Outputs: self.outputs.current [A] conditions. propulsion.etam [-] i ...
Calculates the motor's rotation rate Assumptions: Cp (power coefficient) is constant Source: N/A Inputs: self.inputs.voltage [V] Outputs: self.outputs.current [A] conditions. propulsion.etam [-] i ...
[ "Calculates", "the", "motor", "s", "rotation", "rate", "Assumptions", ":", "Cp", "(", "power", "coefficient", ")", "is", "constant", "Source", ":", "N", "/", "A", "Inputs", ":", "self", ".", "inputs", ".", "voltage", "[", "V", "]", "Outputs", ":", "sel...
def current(self,conditions): """Calculates the motor's rotation rate Assumptions: Cp (power coefficient) is constant Source: N/A Inputs: self.inputs.voltage [V] Outputs: self.outputs.current [A] conditions. ...
[ "def", "current", "(", "self", ",", "conditions", ")", ":", "# Unpack", "G", "=", "self", ".", "gear_ratio", "Kv", "=", "self", ".", "speed_constant", "Res", "=", "self", ".", "resistance", "v", "=", "self", ".", "inputs", ".", "voltage", "omeg", "=", ...
https://github.com/suavecode/SUAVE/blob/4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5/trunk/SUAVE/Components/Energy/Converters/Motor_Lo_Fid.py#L122-L172
Blueqat/Blueqat
b676f30489b71767419fd20503403d290d4950b5
blueqat/gate.py
python
CCZGate.n_qargs
(self)
return 3
[]
def n_qargs(self): return 3
[ "def", "n_qargs", "(", "self", ")", ":", "return", "3" ]
https://github.com/Blueqat/Blueqat/blob/b676f30489b71767419fd20503403d290d4950b5/blueqat/gate.py#L646-L647
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ecm/v20190719/models.py
python
ReplaceRouteTableAssociationRequest.__init__
(self)
r""" :param SubnetId: 子网实例ID,例如:subnet-3x5lf5q0。可通过DescribeSubnets接口查询。 :type SubnetId: str :param RouteTableId: 路由表实例ID,例如:rtb-azd4dt1c。 :type RouteTableId: str :param EcmRegion: ECM 地域 :type EcmRegion: str
r""" :param SubnetId: 子网实例ID,例如:subnet-3x5lf5q0。可通过DescribeSubnets接口查询。 :type SubnetId: str :param RouteTableId: 路由表实例ID,例如:rtb-azd4dt1c。 :type RouteTableId: str :param EcmRegion: ECM 地域 :type EcmRegion: str
[ "r", ":", "param", "SubnetId", ":", "子网实例ID,例如:subnet", "-", "3x5lf5q0。可通过DescribeSubnets接口查询。", ":", "type", "SubnetId", ":", "str", ":", "param", "RouteTableId", ":", "路由表实例ID,例如:rtb", "-", "azd4dt1c。", ":", "type", "RouteTableId", ":", "str", ":", "param", "E...
def __init__(self): r""" :param SubnetId: 子网实例ID,例如:subnet-3x5lf5q0。可通过DescribeSubnets接口查询。 :type SubnetId: str :param RouteTableId: 路由表实例ID,例如:rtb-azd4dt1c。 :type RouteTableId: str :param EcmRegion: ECM 地域 :type EcmRegion: str """ self.SubnetId = ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "SubnetId", "=", "None", "self", ".", "RouteTableId", "=", "None", "self", ".", "EcmRegion", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ecm/v20190719/models.py#L10225-L10236
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/voiper/sulley/vmcontrol.py
python
vmcontrol_pedrpc_server.start
(self)
return self.vmcommand(command)
[]
def start (self): self.log("starting image", 2) command = self.vmrun + " start " + self.vmx return self.vmcommand(command)
[ "def", "start", "(", "self", ")", ":", "self", ".", "log", "(", "\"starting image\"", ",", "2", ")", "command", "=", "self", ".", "vmrun", "+", "\" start \"", "+", "self", ".", "vmx", "return", "self", ".", "vmcommand", "(", "command", ")" ]
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/vmcontrol.py#L255-L259
lbolla/EMpy
6296882a9c69a9f652943d235cd65df028c3d2b3
scripts/FDTD.py
python
Input.__init__
(self, filename)
Set the input filename.
Set the input filename.
[ "Set", "the", "input", "filename", "." ]
def __init__(self, filename): """Set the input filename.""" self.filename = filename
[ "def", "__init__", "(", "self", ",", "filename", ")", ":", "self", ".", "filename", "=", "filename" ]
https://github.com/lbolla/EMpy/blob/6296882a9c69a9f652943d235cd65df028c3d2b3/scripts/FDTD.py#L19-L21
iiau-tracker/SPLT
a196e603798e9be969d9d985c087c11cad1cda43
core/man_meta_arch.py
python
MANMetaArch._add_box_predictions_to_feature_maps
(self, feature_maps,reuse=None)
return box_encodings, class_predictions_with_background
Adds box predictors to each feature map and returns concatenated results. Args: feature_maps: a list of tensors where the ith tensor has shape [batch, height_i, width_i, depth_i] Returns: box_encodings: 4-D float tensor of shape [batch_size, num_anchors, b...
Adds box predictors to each feature map and returns concatenated results.
[ "Adds", "box", "predictors", "to", "each", "feature", "map", "and", "returns", "concatenated", "results", "." ]
def _add_box_predictions_to_feature_maps(self, feature_maps,reuse=None): """Adds box predictors to each feature map and returns concatenated results. Args: feature_maps: a list of tensors where the ith tensor has shape [batch, height_i, width_i, depth_i] Returns: ...
[ "def", "_add_box_predictions_to_feature_maps", "(", "self", ",", "feature_maps", ",", "reuse", "=", "None", ")", ":", "num_anchors_per_location_list", "=", "(", "self", ".", "_anchor_generator", ".", "num_anchors_per_location", "(", ")", ")", "if", "len", "(", "fe...
https://github.com/iiau-tracker/SPLT/blob/a196e603798e9be969d9d985c087c11cad1cda43/core/man_meta_arch.py#L154-L214
PacktPublishing/Clean-Code-in-Python
3c4b4a2fde2ccf28d2e0ec5002b2e1921704164e
Chapter03/exceptions_2.py
python
connect_with_retry
(connector, retry_n_times, retry_threshold=5)
Tries to establish the connection of <connector> retrying <retry_n_times>. If it can connect, returns the connection object. If it's not possible after the retries, raises ConnectionError :param connector: An object with a `.connect()` method. :param retry_n_times int: The number of ti...
Tries to establish the connection of <connector> retrying <retry_n_times>.
[ "Tries", "to", "establish", "the", "connection", "of", "<connector", ">", "retrying", "<retry_n_times", ">", "." ]
def connect_with_retry(connector, retry_n_times, retry_threshold=5): """Tries to establish the connection of <connector> retrying <retry_n_times>. If it can connect, returns the connection object. If it's not possible after the retries, raises ConnectionError :param connector: An object ...
[ "def", "connect_with_retry", "(", "connector", ",", "retry_n_times", ",", "retry_threshold", "=", "5", ")", ":", "for", "_", "in", "range", "(", "retry_n_times", ")", ":", "try", ":", "return", "connector", ".", "connect", "(", ")", "except", "ConnectionErro...
https://github.com/PacktPublishing/Clean-Code-in-Python/blob/3c4b4a2fde2ccf28d2e0ec5002b2e1921704164e/Chapter03/exceptions_2.py#L31-L54
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/requests/cookies.py
python
RequestsCookieJar.set_cookie
(self, cookie, *args, **kwargs)
return super(RequestsCookieJar, self).set_cookie(cookie, *args, **kwargs)
[]
def set_cookie(self, cookie, *args, **kwargs): if hasattr(cookie.value, 'startswith') and cookie.value.startswith('"') and cookie.value.endswith('"'): cookie.value = cookie.value.replace('\\"', '') return super(RequestsCookieJar, self).set_cookie(cookie, *args, **kwargs)
[ "def", "set_cookie", "(", "self", ",", "cookie", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "cookie", ".", "value", ",", "'startswith'", ")", "and", "cookie", ".", "value", ".", "startswith", "(", "'\"'", ")", "and", ...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/requests/cookies.py#L297-L300
JPaulMora/Pyrit
f0f1913c645b445dd391fb047b812b5ba511782c
cpyrit/cpyrit.py
python
CPyrit.__init__
(self)
Create a new instance that blocks calls to .enqueue() when more than the given amount of passwords are currently waiting to be scheduled to the hardware.
Create a new instance that blocks calls to .enqueue() when more than the given amount of passwords are currently waiting to be scheduled to the hardware.
[ "Create", "a", "new", "instance", "that", "blocks", "calls", "to", ".", "enqueue", "()", "when", "more", "than", "the", "given", "amount", "of", "passwords", "are", "currently", "waiting", "to", "be", "scheduled", "to", "the", "hardware", "." ]
def __init__(self): """Create a new instance that blocks calls to .enqueue() when more than the given amount of passwords are currently waiting to be scheduled to the hardware. """ self.inqueue = [] self.outqueue = {} self.workunits = [] self.slices ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "inqueue", "=", "[", "]", "self", ".", "outqueue", "=", "{", "}", "self", ".", "workunits", "=", "[", "]", "self", ".", "slices", "=", "{", "}", "self", ".", "in_idx", "=", "self", ".", "ou...
https://github.com/JPaulMora/Pyrit/blob/f0f1913c645b445dd391fb047b812b5ba511782c/cpyrit/cpyrit.py#L420-L496
timgaripov/TensorNet-TF
76299ad4726370bb5e75589017208d7eae7d8666
experiments/cifar-10/conv-Ultimate-Tensorization/nets/conv-fc.py
python
evaluation
(logits, labels)
return tf.cast(correct_flags, tf.int32)
Evaluate the quality of the logits at predicting the label. Args: logits: Logits tensor, float - [batch_size, NUM_CLASSES]. labels: Labels tensor, int32 - [batch_size], with values in the range [0, NUM_CLASSES). Returns: A scalar int32 tensor with the number of examples (out of b...
Evaluate the quality of the logits at predicting the label. Args: logits: Logits tensor, float - [batch_size, NUM_CLASSES]. labels: Labels tensor, int32 - [batch_size], with values in the range [0, NUM_CLASSES). Returns: A scalar int32 tensor with the number of examples (out of b...
[ "Evaluate", "the", "quality", "of", "the", "logits", "at", "predicting", "the", "label", ".", "Args", ":", "logits", ":", "Logits", "tensor", "float", "-", "[", "batch_size", "NUM_CLASSES", "]", ".", "labels", ":", "Labels", "tensor", "int32", "-", "[", ...
def evaluation(logits, labels): """Evaluate the quality of the logits at predicting the label. Args: logits: Logits tensor, float - [batch_size, NUM_CLASSES]. labels: Labels tensor, int32 - [batch_size], with values in the range [0, NUM_CLASSES). Returns: A scalar int32 tenso...
[ "def", "evaluation", "(", "logits", ",", "labels", ")", ":", "# For a classifier model, we can use the in_top_k Op.", "# It returns a bool tensor with shape [batch_size] that is true for", "# the examples where the label's is was in the top k (here k=1)", "# of all logits for that example.", ...
https://github.com/timgaripov/TensorNet-TF/blob/76299ad4726370bb5e75589017208d7eae7d8666/experiments/cifar-10/conv-Ultimate-Tensorization/nets/conv-fc.py#L206-L222
zaxlct/imooc-django
daf1ced745d3d21989e8191b658c293a511b37fd
extra_apps/xadmin/views/dashboard.py
python
BaseWidget.setup
(self)
[]
def setup(self): helper = FormHelper() helper.form_tag = False helper.include_media = False self.helper = helper self.id = self.cleaned_data['id'] self.title = self.cleaned_data['title'] or self.base_title if not (self.user.is_superuser or self.has_perm()): ...
[ "def", "setup", "(", "self", ")", ":", "helper", "=", "FormHelper", "(", ")", "helper", ".", "form_tag", "=", "False", "helper", ".", "include_media", "=", "False", "self", ".", "helper", "=", "helper", "self", ".", "id", "=", "self", ".", "cleaned_dat...
https://github.com/zaxlct/imooc-django/blob/daf1ced745d3d21989e8191b658c293a511b37fd/extra_apps/xadmin/views/dashboard.py#L202-L212
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/permutation.py
python
Permutation.foata_bijection
(self)
return Permutations()(M)
r""" Return the image of the permutation ``self`` under the Foata bijection `\phi`. The bijection shows that `\mathrm{maj}` (the major index) and `\mathrm{inv}` (the number of inversions) are equidistributed: if `\phi(P) = Q`, then `\mathrm{maj}(P) = \mathrm{inv}(Q)`. ...
r""" Return the image of the permutation ``self`` under the Foata bijection `\phi`.
[ "r", "Return", "the", "image", "of", "the", "permutation", "self", "under", "the", "Foata", "bijection", "\\", "phi", "." ]
def foata_bijection(self) -> Permutation: r""" Return the image of the permutation ``self`` under the Foata bijection `\phi`. The bijection shows that `\mathrm{maj}` (the major index) and `\mathrm{inv}` (the number of inversions) are equidistributed: if `\phi(P) = Q`, th...
[ "def", "foata_bijection", "(", "self", ")", "->", "Permutation", ":", "M", ":", "list", "[", "int", "]", "=", "[", "]", "for", "e", "in", "self", ":", "k", "=", "len", "(", "M", ")", "if", "k", "<=", "1", ":", "M", ".", "append", "(", "e", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/permutation.py#L2313-L2406
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/integrals/rubi/utility_function.py
python
Length
(expr)
return len(expr.args)
Returns number of elements in the expression just as SymPy's len. Examples ======== >>> from sympy.integrals.rubi.utility_function import Length >>> from sympy.abc import x, a, b >>> from sympy import cos, sin >>> Length(a + b) 2 >>> Length(sin(a)*cos(a)) 2
Returns number of elements in the expression just as SymPy's len.
[ "Returns", "number", "of", "elements", "in", "the", "expression", "just", "as", "SymPy", "s", "len", "." ]
def Length(expr): """ Returns number of elements in the expression just as SymPy's len. Examples ======== >>> from sympy.integrals.rubi.utility_function import Length >>> from sympy.abc import x, a, b >>> from sympy import cos, sin >>> Length(a + b) 2 >>> Length(sin(a)*cos(a)) ...
[ "def", "Length", "(", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "list", ")", ":", "return", "len", "(", "expr", ")", "return", "len", "(", "expr", ".", "args", ")" ]
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/integrals/rubi/utility_function.py#L832-L850
Jeff-sjtu/CrowdPose
86fe5e11e570cad02d553db52ec72545578cd1c8
crowdpose-api/PythonAPI/crowdposetools/cocoeval.py
python
COCOeval.accumulate
(self, p=None)
Accumulate per image evaluation results and store the result in self.eval :param p: input params for evaluation :return: None
Accumulate per image evaluation results and store the result in self.eval :param p: input params for evaluation :return: None
[ "Accumulate", "per", "image", "evaluation", "results", "and", "store", "the", "result", "in", "self", ".", "eval", ":", "param", "p", ":", "input", "params", "for", "evaluation", ":", "return", ":", "None" ]
def accumulate(self, p=None): ''' Accumulate per image evaluation results and store the result in self.eval :param p: input params for evaluation :return: None ''' print('Accumulating evaluation results...') tic = time.time() if not self.evalImgs: ...
[ "def", "accumulate", "(", "self", ",", "p", "=", "None", ")", ":", "print", "(", "'Accumulating evaluation results...'", ")", "tic", "=", "time", ".", "time", "(", ")", "if", "not", "self", ".", "evalImgs", ":", "print", "(", "'Please run evaluate() first'",...
https://github.com/Jeff-sjtu/CrowdPose/blob/86fe5e11e570cad02d553db52ec72545578cd1c8/crowdpose-api/PythonAPI/crowdposetools/cocoeval.py#L350-L462
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/internet/task.py
python
LoopingCall._reschedule
(self)
Schedule the next iteration of this looping call.
Schedule the next iteration of this looping call.
[ "Schedule", "the", "next", "iteration", "of", "this", "looping", "call", "." ]
def _reschedule(self): """ Schedule the next iteration of this looping call. """ if self.interval == 0: self.call = self.clock.callLater(0, self) return currentTime = self.clock.seconds() # Find how long is left until the interval comes around aga...
[ "def", "_reschedule", "(", "self", ")", ":", "if", "self", ".", "interval", "==", "0", ":", "self", ".", "call", "=", "self", ".", "clock", ".", "callLater", "(", "0", ",", "self", ")", "return", "currentTime", "=", "self", ".", "clock", ".", "seco...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/task.py#L199-L219
dfd-tud/deda
23e84e1a027263b7296a670b615c16dab1bdedd9
libdeda/print_parser.py
python
PrintParser.getAllTdms
(self)
TDMs where redundance check passed or failed
TDMs where redundance check passed or failed
[ "TDMs", "where", "redundance", "check", "passed", "or", "failed" ]
def getAllTdms(self): """ TDMs where redundance check passed or failed """ for tdm in self.allTDMs: yield tdm
[ "def", "getAllTdms", "(", "self", ")", ":", "for", "tdm", "in", "self", ".", "allTDMs", ":", "yield", "tdm" ]
https://github.com/dfd-tud/deda/blob/23e84e1a027263b7296a670b615c16dab1bdedd9/libdeda/print_parser.py#L176-L179
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/viewrendered3.py
python
ViewRenderedController3.plot_2d
(self)
r""" #@+<< docstring >> #@+node:tom.20211104105903.2: *5* << docstring >> Show a plot of x-y data in the selected node. The data can be either a one-column or two-column list of rows. Columns are separated by whitespace. Optionally, the node may contain a config file-l...
r""" #@+<< docstring >> #@+node:tom.20211104105903.2: *5* << docstring >> Show a plot of x-y data in the selected node.
[ "r", "#@", "+", "<<", "docstring", ">>", "#@", "+", "node", ":", "tom", ".", "20211104105903", ".", "2", ":", "*", "5", "*", "<<", "docstring", ">>", "Show", "a", "plot", "of", "x", "-", "y", "data", "in", "the", "selected", "node", "." ]
def plot_2d(self): r""" #@+<< docstring >> #@+node:tom.20211104105903.2: *5* << docstring >> Show a plot of x-y data in the selected node. The data can be either a one-column or two-column list of rows. Columns are separated by whitespace. Optionally, the node ...
[ "def", "plot_2d", "(", "self", ")", ":", "if", "not", "matplotlib", ":", "g", ".", "es", "(", "'VR3 -- Matplotlib is needed to plot 2D data'", ")", "return", "page", "=", "self", ".", "c", ".", "p", ".", "b", "page_lines", "=", "page", ".", "split", "(",...
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/viewrendered3.py#L1924-L2336
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/nose-1.3.7/nose/plugins/allmodules.py
python
AllModules.wantModule
(self, module)
return True
Override return True for all modules
Override return True for all modules
[ "Override", "return", "True", "for", "all", "modules" ]
def wantModule(self, module): """Override return True for all modules""" return True
[ "def", "wantModule", "(", "self", ",", "module", ")", ":", "return", "True" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/nose-1.3.7/nose/plugins/allmodules.py#L43-L45
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pygments/filters/__init__.py
python
TokenMergeFilter.filter
(self, lexer, stream)
[]
def filter(self, lexer, stream): current_type = None current_value = None for ttype, value in stream: if ttype is current_type: current_value += value else: if current_type is not None: yield current_type, current_value ...
[ "def", "filter", "(", "self", ",", "lexer", ",", "stream", ")", ":", "current_type", "=", "None", "current_value", "=", "None", "for", "ttype", ",", "value", "in", "stream", ":", "if", "ttype", "is", "current_type", ":", "current_value", "+=", "value", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pygments/filters/__init__.py#L327-L339
dragonfly/dragonfly
a579b5eadf452e23b07d4caf27b402703b0012b7
examples/salsa/salsa_estimator.py
python
get_salsa_estimator_from_data_and_hyperparams
(X_tr, Y_tr, kernel_type, add_order, kernel_scale, bandwidths, l2_reg)
return salsa_obj.eval
Returns an estimator using the data.
Returns an estimator using the data.
[ "Returns", "an", "estimator", "using", "the", "data", "." ]
def get_salsa_estimator_from_data_and_hyperparams(X_tr, Y_tr, kernel_type, add_order, kernel_scale, bandwidths, l2_reg): """ Returns an estimator using the data. """ problem_dim = np.array(X_tr).shape[1] kernel = get_salsa_kernel_from_params(kernel_type, add_order...
[ "def", "get_salsa_estimator_from_data_and_hyperparams", "(", "X_tr", ",", "Y_tr", ",", "kernel_type", ",", "add_order", ",", "kernel_scale", ",", "bandwidths", ",", "l2_reg", ")", ":", "problem_dim", "=", "np", ".", "array", "(", "X_tr", ")", ".", "shape", "["...
https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/examples/salsa/salsa_estimator.py#L355-L366
shaypal5/cachier
ea7906fb5f5ae8d89d76fb39d2ce86002103b50b
cachier/_version.py
python
git_get_keywords
(versionfile_abs)
return keywords
Extract version information from the given file.
Extract version information from the given file.
[ "Extract", "version", "information", "from", "the", "given", "file", "." ]
def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these # keywords. When used from setup.py, we don't want to import _version.py, # so we do it with a regexp instead. This function is not used from...
[ "def", "git_get_keywords", "(", "versionfile_abs", ")", ":", "# the code embedded in _version.py can just fetch the value of these", "# keywords. When used from setup.py, we don't want to import _version.py,", "# so we do it with a regexp instead. This function is not used from", "# _version.py.",...
https://github.com/shaypal5/cachier/blob/ea7906fb5f5ae8d89d76fb39d2ce86002103b50b/cachier/_version.py#L121-L142
IlyaGusev/rupo
83a5fac0dddd480a401181e5465f0e3c94ad2dcc
rupo/stress/predictor.py
python
DictStressPredictor.__init__
(self, language="ru", raw_dict_path=None, trie_path=None, zalyzniak_dict=ZALYZNYAK_DICT, cmu_dict=CMU_DICT)
[]
def __init__(self, language="ru", raw_dict_path=None, trie_path=None, zalyzniak_dict=ZALYZNYAK_DICT, cmu_dict=CMU_DICT): self.stress_dict = StressDict(language, raw_dict_path=raw_dict_path, trie_path=trie_path, zalyzniak_dict=zalyzniak_dict, cmu_dict=cmu_di...
[ "def", "__init__", "(", "self", ",", "language", "=", "\"ru\"", ",", "raw_dict_path", "=", "None", ",", "trie_path", "=", "None", ",", "zalyzniak_dict", "=", "ZALYZNYAK_DICT", ",", "cmu_dict", "=", "CMU_DICT", ")", ":", "self", ".", "stress_dict", "=", "St...
https://github.com/IlyaGusev/rupo/blob/83a5fac0dddd480a401181e5465f0e3c94ad2dcc/rupo/stress/predictor.py#L21-L24
intel/virtual-storage-manager
00706ab9701acbd0d5e04b19cc80c6b66a2973b8
source/vsm/vsm/utils.py
python
generate_glance_url
()
return "http://%s:%d" % (FLAGS.glance_host, FLAGS.glance_port)
Generate the URL to glance.
Generate the URL to glance.
[ "Generate", "the", "URL", "to", "glance", "." ]
def generate_glance_url(): """Generate the URL to glance.""" # TODO(jk0): This will eventually need to take SSL into consideration # when supported in glance. return "http://%s:%d" % (FLAGS.glance_host, FLAGS.glance_port)
[ "def", "generate_glance_url", "(", ")", ":", "# TODO(jk0): This will eventually need to take SSL into consideration", "# when supported in glance.", "return", "\"http://%s:%d\"", "%", "(", "FLAGS", ".", "glance_host", ",", "FLAGS", ".", "glance_port", ")" ]
https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/vsm/vsm/utils.py#L973-L977
redis/redis-py
0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7
redis/commands/core.py
python
StreamCommands.xreadgroup
( self, groupname, consumername, streams, count=None, block=None, noack=False )
return self.execute_command("XREADGROUP", *pieces)
Read from a stream via a consumer group. groupname: name of the consumer group. consumername: name of the requesting consumer. streams: a dict of stream names to stream IDs, where IDs indicate the last ID already seen. count: if set, only return this many items, beginning ...
Read from a stream via a consumer group. groupname: name of the consumer group. consumername: name of the requesting consumer. streams: a dict of stream names to stream IDs, where IDs indicate the last ID already seen. count: if set, only return this many items, beginning ...
[ "Read", "from", "a", "stream", "via", "a", "consumer", "group", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "consumername", ":", "name", "of", "the", "requesting", "consumer", ".", "streams", ":", "a", "dict", "of", "stream", "n...
def xreadgroup( self, groupname, consumername, streams, count=None, block=None, noack=False ): """ Read from a stream via a consumer group. groupname: name of the consumer group. consumername: name of the requesting consumer. streams: a dict of stream names to stream ...
[ "def", "xreadgroup", "(", "self", ",", "groupname", ",", "consumername", ",", "streams", ",", "count", "=", "None", ",", "block", "=", "None", ",", "noack", "=", "False", ")", ":", "pieces", "=", "[", "b\"GROUP\"", ",", "groupname", ",", "consumername", ...
https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/commands/core.py#L2924-L2958
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/orm/computers.py
python
Computer._transport_type_validator
(cls, transport_type: str)
Validates the transport string.
Validates the transport string.
[ "Validates", "the", "transport", "string", "." ]
def _transport_type_validator(cls, transport_type: str) -> None: """ Validates the transport string. """ from aiida.plugins.entry_point import get_entry_point_names if transport_type not in get_entry_point_names('aiida.transports'): raise exceptions.ValidationError('T...
[ "def", "_transport_type_validator", "(", "cls", ",", "transport_type", ":", "str", ")", "->", "None", ":", "from", "aiida", ".", "plugins", ".", "entry_point", "import", "get_entry_point_names", "if", "transport_type", "not", "in", "get_entry_point_names", "(", "'...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/computers.py#L151-L157
PacktPublishing/Advanced-Deep-Learning-with-Keras
099980731ba4f4e1a847506adf693247e41ef0cb
chapter13-mi-unsupervised/mine-13.8.1.py
python
MINE.eval
(self)
Evaluate the accuracy of the current model weights
Evaluate the accuracy of the current model weights
[ "Evaluate", "the", "accuracy", "of", "the", "current", "model", "weights" ]
def eval(self): """Evaluate the accuracy of the current model weights """ # generate clustering predictions fr test data y_pred = self._encoder.predict(self.x_test) # train a linear classifier # input: clustered data # output: ground truth labels self._cla...
[ "def", "eval", "(", "self", ")", ":", "# generate clustering predictions fr test data", "y_pred", "=", "self", ".", "_encoder", ".", "predict", "(", "self", ".", "x_test", ")", "# train a linear classifier", "# input: clustered data", "# output: ground truth labels", "sel...
https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras/blob/099980731ba4f4e1a847506adf693247e41ef0cb/chapter13-mi-unsupervised/mine-13.8.1.py#L419-L450
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/HTMLParser.py
python
HTMLParser.parse_html_declaration
(self, i)
[]
def parse_html_declaration(self, i): rawdata = self.rawdata if rawdata[i:i+2] != '<!': self.error('unexpected call to parse_html_declaration()') if rawdata[i:i+4] == '<!--': # this case is actually already handled in goahead() return self.parse_comment(i) ...
[ "def", "parse_html_declaration", "(", "self", ",", "i", ")", ":", "rawdata", "=", "self", ".", "rawdata", "if", "rawdata", "[", "i", ":", "i", "+", "2", "]", "!=", "'<!'", ":", "self", ".", "error", "(", "'unexpected call to parse_html_declaration()'", ")"...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/HTMLParser.py#L237-L254
translate/virtaal
8b0a6fbf764ed92cc44a189499dec399c6423761
virtaal/plugins/tm/tmcontroller.py
python
TMController.send_tm_query
(self, unit=None)
Send a new query to the TM engine. (This method is used as Controller-Model communications)
Send a new query to the TM engine. (This method is used as Controller-Model communications)
[ "Send", "a", "new", "query", "to", "the", "TM", "engine", ".", "(", "This", "method", "is", "used", "as", "Controller", "-", "Model", "communications", ")" ]
def send_tm_query(self, unit=None): """Send a new query to the TM engine. (This method is used as Controller-Model communications)""" if unit is not None: self.unit = unit self.current_query = self.unit.source self.matches = [] self.view.clear() s...
[ "def", "send_tm_query", "(", "self", ",", "unit", "=", "None", ")", ":", "if", "unit", "is", "not", "None", ":", "self", ".", "unit", "=", "unit", "self", ".", "current_query", "=", "self", ".", "unit", ".", "source", "self", ".", "matches", "=", "...
https://github.com/translate/virtaal/blob/8b0a6fbf764ed92cc44a189499dec399c6423761/virtaal/plugins/tm/tmcontroller.py#L169-L178
twitter/zktraffic
82db04d9aafa13f694d4f5c7265069db42c0307c
zktraffic/zab/quorum_packet.py
python
QuorumPacket.zxid_literal
(self)
return self.zxid if self.zxid == -1 else "0x%x" % self.zxid
[]
def zxid_literal(self): return self.zxid if self.zxid == -1 else "0x%x" % self.zxid
[ "def", "zxid_literal", "(", "self", ")", ":", "return", "self", ".", "zxid", "if", "self", ".", "zxid", "==", "-", "1", "else", "\"0x%x\"", "%", "self", ".", "zxid" ]
https://github.com/twitter/zktraffic/blob/82db04d9aafa13f694d4f5c7265069db42c0307c/zktraffic/zab/quorum_packet.py#L121-L122
aqlaboratory/rgn
0133213eea9aa95900d1f16c0c6b9febbeb394cb
model/model.py
python
RGNModel._evaluate
(self, session, pretty=True)
Evaluates loss(es) and returns dicts with the relevant loss(es).
Evaluates loss(es) and returns dicts with the relevant loss(es).
[ "Evaluates", "loss", "(", "es", ")", "and", "returns", "dicts", "with", "the", "relevant", "loss", "(", "es", ")", "." ]
def _evaluate(self, session, pretty=True): """ Evaluates loss(es) and returns dicts with the relevant loss(es). """ if RGNModel._is_started: # evaluate num_invocations = self.config.queueing['num_evaluation_invocations'] for invocation in range(num_invocations): ...
[ "def", "_evaluate", "(", "self", ",", "session", ",", "pretty", "=", "True", ")", ":", "if", "RGNModel", ".", "_is_started", ":", "# evaluate", "num_invocations", "=", "self", ".", "config", ".", "queueing", "[", "'num_evaluation_invocations'", "]", "for", "...
https://github.com/aqlaboratory/rgn/blob/0133213eea9aa95900d1f16c0c6b9febbeb394cb/model/model.py#L293-L314
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/preprocess/preprocess.py
python
Randomize.randomize
(table, rand_state=None)
return table
[]
def randomize(table, rand_state=None): rstate = np.random.RandomState(rand_state) if sp.issparse(table): table = table.tocsc() # type: sp.spmatrix for i in range(table.shape[1]): permutation = rstate.permutation(table.shape[0]) col_indices = \ ...
[ "def", "randomize", "(", "table", ",", "rand_state", "=", "None", ")", ":", "rstate", "=", "np", ".", "random", ".", "RandomState", "(", "rand_state", ")", "if", "sp", ".", "issparse", "(", "table", ")", ":", "table", "=", "table", ".", "tocsc", "(",...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/preprocess/preprocess.py#L428-L442
tensorflow/tensorboard
61d11d99ef034c30ba20b6a7840c8eededb9031c
tensorboard/plugins/image/images_plugin.py
python
ImagesPlugin._serve_individual_image
(self, request)
return http_util.Respond(request, data, content_type)
Serves an individual image.
Serves an individual image.
[ "Serves", "an", "individual", "image", "." ]
def _serve_individual_image(self, request): """Serves an individual image.""" try: ctx = plugin_util.context(request.environ) blob_key = request.args["blob_key"] data = self._get_generic_data_individual_image(ctx, blob_key) except (KeyError, IndexError): ...
[ "def", "_serve_individual_image", "(", "self", ",", "request", ")", ":", "try", ":", "ctx", "=", "plugin_util", ".", "context", "(", "request", ".", "environ", ")", "blob_key", "=", "request", ".", "args", "[", "\"blob_key\"", "]", "data", "=", "self", "...
https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/image/images_plugin.py#L233-L250
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/cisconso.py
python
apply_rollback
(datastore, name)
return _proxy_cmd("apply_rollback", datastore, name)
Apply a system rollback :param datastore: The datastore, e.g. running, operational. One of the NETCONF store IETF types :type datastore: :class:`DatastoreType` (``str`` enum). :param name: an ID of the rollback to restore :type name: ``str`` .. code-block:: bash salt cisco-nso ...
Apply a system rollback
[ "Apply", "a", "system", "rollback" ]
def apply_rollback(datastore, name): """ Apply a system rollback :param datastore: The datastore, e.g. running, operational. One of the NETCONF store IETF types :type datastore: :class:`DatastoreType` (``str`` enum). :param name: an ID of the rollback to restore :type name: ``str`` ...
[ "def", "apply_rollback", "(", "datastore", ",", "name", ")", ":", "return", "_proxy_cmd", "(", "\"apply_rollback\"", ",", "datastore", ",", "name", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/cisconso.py#L116-L131