repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
robhowley/nhlscrapi
nhlscrapi/games/events.py
EventFactory.Create
def Create(event_type): """ Factory method creates objects derived from :py:class`.Event` with class name matching the :py:class`.EventType`. :param event_type: number for type of event :returns: constructed event corresponding to ``event_type`` :rtype: :py:class:`.Event...
python
def Create(event_type): """ Factory method creates objects derived from :py:class`.Event` with class name matching the :py:class`.EventType`. :param event_type: number for type of event :returns: constructed event corresponding to ``event_type`` :rtype: :py:class:`.Event...
[ "def", "Create", "(", "event_type", ")", ":", "if", "event_type", "in", "EventType", ".", "Name", ":", "# unknown event type gets base class", "if", "EventType", ".", "Name", "[", "event_type", "]", "==", "Event", ".", "__name__", ":", "return", "Event", "(", ...
Factory method creates objects derived from :py:class`.Event` with class name matching the :py:class`.EventType`. :param event_type: number for type of event :returns: constructed event corresponding to ``event_type`` :rtype: :py:class:`.Event`
[ "Factory", "method", "creates", "objects", "derived", "from", ":", "py", ":", "class", ".", "Event", "with", "class", "name", "matching", "the", ":", "py", ":", "class", ".", "EventType", ".", ":", "param", "event_type", ":", "number", "for", "type", "of...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/events.py#L167-L183
train
robhowley/nhlscrapi
nhlscrapi/games/toi.py
TOI.home_shift_summ
def home_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the home team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_home: self.__wrapped_home = self.__wrap(self._home.by_player) return self.__wra...
python
def home_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the home team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_home: self.__wrapped_home = self.__wrap(self._home.by_player) return self.__wra...
[ "def", "home_shift_summ", "(", "self", ")", ":", "if", "not", "self", ".", "__wrapped_home", ":", "self", ".", "__wrapped_home", "=", "self", ".", "__wrap", "(", "self", ".", "_home", ".", "by_player", ")", "return", "self", ".", "__wrapped_home" ]
:returns: :py:class:`.ShiftSummary` by player for the home team :rtype: dict ``{ player_num: shift_summary_obj }``
[ ":", "returns", ":", ":", "py", ":", "class", ":", ".", "ShiftSummary", "by", "player", "for", "the", "home", "team", ":", "rtype", ":", "dict", "{", "player_num", ":", "shift_summary_obj", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/toi.py#L88-L96
train
robhowley/nhlscrapi
nhlscrapi/games/toi.py
TOI.away_shift_summ
def away_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the away team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_away: self.__wrapped_away = self.__wrap(self._away.by_player) return self.__wra...
python
def away_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the away team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_away: self.__wrapped_away = self.__wrap(self._away.by_player) return self.__wra...
[ "def", "away_shift_summ", "(", "self", ")", ":", "if", "not", "self", ".", "__wrapped_away", ":", "self", ".", "__wrapped_away", "=", "self", ".", "__wrap", "(", "self", ".", "_away", ".", "by_player", ")", "return", "self", ".", "__wrapped_away" ]
:returns: :py:class:`.ShiftSummary` by player for the away team :rtype: dict ``{ player_num: shift_summary_obj }``
[ ":", "returns", ":", ":", "py", ":", "class", ":", ".", "ShiftSummary", "by", "player", "for", "the", "away", "team", ":", "rtype", ":", "dict", "{", "player_num", ":", "shift_summary_obj", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/toi.py#L100-L108
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rosterrep.py
RosterRep.parse
def parse(self): """ Retreive and parse Play by Play data for the given :py:class:`nhlscrapi.games.game.GameKey`` :returns: ``self`` on success, ``None`` otherwise """ try: return super(RosterRep, self).parse() \ .parse_rosters() \ .p...
python
def parse(self): """ Retreive and parse Play by Play data for the given :py:class:`nhlscrapi.games.game.GameKey`` :returns: ``self`` on success, ``None`` otherwise """ try: return super(RosterRep, self).parse() \ .parse_rosters() \ .p...
[ "def", "parse", "(", "self", ")", ":", "try", ":", "return", "super", "(", "RosterRep", ",", "self", ")", ".", "parse", "(", ")", ".", "parse_rosters", "(", ")", ".", "parse_scratches", "(", ")", ".", "parse_coaches", "(", ")", ".", "parse_officials", ...
Retreive and parse Play by Play data for the given :py:class:`nhlscrapi.games.game.GameKey`` :returns: ``self`` on success, ``None`` otherwise
[ "Retreive", "and", "parse", "Play", "by", "Play", "data", "for", "the", "given", ":", "py", ":", "class", ":", "nhlscrapi", ".", "games", ".", "game", ".", "GameKey" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L65-L79
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rosterrep.py
RosterRep.parse_rosters
def parse_rosters(self): """ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['home', 'away']: self.rosters[t] = ...
python
def parse_rosters(self): """ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['home', 'away']: self.rosters[t] = ...
[ "def", "parse_rosters", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "if", "not", "self", ".", "__blocks", ":", "self", ".", "__pl_blocks", "(", "lx_doc", ")", "for", "t", "in", "[", "'home'", ",", "'away'", "]", ":", "s...
Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise
[ "Parse", "the", "home", "and", "away", "game", "rosters" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L82-L96
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rosterrep.py
RosterRep.parse_scratches
def parse_scratches(self): """ Parse the home and away healthy scratches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['aw_scr', 'h_scr']: ix = 'awa...
python
def parse_scratches(self): """ Parse the home and away healthy scratches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['aw_scr', 'h_scr']: ix = 'awa...
[ "def", "parse_scratches", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "if", "not", "self", ".", "__blocks", ":", "self", ".", "__pl_blocks", "(", "lx_doc", ")", "for", "t", "in", "[", "'aw_scr'", ",", "'h_scr'", "]", ":",...
Parse the home and away healthy scratches :returns: ``self`` on success, ``None`` otherwise
[ "Parse", "the", "home", "and", "away", "healthy", "scratches" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L99-L113
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rosterrep.py
RosterRep.parse_coaches
def parse_coaches(self): """ Parse the home and away coaches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() tr = lx_doc.xpath('//tr[@id="HeadCoaches"]')[0] for i, td in enumerate(tr): txt = td.xpath('.//text()') ...
python
def parse_coaches(self): """ Parse the home and away coaches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() tr = lx_doc.xpath('//tr[@id="HeadCoaches"]')[0] for i, td in enumerate(tr): txt = td.xpath('.//text()') ...
[ "def", "parse_coaches", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "tr", "=", "lx_doc", ".", "xpath", "(", "'//tr[@id=\"HeadCoaches\"]'", ")", "[", "0", "]", "for", "i", ",", "td", "in", "enumerate", "(", "tr", ")", ":",...
Parse the home and away coaches :returns: ``self`` on success, ``None`` otherwise
[ "Parse", "the", "home", "and", "away", "coaches" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L116-L131
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rosterrep.py
RosterRep.parse_officials
def parse_officials(self): """ Parse the officials :returns: ``self`` on success, ``None`` otherwise """ # begin proper body of method lx_doc = self.html_doc() off_parser = opm(self.game_key.season) self.officials = off_parser(lx_doc) return self...
python
def parse_officials(self): """ Parse the officials :returns: ``self`` on success, ``None`` otherwise """ # begin proper body of method lx_doc = self.html_doc() off_parser = opm(self.game_key.season) self.officials = off_parser(lx_doc) return self...
[ "def", "parse_officials", "(", "self", ")", ":", "# begin proper body of method", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "off_parser", "=", "opm", "(", "self", ".", "game_key", ".", "season", ")", "self", ".", "officials", "=", "off_parser", "(", ...
Parse the officials :returns: ``self`` on success, ``None`` otherwise
[ "Parse", "the", "officials" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L134-L145
train
michaelherold/pyIsEmail
pyisemail/__init__.py
is_email
def is_email(address, check_dns=False, diagnose=False): """Validate an email address. Keyword arguments: address --- the email address as a string check_dns --- flag for whether to check the DNS status of the domain diagnose --- flag for whether to return True/False or a Diagnosis """ ...
python
def is_email(address, check_dns=False, diagnose=False): """Validate an email address. Keyword arguments: address --- the email address as a string check_dns --- flag for whether to check the DNS status of the domain diagnose --- flag for whether to return True/False or a Diagnosis """ ...
[ "def", "is_email", "(", "address", ",", "check_dns", "=", "False", ",", "diagnose", "=", "False", ")", ":", "threshold", "=", "BaseDiagnosis", ".", "CATEGORIES", "[", "\"THRESHOLD\"", "]", "d", "=", "ParserValidator", "(", ")", ".", "is_email", "(", "addre...
Validate an email address. Keyword arguments: address --- the email address as a string check_dns --- flag for whether to check the DNS status of the domain diagnose --- flag for whether to return True/False or a Diagnosis
[ "Validate", "an", "email", "address", "." ]
dd42d6425c59e5061fc214d42672210dccc64cf5
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/__init__.py#L12-L28
train
robhowley/nhlscrapi
nhlscrapi/games/repscrwrap.py
dispatch_loader
def dispatch_loader(scraper, loader_name): """ Decorator that enforces one time loading for scrapers. The one time loading is applied to partial loaders, e.g. only parse and load the home team roster once. This is not meant to be used directly. :param scraper: property name (string) containing ...
python
def dispatch_loader(scraper, loader_name): """ Decorator that enforces one time loading for scrapers. The one time loading is applied to partial loaders, e.g. only parse and load the home team roster once. This is not meant to be used directly. :param scraper: property name (string) containing ...
[ "def", "dispatch_loader", "(", "scraper", ",", "loader_name", ")", ":", "l", "=", "'.'", ".", "join", "(", "[", "scraper", ",", "loader_name", "]", ")", "def", "wrapper", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapped", "(", "self...
Decorator that enforces one time loading for scrapers. The one time loading is applied to partial loaders, e.g. only parse and load the home team roster once. This is not meant to be used directly. :param scraper: property name (string) containing an object of type :py:class:`scrapr.ReportLoader` :...
[ "Decorator", "that", "enforces", "one", "time", "loading", "for", "scrapers", ".", "The", "one", "time", "loading", "is", "applied", "to", "partial", "loaders", "e", ".", "g", ".", "only", "parse", "and", "load", "the", "home", "team", "roster", "once", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/repscrwrap.py#L5-L28
train
robhowley/nhlscrapi
nhlscrapi/scrapr/toirep.py
TOIRepBase.parse_shifts
def parse_shifts(self): """ Parse shifts from TOI report :returns: self if successfule else None """ lx_doc = self.html_doc() pl_heads = lx_doc.xpath('//td[contains(@class, "playerHeading")]') for pl in pl_heads: sh_sum = { } ...
python
def parse_shifts(self): """ Parse shifts from TOI report :returns: self if successfule else None """ lx_doc = self.html_doc() pl_heads = lx_doc.xpath('//td[contains(@class, "playerHeading")]') for pl in pl_heads: sh_sum = { } ...
[ "def", "parse_shifts", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "pl_heads", "=", "lx_doc", ".", "xpath", "(", "'//td[contains(@class, \"playerHeading\")]'", ")", "for", "pl", "in", "pl_heads", ":", "sh_sum", "=", "{", "}", "...
Parse shifts from TOI report :returns: self if successfule else None
[ "Parse", "shifts", "from", "TOI", "report", ":", "returns", ":", "self", "if", "successfule", "else", "None" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/toirep.py#L130-L159
train
michaelherold/pyIsEmail
pyisemail/validators/dns_validator.py
DNSValidator.is_valid
def is_valid(self, domain, diagnose=False): """Check whether a domain has a valid MX or A record. Keyword arguments: domain --- the domain to check diagnose --- flag to report a diagnosis or a boolean (default False) """ return_status = [ValidDiagnosis()] dn...
python
def is_valid(self, domain, diagnose=False): """Check whether a domain has a valid MX or A record. Keyword arguments: domain --- the domain to check diagnose --- flag to report a diagnosis or a boolean (default False) """ return_status = [ValidDiagnosis()] dn...
[ "def", "is_valid", "(", "self", ",", "domain", ",", "diagnose", "=", "False", ")", ":", "return_status", "=", "[", "ValidDiagnosis", "(", ")", "]", "dns_checked", "=", "False", "# http://tools.ietf.org/html/rfc5321#section-2.3.5", "# Names that can be resolved to MX R...
Check whether a domain has a valid MX or A record. Keyword arguments: domain --- the domain to check diagnose --- flag to report a diagnosis or a boolean (default False)
[ "Check", "whether", "a", "domain", "has", "a", "valid", "MX", "or", "A", "record", "." ]
dd42d6425c59e5061fc214d42672210dccc64cf5
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/validators/dns_validator.py#L8-L111
train
robhowley/nhlscrapi
nhlscrapi/scrapr/reportloader.py
ReportLoader.html_doc
def html_doc(self): """ :returns: the lxml processed html document :rtype: ``lxml.html.document_fromstring`` output """ if self.__lx_doc is None: cn = NHLCn() if hasattr(cn, self.report_type): html = getattr(cn, self.rep...
python
def html_doc(self): """ :returns: the lxml processed html document :rtype: ``lxml.html.document_fromstring`` output """ if self.__lx_doc is None: cn = NHLCn() if hasattr(cn, self.report_type): html = getattr(cn, self.rep...
[ "def", "html_doc", "(", "self", ")", ":", "if", "self", ".", "__lx_doc", "is", "None", ":", "cn", "=", "NHLCn", "(", ")", "if", "hasattr", "(", "cn", ",", "self", ".", "report_type", ")", ":", "html", "=", "getattr", "(", "cn", ",", "self", ".", ...
:returns: the lxml processed html document :rtype: ``lxml.html.document_fromstring`` output
[ ":", "returns", ":", "the", "lxml", "processed", "html", "document", ":", "rtype", ":", "lxml", ".", "html", ".", "document_fromstring", "output" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/reportloader.py#L52-L71
train
robhowley/nhlscrapi
nhlscrapi/scrapr/reportloader.py
ReportLoader.parse_matchup
def parse_matchup(self): """ Parse the banner matchup meta info for the game. :returns: ``self`` on success or ``None`` """ lx_doc = self.html_doc() try: if not self.matchup: self.matchup = self._fill_meta(lx_doc) return se...
python
def parse_matchup(self): """ Parse the banner matchup meta info for the game. :returns: ``self`` on success or ``None`` """ lx_doc = self.html_doc() try: if not self.matchup: self.matchup = self._fill_meta(lx_doc) return se...
[ "def", "parse_matchup", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "try", ":", "if", "not", "self", ".", "matchup", ":", "self", ".", "matchup", "=", "self", ".", "_fill_meta", "(", "lx_doc", ")", "return", "self", "exce...
Parse the banner matchup meta info for the game. :returns: ``self`` on success or ``None``
[ "Parse", "the", "banner", "matchup", "meta", "info", "for", "the", "game", ".", ":", "returns", ":", "self", "on", "success", "or", "None" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/reportloader.py#L74-L86
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rtss.py
RTSS.parse_plays_stream
def parse_plays_stream(self): """Generate and yield a stream of parsed plays. Useful for per play processing.""" lx_doc = self.html_doc() if lx_doc is not None: parser = PlayParser(self.game_key.season, self.game_key.game_type) plays = lx_doc.xpath('//tr[@class =...
python
def parse_plays_stream(self): """Generate and yield a stream of parsed plays. Useful for per play processing.""" lx_doc = self.html_doc() if lx_doc is not None: parser = PlayParser(self.game_key.season, self.game_key.game_type) plays = lx_doc.xpath('//tr[@class =...
[ "def", "parse_plays_stream", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "if", "lx_doc", "is", "not", "None", ":", "parser", "=", "PlayParser", "(", "self", ".", "game_key", ".", "season", ",", "self", ".", "game_key", ".",...
Generate and yield a stream of parsed plays. Useful for per play processing.
[ "Generate", "and", "yield", "a", "stream", "of", "parsed", "plays", ".", "Useful", "for", "per", "play", "processing", "." ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L48-L59
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rtss.py
PlayParser.ColMap
def ColMap(season): """ Returns a dictionary mapping the type of information in the RTSS play row to the appropriate column number. The column locations pre/post 2008 are different. :param season: int for the season number :returns: mapping of RTSS column to info type ...
python
def ColMap(season): """ Returns a dictionary mapping the type of information in the RTSS play row to the appropriate column number. The column locations pre/post 2008 are different. :param season: int for the season number :returns: mapping of RTSS column to info type ...
[ "def", "ColMap", "(", "season", ")", ":", "if", "c", ".", "MIN_SEASON", "<=", "season", "<=", "c", ".", "MAX_SEASON", ":", "return", "{", "\"play_num\"", ":", "0", ",", "\"per\"", ":", "1", ",", "\"str\"", ":", "2", ",", "\"time\"", ":", "3", ",", ...
Returns a dictionary mapping the type of information in the RTSS play row to the appropriate column number. The column locations pre/post 2008 are different. :param season: int for the season number :returns: mapping of RTSS column to info type :rtype: dict, keys are ``'play_num...
[ "Returns", "a", "dictionary", "mapping", "the", "type", "of", "information", "in", "the", "RTSS", "play", "row", "to", "the", "appropriate", "column", "number", ".", "The", "column", "locations", "pre", "/", "post", "2008", "are", "different", ".", ":", "p...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L71-L92
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rtss.py
PlayParser.build_play
def build_play(self, pbp_row): """ Parses table row from RTSS. These are the rows tagged with ``<tr class='evenColor' ... >``. Result set contains :py:class:`nhlscrapi.games.playbyplay.Strength` and :py:class:`nhlscrapi.games.events.EventType` objects. Returned play data is in the form ...
python
def build_play(self, pbp_row): """ Parses table row from RTSS. These are the rows tagged with ``<tr class='evenColor' ... >``. Result set contains :py:class:`nhlscrapi.games.playbyplay.Strength` and :py:class:`nhlscrapi.games.events.EventType` objects. Returned play data is in the form ...
[ "def", "build_play", "(", "self", ",", "pbp_row", ")", ":", "d", "=", "pbp_row", ".", "findall", "(", "'./td'", ")", "c", "=", "PlayParser", ".", "ColMap", "(", "self", ".", "season", ")", "p", "=", "{", "}", "to_dig", "=", "lambda", "t", ":", "i...
Parses table row from RTSS. These are the rows tagged with ``<tr class='evenColor' ... >``. Result set contains :py:class:`nhlscrapi.games.playbyplay.Strength` and :py:class:`nhlscrapi.games.events.EventType` objects. Returned play data is in the form .. code:: python ...
[ "Parses", "table", "row", "from", "RTSS", ".", "These", "are", "the", "rows", "tagged", "with", "<tr", "class", "=", "evenColor", "...", ">", ".", "Result", "set", "contains", ":", "py", ":", "class", ":", "nhlscrapi", ".", "games", ".", "playbyplay", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L94-L145
train
robhowley/nhlscrapi
nhlscrapi/scrapr/rtss.py
PlayParser.__skaters
def __skaters(self, tab): """ Constructs dictionary of players on the ice in the provided table at time of play. :param tab: RTSS table of the skaters and goalie on at the time of the play :rtype: dictionary, key = player number, value = [position, name] """ res ...
python
def __skaters(self, tab): """ Constructs dictionary of players on the ice in the provided table at time of play. :param tab: RTSS table of the skaters and goalie on at the time of the play :rtype: dictionary, key = player number, value = [position, name] """ res ...
[ "def", "__skaters", "(", "self", ",", "tab", ")", ":", "res", "=", "{", "}", "for", "td", "in", "tab", ".", "iterchildren", "(", ")", ":", "if", "len", "(", "td", ")", ":", "pl_data", "=", "td", ".", "xpath", "(", "\"./table/tr\"", ")", "pl", "...
Constructs dictionary of players on the ice in the provided table at time of play. :param tab: RTSS table of the skaters and goalie on at the time of the play :rtype: dictionary, key = player number, value = [position, name]
[ "Constructs", "dictionary", "of", "players", "on", "the", "ice", "in", "the", "provided", "table", "at", "time", "of", "play", ".", ":", "param", "tab", ":", "RTSS", "table", "of", "the", "skaters", "and", "goalie", "on", "at", "the", "time", "of", "th...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L147-L166
train
robhowley/nhlscrapi
nhlscrapi/_tools.py
exclude_from
def exclude_from(l, containing = [], equal_to = []): """Exclude elements in list l containing any elements from list ex. Example: >>> l = ['bob', 'r', 'rob\r', '\r\nrobert'] >>> containing = ['\n', '\r'] >>> equal_to = ['r'] >>> exclude_from(l, containing, equal_to) ['bob...
python
def exclude_from(l, containing = [], equal_to = []): """Exclude elements in list l containing any elements from list ex. Example: >>> l = ['bob', 'r', 'rob\r', '\r\nrobert'] >>> containing = ['\n', '\r'] >>> equal_to = ['r'] >>> exclude_from(l, containing, equal_to) ['bob...
[ "def", "exclude_from", "(", "l", ",", "containing", "=", "[", "]", ",", "equal_to", "=", "[", "]", ")", ":", "cont", "=", "lambda", "li", ":", "any", "(", "c", "in", "li", "for", "c", "in", "containing", ")", "eq", "=", "lambda", "li", ":", "an...
Exclude elements in list l containing any elements from list ex. Example: >>> l = ['bob', 'r', 'rob\r', '\r\nrobert'] >>> containing = ['\n', '\r'] >>> equal_to = ['r'] >>> exclude_from(l, containing, equal_to) ['bob']
[ "Exclude", "elements", "in", "list", "l", "containing", "any", "elements", "from", "list", "ex", ".", "Example", ":", ">>>", "l", "=", "[", "bob", "r", "rob", "\\", "r", "\\", "r", "\\", "nrobert", "]", ">>>", "containing", "=", "[", "\\", "n", "\\...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/_tools.py#L23-L35
train
NeuroanatomyAndConnectivity/surfdist
nipype/surfdist_nipype.py
calc_surfdist
def calc_surfdist(surface, labels, annot, reg, origin, target): import nibabel as nib import numpy as np import os from surfdist import load, utils, surfdist import csv """ inputs: surface - surface file (e.g. lh.pial, with full path) labels - label file (e.g. lh.cortex.label, with full path) annot -...
python
def calc_surfdist(surface, labels, annot, reg, origin, target): import nibabel as nib import numpy as np import os from surfdist import load, utils, surfdist import csv """ inputs: surface - surface file (e.g. lh.pial, with full path) labels - label file (e.g. lh.cortex.label, with full path) annot -...
[ "def", "calc_surfdist", "(", "surface", ",", "labels", ",", "annot", ",", "reg", ",", "origin", ",", "target", ")", ":", "import", "nibabel", "as", "nib", "import", "numpy", "as", "np", "import", "os", "from", "surfdist", "import", "load", ",", "utils", ...
inputs: surface - surface file (e.g. lh.pial, with full path) labels - label file (e.g. lh.cortex.label, with full path) annot - annot file (e.g. lh.aparc.a2009s.annot, with full path) reg - registration file (lh.sphere.reg) origin - the label from which we calculate distances target - target surface (e.g. ...
[ "inputs", ":", "surface", "-", "surface", "file", "(", "e", ".", "g", ".", "lh", ".", "pial", "with", "full", "path", ")", "labels", "-", "label", "file", "(", "e", ".", "g", ".", "lh", ".", "cortex", ".", "label", "with", "full", "path", ")", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/nipype/surfdist_nipype.py#L20-L56
train
NeuroanatomyAndConnectivity/surfdist
nipype/surfdist_nipype.py
stack_files
def stack_files(files, hemi, source, target): """ This function takes a list of files as input and vstacks them """ import csv import os import numpy as np fname = "sdist_%s_%s_%s.csv" % (hemi, source, target) filename = os.path.join(os.getcwd(),fname) alldist = [] for dfile in files: alldist...
python
def stack_files(files, hemi, source, target): """ This function takes a list of files as input and vstacks them """ import csv import os import numpy as np fname = "sdist_%s_%s_%s.csv" % (hemi, source, target) filename = os.path.join(os.getcwd(),fname) alldist = [] for dfile in files: alldist...
[ "def", "stack_files", "(", "files", ",", "hemi", ",", "source", ",", "target", ")", ":", "import", "csv", "import", "os", "import", "numpy", "as", "np", "fname", "=", "\"sdist_%s_%s_%s.csv\"", "%", "(", "hemi", ",", "source", ",", "target", ")", "filenam...
This function takes a list of files as input and vstacks them
[ "This", "function", "takes", "a", "list", "of", "files", "as", "input", "and", "vstacks", "them" ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/nipype/surfdist_nipype.py#L58-L77
train
gcushen/mezzanine-api
mezzanine_api/serializers.py
PostOutputSerializer.get_short_url
def get_short_url(self, obj): """ Get short URL of blog post like '/blog/<slug>/' using ``get_absolute_url`` if available. Removes dependency on reverse URLs of Mezzanine views when deploying Mezzanine only as an API backend. """ try: url = obj.get_absolute_url() ...
python
def get_short_url(self, obj): """ Get short URL of blog post like '/blog/<slug>/' using ``get_absolute_url`` if available. Removes dependency on reverse URLs of Mezzanine views when deploying Mezzanine only as an API backend. """ try: url = obj.get_absolute_url() ...
[ "def", "get_short_url", "(", "self", ",", "obj", ")", ":", "try", ":", "url", "=", "obj", ".", "get_absolute_url", "(", ")", "except", "NoReverseMatch", ":", "url", "=", "'/blog/'", "+", "obj", ".", "slug", "return", "url" ]
Get short URL of blog post like '/blog/<slug>/' using ``get_absolute_url`` if available. Removes dependency on reverse URLs of Mezzanine views when deploying Mezzanine only as an API backend.
[ "Get", "short", "URL", "of", "blog", "post", "like", "/", "blog", "/", "<slug", ">", "/", "using", "get_absolute_url", "if", "available", ".", "Removes", "dependency", "on", "reverse", "URLs", "of", "Mezzanine", "views", "when", "deploying", "Mezzanine", "on...
8e9d519c0008f46019302fa3d4bf83c372d4ae21
https://github.com/gcushen/mezzanine-api/blob/8e9d519c0008f46019302fa3d4bf83c372d4ae21/mezzanine_api/serializers.py#L253-L262
train
robhowley/nhlscrapi
nhlscrapi/games/faceoffcomp.py
FaceOffComparison.head_to_head
def head_to_head(self, home_num, away_num): """ Return the head-to-head face-off outcomes between two players. If the matchup didn't happen, ``{ }`` is returned. :param home_num: the number of the home team player :param away_num: the number of the away team player ...
python
def head_to_head(self, home_num, away_num): """ Return the head-to-head face-off outcomes between two players. If the matchup didn't happen, ``{ }`` is returned. :param home_num: the number of the home team player :param away_num: the number of the away team player ...
[ "def", "head_to_head", "(", "self", ",", "home_num", ",", "away_num", ")", ":", "if", "home_num", "in", "self", ".", "home_fo", "and", "away_num", "in", "self", ".", "home_fo", "[", "home_num", "]", "[", "'opps'", "]", ":", "h_fo", "=", "self", ".", ...
Return the head-to-head face-off outcomes between two players. If the matchup didn't happen, ``{ }`` is returned. :param home_num: the number of the home team player :param away_num: the number of the away team player :returns: dict, either ``{ }`` or the following ...
[ "Return", "the", "head", "-", "to", "-", "head", "face", "-", "off", "outcomes", "between", "two", "players", ".", "If", "the", "matchup", "didn", "t", "happen", "{", "}", "is", "returned", ".", ":", "param", "home_num", ":", "the", "number", "of", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L47-L72
train
robhowley/nhlscrapi
nhlscrapi/games/faceoffcomp.py
FaceOffComparison.team_totals
def team_totals(self): """ Returns the overall faceoff win/total breakdown for home and away as :returns: dict, ``{ 'home/away': { 'won': won, 'total': total } }`` """ if self.__team_tots is None: self.__team_tots = self.__comp_tot() return {...
python
def team_totals(self): """ Returns the overall faceoff win/total breakdown for home and away as :returns: dict, ``{ 'home/away': { 'won': won, 'total': total } }`` """ if self.__team_tots is None: self.__team_tots = self.__comp_tot() return {...
[ "def", "team_totals", "(", "self", ")", ":", "if", "self", ".", "__team_tots", "is", "None", ":", "self", ".", "__team_tots", "=", "self", ".", "__comp_tot", "(", ")", "return", "{", "t", ":", "self", ".", "__team_tots", "[", "t", "]", "[", "'all'", ...
Returns the overall faceoff win/total breakdown for home and away as :returns: dict, ``{ 'home/away': { 'won': won, 'total': total } }``
[ "Returns", "the", "overall", "faceoff", "win", "/", "total", "breakdown", "for", "home", "and", "away", "as", ":", "returns", ":", "dict", "{", "home", "/", "away", ":", "{", "won", ":", "won", "total", ":", "total", "}", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L75-L87
train
robhowley/nhlscrapi
nhlscrapi/games/faceoffcomp.py
FaceOffComparison.by_zone
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 ...
python
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", ")", ":", "if", "self", ".", "__team_tots", "is", "None", ":", "self", ".", "__team_tots", "=", "self", ".", "__comp_tot", "(", ")", "return", "{", "t", ":", "{", "z", ":", "self", ".", "__team_tots", "[", "t", "]", ...
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", ":", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L90-L113
train
robhowley/nhlscrapi
nhlscrapi/games/faceoffcomp.py
FaceOffComparison.fo_pct
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'...
python
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", ")", ":", "tots", "=", "self", ".", "team_totals", "return", "{", "t", ":", "tots", "[", "t", "]", "[", "'won'", "]", "/", "(", "1.0", "*", "tots", "[", "t", "]", "[", "'total'", "]", ")", "if", "tots", "[", "t",...
Get the by team overall face-off win %. :returns: dict, ``{ 'home': %, 'away': % }``
[ "Get", "the", "by", "team", "overall", "face", "-", "off", "win", "%", ".", ":", "returns", ":", "dict", "{", "home", ":", "%", "away", ":", "%", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L116-L126
train
robhowley/nhlscrapi
nhlscrapi/games/faceoffcomp.py
FaceOffComparison.fo_pct_by_zone
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...
python
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", ")", ":", "bz", "=", "self", ".", "by_zone", "return", "{", "t", ":", "{", "z", ":", "bz", "[", "t", "]", "[", "z", "]", "[", "'won'", "]", "/", "(", "1.0", "*", "bz", "[", "t", "]", "[", "z", "]", "[...
Get the by team face-off win % by zone. Format is :returns: dict ``{ 'home/away': { 'off/def/neut': % } }``
[ "Get", "the", "by", "team", "face", "-", "off", "win", "%", "by", "zone", ".", "Format", "is", ":", "returns", ":", "dict", "{", "home", "/", "away", ":", "{", "off", "/", "def", "/", "neut", ":", "%", "}", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L129-L144
train
robhowley/nhlscrapi
nhlscrapi/games/cumstats.py
TeamIncrementor.update
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...
python
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", ")", ":", "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...
Update the accumulator with the current play :returns: new tally :rtype: dict, ``{ 'period': per, 'time': clock, 'team': cumul, 'play': play }``
[ "Update", "the", "accumulator", "with", "the", "current", "play", ":", "returns", ":", "new", "tally", ":", "rtype", ":", "dict", "{", "period", ":", "per", "time", ":", "clock", "team", ":", "cumul", "play", ":", "play", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/cumstats.py#L55-L93
train
robhowley/nhlscrapi
nhlscrapi/games/cumstats.py
Corsi.share
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() }
python
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", ")", ":", "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': % }``
[ "The", "Cori", "-", "share", "(", "%", "of", "shot", "attempts", ")", "for", "each", "team", ":", "returns", ":", "dict", "{", "home_name", ":", "%", "away_name", ":", "%", "}" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/cumstats.py#L171-L178
train
robhowley/nhlscrapi
nhlscrapi/games/playbyplay.py
PlayByPlay.compute_stats
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._...
python
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", ")", ":", "if", "not", "self", ".", "__have_stats", ":", "if", "self", ".", "init_cs_teams", "and", "self", ".", "cum_stats", ":", "self", ".", "__init_cs_teams", "(", ")", "for", "play", "in", "self", ".", "_rep_read...
Compute the stats defined in ``self.cum_stats``. :returns: collection of all computed :py:class:`.AccumulateStats` :rtype: dict
[ "Compute", "the", "stats", "defined", "in", "self", ".", "cum_stats", ".", ":", "returns", ":", "collection", "of", "all", "computed", ":", "py", ":", "class", ":", ".", "AccumulateStats", ":", "rtype", ":", "dict" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/playbyplay.py#L84-L102
train
robhowley/nhlscrapi
nhlscrapi/scrapr/nhlreq.py
NHLCn.__html_rep
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" ] ...
python
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", ")", ":", "seas", ",", "gt", ",", "num", "=", "game_key", ".", "to_tuple", "(", ")", "url", "=", "[", "self", ".", "__domain", ",", "\"scores/htmlreports/\"", ",", "str", "(", "seas", ...
Retrieves the nhl html reports for the specified game and report code
[ "Retrieves", "the", "nhl", "html", "reports", "for", "the", "specified", "game", "and", "report", "code" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/nhlreq.py#L17-L24
train
michaelherold/pyIsEmail
pyisemail/validators/parser_validator.py
to_char
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...
python
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", ")", ":", "if", "ord", "(", "token", ")", "in", "_range", "(", "9216", ",", "9229", "+", "1", ")", ":", "token", "=", "_unichr", "(", "ord", "(", "token", ")", "-", "9216", ")", "return", "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
[ "Transforms", "the", "ASCII", "control", "character", "symbols", "to", "their", "real", "char", "." ]
dd42d6425c59e5061fc214d42672210dccc64cf5
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/validators/parser_validator.py#L48-L61
train
michaelherold/pyIsEmail
pyisemail/validators/parser_validator.py
ParserValidator.is_email
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...
python
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", ")", ":", "threshold", "=", "BaseDiagnosis", ".", "CATEGORIES", "[", "'VALID'", "]", "return_status", "=", "[", "ValidDiagnosis", "(", ")", "]", "parse_data", "=", "{", "}", "...
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...
[ "Check", "that", "an", "address", "address", "conforms", "to", "RFCs", "5321", "5322", "and", "others", "." ]
dd42d6425c59e5061fc214d42672210dccc64cf5
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/validators/parser_validator.py#L65-L1127
train
NeuroanatomyAndConnectivity/surfdist
surfdist/load.py
load_freesurfer_label
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...
python
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", ")", ":", "if", "cortex", "is", "not", "None", ":", "print", "(", "\"Warning: cortex is not used to load the freesurfer label\"", ")", "labels", ",", "color_table", ",...
Get source node list for a specified freesurfer label. Inputs ------- annot_input : freesurfer annotation label file label_name : freesurfer label name cortex : not used
[ "Get", "source", "node", "list", "for", "a", "specified", "freesurfer", "label", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/load.py#L5-L24
train
NeuroanatomyAndConnectivity/surfdist
surfdist/load.py
get_freesurfer_label
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
python
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", ")", ":", "labels", ",", "color_table", ",", "names", "=", "nib", ".", "freesurfer", ".", "read_annot", "(", "annot_input", ")", "if", "verbose", ":", "print", "(", "names", ")...
Print freesurfer label names.
[ "Print", "freesurfer", "label", "names", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/load.py#L27-L34
train
NeuroanatomyAndConnectivity/surfdist
surfdist/viz.py
viz
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 ...
python
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", ",", "b...
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...
[ "Visualize", "results", "on", "cortical", "surface", "using", "matplotlib", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/viz.py#L1-L128
train
NeuroanatomyAndConnectivity/surfdist
surfdist/utils.py
surf_keep_cortex
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...
python
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", ")", ":", "# split surface into vertices and triangles", "vertices", ",", "triangles", "=", "surf", "# keep only the vertices within the cortex label", "cortex_vertices", "=", "np", ".", "array", "(", "vertices", "[",...
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...
[ "Remove", "medial", "wall", "from", "cortical", "surface", "to", "ensure", "that", "shortest", "paths", "are", "only", "calculated", "through", "the", "cortex", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L5-L28
train
NeuroanatomyAndConnectivity/surfdist
surfdist/utils.py
triangles_keep_cortex
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...
python
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", ")", ":", "# 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", "(", ...
Remove triangles with nodes not contained in the cortex label array
[ "Remove", "triangles", "with", "nodes", "not", "contained", "in", "the", "cortex", "label", "array" ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L31-L46
train
NeuroanatomyAndConnectivity/surfdist
surfdist/utils.py
translate_src
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
python
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", ")", ":", "src_new", "=", "np", ".", "array", "(", "np", ".", "where", "(", "np", ".", "in1d", "(", "cortex", ",", "src", ")", ")", "[", "0", "]", ",", "dtype", "=", "np", ".", "int32", ")", ...
Convert source nodes to new surface (without medial wall).
[ "Convert", "source", "nodes", "to", "new", "surface", "(", "without", "medial", "wall", ")", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L49-L55
train
NeuroanatomyAndConnectivity/surfdist
surfdist/utils.py
recort
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
python
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", ")", ":", "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.
[ "Return", "data", "values", "to", "space", "of", "full", "cortex", "(", "including", "medial", "wall", ")", "with", "medial", "wall", "equal", "to", "zero", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L57-L63
train
NeuroanatomyAndConnectivity/surfdist
surfdist/utils.py
find_node_match
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...
python
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", ")", ":", "import", "scipy", ".", "spatial", "# make array for writing in final voronoi seed indices", "voronoi_seed_idx", "=", "np", ".", "zeros", "(", "(", "simple_vertices", ".", "shape", "[",...
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.
[ "Thanks", "to", "juhuntenburg", ".", "Functions", "taken", "from", "https", ":", "//", "github", ".", "com", "/", "juhuntenburg", "/", "brainsurfacescripts" ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/utils.py#L66-L119
train
robhowley/nhlscrapi
nhlscrapi/scrapr/eventsummrep.py
EventSummRep.parse
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() \ ...
python
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", ")", ":", "try", ":", "return", "super", "(", "EventSummRep", ",", "self", ")", ".", "parse", "(", ")", ".", "parse_away_shots", "(", ")", ".", "parse_home_shots", "(", ")", ".", "parse_away_fo", "(", ")", ".", "parse_home_...
Retreive and parse Event Summary report for the given :py:class:`nhlscrapi.games.game.GameKey` :returns: ``self`` on success, ``None`` otherwise
[ "Retreive", "and", "parse", "Event", "Summary", "report", "for", "the", "given", ":", "py", ":", "class", ":", "nhlscrapi", ".", "games", ".", "game", ".", "GameKey", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L86-L101
train
robhowley/nhlscrapi
nhlscrapi/scrapr/eventsummrep.py
EventSummRep.parse_home_shots
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...
python
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", ")", ":", "try", ":", "self", ".", "__set_shot_tables", "(", ")", "self", ".", "shots", "[", "'home'", "]", "=", "self", ".", "__parse_shot_tables", "(", "self", ".", "__home_top", ",", "self", ".", "__home_bot", "...
Parse shot info for home team. :returns: ``self`` on success, ``None`` otherwise
[ "Parse", "shot", "info", "for", "home", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L149-L163
train
robhowley/nhlscrapi
nhlscrapi/scrapr/eventsummrep.py
EventSummRep.parse_away_shots
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._...
python
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", ")", ":", "try", ":", "self", ".", "__set_shot_tables", "(", ")", "self", ".", "shots", "[", "'away'", "]", "=", "self", ".", "__parse_shot_tables", "(", "self", ".", "__aw_top", ",", "self", ".", "__aw_bot", ")", ...
Parse shot info for away team. :returns: ``self`` on success, ``None`` otherwise
[ "Parse", "shot", "info", "for", "away", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L165-L179
train
robhowley/nhlscrapi
nhlscrapi/scrapr/eventsummrep.py
EventSummRep.parse_home_fo
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...
python
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", ")", ":", "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
[ "Parse", "face", "-", "off", "info", "for", "home", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L181-L192
train
robhowley/nhlscrapi
nhlscrapi/scrapr/eventsummrep.py
EventSummRep.parse_away_fo
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...
python
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", ")", ":", "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
[ "Parse", "face", "-", "off", "info", "for", "away", "team", ".", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/eventsummrep.py#L194-L205
train
NeuroanatomyAndConnectivity/surfdist
surfdist/surfdist.py
dist_calc
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". ...
python
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", ")", ":", "cortex_vertices", ",", "cortex_triangles", "=", "surf_keep_cortex", "(", "surf", ",", "cortex", ")", "translated_source_nodes", "=", "translate_src", "(", "source_nodes", ",", "cortex"...
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", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/surfdist.py#L6-L20
train
NeuroanatomyAndConnectivity/surfdist
surfdist/surfdist.py
zone_calc
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...
python
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", ")", ":", "cortex_vertices", ",", "cortex_triangles", "=", "surf_keep_cortex", "(", "surf", ",", "cortex", ")", "dist_vals", "=", "np", ".", "zeros", "(", "(", "len", "(", "source_nodes", ")", "...
Calculate closest nodes to each source node using exact geodesic distance along the cortical surface.
[ "Calculate", "closest", "nodes", "to", "each", "source", "node", "using", "exact", "geodesic", "distance", "along", "the", "cortical", "surface", "." ]
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/surfdist.py#L23-L43
train
NeuroanatomyAndConnectivity/surfdist
surfdist/surfdist.py
dist_calc_matrix
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...
python
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", ")", ":", "cortex_vertices", ",", "cortex_triangles", "=", "surf_keep_cortex", "(", "surf", ...
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...
[ "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", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/surfdist/surfdist.py#L46-L85
train
robhowley/nhlscrapi
nhlscrapi/scrapr/faceoffrep.py
FaceOffRep.parse
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() ...
python
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", ")", ":", "try", ":", "return", "(", "super", "(", "FaceOffRep", ",", "self", ")", ".", "parse", "(", ")", "and", "self", ".", "parse_home_face_offs", "(", ")", "and", "self", ".", "parse_away_face_offs", "(", ")", ")", "...
Retreive and parse Play by Play data for the given nhlscrapi.GameKey :returns: ``self`` on success, ``None`` otherwise
[ "Retreive", "and", "parse", "Play", "by", "Play", "data", "for", "the", "given", "nhlscrapi", ".", "GameKey", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/faceoffrep.py#L53-L66
train
robhowley/nhlscrapi
nhlscrapi/scrapr/faceoffrep.py
FaceOffRep.parse_home_face_offs
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
python
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", ")", ":", "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
[ "Parse", "only", "the", "home", "faceoffs", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/faceoffrep.py#L68-L76
train
robhowley/nhlscrapi
nhlscrapi/scrapr/faceoffrep.py
FaceOffRep.parse_away_face_offs
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
python
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", ")", ":", "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
[ "Parse", "only", "the", "away", "faceoffs", ":", "returns", ":", "self", "on", "success", "None", "otherwise" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/faceoffrep.py#L78-L86
train
linkedin/Zopkio
zopkio/utils.py
load_module
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])
python
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", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "path", "=", "os", ".", "path", ".", "dirname", "(", "filename", ")", "sys", ".", "path", ".", "append", "(", "path", ")", "...
Loads a module by filename
[ "Loads", "a", "module", "by", "filename" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L58-L66
train
linkedin/Zopkio
zopkio/utils.py
make_machine_mapping
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...
python
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", ")", ":", "if", "machine_list", "is", "None", ":", "return", "{", "}", "else", ":", "mapping", "=", "{", "}", "for", "pair", "in", "machine_list", ":", "if", "(", "constants", ".", "MACHINE_SEPARATOR", "n...
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
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L79-L95
train
linkedin/Zopkio
zopkio/utils.py
parse_config_list
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...
python
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", ")", ":", "if", "config_list", "is", "None", ":", "return", "{", "}", "else", ":", "mapping", "=", "{", "}", "for", "pair", "in", "config_list", ":", "if", "(", "constants", ".", "CONFIG_SEPARATOR", "not", ...
Parse a list of configuration properties separated by '='
[ "Parse", "a", "list", "of", "configuration", "properties", "separated", "by", "=" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L98-L111
train
linkedin/Zopkio
zopkio/utils.py
parse_config_file
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...
python
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", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "config_file_path", ")", "[", "1", "]", "if", "extension", "==", "'.pyc'", ":", "raise", "ValueError", "(", "\"Skipping .pyc file as config\...
Parse a configuration file. Currently only supports .json, .py and properties separated by '=' :param config_file_path: :return: a dict of the configuration properties
[ "Parse", "a", "configuration", "file", ".", "Currently", "only", "supports", ".", "json", ".", "py", "and", "properties", "separated", "by", "=", ":", "param", "config_file_path", ":", ":", "return", ":", "a", "dict", "of", "the", "configuration", "propertie...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L114-L143
train
linkedin/Zopkio
zopkio/remote_host_helper.py
exec_with_env
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...
python
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", ")", ":", "bash_profile_command", "=", "\"source .bash_profile > /dev/null 2> /dev/null;\"", "env_command", "=", "build_os_environment_st...
:param ssh: :param command: :param msg: :param env: :param synch: :return:
[ ":", "param", "ssh", ":", ":", "param", "command", ":", ":", "param", "msg", ":", ":", "param", "env", ":", ":", "param", "synch", ":", ":", "return", ":" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L72-L88
train
linkedin/Zopkio
zopkio/remote_host_helper.py
better_exec_command
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...
python
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", ")", ":", "chan", "=", "ssh", ".", "get_transport", "(", ")", ".", "open_session", "(", ")", "chan", ".", "exec_command", "(", "command", ")", "exit_status", "=", "chan", ".", "recv_ex...
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 ...
[ "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", "...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L90-L116
train
linkedin/Zopkio
zopkio/remote_host_helper.py
log_output
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) ...
python
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", ")", ":", "if", "hasattr", "(", "chan", ",", "\"recv\"", ")", ":", "str", "=", "chan", ".", "recv", "(", "1024", ")", "msgs", "=", "[", "]", "while", "len", "(", "str", ")", ">", "0", ":", "msgs", ".", "append"...
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:
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L118-L134
train
linkedin/Zopkio
zopkio/remote_host_helper.py
copy_dir
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...
python
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", "=", "''", ")", ":", "try", ":", "mode", "=", "ftp", ".", "stat", "(", "filename", ")", ".", "st_mode", "except", "IOError", ",", "e", ":", "if", "e", ...
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:
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L137-L162
train
linkedin/Zopkio
zopkio/remote_host_helper.py
open_remote_file
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...
python
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", ")", ":", "with", "get_ssh_client", "(", "hostname", ",", "username", "=", ...
:param hostname: :param filename: :return:
[ ":", "param", "hostname", ":", ":", "param", "filename", ":", ":", "return", ":" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/remote_host_helper.py#L166-L184
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.deploy
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...
python
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", ")", ":", "self", ".", "install", "(", "unique_id", ",", "configs", ")", "self", ".", "start", "(", "unique_id", ",", "configs", ")" ]
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
[ "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", "." ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L81-L89
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.undeploy
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...
python
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", ")", ":", "self", ".", "stop", "(", "unique_id", ",", "configs", ")", "self", ".", "uninstall", "(", "unique_id", ",", "configs", ")" ]
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
[ "Undeploys", "the", "service", ".", "This", "should", "at", "least", "perform", "the", "same", "actions", "as", "stop", "and", "uninstall", "but", "may", "perform", "additional", "tasks", "as", "needed", "." ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L91-L99
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.soft_bounce
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)
python
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", ")", ":", "self", ".", "stop", "(", "unique_id", ",", "configs", ")", "self", ".", "start", "(", "unique_id", ",", "configs", ")" ]
Performs a soft bounce (stop and start) for the specified process :Parameter unique_id: the name of the process
[ "Performs", "a", "soft", "bounce", "(", "stop", "and", "start", ")", "for", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L148-L154
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.hard_bounce
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)
python
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", ")", ":", "self", ".", "kill", "(", "unique_id", ",", "configs", ")", "self", ".", "start", "(", "unique_id", ",", "configs", ")" ]
Performs a hard bounce (kill and start) for the specified process :Parameter unique_id: the name of the process
[ "Performs", "a", "hard", "bounce", "(", "kill", "and", "start", ")", "for", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L156-L162
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.sleep
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)
python
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", ")", ":", "self", ".", "pause", "(", "unique_id", ",", "configs", ")", "time", ".", "sleep", "(", "delay", ")", "self", ".", "resume", "(", "unique_id", ",", ...
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
[ "Pauses", "the", "process", "for", "the", "specified", "delay", "and", "then", "resumes", "it" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L164-L172
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.pause
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...
python
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", ")", ":", "pids", "=", "self", ".", "get_pid", "(", "unique_id", ",", "configs", ")", "if", "pids", "!=", "constants", ".", "PROCESS_NOT_RUNNING_PID", ":", "pid_str", "=", "' '",...
Issues a sigstop for the specified process :Parameter unique_id: the name of the process
[ "Issues", "a", "sigstop", "for", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L174-L184
train
linkedin/Zopkio
zopkio/deployer.py
Deployer._send_signal
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...
python
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", ")", ":", "pids", "=", "self", ".", "get_pid", "(", "unique_id", ",", "configs", ")", "if", "pids", "!=", "constants", ".", "PROCESS_NOT_RUNNING_PID", ":", "pid_str", "=...
Issues a signal for the specified process :Parameter unique_id: the name of the process
[ "Issues", "a", "signal", "for", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L186-L197
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.resume
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)
python
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", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGCONT", ",", "configs", ")" ]
Issues a sigcont for the specified process :Parameter unique_id: the name of the process
[ "Issues", "a", "sigcont", "for", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L200-L205
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.kill
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...
python
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", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGKILL", ",", "configs", ")" ]
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...
[ "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"...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L207-L215
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.terminate
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)
python
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", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGTERM", ",", "configs", ")" ]
Issues a kill -15 to the specified process :Parameter unique_id: the name of the process
[ "Issues", "a", "kill", "-", "15", "to", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L217-L222
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.hangup
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)
python
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", ")", ":", "self", ".", "_send_signal", "(", "unique_id", ",", "signal", ".", "SIGHUP", ",", "configs", ")" ]
Issue a signal to hangup the specified process :Parameter unique_id: the name of the process
[ "Issue", "a", "signal", "to", "hangup", "the", "specified", "process" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L224-L230
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.get_logs
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)
python
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", ")", ":", "self", ".", "fetch_logs", "(", "unique_id", ",", "logs", ",", "directory", ",", "pattern", ")" ]
deprecated name for fetch_logs
[ "deprecated", "name", "for", "fetch_logs" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L232-L234
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.fetch_logs
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 ...
python
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", ")", ":", "hostname", "=", "self", ".", "processes", "[", "unique_id", "]", ".", "hostname", "install_path", "...
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...
[ "Copies", "logs", "from", "the", "remote", "host", "that", "the", "process", "is", "running", "on", "to", "the", "provided", "directory" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L236-L246
train
linkedin/Zopkio
zopkio/deployer.py
Deployer.fetch_logs_from_host
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...
python
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", ")", ":", "if", "hostname", "is", "not", "None", ":", "with", "get_sftp_client", "(", "hostname", ",", "username", "=", "runtim...
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...
[ "Static", "method", "Copies", "logs", "from", "specified", "host", "on", "the", "specified", "install", "path" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/deployer.py#L249-L271
train
linkedin/Zopkio
zopkio/junit_reporter.py
Reporter.generate
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) ...
python
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", ")", ":", "self", ".", "_setup", "(", ")", "for", "config_name", "in", "self", ".", "report_info", ".", "config_to_test_names_map", ".", "keys", "(", ")", ":", "config_dir", "=", "os", ".", "path", ".", "join", "(", "sel...
Generates the report
[ "Generates", "the", "report" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/junit_reporter.py#L81-L91
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.install
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...
python
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", ")", ":", "# 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...
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...
[ "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", "...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L78-L197
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.start
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 ...
python
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", ")", ":", "# 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...
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) ...
[ "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"...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L199-L262
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.stop
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...
python
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", ")", ":", "# 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...
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...
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L264-L306
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.uninstall
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 ...
python
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", ")", ":", "# 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...
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...
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L308-L340
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.get_pid
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...
python
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", ")", ":", "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...
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
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L342-L394
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.get_host
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 """ ...
python
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", ")", ":", "if", "unique_id", "in", "self", ".", "processes", ":", "return", "self", ".", "processes", "[", "unique_id", "]", ".", "hostname", "logger", ".", "error", "(", "\"{0} not a known 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 :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" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L396-L406
train
linkedin/Zopkio
zopkio/adhoc_deployer.py
SSHDeployer.kill_all_process
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)):...
python
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", ")", ":", "if", "(", "runtime", ".", "get_active_config", "(", "\"cleanup_pending_process\"", ",", "False", ")", ")", ":", "for", "process", "in", "self", ".", "get_processes", "(", ")", ":", "self", ".", "terminate", ...
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
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/adhoc_deployer.py#L415-L423
train
linkedin/Zopkio
zopkio/__main__.py
string_to_level
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...
python
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", ")", ":", "if", "(", "log_level", ".", "strip", "(", ")", ".", "upper", "(", ")", "==", "\"DEBUG\"", ")", ":", "return", "logging", ".", "DEBUG", "if", "(", "log_level", ".", "strip", "(", ")", ".", "upper"...
Converts a string to the corresponding log level
[ "Converts", "a", "string", "to", "the", "corresponding", "log", "level" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/__main__.py#L54-L65
train
linkedin/Zopkio
zopkio/__main__.py
main
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='*', ...
python
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", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'A distributed test framework'", ")", "parser", ".", "add_argument", "(", "'testfile'", ",", "help", "=", "'The file that is used to determine the test suite run'",...
Parse command line arguments and then run the test suite
[ "Parse", "command", "line", "arguments", "and", "then", "run", "the", "test", "suite" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/__main__.py#L67-L105
train
linkedin/Zopkio
zopkio/runtime.py
reset_all
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...
python
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", "(", ")", ":", "global", "_username", "global", "_password", "global", "_active_config", "global", "_active_tests", "global", "_machine_names", "global", "_deployers", "reset_deployers", "(", ")", "reset_collector", "(", ")", "_username", "=", "N...
Clear relevant globals to start fresh :return:
[ "Clear", "relevant", "globals", "to", "start", "fresh", ":", "return", ":" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/runtime.py#L163-L180
train
linkedin/Zopkio
zopkio/runtime.py
get_active_config
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 ...
python
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", ")", ":", "return", "_active_config", ".", "mapping", "[", "config_option", "]", "if", "default", "is", "None", "else", "_active_config", ".", "mapping", ".", "get", "(", "config_op...
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...
[ "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...
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/runtime.py#L196-L204
train
linkedin/Zopkio
zopkio/html_reporter.py
Reporter.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_...
python
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", ")", ":", "self", ".", "_setup", "(", ")", "header_html", "=", "self", ".", "_generate_header", "(", ")", "footer_html", "=", "self", ".", "_generate_footer", "(", ")", "results_topbar_html", "=", "self", ".", "_generate_topba...
Generates the report
[ "Generates", "the", "report" ]
a06e35a884cd26eedca0aac8ba6b9b40c417a01c
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/html_reporter.py#L85-L122
train
dmwm/DBS
Server/Python/src/dbs/dao/Oracle/Dataset/UpdateType.py
UpdateType.execute
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...
python
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", ")", ":", "if", "not", "conn", ":", "dbsExceptionHandler", "(", "\"dbsException-failed-connect2host\"", ",", "\"Oracle/Dataset/UpdateType. Expect...
for a given file
[ "for", "a", "given", "file" ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/Dataset/UpdateType.py#L26-L33
train
dmwm/DBS
Server/Python/src/dbs/utils/DBSInputValidation.py
inputChecks
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...
python
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_", ")", ":", "def", "checkTypes", "(", "_func_", ",", "_params_", "=", "_params_", ")", ":", "log", "=", "clog", ".", "error_log", "@", "wraps", "(", "_func_", ")", "def", "wrapped", "(", "*", "args", ","...
This is a function to check all the input for GET APIs.
[ "This", "is", "a", "function", "to", "check", "all", "the", "input", "for", "GET", "APIs", "." ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/DBSInputValidation.py#L31-L155
train
dmwm/DBS
Server/Python/src/dbs/utils/DBSInputValidation.py
validateStringInput
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...
python
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", ")", ":", "log", "=", "clog", ".", "error_log", "func", "=", "None", "if", "'*'", "in", "input_data", "or", "'%'", "in", "input_data", ":", "func", "=", "valida...
To check if a string has the required format. This is only used for POST APIs.
[ "To", "check", "if", "a", "string", "has", "the", "required", "format", ".", "This", "is", "only", "used", "for", "POST", "APIs", "." ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/DBSInputValidation.py#L305-L339
train
dmwm/DBS
Server/Python/src/dbs/dao/Oracle/Service/List.py
List.execute
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: ...
python
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", ")", ":", "sql", "=", "self", ".", "sql", "binds", "=", "{", "}", "cursors", "=", "self", ".", "dbi", ".", "processData", "(", "sql", ",", "binds", ",", "conn", ",", "t...
Lists all primary datasets if pattern is not provided.
[ "Lists", "all", "primary", "datasets", "if", "pattern", "is", "not", "provided", "." ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/Service/List.py#L26-L37
train
dmwm/DBS
Server/Python/src/dbs/dao/Oracle/MigrationRequests/Remove.py
Remove.execute
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...
python
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", ")", ":", "if", "not", "conn", ":", "dbsExceptionHandler", "(", "\"dbsException-failed-connect2host\"", ",", "\"Oracle/MigrationRequests/Remove. Expects db connection from upper...
daoinput keys: migration_request_id
[ "daoinput", "keys", ":", "migration_request_id" ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/MigrationRequests/Remove.py#L34-L53
train
dmwm/DBS
Server/Python/src/dbs/utils/dbsUtils.py
jsonstreamer
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 ...
python
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", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "gen", "=", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", "yield", "\"[\"", "firstItem", "=", "...
JSON streamer decorator
[ "JSON", "streamer", "decorator" ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/dbsUtils.py#L69-L82
train
dmwm/DBS
Server/Python/src/dbs/utils/dbsUtils.py
dbsUtils.decodeLumiIntervals
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): ...
python
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", ")", ":", "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", "...
lumi_list must be of one of the two following formats: '[[a,b], [c,d],' or [a1, a2, a3]
[ "lumi_list", "must", "be", "of", "one", "of", "the", "two", "following", "formats", ":", "[[", "a", "b", "]", "[", "c", "d", "]", "or", "[", "a1", "a2", "a3", "]" ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/dbsUtils.py#L36-L67
train
dmwm/DBS
Server/Python/src/dbs/business/DBSDatasetAccessType.py
DBSDatasetAccessType.listDatasetAccessTypes
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...
python
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", "=", "\"\"", ")", ":", "if", "isinstance", "(", "dataset_access_type", ",", "basestring", ")", ":", "try", ":", "dataset_access_type", "=", "str", "(", "dataset_access_type", ")", "except", ...
List dataset access types
[ "List", "dataset", "access", "types" ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSDatasetAccessType.py#L24-L48
train
closeio/flask-ipblock
flask_ipblock/__init__.py
IPBlock.block_before
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...
python
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", ")", ":", "# To avoid unnecessary database queries, ignore the IP check for", "# requests for static files", "if", "request", ".", "path", ".", "startswith", "(", "url_for", "(", "'static'", ",", "filename", "=", "''", ")", ")", ":"...
Check the current request and block it if the IP address it's coming from is blacklisted.
[ "Check", "the", "current", "request", "and", "block", "it", "if", "the", "IP", "address", "it", "s", "coming", "from", "is", "blacklisted", "." ]
d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f
https://github.com/closeio/flask-ipblock/blob/d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f/flask_ipblock/__init__.py#L43-L75
train
closeio/flask-ipblock
flask_ipblock/__init__.py
IPBlock.matches_ip
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...
python
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", ")", ":", "# Check the cache if caching is enabled", "if", "self", ".", "cache", "is", "not", "None", ":", "matches_ip", "=", "self", ".", "cache", ".", "get", "(", "ip", ")", "if", "matches_ip", "is", "not", ...
Return True if the given IP is blacklisted, False otherwise.
[ "Return", "True", "if", "the", "given", "IP", "is", "blacklisted", "False", "otherwise", "." ]
d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f
https://github.com/closeio/flask-ipblock/blob/d4d6d50e4a7d1ba7aa0f8d7298ee8d63d25b644f/flask_ipblock/__init__.py#L77-L94
train
dmwm/DBS
Server/Python/src/dbs/dao/Oracle/FileParent/ListChild.py
ListChild.execute
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...
python
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", ")", ":", "binds", "=", "{", "}", "sql", "=", "''", "if", "logical_file_name", ":", "if", "isinstance", "(", "logi...
Lists all primary datasets if pattern is not provided.
[ "Lists", "all", "primary", "datasets", "if", "pattern", "is", "not", "provided", "." ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/FileParent/ListChild.py#L30-L63
train
dmwm/DBS
Server/Python/src/dbs/business/DBSAcquisitionEra.py
DBSAcquisitionEra.listAcquisitionEras
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() ...
python
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", "=", "''", ")", ":", "try", ":", "acq", "=", "str", "(", "acq", ")", "except", ":", "dbsExceptionHandler", "(", "'dbsException-invalid-input'", ",", "'acquistion_era_name given is not valid : %s'", "%", "acq",...
Returns all acquistion eras in dbs
[ "Returns", "all", "acquistion", "eras", "in", "dbs" ]
9619bafce3783b3e77f0415f8f9a258e33dd1e6f
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSAcquisitionEra.py#L27-L40
train