repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
asweigart/PyMsgBox
pymsgbox/__init__.py
_buttonbox
def _buttonbox(msg, title, choices, root=None, timeout=None): """ Display a msg, a title, and a set of buttons. The buttons are defined by the members of the choices list. Return the text of the button that the user selected. @arg msg: the msg to be displayed. @arg title: the window title @...
python
def _buttonbox(msg, title, choices, root=None, timeout=None): """ Display a msg, a title, and a set of buttons. The buttons are defined by the members of the choices list. Return the text of the button that the user selected. @arg msg: the msg to be displayed. @arg title: the window title @...
[ "def", "_buttonbox", "(", "msg", ",", "title", ",", "choices", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "global", "boxRoot", ",", "__replyButtonText", ",", "__widgetTexts", ",", "buttonsFrame", "# Initialize __replyButtonText to the first c...
Display a msg, a title, and a set of buttons. The buttons are defined by the members of the choices list. Return the text of the button that the user selected. @arg msg: the msg to be displayed. @arg title: the window title @arg choices: a list or tuple of the choices to be displayed
[ "Display", "a", "msg", "a", "title", "and", "a", "set", "of", "buttons", ".", "The", "buttons", "are", "defined", "by", "the", "members", "of", "the", "choices", "list", ".", "Return", "the", "text", "of", "the", "button", "that", "the", "user", "selec...
train
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L134-L194
asweigart/PyMsgBox
pymsgbox/__init__.py
__put_buttons_in_buttonframe
def __put_buttons_in_buttonframe(choices): """Put the buttons in the buttons frame""" global __widgetTexts, __firstWidget, buttonsFrame __firstWidget = None __widgetTexts = {} i = 0 for buttonText in choices: tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText) _...
python
def __put_buttons_in_buttonframe(choices): """Put the buttons in the buttons frame""" global __widgetTexts, __firstWidget, buttonsFrame __firstWidget = None __widgetTexts = {} i = 0 for buttonText in choices: tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText) _...
[ "def", "__put_buttons_in_buttonframe", "(", "choices", ")", ":", "global", "__widgetTexts", ",", "__firstWidget", ",", "buttonsFrame", "__firstWidget", "=", "None", "__widgetTexts", "=", "{", "}", "i", "=", "0", "for", "buttonText", "in", "choices", ":", "tempBu...
Put the buttons in the buttons frame
[ "Put", "the", "buttons", "in", "the", "buttons", "frame" ]
train
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L197-L226
asweigart/PyMsgBox
pymsgbox/__init__.py
__fillablebox
def __fillablebox(msg, title='', default='', mask=None, root=None, timeout=None): """ Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels th...
python
def __fillablebox(msg, title='', default='', mask=None, root=None, timeout=None): """ Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels th...
[ "def", "__fillablebox", "(", "msg", ",", "title", "=", "''", ",", "default", "=", "''", ",", "mask", "=", "None", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "global", "boxRoot", ",", "__enterboxText", ",", "__enterboxDefaultText", ...
Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels the operation.
[ "Show", "a", "box", "in", "which", "a", "user", "can", "enter", "some", "text", ".", "You", "may", "optionally", "specify", "some", "default", "text", "which", "will", "appear", "in", "the", "enterbox", "when", "it", "is", "displayed", ".", "Returns", "t...
train
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L259-L365
refindlyllc/rets
rets/parsers/login.py
OneXLogin.parse
def parse(self, response): """ Parse the login xml response :param response: the login response from the RETS server :return: None """ self.headers = response.headers if 'xml' in self.headers.get('Content-Type'): # Got an XML response, likely an error...
python
def parse(self, response): """ Parse the login xml response :param response: the login response from the RETS server :return: None """ self.headers = response.headers if 'xml' in self.headers.get('Content-Type'): # Got an XML response, likely an error...
[ "def", "parse", "(", "self", ",", "response", ")", ":", "self", ".", "headers", "=", "response", ".", "headers", "if", "'xml'", "in", "self", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ":", "# Got an XML response, likely an error code.", "xml", ...
Parse the login xml response :param response: the login response from the RETS server :return: None
[ "Parse", "the", "login", "xml", "response", ":", "param", "response", ":", "the", "login", "response", "from", "the", "RETS", "server", ":", "return", ":", "None" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/login.py#L20-L45
refindlyllc/rets
rets/parsers/login.py
OneXLogin.read_line
def read_line(line): """Reads lines of XML and delimits, strips, and returns.""" name, value = '', '' if '=' in line: name, value = line.split('=', 1) return [name.strip(), value.strip()]
python
def read_line(line): """Reads lines of XML and delimits, strips, and returns.""" name, value = '', '' if '=' in line: name, value = line.split('=', 1) return [name.strip(), value.strip()]
[ "def", "read_line", "(", "line", ")", ":", "name", ",", "value", "=", "''", ",", "''", "if", "'='", "in", "line", ":", "name", ",", "value", "=", "line", ".", "split", "(", "'='", ",", "1", ")", "return", "[", "name", ".", "strip", "(", ")", ...
Reads lines of XML and delimits, strips, and returns.
[ "Reads", "lines", "of", "XML", "and", "delimits", "strips", "and", "returns", "." ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/login.py#L48-L55
refindlyllc/rets
rets/parsers/search.py
OneXSearchCursor.generator
def generator(self, response): """ Takes a response socket connection and iteratively parses and yields the results as python dictionaries. :param response: a Requests response object with stream=True :return: """ delim = '\t' # Default to tab delimited columns ...
python
def generator(self, response): """ Takes a response socket connection and iteratively parses and yields the results as python dictionaries. :param response: a Requests response object with stream=True :return: """ delim = '\t' # Default to tab delimited columns ...
[ "def", "generator", "(", "self", ",", "response", ")", ":", "delim", "=", "'\\t'", "# Default to tab delimited", "columns", "=", "[", "]", "response", ".", "raw", ".", "decode_content", "=", "True", "events", "=", "ET", ".", "iterparse", "(", "BytesIO", "(...
Takes a response socket connection and iteratively parses and yields the results as python dictionaries. :param response: a Requests response object with stream=True :return:
[ "Takes", "a", "response", "socket", "connection", "and", "iteratively", "parses", "and", "yields", "the", "results", "as", "python", "dictionaries", ".", ":", "param", "response", ":", "a", "Requests", "response", "object", "with", "stream", "=", "True", ":", ...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/search.py#L18-L72
ashim888/awis
myawis/__init__.py
flatten_urlinfo
def flatten_urlinfo(urlinfo, shorter_keys=True): """ Takes a urlinfo object and returns a flat dictionary.""" def flatten(value, prefix=""): if is_string(value): _result[prefix[1:]] = value return try: len(value) except (AttributeError, TypeError): # ...
python
def flatten_urlinfo(urlinfo, shorter_keys=True): """ Takes a urlinfo object and returns a flat dictionary.""" def flatten(value, prefix=""): if is_string(value): _result[prefix[1:]] = value return try: len(value) except (AttributeError, TypeError): # ...
[ "def", "flatten_urlinfo", "(", "urlinfo", ",", "shorter_keys", "=", "True", ")", ":", "def", "flatten", "(", "value", ",", "prefix", "=", "\"\"", ")", ":", "if", "is_string", "(", "value", ")", ":", "_result", "[", "prefix", "[", "1", ":", "]", "]", ...
Takes a urlinfo object and returns a flat dictionary.
[ "Takes", "a", "urlinfo", "object", "and", "returns", "a", "flat", "dictionary", "." ]
train
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L163-L207
ashim888/awis
myawis/__init__.py
CallAwis.create_v4_signature
def create_v4_signature(self, request_params): ''' Create URI and signature headers based on AWS V4 signing process. Refer to https://docs.aws.amazon.com/AlexaWebInfoService/latest/ApiReferenceArticle.html for request params. :param request_params: dictionary of request parameters ...
python
def create_v4_signature(self, request_params): ''' Create URI and signature headers based on AWS V4 signing process. Refer to https://docs.aws.amazon.com/AlexaWebInfoService/latest/ApiReferenceArticle.html for request params. :param request_params: dictionary of request parameters ...
[ "def", "create_v4_signature", "(", "self", ",", "request_params", ")", ":", "method", "=", "'GET'", "service", "=", "'awis'", "host", "=", "'awis.us-west-1.amazonaws.com'", "region", "=", "'us-west-1'", "endpoint", "=", "'https://awis.amazonaws.com/api'", "request_param...
Create URI and signature headers based on AWS V4 signing process. Refer to https://docs.aws.amazon.com/AlexaWebInfoService/latest/ApiReferenceArticle.html for request params. :param request_params: dictionary of request parameters :return: URL and header to be passed to requests.get
[ "Create", "URI", "and", "signature", "headers", "based", "on", "AWS", "V4", "signing", "process", ".", "Refer", "to", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AlexaWebInfoService", "/", "latest", "/", "ApiReferenceArticle", ...
train
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L34-L92
ashim888/awis
myawis/__init__.py
CallAwis.urlinfo
def urlinfo(self, domain, response_group = URLINFO_RESPONSE_GROUPS): ''' Provide information about supplied domain as specified by the response group :param domain: Any valid URL :param response_group: Any valid urlinfo response group :return: Traffic and/or content data of the d...
python
def urlinfo(self, domain, response_group = URLINFO_RESPONSE_GROUPS): ''' Provide information about supplied domain as specified by the response group :param domain: Any valid URL :param response_group: Any valid urlinfo response group :return: Traffic and/or content data of the d...
[ "def", "urlinfo", "(", "self", ",", "domain", ",", "response_group", "=", "URLINFO_RESPONSE_GROUPS", ")", ":", "params", "=", "{", "'Action'", ":", "\"UrlInfo\"", ",", "'Url'", ":", "domain", ",", "'ResponseGroup'", ":", "response_group", "}", "url", ",", "h...
Provide information about supplied domain as specified by the response group :param domain: Any valid URL :param response_group: Any valid urlinfo response group :return: Traffic and/or content data of the domain in XML format
[ "Provide", "information", "about", "supplied", "domain", "as", "specified", "by", "the", "response", "group", ":", "param", "domain", ":", "Any", "valid", "URL", ":", "param", "response_group", ":", "Any", "valid", "urlinfo", "response", "group", ":", "return"...
train
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L94-L108
ashim888/awis
myawis/__init__.py
CallAwis.traffichistory
def traffichistory(self, domain, response_group=TRAFFICINFO_RESPONSE_GROUPS, myrange=31, start=20070801): ''' Provide traffic history of supplied domain :param domain: Any valid URL :param response_group: Any valid traffic history response group :return: Traffic and/or content da...
python
def traffichistory(self, domain, response_group=TRAFFICINFO_RESPONSE_GROUPS, myrange=31, start=20070801): ''' Provide traffic history of supplied domain :param domain: Any valid URL :param response_group: Any valid traffic history response group :return: Traffic and/or content da...
[ "def", "traffichistory", "(", "self", ",", "domain", ",", "response_group", "=", "TRAFFICINFO_RESPONSE_GROUPS", ",", "myrange", "=", "31", ",", "start", "=", "20070801", ")", ":", "params", "=", "{", "'Action'", ":", "\"TrafficHistory\"", ",", "'Url'", ":", ...
Provide traffic history of supplied domain :param domain: Any valid URL :param response_group: Any valid traffic history response group :return: Traffic and/or content data of the domain in XML format
[ "Provide", "traffic", "history", "of", "supplied", "domain", ":", "param", "domain", ":", "Any", "valid", "URL", ":", "param", "response_group", ":", "Any", "valid", "traffic", "history", "response", "group", ":", "return", ":", "Traffic", "and", "/", "or", ...
train
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L110-L126
ashim888/awis
myawis/__init__.py
CallAwis.cat_browse
def cat_browse(self, domain, path, response_group=CATEGORYBROWSE_RESPONSE_GROUPS, descriptions='True'): ''' Provide category browse information of specified domain :param domain: Any valid URL :param path: Valid category path :param response_group: Any valid traffic history respo...
python
def cat_browse(self, domain, path, response_group=CATEGORYBROWSE_RESPONSE_GROUPS, descriptions='True'): ''' Provide category browse information of specified domain :param domain: Any valid URL :param path: Valid category path :param response_group: Any valid traffic history respo...
[ "def", "cat_browse", "(", "self", ",", "domain", ",", "path", ",", "response_group", "=", "CATEGORYBROWSE_RESPONSE_GROUPS", ",", "descriptions", "=", "'True'", ")", ":", "params", "=", "{", "'Action'", ":", "\"CategoryListings\"", ",", "'ResponseGroup'", ":", "'...
Provide category browse information of specified domain :param domain: Any valid URL :param path: Valid category path :param response_group: Any valid traffic history response group :return: Traffic and/or content data of the domain in XML format
[ "Provide", "category", "browse", "information", "of", "specified", "domain", ":", "param", "domain", ":", "Any", "valid", "URL", ":", "param", "path", ":", "Valid", "category", "path", ":", "param", "response_group", ":", "Any", "valid", "traffic", "history", ...
train
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L139-L155
refindlyllc/rets
rets/session.py
Session.add_capability
def add_capability(self, name, uri): """ Add a capability of the RETS board :param name: The name of the capability :param uri: The capability URI given by the RETS board :return: None """ parse_results = urlparse(uri) if parse_results.hostname is None: ...
python
def add_capability(self, name, uri): """ Add a capability of the RETS board :param name: The name of the capability :param uri: The capability URI given by the RETS board :return: None """ parse_results = urlparse(uri) if parse_results.hostname is None: ...
[ "def", "add_capability", "(", "self", ",", "name", ",", "uri", ")", ":", "parse_results", "=", "urlparse", "(", "uri", ")", "if", "parse_results", ".", "hostname", "is", "None", ":", "# relative URL given, so build this into an absolute URL", "login_url", "=", "se...
Add a capability of the RETS board :param name: The name of the capability :param uri: The capability URI given by the RETS board :return: None
[ "Add", "a", "capability", "of", "the", "RETS", "board", ":", "param", "name", ":", "The", "name", "of", "the", "capability", ":", "param", "uri", ":", "The", "capability", "URI", "given", "by", "the", "RETS", "board", ":", "return", ":", "None" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L90-L110
refindlyllc/rets
rets/session.py
Session.login
def login(self): """ Login to the RETS board and return an instance of Bulletin :return: Bulletin instance """ response = self._request('Login') parser = OneXLogin() parser.parse(response) self.session_id = response.cookies.get(self.session_id_cookie_name...
python
def login(self): """ Login to the RETS board and return an instance of Bulletin :return: Bulletin instance """ response = self._request('Login') parser = OneXLogin() parser.parse(response) self.session_id = response.cookies.get(self.session_id_cookie_name...
[ "def", "login", "(", "self", ")", ":", "response", "=", "self", ".", "_request", "(", "'Login'", ")", "parser", "=", "OneXLogin", "(", ")", "parser", ".", "parse", "(", "response", ")", "self", ".", "session_id", "=", "response", ".", "cookies", ".", ...
Login to the RETS board and return an instance of Bulletin :return: Bulletin instance
[ "Login", "to", "the", "RETS", "board", "and", "return", "an", "instance", "of", "Bulletin", ":", "return", ":", "Bulletin", "instance" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L112-L132
refindlyllc/rets
rets/session.py
Session.get_resource_metadata
def get_resource_metadata(self, resource=None): """ Get resource metadata :param resource: The name of the resource to get metadata for :return: list """ result = self._make_metadata_request(meta_id=0, metadata_type='METADATA-RESOURCE') if resource: re...
python
def get_resource_metadata(self, resource=None): """ Get resource metadata :param resource: The name of the resource to get metadata for :return: list """ result = self._make_metadata_request(meta_id=0, metadata_type='METADATA-RESOURCE') if resource: re...
[ "def", "get_resource_metadata", "(", "self", ",", "resource", "=", "None", ")", ":", "result", "=", "self", ".", "_make_metadata_request", "(", "meta_id", "=", "0", ",", "metadata_type", "=", "'METADATA-RESOURCE'", ")", "if", "resource", ":", "result", "=", ...
Get resource metadata :param resource: The name of the resource to get metadata for :return: list
[ "Get", "resource", "metadata", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", "to", "get", "metadata", "for", ":", "return", ":", "list" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L152-L161
refindlyllc/rets
rets/session.py
Session.get_table_metadata
def get_table_metadata(self, resource, resource_class): """ Get metadata for a given resource: class :param resource: The name of the resource :param resource_class: The name of the class to get metadata from :return: list """ return self._make_metadata_request(me...
python
def get_table_metadata(self, resource, resource_class): """ Get metadata for a given resource: class :param resource: The name of the resource :param resource_class: The name of the class to get metadata from :return: list """ return self._make_metadata_request(me...
[ "def", "get_table_metadata", "(", "self", ",", "resource", ",", "resource_class", ")", ":", "return", "self", ".", "_make_metadata_request", "(", "meta_id", "=", "resource", "+", "':'", "+", "resource_class", ",", "metadata_type", "=", "'METADATA-TABLE'", ")" ]
Get metadata for a given resource: class :param resource: The name of the resource :param resource_class: The name of the class to get metadata from :return: list
[ "Get", "metadata", "for", "a", "given", "resource", ":", "class", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", ":", "param", "resource_class", ":", "The", "name", "of", "the", "class", "to", "get", "metadata", "from", ":", "retu...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L171-L178
refindlyllc/rets
rets/session.py
Session.get_lookup_values
def get_lookup_values(self, resource, lookup_name): """ Get possible lookup values for a given field :param resource: The name of the resource :param lookup_name: The name of the the field to get lookup values for :return: list """ return self._make_metadata_reque...
python
def get_lookup_values(self, resource, lookup_name): """ Get possible lookup values for a given field :param resource: The name of the resource :param lookup_name: The name of the the field to get lookup values for :return: list """ return self._make_metadata_reque...
[ "def", "get_lookup_values", "(", "self", ",", "resource", ",", "lookup_name", ")", ":", "return", "self", ".", "_make_metadata_request", "(", "meta_id", "=", "resource", "+", "':'", "+", "lookup_name", ",", "metadata_type", "=", "'METADATA-LOOKUP_TYPE'", ")" ]
Get possible lookup values for a given field :param resource: The name of the resource :param lookup_name: The name of the the field to get lookup values for :return: list
[ "Get", "possible", "lookup", "values", "for", "a", "given", "field", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", ":", "param", "lookup_name", ":", "The", "name", "of", "the", "the", "field", "to", "get", "lookup", "values", "fo...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L188-L195
refindlyllc/rets
rets/session.py
Session._make_metadata_request
def _make_metadata_request(self, meta_id, metadata_type=None): """ Get the Metadata. The Session initializes with 'COMPACT-DECODED' as the format type. If that returns a DTD error then we change to the 'STANDARD-XML' format and try again. :param meta_id: The name of the resource, class, ...
python
def _make_metadata_request(self, meta_id, metadata_type=None): """ Get the Metadata. The Session initializes with 'COMPACT-DECODED' as the format type. If that returns a DTD error then we change to the 'STANDARD-XML' format and try again. :param meta_id: The name of the resource, class, ...
[ "def", "_make_metadata_request", "(", "self", ",", "meta_id", ",", "metadata_type", "=", "None", ")", ":", "# If this metadata _request has already happened, returned the saved result.", "key", "=", "'{0!s}:{1!s}'", ".", "format", "(", "metadata_type", ",", "meta_id", ")"...
Get the Metadata. The Session initializes with 'COMPACT-DECODED' as the format type. If that returns a DTD error then we change to the 'STANDARD-XML' format and try again. :param meta_id: The name of the resource, class, or lookup to get metadata for :param metadata_type: The RETS metadata type ...
[ "Get", "the", "Metadata", ".", "The", "Session", "initializes", "with", "COMPACT", "-", "DECODED", "as", "the", "format", "type", ".", "If", "that", "returns", "a", "DTD", "error", "then", "we", "change", "to", "the", "STANDARD", "-", "XML", "format", "a...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L197-L238
refindlyllc/rets
rets/session.py
Session.get_preferred_object
def get_preferred_object(self, resource, object_type, content_id, location=0): """ Get the first object from a Resource :param resource: The name of the resource :param object_type: The type of object to fetch :param content_id: The unique id of the item to get objects for ...
python
def get_preferred_object(self, resource, object_type, content_id, location=0): """ Get the first object from a Resource :param resource: The name of the resource :param object_type: The type of object to fetch :param content_id: The unique id of the item to get objects for ...
[ "def", "get_preferred_object", "(", "self", ",", "resource", ",", "object_type", ",", "content_id", ",", "location", "=", "0", ")", ":", "collection", "=", "self", ".", "get_object", "(", "resource", "=", "resource", ",", "object_type", "=", "object_type", "...
Get the first object from a Resource :param resource: The name of the resource :param object_type: The type of object to fetch :param content_id: The unique id of the item to get objects for :param location: The path to get Objects from :return: Object
[ "Get", "the", "first", "object", "from", "a", "Resource", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", ":", "param", "object_type", ":", "The", "type", "of", "object", "to", "fetch", ":", "param", "content_id", ":", "The", "uniq...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L240-L251
refindlyllc/rets
rets/session.py
Session.get_object
def get_object(self, resource, object_type, content_ids, object_ids='*', location=0): """ Get a list of Objects from a resource :param resource: The resource to get objects from :param object_type: The type of object to fetch :param content_ids: The unique id of the item to get o...
python
def get_object(self, resource, object_type, content_ids, object_ids='*', location=0): """ Get a list of Objects from a resource :param resource: The resource to get objects from :param object_type: The type of object to fetch :param content_ids: The unique id of the item to get o...
[ "def", "get_object", "(", "self", ",", "resource", ",", "object_type", ",", "content_ids", ",", "object_ids", "=", "'*'", ",", "location", "=", "0", ")", ":", "object_helper", "=", "GetObject", "(", ")", "request_ids", "=", "object_helper", ".", "ids", "("...
Get a list of Objects from a resource :param resource: The resource to get objects from :param object_type: The type of object to fetch :param content_ids: The unique id of the item to get objects for :param object_ids: ids of the objects to download :param location: The path to ...
[ "Get", "a", "list", "of", "Objects", "from", "a", "resource", ":", "param", "resource", ":", "The", "resource", "to", "get", "objects", "from", ":", "param", "object_type", ":", "The", "type", "of", "object", "to", "fetch", ":", "param", "content_ids", "...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L253-L286
refindlyllc/rets
rets/session.py
Session.search
def search(self, resource, resource_class, search_filter=None, dmql_query=None, limit=9999999, offset=0, optional_parameters=None, auto_offset=True, query_type='DMQL2', standard_names=0, response_format='COMPACT-DECODED'): """ Preform a search on the RETS board :par...
python
def search(self, resource, resource_class, search_filter=None, dmql_query=None, limit=9999999, offset=0, optional_parameters=None, auto_offset=True, query_type='DMQL2', standard_names=0, response_format='COMPACT-DECODED'): """ Preform a search on the RETS board :par...
[ "def", "search", "(", "self", ",", "resource", ",", "resource_class", ",", "search_filter", "=", "None", ",", "dmql_query", "=", "None", ",", "limit", "=", "9999999", ",", "offset", "=", "0", ",", "optional_parameters", "=", "None", ",", "auto_offset", "="...
Preform a search on the RETS board :param resource: The resource that contains the class to search :param resource_class: The class to search :param search_filter: The query as a dict :param dmql_query: The query in dmql format :param limit: Limit search values count :par...
[ "Preform", "a", "search", "on", "the", "RETS", "board", ":", "param", "resource", ":", "The", "resource", "that", "contains", "the", "class", "to", "search", ":", "param", "resource_class", ":", "The", "class", "to", "search", ":", "param", "search_filter", ...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L288-L363
refindlyllc/rets
rets/session.py
Session._request
def _request(self, capability, options=None, stream=False): """ Make a _request to the RETS server :param capability: The name of the capability to use to get the URI :param options: Options to put into the _request :return: Response """ if options is None: ...
python
def _request(self, capability, options=None, stream=False): """ Make a _request to the RETS server :param capability: The name of the capability to use to get the URI :param options: Options to put into the _request :return: Response """ if options is None: ...
[ "def", "_request", "(", "self", ",", "capability", ",", "options", "=", "None", ",", "stream", "=", "False", ")", ":", "if", "options", "is", "None", ":", "options", "=", "{", "}", "options", ".", "update", "(", "{", "'headers'", ":", "self", ".", ...
Make a _request to the RETS server :param capability: The name of the capability to use to get the URI :param options: Options to put into the _request :return: Response
[ "Make", "a", "_request", "to", "the", "RETS", "server", ":", "param", "capability", ":", "The", "name", "of", "the", "capability", "to", "use", "to", "get", "the", "URI", ":", "param", "options", ":", "Options", "to", "put", "into", "the", "_request", ...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L365-L409
refindlyllc/rets
rets/session.py
Session._user_agent_digest_hash
def _user_agent_digest_hash(self): """ Hash the user agent and user agent password Section 3.10 of https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf :return: md5 """ if not self.version: raise MissingVersion("A version is required for user agent auth. The...
python
def _user_agent_digest_hash(self): """ Hash the user agent and user agent password Section 3.10 of https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf :return: md5 """ if not self.version: raise MissingVersion("A version is required for user agent auth. The...
[ "def", "_user_agent_digest_hash", "(", "self", ")", ":", "if", "not", "self", ".", "version", ":", "raise", "MissingVersion", "(", "\"A version is required for user agent auth. The RETS server should set this\"", "\"automatically but it has not. Please instantiate the session with a ...
Hash the user agent and user agent password Section 3.10 of https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf :return: md5
[ "Hash", "the", "user", "agent", "and", "user", "agent", "password", "Section", "3", ".", "10", "of", "https", ":", "//", "www", ".", "nar", ".", "realtor", "/", "retsorg", ".", "nsf", "/", "retsproto1", ".", "7d6", ".", "pdf", ":", "return", ":", "...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L411-L427
hamidfzm/Flask-HTMLmin
flask_htmlmin/__init__.py
HTMLMIN.response_minify
def response_minify(self, response): """ minify response html to decrease traffic """ if response.content_type == u'text/html; charset=utf-8': endpoint = request.endpoint or '' view_func = current_app.view_functions.get(endpoint, None) name = ( ...
python
def response_minify(self, response): """ minify response html to decrease traffic """ if response.content_type == u'text/html; charset=utf-8': endpoint = request.endpoint or '' view_func = current_app.view_functions.get(endpoint, None) name = ( ...
[ "def", "response_minify", "(", "self", ",", "response", ")", ":", "if", "response", ".", "content_type", "==", "u'text/html; charset=utf-8'", ":", "endpoint", "=", "request", ".", "endpoint", "or", "''", "view_func", "=", "current_app", ".", "view_functions", "....
minify response html to decrease traffic
[ "minify", "response", "html", "to", "decrease", "traffic" ]
train
https://github.com/hamidfzm/Flask-HTMLmin/blob/03de23347ac021da4011af36b57903a235268429/flask_htmlmin/__init__.py#L29-L50
hamidfzm/Flask-HTMLmin
flask_htmlmin/__init__.py
HTMLMIN.exempt
def exempt(self, obj): """ decorator to mark a view as exempt from htmlmin. """ name = '%s.%s' % (obj.__module__, obj.__name__) @wraps(obj) def __inner(*a, **k): return obj(*a, **k) self._exempt_routes.add(name) return __inner
python
def exempt(self, obj): """ decorator to mark a view as exempt from htmlmin. """ name = '%s.%s' % (obj.__module__, obj.__name__) @wraps(obj) def __inner(*a, **k): return obj(*a, **k) self._exempt_routes.add(name) return __inner
[ "def", "exempt", "(", "self", ",", "obj", ")", ":", "name", "=", "'%s.%s'", "%", "(", "obj", ".", "__module__", ",", "obj", ".", "__name__", ")", "@", "wraps", "(", "obj", ")", "def", "__inner", "(", "*", "a", ",", "*", "*", "k", ")", ":", "r...
decorator to mark a view as exempt from htmlmin.
[ "decorator", "to", "mark", "a", "view", "as", "exempt", "from", "htmlmin", "." ]
train
https://github.com/hamidfzm/Flask-HTMLmin/blob/03de23347ac021da4011af36b57903a235268429/flask_htmlmin/__init__.py#L52-L63
refindlyllc/rets
rets/utils/search.py
DMQLHelper.dmql
def dmql(query): """Client supplied raw DMQL, ensure quote wrap.""" if isinstance(query, dict): raise ValueError("You supplied a dictionary to the dmql_query parameter, but a string is required." " Did you mean to pass this to the search_filter parameter? ") ...
python
def dmql(query): """Client supplied raw DMQL, ensure quote wrap.""" if isinstance(query, dict): raise ValueError("You supplied a dictionary to the dmql_query parameter, but a string is required." " Did you mean to pass this to the search_filter parameter? ") ...
[ "def", "dmql", "(", "query", ")", ":", "if", "isinstance", "(", "query", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"You supplied a dictionary to the dmql_query parameter, but a string is required.\"", "\" Did you mean to pass this to the search_filter parameter? \"", ...
Client supplied raw DMQL, ensure quote wrap.
[ "Client", "supplied", "raw", "DMQL", "ensure", "quote", "wrap", "." ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/search.py#L14-L23
refindlyllc/rets
rets/utils/search.py
DMQLHelper.filter_to_dmql
def filter_to_dmql(filter_dict): """Converts the filter dictionary into DMQL""" if not isinstance(filter_dict, (dict, collections.OrderedDict)): raise TypeError('Expected a dictionary type buy got {} instead.'.format(type(filter_dict))) def is_date_time_type(val): """Re...
python
def filter_to_dmql(filter_dict): """Converts the filter dictionary into DMQL""" if not isinstance(filter_dict, (dict, collections.OrderedDict)): raise TypeError('Expected a dictionary type buy got {} instead.'.format(type(filter_dict))) def is_date_time_type(val): """Re...
[ "def", "filter_to_dmql", "(", "filter_dict", ")", ":", "if", "not", "isinstance", "(", "filter_dict", ",", "(", "dict", ",", "collections", ".", "OrderedDict", ")", ")", ":", "raise", "TypeError", "(", "'Expected a dictionary type buy got {} instead.'", ".", "form...
Converts the filter dictionary into DMQL
[ "Converts", "the", "filter", "dictionary", "into", "DMQL" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/search.py#L26-L161
refindlyllc/rets
rets/parsers/base.py
Base.get_attributes
def get_attributes(input_dict): """ Get attributes of xml tags in input_dict and creates a dictionary with the attribute name as the key and the attribute value as the value :param input_dict: The xml tag with the attributes and values :return: dict """ return {k....
python
def get_attributes(input_dict): """ Get attributes of xml tags in input_dict and creates a dictionary with the attribute name as the key and the attribute value as the value :param input_dict: The xml tag with the attributes and values :return: dict """ return {k....
[ "def", "get_attributes", "(", "input_dict", ")", ":", "return", "{", "k", ".", "lstrip", "(", "\"@\"", ")", ":", "v", "for", "k", ",", "v", "in", "input_dict", ".", "items", "(", ")", "if", "k", "[", "0", "]", "==", "\"@\"", "}" ]
Get attributes of xml tags in input_dict and creates a dictionary with the attribute name as the key and the attribute value as the value :param input_dict: The xml tag with the attributes and values :return: dict
[ "Get", "attributes", "of", "xml", "tags", "in", "input_dict", "and", "creates", "a", "dictionary", "with", "the", "attribute", "name", "as", "the", "key", "and", "the", "attribute", "value", "as", "the", "value", ":", "param", "input_dict", ":", "The", "xm...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/base.py#L12-L19
refindlyllc/rets
rets/parsers/base.py
Base.data_columns_to_dict
def data_columns_to_dict(columns_string, dict_string, delimiter=None): """ Turns column names in a single string into a dictionary with the key being the column name and the value being the value in that column for each row :param columns_string: A string of column names :param d...
python
def data_columns_to_dict(columns_string, dict_string, delimiter=None): """ Turns column names in a single string into a dictionary with the key being the column name and the value being the value in that column for each row :param columns_string: A string of column names :param d...
[ "def", "data_columns_to_dict", "(", "columns_string", ",", "dict_string", ",", "delimiter", "=", "None", ")", ":", "if", "delimiter", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "zip", "(", "columns_string", ".", "split", "(", "delimit...
Turns column names in a single string into a dictionary with the key being the column name and the value being the value in that column for each row :param columns_string: A string of column names :param dict_string: A string of values :param delimiter: The delimiter to use to split the ...
[ "Turns", "column", "names", "in", "a", "single", "string", "into", "a", "dictionary", "with", "the", "key", "being", "the", "column", "name", "and", "the", "value", "being", "the", "value", "in", "that", "column", "for", "each", "row", ":", "param", "col...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/base.py#L22-L34
refindlyllc/rets
rets/parsers/base.py
Base.analyze_reply_code
def analyze_reply_code(self, xml_response_dict): """ Checks the RETS Response Code and handles non-zero answers. :param xml_response_dict: :return: None """ if 'RETS-STATUS' in xml_response_dict: attributes = self.get_attributes(xml_response_dict['RETS-STATUS'...
python
def analyze_reply_code(self, xml_response_dict): """ Checks the RETS Response Code and handles non-zero answers. :param xml_response_dict: :return: None """ if 'RETS-STATUS' in xml_response_dict: attributes = self.get_attributes(xml_response_dict['RETS-STATUS'...
[ "def", "analyze_reply_code", "(", "self", ",", "xml_response_dict", ")", ":", "if", "'RETS-STATUS'", "in", "xml_response_dict", ":", "attributes", "=", "self", ".", "get_attributes", "(", "xml_response_dict", "[", "'RETS-STATUS'", "]", ")", "reply_code", "=", "att...
Checks the RETS Response Code and handles non-zero answers. :param xml_response_dict: :return: None
[ "Checks", "the", "RETS", "Response", "Code", "and", "handles", "non", "-", "zero", "answers", ".", ":", "param", "xml_response_dict", ":", ":", "return", ":", "None" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/base.py#L36-L64
refindlyllc/rets
rets/utils/get_object.py
GetObject.ids
def ids(self, content_ids, object_ids): """Appends the content and object ids how RETS expects them""" result = [] content_ids = self.split(content_ids, False) object_ids = self.split(object_ids) for cid in content_ids: result.append('{}:{}'.format(cid, ':'.join(obj...
python
def ids(self, content_ids, object_ids): """Appends the content and object ids how RETS expects them""" result = [] content_ids = self.split(content_ids, False) object_ids = self.split(object_ids) for cid in content_ids: result.append('{}:{}'.format(cid, ':'.join(obj...
[ "def", "ids", "(", "self", ",", "content_ids", ",", "object_ids", ")", ":", "result", "=", "[", "]", "content_ids", "=", "self", ".", "split", "(", "content_ids", ",", "False", ")", "object_ids", "=", "self", ".", "split", "(", "object_ids", ")", "for"...
Appends the content and object ids how RETS expects them
[ "Appends", "the", "content", "and", "object", "ids", "how", "RETS", "expects", "them" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/get_object.py#L7-L17
refindlyllc/rets
rets/utils/get_object.py
GetObject.split
def split(value, dash_ranges=True): """Splits """ if isinstance(value, list): value = [str(v) for v in value] else: str_value = str(value) dash_matches = re.match(pattern='(\d+)\-(\d+)', string=str_value) if ':' in str_value or ',' in str_value: ...
python
def split(value, dash_ranges=True): """Splits """ if isinstance(value, list): value = [str(v) for v in value] else: str_value = str(value) dash_matches = re.match(pattern='(\d+)\-(\d+)', string=str_value) if ':' in str_value or ',' in str_value: ...
[ "def", "split", "(", "value", ",", "dash_ranges", "=", "True", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "value", "=", "[", "str", "(", "v", ")", "for", "v", "in", "value", "]", "else", ":", "str_value", "=", "str", "(", ...
Splits
[ "Splits" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/get_object.py#L20-L38
roanuz/py-cricket
src/pycricket_storagehandler.py
RcaFileStorageHandler.set_value
def set_value(self, key, value): """ Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value """ ...
python
def set_value(self, key, value): """ Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value """ ...
[ "def", "set_value", "(", "self", ",", "key", ",", "value", ")", ":", "file_cache", "=", "self", ".", "read_file", "(", ")", "if", "file_cache", ":", "file_cache", "[", "key", "]", "=", "value", "else", ":", "file_cache", "=", "{", "}", "file_cache", ...
Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value
[ "Set", "key", "value", "to", "the", "file", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L56-L73
roanuz/py-cricket
src/pycricket_storagehandler.py
RcaFileStorageHandler.delete_value
def delete_value(self, key): """ Delete the key if the token is expired. Arg: key : cache key """ response = {} response['status'] = False response['msg'] = "key does not exist" file_cache = self.read_file() if key in file_cache: ...
python
def delete_value(self, key): """ Delete the key if the token is expired. Arg: key : cache key """ response = {} response['status'] = False response['msg'] = "key does not exist" file_cache = self.read_file() if key in file_cache: ...
[ "def", "delete_value", "(", "self", ",", "key", ")", ":", "response", "=", "{", "}", "response", "[", "'status'", "]", "=", "False", "response", "[", "'msg'", "]", "=", "\"key does not exist\"", "file_cache", "=", "self", ".", "read_file", "(", ")", "if"...
Delete the key if the token is expired. Arg: key : cache key
[ "Delete", "the", "key", "if", "the", "token", "is", "expired", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L101-L118
roanuz/py-cricket
src/pycricket_storagehandler.py
RcaFileStorageHandler.read_file
def read_file(self): """ Open the file and assiging the permission to read/write and return the content in json formate. Return : json data """ file_obj = open(self.file, 'r') content = file_obj.read() file_obj.close() if content: cont...
python
def read_file(self): """ Open the file and assiging the permission to read/write and return the content in json formate. Return : json data """ file_obj = open(self.file, 'r') content = file_obj.read() file_obj.close() if content: cont...
[ "def", "read_file", "(", "self", ")", ":", "file_obj", "=", "open", "(", "self", ".", "file", ",", "'r'", ")", "content", "=", "file_obj", ".", "read", "(", ")", "file_obj", ".", "close", "(", ")", "if", "content", ":", "content", "=", "json", ".",...
Open the file and assiging the permission to read/write and return the content in json formate. Return : json data
[ "Open", "the", "file", "and", "assiging", "the", "permission", "to", "read", "/", "write", "and", "return", "the", "content", "in", "json", "formate", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L128-L142
roanuz/py-cricket
src/pycricket_storagehandler.py
RcaFileStorageHandler.update_file
def update_file(self, content): """ It will convert json content to json string and update into file. Return: Boolean True/False """ updated_content = json.dumps(content) file_obj = open(self.file, 'r+') file_obj.write(str(updated_content)) file_o...
python
def update_file(self, content): """ It will convert json content to json string and update into file. Return: Boolean True/False """ updated_content = json.dumps(content) file_obj = open(self.file, 'r+') file_obj.write(str(updated_content)) file_o...
[ "def", "update_file", "(", "self", ",", "content", ")", ":", "updated_content", "=", "json", ".", "dumps", "(", "content", ")", "file_obj", "=", "open", "(", "self", ".", "file", ",", "'r+'", ")", "file_obj", ".", "write", "(", "str", "(", "updated_con...
It will convert json content to json string and update into file. Return: Boolean True/False
[ "It", "will", "convert", "json", "content", "to", "json", "string", "and", "update", "into", "file", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L144-L155
refindlyllc/rets
rets/parsers/metadata.py
CompactMetadata.parse
def parse(self, response, metadata_type): """ Parses RETS metadata using the COMPACT-DECODED format :param response: :param metadata_type: :return: """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xml_response_dict=xml) base = xml.g...
python
def parse(self, response, metadata_type): """ Parses RETS metadata using the COMPACT-DECODED format :param response: :param metadata_type: :return: """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xml_response_dict=xml) base = xml.g...
[ "def", "parse", "(", "self", ",", "response", ",", "metadata_type", ")", ":", "xml", "=", "xmltodict", ".", "parse", "(", "response", ".", "text", ")", "self", ".", "analyze_reply_code", "(", "xml_response_dict", "=", "xml", ")", "base", "=", "xml", ".",...
Parses RETS metadata using the COMPACT-DECODED format :param response: :param metadata_type: :return:
[ "Parses", "RETS", "metadata", "using", "the", "COMPACT", "-", "DECODED", "format", ":", "param", "response", ":", ":", "param", "metadata_type", ":", ":", "return", ":" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/metadata.py#L14-L56
refindlyllc/rets
rets/parsers/metadata.py
StandardXMLetadata.parse
def parse(self, response, metadata_type): """ Parses RETS metadata using the STANDARD-XML format :param response: requests Response object :param metadata_type: string :return parsed: list """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xm...
python
def parse(self, response, metadata_type): """ Parses RETS metadata using the STANDARD-XML format :param response: requests Response object :param metadata_type: string :return parsed: list """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xm...
[ "def", "parse", "(", "self", ",", "response", ",", "metadata_type", ")", ":", "xml", "=", "xmltodict", ".", "parse", "(", "response", ".", "text", ")", "self", ".", "analyze_reply_code", "(", "xml_response_dict", "=", "xml", ")", "base", "=", "xml", ".",...
Parses RETS metadata using the STANDARD-XML format :param response: requests Response object :param metadata_type: string :return parsed: list
[ "Parses", "RETS", "metadata", "using", "the", "STANDARD", "-", "XML", "format", ":", "param", "response", ":", "requests", "Response", "object", ":", "param", "metadata_type", ":", "string", ":", "return", "parsed", ":", "list" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/metadata.py#L62-L116
refindlyllc/rets
rets/parsers/get_object.py
MultipleObjectParser._get_multiparts
def _get_multiparts(response): """ From this 'multipart/parallel; boundary="874e43d27ec6d83f30f37841bdaf90c7"; charset=utf-8' get this --874e43d27ec6d83f30f37841bdaf90c7 """ boundary = None for part in response.headers.get('Content-Type', '').split(';'): ...
python
def _get_multiparts(response): """ From this 'multipart/parallel; boundary="874e43d27ec6d83f30f37841bdaf90c7"; charset=utf-8' get this --874e43d27ec6d83f30f37841bdaf90c7 """ boundary = None for part in response.headers.get('Content-Type', '').split(';'): ...
[ "def", "_get_multiparts", "(", "response", ")", ":", "boundary", "=", "None", "for", "part", "in", "response", ".", "headers", ".", "get", "(", "'Content-Type'", ",", "''", ")", ".", "split", "(", "';'", ")", ":", "if", "'boundary='", "in", "part", ":"...
From this 'multipart/parallel; boundary="874e43d27ec6d83f30f37841bdaf90c7"; charset=utf-8' get this --874e43d27ec6d83f30f37841bdaf90c7
[ "From", "this", "multipart", "/", "parallel", ";", "boundary", "=", "874e43d27ec6d83f30f37841bdaf90c7", ";", "charset", "=", "utf", "-", "8", "get", "this", "--", "874e43d27ec6d83f30f37841bdaf90c7" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/get_object.py#L39-L73
refindlyllc/rets
rets/parsers/get_object.py
MultipleObjectParser.parse_image_response
def parse_image_response(self, response): """ Parse multiple objects from the RETS feed. A lot of string methods are used to handle the response before encoding it back into bytes for the object. :param response: The response from the feed :return: list of SingleObjectParser ...
python
def parse_image_response(self, response): """ Parse multiple objects from the RETS feed. A lot of string methods are used to handle the response before encoding it back into bytes for the object. :param response: The response from the feed :return: list of SingleObjectParser ...
[ "def", "parse_image_response", "(", "self", ",", "response", ")", ":", "if", "'xml'", "in", "response", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ":", "# Got an XML response, likely an error code.", "xml", "=", "xmltodict", ".", "parse", "(", "resp...
Parse multiple objects from the RETS feed. A lot of string methods are used to handle the response before encoding it back into bytes for the object. :param response: The response from the feed :return: list of SingleObjectParser
[ "Parse", "multiple", "objects", "from", "the", "RETS", "feed", ".", "A", "lot", "of", "string", "methods", "are", "used", "to", "handle", "the", "response", "before", "encoding", "it", "back", "into", "bytes", "for", "the", "object", ".", ":", "param", "...
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/get_object.py#L75-L120
refindlyllc/rets
rets/parsers/get_object.py
SingleObjectParser.parse_image_response
def parse_image_response(self, response): """ Parse a single object from the RETS feed :param response: The response from the RETS server :return: Object """ if 'xml' in response.headers.get('Content-Type'): # Got an XML response, likely an error code. ...
python
def parse_image_response(self, response): """ Parse a single object from the RETS feed :param response: The response from the RETS server :return: Object """ if 'xml' in response.headers.get('Content-Type'): # Got an XML response, likely an error code. ...
[ "def", "parse_image_response", "(", "self", ",", "response", ")", ":", "if", "'xml'", "in", "response", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ":", "# Got an XML response, likely an error code.", "xml", "=", "xmltodict", ".", "parse", "(", "resp...
Parse a single object from the RETS feed :param response: The response from the RETS server :return: Object
[ "Parse", "a", "single", "object", "from", "the", "RETS", "feed", ":", "param", "response", ":", "The", "response", "from", "the", "RETS", "server", ":", "return", ":", "Object" ]
train
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/get_object.py#L125-L139
roanuz/py-cricket
src/pycricket.py
RcaApp.auth
def auth(self): """ Auth is used to call the AUTH API of CricketAPI. Access token required for every request call to CricketAPI. Auth functional will post user Cricket API app details to server and return the access token. Return: Access token ...
python
def auth(self): """ Auth is used to call the AUTH API of CricketAPI. Access token required for every request call to CricketAPI. Auth functional will post user Cricket API app details to server and return the access token. Return: Access token ...
[ "def", "auth", "(", "self", ")", ":", "if", "not", "self", ".", "store_handler", ".", "has_value", "(", "'access_token'", ")", ":", "params", "=", "{", "}", "params", "[", "\"access_key\"", "]", "=", "self", ".", "access_key", "params", "[", "\"secret_ke...
Auth is used to call the AUTH API of CricketAPI. Access token required for every request call to CricketAPI. Auth functional will post user Cricket API app details to server and return the access token. Return: Access token
[ "Auth", "is", "used", "to", "call", "the", "AUTH", "API", "of", "CricketAPI", ".", "Access", "token", "required", "for", "every", "request", "call", "to", "CricketAPI", ".", "Auth", "functional", "will", "post", "user", "Cricket", "API", "app", "details", ...
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L89-L117
roanuz/py-cricket
src/pycricket.py
RcaApp.get_response
def get_response(self, url, params={}, method="get"): """ It will return json response based on given url, params and methods. Arg: params: 'dictionary' url: 'url' format method: default 'get', support method 'post' Return: json data ...
python
def get_response(self, url, params={}, method="get"): """ It will return json response based on given url, params and methods. Arg: params: 'dictionary' url: 'url' format method: default 'get', support method 'post' Return: json data ...
[ "def", "get_response", "(", "self", ",", "url", ",", "params", "=", "{", "}", ",", "method", "=", "\"get\"", ")", ":", "if", "method", "==", "\"post\"", ":", "response_data", "=", "json", ".", "loads", "(", "requests", ".", "post", "(", "url", ",", ...
It will return json response based on given url, params and methods. Arg: params: 'dictionary' url: 'url' format method: default 'get', support method 'post' Return: json data
[ "It", "will", "return", "json", "response", "based", "on", "given", "url", "params", "and", "methods", ".", "Arg", ":", "params", ":", "dictionary", "url", ":", "url", "format", "method", ":", "default", "get", "support", "method", "post", "Return", ":", ...
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L119-L144
roanuz/py-cricket
src/pycricket.py
RcaApp.get_active_token
def get_active_token(self): """ Getting the valid access token. Access token expires every 24 hours, It will expires then it will generate a new token. Return: active access token """ expire_time = self.store_handler.has_value("expires") ...
python
def get_active_token(self): """ Getting the valid access token. Access token expires every 24 hours, It will expires then it will generate a new token. Return: active access token """ expire_time = self.store_handler.has_value("expires") ...
[ "def", "get_active_token", "(", "self", ")", ":", "expire_time", "=", "self", ".", "store_handler", ".", "has_value", "(", "\"expires\"", ")", "access_token", "=", "self", ".", "store_handler", ".", "has_value", "(", "\"access_token\"", ")", "if", "expire_time",...
Getting the valid access token. Access token expires every 24 hours, It will expires then it will generate a new token. Return: active access token
[ "Getting", "the", "valid", "access", "token", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L146-L169
roanuz/py-cricket
src/pycricket.py
RcaApp.get_match
def get_match(self, match_key, card_type="full_card"): """ Calling the Match API. Arg: match_key: key of the match card_type: optional, default to full_card. Accepted values are micro_card, summary_card & full_card. Return: json data ...
python
def get_match(self, match_key, card_type="full_card"): """ Calling the Match API. Arg: match_key: key of the match card_type: optional, default to full_card. Accepted values are micro_card, summary_card & full_card. Return: json data ...
[ "def", "get_match", "(", "self", ",", "match_key", ",", "card_type", "=", "\"full_card\"", ")", ":", "match_url", "=", "self", ".", "api_path", "+", "\"match/\"", "+", "match_key", "+", "\"/\"", "params", "=", "{", "}", "params", "[", "\"card_type\"", "]",...
Calling the Match API. Arg: match_key: key of the match card_type: optional, default to full_card. Accepted values are micro_card, summary_card & full_card. Return: json data
[ "Calling", "the", "Match", "API", ".", "Arg", ":", "match_key", ":", "key", "of", "the", "match", "card_type", ":", "optional", "default", "to", "full_card", ".", "Accepted", "values", "are", "micro_card", "summary_card", "&", "full_card", ".", "Return", ":"...
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L171-L187
roanuz/py-cricket
src/pycricket.py
RcaApp.get_recent_matches
def get_recent_matches(self, card_type="micro_card"): """ Calling the Recent Matches API. Arg: card_type: optional, default to micro_card. Accepted values are micro_card & summary_card. Return: json data """ recent_matches_url = self.api...
python
def get_recent_matches(self, card_type="micro_card"): """ Calling the Recent Matches API. Arg: card_type: optional, default to micro_card. Accepted values are micro_card & summary_card. Return: json data """ recent_matches_url = self.api...
[ "def", "get_recent_matches", "(", "self", ",", "card_type", "=", "\"micro_card\"", ")", ":", "recent_matches_url", "=", "self", ".", "api_path", "+", "\"recent_matches/\"", "params", "=", "{", "}", "params", "[", "\"card_type\"", "]", "=", "card_type", "response...
Calling the Recent Matches API. Arg: card_type: optional, default to micro_card. Accepted values are micro_card & summary_card. Return: json data
[ "Calling", "the", "Recent", "Matches", "API", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L189-L204
roanuz/py-cricket
src/pycricket.py
RcaApp.get_player_stats
def get_player_stats(self, player_key, board_key): """ Calling the Player Stats API Args: player_key: Key of the player board_key: key of the board Return: json data """ player_stats_url = self.api_path + 'player/' + player_key + '/leag...
python
def get_player_stats(self, player_key, board_key): """ Calling the Player Stats API Args: player_key: Key of the player board_key: key of the board Return: json data """ player_stats_url = self.api_path + 'player/' + player_key + '/leag...
[ "def", "get_player_stats", "(", "self", ",", "player_key", ",", "board_key", ")", ":", "player_stats_url", "=", "self", ".", "api_path", "+", "'player/'", "+", "player_key", "+", "'/league/'", "+", "board_key", "+", "'/stats/'", "response", "=", "self", ".", ...
Calling the Player Stats API Args: player_key: Key of the player board_key: key of the board Return: json data
[ "Calling", "the", "Player", "Stats", "API", "Args", ":", "player_key", ":", "Key", "of", "the", "player", "board_key", ":", "key", "of", "the", "board", "Return", ":", "json", "data" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L206-L217
roanuz/py-cricket
src/pycricket.py
RcaApp.get_ball_by_ball
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....
python
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", ")", ":", "if", "over_key", ":", "ball_by_ball_url", "=", "\"{base_path}match/{match_key}/balls/{over_key}/\"", ".", "format", "(", "base_path", "=", "self", ".", "api_path", "...
match_key: key of the match over_key : key of the over Return: json data:
[ "match_key", ":", "key", "of", "the", "match", "over_key", ":", "key", "of", "the", "over", "Return", ":", "json", "data", ":" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L219-L233
roanuz/py-cricket
src/pycricket.py
RcaApp.get_recent_season_matches
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...
python
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", ")", ":", "season_recent_matches_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/recent_matches/\"", "response", "=", "self", ".", "get_response", "(", "season_re...
Calling specific season recent matches. Arg: season_key: key of the season. Return: json date
[ "Calling", "specific", "season", "recent", "matches", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L235-L247
roanuz/py-cricket
src/pycricket.py
RcaApp.get_recent_seasons
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
python
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", ")", ":", "recent_seasons_url", "=", "self", ".", "api_path", "+", "\"recent_seasons/\"", "response", "=", "self", ".", "get_response", "(", "recent_seasons_url", ")", "return", "response" ]
Calling the Recent Season API. Return: json data
[ "Calling", "the", "Recent", "Season", "API", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L249-L259
roanuz/py-cricket
src/pycricket.py
RcaApp.get_schedule
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) ...
python
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", ")", ":", "schedule_url", "=", "self", ".", "api_path", "+", "\"schedule/\"", "params", "=", "{", "}", "if", "date", ":", "params", "[", "'date'", "]", "=", "date", "response", "=", "self", ...
Calling the Schedule API. Return: json data
[ "Calling", "the", "Schedule", "API", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L261-L274
roanuz/py-cricket
src/pycricket.py
RcaApp.get_season_schedule
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...
python
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", ")", ":", "schedule_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/schedule/\"", "response", "=", "self", ".", "get_response", "(", "schedule_url", ")", "return", ...
Calling specific season schedule Arg: season_key: key of the season Return: json data
[ "Calling", "specific", "season", "schedule" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L276-L288
roanuz/py-cricket
src/pycricket.py
RcaApp.get_season
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 """ ...
python
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\"", ")", ":", "season_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/\"", "params", "=", "{", "}", "params", "[", "\"card_type\"", ...
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", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L290-L306
roanuz/py-cricket
src/pycricket.py
RcaApp.get_season_stats
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...
python
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", ")", ":", "season_stats_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/stats/\"", "response", "=", "self", ".", "get_response", "(", "season_stats_url", ")", "return"...
Calling Season Stats API. Arg: season_key: key of the season Return: json data
[ "Calling", "Season", "Stats", "API", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L308-L320
roanuz/py-cricket
src/pycricket.py
RcaApp.get_season_team
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/' +...
python
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", ")", ":", "params", "=", "{", "\"stats_type\"", ":", "stats_type", "}", "season_team_url", "=", "self", ".", "api_path", "+", "'season/'", "+", ...
Calling Season teams API Arg: season_key: key of the season Return: json data
[ "Calling", "Season", "teams", "API" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L322-L334
roanuz/py-cricket
src/pycricket.py
RcaApp.get_season_points
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...
python
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", ")", ":", "season_points_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/points/\"", "response", "=", "self", ".", "get_response", "(", "season_points_url", ")", "ret...
Calling Season Points API. Arg: season_key: key of the season Return: json data
[ "Calling", "Season", "Points", "API", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L336-L348
roanuz/py-cricket
src/pycricket.py
RcaApp.get_season_player_stats
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/" + ...
python
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", ")", ":", "season_player_stats_url", "=", "self", ".", "api_path", "+", "\"season/\"", "+", "season_key", "+", "\"/player/\"", "+", "player_key", "+", "\"/stats/\"", "response", "...
Calling Season Player Stats API. Arg: season_key: key of the season player_key: key of the player Return: json data
[ "Calling", "Season", "Player", "Stats", "API", "." ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L350-L363
roanuz/py-cricket
src/pycricket.py
RcaApp.get_overs_summary
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...
python
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", ")", ":", "overs_summary_url", "=", "self", ".", "api_path", "+", "\"match/\"", "+", "match_key", "+", "\"/overs_summary/\"", "response", "=", "self", ".", "get_response", "(", "overs_summary_url", ")", ...
Calling Overs Summary API Arg: match_key: key of the match Return: json data
[ "Calling", "Overs", "Summary", "API" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L365-L376
roanuz/py-cricket
src/pycricket.py
RcaApp.get_news_aggregation
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
python
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", ")", ":", "news_aggregation_url", "=", "self", ".", "api_path", "+", "\"news_aggregation\"", "+", "\"/\"", "response", "=", "self", ".", "get_response", "(", "news_aggregation_url", ")", "return", "response" ]
Calling News Aggregation API Return: json data
[ "Calling", "News", "Aggregation", "API" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L378-L388
roanuz/py-cricket
src/pycricket.py
RcaApp.get_fantasy_credits
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...
python
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", ")", ":", "fantasy_credit_url", "=", "self", ".", "api_path_v3", "+", "\"fantasy-match-credits/\"", "+", "match_key", "+", "\"/\"", "response", "=", "self", ".", "get_response", "(", "fantasy_credit_url", ...
Calling Fantasy Credit API Arg: match_key: key of the match Return: json data
[ "Calling", "Fantasy", "Credit", "API" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L390-L402
roanuz/py-cricket
src/pycricket.py
RcaApp.get_fantasy_points
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(...
python
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", ")", ":", "fantasy_points_url", "=", "self", ".", "api_path_v3", "+", "\"fantasy-match-points/\"", "+", "match_key", "+", "\"/\"", "response", "=", "self", ".", "get_response", "(", "fantasy_points_url", ...
Calling Fantasy Points API Arg: match_key: key of the match Return: json data
[ "Calling", "Fantasy", "Points", "API" ]
train
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L404-L416
HarveyHunt/i3situation
i3situation/plugins/reddit.py
RedditPlugin.main
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...
python
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", ")", ":", "self", ".", "manage_submissions", "(", ")", "out_string", "=", "self", ".", "options", "[", "'format'", "]", "# Pop until we get something which len(title) <= max-chars", "length", "=", "float", "(", "'inf'", ")", "while", ...
Generates an output string by replacing the keywords in the format string with the corresponding values from a submission dictionary.
[ "Generates", "an", "output", "string", "by", "replacing", "the", "keywords", "in", "the", "format", "string", "with", "the", "corresponding", "values", "from", "a", "submission", "dictionary", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L66-L82
HarveyHunt/i3situation
i3situation/plugins/reddit.py
RedditPlugin.login
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) ...
python
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", ")", ":", "data", "=", "{", "'user'", ":", "self", ".", "options", "[", "'username'", "]", ",", "'passwd'", ":", "self", ".", "options", "[", "'password'", "]", ",", "'api_type'", ":", "'json'", "}", "response", "=", "sel...
Logs into Reddit in order to display a personalised front page.
[ "Logs", "into", "Reddit", "in", "order", "to", "display", "a", "personalised", "front", "page", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L84-L91
HarveyHunt/i3situation
i3situation/plugins/reddit.py
RedditPlugin.manage_submissions
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...
python
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", "not", "hasattr", "(", "self", ",", "'submissions'", ")", "or", "len", "(", "self", ".", "submissions", ")", "==", "1", ":", "self", ".", "submissions", "=", "[", "]", "if", "self", ".", "opti...
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", "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", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L93-L114
HarveyHunt/i3situation
i3situation/plugins/reddit.py
RedditPlugin.get_submissions
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...
python
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", ")", ":", "response", "=", "self", ".", "client", ".", "get", "(", "url", ",", "params", "=", "{", "'limit'", ":", "self", ".", "options", "[", "'limit'", "]", "}", ")", "submissions", "=", "[", "x...
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.
[ "Connects", "to", "Reddit", "and", "gets", "a", "JSON", "representation", "of", "submissions", ".", "This", "JSON", "data", "is", "then", "processed", "and", "returned", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/reddit.py#L116-L125
HarveyHunt/i3situation
i3situation/plugins/cmus.py
CmusPlugin.main
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...
python
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", ")", ":", "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'", ...
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.
[ "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", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/cmus.py#L44-L64
HarveyHunt/i3situation
i3situation/plugins/cmus.py
CmusPlugin.convert_cmus_output
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...
python
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", ")", ":", "cmus_output", "=", "cmus_output", ".", "split", "(", "'\\n'", ")", "cmus_output", "=", "[", "x", ".", "replace", "(", "'tag '", ",", "''", ")", "for", "x", "in", "cmus_output", "if...
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...
[ "Change", "the", "newline", "separated", "string", "of", "output", "data", "into", "a", "dictionary", "which", "can", "then", "be", "used", "to", "replace", "the", "strings", "in", "the", "config", "format", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/cmus.py#L66-L84
HarveyHunt/i3situation
i3situation/plugins/cmus.py
CmusPlugin.convert_time
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': ...
python
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", ")", ":", "time_string", "=", "str", "(", "datetime", ".", "timedelta", "(", "seconds", "=", "int", "(", "time", ")", ")", ")", "if", "time_string", ".", "split", "(", "':'", ")", "[", "0", "]", "=="...
A helper function to convert seconds into hh:mm:ss for better readability. time: A string representing time in seconds.
[ "A", "helper", "function", "to", "convert", "seconds", "into", "hh", ":", "mm", ":", "ss", "for", "better", "readability", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/cmus.py#L86-L96
HarveyHunt/i3situation
i3situation/plugins/_plugin.py
Plugin.output
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. """ ...
python
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", ")", ":", "full_text", "=", "full_text", ".", "replace", "(", "'\\n'", ",", "''", ")", "short_text", "=", "short_text", ".", "replace", "(", "'\\n'", ",", "''", ")", "self", ".", "outpu...
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", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/_plugin.py#L29-L41
HarveyHunt/i3situation
i3situation/plugins/_plugin.py
Plugin.on_click
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) ...
python
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", ")", ":", "if", "event", "[", "'button'", "]", "==", "1", "and", "'button1'", "in", "self", ".", "options", ":", "subprocess", ".", "call", "(", "self", ".", "options", "[", "'button1'", "]", ".", "split"...
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...
[ "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", ...
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/_plugin.py#L43-L61
nephila/django-ckeditor-filebrowser-filer
ckeditor_filebrowser_filer/views.py
url_reverse
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') ...
python
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", ")", ":", "if", "request", ".", "method", "in", "(", "'GET'", ",", "'POST'", ")", ":", "data", "=", "getattr", "(", "request", ",", "request", ".", "method", ")", "url_name", "=", "data", ".", "get", "(", "'url_n...
Reverse the requested URL (passed via GET / POST as `url_name` parameter) :param request: Request object :return: The reversed path
[ "Reverse", "the", "requested", "URL", "(", "passed", "via", "GET", "/", "POST", "as", "url_name", "parameter", ")" ]
train
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L41-L57
nephila/django-ckeditor-filebrowser-filer
ckeditor_filebrowser_filer/views.py
url_image
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...
python
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", ")", ":", "image", "=", "File", ".", "objects", ".", "get", "(", "pk", "=", "image_id", ")", "if", "getattr...
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')
[ "Converts", "a", "filer", "image", "ID", "in", "a", "complete", "path" ]
train
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L79-L104
nephila/django-ckeditor-filebrowser-filer
ckeditor_filebrowser_filer/views.py
thumbnail_options
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...
python
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", ")", ":", "response_data", "=", "[", "{", "'id'", ":", "opt", ".", "pk", ",", "'name'", ":", "opt", ".", "name", "}", "for", "opt", "in", "ThumbnailOption", ".", "objects", ".", "all", "(", ")", "]", "retur...
Returns the requested ThumbnailOption as JSON :param request: Request object :return: JSON serialized ThumbnailOption
[ "Returns", "the", "requested", "ThumbnailOption", "as", "JSON" ]
train
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L107-L115
nephila/django-ckeditor-filebrowser-filer
ckeditor_filebrowser_filer/views.py
serve_image
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...
python
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", ")", ":", "image", "=", "File", ".", "objects", ".", "get", "(", "pk", "=", "image_id", ")", "if", "getat...
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'...
[ "returns", "the", "content", "of", "an", "image", "sized", "according", "to", "the", "parameters" ]
train
https://github.com/nephila/django-ckeditor-filebrowser-filer/blob/336ea259fbc6f9d338e3798375299f654a4d6995/ckeditor_filebrowser_filer/views.py#L118-L138
HarveyHunt/i3situation
i3situation/core/config.py
Config._touch_dir
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: ...
python
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", ")", ":", "try", ":", "os", ".", "makedirs", "(", "path", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "EEXIST", ":", "raise" ]
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.
[ "A", "helper", "function", "to", "create", "a", "directory", "if", "it", "doesn", "t", "exist", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/config.py#L32-L42
HarveyHunt/i3situation
i3situation/core/config.py
Config.reload
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 ...
python
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", ")", ":", "self", ".", "_conf", "=", "configparser", ".", "ConfigParser", "(", ")", "# Preserve the case of sections and keys.", "self", ".", "_conf", ".", "optionxform", "=", "str", "self", ".", "_conf", ".", "read", "(", "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.
[ "Reload", "the", "configuration", "from", "the", "file", ".", "This", "is", "in", "its", "own", "function", "so", "that", "it", "can", "be", "called", "at", "any", "time", "by", "another", "class", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/config.py#L50-L68
HarveyHunt/i3situation
i3situation/core/config.py
Config._replace_data_types
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...
python
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", ")", ":", "logging_levels", "=", "{", "'NONE'", ":", "0", ",", "'NULL'", ":", "0", ",", "'DEBUG'", ":", "10", ",", "'INFO'", ":", "20", ",", "'WARNING'", ":", "30", ",", "'ERROR'", ":", "40", ",", "'CR...
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.
[ "Replaces", "strings", "with", "appropriate", "data", "types", "(", "int", "boolean", ")", ".", "Also", "replaces", "the", "human", "readable", "logging", "levels", "with", "the", "integer", "form", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/config.py#L71-L93
xolox/python-rotate-backups
rotate_backups/cli.py
main
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 = [] ...
python
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", "(", ")", ":", "coloredlogs", ".", "install", "(", "syslog", "=", "True", ")", "# Command line option defaults.", "rotation_scheme", "=", "{", "}", "kw", "=", "dict", "(", "include_list", "=", "[", "]", ",", "exclude_list", "=", "[", "]", ...
Command line interface for the ``rotate-backups`` program.
[ "Command", "line", "interface", "for", "the", "rotate", "-", "backups", "program", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/cli.py#L205-L303
HarveyHunt/i3situation
i3situation/plugins/battery.py
BatteryPlugin.get_battery_state
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()
python
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", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "options", "[", "'battery_path'", "]", ",", "prop", ")", ",", "'r'", ")", "as", "f", ":", "return", "f", ".", "...
Return the first line from the file located at battery_path/prop as a string.
[ "Return", "the", "first", "line", "from", "the", "file", "located", "at", "battery_path", "/", "prop", "as", "a", "string", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/plugins/battery.py#L52-L58
xolox/python-rotate-backups
rotate_backups/__init__.py
coerce_location
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...
python
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", ")", ":", "# Location objects pass through untouched.", "if", "not", "isinstance", "(", "value", ",", "Location", ")", ":", "# Other values are expected to be strings.", "if", "not", "isinstance", "(", ...
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.
[ "Coerce", "a", "string", "to", "a", ":", "class", ":", "Location", "object", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L93-L119
xolox/python-rotate-backups
rotate_backups/__init__.py
coerce_retention_period
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` ...
python
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", ")", ":", "# Numbers pass through untouched.", "if", "not", "isinstance", "(", "value", ",", "numbers", ".", "Number", ")", ":", "# Other values are expected to be strings.", "if", "not", "isinstance", "(", "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` when the string can't be coerced.
[ "Coerce", "a", "retention", "period", "to", "a", "Python", "value", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L122-L147
xolox/python-rotate-backups
rotate_backups/__init__.py
load_config_file
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...
python
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", ")", ":", "expand_notice_given", "=", "False", "if", "configuration_file", ":", "loader", "=", "ConfigLoader", "(", "available_files", "=", "[", "configuration_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...
[ "Load", "a", "configuration", "file", "with", "backup", "directories", "and", "rotation", "schemes", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L150-L220
xolox/python-rotate-backups
rotate_backups/__init__.py
rotate_backups
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...
python
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", ")", ":", "program", "=", "RotateBackups", "(", "rotation_scheme", "=", "rotation_scheme", ",", "*", "*", "options", ")", "program", ".", "rotate_backups", "(", "direc...
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", "the", "backups", "in", "a", "directory", "according", "to", "a", "flexible", "rotation", "scheme", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L223-L235
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.rotate_concurrent
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 ...
python
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", ")", ":", "timer", "=", "Timer", "(", ")", "pool", "=", "CommandPool", "(", "concurrency", "=", "10", ")", "logger", ".", "info", "(", "\"Scanning %s ..\"", ",", "plur...
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", "the", "backups", "in", "the", "given", "locations", "concurrently", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L403-L431
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.rotate_backups
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 ...
python
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", ")", ":", "rotation_commands", "=", "[", "]", "location", "=", "coerce_location", "(", "location", ")", "# Load configuration overrides by user?",...
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", "the", "backups", "in", "a", "directory", "according", "to", "a", "flexible", "rotation", "scheme", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L433-L512
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.load_config_file
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...
python
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", ")", ":", "location", "=", "coerce_location", "(", "location", ")", "for", "configured_location", ",", "rotation_scheme", ",", "options", "in", "load_config_file", "(", "self", ".", "config_file", ",", "ex...
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.
[ "Load", "a", "rotation", "scheme", "and", "other", "options", "from", "a", "configuration", "file", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L514-L544
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.collect_backups
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...
python
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", ")", ":", "backups", "=", "[", "]", "location", "=", "coerce_location", "(", "location", ")", "logger", ".", "info", "(", "\"Scanning %s for backups ..\"", ",", "location", ")", "location", ".", "ensure_r...
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...
[ "Collect", "the", "backups", "at", "the", "given", "location", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L546-L579
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.group_backups
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',...
python
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", ")", ":", "backups_by_frequency", "=", "dict", "(", "(", "frequency", ",", "collections", ".", "defaultdict", "(", "list", ")", ")", "for", "frequency", "in", "SUPPORTED_FREQUENCIES", ")", "for", "b", "in"...
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...
[ "Group", "backups", "collected", "by", ":", "func", ":", "collect_backups", "()", "by", "rotation", "frequencies", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L581-L601
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.apply_rotation_scheme
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()`. ...
python
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", ")", ":", "if", "not", "self", ".", "rotation_scheme", ":", "raise", "ValueError", "(", "\"Refusing to use empty rotation scheme! (all backups would be deleted)\"", ")", "fo...
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 ...
[ "Apply", "the", "user", "defined", "rotation", "scheme", "to", "the", "result", "of", ":", "func", ":", "group_backups", "()", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L603-L649
xolox/python-rotate-backups
rotate_backups/__init__.py
RotateBackups.find_preservation_criteria
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 ...
python
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", ")", ":", "backups_to_preserve", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "frequency", ",", "delta", "in", "ORDERED_FREQUENCIES", ":", "for", "period", "in", "ba...
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:...
[ "Collect", "the", "criteria", "used", "to", "decide", "which", "backups", "to", "preserve", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L651-L667
xolox/python-rotate-backups
rotate_backups/__init__.py
Location.mount_point
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...
python
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", ")", ":", "try", ":", "return", "self", ".", "context", ".", "capture", "(", "'stat'", ",", "'--format=%m'", ",", "self", ".", "directory", ",", "silent", "=", "True", ")", "except", "ExternalCommandFailed", ":", "return"...
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`` ...
[ "The", "pathname", "of", "the", "mount", "point", "of", ":", "attr", ":", "directory", "(", "a", "string", "or", ":", "data", ":", "None", ")", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L693-L705
xolox/python-rotate-backups
rotate_backups/__init__.py
Location.ensure_exists
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...
python
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", ")", ":", "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...
Make sure the location exists.
[ "Make", "sure", "the", "location", "exists", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L729-L744
xolox/python-rotate-backups
rotate_backups/__init__.py
Location.ensure_readable
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...
python
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", ")", ":", "self", ".", "ensure_exists", "(", ")", "if", "not", "self", ".", "context", ".", "is_readable", "(", "self", ".", "directory", ")", ":", "if", "self", ".", "context", ".", "have_superuser_privileges", ":", ...
Make sure the location exists and is readable.
[ "Make", "sure", "the", "location", "exists", "and", "is", "readable", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L746-L758
xolox/python-rotate-backups
rotate_backups/__init__.py
Location.ensure_writable
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(...
python
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", ")", ":", "self", ".", "ensure_exists", "(", ")", "if", "not", "self", ".", "context", ".", "is_writable", "(", "self", ".", "directory", ")", ":", "if", "self", ".", "context", ".", "have_superuser_privileges", ":", ...
Make sure the directory exists and is writable.
[ "Make", "sure", "the", "directory", "exists", "and", "is", "writable", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L760-L771
xolox/python-rotate-backups
rotate_backups/__init__.py
Location.match
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 ...
python
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", ")", ":", "if", "self", ".", "ssh_alias", "!=", "location", ".", "ssh_alias", ":", "# Never match locations on other systems.", "return", "False", "elif", "self", ".", "have_wildcards", ":", "# Match filename patterns us...
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...
[ "Check", "if", "the", "given", "location", "matches", "." ]
train
https://github.com/xolox/python-rotate-backups/blob/611c72b2806952bf2bb84c38a4b5f856ea334707/rotate_backups/__init__.py#L773-L792
HarveyHunt/i3situation
i3situation/core/status.py
setup_file_logger
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...
python
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", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ")", "# If a stream handler has been attached, remove it.", "if", "logger", ".", "handlers", ":", "logger", ".", "removeHandl...
A helper function for creating a file logger. Accepts arguments, as it is used in Status and LoggingWriter.
[ "A", "helper", "function", "for", "creating", "a", "file", "logger", ".", "Accepts", "arguments", "as", "it", "is", "used", "in", "Status", "and", "LoggingWriter", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L12-L27
HarveyHunt/i3situation
i3situation/core/status.py
Status.output_to_bar
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....
python
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", ")", ":", "if", "comma", ":", "message", "+=", "','", "sys", ".", "stdout", ".", "write", "(", "message", "+", "'\\n'", ")", "sys", ".", "stdout", ".", "flush", "(", ")...
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.
[ "Outputs", "data", "to", "stdout", "without", "buffering", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L76-L86
HarveyHunt/i3situation
i3situation/core/status.py
Status.reload
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...
python
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", ")", ":", "logging", ".", "debug", "(", "'Reloading config file as files have been modified.'", ")", "self", ".", "config", ".", "plugin", ",", "self", ".", "config", ".", "general", "=", "self", ".", "config", ".", "reload", "(...
Reload the installed plugins and the configuration file. This is called when either the plugins or config get updated.
[ "Reload", "the", "installed", "plugins", "and", "the", "configuration", "file", ".", "This", "is", "called", "when", "either", "the", "plugins", "or", "config", "get", "updated", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L88-L99
HarveyHunt/i3situation
i3situation/core/status.py
Status.run_plugins
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...
python
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", ")", ":", "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...
Creates a thread for each plugin and lets the thread_manager handle it.
[ "Creates", "a", "thread", "for", "each", "plugin", "and", "lets", "the", "thread_manager", "handle", "it", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L101-L109
HarveyHunt/i3situation
i3situation/core/status.py
Status.run
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 ...
python
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", ")", ":", "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...
Monitors if the config file or plugins are updated. Also outputs the JSON data generated by the plugins, without needing to poll the threads.
[ "Monitors", "if", "the", "config", "file", "or", "plugins", "are", "updated", ".", "Also", "outputs", "the", "JSON", "data", "generated", "by", "the", "plugins", "without", "needing", "to", "poll", "the", "threads", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L111-L127
HarveyHunt/i3situation
i3situation/core/status.py
Status._remove_empty_output
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]...
python
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", ")", ":", "output", "=", "[", "]", "for", "key", "in", "self", ".", "output_dict", ":", "if", "self", ".", "output_dict", "[", "key", "]", "is", "not", "None", "and", "'full_text'", "in", "self", ".", "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.
[ "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", "." ]
train
https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L129-L139