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
log2timeline/plaso
plaso/analysis/manager.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/analysis/manager.py#L48-L71
def GetAllPluginInformation(cls, show_all=True): """Retrieves a list of the registered analysis plugins. Args: show_all (Optional[bool]): True if all analysis plugin names should be listed. Returns: list[tuple[str, str, str]]: the name, docstring and type string of each ana...
[ "def", "GetAllPluginInformation", "(", "cls", ",", "show_all", "=", "True", ")", ":", "results", "=", "[", "]", "for", "plugin_class", "in", "iter", "(", "cls", ".", "_plugin_classes", ".", "values", "(", ")", ")", ":", "plugin_object", "=", "plugin_class"...
Retrieves a list of the registered analysis plugins. Args: show_all (Optional[bool]): True if all analysis plugin names should be listed. Returns: list[tuple[str, str, str]]: the name, docstring and type string of each analysis plugin in alphabetical order.
[ "Retrieves", "a", "list", "of", "the", "registered", "analysis", "plugins", "." ]
python
train
37.166667
AustralianSynchrotron/lightflow
lightflow/models/signal.py
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/signal.py#L131-L138
def send(self, response): """ Send a response back to the client that issued a request. Args: response (Response): Reference to the response object that should be sent. """ self._connection.connection.set('{}:{}'.format(SIGNAL_REDIS_PREFIX, response.uid), ...
[ "def", "send", "(", "self", ",", "response", ")", ":", "self", ".", "_connection", ".", "connection", ".", "set", "(", "'{}:{}'", ".", "format", "(", "SIGNAL_REDIS_PREFIX", ",", "response", ".", "uid", ")", ",", "pickle", ".", "dumps", "(", "response", ...
Send a response back to the client that issued a request. Args: response (Response): Reference to the response object that should be sent.
[ "Send", "a", "response", "back", "to", "the", "client", "that", "issued", "a", "request", "." ]
python
train
44.625
Microsoft/nni
src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L194-L211
def generate(self): """Generate the next neural architecture. Returns ------- other_info: any object Anything to be saved in the training queue together with the architecture. generated_graph: Graph An instance of Graph. """ generated_grap...
[ "def", "generate", "(", "self", ")", ":", "generated_graph", ",", "new_father_id", "=", "self", ".", "bo", ".", "generate", "(", "self", ".", "descriptors", ")", "if", "new_father_id", "is", "None", ":", "new_father_id", "=", "0", "generated_graph", "=", "...
Generate the next neural architecture. Returns ------- other_info: any object Anything to be saved in the training queue together with the architecture. generated_graph: Graph An instance of Graph.
[ "Generate", "the", "next", "neural", "architecture", "." ]
python
train
35.5
allenai/allennlp
allennlp/nn/util.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/nn/util.py#L792-L829
def combine_tensors_and_multiply(combination: str, tensors: List[torch.Tensor], weights: torch.nn.Parameter) -> torch.Tensor: """ Like :func:`combine_tensors`, but does a weighted (linear) multiplication while combining. This is a separate fu...
[ "def", "combine_tensors_and_multiply", "(", "combination", ":", "str", ",", "tensors", ":", "List", "[", "torch", ".", "Tensor", "]", ",", "weights", ":", "torch", ".", "nn", ".", "Parameter", ")", "->", "torch", ".", "Tensor", ":", "if", "len", "(", "...
Like :func:`combine_tensors`, but does a weighted (linear) multiplication while combining. This is a separate function from ``combine_tensors`` because we try to avoid instantiating large intermediate tensors during the combination, which is possible because we know that we're going to be multiplying by a w...
[ "Like", ":", "func", ":", "combine_tensors", "but", "does", "a", "weighted", "(", "linear", ")", "multiplication", "while", "combining", ".", "This", "is", "a", "separate", "function", "from", "combine_tensors", "because", "we", "try", "to", "avoid", "instanti...
python
train
51
pybel/pybel-tools
src/pybel_tools/dict_manager.py
https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/dict_manager.py#L39-L44
def get_graphs_by_ids(self, network_ids: Iterable[int]) -> List[BELGraph]: """Get several graphs by their identifiers.""" return [ self.networks[network_id] for network_id in network_ids ]
[ "def", "get_graphs_by_ids", "(", "self", ",", "network_ids", ":", "Iterable", "[", "int", "]", ")", "->", "List", "[", "BELGraph", "]", ":", "return", "[", "self", ".", "networks", "[", "network_id", "]", "for", "network_id", "in", "network_ids", "]" ]
Get several graphs by their identifiers.
[ "Get", "several", "graphs", "by", "their", "identifiers", "." ]
python
valid
38.5
edmondburnett/twitter-text-python
ttp/ttp.py
https://github.com/edmondburnett/twitter-text-python/blob/2a23ced35bfd34c4bc4b7148afd85771e9eb8669/ttp/ttp.py#L197-L211
def _parse_users(self, match): '''Parse usernames.''' # Don't parse lists here if match.group(2) is not None: return match.group(0) mat = match.group(0) if self._include_spans: self._users.append((mat[1:], match.span(0))) else: self._...
[ "def", "_parse_users", "(", "self", ",", "match", ")", ":", "# Don't parse lists here", "if", "match", ".", "group", "(", "2", ")", "is", "not", "None", ":", "return", "match", ".", "group", "(", "0", ")", "mat", "=", "match", ".", "group", "(", "0",...
Parse usernames.
[ "Parse", "usernames", "." ]
python
train
27.333333
noahbenson/neuropythy
neuropythy/vision/retinotopy.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/vision/retinotopy.py#L79-L96
def basic_retinotopy_data(hemi, retino_type): ''' basic_retinotopy_data(hemi, t) yields a numpy array of data for the given cortex object hemi and retinotopy type t; it does this by looking at the properties in hemi and picking out any combination that is commonly used to denote empirical retinotopy dat...
[ "def", "basic_retinotopy_data", "(", "hemi", ",", "retino_type", ")", ":", "dat", "=", "_retinotopy_names", "[", "retino_type", ".", "lower", "(", ")", "]", "val", "=", "next", "(", "(", "hemi", ".", "prop", "(", "s", ")", "for", "s", "in", "six", "....
basic_retinotopy_data(hemi, t) yields a numpy array of data for the given cortex object hemi and retinotopy type t; it does this by looking at the properties in hemi and picking out any combination that is commonly used to denote empirical retinotopy data. These common names are stored in _predicted_retinto...
[ "basic_retinotopy_data", "(", "hemi", "t", ")", "yields", "a", "numpy", "array", "of", "data", "for", "the", "given", "cortex", "object", "hemi", "and", "retinotopy", "type", "t", ";", "it", "does", "this", "by", "looking", "at", "the", "properties", "in",...
python
train
62.888889
NerdWalletOSS/savage
src/savage/api/data.py
https://github.com/NerdWalletOSS/savage/blob/54f64ac1c912528710365107952967d31d56e60d/src/savage/api/data.py#L147-L163
def _get_conditions(pk_conds, and_conds=None): """If and_conds = [a1, a2, ..., an] and pk_conds = [[b11, b12, ..., b1m], ... [bk1, ..., bkm]], this function will return the mysql condition clause: a1 & a2 & ... an & ((b11 and ... b1m) or ... (b11 and ... b1m)) :param pk_conds: a list of list of pri...
[ "def", "_get_conditions", "(", "pk_conds", ",", "and_conds", "=", "None", ")", ":", "if", "and_conds", "is", "None", ":", "and_conds", "=", "[", "]", "if", "len", "(", "and_conds", ")", "==", "0", "and", "len", "(", "pk_conds", ")", "==", "0", ":", ...
If and_conds = [a1, a2, ..., an] and pk_conds = [[b11, b12, ..., b1m], ... [bk1, ..., bkm]], this function will return the mysql condition clause: a1 & a2 & ... an & ((b11 and ... b1m) or ... (b11 and ... b1m)) :param pk_conds: a list of list of primary key constraints returned by _get_conditions_list ...
[ "If", "and_conds", "=", "[", "a1", "a2", "...", "an", "]", "and", "pk_conds", "=", "[[", "b11", "b12", "...", "b1m", "]", "...", "[", "bk1", "...", "bkm", "]]", "this", "function", "will", "return", "the", "mysql", "condition", "clause", ":", "a1", ...
python
train
41.764706
PSPC-SPAC-buyandsell/von_anchor
von_anchor/nodepool/protocol.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/nodepool/protocol.py#L110-L124
def txn2data(self, txn: dict) -> str: """ Given ledger transaction, return its data json. :param txn: transaction as dict :return: transaction data json """ rv_json = json.dumps({}) if self == Protocol.V_13: rv_json = json.dumps(txn['result'].get('da...
[ "def", "txn2data", "(", "self", ",", "txn", ":", "dict", ")", "->", "str", ":", "rv_json", "=", "json", ".", "dumps", "(", "{", "}", ")", "if", "self", "==", "Protocol", ".", "V_13", ":", "rv_json", "=", "json", ".", "dumps", "(", "txn", "[", "...
Given ledger transaction, return its data json. :param txn: transaction as dict :return: transaction data json
[ "Given", "ledger", "transaction", "return", "its", "data", "json", "." ]
python
train
31.466667
PBR/MQ2
MQ2/plugins/xls_plugin.py
https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/plugins/xls_plugin.py#L66-L87
def read_excel_file(inputfile, sheet_name): """ Return a matrix containing all the information present in the excel sheet of the specified excel document. :arg inputfile: excel document to read :arg sheetname: the name of the excel sheet to return """ workbook = xlrd.open_workbook(inputfile) ...
[ "def", "read_excel_file", "(", "inputfile", ",", "sheet_name", ")", ":", "workbook", "=", "xlrd", ".", "open_workbook", "(", "inputfile", ")", "output", "=", "[", "]", "found", "=", "False", "for", "sheet", "in", "workbook", ".", "sheets", "(", ")", ":",...
Return a matrix containing all the information present in the excel sheet of the specified excel document. :arg inputfile: excel document to read :arg sheetname: the name of the excel sheet to return
[ "Return", "a", "matrix", "containing", "all", "the", "information", "present", "in", "the", "excel", "sheet", "of", "the", "specified", "excel", "document", "." ]
python
train
34.954545
Azure/azure-cli-extensions
src/alias/azext_alias/_validators.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/alias/azext_alias/_validators.py#L209-L239
def _validate_positional_arguments(args): """ To validate the positional argument feature - https://github.com/Azure/azure-cli/pull/6055. Assuming that unknown commands are positional arguments immediately led by words that only appear at the end of the commands Slight modification of https://g...
[ "def", "_validate_positional_arguments", "(", "args", ")", ":", "nouns", "=", "[", "]", "for", "arg", "in", "args", ":", "if", "not", "arg", ".", "startswith", "(", "'-'", ")", "or", "not", "arg", ".", "startswith", "(", "'{{'", ")", ":", "nouns", "....
To validate the positional argument feature - https://github.com/Azure/azure-cli/pull/6055. Assuming that unknown commands are positional arguments immediately led by words that only appear at the end of the commands Slight modification of https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/...
[ "To", "validate", "the", "positional", "argument", "feature", "-", "https", ":", "//", "github", ".", "com", "/", "Azure", "/", "azure", "-", "cli", "/", "pull", "/", "6055", ".", "Assuming", "that", "unknown", "commands", "are", "positional", "arguments",...
python
train
34.483871
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/signals/handlers.py
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L11-L28
def create_entry_tag(sender, instance, created, **kwargs): """ Creates EntryTag for Entry corresponding to specified ItemBase instance. :param sender: the sending ItemBase class. :param instance: the ItemBase instance. """ from ..models import ( Entry, EntryTag ) en...
[ "def", "create_entry_tag", "(", "sender", ",", "instance", ",", "created", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "(", "Entry", ",", "EntryTag", ")", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "i...
Creates EntryTag for Entry corresponding to specified ItemBase instance. :param sender: the sending ItemBase class. :param instance: the ItemBase instance.
[ "Creates", "EntryTag", "for", "Entry", "corresponding", "to", "specified", "ItemBase", "instance", "." ]
python
train
28.611111
pyblish/pyblish-qml
pyblish_qml/ipc/formatting.py
https://github.com/pyblish/pyblish-qml/blob/6095d18b2ec0afd0409a9b1a17e53b0658887283/pyblish_qml/ipc/formatting.py#L27-L50
def format_result(result): """Serialise Result""" instance = None error = None if result["instance"] is not None: instance = format_instance(result["instance"]) if result["error"] is not None: error = format_error(result["error"]) result = { "success": result["success"...
[ "def", "format_result", "(", "result", ")", ":", "instance", "=", "None", "error", "=", "None", "if", "result", "[", "\"instance\"", "]", "is", "not", "None", ":", "instance", "=", "format_instance", "(", "result", "[", "\"instance\"", "]", ")", "if", "r...
Serialise Result
[ "Serialise", "Result" ]
python
train
24.958333
gisgroup/statbank-python
statbank/request.py
https://github.com/gisgroup/statbank-python/blob/3678820d8da35f225d706ea5096c1f08bf0b9c68/statbank/request.py#L50-L59
def csv(self): """Parse raw response as csv and return row object list. """ lines = self._parsecsv(self.raw) # set keys from header line (first line) keys = next(lines) for line in lines: yield dict(zip(keys, line))
[ "def", "csv", "(", "self", ")", ":", "lines", "=", "self", ".", "_parsecsv", "(", "self", ".", "raw", ")", "# set keys from header line (first line)", "keys", "=", "next", "(", "lines", ")", "for", "line", "in", "lines", ":", "yield", "dict", "(", "zip",...
Parse raw response as csv and return row object list.
[ "Parse", "raw", "response", "as", "csv", "and", "return", "row", "object", "list", "." ]
python
train
26.8
HiPERCAM/hcam_widgets
hcam_widgets/misc.py
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L535-L554
def getFrameNumber(g): """ Polls the data server to find the current frame number. Throws an exceotion if it cannot determine it. """ if not g.cpars['hcam_server_on']: raise DriverError('getRunNumber error: servers are not active') url = g.cpars['hipercam_server'] + 'status/DET.FRAM2.NO...
[ "def", "getFrameNumber", "(", "g", ")", ":", "if", "not", "g", ".", "cpars", "[", "'hcam_server_on'", "]", ":", "raise", "DriverError", "(", "'getRunNumber error: servers are not active'", ")", "url", "=", "g", ".", "cpars", "[", "'hipercam_server'", "]", "+",...
Polls the data server to find the current frame number. Throws an exceotion if it cannot determine it.
[ "Polls", "the", "data", "server", "to", "find", "the", "current", "frame", "number", "." ]
python
train
33.55
awslabs/sockeye
sockeye/utils.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/utils.py#L940-L951
def cast_conditionally(data: mx.sym.Symbol, dtype: str) -> mx.sym.Symbol: """ Workaround until no-op cast will be fixed in MXNet codebase. Creates cast symbol only if dtype is different from default one, i.e. float32. :param data: Input symbol. :param dtype: Target dtype. :return: Cast symbol o...
[ "def", "cast_conditionally", "(", "data", ":", "mx", ".", "sym", ".", "Symbol", ",", "dtype", ":", "str", ")", "->", "mx", ".", "sym", ".", "Symbol", ":", "if", "dtype", "!=", "C", ".", "DTYPE_FP32", ":", "return", "mx", ".", "sym", ".", "cast", ...
Workaround until no-op cast will be fixed in MXNet codebase. Creates cast symbol only if dtype is different from default one, i.e. float32. :param data: Input symbol. :param dtype: Target dtype. :return: Cast symbol or just data symbol.
[ "Workaround", "until", "no", "-", "op", "cast", "will", "be", "fixed", "in", "MXNet", "codebase", ".", "Creates", "cast", "symbol", "only", "if", "dtype", "is", "different", "from", "default", "one", "i", ".", "e", ".", "float32", "." ]
python
train
36.083333
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L16-L42
def _get_value(scikit_value, mode = 'regressor', scaling = 1.0, n_classes = 2, tree_index = 0): """ Get the right value from the scikit-tree """ # Regression if mode == 'regressor': return scikit_value[0] * scaling # Binary classification if n_classes == 2: # Decision tree ...
[ "def", "_get_value", "(", "scikit_value", ",", "mode", "=", "'regressor'", ",", "scaling", "=", "1.0", ",", "n_classes", "=", "2", ",", "tree_index", "=", "0", ")", ":", "# Regression", "if", "mode", "==", "'regressor'", ":", "return", "scikit_value", "[",...
Get the right value from the scikit-tree
[ "Get", "the", "right", "value", "from", "the", "scikit", "-", "tree" ]
python
train
30.444444
ffalcinelli/pydivert
pydivert/packet/__init__.py
https://github.com/ffalcinelli/pydivert/blob/f75eba4126c527b5a43ace0a49369c7479cf5ee8/pydivert/packet/__init__.py#L186-L193
def icmpv6(self): """ - An ICMPv6Header instance, if the packet is valid ICMPv6. - None, otherwise. """ ipproto, proto_start = self.protocol if ipproto == Protocol.ICMPV6: return ICMPv6Header(self, proto_start)
[ "def", "icmpv6", "(", "self", ")", ":", "ipproto", ",", "proto_start", "=", "self", ".", "protocol", "if", "ipproto", "==", "Protocol", ".", "ICMPV6", ":", "return", "ICMPv6Header", "(", "self", ",", "proto_start", ")" ]
- An ICMPv6Header instance, if the packet is valid ICMPv6. - None, otherwise.
[ "-", "An", "ICMPv6Header", "instance", "if", "the", "packet", "is", "valid", "ICMPv6", ".", "-", "None", "otherwise", "." ]
python
train
32.875
aestrivex/bctpy
bct/utils/visualization.py
https://github.com/aestrivex/bctpy/blob/4cb0e759eb4a038750b07e23bd29958c400684b8/bct/utils/visualization.py#L602-L742
def reorder_mod(A, ci): ''' This function reorders the connectivity matrix by modular structure and may hence be useful in visualization of modular structure. Parameters ---------- A : NxN np.ndarray binary/weighted connectivity matrix ci : Nx1 np.ndarray module affiliation ...
[ "def", "reorder_mod", "(", "A", ",", "ci", ")", ":", "# TODO update function with 2015 changes", "from", "scipy", "import", "stats", "_", ",", "max_module_size", "=", "stats", ".", "mode", "(", "ci", ")", "u", ",", "ci", "=", "np", ".", "unique", "(", "c...
This function reorders the connectivity matrix by modular structure and may hence be useful in visualization of modular structure. Parameters ---------- A : NxN np.ndarray binary/weighted connectivity matrix ci : Nx1 np.ndarray module affiliation vector Returns ------- ...
[ "This", "function", "reorders", "the", "connectivity", "matrix", "by", "modular", "structure", "and", "may", "hence", "be", "useful", "in", "visualization", "of", "modular", "structure", "." ]
python
train
32.425532
SoCo/SoCo
soco/groups.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/groups.py#L106-L116
def short_label(self): """str: A short description of the group. >>> device.group.short_label 'Kitchen + 1' """ group_names = sorted([m.player_name for m in self.members]) group_label = group_names[0] if len(group_names) > 1: group_label += " + {}".fo...
[ "def", "short_label", "(", "self", ")", ":", "group_names", "=", "sorted", "(", "[", "m", ".", "player_name", "for", "m", "in", "self", ".", "members", "]", ")", "group_label", "=", "group_names", "[", "0", "]", "if", "len", "(", "group_names", ")", ...
str: A short description of the group. >>> device.group.short_label 'Kitchen + 1'
[ "str", ":", "A", "short", "description", "of", "the", "group", "." ]
python
train
33
peopledoc/workalendar
workalendar/core.py
https://github.com/peopledoc/workalendar/blob/d044d5dfc1709ec388db34dab583dd554cc66c4e/workalendar/core.py#L105-L107
def holidays_set(self, year=None): "Return a quick date index (set)" return set([day for day, label in self.holidays(year)])
[ "def", "holidays_set", "(", "self", ",", "year", "=", "None", ")", ":", "return", "set", "(", "[", "day", "for", "day", ",", "label", "in", "self", ".", "holidays", "(", "year", ")", "]", ")" ]
Return a quick date index (set)
[ "Return", "a", "quick", "date", "index", "(", "set", ")" ]
python
train
46
chop-dbhi/varify-data-warehouse
vdw/samples/migrations/0003_remap_names_and_labels.py
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/samples/migrations/0003_remap_names_and_labels.py#L10-L14
def forwards(self, orm): "Write your forwards methods here." orm.Project.objects.update(label=F('name')) orm.Cohort.objects.update(label=F('name')) orm.Sample.objects.update(name=F('label'))
[ "def", "forwards", "(", "self", ",", "orm", ")", ":", "orm", ".", "Project", ".", "objects", ".", "update", "(", "label", "=", "F", "(", "'name'", ")", ")", "orm", ".", "Cohort", ".", "objects", ".", "update", "(", "label", "=", "F", "(", "'name'...
Write your forwards methods here.
[ "Write", "your", "forwards", "methods", "here", "." ]
python
train
43.6
gmr/tinman
tinman/serializers.py
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/serializers.py#L92-L99
def serialize(self, data): """Return the data as serialized string. :param dict data: The data to serialize :rtype: str """ return json.dumps(self._serialize_datetime(data), ensure_ascii=False)
[ "def", "serialize", "(", "self", ",", "data", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "_serialize_datetime", "(", "data", ")", ",", "ensure_ascii", "=", "False", ")" ]
Return the data as serialized string. :param dict data: The data to serialize :rtype: str
[ "Return", "the", "data", "as", "serialized", "string", "." ]
python
train
28.5
bitesofcode/projexui
projexui/widgets/xorbrecordbox.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbrecordbox.py#L951-L967
def setVisible(self, state): """ Sets the visibility for this record box. :param state | <bool> """ super(XOrbRecordBox, self).setVisible(state) if state and not self._loaded: if self.autoInitialize(): table = s...
[ "def", "setVisible", "(", "self", ",", "state", ")", ":", "super", "(", "XOrbRecordBox", ",", "self", ")", ".", "setVisible", "(", "state", ")", "if", "state", "and", "not", "self", ".", "_loaded", ":", "if", "self", ".", "autoInitialize", "(", ")", ...
Sets the visibility for this record box. :param state | <bool>
[ "Sets", "the", "visibility", "for", "this", "record", "box", ".", ":", "param", "state", "|", "<bool", ">" ]
python
train
30.764706
materialsproject/pymatgen
pymatgen/core/lattice.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L779-L926
def get_niggli_reduced_lattice(self, tol: float = 1e-5) -> "Lattice": """ Get the Niggli reduced lattice using the numerically stable algo proposed by R. W. Grosse-Kunstleve, N. K. Sauter, & P. D. Adams, Acta Crystallographica Section A Foundations of Crystallography, 2003, 60(1)...
[ "def", "get_niggli_reduced_lattice", "(", "self", ",", "tol", ":", "float", "=", "1e-5", ")", "->", "\"Lattice\"", ":", "# lll reduction is more stable for skewed cells", "matrix", "=", "self", ".", "lll_matrix", "a", "=", "matrix", "[", "0", "]", "b", "=", "m...
Get the Niggli reduced lattice using the numerically stable algo proposed by R. W. Grosse-Kunstleve, N. K. Sauter, & P. D. Adams, Acta Crystallographica Section A Foundations of Crystallography, 2003, 60(1), 1-6. doi:10.1107/S010876730302186X Args: tol (float): The numerical...
[ "Get", "the", "Niggli", "reduced", "lattice", "using", "the", "numerically", "stable", "algo", "proposed", "by", "R", ".", "W", ".", "Grosse", "-", "Kunstleve", "N", ".", "K", ".", "Sauter", "&", "P", ".", "D", ".", "Adams", "Acta", "Crystallographica", ...
python
train
32.391892
venthur/python-debianbts
debianbts/debianbts.py
https://github.com/venthur/python-debianbts/blob/72cf11ae3458a8544142e9f365aaafe25634dd4f/debianbts/debianbts.py#L511-L521
def _soap_client_call(method_name, *args): """Wrapper to call SoapClient method""" # a new client instance is built for threading issues soap_client = _build_soap_client() soap_args = _convert_soap_method_args(*args) # if pysimplesoap version requires it, apply a workaround for # https://github....
[ "def", "_soap_client_call", "(", "method_name", ",", "*", "args", ")", ":", "# a new client instance is built for threading issues", "soap_client", "=", "_build_soap_client", "(", ")", "soap_args", "=", "_convert_soap_method_args", "(", "*", "args", ")", "# if pysimplesoa...
Wrapper to call SoapClient method
[ "Wrapper", "to", "call", "SoapClient", "method" ]
python
train
47.454545
python-openxml/python-docx
docx/table.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L99-L106
def row_cells(self, row_idx): """ Sequence of cells in the row at *row_idx* in this table. """ column_count = self._column_count start = row_idx * column_count end = start + column_count return self._cells[start:end]
[ "def", "row_cells", "(", "self", ",", "row_idx", ")", ":", "column_count", "=", "self", ".", "_column_count", "start", "=", "row_idx", "*", "column_count", "end", "=", "start", "+", "column_count", "return", "self", ".", "_cells", "[", "start", ":", "end",...
Sequence of cells in the row at *row_idx* in this table.
[ "Sequence", "of", "cells", "in", "the", "row", "at", "*", "row_idx", "*", "in", "this", "table", "." ]
python
train
33.125
Jajcus/pyxmpp2
pyxmpp2/iq.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/iq.py#L131-L143
def make_result_response(self): """Create result response for the a "get" or "set" iq stanza. :return: new `Iq` object with the same "id" as self, "from" and "to" attributes replaced and type="result". :returntype: `Iq`""" if self.stanza_type not in ("set", "get"): ...
[ "def", "make_result_response", "(", "self", ")", ":", "if", "self", ".", "stanza_type", "not", "in", "(", "\"set\"", ",", "\"get\"", ")", ":", "raise", "ValueError", "(", "\"Results may only be generated for\"", "\" 'set' or 'get' iq\"", ")", "stanza", "=", "Iq", ...
Create result response for the a "get" or "set" iq stanza. :return: new `Iq` object with the same "id" as self, "from" and "to" attributes replaced and type="result". :returntype: `Iq`
[ "Create", "result", "response", "for", "the", "a", "get", "or", "set", "iq", "stanza", "." ]
python
valid
46.769231
Gandi/gandi.cli
gandi/cli/modules/hostedcert.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/hostedcert.py#L44-L59
def infos(cls, fqdn): """ Display information about hosted certificates for a fqdn. """ if isinstance(fqdn, (list, tuple)): ids = [] for fqd_ in fqdn: ids.extend(cls.infos(fqd_)) return ids ids = cls.usable_id(fqdn) if not ids: ...
[ "def", "infos", "(", "cls", ",", "fqdn", ")", ":", "if", "isinstance", "(", "fqdn", ",", "(", "list", ",", "tuple", ")", ")", ":", "ids", "=", "[", "]", "for", "fqd_", "in", "fqdn", ":", "ids", ".", "extend", "(", "cls", ".", "infos", "(", "f...
Display information about hosted certificates for a fqdn.
[ "Display", "information", "about", "hosted", "certificates", "for", "a", "fqdn", "." ]
python
train
27.375
wmayner/pyphi
pyphi/memory.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/memory.py#L18-L39
def cache(ignore=None): """Decorator for memoizing a function using either the filesystem or a database. """ def decorator(func): # Initialize both cached versions joblib_cached = constants.joblib_memory.cache(func, ignore=ignore) db_cached = DbMemoizedFunc(func, ignore) ...
[ "def", "cache", "(", "ignore", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "# Initialize both cached versions", "joblib_cached", "=", "constants", ".", "joblib_memory", ".", "cache", "(", "func", ",", "ignore", "=", "ignore", ")", "db_c...
Decorator for memoizing a function using either the filesystem or a database.
[ "Decorator", "for", "memoizing", "a", "function", "using", "either", "the", "filesystem", "or", "a", "database", "." ]
python
train
35.090909
bskinn/opan
opan/utils/symm.py
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L42-L68
def point_displ(pt1, pt2): """ Calculate the displacement vector between two n-D points. pt1 - pt2 .. todo:: Complete point_disp docstring """ #Imports import numpy as np # Make iterable if not np.iterable(pt1): pt1 = np.float64(np.array([pt1])) else: pt1 = np.fl...
[ "def", "point_displ", "(", "pt1", ",", "pt2", ")", ":", "#Imports", "import", "numpy", "as", "np", "# Make iterable", "if", "not", "np", ".", "iterable", "(", "pt1", ")", ":", "pt1", "=", "np", ".", "float64", "(", "np", ".", "array", "(", "[", "pt...
Calculate the displacement vector between two n-D points. pt1 - pt2 .. todo:: Complete point_disp docstring
[ "Calculate", "the", "displacement", "vector", "between", "two", "n", "-", "D", "points", "." ]
python
train
22.592593
pgjones/hypercorn
hypercorn/asgi/h11.py
https://github.com/pgjones/hypercorn/blob/ef93d741fe246846a127f9318b54505ac65f1ae7/hypercorn/asgi/h11.py#L123-L151
async def asgi_send(self, message: dict) -> None: """Called by the ASGI instance to send a message.""" if message["type"] == "http.response.start" and self.state == ASGIHTTPState.REQUEST: self.response = message elif message["type"] == "http.response.body" and self.state in { ...
[ "async", "def", "asgi_send", "(", "self", ",", "message", ":", "dict", ")", "->", "None", ":", "if", "message", "[", "\"type\"", "]", "==", "\"http.response.start\"", "and", "self", ".", "state", "==", "ASGIHTTPState", ".", "REQUEST", ":", "self", ".", "...
Called by the ASGI instance to send a message.
[ "Called", "by", "the", "ASGI", "instance", "to", "send", "a", "message", "." ]
python
test
46.862069
ihmeuw/vivarium
src/vivarium/framework/randomness.py
https://github.com/ihmeuw/vivarium/blob/c5f5d50f775c8bf337d3aae1ff7c57c025a8e258/src/vivarium/framework/randomness.py#L152-L154
def digit(m: Union[int, pd.Series], n: int) -> Union[int, pd.Series]: """Returns the nth digit of each number in m.""" return (m // (10 ** n)) % 10
[ "def", "digit", "(", "m", ":", "Union", "[", "int", ",", "pd", ".", "Series", "]", ",", "n", ":", "int", ")", "->", "Union", "[", "int", ",", "pd", ".", "Series", "]", ":", "return", "(", "m", "//", "(", "10", "**", "n", ")", ")", "%", "1...
Returns the nth digit of each number in m.
[ "Returns", "the", "nth", "digit", "of", "each", "number", "in", "m", "." ]
python
train
53.666667
orangain/scrapy-s3pipeline
s3pipeline/pipelines.py
https://github.com/orangain/scrapy-s3pipeline/blob/6301a3a057da6407b04a09c717498026f88706a4/s3pipeline/pipelines.py#L45-L54
def process_item(self, item, spider): """ Process single item. Add item to items and then upload to S3 if size of items >= max_chunk_size. """ self.items.append(item) if len(self.items) >= self.max_chunk_size: self._upload_chunk(spider) return item
[ "def", "process_item", "(", "self", ",", "item", ",", "spider", ")", ":", "self", ".", "items", ".", "append", "(", "item", ")", "if", "len", "(", "self", ".", "items", ")", ">=", "self", ".", "max_chunk_size", ":", "self", ".", "_upload_chunk", "(",...
Process single item. Add item to items and then upload to S3 if size of items >= max_chunk_size.
[ "Process", "single", "item", ".", "Add", "item", "to", "items", "and", "then", "upload", "to", "S3", "if", "size", "of", "items", ">", "=", "max_chunk_size", "." ]
python
test
30.8
tmr232/Sark
sark/ui.py
https://github.com/tmr232/Sark/blob/bee62879c2aea553a3924d887e2b30f2a6008581/sark/ui.py#L276-L282
def _get_handling_triplet(self, node_id): """_get_handling_triplet(node_id) -> (handler, value, attrs)""" handler = self._get_handler(node_id) value = self[node_id] attrs = self._get_attrs(node_id) return handler, value, attrs
[ "def", "_get_handling_triplet", "(", "self", ",", "node_id", ")", ":", "handler", "=", "self", ".", "_get_handler", "(", "node_id", ")", "value", "=", "self", "[", "node_id", "]", "attrs", "=", "self", ".", "_get_attrs", "(", "node_id", ")", "return", "h...
_get_handling_triplet(node_id) -> (handler, value, attrs)
[ "_get_handling_triplet", "(", "node_id", ")", "-", ">", "(", "handler", "value", "attrs", ")" ]
python
train
37.285714
IS-ENES-Data/esgf-pid
esgfpid/utils/timeutils.py
https://github.com/IS-ENES-Data/esgf-pid/blob/2f4909bb3ff79c0b6ed2932e0dd8b3bb6aec5e41/esgfpid/utils/timeutils.py#L10-L27
def get_now_utc(): ''' date in UTC, ISO format''' # Helper class for UTC time # Source: http://stackoverflow.com/questions/2331592/datetime-datetime-utcnow-why-no-tzinfo ZERO = datetime.timedelta(0) class UTC(datetime.tzinfo): """UTC""" def utcoffset(self, dt): return ZE...
[ "def", "get_now_utc", "(", ")", ":", "# Helper class for UTC time", "# Source: http://stackoverflow.com/questions/2331592/datetime-datetime-utcnow-why-no-tzinfo", "ZERO", "=", "datetime", ".", "timedelta", "(", "0", ")", "class", "UTC", "(", "datetime", ".", "tzinfo", ")", ...
date in UTC, ISO format
[ "date", "in", "UTC", "ISO", "format" ]
python
train
29.222222
limodou/uliweb
uliweb/orm/__init__.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/orm/__init__.py#L2661-L2669
def count(self): """ If result is True, then the count will process result set , if result if False, then only use condition to count """ if self._group_by or self._join or self.distinct_field: return self.do_(self.get_query().limit(None).order_by(None).offset(None).a...
[ "def", "count", "(", "self", ")", ":", "if", "self", ".", "_group_by", "or", "self", ".", "_join", "or", "self", ".", "distinct_field", ":", "return", "self", ".", "do_", "(", "self", ".", "get_query", "(", ")", ".", "limit", "(", "None", ")", ".",...
If result is True, then the count will process result set , if result if False, then only use condition to count
[ "If", "result", "is", "True", "then", "the", "count", "will", "process", "result", "set", "if", "result", "if", "False", "then", "only", "use", "condition", "to", "count" ]
python
train
53.222222
samdobson/image_slicer
image_slicer/main.py
https://github.com/samdobson/image_slicer/blob/54ec036f73862085156e0544fe30e61a509c06d2/image_slicer/main.py#L120-L168
def slice(filename, number_tiles=None, col=None, row=None, save=True): """ Split an image into a specified number of tiles. Args: filename (str): The filename of the image to split. number_tiles (int): The number of tiles required. Kwargs: save (bool): Whether or not to save til...
[ "def", "slice", "(", "filename", ",", "number_tiles", "=", "None", ",", "col", "=", "None", ",", "row", "=", "None", ",", "save", "=", "True", ")", ":", "im", "=", "Image", ".", "open", "(", "filename", ")", "im_w", ",", "im_h", "=", "im", ".", ...
Split an image into a specified number of tiles. Args: filename (str): The filename of the image to split. number_tiles (int): The number of tiles required. Kwargs: save (bool): Whether or not to save tiles to disk. Returns: Tuple of :class:`Tile` instances.
[ "Split", "an", "image", "into", "a", "specified", "number", "of", "tiles", "." ]
python
train
31.306122
istresearch/scrapy-cluster
rest/rest_service.py
https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/rest/rest_service.py#L540-L565
def _feed_to_kafka(self, json_item): """Sends a request to Kafka :param json_item: The json item to send :returns: A boolean indicating whther the data was sent successfully or not """ @MethodTimer.timeout(self.settings['KAFKA_FEED_TIMEOUT'], False) def _feed(json_item):...
[ "def", "_feed_to_kafka", "(", "self", ",", "json_item", ")", ":", "@", "MethodTimer", ".", "timeout", "(", "self", ".", "settings", "[", "'KAFKA_FEED_TIMEOUT'", "]", ",", "False", ")", "def", "_feed", "(", "json_item", ")", ":", "try", ":", "self", ".", ...
Sends a request to Kafka :param json_item: The json item to send :returns: A boolean indicating whther the data was sent successfully or not
[ "Sends", "a", "request", "to", "Kafka" ]
python
train
37.615385
peri-source/peri
peri/opt/optimize.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L1414-L1418
def update_function(self, param_vals): """Takes an array param_vals, updates function, returns the new error""" self.model = self.func(param_vals, *self.func_args, **self.func_kwargs) d = self.calc_residuals() return np.dot(d.flat, d.flat)
[ "def", "update_function", "(", "self", ",", "param_vals", ")", ":", "self", ".", "model", "=", "self", ".", "func", "(", "param_vals", ",", "*", "self", ".", "func_args", ",", "*", "*", "self", ".", "func_kwargs", ")", "d", "=", "self", ".", "calc_re...
Takes an array param_vals, updates function, returns the new error
[ "Takes", "an", "array", "param_vals", "updates", "function", "returns", "the", "new", "error" ]
python
valid
53.4
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L644-L656
def iter_entry_points(self, group, name=None): """Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution ord...
[ "def", "iter_entry_points", "(", "self", ",", "group", ",", "name", "=", "None", ")", ":", "return", "(", "entry", "for", "dist", "in", "self", "for", "entry", "in", "dist", ".", "get_entry_map", "(", "group", ")", ".", "values", "(", ")", "if", "nam...
Yield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution order).
[ "Yield", "entry", "point", "objects", "from", "group", "matching", "name" ]
python
train
39.076923
waqasbhatti/astrobase
astrobase/periodbase/spdm.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/spdm.py#L71-L141
def stellingwerf_pdm_theta(times, mags, errs, frequency, binsize=0.05, minbin=9): ''' This calculates the Stellingwerf PDM theta value at a test frequency. Parameters ---------- times,mags,errs : np.array The input time-series and associated errors. frequenc...
[ "def", "stellingwerf_pdm_theta", "(", "times", ",", "mags", ",", "errs", ",", "frequency", ",", "binsize", "=", "0.05", ",", "minbin", "=", "9", ")", ":", "period", "=", "1.0", "/", "frequency", "fold_time", "=", "times", "[", "0", "]", "phased", "=", ...
This calculates the Stellingwerf PDM theta value at a test frequency. Parameters ---------- times,mags,errs : np.array The input time-series and associated errors. frequency : float The test frequency to calculate the theta statistic at. binsize : float The phase bin size...
[ "This", "calculates", "the", "Stellingwerf", "PDM", "theta", "value", "at", "a", "test", "frequency", "." ]
python
valid
25.394366
inasafe/inasafe
safe/impact_function/impact_function.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L1223-L1257
def _compute_output_layer_expected(self): """Compute output layers expected that the IF will produce. Be careful when you call this function. It's a private function, better to use the public function `output_layers_expected()`. :return: List of expected layer keys. :rtype: lis...
[ "def", "_compute_output_layer_expected", "(", "self", ")", ":", "# Actually, an IF can produce maximum 6 layers, by default.", "expected", "=", "[", "layer_purpose_exposure_summary", "[", "'key'", "]", ",", "# 1", "layer_purpose_aggregate_hazard_impacted", "[", "'key'", "]", ...
Compute output layers expected that the IF will produce. Be careful when you call this function. It's a private function, better to use the public function `output_layers_expected()`. :return: List of expected layer keys. :rtype: list
[ "Compute", "output", "layers", "expected", "that", "the", "IF", "will", "produce", "." ]
python
train
46.057143
saltstack/salt
salt/modules/pkgin.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L320-L341
def list_upgrades(refresh=True, **kwargs): ''' List all available package upgrades. .. versionadded:: 2018.3.0 refresh Whether or not to refresh the package database before installing. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades ''' pkgs = {} for...
[ "def", "list_upgrades", "(", "refresh", "=", "True", ",", "*", "*", "kwargs", ")", ":", "pkgs", "=", "{", "}", "for", "pkg", "in", "sorted", "(", "list_pkgs", "(", "refresh", "=", "refresh", ")", ".", "keys", "(", ")", ")", ":", "# NOTE: we already o...
List all available package upgrades. .. versionadded:: 2018.3.0 refresh Whether or not to refresh the package database before installing. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades
[ "List", "all", "available", "package", "upgrades", "." ]
python
train
25
coded-by-hand/mass
env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/util.py
https://github.com/coded-by-hand/mass/blob/59005479efed3cd8598a8f0c66791a4482071899/env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/util.py#L98-L103
def get_pathext(default_pathext=None): """Returns the path extensions from environment or a default""" if default_pathext is None: default_pathext = os.pathsep.join([ '.COM', '.EXE', '.BAT', '.CMD' ]) pathext = os.environ.get('PATHEXT', default_pathext) return pathext
[ "def", "get_pathext", "(", "default_pathext", "=", "None", ")", ":", "if", "default_pathext", "is", "None", ":", "default_pathext", "=", "os", ".", "pathsep", ".", "join", "(", "[", "'.COM'", ",", "'.EXE'", ",", "'.BAT'", ",", "'.CMD'", "]", ")", "pathex...
Returns the path extensions from environment or a default
[ "Returns", "the", "path", "extensions", "from", "environment", "or", "a", "default" ]
python
train
47.833333
quantumlib/Cirq
cirq/linalg/transformations.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/linalg/transformations.py#L152-L201
def targeted_conjugate_about(tensor: np.ndarray, target: np.ndarray, indices: Sequence[int], conj_indices: Sequence[int] = None, buffer: Optional[np.ndarray] = None, out: Opti...
[ "def", "targeted_conjugate_about", "(", "tensor", ":", "np", ".", "ndarray", ",", "target", ":", "np", ".", "ndarray", ",", "indices", ":", "Sequence", "[", "int", "]", ",", "conj_indices", ":", "Sequence", "[", "int", "]", "=", "None", ",", "buffer", ...
r"""Conjugates the given tensor about the target tensor. This method computes a target tensor conjugated by another tensor. Here conjugate is used in the sense of conjugating by a matrix, i.a. A conjugated about B is $A B A^\dagger$ where $\dagger$ represents the conjugate transpose. Abstractly th...
[ "r", "Conjugates", "the", "given", "tensor", "about", "the", "target", "tensor", "." ]
python
train
51.2
radjkarl/fancyWidgets
fancywidgets/pyQtBased/CodeEditor.py
https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/CodeEditor.py#L349-L376
def _updateNumbers(self, linenumers): """ add/remove line numbers """ b = self.blockCount() c = b - linenumers if c > 0: # remove lines numbers for _ in range(c): # remove last line: self.setFocus() s...
[ "def", "_updateNumbers", "(", "self", ",", "linenumers", ")", ":", "b", "=", "self", ".", "blockCount", "(", ")", "c", "=", "b", "-", "linenumers", "if", "c", ">", "0", ":", "# remove lines numbers", "for", "_", "in", "range", "(", "c", ")", ":", "...
add/remove line numbers
[ "add", "/", "remove", "line", "numbers" ]
python
train
36.035714
mwgielen/jackal
jackal/core.py
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L495-L519
def find_object(self, username, secret, domain=None, host_ip=None, service_id=None): """ Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id. """ # Not sure yet if this is advisable... Older passwords can be overwritten... ...
[ "def", "find_object", "(", "self", ",", "username", ",", "secret", ",", "domain", "=", "None", ",", "host_ip", "=", "None", ",", "service_id", "=", "None", ")", ":", "# Not sure yet if this is advisable... Older passwords can be overwritten...", "search", "=", "Cred...
Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id.
[ "Searches", "elasticsearch", "for", "objects", "with", "the", "same", "username", "password", "optional", "domain", "host_ip", "and", "service_id", "." ]
python
valid
42.16
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/style_sheet.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/style_sheet.py#L86-L95
def get_instance(self, payload): """ Build an instance of StyleSheetInstance :param dict payload: Payload response from the API :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance ...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "StyleSheetInstance", "(", "self", ".", "_version", ",", "payload", ",", "assistant_sid", "=", "self", ".", "_solution", "[", "'assistant_sid'", "]", ",", ")" ]
Build an instance of StyleSheetInstance :param dict payload: Payload response from the API :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance
[ "Build", "an", "instance", "of", "StyleSheetInstance" ]
python
train
42.9
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L389-L396
def mag_discrepancy(RAW_IMU, ATTITUDE, inclination, declination=None): '''give the magnitude of the discrepancy between observed and expected magnetic field''' if declination is None: import mavutil declination = degrees(mavutil.mavfile_global.param('COMPASS_DEC', 0)) expected = expected_mag...
[ "def", "mag_discrepancy", "(", "RAW_IMU", ",", "ATTITUDE", ",", "inclination", ",", "declination", "=", "None", ")", ":", "if", "declination", "is", "None", ":", "import", "mavutil", "declination", "=", "degrees", "(", "mavutil", ".", "mavfile_global", ".", ...
give the magnitude of the discrepancy between observed and expected magnetic field
[ "give", "the", "magnitude", "of", "the", "discrepancy", "between", "observed", "and", "expected", "magnetic", "field" ]
python
train
57.25
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L9187-L9217
def metaseries_description_metadata(description): """Return metatata from MetaSeries image description as dict.""" if not description.startswith('<MetaData>'): raise ValueError('invalid MetaSeries image description') from xml.etree import cElementTree as etree # delayed import root = etree.fro...
[ "def", "metaseries_description_metadata", "(", "description", ")", ":", "if", "not", "description", ".", "startswith", "(", "'<MetaData>'", ")", ":", "raise", "ValueError", "(", "'invalid MetaSeries image description'", ")", "from", "xml", ".", "etree", "import", "c...
Return metatata from MetaSeries image description as dict.
[ "Return", "metatata", "from", "MetaSeries", "image", "description", "as", "dict", "." ]
python
train
34.419355
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L3973-L3995
def get_assessments(self): """Gets all ``Assessments``. In plenary mode, the returned list contains all known assessments or an error results. Otherwise, the returned list may contain only those assessments that are accessible through this session. return: (osid.assessm...
[ "def", "get_assessments", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'assessment'", ",", "collection", "...
Gets all ``Assessments``. In plenary mode, the returned list contains all known assessments or an error results. Otherwise, the returned list may contain only those assessments that are accessible through this session. return: (osid.assessment.AssessmentList) - a list of ...
[ "Gets", "all", "Assessments", "." ]
python
train
47.26087
theosysbio/means
src/means/simulation/ssa.py
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/simulation/ssa.py#L62-L139
def simulate_system(self, parameters, initial_conditions, timepoints, max_moment_order=1, number_of_processes=1): """ Perform Gillespie SSA simulations and returns trajectories for of each species. Each trajectory is interpolated at the given time points. By defau...
[ "def", "simulate_system", "(", "self", ",", "parameters", ",", "initial_conditions", ",", "timepoints", ",", "max_moment_order", "=", "1", ",", "number_of_processes", "=", "1", ")", ":", "max_moment_order", "=", "int", "(", "max_moment_order", ")", "assert", "("...
Perform Gillespie SSA simulations and returns trajectories for of each species. Each trajectory is interpolated at the given time points. By default, the average amounts of species for all simulations is returned. :param parameters: list of the initial values for the constants in the model. ...
[ "Perform", "Gillespie", "SSA", "simulations", "and", "returns", "trajectories", "for", "of", "each", "species", ".", "Each", "trajectory", "is", "interpolated", "at", "the", "given", "time", "points", ".", "By", "default", "the", "average", "amounts", "of", "s...
python
train
47.025641
happyleavesaoc/python-upsmychoice
upsmychoice/__init__.py
https://github.com/happyleavesaoc/python-upsmychoice/blob/df4d7e9d92f95884c8d86f9d38b5a2291cf9edbe/upsmychoice/__init__.py#L64-L82
def _login(session): """Login to UPS.""" resp = session.get(LOGIN_URL, params=_get_params(session.auth.locale)) parsed = BeautifulSoup(resp.text, HTML_PARSER) csrf = parsed.find(CSRF_FIND_TAG, CSRF_FIND_ATTR).get(VALUE_ATTR) resp = session.post(LOGIN_URL, { 'userID': session.auth.username, ...
[ "def", "_login", "(", "session", ")", ":", "resp", "=", "session", ".", "get", "(", "LOGIN_URL", ",", "params", "=", "_get_params", "(", "session", ".", "auth", ".", "locale", ")", ")", "parsed", "=", "BeautifulSoup", "(", "resp", ".", "text", ",", "...
Login to UPS.
[ "Login", "to", "UPS", "." ]
python
train
39.842105
biolink/biolink-model
metamodel/generators/contextgen.py
https://github.com/biolink/biolink-model/blob/f379e28d5d4085e1115798c6cb28e5acc4dba8b4/metamodel/generators/contextgen.py#L92-L103
def add_prefix(self, ncname: str) -> None: """ Look up ncname and add it to the prefix map if necessary @param ncname: name to add """ if ncname not in self.prefixmap: uri = cu.expand_uri(ncname + ':', self.curi_maps) if uri and '://' in uri: self...
[ "def", "add_prefix", "(", "self", ",", "ncname", ":", "str", ")", "->", "None", ":", "if", "ncname", "not", "in", "self", ".", "prefixmap", ":", "uri", "=", "cu", ".", "expand_uri", "(", "ncname", "+", "':'", ",", "self", ".", "curi_maps", ")", "if...
Look up ncname and add it to the prefix map if necessary @param ncname: name to add
[ "Look", "up", "ncname", "and", "add", "it", "to", "the", "prefix", "map", "if", "necessary" ]
python
train
42.083333
twilio/twilio-python
twilio/rest/api/v2010/account/call/feedback_summary.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/call/feedback_summary.py#L67-L76
def get(self, sid): """ Constructs a FeedbackSummaryContext :param sid: A string that uniquely identifies this feedback summary resource :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext :rtype: twilio.rest.api.v2010.account.call.feedback_summ...
[ "def", "get", "(", "self", ",", "sid", ")", ":", "return", "FeedbackSummaryContext", "(", "self", ".", "_version", ",", "account_sid", "=", "self", ".", "_solution", "[", "'account_sid'", "]", ",", "sid", "=", "sid", ",", ")" ]
Constructs a FeedbackSummaryContext :param sid: A string that uniquely identifies this feedback summary resource :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext
[ "Constructs", "a", "FeedbackSummaryContext" ]
python
train
45.6
pantsbuild/pants
src/python/pants/reporting/html_reporter.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/reporting/html_reporter.py#L224-L308
def end_workunit(self, workunit): """Implementation of Reporter callback.""" duration = workunit.duration() timing = '{:.3f}'.format(duration) unaccounted_time = '' # Background work may be idle a lot, no point in reporting that as unaccounted. if self.is_under_main_root(workunit): unaccou...
[ "def", "end_workunit", "(", "self", ",", "workunit", ")", ":", "duration", "=", "workunit", ".", "duration", "(", ")", "timing", "=", "'{:.3f}'", ".", "format", "(", "duration", ")", "unaccounted_time", "=", "''", "# Background work may be idle a lot, no point in ...
Implementation of Reporter callback.
[ "Implementation", "of", "Reporter", "callback", "." ]
python
train
38.258824
lamoreauxlab/srpenergy-api-client-python
srpenergy/client.py
https://github.com/lamoreauxlab/srpenergy-api-client-python/blob/dc703510672c2a3e7f3e82c879c9474d04874a40/srpenergy/client.py#L17-L24
def get_iso_time(date_part, time_part): r"""Combign date and time into an iso datetime.""" str_date = datetime.datetime.strptime( date_part, '%m/%d/%Y').strftime('%Y-%m-%d') str_time = datetime.datetime.strptime( time_part, '%I:%M %p').strftime('%H:%M:%S') return str_date + "T" +...
[ "def", "get_iso_time", "(", "date_part", ",", "time_part", ")", ":", "str_date", "=", "datetime", ".", "datetime", ".", "strptime", "(", "date_part", ",", "'%m/%d/%Y'", ")", ".", "strftime", "(", "'%Y-%m-%d'", ")", "str_time", "=", "datetime", ".", "datetime...
r"""Combign date and time into an iso datetime.
[ "r", "Combign", "date", "and", "time", "into", "an", "iso", "datetime", "." ]
python
train
41.5
oauthlib/oauthlib
oauthlib/oauth2/rfc6749/clients/base.py
https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L375-L423
def parse_request_body_response(self, body, scope=None, **kwargs): """Parse the JSON response body. If the access token request is valid and authorized, the authorization server issues an access token as described in `Section 5.1`_. A refresh token SHOULD NOT be included. If the reque...
[ "def", "parse_request_body_response", "(", "self", ",", "body", ",", "scope", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "token", "=", "parse_token_response", "(", "body", ",", "scope", "=", "scope", ")", "self", ".", "populate_token_attr...
Parse the JSON response body. If the access token request is valid and authorized, the authorization server issues an access token as described in `Section 5.1`_. A refresh token SHOULD NOT be included. If the request failed client authentication or is invalid, the authorization serve...
[ "Parse", "the", "JSON", "response", "body", "." ]
python
train
45.897959
joelfrederico/SciSalt
scisalt/matplotlib/setup_axes.py
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/setup_axes.py#L8-L57
def setup_axes(rows=1, cols=1, figsize=(8, 6), expand=True, tight_layout=None, **kwargs): """ Sets up a figure of size *figsize* with a number of rows (*rows*) and columns (*cols*). \*\*kwargs passed through to :meth:`matplotlib.figure.Figure.add_subplot`. .. versionadded:: 1.2 Parameters --------...
[ "def", "setup_axes", "(", "rows", "=", "1", ",", "cols", "=", "1", ",", "figsize", "=", "(", "8", ",", "6", ")", ",", "expand", "=", "True", ",", "tight_layout", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "expand", ":", "figsize", "=...
Sets up a figure of size *figsize* with a number of rows (*rows*) and columns (*cols*). \*\*kwargs passed through to :meth:`matplotlib.figure.Figure.add_subplot`. .. versionadded:: 1.2 Parameters ---------- rows : int Number of rows to create. cols : int Number of columns to creat...
[ "Sets", "up", "a", "figure", "of", "size", "*", "figsize", "*", "with", "a", "number", "of", "rows", "(", "*", "rows", "*", ")", "and", "columns", "(", "*", "cols", "*", ")", ".", "\\", "*", "\\", "*", "kwargs", "passed", "through", "to", ":", ...
python
valid
28.74
mcocdawc/chemcoord
src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/cartesian_coordinates/_cartesian_class_get_zmat.py#L339-L356
def check_dihedral(self, construction_table): """Checks, if the dihedral defining atom is colinear. Checks for each index starting from the third row of the ``construction_table``, if the reference atoms are colinear. Args: construction_table (pd.DataFrame): Return...
[ "def", "check_dihedral", "(", "self", ",", "construction_table", ")", ":", "c_table", "=", "construction_table", "angles", "=", "self", ".", "get_angle_degrees", "(", "c_table", ".", "iloc", "[", "3", ":", ",", ":", "]", ".", "values", ")", "problem_index", ...
Checks, if the dihedral defining atom is colinear. Checks for each index starting from the third row of the ``construction_table``, if the reference atoms are colinear. Args: construction_table (pd.DataFrame): Returns: list: A list of problematic indices.
[ "Checks", "if", "the", "dihedral", "defining", "atom", "is", "colinear", "." ]
python
train
37.777778
sendgrid/sendgrid-python
sendgrid/helpers/mail/mail.py
https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/mail.py#L195-L204
def add_personalization(self, personalization, index=0): """Add a Personaliztion object :param personalizations: Add a Personalization object :type personalizations: Personalization :param index: The index where to add the Personalization :type index: int """ sel...
[ "def", "add_personalization", "(", "self", ",", "personalization", ",", "index", "=", "0", ")", ":", "self", ".", "_personalizations", "=", "self", ".", "_ensure_append", "(", "personalization", ",", "self", ".", "_personalizations", ",", "index", ")" ]
Add a Personaliztion object :param personalizations: Add a Personalization object :type personalizations: Personalization :param index: The index where to add the Personalization :type index: int
[ "Add", "a", "Personaliztion", "object" ]
python
train
41.3
necaris/python3-openid
openid/consumer/discover.py
https://github.com/necaris/python3-openid/blob/4911bbc196dfd6f9eda7155df9903d668720ecbf/openid/consumer/discover.py#L290-L298
def normalizeURL(url): """Normalize a URL, converting normalization failures to DiscoveryFailure""" try: normalized = urinorm.urinorm(url) except ValueError as why: raise DiscoveryFailure('Normalizing identifier: %s' % (why, ), None) else: return urllib.parse.urldefrag(normal...
[ "def", "normalizeURL", "(", "url", ")", ":", "try", ":", "normalized", "=", "urinorm", ".", "urinorm", "(", "url", ")", "except", "ValueError", "as", "why", ":", "raise", "DiscoveryFailure", "(", "'Normalizing identifier: %s'", "%", "(", "why", ",", ")", "...
Normalize a URL, converting normalization failures to DiscoveryFailure
[ "Normalize", "a", "URL", "converting", "normalization", "failures", "to", "DiscoveryFailure" ]
python
train
35.555556
GeorgeArgyros/symautomata
symautomata/pythondfa.py
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pythondfa.py#L389-L400
def symmetric_difference(self, other): """Constructs an unminimized DFA recognizing the symmetric difference of the languages of two given DFAs. Args: other (DFA): The other DFA that will be used for the symmetric difference operation Returns: ...
[ "def", "symmetric_difference", "(", "self", ",", "other", ")", ":", "operation", "=", "bool", ".", "__xor__", "self", ".", "cross_product", "(", "other", ",", "operation", ")", "return", "self" ]
Constructs an unminimized DFA recognizing the symmetric difference of the languages of two given DFAs. Args: other (DFA): The other DFA that will be used for the symmetric difference operation Returns: DFA: The resulting DFA
[ "Constructs", "an", "unminimized", "DFA", "recognizing", "the", "symmetric", "difference", "of", "the", "languages", "of", "two", "given", "DFAs", ".", "Args", ":", "other", "(", "DFA", ")", ":", "The", "other", "DFA", "that", "will", "be", "used", "for", ...
python
train
37.25
tensorflow/tensor2tensor
tensor2tensor/rl/dopamine_connector.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L450-L468
def get_create_batch_env_fun(batch_env_fn, time_limit): """Factory for dopamine environment initialization function. Args: batch_env_fn: function(in_graph: bool) -> batch environment. time_limit: time steps limit for environment. Returns: function (with optional, unused parameters) initializing envi...
[ "def", "get_create_batch_env_fun", "(", "batch_env_fn", ",", "time_limit", ")", ":", "def", "create_env_fun", "(", "game_name", "=", "None", ",", "sticky_actions", "=", "None", ")", ":", "del", "game_name", ",", "sticky_actions", "batch_env", "=", "batch_env_fn", ...
Factory for dopamine environment initialization function. Args: batch_env_fn: function(in_graph: bool) -> batch environment. time_limit: time steps limit for environment. Returns: function (with optional, unused parameters) initializing environment.
[ "Factory", "for", "dopamine", "environment", "initialization", "function", "." ]
python
train
35.157895
mozilla-iot/webthing-python
webthing/thing.py
https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/thing.py#L412-L421
def remove_event_subscriber(self, name, ws): """ Remove a websocket subscriber from an event. name -- name of the event ws -- the websocket """ if name in self.available_events and \ ws in self.available_events[name]['subscribers']: self.avail...
[ "def", "remove_event_subscriber", "(", "self", ",", "name", ",", "ws", ")", ":", "if", "name", "in", "self", ".", "available_events", "and", "ws", "in", "self", ".", "available_events", "[", "name", "]", "[", "'subscribers'", "]", ":", "self", ".", "avai...
Remove a websocket subscriber from an event. name -- name of the event ws -- the websocket
[ "Remove", "a", "websocket", "subscriber", "from", "an", "event", "." ]
python
test
35.4
eerimoq/bincopy
bincopy.py
https://github.com/eerimoq/bincopy/blob/5e02cd001c3e9b54729425db6bffad5f03e1beac/bincopy.py#L504-L520
def chunks(self, size=32, alignment=1): """Iterate over all segments and return chunks of the data aligned as given by `alignment`. `size` must be a multiple of `alignment`. Each chunk is returned as a named two-tuple of its address and data. """ if (size % alignment) !...
[ "def", "chunks", "(", "self", ",", "size", "=", "32", ",", "alignment", "=", "1", ")", ":", "if", "(", "size", "%", "alignment", ")", "!=", "0", ":", "raise", "Error", "(", "'size {} is not a multiple of alignment {}'", ".", "format", "(", "size", ",", ...
Iterate over all segments and return chunks of the data aligned as given by `alignment`. `size` must be a multiple of `alignment`. Each chunk is returned as a named two-tuple of its address and data.
[ "Iterate", "over", "all", "segments", "and", "return", "chunks", "of", "the", "data", "aligned", "as", "given", "by", "alignment", ".", "size", "must", "be", "a", "multiple", "of", "alignment", ".", "Each", "chunk", "is", "returned", "as", "a", "named", ...
python
train
33.823529
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbtreewidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L2049-L2062
def setRecords(self, records): """ Manually sets the list of records that will be displayed in this tree. This is a shortcut method to creating a RecordSet with a list of records and assigning it to the tree. :param records | [<orb.Table>, ..] ...
[ "def", "setRecords", "(", "self", ",", "records", ")", ":", "self", ".", "_searchTerms", "=", "''", "if", "not", "isinstance", "(", "records", ",", "RecordSet", ")", ":", "records", "=", "RecordSet", "(", "records", ")", "self", ".", "setRecordSet", "(",...
Manually sets the list of records that will be displayed in this tree. This is a shortcut method to creating a RecordSet with a list of records and assigning it to the tree. :param records | [<orb.Table>, ..]
[ "Manually", "sets", "the", "list", "of", "records", "that", "will", "be", "displayed", "in", "this", "tree", ".", "This", "is", "a", "shortcut", "method", "to", "creating", "a", "RecordSet", "with", "a", "list", "of", "records", "and", "assigning", "it", ...
python
train
34.357143
bitesofcode/projexui
projexui/widgets/xlogrecordwidget/xlogrecordwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xlogrecordwidget/xlogrecordwidget.py#L298-L319
def restoreXml(self, xml): """ Saves the logging settings for this widget to XML format. :param xml | <xml.etree.ElementTree.Element> """ self.uiFilterTXT.setText(xml.get('filter', '')) xlevels = xml.find('levels') xloggerlevels = x...
[ "def", "restoreXml", "(", "self", ",", "xml", ")", ":", "self", ".", "uiFilterTXT", ".", "setText", "(", "xml", ".", "get", "(", "'filter'", ",", "''", ")", ")", "xlevels", "=", "xml", ".", "find", "(", "'levels'", ")", "xloggerlevels", "=", "xml", ...
Saves the logging settings for this widget to XML format. :param xml | <xml.etree.ElementTree.Element>
[ "Saves", "the", "logging", "settings", "for", "this", "widget", "to", "XML", "format", ".", ":", "param", "xml", "|", "<xml", ".", "etree", ".", "ElementTree", ".", "Element", ">" ]
python
train
37.318182
yahoo/serviceping
serviceping/network.py
https://github.com/yahoo/serviceping/blob/1f9df5ee5b3cba466426b1164262278472ba4977/serviceping/network.py#L25-L124
def scan(host, port=80, url=None, https=False, timeout=1, max_size=65535): """ Scan a network port Parameters ---------- host : str Host or ip address to scan port : int, optional Port to scan, default=80 url : str, optional URL to perform get request to on the hos...
[ "def", "scan", "(", "host", ",", "port", "=", "80", ",", "url", "=", "None", ",", "https", "=", "False", ",", "timeout", "=", "1", ",", "max_size", "=", "65535", ")", ":", "starts", "=", "OrderedDict", "(", ")", "ends", "=", "OrderedDict", "(", "...
Scan a network port Parameters ---------- host : str Host or ip address to scan port : int, optional Port to scan, default=80 url : str, optional URL to perform get request to on the host and port specified https : bool, optional Perform ssl connection on the ...
[ "Scan", "a", "network", "port" ]
python
train
30.02
sibirrer/lenstronomy
lenstronomy/SimulationAPI/data_api.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/SimulationAPI/data_api.py#L41-L60
def psf_class(self): """ creates instance of PSF() class based on knowledge of the observations For the full possibility of how to create such an instance, see the PSF() class documentation :return: instance of PSF() class """ if self._psf_type == 'GAUSSIAN': ...
[ "def", "psf_class", "(", "self", ")", ":", "if", "self", ".", "_psf_type", "==", "'GAUSSIAN'", ":", "psf_type", "=", "\"GAUSSIAN\"", "fwhm", "=", "self", ".", "_seeing", "kwargs_psf", "=", "{", "'psf_type'", ":", "psf_type", ",", "'fwhm'", ":", "fwhm", "...
creates instance of PSF() class based on knowledge of the observations For the full possibility of how to create such an instance, see the PSF() class documentation :return: instance of PSF() class
[ "creates", "instance", "of", "PSF", "()", "class", "based", "on", "knowledge", "of", "the", "observations", "For", "the", "full", "possibility", "of", "how", "to", "create", "such", "an", "instance", "see", "the", "PSF", "()", "class", "documentation" ]
python
train
42.65
ianmiell/shutit
shutit_pexpect.py
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L585-L627
def expect(self, expect, searchwindowsize=None, maxread=None, timeout=None, iteration_n=1): """Handle child expects, with EOF and TIMEOUT handled iteration_n - Number of times this expect has been called for the send. If 1, (the default) t...
[ "def", "expect", "(", "self", ",", "expect", ",", "searchwindowsize", "=", "None", ",", "maxread", "=", "None", ",", "timeout", "=", "None", ",", "iteration_n", "=", "1", ")", ":", "if", "isinstance", "(", "expect", ",", "str", ")", ":", "expect", "=...
Handle child expects, with EOF and TIMEOUT handled iteration_n - Number of times this expect has been called for the send. If 1, (the default) then it gets added to the pane of output (if applicable to this run)
[ "Handle", "child", "expects", "with", "EOF", "and", "TIMEOUT", "handled" ]
python
train
41.860465
bspaans/python-mingus
mingus/midi/midi_track.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L90-L110
def play_Bar(self, bar): """Convert a Bar object to MIDI events and write them to the track_data.""" self.set_deltatime(self.delay) self.delay = 0 self.set_meter(bar.meter) self.set_deltatime(0) self.set_key(bar.key) for x in bar: tick = int(ro...
[ "def", "play_Bar", "(", "self", ",", "bar", ")", ":", "self", ".", "set_deltatime", "(", "self", ".", "delay", ")", "self", ".", "delay", "=", "0", "self", ".", "set_meter", "(", "bar", ".", "meter", ")", "self", ".", "set_deltatime", "(", "0", ")"...
Convert a Bar object to MIDI events and write them to the track_data.
[ "Convert", "a", "Bar", "object", "to", "MIDI", "events", "and", "write", "them", "to", "the", "track_data", "." ]
python
train
37.333333
axialmarket/fsq
fsq/done.py
https://github.com/axialmarket/fsq/blob/43b84c292cb8a187599d86753b947cf73248f989/fsq/done.py#L74-L88
def success(item): '''Successful finish''' try: # mv to done trg_queue = item.queue os.rename(fsq_path.item(trg_queue, item.id, host=item.host), os.path.join(fsq_path.done(trg_queue, host=item.host), item.id)) except AttributeError, e:...
[ "def", "success", "(", "item", ")", ":", "try", ":", "# mv to done", "trg_queue", "=", "item", ".", "queue", "os", ".", "rename", "(", "fsq_path", ".", "item", "(", "trg_queue", ",", "item", ".", "id", ",", "host", "=", "item", ".", "host", ")", ",...
Successful finish
[ "Successful", "finish" ]
python
train
42.8
camsci/meteor-pi
src/pythonModules/meteorpi_db/meteorpi_db/__init__.py
https://github.com/camsci/meteor-pi/blob/7b01527650bd1b2b76d6f364e8122e25b8812c8d/src/pythonModules/meteorpi_db/meteorpi_db/__init__.py#L1023-L1037
def get_export_configuration(self, config_id): """ Retrieve the ExportConfiguration with the given ID :param string config_id: ID for which to search :return: a :class:`meteorpi_model.ExportConfiguration` or None, or no match was found. """ sql = ...
[ "def", "get_export_configuration", "(", "self", ",", "config_id", ")", ":", "sql", "=", "(", "'SELECT uid, exportConfigId, exportType, searchString, targetURL, '", "'targetUser, targetPassword, exportName, description, active '", "'FROM archive_exportConfig WHERE exportConfigId = %s'", "...
Retrieve the ExportConfiguration with the given ID :param string config_id: ID for which to search :return: a :class:`meteorpi_model.ExportConfiguration` or None, or no match was found.
[ "Retrieve", "the", "ExportConfiguration", "with", "the", "given", "ID" ]
python
train
44.133333
apache/airflow
airflow/jobs.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L419-L430
def start(self): """ Launch the process and start processing the DAG. """ self._process = DagFileProcessor._launch_process( self._result_queue, self.file_path, self._pickle_dags, self._dag_id_white_list, "DagFileProcessor{}".for...
[ "def", "start", "(", "self", ")", ":", "self", ".", "_process", "=", "DagFileProcessor", ".", "_launch_process", "(", "self", ".", "_result_queue", ",", "self", ".", "file_path", ",", "self", ".", "_pickle_dags", ",", "self", ".", "_dag_id_white_list", ",", ...
Launch the process and start processing the DAG.
[ "Launch", "the", "process", "and", "start", "processing", "the", "DAG", "." ]
python
test
33.666667
JonathanRaiman/pytreebank
pytreebank/parse.py
https://github.com/JonathanRaiman/pytreebank/blob/7b4c671d3dff661cc3677e54db817e50c5a1c666/pytreebank/parse.py#L163-L187
def load_sst(path=None, url='http://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip'): """ Download and read in the Stanford Sentiment Treebank dataset into a dictionary with a 'train', 'dev', and 'test' keys. The dictionary keys point to lists of LabeledTrees. Arguments: ----...
[ "def", "load_sst", "(", "path", "=", "None", ",", "url", "=", "'http://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip'", ")", ":", "if", "path", "is", "None", ":", "# find a good temporary path", "path", "=", "os", ".", "path", ".", "expanduser", "(", "\"~/s...
Download and read in the Stanford Sentiment Treebank dataset into a dictionary with a 'train', 'dev', and 'test' keys. The dictionary keys point to lists of LabeledTrees. Arguments: ---------- path : str, (optional defaults to ~/stanford_sentiment_treebank), directory where the corp...
[ "Download", "and", "read", "in", "the", "Stanford", "Sentiment", "Treebank", "dataset", "into", "a", "dictionary", "with", "a", "train", "dev", "and", "test", "keys", ".", "The", "dictionary", "keys", "point", "to", "lists", "of", "LabeledTrees", "." ]
python
train
37.04
ColtonProvias/sqlalchemy-jsonapi
sqlalchemy_jsonapi/serializer.py
https://github.com/ColtonProvias/sqlalchemy-jsonapi/blob/40f8b5970d44935b27091c2bf3224482d23311bb/sqlalchemy_jsonapi/serializer.py#L349-L356
def _render_short_instance(self, instance): """ For those very short versions of resources, we have this. :param instance: The instance to render """ check_permission(instance, None, Permissions.VIEW) return {'type': instance.__jsonapi_type__, 'id': instance.id}
[ "def", "_render_short_instance", "(", "self", ",", "instance", ")", ":", "check_permission", "(", "instance", ",", "None", ",", "Permissions", ".", "VIEW", ")", "return", "{", "'type'", ":", "instance", ".", "__jsonapi_type__", ",", "'id'", ":", "instance", ...
For those very short versions of resources, we have this. :param instance: The instance to render
[ "For", "those", "very", "short", "versions", "of", "resources", "we", "have", "this", "." ]
python
train
38
Dallinger/Dallinger
dallinger/recruiters.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L936-L972
def from_config(config): """Return a Recruiter instance based on the configuration. Default is HotAirRecruiter in debug mode (unless we're using the bot recruiter, which can be used in debug mode) and the MTurkRecruiter in other modes. """ debug_mode = config.get("mode") == "debug" name = c...
[ "def", "from_config", "(", "config", ")", ":", "debug_mode", "=", "config", ".", "get", "(", "\"mode\"", ")", "==", "\"debug\"", "name", "=", "config", ".", "get", "(", "\"recruiter\"", ",", "None", ")", "recruiter", "=", "None", "# Special case 1: Don't use...
Return a Recruiter instance based on the configuration. Default is HotAirRecruiter in debug mode (unless we're using the bot recruiter, which can be used in debug mode) and the MTurkRecruiter in other modes.
[ "Return", "a", "Recruiter", "instance", "based", "on", "the", "configuration", "." ]
python
train
31.891892
kwikteam/phy
phy/electrode/mea.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/electrode/mea.py#L53-L57
def _probe_positions(probe, group): """Return the positions of a probe channel group.""" positions = probe['channel_groups'][group]['geometry'] channels = _probe_channels(probe, group) return np.array([positions[channel] for channel in channels])
[ "def", "_probe_positions", "(", "probe", ",", "group", ")", ":", "positions", "=", "probe", "[", "'channel_groups'", "]", "[", "group", "]", "[", "'geometry'", "]", "channels", "=", "_probe_channels", "(", "probe", ",", "group", ")", "return", "np", ".", ...
Return the positions of a probe channel group.
[ "Return", "the", "positions", "of", "a", "probe", "channel", "group", "." ]
python
train
51.6
dj-stripe/dj-stripe
djstripe/models/core.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/models/core.py#L597-L673
def charge( self, amount, currency=None, application_fee=None, capture=None, description=None, destination=None, metadata=None, shipping=None, source=None, statement_descriptor=None, idempotency_key=None, ): """ Creates a charge for this customer. Parameters not implemented: * **recei...
[ "def", "charge", "(", "self", ",", "amount", ",", "currency", "=", "None", ",", "application_fee", "=", "None", ",", "capture", "=", "None", ",", "description", "=", "None", ",", "destination", "=", "None", ",", "metadata", "=", "None", ",", "shipping", ...
Creates a charge for this customer. Parameters not implemented: * **receipt_email** - Since this is a charge on a customer, the customer's email address is used. :param amount: The amount to charge. :type amount: Decimal. Precision is 2; anything more will be ignored. :param currency: 3-letter ISO code fo...
[ "Creates", "a", "charge", "for", "this", "customer", "." ]
python
train
33.545455
quantmind/pulsar
pulsar/apps/wsgi/content.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/wsgi/content.py#L330-L346
def attr(self, *args): '''Add the specific attribute to the attribute dictionary with key ``name`` and value ``value`` and return ``self``.''' attr = self._attr if not args: return attr or {} result, adding = self._attrdata('attr', *args) if adding: ...
[ "def", "attr", "(", "self", ",", "*", "args", ")", ":", "attr", "=", "self", ".", "_attr", "if", "not", "args", ":", "return", "attr", "or", "{", "}", "result", ",", "adding", "=", "self", ".", "_attrdata", "(", "'attr'", ",", "*", "args", ")", ...
Add the specific attribute to the attribute dictionary with key ``name`` and value ``value`` and return ``self``.
[ "Add", "the", "specific", "attribute", "to", "the", "attribute", "dictionary", "with", "key", "name", "and", "value", "value", "and", "return", "self", "." ]
python
train
36.705882
bskinn/opan
opan/vpt2/repo.py
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L437-L456
def has_param(self, param): """ .. todo:: has_param docstring """ # Imports from ..error import RepoError # Try to get the param; pass along all errors, except 'data' error # from RepoError retval = True try: self.get_param(param) ex...
[ "def", "has_param", "(", "self", ",", "param", ")", ":", "# Imports", "from", ".", ".", "error", "import", "RepoError", "# Try to get the param; pass along all errors, except 'data' error", "# from RepoError", "retval", "=", "True", "try", ":", "self", ".", "get_para...
.. todo:: has_param docstring
[ "..", "todo", "::", "has_param", "docstring" ]
python
train
24.55
jaraco/irc
irc/client_aio.py
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/client_aio.py#L160-L173
def process_data(self, new_data): """ handles incoming data from the `IrcProtocol` connection. Main data processing/routing is handled by the _process_line method, inherited from `ServerConnection` """ self.buffer.feed(new_data) # process each non-empty line afte...
[ "def", "process_data", "(", "self", ",", "new_data", ")", ":", "self", ".", "buffer", ".", "feed", "(", "new_data", ")", "# process each non-empty line after logging all lines", "for", "line", "in", "self", ".", "buffer", ":", "log", ".", "debug", "(", "\"FROM...
handles incoming data from the `IrcProtocol` connection. Main data processing/routing is handled by the _process_line method, inherited from `ServerConnection`
[ "handles", "incoming", "data", "from", "the", "IrcProtocol", "connection", ".", "Main", "data", "processing", "/", "routing", "is", "handled", "by", "the", "_process_line", "method", "inherited", "from", "ServerConnection" ]
python
train
35.214286
ihiji/version_utils
version_utils/rpm.py
https://github.com/ihiji/version_utils/blob/7f63d80faca8e76274b6e8dff7637cc7cb8d848c/version_utils/rpm.py#L356-L393
def _compare_blocks(block_a, block_b): """Compare two blocks of characters Compares two blocks of characters of the form returned by either the :any:`_pop_digits` or :any:`_pop_letters` function. Blocks should be character lists containing only digits or only letters. Both blocks should contain the...
[ "def", "_compare_blocks", "(", "block_a", ",", "block_b", ")", ":", "logger", ".", "debug", "(", "'_compare_blocks(%s, %s)'", ",", "block_a", ",", "block_b", ")", "if", "block_a", "[", "0", "]", ".", "isdigit", "(", ")", ":", "_trim_zeros", "(", "block_a",...
Compare two blocks of characters Compares two blocks of characters of the form returned by either the :any:`_pop_digits` or :any:`_pop_letters` function. Blocks should be character lists containing only digits or only letters. Both blocks should contain the same character type (digits or letters). ...
[ "Compare", "two", "blocks", "of", "characters" ]
python
train
43.921053
astropy/regions
regions/io/core.py
https://github.com/astropy/regions/blob/452d962c417e4ff20d1268f99535c6ff89c83437/regions/io/core.py#L527-L547
def convert_coords(self): """ Process list of coordinates This mainly searches for tuple of coordinates in the coordinate list and creates a SkyCoord or PixCoord object from them if appropriate for a given region type. This involves again some coordinate transformation, ...
[ "def", "convert_coords", "(", "self", ")", ":", "if", "self", ".", "coordsys", "in", "[", "'image'", ",", "'physical'", "]", ":", "coords", "=", "self", ".", "_convert_pix_coords", "(", ")", "else", ":", "coords", "=", "self", ".", "_convert_sky_coords", ...
Process list of coordinates This mainly searches for tuple of coordinates in the coordinate list and creates a SkyCoord or PixCoord object from them if appropriate for a given region type. This involves again some coordinate transformation, so this step could be moved to the parsing pro...
[ "Process", "list", "of", "coordinates" ]
python
train
34.333333
numenta/nupic
src/nupic/database/connection.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/connection.py#L340-L370
def release(self): """ Release the database connection and cursor The receiver of the Connection instance MUST call this method in order to reclaim resources """ self._logger.debug("Releasing: %r", self) # Discard self from set of outstanding instances if self._addedToInstanceSet: t...
[ "def", "release", "(", "self", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"Releasing: %r\"", ",", "self", ")", "# Discard self from set of outstanding instances", "if", "self", ".", "_addedToInstanceSet", ":", "try", ":", "self", ".", "_clsOutstandingI...
Release the database connection and cursor The receiver of the Connection instance MUST call this method in order to reclaim resources
[ "Release", "the", "database", "connection", "and", "cursor" ]
python
valid
28.322581
tcalmant/ipopo
pelix/rsa/__init__.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1165-L1181
def get_string_plus_property_value(value): # type: (Any) -> Optional[List[str]] """ Converts a string or list of string into a list of strings :param value: A string or a list of strings :return: A list of strings or None """ if value: if isinstance(value, str): return [...
[ "def", "get_string_plus_property_value", "(", "value", ")", ":", "# type: (Any) -> Optional[List[str]]", "if", "value", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "return", "[", "value", "]", "if", "isinstance", "(", "value", ",", "list", ")"...
Converts a string or list of string into a list of strings :param value: A string or a list of strings :return: A list of strings or None
[ "Converts", "a", "string", "or", "list", "of", "string", "into", "a", "list", "of", "strings" ]
python
train
26.823529
xoolive/traffic
traffic/data/adsb/opensky.py
https://github.com/xoolive/traffic/blob/d1a8878098f16759f6b6e0e8d8b8f32e34a680a8/traffic/data/adsb/opensky.py#L257-L270
def api_routes(self, callsign: str) -> Tuple[Airport, ...]: """Returns the route associated to a callsign.""" from .. import airports c = requests.get( f"https://opensky-network.org/api/routes?callsign={callsign}" ) if c.status_code == 404: raise ValueErr...
[ "def", "api_routes", "(", "self", ",", "callsign", ":", "str", ")", "->", "Tuple", "[", "Airport", ",", "...", "]", ":", "from", ".", ".", "import", "airports", "c", "=", "requests", ".", "get", "(", "f\"https://opensky-network.org/api/routes?callsign={callsig...
Returns the route associated to a callsign.
[ "Returns", "the", "route", "associated", "to", "a", "callsign", "." ]
python
train
35.214286
Shapeways/coyote_framework
coyote_framework/database/coyote_db.py
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_db.py#L276-L293
def execute(*args, **kwargs): """Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution """ # Inspect the call stack for the originating call args = CoyoteDb.__add_query_comment(args[0]) db =...
[ "def", "execute", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Inspect the call stack for the originating call", "args", "=", "CoyoteDb", ".", "__add_query_comment", "(", "args", "[", "0", "]", ")", "db", "=", "CoyoteDb", ".", "__get_db_write_instance...
Executes the sql statement, but does not commit. Returns the cursor to commit @return: DB and cursor instance following sql execution
[ "Executes", "the", "sql", "statement", "but", "does", "not", "commit", ".", "Returns", "the", "cursor", "to", "commit" ]
python
train
41.611111
numenta/nupic
src/nupic/frameworks/opf/experiment_runner.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/experiment_runner.py#L686-L751
def run(self): """Runs a single experiment task""" self.__logger.debug("run(): Starting task <%s>", self.__task['taskLabel']) # Set up the task # Create our main loop-control iterator if self.__cmdOptions.privateOptions['testMode']: numIters = 10 else: numIters = self.__task['itera...
[ "def", "run", "(", "self", ")", ":", "self", ".", "__logger", ".", "debug", "(", "\"run(): Starting task <%s>\"", ",", "self", ".", "__task", "[", "'taskLabel'", "]", ")", "# Set up the task", "# Create our main loop-control iterator", "if", "self", ".", "__cmdOpt...
Runs a single experiment task
[ "Runs", "a", "single", "experiment", "task" ]
python
valid
29.242424
ibis-project/ibis
ibis/pandas/udf.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/pandas/udf.py#L219-L237
def parameter_count(funcsig): """Get the number of positional-or-keyword or position-only parameters in a function signature. Parameters ---------- funcsig : inspect.Signature A UDF signature Returns ------- int The number of parameters """ return sum( p...
[ "def", "parameter_count", "(", "funcsig", ")", ":", "return", "sum", "(", "param", ".", "kind", "in", "{", "param", ".", "POSITIONAL_OR_KEYWORD", ",", "param", ".", "POSITIONAL_ONLY", "}", "for", "param", "in", "funcsig", ".", "parameters", ".", "values", ...
Get the number of positional-or-keyword or position-only parameters in a function signature. Parameters ---------- funcsig : inspect.Signature A UDF signature Returns ------- int The number of parameters
[ "Get", "the", "number", "of", "positional", "-", "or", "-", "keyword", "or", "position", "-", "only", "parameters", "in", "a", "function", "signature", "." ]
python
train
24.526316
pytroll/satpy
satpy/readers/eps_l1b.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/eps_l1b.py#L209-L220
def get_full_lonlats(self): """Get the interpolated lons/lats. """ if self.lons is not None and self.lats is not None: return self.lons, self.lats self.lons, self.lats = self._get_full_lonlats() self.lons = da.from_delayed(self.lons, dtype=self["EARTH_LOCATIONS"].dty...
[ "def", "get_full_lonlats", "(", "self", ")", ":", "if", "self", ".", "lons", "is", "not", "None", "and", "self", ".", "lats", "is", "not", "None", ":", "return", "self", ".", "lons", ",", "self", ".", "lats", "self", ".", "lons", ",", "self", ".", ...
Get the interpolated lons/lats.
[ "Get", "the", "interpolated", "lons", "/", "lats", "." ]
python
train
48.166667
iotile/coretools
iotilesensorgraph/iotile/sg/update/setconfig_record.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/update/setconfig_record.py#L33-L61
def encode(self): """Encode this record into binary, suitable for embedded into an update script. This function will create multiple records that correspond to the actual underlying rpcs that SetConfigRecord turns into. Returns: bytearary: The binary version of the record t...
[ "def", "encode", "(", "self", ")", ":", "begin_payload", "=", "struct", ".", "pack", "(", "\"<H8s\"", ",", "self", ".", "config_id", ",", "self", ".", "target", ".", "encode", "(", ")", ")", "start_record", "=", "SendErrorCheckingRPCRecord", "(", "8", ",...
Encode this record into binary, suitable for embedded into an update script. This function will create multiple records that correspond to the actual underlying rpcs that SetConfigRecord turns into. Returns: bytearary: The binary version of the record that could be parsed via ...
[ "Encode", "this", "record", "into", "binary", "suitable", "for", "embedded", "into", "an", "update", "script", "." ]
python
train
38.448276
diefans/docker-events
src/docker_events/__init__.py
https://github.com/diefans/docker-events/blob/cc07591d908fefcc265285ba7fc0047632e06dea/src/docker_events/__init__.py#L40-L47
def matches(self, client, event_data): """True if all filters are matching.""" for f in self.filters: if not f(client, event_data): return False return True
[ "def", "matches", "(", "self", ",", "client", ",", "event_data", ")", ":", "for", "f", "in", "self", ".", "filters", ":", "if", "not", "f", "(", "client", ",", "event_data", ")", ":", "return", "False", "return", "True" ]
True if all filters are matching.
[ "True", "if", "all", "filters", "are", "matching", "." ]
python
train
25.375
edx/XBlock
xblock/core.py
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/core.py#L239-L257
def aside_for(cls, view_name): """ A decorator to indicate a function is the aside view for the given view_name. Aside views should have a signature like: @XBlockAside.aside_for('student_view') def student_aside(self, block, context=None): ... ...
[ "def", "aside_for", "(", "cls", ",", "view_name", ")", ":", "# pylint: disable=protected-access", "def", "_decorator", "(", "func", ")", ":", "# pylint: disable=missing-docstring", "if", "not", "hasattr", "(", "func", ",", "'_aside_for'", ")", ":", "func", ".", ...
A decorator to indicate a function is the aside view for the given view_name. Aside views should have a signature like: @XBlockAside.aside_for('student_view') def student_aside(self, block, context=None): ... return Fragment(...)
[ "A", "decorator", "to", "indicate", "a", "function", "is", "the", "aside", "view", "for", "the", "given", "view_name", "." ]
python
train
35.157895
sibirrer/lenstronomy
lenstronomy/ImSim/MultiBand/multi_data_base.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/MultiBand/multi_data_base.py#L38-L45
def reset_point_source_cache(self, bool=True): """ deletes all the cache in the point source class and saves it from then on :return: """ for imageModel in self._imageModel_list: imageModel.reset_point_source_cache(bool=bool)
[ "def", "reset_point_source_cache", "(", "self", ",", "bool", "=", "True", ")", ":", "for", "imageModel", "in", "self", ".", "_imageModel_list", ":", "imageModel", ".", "reset_point_source_cache", "(", "bool", "=", "bool", ")" ]
deletes all the cache in the point source class and saves it from then on :return:
[ "deletes", "all", "the", "cache", "in", "the", "point", "source", "class", "and", "saves", "it", "from", "then", "on" ]
python
train
33.875
caseyjlaw/activegit
activegit/activegit.py
https://github.com/caseyjlaw/activegit/blob/2b4a0ee0fecf13345b5257130ba98b48f46e1098/activegit/activegit.py#L54-L75
def initializerepo(self): """ Fill empty directory with products and make first commit """ try: os.mkdir(self.repopath) except OSError: pass cmd = self.repo.init(bare=self.bare, shared=self.shared) if not self.bare: self.write_testing_data([...
[ "def", "initializerepo", "(", "self", ")", ":", "try", ":", "os", ".", "mkdir", "(", "self", ".", "repopath", ")", "except", "OSError", ":", "pass", "cmd", "=", "self", ".", "repo", ".", "init", "(", "bare", "=", "self", ".", "bare", ",", "shared",...
Fill empty directory with products and make first commit
[ "Fill", "empty", "directory", "with", "products", "and", "make", "first", "commit" ]
python
train
30.954545
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/oinspect.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L118-L145
def getsource(obj,is_binary=False): """Wrapper around inspect.getsource. This can be modified by other projects to provide customized source extraction. Inputs: - obj: an object whose source code we will attempt to extract. Optional inputs: - is_binary: whether the object is known to co...
[ "def", "getsource", "(", "obj", ",", "is_binary", "=", "False", ")", ":", "if", "is_binary", ":", "return", "None", "else", ":", "# get source if obj was decorated with @decorator", "if", "hasattr", "(", "obj", ",", "\"__wrapped__\"", ")", ":", "obj", "=", "ob...
Wrapper around inspect.getsource. This can be modified by other projects to provide customized source extraction. Inputs: - obj: an object whose source code we will attempt to extract. Optional inputs: - is_binary: whether the object is known to come from a binary source. This implement...
[ "Wrapper", "around", "inspect", ".", "getsource", "." ]
python
test
29.964286
gholt/swiftly
swiftly/cli/iomanager.py
https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/iomanager.py#L86-L96
def client_path_to_os_path(self, client_path): """ Converts a client path into the operating system's path by replacing instances of '/' with os.path.sep. Note: If the client path contains any instances of os.path.sep already, they will be replaced with '-'. """ ...
[ "def", "client_path_to_os_path", "(", "self", ",", "client_path", ")", ":", "if", "os", ".", "path", ".", "sep", "==", "'/'", ":", "return", "client_path", "return", "client_path", ".", "replace", "(", "os", ".", "path", ".", "sep", ",", "'-'", ")", "....
Converts a client path into the operating system's path by replacing instances of '/' with os.path.sep. Note: If the client path contains any instances of os.path.sep already, they will be replaced with '-'.
[ "Converts", "a", "client", "path", "into", "the", "operating", "system", "s", "path", "by", "replacing", "instances", "of", "/", "with", "os", ".", "path", ".", "sep", "." ]
python
test
40.181818