repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
tensorflow/tensor2tensor
tensor2tensor/models/distillation.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/distillation.py#L175-L196
def distill_resnet_32_to_15_cifar20x5(): """Set of hyperparameters.""" hparams = distill_base() hparams.teacher_model = "resnet" hparams.teacher_hparams = "resnet_cifar_32" hparams.student_model = "resnet" hparams.student_hparams = "resnet_cifar_15" hparams.optimizer_momentum_nesterov = True # (base_lr...
[ "def", "distill_resnet_32_to_15_cifar20x5", "(", ")", ":", "hparams", "=", "distill_base", "(", ")", "hparams", ".", "teacher_model", "=", "\"resnet\"", "hparams", ".", "teacher_hparams", "=", "\"resnet_cifar_32\"", "hparams", ".", "student_model", "=", "\"resnet\"", ...
Set of hyperparameters.
[ "Set", "of", "hyperparameters", "." ]
python
train
35.363636
abelcarreras/DynaPhoPy
dynaphopy/interface/iofile/__init__.py
https://github.com/abelcarreras/DynaPhoPy/blob/51e99422228e6be84830d659b88a0ca904d9136f/dynaphopy/interface/iofile/__init__.py#L10-L20
def diff_matrix(array_1, array_2, cell_size): """ :param array_1: supercell scaled positions respect unit cell :param array_2: supercell scaled positions respect unit cell :param cell_size: diference between arrays accounting for periodicity :return: """ array_1_norm = np.array(array_1) / np...
[ "def", "diff_matrix", "(", "array_1", ",", "array_2", ",", "cell_size", ")", ":", "array_1_norm", "=", "np", ".", "array", "(", "array_1", ")", "/", "np", ".", "array", "(", "cell_size", ",", "dtype", "=", "float", ")", "[", "None", ",", ":", "]", ...
:param array_1: supercell scaled positions respect unit cell :param array_2: supercell scaled positions respect unit cell :param cell_size: diference between arrays accounting for periodicity :return:
[ ":", "param", "array_1", ":", "supercell", "scaled", "positions", "respect", "unit", "cell", ":", "param", "array_2", ":", "supercell", "scaled", "positions", "respect", "unit", "cell", ":", "param", "cell_size", ":", "diference", "between", "arrays", "accountin...
python
train
42.545455
Microsoft/nni
src/sdk/pynni/nni/networkmorphism_tuner/layers.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layers.py#L613-L661
def layer_description_extractor(layer, node_to_id): '''get layer description. ''' layer_input = layer.input layer_output = layer.output if layer_input is not None: if isinstance(layer_input, Iterable): layer_input = list(map(lambda x: node_to_id[x], layer_input)) else: ...
[ "def", "layer_description_extractor", "(", "layer", ",", "node_to_id", ")", ":", "layer_input", "=", "layer", ".", "input", "layer_output", "=", "layer", ".", "output", "if", "layer_input", "is", "not", "None", ":", "if", "isinstance", "(", "layer_input", ",",...
get layer description.
[ "get", "layer", "description", "." ]
python
train
30.163265
open511/open511
open511/utils/schedule.py
https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L53-L56
def intervals(self, range_start=datetime.datetime.min, range_end=datetime.datetime.max): """Returns a list of tuples of start/end datetimes for when the schedule is active during the provided range.""" raise NotImplementedError
[ "def", "intervals", "(", "self", ",", "range_start", "=", "datetime", ".", "datetime", ".", "min", ",", "range_end", "=", "datetime", ".", "datetime", ".", "max", ")", ":", "raise", "NotImplementedError" ]
Returns a list of tuples of start/end datetimes for when the schedule is active during the provided range.
[ "Returns", "a", "list", "of", "tuples", "of", "start", "/", "end", "datetimes", "for", "when", "the", "schedule", "is", "active", "during", "the", "provided", "range", "." ]
python
valid
62
Parsl/parsl
parsl/providers/aws/aws.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L540-L564
def status(self, job_ids): """Get the status of a list of jobs identified by their ids. Parameters ---------- job_ids : list of str Identifiers for the jobs. Returns ------- list of int The status codes of the requsted jobs. """ ...
[ "def", "status", "(", "self", ",", "job_ids", ")", ":", "all_states", "=", "[", "]", "status", "=", "self", ".", "client", ".", "describe_instances", "(", "InstanceIds", "=", "job_ids", ")", "for", "r", "in", "status", "[", "'Reservations'", "]", ":", ...
Get the status of a list of jobs identified by their ids. Parameters ---------- job_ids : list of str Identifiers for the jobs. Returns ------- list of int The status codes of the requsted jobs.
[ "Get", "the", "status", "of", "a", "list", "of", "jobs", "identified", "by", "their", "ids", "." ]
python
valid
29.88
reingart/pyafipws
iibb.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/iibb.py#L89-L144
def ConsultarContribuyentes(self, fecha_desde, fecha_hasta, cuit_contribuyente): "Realiza la consulta remota a ARBA, estableciendo los resultados" self.limpiar() try: self.xml = SimpleXMLElement(XML_ENTRADA_BASE) self.xml.fechaDesde = fecha_desde self.xml.fec...
[ "def", "ConsultarContribuyentes", "(", "self", ",", "fecha_desde", ",", "fecha_hasta", ",", "cuit_contribuyente", ")", ":", "self", ".", "limpiar", "(", ")", "try", ":", "self", ".", "xml", "=", "SimpleXMLElement", "(", "XML_ENTRADA_BASE", ")", "self", ".", ...
Realiza la consulta remota a ARBA, estableciendo los resultados
[ "Realiza", "la", "consulta", "remota", "a", "ARBA", "estableciendo", "los", "resultados" ]
python
train
50.642857
bcho/bearychat-py
bearychat/incoming.py
https://github.com/bcho/bearychat-py/blob/d492595d6334dfba511f82770995160ee12b5de1/bearychat/incoming.py#L43-L50
def reset(self): '''Reset stream.''' self._text = None self._markdown = False self._channel = Incoming.DEFAULT_CHANNEL self._attachments = [] return self
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_text", "=", "None", "self", ".", "_markdown", "=", "False", "self", ".", "_channel", "=", "Incoming", ".", "DEFAULT_CHANNEL", "self", ".", "_attachments", "=", "[", "]", "return", "self" ]
Reset stream.
[ "Reset", "stream", "." ]
python
train
24.375
ska-sa/spead2
spead2/__init__.py
https://github.com/ska-sa/spead2/blob/cac95fd01d8debaa302d2691bd26da64b7828bc6/spead2/__init__.py#L367-L386
def _read_bits(cls, raw_value): """Generator that takes a memory view and provides bitfields from it. After creating the generator, call `send(None)` to initialise it, and thereafter call `send(need_bits)` to obtain that many bits. """ have_bits = 0 bits = 0 byte_...
[ "def", "_read_bits", "(", "cls", ",", "raw_value", ")", ":", "have_bits", "=", "0", "bits", "=", "0", "byte_source", "=", "iter", "(", "raw_value", ")", "result", "=", "0", "while", "True", ":", "need_bits", "=", "yield", "result", "while", "have_bits", ...
Generator that takes a memory view and provides bitfields from it. After creating the generator, call `send(None)` to initialise it, and thereafter call `send(need_bits)` to obtain that many bits.
[ "Generator", "that", "takes", "a", "memory", "view", "and", "provides", "bitfields", "from", "it", ".", "After", "creating", "the", "generator", "call", "send", "(", "None", ")", "to", "initialise", "it", "and", "thereafter", "call", "send", "(", "need_bits"...
python
train
38.75
networks-lab/metaknowledge
metaknowledge/medline/recordMedline.py
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/medline/recordMedline.py#L66-L88
def writeRecord(self, f): """This is nearly identical to the original the FAU tag is the only tag not writen in the same place, doing so would require changing the parser and lots of extra logic. """ if self.bad: raise BadPubmedRecord("This record cannot be converted to a file as the...
[ "def", "writeRecord", "(", "self", ",", "f", ")", ":", "if", "self", ".", "bad", ":", "raise", "BadPubmedRecord", "(", "\"This record cannot be converted to a file as the input was malformed.\\nThe original line number (if any) is: {} and the original file is: '{}'\"", ".", "form...
This is nearly identical to the original the FAU tag is the only tag not writen in the same place, doing so would require changing the parser and lots of extra logic.
[ "This", "is", "nearly", "identical", "to", "the", "original", "the", "FAU", "tag", "is", "the", "only", "tag", "not", "writen", "in", "the", "same", "place", "doing", "so", "would", "require", "changing", "the", "parser", "and", "lots", "of", "extra", "l...
python
train
61.913043
rosenbrockc/fortpy
fortpy/interop/ftypes.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L683-L690
def _py_outvar(parameter, lparams, tab): """Returns the code to produce a ctypes output variable for interacting with fortran. """ if ("out" in parameter.direction and parameter.D > 0 and ":" in parameter.dimension and ("allocatable" in parameter.modifiers or "pointer" in parameter.modifiers)): ...
[ "def", "_py_outvar", "(", "parameter", ",", "lparams", ",", "tab", ")", ":", "if", "(", "\"out\"", "in", "parameter", ".", "direction", "and", "parameter", ".", "D", ">", "0", "and", "\":\"", "in", "parameter", ".", "dimension", "and", "(", "\"allocatabl...
Returns the code to produce a ctypes output variable for interacting with fortran.
[ "Returns", "the", "code", "to", "produce", "a", "ctypes", "output", "variable", "for", "interacting", "with", "fortran", "." ]
python
train
66.625
tmux-python/libtmux
libtmux/common.py
https://github.com/tmux-python/libtmux/blob/8eb2f8bbea3a025c1567b1516653414dbc24e1fc/libtmux/common.py#L106-L142
def show_environment(self, name=None): """Show environment ``$ tmux show-environment -t [session] <name>``. Return dict of environment variables for the session or the value of a specific variable if the name is specified. Parameters ---------- name : str th...
[ "def", "show_environment", "(", "self", ",", "name", "=", "None", ")", ":", "tmux_args", "=", "[", "'show-environment'", "]", "if", "self", ".", "_add_option", ":", "tmux_args", "+=", "[", "self", ".", "_add_option", "]", "if", "name", ":", "tmux_args", ...
Show environment ``$ tmux show-environment -t [session] <name>``. Return dict of environment variables for the session or the value of a specific variable if the name is specified. Parameters ---------- name : str the environment variable name. such as 'PATH'. ...
[ "Show", "environment", "$", "tmux", "show", "-", "environment", "-", "t", "[", "session", "]", "<name", ">", "." ]
python
train
29.648649
geopython/geolinks
geolinks/__init__.py
https://github.com/geopython/geolinks/blob/134608c81e6b31323a17d05fb5e62e3119de81da/geolinks/__init__.py#L63-L110
def sniff_link(url): """performs basic heuristics to detect what the URL is""" protocol = None link = url.strip() # heuristics begin if inurl(['service=CSW', 'request=GetRecords'], link): protocol = 'OGC:CSW' elif inurl(['service=SOS', 'request=GetObservation'], link): protocol...
[ "def", "sniff_link", "(", "url", ")", ":", "protocol", "=", "None", "link", "=", "url", ".", "strip", "(", ")", "# heuristics begin", "if", "inurl", "(", "[", "'service=CSW'", ",", "'request=GetRecords'", "]", ",", "link", ")", ":", "protocol", "=", "'OG...
performs basic heuristics to detect what the URL is
[ "performs", "basic", "heuristics", "to", "detect", "what", "the", "URL", "is" ]
python
train
34.020833
uw-it-cte/uw-restclients-wheniwork
uw_wheniwork/shifts.py
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/shifts.py#L66-L77
def delete_shifts(self, shifts): """ Delete existing shifts. http://dev.wheniwork.com/#delete-shift """ url = "/2/shifts/?%s" % urlencode( {'ids': ",".join(str(s) for s in shifts)}) data = self._delete_resource(url) return data
[ "def", "delete_shifts", "(", "self", ",", "shifts", ")", ":", "url", "=", "\"/2/shifts/?%s\"", "%", "urlencode", "(", "{", "'ids'", ":", "\",\"", ".", "join", "(", "str", "(", "s", ")", "for", "s", "in", "shifts", ")", "}", ")", "data", "=", "self"...
Delete existing shifts. http://dev.wheniwork.com/#delete-shift
[ "Delete", "existing", "shifts", "." ]
python
valid
23.916667
bitshares/uptick
uptick/markets.py
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/markets.py#L353-L364
def bidcollateral( ctx, collateral_symbol, collateral_amount, debt_symbol, debt_amount, account ): """ Bid for collateral in the settlement fund """ print_tx( ctx.bitshares.bid_collateral( Amount(collateral_amount, collateral_symbol), Amount(debt_amount, debt_symbol), ...
[ "def", "bidcollateral", "(", "ctx", ",", "collateral_symbol", ",", "collateral_amount", ",", "debt_symbol", ",", "debt_amount", ",", "account", ")", ":", "print_tx", "(", "ctx", ".", "bitshares", ".", "bid_collateral", "(", "Amount", "(", "collateral_amount", ",...
Bid for collateral in the settlement fund
[ "Bid", "for", "collateral", "in", "the", "settlement", "fund" ]
python
train
29.166667
hvac/hvac
hvac/api/secrets_engines/transit.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/api/secrets_engines/transit.py#L734-L757
def backup_key(self, name, mount_point=DEFAULT_MOUNT_POINT): """Return a plaintext backup of a named key. The backup contains all the configuration data and keys of all the versions along with the HMAC key. The response from this endpoint can be used with the /restore endpoint to restore the ke...
[ "def", "backup_key", "(", "self", ",", "name", ",", "mount_point", "=", "DEFAULT_MOUNT_POINT", ")", ":", "api_path", "=", "'/v1/{mount_point}/backup/{name}'", ".", "format", "(", "mount_point", "=", "mount_point", ",", "name", "=", "name", ",", ")", "response", ...
Return a plaintext backup of a named key. The backup contains all the configuration data and keys of all the versions along with the HMAC key. The response from this endpoint can be used with the /restore endpoint to restore the key. Supported methods: GET: /{mount_point}/backup/{n...
[ "Return", "a", "plaintext", "backup", "of", "a", "named", "key", "." ]
python
train
38.583333
gem/oq-engine
openquake/hmtk/seismicity/gcmt_catalogue.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/seismicity/gcmt_catalogue.py#L193-L206
def _to_ned(self): """ Switches the reference frame to NED """ if self.ref_frame is 'USE': # Rotate return utils.use_to_ned(self.tensor), \ utils.use_to_ned(self.tensor_sigma) elif self.ref_frame is 'NED': # Alreadt NED ...
[ "def", "_to_ned", "(", "self", ")", ":", "if", "self", ".", "ref_frame", "is", "'USE'", ":", "# Rotate", "return", "utils", ".", "use_to_ned", "(", "self", ".", "tensor", ")", ",", "utils", ".", "use_to_ned", "(", "self", ".", "tensor_sigma", ")", "eli...
Switches the reference frame to NED
[ "Switches", "the", "reference", "frame", "to", "NED" ]
python
train
36
rikrd/inspire
inspirespeech/htk.py
https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/htk.py#L283-L293
def main(): """Test code called from commandline""" model = load_model('../data/hmmdefs') hmm = model.hmms['r-We'] for state_name in hmm.state_names: print(state_name) state = model.states[state_name] print(state.means_) print(model) model2 = load_model('../data/prior.hmm...
[ "def", "main", "(", ")", ":", "model", "=", "load_model", "(", "'../data/hmmdefs'", ")", "hmm", "=", "model", ".", "hmms", "[", "'r-We'", "]", "for", "state_name", "in", "hmm", ".", "state_names", ":", "print", "(", "state_name", ")", "state", "=", "mo...
Test code called from commandline
[ "Test", "code", "called", "from", "commandline" ]
python
train
31.181818
anthok/overwatch-api
overwatch_api/core.py
https://github.com/anthok/overwatch-api/blob/aba976a3c07c4932de13f4236d924b2901b149b9/overwatch_api/core.py#L98-L114
async def get_stats(self, battletag: str, regions=(EUROPE, KOREA, AMERICAS, CHINA, JAPAN, ANY), platform=None, _session=None, handle_ratelimit=None, max_tries=None, request_timeout=None): """Returns the stats for the profiles on the specified regions and platform. The format for regions ...
[ "async", "def", "get_stats", "(", "self", ",", "battletag", ":", "str", ",", "regions", "=", "(", "EUROPE", ",", "KOREA", ",", "AMERICAS", ",", "CHINA", ",", "JAPAN", ",", "ANY", ")", ",", "platform", "=", "None", ",", "_session", "=", "None", ",", ...
Returns the stats for the profiles on the specified regions and platform. The format for regions without a matching user, the format is the same as get_profile. The stats are returned in a dictionary with a similar format to what https://github.com/SunDwarf/OWAPI/blob/master/api.md#get-apiv3ubattletagstats spec...
[ "Returns", "the", "stats", "for", "the", "profiles", "on", "the", "specified", "regions", "and", "platform", ".", "The", "format", "for", "regions", "without", "a", "matching", "user", "the", "format", "is", "the", "same", "as", "get_profile", ".", "The", ...
python
train
77.352941
nfcpy/nfcpy
src/nfc/tag/tt1.py
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt1.py#L436-L450
def write_block(self, block, data, erase=True): """Write an 8-byte data block at address (block * 8). The target bytes are zero'd first if *erase* is True. """ if block < 0 or block > 255: raise ValueError("invalid block number") log.debug("write block {0}".format(bl...
[ "def", "write_block", "(", "self", ",", "block", ",", "data", ",", "erase", "=", "True", ")", ":", "if", "block", "<", "0", "or", "block", ">", "255", ":", "raise", "ValueError", "(", "\"invalid block number\"", ")", "log", ".", "debug", "(", "\"write ...
Write an 8-byte data block at address (block * 8). The target bytes are zero'd first if *erase* is True.
[ "Write", "an", "8", "-", "byte", "data", "block", "at", "address", "(", "block", "*", "8", ")", ".", "The", "target", "bytes", "are", "zero", "d", "first", "if", "*", "erase", "*", "is", "True", "." ]
python
train
41.6
dylanaraps/bum
bum/song.py
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/song.py#L12-L22
def init(port=6600, server="localhost"): """Initialize mpd.""" client = mpd.MPDClient() try: client.connect(server, port) return client except ConnectionRefusedError: print("error: Connection refused to mpd/mopidy.") os._exit(1)
[ "def", "init", "(", "port", "=", "6600", ",", "server", "=", "\"localhost\"", ")", ":", "client", "=", "mpd", ".", "MPDClient", "(", ")", "try", ":", "client", ".", "connect", "(", "server", ",", "port", ")", "return", "client", "except", "ConnectionRe...
Initialize mpd.
[ "Initialize", "mpd", "." ]
python
train
24.363636
square/pylink
pylink/jlink.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2224-L2240
def scan_chain_len(self, scan_chain): """Retrieves and returns the number of bits in the scan chain. Args: self (JLink): the ``JLink`` instance scan_chain (int): scan chain to be measured Returns: Number of bits in the specified scan chain. Raises: ...
[ "def", "scan_chain_len", "(", "self", ",", "scan_chain", ")", ":", "res", "=", "self", ".", "_dll", ".", "JLINKARM_MeasureSCLen", "(", "scan_chain", ")", "if", "res", "<", "0", ":", "raise", "errors", ".", "JLinkException", "(", "res", ")", "return", "re...
Retrieves and returns the number of bits in the scan chain. Args: self (JLink): the ``JLink`` instance scan_chain (int): scan chain to be measured Returns: Number of bits in the specified scan chain. Raises: JLinkException: on error.
[ "Retrieves", "and", "returns", "the", "number", "of", "bits", "in", "the", "scan", "chain", "." ]
python
train
28.647059
polysquare/cmake-ast
cmakeast/ast.py
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast.py#L671-L683
def consume_token(self, tokens, index, tokens_len): """Consume a token. Returns a tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together. """ del tokens_len if tokens[index].type == TokenType.EndInlineRST: ret...
[ "def", "consume_token", "(", "self", ",", "tokens", ",", "index", ",", "tokens_len", ")", ":", "del", "tokens_len", "if", "tokens", "[", "index", "]", ".", "type", "==", "TokenType", ".", "EndInlineRST", ":", "return", "_paste_tokens_line_by_line", "(", "tok...
Consume a token. Returns a tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together.
[ "Consume", "a", "token", "." ]
python
train
40.153846
PmagPy/PmagPy
pmagpy/pmagplotlib.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmagplotlib.py#L2872-L2964
def add_borders(Figs, titles, border_color='#000000', text_color='#800080', con_id=""): """ Formatting for generating plots on the server Default border color: black Default text color: purple """ def split_title(s): """ Add '\n's to split of overly long titles """ ...
[ "def", "add_borders", "(", "Figs", ",", "titles", ",", "border_color", "=", "'#000000'", ",", "text_color", "=", "'#800080'", ",", "con_id", "=", "\"\"", ")", ":", "def", "split_title", "(", "s", ")", ":", "\"\"\"\n Add '\\n's to split of overly long titles...
Formatting for generating plots on the server Default border color: black Default text color: purple
[ "Formatting", "for", "generating", "plots", "on", "the", "server", "Default", "border", "color", ":", "black", "Default", "text", "color", ":", "purple" ]
python
train
38.677419
mjg59/python-broadlink
broadlink/__init__.py
https://github.com/mjg59/python-broadlink/blob/1d6d8d2aee6e221aa3383e4078b19b7b95397f43/broadlink/__init__.py#L374-L382
def set_power(self, state): """Sets the power state of the smart plug.""" packet = bytearray(16) packet[0] = 2 if self.check_nightlight(): packet[4] = 3 if state else 2 else: packet[4] = 1 if state else 0 self.send_packet(0x6a, packet)
[ "def", "set_power", "(", "self", ",", "state", ")", ":", "packet", "=", "bytearray", "(", "16", ")", "packet", "[", "0", "]", "=", "2", "if", "self", ".", "check_nightlight", "(", ")", ":", "packet", "[", "4", "]", "=", "3", "if", "state", "else"...
Sets the power state of the smart plug.
[ "Sets", "the", "power", "state", "of", "the", "smart", "plug", "." ]
python
train
29.222222
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py#L68-L139
def order_shares(id_or_ins, amount, price=None, style=None): """ 落指定股数的买/卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 ...
[ "def", "order_shares", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "if", "amount", "==", "0", ":", "# 如果下单量为0,则认为其并没有发单,则直接返回None", "user_system_log", ".", "warn", "(", "_", "(", "u\"Order Creation Failed: O...
落指定股数的买/卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market order)。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` :param int amount: 下单量, 正数代表买入,负数代表卖出。将会根据一手xx股来向下调整到一手的倍数,比如中国A股就是调整成100股的倍数。 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `st...
[ "落指定股数的买", "/", "卖单,最常见的落单方式之一。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认是市价单(market", "order)。" ]
python
train
34.833333
Robpol86/libnl
libnl/genl/mngt.py
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/mngt.py#L136-L148
def lookup_family(family): """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L94. Positional arguments: family -- integer. Returns: genl_ops class instance or None. """ for ops in nl_list_for_each_entry(genl_ops(), genl_ops_list, 'o_list'): if ops.o_id == family:...
[ "def", "lookup_family", "(", "family", ")", ":", "for", "ops", "in", "nl_list_for_each_entry", "(", "genl_ops", "(", ")", ",", "genl_ops_list", ",", "'o_list'", ")", ":", "if", "ops", ".", "o_id", "==", "family", ":", "return", "ops", "return", "None" ]
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L94. Positional arguments: family -- integer. Returns: genl_ops class instance or None.
[ "https", ":", "//", "github", ".", "com", "/", "thom311", "/", "libnl", "/", "blob", "/", "libnl3_2_25", "/", "lib", "/", "genl", "/", "mngt", ".", "c#L94", "." ]
python
train
26.692308
cogniteev/docido-python-sdk
docido_sdk/toolbox/ha.py
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/ha.py#L74-L99
def catch(cls, catch_exception, config='default'): """Decorator class method catching exceptions raised by the wrapped member function. When exception is caught, the decorator waits for an amount of time specified in the `ha_config`. :param catch_exception: Exception class or tuple of e...
[ "def", "catch", "(", "cls", ",", "catch_exception", ",", "config", "=", "'default'", ")", ":", "def", "wrap", "(", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method", ")", "def", "wrapped_method", "(", "self", ",", "*", "args", ",", "*...
Decorator class method catching exceptions raised by the wrapped member function. When exception is caught, the decorator waits for an amount of time specified in the `ha_config`. :param catch_exception: Exception class or tuple of exception classes.
[ "Decorator", "class", "method", "catching", "exceptions", "raised", "by", "the", "wrapped", "member", "function", ".", "When", "exception", "is", "caught", "the", "decorator", "waits", "for", "an", "amount", "of", "time", "specified", "in", "the", "ha_config", ...
python
train
46.576923
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_attrs.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_attrs.py#L6-L33
def _guess_type_from_validator(validator): """ Utility method to return the declared type of an attribute or None. It handles _OptionalValidator and _AndValidator in order to unpack the validators. :param validator: :return: the type of attribute declared in an inner 'instance_of' validator (if any...
[ "def", "_guess_type_from_validator", "(", "validator", ")", ":", "if", "isinstance", "(", "validator", ",", "_OptionalValidator", ")", ":", "# Optional : look inside", "return", "_guess_type_from_validator", "(", "validator", ".", "validator", ")", "elif", "isinstance",...
Utility method to return the declared type of an attribute or None. It handles _OptionalValidator and _AndValidator in order to unpack the validators. :param validator: :return: the type of attribute declared in an inner 'instance_of' validator (if any is found, the first one is used) or None if no inn...
[ "Utility", "method", "to", "return", "the", "declared", "type", "of", "an", "attribute", "or", "None", ".", "It", "handles", "_OptionalValidator", "and", "_AndValidator", "in", "order", "to", "unpack", "the", "validators", "." ]
python
train
35.214286
rkhleics/wagtailmodeladmin
wagtailmodeladmin/views.py
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/views.py#L297-L327
def get_search_results(self, request, queryset, search_term): """ Returns a tuple containing a queryset to implement the search, and a boolean indicating if the results may contain duplicates. """ # Apply keyword searches. def construct_search(field_name): if ...
[ "def", "get_search_results", "(", "self", ",", "request", ",", "queryset", ",", "search_term", ")", ":", "# Apply keyword searches.", "def", "construct_search", "(", "field_name", ")", ":", "if", "field_name", ".", "startswith", "(", "'^'", ")", ":", "return", ...
Returns a tuple containing a queryset to implement the search, and a boolean indicating if the results may contain duplicates.
[ "Returns", "a", "tuple", "containing", "a", "queryset", "to", "implement", "the", "search", "and", "a", "boolean", "indicating", "if", "the", "results", "may", "contain", "duplicates", "." ]
python
train
43.677419
ungarj/s2reader
s2reader/s2reader.py
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L321-L339
def footprint(self): """Find and return footprint as Shapely Polygon.""" # Check whether product or granule footprint needs to be calculated. tile_geocoding = self._metadata.iter("Tile_Geocoding").next() resolution = 10 searchstring = ".//*[@resolution='%s']" % resolution ...
[ "def", "footprint", "(", "self", ")", ":", "# Check whether product or granule footprint needs to be calculated.", "tile_geocoding", "=", "self", ".", "_metadata", ".", "iter", "(", "\"Tile_Geocoding\"", ")", ".", "next", "(", ")", "resolution", "=", "10", "searchstri...
Find and return footprint as Shapely Polygon.
[ "Find", "and", "return", "footprint", "as", "Shapely", "Polygon", "." ]
python
train
44.473684
pytroll/satpy
satpy/readers/seviri_l1b_native.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/seviri_l1b_native.py#L159-L236
def _read_header(self): """Read the header info""" data = np.fromfile(self.filename, dtype=native_header, count=1) self.header.update(recarray2dict(data)) data15hd = self.header['15_DATA_HEADER'] sec15hd = self.header['15_SECONDARY_PRODUCT_HEADER'] ...
[ "def", "_read_header", "(", "self", ")", ":", "data", "=", "np", ".", "fromfile", "(", "self", ".", "filename", ",", "dtype", "=", "native_header", ",", "count", "=", "1", ")", "self", ".", "header", ".", "update", "(", "recarray2dict", "(", "data", ...
Read the header info
[ "Read", "the", "header", "info" ]
python
train
43.730769
google/grr
grr/server/grr_response_server/databases/mysql_migration.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_migration.py#L28-L31
def _MigrationFilenameToInt(fname): """Converts migration filename to a migration number.""" base, _ = os.path.splitext(fname) return int(base)
[ "def", "_MigrationFilenameToInt", "(", "fname", ")", ":", "base", ",", "_", "=", "os", ".", "path", ".", "splitext", "(", "fname", ")", "return", "int", "(", "base", ")" ]
Converts migration filename to a migration number.
[ "Converts", "migration", "filename", "to", "a", "migration", "number", "." ]
python
train
36.5
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L525-L540
def delete_cas(self, key, *, index): """Deletes the Key with check-and-set semantics. Parameters: key (str): Key to delete index (ObjectIndex): Index ID The Key will only be deleted if its current modify index matches the supplied Index """ self....
[ "def", "delete_cas", "(", "self", ",", "key", ",", "*", ",", "index", ")", ":", "self", ".", "append", "(", "{", "\"Verb\"", ":", "\"delete-cas\"", ",", "\"Key\"", ":", "key", ",", "\"Index\"", ":", "extract_attr", "(", "index", ",", "keys", "=", "["...
Deletes the Key with check-and-set semantics. Parameters: key (str): Key to delete index (ObjectIndex): Index ID The Key will only be deleted if its current modify index matches the supplied Index
[ "Deletes", "the", "Key", "with", "check", "-", "and", "-", "set", "semantics", "." ]
python
train
29.625
gr33ndata/dysl
dysl/social.py
https://github.com/gr33ndata/dysl/blob/649c1d6a1761f47d49a9842e7389f6df52039155/dysl/social.py#L71-L83
def normalize(self, text): """ Normalizes text. Converts to lowercase, Unicode NFC normalization and removes mentions and links :param text: Text to be normalized. """ #print 'Normalize...\n' text = text.lower() text = unicodedata....
[ "def", "normalize", "(", "self", ",", "text", ")", ":", "#print 'Normalize...\\n'", "text", "=", "text", ".", "lower", "(", ")", "text", "=", "unicodedata", ".", "normalize", "(", "'NFC'", ",", "text", ")", "text", "=", "self", ".", "strip_mentions_links",...
Normalizes text. Converts to lowercase, Unicode NFC normalization and removes mentions and links :param text: Text to be normalized.
[ "Normalizes", "text", ".", "Converts", "to", "lowercase", "Unicode", "NFC", "normalization", "and", "removes", "mentions", "and", "links" ]
python
train
30.538462
lemieuxl/pyGenClean
pyGenClean/PlinkUtils/plot_MDS.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/PlinkUtils/plot_MDS.py#L229-L256
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
[ "def", "checkArgs", "(", "args", ")", ":", "# Check in input file", "if", "not", "os", ".", "path", ".", "isfile", "(", "args", ".", "file", ")", ":", "msg", "=", "\"%s: no such file\"", "%", "args", ".", "file", "raise", "ProgramError", "(", "msg", ")",...
Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class, a message is printed to t...
[ "Checks", "the", "arguments", "and", "options", "." ]
python
train
30.107143
tensorflow/hub
tensorflow_hub/resolver.py
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L103-L122
def _print_download_progress_msg(self, msg, flush=False): """Prints a message about download progress either to the console or TF log. Args: msg: Message to print. flush: Indicates whether to flush the output (only used in interactive mode). """ if self._interactive_mode(): ...
[ "def", "_print_download_progress_msg", "(", "self", ",", "msg", ",", "flush", "=", "False", ")", ":", "if", "self", ".", "_interactive_mode", "(", ")", ":", "# Print progress message to console overwriting previous progress", "# message.", "self", ".", "_max_prog_str", ...
Prints a message about download progress either to the console or TF log. Args: msg: Message to print. flush: Indicates whether to flush the output (only used in interactive mode).
[ "Prints", "a", "message", "about", "download", "progress", "either", "to", "the", "console", "or", "TF", "log", "." ]
python
train
35.35
django-admin-tools/django-admin-tools
admin_tools/utils.py
https://github.com/django-admin-tools/django-admin-tools/blob/ba6f46f51ebd84fcf84f2f79ec9487f45452d79b/admin_tools/utils.py#L166-L173
def _get_admin_change_url(self, model, context): """ Returns the admin change url. """ app_label = model._meta.app_label return reverse('%s:%s_%s_changelist' % (get_admin_site_name(context), app_label, ...
[ "def", "_get_admin_change_url", "(", "self", ",", "model", ",", "context", ")", ":", "app_label", "=", "model", ".", "_meta", ".", "app_label", "return", "reverse", "(", "'%s:%s_%s_changelist'", "%", "(", "get_admin_site_name", "(", "context", ")", ",", "app_l...
Returns the admin change url.
[ "Returns", "the", "admin", "change", "url", "." ]
python
train
44.375
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L359-L379
def _bb_intensity(self, Teff, photon_weighted=False): """ Computes mean passband intensity using blackbody atmosphere: I_pb^E = \int_\lambda I(\lambda) P(\lambda) d\lambda / \int_\lambda P(\lambda) d\lambda I_pb^P = \int_\lambda \lambda I(\lambda) P(\lambda) d\lambda / \int_\lambda \lam...
[ "def", "_bb_intensity", "(", "self", ",", "Teff", ",", "photon_weighted", "=", "False", ")", ":", "if", "photon_weighted", ":", "pb", "=", "lambda", "w", ":", "w", "*", "self", ".", "_planck", "(", "w", ",", "Teff", ")", "*", "self", ".", "ptf", "(...
Computes mean passband intensity using blackbody atmosphere: I_pb^E = \int_\lambda I(\lambda) P(\lambda) d\lambda / \int_\lambda P(\lambda) d\lambda I_pb^P = \int_\lambda \lambda I(\lambda) P(\lambda) d\lambda / \int_\lambda \lambda P(\lambda) d\lambda Superscripts E and P stand for energy and...
[ "Computes", "mean", "passband", "intensity", "using", "blackbody", "atmosphere", ":" ]
python
train
42.952381
saltstack/salt
salt/modules/sysbench.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysbench.py#L59-L85
def cpu(): ''' Tests for the CPU performance of minions. CLI Examples: .. code-block:: bash salt '*' sysbench.cpu ''' # Test data max_primes = [500, 1000, 2500, 5000] # Initializing the test variables test_command = 'sysbench --test=cpu --cpu-max-prime={0} run' resul...
[ "def", "cpu", "(", ")", ":", "# Test data", "max_primes", "=", "[", "500", ",", "1000", ",", "2500", ",", "5000", "]", "# Initializing the test variables", "test_command", "=", "'sysbench --test=cpu --cpu-max-prime={0} run'", "result", "=", "None", "ret_val", "=", ...
Tests for the CPU performance of minions. CLI Examples: .. code-block:: bash salt '*' sysbench.cpu
[ "Tests", "for", "the", "CPU", "performance", "of", "minions", "." ]
python
train
21.62963
sijis/sumologic-python
src/sumologic/utils.py
https://github.com/sijis/sumologic-python/blob/b50200907837f0d452d14ead5e647b8e24e2e9e5/src/sumologic/utils.py#L4-L9
def get_logging_level(debug): """Returns logging level based on boolean""" level = logging.INFO if debug: level = logging.DEBUG return level
[ "def", "get_logging_level", "(", "debug", ")", ":", "level", "=", "logging", ".", "INFO", "if", "debug", ":", "level", "=", "logging", ".", "DEBUG", "return", "level" ]
Returns logging level based on boolean
[ "Returns", "logging", "level", "based", "on", "boolean" ]
python
train
26.5
rootpy/rootpy
rootpy/plotting/hist.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/hist.py#L1544-L1669
def quantiles(self, quantiles, axis=0, strict=False, recompute_integral=False): """ Calculate the quantiles of this histogram. Parameters ---------- quantiles : list or int A list of cumulative probabilities or an integer used to ...
[ "def", "quantiles", "(", "self", ",", "quantiles", ",", "axis", "=", "0", ",", "strict", "=", "False", ",", "recompute_integral", "=", "False", ")", ":", "if", "axis", ">=", "self", ".", "GetDimension", "(", ")", ":", "raise", "ValueError", "(", "\"axi...
Calculate the quantiles of this histogram. Parameters ---------- quantiles : list or int A list of cumulative probabilities or an integer used to determine equally spaced values between 0 and 1 (inclusive). axis : int, optional (default=0) The axis ...
[ "Calculate", "the", "quantiles", "of", "this", "histogram", "." ]
python
train
39.055556
pvlib/pvlib-python
pvlib/location.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/location.py#L164-L235
def get_clearsky(self, times, model='ineichen', solar_position=None, dni_extra=None, **kwargs): """ Calculate the clear sky estimates of GHI, DNI, and/or DHI at this location. Parameters ---------- times: DatetimeIndex model: str, default 'in...
[ "def", "get_clearsky", "(", "self", ",", "times", ",", "model", "=", "'ineichen'", ",", "solar_position", "=", "None", ",", "dni_extra", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "dni_extra", "is", "None", ":", "dni_extra", "=", "irradiance",...
Calculate the clear sky estimates of GHI, DNI, and/or DHI at this location. Parameters ---------- times: DatetimeIndex model: str, default 'ineichen' The clear sky model to use. Must be one of 'ineichen', 'haurwitz', 'simplified_solis'. solar_posi...
[ "Calculate", "the", "clear", "sky", "estimates", "of", "GHI", "DNI", "and", "/", "or", "DHI", "at", "this", "location", "." ]
python
train
38.986111
ttinies/sc2players
sc2players/playerManagement.py
https://github.com/ttinies/sc2players/blob/fd9b37c268bf1005d9ef73a25e65ed97c8b7895f/sc2players/playerManagement.py#L81-L92
def getKnownPlayers(reset=False): """identify all of the currently defined players""" global playerCache if not playerCache or reset: jsonFiles = os.path.join(c.PLAYERS_FOLDER, "*.json") for playerFilepath in glob.glob(jsonFiles): filename = os.path.basename(playerFilepath) ...
[ "def", "getKnownPlayers", "(", "reset", "=", "False", ")", ":", "global", "playerCache", "if", "not", "playerCache", "or", "reset", ":", "jsonFiles", "=", "os", ".", "path", ".", "join", "(", "c", ".", "PLAYERS_FOLDER", ",", "\"*.json\"", ")", "for", "pl...
identify all of the currently defined players
[ "identify", "all", "of", "the", "currently", "defined", "players" ]
python
train
42.666667
bethgelab/foolbox
foolbox/models/base.py
https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/models/base.py#L104-L117
def _process_gradient(self, backward, dmdp): """ backward: `callable` callable that backpropagates the gradient of the model w.r.t to preprocessed input through the preprocessing to get the gradient of the model's output w.r.t. the input before preprocessing d...
[ "def", "_process_gradient", "(", "self", ",", "backward", ",", "dmdp", ")", ":", "if", "backward", "is", "None", ":", "# pragma: no cover", "raise", "ValueError", "(", "'Your preprocessing function does not provide'", "' an (approximate) gradient'", ")", "dmdx", "=", ...
backward: `callable` callable that backpropagates the gradient of the model w.r.t to preprocessed input through the preprocessing to get the gradient of the model's output w.r.t. the input before preprocessing dmdp: gradient of model w.r.t. preprocessed input
[ "backward", ":", "callable", "callable", "that", "backpropagates", "the", "gradient", "of", "the", "model", "w", ".", "r", ".", "t", "to", "preprocessed", "input", "through", "the", "preprocessing", "to", "get", "the", "gradient", "of", "the", "model", "s", ...
python
valid
45.785714
biolink/biolink-model
metamodel/utils/generator.py
https://github.com/biolink/biolink-model/blob/f379e28d5d4085e1115798c6cb28e5acc4dba8b4/metamodel/utils/generator.py#L159-L211
def neighborhood(self, elements: List[ELEMENT_NAME]) \ -> References: """ Return a list of all slots, classes and types that touch any element in elements, including the element itself @param elements: Elements to do proximity with @return: All slots and classes that touch e...
[ "def", "neighborhood", "(", "self", ",", "elements", ":", "List", "[", "ELEMENT_NAME", "]", ")", "->", "References", ":", "touches", "=", "References", "(", ")", "for", "element", "in", "elements", ":", "if", "element", "in", "self", ".", "schema", ".", ...
Return a list of all slots, classes and types that touch any element in elements, including the element itself @param elements: Elements to do proximity with @return: All slots and classes that touch element
[ "Return", "a", "list", "of", "all", "slots", "classes", "and", "types", "that", "touch", "any", "element", "in", "elements", "including", "the", "element", "itself" ]
python
train
47.698113
glomex/gcdt
gcdt/cloudwatch_logs.py
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L56-L86
def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None): """ Note: this is used to retrieve logs in ramuda. :param log_group_name: log group name :param start_ts: timestamp :param end_ts: timestamp :return: list of log entries """ client_logs = awsclient.get_client('logs...
[ "def", "filter_log_events", "(", "awsclient", ",", "log_group_name", ",", "start_ts", ",", "end_ts", "=", "None", ")", ":", "client_logs", "=", "awsclient", ".", "get_client", "(", "'logs'", ")", "# TODO use all_pages instead!", "logs", "=", "[", "]", "next_toke...
Note: this is used to retrieve logs in ramuda. :param log_group_name: log group name :param start_ts: timestamp :param end_ts: timestamp :return: list of log entries
[ "Note", ":", "this", "is", "used", "to", "retrieve", "logs", "in", "ramuda", "." ]
python
train
30.064516
svinota/mdns
mdns/zeroconf.py
https://github.com/svinota/mdns/blob/295f6407132616a0ff7401124b9057d89555f91d/mdns/zeroconf.py#L2142-L2158
def close(self): """Ends the background threads, and prevent this instance from servicing further queries.""" if globals()['_GLOBAL_DONE'] == 0: globals()['_GLOBAL_DONE'] = 1 self.notify_all() self.engine.notify() self.unregister_all_services() ...
[ "def", "close", "(", "self", ")", ":", "if", "globals", "(", ")", "[", "'_GLOBAL_DONE'", "]", "==", "0", ":", "globals", "(", ")", "[", "'_GLOBAL_DONE'", "]", "=", "1", "self", ".", "notify_all", "(", ")", "self", ".", "engine", ".", "notify", "(",...
Ends the background threads, and prevent this instance from servicing further queries.
[ "Ends", "the", "background", "threads", "and", "prevent", "this", "instance", "from", "servicing", "further", "queries", "." ]
python
train
41.882353
scheibler/khard
khard/carddav_object.py
https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/carddav_object.py#L1556-L1589
def _parse_type_value(types, value, supported_types): """Parse type value of phone numbers, email and post addresses. :param types: list of type values :type types: list(str) :param value: the corresponding label, required for more verbose exceptions :type value: str...
[ "def", "_parse_type_value", "(", "types", ",", "value", ",", "supported_types", ")", ":", "custom_types", "=", "[", "]", "standard_types", "=", "[", "]", "pref", "=", "0", "for", "type", "in", "types", ":", "type", "=", "type", ".", "strip", "(", ")", ...
Parse type value of phone numbers, email and post addresses. :param types: list of type values :type types: list(str) :param value: the corresponding label, required for more verbose exceptions :type value: str :param supported_types: all allowed standard types ...
[ "Parse", "type", "value", "of", "phone", "numbers", "email", "and", "post", "addresses", "." ]
python
test
39.352941
saltstack/salt
salt/minion.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1854-L1971
def _thread_multi_return(cls, minion_instance, opts, data): ''' This method should be used as a threading target, start the actual minion side execution. ''' fn_ = os.path.join(minion_instance.proc_dir, data['jid']) if opts['multiprocessing'] and not salt.utils.platform....
[ "def", "_thread_multi_return", "(", "cls", ",", "minion_instance", ",", "opts", ",", "data", ")", ":", "fn_", "=", "os", ".", "path", ".", "join", "(", "minion_instance", ".", "proc_dir", ",", "data", "[", "'jid'", "]", ")", "if", "opts", "[", "'multip...
This method should be used as a threading target, start the actual minion side execution.
[ "This", "method", "should", "be", "used", "as", "a", "threading", "target", "start", "the", "actual", "minion", "side", "execution", "." ]
python
train
44.669492
notifiers/notifiers
notifiers/utils/requests.py
https://github.com/notifiers/notifiers/blob/6dd8aafff86935dbb4763db9c56f9cdd7fc08b65/notifiers/utils/requests.py#L13-L67
def request( self, url: str, method: str, raise_for_status: bool = True, path_to_errors: tuple = None, *args, **kwargs ) -> tuple: """ A wrapper method for :meth:`~requests.Session.request``, which adds some defaults and logging :param...
[ "def", "request", "(", "self", ",", "url", ":", "str", ",", "method", ":", "str", ",", "raise_for_status", ":", "bool", "=", "True", ",", "path_to_errors", ":", "tuple", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "tuple", ":...
A wrapper method for :meth:`~requests.Session.request``, which adds some defaults and logging :param url: The URL to send the reply to :param method: The method to use :param raise_for_status: Should an exception be raised for a failed response. Default is **True** :param args: Addition...
[ "A", "wrapper", "method", "for", ":", "meth", ":", "~requests", ".", "Session", ".", "request", "which", "adds", "some", "defaults", "and", "logging" ]
python
train
37.527273
tsnaomi/finnsyll
finnsyll/prev/v05.py
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L97-L119
def _syllabify(word, T4=True): '''Syllabify the given word.''' word = replace_umlauts(word) word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) word, T4...
[ "def", "_syllabify", "(", "word", ",", "T4", "=", "True", ")", ":", "word", "=", "replace_umlauts", "(", "word", ")", "word", ",", "rules", "=", "apply_T1", "(", "word", ")", "if", "re", ".", "search", "(", "r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*'", ","...
Syllabify the given word.
[ "Syllabify", "the", "given", "word", "." ]
python
train
31.304348
CyberReboot/vent
vent/menus/editor.py
https://github.com/CyberReboot/vent/blob/9956a09146b11a89a0eabab3bc7ce8906d124885/vent/menus/editor.py#L115-L120
def change_screens(self): """ Change to the next tool to edit or back to MAIN form """ if self.settings['next_tool']: self.parentApp.change_form(self.settings['next_tool']) else: self.parentApp.change_form('MAIN')
[ "def", "change_screens", "(", "self", ")", ":", "if", "self", ".", "settings", "[", "'next_tool'", "]", ":", "self", ".", "parentApp", ".", "change_form", "(", "self", ".", "settings", "[", "'next_tool'", "]", ")", "else", ":", "self", ".", "parentApp", ...
Change to the next tool to edit or back to MAIN form
[ "Change", "to", "the", "next", "tool", "to", "edit", "or", "back", "to", "MAIN", "form" ]
python
train
42.666667
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py#L4027-L4039
def get_stp_mst_detail_output_cist_migrate_time(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") cist = ...
[ "def", "get_stp_mst_detail_output_cist_migrate_time", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_stp_mst_detail", "=", "ET", ".", "Element", "(", "\"get_stp_mst_detail\"", ")", "config", "=",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
41.692308
ejeschke/ginga
ginga/Bindings.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/Bindings.py#L469-L482
def enable(self, **kwdargs): """ General enable function encompassing all user interface features. Usage (e.g.): viewer.enable(rotate=False, flip=True) """ for feat, value in kwdargs: feat = feat.lower() if feat not in self.features: ...
[ "def", "enable", "(", "self", ",", "*", "*", "kwdargs", ")", ":", "for", "feat", ",", "value", "in", "kwdargs", ":", "feat", "=", "feat", ".", "lower", "(", ")", "if", "feat", "not", "in", "self", ".", "features", ":", "raise", "ValueError", "(", ...
General enable function encompassing all user interface features. Usage (e.g.): viewer.enable(rotate=False, flip=True)
[ "General", "enable", "function", "encompassing", "all", "user", "interface", "features", ".", "Usage", "(", "e", ".", "g", ".", ")", ":", "viewer", ".", "enable", "(", "rotate", "=", "False", "flip", "=", "True", ")" ]
python
train
36.285714
streamlink/streamlink
src/streamlink/stream/segmented.py
https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/stream/segmented.py#L32-L39
def close(self): """Shuts down the thread.""" if not self.closed: log.debug("Closing worker thread") self.closed = True if self._wait: self._wait.set()
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "closed", ":", "log", ".", "debug", "(", "\"Closing worker thread\"", ")", "self", ".", "closed", "=", "True", "if", "self", ".", "_wait", ":", "self", ".", "_wait", ".", "set", "(", ...
Shuts down the thread.
[ "Shuts", "down", "the", "thread", "." ]
python
test
25.125
EnigmaBridge/client.py
ebclient/eb_utils.py
https://github.com/EnigmaBridge/client.py/blob/0fafe3902da394da88e9f960751d695ca65bbabd/ebclient/eb_utils.py#L47-L60
def build_api_object(uo=None, api_key=None, uo_id=None, uo_type=None): """ Builds API object identifier :return: """ if uo is not None: api_key = uo.resolve_api_key() if uo.resolve_api_key() is not None else api_key uo_id = uo.uo_id if uo.uo_id is not None...
[ "def", "build_api_object", "(", "uo", "=", "None", ",", "api_key", "=", "None", ",", "uo_id", "=", "None", ",", "uo_type", "=", "None", ")", ":", "if", "uo", "is", "not", "None", ":", "api_key", "=", "uo", ".", "resolve_api_key", "(", ")", "if", "u...
Builds API object identifier :return:
[ "Builds", "API", "object", "identifier", ":", "return", ":" ]
python
train
38.714286
TissueMAPS/TmClient
src/python/tmclient/api.py
https://github.com/TissueMAPS/TmClient/blob/6fb40622af19142cb5169a64b8c2965993a25ab1/src/python/tmclient/api.py#L1796-L1837
def upload_segmentation_image_file(self, mapobject_type_name, plate_name, well_name, well_pos_y, well_pos_x, tpoint, zplane, filename): '''Uploads segmentations from a *PNG* image file. Parameters ---------- mapobject_type_name: str name of the segmen...
[ "def", "upload_segmentation_image_file", "(", "self", ",", "mapobject_type_name", ",", "plate_name", ",", "well_name", ",", "well_pos_y", ",", "well_pos_x", ",", "tpoint", ",", "zplane", ",", "filename", ")", ":", "logger", ".", "info", "(", "'upload segmentation ...
Uploads segmentations from a *PNG* image file. Parameters ---------- mapobject_type_name: str name of the segmented objects plate_name: str name of the plate well_name: str name of the well in which the image is located well_pos_y: int...
[ "Uploads", "segmentations", "from", "a", "*", "PNG", "*", "image", "file", "." ]
python
train
38.880952
spyder-ide/spyder
spyder/plugins/editor/widgets/editor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L1846-L1895
def save_copy_as(self, index=None): """Save copy of file as... Args: index: self.data index for the file to save. Returns: False if no file name was selected or if save() was unsuccessful. True is save() was successful. Gets the new file n...
[ "def", "save_copy_as", "(", "self", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "# Save the currently edited file\r", "index", "=", "self", ".", "get_stack_index", "(", ")", "finfo", "=", "self", ".", "data", "[", "index", "]", ...
Save copy of file as... Args: index: self.data index for the file to save. Returns: False if no file name was selected or if save() was unsuccessful. True is save() was successful. Gets the new file name from select_savename(). If no name is chose...
[ "Save", "copy", "of", "file", "as", "...", "Args", ":", "index", ":", "self", ".", "data", "index", "for", "the", "file", "to", "save", ".", "Returns", ":", "False", "if", "no", "file", "name", "was", "selected", "or", "if", "save", "()", "was", "u...
python
train
40.42
Rapptz/discord.py
discord/ext/commands/core.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1566-L1582
def is_nsfw(): """A :func:`.check` that checks if the channel is a NSFW channel. This check raises a special exception, :exc:`.NSFWChannelRequired` that is derived from :exc:`.CheckFailure`. .. versionchanged:: 1.1.0 Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`. ...
[ "def", "is_nsfw", "(", ")", ":", "def", "pred", "(", "ctx", ")", ":", "ch", "=", "ctx", ".", "channel", "if", "ctx", ".", "guild", "is", "None", "or", "(", "isinstance", "(", "ch", ",", "discord", ".", "TextChannel", ")", "and", "ch", ".", "is_ns...
A :func:`.check` that checks if the channel is a NSFW channel. This check raises a special exception, :exc:`.NSFWChannelRequired` that is derived from :exc:`.CheckFailure`. .. versionchanged:: 1.1.0 Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`. DM channels will...
[ "A", ":", "func", ":", ".", "check", "that", "checks", "if", "the", "channel", "is", "a", "NSFW", "channel", "." ]
python
train
33.941176
trombastic/PyScada
pyscada/hmi/views.py
https://github.com/trombastic/PyScada/blob/c5fc348a25f0df1340336f694ee9bc1aea62516a/pyscada/hmi/views.py#L240-L309
def get_cache_data(request): if 'init' in request.POST: init = bool(float(request.POST['init'])) else: init = False active_variables = [] if 'variables[]' in request.POST: active_variables = request.POST.getlist('variables[]') """ else: active_variables = list( ...
[ "def", "get_cache_data", "(", "request", ")", ":", "if", "'init'", "in", "request", ".", "POST", ":", "init", "=", "bool", "(", "float", "(", "request", ".", "POST", "[", "'init'", "]", ")", ")", "else", ":", "init", "=", "False", "active_variables", ...
else: active_variables = list( GroupDisplayPermission.objects.filter(hmi_group__in=request.user.groups.iterator()).values_list( 'charts__variables', flat=True)) active_variables += list( GroupDisplayPermission.objects.filter(hmi_group__in=request.user.groups.itera...
[ "else", ":", "active_variables", "=", "list", "(", "GroupDisplayPermission", ".", "objects", ".", "filter", "(", "hmi_group__in", "=", "request", ".", "user", ".", "groups", ".", "iterator", "()", ")", ".", "values_list", "(", "charts__variables", "flat", "=",...
python
train
35.557143
dbcli/athenacli
athenacli/sqlexecute.py
https://github.com/dbcli/athenacli/blob/bcab59e4953145866430083e902ed4d042d4ebba/athenacli/sqlexecute.py#L84-L98
def get_result(self, cursor): '''Get the current result's data from the cursor.''' title = headers = None # cursor.description is not None for queries that return result sets, # e.g. SELECT or SHOW. if cursor.description is not None: headers = [x[0] for x in cursor.d...
[ "def", "get_result", "(", "self", ",", "cursor", ")", ":", "title", "=", "headers", "=", "None", "# cursor.description is not None for queries that return result sets,", "# e.g. SELECT or SHOW.", "if", "cursor", ".", "description", "is", "not", "None", ":", "headers", ...
Get the current result's data from the cursor.
[ "Get", "the", "current", "result", "s", "data", "from", "the", "cursor", "." ]
python
train
40.066667
openstax/cnx-archive
cnxarchive/__init__.py
https://github.com/openstax/cnx-archive/blob/d31d34aa8bbc8a9fde6cd4227a0df92726e8daf4/cnxarchive/__init__.py#L137-L159
def main(global_config, **settings): """Main WSGI application factory.""" initialize_sentry_integration() config = Configurator(settings=settings) declare_api_routes(config) declare_type_info(config) # allowing the pyramid templates to render rss and xml config.include('pyramid_jinja2') ...
[ "def", "main", "(", "global_config", ",", "*", "*", "settings", ")", ":", "initialize_sentry_integration", "(", ")", "config", "=", "Configurator", "(", "settings", "=", "settings", ")", "declare_api_routes", "(", "config", ")", "declare_type_info", "(", "config...
Main WSGI application factory.
[ "Main", "WSGI", "application", "factory", "." ]
python
train
34.565217
StanfordBioinformatics/loom
client/loomengine/playbooks/files/gcloud_utils.py
https://github.com/StanfordBioinformatics/loom/blob/db2031a1a87124fee1aeb7414a668c03d774a698/client/loomengine/playbooks/files/gcloud_utils.py#L11-L24
def on_gcloud_vm(): """ Determines if we're running on a GCE instance.""" r = None try: r = requests.get('http://metadata.google.internal') except requests.ConnectionError: return False try: if r.headers['Metadata-Flavor'] == 'Google' and \ r.headers['Server'] == ...
[ "def", "on_gcloud_vm", "(", ")", ":", "r", "=", "None", "try", ":", "r", "=", "requests", ".", "get", "(", "'http://metadata.google.internal'", ")", "except", "requests", ".", "ConnectionError", ":", "return", "False", "try", ":", "if", "r", ".", "headers"...
Determines if we're running on a GCE instance.
[ "Determines", "if", "we", "re", "running", "on", "a", "GCE", "instance", "." ]
python
train
28.428571
soravux/scoop
bench/process_debug.py
https://github.com/soravux/scoop/blob/d391dfa62f47e49d48328ee9cf08aa114256fd33/bench/process_debug.py#L41-L49
def getWorkersName(data): """Returns the list of the names of the workers sorted alphabetically""" names = [fichier for fichier in data.keys()] names.sort() try: names.remove("broker") except ValueError: pass return names
[ "def", "getWorkersName", "(", "data", ")", ":", "names", "=", "[", "fichier", "for", "fichier", "in", "data", ".", "keys", "(", ")", "]", "names", ".", "sort", "(", ")", "try", ":", "names", ".", "remove", "(", "\"broker\"", ")", "except", "ValueErro...
Returns the list of the names of the workers sorted alphabetically
[ "Returns", "the", "list", "of", "the", "names", "of", "the", "workers", "sorted", "alphabetically" ]
python
train
28.111111
raiden-network/raiden
raiden/utils/signer.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/signer.py#L83-L90
def sign(self, data: bytes, v: int = 27) -> Signature: """ Sign data hash with local private key """ assert v in (0, 27), 'Raiden is only signing messages with v in (0, 27)' _hash = eth_sign_sha3(data) signature = self.private_key.sign_msg_hash(message_hash=_hash) sig_bytes = sig...
[ "def", "sign", "(", "self", ",", "data", ":", "bytes", ",", "v", ":", "int", "=", "27", ")", "->", "Signature", ":", "assert", "v", "in", "(", "0", ",", "27", ")", ",", "'Raiden is only signing messages with v in (0, 27)'", "_hash", "=", "eth_sign_sha3", ...
Sign data hash with local private key
[ "Sign", "data", "hash", "with", "local", "private", "key" ]
python
train
52.625
timothydmorton/simpledist
simpledist/kde.py
https://github.com/timothydmorton/simpledist/blob/d9807c90a935bd125213445ffed6255af558f1ca/simpledist/kde.py#L235-L254
def newton(f,c,tol=0.0001,restrict=None): """ newton(f,c) --> float Returns the x closest to c such that f(x) = 0 """ #print(c) if restrict: lo,hi = restrict if c < lo or c > hi: print(c) c = random*(hi-lo)+lo if fuzzyequals(f(c),0,tol): ...
[ "def", "newton", "(", "f", ",", "c", ",", "tol", "=", "0.0001", ",", "restrict", "=", "None", ")", ":", "#print(c)", "if", "restrict", ":", "lo", ",", "hi", "=", "restrict", "if", "c", "<", "lo", "or", "c", ">", "hi", ":", "print", "(", "c", ...
newton(f,c) --> float Returns the x closest to c such that f(x) = 0
[ "newton", "(", "f", "c", ")", "--", ">", "float", "Returns", "the", "x", "closest", "to", "c", "such", "that", "f", "(", "x", ")", "=", "0" ]
python
train
21.8
scheibler/khard
khard/khard.py
https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/khard.py#L921-L982
def phone_subcommand(search_terms, vcard_list, parsable): """Print a phone application friendly contact table. :param search_terms: used as search term to filter the contacts before printing :type search_terms: str :param vcard_list: the vcards to search for matching entries which should ...
[ "def", "phone_subcommand", "(", "search_terms", ",", "vcard_list", ",", "parsable", ")", ":", "all_phone_numbers_list", "=", "[", "]", "matching_phone_number_list", "=", "[", "]", "for", "vcard", "in", "vcard_list", ":", "for", "type", ",", "number_list", "in", ...
Print a phone application friendly contact table. :param search_terms: used as search term to filter the contacts before printing :type search_terms: str :param vcard_list: the vcards to search for matching entries which should be printed :type vcard_list: list of carddav_object.Carddav...
[ "Print", "a", "phone", "application", "friendly", "contact", "table", "." ]
python
test
45.274194
coleifer/irc
irc.py
https://github.com/coleifer/irc/blob/f9d2bd6369aafe6cb0916c9406270ca8ecea2080/irc.py#L146-L168
def dispatch_patterns(self): """\ Low-level dispatching of socket data based on regex matching, in general handles * In event a nickname is taken, registers under a different one * Responds to periodic PING messages from server * Dispatches to registered callbacks when ...
[ "def", "dispatch_patterns", "(", "self", ")", ":", "return", "(", "(", "self", ".", "nick_re", ",", "self", ".", "new_nick", ")", ",", "(", "self", ".", "nick_change_re", ",", "self", ".", "handle_nick_change", ")", ",", "(", "self", ".", "ping_re", ",...
\ Low-level dispatching of socket data based on regex matching, in general handles * In event a nickname is taken, registers under a different one * Responds to periodic PING messages from server * Dispatches to registered callbacks when - any user leaves or enters a...
[ "\\", "Low", "-", "level", "dispatching", "of", "socket", "data", "based", "on", "regex", "matching", "in", "general", "handles" ]
python
test
41.652174
numba/llvmlite
llvmlite/binding/targets.py
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/targets.py#L187-L198
def from_triple(cls, triple): """ Create a Target instance for the given triple (a string). """ with ffi.OutputString() as outerr: target = ffi.lib.LLVMPY_GetTargetFromTriple(triple.encode('utf8'), outerr) if...
[ "def", "from_triple", "(", "cls", ",", "triple", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "outerr", ":", "target", "=", "ffi", ".", "lib", ".", "LLVMPY_GetTargetFromTriple", "(", "triple", ".", "encode", "(", "'utf8'", ")", ",", "o...
Create a Target instance for the given triple (a string).
[ "Create", "a", "Target", "instance", "for", "the", "given", "triple", "(", "a", "string", ")", "." ]
python
train
38.666667
aiogram/aiogram
aiogram/utils/executor.py
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/executor.py#L294-L313
def start_polling(self, reset_webhook=None, timeout=20, fast=True): """ Start bot in long-polling mode :param reset_webhook: :param timeout: """ self._prepare_polling() loop: asyncio.AbstractEventLoop = self.loop try: loop.run_until_complete(...
[ "def", "start_polling", "(", "self", ",", "reset_webhook", "=", "None", ",", "timeout", "=", "20", ",", "fast", "=", "True", ")", ":", "self", ".", "_prepare_polling", "(", ")", "loop", ":", "asyncio", ".", "AbstractEventLoop", "=", "self", ".", "loop", ...
Start bot in long-polling mode :param reset_webhook: :param timeout:
[ "Start", "bot", "in", "long", "-", "polling", "mode" ]
python
train
33.95
secdev/scapy
scapy/contrib/isotp.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/isotp.py#L602-L610
def begin_send(self, p): """Begin the transmission of message p. This method returns after sending the first frame. If multiple frames are necessary to send the message, this socket will unable to send other messages until either the transmission of this frame succeeds or it fails.""" ...
[ "def", "begin_send", "(", "self", ",", "p", ")", ":", "if", "hasattr", "(", "p", ",", "\"sent_time\"", ")", ":", "p", ".", "sent_time", "=", "time", ".", "time", "(", ")", "return", "self", ".", "outs", ".", "begin_send", "(", "bytes", "(", "p", ...
Begin the transmission of message p. This method returns after sending the first frame. If multiple frames are necessary to send the message, this socket will unable to send other messages until either the transmission of this frame succeeds or it fails.
[ "Begin", "the", "transmission", "of", "message", "p", ".", "This", "method", "returns", "after", "sending", "the", "first", "frame", ".", "If", "multiple", "frames", "are", "necessary", "to", "send", "the", "message", "this", "socket", "will", "unable", "to"...
python
train
47.777778
sbg/sevenbridges-python
sevenbridges/models/dataset.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/dataset.py#L144-L162
def add_member(self, username, permissions, api=None): """Add member to a dataset :param username: Member username :param permissions: Permissions dict :param api: Api instance :return: New member instance """ api = api or self._API data = { 'u...
[ "def", "add_member", "(", "self", ",", "username", ",", "permissions", ",", "api", "=", "None", ")", ":", "api", "=", "api", "or", "self", ".", "_API", "data", "=", "{", "'username'", ":", "username", ",", "'permissions'", ":", "permissions", "}", "res...
Add member to a dataset :param username: Member username :param permissions: Permissions dict :param api: Api instance :return: New member instance
[ "Add", "member", "to", "a", "dataset", ":", "param", "username", ":", "Member", "username", ":", "param", "permissions", ":", "Permissions", "dict", ":", "param", "api", ":", "Api", "instance", ":", "return", ":", "New", "member", "instance" ]
python
train
29.421053
secdev/scapy
scapy/arch/windows/__init__.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L174-L183
def _exec_cmd(command): """Call a CMD command and return the output and returncode""" proc = sp.Popen(command, stdout=sp.PIPE, shell=True) if six.PY2: res = proc.communicate()[0] else: res = proc.communicate(timeout=5)[0] return res, proc.retur...
[ "def", "_exec_cmd", "(", "command", ")", ":", "proc", "=", "sp", ".", "Popen", "(", "command", ",", "stdout", "=", "sp", ".", "PIPE", ",", "shell", "=", "True", ")", "if", "six", ".", "PY2", ":", "res", "=", "proc", ".", "communicate", "(", ")", ...
Call a CMD command and return the output and returncode
[ "Call", "a", "CMD", "command", "and", "return", "the", "output", "and", "returncode" ]
python
train
31.6
noahmorrison/chevron
chevron/tokenizer.py
https://github.com/noahmorrison/chevron/blob/78f1a384eddef16906732d8db66deea6d37049b7/chevron/tokenizer.py#L31-L44
def l_sa_check(template, literal, is_standalone): """Do a preliminary check to see if a tag could be a standalone""" # If there is a newline, or the previous tag was a standalone if literal.find('\n') != -1 or is_standalone: padding = literal.split('\n')[-1] # If all the characters since t...
[ "def", "l_sa_check", "(", "template", ",", "literal", ",", "is_standalone", ")", ":", "# If there is a newline, or the previous tag was a standalone", "if", "literal", ".", "find", "(", "'\\n'", ")", "!=", "-", "1", "or", "is_standalone", ":", "padding", "=", "lit...
Do a preliminary check to see if a tag could be a standalone
[ "Do", "a", "preliminary", "check", "to", "see", "if", "a", "tag", "could", "be", "a", "standalone" ]
python
train
38.071429
attakei/errcron
errcron/bot.py
https://github.com/attakei/errcron/blob/a3938fc7d051daefb6813588fcbeb9592bd00c9a/errcron/bot.py#L53-L63
def poll_crontab(self): """Check crontab and run target jobs """ polled_time = self._get_current_time() if polled_time.second >= 30: self.log.debug('Skip cronjobs in {}'.format(polled_time)) return for job in self._crontab: if not job.is_runnab...
[ "def", "poll_crontab", "(", "self", ")", ":", "polled_time", "=", "self", ".", "_get_current_time", "(", ")", "if", "polled_time", ".", "second", ">=", "30", ":", "self", ".", "log", ".", "debug", "(", "'Skip cronjobs in {}'", ".", "format", "(", "polled_t...
Check crontab and run target jobs
[ "Check", "crontab", "and", "run", "target", "jobs" ]
python
train
36
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3769-L3783
def get_tags_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get tags of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :retu...
[ "def", "get_tags_of_delivery_note_per_page", "(", "self", ",", "delivery_note_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "DELIVERY_NOTE_TAGS", ",", "per_page", "=", "...
Get tags of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "tags", "of", "delivery", "note", "per", "page" ]
python
train
35.6
gitpython-developers/GitPython
git/cmd.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/cmd.py#L866-L882
def custom_environment(self, **kwargs): """ A context manager around the above ``update_environment`` method to restore the environment back to its previous state after operation. ``Examples``:: with self.custom_environment(GIT_SSH='/bin/ssh_wrapper'): repo....
[ "def", "custom_environment", "(", "self", ",", "*", "*", "kwargs", ")", ":", "old_env", "=", "self", ".", "update_environment", "(", "*", "*", "kwargs", ")", "try", ":", "yield", "finally", ":", "self", ".", "update_environment", "(", "*", "*", "old_env"...
A context manager around the above ``update_environment`` method to restore the environment back to its previous state after operation. ``Examples``:: with self.custom_environment(GIT_SSH='/bin/ssh_wrapper'): repo.remotes.origin.fetch() :param kwargs: see update_en...
[ "A", "context", "manager", "around", "the", "above", "update_environment", "method", "to", "restore", "the", "environment", "back", "to", "its", "previous", "state", "after", "operation", "." ]
python
train
31.294118
astropy/photutils
photutils/background/background_2d.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L412-L453
def _select_meshes(self, data): """ Define the x and y indices with respect to the low-resolution mesh image of the meshes to use for the background interpolation. The ``exclude_percentile`` keyword determines which meshes are not used for the background interpolation. ...
[ "def", "_select_meshes", "(", "self", ",", "data", ")", ":", "# the number of masked pixels in each mesh", "nmasked", "=", "np", ".", "ma", ".", "count_masked", "(", "data", ",", "axis", "=", "1", ")", "# meshes that contain more than ``exclude_percentile`` percent", ...
Define the x and y indices with respect to the low-resolution mesh image of the meshes to use for the background interpolation. The ``exclude_percentile`` keyword determines which meshes are not used for the background interpolation. Parameters ---------- data :...
[ "Define", "the", "x", "and", "y", "indices", "with", "respect", "to", "the", "low", "-", "resolution", "mesh", "image", "of", "the", "meshes", "to", "use", "for", "the", "background", "interpolation", "." ]
python
train
39.714286
spacetelescope/pysynphot
pysynphot/spectrum.py
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/pysynphot/spectrum.py#L699-L714
def setMagnitude(self, band, value): """Makes the magnitude of the source in the band equal to value. band is a SpectralElement. This method is marked for deletion once the .renorm method is well tested. Object returned is a CompositeSourceSpectrum. .. warning:: DO NOT ...
[ "def", "setMagnitude", "(", "self", ",", "band", ",", "value", ")", ":", "objectFlux", "=", "band", ".", "calcTotalFlux", "(", "self", ")", "vegaFlux", "=", "band", ".", "calcVegaFlux", "(", ")", "magDiff", "=", "-", "2.5", "*", "math", ".", "log10", ...
Makes the magnitude of the source in the band equal to value. band is a SpectralElement. This method is marked for deletion once the .renorm method is well tested. Object returned is a CompositeSourceSpectrum. .. warning:: DO NOT USED
[ "Makes", "the", "magnitude", "of", "the", "source", "in", "the", "band", "equal", "to", "value", ".", "band", "is", "a", "SpectralElement", ".", "This", "method", "is", "marked", "for", "deletion", "once", "the", ".", "renorm", "method", "is", "well", "t...
python
train
33.5625
welbornprod/colr
examples/walk_dir.py
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/examples/walk_dir.py#L124-L167
def walk_dir_progress(path, maxdircnt=5000, file=sys.stdout): """ Walk a directory, printing status updates along the way. """ p = ProgressBar( 'Walking {}'.format(C(path, 'cyan')), bars=Bars.numbers_blue.with_wrapper(('(', ')')), show_time=True, file=file, ) rootcnt = 0 ...
[ "def", "walk_dir_progress", "(", "path", ",", "maxdircnt", "=", "5000", ",", "file", "=", "sys", ".", "stdout", ")", ":", "p", "=", "ProgressBar", "(", "'Walking {}'", ".", "format", "(", "C", "(", "path", ",", "'cyan'", ")", ")", ",", "bars", "=", ...
Walk a directory, printing status updates along the way.
[ "Walk", "a", "directory", "printing", "status", "updates", "along", "the", "way", "." ]
python
train
31.636364
gem/oq-engine
openquake/commonlib/oqvalidation.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/oqvalidation.py#L468-L472
def lti(self): """ Dictionary extended_loss_type -> extended_loss_type index """ return {lt: i for i, (lt, dt) in enumerate(self.loss_dt_list())}
[ "def", "lti", "(", "self", ")", ":", "return", "{", "lt", ":", "i", "for", "i", ",", "(", "lt", ",", "dt", ")", "in", "enumerate", "(", "self", ".", "loss_dt_list", "(", ")", ")", "}" ]
Dictionary extended_loss_type -> extended_loss_type index
[ "Dictionary", "extended_loss_type", "-", ">", "extended_loss_type", "index" ]
python
train
34.6
dropbox/stone
stone/frontend/ir_generator.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/ir_generator.py#L552-L577
def _create_type(self, env, item): """Create a forward reference for a union or struct.""" if item.name in env: existing_dt = env[item.name] raise InvalidSpec( 'Symbol %s already defined (%s:%d).' % (quote(item.name), existing_dt._ast_node.path, ...
[ "def", "_create_type", "(", "self", ",", "env", ",", "item", ")", ":", "if", "item", ".", "name", "in", "env", ":", "existing_dt", "=", "env", "[", "item", ".", "name", "]", "raise", "InvalidSpec", "(", "'Symbol %s already defined (%s:%d).'", "%", "(", "...
Create a forward reference for a union or struct.
[ "Create", "a", "forward", "reference", "for", "a", "union", "or", "struct", "." ]
python
train
43.730769
7sDream/zhihu-py3
zhihu/author.py
https://github.com/7sDream/zhihu-py3/blob/bcb4aa8325f8b54d3b44bd0bdc959edd9761fcfc/zhihu/author.py#L66-L73
def id(self): """获取用户id,就是网址最后那一部分. :return: 用户id :rtype: str """ return re.match(r'^.*/([^/]+)/$', self.url).group(1) \ if self.url is not None else ''
[ "def", "id", "(", "self", ")", ":", "return", "re", ".", "match", "(", "r'^.*/([^/]+)/$'", ",", "self", ".", "url", ")", ".", "group", "(", "1", ")", "if", "self", ".", "url", "is", "not", "None", "else", "''" ]
获取用户id,就是网址最后那一部分. :return: 用户id :rtype: str
[ "获取用户id,就是网址最后那一部分", "." ]
python
train
24.75
neo4j-contrib/neomodel
neomodel/core.py
https://github.com/neo4j-contrib/neomodel/blob/cca5de4c4e90998293558b871b1b529095c91a38/neomodel/core.py#L50-L65
def remove_all_labels(stdout=None): """ Calls functions for dropping constraints and indexes. :param stdout: output stream :return: None """ if not stdout: stdout = sys.stdout stdout.write("Droping constraints...\n") drop_constraints(quiet=False, stdout=stdout) stdout.wri...
[ "def", "remove_all_labels", "(", "stdout", "=", "None", ")", ":", "if", "not", "stdout", ":", "stdout", "=", "sys", ".", "stdout", "stdout", ".", "write", "(", "\"Droping constraints...\\n\"", ")", "drop_constraints", "(", "quiet", "=", "False", ",", "stdout...
Calls functions for dropping constraints and indexes. :param stdout: output stream :return: None
[ "Calls", "functions", "for", "dropping", "constraints", "and", "indexes", "." ]
python
train
23.5
dtmilano/AndroidViewClient
src/com/dtmilano/android/culebron.py
https://github.com/dtmilano/AndroidViewClient/blob/7e6e83fde63af99e5e4ab959712ecf94f9881aa2/src/com/dtmilano/android/culebron.py#L305-L386
def takeScreenshotAndShowItOnWindow(self): ''' Takes the current screenshot and shows it on the main window. It also: - sizes the window - create the canvas - set the focus - enable the events - create widgets - finds the targets (as explaine...
[ "def", "takeScreenshotAndShowItOnWindow", "(", "self", ")", ":", "if", "PROFILE", ":", "print", ">>", "sys", ".", "stderr", ",", "\"PROFILING: takeScreenshotAndShowItOnWindow()\"", "profileStart", "(", ")", "if", "DEBUG", ":", "print", ">>", "sys", ".", "stderr", ...
Takes the current screenshot and shows it on the main window. It also: - sizes the window - create the canvas - set the focus - enable the events - create widgets - finds the targets (as explained in L{findTargets}) - hides the vignette (that could ...
[ "Takes", "the", "current", "screenshot", "and", "shows", "it", "on", "the", "main", "window", ".", "It", "also", ":", "-", "sizes", "the", "window", "-", "create", "the", "canvas", "-", "set", "the", "focus", "-", "enable", "the", "events", "-", "creat...
python
train
41.219512
googledatalab/pydatalab
datalab/storage/_item.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/datalab/storage/_item.py#L130-L137
def exists(self): """ Checks if the item exists. """ try: return self.metadata is not None except datalab.utils.RequestException: return False except Exception as e: raise e
[ "def", "exists", "(", "self", ")", ":", "try", ":", "return", "self", ".", "metadata", "is", "not", "None", "except", "datalab", ".", "utils", ".", "RequestException", ":", "return", "False", "except", "Exception", "as", "e", ":", "raise", "e" ]
Checks if the item exists.
[ "Checks", "if", "the", "item", "exists", "." ]
python
train
25
astropy/photutils
photutils/aperture/mask.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/mask.py#L210-L241
def multiply(self, data, fill_value=0.): """ Multiply the aperture mask with the input data, taking any edge effects into account. The result is a mask-weighted cutout from the data. Parameters ---------- data : array_like or `~astropy.units.Quantity` ...
[ "def", "multiply", "(", "self", ",", "data", ",", "fill_value", "=", "0.", ")", ":", "cutout", "=", "self", ".", "cutout", "(", "data", ",", "fill_value", "=", "fill_value", ")", "if", "cutout", "is", "None", ":", "return", "None", "else", ":", "retu...
Multiply the aperture mask with the input data, taking any edge effects into account. The result is a mask-weighted cutout from the data. Parameters ---------- data : array_like or `~astropy.units.Quantity` The 2D array to multiply with the aperture mask. f...
[ "Multiply", "the", "aperture", "mask", "with", "the", "input", "data", "taking", "any", "edge", "effects", "into", "account", "." ]
python
train
35.625
uralbash/sqlalchemy_mptt
sqlalchemy_mptt/mixins.py
https://github.com/uralbash/sqlalchemy_mptt/blob/2971c9fa49bbeaa3e2fb96229d933ceae450b319/sqlalchemy_mptt/mixins.py#L153-L164
def move_inside(self, parent_id): """ Moving one node of tree inside another For example see: * :mod:`sqlalchemy_mptt.tests.cases.move_node.test_move_inside_function` * :mod:`sqlalchemy_mptt.tests.cases.move_node.test_move_inside_to_the_same_parent_function` """ # noqa ...
[ "def", "move_inside", "(", "self", ",", "parent_id", ")", ":", "# noqa", "session", "=", "Session", ".", "object_session", "(", "self", ")", "self", ".", "parent_id", "=", "parent_id", "self", ".", "mptt_move_inside", "=", "parent_id", "session", ".", "add",...
Moving one node of tree inside another For example see: * :mod:`sqlalchemy_mptt.tests.cases.move_node.test_move_inside_function` * :mod:`sqlalchemy_mptt.tests.cases.move_node.test_move_inside_to_the_same_parent_function`
[ "Moving", "one", "node", "of", "tree", "inside", "another" ]
python
train
37.583333
LPgenerator/django-db-mailer
dbmail/providers/pubnub/push.py
https://github.com/LPgenerator/django-db-mailer/blob/217a73c21ba5c6b68738f74b2c55a6dd2c1afe35/dbmail/providers/pubnub/push.py#L11-L27
def send(channel, message, **kwargs): """ Site: http://www.pubnub.com/ API: https://www.mashape.com/pubnub/pubnub-network Desc: real-time browser notifications Installation and usage: pip install -U pubnub Tests for browser notification http://127.0.0.1:8000/browser_notification/ """ ...
[ "def", "send", "(", "channel", ",", "message", ",", "*", "*", "kwargs", ")", ":", "pubnub", "=", "Pubnub", "(", "publish_key", "=", "settings", ".", "PUBNUB_PUB_KEY", ",", "subscribe_key", "=", "settings", ".", "PUBNUB_SUB_KEY", ",", "secret_key", "=", "se...
Site: http://www.pubnub.com/ API: https://www.mashape.com/pubnub/pubnub-network Desc: real-time browser notifications Installation and usage: pip install -U pubnub Tests for browser notification http://127.0.0.1:8000/browser_notification/
[ "Site", ":", "http", ":", "//", "www", ".", "pubnub", ".", "com", "/", "API", ":", "https", ":", "//", "www", ".", "mashape", ".", "com", "/", "pubnub", "/", "pubnub", "-", "network", "Desc", ":", "real", "-", "time", "browser", "notifications" ]
python
train
34.294118
gunthercox/ChatterBot
chatterbot/parsing.py
https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/parsing.py#L639-L652
def date_from_adverb(base_date, name): """ Convert Day adverbs to dates Tomorrow => Date Today => Date """ # Reset date to start of the day adverb_date = datetime(base_date.year, base_date.month, base_date.day) if name == 'today' or name == 'tonite' or name == 'tonight': return a...
[ "def", "date_from_adverb", "(", "base_date", ",", "name", ")", ":", "# Reset date to start of the day", "adverb_date", "=", "datetime", "(", "base_date", ".", "year", ",", "base_date", ".", "month", ",", "base_date", ".", "day", ")", "if", "name", "==", "'toda...
Convert Day adverbs to dates Tomorrow => Date Today => Date
[ "Convert", "Day", "adverbs", "to", "dates", "Tomorrow", "=", ">", "Date", "Today", "=", ">", "Date" ]
python
train
35.357143
mezz64/pyEight
pyeight/user.py
https://github.com/mezz64/pyEight/blob/e557e4e6876f490d0964298e9475d68b64222d4f/pyeight/user.py#L258-L270
def current_resp_rate(self): """Return current respiratory rate for in-progress session.""" try: rates = self.intervals[0]['timeseries']['respiratoryRate'] num_rates = len(rates) if num_rates == 0: return None rate = rates[num_rates-1][1]...
[ "def", "current_resp_rate", "(", "self", ")", ":", "try", ":", "rates", "=", "self", ".", "intervals", "[", "0", "]", "[", "'timeseries'", "]", "[", "'respiratoryRate'", "]", "num_rates", "=", "len", "(", "rates", ")", "if", "num_rates", "==", "0", ":"...
Return current respiratory rate for in-progress session.
[ "Return", "current", "respiratory", "rate", "for", "in", "-", "progress", "session", "." ]
python
train
29
Capitains/flask-capitains-nemo
flask_nemo/__init__.py
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L375-L402
def get_reffs(self, objectId, subreference=None, collection=None, export_collection=False): """ Retrieve and transform a list of references. Returns the inventory collection object with its metadata and a callback function taking a level parameter \ and returning a list of strings. :pa...
[ "def", "get_reffs", "(", "self", ",", "objectId", ",", "subreference", "=", "None", ",", "collection", "=", "None", ",", "export_collection", "=", "False", ")", ":", "if", "collection", "is", "not", "None", ":", "text", "=", "collection", "else", ":", "t...
Retrieve and transform a list of references. Returns the inventory collection object with its metadata and a callback function taking a level parameter \ and returning a list of strings. :param objectId: Collection Identifier :type objectId: str :param subreference: Subreferenc...
[ "Retrieve", "and", "transform", "a", "list", "of", "references", "." ]
python
valid
43.035714
campaignmonitor/createsend-python
lib/createsend/campaign.py
https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/campaign.py#L52-L88
def create_from_template(self, client_id, subject, name, from_name, from_email, reply_to, list_ids, segment_ids, template_id, template_content): """Creates a new campaign for a client, from a template. :param client_id: String representing the ID of the client for whom the ...
[ "def", "create_from_template", "(", "self", ",", "client_id", ",", "subject", ",", "name", ",", "from_name", ",", "from_email", ",", "reply_to", ",", "list_ids", ",", "segment_ids", ",", "template_id", ",", "template_content", ")", ":", "body", "=", "{", "\"...
Creates a new campaign for a client, from a template. :param client_id: String representing the ID of the client for whom the campaign will be created. :param subject: String representing the subject of the campaign. :param name: String representing the name of the campaign. :...
[ "Creates", "a", "new", "campaign", "for", "a", "client", "from", "a", "template", "." ]
python
train
53.567568
Nekmo/amazon-dash
amazon_dash/config.py
https://github.com/Nekmo/amazon-dash/blob/0e2bdc24ff8ea32cecb2f5f54f5cc1c0f99c197b/amazon_dash/config.py#L227-L240
def read(self): """Parse and validate the config file. The read data is accessible as a dictionary in this instance :return: None """ try: data = load(open(self.file), Loader) except (UnicodeDecodeError, YAMLError) as e: raise InvalidConfig(self.file, '{}...
[ "def", "read", "(", "self", ")", ":", "try", ":", "data", "=", "load", "(", "open", "(", "self", ".", "file", ")", ",", "Loader", ")", "except", "(", "UnicodeDecodeError", ",", "YAMLError", ")", "as", "e", ":", "raise", "InvalidConfig", "(", "self", ...
Parse and validate the config file. The read data is accessible as a dictionary in this instance :return: None
[ "Parse", "and", "validate", "the", "config", "file", ".", "The", "read", "data", "is", "accessible", "as", "a", "dictionary", "in", "this", "instance" ]
python
test
34
DarkEnergySurvey/ugali
ugali/observation/mask.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L406-L421
def plotSolidAngleCMD(self): """ Solid angle within the mask as a function of color and magnitude. """ msg = "'%s.plotSolidAngleCMD': ADW 2018-05-05"%self.__class__.__name__ DeprecationWarning(msg) import ugali.utils.plotting ugali.utils.plotting.twoDimen...
[ "def", "plotSolidAngleCMD", "(", "self", ")", ":", "msg", "=", "\"'%s.plotSolidAngleCMD': ADW 2018-05-05\"", "%", "self", ".", "__class__", ".", "__name__", "DeprecationWarning", "(", "msg", ")", "import", "ugali", ".", "utils", ".", "plotting", "ugali", ".", "u...
Solid angle within the mask as a function of color and magnitude.
[ "Solid", "angle", "within", "the", "mask", "as", "a", "function", "of", "color", "and", "magnitude", "." ]
python
train
57.1875
acorg/dark-matter
dark/reads.py
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/reads.py#L1323-L1352
def save(self, filename, format_='fasta'): """ Write the reads to C{filename} in the requested format. @param filename: Either a C{str} file name to save into (the file will be overwritten) or an open file descriptor (e.g., sys.stdout). @param format_: A C{str} format to sav...
[ "def", "save", "(", "self", ",", "filename", ",", "format_", "=", "'fasta'", ")", ":", "format_", "=", "format_", ".", "lower", "(", ")", "count", "=", "0", "if", "isinstance", "(", "filename", ",", "str", ")", ":", "try", ":", "with", "open", "(",...
Write the reads to C{filename} in the requested format. @param filename: Either a C{str} file name to save into (the file will be overwritten) or an open file descriptor (e.g., sys.stdout). @param format_: A C{str} format to save as, either 'fasta', 'fastq' or 'fasta-ss'. ...
[ "Write", "the", "reads", "to", "C", "{", "filename", "}", "in", "the", "requested", "format", "." ]
python
train
37.566667
Gorialis/jishaku
jishaku/cog.py
https://github.com/Gorialis/jishaku/blob/fc7c479b9d510ede189a929c8aa6f7c8ef7f9a6e/jishaku/cog.py#L217-L238
async def jsk_cancel(self, ctx: commands.Context, *, index: int): """ Cancels a task with the given index. If the index passed is -1, will cancel the last task instead. """ if not self.tasks: return await ctx.send("No tasks to cancel.") if index == -1: ...
[ "async", "def", "jsk_cancel", "(", "self", ",", "ctx", ":", "commands", ".", "Context", ",", "*", ",", "index", ":", "int", ")", ":", "if", "not", "self", ".", "tasks", ":", "return", "await", "ctx", ".", "send", "(", "\"No tasks to cancel.\"", ")", ...
Cancels a task with the given index. If the index passed is -1, will cancel the last task instead.
[ "Cancels", "a", "task", "with", "the", "given", "index", "." ]
python
train
35.318182
gebn/wood
wood/comparison.py
https://github.com/gebn/wood/blob/efc71879890dbd2f2d7a0b1a65ed22a0843139dd/wood/comparison.py#L224-L236
def is_modified(self) -> bool: """ Find whether the files on the left and right are different. Note, modified implies the contents of the file have changed, which is predicated on the file existing on both the left and right. Therefore this will be false if the file on the left h...
[ "def", "is_modified", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "is_new", "or", "self", ".", "is_deleted", ":", "return", "False", "return", "self", ".", "left", ".", "md5", "!=", "self", ".", "right", ".", "md5" ]
Find whether the files on the left and right are different. Note, modified implies the contents of the file have changed, which is predicated on the file existing on both the left and right. Therefore this will be false if the file on the left has been deleted, or the file on the right i...
[ "Find", "whether", "the", "files", "on", "the", "left", "and", "right", "are", "different", ".", "Note", "modified", "implies", "the", "contents", "of", "the", "file", "have", "changed", "which", "is", "predicated", "on", "the", "file", "existing", "on", "...
python
train
42
elehcimd/pynb
notebooks/sum.py
https://github.com/elehcimd/pynb/blob/a32af1f0e574f880eccda4a46aede6d65151f8c9/notebooks/sum.py#L1-L11
def cells(a, b): ''' # Sum ''' a, b = int(a), int(b) ''' ''' a + b
[ "def", "cells", "(", "a", ",", "b", ")", ":", "a", ",", "b", "=", "int", "(", "a", ")", ",", "int", "(", "b", ")", "'''\n '''", "a", "+", "b" ]
# Sum
[ "#", "Sum" ]
python
train
7.909091
kgiusti/pyngus
pyngus/connection.py
https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/connection.py#L609-L620
def output_data(self): """Get a buffer of data that needs to be written to the network. """ c = self.has_output if c <= 0: return None try: buf = self._pn_transport.peek(c) except Exception as e: self._connection_failed(str(e)) ...
[ "def", "output_data", "(", "self", ")", ":", "c", "=", "self", ".", "has_output", "if", "c", "<=", "0", ":", "return", "None", "try", ":", "buf", "=", "self", ".", "_pn_transport", ".", "peek", "(", "c", ")", "except", "Exception", "as", "e", ":", ...
Get a buffer of data that needs to be written to the network.
[ "Get", "a", "buffer", "of", "data", "that", "needs", "to", "be", "written", "to", "the", "network", "." ]
python
test
28.583333