partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
FaceOffComparison.by_zone
Returns the faceoff win/total breakdown by zone for home and away as .. code:: python { 'home/away': { 'off/def/neut/all': { 'won': won, 'total': total } } } :returns: dict
nhlscrapi/games/faceoffcomp.py
def by_zone(self): """ Returns the faceoff win/total breakdown by zone for home and away as .. code:: python { 'home/away': { 'off/def/neut/all': { 'won': won, 'total': total } } } :returns: dict ...
def by_zone(self): """ Returns the faceoff win/total breakdown by zone for home and away as .. code:: python { 'home/away': { 'off/def/neut/all': { 'won': won, 'total': total } } } :returns: dict ...
[ "Returns", "the", "faceoff", "win", "/", "total", "breakdown", "by", "zone", "for", "home", "and", "away", "as", "..", "code", "::", "python", "{", "home", "/", "away", ":", "{", "off", "/", "def", "/", "neut", "/", "all", ":", "{", "won", ":", "...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L90-L113
[ "def", "by_zone", "(", "self", ")", ":", "if", "self", ".", "__team_tots", "is", "None", ":", "self", ".", "__team_tots", "=", "self", ".", "__comp_tot", "(", ")", "return", "{", "t", ":", "{", "z", ":", "self", ".", "__team_tots", "[", "t", "]", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
FaceOffComparison.fo_pct
Get the by team overall face-off win %. :returns: dict, ``{ 'home': %, 'away': % }``
nhlscrapi/games/faceoffcomp.py
def fo_pct(self): """ Get the by team overall face-off win %. :returns: dict, ``{ 'home': %, 'away': % }`` """ tots = self.team_totals return { t: tots[t]['won']/(1.0*tots[t]['total']) if tots[t]['total'] else 0.0 for t in [ 'home', 'away'...
def fo_pct(self): """ Get the by team overall face-off win %. :returns: dict, ``{ 'home': %, 'away': % }`` """ tots = self.team_totals return { t: tots[t]['won']/(1.0*tots[t]['total']) if tots[t]['total'] else 0.0 for t in [ 'home', 'away'...
[ "Get", "the", "by", "team", "overall", "face", "-", "off", "win", "%", ".", ":", "returns", ":", "dict", "{", "home", ":", "%", "away", ":", "%", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L116-L126
[ "def", "fo_pct", "(", "self", ")", ":", "tots", "=", "self", ".", "team_totals", "return", "{", "t", ":", "tots", "[", "t", "]", "[", "'won'", "]", "/", "(", "1.0", "*", "tots", "[", "t", "]", "[", "'total'", "]", ")", "if", "tots", "[", "t",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
FaceOffComparison.fo_pct_by_zone
Get the by team face-off win % by zone. Format is :returns: dict ``{ 'home/away': { 'off/def/neut': % } }``
nhlscrapi/games/faceoffcomp.py
def fo_pct_by_zone(self): """ Get the by team face-off win % by zone. Format is :returns: dict ``{ 'home/away': { 'off/def/neut': % } }`` """ bz = self.by_zone return { t: { z: bz[t][z]['won']/(1.0*bz[t][z]['total']) if bz[t][z]['t...
def fo_pct_by_zone(self): """ Get the by team face-off win % by zone. Format is :returns: dict ``{ 'home/away': { 'off/def/neut': % } }`` """ bz = self.by_zone return { t: { z: bz[t][z]['won']/(1.0*bz[t][z]['total']) if bz[t][z]['t...
[ "Get", "the", "by", "team", "face", "-", "off", "win", "%", "by", "zone", ".", "Format", "is", ":", "returns", ":", "dict", "{", "home", "/", "away", ":", "{", "off", "/", "def", "/", "neut", ":", "%", "}", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L129-L144
[ "def", "fo_pct_by_zone", "(", "self", ")", ":", "bz", "=", "self", ".", "by_zone", "return", "{", "t", ":", "{", "z", ":", "bz", "[", "t", "]", "[", "z", "]", "[", "'won'", "]", "/", "(", "1.0", "*", "bz", "[", "t", "]", "[", "z", "]", "[...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
TeamIncrementor.update
Update the accumulator with the current play :returns: new tally :rtype: dict, ``{ 'period': per, 'time': clock, 'team': cumul, 'play': play }``
nhlscrapi/games/cumstats.py
def update(self, play): """ Update the accumulator with the current play :returns: new tally :rtype: dict, ``{ 'period': per, 'time': clock, 'team': cumul, 'play': play }`` """ new_tally = { } #if any(isinstance(play.event, te) for te in self.trigger_even...
def update(self, play): """ Update the accumulator with the current play :returns: new tally :rtype: dict, ``{ 'period': per, 'time': clock, 'team': cumul, 'play': play }`` """ new_tally = { } #if any(isinstance(play.event, te) for te in self.trigger_even...
[ "Update", "the", "accumulator", "with", "the", "current", "play", ":", "returns", ":", "new", "tally", ":", "rtype", ":", "dict", "{", "period", ":", "per", "time", ":", "clock", "team", ":", "cumul", "play", ":", "play", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/cumstats.py#L55-L93
[ "def", "update", "(", "self", ",", "play", ")", ":", "new_tally", "=", "{", "}", "#if any(isinstance(play.event, te) for te in self.trigger_event_types):", "if", "self", ".", "_count_play", "(", "play", ")", ":", "# the team who made the play / triggered the event", "team...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
Corsi.share
The Cori-share (% of shot attempts) for each team :returns: dict, ``{ 'home_name': %, 'away_name': % }``
nhlscrapi/games/cumstats.py
def share(self): """ The Cori-share (% of shot attempts) for each team :returns: dict, ``{ 'home_name': %, 'away_name': % }`` """ tot = sum(self.total.values()) return { k: v/float(tot) for k,v in self.total.items() }
def share(self): """ The Cori-share (% of shot attempts) for each team :returns: dict, ``{ 'home_name': %, 'away_name': % }`` """ tot = sum(self.total.values()) return { k: v/float(tot) for k,v in self.total.items() }
[ "The", "Cori", "-", "share", "(", "%", "of", "shot", "attempts", ")", "for", "each", "team", ":", "returns", ":", "dict", "{", "home_name", ":", "%", "away_name", ":", "%", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/cumstats.py#L171-L178
[ "def", "share", "(", "self", ")", ":", "tot", "=", "sum", "(", "self", ".", "total", ".", "values", "(", ")", ")", "return", "{", "k", ":", "v", "/", "float", "(", "tot", ")", "for", "k", ",", "v", "in", "self", ".", "total", ".", "items", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
PlayByPlay.compute_stats
Compute the stats defined in ``self.cum_stats``. :returns: collection of all computed :py:class:`.AccumulateStats` :rtype: dict
nhlscrapi/games/playbyplay.py
def compute_stats(self): """ Compute the stats defined in ``self.cum_stats``. :returns: collection of all computed :py:class:`.AccumulateStats` :rtype: dict """ if not self.__have_stats: if self.init_cs_teams and self.cum_stats: self._...
def compute_stats(self): """ Compute the stats defined in ``self.cum_stats``. :returns: collection of all computed :py:class:`.AccumulateStats` :rtype: dict """ if not self.__have_stats: if self.init_cs_teams and self.cum_stats: self._...
[ "Compute", "the", "stats", "defined", "in", "self", ".", "cum_stats", ".", ":", "returns", ":", "collection", "of", "all", "computed", ":", "py", ":", "class", ":", ".", "AccumulateStats", ":", "rtype", ":", "dict" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/playbyplay.py#L84-L102
[ "def", "compute_stats", "(", "self", ")", ":", "if", "not", "self", ".", "__have_stats", ":", "if", "self", ".", "init_cs_teams", "and", "self", ".", "cum_stats", ":", "self", ".", "__init_cs_teams", "(", ")", "for", "play", "in", "self", ".", "_rep_read...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
NHLCn.__html_rep
Retrieves the nhl html reports for the specified game and report code
nhlscrapi/scrapr/nhlreq.py
def __html_rep(self, game_key, rep_code): """Retrieves the nhl html reports for the specified game and report code""" seas, gt, num = game_key.to_tuple() url = [ self.__domain, "scores/htmlreports/", str(seas-1), str(seas), "/", rep_code, "0", str(gt), ("%04i" % (num)), ".HTM" ] ...
def __html_rep(self, game_key, rep_code): """Retrieves the nhl html reports for the specified game and report code""" seas, gt, num = game_key.to_tuple() url = [ self.__domain, "scores/htmlreports/", str(seas-1), str(seas), "/", rep_code, "0", str(gt), ("%04i" % (num)), ".HTM" ] ...
[ "Retrieves", "the", "nhl", "html", "reports", "for", "the", "specified", "game", "and", "report", "code" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/nhlreq.py#L17-L24
[ "def", "__html_rep", "(", "self", ",", "game_key", ",", "rep_code", ")", ":", "seas", ",", "gt", ",", "num", "=", "game_key", ".", "to_tuple", "(", ")", "url", "=", "[", "self", ".", "__domain", ",", "\"scores/htmlreports/\"", ",", "str", "(", "seas", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
to_char
Transforms the ASCII control character symbols to their real char. Note: If the token is not an ASCII control character symbol, just return the token. Keyword arguments: token -- the token to transform
pyisemail/validators/parser_validator.py
def to_char(token): """Transforms the ASCII control character symbols to their real char. Note: If the token is not an ASCII control character symbol, just return the token. Keyword arguments: token -- the token to transform """ if ord(token) in _range(9216, 9229 + 1): token = _un...
def to_char(token): """Transforms the ASCII control character symbols to their real char. Note: If the token is not an ASCII control character symbol, just return the token. Keyword arguments: token -- the token to transform """ if ord(token) in _range(9216, 9229 + 1): token = _un...
[ "Transforms", "the", "ASCII", "control", "character", "symbols", "to", "their", "real", "char", "." ]
michaelherold/pyIsEmail
python
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/validators/parser_validator.py#L48-L61
[ "def", "to_char", "(", "token", ")", ":", "if", "ord", "(", "token", ")", "in", "_range", "(", "9216", ",", "9229", "+", "1", ")", ":", "token", "=", "_unichr", "(", "ord", "(", "token", ")", "-", "9216", ")", "return", "token" ]
dd42d6425c59e5061fc214d42672210dccc64cf5
train
ParserValidator.is_email
Check that an address address conforms to RFCs 5321, 5322 and others. More specifically, see the follow RFCs: * http://tools.ietf.org/html/rfc5321 * http://tools.ietf.org/html/rfc5322 * http://tools.ietf.org/html/rfc4291#section-2.2 * http://tools.ietf.org/html/r...
pyisemail/validators/parser_validator.py
def is_email(self, address, diagnose=False): """Check that an address address conforms to RFCs 5321, 5322 and others. More specifically, see the follow RFCs: * http://tools.ietf.org/html/rfc5321 * http://tools.ietf.org/html/rfc5322 * http://tools.ietf.org/html/rfc429...
def is_email(self, address, diagnose=False): """Check that an address address conforms to RFCs 5321, 5322 and others. More specifically, see the follow RFCs: * http://tools.ietf.org/html/rfc5321 * http://tools.ietf.org/html/rfc5322 * http://tools.ietf.org/html/rfc429...
[ "Check", "that", "an", "address", "address", "conforms", "to", "RFCs", "5321", "5322", "and", "others", "." ]
michaelherold/pyIsEmail
python
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/validators/parser_validator.py#L65-L1127
[ "def", "is_email", "(", "self", ",", "address", ",", "diagnose", "=", "False", ")", ":", "threshold", "=", "BaseDiagnosis", ".", "CATEGORIES", "[", "'VALID'", "]", "return_status", "=", "[", "ValidDiagnosis", "(", ")", "]", "parse_data", "=", "{", "}", "...
dd42d6425c59e5061fc214d42672210dccc64cf5
train
load_freesurfer_label
Get source node list for a specified freesurfer label. Inputs ------- annot_input : freesurfer annotation label file label_name : freesurfer label name cortex : not used
surfdist/load.py
def load_freesurfer_label(annot_input, label_name, cortex=None): """ Get source node list for a specified freesurfer label. Inputs ------- annot_input : freesurfer annotation label file label_name : freesurfer label name cortex : not used """ if cortex is not None: print("W...
def load_freesurfer_label(annot_input, label_name, cortex=None): """ Get source node list for a specified freesurfer label. Inputs ------- annot_input : freesurfer annotation label file label_name : freesurfer label name cortex : not used """ if cortex is not None: print("W...
[ "Get", "source", "node", "list", "for", "a", "specified", "freesurfer", "label", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/load.py#L5-L24
[ "def", "load_freesurfer_label", "(", "annot_input", ",", "label_name", ",", "cortex", "=", "None", ")", ":", "if", "cortex", "is", "not", "None", ":", "print", "(", "\"Warning: cortex is not used to load the freesurfer label\"", ")", "labels", ",", "color_table", ",...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
get_freesurfer_label
Print freesurfer label names.
surfdist/load.py
def get_freesurfer_label(annot_input, verbose = True): """ Print freesurfer label names. """ labels, color_table, names = nib.freesurfer.read_annot(annot_input) if verbose: print(names) return names
def get_freesurfer_label(annot_input, verbose = True): """ Print freesurfer label names. """ labels, color_table, names = nib.freesurfer.read_annot(annot_input) if verbose: print(names) return names
[ "Print", "freesurfer", "label", "names", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/load.py#L27-L34
[ "def", "get_freesurfer_label", "(", "annot_input", ",", "verbose", "=", "True", ")", ":", "labels", ",", "color_table", ",", "names", "=", "nib", ".", "freesurfer", ".", "read_annot", "(", "annot_input", ")", "if", "verbose", ":", "print", "(", "names", ")...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
viz
Visualize results on cortical surface using matplotlib. Inputs ------- coords : numpy array of shape (n_nodes,3), each row specifying the x,y,z coordinates of one node of surface mesh faces : numpy array of shape (n_faces, 3), each row specifying the indices of the three nodes b...
surfdist/viz.py
def viz(coords, faces, stat_map=None, elev=0, azim=0, cmap='coolwarm', threshold=None, alpha='auto', bg_map=None, bg_on_stat=False, figsize=None, **kwargs): ''' Visualize results on cortical surface using matplotlib. Inputs ------- coords : numpy array of shape ...
def viz(coords, faces, stat_map=None, elev=0, azim=0, cmap='coolwarm', threshold=None, alpha='auto', bg_map=None, bg_on_stat=False, figsize=None, **kwargs): ''' Visualize results on cortical surface using matplotlib. Inputs ------- coords : numpy array of shape ...
[ "Visualize", "results", "on", "cortical", "surface", "using", "matplotlib", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/viz.py#L1-L128
[ "def", "viz", "(", "coords", ",", "faces", ",", "stat_map", "=", "None", ",", "elev", "=", "0", ",", "azim", "=", "0", ",", "cmap", "=", "'coolwarm'", ",", "threshold", "=", "None", ",", "alpha", "=", "'auto'", ",", "bg_map", "=", "None", ",", "b...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
surf_keep_cortex
Remove medial wall from cortical surface to ensure that shortest paths are only calculated through the cortex. Inputs ------- surf : Tuple containing two numpy arrays of shape (n_nodes,3). Each node of the first array specifies the x, y, z coordinates one node of the surface mesh. Each node of t...
surfdist/utils.py
def surf_keep_cortex(surf, cortex): """ Remove medial wall from cortical surface to ensure that shortest paths are only calculated through the cortex. Inputs ------- surf : Tuple containing two numpy arrays of shape (n_nodes,3). Each node of the first array specifies the x, y, z coordina...
def surf_keep_cortex(surf, cortex): """ Remove medial wall from cortical surface to ensure that shortest paths are only calculated through the cortex. Inputs ------- surf : Tuple containing two numpy arrays of shape (n_nodes,3). Each node of the first array specifies the x, y, z coordina...
[ "Remove", "medial", "wall", "from", "cortical", "surface", "to", "ensure", "that", "shortest", "paths", "are", "only", "calculated", "through", "the", "cortex", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L5-L28
[ "def", "surf_keep_cortex", "(", "surf", ",", "cortex", ")", ":", "# split surface into vertices and triangles", "vertices", ",", "triangles", "=", "surf", "# keep only the vertices within the cortex label", "cortex_vertices", "=", "np", ".", "array", "(", "vertices", "[",...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
triangles_keep_cortex
Remove triangles with nodes not contained in the cortex label array
surfdist/utils.py
def triangles_keep_cortex(triangles, cortex): """ Remove triangles with nodes not contained in the cortex label array """ # for or each face/triangle keep only those that only contain nodes within the list of cortex nodes input_shape = triangles.shape triangle_is_in_cortex = np.all(np.reshape(n...
def triangles_keep_cortex(triangles, cortex): """ Remove triangles with nodes not contained in the cortex label array """ # for or each face/triangle keep only those that only contain nodes within the list of cortex nodes input_shape = triangles.shape triangle_is_in_cortex = np.all(np.reshape(n...
[ "Remove", "triangles", "with", "nodes", "not", "contained", "in", "the", "cortex", "label", "array" ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L31-L46
[ "def", "triangles_keep_cortex", "(", "triangles", ",", "cortex", ")", ":", "# for or each face/triangle keep only those that only contain nodes within the list of cortex nodes", "input_shape", "=", "triangles", ".", "shape", "triangle_is_in_cortex", "=", "np", ".", "all", "(", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
translate_src
Convert source nodes to new surface (without medial wall).
surfdist/utils.py
def translate_src(src, cortex): """ Convert source nodes to new surface (without medial wall). """ src_new = np.array(np.where(np.in1d(cortex, src))[0], dtype=np.int32) return src_new
def translate_src(src, cortex): """ Convert source nodes to new surface (without medial wall). """ src_new = np.array(np.where(np.in1d(cortex, src))[0], dtype=np.int32) return src_new
[ "Convert", "source", "nodes", "to", "new", "surface", "(", "without", "medial", "wall", ")", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L49-L55
[ "def", "translate_src", "(", "src", ",", "cortex", ")", ":", "src_new", "=", "np", ".", "array", "(", "np", ".", "where", "(", "np", ".", "in1d", "(", "cortex", ",", "src", ")", ")", "[", "0", "]", ",", "dtype", "=", "np", ".", "int32", ")", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
recort
Return data values to space of full cortex (including medial wall), with medial wall equal to zero.
surfdist/utils.py
def recort(input_data, surf, cortex): """ Return data values to space of full cortex (including medial wall), with medial wall equal to zero. """ data = np.zeros(len(surf[0])) data[cortex] = input_data return data
def recort(input_data, surf, cortex): """ Return data values to space of full cortex (including medial wall), with medial wall equal to zero. """ data = np.zeros(len(surf[0])) data[cortex] = input_data return data
[ "Return", "data", "values", "to", "space", "of", "full", "cortex", "(", "including", "medial", "wall", ")", "with", "medial", "wall", "equal", "to", "zero", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L57-L63
[ "def", "recort", "(", "input_data", ",", "surf", ",", "cortex", ")", ":", "data", "=", "np", ".", "zeros", "(", "len", "(", "surf", "[", "0", "]", ")", ")", "data", "[", "cortex", "]", "=", "input_data", "return", "data" ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
find_node_match
Thanks to juhuntenburg. Functions taken from https://github.com/juhuntenburg/brainsurfacescripts Finds those points on the complex mesh that correspond best to the simple mesh while forcing a one-to-one mapping.
surfdist/utils.py
def find_node_match(simple_vertices, complex_vertices): """ Thanks to juhuntenburg. Functions taken from https://github.com/juhuntenburg/brainsurfacescripts Finds those points on the complex mesh that correspond best to the simple mesh while forcing a one-to-one mapping. """ import scipy.s...
def find_node_match(simple_vertices, complex_vertices): """ Thanks to juhuntenburg. Functions taken from https://github.com/juhuntenburg/brainsurfacescripts Finds those points on the complex mesh that correspond best to the simple mesh while forcing a one-to-one mapping. """ import scipy.s...
[ "Thanks", "to", "juhuntenburg", ".", "Functions", "taken", "from", "https", ":", "//", "github", ".", "com", "/", "juhuntenburg", "/", "brainsurfacescripts" ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L66-L119
[ "def", "find_node_match", "(", "simple_vertices", ",", "complex_vertices", ")", ":", "import", "scipy", ".", "spatial", "# make array for writing in final voronoi seed indices", "voronoi_seed_idx", "=", "np", ".", "zeros", "(", "(", "simple_vertices", ".", "shape", "[",...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
EventSummRep.parse
Retreive and parse Event Summary report for the given :py:class:`nhlscrapi.games.game.GameKey` :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/eventsummrep.py
def parse(self): """ Retreive and parse Event Summary report for the given :py:class:`nhlscrapi.games.game.GameKey` :returns: ``self`` on success, ``None`` otherwise """ try: return super(EventSummRep, self).parse() \ .parse_away_shots() \ ...
def parse(self): """ Retreive and parse Event Summary report for the given :py:class:`nhlscrapi.games.game.GameKey` :returns: ``self`` on success, ``None`` otherwise """ try: return super(EventSummRep, self).parse() \ .parse_away_shots() \ ...
[ "Retreive", "and", "parse", "Event", "Summary", "report", "for", "the", "given", ":", "py", ":", "class", ":", "nhlscrapi", ".", "games", ".", "game", ".", "GameKey", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L86-L101
[ "def", "parse", "(", "self", ")", ":", "try", ":", "return", "super", "(", "EventSummRep", ",", "self", ")", ".", "parse", "(", ")", ".", "parse_away_shots", "(", ")", ".", "parse_home_shots", "(", ")", ".", "parse_away_fo", "(", ")", ".", "parse_home_...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummRep.parse_home_shots
Parse shot info for home team. :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/eventsummrep.py
def parse_home_shots(self): """ Parse shot info for home team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_shot_tables() self.shots['home'] = self.__parse_shot_tables( self.__home_top, self...
def parse_home_shots(self): """ Parse shot info for home team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_shot_tables() self.shots['home'] = self.__parse_shot_tables( self.__home_top, self...
[ "Parse", "shot", "info", "for", "home", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L149-L163
[ "def", "parse_home_shots", "(", "self", ")", ":", "try", ":", "self", ".", "__set_shot_tables", "(", ")", "self", ".", "shots", "[", "'home'", "]", "=", "self", ".", "__parse_shot_tables", "(", "self", ".", "__home_top", ",", "self", ".", "__home_bot", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummRep.parse_away_shots
Parse shot info for away team. :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/eventsummrep.py
def parse_away_shots(self): """ Parse shot info for away team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_shot_tables() self.shots['away'] = self.__parse_shot_tables( self.__aw_top, self._...
def parse_away_shots(self): """ Parse shot info for away team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_shot_tables() self.shots['away'] = self.__parse_shot_tables( self.__aw_top, self._...
[ "Parse", "shot", "info", "for", "away", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L165-L179
[ "def", "parse_away_shots", "(", "self", ")", ":", "try", ":", "self", ".", "__set_shot_tables", "(", ")", "self", ".", "shots", "[", "'away'", "]", "=", "self", ".", "__parse_shot_tables", "(", "self", ".", "__aw_top", ",", "self", ".", "__aw_bot", ")", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummRep.parse_home_fo
Parse face-off info for home team. :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/eventsummrep.py
def parse_home_fo(self): """ Parse face-off info for home team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_fo_tables() self.face_offs['home'] = self.__parse_fo_table(self.__home_fo) return self except...
def parse_home_fo(self): """ Parse face-off info for home team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_fo_tables() self.face_offs['home'] = self.__parse_fo_table(self.__home_fo) return self except...
[ "Parse", "face", "-", "off", "info", "for", "home", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L181-L192
[ "def", "parse_home_fo", "(", "self", ")", ":", "try", ":", "self", ".", "__set_fo_tables", "(", ")", "self", ".", "face_offs", "[", "'home'", "]", "=", "self", ".", "__parse_fo_table", "(", "self", ".", "__home_fo", ")", "return", "self", "except", ":", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummRep.parse_away_fo
Parse face-off info for away team. :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/eventsummrep.py
def parse_away_fo(self): """ Parse face-off info for away team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_fo_tables() self.face_offs['away'] = self.__parse_fo_table(self.__away_fo) return self except...
def parse_away_fo(self): """ Parse face-off info for away team. :returns: ``self`` on success, ``None`` otherwise """ try: self.__set_fo_tables() self.face_offs['away'] = self.__parse_fo_table(self.__away_fo) return self except...
[ "Parse", "face", "-", "off", "info", "for", "away", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L194-L205
[ "def", "parse_away_fo", "(", "self", ")", ":", "try", ":", "self", ".", "__set_fo_tables", "(", ")", "self", ".", "face_offs", "[", "'away'", "]", "=", "self", ".", "__parse_fo_table", "(", "self", ".", "__away_fo", ")", "return", "self", "except", ":", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
dist_calc
Calculate exact geodesic distance along cortical surface from set of source nodes. "dist_type" specifies whether to calculate "min", "mean", "median", or "max" distance values from a region-of-interest. If running only on single node, defaults to "min".
surfdist/surfdist.py
def dist_calc(surf, cortex, source_nodes): """ Calculate exact geodesic distance along cortical surface from set of source nodes. "dist_type" specifies whether to calculate "min", "mean", "median", or "max" distance values from a region-of-interest. If running only on single node, defaults to "min". ...
def dist_calc(surf, cortex, source_nodes): """ Calculate exact geodesic distance along cortical surface from set of source nodes. "dist_type" specifies whether to calculate "min", "mean", "median", or "max" distance values from a region-of-interest. If running only on single node, defaults to "min". ...
[ "Calculate", "exact", "geodesic", "distance", "along", "cortical", "surface", "from", "set", "of", "source", "nodes", ".", "dist_type", "specifies", "whether", "to", "calculate", "min", "mean", "median", "or", "max", "distance", "values", "from", "a", "region", ...
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/surfdist.py#L6-L20
[ "def", "dist_calc", "(", "surf", ",", "cortex", ",", "source_nodes", ")", ":", "cortex_vertices", ",", "cortex_triangles", "=", "surf_keep_cortex", "(", "surf", ",", "cortex", ")", "translated_source_nodes", "=", "translate_src", "(", "source_nodes", ",", "cortex"...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
zone_calc
Calculate closest nodes to each source node using exact geodesic distance along the cortical surface.
surfdist/surfdist.py
def zone_calc(surf, cortex, src): """ Calculate closest nodes to each source node using exact geodesic distance along the cortical surface. """ cortex_vertices, cortex_triangles = surf_keep_cortex(surf, cortex) dist_vals = np.zeros((len(source_nodes), len(cortex_vertices))) for x in range(len...
def zone_calc(surf, cortex, src): """ Calculate closest nodes to each source node using exact geodesic distance along the cortical surface. """ cortex_vertices, cortex_triangles = surf_keep_cortex(surf, cortex) dist_vals = np.zeros((len(source_nodes), len(cortex_vertices))) for x in range(len...
[ "Calculate", "closest", "nodes", "to", "each", "source", "node", "using", "exact", "geodesic", "distance", "along", "the", "cortical", "surface", "." ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/surfdist.py#L23-L43
[ "def", "zone_calc", "(", "surf", ",", "cortex", ",", "src", ")", ":", "cortex_vertices", ",", "cortex_triangles", "=", "surf_keep_cortex", "(", "surf", ",", "cortex", ")", "dist_vals", "=", "np", ".", "zeros", "(", "(", "len", "(", "source_nodes", ")", "...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
dist_calc_matrix
Calculate exact geodesic distance along cortical surface from set of source nodes. "labels" specifies the freesurfer label file to use. All values will be used other than those specified in "exceptions" (default: 'Unknown' and 'Medial_Wall'). returns: dist_mat: symmetrical nxn matrix of minimum dista...
surfdist/surfdist.py
def dist_calc_matrix(surf, cortex, labels, exceptions = ['Unknown', 'Medial_wall'], verbose = True): """ Calculate exact geodesic distance along cortical surface from set of source nodes. "labels" specifies the freesurfer label file to use. All values will be used other than those specified in "exceptio...
def dist_calc_matrix(surf, cortex, labels, exceptions = ['Unknown', 'Medial_wall'], verbose = True): """ Calculate exact geodesic distance along cortical surface from set of source nodes. "labels" specifies the freesurfer label file to use. All values will be used other than those specified in "exceptio...
[ "Calculate", "exact", "geodesic", "distance", "along", "cortical", "surface", "from", "set", "of", "source", "nodes", ".", "labels", "specifies", "the", "freesurfer", "label", "file", "to", "use", ".", "All", "values", "will", "be", "used", "other", "than", ...
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/surfdist.py#L46-L85
[ "def", "dist_calc_matrix", "(", "surf", ",", "cortex", ",", "labels", ",", "exceptions", "=", "[", "'Unknown'", ",", "'Medial_wall'", "]", ",", "verbose", "=", "True", ")", ":", "cortex_vertices", ",", "cortex_triangles", "=", "surf_keep_cortex", "(", "surf", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
FaceOffRep.parse
Retreive and parse Play by Play data for the given nhlscrapi.GameKey :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/faceoffrep.py
def parse(self): """ Retreive and parse Play by Play data for the given nhlscrapi.GameKey :returns: ``self`` on success, ``None`` otherwise """ try: return ( super(FaceOffRep, self).parse() and self.parse_home_face_offs() ...
def parse(self): """ Retreive and parse Play by Play data for the given nhlscrapi.GameKey :returns: ``self`` on success, ``None`` otherwise """ try: return ( super(FaceOffRep, self).parse() and self.parse_home_face_offs() ...
[ "Retreive", "and", "parse", "Play", "by", "Play", "data", "for", "the", "given", "nhlscrapi", ".", "GameKey", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/faceoffrep.py#L53-L66
[ "def", "parse", "(", "self", ")", ":", "try", ":", "return", "(", "super", "(", "FaceOffRep", ",", "self", ")", ".", "parse", "(", ")", "and", "self", ".", "parse_home_face_offs", "(", ")", "and", "self", ".", "parse_away_face_offs", "(", ")", ")", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
FaceOffRep.parse_home_face_offs
Parse only the home faceoffs :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/faceoffrep.py
def parse_home_face_offs(self): """ Parse only the home faceoffs :returns: ``self`` on success, ``None`` otherwise """ self.__set_team_docs() self.face_offs['home'] = FaceOffRep.__read_team_doc(self.__home_doc) return self
def parse_home_face_offs(self): """ Parse only the home faceoffs :returns: ``self`` on success, ``None`` otherwise """ self.__set_team_docs() self.face_offs['home'] = FaceOffRep.__read_team_doc(self.__home_doc) return self
[ "Parse", "only", "the", "home", "faceoffs", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/faceoffrep.py#L68-L76
[ "def", "parse_home_face_offs", "(", "self", ")", ":", "self", ".", "__set_team_docs", "(", ")", "self", ".", "face_offs", "[", "'home'", "]", "=", "FaceOffRep", ".", "__read_team_doc", "(", "self", ".", "__home_doc", ")", "return", "self" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
FaceOffRep.parse_away_face_offs
Parse only the away faceoffs :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/faceoffrep.py
def parse_away_face_offs(self): """ Parse only the away faceoffs :returns: ``self`` on success, ``None`` otherwise """ self.__set_team_docs() self.face_offs['away'] = FaceOffRep.__read_team_doc(self.__vis_doc) return self
def parse_away_face_offs(self): """ Parse only the away faceoffs :returns: ``self`` on success, ``None`` otherwise """ self.__set_team_docs() self.face_offs['away'] = FaceOffRep.__read_team_doc(self.__vis_doc) return self
[ "Parse", "only", "the", "away", "faceoffs", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/faceoffrep.py#L78-L86
[ "def", "parse_away_face_offs", "(", "self", ")", ":", "self", ".", "__set_team_docs", "(", ")", "self", ".", "face_offs", "[", "'away'", "]", "=", "FaceOffRep", ".", "__read_team_doc", "(", "self", ".", "__vis_doc", ")", "return", "self" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
load_module
Loads a module by filename
zopkio/utils.py
def load_module(filename): """ Loads a module by filename """ basename = os.path.basename(filename) path = os.path.dirname(filename) sys.path.append(path) # TODO(tlan) need to figure out how to handle errors thrown here return __import__(os.path.splitext(basename)[0])
def load_module(filename): """ Loads a module by filename """ basename = os.path.basename(filename) path = os.path.dirname(filename) sys.path.append(path) # TODO(tlan) need to figure out how to handle errors thrown here return __import__(os.path.splitext(basename)[0])
[ "Loads", "a", "module", "by", "filename" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L58-L66
[ "def", "load_module", "(", "filename", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "path", "=", "os", ".", "path", ".", "dirname", "(", "filename", ")", "sys", ".", "path", ".", "append", "(", "path", ")", "...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
make_machine_mapping
Convert the machine list argument from a list of names into a mapping of logical names to physical hosts. This is similar to the _parse_configs function but separated to provide the opportunity for extension and additional checking of machine access
zopkio/utils.py
def make_machine_mapping(machine_list): """ Convert the machine list argument from a list of names into a mapping of logical names to physical hosts. This is similar to the _parse_configs function but separated to provide the opportunity for extension and additional checking of machine access """ if machine...
def make_machine_mapping(machine_list): """ Convert the machine list argument from a list of names into a mapping of logical names to physical hosts. This is similar to the _parse_configs function but separated to provide the opportunity for extension and additional checking of machine access """ if machine...
[ "Convert", "the", "machine", "list", "argument", "from", "a", "list", "of", "names", "into", "a", "mapping", "of", "logical", "names", "to", "physical", "hosts", ".", "This", "is", "similar", "to", "the", "_parse_configs", "function", "but", "separated", "to...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L79-L95
[ "def", "make_machine_mapping", "(", "machine_list", ")", ":", "if", "machine_list", "is", "None", ":", "return", "{", "}", "else", ":", "mapping", "=", "{", "}", "for", "pair", "in", "machine_list", ":", "if", "(", "constants", ".", "MACHINE_SEPARATOR", "n...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
parse_config_list
Parse a list of configuration properties separated by '='
zopkio/utils.py
def parse_config_list(config_list): """ Parse a list of configuration properties separated by '=' """ if config_list is None: return {} else: mapping = {} for pair in config_list: if (constants.CONFIG_SEPARATOR not in pair) or (pair.count(constants.CONFIG_SEPARATOR) != 1): raise Valu...
def parse_config_list(config_list): """ Parse a list of configuration properties separated by '=' """ if config_list is None: return {} else: mapping = {} for pair in config_list: if (constants.CONFIG_SEPARATOR not in pair) or (pair.count(constants.CONFIG_SEPARATOR) != 1): raise Valu...
[ "Parse", "a", "list", "of", "configuration", "properties", "separated", "by", "=" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L98-L111
[ "def", "parse_config_list", "(", "config_list", ")", ":", "if", "config_list", "is", "None", ":", "return", "{", "}", "else", ":", "mapping", "=", "{", "}", "for", "pair", "in", "config_list", ":", "if", "(", "constants", ".", "CONFIG_SEPARATOR", "not", ...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
parse_config_file
Parse a configuration file. Currently only supports .json, .py and properties separated by '=' :param config_file_path: :return: a dict of the configuration properties
zopkio/utils.py
def parse_config_file(config_file_path): """ Parse a configuration file. Currently only supports .json, .py and properties separated by '=' :param config_file_path: :return: a dict of the configuration properties """ extension = os.path.splitext(config_file_path)[1] if extension == '.pyc': raise Value...
def parse_config_file(config_file_path): """ Parse a configuration file. Currently only supports .json, .py and properties separated by '=' :param config_file_path: :return: a dict of the configuration properties """ extension = os.path.splitext(config_file_path)[1] if extension == '.pyc': raise Value...
[ "Parse", "a", "configuration", "file", ".", "Currently", "only", "supports", ".", "json", ".", "py", "and", "properties", "separated", "by", "=", ":", "param", "config_file_path", ":", ":", "return", ":", "a", "dict", "of", "the", "configuration", "propertie...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L114-L143
[ "def", "parse_config_file", "(", "config_file_path", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "config_file_path", ")", "[", "1", "]", "if", "extension", "==", "'.pyc'", ":", "raise", "ValueError", "(", "\"Skipping .pyc file as config\...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
exec_with_env
:param ssh: :param command: :param msg: :param env: :param synch: :return:
zopkio/remote_host_helper.py
def exec_with_env(ssh, command, msg='', env={}, **kwargs): """ :param ssh: :param command: :param msg: :param env: :param synch: :return: """ bash_profile_command = "source .bash_profile > /dev/null 2> /dev/null;" env_command = build_os_environment_string(env) new_command = bash_profi...
def exec_with_env(ssh, command, msg='', env={}, **kwargs): """ :param ssh: :param command: :param msg: :param env: :param synch: :return: """ bash_profile_command = "source .bash_profile > /dev/null 2> /dev/null;" env_command = build_os_environment_string(env) new_command = bash_profi...
[ ":", "param", "ssh", ":", ":", "param", "command", ":", ":", "param", "msg", ":", ":", "param", "env", ":", ":", "param", "synch", ":", ":", "return", ":" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L72-L88
[ "def", "exec_with_env", "(", "ssh", ",", "command", ",", "msg", "=", "''", ",", "env", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "bash_profile_command", "=", "\"source .bash_profile > /dev/null 2> /dev/null;\"", "env_command", "=", "build_os_environment_st...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
better_exec_command
Uses paramiko to execute a command but handles failure by raising a ParamikoError if the command fails. Note that unlike paramiko.SSHClient.exec_command this is not asynchronous because we wait until the exit status is known :Parameter ssh: a paramiko SSH Client :Parameter command: the command to execute ...
zopkio/remote_host_helper.py
def better_exec_command(ssh, command, msg): """Uses paramiko to execute a command but handles failure by raising a ParamikoError if the command fails. Note that unlike paramiko.SSHClient.exec_command this is not asynchronous because we wait until the exit status is known :Parameter ssh: a paramiko SSH Client...
def better_exec_command(ssh, command, msg): """Uses paramiko to execute a command but handles failure by raising a ParamikoError if the command fails. Note that unlike paramiko.SSHClient.exec_command this is not asynchronous because we wait until the exit status is known :Parameter ssh: a paramiko SSH Client...
[ "Uses", "paramiko", "to", "execute", "a", "command", "but", "handles", "failure", "by", "raising", "a", "ParamikoError", "if", "the", "command", "fails", ".", "Note", "that", "unlike", "paramiko", ".", "SSHClient", ".", "exec_command", "this", "is", "not", "...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L90-L116
[ "def", "better_exec_command", "(", "ssh", ",", "command", ",", "msg", ")", ":", "chan", "=", "ssh", ".", "get_transport", "(", ")", ".", "open_session", "(", ")", "chan", ".", "exec_command", "(", "command", ")", "exit_status", "=", "chan", ".", "recv_ex...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
log_output
logs the output from a remote command the input should be an open channel in the case of synchronous better_exec_command otherwise this will not log anything and simply return to the caller :param chan: :return:
zopkio/remote_host_helper.py
def log_output(chan): """ logs the output from a remote command the input should be an open channel in the case of synchronous better_exec_command otherwise this will not log anything and simply return to the caller :param chan: :return: """ if hasattr(chan, "recv"): str = chan.recv(1024) ...
def log_output(chan): """ logs the output from a remote command the input should be an open channel in the case of synchronous better_exec_command otherwise this will not log anything and simply return to the caller :param chan: :return: """ if hasattr(chan, "recv"): str = chan.recv(1024) ...
[ "logs", "the", "output", "from", "a", "remote", "command", "the", "input", "should", "be", "an", "open", "channel", "in", "the", "case", "of", "synchronous", "better_exec_command", "otherwise", "this", "will", "not", "log", "anything", "and", "simply", "return...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L118-L134
[ "def", "log_output", "(", "chan", ")", ":", "if", "hasattr", "(", "chan", ",", "\"recv\"", ")", ":", "str", "=", "chan", ".", "recv", "(", "1024", ")", "msgs", "=", "[", "]", "while", "len", "(", "str", ")", ">", "0", ":", "msgs", ".", "append"...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
copy_dir
Recursively copy a directory flattens the output into a single directory but prefixes the files with the path from the original input directory :param ftp: :param filename: :param outputdir: :param prefix: :param pattern: a regex pattern for files to match (by default matches everything) :return:
zopkio/remote_host_helper.py
def copy_dir(ftp, filename, outputdir, prefix, pattern=''): """ Recursively copy a directory flattens the output into a single directory but prefixes the files with the path from the original input directory :param ftp: :param filename: :param outputdir: :param prefix: :param pattern: a regex pa...
def copy_dir(ftp, filename, outputdir, prefix, pattern=''): """ Recursively copy a directory flattens the output into a single directory but prefixes the files with the path from the original input directory :param ftp: :param filename: :param outputdir: :param prefix: :param pattern: a regex pa...
[ "Recursively", "copy", "a", "directory", "flattens", "the", "output", "into", "a", "single", "directory", "but", "prefixes", "the", "files", "with", "the", "path", "from", "the", "original", "input", "directory", ":", "param", "ftp", ":", ":", "param", "file...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L137-L162
[ "def", "copy_dir", "(", "ftp", ",", "filename", ",", "outputdir", ",", "prefix", ",", "pattern", "=", "''", ")", ":", "try", ":", "mode", "=", "ftp", ".", "stat", "(", "filename", ")", ".", "st_mode", "except", "IOError", ",", "e", ":", "if", "e", ...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
open_remote_file
:param hostname: :param filename: :return:
zopkio/remote_host_helper.py
def open_remote_file(hostname, filename, mode='r', bufsize=-1, username=None, password=None): """ :param hostname: :param filename: :return: """ with get_ssh_client(hostname, username=username, password=password) as ssh: sftp = None f = None try: sftp = ssh.open_sftp() f...
def open_remote_file(hostname, filename, mode='r', bufsize=-1, username=None, password=None): """ :param hostname: :param filename: :return: """ with get_ssh_client(hostname, username=username, password=password) as ssh: sftp = None f = None try: sftp = ssh.open_sftp() f...
[ ":", "param", "hostname", ":", ":", "param", "filename", ":", ":", "return", ":" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L166-L184
[ "def", "open_remote_file", "(", "hostname", ",", "filename", ",", "mode", "=", "'r'", ",", "bufsize", "=", "-", "1", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "with", "get_ssh_client", "(", "hostname", ",", "username", "=", ...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.deploy
Deploys the service to the host. This should at least perform the same actions as install and start but may perform additional tasks as needed. :Parameter unique_id: the name of the process :Parameter configs: a mao of configs the deployer may use to modify the deployment
zopkio/deployer.py
def deploy(self, unique_id, configs=None): """Deploys the service to the host. This should at least perform the same actions as install and start but may perform additional tasks as needed. :Parameter unique_id: the name of the process :Parameter configs: a mao of configs the deployer may use to modif...
def deploy(self, unique_id, configs=None): """Deploys the service to the host. This should at least perform the same actions as install and start but may perform additional tasks as needed. :Parameter unique_id: the name of the process :Parameter configs: a mao of configs the deployer may use to modif...
[ "Deploys", "the", "service", "to", "the", "host", ".", "This", "should", "at", "least", "perform", "the", "same", "actions", "as", "install", "and", "start", "but", "may", "perform", "additional", "tasks", "as", "needed", "." ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L81-L89
[ "def", "deploy", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "install", "(", "unique_id", ",", "configs", ")", "self", ".", "start", "(", "unique_id", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.undeploy
Undeploys the service. This should at least perform the same actions as stop and uninstall but may perform additional tasks as needed. :Parameter unique_id: the name of the process :Parameter configs: a map of configs the deployer may use
zopkio/deployer.py
def undeploy(self, unique_id, configs=None): """Undeploys the service. This should at least perform the same actions as stop and uninstall but may perform additional tasks as needed. :Parameter unique_id: the name of the process :Parameter configs: a map of configs the deployer may use """ sel...
def undeploy(self, unique_id, configs=None): """Undeploys the service. This should at least perform the same actions as stop and uninstall but may perform additional tasks as needed. :Parameter unique_id: the name of the process :Parameter configs: a map of configs the deployer may use """ sel...
[ "Undeploys", "the", "service", ".", "This", "should", "at", "least", "perform", "the", "same", "actions", "as", "stop", "and", "uninstall", "but", "may", "perform", "additional", "tasks", "as", "needed", "." ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L91-L99
[ "def", "undeploy", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "stop", "(", "unique_id", ",", "configs", ")", "self", ".", "uninstall", "(", "unique_id", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.soft_bounce
Performs a soft bounce (stop and start) for the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def soft_bounce(self, unique_id, configs=None): """ Performs a soft bounce (stop and start) for the specified process :Parameter unique_id: the name of the process """ self.stop(unique_id, configs) self.start(unique_id, configs)
def soft_bounce(self, unique_id, configs=None): """ Performs a soft bounce (stop and start) for the specified process :Parameter unique_id: the name of the process """ self.stop(unique_id, configs) self.start(unique_id, configs)
[ "Performs", "a", "soft", "bounce", "(", "stop", "and", "start", ")", "for", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L148-L154
[ "def", "soft_bounce", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "stop", "(", "unique_id", ",", "configs", ")", "self", ".", "start", "(", "unique_id", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.hard_bounce
Performs a hard bounce (kill and start) for the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def hard_bounce(self, unique_id, configs=None): """ Performs a hard bounce (kill and start) for the specified process :Parameter unique_id: the name of the process """ self.kill(unique_id, configs) self.start(unique_id, configs)
def hard_bounce(self, unique_id, configs=None): """ Performs a hard bounce (kill and start) for the specified process :Parameter unique_id: the name of the process """ self.kill(unique_id, configs) self.start(unique_id, configs)
[ "Performs", "a", "hard", "bounce", "(", "kill", "and", "start", ")", "for", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L156-L162
[ "def", "hard_bounce", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "kill", "(", "unique_id", ",", "configs", ")", "self", ".", "start", "(", "unique_id", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.sleep
Pauses the process for the specified delay and then resumes it :Parameter unique_id: the name of the process :Parameter delay: delay time in seconds
zopkio/deployer.py
def sleep(self, unique_id, delay, configs=None): """ Pauses the process for the specified delay and then resumes it :Parameter unique_id: the name of the process :Parameter delay: delay time in seconds """ self.pause(unique_id, configs) time.sleep(delay) self.resume(unique_id, configs)
def sleep(self, unique_id, delay, configs=None): """ Pauses the process for the specified delay and then resumes it :Parameter unique_id: the name of the process :Parameter delay: delay time in seconds """ self.pause(unique_id, configs) time.sleep(delay) self.resume(unique_id, configs)
[ "Pauses", "the", "process", "for", "the", "specified", "delay", "and", "then", "resumes", "it" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L164-L172
[ "def", "sleep", "(", "self", ",", "unique_id", ",", "delay", ",", "configs", "=", "None", ")", ":", "self", ".", "pause", "(", "unique_id", ",", "configs", ")", "time", ".", "sleep", "(", "delay", ")", "self", ".", "resume", "(", "unique_id", ",", ...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.pause
Issues a sigstop for the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def pause(self, unique_id, configs=None): """ Issues a sigstop for the specified process :Parameter unique_id: the name of the process """ pids = self.get_pid(unique_id, configs) if pids != constants.PROCESS_NOT_RUNNING_PID: pid_str = ' '.join(str(pid) for pid in pids) hostname = self.p...
def pause(self, unique_id, configs=None): """ Issues a sigstop for the specified process :Parameter unique_id: the name of the process """ pids = self.get_pid(unique_id, configs) if pids != constants.PROCESS_NOT_RUNNING_PID: pid_str = ' '.join(str(pid) for pid in pids) hostname = self.p...
[ "Issues", "a", "sigstop", "for", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L174-L184
[ "def", "pause", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "pids", "=", "self", ".", "get_pid", "(", "unique_id", ",", "configs", ")", "if", "pids", "!=", "constants", ".", "PROCESS_NOT_RUNNING_PID", ":", "pid_str", "=", "' '",...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer._send_signal
Issues a signal for the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def _send_signal(self, unique_id, signalno, configs): """ Issues a signal for the specified process :Parameter unique_id: the name of the process """ pids = self.get_pid(unique_id, configs) if pids != constants.PROCESS_NOT_RUNNING_PID: pid_str = ' '.join(str(pid) for pid in pids) hostna...
def _send_signal(self, unique_id, signalno, configs): """ Issues a signal for the specified process :Parameter unique_id: the name of the process """ pids = self.get_pid(unique_id, configs) if pids != constants.PROCESS_NOT_RUNNING_PID: pid_str = ' '.join(str(pid) for pid in pids) hostna...
[ "Issues", "a", "signal", "for", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L186-L197
[ "def", "_send_signal", "(", "self", ",", "unique_id", ",", "signalno", ",", "configs", ")", ":", "pids", "=", "self", ".", "get_pid", "(", "unique_id", ",", "configs", ")", "if", "pids", "!=", "constants", ".", "PROCESS_NOT_RUNNING_PID", ":", "pid_str", "=...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.resume
Issues a sigcont for the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def resume(self, unique_id, configs=None): """ Issues a sigcont for the specified process :Parameter unique_id: the name of the process """ self._send_signal(unique_id, signal.SIGCONT,configs)
def resume(self, unique_id, configs=None): """ Issues a sigcont for the specified process :Parameter unique_id: the name of the process """ self._send_signal(unique_id, signal.SIGCONT,configs)
[ "Issues", "a", "sigcont", "for", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L200-L205
[ "def", "resume", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGCONT", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.kill
Issues a kill -9 to the specified process calls the deployers get_pid function for the process. If no pid_file/pid_keyword is specified a generic grep of ps aux command is executed on remote machine based on process parameters which may not be reliable if more process are running with similar name :Par...
zopkio/deployer.py
def kill(self, unique_id, configs=None): """ Issues a kill -9 to the specified process calls the deployers get_pid function for the process. If no pid_file/pid_keyword is specified a generic grep of ps aux command is executed on remote machine based on process parameters which may not be reliable if mor...
def kill(self, unique_id, configs=None): """ Issues a kill -9 to the specified process calls the deployers get_pid function for the process. If no pid_file/pid_keyword is specified a generic grep of ps aux command is executed on remote machine based on process parameters which may not be reliable if mor...
[ "Issues", "a", "kill", "-", "9", "to", "the", "specified", "process", "calls", "the", "deployers", "get_pid", "function", "for", "the", "process", ".", "If", "no", "pid_file", "/", "pid_keyword", "is", "specified", "a", "generic", "grep", "of", "ps", "aux"...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L207-L215
[ "def", "kill", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGKILL", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.terminate
Issues a kill -15 to the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def terminate(self, unique_id, configs=None): """ Issues a kill -15 to the specified process :Parameter unique_id: the name of the process """ self._send_signal(unique_id, signal.SIGTERM, configs)
def terminate(self, unique_id, configs=None): """ Issues a kill -15 to the specified process :Parameter unique_id: the name of the process """ self._send_signal(unique_id, signal.SIGTERM, configs)
[ "Issues", "a", "kill", "-", "15", "to", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L217-L222
[ "def", "terminate", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGTERM", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.hangup
Issue a signal to hangup the specified process :Parameter unique_id: the name of the process
zopkio/deployer.py
def hangup(self, unique_id, configs=None): """ Issue a signal to hangup the specified process :Parameter unique_id: the name of the process """ self._send_signal(unique_id, signal.SIGHUP, configs)
def hangup(self, unique_id, configs=None): """ Issue a signal to hangup the specified process :Parameter unique_id: the name of the process """ self._send_signal(unique_id, signal.SIGHUP, configs)
[ "Issue", "a", "signal", "to", "hangup", "the", "specified", "process" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L224-L230
[ "def", "hangup", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGHUP", ",", "configs", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.get_logs
deprecated name for fetch_logs
zopkio/deployer.py
def get_logs(self, unique_id, logs, directory, pattern=constants.FILTER_NAME_ALLOW_NONE): """deprecated name for fetch_logs""" self.fetch_logs(unique_id, logs, directory, pattern)
def get_logs(self, unique_id, logs, directory, pattern=constants.FILTER_NAME_ALLOW_NONE): """deprecated name for fetch_logs""" self.fetch_logs(unique_id, logs, directory, pattern)
[ "deprecated", "name", "for", "fetch_logs" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L232-L234
[ "def", "get_logs", "(", "self", ",", "unique_id", ",", "logs", ",", "directory", ",", "pattern", "=", "constants", ".", "FILTER_NAME_ALLOW_NONE", ")", ":", "self", ".", "fetch_logs", "(", "unique_id", ",", "logs", ",", "directory", ",", "pattern", ")" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.fetch_logs
Copies logs from the remote host that the process is running on to the provided directory :Parameter unique_id the unique_id of the process in question :Parameter logs a list of logs given by absolute path from the remote host :Parameter directory the local directory to store the copied logs :Parameter...
zopkio/deployer.py
def fetch_logs(self, unique_id, logs, directory, pattern=constants.FILTER_NAME_ALLOW_NONE): """ Copies logs from the remote host that the process is running on to the provided directory :Parameter unique_id the unique_id of the process in question :Parameter logs a list of logs given by absolute path from ...
def fetch_logs(self, unique_id, logs, directory, pattern=constants.FILTER_NAME_ALLOW_NONE): """ Copies logs from the remote host that the process is running on to the provided directory :Parameter unique_id the unique_id of the process in question :Parameter logs a list of logs given by absolute path from ...
[ "Copies", "logs", "from", "the", "remote", "host", "that", "the", "process", "is", "running", "on", "to", "the", "provided", "directory" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L236-L246
[ "def", "fetch_logs", "(", "self", ",", "unique_id", ",", "logs", ",", "directory", ",", "pattern", "=", "constants", ".", "FILTER_NAME_ALLOW_NONE", ")", ":", "hostname", "=", "self", ".", "processes", "[", "unique_id", "]", ".", "hostname", "install_path", "...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Deployer.fetch_logs_from_host
Static method Copies logs from specified host on the specified install path :Parameter hostname the remote host from where we need to fetch the logs :Parameter install_path path where the app is installed :Parameter prefix prefix used to copy logs. Generall the unique_id of process :Parameter logs a li...
zopkio/deployer.py
def fetch_logs_from_host(hostname, install_path, prefix, logs, directory, pattern): """ Static method Copies logs from specified host on the specified install path :Parameter hostname the remote host from where we need to fetch the logs :Parameter install_path path where the app is installed :Parameter...
def fetch_logs_from_host(hostname, install_path, prefix, logs, directory, pattern): """ Static method Copies logs from specified host on the specified install path :Parameter hostname the remote host from where we need to fetch the logs :Parameter install_path path where the app is installed :Parameter...
[ "Static", "method", "Copies", "logs", "from", "specified", "host", "on", "the", "specified", "install", "path" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L249-L271
[ "def", "fetch_logs_from_host", "(", "hostname", ",", "install_path", ",", "prefix", ",", "logs", ",", "directory", ",", "pattern", ")", ":", "if", "hostname", "is", "not", "None", ":", "with", "get_sftp_client", "(", "hostname", ",", "username", "=", "runtim...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Reporter.generate
Generates the report
zopkio/junit_reporter.py
def generate(self): """ Generates the report """ self._setup() for config_name in self.report_info.config_to_test_names_map.keys(): config_dir = os.path.join(self.report_info.resource_dir, config_name) utils.makedirs(config_dir) testsuite = self._generate_junit_xml(config_name) ...
def generate(self): """ Generates the report """ self._setup() for config_name in self.report_info.config_to_test_names_map.keys(): config_dir = os.path.join(self.report_info.resource_dir, config_name) utils.makedirs(config_dir) testsuite = self._generate_junit_xml(config_name) ...
[ "Generates", "the", "report" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/junit_reporter.py#L81-L91
[ "def", "generate", "(", "self", ")", ":", "self", ".", "_setup", "(", ")", "for", "config_name", "in", "self", ".", "report_info", ".", "config_to_test_names_map", ".", "keys", "(", ")", ":", "config_dir", "=", "os", ".", "path", ".", "join", "(", "sel...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.install
Copies the executable to the remote machine under install path. Inspects the configs for the possible keys 'hostname': the host to install on 'install_path': the location on the remote host 'executable': the executable to copy 'no_copy': if this config is passed in and true then this method will not cop...
zopkio/adhoc_deployer.py
def install(self, unique_id, configs=None): """ Copies the executable to the remote machine under install path. Inspects the configs for the possible keys 'hostname': the host to install on 'install_path': the location on the remote host 'executable': the executable to copy 'no_copy': if this co...
def install(self, unique_id, configs=None): """ Copies the executable to the remote machine under install path. Inspects the configs for the possible keys 'hostname': the host to install on 'install_path': the location on the remote host 'executable': the executable to copy 'no_copy': if this co...
[ "Copies", "the", "executable", "to", "the", "remote", "machine", "under", "install", "path", ".", "Inspects", "the", "configs", "for", "the", "possible", "keys", "hostname", ":", "the", "host", "to", "install", "on", "install_path", ":", "the", "location", "...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L78-L197
[ "def", "install", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "# the following is necessay to set the configs for this function as the combination of the", "# default configurations and the parameter with the parameter superceding the defaults but", "# not modif...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.start
Start the service. If `unique_id` has already been installed the deployer will start the service on that host. Otherwise this will call install with the configs. Within the context of this function, only four configs are considered 'start_command': the command to run (if provided will replace the default) ...
zopkio/adhoc_deployer.py
def start(self, unique_id, configs=None): """ Start the service. If `unique_id` has already been installed the deployer will start the service on that host. Otherwise this will call install with the configs. Within the context of this function, only four configs are considered 'start_command': the ...
def start(self, unique_id, configs=None): """ Start the service. If `unique_id` has already been installed the deployer will start the service on that host. Otherwise this will call install with the configs. Within the context of this function, only four configs are considered 'start_command': the ...
[ "Start", "the", "service", ".", "If", "unique_id", "has", "already", "been", "installed", "the", "deployer", "will", "start", "the", "service", "on", "that", "host", ".", "Otherwise", "this", "will", "call", "install", "with", "the", "configs", ".", "Within"...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L199-L262
[ "def", "start", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "# the following is necessay to set the configs for this function as the combination of the", "# default configurations and the parameter with the parameter superceding the defaults but", "# not modifyi...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.stop
Stop the service. If the deployer has not started a service with`unique_id` the deployer will raise an Exception There are two configs that will be considered: 'terminate_only': if this config is passed in then this method is the same as terminate(unique_id) (this is also the behavior if stop_command is No...
zopkio/adhoc_deployer.py
def stop(self, unique_id, configs=None): """Stop the service. If the deployer has not started a service with`unique_id` the deployer will raise an Exception There are two configs that will be considered: 'terminate_only': if this config is passed in then this method is the same as terminate(unique_id) (thi...
def stop(self, unique_id, configs=None): """Stop the service. If the deployer has not started a service with`unique_id` the deployer will raise an Exception There are two configs that will be considered: 'terminate_only': if this config is passed in then this method is the same as terminate(unique_id) (thi...
[ "Stop", "the", "service", ".", "If", "the", "deployer", "has", "not", "started", "a", "service", "with", "unique_id", "the", "deployer", "will", "raise", "an", "Exception", "There", "are", "two", "configs", "that", "will", "be", "considered", ":", "terminate...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L264-L306
[ "def", "stop", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "# the following is necessay to set the configs for this function as the combination of the", "# default configurations and the parameter with the parameter superceding the defaults but", "# not modifyin...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.uninstall
uninstall the service. If the deployer has not started a service with `unique_id` this will raise a DeploymentError. This considers one config: 'additional_directories': a list of directories to remove in addition to those provided in the constructor plus the install path. This will update the directorie...
zopkio/adhoc_deployer.py
def uninstall(self, unique_id, configs=None): """uninstall the service. If the deployer has not started a service with `unique_id` this will raise a DeploymentError. This considers one config: 'additional_directories': a list of directories to remove in addition to those provided in the constructor plus ...
def uninstall(self, unique_id, configs=None): """uninstall the service. If the deployer has not started a service with `unique_id` this will raise a DeploymentError. This considers one config: 'additional_directories': a list of directories to remove in addition to those provided in the constructor plus ...
[ "uninstall", "the", "service", ".", "If", "the", "deployer", "has", "not", "started", "a", "service", "with", "unique_id", "this", "will", "raise", "a", "DeploymentError", ".", "This", "considers", "one", "config", ":", "additional_directories", ":", "a", "lis...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L308-L340
[ "def", "uninstall", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "# the following is necessay to set the configs for this function as the combination of the", "# default configurations and the parameter with the parameter superceding the defaults but", "# not mod...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.get_pid
Gets the pid of the process with `unique_id`. If the deployer does not know of a process with `unique_id` then it should return a value of constants.PROCESS_NOT_RUNNING_PID
zopkio/adhoc_deployer.py
def get_pid(self, unique_id, configs=None): """Gets the pid of the process with `unique_id`. If the deployer does not know of a process with `unique_id` then it should return a value of constants.PROCESS_NOT_RUNNING_PID """ RECV_BLOCK_SIZE = 16 # the following is necessay to set the configs for thi...
def get_pid(self, unique_id, configs=None): """Gets the pid of the process with `unique_id`. If the deployer does not know of a process with `unique_id` then it should return a value of constants.PROCESS_NOT_RUNNING_PID """ RECV_BLOCK_SIZE = 16 # the following is necessay to set the configs for thi...
[ "Gets", "the", "pid", "of", "the", "process", "with", "unique_id", ".", "If", "the", "deployer", "does", "not", "know", "of", "a", "process", "with", "unique_id", "then", "it", "should", "return", "a", "value", "of", "constants", ".", "PROCESS_NOT_RUNNING_PI...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L342-L394
[ "def", "get_pid", "(", "self", ",", "unique_id", ",", "configs", "=", "None", ")", ":", "RECV_BLOCK_SIZE", "=", "16", "# the following is necessay to set the configs for this function as the combination of the", "# default configurations and the parameter with the parameter supercedi...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.get_host
Gets the host of the process with `unique_id`. If the deployer does not know of a process with `unique_id` then it should return a value of SOME_SENTINAL_VALUE :Parameter unique_id: the name of the process :raises NameError if the name is not valid process
zopkio/adhoc_deployer.py
def get_host(self, unique_id): """Gets the host of the process with `unique_id`. If the deployer does not know of a process with `unique_id` then it should return a value of SOME_SENTINAL_VALUE :Parameter unique_id: the name of the process :raises NameError if the name is not valid process """ ...
def get_host(self, unique_id): """Gets the host of the process with `unique_id`. If the deployer does not know of a process with `unique_id` then it should return a value of SOME_SENTINAL_VALUE :Parameter unique_id: the name of the process :raises NameError if the name is not valid process """ ...
[ "Gets", "the", "host", "of", "the", "process", "with", "unique_id", ".", "If", "the", "deployer", "does", "not", "know", "of", "a", "process", "with", "unique_id", "then", "it", "should", "return", "a", "value", "of", "SOME_SENTINAL_VALUE" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L396-L406
[ "def", "get_host", "(", "self", ",", "unique_id", ")", ":", "if", "unique_id", "in", "self", ".", "processes", ":", "return", "self", ".", "processes", "[", "unique_id", "]", ".", "hostname", "logger", ".", "error", "(", "\"{0} not a known process\"", ".", ...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
SSHDeployer.kill_all_process
Terminates all the running processes. By default it is set to false. Users can set to true in config once the method to get_pid is done deterministically either using pid_file or an accurate keyword
zopkio/adhoc_deployer.py
def kill_all_process(self): """ Terminates all the running processes. By default it is set to false. Users can set to true in config once the method to get_pid is done deterministically either using pid_file or an accurate keyword """ if (runtime.get_active_config("cleanup_pending_process",False)):...
def kill_all_process(self): """ Terminates all the running processes. By default it is set to false. Users can set to true in config once the method to get_pid is done deterministically either using pid_file or an accurate keyword """ if (runtime.get_active_config("cleanup_pending_process",False)):...
[ "Terminates", "all", "the", "running", "processes", ".", "By", "default", "it", "is", "set", "to", "false", ".", "Users", "can", "set", "to", "true", "in", "config", "once", "the", "method", "to", "get_pid", "is", "done", "deterministically", "either", "us...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L415-L423
[ "def", "kill_all_process", "(", "self", ")", ":", "if", "(", "runtime", ".", "get_active_config", "(", "\"cleanup_pending_process\"", ",", "False", ")", ")", ":", "for", "process", "in", "self", ".", "get_processes", "(", ")", ":", "self", ".", "terminate", ...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
string_to_level
Converts a string to the corresponding log level
zopkio/__main__.py
def string_to_level(log_level): """ Converts a string to the corresponding log level """ if (log_level.strip().upper() == "DEBUG"): return logging.DEBUG if (log_level.strip().upper() == "INFO"): return logging.INFO if (log_level.strip().upper() == "WARNING"): return logging.WARNING if (log_lev...
def string_to_level(log_level): """ Converts a string to the corresponding log level """ if (log_level.strip().upper() == "DEBUG"): return logging.DEBUG if (log_level.strip().upper() == "INFO"): return logging.INFO if (log_level.strip().upper() == "WARNING"): return logging.WARNING if (log_lev...
[ "Converts", "a", "string", "to", "the", "corresponding", "log", "level" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/__main__.py#L54-L65
[ "def", "string_to_level", "(", "log_level", ")", ":", "if", "(", "log_level", ".", "strip", "(", ")", ".", "upper", "(", ")", "==", "\"DEBUG\"", ")", ":", "return", "logging", ".", "DEBUG", "if", "(", "log_level", ".", "strip", "(", ")", ".", "upper"...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
main
Parse command line arguments and then run the test suite
zopkio/__main__.py
def main(): """ Parse command line arguments and then run the test suite """ parser = argparse.ArgumentParser(description='A distributed test framework') parser.add_argument('testfile', help='The file that is used to determine the test suite run') parser.add_argument('--test-only', nargs='*', ...
def main(): """ Parse command line arguments and then run the test suite """ parser = argparse.ArgumentParser(description='A distributed test framework') parser.add_argument('testfile', help='The file that is used to determine the test suite run') parser.add_argument('--test-only', nargs='*', ...
[ "Parse", "command", "line", "arguments", "and", "then", "run", "the", "test", "suite" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/__main__.py#L67-L105
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'A distributed test framework'", ")", "parser", ".", "add_argument", "(", "'testfile'", ",", "help", "=", "'The file that is used to determine the test suite run'",...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
reset_all
Clear relevant globals to start fresh :return:
zopkio/runtime.py
def reset_all(): """ Clear relevant globals to start fresh :return: """ global _username global _password global _active_config global _active_tests global _machine_names global _deployers reset_deployers() reset_collector() _username = None _password = None _active_config = None _active...
def reset_all(): """ Clear relevant globals to start fresh :return: """ global _username global _password global _active_config global _active_tests global _machine_names global _deployers reset_deployers() reset_collector() _username = None _password = None _active_config = None _active...
[ "Clear", "relevant", "globals", "to", "start", "fresh", ":", "return", ":" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/runtime.py#L163-L180
[ "def", "reset_all", "(", ")", ":", "global", "_username", "global", "_password", "global", "_active_config", "global", "_active_tests", "global", "_machine_names", "global", "_deployers", "reset_deployers", "(", ")", "reset_collector", "(", ")", "_username", "=", "N...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
get_active_config
gets the config value associated with the config_option or returns an empty string if the config is not found :param config_option: :param default: if not None, will be used :return: value of config. If key is not in config, then default will be used if default is not set to None. Otherwise, KeyError is thrown...
zopkio/runtime.py
def get_active_config(config_option, default=None): """ gets the config value associated with the config_option or returns an empty string if the config is not found :param config_option: :param default: if not None, will be used :return: value of config. If key is not in config, then default will be used if ...
def get_active_config(config_option, default=None): """ gets the config value associated with the config_option or returns an empty string if the config is not found :param config_option: :param default: if not None, will be used :return: value of config. If key is not in config, then default will be used if ...
[ "gets", "the", "config", "value", "associated", "with", "the", "config_option", "or", "returns", "an", "empty", "string", "if", "the", "config", "is", "not", "found", ":", "param", "config_option", ":", ":", "param", "default", ":", "if", "not", "None", "w...
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/runtime.py#L196-L204
[ "def", "get_active_config", "(", "config_option", ",", "default", "=", "None", ")", ":", "return", "_active_config", ".", "mapping", "[", "config_option", "]", "if", "default", "is", "None", "else", "_active_config", ".", "mapping", ".", "get", "(", "config_op...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
Reporter.generate
Generates the report
zopkio/html_reporter.py
def generate(self): """ Generates the report """ self._setup() header_html = self._generate_header() footer_html = self._generate_footer() results_topbar_html = self._generate_topbar("results") summary_topbar_html = self._generate_topbar("summary") logs_topbar_html = self._generate_...
def generate(self): """ Generates the report """ self._setup() header_html = self._generate_header() footer_html = self._generate_footer() results_topbar_html = self._generate_topbar("results") summary_topbar_html = self._generate_topbar("summary") logs_topbar_html = self._generate_...
[ "Generates", "the", "report" ]
linkedin/Zopkio
python
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/html_reporter.py#L85-L122
[ "def", "generate", "(", "self", ")", ":", "self", ".", "_setup", "(", ")", "header_html", "=", "self", ".", "_generate_header", "(", ")", "footer_html", "=", "self", ".", "_generate_footer", "(", ")", "results_topbar_html", "=", "self", ".", "_generate_topba...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
train
UpdateType.execute
for a given file
Server/Python/src/dbs/dao/Oracle/Dataset/UpdateType.py
def execute ( self, conn, dataset, dataset_access_type, transaction=False ): """ for a given file """ if not conn: dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/Dataset/UpdateType. Expects db connection from upper layer.", self.logger.exception) bin...
def execute ( self, conn, dataset, dataset_access_type, transaction=False ): """ for a given file """ if not conn: dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/Dataset/UpdateType. Expects db connection from upper layer.", self.logger.exception) bin...
[ "for", "a", "given", "file" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/Dataset/UpdateType.py#L26-L33
[ "def", "execute", "(", "self", ",", "conn", ",", "dataset", ",", "dataset_access_type", ",", "transaction", "=", "False", ")", ":", "if", "not", "conn", ":", "dbsExceptionHandler", "(", "\"dbsException-failed-connect2host\"", ",", "\"Oracle/Dataset/UpdateType. Expect...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
inputChecks
This is a function to check all the input for GET APIs.
Server/Python/src/dbs/utils/DBSInputValidation.py
def inputChecks(**_params_): """ This is a function to check all the input for GET APIs. """ def checkTypes(_func_, _params_ = _params_): log = clog.error_log @wraps(_func_) def wrapped(*args, **kw): arg_names = _func_.__code__.co_varnames[:_func_.__code__.co_argcount...
def inputChecks(**_params_): """ This is a function to check all the input for GET APIs. """ def checkTypes(_func_, _params_ = _params_): log = clog.error_log @wraps(_func_) def wrapped(*args, **kw): arg_names = _func_.__code__.co_varnames[:_func_.__code__.co_argcount...
[ "This", "is", "a", "function", "to", "check", "all", "the", "input", "for", "GET", "APIs", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/DBSInputValidation.py#L31-L155
[ "def", "inputChecks", "(", "*", "*", "_params_", ")", ":", "def", "checkTypes", "(", "_func_", ",", "_params_", "=", "_params_", ")", ":", "log", "=", "clog", ".", "error_log", "@", "wraps", "(", "_func_", ")", "def", "wrapped", "(", "*", "args", ","...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
validateStringInput
To check if a string has the required format. This is only used for POST APIs.
Server/Python/src/dbs/utils/DBSInputValidation.py
def validateStringInput(input_key,input_data, read=False): """ To check if a string has the required format. This is only used for POST APIs. """ log = clog.error_log func = None if '*' in input_data or '%' in input_data: func = validationFunctionWildcard.get(input_key) if func i...
def validateStringInput(input_key,input_data, read=False): """ To check if a string has the required format. This is only used for POST APIs. """ log = clog.error_log func = None if '*' in input_data or '%' in input_data: func = validationFunctionWildcard.get(input_key) if func i...
[ "To", "check", "if", "a", "string", "has", "the", "required", "format", ".", "This", "is", "only", "used", "for", "POST", "APIs", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/DBSInputValidation.py#L305-L339
[ "def", "validateStringInput", "(", "input_key", ",", "input_data", ",", "read", "=", "False", ")", ":", "log", "=", "clog", ".", "error_log", "func", "=", "None", "if", "'*'", "in", "input_data", "or", "'%'", "in", "input_data", ":", "func", "=", "valida...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
List.execute
Lists all primary datasets if pattern is not provided.
Server/Python/src/dbs/dao/Oracle/Service/List.py
def execute(self, conn, transaction=False): """ Lists all primary datasets if pattern is not provided. """ sql = self.sql binds = {} cursors = self.dbi.processData(sql, binds, conn, transaction, returnCursor=True) result = [] for c in cursors: ...
def execute(self, conn, transaction=False): """ Lists all primary datasets if pattern is not provided. """ sql = self.sql binds = {} cursors = self.dbi.processData(sql, binds, conn, transaction, returnCursor=True) result = [] for c in cursors: ...
[ "Lists", "all", "primary", "datasets", "if", "pattern", "is", "not", "provided", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/Service/List.py#L26-L37
[ "def", "execute", "(", "self", ",", "conn", ",", "transaction", "=", "False", ")", ":", "sql", "=", "self", ".", "sql", "binds", "=", "{", "}", "cursors", "=", "self", ".", "dbi", ".", "processData", "(", "sql", ",", "binds", ",", "conn", ",", "t...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
Remove.execute
daoinput keys: migration_request_id
Server/Python/src/dbs/dao/Oracle/MigrationRequests/Remove.py
def execute(self, conn, daoinput, transaction = False): """ daoinput keys: migration_request_id """ if not conn: dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationRequests/Remove. Expects db connection from upper layer.", self...
def execute(self, conn, daoinput, transaction = False): """ daoinput keys: migration_request_id """ if not conn: dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationRequests/Remove. Expects db connection from upper layer.", self...
[ "daoinput", "keys", ":", "migration_request_id" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/MigrationRequests/Remove.py#L34-L53
[ "def", "execute", "(", "self", ",", "conn", ",", "daoinput", ",", "transaction", "=", "False", ")", ":", "if", "not", "conn", ":", "dbsExceptionHandler", "(", "\"dbsException-failed-connect2host\"", ",", "\"Oracle/MigrationRequests/Remove. Expects db connection from upper...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
jsonstreamer
JSON streamer decorator
Server/Python/src/dbs/utils/dbsUtils.py
def jsonstreamer(func): """JSON streamer decorator""" def wrapper (self, *args, **kwds): gen = func (self, *args, **kwds) yield "[" firstItem = True for item in gen: if not firstItem: yield "," else: firstItem = False ...
def jsonstreamer(func): """JSON streamer decorator""" def wrapper (self, *args, **kwds): gen = func (self, *args, **kwds) yield "[" firstItem = True for item in gen: if not firstItem: yield "," else: firstItem = False ...
[ "JSON", "streamer", "decorator" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/dbsUtils.py#L69-L82
[ "def", "jsonstreamer", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "gen", "=", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", "yield", "\"[\"", "firstItem", "=", "...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
dbsUtils.decodeLumiIntervals
lumi_list must be of one of the two following formats: '[[a,b], [c,d],' or [a1, a2, a3]
Server/Python/src/dbs/utils/dbsUtils.py
def decodeLumiIntervals(self, lumi_list): """lumi_list must be of one of the two following formats: '[[a,b], [c,d],' or [a1, a2, a3] """ errmessage = "lumi intervals must be of one of the two following formats: '[[a,b], [c,d], ...],' or [a1, a2, a3 ...] " if isinstance(lumi_list, basestring): ...
def decodeLumiIntervals(self, lumi_list): """lumi_list must be of one of the two following formats: '[[a,b], [c,d],' or [a1, a2, a3] """ errmessage = "lumi intervals must be of one of the two following formats: '[[a,b], [c,d], ...],' or [a1, a2, a3 ...] " if isinstance(lumi_list, basestring): ...
[ "lumi_list", "must", "be", "of", "one", "of", "the", "two", "following", "formats", ":", "[[", "a", "b", "]", "[", "c", "d", "]", "or", "[", "a1", "a2", "a3", "]" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/dbsUtils.py#L36-L67
[ "def", "decodeLumiIntervals", "(", "self", ",", "lumi_list", ")", ":", "errmessage", "=", "\"lumi intervals must be of one of the two following formats: '[[a,b], [c,d], ...],' or [a1, a2, a3 ...] \"", "if", "isinstance", "(", "lumi_list", ",", "basestring", ")", ":", "try", "...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSDatasetAccessType.listDatasetAccessTypes
List dataset access types
Server/Python/src/dbs/business/DBSDatasetAccessType.py
def listDatasetAccessTypes(self, dataset_access_type=""): """ List dataset access types """ if isinstance(dataset_access_type, basestring): try: dataset_access_type = str(dataset_access_type) except: dbsExceptionHandler('dbsExce...
def listDatasetAccessTypes(self, dataset_access_type=""): """ List dataset access types """ if isinstance(dataset_access_type, basestring): try: dataset_access_type = str(dataset_access_type) except: dbsExceptionHandler('dbsExce...
[ "List", "dataset", "access", "types" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSDatasetAccessType.py#L24-L48
[ "def", "listDatasetAccessTypes", "(", "self", ",", "dataset_access_type", "=", "\"\"", ")", ":", "if", "isinstance", "(", "dataset_access_type", ",", "basestring", ")", ":", "try", ":", "dataset_access_type", "=", "str", "(", "dataset_access_type", ")", "except", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
IPBlock.block_before
Check the current request and block it if the IP address it's coming from is blacklisted.
flask_ipblock/__init__.py
def block_before(self): """ Check the current request and block it if the IP address it's coming from is blacklisted. """ # To avoid unnecessary database queries, ignore the IP check for # requests for static files if request.path.startswith(url_for('static', file...
def block_before(self): """ Check the current request and block it if the IP address it's coming from is blacklisted. """ # To avoid unnecessary database queries, ignore the IP check for # requests for static files if request.path.startswith(url_for('static', file...
[ "Check", "the", "current", "request", "and", "block", "it", "if", "the", "IP", "address", "it", "s", "coming", "from", "is", "blacklisted", "." ]
closeio/flask-ipblock
python
https://github.com/closeio/flask-ipblock/blob/d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f/flask_ipblock/__init__.py#L43-L75
[ "def", "block_before", "(", "self", ")", ":", "# To avoid unnecessary database queries, ignore the IP check for", "# requests for static files", "if", "request", ".", "path", ".", "startswith", "(", "url_for", "(", "'static'", ",", "filename", "=", "''", ")", ")", ":"...
d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f
train
IPBlock.matches_ip
Return True if the given IP is blacklisted, False otherwise.
flask_ipblock/__init__.py
def matches_ip(self, ip): """Return True if the given IP is blacklisted, False otherwise.""" # Check the cache if caching is enabled if self.cache is not None: matches_ip = self.cache.get(ip) if matches_ip is not None: return matches_ip # Query M...
def matches_ip(self, ip): """Return True if the given IP is blacklisted, False otherwise.""" # Check the cache if caching is enabled if self.cache is not None: matches_ip = self.cache.get(ip) if matches_ip is not None: return matches_ip # Query M...
[ "Return", "True", "if", "the", "given", "IP", "is", "blacklisted", "False", "otherwise", "." ]
closeio/flask-ipblock
python
https://github.com/closeio/flask-ipblock/blob/d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f/flask_ipblock/__init__.py#L77-L94
[ "def", "matches_ip", "(", "self", ",", "ip", ")", ":", "# Check the cache if caching is enabled", "if", "self", ".", "cache", "is", "not", "None", ":", "matches_ip", "=", "self", ".", "cache", ".", "get", "(", "ip", ")", "if", "matches_ip", "is", "not", ...
d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f
train
ListChild.execute
Lists all primary datasets if pattern is not provided.
Server/Python/src/dbs/dao/Oracle/FileParent/ListChild.py
def execute(self, conn, logical_file_name, block_name, block_id, transaction=False): """ Lists all primary datasets if pattern is not provided. """ binds = {} sql = '' if logical_file_name: if isinstance(logical_file_name, basestring): wheresq...
def execute(self, conn, logical_file_name, block_name, block_id, transaction=False): """ Lists all primary datasets if pattern is not provided. """ binds = {} sql = '' if logical_file_name: if isinstance(logical_file_name, basestring): wheresq...
[ "Lists", "all", "primary", "datasets", "if", "pattern", "is", "not", "provided", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/FileParent/ListChild.py#L30-L63
[ "def", "execute", "(", "self", ",", "conn", ",", "logical_file_name", ",", "block_name", ",", "block_id", ",", "transaction", "=", "False", ")", ":", "binds", "=", "{", "}", "sql", "=", "''", "if", "logical_file_name", ":", "if", "isinstance", "(", "logi...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSAcquisitionEra.listAcquisitionEras
Returns all acquistion eras in dbs
Server/Python/src/dbs/business/DBSAcquisitionEra.py
def listAcquisitionEras(self, acq=''): """ Returns all acquistion eras in dbs """ try: acq = str(acq) except: dbsExceptionHandler('dbsException-invalid-input', 'acquistion_era_name given is not valid : %s' %acq) conn = self.dbi.connection() ...
def listAcquisitionEras(self, acq=''): """ Returns all acquistion eras in dbs """ try: acq = str(acq) except: dbsExceptionHandler('dbsException-invalid-input', 'acquistion_era_name given is not valid : %s' %acq) conn = self.dbi.connection() ...
[ "Returns", "all", "acquistion", "eras", "in", "dbs" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSAcquisitionEra.py#L27-L40
[ "def", "listAcquisitionEras", "(", "self", ",", "acq", "=", "''", ")", ":", "try", ":", "acq", "=", "str", "(", "acq", ")", "except", ":", "dbsExceptionHandler", "(", "'dbsException-invalid-input'", ",", "'acquistion_era_name given is not valid : %s'", "%", "acq",...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSAcquisitionEra.listAcquisitionEras_CI
Returns all acquistion eras in dbs
Server/Python/src/dbs/business/DBSAcquisitionEra.py
def listAcquisitionEras_CI(self, acq=''): """ Returns all acquistion eras in dbs """ try: acq = str(acq) except: dbsExceptionHandler('dbsException-invalid-input', 'aquistion_era_name given is not valid : %s'%acq) conn = self.dbi.connection() ...
def listAcquisitionEras_CI(self, acq=''): """ Returns all acquistion eras in dbs """ try: acq = str(acq) except: dbsExceptionHandler('dbsException-invalid-input', 'aquistion_era_name given is not valid : %s'%acq) conn = self.dbi.connection() ...
[ "Returns", "all", "acquistion", "eras", "in", "dbs" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSAcquisitionEra.py#L42-L55
[ "def", "listAcquisitionEras_CI", "(", "self", ",", "acq", "=", "''", ")", ":", "try", ":", "acq", "=", "str", "(", "acq", ")", "except", ":", "dbsExceptionHandler", "(", "'dbsException-invalid-input'", ",", "'aquistion_era_name given is not valid : %s'", "%", "acq...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSAcquisitionEra.insertAcquisitionEra
Input dictionary has to have the following keys: acquisition_era_name, creation_date, create_by, start_date, end_date. it builds the correct dictionary for dao input and executes the dao
Server/Python/src/dbs/business/DBSAcquisitionEra.py
def insertAcquisitionEra(self, businput): """ Input dictionary has to have the following keys: acquisition_era_name, creation_date, create_by, start_date, end_date. it builds the correct dictionary for dao input and executes the dao """ conn = self.dbi.connection() ...
def insertAcquisitionEra(self, businput): """ Input dictionary has to have the following keys: acquisition_era_name, creation_date, create_by, start_date, end_date. it builds the correct dictionary for dao input and executes the dao """ conn = self.dbi.connection() ...
[ "Input", "dictionary", "has", "to", "have", "the", "following", "keys", ":", "acquisition_era_name", "creation_date", "create_by", "start_date", "end_date", ".", "it", "builds", "the", "correct", "dictionary", "for", "dao", "input", "and", "executes", "the", "dao"...
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSAcquisitionEra.py#L57-L83
[ "def", "insertAcquisitionEra", "(", "self", ",", "businput", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "tran", "=", "conn", ".", "begin", "(", ")", "try", ":", "businput", "[", "\"acquisition_era_id\"", "]", "=", "self", "...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSAcquisitionEra.UpdateAcqEraEndDate
Input dictionary has to have the following keys: acquisition_era_name, end_date.
Server/Python/src/dbs/business/DBSAcquisitionEra.py
def UpdateAcqEraEndDate(self, acquisition_era_name ="", end_date=0): """ Input dictionary has to have the following keys: acquisition_era_name, end_date. """ if acquisition_era_name =="" or end_date==0: dbsExceptionHandler('dbsException-invalid-input', "acquisition_er...
def UpdateAcqEraEndDate(self, acquisition_era_name ="", end_date=0): """ Input dictionary has to have the following keys: acquisition_era_name, end_date. """ if acquisition_era_name =="" or end_date==0: dbsExceptionHandler('dbsException-invalid-input', "acquisition_er...
[ "Input", "dictionary", "has", "to", "have", "the", "following", "keys", ":", "acquisition_era_name", "end_date", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSAcquisitionEra.py#L85-L100
[ "def", "UpdateAcqEraEndDate", "(", "self", ",", "acquisition_era_name", "=", "\"\"", ",", "end_date", "=", "0", ")", ":", "if", "acquisition_era_name", "==", "\"\"", "or", "end_date", "==", "0", ":", "dbsExceptionHandler", "(", "'dbsException-invalid-input'", ",",...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
GetID.execute
returns id for a given application
Server/Python/src/dbs/dao/Oracle/OutputModuleConfig/GetID.py
def execute(self, conn, app="", release_version="", pset_hash="", output_label="", global_tag='', transaction = False): """ returns id for a given application """ sql = self.sql binds = {} setAnd=False if not app == "": sql += " A.APP_NAME=:app_name" binds[...
def execute(self, conn, app="", release_version="", pset_hash="", output_label="", global_tag='', transaction = False): """ returns id for a given application """ sql = self.sql binds = {} setAnd=False if not app == "": sql += " A.APP_NAME=:app_name" binds[...
[ "returns", "id", "for", "a", "given", "application" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/OutputModuleConfig/GetID.py#L31-L68
[ "def", "execute", "(", "self", ",", "conn", ",", "app", "=", "\"\"", ",", "release_version", "=", "\"\"", ",", "pset_hash", "=", "\"\"", ",", "output_label", "=", "\"\"", ",", "global_tag", "=", "''", ",", "transaction", "=", "False", ")", ":", "sql", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.prepareDatasetMigrationList
Prepare the ordered lists of blocks based on input DATASET (note Block is different) 1. Get list of blocks from source 2. Check and see if these blocks are already at DST 3. Check if dataset has parents 4. Check if parent blocks are already at DST
Server/Python/src/dbs/business/DBSMigrate.py
def prepareDatasetMigrationList(self, conn, request): """ Prepare the ordered lists of blocks based on input DATASET (note Block is different) 1. Get list of blocks from source 2. Check and see if these blocks are already at DST 3. Check if dataset has parents ...
def prepareDatasetMigrationList(self, conn, request): """ Prepare the ordered lists of blocks based on input DATASET (note Block is different) 1. Get list of blocks from source 2. Check and see if these blocks are already at DST 3. Check if dataset has parents ...
[ "Prepare", "the", "ordered", "lists", "of", "blocks", "based", "on", "input", "DATASET", "(", "note", "Block", "is", "different", ")", "1", ".", "Get", "list", "of", "blocks", "from", "source", "2", ".", "Check", "and", "see", "if", "these", "blocks", ...
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L77-L120
[ "def", "prepareDatasetMigrationList", "(", "self", ",", "conn", ",", "request", ")", ":", "ordered_dict", "=", "{", "}", "order_counter", "=", "0", "srcdataset", "=", "request", "[", "\"migration_input\"", "]", "url", "=", "request", "[", "\"migration_url\"", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.processDatasetBlocks
Utility function, that comapares blocks of a dataset at source and dst and returns an ordered list of blocks not already at dst for migration
Server/Python/src/dbs/business/DBSMigrate.py
def processDatasetBlocks(self, url, conn, inputdataset, order_counter): """ Utility function, that comapares blocks of a dataset at source and dst and returns an ordered list of blocks not already at dst for migration """ ordered_dict = {} srcblks = self.getSrcBlocks(url,...
def processDatasetBlocks(self, url, conn, inputdataset, order_counter): """ Utility function, that comapares blocks of a dataset at source and dst and returns an ordered list of blocks not already at dst for migration """ ordered_dict = {} srcblks = self.getSrcBlocks(url,...
[ "Utility", "function", "that", "comapares", "blocks", "of", "a", "dataset", "at", "source", "and", "dst", "and", "returns", "an", "ordered", "list", "of", "blocks", "not", "already", "at", "dst", "for", "migration" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L122-L148
[ "def", "processDatasetBlocks", "(", "self", ",", "url", ",", "conn", ",", "inputdataset", ",", "order_counter", ")", ":", "ordered_dict", "=", "{", "}", "srcblks", "=", "self", ".", "getSrcBlocks", "(", "url", ",", "dataset", "=", "inputdataset", ")", "if"...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.getParentDatasetsOrderedList
check if input dataset has parents, check if any of the blocks are already at dst, prepare the ordered list and return it. url : source DBS url dataset : to be migrated dataset order_counter: the order in which migration happends.
Server/Python/src/dbs/business/DBSMigrate.py
def getParentDatasetsOrderedList(self, url, conn, dataset, order_counter): """ check if input dataset has parents, check if any of the blocks are already at dst, prepare the ordered list and return it. url : source DBS url dataset : to be migrated dataset order_co...
def getParentDatasetsOrderedList(self, url, conn, dataset, order_counter): """ check if input dataset has parents, check if any of the blocks are already at dst, prepare the ordered list and return it. url : source DBS url dataset : to be migrated dataset order_co...
[ "check", "if", "input", "dataset", "has", "parents", "check", "if", "any", "of", "the", "blocks", "are", "already", "at", "dst", "prepare", "the", "ordered", "list", "and", "return", "it", ".", "url", ":", "source", "DBS", "url", "dataset", ":", "to", ...
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L150-L182
[ "def", "getParentDatasetsOrderedList", "(", "self", ",", "url", ",", "conn", ",", "dataset", ",", "order_counter", ")", ":", "ordered_dict", "=", "{", "}", "parentSrcDatasets", "=", "self", ".", "getSrcDatasetParents", "(", "url", ",", "dataset", ")", "if", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.prepareBlockMigrationList
Prepare the ordered lists of blocks based on input BLOCK 1. see if block already exists at dst (no need to migrate), raise "ALREADY EXISTS" 2. see if block exists at src & make sure the block's open_for_writing=0 3. see if block has parents 4. see if parent...
Server/Python/src/dbs/business/DBSMigrate.py
def prepareBlockMigrationList(self, conn, request): """ Prepare the ordered lists of blocks based on input BLOCK 1. see if block already exists at dst (no need to migrate), raise "ALREADY EXISTS" 2. see if block exists at src & make sure the block's open_for_writin...
def prepareBlockMigrationList(self, conn, request): """ Prepare the ordered lists of blocks based on input BLOCK 1. see if block already exists at dst (no need to migrate), raise "ALREADY EXISTS" 2. see if block exists at src & make sure the block's open_for_writin...
[ "Prepare", "the", "ordered", "lists", "of", "blocks", "based", "on", "input", "BLOCK", "1", ".", "see", "if", "block", "already", "exists", "at", "dst", "(", "no", "need", "to", "migrate", ")", "raise", "ALREADY", "EXISTS", "2", ".", "see", "if", "bloc...
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L184-L238
[ "def", "prepareBlockMigrationList", "(", "self", ",", "conn", ",", "request", ")", ":", "ordered_dict", "=", "{", "}", "block_name", "=", "request", "[", "\"migration_input\"", "]", "url", "=", "request", "[", "\"migration_url\"", "]", "order_counter", "=", "0...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.removeMigrationRequest
Method to remove pending or failed migration request from the queue.
Server/Python/src/dbs/business/DBSMigrate.py
def removeMigrationRequest(self, migration_rqst): """ Method to remove pending or failed migration request from the queue. """ conn = self.dbi.connection() try: tran = conn.begin() self.mgrremove.execute(conn, migration_rqst) tran.commit() ...
def removeMigrationRequest(self, migration_rqst): """ Method to remove pending or failed migration request from the queue. """ conn = self.dbi.connection() try: tran = conn.begin() self.mgrremove.execute(conn, migration_rqst) tran.commit() ...
[ "Method", "to", "remove", "pending", "or", "failed", "migration", "request", "from", "the", "queue", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L285-L301
[ "def", "removeMigrationRequest", "(", "self", ",", "migration_rqst", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "try", ":", "tran", "=", "conn", ".", "begin", "(", ")", "self", ".", "mgrremove", ".", "execute", "(", "conn",...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.insertMigrationRequest
Method to insert use requests to MIGRATION_REQUESTS table. request keys: migration_url, migration_input
Server/Python/src/dbs/business/DBSMigrate.py
def insertMigrationRequest(self, request): """ Method to insert use requests to MIGRATION_REQUESTS table. request keys: migration_url, migration_input """ conn = self.dbi.connection() # check if already queued. #If the migration_input is the same, but the src url ...
def insertMigrationRequest(self, request): """ Method to insert use requests to MIGRATION_REQUESTS table. request keys: migration_url, migration_input """ conn = self.dbi.connection() # check if already queued. #If the migration_input is the same, but the src url ...
[ "Method", "to", "insert", "use", "requests", "to", "MIGRATION_REQUESTS", "table", ".", "request", "keys", ":", "migration_url", "migration_input" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L305-L418
[ "def", "insertMigrationRequest", "(", "self", ",", "request", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "# check if already queued.", "#If the migration_input is the same, but the src url is different,", "#We will consider it as a submitted request...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.listMigrationRequests
get the status of the migration migratee : can be dataset or block_name
Server/Python/src/dbs/business/DBSMigrate.py
def listMigrationRequests(self, migration_request_id="", block_name="", dataset="", user="", oldest=False): """ get the status of the migration migratee : can be dataset or block_name """ conn = self.dbi.connection() migratee = "" tr...
def listMigrationRequests(self, migration_request_id="", block_name="", dataset="", user="", oldest=False): """ get the status of the migration migratee : can be dataset or block_name """ conn = self.dbi.connection() migratee = "" tr...
[ "get", "the", "status", "of", "the", "migration", "migratee", ":", "can", "be", "dataset", "or", "block_name" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L420-L440
[ "def", "listMigrationRequests", "(", "self", ",", "migration_request_id", "=", "\"\"", ",", "block_name", "=", "\"\"", ",", "dataset", "=", "\"\"", ",", "user", "=", "\"\"", ",", "oldest", "=", "False", ")", ":", "conn", "=", "self", ".", "dbi", ".", "...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.listMigrationBlocks
get eveything of block that is has status = 0 and migration_request_id as specified.
Server/Python/src/dbs/business/DBSMigrate.py
def listMigrationBlocks(self, migration_request_id=""): """ get eveything of block that is has status = 0 and migration_request_id as specified. """ conn = self.dbi.connection() try: return self.mgrblklist.execute(conn, migration_request_id=migration_request_id) ...
def listMigrationBlocks(self, migration_request_id=""): """ get eveything of block that is has status = 0 and migration_request_id as specified. """ conn = self.dbi.connection() try: return self.mgrblklist.execute(conn, migration_request_id=migration_request_id) ...
[ "get", "eveything", "of", "block", "that", "is", "has", "status", "=", "0", "and", "migration_request_id", "as", "specified", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L442-L451
[ "def", "listMigrationBlocks", "(", "self", ",", "migration_request_id", "=", "\"\"", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "try", ":", "return", "self", ".", "mgrblklist", ".", "execute", "(", "conn", ",", "migration_reque...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.updateMigrationRequestStatus
migration_status: 0=PENDING 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) 9=Terminally FAILED status change: 0 -> 1 1 -> 2 1 -> 3 1 -> 9 are only allowed changes for working through migration. 3 -> 1 is allowed for r...
Server/Python/src/dbs/business/DBSMigrate.py
def updateMigrationRequestStatus(self, migration_status, migration_request_id): """ migration_status: 0=PENDING 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) 9=Terminally FAILED status change: 0 -> 1 1 -> 2 1 -> 3 1 ...
def updateMigrationRequestStatus(self, migration_status, migration_request_id): """ migration_status: 0=PENDING 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) 9=Terminally FAILED status change: 0 -> 1 1 -> 2 1 -> 3 1 ...
[ "migration_status", ":", "0", "=", "PENDING", "1", "=", "IN", "PROGRESS", "2", "=", "COMPLETED", "3", "=", "FAILED", "(", "will", "be", "retried", ")", "9", "=", "Terminally", "FAILED", "status", "change", ":", "0", "-", ">", "1", "1", "-", ">", "2...
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L454-L486
[ "def", "updateMigrationRequestStatus", "(", "self", ",", "migration_status", ",", "migration_request_id", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "tran", "=", "conn", ".", "begin", "(", ")", "try", ":", "upst", "=", "dict", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.updateMigrationBlockStatus
migration_status: 0=PENDING 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) 9=Terminally FAILED status change: 0 -> 1 1 -> 2 1 -> 3 1 -> 9 are only allowed changes for working through migration. 3 -> 1 allowed for retry...
Server/Python/src/dbs/business/DBSMigrate.py
def updateMigrationBlockStatus(self, migration_status=0, migration_block=None, migration_request=None): """ migration_status: 0=PENDING 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) 9=Terminally FAILED status change: 0 -> 1 1 -> 2 ...
def updateMigrationBlockStatus(self, migration_status=0, migration_block=None, migration_request=None): """ migration_status: 0=PENDING 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) 9=Terminally FAILED status change: 0 -> 1 1 -> 2 ...
[ "migration_status", ":", "0", "=", "PENDING", "1", "=", "IN", "PROGRESS", "2", "=", "COMPLETED", "3", "=", "FAILED", "(", "will", "be", "retried", ")", "9", "=", "Terminally", "FAILED", "status", "change", ":", "0", "-", ">", "1", "1", "-", ">", "2...
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L492-L526
[ "def", "updateMigrationBlockStatus", "(", "self", ",", "migration_status", "=", "0", ",", "migration_block", "=", "None", ",", "migration_request", "=", "None", ")", ":", "conn", "=", "self", ".", "dbi", ".", "connection", "(", ")", "tran", "=", "conn", "....
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.getSrcDatasetParents
List block at src DBS
Server/Python/src/dbs/business/DBSMigrate.py
def getSrcDatasetParents(self, url, dataset): """ List block at src DBS """ #resturl = "%s/datasetparents?dataset=%s" % (url, dataset) params={'dataset':dataset} return cjson.decode(self.callDBSService(url, 'datasetparents', params, {}))
def getSrcDatasetParents(self, url, dataset): """ List block at src DBS """ #resturl = "%s/datasetparents?dataset=%s" % (url, dataset) params={'dataset':dataset} return cjson.decode(self.callDBSService(url, 'datasetparents', params, {}))
[ "List", "block", "at", "src", "DBS" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L554-L560
[ "def", "getSrcDatasetParents", "(", "self", ",", "url", ",", "dataset", ")", ":", "#resturl = \"%s/datasetparents?dataset=%s\" % (url, dataset)", "params", "=", "{", "'dataset'", ":", "dataset", "}", "return", "cjson", ".", "decode", "(", "self", ".", "callDBSServic...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.getSrcBlockParents
List block at src DBS
Server/Python/src/dbs/business/DBSMigrate.py
def getSrcBlockParents(self, url, block): """ List block at src DBS """ #blockname = block.replace("#", urllib.quote_plus('#')) #resturl = "%s/blockparents?block_name=%s" % (url, blockname) params={'block_name':block} return cjson.decode(self.callDBSService(url, '...
def getSrcBlockParents(self, url, block): """ List block at src DBS """ #blockname = block.replace("#", urllib.quote_plus('#')) #resturl = "%s/blockparents?block_name=%s" % (url, blockname) params={'block_name':block} return cjson.decode(self.callDBSService(url, '...
[ "List", "block", "at", "src", "DBS" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L562-L569
[ "def", "getSrcBlockParents", "(", "self", ",", "url", ",", "block", ")", ":", "#blockname = block.replace(\"#\", urllib.quote_plus('#'))", "#resturl = \"%s/blockparents?block_name=%s\" % (url, blockname)", "params", "=", "{", "'block_name'", ":", "block", "}", "return", "cjso...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
DBSMigrate.getSrcBlocks
Need to list all blocks of the dataset and its parents starting from the top For now just list the blocks from this dataset. Client type call...
Server/Python/src/dbs/business/DBSMigrate.py
def getSrcBlocks(self, url, dataset="", block=""): """ Need to list all blocks of the dataset and its parents starting from the top For now just list the blocks from this dataset. Client type call... """ if block: params={'block_name':block, 'open_for_writing'...
def getSrcBlocks(self, url, dataset="", block=""): """ Need to list all blocks of the dataset and its parents starting from the top For now just list the blocks from this dataset. Client type call... """ if block: params={'block_name':block, 'open_for_writing'...
[ "Need", "to", "list", "all", "blocks", "of", "the", "dataset", "and", "its", "parents", "starting", "from", "the", "top", "For", "now", "just", "list", "the", "blocks", "from", "this", "dataset", ".", "Client", "type", "call", "..." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSMigrate.py#L571-L586
[ "def", "getSrcBlocks", "(", "self", ",", "url", ",", "dataset", "=", "\"\"", ",", "block", "=", "\"\"", ")", ":", "if", "block", ":", "params", "=", "{", "'block_name'", ":", "block", ",", "'open_for_writing'", ":", "0", "}", "elif", "dataset", ":", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
InsertSingle.executeSingle
build dynamic sql based on daoinput
Server/Python/src/dbs/dao/Oracle/InsertTable/Insert.py
def executeSingle( self, conn, daoinput, tablename, transaction = False): """build dynamic sql based on daoinput""" sql1 = " insert into %s%s( " %(self.owner, tablename) sql2 =" values(" "Now loop over all the input keys. We need to check if all the keys are valid !!!" for key in daoinput: sq...
def executeSingle( self, conn, daoinput, tablename, transaction = False): """build dynamic sql based on daoinput""" sql1 = " insert into %s%s( " %(self.owner, tablename) sql2 =" values(" "Now loop over all the input keys. We need to check if all the keys are valid !!!" for key in daoinput: sq...
[ "build", "dynamic", "sql", "based", "on", "daoinput" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/InsertTable/Insert.py#L16-L27
[ "def", "executeSingle", "(", "self", ",", "conn", ",", "daoinput", ",", "tablename", ",", "transaction", "=", "False", ")", ":", "sql1", "=", "\" insert into %s%s( \"", "%", "(", "self", ".", "owner", ",", "tablename", ")", "sql2", "=", "\" values(\"", "\"...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
Config._cast_boolean
Helper to convert config values to boolean as ConfigParser do.
decouple.py
def _cast_boolean(self, value): """ Helper to convert config values to boolean as ConfigParser do. """ if value.lower() not in self._BOOLEANS: raise ValueError('Not a boolean: %s' % value) return self._BOOLEANS[value.lower()]
def _cast_boolean(self, value): """ Helper to convert config values to boolean as ConfigParser do. """ if value.lower() not in self._BOOLEANS: raise ValueError('Not a boolean: %s' % value) return self._BOOLEANS[value.lower()]
[ "Helper", "to", "convert", "config", "values", "to", "boolean", "as", "ConfigParser", "do", "." ]
henriquebastos/django-decouple
python
https://github.com/henriquebastos/django-decouple/blob/fbc4a1b139565e1468b97de7e8c4276bcfc5b3e9/decouple.py#L40-L47
[ "def", "_cast_boolean", "(", "self", ",", "value", ")", ":", "if", "value", ".", "lower", "(", ")", "not", "in", "self", ".", "_BOOLEANS", ":", "raise", "ValueError", "(", "'Not a boolean: %s'", "%", "value", ")", "return", "self", ".", "_BOOLEANS", "[",...
fbc4a1b139565e1468b97de7e8c4276bcfc5b3e9
train
Config.get
Return the value for option or default if defined.
decouple.py
def get(self, option, default=undefined, cast=undefined): """ Return the value for option or default if defined. """ if option in self.repository: value = self.repository.get(option) else: value = default if isinstance(value, Undefined): ...
def get(self, option, default=undefined, cast=undefined): """ Return the value for option or default if defined. """ if option in self.repository: value = self.repository.get(option) else: value = default if isinstance(value, Undefined): ...
[ "Return", "the", "value", "for", "option", "or", "default", "if", "defined", "." ]
henriquebastos/django-decouple
python
https://github.com/henriquebastos/django-decouple/blob/fbc4a1b139565e1468b97de7e8c4276bcfc5b3e9/decouple.py#L49-L66
[ "def", "get", "(", "self", ",", "option", ",", "default", "=", "undefined", ",", "cast", "=", "undefined", ")", ":", "if", "option", "in", "self", ".", "repository", ":", "value", "=", "self", ".", "repository", ".", "get", "(", "option", ")", "else"...
fbc4a1b139565e1468b97de7e8c4276bcfc5b3e9
train
parse_requirements
Create a list for the 'install_requires' component of the setup function by parsing a requirements file
Client/setup.py
def parse_requirements(requirements_file): """ Create a list for the 'install_requires' component of the setup function by parsing a requirements file """ if os.path.exists(requirements_file): # return a list that contains each line of the requirements file return open(requireme...
def parse_requirements(requirements_file): """ Create a list for the 'install_requires' component of the setup function by parsing a requirements file """ if os.path.exists(requirements_file): # return a list that contains each line of the requirements file return open(requireme...
[ "Create", "a", "list", "for", "the", "install_requires", "component", "of", "the", "setup", "function", "by", "parsing", "a", "requirements", "file" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Client/setup.py#L16-L27
[ "def", "parse_requirements", "(", "requirements_file", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "requirements_file", ")", ":", "# return a list that contains each line of the requirements file", "return", "open", "(", "requirements_file", ",", "'r'", ")", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
BriefList.execute
dataset: /a/b/c block: /a/b/c#d
Server/Python/src/dbs/dao/Oracle/Block/BriefList.py
def execute(self, conn, dataset="", block_name="", data_tier_name="", origin_site_name="", logical_file_name="", run_num=-1, min_cdate=0, max_cdate=0, min_ldate=0, max_ldate=0, cdate=0, ldate=0, open_for_writing=-1, transaction = False): """ dataset: /a/b/c block:...
def execute(self, conn, dataset="", block_name="", data_tier_name="", origin_site_name="", logical_file_name="", run_num=-1, min_cdate=0, max_cdate=0, min_ldate=0, max_ldate=0, cdate=0, ldate=0, open_for_writing=-1, transaction = False): """ dataset: /a/b/c block:...
[ "dataset", ":", "/", "a", "/", "b", "/", "c", "block", ":", "/", "a", "/", "b", "/", "c#d" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/Block/BriefList.py#L26-L144
[ "def", "execute", "(", "self", ",", "conn", ",", "dataset", "=", "\"\"", ",", "block_name", "=", "\"\"", ",", "data_tier_name", "=", "\"\"", ",", "origin_site_name", "=", "\"\"", ",", "logical_file_name", "=", "\"\"", ",", "run_num", "=", "-", "1", ",", ...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
List.execute
Lists all primary dataset types if no user input is provided.
Server/Python/src/dbs/dao/Oracle/PrimaryDSType/List.py
def execute(self, conn, dsType = "", dataset="", transaction = False): """ Lists all primary dataset types if no user input is provided. """ sql = self.sql binds={} if not dsType and not dataset: pass elif dsType and dataset in ("", None, '%'): ...
def execute(self, conn, dsType = "", dataset="", transaction = False): """ Lists all primary dataset types if no user input is provided. """ sql = self.sql binds={} if not dsType and not dataset: pass elif dsType and dataset in ("", None, '%'): ...
[ "Lists", "all", "primary", "dataset", "types", "if", "no", "user", "input", "is", "provided", "." ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/PrimaryDSType/List.py#L29-L62
[ "def", "execute", "(", "self", ",", "conn", ",", "dsType", "=", "\"\"", ",", "dataset", "=", "\"\"", ",", "transaction", "=", "False", ")", ":", "sql", "=", "self", ".", "sql", "binds", "=", "{", "}", "if", "not", "dsType", "and", "not", "dataset",...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
train
List.execute
returns id for a given application
Server/Python/src/dbs/dao/Oracle/OutputModuleConfig/List.py
def execute(self, conn, dataset="", logical_file_name="", app="", release_version="", pset_hash="", output_label ="", block_id=0, global_tag='', transaction = False): """ returns id for a given application """ #sql=self.sql binds = {} setAnd=False #add search only b...
def execute(self, conn, dataset="", logical_file_name="", app="", release_version="", pset_hash="", output_label ="", block_id=0, global_tag='', transaction = False): """ returns id for a given application """ #sql=self.sql binds = {} setAnd=False #add search only b...
[ "returns", "id", "for", "a", "given", "application" ]
dmwm/DBS
python
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/OutputModuleConfig/List.py#L42-L116
[ "def", "execute", "(", "self", ",", "conn", ",", "dataset", "=", "\"\"", ",", "logical_file_name", "=", "\"\"", ",", "app", "=", "\"\"", ",", "release_version", "=", "\"\"", ",", "pset_hash", "=", "\"\"", ",", "output_label", "=", "\"\"", ",", "block_id"...
9619bafce3783b3e77f0415f8f9a258e33dd1e6f