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
ronaldguillen/wave
wave/fields.py
DictField.to_internal_value
def to_internal_value(self, data): """ Dicts of native values <- Dicts of primitive datatypes. """ if html.is_html_input(data): data = html.parse_html_dict(data) if not isinstance(data, dict): self.fail('not_a_dict', input_type=type(data).__name__) ...
python
def to_internal_value(self, data): """ Dicts of native values <- Dicts of primitive datatypes. """ if html.is_html_input(data): data = html.parse_html_dict(data) if not isinstance(data, dict): self.fail('not_a_dict', input_type=type(data).__name__) ...
[ "def", "to_internal_value", "(", "self", ",", "data", ")", ":", "if", "html", ".", "is_html_input", "(", "data", ")", ":", "data", "=", "html", ".", "parse_html_dict", "(", "data", ")", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":", "...
Dicts of native values <- Dicts of primitive datatypes.
[ "Dicts", "of", "native", "values", "<", "-", "Dicts", "of", "primitive", "datatypes", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/fields.py#L1511-L1522
ronaldguillen/wave
wave/fields.py
DictField.to_representation
def to_representation(self, value): """ List of object instances -> List of dicts of primitive datatypes. """ return { six.text_type(key): self.child.to_representation(val) for key, val in value.items() }
python
def to_representation(self, value): """ List of object instances -> List of dicts of primitive datatypes. """ return { six.text_type(key): self.child.to_representation(val) for key, val in value.items() }
[ "def", "to_representation", "(", "self", ",", "value", ")", ":", "return", "{", "six", ".", "text_type", "(", "key", ")", ":", "self", ".", "child", ".", "to_representation", "(", "val", ")", "for", "key", ",", "val", "in", "value", ".", "items", "("...
List of object instances -> List of dicts of primitive datatypes.
[ "List", "of", "object", "instances", "-", ">", "List", "of", "dicts", "of", "primitive", "datatypes", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/fields.py#L1524-L1531
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird._query_
def _query_(self, path, method, params={}): """Used internally for requests. :param str path: The path to hit. :param str method: The method to use, either `'GET'` or `'POST.` :param dict data: The optional paramters to the `GET` or the data to `POST`. :returns: ...
python
def _query_(self, path, method, params={}): """Used internally for requests. :param str path: The path to hit. :param str method: The method to use, either `'GET'` or `'POST.` :param dict data: The optional paramters to the `GET` or the data to `POST`. :returns: ...
[ "def", "_query_", "(", "self", ",", "path", ",", "method", ",", "params", "=", "{", "}", ")", ":", "if", "method", "==", "\"POST\"", ":", "url", "=", "'{API_URL}{API_PATH}'", ".", "format", "(", "API_URL", "=", "self", ".", "api_url", ",", "API_PATH", ...
Used internally for requests. :param str path: The path to hit. :param str method: The method to use, either `'GET'` or `'POST.` :param dict data: The optional paramters to the `GET` or the data to `POST`. :returns: Requests object -- Requires you to handle the ...
[ "Used", "internally", "for", "requests", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L27-L50
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.authenticate
def authenticate(self, username, password): """Authenticates your user and returns an auth token. :param str username: Hummingbird username. :param str password: Hummingbird password. :returns: str -- The Auth Token :raises: ValueError -- If the Authentication is wrong "...
python
def authenticate(self, username, password): """Authenticates your user and returns an auth token. :param str username: Hummingbird username. :param str password: Hummingbird password. :returns: str -- The Auth Token :raises: ValueError -- If the Authentication is wrong "...
[ "def", "authenticate", "(", "self", ",", "username", ",", "password", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/users/authenticate'", ",", "'POST'", ",", "params", "=", "{", "'username'", ":", "username", ",", "'password'", ":", "password", "}", ...
Authenticates your user and returns an auth token. :param str username: Hummingbird username. :param str password: Hummingbird password. :returns: str -- The Auth Token :raises: ValueError -- If the Authentication is wrong
[ "Authenticates", "your", "user", "and", "returns", "an", "auth", "token", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L52-L67
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.get_anime
def get_anime(self, anime_id, title_language='canonical'): """Fetches the Anime Object of the given id or slug. :param anime_id: The Anime ID or Slug. :type anime_id: int or str :param str title_language: The PREFERED title language can be any of `'canonical'`, `'english'`, ...
python
def get_anime(self, anime_id, title_language='canonical'): """Fetches the Anime Object of the given id or slug. :param anime_id: The Anime ID or Slug. :type anime_id: int or str :param str title_language: The PREFERED title language can be any of `'canonical'`, `'english'`, ...
[ "def", "get_anime", "(", "self", ",", "anime_id", ",", "title_language", "=", "'canonical'", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/anime/%s'", "%", "anime_id", ",", "'GET'", ",", "params", "=", "{", "'title_language_preference'", ":", "title_la...
Fetches the Anime Object of the given id or slug. :param anime_id: The Anime ID or Slug. :type anime_id: int or str :param str title_language: The PREFERED title language can be any of `'canonical'`, `'english'`, `'romanized'` :returns: Anime Object -- The Anime you requeste...
[ "Fetches", "the", "Anime", "Object", "of", "the", "given", "id", "or", "slug", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L69-L81
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.search_anime
def search_anime(self, query): """Fuzzy searches the Anime Database for the query. :param str query: The text to fuzzy search. :returns: List of Anime Objects. This list can be empty. """ r = self._query_('/search/anime', 'GET', params={'query': query})...
python
def search_anime(self, query): """Fuzzy searches the Anime Database for the query. :param str query: The text to fuzzy search. :returns: List of Anime Objects. This list can be empty. """ r = self._query_('/search/anime', 'GET', params={'query': query})...
[ "def", "search_anime", "(", "self", ",", "query", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/search/anime'", ",", "'GET'", ",", "params", "=", "{", "'query'", ":", "query", "}", ")", "results", "=", "[", "Anime", "(", "item", ")", "for", "...
Fuzzy searches the Anime Database for the query. :param str query: The text to fuzzy search. :returns: List of Anime Objects. This list can be empty.
[ "Fuzzy", "searches", "the", "Anime", "Database", "for", "the", "query", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L83-L94
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.get_library
def get_library(self, username, status=None): """Fetches a users library. :param str username: The user to get the library from. :param str status: only return the items with the supplied status. Can be one of `currently-watching`, `plan-to-watch`, `completed`, `on-hold`...
python
def get_library(self, username, status=None): """Fetches a users library. :param str username: The user to get the library from. :param str status: only return the items with the supplied status. Can be one of `currently-watching`, `plan-to-watch`, `completed`, `on-hold`...
[ "def", "get_library", "(", "self", ",", "username", ",", "status", "=", "None", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/users/%s/library'", "%", "username", ",", "'GET'", ",", "params", "=", "{", "'status'", ":", "status", "}", ")", "result...
Fetches a users library. :param str username: The user to get the library from. :param str status: only return the items with the supplied status. Can be one of `currently-watching`, `plan-to-watch`, `completed`, `on-hold` or `dropped`. :returns: List of Library objects...
[ "Fetches", "a", "users", "library", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L96-L111
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.get_user
def get_user(self, username): """Get user information. :param str username: User to get info on. """ r = self._query_('/users/%s' % username, 'GET') result = User(r.json()) return result
python
def get_user(self, username): """Get user information. :param str username: User to get info on. """ r = self._query_('/users/%s' % username, 'GET') result = User(r.json()) return result
[ "def", "get_user", "(", "self", ",", "username", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/users/%s'", "%", "username", ",", "'GET'", ")", "result", "=", "User", "(", "r", ".", "json", "(", ")", ")", "return", "result" ]
Get user information. :param str username: User to get info on.
[ "Get", "user", "information", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L113-L122
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.get_feed
def get_feed(self, username): """Gets a user's feed. :param str username: User to fetch feed from. """ r = self._query_('/users/%s/feed' % username, 'GET') results = [Story(item) for item in r.json()] return results
python
def get_feed(self, username): """Gets a user's feed. :param str username: User to fetch feed from. """ r = self._query_('/users/%s/feed' % username, 'GET') results = [Story(item) for item in r.json()] return results
[ "def", "get_feed", "(", "self", ",", "username", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/users/%s/feed'", "%", "username", ",", "'GET'", ")", "results", "=", "[", "Story", "(", "item", ")", "for", "item", "in", "r", ".", "json", "(", ")...
Gets a user's feed. :param str username: User to fetch feed from.
[ "Gets", "a", "user", "s", "feed", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L124-L134
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.get_favorites
def get_favorites(self, username): """Get a user's favorite anime. :param str username: User to get favorites from. """ r = self._query_('/users/%s/favorite_anime' % username, 'GET') results = [Favorite(item) for item in r.json()] return results
python
def get_favorites(self, username): """Get a user's favorite anime. :param str username: User to get favorites from. """ r = self._query_('/users/%s/favorite_anime' % username, 'GET') results = [Favorite(item) for item in r.json()] return results
[ "def", "get_favorites", "(", "self", ",", "username", ")", ":", "r", "=", "self", ".", "_query_", "(", "'/users/%s/favorite_anime'", "%", "username", ",", "'GET'", ")", "results", "=", "[", "Favorite", "(", "item", ")", "for", "item", "in", "r", ".", "...
Get a user's favorite anime. :param str username: User to get favorites from.
[ "Get", "a", "user", "s", "favorite", "anime", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L136-L145
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.update_entry
def update_entry(self, anime_id, status=None, privacy=None, rating=None, sane_rating_update=None, rewatched_times=None, notes=None, episodes_watched=None, increment_episodes=None): """Creates or updates the Library entry with the provided values. :param anime_i...
python
def update_entry(self, anime_id, status=None, privacy=None, rating=None, sane_rating_update=None, rewatched_times=None, notes=None, episodes_watched=None, increment_episodes=None): """Creates or updates the Library entry with the provided values. :param anime_i...
[ "def", "update_entry", "(", "self", ",", "anime_id", ",", "status", "=", "None", ",", "privacy", "=", "None", ",", "rating", "=", "None", ",", "sane_rating_update", "=", "None", ",", "rewatched_times", "=", "None", ",", "notes", "=", "None", ",", "episod...
Creates or updates the Library entry with the provided values. :param anime_id: The Anime ID or Slug. :type anime_id: int or str :param str auth_token: User authentication token. :param str status: Can be one of `'currently-watching'`, `'plan-to-watch'`, `'comple...
[ "Creates", "or", "updates", "the", "Library", "entry", "with", "the", "provided", "values", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L147-L195
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird.remove_entry
def remove_entry(self, anime_id): """Removes an entry from the user's library. :param anime_id: The Anime ID or slug. """ r = self._query_('libraries/%s/remove' % anime_id, 'POST') if not r.status_code == 200: raise ValueError
python
def remove_entry(self, anime_id): """Removes an entry from the user's library. :param anime_id: The Anime ID or slug. """ r = self._query_('libraries/%s/remove' % anime_id, 'POST') if not r.status_code == 200: raise ValueError
[ "def", "remove_entry", "(", "self", ",", "anime_id", ")", ":", "r", "=", "self", ".", "_query_", "(", "'libraries/%s/remove'", "%", "anime_id", ",", "'POST'", ")", "if", "not", "r", ".", "status_code", "==", "200", ":", "raise", "ValueError" ]
Removes an entry from the user's library. :param anime_id: The Anime ID or slug.
[ "Removes", "an", "entry", "from", "the", "user", "s", "library", "." ]
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L197-L206
collectiveacuity/labPack
labpack/platforms/aws/ssh.py
sshClient.terminal
def terminal(self, confirmation=True): ''' method to open an SSH terminal inside AWS instance :param confirmation: [optional] boolean to prompt keypair confirmation :return: True ''' title = '%s.terminal' % self.__class__.__name__ # construct ssh command ...
python
def terminal(self, confirmation=True): ''' method to open an SSH terminal inside AWS instance :param confirmation: [optional] boolean to prompt keypair confirmation :return: True ''' title = '%s.terminal' % self.__class__.__name__ # construct ssh command ...
[ "def", "terminal", "(", "self", ",", "confirmation", "=", "True", ")", ":", "title", "=", "'%s.terminal'", "%", "self", ".", "__class__", ".", "__name__", "# construct ssh command", "if", "confirmation", ":", "override_cmd", "=", "' '", "else", ":", "override_...
method to open an SSH terminal inside AWS instance :param confirmation: [optional] boolean to prompt keypair confirmation :return: True
[ "method", "to", "open", "an", "SSH", "terminal", "inside", "AWS", "instance" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ssh.py#L197-L226
collectiveacuity/labPack
labpack/platforms/aws/ssh.py
sshClient.script
def script(self, commands, synopsis=True): ''' a method to run a list of shell command scripts on AWS instance :param commands: list of strings with shell commands to pass through connection :param synopsis: [optional] boolean to simplify progress messages to one line :retu...
python
def script(self, commands, synopsis=True): ''' a method to run a list of shell command scripts on AWS instance :param commands: list of strings with shell commands to pass through connection :param synopsis: [optional] boolean to simplify progress messages to one line :retu...
[ "def", "script", "(", "self", ",", "commands", ",", "synopsis", "=", "True", ")", ":", "title", "=", "'%s.script'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "if", "isinstance", "(", "commands", ",", "str", ")", ":", "commands", ...
a method to run a list of shell command scripts on AWS instance :param commands: list of strings with shell commands to pass through connection :param synopsis: [optional] boolean to simplify progress messages to one line :return: string with response to last command
[ "a", "method", "to", "run", "a", "list", "of", "shell", "command", "scripts", "on", "AWS", "instance" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ssh.py#L228-L301
collectiveacuity/labPack
labpack/platforms/aws/ssh.py
sshClient.put
def put(self, local_path, remote_path='', overwrite=False, synopsis=True): ''' a method to copy a folder or file from local device to AWS instance :param local_path: string with path to folder or file on local host :param remote_path: [optional] string with path to copy contents on...
python
def put(self, local_path, remote_path='', overwrite=False, synopsis=True): ''' a method to copy a folder or file from local device to AWS instance :param local_path: string with path to folder or file on local host :param remote_path: [optional] string with path to copy contents on...
[ "def", "put", "(", "self", ",", "local_path", ",", "remote_path", "=", "''", ",", "overwrite", "=", "False", ",", "synopsis", "=", "True", ")", ":", "title", "=", "'%s.put'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_field...
a method to copy a folder or file from local device to AWS instance :param local_path: string with path to folder or file on local host :param remote_path: [optional] string with path to copy contents on remote host :param overwrite: [optional] boolean to enable file overwrite on remote host ...
[ "a", "method", "to", "copy", "a", "folder", "or", "file", "from", "local", "device", "to", "AWS", "instance" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ssh.py#L303-L486
collectiveacuity/labPack
labpack/platforms/aws/ssh.py
sshClient.get
def get(self, remote_path, local_path='', overwrite=False, synopsis=True): ''' a method to copy a folder or file from AWS instance to local device :param remote_path: string with path to copy contents on remote host :param local_path: [optional] string with path to folder or file o...
python
def get(self, remote_path, local_path='', overwrite=False, synopsis=True): ''' a method to copy a folder or file from AWS instance to local device :param remote_path: string with path to copy contents on remote host :param local_path: [optional] string with path to folder or file o...
[ "def", "get", "(", "self", ",", "remote_path", ",", "local_path", "=", "''", ",", "overwrite", "=", "False", ",", "synopsis", "=", "True", ")", ":", "title", "=", "'%s.transfer'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_...
a method to copy a folder or file from AWS instance to local device :param remote_path: string with path to copy contents on remote host :param local_path: [optional] string with path to folder or file on local host :param overwrite: [optional] boolean to enable file overwrite on remote host ...
[ "a", "method", "to", "copy", "a", "folder", "or", "file", "from", "AWS", "instance", "to", "local", "device" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ssh.py#L488-L665
collectiveacuity/labPack
labpack/platforms/aws/ssh.py
sshClient.responsive
def responsive(self, port=80, timeout=600): ''' a method for waiting until web server on AWS instance has restarted :param port: integer with port number to check :param timeout: integer with number of seconds to continue to check :return: string with response code ...
python
def responsive(self, port=80, timeout=600): ''' a method for waiting until web server on AWS instance has restarted :param port: integer with port number to check :param timeout: integer with number of seconds to continue to check :return: string with response code ...
[ "def", "responsive", "(", "self", ",", "port", "=", "80", ",", "timeout", "=", "600", ")", ":", "title", "=", "'%s.wait'", "%", "self", ".", "__class__", ".", "__name__", "from", "time", "import", "sleep", "# validate inputs", "input_fields", "=", "{", "...
a method for waiting until web server on AWS instance has restarted :param port: integer with port number to check :param timeout: integer with number of seconds to continue to check :return: string with response code
[ "a", "method", "for", "waiting", "until", "web", "server", "on", "AWS", "instance", "has", "restarted" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ssh.py#L667-L721
nefarioustim/parker
parker/mediafile.py
get_instance
def get_instance(uri): """Return an instance of MediaFile.""" global _instances try: instance = _instances[uri] except KeyError: instance = MediaFile( uri, client.get_instance() ) _instances[uri] = instance return instance
python
def get_instance(uri): """Return an instance of MediaFile.""" global _instances try: instance = _instances[uri] except KeyError: instance = MediaFile( uri, client.get_instance() ) _instances[uri] = instance return instance
[ "def", "get_instance", "(", "uri", ")", ":", "global", "_instances", "try", ":", "instance", "=", "_instances", "[", "uri", "]", "except", "KeyError", ":", "instance", "=", "MediaFile", "(", "uri", ",", "client", ".", "get_instance", "(", ")", ")", "_ins...
Return an instance of MediaFile.
[ "Return", "an", "instance", "of", "MediaFile", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/mediafile.py#L14-L26
nefarioustim/parker
parker/mediafile.py
MediaFile.fetch_to_file
def fetch_to_file(self, filename): """Stream the MediaFile to the filesystem.""" self.filename = filename stream = self.client.get_iter_content(self.uri) content_type = self.client.response_headers['content-type'] if content_type in _content_type_map: self.fileext = ...
python
def fetch_to_file(self, filename): """Stream the MediaFile to the filesystem.""" self.filename = filename stream = self.client.get_iter_content(self.uri) content_type = self.client.response_headers['content-type'] if content_type in _content_type_map: self.fileext = ...
[ "def", "fetch_to_file", "(", "self", ",", "filename", ")", ":", "self", ".", "filename", "=", "filename", "stream", "=", "self", ".", "client", ".", "get_iter_content", "(", "self", ".", "uri", ")", "content_type", "=", "self", ".", "client", ".", "respo...
Stream the MediaFile to the filesystem.
[ "Stream", "the", "MediaFile", "to", "the", "filesystem", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/mediafile.py#L44-L56
mbodenhamer/syn
syn/base_utils/list.py
is_unique
def is_unique(seq): '''Returns True if every item in the seq is unique, False otherwise.''' try: s = set(seq) return len(s) == len(seq) except TypeError: buf = [] for item in seq: if item in buf: return False buf.append(item) re...
python
def is_unique(seq): '''Returns True if every item in the seq is unique, False otherwise.''' try: s = set(seq) return len(s) == len(seq) except TypeError: buf = [] for item in seq: if item in buf: return False buf.append(item) re...
[ "def", "is_unique", "(", "seq", ")", ":", "try", ":", "s", "=", "set", "(", "seq", ")", "return", "len", "(", "s", ")", "==", "len", "(", "seq", ")", "except", "TypeError", ":", "buf", "=", "[", "]", "for", "item", "in", "seq", ":", "if", "it...
Returns True if every item in the seq is unique, False otherwise.
[ "Returns", "True", "if", "every", "item", "in", "the", "seq", "is", "unique", "False", "otherwise", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/list.py#L211-L222
mbodenhamer/syn
syn/base_utils/list.py
indices_removed
def indices_removed(lst, idxs): '''Returns a copy of lst with each index in idxs removed.''' ret = [item for k,item in enumerate(lst) if k not in idxs] return type(lst)(ret)
python
def indices_removed(lst, idxs): '''Returns a copy of lst with each index in idxs removed.''' ret = [item for k,item in enumerate(lst) if k not in idxs] return type(lst)(ret)
[ "def", "indices_removed", "(", "lst", ",", "idxs", ")", ":", "ret", "=", "[", "item", "for", "k", ",", "item", "in", "enumerate", "(", "lst", ")", "if", "k", "not", "in", "idxs", "]", "return", "type", "(", "lst", ")", "(", "ret", ")" ]
Returns a copy of lst with each index in idxs removed.
[ "Returns", "a", "copy", "of", "lst", "with", "each", "index", "in", "idxs", "removed", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/list.py#L227-L230
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/elementary_functions.py
_deriv_hypot
def _deriv_hypot(x, y): """Derivative of numpy hypot function""" r = np.hypot(x, y) df_dx = x / r df_dy = y / r return np.hstack([df_dx, df_dy])
python
def _deriv_hypot(x, y): """Derivative of numpy hypot function""" r = np.hypot(x, y) df_dx = x / r df_dy = y / r return np.hstack([df_dx, df_dy])
[ "def", "_deriv_hypot", "(", "x", ",", "y", ")", ":", "r", "=", "np", ".", "hypot", "(", "x", ",", "y", ")", "df_dx", "=", "x", "/", "r", "df_dy", "=", "y", "/", "r", "return", "np", ".", "hstack", "(", "[", "df_dx", ",", "df_dy", "]", ")" ]
Derivative of numpy hypot function
[ "Derivative", "of", "numpy", "hypot", "function" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/elementary_functions.py#L200-L205
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/elementary_functions.py
_deriv_arctan2
def _deriv_arctan2(y, x): """Derivative of the arctan2 function""" r2 = x*x + y*y df_dy = x / r2 df_dx = -y / r2 return np.hstack([df_dy, df_dx])
python
def _deriv_arctan2(y, x): """Derivative of the arctan2 function""" r2 = x*x + y*y df_dy = x / r2 df_dx = -y / r2 return np.hstack([df_dy, df_dx])
[ "def", "_deriv_arctan2", "(", "y", ",", "x", ")", ":", "r2", "=", "x", "*", "x", "+", "y", "*", "y", "df_dy", "=", "x", "/", "r2", "df_dx", "=", "-", "y", "/", "r2", "return", "np", ".", "hstack", "(", "[", "df_dy", ",", "df_dx", "]", ")" ]
Derivative of the arctan2 function
[ "Derivative", "of", "the", "arctan2", "function" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/elementary_functions.py#L211-L216
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/elementary_functions.py
_deriv_logaddexp
def _deriv_logaddexp(x1, x2): """The derivative of f(x, y) = log(e^x + e^y)""" y1 = np.exp(x1) y2 = np.exp(x2) df_dx1 = y1 / (y1 + y2) df_dx2 = y2 / (y1 + y2) return np.vstack([df_dx1, df_dx2]).T
python
def _deriv_logaddexp(x1, x2): """The derivative of f(x, y) = log(e^x + e^y)""" y1 = np.exp(x1) y2 = np.exp(x2) df_dx1 = y1 / (y1 + y2) df_dx2 = y2 / (y1 + y2) return np.vstack([df_dx1, df_dx2]).T
[ "def", "_deriv_logaddexp", "(", "x1", ",", "x2", ")", ":", "y1", "=", "np", ".", "exp", "(", "x1", ")", "y2", "=", "np", ".", "exp", "(", "x2", ")", "df_dx1", "=", "y1", "/", "(", "y1", "+", "y2", ")", "df_dx2", "=", "y2", "/", "(", "y1", ...
The derivative of f(x, y) = log(e^x + e^y)
[ "The", "derivative", "of", "f", "(", "x", "y", ")", "=", "log", "(", "e^x", "+", "e^y", ")" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/elementary_functions.py#L351-L357
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/elementary_functions.py
_deriv_logaddexp2
def _deriv_logaddexp2(x1, x2): """The derivative of f(x, y) = log2(2^x + 2^y)""" y1 = np.exp2(x1) y2 = np.exp2(x2) df_dx1 = y1 / (y1 + y2) df_dx2 = y2 / (y1 + y2) return np.vstack([df_dx1, df_dx2]).T
python
def _deriv_logaddexp2(x1, x2): """The derivative of f(x, y) = log2(2^x + 2^y)""" y1 = np.exp2(x1) y2 = np.exp2(x2) df_dx1 = y1 / (y1 + y2) df_dx2 = y2 / (y1 + y2) return np.vstack([df_dx1, df_dx2]).T
[ "def", "_deriv_logaddexp2", "(", "x1", ",", "x2", ")", ":", "y1", "=", "np", ".", "exp2", "(", "x1", ")", "y2", "=", "np", ".", "exp2", "(", "x2", ")", "df_dx1", "=", "y1", "/", "(", "y1", "+", "y2", ")", "df_dx2", "=", "y2", "/", "(", "y1"...
The derivative of f(x, y) = log2(2^x + 2^y)
[ "The", "derivative", "of", "f", "(", "x", "y", ")", "=", "log2", "(", "2^x", "+", "2^y", ")" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/elementary_functions.py#L362-L368
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/elementary_functions.py
DifferentiableUnopFunction._forward_mode
def _forward_mode(self, *args): """Forward mode differentiation for a constant""" # Evaluate inner function self.f X: np.ndarray dX: np.ndarray X, dX = self.f._forward_mode(*args) # The function value val = self.func(X) # The derivative diff = self...
python
def _forward_mode(self, *args): """Forward mode differentiation for a constant""" # Evaluate inner function self.f X: np.ndarray dX: np.ndarray X, dX = self.f._forward_mode(*args) # The function value val = self.func(X) # The derivative diff = self...
[ "def", "_forward_mode", "(", "self", ",", "*", "args", ")", ":", "# Evaluate inner function self.f", "X", ":", "np", ".", "ndarray", "dX", ":", "np", ".", "ndarray", "X", ",", "dX", "=", "self", ".", "f", ".", "_forward_mode", "(", "*", "args", ")", ...
Forward mode differentiation for a constant
[ "Forward", "mode", "differentiation", "for", "a", "constant" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/elementary_functions.py#L51-L61
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/elementary_functions.py
DifferentiableBinopFunction._forward_mode
def _forward_mode(self, *args): """Forward mode differentiation for a constant""" # Evaluate inner function self.f X: np.ndarray dX: np.ndarray X, dX = self.f._forward_mode(*args) Y: np.ndarray dY: np.ndarray Y, dY = self.g._forward_mode(*args) # T...
python
def _forward_mode(self, *args): """Forward mode differentiation for a constant""" # Evaluate inner function self.f X: np.ndarray dX: np.ndarray X, dX = self.f._forward_mode(*args) Y: np.ndarray dY: np.ndarray Y, dY = self.g._forward_mode(*args) # T...
[ "def", "_forward_mode", "(", "self", ",", "*", "args", ")", ":", "# Evaluate inner function self.f", "X", ":", "np", ".", "ndarray", "dX", ":", "np", ".", "ndarray", "X", ",", "dX", "=", "self", ".", "f", ".", "_forward_mode", "(", "*", "args", ")", ...
Forward mode differentiation for a constant
[ "Forward", "mode", "differentiation", "for", "a", "constant" ]
train
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/elementary_functions.py#L80-L93
lambdalisue/maidenhair
src/maidenhair/classification/classify.py
default_classify_function
def default_classify_function(data): """ A default classify_function which recieve `data` and return filename without characters just after the last underscore >>> # [<filename>] is mimicking `data` >>> default_classify_function(['./foo/foo_bar_hoge.piyo']) './foo/foo_bar.piyo' >>> default_...
python
def default_classify_function(data): """ A default classify_function which recieve `data` and return filename without characters just after the last underscore >>> # [<filename>] is mimicking `data` >>> default_classify_function(['./foo/foo_bar_hoge.piyo']) './foo/foo_bar.piyo' >>> default_...
[ "def", "default_classify_function", "(", "data", ")", ":", "# data[0] indicate the filename of the data", "rootname", ",", "basename", "=", "os", ".", "path", ".", "split", "(", "data", "[", "0", "]", ")", "filename", ",", "ext", "=", "os", ".", "path", ".",...
A default classify_function which recieve `data` and return filename without characters just after the last underscore >>> # [<filename>] is mimicking `data` >>> default_classify_function(['./foo/foo_bar_hoge.piyo']) './foo/foo_bar.piyo' >>> default_classify_function(['./foo/foo_bar.piyo']) './...
[ "A", "default", "classify_function", "which", "recieve", "data", "and", "return", "filename", "without", "characters", "just", "after", "the", "last", "underscore" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/classification/classify.py#L10-L31
lambdalisue/maidenhair
src/maidenhair/classification/classify.py
classify_dataset
def classify_dataset(dataset, fn): """ Classify dataset via fn Parameters ---------- dataset : list A list of data fn : function A function which recieve :attr:`data` and return classification string. It if is None, a function which return the first item of the :...
python
def classify_dataset(dataset, fn): """ Classify dataset via fn Parameters ---------- dataset : list A list of data fn : function A function which recieve :attr:`data` and return classification string. It if is None, a function which return the first item of the :...
[ "def", "classify_dataset", "(", "dataset", ",", "fn", ")", ":", "if", "fn", "is", "None", ":", "fn", "=", "default_classify_function", "# classify dataset via classify_fn", "classified_dataset", "=", "OrderedDict", "(", ")", "for", "data", "in", "dataset", ":", ...
Classify dataset via fn Parameters ---------- dataset : list A list of data fn : function A function which recieve :attr:`data` and return classification string. It if is None, a function which return the first item of the :attr:`data` will be used (See ``with_filename``...
[ "Classify", "dataset", "via", "fn" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/classification/classify.py#L34-L62
rikrd/inspire
inspirespeech/edit_distance.py
Script.to_strings
def to_strings(self, use_colors=True): """Convert an edit script to a pair of strings representing the operation in a human readable way. :param use_colors: Boolean indicating whether to use terminal color codes to color the output. :return: Tuple with text corresponding to the first pronunciat...
python
def to_strings(self, use_colors=True): """Convert an edit script to a pair of strings representing the operation in a human readable way. :param use_colors: Boolean indicating whether to use terminal color codes to color the output. :return: Tuple with text corresponding to the first pronunciat...
[ "def", "to_strings", "(", "self", ",", "use_colors", "=", "True", ")", ":", "edit_script", "=", "self", ".", "to_primitive", "(", ")", "colors", "=", "collections", ".", "defaultdict", "(", "str", ")", "if", "use_colors", ":", "colors", "[", "'red'", "]"...
Convert an edit script to a pair of strings representing the operation in a human readable way. :param use_colors: Boolean indicating whether to use terminal color codes to color the output. :return: Tuple with text corresponding to the first pronunciation and the text of the second one.
[ "Convert", "an", "edit", "script", "to", "a", "pair", "of", "strings", "representing", "the", "operation", "in", "a", "human", "readable", "way", "." ]
train
https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/edit_distance.py#L54-L107
lockwooddev/python-nasapi
nasapi/api.py
Nasapi.get_apod
def get_apod(cls, date=None, hd=False): """ Returns Astronomy Picture of the Day Args: date: date instance (default = today) hd: bool if high resolution should be included Returns: json """ instance = cls('planetary/apod') fi...
python
def get_apod(cls, date=None, hd=False): """ Returns Astronomy Picture of the Day Args: date: date instance (default = today) hd: bool if high resolution should be included Returns: json """ instance = cls('planetary/apod') fi...
[ "def", "get_apod", "(", "cls", ",", "date", "=", "None", ",", "hd", "=", "False", ")", ":", "instance", "=", "cls", "(", "'planetary/apod'", ")", "filters", "=", "{", "'date'", ":", "date", ",", "'hd'", ":", "hd", "}", "return", "instance", ".", "g...
Returns Astronomy Picture of the Day Args: date: date instance (default = today) hd: bool if high resolution should be included Returns: json
[ "Returns", "Astronomy", "Picture", "of", "the", "Day" ]
train
https://github.com/lockwooddev/python-nasapi/blob/b487dd834c91b8a125a10c9b4b996ed2380da498/nasapi/api.py#L72-L90
lockwooddev/python-nasapi
nasapi/api.py
Nasapi.get_assets
def get_assets(cls, lat, lon, begin=None, end=None): """ Returns date and ids of flyovers Args: lat: latitude float lon: longitude float begin: date instance end: date instance Returns: json """ instance = cls(...
python
def get_assets(cls, lat, lon, begin=None, end=None): """ Returns date and ids of flyovers Args: lat: latitude float lon: longitude float begin: date instance end: date instance Returns: json """ instance = cls(...
[ "def", "get_assets", "(", "cls", ",", "lat", ",", "lon", ",", "begin", "=", "None", ",", "end", "=", "None", ")", ":", "instance", "=", "cls", "(", "'planetary/earth/assets'", ")", "filters", "=", "{", "'lat'", ":", "lat", ",", "'lon'", ":", "lon", ...
Returns date and ids of flyovers Args: lat: latitude float lon: longitude float begin: date instance end: date instance Returns: json
[ "Returns", "date", "and", "ids", "of", "flyovers" ]
train
https://github.com/lockwooddev/python-nasapi/blob/b487dd834c91b8a125a10c9b4b996ed2380da498/nasapi/api.py#L93-L115
lockwooddev/python-nasapi
nasapi/api.py
Nasapi.get_imagery
def get_imagery(cls, lat, lon, date=None, dim=None, cloud_score=False): """ Returns satellite image Args: lat: latitude float lon: longitude float date: date instance of available date from `get_assets` dim: width and height of image in degrees as...
python
def get_imagery(cls, lat, lon, date=None, dim=None, cloud_score=False): """ Returns satellite image Args: lat: latitude float lon: longitude float date: date instance of available date from `get_assets` dim: width and height of image in degrees as...
[ "def", "get_imagery", "(", "cls", ",", "lat", ",", "lon", ",", "date", "=", "None", ",", "dim", "=", "None", ",", "cloud_score", "=", "False", ")", ":", "instance", "=", "cls", "(", "'planetary/earth/imagery'", ")", "filters", "=", "{", "'lat'", ":", ...
Returns satellite image Args: lat: latitude float lon: longitude float date: date instance of available date from `get_assets` dim: width and height of image in degrees as float cloud_score: boolean to calculate the percentage of the image covered by ...
[ "Returns", "satellite", "image" ]
train
https://github.com/lockwooddev/python-nasapi/blob/b487dd834c91b8a125a10c9b4b996ed2380da498/nasapi/api.py#L118-L142
etcher-be/emiz
emiz/avwx/core.py
valid_station
def valid_station(station: str): """ Checks the validity of a station ident This function doesn't return anything. It merely raises a BadStation error if needed """ station = station.strip() if len(station) != 4: raise BadStation('ICAO station idents must be four characters long') u...
python
def valid_station(station: str): """ Checks the validity of a station ident This function doesn't return anything. It merely raises a BadStation error if needed """ station = station.strip() if len(station) != 4: raise BadStation('ICAO station idents must be four characters long') u...
[ "def", "valid_station", "(", "station", ":", "str", ")", ":", "station", "=", "station", ".", "strip", "(", ")", "if", "len", "(", "station", ")", "!=", "4", ":", "raise", "BadStation", "(", "'ICAO station idents must be four characters long'", ")", "uses_na_f...
Checks the validity of a station ident This function doesn't return anything. It merely raises a BadStation error if needed
[ "Checks", "the", "validity", "of", "a", "station", "ident" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L23-L32
etcher-be/emiz
emiz/avwx/core.py
uses_na_format
def uses_na_format(station: str) -> bool: """ Returns True if the station uses the North American format, False if the International format """ if station[0] in NA_REGIONS: return True if station[0] in IN_REGIONS: return False if station[:2] in M_NA_REGIONS: return Tr...
python
def uses_na_format(station: str) -> bool: """ Returns True if the station uses the North American format, False if the International format """ if station[0] in NA_REGIONS: return True if station[0] in IN_REGIONS: return False if station[:2] in M_NA_REGIONS: return Tr...
[ "def", "uses_na_format", "(", "station", ":", "str", ")", "->", "bool", ":", "if", "station", "[", "0", "]", "in", "NA_REGIONS", ":", "return", "True", "if", "station", "[", "0", "]", "in", "IN_REGIONS", ":", "return", "False", "if", "station", "[", ...
Returns True if the station uses the North American format, False if the International format
[ "Returns", "True", "if", "the", "station", "uses", "the", "North", "American", "format", "False", "if", "the", "International", "format" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L35-L48
etcher-be/emiz
emiz/avwx/core.py
is_unknown
def is_unknown(val: str) -> bool: """ Returns True if val contains only '/' characters """ for char in ('/', 'X'): if val == char * len(val): return True return False
python
def is_unknown(val: str) -> bool: """ Returns True if val contains only '/' characters """ for char in ('/', 'X'): if val == char * len(val): return True return False
[ "def", "is_unknown", "(", "val", ":", "str", ")", "->", "bool", ":", "for", "char", "in", "(", "'/'", ",", "'X'", ")", ":", "if", "val", "==", "char", "*", "len", "(", "val", ")", ":", "return", "True", "return", "False" ]
Returns True if val contains only '/' characters
[ "Returns", "True", "if", "val", "contains", "only", "/", "characters" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L51-L58
etcher-be/emiz
emiz/avwx/core.py
unpack_fraction
def unpack_fraction(num: str) -> str: """ Returns unpacked fraction string 5/2 -> 2 1/2 """ nums = [int(n) for n in num.split('/') if n] if len(nums) == 2 and nums[0] > nums[1]: over = nums[0] // nums[1] rem = nums[0] % nums[1] return f'{over} {rem}/{nums[1]}' return num
python
def unpack_fraction(num: str) -> str: """ Returns unpacked fraction string 5/2 -> 2 1/2 """ nums = [int(n) for n in num.split('/') if n] if len(nums) == 2 and nums[0] > nums[1]: over = nums[0] // nums[1] rem = nums[0] % nums[1] return f'{over} {rem}/{nums[1]}' return num
[ "def", "unpack_fraction", "(", "num", ":", "str", ")", "->", "str", ":", "nums", "=", "[", "int", "(", "n", ")", "for", "n", "in", "num", ".", "split", "(", "'/'", ")", "if", "n", "]", "if", "len", "(", "nums", ")", "==", "2", "and", "nums", ...
Returns unpacked fraction string 5/2 -> 2 1/2
[ "Returns", "unpacked", "fraction", "string", "5", "/", "2", "-", ">", "2", "1", "/", "2" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L61-L70
etcher-be/emiz
emiz/avwx/core.py
remove_leading_zeros
def remove_leading_zeros(num: str) -> str: """ Strips zeros while handling -, M, and empty strings """ if not num: return num if num.startswith('M'): ret = 'M' + num[1:].lstrip('0') elif num.startswith('-'): ret = '-' + num[1:].lstrip('0') else: ret = num.lstr...
python
def remove_leading_zeros(num: str) -> str: """ Strips zeros while handling -, M, and empty strings """ if not num: return num if num.startswith('M'): ret = 'M' + num[1:].lstrip('0') elif num.startswith('-'): ret = '-' + num[1:].lstrip('0') else: ret = num.lstr...
[ "def", "remove_leading_zeros", "(", "num", ":", "str", ")", "->", "str", ":", "if", "not", "num", ":", "return", "num", "if", "num", ".", "startswith", "(", "'M'", ")", ":", "ret", "=", "'M'", "+", "num", "[", "1", ":", "]", ".", "lstrip", "(", ...
Strips zeros while handling -, M, and empty strings
[ "Strips", "zeros", "while", "handling", "-", "M", "and", "empty", "strings" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L73-L85
etcher-be/emiz
emiz/avwx/core.py
spoken_number
def spoken_number(num: str) -> str: """ Returns the spoken version of a number Ex: 1.2 -> one point two 1 1/2 -> one and one half """ ret = [] for part in num.split(' '): if part in FRACTIONS: ret.append(FRACTIONS[part]) else: ret.append(' '.join(...
python
def spoken_number(num: str) -> str: """ Returns the spoken version of a number Ex: 1.2 -> one point two 1 1/2 -> one and one half """ ret = [] for part in num.split(' '): if part in FRACTIONS: ret.append(FRACTIONS[part]) else: ret.append(' '.join(...
[ "def", "spoken_number", "(", "num", ":", "str", ")", "->", "str", ":", "ret", "=", "[", "]", "for", "part", "in", "num", ".", "split", "(", "' '", ")", ":", "if", "part", "in", "FRACTIONS", ":", "ret", ".", "append", "(", "FRACTIONS", "[", "part"...
Returns the spoken version of a number Ex: 1.2 -> one point two 1 1/2 -> one and one half
[ "Returns", "the", "spoken", "version", "of", "a", "number" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L88-L101
etcher-be/emiz
emiz/avwx/core.py
make_number
def make_number(num: str, repr_: str = None, speak: str = None): """ Returns a Number or Fraction dataclass for a number string """ if not num or is_unknown(num): return # Check CAVOK if num == 'CAVOK': return Number('CAVOK', 9999, 'ceiling and visibility ok') # type: ignore ...
python
def make_number(num: str, repr_: str = None, speak: str = None): """ Returns a Number or Fraction dataclass for a number string """ if not num or is_unknown(num): return # Check CAVOK if num == 'CAVOK': return Number('CAVOK', 9999, 'ceiling and visibility ok') # type: ignore ...
[ "def", "make_number", "(", "num", ":", "str", ",", "repr_", ":", "str", "=", "None", ",", "speak", ":", "str", "=", "None", ")", ":", "if", "not", "num", "or", "is_unknown", "(", "num", ")", ":", "return", "# Check CAVOK", "if", "num", "==", "'CAVO...
Returns a Number or Fraction dataclass for a number string
[ "Returns", "a", "Number", "or", "Fraction", "dataclass", "for", "a", "number", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L104-L125
etcher-be/emiz
emiz/avwx/core.py
find_first_in_list
def find_first_in_list(txt: str, str_list: [str]) -> int: # type: ignore """ Returns the index of the earliest occurence of an item from a list in a string Ex: find_first_in_list('foobar', ['bar', 'fin']) -> 3 """ start = len(txt) + 1 for item in str_list: if start > txt.find(item) > -...
python
def find_first_in_list(txt: str, str_list: [str]) -> int: # type: ignore """ Returns the index of the earliest occurence of an item from a list in a string Ex: find_first_in_list('foobar', ['bar', 'fin']) -> 3 """ start = len(txt) + 1 for item in str_list: if start > txt.find(item) > -...
[ "def", "find_first_in_list", "(", "txt", ":", "str", ",", "str_list", ":", "[", "str", "]", ")", "->", "int", ":", "# type: ignore", "start", "=", "len", "(", "txt", ")", "+", "1", "for", "item", "in", "str_list", ":", "if", "start", ">", "txt", "....
Returns the index of the earliest occurence of an item from a list in a string Ex: find_first_in_list('foobar', ['bar', 'fin']) -> 3
[ "Returns", "the", "index", "of", "the", "earliest", "occurence", "of", "an", "item", "from", "a", "list", "in", "a", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L128-L138
etcher-be/emiz
emiz/avwx/core.py
get_remarks
def get_remarks(txt: str) -> ([str], str): # type: ignore """ Returns the report split into components and the remarks string Remarks can include items like RMK and on, NOSIG and on, and BECMG and on """ txt = txt.replace('?', '').strip() # First look for Altimeter in txt alt_index = len(t...
python
def get_remarks(txt: str) -> ([str], str): # type: ignore """ Returns the report split into components and the remarks string Remarks can include items like RMK and on, NOSIG and on, and BECMG and on """ txt = txt.replace('?', '').strip() # First look for Altimeter in txt alt_index = len(t...
[ "def", "get_remarks", "(", "txt", ":", "str", ")", "->", "(", "[", "str", "]", ",", "str", ")", ":", "# type: ignore", "txt", "=", "txt", ".", "replace", "(", "'?'", ",", "''", ")", ".", "strip", "(", ")", "# First look for Altimeter in txt", "alt_inde...
Returns the report split into components and the remarks string Remarks can include items like RMK and on, NOSIG and on, and BECMG and on
[ "Returns", "the", "report", "split", "into", "components", "and", "the", "remarks", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L141-L162
etcher-be/emiz
emiz/avwx/core.py
get_taf_remarks
def get_taf_remarks(txt: str) -> (str, str): # type: ignore """ Returns report and remarks separated if found """ remarks_start = find_first_in_list(txt, TAF_RMK) if remarks_start == -1: return txt, '' remarks = txt[remarks_start:] txt = txt[:remarks_start].strip() return txt, r...
python
def get_taf_remarks(txt: str) -> (str, str): # type: ignore """ Returns report and remarks separated if found """ remarks_start = find_first_in_list(txt, TAF_RMK) if remarks_start == -1: return txt, '' remarks = txt[remarks_start:] txt = txt[:remarks_start].strip() return txt, r...
[ "def", "get_taf_remarks", "(", "txt", ":", "str", ")", "->", "(", "str", ",", "str", ")", ":", "# type: ignore", "remarks_start", "=", "find_first_in_list", "(", "txt", ",", "TAF_RMK", ")", "if", "remarks_start", "==", "-", "1", ":", "return", "txt", ","...
Returns report and remarks separated if found
[ "Returns", "report", "and", "remarks", "separated", "if", "found" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L165-L174
etcher-be/emiz
emiz/avwx/core.py
sanitize_report_string
def sanitize_report_string(txt: str) -> str: """ Provides sanitization for operations that work better when the report is a string Returns the first pass sanitized report string """ if len(txt) < 4: return txt # Standardize whitespace txt = ' '.join(txt.split()) # Prevent change...
python
def sanitize_report_string(txt: str) -> str: """ Provides sanitization for operations that work better when the report is a string Returns the first pass sanitized report string """ if len(txt) < 4: return txt # Standardize whitespace txt = ' '.join(txt.split()) # Prevent change...
[ "def", "sanitize_report_string", "(", "txt", ":", "str", ")", "->", "str", ":", "if", "len", "(", "txt", ")", "<", "4", ":", "return", "txt", "# Standardize whitespace", "txt", "=", "' '", ".", "join", "(", "txt", ".", "split", "(", ")", ")", "# Prev...
Provides sanitization for operations that work better when the report is a string Returns the first pass sanitized report string
[ "Provides", "sanitization", "for", "operations", "that", "work", "better", "when", "the", "report", "is", "a", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L180-L211
etcher-be/emiz
emiz/avwx/core.py
sanitize_line
def sanitize_line(txt: str) -> str: """ Fixes common mistakes with 'new line' signifiers so that they can be recognized """ for key in LINE_FIXES: index = txt.find(key) if index > -1: txt = txt[:index] + LINE_FIXES[key] + txt[index + len(key):] # Fix when space is missing...
python
def sanitize_line(txt: str) -> str: """ Fixes common mistakes with 'new line' signifiers so that they can be recognized """ for key in LINE_FIXES: index = txt.find(key) if index > -1: txt = txt[:index] + LINE_FIXES[key] + txt[index + len(key):] # Fix when space is missing...
[ "def", "sanitize_line", "(", "txt", ":", "str", ")", "->", "str", ":", "for", "key", "in", "LINE_FIXES", ":", "index", "=", "txt", ".", "find", "(", "key", ")", "if", "index", ">", "-", "1", ":", "txt", "=", "txt", "[", ":", "index", "]", "+", ...
Fixes common mistakes with 'new line' signifiers so that they can be recognized
[ "Fixes", "common", "mistakes", "with", "new", "line", "signifiers", "so", "that", "they", "can", "be", "recognized" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L222-L235
etcher-be/emiz
emiz/avwx/core.py
extra_space_exists
def extra_space_exists(str1: str, str2: str) -> bool: # noqa """ Return True if a space shouldn't exist between two items """ ls1, ls2 = len(str1), len(str2) if str1.isdigit(): # 10 SM if str2 in ['SM', '0SM']: return True # 12 /10 if ls2 > 2 and str2[0] ...
python
def extra_space_exists(str1: str, str2: str) -> bool: # noqa """ Return True if a space shouldn't exist between two items """ ls1, ls2 = len(str1), len(str2) if str1.isdigit(): # 10 SM if str2 in ['SM', '0SM']: return True # 12 /10 if ls2 > 2 and str2[0] ...
[ "def", "extra_space_exists", "(", "str1", ":", "str", ",", "str2", ":", "str", ")", "->", "bool", ":", "# noqa", "ls1", ",", "ls2", "=", "len", "(", "str1", ")", ",", "len", "(", "str2", ")", "if", "str1", ".", "isdigit", "(", ")", ":", "# 10 SM"...
Return True if a space shouldn't exist between two items
[ "Return", "True", "if", "a", "space", "shouldn", "t", "exist", "between", "two", "items" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L238-L280
etcher-be/emiz
emiz/avwx/core.py
sanitize_report_list
def sanitize_report_list(wxdata: [str], # type: ignore # noqa remove_clr_and_skc: bool = True ) -> ([str], [str], str): # type: ignore """ Sanitize wxData We can remove and identify "one-off" elements and fix other issues before parsing a line We al...
python
def sanitize_report_list(wxdata: [str], # type: ignore # noqa remove_clr_and_skc: bool = True ) -> ([str], [str], str): # type: ignore """ Sanitize wxData We can remove and identify "one-off" elements and fix other issues before parsing a line We al...
[ "def", "sanitize_report_list", "(", "wxdata", ":", "[", "str", "]", ",", "# type: ignore # noqa", "remove_clr_and_skc", ":", "bool", "=", "True", ")", "->", "(", "[", "str", "]", ",", "[", "str", "]", ",", "str", ")", ":", "# type: ignore", "shear", "="...
Sanitize wxData We can remove and identify "one-off" elements and fix other issues before parsing a line We also return the runway visibility and wind shear since they are very easy to recognize and their location in the report is non-standard
[ "Sanitize", "wxData" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L289-L350
etcher-be/emiz
emiz/avwx/core.py
get_altimeter
def get_altimeter(wxdata: [str], units: Units, version: str = 'NA') -> ([str], Number): # type: ignore # noqa """ Returns the report list and the removed altimeter item Version is 'NA' (North American / default) or 'IN' (International) """ if not wxdata: return wxdata, None altimeter ...
python
def get_altimeter(wxdata: [str], units: Units, version: str = 'NA') -> ([str], Number): # type: ignore # noqa """ Returns the report list and the removed altimeter item Version is 'NA' (North American / default) or 'IN' (International) """ if not wxdata: return wxdata, None altimeter ...
[ "def", "get_altimeter", "(", "wxdata", ":", "[", "str", "]", ",", "units", ":", "Units", ",", "version", ":", "str", "=", "'NA'", ")", "->", "(", "[", "str", "]", ",", "Number", ")", ":", "# type: ignore # noqa", "if", "not", "wxdata", ":", "return"...
Returns the report list and the removed altimeter item Version is 'NA' (North American / default) or 'IN' (International)
[ "Returns", "the", "report", "list", "and", "the", "removed", "altimeter", "item" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L354-L403
etcher-be/emiz
emiz/avwx/core.py
get_taf_alt_ice_turb
def get_taf_alt_ice_turb(wxdata: [str]) -> ([str], str, [str], [str]): # type: ignore """ Returns the report list and removed: Altimeter string, Icing list, Turbulance list """ altimeter = '' icing, turbulence = [], [] for i, item in reversed(list(enumerate(wxdata))): if len(item) > 6 a...
python
def get_taf_alt_ice_turb(wxdata: [str]) -> ([str], str, [str], [str]): # type: ignore """ Returns the report list and removed: Altimeter string, Icing list, Turbulance list """ altimeter = '' icing, turbulence = [], [] for i, item in reversed(list(enumerate(wxdata))): if len(item) > 6 a...
[ "def", "get_taf_alt_ice_turb", "(", "wxdata", ":", "[", "str", "]", ")", "->", "(", "[", "str", "]", ",", "str", ",", "[", "str", "]", ",", "[", "str", "]", ")", ":", "# type: ignore", "altimeter", "=", "''", "icing", ",", "turbulence", "=", "[", ...
Returns the report list and removed: Altimeter string, Icing list, Turbulance list
[ "Returns", "the", "report", "list", "and", "removed", ":", "Altimeter", "string", "Icing", "list", "Turbulance", "list" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L406-L420
etcher-be/emiz
emiz/avwx/core.py
is_possible_temp
def is_possible_temp(temp: str) -> bool: """ Returns True if all characters are digits or 'M' (for minus) """ for char in temp: if not (char.isdigit() or char == 'M'): return False return True
python
def is_possible_temp(temp: str) -> bool: """ Returns True if all characters are digits or 'M' (for minus) """ for char in temp: if not (char.isdigit() or char == 'M'): return False return True
[ "def", "is_possible_temp", "(", "temp", ":", "str", ")", "->", "bool", ":", "for", "char", "in", "temp", ":", "if", "not", "(", "char", ".", "isdigit", "(", ")", "or", "char", "==", "'M'", ")", ":", "return", "False", "return", "True" ]
Returns True if all characters are digits or 'M' (for minus)
[ "Returns", "True", "if", "all", "characters", "are", "digits", "or", "M", "(", "for", "minus", ")" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L423-L430
etcher-be/emiz
emiz/avwx/core.py
get_temp_and_dew
def get_temp_and_dew(wxdata: str) -> ([str], Number, Number): # type: ignore """ Returns the report list and removed temperature and dewpoint strings """ for i, item in reversed(list(enumerate(wxdata))): if '/' in item: # ///07 if item[0] == '/': item = '...
python
def get_temp_and_dew(wxdata: str) -> ([str], Number, Number): # type: ignore """ Returns the report list and removed temperature and dewpoint strings """ for i, item in reversed(list(enumerate(wxdata))): if '/' in item: # ///07 if item[0] == '/': item = '...
[ "def", "get_temp_and_dew", "(", "wxdata", ":", "str", ")", "->", "(", "[", "str", "]", ",", "Number", ",", "Number", ")", ":", "# type: ignore", "for", "i", ",", "item", "in", "reversed", "(", "list", "(", "enumerate", "(", "wxdata", ")", ")", ")", ...
Returns the report list and removed temperature and dewpoint strings
[ "Returns", "the", "report", "list", "and", "removed", "temperature", "and", "dewpoint", "strings" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L433-L458
etcher-be/emiz
emiz/avwx/core.py
get_station_and_time
def get_station_and_time(wxdata: [str]) -> ([str], str, str): # type: ignore """ Returns the report list and removed station ident and time strings """ station = wxdata.pop(0) qtime = wxdata[0] if wxdata and qtime.endswith('Z') and qtime[:-1].isdigit(): rtime = wxdata.pop(0) elif wx...
python
def get_station_and_time(wxdata: [str]) -> ([str], str, str): # type: ignore """ Returns the report list and removed station ident and time strings """ station = wxdata.pop(0) qtime = wxdata[0] if wxdata and qtime.endswith('Z') and qtime[:-1].isdigit(): rtime = wxdata.pop(0) elif wx...
[ "def", "get_station_and_time", "(", "wxdata", ":", "[", "str", "]", ")", "->", "(", "[", "str", "]", ",", "str", ",", "str", ")", ":", "# type: ignore", "station", "=", "wxdata", ".", "pop", "(", "0", ")", "qtime", "=", "wxdata", "[", "0", "]", "...
Returns the report list and removed station ident and time strings
[ "Returns", "the", "report", "list", "and", "removed", "station", "ident", "and", "time", "strings" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L461-L473
etcher-be/emiz
emiz/avwx/core.py
get_wind
def get_wind(wxdata: [str], units: Units) -> ([str], Number, Number, Number, [Number]): # type: ignore # noqa """ Returns the report list and removed: Direction string, speed string, gust string, variable direction list """ direction, speed, gust = '', '', '' variable = [] # type: ignore ...
python
def get_wind(wxdata: [str], units: Units) -> ([str], Number, Number, Number, [Number]): # type: ignore # noqa """ Returns the report list and removed: Direction string, speed string, gust string, variable direction list """ direction, speed, gust = '', '', '' variable = [] # type: ignore ...
[ "def", "get_wind", "(", "wxdata", ":", "[", "str", "]", ",", "units", ":", "Units", ")", "->", "(", "[", "str", "]", ",", "Number", ",", "Number", ",", "Number", ",", "[", "Number", "]", ")", ":", "# type: ignore # noqa", "direction", ",", "speed", ...
Returns the report list and removed: Direction string, speed string, gust string, variable direction list
[ "Returns", "the", "report", "list", "and", "removed", ":", "Direction", "string", "speed", "string", "gust", "string", "variable", "direction", "list" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L477-L526
etcher-be/emiz
emiz/avwx/core.py
get_visibility
def get_visibility(wxdata: [str], units: Units) -> ([str], Number): # type: ignore """ Returns the report list and removed visibility string """ visibility = '' # type: ignore if wxdata: item = copy(wxdata[0]) # Vis reported in statue miles if item.endswith('SM'): # 10SM ...
python
def get_visibility(wxdata: [str], units: Units) -> ([str], Number): # type: ignore """ Returns the report list and removed visibility string """ visibility = '' # type: ignore if wxdata: item = copy(wxdata[0]) # Vis reported in statue miles if item.endswith('SM'): # 10SM ...
[ "def", "get_visibility", "(", "wxdata", ":", "[", "str", "]", ",", "units", ":", "Units", ")", "->", "(", "[", "str", "]", ",", "Number", ")", ":", "# type: ignore", "visibility", "=", "''", "# type: ignore", "if", "wxdata", ":", "item", "=", "copy", ...
Returns the report list and removed visibility string
[ "Returns", "the", "report", "list", "and", "removed", "visibility", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L529-L567
etcher-be/emiz
emiz/avwx/core.py
starts_new_line
def starts_new_line(item: str) -> bool: """ Returns True if the given element should start a new report line """ if item in TAF_NEWLINE: return True for start in TAF_NEWLINE_STARTSWITH: if item.startswith(start): return True return False
python
def starts_new_line(item: str) -> bool: """ Returns True if the given element should start a new report line """ if item in TAF_NEWLINE: return True for start in TAF_NEWLINE_STARTSWITH: if item.startswith(start): return True return False
[ "def", "starts_new_line", "(", "item", ":", "str", ")", "->", "bool", ":", "if", "item", "in", "TAF_NEWLINE", ":", "return", "True", "for", "start", "in", "TAF_NEWLINE_STARTSWITH", ":", "if", "item", ".", "startswith", "(", "start", ")", ":", "return", "...
Returns True if the given element should start a new report line
[ "Returns", "True", "if", "the", "given", "element", "should", "start", "a", "new", "report", "line" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L570-L581
etcher-be/emiz
emiz/avwx/core.py
split_taf
def split_taf(txt: str) -> [str]: # type: ignore """ Splits a TAF report into each distinct time period """ lines = [] split = txt.split() last_index = 0 for i, item in enumerate(split): if starts_new_line(item) and i != 0 and not split[i - 1].startswith('PROB'): lines.a...
python
def split_taf(txt: str) -> [str]: # type: ignore """ Splits a TAF report into each distinct time period """ lines = [] split = txt.split() last_index = 0 for i, item in enumerate(split): if starts_new_line(item) and i != 0 and not split[i - 1].startswith('PROB'): lines.a...
[ "def", "split_taf", "(", "txt", ":", "str", ")", "->", "[", "str", "]", ":", "# type: ignore", "lines", "=", "[", "]", "split", "=", "txt", ".", "split", "(", ")", "last_index", "=", "0", "for", "i", ",", "item", "in", "enumerate", "(", "split", ...
Splits a TAF report into each distinct time period
[ "Splits", "a", "TAF", "report", "into", "each", "distinct", "time", "period" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L584-L596
etcher-be/emiz
emiz/avwx/core.py
get_type_and_times
def get_type_and_times(wxdata: [str]) -> ([str], str, str, str): # type: ignore """ Returns the report list and removed: Report type string, start time string, end time string """ report_type, start_time, end_time = 'FROM', '', '' if wxdata: # TEMPO, BECMG, INTER if wxdata[0] in...
python
def get_type_and_times(wxdata: [str]) -> ([str], str, str, str): # type: ignore """ Returns the report list and removed: Report type string, start time string, end time string """ report_type, start_time, end_time = 'FROM', '', '' if wxdata: # TEMPO, BECMG, INTER if wxdata[0] in...
[ "def", "get_type_and_times", "(", "wxdata", ":", "[", "str", "]", ")", "->", "(", "[", "str", "]", ",", "str", ",", "str", ",", "str", ")", ":", "# type: ignore", "report_type", ",", "start_time", ",", "end_time", "=", "'FROM'", ",", "''", ",", "''",...
Returns the report list and removed: Report type string, start time string, end time string
[ "Returns", "the", "report", "list", "and", "removed", ":", "Report", "type", "string", "start", "time", "string", "end", "time", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L600-L630
etcher-be/emiz
emiz/avwx/core.py
_is_tempo_or_prob
def _is_tempo_or_prob(report_type: str) -> bool: """ Returns True if report type is TEMPO or PROB__ """ if report_type == 'TEMPO': return True if len(report_type) == 6 and report_type.startswith('PROB'): return True return False
python
def _is_tempo_or_prob(report_type: str) -> bool: """ Returns True if report type is TEMPO or PROB__ """ if report_type == 'TEMPO': return True if len(report_type) == 6 and report_type.startswith('PROB'): return True return False
[ "def", "_is_tempo_or_prob", "(", "report_type", ":", "str", ")", "->", "bool", ":", "if", "report_type", "==", "'TEMPO'", ":", "return", "True", "if", "len", "(", "report_type", ")", "==", "6", "and", "report_type", ".", "startswith", "(", "'PROB'", ")", ...
Returns True if report type is TEMPO or PROB__
[ "Returns", "True", "if", "report", "type", "is", "TEMPO", "or", "PROB__" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L633-L641
etcher-be/emiz
emiz/avwx/core.py
_get_next_time
def _get_next_time(lines: [dict], target: str) -> str: # type: ignore """ Returns the next FROM target value or empty """ for line in lines: if line[target] and not _is_tempo_or_prob(line['type']): return line[target] return ''
python
def _get_next_time(lines: [dict], target: str) -> str: # type: ignore """ Returns the next FROM target value or empty """ for line in lines: if line[target] and not _is_tempo_or_prob(line['type']): return line[target] return ''
[ "def", "_get_next_time", "(", "lines", ":", "[", "dict", "]", ",", "target", ":", "str", ")", "->", "str", ":", "# type: ignore", "for", "line", "in", "lines", ":", "if", "line", "[", "target", "]", "and", "not", "_is_tempo_or_prob", "(", "line", "[", ...
Returns the next FROM target value or empty
[ "Returns", "the", "next", "FROM", "target", "value", "or", "empty" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L644-L651
etcher-be/emiz
emiz/avwx/core.py
find_missing_taf_times
def find_missing_taf_times(lines: [dict], start: Timestamp, end: Timestamp) -> [dict]: # type: ignore """ Fix any missing time issues (except for error/empty lines) """ if not lines: return lines # Assign start time lines[0]['start_time'] = start # Fix other times last_fm_line =...
python
def find_missing_taf_times(lines: [dict], start: Timestamp, end: Timestamp) -> [dict]: # type: ignore """ Fix any missing time issues (except for error/empty lines) """ if not lines: return lines # Assign start time lines[0]['start_time'] = start # Fix other times last_fm_line =...
[ "def", "find_missing_taf_times", "(", "lines", ":", "[", "dict", "]", ",", "start", ":", "Timestamp", ",", "end", ":", "Timestamp", ")", "->", "[", "dict", "]", ":", "# type: ignore", "if", "not", "lines", ":", "return", "lines", "# Assign start time", "li...
Fix any missing time issues (except for error/empty lines)
[ "Fix", "any", "missing", "time", "issues", "(", "except", "for", "error", "/", "empty", "lines", ")" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L654-L679
etcher-be/emiz
emiz/avwx/core.py
get_temp_min_and_max
def get_temp_min_and_max(wxlist: [str]) -> ([str], str, str): # type: ignore """ Pull out Max temp at time and Min temp at time items from wx list """ temp_max, temp_min = '', '' for i, item in reversed(list(enumerate(wxlist))): if len(item) > 6 and item[0] == 'T' and '/' in item: ...
python
def get_temp_min_and_max(wxlist: [str]) -> ([str], str, str): # type: ignore """ Pull out Max temp at time and Min temp at time items from wx list """ temp_max, temp_min = '', '' for i, item in reversed(list(enumerate(wxlist))): if len(item) > 6 and item[0] == 'T' and '/' in item: ...
[ "def", "get_temp_min_and_max", "(", "wxlist", ":", "[", "str", "]", ")", "->", "(", "[", "str", "]", ",", "str", ",", "str", ")", ":", "# type: ignore", "temp_max", ",", "temp_min", "=", "''", ",", "''", "for", "i", ",", "item", "in", "reversed", "...
Pull out Max temp at time and Min temp at time items from wx list
[ "Pull", "out", "Max", "temp", "at", "time", "and", "Min", "temp", "at", "time", "items", "from", "wx", "list" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L682-L707
etcher-be/emiz
emiz/avwx/core.py
_get_digit_list
def _get_digit_list(alist: [str], from_index: int) -> ([str], [str]): # type: ignore """ Returns a list of items removed from a given list of strings that are all digits from 'from_index' until hitting a non-digit item """ ret = [] alist.pop(from_index) while len(alist) > from_index and ali...
python
def _get_digit_list(alist: [str], from_index: int) -> ([str], [str]): # type: ignore """ Returns a list of items removed from a given list of strings that are all digits from 'from_index' until hitting a non-digit item """ ret = [] alist.pop(from_index) while len(alist) > from_index and ali...
[ "def", "_get_digit_list", "(", "alist", ":", "[", "str", "]", ",", "from_index", ":", "int", ")", "->", "(", "[", "str", "]", ",", "[", "str", "]", ")", ":", "# type: ignore", "ret", "=", "[", "]", "alist", ".", "pop", "(", "from_index", ")", "wh...
Returns a list of items removed from a given list of strings that are all digits from 'from_index' until hitting a non-digit item
[ "Returns", "a", "list", "of", "items", "removed", "from", "a", "given", "list", "of", "strings", "that", "are", "all", "digits", "from", "from_index", "until", "hitting", "a", "non", "-", "digit", "item" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L710-L719
etcher-be/emiz
emiz/avwx/core.py
get_oceania_temp_and_alt
def get_oceania_temp_and_alt(wxlist: [str]) -> ([str], [str], [str]): # type: ignore """ Get Temperature and Altimeter lists for Oceania TAFs """ tlist, qlist = [], [] # type: ignore if 'T' in wxlist: wxlist, tlist = _get_digit_list(wxlist, wxlist.index('T')) if 'Q' in wxlist: ...
python
def get_oceania_temp_and_alt(wxlist: [str]) -> ([str], [str], [str]): # type: ignore """ Get Temperature and Altimeter lists for Oceania TAFs """ tlist, qlist = [], [] # type: ignore if 'T' in wxlist: wxlist, tlist = _get_digit_list(wxlist, wxlist.index('T')) if 'Q' in wxlist: ...
[ "def", "get_oceania_temp_and_alt", "(", "wxlist", ":", "[", "str", "]", ")", "->", "(", "[", "str", "]", ",", "[", "str", "]", ",", "[", "str", "]", ")", ":", "# type: ignore", "tlist", ",", "qlist", "=", "[", "]", ",", "[", "]", "# type: ignore", ...
Get Temperature and Altimeter lists for Oceania TAFs
[ "Get", "Temperature", "and", "Altimeter", "lists", "for", "Oceania", "TAFs" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L722-L731
etcher-be/emiz
emiz/avwx/core.py
sanitize_cloud
def sanitize_cloud(cloud: str) -> str: """ Fix rare cloud layer issues """ if len(cloud) < 4: return cloud if not cloud[3].isdigit() and cloud[3] != '/': if cloud[3] == 'O': cloud = cloud[:3] + '0' + cloud[4:] # Bad "O": FEWO03 -> FEW003 else: # Move modifiers t...
python
def sanitize_cloud(cloud: str) -> str: """ Fix rare cloud layer issues """ if len(cloud) < 4: return cloud if not cloud[3].isdigit() and cloud[3] != '/': if cloud[3] == 'O': cloud = cloud[:3] + '0' + cloud[4:] # Bad "O": FEWO03 -> FEW003 else: # Move modifiers t...
[ "def", "sanitize_cloud", "(", "cloud", ":", "str", ")", "->", "str", ":", "if", "len", "(", "cloud", ")", "<", "4", ":", "return", "cloud", "if", "not", "cloud", "[", "3", "]", ".", "isdigit", "(", ")", "and", "cloud", "[", "3", "]", "!=", "'/'...
Fix rare cloud layer issues
[ "Fix", "rare", "cloud", "layer", "issues" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L734-L745
etcher-be/emiz
emiz/avwx/core.py
split_cloud
def split_cloud(cloud: str) -> [str]: # type: ignore """ Transforms a cloud string into a list of strings: [Type, Height (, Optional Modifier)] """ split = [] cloud = sanitize_cloud(cloud) if cloud.startswith('VV'): split.append(cloud[:2]) cloud = cloud[2:] while len(cloud) ...
python
def split_cloud(cloud: str) -> [str]: # type: ignore """ Transforms a cloud string into a list of strings: [Type, Height (, Optional Modifier)] """ split = [] cloud = sanitize_cloud(cloud) if cloud.startswith('VV'): split.append(cloud[:2]) cloud = cloud[2:] while len(cloud) ...
[ "def", "split_cloud", "(", "cloud", ":", "str", ")", "->", "[", "str", "]", ":", "# type: ignore", "split", "=", "[", "]", "cloud", "=", "sanitize_cloud", "(", "cloud", ")", "if", "cloud", ".", "startswith", "(", "'VV'", ")", ":", "split", ".", "appe...
Transforms a cloud string into a list of strings: [Type, Height (, Optional Modifier)]
[ "Transforms", "a", "cloud", "string", "into", "a", "list", "of", "strings", ":", "[", "Type", "Height", "(", "Optional", "Modifier", ")", "]" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L748-L771
etcher-be/emiz
emiz/avwx/core.py
get_clouds
def get_clouds(wxdata: [str]) -> ([str], list): # type: ignore """ Returns the report list and removed list of split cloud layers """ clouds = [] for i, item in reversed(list(enumerate(wxdata))): if item[:3] in CLOUD_LIST or item[:2] == 'VV': cloud = wxdata.pop(i) cl...
python
def get_clouds(wxdata: [str]) -> ([str], list): # type: ignore """ Returns the report list and removed list of split cloud layers """ clouds = [] for i, item in reversed(list(enumerate(wxdata))): if item[:3] in CLOUD_LIST or item[:2] == 'VV': cloud = wxdata.pop(i) cl...
[ "def", "get_clouds", "(", "wxdata", ":", "[", "str", "]", ")", "->", "(", "[", "str", "]", ",", "list", ")", ":", "# type: ignore", "clouds", "=", "[", "]", "for", "i", ",", "item", "in", "reversed", "(", "list", "(", "enumerate", "(", "wxdata", ...
Returns the report list and removed list of split cloud layers
[ "Returns", "the", "report", "list", "and", "removed", "list", "of", "split", "cloud", "layers" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L783-L792
etcher-be/emiz
emiz/avwx/core.py
get_flight_rules
def get_flight_rules(vis: Number, ceiling: Cloud) -> int: """ Returns int based on current flight rules from parsed METAR data 0=VFR, 1=MVFR, 2=IFR, 3=LIFR Note: Common practice is to report IFR if visibility unavailable """ # Parse visibility if not vis: return 2 if vis.repr =...
python
def get_flight_rules(vis: Number, ceiling: Cloud) -> int: """ Returns int based on current flight rules from parsed METAR data 0=VFR, 1=MVFR, 2=IFR, 3=LIFR Note: Common practice is to report IFR if visibility unavailable """ # Parse visibility if not vis: return 2 if vis.repr =...
[ "def", "get_flight_rules", "(", "vis", ":", "Number", ",", "ceiling", ":", "Cloud", ")", "->", "int", ":", "# Parse visibility", "if", "not", "vis", ":", "return", "2", "if", "vis", ".", "repr", "==", "'CAVOK'", "or", "vis", ".", "repr", ".", "startswi...
Returns int based on current flight rules from parsed METAR data 0=VFR, 1=MVFR, 2=IFR, 3=LIFR Note: Common practice is to report IFR if visibility unavailable
[ "Returns", "int", "based", "on", "current", "flight", "rules", "from", "parsed", "METAR", "data" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L795-L824
etcher-be/emiz
emiz/avwx/core.py
get_taf_flight_rules
def get_taf_flight_rules(lines: [dict]) -> [dict]: # type: ignore """ Get flight rules by looking for missing data in prior reports """ for i, line in enumerate(lines): temp_vis, temp_cloud = line['visibility'], line['clouds'] for report in reversed(lines[:i]): if not _is_te...
python
def get_taf_flight_rules(lines: [dict]) -> [dict]: # type: ignore """ Get flight rules by looking for missing data in prior reports """ for i, line in enumerate(lines): temp_vis, temp_cloud = line['visibility'], line['clouds'] for report in reversed(lines[:i]): if not _is_te...
[ "def", "get_taf_flight_rules", "(", "lines", ":", "[", "dict", "]", ")", "->", "[", "dict", "]", ":", "# type: ignore", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "temp_vis", ",", "temp_cloud", "=", "line", "[", "'visibility'", ...
Get flight rules by looking for missing data in prior reports
[ "Get", "flight", "rules", "by", "looking", "for", "missing", "data", "in", "prior", "reports" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L827-L846
etcher-be/emiz
emiz/avwx/core.py
get_ceiling
def get_ceiling(clouds: [Cloud]) -> Cloud: # type: ignore """ Returns ceiling layer from Cloud-List or None if none found Assumes that the clouds are already sorted lowest to highest Only 'Broken', 'Overcast', and 'Vertical Visibility' are considdered ceilings Prevents errors due to lack of clou...
python
def get_ceiling(clouds: [Cloud]) -> Cloud: # type: ignore """ Returns ceiling layer from Cloud-List or None if none found Assumes that the clouds are already sorted lowest to highest Only 'Broken', 'Overcast', and 'Vertical Visibility' are considdered ceilings Prevents errors due to lack of clou...
[ "def", "get_ceiling", "(", "clouds", ":", "[", "Cloud", "]", ")", "->", "Cloud", ":", "# type: ignore", "for", "cloud", "in", "clouds", ":", "if", "cloud", ".", "altitude", "and", "cloud", ".", "type", "in", "(", "'OVC'", ",", "'BKN'", ",", "'VV'", "...
Returns ceiling layer from Cloud-List or None if none found Assumes that the clouds are already sorted lowest to highest Only 'Broken', 'Overcast', and 'Vertical Visibility' are considdered ceilings Prevents errors due to lack of cloud information (eg. '' or 'FEW///')
[ "Returns", "ceiling", "layer", "from", "Cloud", "-", "List", "or", "None", "if", "none", "found" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L849-L862
etcher-be/emiz
emiz/avwx/core.py
parse_date
def parse_date(date: str, hour_threshold: int = 200): """ Parses a report timestamp in ddhhZ or ddhhmmZ format This function assumes the given timestamp is within the hour threshold from current date """ # Format date string date = date.strip('Z') if len(date) == 4: date += '00' ...
python
def parse_date(date: str, hour_threshold: int = 200): """ Parses a report timestamp in ddhhZ or ddhhmmZ format This function assumes the given timestamp is within the hour threshold from current date """ # Format date string date = date.strip('Z') if len(date) == 4: date += '00' ...
[ "def", "parse_date", "(", "date", ":", "str", ",", "hour_threshold", ":", "int", "=", "200", ")", ":", "# Format date string", "date", "=", "date", ".", "strip", "(", "'Z'", ")", "if", "len", "(", "date", ")", "==", "4", ":", "date", "+=", "'00'", ...
Parses a report timestamp in ddhhZ or ddhhmmZ format This function assumes the given timestamp is within the hour threshold from current date
[ "Parses", "a", "report", "timestamp", "in", "ddhhZ", "or", "ddhhmmZ", "format" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L865-L889
praekeltfoundation/molo.polls
molo/polls/admin.py
ParentListFilter.lookups
def lookups(self, request, model_admin): """ Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar. ...
python
def lookups(self, request, model_admin): """ Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar. ...
[ "def", "lookups", "(", "self", ",", "request", ",", "model_admin", ")", ":", "return", "[", "(", "q", ".", "slug", ",", "q", ".", "title", ")", "for", "q", "in", "Question", ".", "objects", ".", "all", "(", ")", "]" ]
Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.
[ "Returns", "a", "list", "of", "tuples", ".", "The", "first", "element", "in", "each", "tuple", "is", "the", "coded", "value", "for", "the", "option", "that", "will", "appear", "in", "the", "URL", "query", ".", "The", "second", "element", "is", "the", "...
train
https://github.com/praekeltfoundation/molo.polls/blob/7b3e0e8908b2674ea297d2118c89c49333c84703/molo/polls/admin.py#L15-L23
praekeltfoundation/molo.polls
molo/polls/admin.py
ParentListFilter.queryset
def queryset(self, request, queryset): """ Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`. """ if self.value(): parent = Question.objects.get(slug=self.value()) return Choice.objects...
python
def queryset(self, request, queryset): """ Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`. """ if self.value(): parent = Question.objects.get(slug=self.value()) return Choice.objects...
[ "def", "queryset", "(", "self", ",", "request", ",", "queryset", ")", ":", "if", "self", ".", "value", "(", ")", ":", "parent", "=", "Question", ".", "objects", ".", "get", "(", "slug", "=", "self", ".", "value", "(", ")", ")", "return", "Choice", ...
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`.
[ "Returns", "the", "filtered", "queryset", "based", "on", "the", "value", "provided", "in", "the", "query", "string", "and", "retrievable", "via", "self", ".", "value", "()", "." ]
train
https://github.com/praekeltfoundation/molo.polls/blob/7b3e0e8908b2674ea297d2118c89c49333c84703/molo/polls/admin.py#L25-L34
delfick/aws_syncr
aws_syncr/option_spec/buckets.py
Buckets.sync_one
def sync_one(self, aws_syncr, amazon, bucket): """Make sure this bucket exists and has only attributes we want it to have""" if bucket.permission.statements: permission_document = bucket.permission.document else: permission_document = "" bucket_info = amazon.s3.b...
python
def sync_one(self, aws_syncr, amazon, bucket): """Make sure this bucket exists and has only attributes we want it to have""" if bucket.permission.statements: permission_document = bucket.permission.document else: permission_document = "" bucket_info = amazon.s3.b...
[ "def", "sync_one", "(", "self", ",", "aws_syncr", ",", "amazon", ",", "bucket", ")", ":", "if", "bucket", ".", "permission", ".", "statements", ":", "permission_document", "=", "bucket", ".", "permission", ".", "document", "else", ":", "permission_document", ...
Make sure this bucket exists and has only attributes we want it to have
[ "Make", "sure", "this", "bucket", "exists", "and", "has", "only", "attributes", "we", "want", "it", "to", "have" ]
train
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/option_spec/buckets.py#L312-L323
matthewdeanmartin/jiggle_version
jiggle_version/file_opener.py
FileOpener.is_python_inside
def is_python_inside(self, file_path): # type: (str) -> bool """ If .py, yes. If extensionless, open file and check shebang TODO: support variations on this: #!/usr/bin/env python :param file_path: :return: """ if file_path.endswith(".py"): return ...
python
def is_python_inside(self, file_path): # type: (str) -> bool """ If .py, yes. If extensionless, open file and check shebang TODO: support variations on this: #!/usr/bin/env python :param file_path: :return: """ if file_path.endswith(".py"): return ...
[ "def", "is_python_inside", "(", "self", ",", "file_path", ")", ":", "# type: (str) -> bool", "if", "file_path", ".", "endswith", "(", "\".py\"", ")", ":", "return", "True", "# duh.", "# not supporting surprising extensions, ege. .py2, .python, .corn_chowder", "# extensionle...
If .py, yes. If extensionless, open file and check shebang TODO: support variations on this: #!/usr/bin/env python :param file_path: :return:
[ "If", ".", "py", "yes", ".", "If", "extensionless", "open", "file", "and", "check", "shebang" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/file_opener.py#L38-L61
matthewdeanmartin/jiggle_version
jiggle_version/file_opener.py
FileOpener.open_this
def open_this(self, file, how): # type: (str,str) -> Any """ Open file while detecting encoding. Use cached when possible. :param file: :param how: :return: """ # BUG: risky code here, allowing relative if not file.startswith("/"): # raise Typ...
python
def open_this(self, file, how): # type: (str,str) -> Any """ Open file while detecting encoding. Use cached when possible. :param file: :param how: :return: """ # BUG: risky code here, allowing relative if not file.startswith("/"): # raise Typ...
[ "def", "open_this", "(", "self", ",", "file", ",", "how", ")", ":", "# type: (str,str) -> Any", "# BUG: risky code here, allowing relative", "if", "not", "file", ".", "startswith", "(", "\"/\"", ")", ":", "# raise TypeError(\"this isn't absolute! We're siths, ya' know.\")",...
Open file while detecting encoding. Use cached when possible. :param file: :param how: :return:
[ "Open", "file", "while", "detecting", "encoding", ".", "Use", "cached", "when", "possible", ".", ":", "param", "file", ":", ":", "param", "how", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/file_opener.py#L72-L102
matthewdeanmartin/jiggle_version
jiggle_version/file_opener.py
FileOpener.read_metadata
def read_metadata(self, file_path): # type: (str) ->str """ Get version out of a .ini file (or .cfg) :return: """ config = configparser.ConfigParser() config.read(file_path) try: return unicode(config["metadata"]["version"]) except KeyError: ...
python
def read_metadata(self, file_path): # type: (str) ->str """ Get version out of a .ini file (or .cfg) :return: """ config = configparser.ConfigParser() config.read(file_path) try: return unicode(config["metadata"]["version"]) except KeyError: ...
[ "def", "read_metadata", "(", "self", ",", "file_path", ")", ":", "# type: (str) ->str", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "config", ".", "read", "(", "file_path", ")", "try", ":", "return", "unicode", "(", "config", "[", "\"metada...
Get version out of a .ini file (or .cfg) :return:
[ "Get", "version", "out", "of", "a", ".", "ini", "file", "(", "or", ".", "cfg", ")", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/file_opener.py#L104-L114
edwards-lab/MVtest
meanvar/mv_esteq.py
MeanVarEstEQ
def MeanVarEstEQ(y, x, covariates, tol=1e-8): """Perform the mean var calculation using estimated equestions :param y: Outcomes :param x: [genotypes, cov1, ..., covN] :param tol: convergence criterion """ pcount = covariates.shape[0] + 2 N = y.shape[0] beta_count = pcount * 2 X = ...
python
def MeanVarEstEQ(y, x, covariates, tol=1e-8): """Perform the mean var calculation using estimated equestions :param y: Outcomes :param x: [genotypes, cov1, ..., covN] :param tol: convergence criterion """ pcount = covariates.shape[0] + 2 N = y.shape[0] beta_count = pcount * 2 X = ...
[ "def", "MeanVarEstEQ", "(", "y", ",", "x", ",", "covariates", ",", "tol", "=", "1e-8", ")", ":", "pcount", "=", "covariates", ".", "shape", "[", "0", "]", "+", "2", "N", "=", "y", ".", "shape", "[", "0", "]", "beta_count", "=", "pcount", "*", "...
Perform the mean var calculation using estimated equestions :param y: Outcomes :param x: [genotypes, cov1, ..., covN] :param tol: convergence criterion
[ "Perform", "the", "mean", "var", "calculation", "using", "estimated", "equestions" ]
train
https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/meanvar/mv_esteq.py#L34-L205
edwards-lab/MVtest
meanvar/mv_esteq.py
RunAnalysis
def RunAnalysis(dataset, pheno_covar): """Run the actual analysis on all valid loci for each phenotype :param dataset: GWAS parser object :param pheno_covar: holds all of the variables This acts as a standard iterator, returning a single MVResult for each locus/phenotype combination. Missing ...
python
def RunAnalysis(dataset, pheno_covar): """Run the actual analysis on all valid loci for each phenotype :param dataset: GWAS parser object :param pheno_covar: holds all of the variables This acts as a standard iterator, returning a single MVResult for each locus/phenotype combination. Missing ...
[ "def", "RunAnalysis", "(", "dataset", ",", "pheno_covar", ")", ":", "covar_missing", "=", "numpy", ".", "empty", "(", "dataset", ".", "ind_count", ",", "dtype", "=", "bool", ")", "covar_missing", "[", ":", "]", "=", "False", "total_covar_count", "=", "len"...
Run the actual analysis on all valid loci for each phenotype :param dataset: GWAS parser object :param pheno_covar: holds all of the variables This acts as a standard iterator, returning a single MVResult for each locus/phenotype combination. Missing is evaluated as anything missing in any of the...
[ "Run", "the", "actual", "analysis", "on", "all", "valid", "loci", "for", "each", "phenotype" ]
train
https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/meanvar/mv_esteq.py#L221-L337
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/XMLname.py
toXMLname
def toXMLname(string): """Convert string to a XML name.""" if string.find(':') != -1 : (prefix, localname) = string.split(':',1) else: prefix = None localname = string T = unicode(localname) N = len(localname) X = []; for i in range(N) : if i< N-1 and T[...
python
def toXMLname(string): """Convert string to a XML name.""" if string.find(':') != -1 : (prefix, localname) = string.split(':',1) else: prefix = None localname = string T = unicode(localname) N = len(localname) X = []; for i in range(N) : if i< N-1 and T[...
[ "def", "toXMLname", "(", "string", ")", ":", "if", "string", ".", "find", "(", "':'", ")", "!=", "-", "1", ":", "(", "prefix", ",", "localname", ")", "=", "string", ".", "split", "(", "':'", ",", "1", ")", "else", ":", "prefix", "=", "None", "l...
Convert string to a XML name.
[ "Convert", "string", "to", "a", "XML", "name", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/XMLname.py#L50-L77
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/XMLname.py
fromXMLname
def fromXMLname(string): """Convert XML name to unicode string.""" retval = sub(r'_xFFFF_','', string ) def fun( matchobj ): return _fromUnicodeHex( matchobj.group(0) ) retval = sub(r'_x[0-9A-Za-z]+_', fun, retval ) return retval
python
def fromXMLname(string): """Convert XML name to unicode string.""" retval = sub(r'_xFFFF_','', string ) def fun( matchobj ): return _fromUnicodeHex( matchobj.group(0) ) retval = sub(r'_x[0-9A-Za-z]+_', fun, retval ) return retval
[ "def", "fromXMLname", "(", "string", ")", ":", "retval", "=", "sub", "(", "r'_xFFFF_'", ",", "''", ",", "string", ")", "def", "fun", "(", "matchobj", ")", ":", "return", "_fromUnicodeHex", "(", "matchobj", ".", "group", "(", "0", ")", ")", "retval", ...
Convert XML name to unicode string.
[ "Convert", "XML", "name", "to", "unicode", "string", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/XMLname.py#L80-L90
dossier/dossier.models
dossier/models/etl/interface.py
html_to_fc
def html_to_fc(html=None, clean_html=None, clean_visible=None, encoding=None, url=None, timestamp=None, other_features=None): '''`html` is expected to be a raw string received over the wire from a remote webserver, and `encoding`, if provided, is used to decode it. Typically, encoding comes ...
python
def html_to_fc(html=None, clean_html=None, clean_visible=None, encoding=None, url=None, timestamp=None, other_features=None): '''`html` is expected to be a raw string received over the wire from a remote webserver, and `encoding`, if provided, is used to decode it. Typically, encoding comes ...
[ "def", "html_to_fc", "(", "html", "=", "None", ",", "clean_html", "=", "None", ",", "clean_visible", "=", "None", ",", "encoding", "=", "None", ",", "url", "=", "None", ",", "timestamp", "=", "None", ",", "other_features", "=", "None", ")", ":", "def",...
`html` is expected to be a raw string received over the wire from a remote webserver, and `encoding`, if provided, is used to decode it. Typically, encoding comes from the Content-Type header field. The :func:`~streamcorpus_pipeline._clean_html.make_clean_html` function handles character encodings.
[ "html", "is", "expected", "to", "be", "a", "raw", "string", "received", "over", "the", "wire", "from", "a", "remote", "webserver", "and", "encoding", "if", "provided", "is", "used", "to", "decode", "it", ".", "Typically", "encoding", "comes", "from", "the"...
train
https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/etl/interface.py#L152-L231
dossier/dossier.models
dossier/models/etl/interface.py
add_sip_to_fc
def add_sip_to_fc(fc, tfidf, limit=40): '''add "bowNP_sip" to `fc` using `tfidf` data ''' if 'bowNP' not in fc: return if tfidf is None: return sips = features.sip_noun_phrases(tfidf, fc['bowNP'].keys(), limit=limit) fc[u'bowNP_sip'] = StringCounter(sips)
python
def add_sip_to_fc(fc, tfidf, limit=40): '''add "bowNP_sip" to `fc` using `tfidf` data ''' if 'bowNP' not in fc: return if tfidf is None: return sips = features.sip_noun_phrases(tfidf, fc['bowNP'].keys(), limit=limit) fc[u'bowNP_sip'] = StringCounter(sips)
[ "def", "add_sip_to_fc", "(", "fc", ",", "tfidf", ",", "limit", "=", "40", ")", ":", "if", "'bowNP'", "not", "in", "fc", ":", "return", "if", "tfidf", "is", "None", ":", "return", "sips", "=", "features", ".", "sip_noun_phrases", "(", "tfidf", ",", "f...
add "bowNP_sip" to `fc` using `tfidf` data
[ "add", "bowNP_sip", "to", "fc", "using", "tfidf", "data" ]
train
https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/etl/interface.py#L234-L242
dossier/dossier.models
dossier/models/etl/interface.py
to_dossier_store.process
def process(self, t_path, name_info, i_str): '''converts each :attr:`streamcorpus.StreamItem.body.clean_html` from `t_path` into a :class:`~dossier.fc.FeatureCollection` and saves it in a :class:`~dossier.store.Store` configured with the global `kvlayer` config. ''' def ...
python
def process(self, t_path, name_info, i_str): '''converts each :attr:`streamcorpus.StreamItem.body.clean_html` from `t_path` into a :class:`~dossier.fc.FeatureCollection` and saves it in a :class:`~dossier.store.Store` configured with the global `kvlayer` config. ''' def ...
[ "def", "process", "(", "self", ",", "t_path", ",", "name_info", ",", "i_str", ")", ":", "def", "cids_and_fcs", "(", ")", ":", "count", "=", "0", "seen", "=", "set", "(", ")", "for", "si", "in", "Chunk", "(", "t_path", ")", ":", "clean_html", "=", ...
converts each :attr:`streamcorpus.StreamItem.body.clean_html` from `t_path` into a :class:`~dossier.fc.FeatureCollection` and saves it in a :class:`~dossier.store.Store` configured with the global `kvlayer` config.
[ "converts", "each", ":", "attr", ":", "streamcorpus", ".", "StreamItem", ".", "body", ".", "clean_html", "from", "t_path", "into", "a", ":", "class", ":", "~dossier", ".", "fc", ".", "FeatureCollection", "and", "saves", "it", "in", "a", ":", "class", ":"...
train
https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/etl/interface.py#L104-L143
collectiveacuity/labPack
labpack/location/find.py
findClient.get_password
def get_password(self): ''' a method to retrieve the password for the group mosquitto server :return: string with group mosquitto server password NOTE: result is added to self.password property ''' import requests url = '%s/mqtt' % self.endpoint ...
python
def get_password(self): ''' a method to retrieve the password for the group mosquitto server :return: string with group mosquitto server password NOTE: result is added to self.password property ''' import requests url = '%s/mqtt' % self.endpoint ...
[ "def", "get_password", "(", "self", ")", ":", "import", "requests", "url", "=", "'%s/mqtt'", "%", "self", ".", "endpoint", "params", "=", "{", "'group'", ":", "self", ".", "group_name", "}", "response", "=", "requests", ".", "put", "(", "url", ",", "pa...
a method to retrieve the password for the group mosquitto server :return: string with group mosquitto server password NOTE: result is added to self.password property
[ "a", "method", "to", "retrieve", "the", "password", "for", "the", "group", "mosquitto", "server" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L83-L102
collectiveacuity/labPack
labpack/location/find.py
findClient.get_locations
def get_locations(self): ''' a method to retrieve all the locations tracked by the model :return: dictionary with location id keys NOTE: results are added to self.locations property { 'location.id': { ' ...
python
def get_locations(self): ''' a method to retrieve all the locations tracked by the model :return: dictionary with location id keys NOTE: results are added to self.locations property { 'location.id': { ' ...
[ "def", "get_locations", "(", "self", ")", ":", "import", "requests", "url", "=", "self", ".", "endpoint", "+", "'/locations'", "params", "=", "{", "'group'", ":", "self", ".", "group_name", "}", "response", "=", "requests", ".", "get", "(", "url", ",", ...
a method to retrieve all the locations tracked by the model :return: dictionary with location id keys NOTE: results are added to self.locations property { 'location.id': { ' } }
[ "a", "method", "to", "retrieve", "all", "the", "locations", "tracked", "by", "the", "model", ":", "return", ":", "dictionary", "with", "location", "id", "keys", "NOTE", ":", "results", "are", "added", "to", "self", ".", "locations", "property", "{", "locat...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L104-L130
collectiveacuity/labPack
labpack/location/find.py
findClient.update_model
def update_model(self): ''' a method to update model with latest training data :return: True ''' import requests url = self.endpoint_public + '/calculate' params = { 'group': self.group_name } respon...
python
def update_model(self): ''' a method to update model with latest training data :return: True ''' import requests url = self.endpoint_public + '/calculate' params = { 'group': self.group_name } respon...
[ "def", "update_model", "(", "self", ")", ":", "import", "requests", "url", "=", "self", ".", "endpoint_public", "+", "'/calculate'", "params", "=", "{", "'group'", ":", "self", ".", "group_name", "}", "response", "=", "requests", ".", "get", "(", "url", ...
a method to update model with latest training data :return: True
[ "a", "method", "to", "update", "model", "with", "latest", "training", "data", ":", "return", ":", "True" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L132-L148
collectiveacuity/labPack
labpack/location/find.py
findClient.get_position
def get_position(self, user_id, track=False, confidence=False): ''' a method to retrieve the latest position of a user :param user_id: string with id of user :param track: [optional] boolean to add user to self.positions :param confidence: [optional] boolean to include the ...
python
def get_position(self, user_id, track=False, confidence=False): ''' a method to retrieve the latest position of a user :param user_id: string with id of user :param track: [optional] boolean to add user to self.positions :param confidence: [optional] boolean to include the ...
[ "def", "get_position", "(", "self", ",", "user_id", ",", "track", "=", "False", ",", "confidence", "=", "False", ")", ":", "title", "=", "'%s.get_position'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'use...
a method to retrieve the latest position of a user :param user_id: string with id of user :param track: [optional] boolean to add user to self.positions :param confidence: [optional] boolean to include the data model confidence scores :return: dictionaries with position details ...
[ "a", "method", "to", "retrieve", "the", "latest", "position", "of", "a", "user" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L150-L227
collectiveacuity/labPack
labpack/location/find.py
findClient.update_positions
def update_positions(self): ''' a method to update the latest position of all users being tracked :return: dictionary with user_id keys and location/time dictionary values NOTE: self.players is updated with position details { 'us...
python
def update_positions(self): ''' a method to update the latest position of all users being tracked :return: dictionary with user_id keys and location/time dictionary values NOTE: self.players is updated with position details { 'us...
[ "def", "update_positions", "(", "self", ")", ":", "# construct user list", "user_list", "=", "[", "]", "for", "key", "in", "self", ".", "positions", ".", "keys", "(", ")", ":", "user_list", ".", "append", "(", "key", ")", "# return empty result", "if", "no...
a method to update the latest position of all users being tracked :return: dictionary with user_id keys and location/time dictionary values NOTE: self.players is updated with position details { 'user_id': { 'time': 0.0, ...
[ "a", "method", "to", "update", "the", "latest", "position", "of", "all", "users", "being", "tracked", ":", "return", ":", "dictionary", "with", "user_id", "keys", "and", "location", "/", "time", "dictionary", "values", "NOTE", ":", "self", ".", "players", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L296-L366
collectiveacuity/labPack
labpack/location/find.py
findClient.subscribe
def subscribe(self, callable=None, block=False, port=1883): ''' a method to establish a mosquitto socket with server to receive position updates :param callable: [optional] callable to process the received positions :param block: [optional] boolean to block the main thr...
python
def subscribe(self, callable=None, block=False, port=1883): ''' a method to establish a mosquitto socket with server to receive position updates :param callable: [optional] callable to process the received positions :param block: [optional] boolean to block the main thr...
[ "def", "subscribe", "(", "self", ",", "callable", "=", "None", ",", "block", "=", "False", ",", "port", "=", "1883", ")", ":", "title", "=", "'%s.subscribe'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", ...
a method to establish a mosquitto socket with server to receive position updates :param callable: [optional] callable to process the received positions :param block: [optional] boolean to block the main thread when method is called :param port: [optional] integer with port to connec...
[ "a", "method", "to", "establish", "a", "mosquitto", "socket", "with", "server", "to", "receive", "position", "updates", ":", "param", "callable", ":", "[", "optional", "]", "callable", "to", "process", "the", "received", "positions", ":", "param", "block", "...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L368-L447
collectiveacuity/labPack
labpack/location/find.py
findClient.publish
def publish(self, user_id, wifi_fingerprint, action='track', location_id='', port=1883): ''' a method to publish wifi fingerprint data to a mosquitto server :param user_id: string with id of user :param wifi_fingerprint: list of dictionaries with wifi fields mac and rss...
python
def publish(self, user_id, wifi_fingerprint, action='track', location_id='', port=1883): ''' a method to publish wifi fingerprint data to a mosquitto server :param user_id: string with id of user :param wifi_fingerprint: list of dictionaries with wifi fields mac and rss...
[ "def", "publish", "(", "self", ",", "user_id", ",", "wifi_fingerprint", ",", "action", "=", "'track'", ",", "location_id", "=", "''", ",", "port", "=", "1883", ")", ":", "title", "=", "'%s.publish'", "%", "self", ".", "__class__", ".", "__name__", "# val...
a method to publish wifi fingerprint data to a mosquitto server :param user_id: string with id of user :param wifi_fingerprint: list of dictionaries with wifi fields mac and rssi :param action: string with type of action to perform with data (track or learn) :param location...
[ "a", "method", "to", "publish", "wifi", "fingerprint", "data", "to", "a", "mosquitto", "server", ":", "param", "user_id", ":", "string", "with", "id", "of", "user", ":", "param", "wifi_fingerprint", ":", "list", "of", "dictionaries", "with", "wifi", "fields"...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L449-L500
radjkarl/fancyTools
fancytools/math/avgMultiplePlots.py
avgMultiplePlots
def avgMultiplePlots(data, calc_mean=True, calc_std=False, calc_density=False, nsample=None): """ return the average (x,y) for a set of multiple x,y arrays which can have a different length and resolution data = ((xvals,yvals),(),,,) assumes that x values are sorted """ ...
python
def avgMultiplePlots(data, calc_mean=True, calc_std=False, calc_density=False, nsample=None): """ return the average (x,y) for a set of multiple x,y arrays which can have a different length and resolution data = ((xvals,yvals),(),,,) assumes that x values are sorted """ ...
[ "def", "avgMultiplePlots", "(", "data", ",", "calc_mean", "=", "True", ",", "calc_std", "=", "False", ",", "calc_density", "=", "False", ",", "nsample", "=", "None", ")", ":", "xArr", ",", "yArr", "=", "bringPlotOverSameX", "(", "data", ",", "nsample", "...
return the average (x,y) for a set of multiple x,y arrays which can have a different length and resolution data = ((xvals,yvals),(),,,) assumes that x values are sorted
[ "return", "the", "average", "(", "x", "y", ")", "for", "a", "set", "of", "multiple", "x", "y", "arrays", "which", "can", "have", "a", "different", "length", "and", "resolution" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/avgMultiplePlots.py#L7-L24
radjkarl/fancyTools
fancytools/math/avgMultiplePlots.py
bringPlotOverSameX
def bringPlotOverSameX(data, nsample=None): """ bring all plots (x,y) to same x value base """ x0 = [x[0] for x, _ in data if len(x)] x1 = [x[-1] for x, _ in data if len(x)] xmin = min(np.min(x0), np.min(x1)) xmax = max(np.max(x0), np.max(x1)) if nsample is None: # calc fro...
python
def bringPlotOverSameX(data, nsample=None): """ bring all plots (x,y) to same x value base """ x0 = [x[0] for x, _ in data if len(x)] x1 = [x[-1] for x, _ in data if len(x)] xmin = min(np.min(x0), np.min(x1)) xmax = max(np.max(x0), np.max(x1)) if nsample is None: # calc fro...
[ "def", "bringPlotOverSameX", "(", "data", ",", "nsample", "=", "None", ")", ":", "x0", "=", "[", "x", "[", "0", "]", "for", "x", ",", "_", "in", "data", "if", "len", "(", "x", ")", "]", "x1", "=", "[", "x", "[", "-", "1", "]", "for", "x", ...
bring all plots (x,y) to same x value base
[ "bring", "all", "plots", "(", "x", "y", ")", "to", "same", "x", "value", "base" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/avgMultiplePlots.py#L27-L54
OlivierB/Bashutils
bashutils/logmsg.py
log_begin_message
def log_begin_message(message): """ Create and print a new log message waiting for an end log message """ global MESSAGE MESSAGE = message sys.stdout.write("[....] ") sys.stdout.write(message) sys.stdout.flush()
python
def log_begin_message(message): """ Create and print a new log message waiting for an end log message """ global MESSAGE MESSAGE = message sys.stdout.write("[....] ") sys.stdout.write(message) sys.stdout.flush()
[ "def", "log_begin_message", "(", "message", ")", ":", "global", "MESSAGE", "MESSAGE", "=", "message", "sys", ".", "stdout", ".", "write", "(", "\"[....] \"", ")", "sys", ".", "stdout", ".", "write", "(", "message", ")", "sys", ".", "stdout", ".", "flush"...
Create and print a new log message waiting for an end log message
[ "Create", "and", "print", "a", "new", "log", "message", "waiting", "for", "an", "end", "log", "message" ]
train
https://github.com/OlivierB/Bashutils/blob/487762049f5d09f14f8a6c764bc0a823f332d8a1/bashutils/logmsg.py#L80-L89
OlivierB/Bashutils
bashutils/logmsg.py
log_end_message
def log_end_message(log): """ End a log message with a status defined by log """ if not log in MESSAGE_LOG.keys(): log = -1 res = colors.color_text(*MESSAGE_LOG[log][1]) sys.stdout.write("\r[" + res + "] " + MESSAGE + "\n")
python
def log_end_message(log): """ End a log message with a status defined by log """ if not log in MESSAGE_LOG.keys(): log = -1 res = colors.color_text(*MESSAGE_LOG[log][1]) sys.stdout.write("\r[" + res + "] " + MESSAGE + "\n")
[ "def", "log_end_message", "(", "log", ")", ":", "if", "not", "log", "in", "MESSAGE_LOG", ".", "keys", "(", ")", ":", "log", "=", "-", "1", "res", "=", "colors", ".", "color_text", "(", "*", "MESSAGE_LOG", "[", "log", "]", "[", "1", "]", ")", "sys...
End a log message with a status defined by log
[ "End", "a", "log", "message", "with", "a", "status", "defined", "by", "log" ]
train
https://github.com/OlivierB/Bashutils/blob/487762049f5d09f14f8a6c764bc0a823f332d8a1/bashutils/logmsg.py#L92-L102
OlivierB/Bashutils
bashutils/logmsg.py
add_log_type
def add_log_type(name, display, color, bcolor): """ name : call name (A-Z and '_') display : display message in [-] color : text color (see bashutils.colors) bcolor : background color (see bashutils.colors) """ global MESSAGE_LOG v_name = name.replace(" ", "_").upper() val = 0 lk...
python
def add_log_type(name, display, color, bcolor): """ name : call name (A-Z and '_') display : display message in [-] color : text color (see bashutils.colors) bcolor : background color (see bashutils.colors) """ global MESSAGE_LOG v_name = name.replace(" ", "_").upper() val = 0 lk...
[ "def", "add_log_type", "(", "name", ",", "display", ",", "color", ",", "bcolor", ")", ":", "global", "MESSAGE_LOG", "v_name", "=", "name", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", ".", "upper", "(", ")", "val", "=", "0", "lkey", "=", "MESSAGE...
name : call name (A-Z and '_') display : display message in [-] color : text color (see bashutils.colors) bcolor : background color (see bashutils.colors)
[ "name", ":", "call", "name", "(", "A", "-", "Z", "and", "_", ")", "display", ":", "display", "message", "in", "[", "-", "]", "color", ":", "text", "color", "(", "see", "bashutils", ".", "colors", ")", "bcolor", ":", "background", "color", "(", "see...
train
https://github.com/OlivierB/Bashutils/blob/487762049f5d09f14f8a6c764bc0a823f332d8a1/bashutils/logmsg.py#L139-L154
deifyed/vault
libconman/vault.py
Vault._fetchFilesFromFolder
def _fetchFilesFromFolder(self, target, recursive): ''' Fetches files from the target directory, and - if recursive mode is on, all subdirectories. Returns a list of all found files ''' directory_items = os.walk(target) # If recursive is false, fetch...
python
def _fetchFilesFromFolder(self, target, recursive): ''' Fetches files from the target directory, and - if recursive mode is on, all subdirectories. Returns a list of all found files ''' directory_items = os.walk(target) # If recursive is false, fetch...
[ "def", "_fetchFilesFromFolder", "(", "self", ",", "target", ",", "recursive", ")", ":", "directory_items", "=", "os", ".", "walk", "(", "target", ")", "# If recursive is false, fetch only the first tuple", "if", "not", "recursive", ":", "directory_items", "=", "[", ...
Fetches files from the target directory, and - if recursive mode is on, all subdirectories. Returns a list of all found files
[ "Fetches", "files", "from", "the", "target", "directory", "and", "-", "if", "recursive", "mode", "is", "on", "all", "subdirectories", "." ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L26-L44
deifyed/vault
libconman/vault.py
Vault.secure
def secure(self, targets, recursive): ''' Saves information about each target file and/or folder and creates a hard link from the file(s) to the vault directory ''' for target in targets: if os.path.isfile(target): path, name = os.path.split(os...
python
def secure(self, targets, recursive): ''' Saves information about each target file and/or folder and creates a hard link from the file(s) to the vault directory ''' for target in targets: if os.path.isfile(target): path, name = os.path.split(os...
[ "def", "secure", "(", "self", ",", "targets", ",", "recursive", ")", ":", "for", "target", "in", "targets", ":", "if", "os", ".", "path", ".", "isfile", "(", "target", ")", ":", "path", ",", "name", "=", "os", ".", "path", ".", "split", "(", "os"...
Saves information about each target file and/or folder and creates a hard link from the file(s) to the vault directory
[ "Saves", "information", "about", "each", "target", "file", "and", "/", "or", "folder", "and", "creates", "a", "hard", "link", "from", "the", "file", "(", "s", ")", "to", "the", "vault", "directory" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L46-L58
deifyed/vault
libconman/vault.py
Vault.remove
def remove(self, iid): ''' Deletes file from vault and removes database information ''' for index in iid: target = Target.getTarget(index) target.delete()
python
def remove(self, iid): ''' Deletes file from vault and removes database information ''' for index in iid: target = Target.getTarget(index) target.delete()
[ "def", "remove", "(", "self", ",", "iid", ")", ":", "for", "index", "in", "iid", ":", "target", "=", "Target", ".", "getTarget", "(", "index", ")", "target", ".", "delete", "(", ")" ]
Deletes file from vault and removes database information
[ "Deletes", "file", "from", "vault", "and", "removes", "database", "information" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L60-L67
deifyed/vault
libconman/vault.py
Vault.deploy
def deploy(self, iid): ''' Links an item from the vault to the original path ''' for index in iid: target = Target.getTarget(index) if target: verbose('Deploying id {} from {} to {} with the name {}' .format(index, targ...
python
def deploy(self, iid): ''' Links an item from the vault to the original path ''' for index in iid: target = Target.getTarget(index) if target: verbose('Deploying id {} from {} to {} with the name {}' .format(index, targ...
[ "def", "deploy", "(", "self", ",", "iid", ")", ":", "for", "index", "in", "iid", ":", "target", "=", "Target", ".", "getTarget", "(", "index", ")", "if", "target", ":", "verbose", "(", "'Deploying id {} from {} to {} with the name {}'", ".", "format", "(", ...
Links an item from the vault to the original path
[ "Links", "an", "item", "from", "the", "vault", "to", "the", "original", "path" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L69-L81
deifyed/vault
libconman/vault.py
Vault.deployAll
def deployAll(self): ''' Deploys all the items from the vault. Useful after a format ''' targets = [Target.getTarget(iid) for iid, n, p in self.db.listTargets()] for target in targets: target.deploy() verbose('Deploy all complete')
python
def deployAll(self): ''' Deploys all the items from the vault. Useful after a format ''' targets = [Target.getTarget(iid) for iid, n, p in self.db.listTargets()] for target in targets: target.deploy() verbose('Deploy all complete')
[ "def", "deployAll", "(", "self", ")", ":", "targets", "=", "[", "Target", ".", "getTarget", "(", "iid", ")", "for", "iid", ",", "n", ",", "p", "in", "self", ".", "db", ".", "listTargets", "(", ")", "]", "for", "target", "in", "targets", ":", "tar...
Deploys all the items from the vault. Useful after a format
[ "Deploys", "all", "the", "items", "from", "the", "vault", ".", "Useful", "after", "a", "format" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L83-L92