id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
38,500
steinitzu/giveme
giveme/injector.py
Injector.inject
def inject(self, function=None, **names): """ Inject dependencies into `funtion`'s arguments when called. >>> @injector.inject ... def use_dependency(dependency_name): ... >>> use_dependency() The `Injector` will look for registered dependencies ...
python
def inject(self, function=None, **names): """ Inject dependencies into `funtion`'s arguments when called. >>> @injector.inject ... def use_dependency(dependency_name): ... >>> use_dependency() The `Injector` will look for registered dependencies ...
[ "def", "inject", "(", "self", ",", "function", "=", "None", ",", "*", "*", "names", ")", ":", "def", "decorator", "(", "function", ")", ":", "@", "wraps", "(", "function", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":"...
Inject dependencies into `funtion`'s arguments when called. >>> @injector.inject ... def use_dependency(dependency_name): ... >>> use_dependency() The `Injector` will look for registered dependencies matching named arguments and automatically pass them t...
[ "Inject", "dependencies", "into", "funtion", "s", "arguments", "when", "called", "." ]
b250995c59eb7e141d2cd8260e292c417785bbd1
https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/injector.py#L148-L198
38,501
steinitzu/giveme
giveme/injector.py
Injector.resolve
def resolve(self, dependency): """ Resolve dependency as instance attribute of given class. >>> class Users: ... db = injector.resolve(user_db) ... ... def get_by_id(self, user_id): ... return self.db.get(user_id) ...
python
def resolve(self, dependency): """ Resolve dependency as instance attribute of given class. >>> class Users: ... db = injector.resolve(user_db) ... ... def get_by_id(self, user_id): ... return self.db.get(user_id) ...
[ "def", "resolve", "(", "self", ",", "dependency", ")", ":", "if", "isinstance", "(", "dependency", ",", "str", ")", ":", "name", "=", "dependency", "else", ":", "name", "=", "dependency", ".", "_giveme_registered_name", "return", "DeferredProperty", "(", "pa...
Resolve dependency as instance attribute of given class. >>> class Users: ... db = injector.resolve(user_db) ... ... def get_by_id(self, user_id): ... return self.db.get(user_id) When the attribute is first accessed, it ...
[ "Resolve", "dependency", "as", "instance", "attribute", "of", "given", "class", "." ]
b250995c59eb7e141d2cd8260e292c417785bbd1
https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/injector.py#L200-L223
38,502
jplusplus/statscraper
statscraper/scrapers/SMHIScraper.py
SMHI._fetch_itemslist
def _fetch_itemslist(self, current_item): """ Get a all available apis """ if current_item.is_root: html = requests.get(self.base_url).text soup = BeautifulSoup(html, 'html.parser') for item_html in soup.select(".row .col-md-6"): try: ...
python
def _fetch_itemslist(self, current_item): """ Get a all available apis """ if current_item.is_root: html = requests.get(self.base_url).text soup = BeautifulSoup(html, 'html.parser') for item_html in soup.select(".row .col-md-6"): try: ...
[ "def", "_fetch_itemslist", "(", "self", ",", "current_item", ")", ":", "if", "current_item", ".", "is_root", ":", "html", "=", "requests", ".", "get", "(", "self", ".", "base_url", ")", ".", "text", "soup", "=", "BeautifulSoup", "(", "html", ",", "'html....
Get a all available apis
[ "Get", "a", "all", "available", "apis" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/SMHIScraper.py#L27-L44
38,503
jplusplus/statscraper
statscraper/scrapers/SMHIScraper.py
SMHI._fetch_data
def _fetch_data(self, dataset, query={}, include_inactive_stations=False): """ Should yield dataset rows """ data = [] parameter = dataset station_dim = dataset.dimensions["station"] all_stations = station_dim.allowed_values # Step 1: Prepare query if "sta...
python
def _fetch_data(self, dataset, query={}, include_inactive_stations=False): """ Should yield dataset rows """ data = [] parameter = dataset station_dim = dataset.dimensions["station"] all_stations = station_dim.allowed_values # Step 1: Prepare query if "sta...
[ "def", "_fetch_data", "(", "self", ",", "dataset", ",", "query", "=", "{", "}", ",", "include_inactive_stations", "=", "False", ")", ":", "data", "=", "[", "]", "parameter", "=", "dataset", "station_dim", "=", "dataset", ".", "dimensions", "[", "\"station\...
Should yield dataset rows
[ "Should", "yield", "dataset", "rows" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/SMHIScraper.py#L70-L140
38,504
jplusplus/statscraper
statscraper/scrapers/SMHIScraper.py
SMHIDataset._get_example_csv
def _get_example_csv(self): """For dimension parsing """ station_key = self.json["station"][0]["key"] period = "corrected-archive" url = self.url\ .replace(".json", "/station/{}/period/{}/data.csv"\ .format(station_key, period)) r = re...
python
def _get_example_csv(self): """For dimension parsing """ station_key = self.json["station"][0]["key"] period = "corrected-archive" url = self.url\ .replace(".json", "/station/{}/period/{}/data.csv"\ .format(station_key, period)) r = re...
[ "def", "_get_example_csv", "(", "self", ")", ":", "station_key", "=", "self", ".", "json", "[", "\"station\"", "]", "[", "0", "]", "[", "\"key\"", "]", "period", "=", "\"corrected-archive\"", "url", "=", "self", ".", "url", ".", "replace", "(", "\".json\...
For dimension parsing
[ "For", "dimension", "parsing" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/SMHIScraper.py#L237-L250
38,505
what-studio/smartformat
smartformat/builtin.py
plural
def plural(formatter, value, name, option, format): """Chooses different textension for locale-specific pluralization rules. Spec: `{:[p[lural]][(locale)]:msgstr0|msgstr1|...}` Example:: >>> smart.format(u'There {num:is an item|are {} items}.', num=1} There is an item. >>> smart.form...
python
def plural(formatter, value, name, option, format): """Chooses different textension for locale-specific pluralization rules. Spec: `{:[p[lural]][(locale)]:msgstr0|msgstr1|...}` Example:: >>> smart.format(u'There {num:is an item|are {} items}.', num=1} There is an item. >>> smart.form...
[ "def", "plural", "(", "formatter", ",", "value", ",", "name", ",", "option", ",", "format", ")", ":", "# Extract the plural words from the format string.", "words", "=", "format", ".", "split", "(", "'|'", ")", "# This extension requires at least two plural words.", "...
Chooses different textension for locale-specific pluralization rules. Spec: `{:[p[lural]][(locale)]:msgstr0|msgstr1|...}` Example:: >>> smart.format(u'There {num:is an item|are {} items}.', num=1} There is an item. >>> smart.format(u'There {num:is an item|are {} items}.', num=10} ...
[ "Chooses", "different", "textension", "for", "locale", "-", "specific", "pluralization", "rules", "." ]
5731203cbf29617ab8d42542f9dac03d5e34b217
https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/builtin.py#L26-L53
38,506
what-studio/smartformat
smartformat/builtin.py
get_choice
def get_choice(value): """Gets a key to choose a choice from any value.""" if value is None: return 'null' for attr in ['__name__', 'name']: if hasattr(value, attr): return getattr(value, attr) return str(value)
python
def get_choice(value): """Gets a key to choose a choice from any value.""" if value is None: return 'null' for attr in ['__name__', 'name']: if hasattr(value, attr): return getattr(value, attr) return str(value)
[ "def", "get_choice", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "'null'", "for", "attr", "in", "[", "'__name__'", ",", "'name'", "]", ":", "if", "hasattr", "(", "value", ",", "attr", ")", ":", "return", "getattr", "(", "value...
Gets a key to choose a choice from any value.
[ "Gets", "a", "key", "to", "choose", "a", "choice", "from", "any", "value", "." ]
5731203cbf29617ab8d42542f9dac03d5e34b217
https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/builtin.py#L56-L63
38,507
what-studio/smartformat
smartformat/builtin.py
choose
def choose(formatter, value, name, option, format): """Adds simple logic to format strings. Spec: `{:c[hoose](choice1|choice2|...):word1|word2|...[|default]}` Example:: >>> smart.format(u'{num:choose(1|2|3):one|two|three|other}, num=1) u'one' >>> smart.format(u'{num:choose(1|2|3):one...
python
def choose(formatter, value, name, option, format): """Adds simple logic to format strings. Spec: `{:c[hoose](choice1|choice2|...):word1|word2|...[|default]}` Example:: >>> smart.format(u'{num:choose(1|2|3):one|two|three|other}, num=1) u'one' >>> smart.format(u'{num:choose(1|2|3):one...
[ "def", "choose", "(", "formatter", ",", "value", ",", "name", ",", "option", ",", "format", ")", ":", "if", "not", "option", ":", "return", "words", "=", "format", ".", "split", "(", "'|'", ")", "num_words", "=", "len", "(", "words", ")", "if", "nu...
Adds simple logic to format strings. Spec: `{:c[hoose](choice1|choice2|...):word1|word2|...[|default]}` Example:: >>> smart.format(u'{num:choose(1|2|3):one|two|three|other}, num=1) u'one' >>> smart.format(u'{num:choose(1|2|3):one|two|three|other}, num=4) u'other'
[ "Adds", "simple", "logic", "to", "format", "strings", "." ]
5731203cbf29617ab8d42542f9dac03d5e34b217
https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/builtin.py#L67-L100
38,508
what-studio/smartformat
smartformat/builtin.py
list_
def list_(formatter, value, name, option, format): """Repeats the items of an array. Spec: `{:[l[ist]:]item|spacer[|final_spacer[|two_spacer]]}` Example:: >>> fruits = [u'apple', u'banana', u'coconut'] >>> smart.format(u'{fruits:list:{}|, |, and | and }', fruits=fruits) u'apple, bana...
python
def list_(formatter, value, name, option, format): """Repeats the items of an array. Spec: `{:[l[ist]:]item|spacer[|final_spacer[|two_spacer]]}` Example:: >>> fruits = [u'apple', u'banana', u'coconut'] >>> smart.format(u'{fruits:list:{}|, |, and | and }', fruits=fruits) u'apple, bana...
[ "def", "list_", "(", "formatter", ",", "value", ",", "name", ",", "option", ",", "format", ")", ":", "if", "not", "format", ":", "return", "if", "not", "hasattr", "(", "value", ",", "'__getitem__'", ")", "or", "isinstance", "(", "value", ",", "string_t...
Repeats the items of an array. Spec: `{:[l[ist]:]item|spacer[|final_spacer[|two_spacer]]}` Example:: >>> fruits = [u'apple', u'banana', u'coconut'] >>> smart.format(u'{fruits:list:{}|, |, and | and }', fruits=fruits) u'apple, banana, and coconut' >>> smart.format(u'{fruits:list:{}...
[ "Repeats", "the", "items", "of", "an", "array", "." ]
5731203cbf29617ab8d42542f9dac03d5e34b217
https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/builtin.py#L112-L156
38,509
MacHu-GWU/rolex-project
rolex/math.py
add_months
def add_months(datetime_like_object, n, return_date=False): """ Returns a time that n months after a time. Notice: for example, the date that one month after 2015-01-31 supposed to be 2015-02-31. But there's no 31th in Feb, so we fix that value to 2015-02-28. :param datetimestr: a datetime obj...
python
def add_months(datetime_like_object, n, return_date=False): """ Returns a time that n months after a time. Notice: for example, the date that one month after 2015-01-31 supposed to be 2015-02-31. But there's no 31th in Feb, so we fix that value to 2015-02-28. :param datetimestr: a datetime obj...
[ "def", "add_months", "(", "datetime_like_object", ",", "n", ",", "return_date", "=", "False", ")", ":", "a_datetime", "=", "parser", ".", "parse_datetime", "(", "datetime_like_object", ")", "month_from_ordinary", "=", "a_datetime", ".", "year", "*", "12", "+", ...
Returns a time that n months after a time. Notice: for example, the date that one month after 2015-01-31 supposed to be 2015-02-31. But there's no 31th in Feb, so we fix that value to 2015-02-28. :param datetimestr: a datetime object or a datetime str :param n: number of months, value can be negat...
[ "Returns", "a", "time", "that", "n", "months", "after", "a", "time", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/math.py#L89-L132
38,510
rosshamish/catanlog
catanlog.py
CatanLog._log
def _log(self, content): """ Write a string to the log """ self._buffer += content if self._auto_flush: self.flush()
python
def _log(self, content): """ Write a string to the log """ self._buffer += content if self._auto_flush: self.flush()
[ "def", "_log", "(", "self", ",", "content", ")", ":", "self", ".", "_buffer", "+=", "content", "if", "self", ".", "_auto_flush", ":", "self", ".", "flush", "(", ")" ]
Write a string to the log
[ "Write", "a", "string", "to", "the", "log" ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/catanlog.py#L51-L57
38,511
rosshamish/catanlog
catanlog.py
CatanLog.reset
def reset(self): """ Erase the log and reset the timestamp """ self._buffer = '' self._chars_flushed = 0 self._game_start_timestamp = datetime.datetime.now()
python
def reset(self): """ Erase the log and reset the timestamp """ self._buffer = '' self._chars_flushed = 0 self._game_start_timestamp = datetime.datetime.now()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_buffer", "=", "''", "self", ".", "_chars_flushed", "=", "0", "self", ".", "_game_start_timestamp", "=", "datetime", ".", "datetime", ".", "now", "(", ")" ]
Erase the log and reset the timestamp
[ "Erase", "the", "log", "and", "reset", "the", "timestamp" ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/catanlog.py#L71-L77
38,512
rosshamish/catanlog
catanlog.py
CatanLog.logpath
def logpath(self): """ Return the logfile path and filename as a string. The file with name self.logpath() is written to on flush(). The filename contains the log's timestamp and the names of players in the game. The logpath changes when reset() or _set_players() are called, as...
python
def logpath(self): """ Return the logfile path and filename as a string. The file with name self.logpath() is written to on flush(). The filename contains the log's timestamp and the names of players in the game. The logpath changes when reset() or _set_players() are called, as...
[ "def", "logpath", "(", "self", ")", ":", "name", "=", "'{}-{}.catan'", ".", "format", "(", "self", ".", "timestamp_str", "(", ")", ",", "'-'", ".", "join", "(", "[", "p", ".", "name", "for", "p", "in", "self", ".", "_players", "]", ")", ")", "pat...
Return the logfile path and filename as a string. The file with name self.logpath() is written to on flush(). The filename contains the log's timestamp and the names of players in the game. The logpath changes when reset() or _set_players() are called, as they change the timestamp and ...
[ "Return", "the", "logfile", "path", "and", "filename", "as", "a", "string", "." ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/catanlog.py#L91-L106
38,513
rosshamish/catanlog
catanlog.py
CatanLog.flush
def flush(self): """ Append the latest updates to file, or optionally to stdout instead. See the constructor for logging options. """ latest = self._latest() self._chars_flushed += len(latest) if self._use_stdout: file = sys.stdout else: ...
python
def flush(self): """ Append the latest updates to file, or optionally to stdout instead. See the constructor for logging options. """ latest = self._latest() self._chars_flushed += len(latest) if self._use_stdout: file = sys.stdout else: ...
[ "def", "flush", "(", "self", ")", ":", "latest", "=", "self", ".", "_latest", "(", ")", "self", ".", "_chars_flushed", "+=", "len", "(", "latest", ")", "if", "self", ".", "_use_stdout", ":", "file", "=", "sys", ".", "stdout", "else", ":", "file", "...
Append the latest updates to file, or optionally to stdout instead. See the constructor for logging options.
[ "Append", "the", "latest", "updates", "to", "file", "or", "optionally", "to", "stdout", "instead", ".", "See", "the", "constructor", "for", "logging", "options", "." ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/catanlog.py#L111-L126
38,514
rosshamish/catanlog
catanlog.py
CatanLog.log_game_start
def log_game_start(self, players, terrain, numbers, ports): """ Begin a game. Erase the log, set the timestamp, set the players, and write the log header. The robber is assumed to start on the desert (or off-board). :param players: iterable of catan.game.Player objects ...
python
def log_game_start(self, players, terrain, numbers, ports): """ Begin a game. Erase the log, set the timestamp, set the players, and write the log header. The robber is assumed to start on the desert (or off-board). :param players: iterable of catan.game.Player objects ...
[ "def", "log_game_start", "(", "self", ",", "players", ",", "terrain", ",", "numbers", ",", "ports", ")", ":", "self", ".", "reset", "(", ")", "self", ".", "_set_players", "(", "players", ")", "self", ".", "_logln", "(", "'{} v{}'", ".", "format", "(", ...
Begin a game. Erase the log, set the timestamp, set the players, and write the log header. The robber is assumed to start on the desert (or off-board). :param players: iterable of catan.game.Player objects :param terrain: list of 19 catan.board.Terrain objects. :param numbers:...
[ "Begin", "a", "game", "." ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/catanlog.py#L128-L149
38,515
rosshamish/catanlog
catanlog.py
CatanLog._log_board_ports
def _log_board_ports(self, ports): """ A board with no ports is allowed. In the logfile, ports must be sorted - ascending by tile identifier (primary) - alphabetical by edge direction (secondary) :param ports: list of catan.board.Port objects """ ports =...
python
def _log_board_ports(self, ports): """ A board with no ports is allowed. In the logfile, ports must be sorted - ascending by tile identifier (primary) - alphabetical by edge direction (secondary) :param ports: list of catan.board.Port objects """ ports =...
[ "def", "_log_board_ports", "(", "self", ",", "ports", ")", ":", "ports", "=", "sorted", "(", "ports", ",", "key", "=", "lambda", "port", ":", "(", "port", ".", "tile_id", ",", "port", ".", "direction", ")", ")", "self", ".", "_logln", "(", "'ports: {...
A board with no ports is allowed. In the logfile, ports must be sorted - ascending by tile identifier (primary) - alphabetical by edge direction (secondary) :param ports: list of catan.board.Port objects
[ "A", "board", "with", "no", "ports", "is", "allowed", "." ]
6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0
https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/catanlog.py#L347-L359
38,516
davgeo/clear
clear/renamer.py
TVRenamer._SetGuide
def _SetGuide(self, guideName): """ Select guide corresponding to guideName Parameters ---------- guideName : string Name of guide to use. Note ---------- Supported guide names are: EPGUIDES """ if(guideName == epguides.EPGuidesLookup.GUIDE_NAME): self._guide = ...
python
def _SetGuide(self, guideName): """ Select guide corresponding to guideName Parameters ---------- guideName : string Name of guide to use. Note ---------- Supported guide names are: EPGUIDES """ if(guideName == epguides.EPGuidesLookup.GUIDE_NAME): self._guide = ...
[ "def", "_SetGuide", "(", "self", ",", "guideName", ")", ":", "if", "(", "guideName", "==", "epguides", ".", "EPGuidesLookup", ".", "GUIDE_NAME", ")", ":", "self", ".", "_guide", "=", "epguides", ".", "EPGuidesLookup", "(", ")", "else", ":", "raise", "Exc...
Select guide corresponding to guideName Parameters ---------- guideName : string Name of guide to use. Note ---------- Supported guide names are: EPGUIDES
[ "Select", "guide", "corresponding", "to", "guideName" ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/renamer.py#L108-L124
38,517
davgeo/clear
clear/renamer.py
TVRenamer._GetUniqueFileShowNames
def _GetUniqueFileShowNames(self, tvFileList): """ Return a list containing all unique show names from tvfile.TVFile object list. Parameters ---------- tvFileList : list List of tvfile.TVFile objects. Returns ---------- set The set of show names from the tvfile....
python
def _GetUniqueFileShowNames(self, tvFileList): """ Return a list containing all unique show names from tvfile.TVFile object list. Parameters ---------- tvFileList : list List of tvfile.TVFile objects. Returns ---------- set The set of show names from the tvfile....
[ "def", "_GetUniqueFileShowNames", "(", "self", ",", "tvFileList", ")", ":", "showNameList", "=", "[", "tvFile", ".", "fileInfo", ".", "showName", "for", "tvFile", "in", "tvFileList", "]", "return", "(", "set", "(", "showNameList", ")", ")" ]
Return a list containing all unique show names from tvfile.TVFile object list. Parameters ---------- tvFileList : list List of tvfile.TVFile objects. Returns ---------- set The set of show names from the tvfile.TVFile list.
[ "Return", "a", "list", "containing", "all", "unique", "show", "names", "from", "tvfile", ".", "TVFile", "object", "list", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/renamer.py#L129-L145
38,518
davgeo/clear
clear/renamer.py
TVRenamer._GetShowInfo
def _GetShowInfo(self, stringSearch): """ Calls GetShowID and does post processing checks on result. Parameters ---------- stringSearch : string String to look up in database or guide. Returns ---------- tvfile.ShowInfo or None If GetShowID returns None or if it ret...
python
def _GetShowInfo(self, stringSearch): """ Calls GetShowID and does post processing checks on result. Parameters ---------- stringSearch : string String to look up in database or guide. Returns ---------- tvfile.ShowInfo or None If GetShowID returns None or if it ret...
[ "def", "_GetShowInfo", "(", "self", ",", "stringSearch", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"RENAMER\"", ",", "\"Looking up show info for: {0}\"", ".", "format", "(", "stringSearch", ")", ")", "goodlogging", ".", "Log", ".", "IncreaseIndent...
Calls GetShowID and does post processing checks on result. Parameters ---------- stringSearch : string String to look up in database or guide. Returns ---------- tvfile.ShowInfo or None If GetShowID returns None or if it returns showInfo with showID = None then this...
[ "Calls", "GetShowID", "and", "does", "post", "processing", "checks", "on", "result", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/renamer.py#L266-L297
38,519
davgeo/clear
clear/renamer.py
TVRenamer._CreateNewShowDir
def _CreateNewShowDir(self, showName): """ Create new directory name for show. An autogenerated choice, which is the showName input that has been stripped of special characters, is proposed which the user can accept or they can enter a new name to use. If the skipUserInput variable is True the autog...
python
def _CreateNewShowDir(self, showName): """ Create new directory name for show. An autogenerated choice, which is the showName input that has been stripped of special characters, is proposed which the user can accept or they can enter a new name to use. If the skipUserInput variable is True the autog...
[ "def", "_CreateNewShowDir", "(", "self", ",", "showName", ")", ":", "stripedDir", "=", "util", ".", "StripSpecialCharacters", "(", "showName", ")", "goodlogging", ".", "Log", ".", "Info", "(", "\"RENAMER\"", ",", "\"Suggested show directory name is: '{0}'\"", ".", ...
Create new directory name for show. An autogenerated choice, which is the showName input that has been stripped of special characters, is proposed which the user can accept or they can enter a new name to use. If the skipUserInput variable is True the autogenerated value is accepted by default. Par...
[ "Create", "new", "directory", "name", "for", "show", ".", "An", "autogenerated", "choice", "which", "is", "the", "showName", "input", "that", "has", "been", "stripped", "of", "special", "characters", "is", "proposed", "which", "the", "user", "can", "accept", ...
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/renamer.py#L529-L561
38,520
davgeo/clear
clear/renamer.py
TVRenamer._GenerateLibraryPath
def _GenerateLibraryPath(self, tvFile, libraryDir): """ Creates a full path for TV file in TV library. This initially attempts to directly match a show directory in the database, if this fails it searches the library directory for the best match. The user can then select an existing match or can pr...
python
def _GenerateLibraryPath(self, tvFile, libraryDir): """ Creates a full path for TV file in TV library. This initially attempts to directly match a show directory in the database, if this fails it searches the library directory for the best match. The user can then select an existing match or can pr...
[ "def", "_GenerateLibraryPath", "(", "self", ",", "tvFile", ",", "libraryDir", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"RENAMER\"", ",", "\"Looking up library directory in database for show: {0}\"", ".", "format", "(", "tvFile", ".", "showInfo", ".",...
Creates a full path for TV file in TV library. This initially attempts to directly match a show directory in the database, if this fails it searches the library directory for the best match. The user can then select an existing match or can propose a new directory to use as the show root directory. ...
[ "Creates", "a", "full", "path", "for", "TV", "file", "in", "TV", "library", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/renamer.py#L566-L654
38,521
e7dal/bubble3
bubble3/util/catcher.py
catch
def catch(ignore=[], was_doing="something important", helpfull_tips="you should use a debugger", gbc=None): """ Catch, prepare and log error :param exc_cls: error class :param exc: exception :param tb: exception traceback """ exc_cls, exc, tb=sys.exc_info() ...
python
def catch(ignore=[], was_doing="something important", helpfull_tips="you should use a debugger", gbc=None): """ Catch, prepare and log error :param exc_cls: error class :param exc: exception :param tb: exception traceback """ exc_cls, exc, tb=sys.exc_info() ...
[ "def", "catch", "(", "ignore", "=", "[", "]", ",", "was_doing", "=", "\"something important\"", ",", "helpfull_tips", "=", "\"you should use a debugger\"", ",", "gbc", "=", "None", ")", ":", "exc_cls", ",", "exc", ",", "tb", "=", "sys", ".", "exc_info", "(...
Catch, prepare and log error :param exc_cls: error class :param exc: exception :param tb: exception traceback
[ "Catch", "prepare", "and", "log", "error" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/util/catcher.py#L7-L68
38,522
alphagov/performanceplatform-client.py
performanceplatform/client/data_set.py
DataSet.from_name
def from_name(api_url, name, dry_run=False): """ doesn't require a token config param as all of our data is currently public """ return DataSet( '/'.join([api_url, name]).rstrip('/'), token=None, dry_run=dry_run )
python
def from_name(api_url, name, dry_run=False): """ doesn't require a token config param as all of our data is currently public """ return DataSet( '/'.join([api_url, name]).rstrip('/'), token=None, dry_run=dry_run )
[ "def", "from_name", "(", "api_url", ",", "name", ",", "dry_run", "=", "False", ")", ":", "return", "DataSet", "(", "'/'", ".", "join", "(", "[", "api_url", ",", "name", "]", ")", ".", "rstrip", "(", "'/'", ")", ",", "token", "=", "None", ",", "dr...
doesn't require a token config param as all of our data is currently public
[ "doesn", "t", "require", "a", "token", "config", "param", "as", "all", "of", "our", "data", "is", "currently", "public" ]
5f9bd061014ef4e81b2a22666cb67213e13caa87
https://github.com/alphagov/performanceplatform-client.py/blob/5f9bd061014ef4e81b2a22666cb67213e13caa87/performanceplatform/client/data_set.py#L24-L33
38,523
binbrain/OpenSesame
OpenSesame/xutils.py
secured_clipboard
def secured_clipboard(item): """This clipboard only allows 1 paste """ expire_clock = time.time() def set_text(clipboard, selectiondata, info, data): # expire after 15 secs if 15.0 >= time.time() - expire_clock: selectiondata.set_text(item.get_secret()) clipboard...
python
def secured_clipboard(item): """This clipboard only allows 1 paste """ expire_clock = time.time() def set_text(clipboard, selectiondata, info, data): # expire after 15 secs if 15.0 >= time.time() - expire_clock: selectiondata.set_text(item.get_secret()) clipboard...
[ "def", "secured_clipboard", "(", "item", ")", ":", "expire_clock", "=", "time", ".", "time", "(", ")", "def", "set_text", "(", "clipboard", ",", "selectiondata", ",", "info", ",", "data", ")", ":", "# expire after 15 secs", "if", "15.0", ">=", "time", ".",...
This clipboard only allows 1 paste
[ "This", "clipboard", "only", "allows", "1", "paste" ]
e32c306385012646400ecb49fc65c64b14ce3a93
https://github.com/binbrain/OpenSesame/blob/e32c306385012646400ecb49fc65c64b14ce3a93/OpenSesame/xutils.py#L27-L46
38,524
binbrain/OpenSesame
OpenSesame/xutils.py
get_active_window
def get_active_window(): """Get the currently focused window """ active_win = None default = wnck.screen_get_default() while gtk.events_pending(): gtk.main_iteration(False) window_list = default.get_windows() if len(window_list) == 0: print "No Windows Found" for win in w...
python
def get_active_window(): """Get the currently focused window """ active_win = None default = wnck.screen_get_default() while gtk.events_pending(): gtk.main_iteration(False) window_list = default.get_windows() if len(window_list) == 0: print "No Windows Found" for win in w...
[ "def", "get_active_window", "(", ")", ":", "active_win", "=", "None", "default", "=", "wnck", ".", "screen_get_default", "(", ")", "while", "gtk", ".", "events_pending", "(", ")", ":", "gtk", ".", "main_iteration", "(", "False", ")", "window_list", "=", "d...
Get the currently focused window
[ "Get", "the", "currently", "focused", "window" ]
e32c306385012646400ecb49fc65c64b14ce3a93
https://github.com/binbrain/OpenSesame/blob/e32c306385012646400ecb49fc65c64b14ce3a93/OpenSesame/xutils.py#L48-L61
38,525
HPCC-Cloud-Computing/CAL
calplus/v1/network/drivers/base.py
BaseQuota.get
def get(self): """Get quota from Cloud Provider.""" # get all network quota from Cloud Provider. attrs = ("networks", "security_groups", "floating_ips", "routers", "internet_gateways") for attr in attrs: se...
python
def get(self): """Get quota from Cloud Provider.""" # get all network quota from Cloud Provider. attrs = ("networks", "security_groups", "floating_ips", "routers", "internet_gateways") for attr in attrs: se...
[ "def", "get", "(", "self", ")", ":", "# get all network quota from Cloud Provider.", "attrs", "=", "(", "\"networks\"", ",", "\"security_groups\"", ",", "\"floating_ips\"", ",", "\"routers\"", ",", "\"internet_gateways\"", ")", "for", "attr", "in", "attrs", ":", "se...
Get quota from Cloud Provider.
[ "Get", "quota", "from", "Cloud", "Provider", "." ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/network/drivers/base.py#L65-L76
38,526
stephrdev/django-tapeforms
tapeforms/utils.py
join_css_class
def join_css_class(css_class, *additional_css_classes): """ Returns the union of one or more CSS classes as a space-separated string. Note that the order will not be preserved. """ css_set = set(chain.from_iterable( c.split(' ') for c in [css_class, *additional_css_classes] if c)) return...
python
def join_css_class(css_class, *additional_css_classes): """ Returns the union of one or more CSS classes as a space-separated string. Note that the order will not be preserved. """ css_set = set(chain.from_iterable( c.split(' ') for c in [css_class, *additional_css_classes] if c)) return...
[ "def", "join_css_class", "(", "css_class", ",", "*", "additional_css_classes", ")", ":", "css_set", "=", "set", "(", "chain", ".", "from_iterable", "(", "c", ".", "split", "(", "' '", ")", "for", "c", "in", "[", "css_class", ",", "*", "additional_css_class...
Returns the union of one or more CSS classes as a space-separated string. Note that the order will not be preserved.
[ "Returns", "the", "union", "of", "one", "or", "more", "CSS", "classes", "as", "a", "space", "-", "separated", "string", ".", "Note", "that", "the", "order", "will", "not", "be", "preserved", "." ]
255602de43777141f18afaf30669d7bdd4f7c323
https://github.com/stephrdev/django-tapeforms/blob/255602de43777141f18afaf30669d7bdd4f7c323/tapeforms/utils.py#L4-L11
38,527
HPCC-Cloud-Computing/CAL
calplus/wsgi.py
WSGIDriver._init_routes_and_middlewares
def _init_routes_and_middlewares(self): """Initialize hooks and URI routes to resources.""" self._init_middlewares() self._init_endpoints() self.app = falcon.API(middleware=self.middleware) self.app.add_error_handler(Exception, self._error_handler) for version_path, end...
python
def _init_routes_and_middlewares(self): """Initialize hooks and URI routes to resources.""" self._init_middlewares() self._init_endpoints() self.app = falcon.API(middleware=self.middleware) self.app.add_error_handler(Exception, self._error_handler) for version_path, end...
[ "def", "_init_routes_and_middlewares", "(", "self", ")", ":", "self", ".", "_init_middlewares", "(", ")", "self", ".", "_init_endpoints", "(", ")", "self", ".", "app", "=", "falcon", ".", "API", "(", "middleware", "=", "self", ".", "middleware", ")", "self...
Initialize hooks and URI routes to resources.
[ "Initialize", "hooks", "and", "URI", "routes", "to", "resources", "." ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/wsgi.py#L57-L67
38,528
HPCC-Cloud-Computing/CAL
calplus/wsgi.py
WSGIDriver.listen
def listen(self): """Self-host using 'bind' and 'port' from the WSGI config group.""" msgtmpl = (u'Serving on host %(host)s:%(port)s') host = CONF.wsgi.wsgi_host port = CONF.wsgi.wsgi_port LOG.info(msgtmpl, {'host': host, 'port': port}) server_cls = self...
python
def listen(self): """Self-host using 'bind' and 'port' from the WSGI config group.""" msgtmpl = (u'Serving on host %(host)s:%(port)s') host = CONF.wsgi.wsgi_host port = CONF.wsgi.wsgi_port LOG.info(msgtmpl, {'host': host, 'port': port}) server_cls = self...
[ "def", "listen", "(", "self", ")", ":", "msgtmpl", "=", "(", "u'Serving on host %(host)s:%(port)s'", ")", "host", "=", "CONF", ".", "wsgi", ".", "wsgi_host", "port", "=", "CONF", ".", "wsgi", ".", "wsgi_port", "LOG", ".", "info", "(", "msgtmpl", ",", "{"...
Self-host using 'bind' and 'port' from the WSGI config group.
[ "Self", "-", "host", "using", "bind", "and", "port", "from", "the", "WSGI", "config", "group", "." ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/wsgi.py#L88-L101
38,529
diamondman/proteusisc
proteusisc/primitive_defaults.py
RunInstruction.get_promise
def get_promise(self): """Return the special set of promises for run_instruction. Run Instruction has to support multiple promises (one for reading data, and one for reading back the status from IR. All other primitives have a single promise, so fitting multiple into this system...
python
def get_promise(self): """Return the special set of promises for run_instruction. Run Instruction has to support multiple promises (one for reading data, and one for reading back the status from IR. All other primitives have a single promise, so fitting multiple into this system...
[ "def", "get_promise", "(", "self", ")", ":", "if", "self", ".", "_promise", "is", "None", ":", "promise", "=", "[", "]", "if", "self", ".", "read", ":", "promise", ".", "append", "(", "TDOPromise", "(", "self", ".", "_chain", ",", "0", ",", "self",...
Return the special set of promises for run_instruction. Run Instruction has to support multiple promises (one for reading data, and one for reading back the status from IR. All other primitives have a single promise, so fitting multiple into this system causes some API consistencies. ...
[ "Return", "the", "special", "set", "of", "promises", "for", "run_instruction", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/primitive_defaults.py#L146-L170
38,530
synw/chartjspy
chartjspy/__init__.py
Chart._get_dataset
def _get_dataset(self, dataset, name, color): """ Encode a dataset """ global palette html = "{" html += '\t"label": "' + name + '",' if color is not None: html += '"backgroundColor": "' + color + '",\n' else: html += '"backgroundCo...
python
def _get_dataset(self, dataset, name, color): """ Encode a dataset """ global palette html = "{" html += '\t"label": "' + name + '",' if color is not None: html += '"backgroundColor": "' + color + '",\n' else: html += '"backgroundCo...
[ "def", "_get_dataset", "(", "self", ",", "dataset", ",", "name", ",", "color", ")", ":", "global", "palette", "html", "=", "\"{\"", "html", "+=", "'\\t\"label\": \"'", "+", "name", "+", "'\",'", "if", "color", "is", "not", "None", ":", "html", "+=", "'...
Encode a dataset
[ "Encode", "a", "dataset" ]
f215e36142d47b044fb59a07f95a4ff996d2b158
https://github.com/synw/chartjspy/blob/f215e36142d47b044fb59a07f95a4ff996d2b158/chartjspy/__init__.py#L12-L25
38,531
synw/chartjspy
chartjspy/__init__.py
Chart.get
def get(self, slug, xdata, ydatasets, label, opts, style, ctype): """ Returns html for a chart """ xdataset = self._format_list(xdata) width = "100%" height = "300px" if opts is not None: if "width" in opts: width = str(opts["width"]) ...
python
def get(self, slug, xdata, ydatasets, label, opts, style, ctype): """ Returns html for a chart """ xdataset = self._format_list(xdata) width = "100%" height = "300px" if opts is not None: if "width" in opts: width = str(opts["width"]) ...
[ "def", "get", "(", "self", ",", "slug", ",", "xdata", ",", "ydatasets", ",", "label", ",", "opts", ",", "style", ",", "ctype", ")", ":", "xdataset", "=", "self", ".", "_format_list", "(", "xdata", ")", "width", "=", "\"100%\"", "height", "=", "\"300p...
Returns html for a chart
[ "Returns", "html", "for", "a", "chart" ]
f215e36142d47b044fb59a07f95a4ff996d2b158
https://github.com/synw/chartjspy/blob/f215e36142d47b044fb59a07f95a4ff996d2b158/chartjspy/__init__.py#L27-L90
38,532
synw/chartjspy
chartjspy/__init__.py
Chart._format_list
def _format_list(self, data): """ Format a list to use in javascript """ dataset = "[" i = 0 for el in data: if pd.isnull(el): dataset += "null" else: dtype = type(data[i]) if dtype == int or dtype ==...
python
def _format_list(self, data): """ Format a list to use in javascript """ dataset = "[" i = 0 for el in data: if pd.isnull(el): dataset += "null" else: dtype = type(data[i]) if dtype == int or dtype ==...
[ "def", "_format_list", "(", "self", ",", "data", ")", ":", "dataset", "=", "\"[\"", "i", "=", "0", "for", "el", "in", "data", ":", "if", "pd", ".", "isnull", "(", "el", ")", ":", "dataset", "+=", "\"null\"", "else", ":", "dtype", "=", "type", "("...
Format a list to use in javascript
[ "Format", "a", "list", "to", "use", "in", "javascript" ]
f215e36142d47b044fb59a07f95a4ff996d2b158
https://github.com/synw/chartjspy/blob/f215e36142d47b044fb59a07f95a4ff996d2b158/chartjspy/__init__.py#L92-L110
38,533
nyrkovalex/httpsrv
httpsrv/httpsrv.py
Rule.status
def status(self, status, headers=None): ''' Respond with given status and no content :type status: int :param status: status code to return :type headers: dict :param headers: dictionary of headers to add to response :returns: itself :rtype: Rule ...
python
def status(self, status, headers=None): ''' Respond with given status and no content :type status: int :param status: status code to return :type headers: dict :param headers: dictionary of headers to add to response :returns: itself :rtype: Rule ...
[ "def", "status", "(", "self", ",", "status", ",", "headers", "=", "None", ")", ":", "self", ".", "response", "=", "_Response", "(", "status", ",", "headers", ")", "return", "self" ]
Respond with given status and no content :type status: int :param status: status code to return :type headers: dict :param headers: dictionary of headers to add to response :returns: itself :rtype: Rule
[ "Respond", "with", "given", "status", "and", "no", "content" ]
0acc3298be56856f73bda1ed10c9ab5153894b01
https://github.com/nyrkovalex/httpsrv/blob/0acc3298be56856f73bda1ed10c9ab5153894b01/httpsrv/httpsrv.py#L84-L98
38,534
nyrkovalex/httpsrv
httpsrv/httpsrv.py
Rule.text
def text(self, text, status=200, headers=None): ''' Respond with given status and text content :type text: str :param text: text to return :type status: int :param status: status code to return :type headers: dict :param headers: dictionary of headers t...
python
def text(self, text, status=200, headers=None): ''' Respond with given status and text content :type text: str :param text: text to return :type status: int :param status: status code to return :type headers: dict :param headers: dictionary of headers t...
[ "def", "text", "(", "self", ",", "text", ",", "status", "=", "200", ",", "headers", "=", "None", ")", ":", "self", ".", "response", "=", "_Response", "(", "status", ",", "headers", ",", "text", ".", "encode", "(", "'utf8'", ")", ")", "return", "sel...
Respond with given status and text content :type text: str :param text: text to return :type status: int :param status: status code to return :type headers: dict :param headers: dictionary of headers to add to response :returns: itself :rtype: Rule
[ "Respond", "with", "given", "status", "and", "text", "content" ]
0acc3298be56856f73bda1ed10c9ab5153894b01
https://github.com/nyrkovalex/httpsrv/blob/0acc3298be56856f73bda1ed10c9ab5153894b01/httpsrv/httpsrv.py#L100-L117
38,535
nyrkovalex/httpsrv
httpsrv/httpsrv.py
Rule.matches
def matches(self, method, path, headers, bytes=None): ''' Checks if rule matches given request parameters :type method: str :param method: HTTP method, e.g. ``'GET'``, ``'POST'``, etc. Can take any custom string :type path: str :param path: request path incl...
python
def matches(self, method, path, headers, bytes=None): ''' Checks if rule matches given request parameters :type method: str :param method: HTTP method, e.g. ``'GET'``, ``'POST'``, etc. Can take any custom string :type path: str :param path: request path incl...
[ "def", "matches", "(", "self", ",", "method", ",", "path", ",", "headers", ",", "bytes", "=", "None", ")", ":", "return", "self", ".", "_expectation", ".", "matches", "(", "method", ",", "path", ",", "headers", ",", "bytes", ")" ]
Checks if rule matches given request parameters :type method: str :param method: HTTP method, e.g. ``'GET'``, ``'POST'``, etc. Can take any custom string :type path: str :param path: request path including query parameters, e.g. ``'/users?name=John%20Doe'`` ...
[ "Checks", "if", "rule", "matches", "given", "request", "parameters" ]
0acc3298be56856f73bda1ed10c9ab5153894b01
https://github.com/nyrkovalex/httpsrv/blob/0acc3298be56856f73bda1ed10c9ab5153894b01/httpsrv/httpsrv.py#L138-L156
38,536
nyrkovalex/httpsrv
httpsrv/httpsrv.py
Server.on
def on(self, method, path=None, headers=None, text=None, json=None): ''' Sends response to matching parameters one time and removes it from list of expectations :type method: str :param method: request method: ``'GET'``, ``'POST'``, etc. can be some custom string :type path: st...
python
def on(self, method, path=None, headers=None, text=None, json=None): ''' Sends response to matching parameters one time and removes it from list of expectations :type method: str :param method: request method: ``'GET'``, ``'POST'``, etc. can be some custom string :type path: st...
[ "def", "on", "(", "self", ",", "method", ",", "path", "=", "None", ",", "headers", "=", "None", ",", "text", "=", "None", ",", "json", "=", "None", ")", ":", "rule", "=", "Rule", "(", "method", ",", "path", ",", "headers", ",", "text", ",", "js...
Sends response to matching parameters one time and removes it from list of expectations :type method: str :param method: request method: ``'GET'``, ``'POST'``, etc. can be some custom string :type path: str :param path: request path including query parameters :type headers: di...
[ "Sends", "response", "to", "matching", "parameters", "one", "time", "and", "removes", "it", "from", "list", "of", "expectations" ]
0acc3298be56856f73bda1ed10c9ab5153894b01
https://github.com/nyrkovalex/httpsrv/blob/0acc3298be56856f73bda1ed10c9ab5153894b01/httpsrv/httpsrv.py#L215-L239
38,537
nyrkovalex/httpsrv
httpsrv/httpsrv.py
Server.stop
def stop(self): ''' Shuts the server down and waits for server thread to join ''' self._server.shutdown() self._server.server_close() self._thread.join() self.running = False
python
def stop(self): ''' Shuts the server down and waits for server thread to join ''' self._server.shutdown() self._server.server_close() self._thread.join() self.running = False
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_server", ".", "shutdown", "(", ")", "self", ".", "_server", ".", "server_close", "(", ")", "self", ".", "_thread", ".", "join", "(", ")", "self", ".", "running", "=", "False" ]
Shuts the server down and waits for server thread to join
[ "Shuts", "the", "server", "down", "and", "waits", "for", "server", "thread", "to", "join" ]
0acc3298be56856f73bda1ed10c9ab5153894b01
https://github.com/nyrkovalex/httpsrv/blob/0acc3298be56856f73bda1ed10c9ab5153894b01/httpsrv/httpsrv.py#L263-L270
38,538
phensley/gstatsd
gstatsd/sink.py
GraphiteSink.send
def send(self, stats): "Format stats and send to one or more Graphite hosts" buf = cStringIO.StringIO() now = int(time.time()) num_stats = 0 # timer stats pct = stats.percent timers = stats.timers for key, vals in timers.iteritems(): if not va...
python
def send(self, stats): "Format stats and send to one or more Graphite hosts" buf = cStringIO.StringIO() now = int(time.time()) num_stats = 0 # timer stats pct = stats.percent timers = stats.timers for key, vals in timers.iteritems(): if not va...
[ "def", "send", "(", "self", ",", "stats", ")", ":", "buf", "=", "cStringIO", ".", "StringIO", "(", ")", "now", "=", "int", "(", "time", ".", "time", "(", ")", ")", "num_stats", "=", "0", "# timer stats", "pct", "=", "stats", ".", "percent", "timers...
Format stats and send to one or more Graphite hosts
[ "Format", "stats", "and", "send", "to", "one", "or", "more", "Graphite", "hosts" ]
c6d3d22f162d236c1ef916064670c6dc5bce6142
https://github.com/phensley/gstatsd/blob/c6d3d22f162d236c1ef916064670c6dc5bce6142/gstatsd/sink.py#L47-L107
38,539
kronok/django-google-analytics-reporter
google_analytics_reporter/tracking.py
Tracker.get_payload
def get_payload(self, *args, **kwargs): """Receive all passed in args, kwargs, and combine them together with any required params""" if not kwargs: kwargs = self.default_params else: kwargs.update(self.default_params) for item in args: if isinstance(it...
python
def get_payload(self, *args, **kwargs): """Receive all passed in args, kwargs, and combine them together with any required params""" if not kwargs: kwargs = self.default_params else: kwargs.update(self.default_params) for item in args: if isinstance(it...
[ "def", "get_payload", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "kwargs", ":", "kwargs", "=", "self", ".", "default_params", "else", ":", "kwargs", ".", "update", "(", "self", ".", "default_params", ")", "for", "i...
Receive all passed in args, kwargs, and combine them together with any required params
[ "Receive", "all", "passed", "in", "args", "kwargs", "and", "combine", "them", "together", "with", "any", "required", "params" ]
cca5fb0920ec68cfe03069cedf53fb4c6440cc11
https://github.com/kronok/django-google-analytics-reporter/blob/cca5fb0920ec68cfe03069cedf53fb4c6440cc11/google_analytics_reporter/tracking.py#L53-L64
38,540
adamrothman/ftl
ftl/stream.py
HTTP2Stream.read_frame
async def read_frame(self) -> DataFrame: """Read a single frame from the local buffer. If no frames are available but the stream is still open, waits until more frames arrive. Otherwise, raises StreamConsumedError. When a stream is closed, a single `None` is added to the data frame ...
python
async def read_frame(self) -> DataFrame: """Read a single frame from the local buffer. If no frames are available but the stream is still open, waits until more frames arrive. Otherwise, raises StreamConsumedError. When a stream is closed, a single `None` is added to the data frame ...
[ "async", "def", "read_frame", "(", "self", ")", "->", "DataFrame", ":", "if", "self", ".", "_data_frames", ".", "qsize", "(", ")", "==", "0", "and", "self", ".", "closed", ":", "raise", "StreamConsumedError", "(", "self", ".", "id", ")", "frame", "=", ...
Read a single frame from the local buffer. If no frames are available but the stream is still open, waits until more frames arrive. Otherwise, raises StreamConsumedError. When a stream is closed, a single `None` is added to the data frame Queue to wake up any waiting `read_frame` corou...
[ "Read", "a", "single", "frame", "from", "the", "local", "buffer", "." ]
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/stream.py#L95-L110
38,541
adamrothman/ftl
ftl/stream.py
HTTP2Stream.read_frame_nowait
def read_frame_nowait(self) -> Optional[DataFrame]: """Read a single frame from the local buffer immediately. If no frames are available but the stream is still open, returns None. Otherwise, raises StreamConsumedError. """ try: frame = self._data_frames.get_nowait()...
python
def read_frame_nowait(self) -> Optional[DataFrame]: """Read a single frame from the local buffer immediately. If no frames are available but the stream is still open, returns None. Otherwise, raises StreamConsumedError. """ try: frame = self._data_frames.get_nowait()...
[ "def", "read_frame_nowait", "(", "self", ")", "->", "Optional", "[", "DataFrame", "]", ":", "try", ":", "frame", "=", "self", ".", "_data_frames", ".", "get_nowait", "(", ")", "except", "asyncio", ".", "QueueEmpty", ":", "if", "self", ".", "closed", ":",...
Read a single frame from the local buffer immediately. If no frames are available but the stream is still open, returns None. Otherwise, raises StreamConsumedError.
[ "Read", "a", "single", "frame", "from", "the", "local", "buffer", "immediately", "." ]
a88f3df1ecbdfba45035b65f833b8ffffc49b399
https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/stream.py#L112-L127
38,542
randomir/plucky
plucky/__init__.py
merge
def merge(a, b, op=None, recurse_list=False, max_depth=None): """Immutable merge ``a`` structure with ``b`` using binary operator ``op`` on leaf nodes. All nodes at, or below, ``max_depth`` are considered to be leaf nodes. Merged structure is returned, input data structures are not modified. If ``...
python
def merge(a, b, op=None, recurse_list=False, max_depth=None): """Immutable merge ``a`` structure with ``b`` using binary operator ``op`` on leaf nodes. All nodes at, or below, ``max_depth`` are considered to be leaf nodes. Merged structure is returned, input data structures are not modified. If ``...
[ "def", "merge", "(", "a", ",", "b", ",", "op", "=", "None", ",", "recurse_list", "=", "False", ",", "max_depth", "=", "None", ")", ":", "if", "op", "is", "None", ":", "op", "=", "operator", ".", "add", "if", "max_depth", "is", "not", "None", ":",...
Immutable merge ``a`` structure with ``b`` using binary operator ``op`` on leaf nodes. All nodes at, or below, ``max_depth`` are considered to be leaf nodes. Merged structure is returned, input data structures are not modified. If ``recurse_list=True``, leaf lists of equal length will be merged on a ...
[ "Immutable", "merge", "a", "structure", "with", "b", "using", "binary", "operator", "op", "on", "leaf", "nodes", ".", "All", "nodes", "at", "or", "below", "max_depth", "are", "considered", "to", "be", "leaf", "nodes", "." ]
16b7b59aa19d619d8e619dc15dc7eeffc9fe078a
https://github.com/randomir/plucky/blob/16b7b59aa19d619d8e619dc15dc7eeffc9fe078a/plucky/__init__.py#L144-L200
38,543
DXsmiley/edgy-json
edgy.py
_param_deprecation_warning
def _param_deprecation_warning(schema, deprecated, context): """Raises warning about using the 'old' names for some parameters. The new naming scheme just has two underscores on each end of the word for consistency """ for i in deprecated: if i in schema: msg = 'When matc...
python
def _param_deprecation_warning(schema, deprecated, context): """Raises warning about using the 'old' names for some parameters. The new naming scheme just has two underscores on each end of the word for consistency """ for i in deprecated: if i in schema: msg = 'When matc...
[ "def", "_param_deprecation_warning", "(", "schema", ",", "deprecated", ",", "context", ")", ":", "for", "i", "in", "deprecated", ":", "if", "i", "in", "schema", ":", "msg", "=", "'When matching {ctx}, parameter {word} is deprecated, use __{word}__ instead'", "msg", "=...
Raises warning about using the 'old' names for some parameters. The new naming scheme just has two underscores on each end of the word for consistency
[ "Raises", "warning", "about", "using", "the", "old", "names", "for", "some", "parameters", ".", "The", "new", "naming", "scheme", "just", "has", "two", "underscores", "on", "each", "end", "of", "the", "word", "for", "consistency" ]
1df05c055ce66722ed8baa71fc21e2bc54884851
https://github.com/DXsmiley/edgy-json/blob/1df05c055ce66722ed8baa71fc21e2bc54884851/edgy.py#L25-L34
38,544
Cadasta/django-tutelary
tutelary/backends.py
Backend.has_perm
def has_perm(self, user, perm, obj=None, *args, **kwargs): """Test user permissions for a single action and object. :param user: The user to test. :type user: ``User`` :param perm: The action to test. :type perm: ``str`` :param obj: The object path to test. :type...
python
def has_perm(self, user, perm, obj=None, *args, **kwargs): """Test user permissions for a single action and object. :param user: The user to test. :type user: ``User`` :param perm: The action to test. :type perm: ``str`` :param obj: The object path to test. :type...
[ "def", "has_perm", "(", "self", ",", "user", ",", "perm", ",", "obj", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "not", "self", ".", "_obj_ok", "(", "obj", ")", ":", "if", "hasattr", "(", "obj", ",", "...
Test user permissions for a single action and object. :param user: The user to test. :type user: ``User`` :param perm: The action to test. :type perm: ``str`` :param obj: The object path to test. :type obj: ``tutelary.engine.Object`` :returns: ``bool`` -- is the ...
[ "Test", "user", "permissions", "for", "a", "single", "action", "and", "object", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/backends.py#L15-L34
38,545
Cadasta/django-tutelary
tutelary/backends.py
Backend.permitted_actions
def permitted_actions(self, user, obj=None): """Determine list of permitted actions for an object or object pattern. :param user: The user to test. :type user: ``User`` :param obj: A function mapping from action names to object paths to test. :type ob...
python
def permitted_actions(self, user, obj=None): """Determine list of permitted actions for an object or object pattern. :param user: The user to test. :type user: ``User`` :param obj: A function mapping from action names to object paths to test. :type ob...
[ "def", "permitted_actions", "(", "self", ",", "user", ",", "obj", "=", "None", ")", ":", "try", ":", "if", "not", "self", ".", "_obj_ok", "(", "obj", ")", ":", "raise", "InvalidPermissionObjectException", "return", "user", ".", "permset_tree", ".", "permit...
Determine list of permitted actions for an object or object pattern. :param user: The user to test. :type user: ``User`` :param obj: A function mapping from action names to object paths to test. :type obj: callable :returns: ``list(tutelary.engine.Act...
[ "Determine", "list", "of", "permitted", "actions", "for", "an", "object", "or", "object", "pattern", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/backends.py#L36-L53
38,546
rogerhil/thegamesdb
thegamesdb/resources.py
GameResource.list
def list(self, name, platform='', genre=''): """ The name argument is required for this method as per the API server specification. This method also provides the platform and genre optional arguments as filters. """ data_list = self.db.get_data(self.list_path, name=name, ...
python
def list(self, name, platform='', genre=''): """ The name argument is required for this method as per the API server specification. This method also provides the platform and genre optional arguments as filters. """ data_list = self.db.get_data(self.list_path, name=name, ...
[ "def", "list", "(", "self", ",", "name", ",", "platform", "=", "''", ",", "genre", "=", "''", ")", ":", "data_list", "=", "self", ".", "db", ".", "get_data", "(", "self", ".", "list_path", ",", "name", "=", "name", ",", "platform", "=", "platform",...
The name argument is required for this method as per the API server specification. This method also provides the platform and genre optional arguments as filters.
[ "The", "name", "argument", "is", "required", "for", "this", "method", "as", "per", "the", "API", "server", "specification", ".", "This", "method", "also", "provides", "the", "platform", "and", "genre", "optional", "arguments", "as", "filters", "." ]
795314215f9ee73697c7520dea4ddecfb23ca8e6
https://github.com/rogerhil/thegamesdb/blob/795314215f9ee73697c7520dea4ddecfb23ca8e6/thegamesdb/resources.py#L38-L47
38,547
rogerhil/thegamesdb
thegamesdb/resources.py
PlatformResource.list
def list(self): """ No argument is required for this method as per the API server specification. """ data_list = self.db.get_data(self.list_path) data_list = data_list.get('Data') or {} platforms = (data_list.get('Platforms') or {}).get('Platform') or [] return [s...
python
def list(self): """ No argument is required for this method as per the API server specification. """ data_list = self.db.get_data(self.list_path) data_list = data_list.get('Data') or {} platforms = (data_list.get('Platforms') or {}).get('Platform') or [] return [s...
[ "def", "list", "(", "self", ")", ":", "data_list", "=", "self", ".", "db", ".", "get_data", "(", "self", ".", "list_path", ")", "data_list", "=", "data_list", ".", "get", "(", "'Data'", ")", "or", "{", "}", "platforms", "=", "(", "data_list", ".", ...
No argument is required for this method as per the API server specification.
[ "No", "argument", "is", "required", "for", "this", "method", "as", "per", "the", "API", "server", "specification", "." ]
795314215f9ee73697c7520dea4ddecfb23ca8e6
https://github.com/rogerhil/thegamesdb/blob/795314215f9ee73697c7520dea4ddecfb23ca8e6/thegamesdb/resources.py#L72-L79
38,548
cloud-hero/hero-cli
lib/utils.py
remove_none_dict_values
def remove_none_dict_values(obj): """ Remove None values from dict. """ if isinstance(obj, (list, tuple, set)): return type(obj)(remove_none_dict_values(x) for x in obj) elif isinstance(obj, dict): return type(obj)((k, remove_none_dict_values(v)) for k, v in ...
python
def remove_none_dict_values(obj): """ Remove None values from dict. """ if isinstance(obj, (list, tuple, set)): return type(obj)(remove_none_dict_values(x) for x in obj) elif isinstance(obj, dict): return type(obj)((k, remove_none_dict_values(v)) for k, v in ...
[ "def", "remove_none_dict_values", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "(", "list", ",", "tuple", ",", "set", ")", ")", ":", "return", "type", "(", "obj", ")", "(", "remove_none_dict_values", "(", "x", ")", "for", "x", "in", "ob...
Remove None values from dict.
[ "Remove", "None", "values", "from", "dict", "." ]
c467b6e932d169901819ac9c456b9226dfd35bd5
https://github.com/cloud-hero/hero-cli/blob/c467b6e932d169901819ac9c456b9226dfd35bd5/lib/utils.py#L88-L99
38,549
HPCC-Cloud-Computing/CAL
calplus/client.py
Client
def Client(version=__version__, resource=None, provider=None, **kwargs): """Initialize client object based on given version. :params version: version of CAL, define at setup.cfg :params resource: resource type (network, compute, object_storage, block_storage) :params provider: prov...
python
def Client(version=__version__, resource=None, provider=None, **kwargs): """Initialize client object based on given version. :params version: version of CAL, define at setup.cfg :params resource: resource type (network, compute, object_storage, block_storage) :params provider: prov...
[ "def", "Client", "(", "version", "=", "__version__", ",", "resource", "=", "None", ",", "provider", "=", "None", ",", "*", "*", "kwargs", ")", ":", "versions", "=", "_CLIENTS", ".", "keys", "(", ")", "if", "version", "not", "in", "versions", ":", "ra...
Initialize client object based on given version. :params version: version of CAL, define at setup.cfg :params resource: resource type (network, compute, object_storage, block_storage) :params provider: provider object :params cloud_config: cloud auth config :params **kwargs: sp...
[ "Initialize", "client", "object", "based", "on", "given", "version", "." ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/client.py#L25-L82
38,550
standage/tag
tag/sequence.py
Sequence.accession
def accession(self): """ Parse accession number from commonly supported formats. If the defline does not match one of the following formats, the entire description (sans leading caret) will be returned. * >gi|572257426|ref|XP_006607122.1| * >gnl|Tcas|XP_008191512.1 ...
python
def accession(self): """ Parse accession number from commonly supported formats. If the defline does not match one of the following formats, the entire description (sans leading caret) will be returned. * >gi|572257426|ref|XP_006607122.1| * >gnl|Tcas|XP_008191512.1 ...
[ "def", "accession", "(", "self", ")", ":", "accession", "=", "None", "if", "self", ".", "defline", ".", "startswith", "(", "'>gi|'", ")", ":", "match", "=", "re", ".", "match", "(", "'>gi\\|\\d+\\|[^\\|]+\\|([^\\|\\n ]+)'", ",", "self", ".", "defline", ")"...
Parse accession number from commonly supported formats. If the defline does not match one of the following formats, the entire description (sans leading caret) will be returned. * >gi|572257426|ref|XP_006607122.1| * >gnl|Tcas|XP_008191512.1 * >lcl|PdomMRNAr1.2-10981.1
[ "Parse", "accession", "number", "from", "commonly", "supported", "formats", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/sequence.py#L76-L100
38,551
standage/tag
tag/sequence.py
Sequence.format_seq
def format_seq(self, outstream=None, linewidth=70): """ Print a sequence in a readable format. :param outstream: if `None`, formatted sequence is returned as a string; otherwise, it is treated as a file-like object and the formatted sequence i...
python
def format_seq(self, outstream=None, linewidth=70): """ Print a sequence in a readable format. :param outstream: if `None`, formatted sequence is returned as a string; otherwise, it is treated as a file-like object and the formatted sequence i...
[ "def", "format_seq", "(", "self", ",", "outstream", "=", "None", ",", "linewidth", "=", "70", ")", ":", "if", "linewidth", "==", "0", "or", "len", "(", "self", ".", "seq", ")", "<=", "linewidth", ":", "if", "outstream", "is", "None", ":", "return", ...
Print a sequence in a readable format. :param outstream: if `None`, formatted sequence is returned as a string; otherwise, it is treated as a file-like object and the formatted sequence is printed to the outstream :param line...
[ "Print", "a", "sequence", "in", "a", "readable", "format", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/sequence.py#L102-L129
38,552
botstory/botstory
botstory/matchers.py
get_validator
def get_validator(filter_data): """ ask every matcher whether it can serve such filter data :param filter_data: :return: """ for matcher_type, m in matchers.items(): if hasattr(m, 'can_handle') and m.can_handle(filter_data): filter_data = m.handle(filter_data) return fi...
python
def get_validator(filter_data): """ ask every matcher whether it can serve such filter data :param filter_data: :return: """ for matcher_type, m in matchers.items(): if hasattr(m, 'can_handle') and m.can_handle(filter_data): filter_data = m.handle(filter_data) return fi...
[ "def", "get_validator", "(", "filter_data", ")", ":", "for", "matcher_type", ",", "m", "in", "matchers", ".", "items", "(", ")", ":", "if", "hasattr", "(", "m", ",", "'can_handle'", ")", "and", "m", ".", "can_handle", "(", "filter_data", ")", ":", "fil...
ask every matcher whether it can serve such filter data :param filter_data: :return:
[ "ask", "every", "matcher", "whether", "it", "can", "serve", "such", "filter", "data" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/matchers.py#L24-L35
38,553
HPCC-Cloud-Computing/CAL
example.py
run
def run(): """Run the examples""" # NOTE(kiennt): Until now, this example isn't finished yet, # because we don't have any completed driver # Get a network client with openstack driver. network_client = client.Client(version=_VERSION, resource=_RESOURCES[0], p...
python
def run(): """Run the examples""" # NOTE(kiennt): Until now, this example isn't finished yet, # because we don't have any completed driver # Get a network client with openstack driver. network_client = client.Client(version=_VERSION, resource=_RESOURCES[0], p...
[ "def", "run", "(", ")", ":", "# NOTE(kiennt): Until now, this example isn't finished yet,", "# because we don't have any completed driver", "# Get a network client with openstack driver.", "network_client", "=", "client", ".", "Client", "(", "version", "=", "_VERSION", ...
Run the examples
[ "Run", "the", "examples" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/example.py#L16-L29
38,554
sharibarboza/py_zap
py_zap/py_zap.py
Ratings.sort
def sort(self, attr): """Sort the ratings based on an attribute""" self.entries = Sorter(self.entries, self.category, attr).sort_entries() return self
python
def sort(self, attr): """Sort the ratings based on an attribute""" self.entries = Sorter(self.entries, self.category, attr).sort_entries() return self
[ "def", "sort", "(", "self", ",", "attr", ")", ":", "self", ".", "entries", "=", "Sorter", "(", "self", ".", "entries", ",", "self", ".", "category", ",", "attr", ")", ".", "sort_entries", "(", ")", "return", "self" ]
Sort the ratings based on an attribute
[ "Sort", "the", "ratings", "based", "on", "an", "attribute" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L121-L124
38,555
sharibarboza/py_zap
py_zap/py_zap.py
Ratings.get_title
def get_title(self): """Title is either the chart header for a cable ratings page or above the opening description for a broadcast ratings page. """ if self.category == 'cable': strings = get_strings(self.soup, 'strong') else: strings = get_strings(self.so...
python
def get_title(self): """Title is either the chart header for a cable ratings page or above the opening description for a broadcast ratings page. """ if self.category == 'cable': strings = get_strings(self.soup, 'strong') else: strings = get_strings(self.so...
[ "def", "get_title", "(", "self", ")", ":", "if", "self", ".", "category", "==", "'cable'", ":", "strings", "=", "get_strings", "(", "self", ".", "soup", ",", "'strong'", ")", "else", ":", "strings", "=", "get_strings", "(", "self", ".", "soup", ",", ...
Title is either the chart header for a cable ratings page or above the opening description for a broadcast ratings page.
[ "Title", "is", "either", "the", "chart", "header", "for", "a", "cable", "ratings", "page", "or", "above", "the", "opening", "description", "for", "a", "broadcast", "ratings", "page", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L146-L163
38,556
sharibarboza/py_zap
py_zap/py_zap.py
Ratings.get_json
def get_json(self): """Serialize ratings object as JSON-formatted string""" ratings_dict = { 'category': self.category, 'date': self.date, 'day': self.weekday, 'next week': self.next_week, 'last week': self.last_week, 'entries': sel...
python
def get_json(self): """Serialize ratings object as JSON-formatted string""" ratings_dict = { 'category': self.category, 'date': self.date, 'day': self.weekday, 'next week': self.next_week, 'last week': self.last_week, 'entries': sel...
[ "def", "get_json", "(", "self", ")", ":", "ratings_dict", "=", "{", "'category'", ":", "self", ".", "category", ",", "'date'", ":", "self", ".", "date", ",", "'day'", ":", "self", ".", "weekday", ",", "'next week'", ":", "self", ".", "next_week", ",", ...
Serialize ratings object as JSON-formatted string
[ "Serialize", "ratings", "object", "as", "JSON", "-", "formatted", "string" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L165-L176
38,557
sharibarboza/py_zap
py_zap/py_zap.py
Ratings._get_url_params
def _get_url_params(self, shorten=True): """Returns a list of each parameter to be used for the url format.""" cable = True if self.category == 'cable' else False url_date = convert_month(self.date, shorten=shorten, cable=cable) return [ BASE_URL, self.weekday.lo...
python
def _get_url_params(self, shorten=True): """Returns a list of each parameter to be used for the url format.""" cable = True if self.category == 'cable' else False url_date = convert_month(self.date, shorten=shorten, cable=cable) return [ BASE_URL, self.weekday.lo...
[ "def", "_get_url_params", "(", "self", ",", "shorten", "=", "True", ")", ":", "cable", "=", "True", "if", "self", ".", "category", "==", "'cable'", "else", "False", "url_date", "=", "convert_month", "(", "self", ".", "date", ",", "shorten", "=", "shorten...
Returns a list of each parameter to be used for the url format.
[ "Returns", "a", "list", "of", "each", "parameter", "to", "be", "used", "for", "the", "url", "format", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L197-L207
38,558
sharibarboza/py_zap
py_zap/py_zap.py
Ratings._verify_page
def _verify_page(self): """Verify the ratings page matches the correct date""" title_date = self._get_date_in_title().lower() split_date = self.date.lower().split() split_date[0] = split_date[0][:3] return all(term in title_date for term in split_date)
python
def _verify_page(self): """Verify the ratings page matches the correct date""" title_date = self._get_date_in_title().lower() split_date = self.date.lower().split() split_date[0] = split_date[0][:3] return all(term in title_date for term in split_date)
[ "def", "_verify_page", "(", "self", ")", ":", "title_date", "=", "self", ".", "_get_date_in_title", "(", ")", ".", "lower", "(", ")", "split_date", "=", "self", ".", "date", ".", "lower", "(", ")", ".", "split", "(", ")", "split_date", "[", "0", "]",...
Verify the ratings page matches the correct date
[ "Verify", "the", "ratings", "page", "matches", "the", "correct", "date" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L226-L231
38,559
sharibarboza/py_zap
py_zap/py_zap.py
Ratings._get_ratings_page
def _get_ratings_page(self): """Do a limited search for the correct url.""" # Use current posted date to build url self._build_url() soup = get_soup(self.url) if soup: return soup # Try building url again with unshortened month self._build_url(shorten...
python
def _get_ratings_page(self): """Do a limited search for the correct url.""" # Use current posted date to build url self._build_url() soup = get_soup(self.url) if soup: return soup # Try building url again with unshortened month self._build_url(shorten...
[ "def", "_get_ratings_page", "(", "self", ")", ":", "# Use current posted date to build url", "self", ".", "_build_url", "(", ")", "soup", "=", "get_soup", "(", "self", ".", "url", ")", "if", "soup", ":", "return", "soup", "# Try building url again with unshortened m...
Do a limited search for the correct url.
[ "Do", "a", "limited", "search", "for", "the", "correct", "url", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L238-L253
38,560
sharibarboza/py_zap
py_zap/py_zap.py
Cable._build_url
def _build_url(self, shorten=True): """Build the url for a cable ratings page""" self.url = URL_FORMAT.format(*self._get_url_params(shorten=shorten))
python
def _build_url(self, shorten=True): """Build the url for a cable ratings page""" self.url = URL_FORMAT.format(*self._get_url_params(shorten=shorten))
[ "def", "_build_url", "(", "self", ",", "shorten", "=", "True", ")", ":", "self", ".", "url", "=", "URL_FORMAT", ".", "format", "(", "*", "self", ".", "_get_url_params", "(", "shorten", "=", "shorten", ")", ")" ]
Build the url for a cable ratings page
[ "Build", "the", "url", "for", "a", "cable", "ratings", "page" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L291-L293
38,561
sharibarboza/py_zap
py_zap/py_zap.py
Cable.fetch_entries
def fetch_entries(self): """Fetch data and parse it to build a list of cable entries.""" data = [] for row in self.get_rows(): # Stop fetching data if limit has been met if exceeded_limit(self.limit, len(data)): break entry = row.find_all('td'...
python
def fetch_entries(self): """Fetch data and parse it to build a list of cable entries.""" data = [] for row in self.get_rows(): # Stop fetching data if limit has been met if exceeded_limit(self.limit, len(data)): break entry = row.find_all('td'...
[ "def", "fetch_entries", "(", "self", ")", ":", "data", "=", "[", "]", "for", "row", "in", "self", ".", "get_rows", "(", ")", ":", "# Stop fetching data if limit has been met", "if", "exceeded_limit", "(", "self", ".", "limit", ",", "len", "(", "data", ")",...
Fetch data and parse it to build a list of cable entries.
[ "Fetch", "data", "and", "parse", "it", "to", "build", "a", "list", "of", "cable", "entries", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L299-L328
38,562
sharibarboza/py_zap
py_zap/py_zap.py
Broadcast._build_url
def _build_url(self, shorten=True): """Build the url for a broadcast ratings page""" url_order = self._get_url_params(shorten=shorten) # For fast ratings, switch weekday and category in url if self.category != 'final': url_order[1], url_order[2] = url_order[2], url_order[1] ...
python
def _build_url(self, shorten=True): """Build the url for a broadcast ratings page""" url_order = self._get_url_params(shorten=shorten) # For fast ratings, switch weekday and category in url if self.category != 'final': url_order[1], url_order[2] = url_order[2], url_order[1] ...
[ "def", "_build_url", "(", "self", ",", "shorten", "=", "True", ")", ":", "url_order", "=", "self", ".", "_get_url_params", "(", "shorten", "=", "shorten", ")", "# For fast ratings, switch weekday and category in url", "if", "self", ".", "category", "!=", "'final'"...
Build the url for a broadcast ratings page
[ "Build", "the", "url", "for", "a", "broadcast", "ratings", "page" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L377-L384
38,563
sharibarboza/py_zap
py_zap/py_zap.py
Broadcast.get_rows
def get_rows(self): """Get the rows from a broadcast ratings chart""" table = self.soup.find_all('tr')[1:-3] return [row for row in table if row.contents[3].string]
python
def get_rows(self): """Get the rows from a broadcast ratings chart""" table = self.soup.find_all('tr')[1:-3] return [row for row in table if row.contents[3].string]
[ "def", "get_rows", "(", "self", ")", ":", "table", "=", "self", ".", "soup", ".", "find_all", "(", "'tr'", ")", "[", "1", ":", "-", "3", "]", "return", "[", "row", "for", "row", "in", "table", "if", "row", ".", "contents", "[", "3", "]", ".", ...
Get the rows from a broadcast ratings chart
[ "Get", "the", "rows", "from", "a", "broadcast", "ratings", "chart" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L386-L389
38,564
sharibarboza/py_zap
py_zap/py_zap.py
Broadcast.fetch_entries
def fetch_entries(self): """Fetch data and parse it to build a list of broadcast entries.""" current_time = '' data = [] for row in self.get_rows(): # Stop fetching data if limit has been met if exceeded_limit(self.limit, len(data)): break ...
python
def fetch_entries(self): """Fetch data and parse it to build a list of broadcast entries.""" current_time = '' data = [] for row in self.get_rows(): # Stop fetching data if limit has been met if exceeded_limit(self.limit, len(data)): break ...
[ "def", "fetch_entries", "(", "self", ")", ":", "current_time", "=", "''", "data", "=", "[", "]", "for", "row", "in", "self", ".", "get_rows", "(", ")", ":", "# Stop fetching data if limit has been met", "if", "exceeded_limit", "(", "self", ".", "limit", ",",...
Fetch data and parse it to build a list of broadcast entries.
[ "Fetch", "data", "and", "parse", "it", "to", "build", "a", "list", "of", "broadcast", "entries", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L391-L425
38,565
sharibarboza/py_zap
py_zap/py_zap.py
Broadcast.get_averages
def get_averages(self): """Get the broadcast network averages for that day. Returns a dictionary: key: network name value: sub-dictionary with 'viewers', 'rating', and 'share' as keys """ networks = [unescape_html(n.string) for n in self.soup.find_all('td', width='77')] ...
python
def get_averages(self): """Get the broadcast network averages for that day. Returns a dictionary: key: network name value: sub-dictionary with 'viewers', 'rating', and 'share' as keys """ networks = [unescape_html(n.string) for n in self.soup.find_all('td', width='77')] ...
[ "def", "get_averages", "(", "self", ")", ":", "networks", "=", "[", "unescape_html", "(", "n", ".", "string", ")", "for", "n", "in", "self", ".", "soup", ".", "find_all", "(", "'td'", ",", "width", "=", "'77'", ")", "]", "table", "=", "self", ".", ...
Get the broadcast network averages for that day. Returns a dictionary: key: network name value: sub-dictionary with 'viewers', 'rating', and 'share' as keys
[ "Get", "the", "broadcast", "network", "averages", "for", "that", "day", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L427-L449
38,566
sharibarboza/py_zap
py_zap/py_zap.py
Broadcast._get_net
def _get_net(self, entry): """Get the network for a specific row""" try: net = entry[1] return net[net.find('(')+1:net.find(')')] except IndexError: return None
python
def _get_net(self, entry): """Get the network for a specific row""" try: net = entry[1] return net[net.find('(')+1:net.find(')')] except IndexError: return None
[ "def", "_get_net", "(", "self", ",", "entry", ")", ":", "try", ":", "net", "=", "entry", "[", "1", "]", "return", "net", "[", "net", ".", "find", "(", "'('", ")", "+", "1", ":", "net", ".", "find", "(", "')'", ")", "]", "except", "IndexError", ...
Get the network for a specific row
[ "Get", "the", "network", "for", "a", "specific", "row" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L451-L457
38,567
sharibarboza/py_zap
py_zap/py_zap.py
Broadcast._get_rating
def _get_rating(self, entry): """Get the rating and share for a specific row""" r_info = '' for string in entry[2].strings: r_info += string rating, share = r_info.split('/') return (rating, share.strip('*'))
python
def _get_rating(self, entry): """Get the rating and share for a specific row""" r_info = '' for string in entry[2].strings: r_info += string rating, share = r_info.split('/') return (rating, share.strip('*'))
[ "def", "_get_rating", "(", "self", ",", "entry", ")", ":", "r_info", "=", "''", "for", "string", "in", "entry", "[", "2", "]", ".", "strings", ":", "r_info", "+=", "string", "rating", ",", "share", "=", "r_info", ".", "split", "(", "'/'", ")", "ret...
Get the rating and share for a specific row
[ "Get", "the", "rating", "and", "share", "for", "a", "specific", "row" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/py_zap.py#L459-L465
38,568
standage/tag
tag/feature.py
Feature._visit
def _visit(self, L, marked, tempmarked): """ Sort features topologically. This recursive function uses depth-first search to find an ordering of the features in the feature graph that is sorted both topologically and with respect to genome coordinates. Implementation ba...
python
def _visit(self, L, marked, tempmarked): """ Sort features topologically. This recursive function uses depth-first search to find an ordering of the features in the feature graph that is sorted both topologically and with respect to genome coordinates. Implementation ba...
[ "def", "_visit", "(", "self", ",", "L", ",", "marked", ",", "tempmarked", ")", ":", "assert", "not", "self", ".", "is_pseudo", "if", "self", "in", "tempmarked", ":", "raise", "Exception", "(", "'feature graph is cyclic'", ")", "if", "self", "not", "in", ...
Sort features topologically. This recursive function uses depth-first search to find an ordering of the features in the feature graph that is sorted both topologically and with respect to genome coordinates. Implementation based on Wikipedia's description of the algorithm in Co...
[ "Sort", "features", "topologically", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L194-L228
38,569
standage/tag
tag/feature.py
Feature.add_child
def add_child(self, child, rangecheck=False): """Add a child feature to this feature.""" assert self.seqid == child.seqid, \ ( 'seqid mismatch for feature {} ({} vs {})'.format( self.fid, self.seqid, child.seqid ) ) if r...
python
def add_child(self, child, rangecheck=False): """Add a child feature to this feature.""" assert self.seqid == child.seqid, \ ( 'seqid mismatch for feature {} ({} vs {})'.format( self.fid, self.seqid, child.seqid ) ) if r...
[ "def", "add_child", "(", "self", ",", "child", ",", "rangecheck", "=", "False", ")", ":", "assert", "self", ".", "seqid", "==", "child", ".", "seqid", ",", "(", "'seqid mismatch for feature {} ({} vs {})'", ".", "format", "(", "self", ".", "fid", ",", "sel...
Add a child feature to this feature.
[ "Add", "a", "child", "feature", "to", "this", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L230-L249
38,570
standage/tag
tag/feature.py
Feature.pseudoify
def pseudoify(self): """ Derive a pseudo-feature parent from the given multi-feature. The provided multi-feature does not need to be the representative. The newly created pseudo-feature has the same seqid as the provided multi- feature, and spans its entire range. Otherwise, the...
python
def pseudoify(self): """ Derive a pseudo-feature parent from the given multi-feature. The provided multi-feature does not need to be the representative. The newly created pseudo-feature has the same seqid as the provided multi- feature, and spans its entire range. Otherwise, the...
[ "def", "pseudoify", "(", "self", ")", ":", "assert", "self", ".", "is_toplevel", "assert", "self", ".", "is_multi", "assert", "len", "(", "self", ".", "multi_rep", ".", "siblings", ")", ">", "0", "rep", "=", "self", ".", "multi_rep", "start", "=", "min...
Derive a pseudo-feature parent from the given multi-feature. The provided multi-feature does not need to be the representative. The newly created pseudo-feature has the same seqid as the provided multi- feature, and spans its entire range. Otherwise, the pseudo-feature is empty. It is u...
[ "Derive", "a", "pseudo", "-", "feature", "parent", "from", "the", "given", "multi", "-", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L255-L282
38,571
standage/tag
tag/feature.py
Feature.slug
def slug(self): """ A concise slug for this feature. Unlike the internal representation, which is 0-based half-open, the slug is a 1-based closed interval (a la GFF3). """ return '{:s}@{:s}[{:d}, {:d}]'.format(self.type, self.seqid, ...
python
def slug(self): """ A concise slug for this feature. Unlike the internal representation, which is 0-based half-open, the slug is a 1-based closed interval (a la GFF3). """ return '{:s}@{:s}[{:d}, {:d}]'.format(self.type, self.seqid, ...
[ "def", "slug", "(", "self", ")", ":", "return", "'{:s}@{:s}[{:d}, {:d}]'", ".", "format", "(", "self", ".", "type", ",", "self", ".", "seqid", ",", "self", ".", "start", "+", "1", ",", "self", ".", "end", ")" ]
A concise slug for this feature. Unlike the internal representation, which is 0-based half-open, the slug is a 1-based closed interval (a la GFF3).
[ "A", "concise", "slug", "for", "this", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L299-L307
38,572
standage/tag
tag/feature.py
Feature.add_sibling
def add_sibling(self, sibling): """ Designate this a multi-feature representative and add a co-feature. Some features exist discontinuously on the sequence, and therefore cannot be declared with a single GFF3 entry (which can encode only a single interval). The canonical encodin...
python
def add_sibling(self, sibling): """ Designate this a multi-feature representative and add a co-feature. Some features exist discontinuously on the sequence, and therefore cannot be declared with a single GFF3 entry (which can encode only a single interval). The canonical encodin...
[ "def", "add_sibling", "(", "self", ",", "sibling", ")", ":", "assert", "self", ".", "is_pseudo", "is", "False", "if", "self", ".", "siblings", "is", "None", ":", "self", ".", "siblings", "=", "list", "(", ")", "self", ".", "multi_rep", "=", "self", "...
Designate this a multi-feature representative and add a co-feature. Some features exist discontinuously on the sequence, and therefore cannot be declared with a single GFF3 entry (which can encode only a single interval). The canonical encoding for these types of features is called a mu...
[ "Designate", "this", "a", "multi", "-", "feature", "representative", "and", "add", "a", "co", "-", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L319-L343
38,573
standage/tag
tag/feature.py
Feature.source
def source(self, newsource): """When modifying source, also update children with matching source.""" oldsource = self.source for feature in self: if feature.source == oldsource: feature._source = newsource
python
def source(self, newsource): """When modifying source, also update children with matching source.""" oldsource = self.source for feature in self: if feature.source == oldsource: feature._source = newsource
[ "def", "source", "(", "self", ",", "newsource", ")", ":", "oldsource", "=", "self", ".", "source", "for", "feature", "in", "self", ":", "if", "feature", ".", "source", "==", "oldsource", ":", "feature", ".", "_source", "=", "newsource" ]
When modifying source, also update children with matching source.
[ "When", "modifying", "source", "also", "update", "children", "with", "matching", "source", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L360-L365
38,574
standage/tag
tag/feature.py
Feature.type
def type(self, newtype): """If the feature is a multifeature, update all entries.""" self._type = newtype if self.is_multi: for sibling in self.multi_rep.siblings: sibling._type = newtype
python
def type(self, newtype): """If the feature is a multifeature, update all entries.""" self._type = newtype if self.is_multi: for sibling in self.multi_rep.siblings: sibling._type = newtype
[ "def", "type", "(", "self", ",", "newtype", ")", ":", "self", ".", "_type", "=", "newtype", "if", "self", ".", "is_multi", ":", "for", "sibling", "in", "self", ".", "multi_rep", ".", "siblings", ":", "sibling", ".", "_type", "=", "newtype" ]
If the feature is a multifeature, update all entries.
[ "If", "the", "feature", "is", "a", "multifeature", "update", "all", "entries", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L374-L379
38,575
standage/tag
tag/feature.py
Feature.transform
def transform(self, offset, newseqid=None): """Transform the feature's coordinates by the given offset.""" for feature in self: feature._range.transform(offset) if newseqid is not None: feature.seqid = newseqid
python
def transform(self, offset, newseqid=None): """Transform the feature's coordinates by the given offset.""" for feature in self: feature._range.transform(offset) if newseqid is not None: feature.seqid = newseqid
[ "def", "transform", "(", "self", ",", "offset", ",", "newseqid", "=", "None", ")", ":", "for", "feature", "in", "self", ":", "feature", ".", "_range", ".", "transform", "(", "offset", ")", "if", "newseqid", "is", "not", "None", ":", "feature", ".", "...
Transform the feature's coordinates by the given offset.
[ "Transform", "the", "feature", "s", "coordinates", "by", "the", "given", "offset", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L393-L398
38,576
standage/tag
tag/feature.py
Feature.add_attribute
def add_attribute(self, attrkey, attrvalue, append=False, oldvalue=None): """ Add an attribute to this feature. Feature attributes are stored as nested dictionaries. Each feature can only have one ID, so ID attribute mapping is 'string' to 'string'. All other attributes can hav...
python
def add_attribute(self, attrkey, attrvalue, append=False, oldvalue=None): """ Add an attribute to this feature. Feature attributes are stored as nested dictionaries. Each feature can only have one ID, so ID attribute mapping is 'string' to 'string'. All other attributes can hav...
[ "def", "add_attribute", "(", "self", ",", "attrkey", ",", "attrvalue", ",", "append", "=", "False", ",", "oldvalue", "=", "None", ")", ":", "# Handle ID/Parent relationships", "if", "attrkey", "==", "'ID'", ":", "if", "self", ".", "children", "is", "not", ...
Add an attribute to this feature. Feature attributes are stored as nested dictionaries. Each feature can only have one ID, so ID attribute mapping is 'string' to 'string'. All other attributes can have multiple values, so mapping is 'string' to 'dict of strings'. By default, a...
[ "Add", "an", "attribute", "to", "this", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L425-L466
38,577
standage/tag
tag/feature.py
Feature.get_attribute
def get_attribute(self, attrkey, as_string=False, as_list=False): """ Get the value of an attribute. By default, returns a string for ID and attributes with a single value, and a list of strings for attributes with multiple values. The `as_string` and `as_list` options can be us...
python
def get_attribute(self, attrkey, as_string=False, as_list=False): """ Get the value of an attribute. By default, returns a string for ID and attributes with a single value, and a list of strings for attributes with multiple values. The `as_string` and `as_list` options can be us...
[ "def", "get_attribute", "(", "self", ",", "attrkey", ",", "as_string", "=", "False", ",", "as_list", "=", "False", ")", ":", "assert", "not", "as_string", "or", "not", "as_list", "if", "attrkey", "not", "in", "self", ".", "_attrs", ":", "return", "None",...
Get the value of an attribute. By default, returns a string for ID and attributes with a single value, and a list of strings for attributes with multiple values. The `as_string` and `as_list` options can be used to force the function to return values as a string (comma-separated in case...
[ "Get", "the", "value", "of", "an", "attribute", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L468-L489
38,578
standage/tag
tag/feature.py
Feature.parse_attributes
def parse_attributes(self, attrstring): """ Parse an attribute string. Given a string with semicolon-separated key-value pairs, populate a dictionary with the given attributes. """ if attrstring in [None, '', '.']: return dict() attributes = dict() ...
python
def parse_attributes(self, attrstring): """ Parse an attribute string. Given a string with semicolon-separated key-value pairs, populate a dictionary with the given attributes. """ if attrstring in [None, '', '.']: return dict() attributes = dict() ...
[ "def", "parse_attributes", "(", "self", ",", "attrstring", ")", ":", "if", "attrstring", "in", "[", "None", ",", "''", ",", "'.'", "]", ":", "return", "dict", "(", ")", "attributes", "=", "dict", "(", ")", "keyvaluepairs", "=", "attrstring", ".", "spli...
Parse an attribute string. Given a string with semicolon-separated key-value pairs, populate a dictionary with the given attributes.
[ "Parse", "an", "attribute", "string", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L500-L523
38,579
standage/tag
tag/feature.py
Feature.attribute_crawl
def attribute_crawl(self, key): """ Grab all attribute values associated with the given feature. Traverse the given feature (and all of its descendants) to find all values associated with the given attribute key. >>> import tag >>> reader = tag.GFF3Reader(tag.pkgdata('o...
python
def attribute_crawl(self, key): """ Grab all attribute values associated with the given feature. Traverse the given feature (and all of its descendants) to find all values associated with the given attribute key. >>> import tag >>> reader = tag.GFF3Reader(tag.pkgdata('o...
[ "def", "attribute_crawl", "(", "self", ",", "key", ")", ":", "union", "=", "set", "(", ")", "for", "feature", "in", "self", ":", "values", "=", "feature", ".", "get_attribute", "(", "key", ",", "as_list", "=", "True", ")", "if", "values", "is", "not"...
Grab all attribute values associated with the given feature. Traverse the given feature (and all of its descendants) to find all values associated with the given attribute key. >>> import tag >>> reader = tag.GFF3Reader(tag.pkgdata('otau-no-seqreg.gff3')) >>> features = tag.sel...
[ "Grab", "all", "attribute", "values", "associated", "with", "the", "given", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L525-L550
38,580
standage/tag
tag/feature.py
Feature.ncbi_geneid
def ncbi_geneid(self): """ Retrieve this feature's NCBI GeneID if it's present. NCBI GFF3 files contain gene IDs encoded in **Dbxref** attributes (example: `Dbxref=GeneID:103504972`). This function locates and returns the GeneID if present, or returns `None` otherwise. "...
python
def ncbi_geneid(self): """ Retrieve this feature's NCBI GeneID if it's present. NCBI GFF3 files contain gene IDs encoded in **Dbxref** attributes (example: `Dbxref=GeneID:103504972`). This function locates and returns the GeneID if present, or returns `None` otherwise. "...
[ "def", "ncbi_geneid", "(", "self", ")", ":", "values", "=", "self", ".", "get_attribute", "(", "'Dbxref'", ",", "as_list", "=", "True", ")", "if", "values", "is", "None", ":", "return", "None", "for", "value", "in", "values", ":", "if", "value", ".", ...
Retrieve this feature's NCBI GeneID if it's present. NCBI GFF3 files contain gene IDs encoded in **Dbxref** attributes (example: `Dbxref=GeneID:103504972`). This function locates and returns the GeneID if present, or returns `None` otherwise.
[ "Retrieve", "this", "feature", "s", "NCBI", "GeneID", "if", "it", "s", "present", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L553-L568
38,581
standage/tag
tag/feature.py
Feature.cdslen
def cdslen(self): """ Translated length of this feature. Undefined for non-mRNA features. """ if self.type != 'mRNA': return None return sum([len(c) for c in self.children if c.type == 'CDS'])
python
def cdslen(self): """ Translated length of this feature. Undefined for non-mRNA features. """ if self.type != 'mRNA': return None return sum([len(c) for c in self.children if c.type == 'CDS'])
[ "def", "cdslen", "(", "self", ")", ":", "if", "self", ".", "type", "!=", "'mRNA'", ":", "return", "None", "return", "sum", "(", "[", "len", "(", "c", ")", "for", "c", "in", "self", ".", "children", "if", "c", ".", "type", "==", "'CDS'", "]", ")...
Translated length of this feature. Undefined for non-mRNA features.
[ "Translated", "length", "of", "this", "feature", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L571-L580
38,582
BrianHicks/emit
examples/regex/graph.py
parse_querystring
def parse_querystring(msg): 'parse a querystring into keys and values' for part in msg.querystring.strip().lstrip('?').split('&'): key, value = part.split('=') yield key, value
python
def parse_querystring(msg): 'parse a querystring into keys and values' for part in msg.querystring.strip().lstrip('?').split('&'): key, value = part.split('=') yield key, value
[ "def", "parse_querystring", "(", "msg", ")", ":", "for", "part", "in", "msg", ".", "querystring", ".", "strip", "(", ")", ".", "lstrip", "(", "'?'", ")", ".", "split", "(", "'&'", ")", ":", "key", ",", "value", "=", "part", ".", "split", "(", "'=...
parse a querystring into keys and values
[ "parse", "a", "querystring", "into", "keys", "and", "values" ]
19a86c2392b136c9e857000798ccaa525aa0ed84
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/examples/regex/graph.py#L14-L18
38,583
MostAwesomeDude/gentleman
gentleman/base.py
AddClusterTags
def AddClusterTags(r, tags, dry_run=False): """ Adds tags to the cluster. @type tags: list of str @param tags: tags to add to the cluster @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @return: job id """ query = { "dry-run": dry_run, ...
python
def AddClusterTags(r, tags, dry_run=False): """ Adds tags to the cluster. @type tags: list of str @param tags: tags to add to the cluster @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @return: job id """ query = { "dry-run": dry_run, ...
[ "def", "AddClusterTags", "(", "r", ",", "tags", ",", "dry_run", "=", "False", ")", ":", "query", "=", "{", "\"dry-run\"", ":", "dry_run", ",", "\"tag\"", ":", "tags", ",", "}", "return", "r", ".", "request", "(", "\"put\"", ",", "\"/2/tags\"", ",", "...
Adds tags to the cluster. @type tags: list of str @param tags: tags to add to the cluster @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @return: job id
[ "Adds", "tags", "to", "the", "cluster", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L113-L131
38,584
MostAwesomeDude/gentleman
gentleman/base.py
DeleteClusterTags
def DeleteClusterTags(r, tags, dry_run=False): """ Deletes tags from the cluster. @type tags: list of str @param tags: tags to delete @type dry_run: bool @param dry_run: whether to perform a dry run """ query = { "dry-run": dry_run, "tag": tags, } return r.requ...
python
def DeleteClusterTags(r, tags, dry_run=False): """ Deletes tags from the cluster. @type tags: list of str @param tags: tags to delete @type dry_run: bool @param dry_run: whether to perform a dry run """ query = { "dry-run": dry_run, "tag": tags, } return r.requ...
[ "def", "DeleteClusterTags", "(", "r", ",", "tags", ",", "dry_run", "=", "False", ")", ":", "query", "=", "{", "\"dry-run\"", ":", "dry_run", ",", "\"tag\"", ":", "tags", ",", "}", "return", "r", ".", "request", "(", "\"delete\"", ",", "\"/2/tags\"", ",...
Deletes tags from the cluster. @type tags: list of str @param tags: tags to delete @type dry_run: bool @param dry_run: whether to perform a dry run
[ "Deletes", "tags", "from", "the", "cluster", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L134-L149
38,585
MostAwesomeDude/gentleman
gentleman/base.py
GetInstances
def GetInstances(r, bulk=False): """ Gets information about instances on the cluster. @type bulk: bool @param bulk: whether to return all information about all instances @rtype: list of dict or list of str @return: if bulk is True, info about the instances, else a list of instances """ ...
python
def GetInstances(r, bulk=False): """ Gets information about instances on the cluster. @type bulk: bool @param bulk: whether to return all information about all instances @rtype: list of dict or list of str @return: if bulk is True, info about the instances, else a list of instances """ ...
[ "def", "GetInstances", "(", "r", ",", "bulk", "=", "False", ")", ":", "if", "bulk", ":", "return", "r", ".", "request", "(", "\"get\"", ",", "\"/2/instances\"", ",", "query", "=", "{", "\"bulk\"", ":", "1", "}", ")", "else", ":", "instances", "=", ...
Gets information about instances on the cluster. @type bulk: bool @param bulk: whether to return all information about all instances @rtype: list of dict or list of str @return: if bulk is True, info about the instances, else a list of instances
[ "Gets", "information", "about", "instances", "on", "the", "cluster", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L152-L167
38,586
MostAwesomeDude/gentleman
gentleman/base.py
GetInstanceInfo
def GetInstanceInfo(r, instance, static=None): """ Gets information about an instance. @type instance: string @param instance: Instance name @rtype: string @return: Job ID """ if static is None: return r.request("get", "/2/instances/%s/info" % instance) else: return...
python
def GetInstanceInfo(r, instance, static=None): """ Gets information about an instance. @type instance: string @param instance: Instance name @rtype: string @return: Job ID """ if static is None: return r.request("get", "/2/instances/%s/info" % instance) else: return...
[ "def", "GetInstanceInfo", "(", "r", ",", "instance", ",", "static", "=", "None", ")", ":", "if", "static", "is", "None", ":", "return", "r", ".", "request", "(", "\"get\"", ",", "\"/2/instances/%s/info\"", "%", "instance", ")", "else", ":", "return", "r"...
Gets information about an instance. @type instance: string @param instance: Instance name @rtype: string @return: Job ID
[ "Gets", "information", "about", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L184-L198
38,587
MostAwesomeDude/gentleman
gentleman/base.py
DeleteInstance
def DeleteInstance(r, instance, dry_run=False): """ Deletes an instance. @type instance: str @param instance: the instance to delete @rtype: int @return: job id """ return r.request("delete", "/2/instances/%s" % instance, query={"dry-run": dry_run})
python
def DeleteInstance(r, instance, dry_run=False): """ Deletes an instance. @type instance: str @param instance: the instance to delete @rtype: int @return: job id """ return r.request("delete", "/2/instances/%s" % instance, query={"dry-run": dry_run})
[ "def", "DeleteInstance", "(", "r", ",", "instance", ",", "dry_run", "=", "False", ")", ":", "return", "r", ".", "request", "(", "\"delete\"", ",", "\"/2/instances/%s\"", "%", "instance", ",", "query", "=", "{", "\"dry-run\"", ":", "dry_run", "}", ")" ]
Deletes an instance. @type instance: str @param instance: the instance to delete @rtype: int @return: job id
[ "Deletes", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L259-L271
38,588
MostAwesomeDude/gentleman
gentleman/base.py
ActivateInstanceDisks
def ActivateInstanceDisks(r, instance, ignore_size=False): """ Activates an instance's disks. @type instance: string @param instance: Instance name @type ignore_size: bool @param ignore_size: Whether to ignore recorded size @return: job id """ return r.request("put", "/2/instances/...
python
def ActivateInstanceDisks(r, instance, ignore_size=False): """ Activates an instance's disks. @type instance: string @param instance: Instance name @type ignore_size: bool @param ignore_size: Whether to ignore recorded size @return: job id """ return r.request("put", "/2/instances/...
[ "def", "ActivateInstanceDisks", "(", "r", ",", "instance", ",", "ignore_size", "=", "False", ")", ":", "return", "r", ".", "request", "(", "\"put\"", ",", "\"/2/instances/%s/activate-disks\"", "%", "instance", ",", "query", "=", "{", "\"ignore_size\"", ":", "i...
Activates an instance's disks. @type instance: string @param instance: Instance name @type ignore_size: bool @param ignore_size: Whether to ignore recorded size @return: job id
[ "Activates", "an", "instance", "s", "disks", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L290-L302
38,589
MostAwesomeDude/gentleman
gentleman/base.py
RecreateInstanceDisks
def RecreateInstanceDisks(r, instance, disks=None, nodes=None): """Recreate an instance's disks. @type instance: string @param instance: Instance name @type disks: list of int @param disks: List of disk indexes @type nodes: list of string @param nodes: New instance nodes, if relocation is d...
python
def RecreateInstanceDisks(r, instance, disks=None, nodes=None): """Recreate an instance's disks. @type instance: string @param instance: Instance name @type disks: list of int @param disks: List of disk indexes @type nodes: list of string @param nodes: New instance nodes, if relocation is d...
[ "def", "RecreateInstanceDisks", "(", "r", ",", "instance", ",", "disks", "=", "None", ",", "nodes", "=", "None", ")", ":", "body", "=", "{", "}", "if", "disks", "is", "not", "None", ":", "body", "[", "\"disks\"", "]", "=", "disks", "if", "nodes", "...
Recreate an instance's disks. @type instance: string @param instance: Instance name @type disks: list of int @param disks: List of disk indexes @type nodes: list of string @param nodes: New instance nodes, if relocation is desired @rtype: string @return: job id
[ "Recreate", "an", "instance", "s", "disks", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L317-L338
38,590
MostAwesomeDude/gentleman
gentleman/base.py
GrowInstanceDisk
def GrowInstanceDisk(r, instance, disk, amount, wait_for_sync=False): """ Grows a disk of an instance. More details for parameters can be found in the RAPI documentation. @type instance: string @param instance: Instance name @type disk: integer @param disk: Disk index @type amount: int...
python
def GrowInstanceDisk(r, instance, disk, amount, wait_for_sync=False): """ Grows a disk of an instance. More details for parameters can be found in the RAPI documentation. @type instance: string @param instance: Instance name @type disk: integer @param disk: Disk index @type amount: int...
[ "def", "GrowInstanceDisk", "(", "r", ",", "instance", ",", "disk", ",", "amount", ",", "wait_for_sync", "=", "False", ")", ":", "body", "=", "{", "\"amount\"", ":", "amount", ",", "\"wait_for_sync\"", ":", "wait_for_sync", ",", "}", "return", "r", ".", "...
Grows a disk of an instance. More details for parameters can be found in the RAPI documentation. @type instance: string @param instance: Instance name @type disk: integer @param disk: Disk index @type amount: integer @param amount: Grow disk by this amount (MiB) @type wait_for_sync: bo...
[ "Grows", "a", "disk", "of", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L341-L365
38,591
MostAwesomeDude/gentleman
gentleman/base.py
AddInstanceTags
def AddInstanceTags(r, instance, tags, dry_run=False): """ Adds tags to an instance. @type instance: str @param instance: instance to add tags to @type tags: list of str @param tags: tags to add to the instance @type dry_run: bool @param dry_run: whether to perform a dry run @rtype...
python
def AddInstanceTags(r, instance, tags, dry_run=False): """ Adds tags to an instance. @type instance: str @param instance: instance to add tags to @type tags: list of str @param tags: tags to add to the instance @type dry_run: bool @param dry_run: whether to perform a dry run @rtype...
[ "def", "AddInstanceTags", "(", "r", ",", "instance", ",", "tags", ",", "dry_run", "=", "False", ")", ":", "query", "=", "{", "\"tag\"", ":", "tags", ",", "\"dry-run\"", ":", "dry_run", ",", "}", "return", "r", ".", "request", "(", "\"put\"", ",", "\"...
Adds tags to an instance. @type instance: str @param instance: instance to add tags to @type tags: list of str @param tags: tags to add to the instance @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @return: job id
[ "Adds", "tags", "to", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L382-L402
38,592
MostAwesomeDude/gentleman
gentleman/base.py
DeleteInstanceTags
def DeleteInstanceTags(r, instance, tags, dry_run=False): """ Deletes tags from an instance. @type instance: str @param instance: instance to delete tags from @type tags: list of str @param tags: tags to delete @type dry_run: bool @param dry_run: whether to perform a dry run """ ...
python
def DeleteInstanceTags(r, instance, tags, dry_run=False): """ Deletes tags from an instance. @type instance: str @param instance: instance to delete tags from @type tags: list of str @param tags: tags to delete @type dry_run: bool @param dry_run: whether to perform a dry run """ ...
[ "def", "DeleteInstanceTags", "(", "r", ",", "instance", ",", "tags", ",", "dry_run", "=", "False", ")", ":", "query", "=", "{", "\"tag\"", ":", "tags", ",", "\"dry-run\"", ":", "dry_run", ",", "}", "return", "r", ".", "request", "(", "\"delete\"", ",",...
Deletes tags from an instance. @type instance: str @param instance: instance to delete tags from @type tags: list of str @param tags: tags to delete @type dry_run: bool @param dry_run: whether to perform a dry run
[ "Deletes", "tags", "from", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L405-L422
38,593
MostAwesomeDude/gentleman
gentleman/base.py
RebootInstance
def RebootInstance(r, instance, reboot_type=None, ignore_secondaries=False, dry_run=False): """ Reboots an instance. @type instance: str @param instance: instance to rebot @type reboot_type: str @param reboot_type: one of: hard, soft, full @type ignore_secondaries: bool ...
python
def RebootInstance(r, instance, reboot_type=None, ignore_secondaries=False, dry_run=False): """ Reboots an instance. @type instance: str @param instance: instance to rebot @type reboot_type: str @param reboot_type: one of: hard, soft, full @type ignore_secondaries: bool ...
[ "def", "RebootInstance", "(", "r", ",", "instance", ",", "reboot_type", "=", "None", ",", "ignore_secondaries", "=", "False", ",", "dry_run", "=", "False", ")", ":", "query", "=", "{", "\"ignore_secondaries\"", ":", "ignore_secondaries", ",", "\"dry-run\"", ":...
Reboots an instance. @type instance: str @param instance: instance to rebot @type reboot_type: str @param reboot_type: one of: hard, soft, full @type ignore_secondaries: bool @param ignore_secondaries: if True, ignores errors for the secondary node while re-assembling disks (in hard...
[ "Reboots", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L425-L452
38,594
MostAwesomeDude/gentleman
gentleman/base.py
ShutdownInstance
def ShutdownInstance(r, instance, dry_run=False, no_remember=False, timeout=120): """ Shuts down an instance. @type instance: str @param instance: the instance to shut down @type dry_run: bool @param dry_run: whether to perform a dry run @type no_remember: bool @par...
python
def ShutdownInstance(r, instance, dry_run=False, no_remember=False, timeout=120): """ Shuts down an instance. @type instance: str @param instance: the instance to shut down @type dry_run: bool @param dry_run: whether to perform a dry run @type no_remember: bool @par...
[ "def", "ShutdownInstance", "(", "r", ",", "instance", ",", "dry_run", "=", "False", ",", "no_remember", "=", "False", ",", "timeout", "=", "120", ")", ":", "query", "=", "{", "\"dry-run\"", ":", "dry_run", ",", "\"no-remember\"", ":", "no_remember", ",", ...
Shuts down an instance. @type instance: str @param instance: the instance to shut down @type dry_run: bool @param dry_run: whether to perform a dry run @type no_remember: bool @param no_remember: if true, will not record the state change @rtype: string @return: job id
[ "Shuts", "down", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L455-L480
38,595
MostAwesomeDude/gentleman
gentleman/base.py
StartupInstance
def StartupInstance(r, instance, dry_run=False, no_remember=False): """ Starts up an instance. @type instance: str @param instance: the instance to start up @type dry_run: bool @param dry_run: whether to perform a dry run @type no_remember: bool @param no_remember: if true, will not rec...
python
def StartupInstance(r, instance, dry_run=False, no_remember=False): """ Starts up an instance. @type instance: str @param instance: the instance to start up @type dry_run: bool @param dry_run: whether to perform a dry run @type no_remember: bool @param no_remember: if true, will not rec...
[ "def", "StartupInstance", "(", "r", ",", "instance", ",", "dry_run", "=", "False", ",", "no_remember", "=", "False", ")", ":", "query", "=", "{", "\"dry-run\"", ":", "dry_run", ",", "\"no-remember\"", ":", "no_remember", ",", "}", "return", "r", ".", "re...
Starts up an instance. @type instance: str @param instance: the instance to start up @type dry_run: bool @param dry_run: whether to perform a dry run @type no_remember: bool @param no_remember: if true, will not record the state change @rtype: string @return: job id
[ "Starts", "up", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L483-L502
38,596
MostAwesomeDude/gentleman
gentleman/base.py
ReinstallInstance
def ReinstallInstance(r, instance, os=None, no_startup=False, osparams=None): """ Reinstalls an instance. @type instance: str @param instance: The instance to reinstall @type os: str or None @param os: The operating system to reinstall. If None, the instance's current operating syst...
python
def ReinstallInstance(r, instance, os=None, no_startup=False, osparams=None): """ Reinstalls an instance. @type instance: str @param instance: The instance to reinstall @type os: str or None @param os: The operating system to reinstall. If None, the instance's current operating syst...
[ "def", "ReinstallInstance", "(", "r", ",", "instance", ",", "os", "=", "None", ",", "no_startup", "=", "False", ",", "osparams", "=", "None", ")", ":", "if", "INST_REINSTALL_REQV1", "in", "r", ".", "features", ":", "body", "=", "{", "\"start\"", ":", "...
Reinstalls an instance. @type instance: str @param instance: The instance to reinstall @type os: str or None @param os: The operating system to reinstall. If None, the instance's current operating system will be installed again @type no_startup: bool @param no_startup: Whether to st...
[ "Reinstalls", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L505-L542
38,597
MostAwesomeDude/gentleman
gentleman/base.py
ReplaceInstanceDisks
def ReplaceInstanceDisks(r, instance, disks=None, mode=REPLACE_DISK_AUTO, remote_node=None, iallocator=None, dry_run=False): """ Replaces disks on an instance. @type instance: str @param instance: instance whose disks to replace @type disks: list of ints @param disks: I...
python
def ReplaceInstanceDisks(r, instance, disks=None, mode=REPLACE_DISK_AUTO, remote_node=None, iallocator=None, dry_run=False): """ Replaces disks on an instance. @type instance: str @param instance: instance whose disks to replace @type disks: list of ints @param disks: I...
[ "def", "ReplaceInstanceDisks", "(", "r", ",", "instance", ",", "disks", "=", "None", ",", "mode", "=", "REPLACE_DISK_AUTO", ",", "remote_node", "=", "None", ",", "iallocator", "=", "None", ",", "dry_run", "=", "False", ")", ":", "if", "mode", "not", "in"...
Replaces disks on an instance. @type instance: str @param instance: instance whose disks to replace @type disks: list of ints @param disks: Indexes of disks to replace @type mode: str @param mode: replacement mode to use (defaults to replace_auto) @type remote_node: str or None @param r...
[ "Replaces", "disks", "on", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L545-L588
38,598
MostAwesomeDude/gentleman
gentleman/base.py
ExportInstance
def ExportInstance(r, instance, mode, destination, shutdown=None, remove_instance=None, x509_key_name=None, destination_x509_ca=None): """ Exports an instance. @type instance: string @param instance: Instance name @type mode: string @param mode: Export mode...
python
def ExportInstance(r, instance, mode, destination, shutdown=None, remove_instance=None, x509_key_name=None, destination_x509_ca=None): """ Exports an instance. @type instance: string @param instance: Instance name @type mode: string @param mode: Export mode...
[ "def", "ExportInstance", "(", "r", ",", "instance", ",", "mode", ",", "destination", ",", "shutdown", "=", "None", ",", "remove_instance", "=", "None", ",", "x509_key_name", "=", "None", ",", "destination_x509_ca", "=", "None", ")", ":", "body", "=", "{", ...
Exports an instance. @type instance: string @param instance: Instance name @type mode: string @param mode: Export mode @rtype: string @return: Job ID
[ "Exports", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L607-L638
38,599
MostAwesomeDude/gentleman
gentleman/base.py
MigrateInstance
def MigrateInstance(r, instance, mode=None, cleanup=None): """ Migrates an instance. @type instance: string @param instance: Instance name @type mode: string @param mode: Migration mode @type cleanup: bool @param cleanup: Whether to clean up a previously failed migration """ bo...
python
def MigrateInstance(r, instance, mode=None, cleanup=None): """ Migrates an instance. @type instance: string @param instance: Instance name @type mode: string @param mode: Migration mode @type cleanup: bool @param cleanup: Whether to clean up a previously failed migration """ bo...
[ "def", "MigrateInstance", "(", "r", ",", "instance", ",", "mode", "=", "None", ",", "cleanup", "=", "None", ")", ":", "body", "=", "{", "}", "if", "mode", "is", "not", "None", ":", "body", "[", "\"mode\"", "]", "=", "mode", "if", "cleanup", "is", ...
Migrates an instance. @type instance: string @param instance: Instance name @type mode: string @param mode: Migration mode @type cleanup: bool @param cleanup: Whether to clean up a previously failed migration
[ "Migrates", "an", "instance", "." ]
17fb8ffb922aa4af9d8bcab85e452c9311d41805
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L641-L662