partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
RcaApp.get_ball_by_ball
match_key: key of the match over_key : key of the over Return: json data:
src/pycricket.py
def get_ball_by_ball(self, match_key, over_key=None): """ match_key: key of the match over_key : key of the over Return: json data: """ if over_key: ball_by_ball_url = "{base_path}match/{match_key}/balls/{over_key}/".format(base_path=self....
def get_ball_by_ball(self, match_key, over_key=None): """ match_key: key of the match over_key : key of the over Return: json data: """ if over_key: ball_by_ball_url = "{base_path}match/{match_key}/balls/{over_key}/".format(base_path=self....
[ "match_key", ":", "key", "of", "the", "match", "over_key", ":", "key", "of", "the", "over", "Return", ":", "json", "data", ":" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L219-L233
[ "def", "get_ball_by_ball", "(", "self", ",", "match_key", ",", "over_key", "=", "None", ")", ":", "if", "over_key", ":", "ball_by_ball_url", "=", "\"{base_path}match/{match_key}/balls/{over_key}/\"", ".", "format", "(", "base_path", "=", "self", ".", "api_path", "...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_recent_season_matches
Calling specific season recent matches. Arg: season_key: key of the season. Return: json date
src/pycricket.py
def get_recent_season_matches(self, season_key): """ Calling specific season recent matches. Arg: season_key: key of the season. Return: json date """ season_recent_matches_url = self.api_path + "season/" + season_key + "/recent_matches/" r...
def get_recent_season_matches(self, season_key): """ Calling specific season recent matches. Arg: season_key: key of the season. Return: json date """ season_recent_matches_url = self.api_path + "season/" + season_key + "/recent_matches/" r...
[ "Calling", "specific", "season", "recent", "matches", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L235-L247
[ "def", "get_recent_season_matches", "(", "self", ",", "season_key", ")", ":", "season_recent_matches_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/recent_matches/\"", "response", "=", "self", ".", "get_response", "(", "season_re...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_recent_seasons
Calling the Recent Season API. Return: json data
src/pycricket.py
def get_recent_seasons(self): """ Calling the Recent Season API. Return: json data """ recent_seasons_url = self.api_path + "recent_seasons/" response = self.get_response(recent_seasons_url) return response
def get_recent_seasons(self): """ Calling the Recent Season API. Return: json data """ recent_seasons_url = self.api_path + "recent_seasons/" response = self.get_response(recent_seasons_url) return response
[ "Calling", "the", "Recent", "Season", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L249-L259
[ "def", "get_recent_seasons", "(", "self", ")", ":", "recent_seasons_url", "=", "self", ".", "api_path", "+", "\"recent_seasons/\"", "response", "=", "self", ".", "get_response", "(", "recent_seasons_url", ")", "return", "response" ]
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_schedule
Calling the Schedule API. Return: json data
src/pycricket.py
def get_schedule(self, date=None): """ Calling the Schedule API. Return: json data """ schedule_url = self.api_path + "schedule/" params = {} if date: params['date'] = date response = self.get_response(schedule_url, params) ...
def get_schedule(self, date=None): """ Calling the Schedule API. Return: json data """ schedule_url = self.api_path + "schedule/" params = {} if date: params['date'] = date response = self.get_response(schedule_url, params) ...
[ "Calling", "the", "Schedule", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L261-L274
[ "def", "get_schedule", "(", "self", ",", "date", "=", "None", ")", ":", "schedule_url", "=", "self", ".", "api_path", "+", "\"schedule/\"", "params", "=", "{", "}", "if", "date", ":", "params", "[", "'date'", "]", "=", "date", "response", "=", "self", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_season_schedule
Calling specific season schedule Arg: season_key: key of the season Return: json data
src/pycricket.py
def get_season_schedule(self, season_key): """ Calling specific season schedule Arg: season_key: key of the season Return: json data """ schedule_url = self.api_path + "season/" + season_key + "/schedule/" response = self.get_response(sched...
def get_season_schedule(self, season_key): """ Calling specific season schedule Arg: season_key: key of the season Return: json data """ schedule_url = self.api_path + "season/" + season_key + "/schedule/" response = self.get_response(sched...
[ "Calling", "specific", "season", "schedule" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L276-L288
[ "def", "get_season_schedule", "(", "self", ",", "season_key", ")", ":", "schedule_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/schedule/\"", "response", "=", "self", ".", "get_response", "(", "schedule_url", ")", "return", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_season
Calling Season API. Arg: season_key: key of the season card_type: optional, default to micro_card. Accepted values are micro_card & summary_card Return: json data
src/pycricket.py
def get_season(self, season_key, card_type="micro_card"): """ Calling Season API. Arg: season_key: key of the season card_type: optional, default to micro_card. Accepted values are micro_card & summary_card Return: json data """ ...
def get_season(self, season_key, card_type="micro_card"): """ Calling Season API. Arg: season_key: key of the season card_type: optional, default to micro_card. Accepted values are micro_card & summary_card Return: json data """ ...
[ "Calling", "Season", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L290-L306
[ "def", "get_season", "(", "self", ",", "season_key", ",", "card_type", "=", "\"micro_card\"", ")", ":", "season_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/\"", "params", "=", "{", "}", "params", "[", "\"card_type\"", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_season_stats
Calling Season Stats API. Arg: season_key: key of the season Return: json data
src/pycricket.py
def get_season_stats(self, season_key): """ Calling Season Stats API. Arg: season_key: key of the season Return: json data """ season_stats_url = self.api_path + "season/" + season_key + "/stats/" response = self.get_response(season_stats_u...
def get_season_stats(self, season_key): """ Calling Season Stats API. Arg: season_key: key of the season Return: json data """ season_stats_url = self.api_path + "season/" + season_key + "/stats/" response = self.get_response(season_stats_u...
[ "Calling", "Season", "Stats", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L308-L320
[ "def", "get_season_stats", "(", "self", ",", "season_key", ")", ":", "season_stats_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/stats/\"", "response", "=", "self", ".", "get_response", "(", "season_stats_url", ")", "return"...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_season_team
Calling Season teams API Arg: season_key: key of the season Return: json data
src/pycricket.py
def get_season_team(self, season_key, season_team_key,stats_type=None): """ Calling Season teams API Arg: season_key: key of the season Return: json data """ params = {"stats_type": stats_type} season_team_url = self.api_path + 'season/' +...
def get_season_team(self, season_key, season_team_key,stats_type=None): """ Calling Season teams API Arg: season_key: key of the season Return: json data """ params = {"stats_type": stats_type} season_team_url = self.api_path + 'season/' +...
[ "Calling", "Season", "teams", "API" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L322-L334
[ "def", "get_season_team", "(", "self", ",", "season_key", ",", "season_team_key", ",", "stats_type", "=", "None", ")", ":", "params", "=", "{", "\"stats_type\"", ":", "stats_type", "}", "season_team_url", "=", "self", ".", "api_path", "+", "'season/'", "+", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_season_points
Calling Season Points API. Arg: season_key: key of the season Return: json data
src/pycricket.py
def get_season_points(self, season_key): """ Calling Season Points API. Arg: season_key: key of the season Return: json data """ season_points_url = self.api_path + "season/" + season_key + "/points/" response = self.get_response(season_poi...
def get_season_points(self, season_key): """ Calling Season Points API. Arg: season_key: key of the season Return: json data """ season_points_url = self.api_path + "season/" + season_key + "/points/" response = self.get_response(season_poi...
[ "Calling", "Season", "Points", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L336-L348
[ "def", "get_season_points", "(", "self", ",", "season_key", ")", ":", "season_points_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/points/\"", "response", "=", "self", ".", "get_response", "(", "season_points_url", ")", "ret...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_season_player_stats
Calling Season Player Stats API. Arg: season_key: key of the season player_key: key of the player Return: json data
src/pycricket.py
def get_season_player_stats(self, season_key, player_key): """ Calling Season Player Stats API. Arg: season_key: key of the season player_key: key of the player Return: json data """ season_player_stats_url = self.api_path + "season/" + ...
def get_season_player_stats(self, season_key, player_key): """ Calling Season Player Stats API. Arg: season_key: key of the season player_key: key of the player Return: json data """ season_player_stats_url = self.api_path + "season/" + ...
[ "Calling", "Season", "Player", "Stats", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L350-L363
[ "def", "get_season_player_stats", "(", "self", ",", "season_key", ",", "player_key", ")", ":", "season_player_stats_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/player/\"", "+", "player_key", "+", "\"/stats/\"", "response", "...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_overs_summary
Calling Overs Summary API Arg: match_key: key of the match Return: json data
src/pycricket.py
def get_overs_summary(self, match_key): """ Calling Overs Summary API Arg: match_key: key of the match Return: json data """ overs_summary_url = self.api_path + "match/" + match_key + "/overs_summary/" response = self.get_response(overs_summ...
def get_overs_summary(self, match_key): """ Calling Overs Summary API Arg: match_key: key of the match Return: json data """ overs_summary_url = self.api_path + "match/" + match_key + "/overs_summary/" response = self.get_response(overs_summ...
[ "Calling", "Overs", "Summary", "API" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L365-L376
[ "def", "get_overs_summary", "(", "self", ",", "match_key", ")", ":", "overs_summary_url", "=", "self", ".", "api_path", "+", "\"match/\"", "+", "match_key", "+", "\"/overs_summary/\"", "response", "=", "self", ".", "get_response", "(", "overs_summary_url", ")", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_news_aggregation
Calling News Aggregation API Return: json data
src/pycricket.py
def get_news_aggregation(self): """ Calling News Aggregation API Return: json data """ news_aggregation_url = self.api_path + "news_aggregation" + "/" response = self.get_response(news_aggregation_url) return response
def get_news_aggregation(self): """ Calling News Aggregation API Return: json data """ news_aggregation_url = self.api_path + "news_aggregation" + "/" response = self.get_response(news_aggregation_url) return response
[ "Calling", "News", "Aggregation", "API" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L378-L388
[ "def", "get_news_aggregation", "(", "self", ")", ":", "news_aggregation_url", "=", "self", ".", "api_path", "+", "\"news_aggregation\"", "+", "\"/\"", "response", "=", "self", ".", "get_response", "(", "news_aggregation_url", ")", "return", "response" ]
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_fantasy_credits
Calling Fantasy Credit API Arg: match_key: key of the match Return: json data
src/pycricket.py
def get_fantasy_credits(self, match_key): """ Calling Fantasy Credit API Arg: match_key: key of the match Return: json data """ fantasy_credit_url = self.api_path_v3 + "fantasy-match-credits/" + match_key + "/" response = self.get_respons...
def get_fantasy_credits(self, match_key): """ Calling Fantasy Credit API Arg: match_key: key of the match Return: json data """ fantasy_credit_url = self.api_path_v3 + "fantasy-match-credits/" + match_key + "/" response = self.get_respons...
[ "Calling", "Fantasy", "Credit", "API" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L390-L402
[ "def", "get_fantasy_credits", "(", "self", ",", "match_key", ")", ":", "fantasy_credit_url", "=", "self", ".", "api_path_v3", "+", "\"fantasy-match-credits/\"", "+", "match_key", "+", "\"/\"", "response", "=", "self", ".", "get_response", "(", "fantasy_credit_url", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_fantasy_points
Calling Fantasy Points API Arg: match_key: key of the match Return: json data
src/pycricket.py
def get_fantasy_points(self, match_key): """ Calling Fantasy Points API Arg: match_key: key of the match Return: json data """ fantasy_points_url = self.api_path_v3 + "fantasy-match-points/" + match_key + "/" response = self.get_response(...
def get_fantasy_points(self, match_key): """ Calling Fantasy Points API Arg: match_key: key of the match Return: json data """ fantasy_points_url = self.api_path_v3 + "fantasy-match-points/" + match_key + "/" response = self.get_response(...
[ "Calling", "Fantasy", "Points", "API" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L404-L416
[ "def", "get_fantasy_points", "(", "self", ",", "match_key", ")", ":", "fantasy_points_url", "=", "self", ".", "api_path_v3", "+", "\"fantasy-match-points/\"", "+", "match_key", "+", "\"/\"", "response", "=", "self", ".", "get_response", "(", "fantasy_points_url", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RedditPlugin.main
Generates an output string by replacing the keywords in the format string with the corresponding values from a submission dictionary.
i3situation/plugins/reddit.py
def main(self): """ Generates an output string by replacing the keywords in the format string with the corresponding values from a submission dictionary. """ self.manage_submissions() out_string = self.options['format'] # Pop until we get something which len(titl...
def main(self): """ Generates an output string by replacing the keywords in the format string with the corresponding values from a submission dictionary. """ self.manage_submissions() out_string = self.options['format'] # Pop until we get something which len(titl...
[ "Generates", "an", "output", "string", "by", "replacing", "the", "keywords", "in", "the", "format", "string", "with", "the", "corresponding", "values", "from", "a", "submission", "dictionary", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L66-L82
[ "def", "main", "(", "self", ")", ":", "self", ".", "manage_submissions", "(", ")", "out_string", "=", "self", ".", "options", "[", "'format'", "]", "# Pop until we get something which len(title) <= max-chars", "length", "=", "float", "(", "'inf'", ")", "while", ...
3160a21006fcc6961f240988874e228a5ec6f18e
train
RedditPlugin.login
Logs into Reddit in order to display a personalised front page.
i3situation/plugins/reddit.py
def login(self): """ Logs into Reddit in order to display a personalised front page. """ data = {'user': self.options['username'], 'passwd': self.options['password'], 'api_type': 'json'} response = self.client.post('http://www.reddit.com/api/login', data=data) ...
def login(self): """ Logs into Reddit in order to display a personalised front page. """ data = {'user': self.options['username'], 'passwd': self.options['password'], 'api_type': 'json'} response = self.client.post('http://www.reddit.com/api/login', data=data) ...
[ "Logs", "into", "Reddit", "in", "order", "to", "display", "a", "personalised", "front", "page", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L84-L91
[ "def", "login", "(", "self", ")", ":", "data", "=", "{", "'user'", ":", "self", ".", "options", "[", "'username'", "]", ",", "'passwd'", ":", "self", ".", "options", "[", "'password'", "]", ",", "'api_type'", ":", "'json'", "}", "response", "=", "sel...
3160a21006fcc6961f240988874e228a5ec6f18e
train
RedditPlugin.manage_submissions
If there are no or only one submissions left, get new submissions. This function manages URL creation and the specifics for front page or subreddit mode.
i3situation/plugins/reddit.py
def manage_submissions(self): """ If there are no or only one submissions left, get new submissions. This function manages URL creation and the specifics for front page or subreddit mode. """ if not hasattr(self, 'submissions') or len(self.submissions) == 1: s...
def manage_submissions(self): """ If there are no or only one submissions left, get new submissions. This function manages URL creation and the specifics for front page or subreddit mode. """ if not hasattr(self, 'submissions') or len(self.submissions) == 1: s...
[ "If", "there", "are", "no", "or", "only", "one", "submissions", "left", "get", "new", "submissions", ".", "This", "function", "manages", "URL", "creation", "and", "the", "specifics", "for", "front", "page", "or", "subreddit", "mode", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L93-L114
[ "def", "manage_submissions", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'submissions'", ")", "or", "len", "(", "self", ".", "submissions", ")", "==", "1", ":", "self", ".", "submissions", "=", "[", "]", "if", "self", ".", "opti...
3160a21006fcc6961f240988874e228a5ec6f18e
train
RedditPlugin.get_submissions
Connects to Reddit and gets a JSON representation of submissions. This JSON data is then processed and returned. url: A url that requests for submissions should be sent to.
i3situation/plugins/reddit.py
def get_submissions(self, url): """ Connects to Reddit and gets a JSON representation of submissions. This JSON data is then processed and returned. url: A url that requests for submissions should be sent to. """ response = self.client.get(url, params={'limit': self.opti...
def get_submissions(self, url): """ Connects to Reddit and gets a JSON representation of submissions. This JSON data is then processed and returned. url: A url that requests for submissions should be sent to. """ response = self.client.get(url, params={'limit': self.opti...
[ "Connects", "to", "Reddit", "and", "gets", "a", "JSON", "representation", "of", "submissions", ".", "This", "JSON", "data", "is", "then", "processed", "and", "returned", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L116-L125
[ "def", "get_submissions", "(", "self", ",", "url", ")", ":", "response", "=", "self", ".", "client", ".", "get", "(", "url", ",", "params", "=", "{", "'limit'", ":", "self", ".", "options", "[", "'limit'", "]", "}", ")", "submissions", "=", "[", "x...
3160a21006fcc6961f240988874e228a5ec6f18e
train
CmusPlugin.main
A compulsary function that gets the output of the cmus-remote -Q command and converts it to unicode in order for it to be processed and finally output.
i3situation/plugins/cmus.py
def main(self): """ A compulsary function that gets the output of the cmus-remote -Q command and converts it to unicode in order for it to be processed and finally output. """ try: # Setting stderr to subprocess.STDOUT seems to stop the error # mes...
def main(self): """ A compulsary function that gets the output of the cmus-remote -Q command and converts it to unicode in order for it to be processed and finally output. """ try: # Setting stderr to subprocess.STDOUT seems to stop the error # mes...
[ "A", "compulsary", "function", "that", "gets", "the", "output", "of", "the", "cmus", "-", "remote", "-", "Q", "command", "and", "converts", "it", "to", "unicode", "in", "order", "for", "it", "to", "be", "processed", "and", "finally", "output", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/cmus.py#L44-L64
[ "def", "main", "(", "self", ")", ":", "try", ":", "# Setting stderr to subprocess.STDOUT seems to stop the error", "# message returned by the process from being output to STDOUT.", "cmus_output", "=", "subprocess", ".", "check_output", "(", "[", "'cmus-remote'", ",", "'-Q'", ...
3160a21006fcc6961f240988874e228a5ec6f18e
train
CmusPlugin.convert_cmus_output
Change the newline separated string of output data into a dictionary which can then be used to replace the strings in the config format. cmus_output: A string with information about cmus that is newline seperated. Running cmus-remote -Q in a terminal will show you what you're de...
i3situation/plugins/cmus.py
def convert_cmus_output(self, cmus_output): """ Change the newline separated string of output data into a dictionary which can then be used to replace the strings in the config format. cmus_output: A string with information about cmus that is newline seperated. Running c...
def convert_cmus_output(self, cmus_output): """ Change the newline separated string of output data into a dictionary which can then be used to replace the strings in the config format. cmus_output: A string with information about cmus that is newline seperated. Running c...
[ "Change", "the", "newline", "separated", "string", "of", "output", "data", "into", "a", "dictionary", "which", "can", "then", "be", "used", "to", "replace", "the", "strings", "in", "the", "config", "format", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/cmus.py#L66-L84
[ "def", "convert_cmus_output", "(", "self", ",", "cmus_output", ")", ":", "cmus_output", "=", "cmus_output", ".", "split", "(", "'\\n'", ")", "cmus_output", "=", "[", "x", ".", "replace", "(", "'tag '", ",", "''", ")", "for", "x", "in", "cmus_output", "if...
3160a21006fcc6961f240988874e228a5ec6f18e
train
CmusPlugin.convert_time
A helper function to convert seconds into hh:mm:ss for better readability. time: A string representing time in seconds.
i3situation/plugins/cmus.py
def convert_time(self, time): """ A helper function to convert seconds into hh:mm:ss for better readability. time: A string representing time in seconds. """ time_string = str(datetime.timedelta(seconds=int(time))) if time_string.split(':')[0] == '0': ...
def convert_time(self, time): """ A helper function to convert seconds into hh:mm:ss for better readability. time: A string representing time in seconds. """ time_string = str(datetime.timedelta(seconds=int(time))) if time_string.split(':')[0] == '0': ...
[ "A", "helper", "function", "to", "convert", "seconds", "into", "hh", ":", "mm", ":", "ss", "for", "better", "readability", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/cmus.py#L86-L96
[ "def", "convert_time", "(", "self", ",", "time", ")", ":", "time_string", "=", "str", "(", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ")", ")", ")", "if", "time_string", ".", "split", "(", "':'", ")", "[", "0", "]", "=="...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Plugin.output
Output all of the options and data for a segment. full_text: A string representing the data that should be output to i3bar. short_text: A more concise version of full_text, in case there is minimal room on the i3bar.
i3situation/plugins/_plugin.py
def output(self, full_text, short_text): """ Output all of the options and data for a segment. full_text: A string representing the data that should be output to i3bar. short_text: A more concise version of full_text, in case there is minimal room on the i3bar. """ ...
def output(self, full_text, short_text): """ Output all of the options and data for a segment. full_text: A string representing the data that should be output to i3bar. short_text: A more concise version of full_text, in case there is minimal room on the i3bar. """ ...
[ "Output", "all", "of", "the", "options", "and", "data", "for", "a", "segment", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/_plugin.py#L29-L41
[ "def", "output", "(", "self", ",", "full_text", ",", "short_text", ")", ":", "full_text", "=", "full_text", ".", "replace", "(", "'\\n'", ",", "''", ")", "short_text", "=", "short_text", ".", "replace", "(", "'\\n'", ",", "''", ")", "self", ".", "outpu...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Plugin.on_click
A function that should be overwritten by a plugin that wishes to react to events, if it wants to perform any action other than running the supplied command related to a button. event: A dictionary passed from i3bar (after being decoded from JSON) that has the folowing format: e...
i3situation/plugins/_plugin.py
def on_click(self, event): """ A function that should be overwritten by a plugin that wishes to react to events, if it wants to perform any action other than running the supplied command related to a button. event: A dictionary passed from i3bar (after being decoded from JSON) ...
def on_click(self, event): """ A function that should be overwritten by a plugin that wishes to react to events, if it wants to perform any action other than running the supplied command related to a button. event: A dictionary passed from i3bar (after being decoded from JSON) ...
[ "A", "function", "that", "should", "be", "overwritten", "by", "a", "plugin", "that", "wishes", "to", "react", "to", "events", "if", "it", "wants", "to", "perform", "any", "action", "other", "than", "running", "the", "supplied", "command", "related", "to", ...
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/_plugin.py#L43-L61
[ "def", "on_click", "(", "self", ",", "event", ")", ":", "if", "event", "[", "'button'", "]", "==", "1", "and", "'button1'", "in", "self", ".", "options", ":", "subprocess", ".", "call", "(", "self", ".", "options", "[", "'button1'", "]", ".", "split"...
3160a21006fcc6961f240988874e228a5ec6f18e
train
url_reverse
Reverse the requested URL (passed via GET / POST as `url_name` parameter) :param request: Request object :return: The reversed path
ckeditor_filebrowser_filer/views.py
def url_reverse(request): """ Reverse the requested URL (passed via GET / POST as `url_name` parameter) :param request: Request object :return: The reversed path """ if request.method in ('GET', 'POST'): data = getattr(request, request.method) url_name = data.get('url_name') ...
def url_reverse(request): """ Reverse the requested URL (passed via GET / POST as `url_name` parameter) :param request: Request object :return: The reversed path """ if request.method in ('GET', 'POST'): data = getattr(request, request.method) url_name = data.get('url_name') ...
[ "Reverse", "the", "requested", "URL", "(", "passed", "via", "GET", "/", "POST", "as", "url_name", "parameter", ")" ]
nephila/django-ckeditor-filebrowser-filer
python
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L41-L57
[ "def", "url_reverse", "(", "request", ")", ":", "if", "request", ".", "method", "in", "(", "'GET'", ",", "'POST'", ")", ":", "data", "=", "getattr", "(", "request", ",", "request", ".", "method", ")", "url_name", "=", "data", ".", "get", "(", "'url_n...
336ea259fbc6f9d338e3798375299f654a4d6995
train
url_image
Converts a filer image ID in a complete path :param request: Request object :param image_id: Filer image ID :param thumb_options: ThumbnailOption ID :param width: user-provided width :param height: user-provided height :return: JSON serialized URL components ('url', 'width', 'height')
ckeditor_filebrowser_filer/views.py
def url_image(request, image_id, thumb_options=None, width=None, height=None): """ Converts a filer image ID in a complete path :param request: Request object :param image_id: Filer image ID :param thumb_options: ThumbnailOption ID :param width: user-provided width :param height: user-provi...
def url_image(request, image_id, thumb_options=None, width=None, height=None): """ Converts a filer image ID in a complete path :param request: Request object :param image_id: Filer image ID :param thumb_options: ThumbnailOption ID :param width: user-provided width :param height: user-provi...
[ "Converts", "a", "filer", "image", "ID", "in", "a", "complete", "path" ]
nephila/django-ckeditor-filebrowser-filer
python
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L79-L104
[ "def", "url_image", "(", "request", ",", "image_id", ",", "thumb_options", "=", "None", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "image", "=", "File", ".", "objects", ".", "get", "(", "pk", "=", "image_id", ")", "if", "getattr...
336ea259fbc6f9d338e3798375299f654a4d6995
train
thumbnail_options
Returns the requested ThumbnailOption as JSON :param request: Request object :return: JSON serialized ThumbnailOption
ckeditor_filebrowser_filer/views.py
def thumbnail_options(request): """ Returns the requested ThumbnailOption as JSON :param request: Request object :return: JSON serialized ThumbnailOption """ response_data = [{'id': opt.pk, 'name': opt.name} for opt in ThumbnailOption.objects.all()] return http.HttpResponse(json.dumps(respo...
def thumbnail_options(request): """ Returns the requested ThumbnailOption as JSON :param request: Request object :return: JSON serialized ThumbnailOption """ response_data = [{'id': opt.pk, 'name': opt.name} for opt in ThumbnailOption.objects.all()] return http.HttpResponse(json.dumps(respo...
[ "Returns", "the", "requested", "ThumbnailOption", "as", "JSON" ]
nephila/django-ckeditor-filebrowser-filer
python
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L107-L115
[ "def", "thumbnail_options", "(", "request", ")", ":", "response_data", "=", "[", "{", "'id'", ":", "opt", ".", "pk", ",", "'name'", ":", "opt", ".", "name", "}", "for", "opt", "in", "ThumbnailOption", ".", "objects", ".", "all", "(", ")", "]", "retur...
336ea259fbc6f9d338e3798375299f654a4d6995
train
serve_image
returns the content of an image sized according to the parameters :param request: Request object :param image_id: Filer image ID :param thumb_options: ThumbnailOption ID :param width: user-provided width :param height: user-provided height :return: JSON serialized URL components ('url', 'width'...
ckeditor_filebrowser_filer/views.py
def serve_image(request, image_id, thumb_options=None, width=None, height=None): """ returns the content of an image sized according to the parameters :param request: Request object :param image_id: Filer image ID :param thumb_options: ThumbnailOption ID :param width: user-provided width :p...
def serve_image(request, image_id, thumb_options=None, width=None, height=None): """ returns the content of an image sized according to the parameters :param request: Request object :param image_id: Filer image ID :param thumb_options: ThumbnailOption ID :param width: user-provided width :p...
[ "returns", "the", "content", "of", "an", "image", "sized", "according", "to", "the", "parameters" ]
nephila/django-ckeditor-filebrowser-filer
python
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L118-L138
[ "def", "serve_image", "(", "request", ",", "image_id", ",", "thumb_options", "=", "None", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "image", "=", "File", ".", "objects", ".", "get", "(", "pk", "=", "image_id", ")", "if", "getat...
336ea259fbc6f9d338e3798375299f654a4d6995
train
Config._touch_dir
A helper function to create a directory if it doesn't exist. path: A string containing a full path to the directory to be created.
i3situation/core/config.py
def _touch_dir(self, path): """ A helper function to create a directory if it doesn't exist. path: A string containing a full path to the directory to be created. """ try: os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: ...
def _touch_dir(self, path): """ A helper function to create a directory if it doesn't exist. path: A string containing a full path to the directory to be created. """ try: os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: ...
[ "A", "helper", "function", "to", "create", "a", "directory", "if", "it", "doesn", "t", "exist", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/config.py#L32-L42
[ "def", "_touch_dir", "(", "self", ",", "path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "path", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "EEXIST", ":", "raise" ]
3160a21006fcc6961f240988874e228a5ec6f18e
train
Config.reload
Reload the configuration from the file. This is in its own function so that it can be called at any time by another class.
i3situation/core/config.py
def reload(self): """ Reload the configuration from the file. This is in its own function so that it can be called at any time by another class. """ self._conf = configparser.ConfigParser() # Preserve the case of sections and keys. self._conf.optionxform = str ...
def reload(self): """ Reload the configuration from the file. This is in its own function so that it can be called at any time by another class. """ self._conf = configparser.ConfigParser() # Preserve the case of sections and keys. self._conf.optionxform = str ...
[ "Reload", "the", "configuration", "from", "the", "file", ".", "This", "is", "in", "its", "own", "function", "so", "that", "it", "can", "be", "called", "at", "any", "time", "by", "another", "class", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/config.py#L50-L68
[ "def", "reload", "(", "self", ")", ":", "self", ".", "_conf", "=", "configparser", ".", "ConfigParser", "(", ")", "# Preserve the case of sections and keys.", "self", ".", "_conf", ".", "optionxform", "=", "str", "self", ".", "_conf", ".", "read", "(", "self...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Config._replace_data_types
Replaces strings with appropriate data types (int, boolean). Also replaces the human readable logging levels with the integer form. dictionary: A dictionary returned from the config file.
i3situation/core/config.py
def _replace_data_types(dictionary): """ Replaces strings with appropriate data types (int, boolean). Also replaces the human readable logging levels with the integer form. dictionary: A dictionary returned from the config file. """ logging_levels = {'NONE': 0, 'NULL': 0...
def _replace_data_types(dictionary): """ Replaces strings with appropriate data types (int, boolean). Also replaces the human readable logging levels with the integer form. dictionary: A dictionary returned from the config file. """ logging_levels = {'NONE': 0, 'NULL': 0...
[ "Replaces", "strings", "with", "appropriate", "data", "types", "(", "int", "boolean", ")", ".", "Also", "replaces", "the", "human", "readable", "logging", "levels", "with", "the", "integer", "form", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/config.py#L71-L93
[ "def", "_replace_data_types", "(", "dictionary", ")", ":", "logging_levels", "=", "{", "'NONE'", ":", "0", ",", "'NULL'", ":", "0", ",", "'DEBUG'", ":", "10", ",", "'INFO'", ":", "20", ",", "'WARNING'", ":", "30", ",", "'ERROR'", ":", "40", ",", "'CR...
3160a21006fcc6961f240988874e228a5ec6f18e
train
main
Command line interface for the ``rotate-backups`` program.
rotate_backups/cli.py
def main(): """Command line interface for the ``rotate-backups`` program.""" coloredlogs.install(syslog=True) # Command line option defaults. rotation_scheme = {} kw = dict(include_list=[], exclude_list=[]) parallel = False use_sudo = False # Internal state. selected_locations = [] ...
def main(): """Command line interface for the ``rotate-backups`` program.""" coloredlogs.install(syslog=True) # Command line option defaults. rotation_scheme = {} kw = dict(include_list=[], exclude_list=[]) parallel = False use_sudo = False # Internal state. selected_locations = [] ...
[ "Command", "line", "interface", "for", "the", "rotate", "-", "backups", "program", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/cli.py#L205-L303
[ "def", "main", "(", ")", ":", "coloredlogs", ".", "install", "(", "syslog", "=", "True", ")", "# Command line option defaults.", "rotation_scheme", "=", "{", "}", "kw", "=", "dict", "(", "include_list", "=", "[", "]", ",", "exclude_list", "=", "[", "]", ...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
BatteryPlugin.get_battery_state
Return the first line from the file located at battery_path/prop as a string.
i3situation/plugins/battery.py
def get_battery_state(self, prop): """ Return the first line from the file located at battery_path/prop as a string. """ with open(os.path.join(self.options['battery_path'], prop), 'r') as f: return f.readline().strip()
def get_battery_state(self, prop): """ Return the first line from the file located at battery_path/prop as a string. """ with open(os.path.join(self.options['battery_path'], prop), 'r') as f: return f.readline().strip()
[ "Return", "the", "first", "line", "from", "the", "file", "located", "at", "battery_path", "/", "prop", "as", "a", "string", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/battery.py#L52-L58
[ "def", "get_battery_state", "(", "self", ",", "prop", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "options", "[", "'battery_path'", "]", ",", "prop", ")", ",", "'r'", ")", "as", "f", ":", "return", "f", ".", "...
3160a21006fcc6961f240988874e228a5ec6f18e
train
coerce_location
Coerce a string to a :class:`Location` object. :param value: The value to coerce (a string or :class:`Location` object). :param options: Any keyword arguments are passed on to :func:`~executor.contexts.create_context()`. :returns: A :class:`Location` object.
rotate_backups/__init__.py
def coerce_location(value, **options): """ Coerce a string to a :class:`Location` object. :param value: The value to coerce (a string or :class:`Location` object). :param options: Any keyword arguments are passed on to :func:`~executor.contexts.create_context()`. :returns: A :cl...
def coerce_location(value, **options): """ Coerce a string to a :class:`Location` object. :param value: The value to coerce (a string or :class:`Location` object). :param options: Any keyword arguments are passed on to :func:`~executor.contexts.create_context()`. :returns: A :cl...
[ "Coerce", "a", "string", "to", "a", ":", "class", ":", "Location", "object", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L93-L119
[ "def", "coerce_location", "(", "value", ",", "*", "*", "options", ")", ":", "# Location objects pass through untouched.", "if", "not", "isinstance", "(", "value", ",", "Location", ")", ":", "# Other values are expected to be strings.", "if", "not", "isinstance", "(", ...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
coerce_retention_period
Coerce a retention period to a Python value. :param value: A string containing the text 'always', a number or an expression that can be evaluated to a number. :returns: A number or the string 'always'. :raises: :exc:`~exceptions.ValueError` when the string can't be coerced.
rotate_backups/__init__.py
def coerce_retention_period(value): """ Coerce a retention period to a Python value. :param value: A string containing the text 'always', a number or an expression that can be evaluated to a number. :returns: A number or the string 'always'. :raises: :exc:`~exceptions.ValueError` ...
def coerce_retention_period(value): """ Coerce a retention period to a Python value. :param value: A string containing the text 'always', a number or an expression that can be evaluated to a number. :returns: A number or the string 'always'. :raises: :exc:`~exceptions.ValueError` ...
[ "Coerce", "a", "retention", "period", "to", "a", "Python", "value", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L122-L147
[ "def", "coerce_retention_period", "(", "value", ")", ":", "# Numbers pass through untouched.", "if", "not", "isinstance", "(", "value", ",", "numbers", ".", "Number", ")", ":", "# Other values are expected to be strings.", "if", "not", "isinstance", "(", "value", ",",...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
load_config_file
Load a configuration file with backup directories and rotation schemes. :param configuration_file: Override the pathname of the configuration file to load (a string or :data:`None`). :param expand: :data:`True` to expand filename patterns to their matches, :dat...
rotate_backups/__init__.py
def load_config_file(configuration_file=None, expand=True): """ Load a configuration file with backup directories and rotation schemes. :param configuration_file: Override the pathname of the configuration file to load (a string or :data:`None`). :param expand: :data:`Tru...
def load_config_file(configuration_file=None, expand=True): """ Load a configuration file with backup directories and rotation schemes. :param configuration_file: Override the pathname of the configuration file to load (a string or :data:`None`). :param expand: :data:`Tru...
[ "Load", "a", "configuration", "file", "with", "backup", "directories", "and", "rotation", "schemes", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L150-L220
[ "def", "load_config_file", "(", "configuration_file", "=", "None", ",", "expand", "=", "True", ")", ":", "expand_notice_given", "=", "False", "if", "configuration_file", ":", "loader", "=", "ConfigLoader", "(", "available_files", "=", "[", "configuration_file", "]...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
rotate_backups
Rotate the backups in a directory according to a flexible rotation scheme. .. note:: This function exists to preserve backwards compatibility with older versions of the `rotate-backups` package where all of the logic was exposed as a single function. Please refer to the do...
rotate_backups/__init__.py
def rotate_backups(directory, rotation_scheme, **options): """ Rotate the backups in a directory according to a flexible rotation scheme. .. note:: This function exists to preserve backwards compatibility with older versions of the `rotate-backups` package where all of the logic...
def rotate_backups(directory, rotation_scheme, **options): """ Rotate the backups in a directory according to a flexible rotation scheme. .. note:: This function exists to preserve backwards compatibility with older versions of the `rotate-backups` package where all of the logic...
[ "Rotate", "the", "backups", "in", "a", "directory", "according", "to", "a", "flexible", "rotation", "scheme", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L223-L235
[ "def", "rotate_backups", "(", "directory", ",", "rotation_scheme", ",", "*", "*", "options", ")", ":", "program", "=", "RotateBackups", "(", "rotation_scheme", "=", "rotation_scheme", ",", "*", "*", "options", ")", "program", ".", "rotate_backups", "(", "direc...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.rotate_concurrent
Rotate the backups in the given locations concurrently. :param locations: One or more values accepted by :func:`coerce_location()`. :param kw: Any keyword arguments are passed on to :func:`rotate_backups()`. This function uses :func:`rotate_backups()` to prepare rotation commands for t...
rotate_backups/__init__.py
def rotate_concurrent(self, *locations, **kw): """ Rotate the backups in the given locations concurrently. :param locations: One or more values accepted by :func:`coerce_location()`. :param kw: Any keyword arguments are passed on to :func:`rotate_backups()`. This function uses ...
def rotate_concurrent(self, *locations, **kw): """ Rotate the backups in the given locations concurrently. :param locations: One or more values accepted by :func:`coerce_location()`. :param kw: Any keyword arguments are passed on to :func:`rotate_backups()`. This function uses ...
[ "Rotate", "the", "backups", "in", "the", "given", "locations", "concurrently", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L403-L431
[ "def", "rotate_concurrent", "(", "self", ",", "*", "locations", ",", "*", "*", "kw", ")", ":", "timer", "=", "Timer", "(", ")", "pool", "=", "CommandPool", "(", "concurrency", "=", "10", ")", "logger", ".", "info", "(", "\"Scanning %s ..\"", ",", "plur...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.rotate_backups
Rotate the backups in a directory according to a flexible rotation scheme. :param location: Any value accepted by :func:`coerce_location()`. :param load_config: If :data:`True` (so by default) the rotation scheme and other options can be customized by the user in ...
rotate_backups/__init__.py
def rotate_backups(self, location, load_config=True, prepare=False): """ Rotate the backups in a directory according to a flexible rotation scheme. :param location: Any value accepted by :func:`coerce_location()`. :param load_config: If :data:`True` (so by default) the rotation scheme ...
def rotate_backups(self, location, load_config=True, prepare=False): """ Rotate the backups in a directory according to a flexible rotation scheme. :param location: Any value accepted by :func:`coerce_location()`. :param load_config: If :data:`True` (so by default) the rotation scheme ...
[ "Rotate", "the", "backups", "in", "a", "directory", "according", "to", "a", "flexible", "rotation", "scheme", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L433-L512
[ "def", "rotate_backups", "(", "self", ",", "location", ",", "load_config", "=", "True", ",", "prepare", "=", "False", ")", ":", "rotation_commands", "=", "[", "]", "location", "=", "coerce_location", "(", "location", ")", "# Load configuration overrides by user?",...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.load_config_file
Load a rotation scheme and other options from a configuration file. :param location: Any value accepted by :func:`coerce_location()`. :returns: The configured or given :class:`Location` object.
rotate_backups/__init__.py
def load_config_file(self, location): """ Load a rotation scheme and other options from a configuration file. :param location: Any value accepted by :func:`coerce_location()`. :returns: The configured or given :class:`Location` object. """ location = coerce_location(loca...
def load_config_file(self, location): """ Load a rotation scheme and other options from a configuration file. :param location: Any value accepted by :func:`coerce_location()`. :returns: The configured or given :class:`Location` object. """ location = coerce_location(loca...
[ "Load", "a", "rotation", "scheme", "and", "other", "options", "from", "a", "configuration", "file", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L514-L544
[ "def", "load_config_file", "(", "self", ",", "location", ")", ":", "location", "=", "coerce_location", "(", "location", ")", "for", "configured_location", ",", "rotation_scheme", ",", "options", "in", "load_config_file", "(", "self", ".", "config_file", ",", "ex...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.collect_backups
Collect the backups at the given location. :param location: Any value accepted by :func:`coerce_location()`. :returns: A sorted :class:`list` of :class:`Backup` objects (the backups are sorted by their date). :raises: :exc:`~exceptions.ValueError` when the given directory does...
rotate_backups/__init__.py
def collect_backups(self, location): """ Collect the backups at the given location. :param location: Any value accepted by :func:`coerce_location()`. :returns: A sorted :class:`list` of :class:`Backup` objects (the backups are sorted by their date). :raises: :e...
def collect_backups(self, location): """ Collect the backups at the given location. :param location: Any value accepted by :func:`coerce_location()`. :returns: A sorted :class:`list` of :class:`Backup` objects (the backups are sorted by their date). :raises: :e...
[ "Collect", "the", "backups", "at", "the", "given", "location", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L546-L579
[ "def", "collect_backups", "(", "self", ",", "location", ")", ":", "backups", "=", "[", "]", "location", "=", "coerce_location", "(", "location", ")", "logger", ".", "info", "(", "\"Scanning %s for backups ..\"", ",", "location", ")", "location", ".", "ensure_r...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.group_backups
Group backups collected by :func:`collect_backups()` by rotation frequencies. :param backups: A :class:`set` of :class:`Backup` objects. :returns: A :class:`dict` whose keys are the names of rotation frequencies ('hourly', 'daily', etc.) and whose values are dictiona...
rotate_backups/__init__.py
def group_backups(self, backups): """ Group backups collected by :func:`collect_backups()` by rotation frequencies. :param backups: A :class:`set` of :class:`Backup` objects. :returns: A :class:`dict` whose keys are the names of rotation frequencies ('hourly', 'daily',...
def group_backups(self, backups): """ Group backups collected by :func:`collect_backups()` by rotation frequencies. :param backups: A :class:`set` of :class:`Backup` objects. :returns: A :class:`dict` whose keys are the names of rotation frequencies ('hourly', 'daily',...
[ "Group", "backups", "collected", "by", ":", "func", ":", "collect_backups", "()", "by", "rotation", "frequencies", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L581-L601
[ "def", "group_backups", "(", "self", ",", "backups", ")", ":", "backups_by_frequency", "=", "dict", "(", "(", "frequency", ",", "collections", ".", "defaultdict", "(", "list", ")", ")", "for", "frequency", "in", "SUPPORTED_FREQUENCIES", ")", "for", "b", "in"...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.apply_rotation_scheme
Apply the user defined rotation scheme to the result of :func:`group_backups()`. :param backups_by_frequency: A :class:`dict` in the format generated by :func:`group_backups()`. :param most_recent_backup: The :class:`~datetime.datetime` of the most ...
rotate_backups/__init__.py
def apply_rotation_scheme(self, backups_by_frequency, most_recent_backup): """ Apply the user defined rotation scheme to the result of :func:`group_backups()`. :param backups_by_frequency: A :class:`dict` in the format generated by :func:`group_backups()`. ...
def apply_rotation_scheme(self, backups_by_frequency, most_recent_backup): """ Apply the user defined rotation scheme to the result of :func:`group_backups()`. :param backups_by_frequency: A :class:`dict` in the format generated by :func:`group_backups()`. ...
[ "Apply", "the", "user", "defined", "rotation", "scheme", "to", "the", "result", "of", ":", "func", ":", "group_backups", "()", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L603-L649
[ "def", "apply_rotation_scheme", "(", "self", ",", "backups_by_frequency", ",", "most_recent_backup", ")", ":", "if", "not", "self", ".", "rotation_scheme", ":", "raise", "ValueError", "(", "\"Refusing to use empty rotation scheme! (all backups would be deleted)\"", ")", "fo...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
RotateBackups.find_preservation_criteria
Collect the criteria used to decide which backups to preserve. :param backups_by_frequency: A :class:`dict` in the format generated by :func:`group_backups()` which has been processed by :func:`apply_rotation_scheme()`. :returns:...
rotate_backups/__init__.py
def find_preservation_criteria(self, backups_by_frequency): """ Collect the criteria used to decide which backups to preserve. :param backups_by_frequency: A :class:`dict` in the format generated by :func:`group_backups()` which has been ...
def find_preservation_criteria(self, backups_by_frequency): """ Collect the criteria used to decide which backups to preserve. :param backups_by_frequency: A :class:`dict` in the format generated by :func:`group_backups()` which has been ...
[ "Collect", "the", "criteria", "used", "to", "decide", "which", "backups", "to", "preserve", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L651-L667
[ "def", "find_preservation_criteria", "(", "self", ",", "backups_by_frequency", ")", ":", "backups_to_preserve", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "frequency", ",", "delta", "in", "ORDERED_FREQUENCIES", ":", "for", "period", "in", "ba...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
Location.mount_point
The pathname of the mount point of :attr:`directory` (a string or :data:`None`). If the ``stat --format=%m ...`` command that is used to determine the mount point fails, the value of this property defaults to :data:`None`. This enables graceful degradation on e.g. Mac OS X whose ``stat`` ...
rotate_backups/__init__.py
def mount_point(self): """ The pathname of the mount point of :attr:`directory` (a string or :data:`None`). If the ``stat --format=%m ...`` command that is used to determine the mount point fails, the value of this property defaults to :data:`None`. This enables graceful degrada...
def mount_point(self): """ The pathname of the mount point of :attr:`directory` (a string or :data:`None`). If the ``stat --format=%m ...`` command that is used to determine the mount point fails, the value of this property defaults to :data:`None`. This enables graceful degrada...
[ "The", "pathname", "of", "the", "mount", "point", "of", ":", "attr", ":", "directory", "(", "a", "string", "or", ":", "data", ":", "None", ")", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L693-L705
[ "def", "mount_point", "(", "self", ")", ":", "try", ":", "return", "self", ".", "context", ".", "capture", "(", "'stat'", ",", "'--format=%m'", ",", "self", ".", "directory", ",", "silent", "=", "True", ")", "except", "ExternalCommandFailed", ":", "return"...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
Location.ensure_exists
Make sure the location exists.
rotate_backups/__init__.py
def ensure_exists(self): """Make sure the location exists.""" if not self.context.is_directory(self.directory): # This can also happen when we don't have permission to one of the # parent directories so we'll point that out in the error message # when it seems applica...
def ensure_exists(self): """Make sure the location exists.""" if not self.context.is_directory(self.directory): # This can also happen when we don't have permission to one of the # parent directories so we'll point that out in the error message # when it seems applica...
[ "Make", "sure", "the", "location", "exists", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L729-L744
[ "def", "ensure_exists", "(", "self", ")", ":", "if", "not", "self", ".", "context", ".", "is_directory", "(", "self", ".", "directory", ")", ":", "# This can also happen when we don't have permission to one of the", "# parent directories so we'll point that out in the error m...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
Location.ensure_readable
Make sure the location exists and is readable.
rotate_backups/__init__.py
def ensure_readable(self): """Make sure the location exists and is readable.""" self.ensure_exists() if not self.context.is_readable(self.directory): if self.context.have_superuser_privileges: msg = "The directory %s isn't readable!" raise ValueError(m...
def ensure_readable(self): """Make sure the location exists and is readable.""" self.ensure_exists() if not self.context.is_readable(self.directory): if self.context.have_superuser_privileges: msg = "The directory %s isn't readable!" raise ValueError(m...
[ "Make", "sure", "the", "location", "exists", "and", "is", "readable", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L746-L758
[ "def", "ensure_readable", "(", "self", ")", ":", "self", ".", "ensure_exists", "(", ")", "if", "not", "self", ".", "context", ".", "is_readable", "(", "self", ".", "directory", ")", ":", "if", "self", ".", "context", ".", "have_superuser_privileges", ":", ...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
Location.ensure_writable
Make sure the directory exists and is writable.
rotate_backups/__init__.py
def ensure_writable(self): """Make sure the directory exists and is writable.""" self.ensure_exists() if not self.context.is_writable(self.directory): if self.context.have_superuser_privileges: msg = "The directory %s isn't writable!" raise ValueError(...
def ensure_writable(self): """Make sure the directory exists and is writable.""" self.ensure_exists() if not self.context.is_writable(self.directory): if self.context.have_superuser_privileges: msg = "The directory %s isn't writable!" raise ValueError(...
[ "Make", "sure", "the", "directory", "exists", "and", "is", "writable", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L760-L771
[ "def", "ensure_writable", "(", "self", ")", ":", "self", ".", "ensure_exists", "(", ")", "if", "not", "self", ".", "context", ".", "is_writable", "(", "self", ".", "directory", ")", ":", "if", "self", ".", "context", ".", "have_superuser_privileges", ":", ...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
Location.match
Check if the given location "matches". :param location: The :class:`Location` object to try to match. :returns: :data:`True` if the two locations are on the same system and the :attr:`directory` can be matched as a filename pattern or a literal match on the normalize...
rotate_backups/__init__.py
def match(self, location): """ Check if the given location "matches". :param location: The :class:`Location` object to try to match. :returns: :data:`True` if the two locations are on the same system and the :attr:`directory` can be matched as a filename pattern or ...
def match(self, location): """ Check if the given location "matches". :param location: The :class:`Location` object to try to match. :returns: :data:`True` if the two locations are on the same system and the :attr:`directory` can be matched as a filename pattern or ...
[ "Check", "if", "the", "given", "location", "matches", "." ]
xolox/python-rotate-backups
python
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L773-L792
[ "def", "match", "(", "self", ",", "location", ")", ":", "if", "self", ".", "ssh_alias", "!=", "location", ".", "ssh_alias", ":", "# Never match locations on other systems.", "return", "False", "elif", "self", ".", "have_wildcards", ":", "# Match filename patterns us...
611c72b2806952bf2bb84c38a4b5f856ea334707
train
setup_file_logger
A helper function for creating a file logger. Accepts arguments, as it is used in Status and LoggingWriter.
i3situation/core/status.py
def setup_file_logger(filename, formatting, log_level): """ A helper function for creating a file logger. Accepts arguments, as it is used in Status and LoggingWriter. """ logger = logging.getLogger() # If a stream handler has been attached, remove it. if logger.handlers: logger.remo...
def setup_file_logger(filename, formatting, log_level): """ A helper function for creating a file logger. Accepts arguments, as it is used in Status and LoggingWriter. """ logger = logging.getLogger() # If a stream handler has been attached, remove it. if logger.handlers: logger.remo...
[ "A", "helper", "function", "for", "creating", "a", "file", "logger", ".", "Accepts", "arguments", "as", "it", "is", "used", "in", "Status", "and", "LoggingWriter", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L12-L27
[ "def", "setup_file_logger", "(", "filename", ",", "formatting", ",", "log_level", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ")", "# If a stream handler has been attached, remove it.", "if", "logger", ".", "handlers", ":", "logger", ".", "removeHandl...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Status.output_to_bar
Outputs data to stdout, without buffering. message: A string containing the data to be output. comma: Whether or not a comma should be placed at the end of the output.
i3situation/core/status.py
def output_to_bar(self, message, comma=True): """ Outputs data to stdout, without buffering. message: A string containing the data to be output. comma: Whether or not a comma should be placed at the end of the output. """ if comma: message += ',' sys....
def output_to_bar(self, message, comma=True): """ Outputs data to stdout, without buffering. message: A string containing the data to be output. comma: Whether or not a comma should be placed at the end of the output. """ if comma: message += ',' sys....
[ "Outputs", "data", "to", "stdout", "without", "buffering", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L76-L86
[ "def", "output_to_bar", "(", "self", ",", "message", ",", "comma", "=", "True", ")", ":", "if", "comma", ":", "message", "+=", "','", "sys", ".", "stdout", ".", "write", "(", "message", "+", "'\\n'", ")", "sys", ".", "stdout", ".", "flush", "(", ")...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Status.reload
Reload the installed plugins and the configuration file. This is called when either the plugins or config get updated.
i3situation/core/status.py
def reload(self): """ Reload the installed plugins and the configuration file. This is called when either the plugins or config get updated. """ logging.debug('Reloading config file as files have been modified.') self.config.plugin, self.config.general = self.config.reloa...
def reload(self): """ Reload the installed plugins and the configuration file. This is called when either the plugins or config get updated. """ logging.debug('Reloading config file as files have been modified.') self.config.plugin, self.config.general = self.config.reloa...
[ "Reload", "the", "installed", "plugins", "and", "the", "configuration", "file", ".", "This", "is", "called", "when", "either", "the", "plugins", "or", "config", "get", "updated", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L88-L99
[ "def", "reload", "(", "self", ")", ":", "logging", ".", "debug", "(", "'Reloading config file as files have been modified.'", ")", "self", ".", "config", ".", "plugin", ",", "self", ".", "config", ".", "general", "=", "self", ".", "config", ".", "reload", "(...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Status.run_plugins
Creates a thread for each plugin and lets the thread_manager handle it.
i3situation/core/status.py
def run_plugins(self): """ Creates a thread for each plugin and lets the thread_manager handle it. """ for obj in self.loader.objects: # Reserve a slot in the output_dict in order to ensure that the # items are in the correct order. self.output_dict[ob...
def run_plugins(self): """ Creates a thread for each plugin and lets the thread_manager handle it. """ for obj in self.loader.objects: # Reserve a slot in the output_dict in order to ensure that the # items are in the correct order. self.output_dict[ob...
[ "Creates", "a", "thread", "for", "each", "plugin", "and", "lets", "the", "thread_manager", "handle", "it", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L101-L109
[ "def", "run_plugins", "(", "self", ")", ":", "for", "obj", "in", "self", ".", "loader", ".", "objects", ":", "# Reserve a slot in the output_dict in order to ensure that the", "# items are in the correct order.", "self", ".", "output_dict", "[", "obj", ".", "output_opti...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Status.run
Monitors if the config file or plugins are updated. Also outputs the JSON data generated by the plugins, without needing to poll the threads.
i3situation/core/status.py
def run(self): """ Monitors if the config file or plugins are updated. Also outputs the JSON data generated by the plugins, without needing to poll the threads. """ self.run_plugins() while True: # Reload plugins and config if either the config file or plugin ...
def run(self): """ Monitors if the config file or plugins are updated. Also outputs the JSON data generated by the plugins, without needing to poll the threads. """ self.run_plugins() while True: # Reload plugins and config if either the config file or plugin ...
[ "Monitors", "if", "the", "config", "file", "or", "plugins", "are", "updated", ".", "Also", "outputs", "the", "JSON", "data", "generated", "by", "the", "plugins", "without", "needing", "to", "poll", "the", "threads", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L111-L127
[ "def", "run", "(", "self", ")", ":", "self", ".", "run_plugins", "(", ")", "while", "True", ":", "# Reload plugins and config if either the config file or plugin", "# directory are modified.", "if", "self", ".", "_config_mod_time", "!=", "os", ".", "path", ".", "get...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Status._remove_empty_output
If plugins haven't been initialised and therefore not sending output or their output is None, there is no reason to take up extra room on the bar.
i3situation/core/status.py
def _remove_empty_output(self): """ If plugins haven't been initialised and therefore not sending output or their output is None, there is no reason to take up extra room on the bar. """ output = [] for key in self.output_dict: if self.output_dict[key]...
def _remove_empty_output(self): """ If plugins haven't been initialised and therefore not sending output or their output is None, there is no reason to take up extra room on the bar. """ output = [] for key in self.output_dict: if self.output_dict[key]...
[ "If", "plugins", "haven", "t", "been", "initialised", "and", "therefore", "not", "sending", "output", "or", "their", "output", "is", "None", "there", "is", "no", "reason", "to", "take", "up", "extra", "room", "on", "the", "bar", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L129-L139
[ "def", "_remove_empty_output", "(", "self", ")", ":", "output", "=", "[", "]", "for", "key", "in", "self", ".", "output_dict", ":", "if", "self", ".", "output_dict", "[", "key", "]", "is", "not", "None", "and", "'full_text'", "in", "self", ".", "output...
3160a21006fcc6961f240988874e228a5ec6f18e
train
Status.handle_events
An event handler that processes events from stdin and calls the on_click function of the respective object. This function is run in another thread, so as to not stall the main thread.
i3situation/core/status.py
def handle_events(self): """ An event handler that processes events from stdin and calls the on_click function of the respective object. This function is run in another thread, so as to not stall the main thread. """ for event in sys.stdin: if event.startswith...
def handle_events(self): """ An event handler that processes events from stdin and calls the on_click function of the respective object. This function is run in another thread, so as to not stall the main thread. """ for event in sys.stdin: if event.startswith...
[ "An", "event", "handler", "that", "processes", "events", "from", "stdin", "and", "calls", "the", "on_click", "function", "of", "the", "respective", "object", ".", "This", "function", "is", "run", "in", "another", "thread", "so", "as", "to", "not", "stall", ...
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L141-L153
[ "def", "handle_events", "(", "self", ")", ":", "for", "event", "in", "sys", ".", "stdin", ":", "if", "event", ".", "startswith", "(", "'['", ")", ":", "continue", "name", "=", "json", ".", "loads", "(", "event", ".", "lstrip", "(", "','", ")", ")",...
3160a21006fcc6961f240988874e228a5ec6f18e
train
FieldChoicePlugin.field_dict
Helper function that returns a dictionary of all fields in the given model. If self.field_filter is set, it only includes the fields that match the filter.
django_databrowse/plugins/fieldchoices.py
def field_dict(self, model): """ Helper function that returns a dictionary of all fields in the given model. If self.field_filter is set, it only includes the fields that match the filter. """ if self.field_filter: return dict( [(f.name, f) for...
def field_dict(self, model): """ Helper function that returns a dictionary of all fields in the given model. If self.field_filter is set, it only includes the fields that match the filter. """ if self.field_filter: return dict( [(f.name, f) for...
[ "Helper", "function", "that", "returns", "a", "dictionary", "of", "all", "fields", "in", "the", "given", "model", ".", "If", "self", ".", "field_filter", "is", "set", "it", "only", "includes", "the", "fields", "that", "match", "the", "filter", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/plugins/fieldchoices.py#L25-L43
[ "def", "field_dict", "(", "self", ",", "model", ")", ":", "if", "self", ".", "field_filter", ":", "return", "dict", "(", "[", "(", "f", ".", "name", ",", "f", ")", "for", "f", "in", "model", ".", "_meta", ".", "fields", "if", "self", ".", "field_...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
Thread.run
Calls the main function of a plugin and mutates the output dict with its return value. Provides an easy way to change the output whilst not needing to constantly poll a queue in another thread and allowing plugin's to manage their own intervals.
i3situation/core/plugin_manager.py
def run(self): """ Calls the main function of a plugin and mutates the output dict with its return value. Provides an easy way to change the output whilst not needing to constantly poll a queue in another thread and allowing plugin's to manage their own intervals. """ ...
def run(self): """ Calls the main function of a plugin and mutates the output dict with its return value. Provides an easy way to change the output whilst not needing to constantly poll a queue in another thread and allowing plugin's to manage their own intervals. """ ...
[ "Calls", "the", "main", "function", "of", "a", "plugin", "and", "mutates", "the", "output", "dict", "with", "its", "return", "value", ".", "Provides", "an", "easy", "way", "to", "change", "the", "output", "whilst", "not", "needing", "to", "constantly", "po...
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L43-L55
[ "def", "run", "(", "self", ")", ":", "self", ".", "running", "=", "True", "while", "self", ".", "running", ":", "ret", "=", "self", ".", "func", "(", ")", "self", ".", "output_dict", "[", "ret", "[", "'name'", "]", "]", "=", "ret", "time", ".", ...
3160a21006fcc6961f240988874e228a5ec6f18e
train
ThreadManager.add_thread
Creates a thread, starts it and then adds it to the thread pool. Func: Same as in the Thread class. Interval: Same as in the Thread class.
i3situation/core/plugin_manager.py
def add_thread(self, func, interval): """ Creates a thread, starts it and then adds it to the thread pool. Func: Same as in the Thread class. Interval: Same as in the Thread class. """ t = Thread(func, interval, self.output_dict) t.start() self._thread_po...
def add_thread(self, func, interval): """ Creates a thread, starts it and then adds it to the thread pool. Func: Same as in the Thread class. Interval: Same as in the Thread class. """ t = Thread(func, interval, self.output_dict) t.start() self._thread_po...
[ "Creates", "a", "thread", "starts", "it", "and", "then", "adds", "it", "to", "the", "thread", "pool", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L84-L93
[ "def", "add_thread", "(", "self", ",", "func", ",", "interval", ")", ":", "t", "=", "Thread", "(", "func", ",", "interval", ",", "self", ".", "output_dict", ")", "t", ".", "start", "(", ")", "self", ".", "_thread_pool", ".", "append", "(", "t", ")"...
3160a21006fcc6961f240988874e228a5ec6f18e
train
PluginLoader._compile_files
Compiles python plugin files in order to be processed by the loader. It compiles the plugins if they have been updated or haven't yet been compiled.
i3situation/core/plugin_manager.py
def _compile_files(self): """ Compiles python plugin files in order to be processed by the loader. It compiles the plugins if they have been updated or haven't yet been compiled. """ for f in glob.glob(os.path.join(self.dir_path, '*.py')): # Check for compiled...
def _compile_files(self): """ Compiles python plugin files in order to be processed by the loader. It compiles the plugins if they have been updated or haven't yet been compiled. """ for f in glob.glob(os.path.join(self.dir_path, '*.py')): # Check for compiled...
[ "Compiles", "python", "plugin", "files", "in", "order", "to", "be", "processed", "by", "the", "loader", ".", "It", "compiles", "the", "plugins", "if", "they", "have", "been", "updated", "or", "haven", "t", "yet", "been", "compiled", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L125-L142
[ "def", "_compile_files", "(", "self", ")", ":", "for", "f", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "dir_path", ",", "'*.py'", ")", ")", ":", "# Check for compiled Python files that aren't in the __pycache__.", "if", ...
3160a21006fcc6961f240988874e228a5ec6f18e
train
PluginLoader._load_compiled
Accepts a path to a compiled plugin and returns a module object. file_path: A string that represents a complete file path to a compiled plugin.
i3situation/core/plugin_manager.py
def _load_compiled(self, file_path): """ Accepts a path to a compiled plugin and returns a module object. file_path: A string that represents a complete file path to a compiled plugin. """ name = os.path.splitext(os.path.split(file_path)[-1])[0] plugin_directory ...
def _load_compiled(self, file_path): """ Accepts a path to a compiled plugin and returns a module object. file_path: A string that represents a complete file path to a compiled plugin. """ name = os.path.splitext(os.path.split(file_path)[-1])[0] plugin_directory ...
[ "Accepts", "a", "path", "to", "a", "compiled", "plugin", "and", "returns", "a", "module", "object", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L144-L157
[ "def", "_load_compiled", "(", "self", ",", "file_path", ")", ":", "name", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "split", "(", "file_path", ")", "[", "-", "1", "]", ")", "[", "0", "]", "plugin_directory", "=", "os", ...
3160a21006fcc6961f240988874e228a5ec6f18e
train
PluginLoader.load_objects
Matches the plugins that have been specified in the config file with the available plugins. Returns instantiated objects based upon the classes defined in the plugins.
i3situation/core/plugin_manager.py
def load_objects(self): """ Matches the plugins that have been specified in the config file with the available plugins. Returns instantiated objects based upon the classes defined in the plugins. """ objects = [] for settings in self._config: if settin...
def load_objects(self): """ Matches the plugins that have been specified in the config file with the available plugins. Returns instantiated objects based upon the classes defined in the plugins. """ objects = [] for settings in self._config: if settin...
[ "Matches", "the", "plugins", "that", "have", "been", "specified", "in", "the", "config", "file", "with", "the", "available", "plugins", ".", "Returns", "instantiated", "objects", "based", "upon", "the", "classes", "defined", "in", "the", "plugins", "." ]
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L159-L180
[ "def", "load_objects", "(", "self", ")", ":", "objects", "=", "[", "]", "for", "settings", "in", "self", ".", "_config", ":", "if", "settings", "[", "'plugin'", "]", "in", "self", ".", "plugins", ":", "module", "=", "self", ".", "plugins", "[", "sett...
3160a21006fcc6961f240988874e228a5ec6f18e
train
PluginLoader.refresh_files
Discovers the available plugins and turns each into a module object. This is a seperate function to allow plugins to be updated dynamically by other parts of the application.
i3situation/core/plugin_manager.py
def refresh_files(self): """ Discovers the available plugins and turns each into a module object. This is a seperate function to allow plugins to be updated dynamically by other parts of the application. """ plugins = {} _plugin_files = glob.glob(os.path.join(self...
def refresh_files(self): """ Discovers the available plugins and turns each into a module object. This is a seperate function to allow plugins to be updated dynamically by other parts of the application. """ plugins = {} _plugin_files = glob.glob(os.path.join(self...
[ "Discovers", "the", "available", "plugins", "and", "turns", "each", "into", "a", "module", "object", ".", "This", "is", "a", "seperate", "function", "to", "allow", "plugins", "to", "be", "updated", "dynamically", "by", "other", "parts", "of", "the", "applica...
HarveyHunt/i3situation
python
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L182-L199
[ "def", "refresh_files", "(", "self", ")", ":", "plugins", "=", "{", "}", "_plugin_files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "dir_path", ",", "'[!_]*.pyc'", ")", ")", "for", "f", "in", "glob", ".", "glo...
3160a21006fcc6961f240988874e228a5ec6f18e
train
ModelDatabrowse.root
Handles main URL routing for the databrowse app. `url` is the remainder of the URL -- e.g. 'objects/3'.
django_databrowse/sites.py
def root(self, request, url): """ Handles main URL routing for the databrowse app. `url` is the remainder of the URL -- e.g. 'objects/3'. """ # Delegate to the appropriate method, based on the URL. if url is None: return self.main_view(request) try: ...
def root(self, request, url): """ Handles main URL routing for the databrowse app. `url` is the remainder of the URL -- e.g. 'objects/3'. """ # Delegate to the appropriate method, based on the URL. if url is None: return self.main_view(request) try: ...
[ "Handles", "main", "URL", "routing", "for", "the", "databrowse", "app", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L55-L73
[ "def", "root", "(", "self", ",", "request", ",", "url", ")", ":", "# Delegate to the appropriate method, based on the URL.", "if", "url", "is", "None", ":", "return", "self", ".", "main_view", "(", "request", ")", "try", ":", "plugin_name", ",", "rest_of_url", ...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
DatabrowseSite.register
Registers the given model(s) with the given databrowse site. The model(s) should be Model classes, not instances. If a databrowse class isn't given, it will use DefaultModelDatabrowse (the default databrowse options). If a model is already registered, this will raise AlreadyRegistered...
django_databrowse/sites.py
def register(self, *model_list, **options): """ Registers the given model(s) with the given databrowse site. The model(s) should be Model classes, not instances. If a databrowse class isn't given, it will use DefaultModelDatabrowse (the default databrowse options). If ...
def register(self, *model_list, **options): """ Registers the given model(s) with the given databrowse site. The model(s) should be Model classes, not instances. If a databrowse class isn't given, it will use DefaultModelDatabrowse (the default databrowse options). If ...
[ "Registers", "the", "given", "model", "(", "s", ")", "with", "the", "given", "databrowse", "site", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L119-L136
[ "def", "register", "(", "self", ",", "*", "model_list", ",", "*", "*", "options", ")", ":", "databrowse_class", "=", "options", ".", "pop", "(", "'databrowse_class'", ",", "DefaultModelDatabrowse", ")", "for", "model", "in", "model_list", ":", "if", "model",...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
DatabrowseSite.unregister
Unregisters the given model(s). If a model isn't already registered, this will raise NotRegistered.
django_databrowse/sites.py
def unregister(self, *model_list): """ Unregisters the given model(s). If a model isn't already registered, this will raise NotRegistered. """ for model in model_list: if model not in self.registry: raise NotRegistered('The model %s is not registered'...
def unregister(self, *model_list): """ Unregisters the given model(s). If a model isn't already registered, this will raise NotRegistered. """ for model in model_list: if model not in self.registry: raise NotRegistered('The model %s is not registered'...
[ "Unregisters", "the", "given", "model", "(", "s", ")", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L138-L148
[ "def", "unregister", "(", "self", ",", "*", "model_list", ")", ":", "for", "model", "in", "model_list", ":", "if", "model", "not", "in", "self", ".", "registry", ":", "raise", "NotRegistered", "(", "'The model %s is not registered'", "%", "model", ".", "__na...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
DatabrowseSite.root
Handles main URL routing for the databrowse app. `url` is the remainder of the URL -- e.g. 'comments/comment/'.
django_databrowse/sites.py
def root(self, request, url): """ Handles main URL routing for the databrowse app. `url` is the remainder of the URL -- e.g. 'comments/comment/'. """ self.root_url = request.path[:len(request.path) - len(url)] url = url.rstrip('/') # Trim trailing slash, if it exists. ...
def root(self, request, url): """ Handles main URL routing for the databrowse app. `url` is the remainder of the URL -- e.g. 'comments/comment/'. """ self.root_url = request.path[:len(request.path) - len(url)] url = url.rstrip('/') # Trim trailing slash, if it exists. ...
[ "Handles", "main", "URL", "routing", "for", "the", "databrowse", "app", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L150-L164
[ "def", "root", "(", "self", ",", "request", ",", "url", ")", ":", "self", ".", "root_url", "=", "request", ".", "path", "[", ":", "len", "(", "request", ".", "path", ")", "-", "len", "(", "url", ")", "]", "url", "=", "url", ".", "rstrip", "(", ...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
DatabrowseSite.model_page
Handles the model-specific functionality of the databrowse site, delegating<to the appropriate ModelDatabrowse class.
django_databrowse/sites.py
def model_page(self, request, app_label, model_name, rest_of_url=None): """ Handles the model-specific functionality of the databrowse site, delegating<to the appropriate ModelDatabrowse class. """ try: model = get_model(app_label, model_name) except LookupErr...
def model_page(self, request, app_label, model_name, rest_of_url=None): """ Handles the model-specific functionality of the databrowse site, delegating<to the appropriate ModelDatabrowse class. """ try: model = get_model(app_label, model_name) except LookupErr...
[ "Handles", "the", "model", "-", "specific", "functionality", "of", "the", "databrowse", "site", "delegating<to", "the", "appropriate", "ModelDatabrowse", "class", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L173-L191
[ "def", "model_page", "(", "self", ",", "request", ",", "app_label", ",", "model_name", ",", "rest_of_url", "=", "None", ")", ":", "try", ":", "model", "=", "get_model", "(", "app_label", ",", "model_name", ")", "except", "LookupError", ":", "model", "=", ...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
EasyInstanceField.values
Returns a list of values for this field for this instance. It's a list so we can accomodate many-to-many fields.
django_databrowse/datastructures.py
def values(self): """ Returns a list of values for this field for this instance. It's a list so we can accomodate many-to-many fields. """ # This import is deliberately inside the function because it causes # some settings to be imported, and we don't want to do that at t...
def values(self): """ Returns a list of values for this field for this instance. It's a list so we can accomodate many-to-many fields. """ # This import is deliberately inside the function because it causes # some settings to be imported, and we don't want to do that at t...
[ "Returns", "a", "list", "of", "values", "for", "this", "field", "for", "this", "instance", ".", "It", "s", "a", "list", "so", "we", "can", "accomodate", "many", "-", "to", "-", "many", "fields", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/datastructures.py#L194-L230
[ "def", "values", "(", "self", ")", ":", "# This import is deliberately inside the function because it causes", "# some settings to be imported, and we don't want to do that at the", "# module level.", "if", "self", ".", "field", ".", "rel", ":", "if", "isinstance", "(", "self",...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
EasyInstanceField.urls
Returns a list of (value, URL) tuples.
django_databrowse/datastructures.py
def urls(self): "Returns a list of (value, URL) tuples." # First, check the urls() method for each plugin. plugin_urls = [] for plugin_name, plugin in \ self.model.model_databrowse().plugins.items(): urls = plugin.urls(plugin_name, self) ...
def urls(self): "Returns a list of (value, URL) tuples." # First, check the urls() method for each plugin. plugin_urls = [] for plugin_name, plugin in \ self.model.model_databrowse().plugins.items(): urls = plugin.urls(plugin_name, self) ...
[ "Returns", "a", "list", "of", "(", "value", "URL", ")", "tuples", "." ]
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/datastructures.py#L232-L273
[ "def", "urls", "(", "self", ")", ":", "# First, check the urls() method for each plugin.", "plugin_urls", "=", "[", "]", "for", "plugin_name", ",", "plugin", "in", "self", ".", "model", ".", "model_databrowse", "(", ")", ".", "plugins", ".", "items", "(", ")",...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
CalendarPlugin.field_dict
Helper function that returns a dictionary of all DateFields or DateTimeFields in the given model. If self.field_names is set, it takes that into account when building the dictionary.
django_databrowse/plugins/calendars.py
def field_dict(self, model): """ Helper function that returns a dictionary of all DateFields or DateTimeFields in the given model. If self.field_names is set, it takes that into account when building the dictionary. """ if self.field_names is None: return dict...
def field_dict(self, model): """ Helper function that returns a dictionary of all DateFields or DateTimeFields in the given model. If self.field_names is set, it takes that into account when building the dictionary. """ if self.field_names is None: return dict...
[ "Helper", "function", "that", "returns", "a", "dictionary", "of", "all", "DateFields", "or", "DateTimeFields", "in", "the", "given", "model", ".", "If", "self", ".", "field_names", "is", "set", "it", "takes", "that", "into", "account", "when", "building", "t...
Alir3z4/django-databrowse
python
https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/plugins/calendars.py#L51-L64
[ "def", "field_dict", "(", "self", ",", "model", ")", ":", "if", "self", ".", "field_names", "is", "None", ":", "return", "dict", "(", "[", "(", "f", ".", "name", ",", "f", ")", "for", "f", "in", "model", ".", "_meta", ".", "fields", "if", "isinst...
4469495cd47a0da506ddf4e8cc752c2f453e0339
train
kmer_dag
Optionally launches a Spark cluster and then runs ADAM to count k-mers on an input file. :param job: Toil job :param input_file: URL/path to input file to count k-mers on :param output_path: URL/path to save k-mer counts at :param kmer_length: The length of k-mer substrings to count. :param spa...
src/toil_scripts/adam_kmers/count_kmers.py
def kmer_dag(job, input_file, output_path, kmer_length, spark_conf, workers, cores, memory, sudo): ''' Optionally launches a Spark cluster and then runs ADAM to count k-mers on an input file. :param ...
def kmer_dag(job, input_file, output_path, kmer_length, spark_conf, workers, cores, memory, sudo): ''' Optionally launches a Spark cluster and then runs ADAM to count k-mers on an input file. :param ...
[ "Optionally", "launches", "a", "Spark", "cluster", "and", "then", "runs", "ADAM", "to", "count", "k", "-", "mers", "on", "an", "input", "file", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L20-L74
[ "def", "kmer_dag", "(", "job", ",", "input_file", ",", "output_path", ",", "kmer_length", ",", "spark_conf", ",", "workers", ",", "cores", ",", "memory", ",", "sudo", ")", ":", "require", "(", "(", "spark_conf", "is", "not", "None", "and", "workers", "is...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
download_count_upload
Runs k-mer counting. 1. If the input file is located in S3, the file is copied into HDFS. 2. If the input file is not in Parquet format, the file is converted into Parquet. 3. The k-mers are counted and saved as text. 4. If the output path is an S3 URL, the file is copied back to S3. :param job: T...
src/toil_scripts/adam_kmers/count_kmers.py
def download_count_upload(job, master_ip, input_file, output_file, kmer_length, spark_conf, memory, sudo): ''' Runs k-mer counting...
def download_count_upload(job, master_ip, input_file, output_file, kmer_length, spark_conf, memory, sudo): ''' Runs k-mer counting...
[ "Runs", "k", "-", "mer", "counting", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L76-L172
[ "def", "download_count_upload", "(", "job", ",", "master_ip", ",", "input_file", ",", "output_file", ",", "kmer_length", ",", "spark_conf", ",", "memory", ",", "sudo", ")", ":", "if", "master_ip", "is", "not", "None", ":", "hdfs_dir", "=", "\"hdfs://{0}:{1}/\"...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
main
Sets up command line parser for Toil/ADAM based k-mer counter, and launches k-mer counter with optional Spark cluster.
src/toil_scripts/adam_kmers/count_kmers.py
def main(): ''' Sets up command line parser for Toil/ADAM based k-mer counter, and launches k-mer counter with optional Spark cluster. ''' parser = argparse.ArgumentParser() # add parser arguments parser.add_argument('--input_path', help='The full path to the input ...
def main(): ''' Sets up command line parser for Toil/ADAM based k-mer counter, and launches k-mer counter with optional Spark cluster. ''' parser = argparse.ArgumentParser() # add parser arguments parser.add_argument('--input_path', help='The full path to the input ...
[ "Sets", "up", "command", "line", "parser", "for", "Toil", "/", "ADAM", "based", "k", "-", "mer", "counter", "and", "launches", "k", "-", "mer", "counter", "with", "optional", "Spark", "cluster", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L175-L223
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "# add parser arguments", "parser", ".", "add_argument", "(", "'--input_path'", ",", "help", "=", "'The full path to the input SAM/BAM/ADAM/FASTQ file.'", ")", "parser", ".", "...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
run_gatk_germline_pipeline
Downloads shared files and calls the GATK best practices germline pipeline for a cohort of samples :param JobFunctionWrappingJob job: passed automatically by Toil :param list[GermlineSample] samples: List of GermlineSample namedtuples :param Namespace config: Configuration options for pipeline Requ...
src/toil_scripts/gatk_germline/germline.py
def run_gatk_germline_pipeline(job, samples, config): """ Downloads shared files and calls the GATK best practices germline pipeline for a cohort of samples :param JobFunctionWrappingJob job: passed automatically by Toil :param list[GermlineSample] samples: List of GermlineSample namedtuples :param...
def run_gatk_germline_pipeline(job, samples, config): """ Downloads shared files and calls the GATK best practices germline pipeline for a cohort of samples :param JobFunctionWrappingJob job: passed automatically by Toil :param list[GermlineSample] samples: List of GermlineSample namedtuples :param...
[ "Downloads", "shared", "files", "and", "calls", "the", "GATK", "best", "practices", "germline", "pipeline", "for", "a", "cohort", "of", "samples" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L88-L132
[ "def", "run_gatk_germline_pipeline", "(", "job", ",", "samples", ",", "config", ")", ":", "# Determine the available disk space on a worker node before any jobs have been run.", "work_dir", "=", "job", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "st", "=", "os", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
gatk_germline_pipeline
Runs the GATK best practices pipeline for germline SNP and INDEL discovery. Steps in Pipeline 0: Generate and preprocess BAM - Uploads processed BAM to output directory 1: Call Variants using HaplotypeCaller - Uploads GVCF 2: Genotype VCF - Uploads VCF 3: Filter Variants usi...
src/toil_scripts/gatk_germline/germline.py
def gatk_germline_pipeline(job, samples, config): """ Runs the GATK best practices pipeline for germline SNP and INDEL discovery. Steps in Pipeline 0: Generate and preprocess BAM - Uploads processed BAM to output directory 1: Call Variants using HaplotypeCaller - Uploads GVCF 2:...
def gatk_germline_pipeline(job, samples, config): """ Runs the GATK best practices pipeline for germline SNP and INDEL discovery. Steps in Pipeline 0: Generate and preprocess BAM - Uploads processed BAM to output directory 1: Call Variants using HaplotypeCaller - Uploads GVCF 2:...
[ "Runs", "the", "GATK", "best", "practices", "pipeline", "for", "germline", "SNP", "and", "INDEL", "discovery", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L135-L233
[ "def", "gatk_germline_pipeline", "(", "job", ",", "samples", ",", "config", ")", ":", "require", "(", "len", "(", "samples", ")", ">", "0", ",", "'No samples were provided!'", ")", "# Get total size of genome reference files. This is used for configuring disk size.", "gen...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
joint_genotype_and_filter
Checks for enough disk space for joint genotyping, then calls the genotype and filter pipeline function. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID} :param Namespace config: Input parameters and reference FileStoreIDs ...
src/toil_scripts/gatk_germline/germline.py
def joint_genotype_and_filter(job, gvcfs, config): """ Checks for enough disk space for joint genotyping, then calls the genotype and filter pipeline function. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID} :param Name...
def joint_genotype_and_filter(job, gvcfs, config): """ Checks for enough disk space for joint genotyping, then calls the genotype and filter pipeline function. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID} :param Name...
[ "Checks", "for", "enough", "disk", "space", "for", "joint", "genotyping", "then", "calls", "the", "genotype", "and", "filter", "pipeline", "function", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L236-L262
[ "def", "joint_genotype_and_filter", "(", "job", ",", "gvcfs", ",", "config", ")", ":", "# Get the total size of genome reference files", "genome_ref_size", "=", "config", ".", "genome_fasta", ".", "size", "+", "config", ".", "genome_fai", ".", "size", "+", "config",...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
genotype_and_filter
Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file to the config output directory. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID} :param Namespace config: I...
src/toil_scripts/gatk_germline/germline.py
def genotype_and_filter(job, gvcfs, config): """ Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file to the config output directory. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict gvcfs: Dictionary of GVCF...
def genotype_and_filter(job, gvcfs, config): """ Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file to the config output directory. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict gvcfs: Dictionary of GVCF...
[ "Genotypes", "one", "or", "more", "GVCF", "files", "and", "runs", "either", "the", "VQSR", "or", "hard", "filtering", "pipeline", ".", "Uploads", "the", "genotyped", "VCF", "file", "to", "the", "config", "output", "directory", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L265-L333
[ "def", "genotype_and_filter", "(", "job", ",", "gvcfs", ",", "config", ")", ":", "# Get the total size of the genome reference", "genome_ref_size", "=", "config", ".", "genome_fasta", ".", "size", "+", "config", ".", "genome_fai", ".", "size", "+", "config", ".", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
annotate_vcfs
Runs Oncotator for a group of VCF files. Each sample is annotated individually. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID} :param Namespace config: Input parameters and shared FileStoreIDs Require...
src/toil_scripts/gatk_germline/germline.py
def annotate_vcfs(job, vcfs, config): """ Runs Oncotator for a group of VCF files. Each sample is annotated individually. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID} :param Namespace config: Input ...
def annotate_vcfs(job, vcfs, config): """ Runs Oncotator for a group of VCF files. Each sample is annotated individually. :param JobFunctionWrappingJob job: passed automatically by Toil :param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID} :param Namespace config: Input ...
[ "Runs", "Oncotator", "for", "a", "group", "of", "VCF", "files", ".", "Each", "sample", "is", "annotated", "individually", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L336-L373
[ "def", "annotate_vcfs", "(", "job", ",", "vcfs", ",", "config", ")", ":", "job", ".", "fileStore", ".", "logToMaster", "(", "'Running Oncotator on the following samples:\\n%s'", "%", "'\\n'", ".", "join", "(", "vcfs", ".", "keys", "(", ")", ")", ")", "for", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
parse_manifest
Parses manifest file for Toil Germline Pipeline :param str path_to_manifest: Path to sample manifest file :return: List of GermlineSample namedtuples :rtype: list[GermlineSample]
src/toil_scripts/gatk_germline/germline.py
def parse_manifest(path_to_manifest): """ Parses manifest file for Toil Germline Pipeline :param str path_to_manifest: Path to sample manifest file :return: List of GermlineSample namedtuples :rtype: list[GermlineSample] """ bam_re = r"^(?P<uuid>\S+)\s(?P<url>\S+[bsc][r]?am)" fq_re = r"...
def parse_manifest(path_to_manifest): """ Parses manifest file for Toil Germline Pipeline :param str path_to_manifest: Path to sample manifest file :return: List of GermlineSample namedtuples :rtype: list[GermlineSample] """ bam_re = r"^(?P<uuid>\S+)\s(?P<url>\S+[bsc][r]?am)" fq_re = r"...
[ "Parses", "manifest", "file", "for", "Toil", "Germline", "Pipeline" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L379-L416
[ "def", "parse_manifest", "(", "path_to_manifest", ")", ":", "bam_re", "=", "r\"^(?P<uuid>\\S+)\\s(?P<url>\\S+[bsc][r]?am)\"", "fq_re", "=", "r\"^(?P<uuid>\\S+)\\s(?P<url>\\S+)\\s(?P<paired_url>\\S+)?\\s?(?P<rg_line>@RG\\S+)\"", "samples", "=", "[", "]", "with", "open", "(", "pa...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
download_shared_files
Downloads shared reference files for Toil Germline pipeline :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Pipeline configuration options :return: Updated config with shared fileStoreIDS :rtype: Namespace
src/toil_scripts/gatk_germline/germline.py
def download_shared_files(job, config): """ Downloads shared reference files for Toil Germline pipeline :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Pipeline configuration options :return: Updated config with shared fileStoreIDS :rtype: Namespace ...
def download_shared_files(job, config): """ Downloads shared reference files for Toil Germline pipeline :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Pipeline configuration options :return: Updated config with shared fileStoreIDS :rtype: Namespace ...
[ "Downloads", "shared", "reference", "files", "for", "Toil", "Germline", "pipeline" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L419-L456
[ "def", "download_shared_files", "(", "job", ",", "config", ")", ":", "job", ".", "fileStore", ".", "logToMaster", "(", "'Downloading shared reference files'", ")", "shared_files", "=", "{", "'genome_fasta'", ",", "'genome_fai'", ",", "'genome_dict'", "}", "nonessent...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
reference_preprocessing
Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config. :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Pipeline configuration options and shared files. Requires FileStoreID for genome fasta f...
src/toil_scripts/gatk_germline/germline.py
def reference_preprocessing(job, config): """ Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config. :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Pipeline configuration options and shared files. ...
def reference_preprocessing(job, config): """ Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config. :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Pipeline configuration options and shared files. ...
[ "Creates", "a", "genome", "fasta", "index", "and", "sequence", "dictionary", "file", "if", "not", "already", "present", "in", "the", "pipeline", "config", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L459-L480
[ "def", "reference_preprocessing", "(", "job", ",", "config", ")", ":", "job", ".", "fileStore", ".", "logToMaster", "(", "'Preparing Reference Files'", ")", "genome_id", "=", "config", ".", "genome_fasta", "if", "getattr", "(", "config", ",", "'genome_fai'", ","...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
prepare_bam
Prepares BAM file for Toil germline pipeline. Steps in pipeline 0: Download and align BAM or FASTQ sample 1: Sort BAM 2: Index BAM 3: Run GATK preprocessing pipeline (Optional) - Uploads preprocessed BAM to output directory :param JobFunctionWrappingJob job: passed automatically by Toi...
src/toil_scripts/gatk_germline/germline.py
def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None): """ Prepares BAM file for Toil germline pipeline. Steps in pipeline 0: Download and align BAM or FASTQ sample 1: Sort BAM 2: Index BAM 3: Run GATK preprocessing pipeline (Optional) - Uploads preprocessed BAM to ...
def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None): """ Prepares BAM file for Toil germline pipeline. Steps in pipeline 0: Download and align BAM or FASTQ sample 1: Sort BAM 2: Index BAM 3: Run GATK preprocessing pipeline (Optional) - Uploads preprocessed BAM to ...
[ "Prepares", "BAM", "file", "for", "Toil", "germline", "pipeline", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L483-L592
[ "def", "prepare_bam", "(", "job", ",", "uuid", ",", "url", ",", "config", ",", "paired_url", "=", "None", ",", "rg_line", "=", "None", ")", ":", "# 0: Align FASTQ or realign BAM", "if", "config", ".", "run_bwa", ":", "get_bam", "=", "job", ".", "wrapJobFn"...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
setup_and_run_bwakit
Downloads and runs bwakit for BAM or FASTQ files :param JobFunctionWrappingJob job: passed automatically by Toil :param str uuid: Unique sample identifier :param str url: FASTQ or BAM file URL. BAM alignment URL must have .bam extension. :param Namespace config: Input parameters and shared FileStoreIDs...
src/toil_scripts/gatk_germline/germline.py
def setup_and_run_bwakit(job, uuid, url, rg_line, config, paired_url=None): """ Downloads and runs bwakit for BAM or FASTQ files :param JobFunctionWrappingJob job: passed automatically by Toil :param str uuid: Unique sample identifier :param str url: FASTQ or BAM file URL. BAM alignment URL must ha...
def setup_and_run_bwakit(job, uuid, url, rg_line, config, paired_url=None): """ Downloads and runs bwakit for BAM or FASTQ files :param JobFunctionWrappingJob job: passed automatically by Toil :param str uuid: Unique sample identifier :param str url: FASTQ or BAM file URL. BAM alignment URL must ha...
[ "Downloads", "and", "runs", "bwakit", "for", "BAM", "or", "FASTQ", "files" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L595-L680
[ "def", "setup_and_run_bwakit", "(", "job", ",", "uuid", ",", "url", ",", "rg_line", ",", "config", ",", "paired_url", "=", "None", ")", ":", "bwa_config", "=", "deepcopy", "(", "config", ")", "bwa_config", ".", "uuid", "=", "uuid", "bwa_config", ".", "rg...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
gatk_haplotype_caller
Uses GATK HaplotypeCaller to identify SNPs and INDELs. Outputs variants in a Genomic VCF file. :param JobFunctionWrappingJob job: passed automatically by Toil :param str bam: FileStoreID for BAM file :param str bai: FileStoreID for BAM index file :param str ref: FileStoreID for reference genome fasta f...
src/toil_scripts/gatk_germline/germline.py
def gatk_haplotype_caller(job, bam, bai, ref, fai, ref_dict, annotations=None, emit_threshold=10.0, call_threshold=30.0, unsafe_mode=False, hc_output=None): """...
def gatk_haplotype_caller(job, bam, bai, ref, fai, ref_dict, annotations=None, emit_threshold=10.0, call_threshold=30.0, unsafe_mode=False, hc_output=None): """...
[ "Uses", "GATK", "HaplotypeCaller", "to", "identify", "SNPs", "and", "INDELs", ".", "Outputs", "variants", "in", "a", "Genomic", "VCF", "file", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L683-L749
[ "def", "gatk_haplotype_caller", "(", "job", ",", "bam", ",", "bai", ",", "ref", ",", "fai", ",", "ref_dict", ",", "annotations", "=", "None", ",", "emit_threshold", "=", "10.0", ",", "call_threshold", "=", "30.0", ",", "unsafe_mode", "=", "False", ",", "...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
main
GATK germline pipeline with variant filtering and annotation.
src/toil_scripts/gatk_germline/germline.py
def main(): """ GATK germline pipeline with variant filtering and annotation. """ # Define Parser object and add to jobTree parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) # Generate subparsers subparsers = parser.add_subparsers(dest='com...
def main(): """ GATK germline pipeline with variant filtering and annotation. """ # Define Parser object and add to jobTree parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter) # Generate subparsers subparsers = parser.add_subparsers(dest='com...
[ "GATK", "germline", "pipeline", "with", "variant", "filtering", "and", "annotation", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L752-L894
[ "def", "main", "(", ")", ":", "# Define Parser object and add to jobTree", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ",", "formatter_class", "=", "argparse", ".", "RawTextHelpFormatter", ")", "# Generate subparsers", "subparse...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
sample_loop
Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each
src/toil_scripts/adam_gatk_pipeline/align_and_call.py
def sample_loop(job, uuid_list, inputs): """ Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each """ for uuid_rg in uuid_list: uuid_items = uuid_rg.split(',') uuid = uuid_items[0] rg_line = None if len(uuid_items) > 1: rg_line = uuid_items[1] job...
def sample_loop(job, uuid_list, inputs): """ Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each """ for uuid_rg in uuid_list: uuid_items = uuid_rg.split(',') uuid = uuid_items[0] rg_line = None if len(uuid_items) > 1: rg_line = uuid_items[1] job...
[ "Loops", "over", "the", "sample_ids", "(", "uuids", ")", "in", "the", "manifest", "creating", "child", "jobs", "to", "process", "each" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L135-L148
[ "def", "sample_loop", "(", "job", ",", "uuid_list", ",", "inputs", ")", ":", "for", "uuid_rg", "in", "uuid_list", ":", "uuid_items", "=", "uuid_rg", ".", "split", "(", "','", ")", "uuid", "=", "uuid_items", "[", "0", "]", "rg_line", "=", "None", "if", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
static_dag
Prefer this here as it allows us to pull the job functions from other jobs without rewrapping the job functions back together. bwa_inputs: Input arguments to be passed to BWA. adam_inputs: Input arguments to be passed to ADAM. gatk_preprocess_inputs: Input arguments to be passed to GATK preprocessing. ...
src/toil_scripts/adam_gatk_pipeline/align_and_call.py
def static_dag(job, uuid, rg_line, inputs): """ Prefer this here as it allows us to pull the job functions from other jobs without rewrapping the job functions back together. bwa_inputs: Input arguments to be passed to BWA. adam_inputs: Input arguments to be passed to ADAM. gatk_preprocess_inpu...
def static_dag(job, uuid, rg_line, inputs): """ Prefer this here as it allows us to pull the job functions from other jobs without rewrapping the job functions back together. bwa_inputs: Input arguments to be passed to BWA. adam_inputs: Input arguments to be passed to ADAM. gatk_preprocess_inpu...
[ "Prefer", "this", "here", "as", "it", "allows", "us", "to", "pull", "the", "job", "functions", "from", "other", "jobs", "without", "rewrapping", "the", "job", "functions", "back", "together", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L151-L266
[ "def", "static_dag", "(", "job", ",", "uuid", ",", "rg_line", ",", "inputs", ")", ":", "# get work directory", "work_dir", "=", "job", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "inputs", ".", "cpu_count", "=", "cpu_count", "(", ")", "inputs", "."...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
main
This is a Toil pipeline used to perform alignment of fastqs.
src/toil_scripts/adam_gatk_pipeline/align_and_call.py
def main(): """ This is a Toil pipeline used to perform alignment of fastqs. """ # Define Parser object and add to Toil if mock_mode(): usage_msg = 'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline ' \ 'will run in mock mode. To disable mock ...
def main(): """ This is a Toil pipeline used to perform alignment of fastqs. """ # Define Parser object and add to Toil if mock_mode(): usage_msg = 'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline ' \ 'will run in mock mode. To disable mock ...
[ "This", "is", "a", "Toil", "pipeline", "used", "to", "perform", "alignment", "of", "fastqs", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L388-L458
[ "def", "main", "(", ")", ":", "# Define Parser object and add to Toil", "if", "mock_mode", "(", ")", ":", "usage_msg", "=", "'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline '", "'will run in mock mode. To disable mock mode, set TOIL_SCRIPTS_MOCK_MODE=0'", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
generate_unique_key
Input1: Path to the BD2K Master Key (for S3 Encryption) Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam) Returns: 32-byte unique key generated for that URL
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def generate_unique_key(master_key_path, url): """ Input1: Path to the BD2K Master Key (for S3 Encryption) Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam) Returns: 32-byte unique key generated for that URL """ with open(master...
def generate_unique_key(master_key_path, url): """ Input1: Path to the BD2K Master Key (for S3 Encryption) Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam) Returns: 32-byte unique key generated for that URL """ with open(master...
[ "Input1", ":", "Path", "to", "the", "BD2K", "Master", "Key", "(", "for", "S3", "Encryption", ")", "Input2", ":", "S3", "URL", "(", "e", ".", "g", ".", "https", ":", "//", "s3", "-", "us", "-", "west", "-", "2", ".", "amazonaws", ".", "com", "/"...
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L49-L62
[ "def", "generate_unique_key", "(", "master_key_path", ",", "url", ")", ":", "with", "open", "(", "master_key_path", ",", "'r'", ")", "as", "f", ":", "master_key", "=", "f", ".", "read", "(", ")", "assert", "len", "(", "master_key", ")", "==", "32", ","...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
download_encrypted_file
Downloads encrypted file from S3 Input1: Working directory Input2: S3 URL to be downloaded Input3: Path to key necessary for decryption Input4: name of file to be downloaded
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def download_encrypted_file(work_dir, url, key_path, name): """ Downloads encrypted file from S3 Input1: Working directory Input2: S3 URL to be downloaded Input3: Path to key necessary for decryption Input4: name of file to be downloaded """ file_path = os.path.join(work_dir, name) ...
def download_encrypted_file(work_dir, url, key_path, name): """ Downloads encrypted file from S3 Input1: Working directory Input2: S3 URL to be downloaded Input3: Path to key necessary for decryption Input4: name of file to be downloaded """ file_path = os.path.join(work_dir, name) ...
[ "Downloads", "encrypted", "file", "from", "S3" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L65-L85
[ "def", "download_encrypted_file", "(", "work_dir", ",", "url", ",", "key_path", ",", "name", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "name", ")", "key", "=", "generate_unique_key", "(", "key_path", ",", "url", ")...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
return_input_paths
Returns the paths of files from the FileStore Input1: Toil job instance Input2: Working directory Input3: jobstore id dictionary Input4: names of files to be returned from the jobstore Returns: path(s) to the file(s) requested -- unpack these!
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def return_input_paths(job, work_dir, ids, *args): """ Returns the paths of files from the FileStore Input1: Toil job instance Input2: Working directory Input3: jobstore id dictionary Input4: names of files to be returned from the jobstore Returns: path(s) to the file(s) requested -- unpac...
def return_input_paths(job, work_dir, ids, *args): """ Returns the paths of files from the FileStore Input1: Toil job instance Input2: Working directory Input3: jobstore id dictionary Input4: names of files to be returned from the jobstore Returns: path(s) to the file(s) requested -- unpac...
[ "Returns", "the", "paths", "of", "files", "from", "the", "FileStore" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L111-L132
[ "def", "return_input_paths", "(", "job", ",", "work_dir", ",", "ids", ",", "*", "args", ")", ":", "paths", "=", "OrderedDict", "(", ")", "for", "name", "in", "args", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
move_to_output_dir
Moves files from work_dir to output_dir Input1: Working directory Input2: Output directory Input3: UUID to be preprended onto file name Input4: list of file names to be moved from working dir to output dir
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def move_to_output_dir(work_dir, output_dir, uuid=None, files=list()): """ Moves files from work_dir to output_dir Input1: Working directory Input2: Output directory Input3: UUID to be preprended onto file name Input4: list of file names to be moved from working dir to output dir """ fo...
def move_to_output_dir(work_dir, output_dir, uuid=None, files=list()): """ Moves files from work_dir to output_dir Input1: Working directory Input2: Output directory Input3: UUID to be preprended onto file name Input4: list of file names to be moved from working dir to output dir """ fo...
[ "Moves", "files", "from", "work_dir", "to", "output_dir" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L135-L148
[ "def", "move_to_output_dir", "(", "work_dir", ",", "output_dir", ",", "uuid", "=", "None", ",", "files", "=", "list", "(", ")", ")", ":", "for", "fname", "in", "files", ":", "if", "uuid", "is", "None", ":", "shutil", ".", "move", "(", "os", ".", "p...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
batch_start
Downloads shared files that are used by all samples for alignment and places them in the jobstore.
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def batch_start(job, input_args): """ Downloads shared files that are used by all samples for alignment and places them in the jobstore. """ shared_files = ['ref.fa', 'ref.fa.amb', 'ref.fa.ann', 'ref.fa.bwt', 'ref.fa.pac', 'ref.fa.sa', 'ref.fa.fai'] shared_ids = {} for fname in shared_files: ...
def batch_start(job, input_args): """ Downloads shared files that are used by all samples for alignment and places them in the jobstore. """ shared_files = ['ref.fa', 'ref.fa.amb', 'ref.fa.ann', 'ref.fa.bwt', 'ref.fa.pac', 'ref.fa.sa', 'ref.fa.fai'] shared_ids = {} for fname in shared_files: ...
[ "Downloads", "shared", "files", "that", "are", "used", "by", "all", "samples", "for", "alignment", "and", "places", "them", "in", "the", "jobstore", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L152-L161
[ "def", "batch_start", "(", "job", ",", "input_args", ")", ":", "shared_files", "=", "[", "'ref.fa'", ",", "'ref.fa.amb'", ",", "'ref.fa.ann'", ",", "'ref.fa.bwt'", ",", "'ref.fa.pac'", ",", "'ref.fa.sa'", ",", "'ref.fa.fai'", "]", "shared_ids", "=", "{", "}", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
spawn_batch_jobs
Spawns an alignment job for every sample in the input configuration file
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def spawn_batch_jobs(job, shared_ids, input_args): """ Spawns an alignment job for every sample in the input configuration file """ samples = [] config = input_args['config'] with open(config, 'r') as f_in: for line in f_in: line = line.strip().split(',') uuid = l...
def spawn_batch_jobs(job, shared_ids, input_args): """ Spawns an alignment job for every sample in the input configuration file """ samples = [] config = input_args['config'] with open(config, 'r') as f_in: for line in f_in: line = line.strip().split(',') uuid = l...
[ "Spawns", "an", "alignment", "job", "for", "every", "sample", "in", "the", "input", "configuration", "file" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L164-L177
[ "def", "spawn_batch_jobs", "(", "job", ",", "shared_ids", ",", "input_args", ")", ":", "samples", "=", "[", "]", "config", "=", "input_args", "[", "'config'", "]", "with", "open", "(", "config", ",", "'r'", ")", "as", "f_in", ":", "for", "line", "in", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
alignment
Runs BWA and then Bamsort on the supplied fastqs for this sample Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def alignment(job, ids, input_args, sample): """ Runs BWA and then Bamsort on the supplied fastqs for this sample Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample """ uuid, urls = sa...
def alignment(job, ids, input_args, sample): """ Runs BWA and then Bamsort on the supplied fastqs for this sample Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample """ uuid, urls = sa...
[ "Runs", "BWA", "and", "then", "Bamsort", "on", "the", "supplied", "fastqs", "for", "this", "sample" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L180-L238
[ "def", "alignment", "(", "job", ",", "ids", ",", "input_args", ",", "sample", ")", ":", "uuid", ",", "urls", "=", "sample", "# ids['bam'] = job.fileStore.getEmptyFileStoreID()", "work_dir", "=", "job", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "output_...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
upload_bam_to_s3
Uploads output BAM from sample to S3 Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
def upload_bam_to_s3(job, ids, input_args, sample): """ Uploads output BAM from sample to S3 Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample """ uuid, urls = sample key_path = i...
def upload_bam_to_s3(job, ids, input_args, sample): """ Uploads output BAM from sample to S3 Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample """ uuid, urls = sample key_path = i...
[ "Uploads", "output", "BAM", "from", "sample", "to", "S3" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L241-L272
[ "def", "upload_bam_to_s3", "(", "job", ",", "ids", ",", "input_args", ",", "sample", ")", ":", "uuid", ",", "urls", "=", "sample", "key_path", "=", "input_args", "[", "'ssec'", "]", "work_dir", "=", "job", ".", "fileStore", ".", "getLocalTempDir", "(", "...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
vqsr_pipeline
Runs GATK Variant Quality Score Recalibration. 0: Start 0 --> 1 --> 3 --> 4 --> 5 1: Recalibrate SNPs | | 2: Recalibrate INDELS +-> 2 -+ 3: Apply SNP Recalibration 4: Apply INDEL Recalibration 5: Write VCF to output directory :p...
src/toil_scripts/gatk_germline/vqsr.py
def vqsr_pipeline(job, uuid, vcf_id, config): """ Runs GATK Variant Quality Score Recalibration. 0: Start 0 --> 1 --> 3 --> 4 --> 5 1: Recalibrate SNPs | | 2: Recalibrate INDELS +-> 2 -+ 3: Apply SNP Recalibration 4: Apply INDEL ...
def vqsr_pipeline(job, uuid, vcf_id, config): """ Runs GATK Variant Quality Score Recalibration. 0: Start 0 --> 1 --> 3 --> 4 --> 5 1: Recalibrate SNPs | | 2: Recalibrate INDELS +-> 2 -+ 3: Apply SNP Recalibration 4: Apply INDEL ...
[ "Runs", "GATK", "Variant", "Quality", "Score", "Recalibration", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/vqsr.py#L12-L162
[ "def", "vqsr_pipeline", "(", "job", ",", "uuid", ",", "vcf_id", ",", "config", ")", ":", "# Get the total size of the genome reference", "genome_ref_size", "=", "config", ".", "genome_fasta", ".", "size", "+", "config", ".", "genome_fai", ".", "size", "+", "conf...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
get_short_annotations
Converts full GATK annotation name to the shortened version :param annotations: :return:
src/toil_scripts/gatk_germline/vqsr.py
def get_short_annotations(annotations): """ Converts full GATK annotation name to the shortened version :param annotations: :return: """ # Annotations need to match VCF header short_name = {'QualByDepth': 'QD', 'FisherStrand': 'FS', 'StrandOddsRatio': 'SOR...
def get_short_annotations(annotations): """ Converts full GATK annotation name to the shortened version :param annotations: :return: """ # Annotations need to match VCF header short_name = {'QualByDepth': 'QD', 'FisherStrand': 'FS', 'StrandOddsRatio': 'SOR...
[ "Converts", "full", "GATK", "annotation", "name", "to", "the", "shortened", "version", ":", "param", "annotations", ":", ":", "return", ":" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/vqsr.py#L165-L185
[ "def", "get_short_annotations", "(", "annotations", ")", ":", "# Annotations need to match VCF header", "short_name", "=", "{", "'QualByDepth'", ":", "'QD'", ",", "'FisherStrand'", ":", "'FS'", ",", "'StrandOddsRatio'", ":", "'SOR'", ",", "'ReadPosRankSumTest'", ":", ...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
parse_sra
Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ] Returns duplicate of ids to follow UUID/URL standard.
src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py
def parse_sra(path_to_config): """ Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ] Returns duplicate of ids to follow UUID/URL standard. """ samples = [] with open(path_to_config, 'r') as f: for line in f.readlines(): if not line.iss...
def parse_sra(path_to_config): """ Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ] Returns duplicate of ids to follow UUID/URL standard. """ samples = [] with open(path_to_config, 'r') as f: for line in f.readlines(): if not line.iss...
[ "Parses", "genetorrent", "config", "file", ".", "Returns", "list", "of", "samples", ":", "[", "[", "id1", "id1", "]", "[", "id2", "id2", "]", "...", "]", "Returns", "duplicate", "of", "ids", "to", "follow", "UUID", "/", "URL", "standard", "." ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L82-L92
[ "def", "parse_sra", "(", "path_to_config", ")", ":", "samples", "=", "[", "]", "with", "open", "(", "path_to_config", ",", "'r'", ")", "as", "f", ":", "for", "line", "in", "f", ".", "readlines", "(", ")", ":", "if", "not", "line", ".", "isspace", "...
f878d863defcdccaabb7fe06f991451b7a198fb7
train
tarball_files
Tars a group of files together into a tarball work_dir: str Current Working Directory tar_name: str Name of tarball uuid: str UUID to stamp files with files: str(s) List of filenames to place in the tarball from working directory
src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py
def tarball_files(work_dir, tar_name, uuid=None, files=None): """ Tars a group of files together into a tarball work_dir: str Current Working Directory tar_name: str Name of tarball uuid: str UUID to stamp files with files: str(s) List of filenames to place in the ta...
def tarball_files(work_dir, tar_name, uuid=None, files=None): """ Tars a group of files together into a tarball work_dir: str Current Working Directory tar_name: str Name of tarball uuid: str UUID to stamp files with files: str(s) List of filenames to place in the ta...
[ "Tars", "a", "group", "of", "files", "together", "into", "a", "tarball" ]
BD2KGenomics/toil-scripts
python
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L95-L109
[ "def", "tarball_files", "(", "work_dir", ",", "tar_name", ",", "uuid", "=", "None", ",", "files", "=", "None", ")", ":", "with", "tarfile", ".", "open", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "tar_name", ")", ",", "'w:gz'", ")", ...
f878d863defcdccaabb7fe06f991451b7a198fb7