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
gabolsgabs/DALI
0bfeec1008b32a8294ff2f49141f943758a476cb
code/DALI/utilities.py
python
sample
(annot, time_r)
return output
Transform the normal time into a discrete value with respect time_r.
Transform the normal time into a discrete value with respect time_r.
[ "Transform", "the", "normal", "time", "into", "a", "discrete", "value", "with", "respect", "time_r", "." ]
def sample(annot, time_r): """Transform the normal time into a discrete value with respect time_r. """ output = copy.deepcopy(annot) for a in output: a['time'] = (np.round(a['time'][0]/time_r).astype(int), np.round(a['time'][1]/time_r).astype(int)) return output
[ "def", "sample", "(", "annot", ",", "time_r", ")", ":", "output", "=", "copy", ".", "deepcopy", "(", "annot", ")", "for", "a", "in", "output", ":", "a", "[", "'time'", "]", "=", "(", "np", ".", "round", "(", "a", "[", "'time'", "]", "[", "0", ...
https://github.com/gabolsgabs/DALI/blob/0bfeec1008b32a8294ff2f49141f943758a476cb/code/DALI/utilities.py#L257-L264
Fallen-Breath/MCDReforged
fdb1d2520b35f916123f265dbd94603981bb2b0c
mcdreforged/handler/abstract_server_handler.py
python
AbstractServerHandler.test_rcon_started
(self, info: Info)
Check if rcon has started and return a bool :param Info info: The info instance that will be checked :return: If rcon has started :rtype: bool
Check if rcon has started and return a bool
[ "Check", "if", "rcon", "has", "started", "and", "return", "a", "bool" ]
def test_rcon_started(self, info: Info) -> bool: """ Check if rcon has started and return a bool :param Info info: The info instance that will be checked :return: If rcon has started :rtype: bool """ raise NotImplementedError()
[ "def", "test_rcon_started", "(", "self", ",", "info", ":", "Info", ")", "->", "bool", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/Fallen-Breath/MCDReforged/blob/fdb1d2520b35f916123f265dbd94603981bb2b0c/mcdreforged/handler/abstract_server_handler.py#L212-L220
microsoft/debugpy
be8dd607f6837244e0b565345e497aff7a0c08bf
src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/sql.py
python
CrashDAO.find_by_example
(self, crash, offset = None, limit = None)
Find all crash dumps that have common properties with the crash dump provided. Results can be paged to avoid consuming too much memory if the database is large. @see: L{find} @type crash: L{Crash} @param crash: Crash object to compare with. Fields set to C{None} are ...
Find all crash dumps that have common properties with the crash dump provided.
[ "Find", "all", "crash", "dumps", "that", "have", "common", "properties", "with", "the", "crash", "dump", "provided", "." ]
def find_by_example(self, crash, offset = None, limit = None): """ Find all crash dumps that have common properties with the crash dump provided. Results can be paged to avoid consuming too much memory if the database is large. @see: L{find} @type crash: L{Cra...
[ "def", "find_by_example", "(", "self", ",", "crash", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "# Validate the parameters.", "if", "limit", "is", "not", "None", "and", "not", "limit", ":", "warnings", ".", "warn", "(", "\"CrashDAO.fi...
https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/sql.py#L898-L962
uqfoundation/mystic
154e6302d1f2f94e8f13e88ecc5f24241cc28ac7
models/br8.py
python
BevingtonDecay.CostFactory2
(self,pts,datapts,nparams)
return self.__cost__
generates a cost function instance from datapoints & evaluation points
generates a cost function instance from datapoints & evaluation points
[ "generates", "a", "cost", "function", "instance", "from", "datapoints", "&", "evaluation", "points" ]
def CostFactory2(self,pts,datapts,nparams): """generates a cost function instance from datapoints & evaluation points""" F = CF() F.addModel(self.ForwardFactory,nparams,self.__name__) self.__cost__ = F.getCostFunction(evalpts=pts,observations=datapts,sigma=sqrt(datapts),metric=self.__met...
[ "def", "CostFactory2", "(", "self", ",", "pts", ",", "datapts", ",", "nparams", ")", ":", "F", "=", "CF", "(", ")", "F", ".", "addModel", "(", "self", ".", "ForwardFactory", ",", "nparams", ",", "self", ".", "__name__", ")", "self", ".", "__cost__", ...
https://github.com/uqfoundation/mystic/blob/154e6302d1f2f94e8f13e88ecc5f24241cc28ac7/models/br8.py#L57-L62
almarklein/visvis
766ed97767b44a55a6ff72c742d7385e074d3d55
core/baseFigure.py
python
BaseFigure.eventAfterDraw
(self)
return self._eventAfterDraw
Fired after each drawing pass.
Fired after each drawing pass.
[ "Fired", "after", "each", "drawing", "pass", "." ]
def eventAfterDraw(self): """ Fired after each drawing pass. """ return self._eventAfterDraw
[ "def", "eventAfterDraw", "(", "self", ")", ":", "return", "self", ".", "_eventAfterDraw" ]
https://github.com/almarklein/visvis/blob/766ed97767b44a55a6ff72c742d7385e074d3d55/core/baseFigure.py#L266-L269
bert-nmt/bert-nmt
fcb616d28091ac23c9c16f30e6870fe90b8576d6
fairseq/models/transformer.py
python
TransformerDecoderLayer.forward
( self, x, encoder_out=None, encoder_padding_mask=None, bert_encoder_out=None, bert_encoder_padding_mask=None, incremental_state=None, prev_self_attn_state=None, prev_attn_state=None, self_attn_mask=None, self_attn_padding_mask=None...
return x, attn
Args: x (Tensor): input to the layer of shape `(seq_len, batch, embed_dim)` encoder_padding_mask (ByteTensor): binary ByteTensor of shape `(batch, src_len)` where padding elements are indicated by ``1``. Returns: encoded output of shape `(batch, src_len, embe...
Args: x (Tensor): input to the layer of shape `(seq_len, batch, embed_dim)` encoder_padding_mask (ByteTensor): binary ByteTensor of shape `(batch, src_len)` where padding elements are indicated by ``1``.
[ "Args", ":", "x", "(", "Tensor", ")", ":", "input", "to", "the", "layer", "of", "shape", "(", "seq_len", "batch", "embed_dim", ")", "encoder_padding_mask", "(", "ByteTensor", ")", ":", "binary", "ByteTensor", "of", "shape", "(", "batch", "src_len", ")", ...
def forward( self, x, encoder_out=None, encoder_padding_mask=None, bert_encoder_out=None, bert_encoder_padding_mask=None, incremental_state=None, prev_self_attn_state=None, prev_attn_state=None, self_attn_mask=None, self_attn_paddin...
[ "def", "forward", "(", "self", ",", "x", ",", "encoder_out", "=", "None", ",", "encoder_padding_mask", "=", "None", ",", "bert_encoder_out", "=", "None", ",", "bert_encoder_padding_mask", "=", "None", ",", "incremental_state", "=", "None", ",", "prev_self_attn_s...
https://github.com/bert-nmt/bert-nmt/blob/fcb616d28091ac23c9c16f30e6870fe90b8576d6/fairseq/models/transformer.py#L1474-L1562
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_pvc.py
python
PersistentVolumeClaim.selector
(self, data)
selector property setter
selector property setter
[ "selector", "property", "setter" ]
def selector(self, data): ''' selector property setter''' if not isinstance(data, dict): data = dict(data) self._selector = data
[ "def", "selector", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":", "data", "=", "dict", "(", "data", ")", "self", ".", "_selector", "=", "data" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_pvc.py#L1586-L1591
blurstudio/cross3d
277968d1227de740fc87ef61005c75034420eadf
cross3d/studiomax/studiomaxsceneobject.py
python
StudiomaxSceneObject._setNativeModel
( self, nativeModel )
return True
\remarks implements the AbstractSceneObject._setNativeModel method to set the native model for this object \sa model, setModel, _nativeModel \param <Py3dsMax.mxs.Object> nativeObject || None \return <bool> success
\remarks implements the AbstractSceneObject._setNativeModel method to set the native model for this object \sa model, setModel, _nativeModel \param <Py3dsMax.mxs.Object> nativeObject || None \return <bool> success
[ "\\", "remarks", "implements", "the", "AbstractSceneObject", ".", "_setNativeModel", "method", "to", "set", "the", "native", "model", "for", "this", "object", "\\", "sa", "model", "setModel", "_nativeModel", "\\", "param", "<Py3dsMax", ".", "mxs", ".", "Object",...
def _setNativeModel( self, nativeModel ): """ \remarks implements the AbstractSceneObject._setNativeModel method to set the native model for this object \sa model, setModel, _nativeModel \param <Py3dsMax.mxs.Object> nativeObject || None \return <bool> success """ model = self._nativeModel() # d...
[ "def", "_setNativeModel", "(", "self", ",", "nativeModel", ")", ":", "model", "=", "self", ".", "_nativeModel", "(", ")", "# don't process when we need to reset this model", "if", "(", "nativeModel", "==", "model", ")", ":", "return", "True", "# otherwise, we need t...
https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/studiomax/studiomaxsceneobject.py#L209-L234
nopernik/mpDNS
b17dc39e7068406df82cb3431b3042e74e520cf9
mpdns.py
python
isValidIP
(s)
[]
def isValidIP(s): try: IP(s) return True except: return False
[ "def", "isValidIP", "(", "s", ")", ":", "try", ":", "IP", "(", "s", ")", "return", "True", "except", ":", "return", "False" ]
https://github.com/nopernik/mpDNS/blob/b17dc39e7068406df82cb3431b3042e74e520cf9/mpdns.py#L108-L113
mila-iqia/babyai
863f3529371ba45ef0148a48b48f5ae6e61e06cc
babyai/model.py
python
ACModel.add_extra_heads_if_necessary
(self, aux_info)
This function allows using a pre-trained model without aux_info and add aux_info to it and still make it possible to finetune.
This function allows using a pre-trained model without aux_info and add aux_info to it and still make it possible to finetune.
[ "This", "function", "allows", "using", "a", "pre", "-", "trained", "model", "without", "aux_info", "and", "add", "aux_info", "to", "it", "and", "still", "make", "it", "possible", "to", "finetune", "." ]
def add_extra_heads_if_necessary(self, aux_info): ''' This function allows using a pre-trained model without aux_info and add aux_info to it and still make it possible to finetune. ''' try: if not hasattr(self, 'aux_info') or not set(self.aux_info) == set(aux_info): ...
[ "def", "add_extra_heads_if_necessary", "(", "self", ",", "aux_info", ")", ":", "try", ":", "if", "not", "hasattr", "(", "self", ",", "'aux_info'", ")", "or", "not", "set", "(", "self", ".", "aux_info", ")", "==", "set", "(", "aux_info", ")", ":", "self...
https://github.com/mila-iqia/babyai/blob/863f3529371ba45ef0148a48b48f5ae6e61e06cc/babyai/model.py#L197-L207
IntelPython/sdc
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
sdc/_version.py
python
render_pep440_old
(pieces)
return rendered
TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Eexceptions: 1: no tags. 0.postDISTANCE[.dev0]
TAG[.postDISTANCE[.dev0]] .
[ "TAG", "[", ".", "postDISTANCE", "[", ".", "dev0", "]]", "." ]
def render_pep440_old(pieces): """TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Eexceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%d" % pie...
[ "def", "render_pep440_old", "(", "pieces", ")", ":", "if", "pieces", "[", "\"closest-tag\"", "]", ":", "rendered", "=", "pieces", "[", "\"closest-tag\"", "]", "if", "pieces", "[", "\"distance\"", "]", "or", "pieces", "[", "\"dirty\"", "]", ":", "rendered", ...
https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/_version.py#L413-L432
python/mypy
17850b3bd77ae9efb5d21f656c4e4e05ac48d894
mypy/semanal.py
python
SemanticAnalyzer.record_incomplete_ref
(self)
Record the encounter of an incomplete reference and defer current analysis target.
Record the encounter of an incomplete reference and defer current analysis target.
[ "Record", "the", "encounter", "of", "an", "incomplete", "reference", "and", "defer", "current", "analysis", "target", "." ]
def record_incomplete_ref(self) -> None: """Record the encounter of an incomplete reference and defer current analysis target.""" self.defer() self.num_incomplete_refs += 1
[ "def", "record_incomplete_ref", "(", "self", ")", "->", "None", ":", "self", ".", "defer", "(", ")", "self", ".", "num_incomplete_refs", "+=", "1" ]
https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/semanal.py#L4840-L4843
Andrew-liu/scrapy_example
6fba398bb4a6f40e1a907611d165b495d5d693a1
Coursera/coursera/coursera/spiders/coursera_spider.py
python
random_string
(length)
return ''.join(random.choice(string.letters + string.digits) for i in xrange(length))
随机生成指定长度的字母和数字序列
随机生成指定长度的字母和数字序列
[ "随机生成指定长度的字母和数字序列" ]
def random_string(length): """ 随机生成指定长度的字母和数字序列 """ return ''.join(random.choice(string.letters + string.digits) for i in xrange(length))
[ "def", "random_string", "(", "length", ")", ":", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "string", ".", "letters", "+", "string", ".", "digits", ")", "for", "i", "in", "xrange", "(", "length", ")", ")" ]
https://github.com/Andrew-liu/scrapy_example/blob/6fba398bb4a6f40e1a907611d165b495d5d693a1/Coursera/coursera/coursera/spiders/coursera_spider.py#L20-L24
internetarchive/openlibrary
33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8
openlibrary/plugins/openlibrary/home.py
python
readonline_carousel
()
Return template code for books pulled from search engine. TODO: If problems, use stock list.
Return template code for books pulled from search engine. TODO: If problems, use stock list.
[ "Return", "template", "code", "for", "books", "pulled", "from", "search", "engine", ".", "TODO", ":", "If", "problems", "use", "stock", "list", "." ]
def readonline_carousel(): """Return template code for books pulled from search engine. TODO: If problems, use stock list. """ try: data = random_ebooks() if len(data) > 30: data = lending.add_availability(random.sample(data, 30)) data = [d for d in data if d['ava...
[ "def", "readonline_carousel", "(", ")", ":", "try", ":", "data", "=", "random_ebooks", "(", ")", "if", "len", "(", "data", ")", ">", "30", ":", "data", "=", "lending", ".", "add_availability", "(", "random", ".", "sample", "(", "data", ",", "30", ")"...
https://github.com/internetarchive/openlibrary/blob/33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8/openlibrary/plugins/openlibrary/home.py#L769-L782
mileyan/Pseudo_Lidar_V2
aaf375b1050c602cb22bbe78113d0c702669e08b
gdc/data_utils/kitti_util.py
python
Calibration.cart2hom
(self, pts_3d)
return pts_3d_hom
Input: nx3 points in Cartesian Oupput: nx4 points in Homogeneous by pending 1
Input: nx3 points in Cartesian Oupput: nx4 points in Homogeneous by pending 1
[ "Input", ":", "nx3", "points", "in", "Cartesian", "Oupput", ":", "nx4", "points", "in", "Homogeneous", "by", "pending", "1" ]
def cart2hom(self, pts_3d): ''' Input: nx3 points in Cartesian Oupput: nx4 points in Homogeneous by pending 1 ''' n = pts_3d.shape[0] pts_3d_hom = np.hstack((pts_3d, np.ones((n,1)))) return pts_3d_hom
[ "def", "cart2hom", "(", "self", ",", "pts_3d", ")", ":", "n", "=", "pts_3d", ".", "shape", "[", "0", "]", "pts_3d_hom", "=", "np", ".", "hstack", "(", "(", "pts_3d", ",", "np", ".", "ones", "(", "(", "n", ",", "1", ")", ")", ")", ")", "return...
https://github.com/mileyan/Pseudo_Lidar_V2/blob/aaf375b1050c602cb22bbe78113d0c702669e08b/gdc/data_utils/kitti_util.py#L145-L151
jparkhill/TensorMol
d52104dc7ee46eec8301d332a95d672270ac0bd1
TensorMol/TFNetworks/TFMolInstanceDirect.py
python
MolInstance_DirectBP_EE.train_step
(self, step)
return
Perform a single training step (complete processing of all input), using minibatches of size self.batch_size Args: step: the index of this step.
Perform a single training step (complete processing of all input), using minibatches of size self.batch_size
[ "Perform", "a", "single", "training", "step", "(", "complete", "processing", "of", "all", "input", ")", "using", "minibatches", "of", "size", "self", ".", "batch_size" ]
def train_step(self, step): """ Perform a single training step (complete processing of all input), using minibatches of size self.batch_size Args: step: the index of this step. """ Ncase_train = self.TData.NTrain start_time = time.time() train_loss = 0.0 train_energy_loss = 0.0 train_dipole_loss ...
[ "def", "train_step", "(", "self", ",", "step", ")", ":", "Ncase_train", "=", "self", ".", "TData", ".", "NTrain", "start_time", "=", "time", ".", "time", "(", ")", "train_loss", "=", "0.0", "train_energy_loss", "=", "0.0", "train_dipole_loss", "=", "0.0", ...
https://github.com/jparkhill/TensorMol/blob/d52104dc7ee46eec8301d332a95d672270ac0bd1/TensorMol/TFNetworks/TFMolInstanceDirect.py#L2666-L2705
google-research/morph-net
be4d79dea816c473007c5967d45ab4036306c21c
morph_net/tools/configurable_ops.py
python
decorator_from_parameterization_file
( filename, fallback_rule=FallbackRule.pass_through, **kwargs)
Create a ConfigurableOps from a parameterization file. Loads a json parameterization file from disk (as saved by tools.structure_exporter) and creates an ConfigurableOps from it. Args: filename: Path to a parameterization file in json format. fallback_rule: A `FallbackRule` enum which controls f...
Create a ConfigurableOps from a parameterization file.
[ "Create", "a", "ConfigurableOps", "from", "a", "parameterization", "file", "." ]
def decorator_from_parameterization_file( filename, fallback_rule=FallbackRule.pass_through, **kwargs): """Create a ConfigurableOps from a parameterization file. Loads a json parameterization file from disk (as saved by tools.structure_exporter) and creates an ConfigurableOps from it. Args: fi...
[ "def", "decorator_from_parameterization_file", "(", "filename", ",", "fallback_rule", "=", "FallbackRule", ".", "pass_through", ",", "*", "*", "kwargs", ")", ":", "with", "tf", ".", "gfile", ".", "Open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "p...
https://github.com/google-research/morph-net/blob/be4d79dea816c473007c5967d45ab4036306c21c/morph_net/tools/configurable_ops.py#L980-L1001
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/datetime.py
python
datetime.now
(cls, tz=None)
return cls.fromtimestamp(t, tz)
Construct a datetime from time.time() and optional time zone info.
Construct a datetime from time.time() and optional time zone info.
[ "Construct", "a", "datetime", "from", "time", ".", "time", "()", "and", "optional", "time", "zone", "info", "." ]
def now(cls, tz=None): "Construct a datetime from time.time() and optional time zone info." t = _time.time() return cls.fromtimestamp(t, tz)
[ "def", "now", "(", "cls", ",", "tz", "=", "None", ")", ":", "t", "=", "_time", ".", "time", "(", ")", "return", "cls", ".", "fromtimestamp", "(", "t", ",", "tz", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/datetime.py#L1413-L1416
cogitas3d/OrtogOnBlender
881e93f5beb2263e44c270974dd0e81deca44762
CompareTools.py
python
Subnasale_digi_pt.poll
(cls, context)
[]
def poll(cls, context): found = 'Subnasale digi' in bpy.data.objects if found == False: return True else: if found == True: return False
[ "def", "poll", "(", "cls", ",", "context", ")", ":", "found", "=", "'Subnasale digi'", "in", "bpy", ".", "data", ".", "objects", "if", "found", "==", "False", ":", "return", "True", "else", ":", "if", "found", "==", "True", ":", "return", "False" ]
https://github.com/cogitas3d/OrtogOnBlender/blob/881e93f5beb2263e44c270974dd0e81deca44762/CompareTools.py#L190-L198
tdoly/apk_parse
6917a54e1120f1b99d1f9ed1fe8913a1f02c7052
apk.py
python
APK.new_zip
(self, filename, deleted_files=None, new_files={})
Create a new zip file :param filename: the output filename of the zip :param deleted_files: a regex pattern to remove specific file :param new_files: a dictionnary of new files :type filename: string :type deleted_files: None or a string :type ne...
Create a new zip file
[ "Create", "a", "new", "zip", "file" ]
def new_zip(self, filename, deleted_files=None, new_files={}): """ Create a new zip file :param filename: the output filename of the zip :param deleted_files: a regex pattern to remove specific file :param new_files: a dictionnary of new files :type ...
[ "def", "new_zip", "(", "self", ",", "filename", ",", "deleted_files", "=", "None", ",", "new_files", "=", "{", "}", ")", ":", "if", "self", ".", "zipmodule", "==", "2", ":", "from", "androguard", ".", "patch", "import", "zipfile", "zout", "=", "zipfile...
https://github.com/tdoly/apk_parse/blob/6917a54e1120f1b99d1f9ed1fe8913a1f02c7052/apk.py#L591-L618
saffsd/langid.py
4153583eaeeadd88212a69ab5fa61a41283ae59b
langid/langid.py
python
set_languages
(langs=None)
return identifier.set_languages(langs)
Set the language set used by the global identifier. @param langs a list of language codes
Set the language set used by the global identifier.
[ "Set", "the", "language", "set", "used", "by", "the", "global", "identifier", "." ]
def set_languages(langs=None): """ Set the language set used by the global identifier. @param langs a list of language codes """ global identifier if identifier is None: load_model() return identifier.set_languages(langs)
[ "def", "set_languages", "(", "langs", "=", "None", ")", ":", "global", "identifier", "if", "identifier", "is", "None", ":", "load_model", "(", ")", "return", "identifier", ".", "set_languages", "(", "langs", ")" ]
https://github.com/saffsd/langid.py/blob/4153583eaeeadd88212a69ab5fa61a41283ae59b/langid/langid.py#L81-L91
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/feature/feature_selection/percentage_value_filter.py
python
PercentageValueFilter.fit
(self, data_instances, suffix)
return self
[]
def fit(self, data_instances, suffix): k = 1 while (1 / k) > self.upper_pct: k += 1 total_num = data_instances.count() thres_num = math.ceil(total_num * self.upper_pct) mode_res = self._find_kth_mode(data_instances, k) for col_index, mode_info in mode_res.it...
[ "def", "fit", "(", "self", ",", "data_instances", ",", "suffix", ")", ":", "k", "=", "1", "while", "(", "1", "/", "k", ")", ">", "self", ".", "upper_pct", ":", "k", "+=", "1", "total_num", "=", "data_instances", ".", "count", "(", ")", "thres_num",...
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/feature/feature_selection/percentage_value_filter.py#L42-L65
rajeshmajumdar/BruteXSS
ed08d0561a46d6553627ba7a26fd23fd792383e0
mechanize/_urllib2_fork.py
python
build_opener
(*handlers)
return opener
Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP, FTP and when applicable, HTTPS. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used.
Create an opener object from a list of handlers.
[ "Create", "an", "opener", "object", "from", "a", "list", "of", "handlers", "." ]
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP, FTP and when applicable, HTTPS. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will no...
[ "def", "build_opener", "(", "*", "handlers", ")", ":", "import", "types", "def", "isclass", "(", "obj", ")", ":", "return", "isinstance", "(", "obj", ",", "(", "types", ".", "ClassType", ",", "type", ")", ")", "opener", "=", "OpenerDirector", "(", ")",...
https://github.com/rajeshmajumdar/BruteXSS/blob/ed08d0561a46d6553627ba7a26fd23fd792383e0/mechanize/_urllib2_fork.py#L376-L413
Ridter/acefile
31f90219fb560364b6f5d27f512fccfae81d04f4
acefile.py
python
BitStream._getbits
(value, start, length)
return (value & mask) >> (32 - length - start)
Return *length* bits from byte *value*, starting at position *start*. Behaviour is undefined for start < 0, length < 0 or start + length > 32.
Return *length* bits from byte *value*, starting at position *start*. Behaviour is undefined for start < 0, length < 0 or start + length > 32.
[ "Return", "*", "length", "*", "bits", "from", "byte", "*", "value", "*", "starting", "at", "position", "*", "start", "*", ".", "Behaviour", "is", "undefined", "for", "start", "<", "0", "length", "<", "0", "or", "start", "+", "length", ">", "32", "." ...
def _getbits(value, start, length): """ Return *length* bits from byte *value*, starting at position *start*. Behaviour is undefined for start < 0, length < 0 or start + length > 32. """ #assert start >= 0 and length >= 0 and start + length <= 32 mask = ((0xFFFFFFFF << (3...
[ "def", "_getbits", "(", "value", ",", "start", ",", "length", ")", ":", "#assert start >= 0 and length >= 0 and start + length <= 32", "mask", "=", "(", "(", "0xFFFFFFFF", "<<", "(", "32", "-", "length", ")", ")", "&", "0xFFFFFFFF", ")", ">>", "start", "return...
https://github.com/Ridter/acefile/blob/31f90219fb560364b6f5d27f512fccfae81d04f4/acefile.py#L1003-L1010
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/utils/math.py
python
rotationMatrix
(rotation)
return matrix
[]
def rotationMatrix(rotation): matrix = Matrix.Rotation(rotation[2], 4, 'Z') matrix @= Matrix.Rotation(rotation[1], 4, 'Y') matrix @= Matrix.Rotation(rotation[0], 4, 'X') return matrix
[ "def", "rotationMatrix", "(", "rotation", ")", ":", "matrix", "=", "Matrix", ".", "Rotation", "(", "rotation", "[", "2", "]", ",", "4", ",", "'Z'", ")", "matrix", "@=", "Matrix", ".", "Rotation", "(", "rotation", "[", "1", "]", ",", "4", ",", "'Y'"...
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/utils/math.py#L24-L28
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/evil_genius_labs/light.py
python
EvilGeniusLight.async_turn_on
( self, **kwargs: Any, )
Turn light on.
Turn light on.
[ "Turn", "light", "on", "." ]
async def async_turn_on( self, **kwargs: Any, ) -> None: """Turn light on.""" if (brightness := kwargs.get(light.ATTR_BRIGHTNESS)) is not None: async with timeout(5): await self.coordinator.client.set_path_value("brightness", brightness) # Setting...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ",", ")", "->", "None", ":", "if", "(", "brightness", ":=", "kwargs", ".", "get", "(", "light", ".", "ATTR_BRIGHTNESS", ")", ")", "is", "not", "None", ":", "async", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/evil_genius_labs/light.py#L91-L114
isbg/isbg
e626d8d0628f691c041032c53f20d764b11d0079
isbg/isbg.py
python
ISBG.do_imap_logout
(self)
Sign off from the imap connection.
Sign off from the imap connection.
[ "Sign", "off", "from", "the", "imap", "connection", "." ]
def do_imap_logout(self): """Sign off from the imap connection.""" self.imap.logout()
[ "def", "do_imap_logout", "(", "self", ")", ":", "self", ".", "imap", ".", "logout", "(", ")" ]
https://github.com/isbg/isbg/blob/e626d8d0628f691c041032c53f20d764b11d0079/isbg/isbg.py#L538-L540
abhinavsingh/proxy.py
c6fceb639a5925994f04b15b333413693eb434eb
proxy/http/proxy/plugin.py
python
HttpProxyBasePlugin.on_access_log
(self, context: Dict[str, Any])
return context
Use this method to override default access log format (see DEFAULT_HTTP_ACCESS_LOG_FORMAT and DEFAULT_HTTPS_ACCESS_LOG_FORMAT) and to add/update/modify/delete context for next plugin.on_access_log invocation. This is specially useful if a plugins want to provide extra context in the acc...
Use this method to override default access log format (see DEFAULT_HTTP_ACCESS_LOG_FORMAT and DEFAULT_HTTPS_ACCESS_LOG_FORMAT) and to add/update/modify/delete context for next plugin.on_access_log invocation.
[ "Use", "this", "method", "to", "override", "default", "access", "log", "format", "(", "see", "DEFAULT_HTTP_ACCESS_LOG_FORMAT", "and", "DEFAULT_HTTPS_ACCESS_LOG_FORMAT", ")", "and", "to", "add", "/", "update", "/", "modify", "/", "delete", "context", "for", "next",...
def on_access_log(self, context: Dict[str, Any]) -> Optional[Dict[str, Any]]: """Use this method to override default access log format (see DEFAULT_HTTP_ACCESS_LOG_FORMAT and DEFAULT_HTTPS_ACCESS_LOG_FORMAT) and to add/update/modify/delete context for next plugin.on_access_log invocation. ...
[ "def", "on_access_log", "(", "self", ",", "context", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "return", "context" ]
https://github.com/abhinavsingh/proxy.py/blob/c6fceb639a5925994f04b15b333413693eb434eb/proxy/http/proxy/plugin.py#L151-L163
hongyi-zhang/mixup
80000cea340bf829a52481ae45a317a487ce2deb
cifar/models/shufflenet.py
python
ShuffleBlock.forward
(self, x)
return x.view(N,g,C/g,H,W).permute(0,2,1,3,4).contiguous().view(N,C,H,W)
Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]
Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]
[ "Channel", "shuffle", ":", "[", "N", "C", "H", "W", "]", "-", ">", "[", "N", "g", "C", "/", "g", "H", "W", "]", "-", ">", "[", "N", "C", "/", "g", "g", "H", "w", "]", "-", ">", "[", "N", "C", "H", "W", "]" ]
def forward(self, x): '''Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]''' N,C,H,W = x.size() g = self.groups return x.view(N,g,C/g,H,W).permute(0,2,1,3,4).contiguous().view(N,C,H,W)
[ "def", "forward", "(", "self", ",", "x", ")", ":", "N", ",", "C", ",", "H", ",", "W", "=", "x", ".", "size", "(", ")", "g", "=", "self", ".", "groups", "return", "x", ".", "view", "(", "N", ",", "g", ",", "C", "/", "g", ",", "H", ",", ...
https://github.com/hongyi-zhang/mixup/blob/80000cea340bf829a52481ae45a317a487ce2deb/cifar/models/shufflenet.py#L17-L21
lukelbd/proplot
d0bc9c0857d9295b380b8613ef9aba81d50a067c
proplot/scale.py
python
PowerTransform.transform_non_affine
(self, a)
[]
def transform_non_affine(self, a): with np.errstate(divide='ignore', invalid='ignore'): return np.power(a, self._power)
[ "def", "transform_non_affine", "(", "self", ",", "a", ")", ":", "with", "np", ".", "errstate", "(", "divide", "=", "'ignore'", ",", "invalid", "=", "'ignore'", ")", ":", "return", "np", ".", "power", "(", "a", ",", "self", ".", "_power", ")" ]
https://github.com/lukelbd/proplot/blob/d0bc9c0857d9295b380b8613ef9aba81d50a067c/proplot/scale.py#L434-L436
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txdav/base/datastore/suboracle.py
python
OracleService.__init__
( self, dataStoreDirectory, subServiceFactory, dsnUser=None, testMode=False, reactor=None, )
Initialize a L{OracleService} pointed at a data store directory. @param dataStoreDirectory: the directory to @type dataStoreDirectory: L{twext.python.filepath.CachingFilePath} @param subServiceFactory: a 1-arg callable that will be called with a 1-arg callable which returns a DB-AP...
Initialize a L{OracleService} pointed at a data store directory.
[ "Initialize", "a", "L", "{", "OracleService", "}", "pointed", "at", "a", "data", "store", "directory", "." ]
def __init__( self, dataStoreDirectory, subServiceFactory, dsnUser=None, testMode=False, reactor=None, ): """ Initialize a L{OracleService} pointed at a data store directory. @param dataStoreDirectory: the directory to @type dataStoreDirectory: L{twex...
[ "def", "__init__", "(", "self", ",", "dataStoreDirectory", ",", "subServiceFactory", ",", "dsnUser", "=", "None", ",", "testMode", "=", "False", ",", "reactor", "=", "None", ",", ")", ":", "MultiService", ".", "__init__", "(", "self", ")", "self", ".", "...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/base/datastore/suboracle.py#L38-L63
census-instrumentation/opencensus-python
15c122dd7e0187b35f956f5d3b77b78455a2aadb
opencensus/trace/samplers/__init__.py
python
ProbabilitySampler.should_sample
(self, span_context)
return lower_long <= bound
Make the sampling decision based on the lower 8 bytes of the trace ID. If the value is less than the bound, return True, else False. :type span_context: :class:`opencensus.trace.span_context.SpanContext` :param span_context: The span context. :rtype: bool :returns: Whether to s...
Make the sampling decision based on the lower 8 bytes of the trace ID. If the value is less than the bound, return True, else False.
[ "Make", "the", "sampling", "decision", "based", "on", "the", "lower", "8", "bytes", "of", "the", "trace", "ID", ".", "If", "the", "value", "is", "less", "than", "the", "bound", "return", "True", "else", "False", "." ]
def should_sample(self, span_context): """Make the sampling decision based on the lower 8 bytes of the trace ID. If the value is less than the bound, return True, else False. :type span_context: :class:`opencensus.trace.span_context.SpanContext` :param span_context: The span context. ...
[ "def", "should_sample", "(", "self", ",", "span_context", ")", ":", "if", "span_context", ".", "trace_options", ".", "get_enabled", "(", ")", ":", "return", "True", "lower_long", "=", "get_lower_long_from_trace_id", "(", "span_context", ".", "trace_id", ")", "bo...
https://github.com/census-instrumentation/opencensus-python/blob/15c122dd7e0187b35f956f5d3b77b78455a2aadb/opencensus/trace/samplers/__init__.py#L66-L81
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/utilities/settings.py
python
delete_setting
(key, qsettings=None)
Delete setting from QSettings under InaSAFE scope. :param key: Unique key for setting. :type key: basestring :param qsettings: A custom QSettings to use. If it's not defined, it will use the default one. :type qsettings: qgis.PyQt.QtCore.QSettings
Delete setting from QSettings under InaSAFE scope.
[ "Delete", "setting", "from", "QSettings", "under", "InaSAFE", "scope", "." ]
def delete_setting(key, qsettings=None): """Delete setting from QSettings under InaSAFE scope. :param key: Unique key for setting. :type key: basestring :param qsettings: A custom QSettings to use. If it's not defined, it will use the default one. :type qsettings: qgis.PyQt.QtCore.QSetting...
[ "def", "delete_setting", "(", "key", ",", "qsettings", "=", "None", ")", ":", "full_key", "=", "'%s/%s'", "%", "(", "APPLICATION_NAME", ",", "key", ")", "delete_general_setting", "(", "full_key", ",", "qsettings", ")" ]
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/utilities/settings.py#L159-L170
projecthamster/hamster
19d160090de30e756bdc3122ff935bdaa86e2843
src/hamster/lib/graphics.py
python
Graphics.circle
(self, x, y, radius)
draw circle
draw circle
[ "draw", "circle" ]
def circle(self, x, y, radius): """draw circle""" self._add_instruction("arc", x, y, radius, 0, math.pi * 2)
[ "def", "circle", "(", "self", ",", "x", ",", "y", ",", "radius", ")", ":", "self", ".", "_add_instruction", "(", "\"arc\"", ",", "x", ",", "y", ",", "radius", ",", "0", ",", "math", ".", "pi", "*", "2", ")" ]
https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/src/hamster/lib/graphics.py#L366-L368
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/codecs.py
python
BufferedIncrementalDecoder.getstate
(self)
return (self.buffer, 0)
[]
def getstate(self): # additional state info is always 0 return (self.buffer, 0)
[ "def", "getstate", "(", "self", ")", ":", "# additional state info is always 0", "return", "(", "self", ".", "buffer", ",", "0", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/codecs.py#L323-L325
kamalgill/flask-appengine-template
11760f83faccbb0d0afe416fc58e67ecfb4643c2
src/lib/werkzeug/routing.py
python
Map.__init__
(self, rules=None, default_subdomain='', charset='utf-8', strict_slashes=True, redirect_defaults=True, converters=None, sort_parameters=False, sort_key=None, encoding_errors='replace', host_matching=False)
[]
def __init__(self, rules=None, default_subdomain='', charset='utf-8', strict_slashes=True, redirect_defaults=True, converters=None, sort_parameters=False, sort_key=None, encoding_errors='replace', host_matching=False): self._rules = [] self._rules_by_en...
[ "def", "__init__", "(", "self", ",", "rules", "=", "None", ",", "default_subdomain", "=", "''", ",", "charset", "=", "'utf-8'", ",", "strict_slashes", "=", "True", ",", "redirect_defaults", "=", "True", ",", "converters", "=", "None", ",", "sort_parameters",...
https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/werkzeug/routing.py#L1142-L1166
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/setuptools/command/sdist.py
python
sdist.read_manifest
(self)
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
[ "Read", "the", "manifest", "file", "(", "named", "by", "self", ".", "manifest", ")", "and", "use", "it", "to", "fill", "in", "self", ".", "filelist", "the", "list", "of", "files", "to", "include", "in", "the", "source", "distribution", "." ]
def read_manifest(self): """Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution. """ log.info("reading manifest file '%s'", self.manifest) manifest = open(self.manifest, 'rbU') ...
[ "def", "read_manifest", "(", "self", ")", ":", "log", ".", "info", "(", "\"reading manifest file '%s'\"", ",", "self", ".", "manifest", ")", "manifest", "=", "open", "(", "self", ".", "manifest", ",", "'rbU'", ")", "for", "line", "in", "manifest", ":", "...
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/setuptools/command/sdist.py#L176-L196
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/system.py
python
System.fqdn
(self)
return socket.getfqdn()
@returns Fully qualified domain name, eg 'somesvr.somestudio.com'
[]
def fqdn(self): """ @returns Fully qualified domain name, eg 'somesvr.somestudio.com' """ import socket return socket.getfqdn()
[ "def", "fqdn", "(", "self", ")", ":", "import", "socket", "return", "socket", ".", "getfqdn", "(", ")" ]
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/system.py#L184-L189
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/sites.py
python
Sites.__iter__
(self)
return self.yieldSites(excludeNone=True)
Returns all non-None sites. Order is oldest first. >>> n = note.Note() >>> m = stream.Measure(number=1) >>> s = stream.Stream(id='thisStream') >>> m.insert(10, n) >>> s.insert(20, n) >>> for site in n.sites: ... print(site, n.getOffsetBySite(site)) <...
Returns all non-None sites. Order is oldest first.
[ "Returns", "all", "non", "-", "None", "sites", ".", "Order", "is", "oldest", "first", "." ]
def __iter__(self): ''' Returns all non-None sites. Order is oldest first. >>> n = note.Note() >>> m = stream.Measure(number=1) >>> s = stream.Stream(id='thisStream') >>> m.insert(10, n) >>> s.insert(20, n) >>> for site in n.sites: ... print(...
[ "def", "__iter__", "(", "self", ")", ":", "return", "self", ".", "yieldSites", "(", "excludeNone", "=", "True", ")" ]
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/sites.py#L300-L314
MycroftAI/adapt
4445f3cc875009ef31f03dba0e8355a085a655b3
adapt/engine.py
python
IntentDeterminationEngine.drop_intent_parser
(self, parser_names)
return len(self.intent_parsers) != num_original_parsers
Drop a registered intent parser. Arguments: parser_names (str or iterable): parser name to drop or list of names Returns: (bool) True if a parser was dropped else False
Drop a registered intent parser.
[ "Drop", "a", "registered", "intent", "parser", "." ]
def drop_intent_parser(self, parser_names): """Drop a registered intent parser. Arguments: parser_names (str or iterable): parser name to drop or list of names Returns: (bool) True if a parser was dropped else False ""...
[ "def", "drop_intent_parser", "(", "self", ",", "parser_names", ")", ":", "if", "isinstance", "(", "parser_names", ",", "str", ")", ":", "parser_names", "=", "[", "parser_names", "]", "new_parsers", "=", "[", "p", "for", "p", "in", "self", ".", "intent_pars...
https://github.com/MycroftAI/adapt/blob/4445f3cc875009ef31f03dba0e8355a085a655b3/adapt/engine.py#L194-L212
tensorpack/tensorpack
fac024f0f72fd593ea243f0b599a51b11fe4effd
tensorpack/train/trainers.py
python
BytePSTrainer.mpi_enabled
(self)
return False
Returns: bool: whether hvd is currently running under MPI
Returns: bool: whether hvd is currently running under MPI
[ "Returns", ":", "bool", ":", "whether", "hvd", "is", "currently", "running", "under", "MPI" ]
def mpi_enabled(self): """ Returns: bool: whether hvd is currently running under MPI """ return False
[ "def", "mpi_enabled", "(", "self", ")", ":", "return", "False" ]
https://github.com/tensorpack/tensorpack/blob/fac024f0f72fd593ea243f0b599a51b11fe4effd/tensorpack/train/trainers.py#L559-L564
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/graphics/widgetbase.py
python
Sizer._addNamedNode
(self,name,node)
if name is not None add an attribute pointing to node and add to the attrMap
if name is not None add an attribute pointing to node and add to the attrMap
[ "if", "name", "is", "not", "None", "add", "an", "attribute", "pointing", "to", "node", "and", "add", "to", "the", "attrMap" ]
def _addNamedNode(self,name,node): 'if name is not None add an attribute pointing to node and add to the attrMap' if name: if name not in list(self._attrMap.keys()): self._attrMap[name] = AttrMapValue(isValidChild) setattr(self, name, node)
[ "def", "_addNamedNode", "(", "self", ",", "name", ",", "node", ")", ":", "if", "name", ":", "if", "name", "not", "in", "list", "(", "self", ".", "_attrMap", ".", "keys", "(", ")", ")", ":", "self", ".", "_attrMap", "[", "name", "]", "=", "AttrMap...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/graphics/widgetbase.py#L454-L459
jupyter/nbgrader
1ae2886e4e734554d8667c6e86861e83cc161451
nbgrader/utils.py
python
is_grade
(cell: NotebookNode)
return cell.metadata['nbgrader'].get('grade', False)
Returns True if the cell is a grade cell.
Returns True if the cell is a grade cell.
[ "Returns", "True", "if", "the", "cell", "is", "a", "grade", "cell", "." ]
def is_grade(cell: NotebookNode) -> bool: """Returns True if the cell is a grade cell.""" if 'nbgrader' not in cell.metadata: return False return cell.metadata['nbgrader'].get('grade', False)
[ "def", "is_grade", "(", "cell", ":", "NotebookNode", ")", "->", "bool", ":", "if", "'nbgrader'", "not", "in", "cell", ".", "metadata", ":", "return", "False", "return", "cell", ".", "metadata", "[", "'nbgrader'", "]", ".", "get", "(", "'grade'", ",", "...
https://github.com/jupyter/nbgrader/blob/1ae2886e4e734554d8667c6e86861e83cc161451/nbgrader/utils.py#L39-L43
osquery/osquery-python
586c79f640af18a4c6fff1df04aaeea52b40c94b
setup.py
python
GenerateThriftCommand.run
(self)
Run the command
Run the command
[ "Run", "the", "command" ]
def run(self): """Run the command""" system("thrift -gen py -out . osquery.thrift") system("rm osquery/extensions/*-remote") system("rm __init__.py")
[ "def", "run", "(", "self", ")", ":", "system", "(", "\"thrift -gen py -out . osquery.thrift\"", ")", "system", "(", "\"rm osquery/extensions/*-remote\"", ")", "system", "(", "\"rm __init__.py\"", ")" ]
https://github.com/osquery/osquery-python/blob/586c79f640af18a4c6fff1df04aaeea52b40c94b/setup.py#L25-L29
snorkel-team/snorkel-tutorials
23bd9525a713a2faaff2cbe0d9123d1c52381958
visual_relation/model.py
python
union
(bbox1, bbox2)
return [y0, y1, x0, x1]
Create the union of the two bboxes. Parameters ---------- bbox1 Coordinates of first bounding box bbox2 Coordinates of second bounding box Returns ------- [y0, y1, x0, x1] Coordinates of union of input bounding boxes
Create the union of the two bboxes.
[ "Create", "the", "union", "of", "the", "two", "bboxes", "." ]
def union(bbox1, bbox2): """Create the union of the two bboxes. Parameters ---------- bbox1 Coordinates of first bounding box bbox2 Coordinates of second bounding box Returns ------- [y0, y1, x0, x1] Coordinates of union of input bounding boxes """ y0 =...
[ "def", "union", "(", "bbox1", ",", "bbox2", ")", ":", "y0", "=", "min", "(", "bbox1", "[", "0", "]", ",", "bbox2", "[", "0", "]", ")", "y1", "=", "max", "(", "bbox1", "[", "1", "]", ",", "bbox2", "[", "1", "]", ")", "x0", "=", "min", "(",...
https://github.com/snorkel-team/snorkel-tutorials/blob/23bd9525a713a2faaff2cbe0d9123d1c52381958/visual_relation/model.py#L17-L37
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/tencentcloud/dts/v20180330/dts_client.py
python
DtsClient.DescribeMigrateCheckJob
(self, request)
本接口用于创建校验后,获取校验的结果. 能查询到当前校验的状态和进度. 若通过校验, 则可调用'StartMigrateJob' 开始迁移. 若未通过校验, 则能查询到校验失败的原因. 请按照报错, 通过'ModifyMigrateJob'修改迁移配置或是调整源/目标实例的相关参数. :param request: 调用DescribeMigrateCheckJob所需参数的结构体。 :type request: :class:`tencentcloud.dts.v20180330.models.DescribeMigrateCheckJobRequest` ...
本接口用于创建校验后,获取校验的结果. 能查询到当前校验的状态和进度. 若通过校验, 则可调用'StartMigrateJob' 开始迁移. 若未通过校验, 则能查询到校验失败的原因. 请按照报错, 通过'ModifyMigrateJob'修改迁移配置或是调整源/目标实例的相关参数.
[ "本接口用于创建校验后", "获取校验的结果", ".", "能查询到当前校验的状态和进度", ".", "若通过校验", "则可调用", "StartMigrateJob", "开始迁移", ".", "若未通过校验", "则能查询到校验失败的原因", ".", "请按照报错", "通过", "ModifyMigrateJob", "修改迁移配置或是调整源", "/", "目标实例的相关参数", "." ]
def DescribeMigrateCheckJob(self, request): """本接口用于创建校验后,获取校验的结果. 能查询到当前校验的状态和进度. 若通过校验, 则可调用'StartMigrateJob' 开始迁移. 若未通过校验, 则能查询到校验失败的原因. 请按照报错, 通过'ModifyMigrateJob'修改迁移配置或是调整源/目标实例的相关参数. :param request: 调用DescribeMigrateCheckJob所需参数的结构体。 :type request: :class:`tencentcloud.dt...
[ "def", "DescribeMigrateCheckJob", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeMigrateCheckJob\"", ",", "params", ")", "response", "=", "json", "...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/dts/v20180330/dts_client.py#L146-L173
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pkg_resources/__init__.py
python
EntryPoint._parse_extras
(cls, extras_spec)
return req.extras
[]
def _parse_extras(cls, extras_spec): if not extras_spec: return () req = Requirement.parse('x' + extras_spec) if req.specs: raise ValueError() return req.extras
[ "def", "_parse_extras", "(", "cls", ",", "extras_spec", ")", ":", "if", "not", "extras_spec", ":", "return", "(", ")", "req", "=", "Requirement", ".", "parse", "(", "'x'", "+", "extras_spec", ")", "if", "req", ".", "specs", ":", "raise", "ValueError", ...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/__init__.py#L2498-L2504
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_secret.py
python
Yedit.valid_key
(key, sep='.')
return True
validate the incoming key
validate the incoming key
[ "validate", "the", "incoming", "key" ]
def valid_key(key, sep='.'): '''validate the incoming key''' common_separators = list(Yedit.com_sep - set([sep])) if not re.match(Yedit.re_valid_key.format(''.join(common_separators)), key): return False return True
[ "def", "valid_key", "(", "key", ",", "sep", "=", "'.'", ")", ":", "common_separators", "=", "list", "(", "Yedit", ".", "com_sep", "-", "set", "(", "[", "sep", "]", ")", ")", "if", "not", "re", ".", "match", "(", "Yedit", ".", "re_valid_key", ".", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_secret.py#L250-L256
oleg-yaroshevskiy/quest_qa_labeling
730a9632314e54584f69f909d5e2ef74d843e02c
packages/fairseq-hacked/fairseq/models/fairseq_decoder.py
python
FairseqDecoder.get_normalized_probs
(self, net_output, log_probs, sample)
Get normalized probabilities (or log probs) from a net's output.
Get normalized probabilities (or log probs) from a net's output.
[ "Get", "normalized", "probabilities", "(", "or", "log", "probs", ")", "from", "a", "net", "s", "output", "." ]
def get_normalized_probs(self, net_output, log_probs, sample): """Get normalized probabilities (or log probs) from a net's output.""" if hasattr(self, "adaptive_softmax") and self.adaptive_softmax is not None: if sample is not None: assert "target" in sample ...
[ "def", "get_normalized_probs", "(", "self", ",", "net_output", ",", "log_probs", ",", "sample", ")", ":", "if", "hasattr", "(", "self", ",", "\"adaptive_softmax\"", ")", "and", "self", ".", "adaptive_softmax", "is", "not", "None", ":", "if", "sample", "is", ...
https://github.com/oleg-yaroshevskiy/quest_qa_labeling/blob/730a9632314e54584f69f909d5e2ef74d843e02c/packages/fairseq-hacked/fairseq/models/fairseq_decoder.py#L56-L72
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/verify/v2/service/rate_limit/bucket.py
python
BucketInstance.fetch
(self)
return self._proxy.fetch()
Fetch the BucketInstance :returns: The fetched BucketInstance :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance
Fetch the BucketInstance
[ "Fetch", "the", "BucketInstance" ]
def fetch(self): """ Fetch the BucketInstance :returns: The fetched BucketInstance :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance """ return self._proxy.fetch()
[ "def", "fetch", "(", "self", ")", ":", "return", "self", ".", "_proxy", ".", "fetch", "(", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/verify/v2/service/rate_limit/bucket.py#L434-L441
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/xml/sax/xmlreader.py
python
InputSource.setByteStream
(self, bytefile)
Set the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itsel...
Set the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source.
[ "Set", "the", "byte", "stream", "(", "a", "Python", "file", "-", "like", "object", "which", "does", "not", "perform", "byte", "-", "to", "-", "character", "conversion", ")", "for", "this", "input", "source", "." ]
def setByteStream(self, bytefile): """Set the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in prefer...
[ "def", "setByteStream", "(", "self", ",", "bytefile", ")", ":", "self", ".", "__bytefile", "=", "bytefile" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/xml/sax/xmlreader.py#L240-L251
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pyqode/core/modes/filewatcher.py
python
FileWatcherMode.auto_reload
(self, value)
[]
def auto_reload(self, value): self._auto_reload = value if self.editor: # propagate changes to every clone for clone in self.editor.clones: try: clone.modes.get(FileWatcherMode).auto_reload = value except KeyError: ...
[ "def", "auto_reload", "(", "self", ",", "value", ")", ":", "self", ".", "_auto_reload", "=", "value", "if", "self", ".", "editor", ":", "# propagate changes to every clone", "for", "clone", "in", "self", ".", "editor", ".", "clones", ":", "try", ":", "clon...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/modes/filewatcher.py#L34-L43
Qirky/FoxDot
76318f9630bede48ff3994146ed644affa27bfa4
FoxDot/lib/Workspace/TextBox.py
python
ThreadedText.remove_selection
(self)
return
Removes selection from the entire document
Removes selection from the entire document
[ "Removes", "selection", "from", "the", "entire", "document" ]
def remove_selection(self): """ Removes selection from the entire document """ self.tag_remove(SEL, "1.0", END) return
[ "def", "remove_selection", "(", "self", ")", ":", "self", ".", "tag_remove", "(", "SEL", ",", "\"1.0\"", ",", "END", ")", "return" ]
https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/Workspace/TextBox.py#L71-L74
pcbje/gransk
63be498ecc7115c55271e51f4ef27fe170d4f3f2
gransk/api.py
python
Subscriber.setup
(self, config)
Set maximum document size. :param config: Configuration object. :type config: ``dict``
Set maximum document size.
[ "Set", "maximum", "document", "size", "." ]
def setup(self, config): """ Set maximum document size. :param config: Configuration object. :type config: ``dict`` """ super(Subscriber, self).setup(config) self.max_size = config.get(helper.MAX_FILE_SIZE, 0) * 1024 * 1024 self.diskimages = set( config.get(helper.EXT_TYPES, {})...
[ "def", "setup", "(", "self", ",", "config", ")", ":", "super", "(", "Subscriber", ",", "self", ")", ".", "setup", "(", "config", ")", "self", ".", "max_size", "=", "config", ".", "get", "(", "helper", ".", "MAX_FILE_SIZE", ",", "0", ")", "*", "1024...
https://github.com/pcbje/gransk/blob/63be498ecc7115c55271e51f4ef27fe170d4f3f2/gransk/api.py#L38-L48
DxCx/plugin.video.9anime
34358c2f701e5ddf19d3276926374a16f63f7b6a
resources/lib/ui/js2py/prototypes/jsstring.py
python
StringPrototype.toLocaleLowerCase
()
return this.Js(this.to_string().value.lower())
[]
def toLocaleLowerCase(): this.cok() return this.Js(this.to_string().value.lower())
[ "def", "toLocaleLowerCase", "(", ")", ":", "this", ".", "cok", "(", ")", "return", "this", ".", "Js", "(", "this", ".", "to_string", "(", ")", ".", "value", ".", "lower", "(", ")", ")" ]
https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/prototypes/jsstring.py#L279-L281
werner-duvaud/muzero-general
23a1f6910e97d78475ccd29576cdd107c5afefd2
self_play.py
python
Node.expand
(self, actions, to_play, reward, policy_logits, hidden_state)
We expand a node using the value, reward and policy prediction obtained from the neural network.
We expand a node using the value, reward and policy prediction obtained from the neural network.
[ "We", "expand", "a", "node", "using", "the", "value", "reward", "and", "policy", "prediction", "obtained", "from", "the", "neural", "network", "." ]
def expand(self, actions, to_play, reward, policy_logits, hidden_state): """ We expand a node using the value, reward and policy prediction obtained from the neural network. """ self.to_play = to_play self.reward = reward self.hidden_state = hidden_state ...
[ "def", "expand", "(", "self", ",", "actions", ",", "to_play", ",", "reward", ",", "policy_logits", ",", "hidden_state", ")", ":", "self", ".", "to_play", "=", "to_play", "self", ".", "reward", "=", "reward", "self", ".", "hidden_state", "=", "hidden_state"...
https://github.com/werner-duvaud/muzero-general/blob/23a1f6910e97d78475ccd29576cdd107c5afefd2/self_play.py#L452-L466
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/feaLib/ast.py
python
VariationBlock.asFea
(self, indent="")
return res
[]
def asFea(self, indent=""): res = indent + "variation %s " % self.name.strip() res += self.conditionset + " " if self.use_extension: res += "useExtension " res += "{\n" res += Block.asFea(self, indent=indent) res += indent + "} %s;\n" % self.name.strip() ...
[ "def", "asFea", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "res", "=", "indent", "+", "\"variation %s \"", "%", "self", ".", "name", ".", "strip", "(", ")", "res", "+=", "self", ".", "conditionset", "+", "\" \"", "if", "self", ".", "use_exten...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/feaLib/ast.py#L2120-L2128
openstack/trove
be86b79119d16ee77f596172f43b0c97cb2617bd
trove/common/base_wsgi.py
python
Request.get_content_type
(self, allowed_content_types=None)
return content_type
Determine content type of the request body. Does not do any body introspection, only checks header
Determine content type of the request body.
[ "Determine", "content", "type", "of", "the", "request", "body", "." ]
def get_content_type(self, allowed_content_types=None): """Determine content type of the request body. Does not do any body introspection, only checks header """ if "Content-Type" not in self.headers: return None content_type = self.content_type allowed_con...
[ "def", "get_content_type", "(", "self", ",", "allowed_content_types", "=", "None", ")", ":", "if", "\"Content-Type\"", "not", "in", "self", ".", "headers", ":", "return", "None", "content_type", "=", "self", ".", "content_type", "allowed_content_types", "=", "("...
https://github.com/openstack/trove/blob/be86b79119d16ee77f596172f43b0c97cb2617bd/trove/common/base_wsgi.py#L317-L332
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/stats/crv_types.py
python
BetaNoncentral
(name, alpha, beta, lamda)
return rv(name, BetaNoncentralDistribution, (alpha, beta, lamda))
r""" Create a Continuous Random Variable with a Type I Noncentral Beta distribution. The density of the Noncentral Beta distribution is given by .. math:: f(x) := \sum_{k=0}^\infty e^{-\lambda/2}\frac{(\lambda/2)^k}{k!} \frac{x^{\alpha+k-1}(1-x)^{\beta-1}}{\mathrm{B}(\alpha+k,\beta...
r""" Create a Continuous Random Variable with a Type I Noncentral Beta distribution.
[ "r", "Create", "a", "Continuous", "Random", "Variable", "with", "a", "Type", "I", "Noncentral", "Beta", "distribution", "." ]
def BetaNoncentral(name, alpha, beta, lamda): r""" Create a Continuous Random Variable with a Type I Noncentral Beta distribution. The density of the Noncentral Beta distribution is given by .. math:: f(x) := \sum_{k=0}^\infty e^{-\lambda/2}\frac{(\lambda/2)^k}{k!} \frac{x^{\al...
[ "def", "BetaNoncentral", "(", "name", ",", "alpha", ",", "beta", ",", "lamda", ")", ":", "return", "rv", "(", "name", ",", "BetaNoncentralDistribution", ",", "(", "alpha", ",", "beta", ",", "lamda", ")", ")" ]
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/stats/crv_types.py#L502-L569
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/core/defchararray.py
python
chararray.translate
(self, table, deletechars=None)
return asarray(translate(self, table, deletechars))
For each element in `self`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table. See also -------- char.translate
For each element in `self`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table.
[ "For", "each", "element", "in", "self", "return", "a", "copy", "of", "the", "string", "where", "all", "characters", "occurring", "in", "the", "optional", "argument", "deletechars", "are", "removed", "and", "the", "remaining", "characters", "have", "been", "map...
def translate(self, table, deletechars=None): """ For each element in `self`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table. ...
[ "def", "translate", "(", "self", ",", "table", ",", "deletechars", "=", "None", ")", ":", "return", "asarray", "(", "translate", "(", "self", ",", "table", ",", "deletechars", ")", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/core/defchararray.py#L2413-L2425
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/chamber.py
python
getNewRepository
()
return ChamberRepository()
Get new repository.
Get new repository.
[ "Get", "new", "repository", "." ]
def getNewRepository(): 'Get new repository.' return ChamberRepository()
[ "def", "getNewRepository", "(", ")", ":", "return", "ChamberRepository", "(", ")" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/chamber.py#L195-L197
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/utils/__init__.py
python
splitext
(path)
return base, ext
Like os.path.splitext, but take off .tar too
Like os.path.splitext, but take off .tar too
[ "Like", "os", ".", "path", ".", "splitext", "but", "take", "off", ".", "tar", "too" ]
def splitext(path): """Like os.path.splitext, but take off .tar too""" base, ext = posixpath.splitext(path) if base.lower().endswith('.tar'): ext = base[-4:] + ext base = base[:-4] return base, ext
[ "def", "splitext", "(", "path", ")", ":", "base", ",", "ext", "=", "posixpath", ".", "splitext", "(", "path", ")", "if", "base", ".", "lower", "(", ")", ".", "endswith", "(", "'.tar'", ")", ":", "ext", "=", "base", "[", "-", "4", ":", "]", "+",...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/utils/__init__.py#L251-L257
rnd-team-dev/plotoptix
d8c12fd18ceae4af0fc1a4644add9f5878239760
plotoptix/npoptix.py
python
NpOptiX.get_float3
(self, name: str)
Get shader ``float3`` variable with given ``name``. Parameters ---------- name : string Variable name. Returns ------- out : tuple (float, float, float) Value (x, y, z) of the variable or ``(None, None, None)`` if variable not found.
Get shader ``float3`` variable with given ``name``.
[ "Get", "shader", "float3", "variable", "with", "given", "name", "." ]
def get_float3(self, name: str) -> (Optional[float], Optional[float], Optional[float]): """Get shader ``float3`` variable with given ``name``. Parameters ---------- name : string Variable name. Returns ------- out : tuple (float, float, float) ...
[ "def", "get_float3", "(", "self", ",", "name", ":", "str", ")", "->", "(", "Optional", "[", "float", "]", ",", "Optional", "[", "float", "]", ",", "Optional", "[", "float", "]", ")", ":", "if", "not", "isinstance", "(", "name", ",", "str", ")", "...
https://github.com/rnd-team-dev/plotoptix/blob/d8c12fd18ceae4af0fc1a4644add9f5878239760/plotoptix/npoptix.py#L919-L944
yihui-he/KL-Loss
66c0ed9e886a2218f4cf88c0efd4f40199bff54a
detectron/ops/collect_and_distribute_fpn_rpn_proposals.py
python
CollectAndDistributeFpnRpnProposalsOp.forward
(self, inputs, outputs)
See modeling.detector.CollectAndDistributeFpnRpnProposals for inputs/outputs documentation.
See modeling.detector.CollectAndDistributeFpnRpnProposals for inputs/outputs documentation.
[ "See", "modeling", ".", "detector", ".", "CollectAndDistributeFpnRpnProposals", "for", "inputs", "/", "outputs", "documentation", "." ]
def forward(self, inputs, outputs): """See modeling.detector.CollectAndDistributeFpnRpnProposals for inputs/outputs documentation. """ # inputs is # [rpn_rois_fpn2, ..., rpn_rois_fpn6, # rpn_roi_probs_fpn2, ..., rpn_roi_probs_fpn6] # If training with Faster R-CNN...
[ "def", "forward", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "# inputs is", "# [rpn_rois_fpn2, ..., rpn_rois_fpn6,", "# rpn_roi_probs_fpn2, ..., rpn_roi_probs_fpn6]", "# If training with Faster R-CNN, then inputs will additionally include", "# + [roidb, im_info]", "rois", ...
https://github.com/yihui-he/KL-Loss/blob/66c0ed9e886a2218f4cf88c0efd4f40199bff54a/detectron/ops/collect_and_distribute_fpn_rpn_proposals.py#L35-L68
devopshq/tfs
56644a36dd34457dec6922eb144c21db320f16e7
tfs/resources.py
python
TFSObject.__init__
(self, data=None, tfs=None, uri='', underProject=None)
Base tfs resource object initialization :param data: raw content of the resource :param tfs: ``TFSAPI`` instance :type tfs: TFSAPI :param uri: uri of resource :type uri: str :param underProject: resource is under the project in the path
Base tfs resource object initialization
[ "Base", "tfs", "resource", "object", "initialization" ]
def __init__(self, data=None, tfs=None, uri='', underProject=None): """ Base tfs resource object initialization :param data: raw content of the resource :param tfs: ``TFSAPI`` instance :type tfs: TFSAPI :param uri: uri of resource :type uri: str :param un...
[ "def", "__init__", "(", "self", ",", "data", "=", "None", ",", "tfs", "=", "None", ",", "uri", "=", "''", ",", "underProject", "=", "None", ")", ":", "# TODO: CaseInsensitive Dict", "self", ".", "tfs", "=", "tfs", "self", ".", "_uri", "=", "uri", "se...
https://github.com/devopshq/tfs/blob/56644a36dd34457dec6922eb144c21db320f16e7/tfs/resources.py#L14-L34
AdeDZY/SIGIR19-BERT-IR
4b418afb9d600218165c60009b0c011062a2cb79
run_qe_classifier.py
python
file_based_convert_examples_to_features
( examples, label_list, max_seq_length, tokenizer, output_file)
Convert a set of `InputExample`s to a TFRecord file.
Convert a set of `InputExample`s to a TFRecord file.
[ "Convert", "a", "set", "of", "InputExample", "s", "to", "a", "TFRecord", "file", "." ]
def file_based_convert_examples_to_features( examples, label_list, max_seq_length, tokenizer, output_file): """Convert a set of `InputExample`s to a TFRecord file.""" writer = tf.python_io.TFRecordWriter(output_file) for (ex_index, example) in enumerate(examples): if ex_index % 10000 == 0:...
[ "def", "file_based_convert_examples_to_features", "(", "examples", ",", "label_list", ",", "max_seq_length", ",", "tokenizer", ",", "output_file", ")", ":", "writer", "=", "tf", ".", "python_io", ".", "TFRecordWriter", "(", "output_file", ")", "for", "(", "ex_inde...
https://github.com/AdeDZY/SIGIR19-BERT-IR/blob/4b418afb9d600218165c60009b0c011062a2cb79/run_qe_classifier.py#L794-L821
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/xml/sax/xmlreader.py
python
XMLReader.getDTDHandler
(self)
return self._dtd_handler
Returns the current DTD handler.
Returns the current DTD handler.
[ "Returns", "the", "current", "DTD", "handler", "." ]
def getDTDHandler(self): "Returns the current DTD handler." return self._dtd_handler
[ "def", "getDTDHandler", "(", "self", ")", ":", "return", "self", ".", "_dtd_handler" ]
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/xml/sax/xmlreader.py#L42-L44
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/ast.py
python
literal_eval
(node_or_string)
return _convert(node_or_string)
Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
[ "Safely", "evaluate", "an", "expression", "node", "or", "a", "string", "containing", "a", "Python", "expression", ".", "The", "string", "or", "node", "provided", "may", "only", "consist", "of", "the", "following", "Python", "literal", "structures", ":", "strin...
def literal_eval(node_or_string): """ Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None. """ if isins...
[ "def", "literal_eval", "(", "node_or_string", ")", ":", "if", "isinstance", "(", "node_or_string", ",", "str", ")", ":", "node_or_string", "=", "parse", "(", "node_or_string", ",", "mode", "=", "'eval'", ")", "if", "isinstance", "(", "node_or_string", ",", "...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/ast.py#L38-L91
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/PrismaSaasSecurity/Integrations/SaasSecurity/SaasSecurity.py
python
update_incident_state_command
(client: Client, args: dict)
return CommandResults( outputs_prefix='SaasSecurity.IncidentState', outputs_key_field='incident_id', readable_output=human_readable, outputs=raw_res, raw_response=raw_res)
Changes an Incident status, can only closing due to an API limitation. Category can be changed multiple times.
Changes an Incident status, can only closing due to an API limitation. Category can be changed multiple times.
[ "Changes", "an", "Incident", "status", "can", "only", "closing", "due", "to", "an", "API", "limitation", ".", "Category", "can", "be", "changed", "multiple", "times", "." ]
def update_incident_state_command(client: Client, args: dict) -> CommandResults: """ Changes an Incident status, can only closing due to an API limitation. Category can be changed multiple times. """ inc_id = args['id'] category = args.get('category', '').replace(' ', '_').lower() raw_res =...
[ "def", "update_incident_state_command", "(", "client", ":", "Client", ",", "args", ":", "dict", ")", "->", "CommandResults", ":", "inc_id", "=", "args", "[", "'id'", "]", "category", "=", "args", ".", "get", "(", "'category'", ",", "''", ")", ".", "repla...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/PrismaSaasSecurity/Integrations/SaasSecurity/SaasSecurity.py#L332-L350
pypa/setuptools
9f37366aab9cd8f6baa23e6a77cfdb8daf97757e
setuptools/command/egg_info.py
python
FileList._remove_files
(self, predicate)
return found
Remove all files from the file list that match the predicate. Return True if any matching files were removed
Remove all files from the file list that match the predicate. Return True if any matching files were removed
[ "Remove", "all", "files", "from", "the", "file", "list", "that", "match", "the", "predicate", ".", "Return", "True", "if", "any", "matching", "files", "were", "removed" ]
def _remove_files(self, predicate): """ Remove all files from the file list that match the predicate. Return True if any matching files were removed """ found = False for i in range(len(self.files) - 1, -1, -1): if predicate(self.files[i]): sel...
[ "def", "_remove_files", "(", "self", ",", "predicate", ")", ":", "found", "=", "False", "for", "i", "in", "range", "(", "len", "(", "self", ".", "files", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "predicate", "(", "self", "."...
https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/command/egg_info.py#L405-L416
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/utils/config_utils.py
python
update_model_config
( model_cls: 'nemo.core.config.modelPT.NemoConfig', update_cfg: 'DictConfig', drop_missing_subconfigs: bool = True )
return model_cfg
Helper class that updates the default values of a ModelPT config class with the values in a DictConfig that mirrors the structure of the config class. Assumes the `update_cfg` is a DictConfig (either generated manually, via hydra or instantiated via yaml/model.cfg). This update_cfg is then used to override...
Helper class that updates the default values of a ModelPT config class with the values in a DictConfig that mirrors the structure of the config class.
[ "Helper", "class", "that", "updates", "the", "default", "values", "of", "a", "ModelPT", "config", "class", "with", "the", "values", "in", "a", "DictConfig", "that", "mirrors", "the", "structure", "of", "the", "config", "class", "." ]
def update_model_config( model_cls: 'nemo.core.config.modelPT.NemoConfig', update_cfg: 'DictConfig', drop_missing_subconfigs: bool = True ): """ Helper class that updates the default values of a ModelPT config class with the values in a DictConfig that mirrors the structure of the config class. Ass...
[ "def", "update_model_config", "(", "model_cls", ":", "'nemo.core.config.modelPT.NemoConfig'", ",", "update_cfg", ":", "'DictConfig'", ",", "drop_missing_subconfigs", ":", "bool", "=", "True", ")", ":", "if", "not", "_HAS_HYDRA", ":", "logging", ".", "error", "(", ...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/utils/config_utils.py#L30-L100
nltk/nltk_contrib
c9da2c29777ca9df650740145f1f4a375ccac961
nltk_contrib/misc/paradigm.py
python
Paradigm.show
(self, p_string)
return
Process and display the given query
Process and display the given query
[ "Process", "and", "display", "the", "given", "query" ]
def show(self, p_string): """ Process and display the given query """ try: # parse the query parse = ParadigmQuery(p_string) except: print "Could not parse query." return try: # Fetch the parsed tree and make present...
[ "def", "show", "(", "self", ",", "p_string", ")", ":", "try", ":", "# parse the query", "parse", "=", "ParadigmQuery", "(", "p_string", ")", "except", ":", "print", "\"Could not parse query.\"", "return", "try", ":", "# Fetch the parsed tree and make presentation", ...
https://github.com/nltk/nltk_contrib/blob/c9da2c29777ca9df650740145f1f4a375ccac961/nltk_contrib/misc/paradigm.py#L87-L139
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/api/v2010/account/usage/record/yearly.py
python
YearlyInstance.end_date
(self)
return self._properties['end_date']
:returns: The last date for which usage is included in the UsageRecord :rtype: date
:returns: The last date for which usage is included in the UsageRecord :rtype: date
[ ":", "returns", ":", "The", "last", "date", "for", "which", "usage", "is", "included", "in", "the", "UsageRecord", ":", "rtype", ":", "date" ]
def end_date(self): """ :returns: The last date for which usage is included in the UsageRecord :rtype: date """ return self._properties['end_date']
[ "def", "end_date", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'end_date'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/usage/record/yearly.py#L533-L538
heynemann/pyvows
5b0e2a202603c1fc00d1fa0c6134c92c15b7e2b7
pyvows/result.py
python
VowsResult.successful
(self)
return self.successful_tests + self.skipped_tests == self.total_test_count
Returns a boolean, indicating whether the current `VowsResult` was 100% successful.
Returns a boolean, indicating whether the current `VowsResult` was 100% successful.
[ "Returns", "a", "boolean", "indicating", "whether", "the", "current", "VowsResult", "was", "100%", "successful", "." ]
def successful(self): '''Returns a boolean, indicating whether the current `VowsResult` was 100% successful. ''' return self.successful_tests + self.skipped_tests == self.total_test_count
[ "def", "successful", "(", "self", ")", ":", "return", "self", ".", "successful_tests", "+", "self", ".", "skipped_tests", "==", "self", ".", "total_test_count" ]
https://github.com/heynemann/pyvows/blob/5b0e2a202603c1fc00d1fa0c6134c92c15b7e2b7/pyvows/result.py#L71-L76
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/ext/mapreduce/input_readers.py
python
DatastoreInputReader.validate
(cls, mapper_spec)
Inherit docs.
Inherit docs.
[ "Inherit", "docs", "." ]
def validate(cls, mapper_spec): """Inherit docs.""" super(DatastoreInputReader, cls).validate(mapper_spec) params = _get_params(mapper_spec) entity_kind = params[cls.ENTITY_KIND_PARAM] try: model_class = util.for_name(entity_kind) except ImportError, e: raise BadReaderParamsError("B...
[ "def", "validate", "(", "cls", ",", "mapper_spec", ")", ":", "super", "(", "DatastoreInputReader", ",", "cls", ")", ".", "validate", "(", "mapper_spec", ")", "params", "=", "_get_params", "(", "mapper_spec", ")", "entity_kind", "=", "params", "[", "cls", "...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/mapreduce/input_readers.py#L637-L653
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/bdf/bdf.py
python
BDF_._prepare_conv
(self, unused_card: List[str], card_obj: BDFCard, comment='')
return boundary_condition
adds a CONV
adds a CONV
[ "adds", "a", "CONV" ]
def _prepare_conv(self, unused_card: List[str], card_obj: BDFCard, comment='') -> CONV: """adds a CONV""" boundary_condition = CONV.add_card(card_obj, comment=comment) self._add_methods._add_thermal_bc_object(boundary_condition, boundary_condition.eid) return boundary_condition
[ "def", "_prepare_conv", "(", "self", ",", "unused_card", ":", "List", "[", "str", "]", ",", "card_obj", ":", "BDFCard", ",", "comment", "=", "''", ")", "->", "CONV", ":", "boundary_condition", "=", "CONV", ".", "add_card", "(", "card_obj", ",", "comment"...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/bdf.py#L2803-L2807
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
HunterCelery/common/plugin_config/localfile_plugin_config.py
python
LocalFilePluginConfig.get_plugin_config
(self, refresh=False)
return self.plugin_config
从本地文件加载配置,提供降级方案 :param refresh: :return:
从本地文件加载配置,提供降级方案 :param refresh: :return:
[ "从本地文件加载配置,提供降级方案", ":", "param", "refresh", ":", ":", "return", ":" ]
def get_plugin_config(self, refresh=False): """ 从本地文件加载配置,提供降级方案 :param refresh: :return: """ if refresh or not self.plugin_config: config_parser = configparser.ConfigParser() config_parser.read(HUNTER_CONFIG_PATH) try: ...
[ "def", "get_plugin_config", "(", "self", ",", "refresh", "=", "False", ")", ":", "if", "refresh", "or", "not", "self", ".", "plugin_config", ":", "config_parser", "=", "configparser", ".", "ConfigParser", "(", ")", "config_parser", ".", "read", "(", "HUNTER_...
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/HunterCelery/common/plugin_config/localfile_plugin_config.py#L64-L83
tariqdaouda/pyGeno
6311c9cd94443e05b130d8b4babc24c374a77d7c
pyGeno/configuration.py
python
reload
()
reinitialize pyGeno
reinitialize pyGeno
[ "reinitialize", "pyGeno" ]
def reload() : """reinitialize pyGeno""" pyGeno_init()
[ "def", "reload", "(", ")", ":", "pyGeno_init", "(", ")" ]
https://github.com/tariqdaouda/pyGeno/blob/6311c9cd94443e05b130d8b4babc24c374a77d7c/pyGeno/configuration.py#L72-L74
TokenMarketNet/smart-contracts
8892e85d1c75994871a0fa14eb8c03016db39d88
ico/utils.py
python
get_contract_by_name
(chain: BaseChain, name: str)
return Contract
Get web3.Contract class by its name. Sanity wrapper over everchanging Populus ABI.
Get web3.Contract class by its name.
[ "Get", "web3", ".", "Contract", "class", "by", "its", "name", "." ]
def get_contract_by_name(chain: BaseChain, name: str) -> web3.contract.Contract: """Get web3.Contract class by its name. Sanity wrapper over everchanging Populus ABI. """ contract_data = chain.provider.get_contract_data(name) # There's a bug in populus where bytecode and bytecode-runtime can't be...
[ "def", "get_contract_by_name", "(", "chain", ":", "BaseChain", ",", "name", ":", "str", ")", "->", "web3", ".", "contract", ".", "Contract", ":", "contract_data", "=", "chain", ".", "provider", ".", "get_contract_data", "(", "name", ")", "# There's a bug in po...
https://github.com/TokenMarketNet/smart-contracts/blob/8892e85d1c75994871a0fa14eb8c03016db39d88/ico/utils.py#L148-L178
n374/dmusic-plugin-NeteaseCloudMusic
503701ce6c2c4d94f1fcd40a158c7a0077861793
neteasecloudmusic/netease_music_browser.py
python
SearchSongItem.get_column_renders
(self)
return (self.render_title, self.render_length, self.render_artist)
Get render callbacks.
Get render callbacks.
[ "Get", "render", "callbacks", "." ]
def get_column_renders(self): '''Get render callbacks.''' return (self.render_title, self.render_length, self.render_artist)
[ "def", "get_column_renders", "(", "self", ")", ":", "return", "(", "self", ".", "render_title", ",", "self", ".", "render_length", ",", "self", ".", "render_artist", ")" ]
https://github.com/n374/dmusic-plugin-NeteaseCloudMusic/blob/503701ce6c2c4d94f1fcd40a158c7a0077861793/neteasecloudmusic/netease_music_browser.py#L414-L417
openstack/sahara
c4f4d29847d5bcca83d49ef7e9a3378458462a79
sahara/conductor/api.py
python
LocalApi.data_source_count
(self, context, **kwargs)
return self._manager.data_source_count(context, **kwargs)
Count Data Sources filtered by **kwargs. Uses sqlalchemy "in_" clause for any tuple values Uses sqlalchemy "like" clause for any string values containing %
Count Data Sources filtered by **kwargs.
[ "Count", "Data", "Sources", "filtered", "by", "**", "kwargs", "." ]
def data_source_count(self, context, **kwargs): """Count Data Sources filtered by **kwargs. Uses sqlalchemy "in_" clause for any tuple values Uses sqlalchemy "like" clause for any string values containing % """ return self._manager.data_source_count(context, **kwargs)
[ "def", "data_source_count", "(", "self", ",", "context", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_manager", ".", "data_source_count", "(", "context", ",", "*", "*", "kwargs", ")" ]
https://github.com/openstack/sahara/blob/c4f4d29847d5bcca83d49ef7e9a3378458462a79/sahara/conductor/api.py#L300-L306
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/random.py
python
Random.betavariate
(self, alpha, beta)
Beta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1.
Beta distribution.
[ "Beta", "distribution", "." ]
def betavariate(self, alpha, beta): """Beta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1. """ # This version due to Janne Sinkkonen, and matches all the std # texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta...
[ "def", "betavariate", "(", "self", ",", "alpha", ",", "beta", ")", ":", "# This version due to Janne Sinkkonen, and matches all the std", "# texts (e.g., Knuth Vol 2 Ed 3 pg 134 \"the beta distribution\").", "y", "=", "self", ".", "gammavariate", "(", "alpha", ",", "1.", ")...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/random.py#L613-L627
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /scripts/Hash_ID.py
python
Tiger160HMAC
()
[]
def Tiger160HMAC(): hs='6603161719da5e56e1866e4f61f79496334e6a10' if len(hash)==len(hs) and hash.isdigit()==False and hash.isalpha()==False and hash.isalnum()==True: jerar.append("109160")
[ "def", "Tiger160HMAC", "(", ")", ":", "hs", "=", "'6603161719da5e56e1866e4f61f79496334e6a10'", "if", "len", "(", "hash", ")", "==", "len", "(", "hs", ")", "and", "hash", ".", "isdigit", "(", ")", "==", "False", "and", "hash", ".", "isalpha", "(", ")", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/Hash_ID.py#L316-L319
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/raspihats/__init__.py
python
I2CHatsManager.stop_keep_alive
(self)
Stop keep alive mechanism.
Stop keep alive mechanism.
[ "Stop", "keep", "alive", "mechanism", "." ]
def stop_keep_alive(self): """Stop keep alive mechanism.""" self._run = False self.join()
[ "def", "stop_keep_alive", "(", "self", ")", ":", "self", ".", "_run", "=", "False", "self", ".", "join", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/raspihats/__init__.py#L193-L196
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1alpha1_volume_attachment_source.py
python
V1alpha1VolumeAttachmentSource.inline_volume_spec
(self, inline_volume_spec)
Sets the inline_volume_spec of this V1alpha1VolumeAttachmentSource. :param inline_volume_spec: The inline_volume_spec of this V1alpha1VolumeAttachmentSource. # noqa: E501 :type: V1PersistentVolumeSpec
Sets the inline_volume_spec of this V1alpha1VolumeAttachmentSource.
[ "Sets", "the", "inline_volume_spec", "of", "this", "V1alpha1VolumeAttachmentSource", "." ]
def inline_volume_spec(self, inline_volume_spec): """Sets the inline_volume_spec of this V1alpha1VolumeAttachmentSource. :param inline_volume_spec: The inline_volume_spec of this V1alpha1VolumeAttachmentSource. # noqa: E501 :type: V1PersistentVolumeSpec """ self._inline_volum...
[ "def", "inline_volume_spec", "(", "self", ",", "inline_volume_spec", ")", ":", "self", ".", "_inline_volume_spec", "=", "inline_volume_spec" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1alpha1_volume_attachment_source.py#L71-L79
rwightman/pytorch-image-models
ccfeb06936549f19c453b7f1f27e8e632cfbe1c2
timm/models/byoanet.py
python
lambda_resnet50ts
(pretrained=False, **kwargs)
return _create_byoanet('lambda_resnet50ts', pretrained=pretrained, **kwargs)
Lambda-ResNet-50-TS. SiLU act. Lambda layers w/ conv pos in last two stages.
Lambda-ResNet-50-TS. SiLU act. Lambda layers w/ conv pos in last two stages.
[ "Lambda", "-", "ResNet", "-", "50", "-", "TS", ".", "SiLU", "act", ".", "Lambda", "layers", "w", "/", "conv", "pos", "in", "last", "two", "stages", "." ]
def lambda_resnet50ts(pretrained=False, **kwargs): """ Lambda-ResNet-50-TS. SiLU act. Lambda layers w/ conv pos in last two stages. """ return _create_byoanet('lambda_resnet50ts', pretrained=pretrained, **kwargs)
[ "def", "lambda_resnet50ts", "(", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "_create_byoanet", "(", "'lambda_resnet50ts'", ",", "pretrained", "=", "pretrained", ",", "*", "*", "kwargs", ")" ]
https://github.com/rwightman/pytorch-image-models/blob/ccfeb06936549f19c453b7f1f27e8e632cfbe1c2/timm/models/byoanet.py#L411-L414
datamllab/rlcard
c21ea82519c453a42e3bdc6848bd3356e9b6ac43
rlcard/envs/env.py
python
Env.step_back
(self)
return state, player_id
Take one step backward. Returns: (tuple): Tuple containing: (dict): The previous state (int): The ID of the previous player Note: Error will be raised if step back from the root node.
Take one step backward.
[ "Take", "one", "step", "backward", "." ]
def step_back(self): ''' Take one step backward. Returns: (tuple): Tuple containing: (dict): The previous state (int): The ID of the previous player Note: Error will be raised if step back from the root node. ''' if not self.allow_st...
[ "def", "step_back", "(", "self", ")", ":", "if", "not", "self", ".", "allow_step_back", ":", "raise", "Exception", "(", "'Step back is off. To use step_back, please set allow_step_back=True in rlcard.make'", ")", "if", "not", "self", ".", "game", ".", "step_back", "("...
https://github.com/datamllab/rlcard/blob/c21ea82519c453a42e3bdc6848bd3356e9b6ac43/rlcard/envs/env.py#L88-L108
phantomcyber/playbooks
9e850ecc44cb98c5dde53784744213a1ed5799bd
risk_notable_preprocess.py
python
artifact_update_severity
(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs)
return
[]
def artifact_update_severity(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs): phantom.debug("artifact_update_severity() called") filtered_artifact_0_data_event_id_filter = phantom.collect2(container=container,...
[ "def", "artifact_update_severity", "(", "action", "=", "None", ",", "success", "=", "None", ",", "container", "=", "None", ",", "results", "=", "None", ",", "handle", "=", "None", ",", "filtered_artifacts", "=", "None", ",", "filtered_results", "=", "None", ...
https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/risk_notable_preprocess.py#L362-L395
pyinvoke/invoke
45dc9d03639dac5b6d1445831bf270e686ef88b4
invoke/runners.py
python
Result.ok
(self)
return self.exited == 0
A boolean equivalent to ``exited == 0``. .. versionadded:: 1.0
A boolean equivalent to ``exited == 0``.
[ "A", "boolean", "equivalent", "to", "exited", "==", "0", "." ]
def ok(self): """ A boolean equivalent to ``exited == 0``. .. versionadded:: 1.0 """ return self.exited == 0
[ "def", "ok", "(", "self", ")", ":", "return", "self", ".", "exited", "==", "0" ]
https://github.com/pyinvoke/invoke/blob/45dc9d03639dac5b6d1445831bf270e686ef88b4/invoke/runners.py#L1490-L1496
pilotmoon/PopClip-Extensions
29fc472befc09ee350092ac70283bd9fdb456cb6
source/InstantTranslate/requests/adapters.py
python
HTTPAdapter.close
(self)
Disposes of any internal state. Currently, this just closes the PoolManager, which closes pooled connections.
Disposes of any internal state.
[ "Disposes", "of", "any", "internal", "state", "." ]
def close(self): """Disposes of any internal state. Currently, this just closes the PoolManager, which closes pooled connections. """ self.poolmanager.clear()
[ "def", "close", "(", "self", ")", ":", "self", ".", "poolmanager", ".", "clear", "(", ")" ]
https://github.com/pilotmoon/PopClip-Extensions/blob/29fc472befc09ee350092ac70283bd9fdb456cb6/source/InstantTranslate/requests/adapters.py#L255-L261
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/fileinput.py
python
FileInput.filename
(self)
return self._filename
[]
def filename(self): return self._filename
[ "def", "filename", "(", "self", ")", ":", "return", "self", ".", "_filename" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/fileinput.py#L344-L345
nasa/CrisisMappingToolkit
0296487974d74cec6aa8be42eafbb5cd24dc6a51
app_engine/libs/bs4/builder/_html5lib.py
python
AttrList.__setitem__
(self, name, value)
[]
def __setitem__(self, name, value): # If this attribute is a multi-valued attribute for this element, # turn its value into a list. list_attr = HTML5TreeBuilder.cdata_list_attributes if (name in list_attr['*'] or (self.element.name in list_attr and name in lis...
[ "def", "__setitem__", "(", "self", ",", "name", ",", "value", ")", ":", "# If this attribute is a multi-valued attribute for this element,", "# turn its value into a list.", "list_attr", "=", "HTML5TreeBuilder", ".", "cdata_list_attributes", "if", "(", "name", "in", "list_a...
https://github.com/nasa/CrisisMappingToolkit/blob/0296487974d74cec6aa8be42eafbb5cd24dc6a51/app_engine/libs/bs4/builder/_html5lib.py#L116-L127
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
p2pool/util/jsonrpc.py
python
Error._to_obj
(self)
return { 'code': self.code, 'message': self.message, 'data': self.data, }
[]
def _to_obj(self): return { 'code': self.code, 'message': self.message, 'data': self.data, }
[ "def", "_to_obj", "(", "self", ")", ":", "return", "{", "'code'", ":", "self", ".", "code", ",", "'message'", ":", "self", ".", "message", ",", "'data'", ":", "self", ".", "data", ",", "}" ]
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/p2pool/util/jsonrpc.py#L24-L29
dump247/aws-mock-metadata
ec85bc8c6f41afa8fa624898d6ba1ee5315ebcc2
metadata/bottle.py
python
BaseRequest.urlparts
(self)
return UrlSplitResult(http, host, path, env.get('QUERY_STRING'), '')
The :attr:`url` string as an :class:`urlparse.SplitResult` tuple. The tuple contains (scheme, host, path, query_string and fragment), but the fragment is always empty because it is not visible to the server.
The :attr:`url` string as an :class:`urlparse.SplitResult` tuple. The tuple contains (scheme, host, path, query_string and fragment), but the fragment is always empty because it is not visible to the server.
[ "The", ":", "attr", ":", "url", "string", "as", "an", ":", "class", ":", "urlparse", ".", "SplitResult", "tuple", ".", "The", "tuple", "contains", "(", "scheme", "host", "path", "query_string", "and", "fragment", ")", "but", "the", "fragment", "is", "alw...
def urlparts(self): ''' The :attr:`url` string as an :class:`urlparse.SplitResult` tuple. The tuple contains (scheme, host, path, query_string and fragment), but the fragment is always empty because it is not visible to the server. ''' env = self.environ http ...
[ "def", "urlparts", "(", "self", ")", ":", "env", "=", "self", ".", "environ", "http", "=", "env", ".", "get", "(", "'HTTP_X_FORWARDED_PROTO'", ")", "or", "env", ".", "get", "(", "'wsgi.url_scheme'", ",", "'http'", ")", "host", "=", "env", ".", "get", ...
https://github.com/dump247/aws-mock-metadata/blob/ec85bc8c6f41afa8fa624898d6ba1ee5315ebcc2/metadata/bottle.py#L1242-L1257
MillionIntegrals/vel
f3ce7da64362ad207f40f2c0d58d9300a25df3e8
vel/api/learner.py
python
Learner.train
(self)
return self.model.train()
Set model in the training mode
Set model in the training mode
[ "Set", "model", "in", "the", "training", "mode" ]
def train(self): """ Set model in the training mode """ return self.model.train()
[ "def", "train", "(", "self", ")", ":", "return", "self", ".", "model", ".", "train", "(", ")" ]
https://github.com/MillionIntegrals/vel/blob/f3ce7da64362ad207f40f2c0d58d9300a25df3e8/vel/api/learner.py#L24-L26
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/图片项目/1、mnist自编码/mnist.py
python
inference
(X,X_)
[]
def inference(X,X_): encode, decode = convolutional_neural_network(X, None, False) # 自编码器 (encode+decode) decode_ = convolutional_neural_network(None, X_, True, False) # 生成器 (decode) saver = tf.train.Saver() with tf.Session() as sess: # saver.restore(sess, os.path.join(FLAGS.checkpointDir,'m...
[ "def", "inference", "(", "X", ",", "X_", ")", ":", "encode", ",", "decode", "=", "convolutional_neural_network", "(", "X", ",", "None", ",", "False", ")", "# 自编码器 (encode+decode)", "decode_", "=", "convolutional_neural_network", "(", "None", ",", "X_", ",", ...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/图片项目/1、mnist自编码/mnist.py#L153-L184
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
nodes/script/profile_mk3.py
python
SvProfileNodeMK3.sv_update
(self)
update analyzes the state of the node and returns if the criteria to start processing are not met.
update analyzes the state of the node and returns if the criteria to start processing are not met.
[ "update", "analyzes", "the", "state", "of", "the", "node", "and", "returns", "if", "the", "criteria", "to", "start", "processing", "are", "not", "met", "." ]
def sv_update(self): ''' update analyzes the state of the node and returns if the criteria to start processing are not met. ''' # keeping the file internal for now. if not (self.filename.strip() in bpy.data.texts): return self.adjust_sockets()
[ "def", "sv_update", "(", "self", ")", ":", "# keeping the file internal for now.", "if", "not", "(", "self", ".", "filename", ".", "strip", "(", ")", "in", "bpy", ".", "data", ".", "texts", ")", ":", "return", "self", ".", "adjust_sockets", "(", ")" ]
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/nodes/script/profile_mk3.py#L571-L581
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/pioneer/media_player.py
python
PioneerDevice.select_source
(self, source)
Select input source.
Select input source.
[ "Select", "input", "source", "." ]
def select_source(self, source): """Select input source.""" self.telnet_command(f"{self._source_name_to_number.get(source)}FN")
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "self", ".", "telnet_command", "(", "f\"{self._source_name_to_number.get(source)}FN\"", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/pioneer/media_player.py#L248-L250
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/contrib/gis/db/backends/postgis/operations.py
python
PostGISOperations.geo_db_type
(self, f)
Return the database field type for the given spatial field.
Return the database field type for the given spatial field.
[ "Return", "the", "database", "field", "type", "for", "the", "given", "spatial", "field", "." ]
def geo_db_type(self, f): """ Return the database field type for the given spatial field. """ if f.geom_type == 'RASTER': return 'raster' # Type-based geometries. # TODO: Support 'M' extension. if f.dim == 3: geom_type = f.geom_type + 'Z' ...
[ "def", "geo_db_type", "(", "self", ",", "f", ")", ":", "if", "f", ".", "geom_type", "==", "'RASTER'", ":", "return", "'raster'", "# Type-based geometries.", "# TODO: Support 'M' extension.", "if", "f", ".", "dim", "==", "3", ":", "geom_type", "=", "f", ".", ...
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/gis/db/backends/postgis/operations.py#L221-L240
slgobinath/SafeEyes
7ef644e6a2ef8541d929d5355a38185ccd138cbd
safeeyes/safeeyes.py
python
SafeEyes.handle_suspend_callback
(self, sleeping)
If the system goes to sleep, Safe Eyes stop the core if it is already active. If it was active, Safe Eyes will become active after wake up.
If the system goes to sleep, Safe Eyes stop the core if it is already active. If it was active, Safe Eyes will become active after wake up.
[ "If", "the", "system", "goes", "to", "sleep", "Safe", "Eyes", "stop", "the", "core", "if", "it", "is", "already", "active", ".", "If", "it", "was", "active", "Safe", "Eyes", "will", "become", "active", "after", "wake", "up", "." ]
def handle_suspend_callback(self, sleeping): """ If the system goes to sleep, Safe Eyes stop the core if it is already active. If it was active, Safe Eyes will become active after wake up. """ if sleeping: # Sleeping / suspending if self.active: ...
[ "def", "handle_suspend_callback", "(", "self", ",", "sleeping", ")", ":", "if", "sleeping", ":", "# Sleeping / suspending", "if", "self", ".", "active", ":", "logging", ".", "info", "(", "\"Stop Safe Eyes due to system suspend\"", ")", "self", ".", "plugins_manager"...
https://github.com/slgobinath/SafeEyes/blob/7ef644e6a2ef8541d929d5355a38185ccd138cbd/safeeyes/safeeyes.py#L151-L167