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
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/tvdbapiv2/models/user_favorites_data.py
python
UserFavoritesData.data
(self, data)
Sets the data of this UserFavoritesData. :param data: The data of this UserFavoritesData. :type: UserFavorites
Sets the data of this UserFavoritesData.
[ "Sets", "the", "data", "of", "this", "UserFavoritesData", "." ]
def data(self, data): """ Sets the data of this UserFavoritesData. :param data: The data of this UserFavoritesData. :type: UserFavorites """ self._data = data
[ "def", "data", "(", "self", ",", "data", ")", ":", "self", ".", "_data", "=", "data" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tvdbapiv2/models/user_favorites_data.py#L64-L72
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/processors/processing.py
python
PostQuestionProcessor.__init__
(self)
[]
def __init__(self): Processor.__init__(self)
[ "def", "__init__", "(", "self", ")", ":", "Processor", ".", "__init__", "(", "self", ")" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/processors/processing.py#L138-L139
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/src/cowidev/vax/batch/greece.py
python
Greece.read
(self)
return ( df.rename( columns={ "referencedate": "date", "totaldistinctpersons": "people_vaccinated", "totaldose2": "people_fully_vaccinated", "totaldose3": "total_boosters", "totalvaccinations"...
[]
def read(self) -> pd.DataFrame: data = requests.get(self.source_url, headers={"Authorization": f"Token {self.token}"}).json() df = pd.DataFrame.from_records(data) check_known_columns( df, [ "area", "areaid", "dailydose1", ...
[ "def", "read", "(", "self", ")", "->", "pd", ".", "DataFrame", ":", "data", "=", "requests", ".", "get", "(", "self", ".", "source_url", ",", "headers", "=", "{", "\"Authorization\"", ":", "f\"Token {self.token}\"", "}", ")", ".", "json", "(", ")", "df...
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/batch/greece.py#L17-L51
itamarst/eliot
74e0aa2ec501d9684f1a63c26d0d51963517eddc
eliot/_validation.py
python
Field.serialize
(self, input)
return self._serializer(input)
Convert the given input to a value that can actually be logged. @param input: An input value supposedly serializable by this L{Field}. @return: A serialized value.
Convert the given input to a value that can actually be logged.
[ "Convert", "the", "given", "input", "to", "a", "value", "that", "can", "actually", "be", "logged", "." ]
def serialize(self, input): """ Convert the given input to a value that can actually be logged. @param input: An input value supposedly serializable by this L{Field}. @return: A serialized value. """ return self._serializer(input)
[ "def", "serialize", "(", "self", ",", "input", ")", ":", "return", "self", ".", "_serializer", "(", "input", ")" ]
https://github.com/itamarst/eliot/blob/74e0aa2ec501d9684f1a63c26d0d51963517eddc/eliot/_validation.py#L98-L106
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/src/cowidev/vax/incremental/brazil.py
python
Brazil.pipe_location
(self, ds: pd.Series)
return enrich_data(ds, "location", self.location)
[]
def pipe_location(self, ds: pd.Series) -> pd.Series: return enrich_data(ds, "location", self.location)
[ "def", "pipe_location", "(", "self", ",", "ds", ":", "pd", ".", "Series", ")", "->", "pd", ".", "Series", ":", "return", "enrich_data", "(", "ds", ",", "\"location\"", ",", "self", ".", "location", ")" ]
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/brazil.py#L28-L29
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/matrix/special.py
python
random_diagonalizable_matrix
(parent,eigenvalues=None,dimensions=None)
return eigenvector_matrix*diagonal_matrix*(eigenvector_matrix.inverse())
Create a random matrix that diagonalizes nicely. To be used as a teaching tool. Return matrices have only real eigenvalues. INPUT: If eigenvalues and dimensions are not specified in a list, they will be assigned randomly. - ``parent`` - the desired size of the square matrix. - ``eigenv...
Create a random matrix that diagonalizes nicely.
[ "Create", "a", "random", "matrix", "that", "diagonalizes", "nicely", "." ]
def random_diagonalizable_matrix(parent,eigenvalues=None,dimensions=None): """ Create a random matrix that diagonalizes nicely. To be used as a teaching tool. Return matrices have only real eigenvalues. INPUT: If eigenvalues and dimensions are not specified in a list, they will be assign...
[ "def", "random_diagonalizable_matrix", "(", "parent", ",", "eigenvalues", "=", "None", ",", "dimensions", "=", "None", ")", ":", "from", "sage", ".", "misc", ".", "prandom", "import", "randint", "size", "=", "parent", ".", "nrows", "(", ")", "if", "parent"...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/matrix/special.py#L3010-L3225
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/YOLO/darkflow/darkflow/net/build.py
python
TFNet.build_forward
(self)
[]
def build_forward(self): verbalise = self.FLAGS.verbalise # Placeholders inp_size = [None] + self.meta['inp_size'] self.inp = tf.placeholder(tf.float32, inp_size, 'input') self.feed = dict() # other placeholders # Build the forward pass state = identity(self.inp) roof = self.num_layer - self.ntrain ...
[ "def", "build_forward", "(", "self", ")", ":", "verbalise", "=", "self", ".", "FLAGS", ".", "verbalise", "# Placeholders", "inp_size", "=", "[", "None", "]", "+", "self", ".", "meta", "[", "'inp_size'", "]", "self", ".", "inp", "=", "tf", ".", "placeho...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/YOLO/darkflow/darkflow/net/build.py#L100-L121
aajanki/yle-dl
b0aa1bb5d943fdbd9a18da2604f21bb2094eadd7
yledl/extractors.py
python
url_language
(url)
[]
def url_language(url): arenan = re.match(r'^https?://arenan\.yle\.fi/', url) is not None arkivet = re.match(r'^https?://svenska\.yle\.fi/artikel/', url) is not None if arenan or arkivet: return 'swe' else: return 'fin'
[ "def", "url_language", "(", "url", ")", ":", "arenan", "=", "re", ".", "match", "(", "r'^https?://arenan\\.yle\\.fi/'", ",", "url", ")", "is", "not", "None", "arkivet", "=", "re", ".", "match", "(", "r'^https?://svenska\\.yle\\.fi/artikel/'", ",", "url", ")", ...
https://github.com/aajanki/yle-dl/blob/b0aa1bb5d943fdbd9a18da2604f21bb2094eadd7/yledl/extractors.py#L48-L54
python-diamond/Diamond
7000e16cfdf4508ed9291fc4b3800592557b2431
src/collectors/kafkastat/kafkastat.py
python
KafkaCollector.get_default_config_help
(self)
return config_help
[]
def get_default_config_help(self): config_help = super(KafkaCollector, self).get_default_config_help() config_help.update({ 'host': "", 'port': "", }) return config_help
[ "def", "get_default_config_help", "(", "self", ")", ":", "config_help", "=", "super", "(", "KafkaCollector", ",", "self", ")", ".", "get_default_config_help", "(", ")", "config_help", ".", "update", "(", "{", "'host'", ":", "\"\"", ",", "'port'", ":", "\"\""...
https://github.com/python-diamond/Diamond/blob/7000e16cfdf4508ed9291fc4b3800592557b2431/src/collectors/kafkastat/kafkastat.py#L37-L43
gwastro/pycbc
1e1c85534b9dba8488ce42df693230317ca63dea
pycbc/tmpltbank/option_utils.py
python
insert_mass_range_option_group
(parser,nonSpin=False)
return massOpts
Adds the options used to specify mass ranges in the bank generation codes to an argparser as an OptionGroup. This should be used if you want to use these options in your code. Parameters ----------- parser : object OptionParser instance. nonSpin : boolean, optional (default=False) ...
Adds the options used to specify mass ranges in the bank generation codes to an argparser as an OptionGroup. This should be used if you want to use these options in your code. Parameters ----------- parser : object OptionParser instance. nonSpin : boolean, optional (default=False) ...
[ "Adds", "the", "options", "used", "to", "specify", "mass", "ranges", "in", "the", "bank", "generation", "codes", "to", "an", "argparser", "as", "an", "OptionGroup", ".", "This", "should", "be", "used", "if", "you", "want", "to", "use", "these", "options", ...
def insert_mass_range_option_group(parser,nonSpin=False): """ Adds the options used to specify mass ranges in the bank generation codes to an argparser as an OptionGroup. This should be used if you want to use these options in your code. Parameters ----------- parser : object Optio...
[ "def", "insert_mass_range_option_group", "(", "parser", ",", "nonSpin", "=", "False", ")", ":", "massOpts", "=", "parser", ".", "add_argument_group", "(", "\"Options related to mass and spin \"", "\"limits for bank generation\"", ")", "massOpts", ".", "add_argument", "(",...
https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/tmpltbank/option_utils.py#L420-L547
Georce/lepus
5b01bae82b5dc1df00c9e058989e2eb9b89ff333
lepus/pymongo-2.7/pymongo/mongo_client.py
python
MongoClient.copy_database
(self, from_name, to_name, from_host=None, username=None, password=None)
Copy a database, potentially from another host. Raises :class:`TypeError` if `from_name` or `to_name` is not an instance of :class:`basestring` (:class:`str` in python 3). Raises :class:`~pymongo.errors.InvalidName` if `to_name` is not a valid database name. If `from_host` is `...
Copy a database, potentially from another host.
[ "Copy", "a", "database", "potentially", "from", "another", "host", "." ]
def copy_database(self, from_name, to_name, from_host=None, username=None, password=None): """Copy a database, potentially from another host. Raises :class:`TypeError` if `from_name` or `to_name` is not an instance of :class:`basestring` (:class:`str` in python 3). ...
[ "def", "copy_database", "(", "self", ",", "from_name", ",", "to_name", ",", "from_host", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "if", "not", "isinstance", "(", "from_name", ",", "basestring", ")", ":", "raise",...
https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/pymongo-2.7/pymongo/mongo_client.py#L1370-L1423
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/knowledge_plugins/xrefs/xref.py
python
XRef.parse_from_cmessage
(cls, cmsg, bits=None, **kwargs)
return cr
[]
def parse_from_cmessage(cls, cmsg, bits=None, **kwargs): # pylint:disable=arguments-differ # Note that we cannot recover _memory_data from cmsg # delayed import from ...engines.light import SpOffset # pylint:disable=import-outside-toplevel if not isinstance(bits, int): ra...
[ "def", "parse_from_cmessage", "(", "cls", ",", "cmsg", ",", "bits", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint:disable=arguments-differ", "# Note that we cannot recover _memory_data from cmsg", "# delayed import", "from", ".", ".", ".", "engines", ".", ...
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/knowledge_plugins/xrefs/xref.py#L96-L113
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/hypertreelist.py
python
HyperTreeList.AddColumn
(self, text, width=_DEFAULT_COL_WIDTH, flag=wx.ALIGN_LEFT, image=-1, shown=True, colour=None, edit=False)
Appends a column to the :class:`HyperTreeList`. :param `text`: the column text label; :param `width`: the column width in pixels; :param `flag`: the column alignment flag, one of ``wx.ALIGN_LEFT``, ``wx.ALIGN_RIGHT``, ``wx.ALIGN_CENTER``; :param `image`: an index within the nor...
Appends a column to the :class:`HyperTreeList`.
[ "Appends", "a", "column", "to", "the", ":", "class", ":", "HyperTreeList", "." ]
def AddColumn(self, text, width=_DEFAULT_COL_WIDTH, flag=wx.ALIGN_LEFT, image=-1, shown=True, colour=None, edit=False): """ Appends a column to the :class:`HyperTreeList`. :param `text`: the column text label; :param `width`: the column width in pixels; :param ...
[ "def", "AddColumn", "(", "self", ",", "text", ",", "width", "=", "_DEFAULT_COL_WIDTH", ",", "flag", "=", "wx", ".", "ALIGN_LEFT", ",", "image", "=", "-", "1", ",", "shown", "=", "True", ",", "colour", "=", "None", ",", "edit", "=", "False", ")", ":...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/hypertreelist.py#L4897-L4915
chipmuenk/pyfda
665310b8548a940a575c0e5ff4bba94608d9ac26
pyfda/input_widgets/input_coeffs.py
python
ItemDelegate.__init__
(self, parent)
Pass instance `parent` of parent class (Input_Coeffs)
Pass instance `parent` of parent class (Input_Coeffs)
[ "Pass", "instance", "parent", "of", "parent", "class", "(", "Input_Coeffs", ")" ]
def __init__(self, parent): """ Pass instance `parent` of parent class (Input_Coeffs) """ super(ItemDelegate, self).__init__(parent) self.parent = parent
[ "def", "__init__", "(", "self", ",", "parent", ")", ":", "super", "(", "ItemDelegate", ",", "self", ")", ".", "__init__", "(", "parent", ")", "self", ".", "parent", "=", "parent" ]
https://github.com/chipmuenk/pyfda/blob/665310b8548a940a575c0e5ff4bba94608d9ac26/pyfda/input_widgets/input_coeffs.py#L68-L73
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cii/v20210408/models.py
python
DescribeStructureTaskResultRequest.__init__
(self)
r""" :param MainTaskId: 结构化任务ID :type MainTaskId: str
r""" :param MainTaskId: 结构化任务ID :type MainTaskId: str
[ "r", ":", "param", "MainTaskId", ":", "结构化任务ID", ":", "type", "MainTaskId", ":", "str" ]
def __init__(self): r""" :param MainTaskId: 结构化任务ID :type MainTaskId: str """ self.MainTaskId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "MainTaskId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cii/v20210408/models.py#L710-L715
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/dirsearch/thirdparty/socks.py
python
wrap_module
(module)
Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using set_default_proxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category.
Attempts to replace a module's socket library with a SOCKS socket.
[ "Attempts", "to", "replace", "a", "module", "s", "socket", "library", "with", "a", "SOCKS", "socket", "." ]
def wrap_module(module): """Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using set_default_proxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category.""" ...
[ "def", "wrap_module", "(", "module", ")", ":", "if", "socksocket", ".", "default_proxy", ":", "module", ".", "socket", ".", "socket", "=", "socksocket", "else", ":", "raise", "GeneralProxyError", "(", "\"No default proxy specified\"", ")" ]
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/socks.py#L139-L148
ranaroussi/pywallet
468622dcf993a27a5b585289b2724986c02a1fbc
pywallet/utils/ethereum.py
python
PublicKey.from_bytes
(key_bytes)
return PublicKey(x, y)
Generates a public key object from a byte (or hex) string. The byte stream must be of the SEC variety (http://www.secg.org/): beginning with a single byte telling what key representation follows. A full, uncompressed key is represented by: 0x04 followed by 64 bytes containing th...
Generates a public key object from a byte (or hex) string.
[ "Generates", "a", "public", "key", "object", "from", "a", "byte", "(", "or", "hex", ")", "string", "." ]
def from_bytes(key_bytes): """ Generates a public key object from a byte (or hex) string. The byte stream must be of the SEC variety (http://www.secg.org/): beginning with a single byte telling what key representation follows. A full, uncompressed key is represented by: 0x04 fol...
[ "def", "from_bytes", "(", "key_bytes", ")", ":", "b", "=", "get_bytes", "(", "key_bytes", ")", "key_bytes_len", "=", "len", "(", "b", ")", "key_type", "=", "b", "[", "0", "]", "if", "key_type", "==", "0x04", ":", "# Uncompressed", "if", "key_bytes_len", ...
https://github.com/ranaroussi/pywallet/blob/468622dcf993a27a5b585289b2724986c02a1fbc/pywallet/utils/ethereum.py#L576-L621
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/designs/resolvable_bibd.py
python
kirkman_triple_system
(v,existence=False)
r""" Return a Kirkman Triple System on `v` points. A Kirkman Triple System `KTS(v)` is a resolvable Steiner Triple System. It exists if and only if `v\equiv 3\pmod{6}`. INPUT: - `n` (integer) - ``existence`` (boolean; ``False`` by default) -- whether to build the `KTS(n)` or only answe...
r""" Return a Kirkman Triple System on `v` points.
[ "r", "Return", "a", "Kirkman", "Triple", "System", "on", "v", "points", "." ]
def kirkman_triple_system(v,existence=False): r""" Return a Kirkman Triple System on `v` points. A Kirkman Triple System `KTS(v)` is a resolvable Steiner Triple System. It exists if and only if `v\equiv 3\pmod{6}`. INPUT: - `n` (integer) - ``existence`` (boolean; ``False`` by default) --...
[ "def", "kirkman_triple_system", "(", "v", ",", "existence", "=", "False", ")", ":", "if", "v", "%", "6", "!=", "3", ":", "if", "existence", ":", "return", "False", "raise", "ValueError", "(", "\"There is no KTS({}) as v!=3 mod(6)\"", ".", "format", "(", "v",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/designs/resolvable_bibd.py#L141-L365
modflowpy/flopy
eecd1ad193c5972093c9712e5c4b7a83284f0688
flopy/utils/zonbud.py
python
ZoneBudget.read_zone_file
(cls, fname)
return zones
Method to read a zonebudget zone file into memory Parameters ---------- fname : str zone file name Returns ------- zones : np.array
Method to read a zonebudget zone file into memory
[ "Method", "to", "read", "a", "zonebudget", "zone", "file", "into", "memory" ]
def read_zone_file(cls, fname): """Method to read a zonebudget zone file into memory Parameters ---------- fname : str zone file name Returns ------- zones : np.array """ with open(fname, "r") as f: lines = f.readlines() ...
[ "def", "read_zone_file", "(", "cls", ",", "fname", ")", ":", "with", "open", "(", "fname", ",", "\"r\"", ")", "as", "f", ":", "lines", "=", "f", ".", "readlines", "(", ")", "# Initialize layer", "lay", "=", "0", "# Initialize data counter", "totlen", "="...
https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/utils/zonbud.py#L1444-L1548
openstack/magnum
fa298eeab19b1d87070d72c7c4fb26cd75b0781e
magnum/api/controllers/v1/cluster_actions.py
python
ActionsController.resize
(self, cluster_ident, cluster_resize_req)
return self._resize(cluster_ident, cluster_resize_req)
[]
def resize(self, cluster_ident, cluster_resize_req): if cluster_resize_req.node_count == 0: raise exception.ZeroNodeCountNotSupported() return self._resize(cluster_ident, cluster_resize_req)
[ "def", "resize", "(", "self", ",", "cluster_ident", ",", "cluster_resize_req", ")", ":", "if", "cluster_resize_req", ".", "node_count", "==", "0", ":", "raise", "exception", ".", "ZeroNodeCountNotSupported", "(", ")", "return", "self", ".", "_resize", "(", "cl...
https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/api/controllers/v1/cluster_actions.py#L87-L90
DataBrewery/cubes
140133e8c2e3f2ff60631cc3ebc9966d16c1655e
cubes/mapper.py
python
Mapper.split_logical
(self, reference)
Returns tuple (`dimension`, `attribute`) from `logical_reference` string. Syntax of the string is: ``dimensions.attribute``.
Returns tuple (`dimension`, `attribute`) from `logical_reference` string. Syntax of the string is: ``dimensions.attribute``.
[ "Returns", "tuple", "(", "dimension", "attribute", ")", "from", "logical_reference", "string", ".", "Syntax", "of", "the", "string", "is", ":", "dimensions", ".", "attribute", "." ]
def split_logical(self, reference): """Returns tuple (`dimension`, `attribute`) from `logical_reference` string. Syntax of the string is: ``dimensions.attribute``.""" split = reference.split(".") if len(split) > 1: dim_name = split[0] attr_name = ".".join(split[...
[ "def", "split_logical", "(", "self", ",", "reference", ")", ":", "split", "=", "reference", ".", "split", "(", "\".\"", ")", "if", "len", "(", "split", ")", ">", "1", ":", "dim_name", "=", "split", "[", "0", "]", "attr_name", "=", "\".\"", ".", "jo...
https://github.com/DataBrewery/cubes/blob/140133e8c2e3f2ff60631cc3ebc9966d16c1655e/cubes/mapper.py#L97-L108
alexMyG/AndroPyTool
e0412677c9602a8000339f119e758a360db18a80
FlowDroid/flowDroid/launchFlowDroidMod.py
python
create_logger
(log_filename)
return logger
[]
def create_logger(log_filename): logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) # create a file handler handler = logging.FileHandler(log_filename) handler.setLevel(logging.INFO) # create a logging format formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s...
[ "def", "create_logger", "(", "log_filename", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "logger", ".", "setLevel", "(", "logging", ".", "INFO", ")", "# create a file handler", "handler", "=", "logging", ".", "FileHandler", "(",...
https://github.com/alexMyG/AndroPyTool/blob/e0412677c9602a8000339f119e758a360db18a80/FlowDroid/flowDroid/launchFlowDroidMod.py#L271-L290
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/appengine/handlers/cron/project_setup.py
python
_set_bucket_service_account
(service_account, client, bucket_name, iam_policy)
return storage.set_bucket_iam_policy(client, bucket_name, iam_policy)
Set service account for a bucket.
Set service account for a bucket.
[ "Set", "service", "account", "for", "a", "bucket", "." ]
def _set_bucket_service_account(service_account, client, bucket_name, iam_policy): """Set service account for a bucket.""" # Add service account as objectAdmin. binding = storage.get_or_create_bucket_iam_binding(iam_policy, OBJEC...
[ "def", "_set_bucket_service_account", "(", "service_account", ",", "client", ",", "bucket_name", ",", "iam_policy", ")", ":", "# Add service account as objectAdmin.", "binding", "=", "storage", ".", "get_or_create_bucket_iam_binding", "(", "iam_policy", ",", "OBJECT_ADMIN_I...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/appengine/handlers/cron/project_setup.py#L370-L383
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wheel/decorator.py
python
reify.__get__
(self, inst, objtype=None)
return val
[]
def __get__(self, inst, objtype=None): if inst is None: return self val = self.wrapped(inst) setattr(inst, self.wrapped.__name__, val) return val
[ "def", "__get__", "(", "self", ",", "inst", ",", "objtype", "=", "None", ")", ":", "if", "inst", "is", "None", ":", "return", "self", "val", "=", "self", ".", "wrapped", "(", "inst", ")", "setattr", "(", "inst", ",", "self", ".", "wrapped", ".", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wheel/decorator.py#L14-L19
timonwong/OmniMarkupPreviewer
21921ac7a99d2b5924a2219b33679a5b53621392
OmniMarkupLib/Renderers/libs/python2/docutils/utils/math/math2html.py
python
ParameterFunction.paramdefs
(self, readtemplate)
Read each param definition in the template
Read each param definition in the template
[ "Read", "each", "param", "definition", "in", "the", "template" ]
def paramdefs(self, readtemplate): "Read each param definition in the template" pos = TextPosition(readtemplate) while not pos.finished(): paramdef = ParameterDefinition().parse(pos) if paramdef: yield paramdef
[ "def", "paramdefs", "(", "self", ",", "readtemplate", ")", ":", "pos", "=", "TextPosition", "(", "readtemplate", ")", "while", "not", "pos", ".", "finished", "(", ")", ":", "paramdef", "=", "ParameterDefinition", "(", ")", ".", "parse", "(", "pos", ")", ...
https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python2/docutils/utils/math/math2html.py#L4780-L4786
mitogen-hq/mitogen
5b505f524a7ae170fe68613841ab92b299613d3f
ansible_mitogen/runner.py
python
NewStyleRunner._get_module_package
(self)
return pkg.encode()
Since Ansible 2.9 __package__ must be set in accordance with an approximation of the original package hierarchy, so that relative imports function correctly.
Since Ansible 2.9 __package__ must be set in accordance with an approximation of the original package hierarchy, so that relative imports function correctly.
[ "Since", "Ansible", "2", ".", "9", "__package__", "must", "be", "set", "in", "accordance", "with", "an", "approximation", "of", "the", "original", "package", "hierarchy", "so", "that", "relative", "imports", "function", "correctly", "." ]
def _get_module_package(self): """ Since Ansible 2.9 __package__ must be set in accordance with an approximation of the original package hierarchy, so that relative imports function correctly. """ pkg, sep, modname = str_rpartition(self.py_module_name, '.') if not...
[ "def", "_get_module_package", "(", "self", ")", ":", "pkg", ",", "sep", ",", "modname", "=", "str_rpartition", "(", "self", ".", "py_module_name", ",", "'.'", ")", "if", "not", "sep", ":", "return", "None", "if", "mitogen", ".", "core", ".", "PY3", ":"...
https://github.com/mitogen-hq/mitogen/blob/5b505f524a7ae170fe68613841ab92b299613d3f/ansible_mitogen/runner.py#L946-L957
allegroai/clearml
5953dc6eefadcdfcc2bdbb6a0da32be58823a5af
clearml/automation/controller.py
python
PipelineController._serialize_pipeline_task
(self)
return params, pipeline_dag
Serialize current pipeline state into the main Task :return: params, pipeline_dag
Serialize current pipeline state into the main Task
[ "Serialize", "current", "pipeline", "state", "into", "the", "main", "Task" ]
def _serialize_pipeline_task(self): # type: () -> (dict, dict) """ Serialize current pipeline state into the main Task :return: params, pipeline_dag """ params = { '_default_queue_': self._default_execution_queue, '_add_pipeline_tags_': self._add_...
[ "def", "_serialize_pipeline_task", "(", "self", ")", ":", "# type: () -> (dict, dict)", "params", "=", "{", "'_default_queue_'", ":", "self", ".", "_default_execution_queue", ",", "'_add_pipeline_tags_'", ":", "self", ".", "_add_pipeline_tags", ",", "'_target_project_'", ...
https://github.com/allegroai/clearml/blob/5953dc6eefadcdfcc2bdbb6a0da32be58823a5af/clearml/automation/controller.py#L1131-L1189
datalad/datalad
d8c8383d878a207bb586415314219a60c345f732
datalad/support/archives.py
python
_get_random_id
(size=6, chars=string.ascii_uppercase + string.digits)
return ''.join(random.choice(chars) for _ in range(size))
Return a random ID composed from digits and uppercase letters upper-case so we are tolerant to unlikely collisions on dummy FSs
Return a random ID composed from digits and uppercase letters
[ "Return", "a", "random", "ID", "composed", "from", "digits", "and", "uppercase", "letters" ]
def _get_random_id(size=6, chars=string.ascii_uppercase + string.digits): """Return a random ID composed from digits and uppercase letters upper-case so we are tolerant to unlikely collisions on dummy FSs """ return ''.join(random.choice(chars) for _ in range(size))
[ "def", "_get_random_id", "(", "size", "=", "6", ",", "chars", "=", "string", ".", "ascii_uppercase", "+", "string", ".", "digits", ")", ":", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "chars", ")", "for", "_", "in", "range", "(",...
https://github.com/datalad/datalad/blob/d8c8383d878a207bb586415314219a60c345f732/datalad/support/archives.py#L114-L119
elastic/elasticsearch-py
6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb
elasticsearch/_async/client/__init__.py
python
AsyncElasticsearch.close
(self)
Closes the Transport and all internal connections
Closes the Transport and all internal connections
[ "Closes", "the", "Transport", "and", "all", "internal", "connections" ]
async def close(self) -> None: """Closes the Transport and all internal connections""" await self.transport.close()
[ "async", "def", "close", "(", "self", ")", "->", "None", ":", "await", "self", ".", "transport", ".", "close", "(", ")" ]
https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_async/client/__init__.py#L515-L517
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/k8s.py
python
create_namespace
(name, apiserver_url=None)
return ret
.. versionadded:: 2016.3.0 Create kubernetes namespace from the name, similar to the functionality added to kubectl since v.1.2.0: .. code-block:: bash kubectl create namespaces namespace-name CLI Example: .. code-block:: bash salt '*' k8s.create_namespace namespace_name sa...
.. versionadded:: 2016.3.0
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
def create_namespace(name, apiserver_url=None): """ .. versionadded:: 2016.3.0 Create kubernetes namespace from the name, similar to the functionality added to kubectl since v.1.2.0: .. code-block:: bash kubectl create namespaces namespace-name CLI Example: .. code-block:: bash ...
[ "def", "create_namespace", "(", "name", ",", "apiserver_url", "=", "None", ")", ":", "ret", "=", "{", "\"name\"", ":", "name", ",", "\"result\"", ":", "True", ",", "\"comment\"", ":", "\"\"", ",", "\"changes\"", ":", "{", "}", "}", "# Try to get kubernetes...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/k8s.py#L412-L444
rushter/MLAlgorithms
3c8e16b8de3baf131395ae57edd479e59566a7c6
mla/ensemble/random_forest.py
python
RandomForestClassifier._predict
(self, X=None)
return predictions
[]
def _predict(self, X=None): y_shape = np.unique(self.y).shape[0] predictions = np.zeros((X.shape[0], y_shape)) for i in range(X.shape[0]): row_pred = np.zeros(y_shape) for tree in self.trees: row_pred += tree.predict_row(X[i, :]) row_pred /= ...
[ "def", "_predict", "(", "self", ",", "X", "=", "None", ")", ":", "y_shape", "=", "np", ".", "unique", "(", "self", ".", "y", ")", ".", "shape", "[", "0", "]", "predictions", "=", "np", ".", "zeros", "(", "(", "X", ".", "shape", "[", "0", "]",...
https://github.com/rushter/MLAlgorithms/blob/3c8e16b8de3baf131395ae57edd479e59566a7c6/mla/ensemble/random_forest.py#L73-L84
tensorflow/addons
37a368adfea1d0ec4cb85998946f458e9d565818
tensorflow_addons/image/distort_image_ops.py
python
random_hsv_in_yiq
( image: TensorLike, max_delta_hue: Number = 0, lower_saturation: Number = 1, upper_saturation: Number = 1, lower_value: Number = 1, upper_value: Number = 1, seed: Optional[int] = None, name: Optional[str] = None, )
Adjust hue, saturation, value of an RGB image randomly in YIQ color space. Equivalent to `adjust_yiq_hsv()` but uses a `delta_h` randomly picked in the interval `[-max_delta_hue, max_delta_hue]`, a `scale_saturation` randomly picked in the interval `[lower_saturation, upper_saturation]`, and a `scale_v...
Adjust hue, saturation, value of an RGB image randomly in YIQ color space.
[ "Adjust", "hue", "saturation", "value", "of", "an", "RGB", "image", "randomly", "in", "YIQ", "color", "space", "." ]
def random_hsv_in_yiq( image: TensorLike, max_delta_hue: Number = 0, lower_saturation: Number = 1, upper_saturation: Number = 1, lower_value: Number = 1, upper_value: Number = 1, seed: Optional[int] = None, name: Optional[str] = None, ) -> tf.Tensor: """Adjust hue, saturation, value ...
[ "def", "random_hsv_in_yiq", "(", "image", ":", "TensorLike", ",", "max_delta_hue", ":", "Number", "=", "0", ",", "lower_saturation", ":", "Number", "=", "1", ",", "upper_saturation", ":", "Number", "=", "1", ",", "lower_value", ":", "Number", "=", "1", ","...
https://github.com/tensorflow/addons/blob/37a368adfea1d0ec4cb85998946f458e9d565818/tensorflow_addons/image/distort_image_ops.py#L29-L102
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/mimic_external_axes.py
python
_enable_external_axis_limits
(external_axis_CTRL, driving_attribute_trunc, driving_axis, enable=True)
Enables/Disables external axis' limit attributes :param external_axis_CTRL: str, name of external axis control :param driving_attribute_trunc: str, truncated name of driving attribute (e.g. Trans, Rot) :param driving_axis: str, 'X', 'Y', or 'Z' :param enable: bool, default True
Enables/Disables external axis' limit attributes :param external_axis_CTRL: str, name of external axis control :param driving_attribute_trunc: str, truncated name of driving attribute (e.g. Trans, Rot) :param driving_axis: str, 'X', 'Y', or 'Z' :param enable: bool, default True
[ "Enables", "/", "Disables", "external", "axis", "limit", "attributes", ":", "param", "external_axis_CTRL", ":", "str", "name", "of", "external", "axis", "control", ":", "param", "driving_attribute_trunc", ":", "str", "truncated", "name", "of", "driving", "attribut...
def _enable_external_axis_limits(external_axis_CTRL, driving_attribute_trunc, driving_axis, enable=True): """ Enables/Disables external axis' limit attributes :param external_axis_CTRL: str, name of external axis control :param driving_attribute_trunc: str, truncated name of driving attribute (e...
[ "def", "_enable_external_axis_limits", "(", "external_axis_CTRL", ",", "driving_attribute_trunc", ",", "driving_axis", ",", "enable", "=", "True", ")", ":", "pm", ".", "setAttr", "(", "'{}.min{}{}LimitEnable'", ".", "format", "(", "external_axis_CTRL", ",", "driving_a...
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/mimic_external_axes.py#L457-L475
ibis-project/ibis
e1ef8b6870ac53de9d1fe5c52851fa41872109c4
ibis/expr/datatypes.py
python
infer_dtype_default
(value: typing.Any)
Default implementation of :func:`~ibis.expr.datatypes.infer`.
Default implementation of :func:`~ibis.expr.datatypes.infer`.
[ "Default", "implementation", "of", ":", "func", ":", "~ibis", ".", "expr", ".", "datatypes", ".", "infer", "." ]
def infer_dtype_default(value: typing.Any) -> DataType: """Default implementation of :func:`~ibis.expr.datatypes.infer`.""" raise com.InputTypeError(value)
[ "def", "infer_dtype_default", "(", "value", ":", "typing", ".", "Any", ")", "->", "DataType", ":", "raise", "com", ".", "InputTypeError", "(", "value", ")" ]
https://github.com/ibis-project/ibis/blob/e1ef8b6870ac53de9d1fe5c52851fa41872109c4/ibis/expr/datatypes.py#L1161-L1163
openstack/barbican
a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce
barbican/plugin/crypto/p11_crypto.py
python
P11CryptoPlugin.supports
(self, type_enum, algorithm=None, bit_length=None, mode=None)
[]
def supports(self, type_enum, algorithm=None, bit_length=None, mode=None): if type_enum == plugin.PluginSupportTypes.ENCRYPT_DECRYPT: return True elif type_enum == plugin.PluginSupportTypes.SYMMETRIC_KEY_GENERATION: return True elif type_enum == plugin.PluginSupportTypes....
[ "def", "supports", "(", "self", ",", "type_enum", ",", "algorithm", "=", "None", ",", "bit_length", "=", "None", ",", "mode", "=", "None", ")", ":", "if", "type_enum", "==", "plugin", ".", "PluginSupportTypes", ".", "ENCRYPT_DECRYPT", ":", "return", "True"...
https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/plugin/crypto/p11_crypto.py#L196-L204
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/shortcuts/widgets/table.py
python
ShortcutsModel.flags
(self, index)
return Qt.ItemFlags(int(QAbstractTableModel.flags(self, index)))
Qt Override.
Qt Override.
[ "Qt", "Override", "." ]
def flags(self, index): """Qt Override.""" if not index.isValid(): return Qt.ItemIsEnabled return Qt.ItemFlags(int(QAbstractTableModel.flags(self, index)))
[ "def", "flags", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "Qt", ".", "ItemIsEnabled", "return", "Qt", ".", "ItemFlags", "(", "int", "(", "QAbstractTableModel", ".", "flags", "(", "self", ",", ...
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/shortcuts/widgets/table.py#L531-L535
qubvel/segmentation_models.pytorch
06fdd31a6fadf659f9c90648e876dbe097e0e399
segmentation_models_pytorch/base/model.py
python
SegmentationModel.forward
(self, x)
return masks
Sequentially pass `x` trough model`s encoder, decoder and heads
Sequentially pass `x` trough model`s encoder, decoder and heads
[ "Sequentially", "pass", "x", "trough", "model", "s", "encoder", "decoder", "and", "heads" ]
def forward(self, x): """Sequentially pass `x` trough model`s encoder, decoder and heads""" features = self.encoder(x) decoder_output = self.decoder(*features) masks = self.segmentation_head(decoder_output) if self.classification_head is not None: labels = self.clas...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "features", "=", "self", ".", "encoder", "(", "x", ")", "decoder_output", "=", "self", ".", "decoder", "(", "*", "features", ")", "masks", "=", "self", ".", "segmentation_head", "(", "decoder_output", ...
https://github.com/qubvel/segmentation_models.pytorch/blob/06fdd31a6fadf659f9c90648e876dbe097e0e399/segmentation_models_pytorch/base/model.py#L12-L23
canonical/cloud-init
dc1aabfca851e520693c05322f724bd102c76364
setup.py
python
render_tmpl
(template, mode=None)
return os.path.join(os.path.basename(tmpd), bname)
render template into a tmpdir under same dir as setup.py This is rendered to a temporary directory under the top level directory with the name 'cloud.cfg'. The reason for not just rendering to config/cloud.cfg is for a.) don't want to write over contents in that file if user had something there. b.) d...
render template into a tmpdir under same dir as setup.py
[ "render", "template", "into", "a", "tmpdir", "under", "same", "dir", "as", "setup", ".", "py" ]
def render_tmpl(template, mode=None): """render template into a tmpdir under same dir as setup.py This is rendered to a temporary directory under the top level directory with the name 'cloud.cfg'. The reason for not just rendering to config/cloud.cfg is for a.) don't want to write over contents in...
[ "def", "render_tmpl", "(", "template", ",", "mode", "=", "None", ")", ":", "# older versions of tox use bdist (xenial), and then install from there.", "# newer versions just use install.", "if", "not", "(", "sys", ".", "argv", "[", "1", "]", "==", "\"install\"", "or", ...
https://github.com/canonical/cloud-init/blob/dc1aabfca851e520693c05322f724bd102c76364/setup.py#L79-L121
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/pymysql/util.py
python
int2byte
(i)
return struct.pack("!B", i)
[]
def int2byte(i): return struct.pack("!B", i)
[ "def", "int2byte", "(", "i", ")", ":", "return", "struct", ".", "pack", "(", "\"!B\"", ",", "i", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pymysql/util.py#L11-L12
open-cogsci/OpenSesame
c4a3641b097a80a76937edbd8c365f036bcc9705
libqtopensesame/items/keyboard_response.py
python
keyboard_response.__init__
(self, name, experiment, string=None)
Constructor Arguments: name -- item name experiment -- experiment instance Keywords arguments: string -- a definition string (default=None)
Constructor
[ "Constructor" ]
def __init__(self, name, experiment, string=None): """ Constructor Arguments: name -- item name experiment -- experiment instance Keywords arguments: string -- a definition string (default=None) """ keyboard_response_runtime.__init__(self, name, experiment, string) qtplugin.__init__(self)
[ "def", "__init__", "(", "self", ",", "name", ",", "experiment", ",", "string", "=", "None", ")", ":", "keyboard_response_runtime", ".", "__init__", "(", "self", ",", "name", ",", "experiment", ",", "string", ")", "qtplugin", ".", "__init__", "(", "self", ...
https://github.com/open-cogsci/OpenSesame/blob/c4a3641b097a80a76937edbd8c365f036bcc9705/libqtopensesame/items/keyboard_response.py#L39-L53
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/ex-submodules/dimagi/utils/couch/migration.py
python
SyncSQLToCouchMixin._migration_get_couch_object
(self)
[]
def _migration_get_couch_object(self): if not self._migration_couch_id: return None cls = self._migration_get_couch_model_class() try: return cls.get(str(self._migration_couch_id)) except ResourceNotFound: return None
[ "def", "_migration_get_couch_object", "(", "self", ")", ":", "if", "not", "self", ".", "_migration_couch_id", ":", "return", "None", "cls", "=", "self", ".", "_migration_get_couch_model_class", "(", ")", "try", ":", "return", "cls", ".", "get", "(", "str", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/dimagi/utils/couch/migration.py#L243-L250
netzob/netzob
49ee3e5e7d6dce67496afd5a75827a78be0c9f70
netzob/src/netzob/Model/Vocabulary/Messages/L4NetworkMessage.py
python
L4NetworkMessage.l4Protocol
(self)
return self.__l4Protocol
The protocol of the fourth layer :type: str
The protocol of the fourth layer
[ "The", "protocol", "of", "the", "fourth", "layer" ]
def l4Protocol(self): """The protocol of the fourth layer :type: str """ return self.__l4Protocol
[ "def", "l4Protocol", "(", "self", ")", ":", "return", "self", ".", "__l4Protocol" ]
https://github.com/netzob/netzob/blob/49ee3e5e7d6dce67496afd5a75827a78be0c9f70/netzob/src/netzob/Model/Vocabulary/Messages/L4NetworkMessage.py#L77-L82
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
numpy/core/__init__.py
python
int8.__or__
(self, *args, **kwargs)
Return self|value.
Return self|value.
[ "Return", "self|value", "." ]
def __or__(self, *args, **kwargs): # real signature unknown """ Return self|value. """ pass
[ "def", "__or__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# real signature unknown", "pass" ]
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L1205-L1207
sreyafrancis/PFNN
61a50342b693826ca0f07d0c0eaa6366ed4851f6
motion/Quaternions.py
python
Quaternions.__div__
(self, other)
When a Quaternion type is supplied, division is defined as multiplication by the inverse of that Quaternion. When a scalar or vector is supplied it is defined as multiplicaion of one over the supplied value. Essentially a scaling.
When a Quaternion type is supplied, division is defined as multiplication by the inverse of that Quaternion. When a scalar or vector is supplied it is defined as multiplicaion of one over the supplied value. Essentially a scaling.
[ "When", "a", "Quaternion", "type", "is", "supplied", "division", "is", "defined", "as", "multiplication", "by", "the", "inverse", "of", "that", "Quaternion", ".", "When", "a", "scalar", "or", "vector", "is", "supplied", "it", "is", "defined", "as", "multipli...
def __div__(self, other): """ When a Quaternion type is supplied, division is defined as multiplication by the inverse of that Quaternion. When a scalar or vector is supplied it is defined as multiplicaion of one over the supplied value. Essentially a scaling. ...
[ "def", "__div__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "Quaternions", ")", ":", "return", "self", "*", "(", "-", "other", ")", "if", "isinstance", "(", "other", ",", "np", ".", "ndarray", ")", ":", "return", "...
https://github.com/sreyafrancis/PFNN/blob/61a50342b693826ca0f07d0c0eaa6366ed4851f6/motion/Quaternions.py#L120-L133
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/contrib/auth/models.py
python
User.is_anonymous
(self)
return False
Always returns False. This is a way of comparing User objects to anonymous users.
Always returns False. This is a way of comparing User objects to anonymous users.
[ "Always", "returns", "False", ".", "This", "is", "a", "way", "of", "comparing", "User", "objects", "to", "anonymous", "users", "." ]
def is_anonymous(self): """ Always returns False. This is a way of comparing User objects to anonymous users. """ return False
[ "def", "is_anonymous", "(", "self", ")", ":", "return", "False" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/contrib/auth/models.py#L217-L222
peterdsharpe/AeroSandbox
ded68b0465f2bfdcaf4bc90abd8c91be0addcaba
aerosandbox/modeling/surrogate_model.py
python
SurrogateModel.__call__
(self, x: Union[int, float, np.ndarray, Dict[str, np.ndarray]] )
Evaluates the surrogate model at some given input x. The input `x` is of the type: * in the general N-dimensional case, a dictionary where keys are variable names and values are float/array. * in the case of a 1-dimensional input (R^1 -> R^2), a float/array.
Evaluates the surrogate model at some given input x.
[ "Evaluates", "the", "surrogate", "model", "at", "some", "given", "input", "x", "." ]
def __call__(self, x: Union[int, float, np.ndarray, Dict[str, np.ndarray]] ) -> Union[float, np.ndarray]: """ Evaluates the surrogate model at some given input x. The input `x` is of the type: * in the general N-dimensional case, a dictionary where ...
[ "def", "__call__", "(", "self", ",", "x", ":", "Union", "[", "int", ",", "float", ",", "np", ".", "ndarray", ",", "Dict", "[", "str", ",", "np", ".", "ndarray", "]", "]", ")", "->", "Union", "[", "float", ",", "np", ".", "ndarray", "]", ":", ...
https://github.com/peterdsharpe/AeroSandbox/blob/ded68b0465f2bfdcaf4bc90abd8c91be0addcaba/aerosandbox/modeling/surrogate_model.py#L36-L59
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/QRadar/Integrations/QRadar_v2/QRadar_v2.py
python
enrich_offense_res_with_domain_names
(client, domain_ids, response)
Add domain_name to the offense and assets results
Add domain_name to the offense and assets results
[ "Add", "domain_name", "to", "the", "offense", "and", "assets", "results" ]
def enrich_offense_res_with_domain_names(client, domain_ids, response): """ Add domain_name to the offense and assets results """ domain_filter = 'id=' + 'or id='.join(str(domain_ids).replace(' ', '').split(','))[1:-1] domains = client.get_devices(_filter=domain_filter) domain_names = {d['id']: ...
[ "def", "enrich_offense_res_with_domain_names", "(", "client", ",", "domain_ids", ",", "response", ")", ":", "domain_filter", "=", "'id='", "+", "'or id='", ".", "join", "(", "str", "(", "domain_ids", ")", ".", "replace", "(", "' '", ",", "''", ")", ".", "s...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/QRadar/Integrations/QRadar_v2/QRadar_v2.py#L1193-L1206
OpenZWave/python-openzwave
8be4c070294348f3fc268bc1d7ad2c535f352f5a
src-manager/pyozwman/ozwsh_widgets.py
python
ValuesTree.cd
(self, directory)
return None
Change to directory and return the widget to display
Change to directory and return the widget to display
[ "Change", "to", "directory", "and", "return", "the", "widget", "to", "display" ]
def cd(self, directory): """ Change to directory and return the widget to display """ if self.exist(directory) : if directory == '..': self.node_id = None return self.parent.widget_box if directory in self.childrens: ...
[ "def", "cd", "(", "self", ",", "directory", ")", ":", "if", "self", ".", "exist", "(", "directory", ")", ":", "if", "directory", "==", "'..'", ":", "self", ".", "node_id", "=", "None", "return", "self", ".", "parent", ".", "widget_box", "if", "direct...
https://github.com/OpenZWave/python-openzwave/blob/8be4c070294348f3fc268bc1d7ad2c535f352f5a/src-manager/pyozwman/ozwsh_widgets.py#L1300-L1311
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/devops_sdk/v6_0/gallery/gallery_client.py
python
GalleryClient.query_publishers
(self, publisher_query)
return self._deserialize('PublisherQueryResult', response)
QueryPublishers. [Preview API] :param :class:`<PublisherQuery> <azure.devops.v6_0.gallery.models.PublisherQuery>` publisher_query: :rtype: :class:`<PublisherQueryResult> <azure.devops.v6_0.gallery.models.PublisherQueryResult>`
QueryPublishers. [Preview API] :param :class:`<PublisherQuery> <azure.devops.v6_0.gallery.models.PublisherQuery>` publisher_query: :rtype: :class:`<PublisherQueryResult> <azure.devops.v6_0.gallery.models.PublisherQueryResult>`
[ "QueryPublishers", ".", "[", "Preview", "API", "]", ":", "param", ":", "class", ":", "<PublisherQuery", ">", "<azure", ".", "devops", ".", "v6_0", ".", "gallery", ".", "models", ".", "PublisherQuery", ">", "publisher_query", ":", ":", "rtype", ":", ":", ...
def query_publishers(self, publisher_query): """QueryPublishers. [Preview API] :param :class:`<PublisherQuery> <azure.devops.v6_0.gallery.models.PublisherQuery>` publisher_query: :rtype: :class:`<PublisherQueryResult> <azure.devops.v6_0.gallery.models.PublisherQueryResult>` """ ...
[ "def", "query_publishers", "(", "self", ",", "publisher_query", ")", ":", "content", "=", "self", ".", "_serialize", ".", "body", "(", "publisher_query", ",", "'PublisherQuery'", ")", "response", "=", "self", ".", "_send", "(", "http_method", "=", "'POST'", ...
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/gallery/gallery_client.py#L1221-L1232
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/bar/marker/_colorbar.py
python
ColorBar.len
(self)
return self["len"]
Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. The 'len' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ...
Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. The 'len' property is a number and may be specified as: - An int or float in the interval [0, inf]
[ "Sets", "the", "length", "of", "the", "color", "bar", "This", "measure", "excludes", "the", "padding", "of", "both", "ends", ".", "That", "is", "the", "color", "bar", "length", "is", "this", "length", "minus", "the", "padding", "on", "both", "ends", ".",...
def len(self): """ Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. The 'len' property is a number and may be specified as: - An int or float in the interva...
[ "def", "len", "(", "self", ")", ":", "return", "self", "[", "\"len\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/bar/marker/_colorbar.py#L265-L278
thenetcircle/dino
1047c3458e91a1b4189e9f48f1393b3a68a935b3
dino/db/__init__.py
python
IDatabase.get_online_admins
(self)
get uuids of all admins that are online :return: list of uuids
get uuids of all admins that are online
[ "get", "uuids", "of", "all", "admins", "that", "are", "online" ]
def get_online_admins(self) -> list: """ get uuids of all admins that are online :return: list of uuids """
[ "def", "get_online_admins", "(", "self", ")", "->", "list", ":" ]
https://github.com/thenetcircle/dino/blob/1047c3458e91a1b4189e9f48f1393b3a68a935b3/dino/db/__init__.py#L434-L439
pytorchbearer/torchbearer
9d97c60ec4deb37a0627311ddecb9c6f1429cd82
torchbearer/metrics/aggregators.py
python
Std.__init__
(self, name, unbiased=True, dim=None)
[]
def __init__(self, name, unbiased=True, dim=None): super(Std, self).__init__(name, unbiased=unbiased, dim=dim)
[ "def", "__init__", "(", "self", ",", "name", ",", "unbiased", "=", "True", ",", "dim", "=", "None", ")", ":", "super", "(", "Std", ",", "self", ")", ".", "__init__", "(", "name", ",", "unbiased", "=", "unbiased", ",", "dim", "=", "dim", ")" ]
https://github.com/pytorchbearer/torchbearer/blob/9d97c60ec4deb37a0627311ddecb9c6f1429cd82/torchbearer/metrics/aggregators.py#L180-L181
jbjorne/TEES
caf19a4a1352ac59f5dc13a8684cc42ce4342d9d
ExampleBuilders/ExampleStats.py
python
ExampleStats.addExample
(self, className, filteredBy=[])
[]
def addExample(self, className, filteredBy=[]): self.beginExample(className) for filter in filteredBy: self.filter(filter) self.endExample()
[ "def", "addExample", "(", "self", ",", "className", ",", "filteredBy", "=", "[", "]", ")", ":", "self", ".", "beginExample", "(", "className", ")", "for", "filter", "in", "filteredBy", ":", "self", ".", "filter", "(", "filter", ")", "self", ".", "endEx...
https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/ExampleBuilders/ExampleStats.py#L24-L28
lektor/lektor
d5a7f22343572a991f2316c086f24005d0cbf0f8
lektor/db.py
python
Query.count
(self)
return rv
Counts all matched objects.
Counts all matched objects.
[ "Counts", "all", "matched", "objects", "." ]
def count(self): """Counts all matched objects.""" rv = 0 for _ in self: rv += 1 return rv
[ "def", "count", "(", "self", ")", ":", "rv", "=", "0", "for", "_", "in", "self", ":", "rv", "+=", "1", "return", "rv" ]
https://github.com/lektor/lektor/blob/d5a7f22343572a991f2316c086f24005d0cbf0f8/lektor/db.py#L1142-L1147
wildfoundry/dataplicity-lomond
2e3235fb64f4c630ceb9a141f4d44977e89e7322
lomond/frame.py
python
Frame.build
(cls, opcode, payload=b'', fin=1, rsv1=0, rsv2=0, rsv3=0, mask=True, masking_key=None)
return frame_bytes
Build a WS frame.
Build a WS frame.
[ "Build", "a", "WS", "frame", "." ]
def build(cls, opcode, payload=b'', fin=1, rsv1=0, rsv2=0, rsv3=0, mask=True, masking_key=None): """Build a WS frame.""" # https://tools.ietf.org/html/rfc6455#section-5.2 payload = bytearray(payload) if isinstance(payload, bytes) else payload mask_bit = 1 << 7...
[ "def", "build", "(", "cls", ",", "opcode", ",", "payload", "=", "b''", ",", "fin", "=", "1", ",", "rsv1", "=", "0", ",", "rsv2", "=", "0", ",", "rsv3", "=", "0", ",", "mask", "=", "True", ",", "masking_key", "=", "None", ")", ":", "# https://to...
https://github.com/wildfoundry/dataplicity-lomond/blob/2e3235fb64f4c630ceb9a141f4d44977e89e7322/lomond/frame.py#L65-L99
tensorflow/agents
1407001d242f7f77fb9407f9b1ac78bcd8f73a09
tf_agents/benchmark/utils.py
python
get_initial_values
(agent, check_values)
return [get_variable_value(agent, var_name) for var_name in check_values]
Returns the initial values.
Returns the initial values.
[ "Returns", "the", "initial", "values", "." ]
def get_initial_values(agent, check_values): """Returns the initial values.""" return [get_variable_value(agent, var_name) for var_name in check_values]
[ "def", "get_initial_values", "(", "agent", ",", "check_values", ")", ":", "return", "[", "get_variable_value", "(", "agent", ",", "var_name", ")", "for", "var_name", "in", "check_values", "]" ]
https://github.com/tensorflow/agents/blob/1407001d242f7f77fb9407f9b1ac78bcd8f73a09/tf_agents/benchmark/utils.py#L194-L196
pypyjs/pypyjs
4532320849881093635075db929240052300a844
tools/module_bundler.py
python
ModuleBundle._copy_py_file
(self, srcpath, dstpath)
Copy a python source file into the bundle. This method copes the contents of a python source file into the bundle. Since browsers usually expect strings in utf-8 format, it will try to detect source files in other encodings and transparently convert them to utf-8.
Copy a python source file into the bundle.
[ "Copy", "a", "python", "source", "file", "into", "the", "bundle", "." ]
def _copy_py_file(self, srcpath, dstpath): """Copy a python source file into the bundle. This method copes the contents of a python source file into the bundle. Since browsers usually expect strings in utf-8 format, it will try to detect source files in other encodings and transparently...
[ "def", "_copy_py_file", "(", "self", ",", "srcpath", ",", "dstpath", ")", ":", "# XXX TODO: copy in chunks, like shutil would do?", "with", "open", "(", "srcpath", ",", "\"rb\"", ")", "as", "f_src", ":", "data", "=", "f_src", ".", "read", "(", ")", "# Look for...
https://github.com/pypyjs/pypyjs/blob/4532320849881093635075db929240052300a844/tools/module_bundler.py#L525-L565
bcbio/bcbio-nextgen
c80f9b6b1be3267d1f981b7035e3b72441d258f2
bcbio/variation/cortex.py
python
_run_cortex_on_region
(region, align_bam, ref_file, work_dir, out_file_base, config)
return [region[0], int(region[1]), int(region[2]), out_file]
Run cortex on a specified chromosome start/end region.
Run cortex on a specified chromosome start/end region.
[ "Run", "cortex", "on", "a", "specified", "chromosome", "start", "/", "end", "region", "." ]
def _run_cortex_on_region(region, align_bam, ref_file, work_dir, out_file_base, config): """Run cortex on a specified chromosome start/end region. """ kmers = [31, 51, 71] min_reads = 1750 cortex_dir = config_utils.get_program("cortex", config, "dir") stampy_dir = config_utils.get_program("stamp...
[ "def", "_run_cortex_on_region", "(", "region", ",", "align_bam", ",", "ref_file", ",", "work_dir", ",", "out_file_base", ",", "config", ")", ":", "kmers", "=", "[", "31", ",", "51", ",", "71", "]", "min_reads", "=", "1750", "cortex_dir", "=", "config_utils...
https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/variation/cortex.py#L122-L157
jamesyonan/brenda
3fdcf6d55baf3138ddfa4812c2527441be341267
brenda/aws.py
python
format_s3_url
(bucktup, s3name)
return "s3://%s/%s%s" % (bucktup[1][0], bucktup[1][1], s3name)
bucktup is the return tuple of get_s3_output_bucket_name
bucktup is the return tuple of get_s3_output_bucket_name
[ "bucktup", "is", "the", "return", "tuple", "of", "get_s3_output_bucket_name" ]
def format_s3_url(bucktup, s3name): """ bucktup is the return tuple of get_s3_output_bucket_name """ return "s3://%s/%s%s" % (bucktup[1][0], bucktup[1][1], s3name)
[ "def", "format_s3_url", "(", "bucktup", ",", "s3name", ")", ":", "return", "\"s3://%s/%s%s\"", "%", "(", "bucktup", "[", "1", "]", "[", "0", "]", ",", "bucktup", "[", "1", "]", "[", "1", "]", ",", "s3name", ")" ]
https://github.com/jamesyonan/brenda/blob/3fdcf6d55baf3138ddfa4812c2527441be341267/brenda/aws.py#L103-L107
tperol/ConvNetQuake
9d8bb6d41e5e3185edf3a3fc716539b910e17cfe
bin/viz/misclassified_loc.py
python
fetch_streams_list
(datadir)
return fnames
Get the list of streams to analyze
Get the list of streams to analyze
[ "Get", "the", "list", "of", "streams", "to", "analyze" ]
def fetch_streams_list(datadir): """Get the list of streams to analyze""" fnames = [] for root, dirs, files in os.walk(datadir): for f in files: if f.endswith(".mseed"): fnames.append(os.path.join(root, f)) return fnames
[ "def", "fetch_streams_list", "(", "datadir", ")", ":", "fnames", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "datadir", ")", ":", "for", "f", "in", "files", ":", "if", "f", ".", "endswith", "(", "\".mseed\...
https://github.com/tperol/ConvNetQuake/blob/9d8bb6d41e5e3185edf3a3fc716539b910e17cfe/bin/viz/misclassified_loc.py#L76-L83
rogerbinns/apsw
00a7eb5138f2f00976f0c76cb51906afecbe298f
tools/apswtrace.py
python
APSWTracer.longestrunningindividual
(self, howmany)
return res
[]
def longestrunningindividual(self, howmany): res=[] for k,v in self.timings.items(): for t in v: res.append( (t, k) ) res.sort() res.reverse() res=res[:howmany] return res
[ "def", "longestrunningindividual", "(", "self", ",", "howmany", ")", ":", "res", "=", "[", "]", "for", "k", ",", "v", "in", "self", ".", "timings", ".", "items", "(", ")", ":", "for", "t", "in", "v", ":", "res", ".", "append", "(", "(", "t", ",...
https://github.com/rogerbinns/apsw/blob/00a7eb5138f2f00976f0c76cb51906afecbe298f/tools/apswtrace.py#L228-L236
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/sndhdr.py
python
whathdr
(filename)
return None
Recognize sound headers
Recognize sound headers
[ "Recognize", "sound", "headers" ]
def whathdr(filename): """Recognize sound headers""" f = open(filename, 'rb') h = f.read(512) for tf in tests: res = tf(h, f) if res: return res return None
[ "def", "whathdr", "(", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'rb'", ")", "h", "=", "f", ".", "read", "(", "512", ")", "for", "tf", "in", "tests", ":", "res", "=", "tf", "(", "h", ",", "f", ")", "if", "res", ":", "re...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/sndhdr.py#L41-L49
mu-editor/mu
5a5d7723405db588f67718a63a0ec0ecabebae33
utils/flask_api.py
python
BottleSpider.parse
(self, response)
Scrapes the list of modules associated with Bottle. Causes scrapy to follow the links to the module docs and uses a different parser to extract the API information contained therein.
Scrapes the list of modules associated with Bottle. Causes scrapy to follow the links to the module docs and uses a different parser to extract the API information contained therein.
[ "Scrapes", "the", "list", "of", "modules", "associated", "with", "Bottle", ".", "Causes", "scrapy", "to", "follow", "the", "links", "to", "the", "module", "docs", "and", "uses", "a", "different", "parser", "to", "extract", "the", "API", "information", "conta...
def parse(self, response): """ Scrapes the list of modules associated with Bottle. Causes scrapy to follow the links to the module docs and uses a different parser to extract the API information contained therein. """ # Find all the function definitions on the page: ...
[ "def", "parse", "(", "self", ",", "response", ")", ":", "# Find all the function definitions on the page:", "for", "func", "in", "response", ".", "css", "(", "\"dl.function\"", ")", ":", "# Class details are always first items in dl.", "func_spec", "=", "func", ".", "...
https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/utils/flask_api.py#L20-L122
tenpy/tenpy
bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff
tenpy/algorithms/exact_diag.py
python
ExactDiag.exp_H
(self, dt)
return npc.tensordot(self.V.scale_axis(np.exp(-1.j * dt * self.E), 'ps*'), self.V.conj(), axes=['ps*', 'ps'])
Return ``U(dt) := exp(-i H dt)``.
Return ``U(dt) := exp(-i H dt)``.
[ "Return", "U", "(", "dt", ")", ":", "=", "exp", "(", "-", "i", "H", "dt", ")", "." ]
def exp_H(self, dt): """Return ``U(dt) := exp(-i H dt)``.""" if self.E is None or self.V is None: raise ValueError("You need to call `full_diagonalization` first!") return npc.tensordot(self.V.scale_axis(np.exp(-1.j * dt * self.E), 'ps*'), self.V.conj(), ...
[ "def", "exp_H", "(", "self", ",", "dt", ")", ":", "if", "self", ".", "E", "is", "None", "or", "self", ".", "V", "is", "None", ":", "raise", "ValueError", "(", "\"You need to call `full_diagonalization` first!\"", ")", "return", "npc", ".", "tensordot", "("...
https://github.com/tenpy/tenpy/blob/bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff/tenpy/algorithms/exact_diag.py#L221-L227
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/mupad.py
python
Mupad.__init__
(self, maxread=None, script_subdirectory=None, server=None, server_tmpdir=None, logfile=None)
Create an instance of the MuPAD interpreter. EXAMPLES:: sage: mupad == loads(dumps(mupad)) # optional - mupad True
Create an instance of the MuPAD interpreter.
[ "Create", "an", "instance", "of", "the", "MuPAD", "interpreter", "." ]
def __init__(self, maxread=None, script_subdirectory=None, server=None, server_tmpdir=None, logfile=None): """ Create an instance of the MuPAD interpreter. EXAMPLES:: sage: mupad == loads(dumps(mupad)) # optional - mupad True """ Exp...
[ "def", "__init__", "(", "self", ",", "maxread", "=", "None", ",", "script_subdirectory", "=", "None", ",", "server", "=", "None", ",", "server_tmpdir", "=", "None", ",", "logfile", "=", "None", ")", ":", "Expect", ".", "__init__", "(", "self", ",", "na...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/mupad.py#L111-L130
dgilland/pydash
24ad0e43b51b367d00447c45baa68c9c03ad1a52
src/pydash/utilities.py
python
base_range
(*args, **kwargs)
return gen()
Yield range values.
Yield range values.
[ "Yield", "range", "values", "." ]
def base_range(*args, **kwargs): """Yield range values.""" from_right = kwargs.get("from_right", False) if len(args) >= 3: args = args[:3] elif len(args) == 2: args = (args[0], args[1], None) elif len(args) == 1: args = (0, args[0], None) if args and args[2] is None: ...
[ "def", "base_range", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from_right", "=", "kwargs", ".", "get", "(", "\"from_right\"", ",", "False", ")", "if", "len", "(", "args", ")", ">=", "3", ":", "args", "=", "args", "[", ":", "3", "]", ...
https://github.com/dgilland/pydash/blob/24ad0e43b51b367d00447c45baa68c9c03ad1a52/src/pydash/utilities.py#L1294-L1335
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/pkg_resources/__init__.py
python
Distribution.__repr__
(self)
[]
def __repr__(self): if self.location: return "%s (%s)" % (self, self.location) else: return str(self)
[ "def", "__repr__", "(", "self", ")", ":", "if", "self", ".", "location", ":", "return", "\"%s (%s)\"", "%", "(", "self", ",", "self", ".", "location", ")", "else", ":", "return", "str", "(", "self", ")" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/pkg_resources/__init__.py#L2798-L2802
IdentityPython/pysaml2
6badb32d212257bd83ffcc816f9b625f68281b47
src/saml2/authn_context/ippword.py
python
activation_pin_type__from_string
(xml_string)
return saml2.create_class_from_xml_string(ActivationPinType_, xml_string)
[]
def activation_pin_type__from_string(xml_string): return saml2.create_class_from_xml_string(ActivationPinType_, xml_string)
[ "def", "activation_pin_type__from_string", "(", "xml_string", ")", ":", "return", "saml2", ".", "create_class_from_xml_string", "(", "ActivationPinType_", ",", "xml_string", ")" ]
https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/authn_context/ippword.py#L1619-L1620
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
builtins.py
python
bytes.isalnum
(self)
return False
Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. :rtype: bool
Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise.
[ "Return", "true", "if", "all", "characters", "in", "the", "string", "are", "alphanumeric", "and", "there", "is", "at", "least", "one", "character", "false", "otherwise", "." ]
def isalnum(self): """Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. :rtype: bool """ return False
[ "def", "isalnum", "(", "self", ")", ":", "return", "False" ]
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/builtins.py#L1108-L1114
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/exceptions.py
python
HashErrors.__nonzero__
(self)
return bool(self.errors)
[]
def __nonzero__(self): return bool(self.errors)
[ "def", "__nonzero__", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "errors", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/exceptions.py#L72-L73
dBeker/Faster-RCNN-TensorFlow-Python3
027e5603551b3b9053042a113b4c7be9579dbb4a
data/coco/PythonAPI/pycocotools/cocoeval.py
python
COCOeval.evaluate
(self)
Run per image evaluation on given images and store results (a list of dict) in self.evalImgs :return: None
Run per image evaluation on given images and store results (a list of dict) in self.evalImgs :return: None
[ "Run", "per", "image", "evaluation", "on", "given", "images", "and", "store", "results", "(", "a", "list", "of", "dict", ")", "in", "self", ".", "evalImgs", ":", "return", ":", "None" ]
def evaluate(self): ''' Run per image evaluation on given images and store results (a list of dict) in self.evalImgs :return: None ''' tic = time.time() print('Running per image evaluation...') p = self.params # add backward compatibility if useSegm is spe...
[ "def", "evaluate", "(", "self", ")", ":", "tic", "=", "time", ".", "time", "(", ")", "print", "(", "'Running per image evaluation...'", ")", "p", "=", "self", ".", "params", "# add backward compatibility if useSegm is specified in params", "if", "not", "p", ".", ...
https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3/blob/027e5603551b3b9053042a113b4c7be9579dbb4a/data/coco/PythonAPI/pycocotools/cocoeval.py#L122-L162
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
scripts/monitoring/cron-send-url-check.py
python
UrlCheck.run
(self)
Main function to run the check
Main function to run the check
[ "Main", "function", "to", "run", "the", "check" ]
def run(self): """Main function to run the check""" logging.info('Starting url checker...') try: with open(self.args.configfile, 'r') as configfile: self.config = yaml.load(configfile) logging.debug('Loaded config file: %s', self.config) excep...
[ "def", "run", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting url checker...'", ")", "try", ":", "with", "open", "(", "self", ".", "args", ".", "configfile", ",", "'r'", ")", "as", "configfile", ":", "self", ".", "config", "=", "yaml", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/scripts/monitoring/cron-send-url-check.py#L89-L118
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/rich_text.py
python
HalloRichTextArea.value_from_datadict
(self, data, files, name)
return DbWhitelister.clean(original_value)
[]
def value_from_datadict(self, data, files, name): original_value = super(HalloRichTextArea, self).value_from_datadict(data, files, name) if original_value is None: return None return DbWhitelister.clean(original_value)
[ "def", "value_from_datadict", "(", "self", ",", "data", ",", "files", ",", "name", ")", ":", "original_value", "=", "super", "(", "HalloRichTextArea", ",", "self", ")", ".", "value_from_datadict", "(", "data", ",", "files", ",", "name", ")", "if", "origina...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/rich_text.py#L136-L140
truenas/middleware
b11ec47d6340324f5a32287ffb4012e5d709b934
src/middlewared/middlewared/plugins/gluster_linux/peer.py
python
GlusterPeerService.do_create
(self, job, data)
return await self.middleware.call('gluster.peer.query', [('hostname', '=', data['hostname'])])
Add peer to the Trusted Storage Pool. `hostname` String representing an IP(v4/v6) address or DNS name
Add peer to the Trusted Storage Pool.
[ "Add", "peer", "to", "the", "Trusted", "Storage", "Pool", "." ]
async def do_create(self, job, data): """ Add peer to the Trusted Storage Pool. `hostname` String representing an IP(v4/v6) address or DNS name """ await self.middleware.call('gluster.peer.common_validation', 'gluster.peer.create') # we need to verify that we can resolv...
[ "async", "def", "do_create", "(", "self", ",", "job", ",", "data", ")", ":", "await", "self", ".", "middleware", ".", "call", "(", "'gluster.peer.common_validation'", ",", "'gluster.peer.create'", ")", "# we need to verify that we can resolve the hostname to an IP address...
https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/plugins/gluster_linux/peer.py#L78-L91
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/plat-sunos5/IN.py
python
FTFLW_HASH
(h)
return (((unsigned)(h))%ftflw_hash_sz)
[]
def FTFLW_HASH(h): return (((unsigned)(h))%ftflw_hash_sz)
[ "def", "FTFLW_HASH", "(", "h", ")", ":", "return", "(", "(", "(", "unsigned", ")", "(", "h", ")", ")", "%", "ftflw_hash_sz", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-sunos5/IN.py#L1102-L1102
gpodder/mygpo
7a028ad621d05d4ca0d58fd22fb92656c8835e43
mygpo/api/advanced/auth.py
python
logout
(request, username)
return HttpResponse()
logs out the user. does nothing if he wasn't logged in
logs out the user. does nothing if he wasn't logged in
[ "logs", "out", "the", "user", ".", "does", "nothing", "if", "he", "wasn", "t", "logged", "in" ]
def logout(request, username): """ logs out the user. does nothing if he wasn't logged in """ auth.logout(request) return HttpResponse()
[ "def", "logout", "(", "request", ",", "username", ")", ":", "auth", ".", "logout", "(", "request", ")", "return", "HttpResponse", "(", ")" ]
https://github.com/gpodder/mygpo/blob/7a028ad621d05d4ca0d58fd22fb92656c8835e43/mygpo/api/advanced/auth.py#L32-L38
nucypher/nucypher
f420caeb1c974f511f689fd1e5a9c6bbdf97f2d7
nucypher/blockchain/eth/agents.py
python
StakingEscrowAgent.set_restaking
(self, transacting_power: TransactingPower, value: bool)
return receipt
Enable automatic restaking for a fixed duration of lock periods. If set to True, then all staking rewards will be automatically added to locked stake.
Enable automatic restaking for a fixed duration of lock periods. If set to True, then all staking rewards will be automatically added to locked stake.
[ "Enable", "automatic", "restaking", "for", "a", "fixed", "duration", "of", "lock", "periods", ".", "If", "set", "to", "True", "then", "all", "staking", "rewards", "will", "be", "automatically", "added", "to", "locked", "stake", "." ]
def set_restaking(self, transacting_power: TransactingPower, value: bool) -> TxReceipt: """ Enable automatic restaking for a fixed duration of lock periods. If set to True, then all staking rewards will be automatically added to locked stake. """ contract_function: ContractFuncti...
[ "def", "set_restaking", "(", "self", ",", "transacting_power", ":", "TransactingPower", ",", "value", ":", "bool", ")", "->", "TxReceipt", ":", "contract_function", ":", "ContractFunction", "=", "self", ".", "contract", ".", "functions", ".", "setReStake", "(", ...
https://github.com/nucypher/nucypher/blob/f420caeb1c974f511f689fd1e5a9c6bbdf97f2d7/nucypher/blockchain/eth/agents.py#L651-L660
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/compat/chainmap_impl.py
python
recursive_repr
(fillvalue='...')
return decorating_function
Decorator to make a repr function return fillvalue for a recursive call
Decorator to make a repr function return fillvalue for a recursive call
[ "Decorator", "to", "make", "a", "repr", "function", "return", "fillvalue", "for", "a", "recursive", "call" ]
def recursive_repr(fillvalue='...'): 'Decorator to make a repr function return fillvalue for a recursive call' def decorating_function(user_function): repr_running = set() def wrapper(self): key = id(self), get_ident() if key in repr_running: return fill...
[ "def", "recursive_repr", "(", "fillvalue", "=", "'...'", ")", ":", "def", "decorating_function", "(", "user_function", ")", ":", "repr_running", "=", "set", "(", ")", "def", "wrapper", "(", "self", ")", ":", "key", "=", "id", "(", "self", ")", ",", "ge...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/compat/chainmap_impl.py#L9-L32
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
DistInfoDistribution._parsed_pkg_info
(self)
Parse and cache metadata
Parse and cache metadata
[ "Parse", "and", "cache", "metadata" ]
def _parsed_pkg_info(self): """Parse and cache metadata""" try: return self._pkg_info except AttributeError: metadata = self.get_metadata(self.PKG_INFO) self._pkg_info = email.parser.Parser().parsestr(metadata) return self._pkg_info
[ "def", "_parsed_pkg_info", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_pkg_info", "except", "AttributeError", ":", "metadata", "=", "self", ".", "get_metadata", "(", "self", ".", "PKG_INFO", ")", "self", ".", "_pkg_info", "=", "email", ".",...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2857-L2864
Zehaos/MobileNet
bb02b10fbd211d717f7a207245feac229f6bb23e
datasets/pascalvoc_to_tfrecords.py
python
_get_output_filename
(output_dir, name, idx)
return '%s/%s_%03d.tfrecord' % (output_dir, name, idx)
[]
def _get_output_filename(output_dir, name, idx): return '%s/%s_%03d.tfrecord' % (output_dir, name, idx)
[ "def", "_get_output_filename", "(", "output_dir", ",", "name", ",", "idx", ")", ":", "return", "'%s/%s_%03d.tfrecord'", "%", "(", "output_dir", ",", "name", ",", "idx", ")" ]
https://github.com/Zehaos/MobileNet/blob/bb02b10fbd211d717f7a207245feac229f6bb23e/datasets/pascalvoc_to_tfrecords.py#L183-L184
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py
python
LocalControllerLauncher.start
(self)
return super(LocalControllerLauncher, self).start()
Start the controller by profile_dir.
Start the controller by profile_dir.
[ "Start", "the", "controller", "by", "profile_dir", "." ]
def start(self): """Start the controller by profile_dir.""" return super(LocalControllerLauncher, self).start()
[ "def", "start", "(", "self", ")", ":", "return", "super", "(", "LocalControllerLauncher", ",", "self", ")", ".", "start", "(", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py#L354-L356
pexpect/pexpect
2be6c4d1aa2b9b522636342c2fd54b73c058060d
pexpect/screen.py
python
screen.erase_down
(self)
Erases the screen from the current line down to the bottom of the screen.
Erases the screen from the current line down to the bottom of the screen.
[ "Erases", "the", "screen", "from", "the", "current", "line", "down", "to", "the", "bottom", "of", "the", "screen", "." ]
def erase_down (self): # <ESC>[0J -or- <ESC>[J '''Erases the screen from the current line down to the bottom of the screen.''' self.erase_end_of_line () self.fill_region (self.cur_r + 1, 1, self.rows, self.cols)
[ "def", "erase_down", "(", "self", ")", ":", "# <ESC>[0J -or- <ESC>[J", "self", ".", "erase_end_of_line", "(", ")", "self", ".", "fill_region", "(", "self", ".", "cur_r", "+", "1", ",", "1", ",", "self", ".", "rows", ",", "self", ".", "cols", ")" ]
https://github.com/pexpect/pexpect/blob/2be6c4d1aa2b9b522636342c2fd54b73c058060d/pexpect/screen.py#L393-L398
sethmlarson/virtualbox-python
984a6e2cb0e8996f4df40f4444c1528849f1c70d
virtualbox/library.py
python
IVirtualBoxErrorInfo.result_code
(self)
return ret
Get int value for 'resultCode' Result code of the error. Usually, it will be the same as the result code returned by the method that provided this error information, but not always. For example, on Win32, CoCreateInstance() will most likely return E_NOINTERFACE upon unsuccessful ...
Get int value for 'resultCode' Result code of the error. Usually, it will be the same as the result code returned by the method that provided this error information, but not always. For example, on Win32, CoCreateInstance() will most likely return E_NOINTERFACE upon unsuccessful ...
[ "Get", "int", "value", "for", "resultCode", "Result", "code", "of", "the", "error", ".", "Usually", "it", "will", "be", "the", "same", "as", "the", "result", "code", "returned", "by", "the", "method", "that", "provided", "this", "error", "information", "bu...
def result_code(self): """Get int value for 'resultCode' Result code of the error. Usually, it will be the same as the result code returned by the method that provided this error information, but not always. For example, on Win32, CoCreateInstance() will most likely retur...
[ "def", "result_code", "(", "self", ")", ":", "ret", "=", "self", ".", "_get_attr", "(", "\"resultCode\"", ")", "return", "ret" ]
https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L8979-L8994
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.addfile
(self, tarinfo, fileobj=None)
Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation ...
Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation ...
[ "Add", "the", "TarInfo", "object", "tarinfo", "to", "the", "archive", ".", "If", "fileobj", "is", "given", "tarinfo", ".", "size", "bytes", "are", "read", "from", "it", "and", "added", "to", "the", "archive", ".", "You", "can", "create", "TarInfo", "obje...
def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be ...
[ "def", "addfile", "(", "self", ",", "tarinfo", ",", "fileobj", "=", "None", ")", ":", "self", ".", "_check", "(", "\"aw\"", ")", "tarinfo", "=", "copy", ".", "copy", "(", "tarinfo", ")", "buf", "=", "tarinfo", ".", "tobuf", "(", "self", ".", "forma...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2100-L2124
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/mturk/webapp/run_mocks/mock_turk_agent.py
python
MockTurkAgent.act
(self, timeout=None, blocking=True)
return gotten_act
Retrieve an act in the normal expected way (out of the queue), but clear the act request if we do end up getting an act.
Retrieve an act in the normal expected way (out of the queue), but clear the act request if we do end up getting an act.
[ "Retrieve", "an", "act", "in", "the", "normal", "expected", "way", "(", "out", "of", "the", "queue", ")", "but", "clear", "the", "act", "request", "if", "we", "do", "end", "up", "getting", "an", "act", "." ]
def act(self, timeout=None, blocking=True): """Retrieve an act in the normal expected way (out of the queue), but clear the act request if we do end up getting an act.""" gotten_act = super().act(timeout, blocking) if gotten_act is not None: self.wants_message = False ...
[ "def", "act", "(", "self", ",", "timeout", "=", "None", ",", "blocking", "=", "True", ")", ":", "gotten_act", "=", "super", "(", ")", ".", "act", "(", "timeout", ",", "blocking", ")", "if", "gotten_act", "is", "not", "None", ":", "self", ".", "want...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/mturk/webapp/run_mocks/mock_turk_agent.py#L82-L89
artefactual/archivematica
4f4605453d5a8796f6a739fa9664921bdb3418f2
src/archivematicaCommon/lib/elasticSearchFunctions.py
python
_normalize_dict_values
(data)
return data
Normalize dictionary values. Because an XML document node may include one or more children, conversion to a dict can result in the converted child being one of two types. this causes problems in an Elasticsearch index as it expects consistant types to be indexed. The below function recurses a dict ...
Normalize dictionary values.
[ "Normalize", "dictionary", "values", "." ]
def _normalize_dict_values(data): """Normalize dictionary values. Because an XML document node may include one or more children, conversion to a dict can result in the converted child being one of two types. this causes problems in an Elasticsearch index as it expects consistant types to be indexed...
[ "def", "_normalize_dict_values", "(", "data", ")", ":", "for", "key", "in", "data", ":", "if", "isinstance", "(", "data", "[", "key", "]", ",", "dict", ")", ":", "data", "[", "key", "]", "=", "[", "_normalize_dict_values", "(", "data", "[", "key", "]...
https://github.com/artefactual/archivematica/blob/4f4605453d5a8796f6a739fa9664921bdb3418f2/src/archivematicaCommon/lib/elasticSearchFunctions.py#L1082-L1097
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/symtable.py
python
Symbol.get_namespaces
(self)
return self.__namespaces
Return a list of namespaces bound to this name
Return a list of namespaces bound to this name
[ "Return", "a", "list", "of", "namespaces", "bound", "to", "this", "name" ]
def get_namespaces(self): """Return a list of namespaces bound to this name""" return self.__namespaces
[ "def", "get_namespaces", "(", "self", ")", ":", "return", "self", ".", "__namespaces" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/symtable.py#L220-L222
adamcaudill/yawast
5e9e7a37831c030530adb971925ee135e9bfcafb
yawast/scanner/cli/http.py
python
reset
()
[]
def reset(): retirejs.reset() file_search.reset() error_checker.reset() http_basic.reset()
[ "def", "reset", "(", ")", ":", "retirejs", ".", "reset", "(", ")", "file_search", ".", "reset", "(", ")", "error_checker", ".", "reset", "(", ")", "http_basic", ".", "reset", "(", ")" ]
https://github.com/adamcaudill/yawast/blob/5e9e7a37831c030530adb971925ee135e9bfcafb/yawast/scanner/cli/http.py#L213-L217
Nuitka/Nuitka
39262276993757fa4e299f497654065600453fc9
nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py
python
RenameFunction
(function, name)
return FunctionType(function.func_code, function.func_globals, name, function.func_defaults)
Returns a function identical to the specified function, but with the specified name.
Returns a function identical to the specified function, but with the specified name.
[ "Returns", "a", "function", "identical", "to", "the", "specified", "function", "but", "with", "the", "specified", "name", "." ]
def RenameFunction(function, name): """ Returns a function identical to the specified function, but with the specified name. """ return FunctionType(function.func_code, function.func_globals, name, function.func_defaults)
[ "def", "RenameFunction", "(", "function", ",", "name", ")", ":", "return", "FunctionType", "(", "function", ".", "func_code", ",", "function", ".", "func_globals", ",", "name", ",", "function", ".", "func_defaults", ")" ]
https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py#L1374-L1382
JiangWenPL/multiperson
e8ae029cc691f3f9c3958a23f762f3d72cf65c54
mmdetection/mmdet/core/fp16/hooks.py
python
Fp16OptimizerHook.copy_grads_to_fp32
(self, fp16_net, fp32_weights)
Copy gradients from fp16 model to fp32 weight copy.
Copy gradients from fp16 model to fp32 weight copy.
[ "Copy", "gradients", "from", "fp16", "model", "to", "fp32", "weight", "copy", "." ]
def copy_grads_to_fp32(self, fp16_net, fp32_weights): """Copy gradients from fp16 model to fp32 weight copy.""" for fp32_param, fp16_param in zip(fp32_weights, fp16_net.parameters()): if fp16_param.grad is not None: if fp32_param.grad is None: fp32_param.g...
[ "def", "copy_grads_to_fp32", "(", "self", ",", "fp16_net", ",", "fp32_weights", ")", ":", "for", "fp32_param", ",", "fp16_param", "in", "zip", "(", "fp32_weights", ",", "fp16_net", ".", "parameters", "(", ")", ")", ":", "if", "fp16_param", ".", "grad", "is...
https://github.com/JiangWenPL/multiperson/blob/e8ae029cc691f3f9c3958a23f762f3d72cf65c54/mmdetection/mmdet/core/fp16/hooks.py#L45-L51
AlexiaJM/RelativisticGAN
2646c0b27cfd42c20fcecaf4005c3d67322fdf4a
code/pytorch_visualize.py
python
remove_vis_hooks
()
[]
def remove_vis_hooks(): for hook in hooks: hook.remove() Function.__call__ = old_function__call__
[ "def", "remove_vis_hooks", "(", ")", ":", "for", "hook", "in", "hooks", ":", "hook", ".", "remove", "(", ")", "Function", ".", "__call__", "=", "old_function__call__" ]
https://github.com/AlexiaJM/RelativisticGAN/blob/2646c0b27cfd42c20fcecaf4005c3d67322fdf4a/code/pytorch_visualize.py#L92-L96
anshumanbh/kubebot
3558ddc593c861a9805731052c1ac5e71879fdf5
utils/wfuzzbasicauthbrute/wfuzz/framework/fuzzer/base.py
python
BaseFuzzRequest.fr_method
(self)
return
Returns HTTP request method, ie. GET, POST, PUT,...
Returns HTTP request method, ie. GET, POST, PUT,...
[ "Returns", "HTTP", "request", "method", "ie", ".", "GET", "POST", "PUT", "..." ]
def fr_method(self): """ Returns HTTP request method, ie. GET, POST, PUT,... """ return
[ "def", "fr_method", "(", "self", ")", ":", "return" ]
https://github.com/anshumanbh/kubebot/blob/3558ddc593c861a9805731052c1ac5e71879fdf5/utils/wfuzzbasicauthbrute/wfuzz/framework/fuzzer/base.py#L60-L64
tushushu/imylu
33b0534981e59d81f225b246b608106a97af2a1f
imylu/cluster/kmeans.py
python
KMeans._bin_search
(self, target, nums)
return mid
Binary search a number from array-like object. The result is the minimum number greater than target in nums. Arguments: target {float} nums {list} Returns: int -- The index result in nums.
Binary search a number from array-like object. The result is the minimum number greater than target in nums.
[ "Binary", "search", "a", "number", "from", "array", "-", "like", "object", ".", "The", "result", "is", "the", "minimum", "number", "greater", "than", "target", "in", "nums", "." ]
def _bin_search(self, target, nums): """Binary search a number from array-like object. The result is the minimum number greater than target in nums. Arguments: target {float} nums {list} Returns: int -- The index result in nums. """ ...
[ "def", "_bin_search", "(", "self", ",", "target", ",", "nums", ")", ":", "low", "=", "0", "high", "=", "len", "(", "nums", ")", "-", "1", "assert", "nums", "[", "low", "]", "<=", "target", "<", "nums", "[", "high", "]", ",", "\"Cannot find target!\...
https://github.com/tushushu/imylu/blob/33b0534981e59d81f225b246b608106a97af2a1f/imylu/cluster/kmeans.py#L33-L56
kubeflow/pipelines
bea751c9259ff0ae85290f873170aae89284ba8e
components/google-cloud/google_cloud_pipeline_components/aiplatform/utils.py
python
resolve_annotation
(annotation: Any)
return annotation
Resolves annotation type against a MB SDK type. Use this for Optional, Union, Forward References Args: annotation: Annotation to resolve Returns: Direct annotation
Resolves annotation type against a MB SDK type.
[ "Resolves", "annotation", "type", "against", "a", "MB", "SDK", "type", "." ]
def resolve_annotation(annotation: Any) -> Any: """Resolves annotation type against a MB SDK type. Use this for Optional, Union, Forward References Args: annotation: Annotation to resolve Returns: Direct annotation """ # handle forward reference string # if this is an Ai ...
[ "def", "resolve_annotation", "(", "annotation", ":", "Any", ")", "->", "Any", ":", "# handle forward reference string", "# if this is an Ai Platform resource noun", "if", "inspect", ".", "isclass", "(", "annotation", ")", ":", "if", "issubclass", "(", "annotation", ",...
https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/components/google-cloud/google_cloud_pipeline_components/aiplatform/utils.py#L87-L128
microsoft/debugpy
be8dd607f6837244e0b565345e497aff7a0c08bf
src/debugpy/common/messaging.py
python
Response.result
(self)
Result of the request. Returns the value of response.body, unless it is an exception, in which case it is raised instead.
Result of the request. Returns the value of response.body, unless it is an exception, in which case it is raised instead.
[ "Result", "of", "the", "request", ".", "Returns", "the", "value", "of", "response", ".", "body", "unless", "it", "is", "an", "exception", "in", "which", "case", "it", "is", "raised", "instead", "." ]
def result(self): """Result of the request. Returns the value of response.body, unless it is an exception, in which case it is raised instead. """ if self.success: return self.body else: raise self.body
[ "def", "result", "(", "self", ")", ":", "if", "self", ".", "success", ":", "return", "self", ".", "body", "else", ":", "raise", "self", ".", "body" ]
https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/common/messaging.py#L948-L955
openstack/barbican
a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce
barbican/plugin/interface/secret_store.py
python
SecretDTO.__init__
(self, type, secret, key_spec, content_type, transport_key=None)
Creates a new SecretDTO. The secret is stored in the secret parameter. In the future this DTO may include compression and key wrapping information. :param type: SecretType for secret :param secret: secret, as a base64-encoded string :param key_spec: KeySpec key specifications ...
Creates a new SecretDTO.
[ "Creates", "a", "new", "SecretDTO", "." ]
def __init__(self, type, secret, key_spec, content_type, transport_key=None): """Creates a new SecretDTO. The secret is stored in the secret parameter. In the future this DTO may include compression and key wrapping information. :param type: SecretType for secret ...
[ "def", "__init__", "(", "self", ",", "type", ",", "secret", ",", "key_spec", ",", "content_type", ",", "transport_key", "=", "None", ")", ":", "self", ".", "type", "=", "type", "or", "SecretType", ".", "OPAQUE", "self", ".", "secret", "=", "secret", "s...
https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/plugin/interface/secret_store.py#L348-L368
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/template/context.py
python
BaseContext.__delitem__
(self, key)
Delete a variable from the current context
Delete a variable from the current context
[ "Delete", "a", "variable", "from", "the", "current", "context" ]
def __delitem__(self, key): "Delete a variable from the current context" del self.dicts[-1][key]
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "del", "self", ".", "dicts", "[", "-", "1", "]", "[", "key", "]" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/template/context.py#L48-L50
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/configparser.py
python
RawConfigParser.write
(self, fp, space_around_delimiters=True)
Write an .ini-format representation of the configuration state. If `space_around_delimiters' is True (the default), delimiters between keys and values are surrounded by spaces.
Write an .ini-format representation of the configuration state.
[ "Write", "an", ".", "ini", "-", "format", "representation", "of", "the", "configuration", "state", "." ]
def write(self, fp, space_around_delimiters=True): """Write an .ini-format representation of the configuration state. If `space_around_delimiters' is True (the default), delimiters between keys and values are surrounded by spaces. """ if space_around_delimiters: d = ...
[ "def", "write", "(", "self", ",", "fp", ",", "space_around_delimiters", "=", "True", ")", ":", "if", "space_around_delimiters", ":", "d", "=", "\" {} \"", ".", "format", "(", "self", ".", "_delimiters", "[", "0", "]", ")", "else", ":", "d", "=", "self"...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/configparser.py#L881-L896
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-mxnet/3rdparty/tvm/topi/python/topi/generic/nn.py
python
_default_schedule
(outs, auto_inline)
return s
Default schedule for llvm.
Default schedule for llvm.
[ "Default", "schedule", "for", "llvm", "." ]
def _default_schedule(outs, auto_inline): """Default schedule for llvm.""" target = tvm.target.current_target(allow_none=False) outs = [outs] if isinstance(outs, tvm.tensor.Tensor) else outs if target.target_name != "llvm": raise RuntimeError("schedule not registered for '%s'" % target) s = ...
[ "def", "_default_schedule", "(", "outs", ",", "auto_inline", ")", ":", "target", "=", "tvm", ".", "target", ".", "current_target", "(", "allow_none", "=", "False", ")", "outs", "=", "[", "outs", "]", "if", "isinstance", "(", "outs", ",", "tvm", ".", "t...
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/3rdparty/tvm/topi/python/topi/generic/nn.py#L7-L18
plone/guillotina
57ad54988f797a93630e424fd4b6a75fa26410af
guillotina/interfaces/security.py
python
IPrincipalRoleMap.get_principals_for_role
(role_id)
Get the principals that have been granted a role. Return the list of (principal id, setting) who have been assigned or removed from a role. If no principals have been assigned this role, then the empty list is returned.
Get the principals that have been granted a role.
[ "Get", "the", "principals", "that", "have", "been", "granted", "a", "role", "." ]
def get_principals_for_role(role_id): # noqa: N805 """Get the principals that have been granted a role. Return the list of (principal id, setting) who have been assigned or removed from a role. If no principals have been assigned this role, then the empty list is returned. ...
[ "def", "get_principals_for_role", "(", "role_id", ")", ":", "# noqa: N805" ]
https://github.com/plone/guillotina/blob/57ad54988f797a93630e424fd4b6a75fa26410af/guillotina/interfaces/security.py#L98-L106