repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
adaptive-learning/proso-apps
proso_user/views.py
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_user/views.py#L22-L89
def profile(request, status=200): """ Get the user's profile. If the user has no assigned profile, the HTTP 404 is returned. Make a POST request to modify the user's profile. GET parameters: html turn on the HTML version of the API username: username of user (onl...
[ "def", "profile", "(", "request", ",", "status", "=", "200", ")", ":", "if", "request", ".", "method", "==", "'GET'", ":", "if", "request", ".", "GET", ".", "get", "(", "\"username\"", ",", "False", ")", ":", "try", ":", "user_profile", "=", "User", ...
Get the user's profile. If the user has no assigned profile, the HTTP 404 is returned. Make a POST request to modify the user's profile. GET parameters: html turn on the HTML version of the API username: username of user (only for users with public profile) stats...
[ "Get", "the", "user", "s", "profile", ".", "If", "the", "user", "has", "no", "assigned", "profile", "the", "HTTP", "404", "is", "returned", ".", "Make", "a", "POST", "request", "to", "modify", "the", "user", "s", "profile", "." ]
python
train
jxtech/wechatpy
wechatpy/pay/api/withhold.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/withhold.py#L176-L202
def apply_cancel_signing(self, contract_id=None, plan_id=None, contract_code=None, contract_termination_remark=None, version="1.0"): """ 申请解约 https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_4&index=6 :param contract_id: 合同ID :param plan_id...
[ "def", "apply_cancel_signing", "(", "self", ",", "contract_id", "=", "None", ",", "plan_id", "=", "None", ",", "contract_code", "=", "None", ",", "contract_termination_remark", "=", "None", ",", "version", "=", "\"1.0\"", ")", ":", "if", "not", "(", "contrac...
申请解约 https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_4&index=6 :param contract_id: 合同ID :param plan_id: 模板ID :param contract_code: 合同号 :param contract_termination_remark: 解约原因 :param version: 版本号 :return:
[ "申请解约" ]
python
train
coleifer/walrus
walrus/rate_limit.py
https://github.com/coleifer/walrus/blob/82bf15a6613487b5b5fefeb488f186d7e0106547/walrus/rate_limit.py#L31-L60
def limit(self, key): """ Function to log an event with the given key. If the ``key`` has not exceeded their alotted events, then the function returns ``False`` to indicate that no limit is being imposed. If the ``key`` has exceeded the number of events, then the function ...
[ "def", "limit", "(", "self", ",", "key", ")", ":", "if", "self", ".", "_debug", ":", "return", "False", "counter", "=", "self", ".", "database", ".", "List", "(", "self", ".", "name", "+", "':'", "+", "key", ")", "n", "=", "len", "(", "counter", ...
Function to log an event with the given key. If the ``key`` has not exceeded their alotted events, then the function returns ``False`` to indicate that no limit is being imposed. If the ``key`` has exceeded the number of events, then the function returns ``True`` indicating rate-limitin...
[ "Function", "to", "log", "an", "event", "with", "the", "given", "key", ".", "If", "the", "key", "has", "not", "exceeded", "their", "alotted", "events", "then", "the", "function", "returns", "False", "to", "indicate", "that", "no", "limit", "is", "being", ...
python
train
mitsei/dlkit
dlkit/services/commenting.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L884-L895
def _set_book_view(self, session): """Sets the underlying book view to match current view""" if self._book_view == FEDERATED: try: session.use_federated_book_view() except AttributeError: pass else: try: session....
[ "def", "_set_book_view", "(", "self", ",", "session", ")", ":", "if", "self", ".", "_book_view", "==", "FEDERATED", ":", "try", ":", "session", ".", "use_federated_book_view", "(", ")", "except", "AttributeError", ":", "pass", "else", ":", "try", ":", "ses...
Sets the underlying book view to match current view
[ "Sets", "the", "underlying", "book", "view", "to", "match", "current", "view" ]
python
train
PythonCharmers/python-future
src/future/backports/urllib/request.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/request.py#L2395-L2409
def getproxies_environment(): """Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. If you need a different way, you can pass a proxies dictionary to the [Fancy]URLopener constructor. "...
[ "def", "getproxies_environment", "(", ")", ":", "proxies", "=", "{", "}", "for", "name", ",", "value", "in", "os", ".", "environ", ".", "items", "(", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "if", "value", "and", "name", "[", "-", "...
Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. If you need a different way, you can pass a proxies dictionary to the [Fancy]URLopener constructor.
[ "Return", "a", "dictionary", "of", "scheme", "-", ">", "proxy", "server", "URL", "mappings", "." ]
python
train
stephantul/reach
reach/reach.py
https://github.com/stephantul/reach/blob/e5ed0cc895d17429e797c6d7dd57bce82ff00d5d/reach/reach.py#L618-L647
def similarity(self, i1, i2): """ Compute the similarity between two sets of items. Parameters ---------- i1 : object The first set of items. i2 : object The second set of item. Returns ------- sim : array of floats ...
[ "def", "similarity", "(", "self", ",", "i1", ",", "i2", ")", ":", "try", ":", "if", "i1", "in", "self", ".", "items", ":", "i1", "=", "[", "i1", "]", "except", "TypeError", ":", "pass", "try", ":", "if", "i2", "in", "self", ".", "items", ":", ...
Compute the similarity between two sets of items. Parameters ---------- i1 : object The first set of items. i2 : object The second set of item. Returns ------- sim : array of floats An array of similarity scores between 1 and ...
[ "Compute", "the", "similarity", "between", "two", "sets", "of", "items", "." ]
python
train
fake-name/ChromeController
ChromeController/Generator/Generated.py
https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L3834-L3862
def DOM_setFileInputFiles(self, files, **kwargs): """ Function path: DOM.setFileInputFiles Domain: DOM Method name: setFileInputFiles WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'files' (type: array) -> Array of file paths to set. Optional argument...
[ "def", "DOM_setFileInputFiles", "(", "self", ",", "files", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "files", ",", "(", "list", ",", "tuple", ")", ")", ",", "\"Argument 'files' must be of type '['list', 'tuple']'. Received type: '%s'\"", "%", ...
Function path: DOM.setFileInputFiles Domain: DOM Method name: setFileInputFiles WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'files' (type: array) -> Array of file paths to set. Optional arguments: 'nodeId' (type: NodeId) -> Identifier of the node....
[ "Function", "path", ":", "DOM", ".", "setFileInputFiles", "Domain", ":", "DOM", "Method", "name", ":", "setFileInputFiles", "WARNING", ":", "This", "function", "is", "marked", "Experimental", "!", "Parameters", ":", "Required", "arguments", ":", "files", "(", ...
python
train
dmbee/seglearn
seglearn/transform.py
https://github.com/dmbee/seglearn/blob/d8d7039e92c4c6571a70350c03298aceab8dbeec/seglearn/transform.py#L761-L816
def transform(self, X, y=None, sample_weight=None): ''' Transforms the time series data with linear direct value interpolation If y is a time series and passed, it will be transformed as well The time dimension is removed from the data Parameters ---------- X : a...
[ "def", "transform", "(", "self", ",", "X", ",", "y", "=", "None", ",", "sample_weight", "=", "None", ")", ":", "check_ts_data", "(", "X", ",", "y", ")", "Xt", ",", "Xc", "=", "get_ts_data_parts", "(", "X", ")", "yt", "=", "y", "swt", "=", "sample...
Transforms the time series data with linear direct value interpolation If y is a time series and passed, it will be transformed as well The time dimension is removed from the data Parameters ---------- X : array-like, shape [n_series, ...] Time series data and (option...
[ "Transforms", "the", "time", "series", "data", "with", "linear", "direct", "value", "interpolation", "If", "y", "is", "a", "time", "series", "and", "passed", "it", "will", "be", "transformed", "as", "well", "The", "time", "dimension", "is", "removed", "from"...
python
train
orb-framework/orb
orb/core/column_types/string.py
https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/string.py#L110-L122
def store(self, value, context=None): """ Converts the value to one that is safe to store on a record within the record values dictionary :param value | <variant> :return <variant> """ if isinstance(value, (str, unicode)) and self.testFlag(self.Flags.En...
[ "def", "store", "(", "self", ",", "value", ",", "context", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "(", "str", ",", "unicode", ")", ")", "and", "self", ".", "testFlag", "(", "self", ".", "Flags", ".", "Encrypted", ")", ":", ...
Converts the value to one that is safe to store on a record within the record values dictionary :param value | <variant> :return <variant>
[ "Converts", "the", "value", "to", "one", "that", "is", "safe", "to", "store", "on", "a", "record", "within", "the", "record", "values", "dictionary" ]
python
train
fastai/fastai
old/fastai/structured.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/old/fastai/structured.py#L45-L68
def get_sample(df,n): """ Gets a random sample of n rows from df, without replacement. Parameters: ----------- df: A pandas data frame, that you wish to sample from. n: The number of rows you wish to sample. Returns: -------- return value: A random sample of n rows of df. Examples: ...
[ "def", "get_sample", "(", "df", ",", "n", ")", ":", "idxs", "=", "sorted", "(", "np", ".", "random", ".", "permutation", "(", "len", "(", "df", ")", ")", "[", ":", "n", "]", ")", "return", "df", ".", "iloc", "[", "idxs", "]", ".", "copy", "("...
Gets a random sample of n rows from df, without replacement. Parameters: ----------- df: A pandas data frame, that you wish to sample from. n: The number of rows you wish to sample. Returns: -------- return value: A random sample of n rows of df. Examples: --------- >>> df = pd.D...
[ "Gets", "a", "random", "sample", "of", "n", "rows", "from", "df", "without", "replacement", ".", "Parameters", ":", "-----------", "df", ":", "A", "pandas", "data", "frame", "that", "you", "wish", "to", "sample", "from", ".", "n", ":", "The", "number", ...
python
train
trevisanj/a99
a99/gui/xmisc.py
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/xmisc.py#L463-L483
def __signalReceived(self, *args): """Received signal. Cancel previous timer and store args to be forwarded later.""" if self.__disconnecting: return with self.__lock: self.__args = args if self.__rateLimit == 0: self.__timer.stop() ...
[ "def", "__signalReceived", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "__disconnecting", ":", "return", "with", "self", ".", "__lock", ":", "self", ".", "__args", "=", "args", "if", "self", ".", "__rateLimit", "==", "0", ":", "self", ...
Received signal. Cancel previous timer and store args to be forwarded later.
[ "Received", "signal", ".", "Cancel", "previous", "timer", "and", "store", "args", "to", "be", "forwarded", "later", "." ]
python
train
swharden/SWHLab
swhlab/common.py
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/common.py#L163-L184
def abfSort(IDs): """ given a list of goofy ABF names, return it sorted intelligently. This places things like 16o01001 after 16901001. """ IDs=list(IDs) monO=[] monN=[] monD=[] good=[] for ID in IDs: if ID is None: continue if 'o' in ID: m...
[ "def", "abfSort", "(", "IDs", ")", ":", "IDs", "=", "list", "(", "IDs", ")", "monO", "=", "[", "]", "monN", "=", "[", "]", "monD", "=", "[", "]", "good", "=", "[", "]", "for", "ID", "in", "IDs", ":", "if", "ID", "is", "None", ":", "continue...
given a list of goofy ABF names, return it sorted intelligently. This places things like 16o01001 after 16901001.
[ "given", "a", "list", "of", "goofy", "ABF", "names", "return", "it", "sorted", "intelligently", ".", "This", "places", "things", "like", "16o01001", "after", "16901001", "." ]
python
valid
rfosterslo/wagtailplus
wagtailplus/wagtailrollbacks/apps.py
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/apps.py#L35-L43
def add_rollback_panels(self): """ Adds rollback panel to applicable model class's edit handlers. """ from wagtailplus.utils.edit_handlers import add_panel_to_edit_handler from wagtailplus.wagtailrollbacks.edit_handlers import HistoryPanel for model in self.applic...
[ "def", "add_rollback_panels", "(", "self", ")", ":", "from", "wagtailplus", ".", "utils", ".", "edit_handlers", "import", "add_panel_to_edit_handler", "from", "wagtailplus", ".", "wagtailrollbacks", ".", "edit_handlers", "import", "HistoryPanel", "for", "model", "in",...
Adds rollback panel to applicable model class's edit handlers.
[ "Adds", "rollback", "panel", "to", "applicable", "model", "class", "s", "edit", "handlers", "." ]
python
train
VingtCinq/python-mailchimp
mailchimp3/helpers.py
https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/helpers.py#L103-L125
def merge_results(x, y): """ Given two dicts, x and y, merge them into a new dict as a shallow copy. The result only differs from `x.update(y)` in the way that it handles list values when both x and y have list values for the same key. In which case the returned dictionary, z, has a value according...
[ "def", "merge_results", "(", "x", ",", "y", ")", ":", "z", "=", "x", ".", "copy", "(", ")", "for", "key", ",", "value", "in", "y", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", "and", "isinstance", "(", "z", ...
Given two dicts, x and y, merge them into a new dict as a shallow copy. The result only differs from `x.update(y)` in the way that it handles list values when both x and y have list values for the same key. In which case the returned dictionary, z, has a value according to: z[key] = x[key] + z[key] ...
[ "Given", "two", "dicts", "x", "and", "y", "merge", "them", "into", "a", "new", "dict", "as", "a", "shallow", "copy", "." ]
python
valid
ctuning/ck
ck/kernel.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/kernel.py#L3635-L3695
def parse_cid(i): """ Input: { cid - in format (REPO_UOA:)MODULE_UOA:DATA_UOA (cur_cid) - output of function 'detect_cid_in_current_path' (ignore_error) - if 'yes', ignore wrong format } Output: { return - return co...
[ "def", "parse_cid", "(", "i", ")", ":", "r", "=", "{", "'return'", ":", "0", "}", "c", "=", "i", "[", "'cid'", "]", ".", "strip", "(", ")", "ie", "=", "i", ".", "get", "(", "'ignore_error'", ",", "''", ")", "cc", "=", "i", ".", "get", "(", ...
Input: { cid - in format (REPO_UOA:)MODULE_UOA:DATA_UOA (cur_cid) - output of function 'detect_cid_in_current_path' (ignore_error) - if 'yes', ignore wrong format } Output: { return - return code = 0, if successful ...
[ "Input", ":", "{", "cid", "-", "in", "format", "(", "REPO_UOA", ":", ")", "MODULE_UOA", ":", "DATA_UOA", "(", "cur_cid", ")", "-", "output", "of", "function", "detect_cid_in_current_path", "(", "ignore_error", ")", "-", "if", "yes", "ignore", "wrong", "for...
python
train
aquatix/python-utilkit
utilkit/fileutil.py
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/fileutil.py#L72-L88
def list_files(dirname, extension=None): """ List all files in directory `dirname`, option to filter on file extension """ f = [] for (dirpath, dirnames, filenames) in os.walk(dirname): f.extend(filenames) break if extension is not None: # Filter on extension filt...
[ "def", "list_files", "(", "dirname", ",", "extension", "=", "None", ")", ":", "f", "=", "[", "]", "for", "(", "dirpath", ",", "dirnames", ",", "filenames", ")", "in", "os", ".", "walk", "(", "dirname", ")", ":", "f", ".", "extend", "(", "filenames"...
List all files in directory `dirname`, option to filter on file extension
[ "List", "all", "files", "in", "directory", "dirname", "option", "to", "filter", "on", "file", "extension" ]
python
train
gwastro/pycbc
pycbc/transforms.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/transforms.py#L520-L550
def transform(self, maps): """This function transforms from chirp distance to luminosity distance, given the chirp mass. Parameters ---------- maps : a mapping object Examples -------- Convert a dict of numpy.array: >>> import numpy as np ...
[ "def", "transform", "(", "self", ",", "maps", ")", ":", "out", "=", "{", "}", "out", "[", "parameters", ".", "distance", "]", "=", "conversions", ".", "distance_from_chirp_distance_mchirp", "(", "maps", "[", "parameters", ".", "chirp_distance", "]", ",", "...
This function transforms from chirp distance to luminosity distance, given the chirp mass. Parameters ---------- maps : a mapping object Examples -------- Convert a dict of numpy.array: >>> import numpy as np >>> from pycbc import transforms ...
[ "This", "function", "transforms", "from", "chirp", "distance", "to", "luminosity", "distance", "given", "the", "chirp", "mass", "." ]
python
train
radjkarl/appBase
appbase/Session.py
https://github.com/radjkarl/appBase/blob/72b514e6dee7c083f01a2d0b2cc93d46df55bdcb/appbase/Session.py#L461-L469
def _autoSave(self): """save state into 'autosave' """ a = 'autoSave' path = self.path if not path: path = self.dir.join('%s.%s' % (a, self.FTYPE)) self._createdAutosaveFile = path self.tmp_dir_save_session = self.tmp_dir_session.join(a).mkdir() ...
[ "def", "_autoSave", "(", "self", ")", ":", "a", "=", "'autoSave'", "path", "=", "self", ".", "path", "if", "not", "path", ":", "path", "=", "self", ".", "dir", ".", "join", "(", "'%s.%s'", "%", "(", "a", ",", "self", ".", "FTYPE", ")", ")", "se...
save state into 'autosave'
[ "save", "state", "into", "autosave" ]
python
train
DecBayComp/RWA-python
rwa/generic.py
https://github.com/DecBayComp/RWA-python/blob/734a52e15a0e8c244d84d74acf3fd64721074732/rwa/generic.py#L276-L309
def pokeVisited(self, objname, obj, record, existing, visited=None, _stack=None, **kwargs): """ Serialize an already serialized object. If the underlying store supports linking, this is the place where to make links. The default implementation delegates to :meth:`pokeStorable` or :meth...
[ "def", "pokeVisited", "(", "self", ",", "objname", ",", "obj", ",", "record", ",", "existing", ",", "visited", "=", "None", ",", "_stack", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "hasPythonType", "(", "obj", ")", ":", "st...
Serialize an already serialized object. If the underlying store supports linking, this is the place where to make links. The default implementation delegates to :meth:`pokeStorable` or :meth:`pokeNative`. Arguments: objname (any): record reference. obj (any): object ...
[ "Serialize", "an", "already", "serialized", "object", "." ]
python
train
delph-in/pydelphin
delphin/lib/pegre.py
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L154-L165
def not_next(e): """ Create a PEG function for negative lookahead. """ def match_not_next(s, grm=None, pos=0): try: e(s, grm, pos) except PegreError as ex: return PegreResult(s, Ignore, (pos, pos)) else: raise PegreError('Negative lookahead fai...
[ "def", "not_next", "(", "e", ")", ":", "def", "match_not_next", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "try", ":", "e", "(", "s", ",", "grm", ",", "pos", ")", "except", "PegreError", "as", "ex", ":", "return", "Pegre...
Create a PEG function for negative lookahead.
[ "Create", "a", "PEG", "function", "for", "negative", "lookahead", "." ]
python
train
scikit-hep/probfit
probfit/plotting.py
https://github.com/scikit-hep/probfit/blob/de3593798ea3877dd2785062bed6877dd9058a02/probfit/plotting.py#L519-L550
def draw_pdf(f, arg, bound, bins=100, scale=1.0, density=True, normed_pdf=False, ax=None, **kwds): """ draw pdf with given argument and bounds. **Arguments** * **f** your pdf. The first argument is assumed to be independent variable * **arg** argument can be tuple o...
[ "def", "draw_pdf", "(", "f", ",", "arg", ",", "bound", ",", "bins", "=", "100", ",", "scale", "=", "1.0", ",", "density", "=", "True", ",", "normed_pdf", "=", "False", ",", "ax", "=", "None", ",", "*", "*", "kwds", ")", ":", "edges", "=", "np",...
draw pdf with given argument and bounds. **Arguments** * **f** your pdf. The first argument is assumed to be independent variable * **arg** argument can be tuple or list * **bound** tuple(xmin,xmax) * **bins** number of bins to plot pdf. Default 100. * **scale...
[ "draw", "pdf", "with", "given", "argument", "and", "bounds", "." ]
python
train
graphite-project/carbonate
carbonate/stale.py
https://github.com/graphite-project/carbonate/blob/b876a85b321fbd7c18a6721bed2e7807b79b4929/carbonate/stale.py#L11-L22
def data(path, hours, offset=0): """ Does the metric at ``path`` have any whisper data newer than ``hours``? If ``offset`` is not None, view the ``hours`` prior to ``offset`` hours ago, instead of from right now. """ now = time.time() end = now - _to_sec(offset) # Will default to now s...
[ "def", "data", "(", "path", ",", "hours", ",", "offset", "=", "0", ")", ":", "now", "=", "time", ".", "time", "(", ")", "end", "=", "now", "-", "_to_sec", "(", "offset", ")", "# Will default to now", "start", "=", "end", "-", "_to_sec", "(", "hours...
Does the metric at ``path`` have any whisper data newer than ``hours``? If ``offset`` is not None, view the ``hours`` prior to ``offset`` hours ago, instead of from right now.
[ "Does", "the", "metric", "at", "path", "have", "any", "whisper", "data", "newer", "than", "hours", "?" ]
python
train
Neurita/boyle
boyle/nifti/roi.py
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/roi.py#L63-L90
def pick_rois(rois_img, roi_values, bg_val=0): """ Return the `rois_img` only with the ROI values from `roi_values`. Parameters ---------- rois_img: niimg-like roi_values: list of int or float The list of values from rois_img. bg_val: int or float The background value of `rois_...
[ "def", "pick_rois", "(", "rois_img", ",", "roi_values", ",", "bg_val", "=", "0", ")", ":", "img", "=", "read_img", "(", "rois_img", ")", "img_data", "=", "img", ".", "get_data", "(", ")", "if", "bg_val", "==", "0", ":", "out", "=", "np", ".", "zero...
Return the `rois_img` only with the ROI values from `roi_values`. Parameters ---------- rois_img: niimg-like roi_values: list of int or float The list of values from rois_img. bg_val: int or float The background value of `rois_img`. Returns ------- subset_rois_img: nib...
[ "Return", "the", "rois_img", "only", "with", "the", "ROI", "values", "from", "roi_values", ".", "Parameters", "----------", "rois_img", ":", "niimg", "-", "like" ]
python
valid
saltstack/salt
salt/modules/iptables.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L774-L800
def new_chain(table='filter', chain=None, family='ipv4'): ''' .. versionadded:: 2014.1.0 Create new custom chain to the specified table. CLI Example: .. code-block:: bash salt '*' iptables.new_chain filter CUSTOM_CHAIN IPv6: salt '*' iptables.new_chain filter CUSTOM_CHAI...
[ "def", "new_chain", "(", "table", "=", "'filter'", ",", "chain", "=", "None", ",", "family", "=", "'ipv4'", ")", ":", "if", "not", "chain", ":", "return", "'Error: Chain needs to be specified'", "wait", "=", "'--wait'", "if", "_has_option", "(", "'--wait'", ...
.. versionadded:: 2014.1.0 Create new custom chain to the specified table. CLI Example: .. code-block:: bash salt '*' iptables.new_chain filter CUSTOM_CHAIN IPv6: salt '*' iptables.new_chain filter CUSTOM_CHAIN family=ipv6
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
python
train
20c/vodka
vodka/bartender.py
https://github.com/20c/vodka/blob/9615148ac6560298453704bb5246b35b66b3339c/vodka/bartender.py#L105-L121
def newapp(path): """ Generates all files for a new vodka app at the specified location. Will generate to current directory if no path is specified """ app_path = os.path.join(VODKA_INSTALL_DIR, "resources", "blank_app") if not os.path.exists(path): os.makedirs(path) elif os.path.e...
[ "def", "newapp", "(", "path", ")", ":", "app_path", "=", "os", ".", "path", ".", "join", "(", "VODKA_INSTALL_DIR", ",", "\"resources\"", ",", "\"blank_app\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "os", ".", "make...
Generates all files for a new vodka app at the specified location. Will generate to current directory if no path is specified
[ "Generates", "all", "files", "for", "a", "new", "vodka", "app", "at", "the", "specified", "location", "." ]
python
train
smira/py-numa
numa.py
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L262-L274
def bind(nodemask): """ Binds the current thread and its children to the nodes specified in nodemask. They will only run on the CPUs of the specified nodes and only be able to allocate memory from them. @param nodemask: node mask @type nodemask: C{set} """ mask = set_to_numa_nodemask(nodema...
[ "def", "bind", "(", "nodemask", ")", ":", "mask", "=", "set_to_numa_nodemask", "(", "nodemask", ")", "bitmask", "=", "libnuma", ".", "numa_allocate_nodemask", "(", ")", "libnuma", ".", "copy_nodemask_to_bitmask", "(", "byref", "(", "mask", ")", ",", "bitmask",...
Binds the current thread and its children to the nodes specified in nodemask. They will only run on the CPUs of the specified nodes and only be able to allocate memory from them. @param nodemask: node mask @type nodemask: C{set}
[ "Binds", "the", "current", "thread", "and", "its", "children", "to", "the", "nodes", "specified", "in", "nodemask", ".", "They", "will", "only", "run", "on", "the", "CPUs", "of", "the", "specified", "nodes", "and", "only", "be", "able", "to", "allocate", ...
python
train
osrg/ryu
ryu/services/protocols/bgp/processor.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L178-L190
def _compare_by_version(path1, path2): """Returns the current/latest learned path. Checks if given paths are from same source/peer and then compares their version number to determine which path is received later. If paths are from different source/peer return None. """ if path1.source == path2....
[ "def", "_compare_by_version", "(", "path1", ",", "path2", ")", ":", "if", "path1", ".", "source", "==", "path2", ".", "source", ":", "if", "path1", ".", "source_version_num", ">", "path2", ".", "source_version_num", ":", "return", "path1", "else", ":", "re...
Returns the current/latest learned path. Checks if given paths are from same source/peer and then compares their version number to determine which path is received later. If paths are from different source/peer return None.
[ "Returns", "the", "current", "/", "latest", "learned", "path", "." ]
python
train
PMEAL/OpenPNM
openpnm/io/MAT.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/io/MAT.py#L29-L60
def save(cls, network, phases=[], filename=''): r""" Write Network to a Mat file for exporting to Matlab. Parameters ---------- network : OpenPNM Network Object filename : string Desired file name, defaults to network name if not given phases : list...
[ "def", "save", "(", "cls", ",", "network", ",", "phases", "=", "[", "]", ",", "filename", "=", "''", ")", ":", "project", ",", "network", ",", "phases", "=", "cls", ".", "_parse_args", "(", "network", "=", "network", ",", "phases", "=", "phases", "...
r""" Write Network to a Mat file for exporting to Matlab. Parameters ---------- network : OpenPNM Network Object filename : string Desired file name, defaults to network name if not given phases : list of phase objects ([]) Phases that have prop...
[ "r", "Write", "Network", "to", "a", "Mat", "file", "for", "exporting", "to", "Matlab", "." ]
python
train
kstaniek/condoor
condoor/connection.py
https://github.com/kstaniek/condoor/blob/77c054b29d4e286c1d7aca2c74dff86b805e1fae/condoor/connection.py#L226-L230
def _chain_indices(self): """Get the deque of chain indices starting with last successful index.""" chain_indices = deque(range(len(self.connection_chains))) chain_indices.rotate(self._last_chain_index) return chain_indices
[ "def", "_chain_indices", "(", "self", ")", ":", "chain_indices", "=", "deque", "(", "range", "(", "len", "(", "self", ".", "connection_chains", ")", ")", ")", "chain_indices", ".", "rotate", "(", "self", ".", "_last_chain_index", ")", "return", "chain_indice...
Get the deque of chain indices starting with last successful index.
[ "Get", "the", "deque", "of", "chain", "indices", "starting", "with", "last", "successful", "index", "." ]
python
train
zwischenloesung/ardu-report-lib
libardurep/datareporter.py
https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/datareporter.py#L68-L87
def log_post(self, url=None, credentials=None, do_verify_certificate=True): """ Write to a remote host via HTTP POST """ if url is None: url = self.url if credentials is None: credentials = self.credentials if do_verify_certificate is None: ...
[ "def", "log_post", "(", "self", ",", "url", "=", "None", ",", "credentials", "=", "None", ",", "do_verify_certificate", "=", "True", ")", ":", "if", "url", "is", "None", ":", "url", "=", "self", ".", "url", "if", "credentials", "is", "None", ":", "cr...
Write to a remote host via HTTP POST
[ "Write", "to", "a", "remote", "host", "via", "HTTP", "POST" ]
python
valid
inspirehep/harvesting-kit
harvestingkit/utils.py
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/utils.py#L213-L220
def fix_dashes(string): """Fix bad Unicode special dashes in string.""" string = string.replace(u'\u05BE', '-') string = string.replace(u'\u1806', '-') string = string.replace(u'\u2E3A', '-') string = string.replace(u'\u2E3B', '-') string = unidecode(string) return re.sub(r'--+', '-', string...
[ "def", "fix_dashes", "(", "string", ")", ":", "string", "=", "string", ".", "replace", "(", "u'\\u05BE'", ",", "'-'", ")", "string", "=", "string", ".", "replace", "(", "u'\\u1806'", ",", "'-'", ")", "string", "=", "string", ".", "replace", "(", "u'\\u...
Fix bad Unicode special dashes in string.
[ "Fix", "bad", "Unicode", "special", "dashes", "in", "string", "." ]
python
valid
pvlib/pvlib-python
pvlib/clearsky.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/clearsky.py#L304-L325
def _linearly_scale(inputmatrix, inputmin, inputmax, outputmin, outputmax): """linearly scale input to output, used by Linke turbidity lookup""" inputrange = inputmax - inputmin outputrange = outputmax - outputmin delta = outputrange/inputrange # number of indices per input unit inputmin = inputmin...
[ "def", "_linearly_scale", "(", "inputmatrix", ",", "inputmin", ",", "inputmax", ",", "outputmin", ",", "outputmax", ")", ":", "inputrange", "=", "inputmax", "-", "inputmin", "outputrange", "=", "outputmax", "-", "outputmin", "delta", "=", "outputrange", "/", "...
linearly scale input to output, used by Linke turbidity lookup
[ "linearly", "scale", "input", "to", "output", "used", "by", "Linke", "turbidity", "lookup" ]
python
train
yinkaisheng/Python-UIAutomation-for-Windows
uiautomation/uiautomation.py
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6038-L6054
def ShowWindow(self, cmdShow: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow. cmdShow: int, a value in in class `SW`. waitTime: float. Return bool, True if succeed otherwise...
[ "def", "ShowWindow", "(", "self", ",", "cmdShow", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "not", "handle", ":", "control", "=", "self", "while", ...
Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow. cmdShow: int, a value in in class `SW`. waitTime: float. Return bool, True if succeed otherwise False.
[ "Get", "a", "native", "handle", "from", "self", "or", "ancestors", "until", "valid", "and", "call", "native", "ShowWindow", "with", "cmdShow", ".", "cmdShow", ":", "int", "a", "value", "in", "in", "class", "SW", ".", "waitTime", ":", "float", ".", "Retur...
python
valid
zeth/inputs
inputs.py
https://github.com/zeth/inputs/blob/a46681dbf77d6ab07834f550e5855c1f50701f99/inputs.py#L2421-L2426
def _get_path_infomation(self): """Get useful infomation from the device path.""" long_identifier = self._device_path.split('/')[4] protocol, remainder = long_identifier.split('-', 1) identifier, _, device_type = remainder.rsplit('-', 2) return (protocol, identifier, device_type)
[ "def", "_get_path_infomation", "(", "self", ")", ":", "long_identifier", "=", "self", ".", "_device_path", ".", "split", "(", "'/'", ")", "[", "4", "]", "protocol", ",", "remainder", "=", "long_identifier", ".", "split", "(", "'-'", ",", "1", ")", "ident...
Get useful infomation from the device path.
[ "Get", "useful", "infomation", "from", "the", "device", "path", "." ]
python
train
ryan-roemer/django-cloud-browser
cloud_browser/common.py
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L146-L163
def path_parts(path): """Split path into container, object. :param path: Path to resource (including container). :type path: `string` :return: Container, storage object tuple. :rtype: `tuple` of `string`, `string` """ path = path if path is not None else '' container_path = object_pat...
[ "def", "path_parts", "(", "path", ")", ":", "path", "=", "path", "if", "path", "is", "not", "None", "else", "''", "container_path", "=", "object_path", "=", "''", "parts", "=", "path_list", "(", "path", ")", "if", "len", "(", "parts", ")", ">=", "1",...
Split path into container, object. :param path: Path to resource (including container). :type path: `string` :return: Container, storage object tuple. :rtype: `tuple` of `string`, `string`
[ "Split", "path", "into", "container", "object", "." ]
python
train
edx/ease
ease/util_functions.py
https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/util_functions.py#L193-L233
def get_vocab(text, score, max_feats=750, max_feats2=200): """ Uses a fisher test to find words that are significant in that they separate high scoring essays from low scoring essays. text is a list of input essays. score is a list of scores, with score[n] corresponding to text[n] max_feats is t...
[ "def", "get_vocab", "(", "text", ",", "score", ",", "max_feats", "=", "750", ",", "max_feats2", "=", "200", ")", ":", "dict", "=", "CountVectorizer", "(", "ngram_range", "=", "(", "1", ",", "2", ")", ",", "max_features", "=", "max_feats", ")", "dict_ma...
Uses a fisher test to find words that are significant in that they separate high scoring essays from low scoring essays. text is a list of input essays. score is a list of scores, with score[n] corresponding to text[n] max_feats is the maximum number of features to consider in the first pass max_fea...
[ "Uses", "a", "fisher", "test", "to", "find", "words", "that", "are", "significant", "in", "that", "they", "separate", "high", "scoring", "essays", "from", "low", "scoring", "essays", ".", "text", "is", "a", "list", "of", "input", "essays", ".", "score", ...
python
valid
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L657-L660
def _save_to_checkpoint(self, filename): """Save the current running config to the given file.""" command = 'checkpoint file {}'.format(filename) self.device.send_command(command)
[ "def", "_save_to_checkpoint", "(", "self", ",", "filename", ")", ":", "command", "=", "'checkpoint file {}'", ".", "format", "(", "filename", ")", "self", ".", "device", ".", "send_command", "(", "command", ")" ]
Save the current running config to the given file.
[ "Save", "the", "current", "running", "config", "to", "the", "given", "file", "." ]
python
train
jmbhughes/suvi-trainer
suvitrainer/gui.py
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L447-L457
def make_options_frame(self): """ make the frame that allows for configuration and classification""" self.tab_frame = ttk.Notebook(self.option_frame, width=800) self.tab_configure = tk.Frame(self.tab_frame) self.tab_classify = tk.Frame(self.tab_frame) self.make_configure_tab() ...
[ "def", "make_options_frame", "(", "self", ")", ":", "self", ".", "tab_frame", "=", "ttk", ".", "Notebook", "(", "self", ".", "option_frame", ",", "width", "=", "800", ")", "self", ".", "tab_configure", "=", "tk", ".", "Frame", "(", "self", ".", "tab_fr...
make the frame that allows for configuration and classification
[ "make", "the", "frame", "that", "allows", "for", "configuration", "and", "classification" ]
python
train
hydraplatform/hydra-base
hydra_base/util/__init__.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/util/__init__.py#L132-L218
def get_val(dataset, timestamp=None): """ Turn the string value of a dataset into an appropriate value, be it a decimal value, array or time series. If a timestamp is passed to this function, return the values appropriate to the requested times. If the timestamp is *before*...
[ "def", "get_val", "(", "dataset", ",", "timestamp", "=", "None", ")", ":", "if", "dataset", ".", "type", "==", "'array'", ":", "#TODO: design a mechansim to retrieve this data if it's stored externally", "return", "json", ".", "loads", "(", "dataset", ".", "value", ...
Turn the string value of a dataset into an appropriate value, be it a decimal value, array or time series. If a timestamp is passed to this function, return the values appropriate to the requested times. If the timestamp is *before* the start of the timeseries data, return None ...
[ "Turn", "the", "string", "value", "of", "a", "dataset", "into", "an", "appropriate", "value", "be", "it", "a", "decimal", "value", "array", "or", "time", "series", "." ]
python
train
eventable/vobject
vobject/behavior.py
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/behavior.py#L144-L169
def serialize(cls, obj, buf, lineLength, validate=True): """ Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize. ...
[ "def", "serialize", "(", "cls", ",", "obj", ",", "buf", ",", "lineLength", ",", "validate", "=", "True", ")", ":", "cls", ".", "generateImplicitParameters", "(", "obj", ")", "if", "validate", ":", "cls", ".", "validate", "(", "obj", ",", "raiseException"...
Set implicit parameters, do encoding, return unicode string. If validate is True, raise VObjectError if the line doesn't validate after implicit parameters are generated. Default is to call base.defaultSerialize.
[ "Set", "implicit", "parameters", "do", "encoding", "return", "unicode", "string", "." ]
python
train
vmlaker/mpipe
src/UnorderedWorker.py
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/UnorderedWorker.py#L42-L73
def assemble( cls, args, input_tube, output_tubes, size, disable_result, do_stop_task, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication c...
[ "def", "assemble", "(", "cls", ",", "args", ",", "input_tube", ",", "output_tubes", ",", "size", ",", "disable_result", ",", "do_stop_task", ",", ")", ":", "# Create the workers.", "workers", "=", "[", "]", "for", "ii", "in", "range", "(", "size", ")", "...
Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication channels *input_tube* and *output_tubes*. The number of workers created is according to *size* parameter. *do_stop_task* indicates whether doTask() will be...
[ "Create", "assemble", "and", "start", "workers", ".", "Workers", "are", "created", "of", "class", "*", "cls", "*", "initialized", "with", "*", "args", "*", "and", "given", "task", "/", "result", "communication", "channels", "*", "input_tube", "*", "and", "...
python
train
bioidiap/bob.ip.facedetect
bob/ip/facedetect/train/TrainingSet.py
https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/train/TrainingSet.py#L294-L438
def sample(self, model = None, maximum_number_of_positives = None, maximum_number_of_negatives = None, positive_indices = None, negative_indices = None): """sample([model], [maximum_number_of_positives], [maximum_number_of_negatives], [positive_indices], [negative_indices]) -> positives, negatives Returns posi...
[ "def", "sample", "(", "self", ",", "model", "=", "None", ",", "maximum_number_of_positives", "=", "None", ",", "maximum_number_of_negatives", "=", "None", ",", "positive_indices", "=", "None", ",", "negative_indices", "=", "None", ")", ":", "# get all existing fea...
sample([model], [maximum_number_of_positives], [maximum_number_of_negatives], [positive_indices], [negative_indices]) -> positives, negatives Returns positive and negative samples from the set of positives and negatives. This reads the previously extracted feature file (or all of them, in case features were e...
[ "sample", "(", "[", "model", "]", "[", "maximum_number_of_positives", "]", "[", "maximum_number_of_negatives", "]", "[", "positive_indices", "]", "[", "negative_indices", "]", ")", "-", ">", "positives", "negatives" ]
python
train
albertz/py_better_exchook
better_exchook.py
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L1382-L1387
def from_frame_summary(cls, f): """ :param FrameSummary f: :rtype: DummyFrame """ return cls(filename=f.filename, lineno=f.lineno, name=f.name, f_locals=f.locals)
[ "def", "from_frame_summary", "(", "cls", ",", "f", ")", ":", "return", "cls", "(", "filename", "=", "f", ".", "filename", ",", "lineno", "=", "f", ".", "lineno", ",", "name", "=", "f", ".", "name", ",", "f_locals", "=", "f", ".", "locals", ")" ]
:param FrameSummary f: :rtype: DummyFrame
[ ":", "param", "FrameSummary", "f", ":", ":", "rtype", ":", "DummyFrame" ]
python
train
acorg/dark-matter
dark/fasta.py
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L17-L30
def dedupFasta(reads): """ Remove sequence duplicates (based on sequence) from FASTA. @param reads: a C{dark.reads.Reads} instance. @return: a generator of C{dark.reads.Read} instances with no duplicates. """ seen = set() add = seen.add for read in reads: hash_ = md5(read.sequen...
[ "def", "dedupFasta", "(", "reads", ")", ":", "seen", "=", "set", "(", ")", "add", "=", "seen", ".", "add", "for", "read", "in", "reads", ":", "hash_", "=", "md5", "(", "read", ".", "sequence", ".", "encode", "(", "'UTF-8'", ")", ")", ".", "digest...
Remove sequence duplicates (based on sequence) from FASTA. @param reads: a C{dark.reads.Reads} instance. @return: a generator of C{dark.reads.Read} instances with no duplicates.
[ "Remove", "sequence", "duplicates", "(", "based", "on", "sequence", ")", "from", "FASTA", "." ]
python
train
CloverHealth/temple
temple/check.py
https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/check.py#L54-L60
def _has_branch(branch): """Return True if the target branch exists.""" ret = temple.utils.shell('git rev-parse --verify {}'.format(branch), stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL, check=False) return ret.re...
[ "def", "_has_branch", "(", "branch", ")", ":", "ret", "=", "temple", ".", "utils", ".", "shell", "(", "'git rev-parse --verify {}'", ".", "format", "(", "branch", ")", ",", "stderr", "=", "subprocess", ".", "DEVNULL", ",", "stdout", "=", "subprocess", ".",...
Return True if the target branch exists.
[ "Return", "True", "if", "the", "target", "branch", "exists", "." ]
python
valid
nerdynick/PySQLPool
src/PySQLPool/connection.py
https://github.com/nerdynick/PySQLPool/blob/a561275fea091e2667b69ce376c507f541b56e7d/src/PySQLPool/connection.py#L117-L122
def lock(self, block=True): """ Lock connection from being used else where """ self._locked = True return self._lock.acquire(block)
[ "def", "lock", "(", "self", ",", "block", "=", "True", ")", ":", "self", ".", "_locked", "=", "True", "return", "self", ".", "_lock", ".", "acquire", "(", "block", ")" ]
Lock connection from being used else where
[ "Lock", "connection", "from", "being", "used", "else", "where" ]
python
train
androguard/androguard
androguard/gui/sourcewindow.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/sourcewindow.py#L383-L395
def keyPressEvent(self, event): """Keyboard shortcuts""" key = event.key() if key == QtCore.Qt.Key_X: self.actionXref() elif key == QtCore.Qt.Key_G: self.actionGoto() elif key == QtCore.Qt.Key_X: self.actionXref() elif key == QtCore.Qt....
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "key", "=", "event", ".", "key", "(", ")", "if", "key", "==", "QtCore", ".", "Qt", ".", "Key_X", ":", "self", ".", "actionXref", "(", ")", "elif", "key", "==", "QtCore", ".", "Qt", ".",...
Keyboard shortcuts
[ "Keyboard", "shortcuts" ]
python
train
pantsbuild/pants
src/python/pants/base/parse_context.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/base/parse_context.py#L73-L93
def create_object_if_not_exists(self, alias, name=None, *args, **kwargs): """Constructs the type with the given alias using the given args and kwargs. NB: aliases may be the alias' object type itself if that type is known. :API: public :param alias: Either the type alias or the type itself. :type...
[ "def", "create_object_if_not_exists", "(", "self", ",", "alias", ",", "name", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "name", "is", "None", ":", "raise", "ValueError", "(", "\"Method requires an object `name`.\"", ")", "obj_cr...
Constructs the type with the given alias using the given args and kwargs. NB: aliases may be the alias' object type itself if that type is known. :API: public :param alias: Either the type alias or the type itself. :type alias: string|type :param *args: These pass through to the underlying callab...
[ "Constructs", "the", "type", "with", "the", "given", "alias", "using", "the", "given", "args", "and", "kwargs", "." ]
python
train
jgorset/django-respite
respite/formats.py
https://github.com/jgorset/django-respite/blob/719469d11baf91d05917bab1623bd82adc543546/respite/formats.py#L69-L79
def find_by_extension(extension): """ Find and return a format by extension. :param extension: A string describing the extension of the format. """ for format in FORMATS: if extension in format.extensions: return format raise UnknownFormat('No format found with extension "%...
[ "def", "find_by_extension", "(", "extension", ")", ":", "for", "format", "in", "FORMATS", ":", "if", "extension", "in", "format", ".", "extensions", ":", "return", "format", "raise", "UnknownFormat", "(", "'No format found with extension \"%s\"'", "%", "extension", ...
Find and return a format by extension. :param extension: A string describing the extension of the format.
[ "Find", "and", "return", "a", "format", "by", "extension", "." ]
python
train
bpannier/simpletr64
simpletr64/discover.py
https://github.com/bpannier/simpletr64/blob/31081139f4e6c85084a56de1617df73927135466/simpletr64/discover.py#L114-L265
def discoverParticularHost(host, service="ssdp:all", deviceDefinitionURL=None, timeout=1, retries=2, ipAddress="239.255.255.250", port=1900, proxies=None): """Discover a particular host and find the best response. This tries to find the most specific discovery result for ...
[ "def", "discoverParticularHost", "(", "host", ",", "service", "=", "\"ssdp:all\"", ",", "deviceDefinitionURL", "=", "None", ",", "timeout", "=", "1", ",", "retries", "=", "2", ",", "ipAddress", "=", "\"239.255.255.250\"", ",", "port", "=", "1900", ",", "prox...
Discover a particular host and find the best response. This tries to find the most specific discovery result for the given host. Only the discovery result contains the URL to the XML tree which initializes the device definition. If an URL is already known it should be provided to avoid addition...
[ "Discover", "a", "particular", "host", "and", "find", "the", "best", "response", "." ]
python
train
frnsys/broca
broca/tokenize/keyword/apriori.py
https://github.com/frnsys/broca/blob/7236dcf54edc0a4a54a55eb93be30800910667e7/broca/tokenize/keyword/apriori.py#L21-L62
def tokenize(self, docs): """ The first pass consists of converting documents into "transactions" (sets of their tokens) and the initial frequency/support filtering. Then iterate until we close in on a final set. `docs` can be any iterator or generator so long as it yie...
[ "def", "tokenize", "(", "self", ",", "docs", ")", ":", "if", "self", ".", "min_sup", "<", "1", "/", "len", "(", "docs", ")", ":", "raise", "Exception", "(", "'`min_sup` must be greater than or equal to `1/len(docs)`.'", ")", "# First pass", "candidates", "=", ...
The first pass consists of converting documents into "transactions" (sets of their tokens) and the initial frequency/support filtering. Then iterate until we close in on a final set. `docs` can be any iterator or generator so long as it yields lists. Each list represents a docu...
[ "The", "first", "pass", "consists", "of", "converting", "documents", "into", "transactions", "(", "sets", "of", "their", "tokens", ")", "and", "the", "initial", "frequency", "/", "support", "filtering", "." ]
python
train
shexSpec/grammar
parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py
https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py#L69-L84
def visitValueSetValue(self, ctx: ShExDocParser.ValueSetValueContext): """ valueSetValue: iriRange | literalRange | languageRange | '.' (iriExclusion+ | literalExclusion+ | languageExclusion+) """ if ctx.iriRange() or ctx.literalRange() or ctx.languageRange(): self.visitChildren...
[ "def", "visitValueSetValue", "(", "self", ",", "ctx", ":", "ShExDocParser", ".", "ValueSetValueContext", ")", ":", "if", "ctx", ".", "iriRange", "(", ")", "or", "ctx", ".", "literalRange", "(", ")", "or", "ctx", ".", "languageRange", "(", ")", ":", "self...
valueSetValue: iriRange | literalRange | languageRange | '.' (iriExclusion+ | literalExclusion+ | languageExclusion+)
[ "valueSetValue", ":", "iriRange", "|", "literalRange", "|", "languageRange", "|", ".", "(", "iriExclusion", "+", "|", "literalExclusion", "+", "|", "languageExclusion", "+", ")" ]
python
train
aparo/pyes
pyes/mappings.py
https://github.com/aparo/pyes/blob/712eb6095961755067b2b5baa262008ade6584b3/pyes/mappings.py#L489-L520
def get_properties_by_type(self, type, recursive=True, parent_path=""): """ Returns a sorted list of fields that match the type. :param type the type of the field "string","integer" or a list of types :param recursive recurse to sub object :returns a sorted list of fields the ma...
[ "def", "get_properties_by_type", "(", "self", ",", "type", ",", "recursive", "=", "True", ",", "parent_path", "=", "\"\"", ")", ":", "if", "parent_path", ":", "parent_path", "+=", "\".\"", "if", "isinstance", "(", "type", ",", "str", ")", ":", "if", "typ...
Returns a sorted list of fields that match the type. :param type the type of the field "string","integer" or a list of types :param recursive recurse to sub object :returns a sorted list of fields the match the type
[ "Returns", "a", "sorted", "list", "of", "fields", "that", "match", "the", "type", "." ]
python
train
tanghaibao/jcvi
jcvi/annotation/ahrd.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/annotation/ahrd.py#L248-L528
def fix_text(s, ignore_sym_pat=False): if not ignore_sym_pat: # Fix descriptions like D7TDB1 ( s = re.sub("([A-Z0-9]){6} \(", "", s) s = s.split(";")[0] # Fix parantheses containing names s = s.translate(None, "[]") s = s.replace("(-)", "[-]") s = s.replace("(+)", "[+]") ...
[ "def", "fix_text", "(", "s", ",", "ignore_sym_pat", "=", "False", ")", ":", "if", "not", "ignore_sym_pat", ":", "# Fix descriptions like D7TDB1 (", "s", "=", "re", ".", "sub", "(", "\"([A-Z0-9]){6} \\(\"", ",", "\"\"", ",", "s", ")", "s", "=", "s", ".", ...
case (qr/^Histone-lysine/) { $ahrd =~ s/,\s+H\d{1}\s+lysine\-\d+//gs; }
[ "case", "(", "qr", "/", "^Histone", "-", "lysine", "/", ")", "{", "$ahrd", "=", "~", "s", "/", "\\", "s", "+", "H", "\\", "d", "{", "1", "}", "\\", "s", "+", "lysine", "\\", "-", "\\", "d", "+", "//", "gs", ";", "}" ]
python
train
timothyb0912/pylogit
pylogit/bootstrap_sampler.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/bootstrap_sampler.py#L207-L242
def create_deepcopied_groupby_dict(orig_df, obs_id_col): """ Will create a dictionary where each key corresponds to a unique value in `orig_df[obs_id_col]` and each value corresponds to all of the rows of `orig_df` where `orig_df[obs_id_col] == key`. Parameters ---------- orig_df : pandas D...
[ "def", "create_deepcopied_groupby_dict", "(", "orig_df", ",", "obs_id_col", ")", ":", "# Get the observation id values", "obs_id_vals", "=", "orig_df", "[", "obs_id_col", "]", ".", "values", "# Get the unique observation ids", "unique_obs_ids", "=", "np", ".", "unique", ...
Will create a dictionary where each key corresponds to a unique value in `orig_df[obs_id_col]` and each value corresponds to all of the rows of `orig_df` where `orig_df[obs_id_col] == key`. Parameters ---------- orig_df : pandas DataFrame. Should be long-format dataframe containing the data...
[ "Will", "create", "a", "dictionary", "where", "each", "key", "corresponds", "to", "a", "unique", "value", "in", "orig_df", "[", "obs_id_col", "]", "and", "each", "value", "corresponds", "to", "all", "of", "the", "rows", "of", "orig_df", "where", "orig_df", ...
python
train
saltstack/salt
salt/states/zabbix_template.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L375-L699
def present(name, params, static_host_list=True, **kwargs): ''' Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation. Zabbix API version: >3.0 :param name: Zabbix Template name :param params: Additional parameters according to Zabbix API...
[ "def", "present", "(", "name", ",", "params", ",", "static_host_list", "=", "True", ",", "*", "*", "kwargs", ")", ":", "zabbix_id_mapper", "=", "__salt__", "[", "'zabbix.get_zabbix_id_mapper'", "]", "(", ")", "dry_run", "=", "__opts__", "[", "'test'", "]", ...
Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation. Zabbix API version: >3.0 :param name: Zabbix Template name :param params: Additional parameters according to Zabbix API documentation :param static_host_list: If hosts assigned to the tem...
[ "Creates", "Zabbix", "Template", "object", "or", "if", "differs", "update", "it", "according", "defined", "parameters", ".", "See", "Zabbix", "API", "documentation", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/ext/muc/muc.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L848-L895
def join(self, room, nick, handler, password = None, history_maxchars = None, history_maxstanzas = None, history_seconds = None, history_since = None): """ Create and return a new room state object and request joining to a MUC room. :Parameters: - `room`: the nam...
[ "def", "join", "(", "self", ",", "room", ",", "nick", ",", "handler", ",", "password", "=", "None", ",", "history_maxchars", "=", "None", ",", "history_maxstanzas", "=", "None", ",", "history_seconds", "=", "None", ",", "history_since", "=", "None", ")", ...
Create and return a new room state object and request joining to a MUC room. :Parameters: - `room`: the name of a room to be joined - `nick`: the nickname to be used in the room - `handler`: is an object to handle room events. - `password`: password for t...
[ "Create", "and", "return", "a", "new", "room", "state", "object", "and", "request", "joining", "to", "a", "MUC", "room", "." ]
python
valid
PmagPy/PmagPy
programs/demag_gui.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/demag_gui.py#L7637-L7685
def on_zijd_mark(self, event): """ Get mouse position on double right click find the interpretation in range of mouse position then mark that interpretation bad or good Parameters ---------- event : the wx Mouseevent for that click Alters ------ ...
[ "def", "on_zijd_mark", "(", "self", ",", "event", ")", ":", "if", "not", "array", "(", "self", ".", "CART_rot", ")", ".", "any", "(", ")", ":", "return", "pos", "=", "event", ".", "GetPosition", "(", ")", "width", ",", "height", "=", "self", ".", ...
Get mouse position on double right click find the interpretation in range of mouse position then mark that interpretation bad or good Parameters ---------- event : the wx Mouseevent for that click Alters ------ current_fit
[ "Get", "mouse", "position", "on", "double", "right", "click", "find", "the", "interpretation", "in", "range", "of", "mouse", "position", "then", "mark", "that", "interpretation", "bad", "or", "good" ]
python
train
chriso/gauged
gauged/writer.py
https://github.com/chriso/gauged/blob/cda3bba2f3e92ce2fb4aa92132dcc0e689bf7976/gauged/writer.py#L210-L223
def parse_query(self, query): """Parse a query string and return an iterator which yields (key, value)""" writer = self.writer if writer is None: raise GaugedUseAfterFreeError Gauged.writer_parse_query(writer, query) position = 0 writer_contents = writ...
[ "def", "parse_query", "(", "self", ",", "query", ")", ":", "writer", "=", "self", ".", "writer", "if", "writer", "is", "None", ":", "raise", "GaugedUseAfterFreeError", "Gauged", ".", "writer_parse_query", "(", "writer", ",", "query", ")", "position", "=", ...
Parse a query string and return an iterator which yields (key, value)
[ "Parse", "a", "query", "string", "and", "return", "an", "iterator", "which", "yields", "(", "key", "value", ")" ]
python
train
mwhooker/jones
jones/jones.py
https://github.com/mwhooker/jones/blob/121e89572ca063f456b8e94cbb8cbee26c307a8f/jones/jones.py#L153-L171
def set_config(self, env, conf, version): """ Set conf to env under service. pass None to env for root. """ if not isinstance(conf, collections.Mapping): raise ValueError("conf must be a collections.Mapping") self._set( self._get_env_path(env), ...
[ "def", "set_config", "(", "self", ",", "env", ",", "conf", ",", "version", ")", ":", "if", "not", "isinstance", "(", "conf", ",", "collections", ".", "Mapping", ")", ":", "raise", "ValueError", "(", "\"conf must be a collections.Mapping\"", ")", "self", ".",...
Set conf to env under service. pass None to env for root.
[ "Set", "conf", "to", "env", "under", "service", "." ]
python
train
aestrivex/bctpy
bct/algorithms/physical_connectivity.py
https://github.com/aestrivex/bctpy/blob/4cb0e759eb4a038750b07e23bd29958c400684b8/bct/algorithms/physical_connectivity.py#L65-L162
def rentian_scaling(A, xyz, n, seed=None): ''' Physical Rentian scaling (or more simply Rentian scaling) is a property of systems that are cost-efficiently embedded into physical space. It is what is called a "topo-physical" property because it combines information regarding the topological organiza...
[ "def", "rentian_scaling", "(", "A", ",", "xyz", ",", "n", ",", "seed", "=", "None", ")", ":", "rng", "=", "get_rng", "(", "seed", ")", "m", "=", "np", ".", "size", "(", "xyz", ",", "axis", "=", "0", ")", "# find number of nodes in system", "# rescale...
Physical Rentian scaling (or more simply Rentian scaling) is a property of systems that are cost-efficiently embedded into physical space. It is what is called a "topo-physical" property because it combines information regarding the topological organization of the graph with information about the physic...
[ "Physical", "Rentian", "scaling", "(", "or", "more", "simply", "Rentian", "scaling", ")", "is", "a", "property", "of", "systems", "that", "are", "cost", "-", "efficiently", "embedded", "into", "physical", "space", ".", "It", "is", "what", "is", "called", "...
python
train
nickjj/ansigenome
ansigenome/scan.py
https://github.com/nickjj/ansigenome/blob/70cd98d7a23d36c56f4e713ea820cfb4c485c81c/ansigenome/scan.py#L324-L337
def tally_role_columns(self): """ Sum up all of the stat columns. """ totals = self.report["totals"] roles = self.report["roles"] totals["dependencies"] = sum(roles[item] ["total_dependencies"] for item in roles) totals["defau...
[ "def", "tally_role_columns", "(", "self", ")", ":", "totals", "=", "self", ".", "report", "[", "\"totals\"", "]", "roles", "=", "self", ".", "report", "[", "\"roles\"", "]", "totals", "[", "\"dependencies\"", "]", "=", "sum", "(", "roles", "[", "item", ...
Sum up all of the stat columns.
[ "Sum", "up", "all", "of", "the", "stat", "columns", "." ]
python
train
resync/resync
resync/list_base_with_index.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/list_base_with_index.py#L136-L178
def read_component_sitemap( self, sitemapindex_uri, sitemap_uri, sitemap, sitemapindex_is_file): """Read a component sitemap of a Resource List with index. Each component must be a sitemap with the """ if (sitemapindex_is_file): if (not self.is_file_uri(sitemap_u...
[ "def", "read_component_sitemap", "(", "self", ",", "sitemapindex_uri", ",", "sitemap_uri", ",", "sitemap", ",", "sitemapindex_is_file", ")", ":", "if", "(", "sitemapindex_is_file", ")", ":", "if", "(", "not", "self", ".", "is_file_uri", "(", "sitemap_uri", ")", ...
Read a component sitemap of a Resource List with index. Each component must be a sitemap with the
[ "Read", "a", "component", "sitemap", "of", "a", "Resource", "List", "with", "index", "." ]
python
train
ascribe/pyspool
spool/spoolex.py
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolex.py#L121-L135
def chain(tree, edition_number): """ Args: tree (dict): Tree history of all editions of a piece. edition_number (int): The edition number to check for. In the case of a piece (master edition), an empty string (``''``) or zero (``0``) can be passed....
[ "def", "chain", "(", "tree", ",", "edition_number", ")", ":", "# return the chain for an edition_number sorted by the timestamp", "return", "sorted", "(", "tree", ".", "get", "(", "edition_number", ",", "[", "]", ")", ",", "key", "=", "lambda", "d", ":", "d", ...
Args: tree (dict): Tree history of all editions of a piece. edition_number (int): The edition number to check for. In the case of a piece (master edition), an empty string (``''``) or zero (``0``) can be passed. Returns: list: The chain of own...
[ "Args", ":", "tree", "(", "dict", ")", ":", "Tree", "history", "of", "all", "editions", "of", "a", "piece", ".", "edition_number", "(", "int", ")", ":", "The", "edition", "number", "to", "check", "for", ".", "In", "the", "case", "of", "a", "piece", ...
python
train
abilian/abilian-core
abilian/web/tags/extension.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/web/tags/extension.py#L90-L97
def entity_tags_form(self, entity, ns=None): """Construct a form class with a field for tags in namespace `ns`.""" if ns is None: ns = self.entity_default_ns(entity) field = TagsField(label=_l("Tags"), ns=ns) cls = type("EntityNSTagsForm", (_TagsForm,), {"tags": field}) ...
[ "def", "entity_tags_form", "(", "self", ",", "entity", ",", "ns", "=", "None", ")", ":", "if", "ns", "is", "None", ":", "ns", "=", "self", ".", "entity_default_ns", "(", "entity", ")", "field", "=", "TagsField", "(", "label", "=", "_l", "(", "\"Tags\...
Construct a form class with a field for tags in namespace `ns`.
[ "Construct", "a", "form", "class", "with", "a", "field", "for", "tags", "in", "namespace", "ns", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L10221-L10238
def reclat(rectan): """ Convert from rectangular coordinates to latitudinal coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reclat_c.html :param rectan: Rectangular coordinates of a point. :type rectan: 3-Element Array of floats :return: Distance from the origin, Longitude...
[ "def", "reclat", "(", "rectan", ")", ":", "rectan", "=", "stypes", ".", "toDoubleVector", "(", "rectan", ")", "radius", "=", "ctypes", ".", "c_double", "(", "0", ")", "longitude", "=", "ctypes", ".", "c_double", "(", "0", ")", "latitude", "=", "ctypes"...
Convert from rectangular coordinates to latitudinal coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reclat_c.html :param rectan: Rectangular coordinates of a point. :type rectan: 3-Element Array of floats :return: Distance from the origin, Longitude in radians, Latitude in radians...
[ "Convert", "from", "rectangular", "coordinates", "to", "latitudinal", "coordinates", "." ]
python
train
sammchardy/python-kucoin
kucoin/client.py
https://github.com/sammchardy/python-kucoin/blob/a4cacde413804784bd313f27a0ad37234888be29/kucoin/client.py#L377-L455
def get_account_activity(self, account_id, start=None, end=None, page=None, limit=None): """Get list of account activity https://docs.kucoin.com/#get-account-history :param account_id: ID for account - from list_accounts() :type account_id: string :param start: (optional) Start...
[ "def", "get_account_activity", "(", "self", ",", "account_id", ",", "start", "=", "None", ",", "end", "=", "None", ",", "page", "=", "None", ",", "limit", "=", "None", ")", ":", "data", "=", "{", "}", "if", "start", ":", "data", "[", "'startAt'", "...
Get list of account activity https://docs.kucoin.com/#get-account-history :param account_id: ID for account - from list_accounts() :type account_id: string :param start: (optional) Start time as unix timestamp :type start: string :param end: (optional) End time as unix ...
[ "Get", "list", "of", "account", "activity" ]
python
train
studionow/pybrightcove
pybrightcove/video.py
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L623-L630
def get_status(video_id, _connection=None): """ Get the status of a video given the ``video_id`` parameter. """ c = _connection if not c: c = connection.APIConnection() return c.post('get_upload_status', video_id=video_id)
[ "def", "get_status", "(", "video_id", ",", "_connection", "=", "None", ")", ":", "c", "=", "_connection", "if", "not", "c", ":", "c", "=", "connection", ".", "APIConnection", "(", ")", "return", "c", ".", "post", "(", "'get_upload_status'", ",", "video_i...
Get the status of a video given the ``video_id`` parameter.
[ "Get", "the", "status", "of", "a", "video", "given", "the", "video_id", "parameter", "." ]
python
train
glormph/msstitch
src/app/writers/tsv.py
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/writers/tsv.py#L1-L12
def write_tsv(headerfields, features, outfn): """Writes header and generator of lines to tab separated file. headerfields - list of field names in header in correct order features - generates 1 list per line that belong to header outfn - filename to output to. Overwritten if exists """ with ope...
[ "def", "write_tsv", "(", "headerfields", ",", "features", ",", "outfn", ")", ":", "with", "open", "(", "outfn", ",", "'w'", ")", "as", "fp", ":", "write_tsv_line_from_list", "(", "headerfields", ",", "fp", ")", "for", "line", "in", "features", ":", "writ...
Writes header and generator of lines to tab separated file. headerfields - list of field names in header in correct order features - generates 1 list per line that belong to header outfn - filename to output to. Overwritten if exists
[ "Writes", "header", "and", "generator", "of", "lines", "to", "tab", "separated", "file", "." ]
python
train
delfick/harpoon
harpoon/actions.py
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L172-L192
def make_all(collector, **kwargs): """Creates all the images in layered order""" configuration = collector.configuration push = configuration["harpoon"].do_push only_pushable = configuration["harpoon"].only_pushable if push: only_pushable = True tag = kwargs.get("artifact", NotSpecified...
[ "def", "make_all", "(", "collector", ",", "*", "*", "kwargs", ")", ":", "configuration", "=", "collector", ".", "configuration", "push", "=", "configuration", "[", "\"harpoon\"", "]", ".", "do_push", "only_pushable", "=", "configuration", "[", "\"harpoon\"", "...
Creates all the images in layered order
[ "Creates", "all", "the", "images", "in", "layered", "order" ]
python
train
cs50/lib50
lib50/_api.py
https://github.com/cs50/lib50/blob/941767f6c0a3b81af0cdea48c25c8d5a761086eb/lib50/_api.py#L129-L202
def files(patterns, require_tags=("require",), include_tags=("include",), exclude_tags=("exclude",), root=".", always_exclude=("**/.git*", "**/.lfs*", "**/.c9*", "**/.~c9*")): """ Takes a list of lib50._config.TaggedValue returns which files should be included a...
[ "def", "files", "(", "patterns", ",", "require_tags", "=", "(", "\"require\"", ",", ")", ",", "include_tags", "=", "(", "\"include\"", ",", ")", ",", "exclude_tags", "=", "(", "\"exclude\"", ",", ")", ",", "root", "=", "\".\"", ",", "always_exclude", "="...
Takes a list of lib50._config.TaggedValue returns which files should be included and excluded from `root`. Any pattern tagged with a tag from include_tags will be included from require_tags can only be a file, that will then be included. MissingFilesError is raised if missing from exclude_ta...
[ "Takes", "a", "list", "of", "lib50", ".", "_config", ".", "TaggedValue", "returns", "which", "files", "should", "be", "included", "and", "excluded", "from", "root", ".", "Any", "pattern", "tagged", "with", "a", "tag", "from", "include_tags", "will", "be", ...
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L140-L145
def cmd_reboot(self, args): '''reboot autopilot''' if len(args) > 0 and args[0] == 'bootloader': self.master.reboot_autopilot(True) else: self.master.reboot_autopilot()
[ "def", "cmd_reboot", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", ">", "0", "and", "args", "[", "0", "]", "==", "'bootloader'", ":", "self", ".", "master", ".", "reboot_autopilot", "(", "True", ")", "else", ":", "self", ".", ...
reboot autopilot
[ "reboot", "autopilot" ]
python
train
kislyuk/aegea
aegea/packages/github3/repos/repo.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L600-L618
def create_hook(self, name, config, events=['push'], active=True): """Create a hook on this repository. :param str name: (required), name of the hook :param dict config: (required), key-value pairs which act as settings for this hook :param list events: (optional), events th...
[ "def", "create_hook", "(", "self", ",", "name", ",", "config", ",", "events", "=", "[", "'push'", "]", ",", "active", "=", "True", ")", ":", "json", "=", "None", "if", "name", "and", "config", "and", "isinstance", "(", "config", ",", "dict", ")", "...
Create a hook on this repository. :param str name: (required), name of the hook :param dict config: (required), key-value pairs which act as settings for this hook :param list events: (optional), events the hook is triggered for :param bool active: (optional), whether the ho...
[ "Create", "a", "hook", "on", "this", "repository", "." ]
python
train
PrefPy/prefpy
prefpy/mechanismMcmcSampleGenerator.py
https://github.com/PrefPy/prefpy/blob/f395ba3782f05684fa5de0cece387a6da9391d02/prefpy/mechanismMcmcSampleGenerator.py#L98-L121
def getNextSample(self, V): """ Generate the next sample by randomly shuffling candidates. :ivar list<int> V: Contains integer representations of each candidate in order of their ranking in a vote, from first to last. This is the current sample. """ positions = rang...
[ "def", "getNextSample", "(", "self", ",", "V", ")", ":", "positions", "=", "range", "(", "0", ",", "len", "(", "self", ".", "wmg", ")", ")", "randPoss", "=", "random", ".", "sample", "(", "positions", ",", "self", ".", "shuffleSize", ")", "flipSet", ...
Generate the next sample by randomly shuffling candidates. :ivar list<int> V: Contains integer representations of each candidate in order of their ranking in a vote, from first to last. This is the current sample.
[ "Generate", "the", "next", "sample", "by", "randomly", "shuffling", "candidates", "." ]
python
train
CivicSpleen/ambry
ambry/exporters/ckan/core.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L141-L147
def is_exported(bundle): """ Returns True if dataset is already exported to CKAN. Otherwise returns False. """ if not ckan: raise EnvironmentError(MISSING_CREDENTIALS_MSG) params = {'q': 'name:{}'.format(bundle.dataset.vid.lower())} resp = ckan.action.package_search(**params) return len(resp...
[ "def", "is_exported", "(", "bundle", ")", ":", "if", "not", "ckan", ":", "raise", "EnvironmentError", "(", "MISSING_CREDENTIALS_MSG", ")", "params", "=", "{", "'q'", ":", "'name:{}'", ".", "format", "(", "bundle", ".", "dataset", ".", "vid", ".", "lower", ...
Returns True if dataset is already exported to CKAN. Otherwise returns False.
[ "Returns", "True", "if", "dataset", "is", "already", "exported", "to", "CKAN", ".", "Otherwise", "returns", "False", "." ]
python
train
scanny/python-pptx
pptx/oxml/chart/series.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/oxml/chart/series.py#L168-L178
def get_or_add_dPt_for_point(self, idx): """ Return the `c:dPt` child representing the visual properties of the data point at index *idx*. """ matches = self.xpath('c:dPt[c:idx[@val="%d"]]' % idx) if matches: return matches[0] dPt = self._add_dPt() ...
[ "def", "get_or_add_dPt_for_point", "(", "self", ",", "idx", ")", ":", "matches", "=", "self", ".", "xpath", "(", "'c:dPt[c:idx[@val=\"%d\"]]'", "%", "idx", ")", "if", "matches", ":", "return", "matches", "[", "0", "]", "dPt", "=", "self", ".", "_add_dPt", ...
Return the `c:dPt` child representing the visual properties of the data point at index *idx*.
[ "Return", "the", "c", ":", "dPt", "child", "representing", "the", "visual", "properties", "of", "the", "data", "point", "at", "index", "*", "idx", "*", "." ]
python
train
Danielhiversen/pyTibber
tibber/__init__.py
https://github.com/Danielhiversen/pyTibber/blob/114ebc3dd49f6affd93665b0862d4cbdea03e9ef/tibber/__init__.py#L541-L546
async def rt_unsubscribe(self): """Unsubscribe to Tibber rt subscription.""" if self._subscription_id is None: _LOGGER.error("Not subscribed.") return await self._tibber_control.sub_manager.unsubscribe(self._subscription_id)
[ "async", "def", "rt_unsubscribe", "(", "self", ")", ":", "if", "self", ".", "_subscription_id", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Not subscribed.\"", ")", "return", "await", "self", ".", "_tibber_control", ".", "sub_manager", ".", "unsubscrib...
Unsubscribe to Tibber rt subscription.
[ "Unsubscribe", "to", "Tibber", "rt", "subscription", "." ]
python
valid
insilichem/ommprotocol
ommprotocol/io.py
https://github.com/insilichem/ommprotocol/blob/7283fddba7203e5ac3542fdab41fc1279d3b444e/ommprotocol/io.py#L284-L309
def from_charmm(cls, path, positions=None, forcefield=None, strict=True, **kwargs): """ Loads PSF Charmm structure from `path`. Requires `charmm_parameters`. Parameters ---------- path : str Path to PSF file forcefield : list of str Paths to Charm...
[ "def", "from_charmm", "(", "cls", ",", "path", ",", "positions", "=", "None", ",", "forcefield", "=", "None", ",", "strict", "=", "True", ",", "*", "*", "kwargs", ")", ":", "psf", "=", "CharmmPsfFile", "(", "path", ")", "if", "strict", "and", "forcef...
Loads PSF Charmm structure from `path`. Requires `charmm_parameters`. Parameters ---------- path : str Path to PSF file forcefield : list of str Paths to Charmm parameters files, such as *.par or *.str. REQUIRED Returns ------- psf : Syst...
[ "Loads", "PSF", "Charmm", "structure", "from", "path", ".", "Requires", "charmm_parameters", "." ]
python
train
dropbox/pygerduty
pygerduty/events.py
https://github.com/dropbox/pygerduty/blob/11b28bfb66306aa7fc2b95ab9df65eb97ea831cf/pygerduty/events.py#L57-L65
def resolve_incident(self, incident_key, description=None, details=None): """ Causes the referenced incident to enter resolved state. Send a resolve event when the problem that caused the initial trigger has been fixed. """ return self.create_event(descr...
[ "def", "resolve_incident", "(", "self", ",", "incident_key", ",", "description", "=", "None", ",", "details", "=", "None", ")", ":", "return", "self", ".", "create_event", "(", "description", ",", "\"resolve\"", ",", "details", ",", "incident_key", ")" ]
Causes the referenced incident to enter resolved state. Send a resolve event when the problem that caused the initial trigger has been fixed.
[ "Causes", "the", "referenced", "incident", "to", "enter", "resolved", "state", ".", "Send", "a", "resolve", "event", "when", "the", "problem", "that", "caused", "the", "initial", "trigger", "has", "been", "fixed", "." ]
python
train
svinota/mdns
mdns/zeroconf.py
https://github.com/svinota/mdns/blob/295f6407132616a0ff7401124b9057d89555f91d/mdns/zeroconf.py#L425-L429
def reset_ttl(self, other): """Sets this record's TTL and created time to that of another record.""" self.created = other.created self.ttl = other.ttl
[ "def", "reset_ttl", "(", "self", ",", "other", ")", ":", "self", ".", "created", "=", "other", ".", "created", "self", ".", "ttl", "=", "other", ".", "ttl" ]
Sets this record's TTL and created time to that of another record.
[ "Sets", "this", "record", "s", "TTL", "and", "created", "time", "to", "that", "of", "another", "record", "." ]
python
train
dslackw/slpkg
slpkg/binary/install.py
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L208-L216
def clear_masters(self): """Clear master packages if already exist in dependencies or if added to install two or more times """ packages = [] for mas in Utils().remove_dbs(self.packages): if mas not in self.dependencies: packages.append(mas) se...
[ "def", "clear_masters", "(", "self", ")", ":", "packages", "=", "[", "]", "for", "mas", "in", "Utils", "(", ")", ".", "remove_dbs", "(", "self", ".", "packages", ")", ":", "if", "mas", "not", "in", "self", ".", "dependencies", ":", "packages", ".", ...
Clear master packages if already exist in dependencies or if added to install two or more times
[ "Clear", "master", "packages", "if", "already", "exist", "in", "dependencies", "or", "if", "added", "to", "install", "two", "or", "more", "times" ]
python
train
freevoid/django-datafilters
datafilters/views.py
https://github.com/freevoid/django-datafilters/blob/99051b3b3e97946981c0e9697576b0100093287c/datafilters/views.py#L33-L43
def get_context_data(self, **kwargs): """ Add filter form to the context. TODO: Currently we construct the filter form object twice - in get_queryset and here, in get_context_data. Will need to figure out a good way to eliminate extra initialization. """ context ...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "FilterFormMixin", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "context", "[", "self", ".", "context_filterform_name", "]"...
Add filter form to the context. TODO: Currently we construct the filter form object twice - in get_queryset and here, in get_context_data. Will need to figure out a good way to eliminate extra initialization.
[ "Add", "filter", "form", "to", "the", "context", "." ]
python
train
ontio/ontology-python-sdk
ontology/io/binary_writer.py
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_writer.py#L337-L354
def write_fixed_str(self, value, length): """ Write a string value to the stream. Args: value (str): value to write to the stream. length (int): length of the string to write. """ towrite = value.encode('utf-8') slen = len(towrite) if slen...
[ "def", "write_fixed_str", "(", "self", ",", "value", ",", "length", ")", ":", "towrite", "=", "value", ".", "encode", "(", "'utf-8'", ")", "slen", "=", "len", "(", "towrite", ")", "if", "slen", ">", "length", ":", "raise", "SDKException", "(", "ErrorCo...
Write a string value to the stream. Args: value (str): value to write to the stream. length (int): length of the string to write.
[ "Write", "a", "string", "value", "to", "the", "stream", "." ]
python
train
phn/angles
angles.py
https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L406-L477
def sexa2deci(sign, hd, mm, ss, todeg=False): """Combine sexagesimal components into a decimal number. Parameters ---------- sign : int Sign of the number: 1 for +ve, -1 for negative. hd : float The hour or degree like part. mm : float The minute or arc-minute like part....
[ "def", "sexa2deci", "(", "sign", ",", "hd", ",", "mm", ",", "ss", ",", "todeg", "=", "False", ")", ":", "divisors", "=", "[", "1.0", ",", "60.0", ",", "3600.0", "]", "d", "=", "0.0", "# sexages[0] is sign.", "if", "sign", "not", "in", "(", "-", "...
Combine sexagesimal components into a decimal number. Parameters ---------- sign : int Sign of the number: 1 for +ve, -1 for negative. hd : float The hour or degree like part. mm : float The minute or arc-minute like part. ss : float The second or arc-second like...
[ "Combine", "sexagesimal", "components", "into", "a", "decimal", "number", "." ]
python
train
osrg/ryu
ryu/services/protocols/vrrp/api.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/api.py#L48-L54
def vrrp_list(app, instance_name=None): """list instances. returns EventVRRPListReply([VRRPInstance]). """ list_request = vrrp_event.EventVRRPListRequest(instance_name) list_request.dst = vrrp_event.VRRP_MANAGER_NAME return app.send_request(list_request)
[ "def", "vrrp_list", "(", "app", ",", "instance_name", "=", "None", ")", ":", "list_request", "=", "vrrp_event", ".", "EventVRRPListRequest", "(", "instance_name", ")", "list_request", ".", "dst", "=", "vrrp_event", ".", "VRRP_MANAGER_NAME", "return", "app", ".",...
list instances. returns EventVRRPListReply([VRRPInstance]).
[ "list", "instances", ".", "returns", "EventVRRPListReply", "(", "[", "VRRPInstance", "]", ")", "." ]
python
train
saltstack/salt
salt/cloud/clouds/profitbricks.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1146-L1179
def _get_system_volume(vm_): ''' Construct VM system volume list from cloud profile config ''' # Override system volume size if 'disk_size' is defined in cloud profile disk_size = get_size(vm_)['disk'] if 'disk_size' in vm_: disk_size = vm_['disk_size'] # Construct the system volum...
[ "def", "_get_system_volume", "(", "vm_", ")", ":", "# Override system volume size if 'disk_size' is defined in cloud profile", "disk_size", "=", "get_size", "(", "vm_", ")", "[", "'disk'", "]", "if", "'disk_size'", "in", "vm_", ":", "disk_size", "=", "vm_", "[", "'d...
Construct VM system volume list from cloud profile config
[ "Construct", "VM", "system", "volume", "list", "from", "cloud", "profile", "config" ]
python
train
torfsen/service
src/service/__init__.py
https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L267-L277
def _get_signal_event(self, s): ''' Get the event for a signal. Checks if the signal has been enabled and raises a ``ValueError`` if not. ''' try: return self._signal_events[int(s)] except KeyError: raise ValueError('Signal {} has not been...
[ "def", "_get_signal_event", "(", "self", ",", "s", ")", ":", "try", ":", "return", "self", ".", "_signal_events", "[", "int", "(", "s", ")", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "'Signal {} has not been enabled'", ".", "format", "(", ...
Get the event for a signal. Checks if the signal has been enabled and raises a ``ValueError`` if not.
[ "Get", "the", "event", "for", "a", "signal", "." ]
python
train
Tanganelli/CoAPthon3
coapthon/layers/forwardLayer.py
https://github.com/Tanganelli/CoAPthon3/blob/985763bfe2eb9e00f49ec100c5b8877c2ed7d531/coapthon/layers/forwardLayer.py#L44-L80
def receive_request_reverse(self, transaction): """ Setup the transaction for forwarding purposes on Reverse Proxies. :type transaction: Transaction :param transaction: the transaction that owns the request :rtype : Transaction :return: the edited transaction ...
[ "def", "receive_request_reverse", "(", "self", ",", "transaction", ")", ":", "path", "=", "str", "(", "\"/\"", "+", "transaction", ".", "request", ".", "uri_path", ")", "transaction", ".", "response", "=", "Response", "(", ")", "transaction", ".", "response"...
Setup the transaction for forwarding purposes on Reverse Proxies. :type transaction: Transaction :param transaction: the transaction that owns the request :rtype : Transaction :return: the edited transaction
[ "Setup", "the", "transaction", "for", "forwarding", "purposes", "on", "Reverse", "Proxies", ".", ":", "type", "transaction", ":", "Transaction", ":", "param", "transaction", ":", "the", "transaction", "that", "owns", "the", "request", ":", "rtype", ":", "Trans...
python
train
allianceauth/allianceauth
allianceauth/services/modules/teamspeak3/util/ts3.py
https://github.com/allianceauth/allianceauth/blob/6585b07e96571a99a4d6dc03cc03f9b8c8f690ca/allianceauth/services/modules/teamspeak3/util/ts3.py#L190-L202
def _unescape_str(value): """ Unescape a TS3 compatible string into a normal string @param value: Value @type value: string/int """ if isinstance(value, int): return "%d" % value value = value.replace(r"\\", "\\") for i, j in ts3_escape.items(...
[ "def", "_unescape_str", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "int", ")", ":", "return", "\"%d\"", "%", "value", "value", "=", "value", ".", "replace", "(", "r\"\\\\\"", ",", "\"\\\\\"", ")", "for", "i", ",", "j", "in", "ts3_...
Unescape a TS3 compatible string into a normal string @param value: Value @type value: string/int
[ "Unescape", "a", "TS3", "compatible", "string", "into", "a", "normal", "string" ]
python
train
guaix-ucm/numina
numina/core/pipeline.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/core/pipeline.py#L294-L323
def select_profile(self, obresult): """Select instrument profile based on OB""" logger = logging.getLogger(__name__) logger.debug('calling default profile selector') # check configuration insconf = obresult.configuration if insconf != 'default': key = insconf...
[ "def", "select_profile", "(", "self", ",", "obresult", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "logger", ".", "debug", "(", "'calling default profile selector'", ")", "# check configuration", "insconf", "=", "obresult", ".", "...
Select instrument profile based on OB
[ "Select", "instrument", "profile", "based", "on", "OB" ]
python
train
h2oai/datatable
datatable/utils/misc.py
https://github.com/h2oai/datatable/blob/dd5fba74d2ca85b66f82ae3c1e0b6ea2fd792564/datatable/utils/misc.py#L130-L166
def normalize_range(e, n): """ Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). Thus we do not allow the range...
[ "def", "normalize_range", "(", "e", ",", "n", ")", ":", "if", "e", ".", "step", ">", "0", ":", "count", "=", "max", "(", "0", ",", "(", "e", ".", "stop", "-", "e", ".", "start", "-", "1", ")", "//", "e", ".", "step", "+", "1", ")", "else"...
Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). Thus we do not allow the range to generate indices that would be ...
[ "Return", "the", "range", "tuple", "normalized", "for", "an", "n", "-", "element", "object", "." ]
python
train
probcomp/crosscat
src/utils/data_utils.py
https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/data_utils.py#L341-L356
def convert_code_to_value(M_c, cidx, code): """ For a column with categorical data, this function takes the 'code': the integer used to represent a specific value, and returns the corresponding raw value (e.g. 'Joe' or 234.23409), which is always encoded as a string. Note that the underlying store ...
[ "def", "convert_code_to_value", "(", "M_c", ",", "cidx", ",", "code", ")", ":", "if", "M_c", "[", "'column_metadata'", "]", "[", "cidx", "]", "[", "'modeltype'", "]", "==", "'normal_inverse_gamma'", ":", "return", "float", "(", "code", ")", "else", ":", ...
For a column with categorical data, this function takes the 'code': the integer used to represent a specific value, and returns the corresponding raw value (e.g. 'Joe' or 234.23409), which is always encoded as a string. Note that the underlying store 'value_to_code' is unfortunately named backwards. TO...
[ "For", "a", "column", "with", "categorical", "data", "this", "function", "takes", "the", "code", ":", "the", "integer", "used", "to", "represent", "a", "specific", "value", "and", "returns", "the", "corresponding", "raw", "value", "(", "e", ".", "g", ".", ...
python
train
CellProfiler/centrosome
centrosome/cpmorphology.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/cpmorphology.py#L1972-L1996
def lines_intersect(pt1_p, pt2_p, pt1_q, pt2_q): '''Return true if two line segments intersect pt1_p, pt2_p - endpoints of first line segment pt1_q, pt2_q - endpoints of second line segment ''' # # The idea here is to do the cross-product of the vector from # point 1 to point 2 of one segmen...
[ "def", "lines_intersect", "(", "pt1_p", ",", "pt2_p", ",", "pt1_q", ",", "pt2_q", ")", ":", "#", "# The idea here is to do the cross-product of the vector from", "# point 1 to point 2 of one segment against the cross products from ", "# both points of the other segment. If any of the c...
Return true if two line segments intersect pt1_p, pt2_p - endpoints of first line segment pt1_q, pt2_q - endpoints of second line segment
[ "Return", "true", "if", "two", "line", "segments", "intersect", "pt1_p", "pt2_p", "-", "endpoints", "of", "first", "line", "segment", "pt1_q", "pt2_q", "-", "endpoints", "of", "second", "line", "segment" ]
python
train
MartinThoma/memtop
memtop/__init__.py
https://github.com/MartinThoma/memtop/blob/504d251f1951922db84883c2e660ba7e754d1546/memtop/__init__.py#L68-L73
def signal_handler(signal_name, frame): """Quit signal handler.""" sys.stdout.flush() print("\nSIGINT in frame signal received. Quitting...") sys.stdout.flush() sys.exit(0)
[ "def", "signal_handler", "(", "signal_name", ",", "frame", ")", ":", "sys", ".", "stdout", ".", "flush", "(", ")", "print", "(", "\"\\nSIGINT in frame signal received. Quitting...\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "sys", ".", "exit", "("...
Quit signal handler.
[ "Quit", "signal", "handler", "." ]
python
train
datascopeanalytics/scrubadub
scrubadub/__init__.py
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/__init__.py#L10-L16
def clean(text, cls=None, **kwargs): """Public facing function to clean ``text`` using the scrubber ``cls`` by replacing all personal information with ``{{PLACEHOLDERS}}``. """ cls = cls or Scrubber scrubber = cls() return scrubber.clean(text, **kwargs)
[ "def", "clean", "(", "text", ",", "cls", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cls", "=", "cls", "or", "Scrubber", "scrubber", "=", "cls", "(", ")", "return", "scrubber", ".", "clean", "(", "text", ",", "*", "*", "kwargs", ")" ]
Public facing function to clean ``text`` using the scrubber ``cls`` by replacing all personal information with ``{{PLACEHOLDERS}}``.
[ "Public", "facing", "function", "to", "clean", "text", "using", "the", "scrubber", "cls", "by", "replacing", "all", "personal", "information", "with", "{{", "PLACEHOLDERS", "}}", "." ]
python
train
castelao/oceansdb
oceansdb/utils.py
https://github.com/castelao/oceansdb/blob/a154c5b845845a602800f9bc53d1702d4cb0f9c5/oceansdb/utils.py#L61-L102
def dbsource(dbname, var, resolution=None, tscale=None): """Return which file(s) to use according to dbname, var, etc """ db_cfg = {} cfg_dir = 'datasource' cfg_files = pkg_resources.resource_listdir('oceansdb', cfg_dir) cfg_files = [f for f in cfg_files if f[-5:] == '.json'] for src_cfg in ...
[ "def", "dbsource", "(", "dbname", ",", "var", ",", "resolution", "=", "None", ",", "tscale", "=", "None", ")", ":", "db_cfg", "=", "{", "}", "cfg_dir", "=", "'datasource'", "cfg_files", "=", "pkg_resources", ".", "resource_listdir", "(", "'oceansdb'", ",",...
Return which file(s) to use according to dbname, var, etc
[ "Return", "which", "file", "(", "s", ")", "to", "use", "according", "to", "dbname", "var", "etc" ]
python
train
watson-developer-cloud/python-sdk
ibm_watson/personality_insights_v3.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L454-L479
def _from_dict(cls, _dict): """Initialize a ConsumptionPreferencesCategory object from a json dictionary.""" args = {} if 'consumption_preference_category_id' in _dict: args['consumption_preference_category_id'] = _dict.get( 'consumption_preference_category_id') ...
[ "def", "_from_dict", "(", "cls", ",", "_dict", ")", ":", "args", "=", "{", "}", "if", "'consumption_preference_category_id'", "in", "_dict", ":", "args", "[", "'consumption_preference_category_id'", "]", "=", "_dict", ".", "get", "(", "'consumption_preference_cate...
Initialize a ConsumptionPreferencesCategory object from a json dictionary.
[ "Initialize", "a", "ConsumptionPreferencesCategory", "object", "from", "a", "json", "dictionary", "." ]
python
train
saltstack/salt
salt/modules/aix_group.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L78-L96
def info(name): ''' Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo ''' try: grinfo = grp.getgrnam(name) except KeyError: return {} else: return {'name': grinfo.gr_name, 'passwd': grinfo.gr_pass...
[ "def", "info", "(", "name", ")", ":", "try", ":", "grinfo", "=", "grp", ".", "getgrnam", "(", "name", ")", "except", "KeyError", ":", "return", "{", "}", "else", ":", "return", "{", "'name'", ":", "grinfo", ".", "gr_name", ",", "'passwd'", ":", "gr...
Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo
[ "Return", "information", "about", "a", "group" ]
python
train
wummel/linkchecker
linkcheck/i18n.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/i18n.py#L70-L94
def init (domain, directory, loc=None): """Initialize this gettext i18n module. Searches for supported languages and installs the gettext translator class.""" global default_language, default_encoding, default_domain, default_directory default_directory = directory default_domain = domain if os....
[ "def", "init", "(", "domain", ",", "directory", ",", "loc", "=", "None", ")", ":", "global", "default_language", ",", "default_encoding", ",", "default_domain", ",", "default_directory", "default_directory", "=", "directory", "default_domain", "=", "domain", "if",...
Initialize this gettext i18n module. Searches for supported languages and installs the gettext translator class.
[ "Initialize", "this", "gettext", "i18n", "module", ".", "Searches", "for", "supported", "languages", "and", "installs", "the", "gettext", "translator", "class", "." ]
python
train
monarch-initiative/dipper
dipper/models/Evidence.py
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/Evidence.py#L63-L81
def add_data_individual(self, data_curie, label=None, ind_type=None): """ Add data individual :param data_curie: str either curie formatted or long string, long strings will be converted to bnodes :param type: str curie :param label: str :return...
[ "def", "add_data_individual", "(", "self", ",", "data_curie", ",", "label", "=", "None", ",", "ind_type", "=", "None", ")", ":", "part_length", "=", "len", "(", "data_curie", ".", "split", "(", "':'", ")", ")", "if", "part_length", "==", "0", ":", "cur...
Add data individual :param data_curie: str either curie formatted or long string, long strings will be converted to bnodes :param type: str curie :param label: str :return: None
[ "Add", "data", "individual", ":", "param", "data_curie", ":", "str", "either", "curie", "formatted", "or", "long", "string", "long", "strings", "will", "be", "converted", "to", "bnodes", ":", "param", "type", ":", "str", "curie", ":", "param", "label", ":"...
python
train