partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
data_only_container
create "data-only container" if it doesn't already exist. We'd like to avoid these, but postgres + boot2docker make it difficult, see issue #5
datacats/docker.py
def data_only_container(name, volumes): """ create "data-only container" if it doesn't already exist. We'd like to avoid these, but postgres + boot2docker make it difficult, see issue #5 """ info = inspect_container(name) if info: return c = _get_docker().create_container( ...
def data_only_container(name, volumes): """ create "data-only container" if it doesn't already exist. We'd like to avoid these, but postgres + boot2docker make it difficult, see issue #5 """ info = inspect_container(name) if info: return c = _get_docker().create_container( ...
[ "create", "data", "-", "only", "container", "if", "it", "doesn", "t", "already", "exist", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L401-L417
[ "def", "data_only_container", "(", "name", ",", "volumes", ")", ":", "info", "=", "inspect_container", "(", "name", ")", "if", "info", ":", "return", "c", "=", "_get_docker", "(", ")", ".", "create_container", "(", "name", "=", "name", ",", "image", "=",...
e4bae503efa997660fb3f34fe166699569653157
train
main
The main entry point for datacats cli tool (as defined in setup.py's entry_points) It parses the cli arguments for corresponding options and runs the corresponding command
datacats/cli/main.py
def main(): """ The main entry point for datacats cli tool (as defined in setup.py's entry_points) It parses the cli arguments for corresponding options and runs the corresponding command """ # pylint: disable=bare-except try: command_fn, opts = _parse_arguments(sys.argv[1:]) ...
def main(): """ The main entry point for datacats cli tool (as defined in setup.py's entry_points) It parses the cli arguments for corresponding options and runs the corresponding command """ # pylint: disable=bare-except try: command_fn, opts = _parse_arguments(sys.argv[1:]) ...
[ "The", "main", "entry", "point", "for", "datacats", "cli", "tool" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/main.py#L78-L128
[ "def", "main", "(", ")", ":", "# pylint: disable=bare-except", "try", ":", "command_fn", ",", "opts", "=", "_parse_arguments", "(", "sys", ".", "argv", "[", "1", ":", "]", ")", "# purge handles loading differently", "# 1 - Bail and just call the command if it doesn't ha...
e4bae503efa997660fb3f34fe166699569653157
train
_subcommand_arguments
Return (subcommand, (possibly adjusted) arguments for that subcommand) Returns (None, args) when no subcommand is found Parsing our arguments is hard. Each subcommand has its own docopt validation, and some subcommands (paster and shell) have positional options (some options passed to datacats and oth...
datacats/cli/main.py
def _subcommand_arguments(args): """ Return (subcommand, (possibly adjusted) arguments for that subcommand) Returns (None, args) when no subcommand is found Parsing our arguments is hard. Each subcommand has its own docopt validation, and some subcommands (paster and shell) have positional opt...
def _subcommand_arguments(args): """ Return (subcommand, (possibly adjusted) arguments for that subcommand) Returns (None, args) when no subcommand is found Parsing our arguments is hard. Each subcommand has its own docopt validation, and some subcommands (paster and shell) have positional opt...
[ "Return", "(", "subcommand", "(", "possibly", "adjusted", ")", "arguments", "for", "that", "subcommand", ")" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/main.py#L156-L213
[ "def", "_subcommand_arguments", "(", "args", ")", ":", "skip_site", "=", "False", "# Find subcommand without docopt so that subcommand options may appear", "# anywhere", "for", "i", ",", "a", "in", "enumerate", "(", "args", ")", ":", "if", "skip_site", ":", "skip_site...
e4bae503efa997660fb3f34fe166699569653157
train
start
Create containers and start serving environment Usage: datacats start [-b] [--site-url SITE_URL] [-p|--no-watch] [-s NAME] [-i] [--syslog] [--address=IP] [ENVIRONMENT [PORT]] datacats start -r [-b] [--site-url SITE_URL] [-s NAME] [--syslog] [-i] [--address=IP] [ENVIRONMENT] Optio...
datacats/cli/manage.py
def start(environment, opts): """Create containers and start serving environment Usage: datacats start [-b] [--site-url SITE_URL] [-p|--no-watch] [-s NAME] [-i] [--syslog] [--address=IP] [ENVIRONMENT [PORT]] datacats start -r [-b] [--site-url SITE_URL] [-s NAME] [--syslog] [-i...
def start(environment, opts): """Create containers and start serving environment Usage: datacats start [-b] [--site-url SITE_URL] [-p|--no-watch] [-s NAME] [-i] [--syslog] [--address=IP] [ENVIRONMENT [PORT]] datacats start -r [-b] [--site-url SITE_URL] [-s NAME] [--syslog] [-i...
[ "Create", "containers", "and", "start", "serving", "environment" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/manage.py#L41-L71
[ "def", "start", "(", "environment", ",", "opts", ")", ":", "environment", ".", "require_data", "(", ")", "if", "environment", ".", "fully_running", "(", ")", ":", "print", "'Already running at {0}'", ".", "format", "(", "environment", ".", "web_address", "(", ...
e4bae503efa997660fb3f34fe166699569653157
train
reload_
Reload environment source and configuration Usage: datacats reload [-b] [-p|--no-watch] [--syslog] [-s NAME] [--site-url=SITE_URL] [-i] [--address=IP] [ENVIRONMENT [PORT]] datacats reload -r [-b] [--syslog] [-s NAME] [--address=IP] [--site-url=SITE_URL] [-i] ...
datacats/cli/manage.py
def reload_(environment, opts): """Reload environment source and configuration Usage: datacats reload [-b] [-p|--no-watch] [--syslog] [-s NAME] [--site-url=SITE_URL] [-i] [--address=IP] [ENVIRONMENT [PORT]] datacats reload -r [-b] [--syslog] [-s NAME] [--address=IP] [--site-url=SITE...
def reload_(environment, opts): """Reload environment source and configuration Usage: datacats reload [-b] [-p|--no-watch] [--syslog] [-s NAME] [--site-url=SITE_URL] [-i] [--address=IP] [ENVIRONMENT [PORT]] datacats reload -r [-b] [--syslog] [-s NAME] [--address=IP] [--site-url=SITE...
[ "Reload", "environment", "source", "and", "configuration" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/manage.py#L74-L140
[ "def", "reload_", "(", "environment", ",", "opts", ")", ":", "if", "opts", "[", "'--interactive'", "]", ":", "# We can't wait for the server if we're tty'd", "opts", "[", "'--background'", "]", "=", "True", "if", "opts", "[", "'--address'", "]", "and", "is_boot2...
e4bae503efa997660fb3f34fe166699569653157
train
info
Display information about environment and running containers Usage: datacats info [-qr] [ENVIRONMENT] Options: -q --quiet Echo only the web URL or nothing if not running ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.'
datacats/cli/manage.py
def info(environment, opts): """Display information about environment and running containers Usage: datacats info [-qr] [ENVIRONMENT] Options: -q --quiet Echo only the web URL or nothing if not running ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.' """ ...
def info(environment, opts): """Display information about environment and running containers Usage: datacats info [-qr] [ENVIRONMENT] Options: -q --quiet Echo only the web URL or nothing if not running ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.' """ ...
[ "Display", "information", "about", "environment", "and", "running", "containers" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/manage.py#L143-L190
[ "def", "info", "(", "environment", ",", "opts", ")", ":", "damaged", "=", "False", "sites", "=", "environment", ".", "sites", "if", "not", "environment", ".", "sites", ":", "sites", "=", "[", "]", "damaged", "=", "True", "if", "opts", "[", "'--quiet'",...
e4bae503efa997660fb3f34fe166699569653157
train
logs
Display or follow container logs Usage: datacats logs [--postgres | --solr | --datapusher] [-s NAME] [-tr] [--tail=LINES] [ENVIRONMENT] datacats logs -f [--postgres | --solr | --datapusher] [-s NAME] [-r] [ENVIRONMENT] Options: --datapusher Show logs for datapusher instead of web logs --postgres ...
datacats/cli/manage.py
def logs(environment, opts): """Display or follow container logs Usage: datacats logs [--postgres | --solr | --datapusher] [-s NAME] [-tr] [--tail=LINES] [ENVIRONMENT] datacats logs -f [--postgres | --solr | --datapusher] [-s NAME] [-r] [ENVIRONMENT] Options: --datapusher Show logs for datapusher inst...
def logs(environment, opts): """Display or follow container logs Usage: datacats logs [--postgres | --solr | --datapusher] [-s NAME] [-tr] [--tail=LINES] [ENVIRONMENT] datacats logs -f [--postgres | --solr | --datapusher] [-s NAME] [-r] [ENVIRONMENT] Options: --datapusher Show logs for datapusher inst...
[ "Display", "or", "follow", "container", "logs" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/manage.py#L206-L244
[ "def", "logs", "(", "environment", ",", "opts", ")", ":", "container", "=", "'web'", "if", "opts", "[", "'--solr'", "]", ":", "container", "=", "'solr'", "if", "opts", "[", "'--postgres'", "]", ":", "container", "=", "'postgres'", "if", "opts", "[", "'...
e4bae503efa997660fb3f34fe166699569653157
train
open_
Open web browser window to this environment Usage: datacats open [-r] [-s NAME] [ENVIRONMENT] Options: -s --site=NAME Choose a site to open [default: primary] ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.'
datacats/cli/manage.py
def open_(environment, opts): # pylint: disable=unused-argument """Open web browser window to this environment Usage: datacats open [-r] [-s NAME] [ENVIRONMENT] Options: -s --site=NAME Choose a site to open [default: primary] ENVIRONMENT may be an environment name or a path to an environment director...
def open_(environment, opts): # pylint: disable=unused-argument """Open web browser window to this environment Usage: datacats open [-r] [-s NAME] [ENVIRONMENT] Options: -s --site=NAME Choose a site to open [default: primary] ENVIRONMENT may be an environment name or a path to an environment director...
[ "Open", "web", "browser", "window", "to", "this", "environment" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/manage.py#L247-L266
[ "def", "open_", "(", "environment", ",", "opts", ")", ":", "# pylint: disable=unused-argument", "environment", ".", "require_data", "(", ")", "addr", "=", "environment", ".", "web_address", "(", ")", "if", "not", "addr", ":", "print", "\"Site not currently running...
e4bae503efa997660fb3f34fe166699569653157
train
tweak
Commands operating on environment data Usage: datacats tweak --install-postgis [ENVIRONMENT] datacats tweak --add-redis [ENVIRONMENT] datacats tweak --admin-password [ENVIRONMENT] Options: --install-postgis Install postgis in ckan database --add-redis Adds redis next time this environment reload...
datacats/cli/manage.py
def tweak(environment, opts): """Commands operating on environment data Usage: datacats tweak --install-postgis [ENVIRONMENT] datacats tweak --add-redis [ENVIRONMENT] datacats tweak --admin-password [ENVIRONMENT] Options: --install-postgis Install postgis in ckan database --add-redis Adds re...
def tweak(environment, opts): """Commands operating on environment data Usage: datacats tweak --install-postgis [ENVIRONMENT] datacats tweak --add-redis [ENVIRONMENT] datacats tweak --admin-password [ENVIRONMENT] Options: --install-postgis Install postgis in ckan database --add-redis Adds re...
[ "Commands", "operating", "on", "environment", "data" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/manage.py#L269-L299
[ "def", "tweak", "(", "environment", ",", "opts", ")", ":", "environment", ".", "require_data", "(", ")", "if", "opts", "[", "'--install-postgis'", "]", ":", "print", "\"Installing postgis\"", "environment", ".", "install_postgis_sql", "(", ")", "if", "opts", "...
e4bae503efa997660fb3f34fe166699569653157
train
_split_path
A wrapper around the normal split function that ignores any trailing /. :return: A tuple of the form (dirname, last) where last is the last element in the path.
datacats/migrate.py
def _split_path(path): """ A wrapper around the normal split function that ignores any trailing /. :return: A tuple of the form (dirname, last) where last is the last element in the path. """ # Get around a quirk in path_split where a / at the end will make the # dirname (split[0])...
def _split_path(path): """ A wrapper around the normal split function that ignores any trailing /. :return: A tuple of the form (dirname, last) where last is the last element in the path. """ # Get around a quirk in path_split where a / at the end will make the # dirname (split[0])...
[ "A", "wrapper", "around", "the", "normal", "split", "function", "that", "ignores", "any", "trailing", "/", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/migrate.py#L43-L54
[ "def", "_split_path", "(", "path", ")", ":", "# Get around a quirk in path_split where a / at the end will make the", "# dirname (split[0]) the entire path", "path", "=", "path", "[", ":", "-", "1", "]", "if", "path", "[", "-", "1", "]", "==", "'/'", "else", "path",...
e4bae503efa997660fb3f34fe166699569653157
train
_one_to_two
After this command, your environment will be converted to format version {}. and will only work with datacats version exceeding and including 1.0.0. This migration is necessary to support multiple sites within the same environment. Your current site will be kept and will be named "primary". Would you like to continue ...
datacats/migrate.py
def _one_to_two(datadir): """After this command, your environment will be converted to format version {}. and will only work with datacats version exceeding and including 1.0.0. This migration is necessary to support multiple sites within the same environment. Your current site will be kept and will be named "prima...
def _one_to_two(datadir): """After this command, your environment will be converted to format version {}. and will only work with datacats version exceeding and including 1.0.0. This migration is necessary to support multiple sites within the same environment. Your current site will be kept and will be named "prima...
[ "After", "this", "command", "your", "environment", "will", "be", "converted", "to", "format", "version", "{}", ".", "and", "will", "only", "work", "with", "datacats", "version", "exceeding", "and", "including", "1", ".", "0", ".", "0", ".", "This", "migrat...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/migrate.py#L57-L130
[ "def", "_one_to_two", "(", "datadir", ")", ":", "new_site_name", "=", "'primary'", "split", "=", "_split_path", "(", "datadir", ")", "print", "'Making sure that containers are stopped...'", "env_name", "=", "split", "[", "1", "]", "# Old-style names on purpose! We need ...
e4bae503efa997660fb3f34fe166699569653157
train
_two_to_one
After this command, your environment will be converted to format version {} and will not work with Datacats versions beyond and including 1.0.0. This format version doesn't support multiple sites, and after this only your "primary" site will be usable, though other sites will be maintained if you wish to do a migration...
datacats/migrate.py
def _two_to_one(datadir): """After this command, your environment will be converted to format version {} and will not work with Datacats versions beyond and including 1.0.0. This format version doesn't support multiple sites, and after this only your "primary" site will be usable, though other sites will be maintai...
def _two_to_one(datadir): """After this command, your environment will be converted to format version {} and will not work with Datacats versions beyond and including 1.0.0. This format version doesn't support multiple sites, and after this only your "primary" site will be usable, though other sites will be maintai...
[ "After", "this", "command", "your", "environment", "will", "be", "converted", "to", "format", "version", "{}", "and", "will", "not", "work", "with", "Datacats", "versions", "beyond", "and", "including", "1", ".", "0", ".", "0", ".", "This", "format", "vers...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/migrate.py#L133-L190
[ "def", "_two_to_one", "(", "datadir", ")", ":", "_", ",", "env_name", "=", "_split_path", "(", "datadir", ")", "print", "'Making sure that containers are stopped...'", "# New-style names", "remove_container", "(", "'datacats_web_{}_primary'", ".", "format", "(", "env_na...
e4bae503efa997660fb3f34fe166699569653157
train
convert_environment
Converts an environment TO the version specified by `version`. :param datadir: The datadir to convert. :param version: The version to convert TO. :param always_yes: True if the user shouldn't be prompted about the migration.
datacats/migrate.py
def convert_environment(datadir, version, always_yes): """ Converts an environment TO the version specified by `version`. :param datadir: The datadir to convert. :param version: The version to convert TO. :param always_yes: True if the user shouldn't be prompted about the migration. """ # Si...
def convert_environment(datadir, version, always_yes): """ Converts an environment TO the version specified by `version`. :param datadir: The datadir to convert. :param version: The version to convert TO. :param always_yes: True if the user shouldn't be prompted about the migration. """ # Si...
[ "Converts", "an", "environment", "TO", "the", "version", "specified", "by", "version", ".", ":", "param", "datadir", ":", "The", "datadir", "to", "convert", ".", ":", "param", "version", ":", "The", "version", "to", "convert", "TO", ".", ":", "param", "a...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/migrate.py#L199-L237
[ "def", "convert_environment", "(", "datadir", ",", "version", ",", "always_yes", ")", ":", "# Since we don't call either load() or new() we have to call require_images ourselves.", "require_images", "(", ")", "inp", "=", "None", "old_version", "=", "_get_current_format", "(",...
e4bae503efa997660fb3f34fe166699569653157
train
FlightData.get_history_by_flight_number
Fetch the history of a flight by its number. This method can be used to get the history of a flight route by the number. It checks the user authentication and returns the data accordingly. Args: flight_number (str): The flight number, e.g. AI101 page (int): Optional pag...
pyflightdata/flightdata.py
def get_history_by_flight_number(self, flight_number, page=1, limit=100): """Fetch the history of a flight by its number. This method can be used to get the history of a flight route by the number. It checks the user authentication and returns the data accordingly. Args: fl...
def get_history_by_flight_number(self, flight_number, page=1, limit=100): """Fetch the history of a flight by its number. This method can be used to get the history of a flight route by the number. It checks the user authentication and returns the data accordingly. Args: fl...
[ "Fetch", "the", "history", "of", "a", "flight", "by", "its", "number", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L58-L83
[ "def", "get_history_by_flight_number", "(", "self", ",", "flight_number", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "FLT_BASE", ".", "format", "(", "flight_number", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page"...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_history_by_tail_number
Fetch the history of a particular aircraft by its tail number. This method can be used to get the history of a particular aircraft by its tail number. It checks the user authentication and returns the data accordingly. Args: tail_number (str): The tail number, e.g. VT-ANL ...
pyflightdata/flightdata.py
def get_history_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the history of a particular aircraft by its tail number. This method can be used to get the history of a particular aircraft by its tail number. It checks the user authentication and returns the data accordingly. ...
def get_history_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the history of a particular aircraft by its tail number. This method can be used to get the history of a particular aircraft by its tail number. It checks the user authentication and returns the data accordingly. ...
[ "Fetch", "the", "history", "of", "a", "particular", "aircraft", "by", "its", "tail", "number", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L85-L110
[ "def", "get_history_by_tail_number", "(", "self", ",", "tail_number", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "REG_BASE", ".", "format", "(", "tail_number", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ",...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_airports
Returns a list of all the airports For a given country this returns a list of dicts, one for each airport, with information like the iata code of the airport etc Args: country (str): The country for which the airports will be fetched Example:: from pyflightdata import ...
pyflightdata/flightdata.py
def get_airports(self, country): """Returns a list of all the airports For a given country this returns a list of dicts, one for each airport, with information like the iata code of the airport etc Args: country (str): The country for which the airports will be fetched Exam...
def get_airports(self, country): """Returns a list of all the airports For a given country this returns a list of dicts, one for each airport, with information like the iata code of the airport etc Args: country (str): The country for which the airports will be fetched Exam...
[ "Returns", "a", "list", "of", "all", "the", "airports", "For", "a", "given", "country", "this", "returns", "a", "list", "of", "dicts", "one", "for", "each", "airport", "with", "information", "like", "the", "iata", "code", "of", "the", "airport", "etc" ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L118-L133
[ "def", "get_airports", "(", "self", ",", "country", ")", ":", "url", "=", "AIRPORT_BASE", ".", "format", "(", "country", ".", "replace", "(", "\" \"", ",", "\"-\"", ")", ")", "return", "self", ".", "_fr24", ".", "get_airports_data", "(", "url", ")" ]
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_info_by_tail_number
Fetch the details of a particular aircraft by its tail number. This method can be used to get the details of a particular aircraft by its tail number. Details include the serial number, age etc along with links to the images of the aircraft. It checks the user authentication and returns the dat...
pyflightdata/flightdata.py
def get_info_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the details of a particular aircraft by its tail number. This method can be used to get the details of a particular aircraft by its tail number. Details include the serial number, age etc along with links to the images ...
def get_info_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the details of a particular aircraft by its tail number. This method can be used to get the details of a particular aircraft by its tail number. Details include the serial number, age etc along with links to the images ...
[ "Fetch", "the", "details", "of", "a", "particular", "aircraft", "by", "its", "tail", "number", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L135-L160
[ "def", "get_info_by_tail_number", "(", "self", ",", "tail_number", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "REG_BASE", ".", "format", "(", "tail_number", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ",", ...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_fleet
Get the fleet for a particular airline. Given a airline code form the get_airlines() method output, this method returns the fleet for the airline. Args: airline_key (str): The code for the airline on flightradar24 Returns: A list of dicts, one for each aircraft in the ...
pyflightdata/flightdata.py
def get_fleet(self, airline_key): """Get the fleet for a particular airline. Given a airline code form the get_airlines() method output, this method returns the fleet for the airline. Args: airline_key (str): The code for the airline on flightradar24 Returns: A...
def get_fleet(self, airline_key): """Get the fleet for a particular airline. Given a airline code form the get_airlines() method output, this method returns the fleet for the airline. Args: airline_key (str): The code for the airline on flightradar24 Returns: A...
[ "Get", "the", "fleet", "for", "a", "particular", "airline", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L172-L191
[ "def", "get_fleet", "(", "self", ",", "airline_key", ")", ":", "url", "=", "AIRLINE_FLEET_BASE", ".", "format", "(", "airline_key", ")", "return", "self", ".", "_fr24", ".", "get_airline_fleet_data", "(", "url", ",", "self", ".", "AUTH_TOKEN", "!=", "''", ...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_flights
Get the flights for a particular airline. Given a full or partial flight number string, this method returns the first 100 flights matching that string. Please note this method was different in earlier versions. The older versions took an airline code and returned all scheduled flights for that airline...
pyflightdata/flightdata.py
def get_flights(self, search_key): """Get the flights for a particular airline. Given a full or partial flight number string, this method returns the first 100 flights matching that string. Please note this method was different in earlier versions. The older versions took an airline code and r...
def get_flights(self, search_key): """Get the flights for a particular airline. Given a full or partial flight number string, this method returns the first 100 flights matching that string. Please note this method was different in earlier versions. The older versions took an airline code and r...
[ "Get", "the", "flights", "for", "a", "particular", "airline", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L193-L215
[ "def", "get_flights", "(", "self", ",", "search_key", ")", ":", "# assume limit 100 to return first 100 of any wild card search", "url", "=", "AIRLINE_FLT_BASE", ".", "format", "(", "search_key", ",", "100", ")", "return", "self", ".", "_fr24", ".", "get_airline_fligh...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_flights_from_to
Get the flights for a particular origin and destination. Given an origin and destination this method returns the upcoming scheduled flights between these two points. The data returned has the airline, airport and schedule information - this is subject to change in future. Args: ori...
pyflightdata/flightdata.py
def get_flights_from_to(self, origin, destination): """Get the flights for a particular origin and destination. Given an origin and destination this method returns the upcoming scheduled flights between these two points. The data returned has the airline, airport and schedule information - this...
def get_flights_from_to(self, origin, destination): """Get the flights for a particular origin and destination. Given an origin and destination this method returns the upcoming scheduled flights between these two points. The data returned has the airline, airport and schedule information - this...
[ "Get", "the", "flights", "for", "a", "particular", "origin", "and", "destination", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L217-L239
[ "def", "get_flights_from_to", "(", "self", ",", "origin", ",", "destination", ")", ":", "# assume limit 100 to return first 100 of any wild card search", "url", "=", "AIRLINE_FLT_BASE_POINTS", ".", "format", "(", "origin", ",", "destination", ")", "return", "self", ".",...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_airport_weather
Retrieve the weather at an airport Given the IATA code of an airport, this method returns the weather information. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number; for users who are on a plan with flightradar24 they can pass in higher p...
pyflightdata/flightdata.py
def get_airport_weather(self, iata, page=1, limit=100): """Retrieve the weather at an airport Given the IATA code of an airport, this method returns the weather information. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number; for u...
def get_airport_weather(self, iata, page=1, limit=100): """Retrieve the weather at an airport Given the IATA code of an airport, this method returns the weather information. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number; for u...
[ "Retrieve", "the", "weather", "at", "an", "airport" ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L241-L271
[ "def", "get_airport_weather", "(", "self", ",", "iata", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "AIRPORT_DATA_BASE", ".", "format", "(", "iata", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ",", "limit"...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_airport_metars
Retrieve the metar data at the current time Given the IATA code of an airport, this method returns the metar information. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number; for users who are on a plan with flightradar24 they can pass in h...
pyflightdata/flightdata.py
def get_airport_metars(self, iata, page=1, limit=100): """Retrieve the metar data at the current time Given the IATA code of an airport, this method returns the metar information. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number;...
def get_airport_metars(self, iata, page=1, limit=100): """Retrieve the metar data at the current time Given the IATA code of an airport, this method returns the metar information. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number;...
[ "Retrieve", "the", "metar", "data", "at", "the", "current", "time" ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L273-L297
[ "def", "get_airport_metars", "(", "self", ",", "iata", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "AIRPORT_DATA_BASE", ".", "format", "(", "iata", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ",", "limit",...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_airport_metars_hist
Retrieve the metar data for past 72 hours. The data will not be parsed to readable format. Given the IATA code of an airport, this method returns the metar information for last 72 hours. Args: iata (str): The IATA code for an airport, e.g. HYD Returns: The metar data f...
pyflightdata/flightdata.py
def get_airport_metars_hist(self, iata): """Retrieve the metar data for past 72 hours. The data will not be parsed to readable format. Given the IATA code of an airport, this method returns the metar information for last 72 hours. Args: iata (str): The IATA code for an airport, e.g...
def get_airport_metars_hist(self, iata): """Retrieve the metar data for past 72 hours. The data will not be parsed to readable format. Given the IATA code of an airport, this method returns the metar information for last 72 hours. Args: iata (str): The IATA code for an airport, e.g...
[ "Retrieve", "the", "metar", "data", "for", "past", "72", "hours", ".", "The", "data", "will", "not", "be", "parsed", "to", "readable", "format", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L299-L320
[ "def", "get_airport_metars_hist", "(", "self", ",", "iata", ")", ":", "url", "=", "AIRPORT_BASE", ".", "format", "(", "iata", ")", "+", "\"/weather\"", "return", "self", ".", "_fr24", ".", "get_airport_metars_hist", "(", "url", ")" ]
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_airport_stats
Retrieve the performance statistics at an airport Given the IATA code of an airport, this method returns the performance statistics for the airport. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number; for users who are on a plan with fligh...
pyflightdata/flightdata.py
def get_airport_stats(self, iata, page=1, limit=100): """Retrieve the performance statistics at an airport Given the IATA code of an airport, this method returns the performance statistics for the airport. Args: iata (str): The IATA code for an airport, e.g. HYD page (i...
def get_airport_stats(self, iata, page=1, limit=100): """Retrieve the performance statistics at an airport Given the IATA code of an airport, this method returns the performance statistics for the airport. Args: iata (str): The IATA code for an airport, e.g. HYD page (i...
[ "Retrieve", "the", "performance", "statistics", "at", "an", "airport" ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L322-L346
[ "def", "get_airport_stats", "(", "self", ",", "iata", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "AIRPORT_DATA_BASE", ".", "format", "(", "iata", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ",", "limit", ...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_airport_details
Retrieve the details of an airport Given the IATA code of an airport, this method returns the detailed information like lat lon, full name, URL, codes etc. Args: iata (str): The IATA code for an airport, e.g. HYD page (int): Optional page number; for users who are on a plan wit...
pyflightdata/flightdata.py
def get_airport_details(self, iata, page=1, limit=100): """Retrieve the details of an airport Given the IATA code of an airport, this method returns the detailed information like lat lon, full name, URL, codes etc. Args: iata (str): The IATA code for an airport, e.g. HYD ...
def get_airport_details(self, iata, page=1, limit=100): """Retrieve the details of an airport Given the IATA code of an airport, this method returns the detailed information like lat lon, full name, URL, codes etc. Args: iata (str): The IATA code for an airport, e.g. HYD ...
[ "Retrieve", "the", "details", "of", "an", "airport" ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L348-L376
[ "def", "get_airport_details", "(", "self", ",", "iata", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "AIRPORT_DATA_BASE", ".", "format", "(", "iata", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ",", "limit"...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.get_images_by_tail_number
Fetch the images of a particular aircraft by its tail number. This method can be used to get the images of the aircraft. The images are in 3 sizes and you can use what suits your need. Args: tail_number (str): The tail number, e.g. VT-ANL page (int): Optional page number; for u...
pyflightdata/flightdata.py
def get_images_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the images of a particular aircraft by its tail number. This method can be used to get the images of the aircraft. The images are in 3 sizes and you can use what suits your need. Args: tail_number (str): ...
def get_images_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the images of a particular aircraft by its tail number. This method can be used to get the images of the aircraft. The images are in 3 sizes and you can use what suits your need. Args: tail_number (str): ...
[ "Fetch", "the", "images", "of", "a", "particular", "aircraft", "by", "its", "tail", "number", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L482-L505
[ "def", "get_images_by_tail_number", "(", "self", ",", "tail_number", ",", "page", "=", "1", ",", "limit", "=", "100", ")", ":", "url", "=", "REG_BASE", ".", "format", "(", "tail_number", ",", "str", "(", "self", ".", "AUTH_TOKEN", ")", ",", "page", ","...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.login
Login to the flightradar24 session The API currently uses flightradar24 as the primary data source. The site provides different levels of data based on user plans. For users who have signed up for a plan, this method allows to login with the credentials from flightradar24. The API obtains a tok...
pyflightdata/flightdata.py
def login(self, email, password): """Login to the flightradar24 session The API currently uses flightradar24 as the primary data source. The site provides different levels of data based on user plans. For users who have signed up for a plan, this method allows to login with the credentials from...
def login(self, email, password): """Login to the flightradar24 session The API currently uses flightradar24 as the primary data source. The site provides different levels of data based on user plans. For users who have signed up for a plan, this method allows to login with the credentials from...
[ "Login", "to", "the", "flightradar24", "session" ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L507-L543
[ "def", "login", "(", "self", ",", "email", ",", "password", ")", ":", "response", "=", "FlightData", ".", "session", ".", "post", "(", "url", "=", "LOGIN_URL", ",", "data", "=", "{", "'email'", ":", "email", ",", "'password'", ":", "password", ",", "...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
FlightData.decode_metar
Simple method that decodes a given metar string. Args: metar (str): The metar data Returns: The metar data in readable format Example:: from pyflightdata import FlightData f=FlightData() f.decode_metar('WSSS 181030Z 04009KT 010V080 ...
pyflightdata/flightdata.py
def decode_metar(self, metar): """ Simple method that decodes a given metar string. Args: metar (str): The metar data Returns: The metar data in readable format Example:: from pyflightdata import FlightData f=FlightData() ...
def decode_metar(self, metar): """ Simple method that decodes a given metar string. Args: metar (str): The metar data Returns: The metar data in readable format Example:: from pyflightdata import FlightData f=FlightData() ...
[ "Simple", "method", "that", "decodes", "a", "given", "metar", "string", "." ]
supercoderz/pyflightdata
python
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L556-L577
[ "def", "decode_metar", "(", "self", ",", "metar", ")", ":", "try", ":", "from", "metar", "import", "Metar", "except", ":", "return", "\"Unable to parse metars. Please install parser from https://github.com/tomp/python-metar.\"", "m", "=", "Metar", ".", "Metar", "(", "...
2caf9f429288f9a171893d1b8377d0c6244541cc
train
RADIUSBackend._get_auth_packet
Get the pyrad authentication packet for the username/password and the given pyrad client.
radiusauth/backends/radius.py
def _get_auth_packet(self, username, password, client): """ Get the pyrad authentication packet for the username/password and the given pyrad client. """ pkt = client.CreateAuthPacket(code=AccessRequest, User_Name=username) pkt["User-...
def _get_auth_packet(self, username, password, client): """ Get the pyrad authentication packet for the username/password and the given pyrad client. """ pkt = client.CreateAuthPacket(code=AccessRequest, User_Name=username) pkt["User-...
[ "Get", "the", "pyrad", "authentication", "packet", "for", "the", "username", "/", "password", "and", "the", "given", "pyrad", "client", "." ]
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L75-L86
[ "def", "_get_auth_packet", "(", "self", ",", "username", ",", "password", ",", "client", ")", ":", "pkt", "=", "client", ".", "CreateAuthPacket", "(", "code", "=", "AccessRequest", ",", "User_Name", "=", "username", ")", "pkt", "[", "\"User-Password\"", "]",...
5b90f4ae4cbd680988197386d882491317e6b20c
train
RADIUSBackend._get_client
Get the pyrad client for a given server. RADIUS server is described by a 3-tuple: (<hostname>, <port>, <secret>).
radiusauth/backends/radius.py
def _get_client(self, server): """ Get the pyrad client for a given server. RADIUS server is described by a 3-tuple: (<hostname>, <port>, <secret>). """ return Client( server=server[0], authport=server[1], secret=server[2], dict=sel...
def _get_client(self, server): """ Get the pyrad client for a given server. RADIUS server is described by a 3-tuple: (<hostname>, <port>, <secret>). """ return Client( server=server[0], authport=server[1], secret=server[2], dict=sel...
[ "Get", "the", "pyrad", "client", "for", "a", "given", "server", ".", "RADIUS", "server", "is", "described", "by", "a", "3", "-", "tuple", ":", "(", "<hostname", ">", "<port", ">", "<secret", ">", ")", "." ]
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L88-L98
[ "def", "_get_client", "(", "self", ",", "server", ")", ":", "return", "Client", "(", "server", "=", "server", "[", "0", "]", ",", "authport", "=", "server", "[", "1", "]", ",", "secret", "=", "server", "[", "2", "]", ",", "dict", "=", "self", "."...
5b90f4ae4cbd680988197386d882491317e6b20c
train
RADIUSBackend._perform_radius_auth
Perform the actual radius authentication by passing the given packet to the server which `client` is bound to. Returns True or False depending on whether the user is authenticated successfully.
radiusauth/backends/radius.py
def _perform_radius_auth(self, client, packet): """ Perform the actual radius authentication by passing the given packet to the server which `client` is bound to. Returns True or False depending on whether the user is authenticated successfully. """ try: ...
def _perform_radius_auth(self, client, packet): """ Perform the actual radius authentication by passing the given packet to the server which `client` is bound to. Returns True or False depending on whether the user is authenticated successfully. """ try: ...
[ "Perform", "the", "actual", "radius", "authentication", "by", "passing", "the", "given", "packet", "to", "the", "server", "which", "client", "is", "bound", "to", ".", "Returns", "True", "or", "False", "depending", "on", "whether", "the", "user", "is", "authe...
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L110-L138
[ "def", "_perform_radius_auth", "(", "self", ",", "client", ",", "packet", ")", ":", "try", ":", "reply", "=", "client", ".", "SendPacket", "(", "packet", ")", "except", "Timeout", "as", "e", ":", "logging", ".", "error", "(", "\"RADIUS timeout occurred conta...
5b90f4ae4cbd680988197386d882491317e6b20c
train
RADIUSBackend._radius_auth
Authenticate the given username/password against the RADIUS server described by `server`.
radiusauth/backends/radius.py
def _radius_auth(self, server, username, password): """ Authenticate the given username/password against the RADIUS server described by `server`. """ client = self._get_client(server) packet = self._get_auth_packet(username, password, client) return self._perform_...
def _radius_auth(self, server, username, password): """ Authenticate the given username/password against the RADIUS server described by `server`. """ client = self._get_client(server) packet = self._get_auth_packet(username, password, client) return self._perform_...
[ "Authenticate", "the", "given", "username", "/", "password", "against", "the", "RADIUS", "server", "described", "by", "server", "." ]
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L140-L147
[ "def", "_radius_auth", "(", "self", ",", "server", ",", "username", ",", "password", ")", ":", "client", "=", "self", ".", "_get_client", "(", "server", ")", "packet", "=", "self", ".", "_get_auth_packet", "(", "username", ",", "password", ",", "client", ...
5b90f4ae4cbd680988197386d882491317e6b20c
train
RADIUSBackend.get_django_user
Get the Django user with the given username, or create one if it doesn't already exist. If `password` is given, then set the user's password to that (regardless of whether the user was created or not).
radiusauth/backends/radius.py
def get_django_user(self, username, password=None): """ Get the Django user with the given username, or create one if it doesn't already exist. If `password` is given, then set the user's password to that (regardless of whether the user was created or not). """ try: ...
def get_django_user(self, username, password=None): """ Get the Django user with the given username, or create one if it doesn't already exist. If `password` is given, then set the user's password to that (regardless of whether the user was created or not). """ try: ...
[ "Get", "the", "Django", "user", "with", "the", "given", "username", "or", "create", "one", "if", "it", "doesn", "t", "already", "exist", ".", "If", "password", "is", "given", "then", "set", "the", "user", "s", "password", "to", "that", "(", "regardless",...
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L149-L164
[ "def", "get_django_user", "(", "self", ",", "username", ",", "password", "=", "None", ")", ":", "try", ":", "user", "=", "User", ".", "objects", ".", "get", "(", "username", "=", "username", ")", "except", "User", ".", "DoesNotExist", ":", "user", "=",...
5b90f4ae4cbd680988197386d882491317e6b20c
train
RADIUSBackend.authenticate
Check credentials against RADIUS server and return a User object or None.
radiusauth/backends/radius.py
def authenticate(self, request, username=None, password=None): """ Check credentials against RADIUS server and return a User object or None. """ if isinstance(username, basestring): username = username.encode('utf-8') if isinstance(password, basestring): ...
def authenticate(self, request, username=None, password=None): """ Check credentials against RADIUS server and return a User object or None. """ if isinstance(username, basestring): username = username.encode('utf-8') if isinstance(password, basestring): ...
[ "Check", "credentials", "against", "RADIUS", "server", "and", "return", "a", "User", "object", "or", "None", "." ]
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L166-L183
[ "def", "authenticate", "(", "self", ",", "request", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "if", "isinstance", "(", "username", ",", "basestring", ")", ":", "username", "=", "username", ".", "encode", "(", "'utf-8'", ")", ...
5b90f4ae4cbd680988197386d882491317e6b20c
train
RADIUSRealmBackend.authenticate
Check credentials against the RADIUS server identified by `realm` and return a User object or None. If no argument is supplied, Django will skip this backend and try the next one (as a TypeError will be raised and caught).
radiusauth/backends/radius.py
def authenticate(self, request, username=None, password=None, realm=None): """ Check credentials against the RADIUS server identified by `realm` and return a User object or None. If no argument is supplied, Django will skip this backend and try the next one (as a TypeError will be raised...
def authenticate(self, request, username=None, password=None, realm=None): """ Check credentials against the RADIUS server identified by `realm` and return a User object or None. If no argument is supplied, Django will skip this backend and try the next one (as a TypeError will be raised...
[ "Check", "credentials", "against", "the", "RADIUS", "server", "identified", "by", "realm", "and", "return", "a", "User", "object", "or", "None", ".", "If", "no", "argument", "is", "supplied", "Django", "will", "skip", "this", "backend", "and", "try", "the", ...
robgolding/django-radius
python
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L229-L253
[ "def", "authenticate", "(", "self", ",", "request", ",", "username", "=", "None", ",", "password", "=", "None", ",", "realm", "=", "None", ")", ":", "if", "isinstance", "(", "username", ",", "basestring", ")", ":", "username", "=", "username", ".", "en...
5b90f4ae4cbd680988197386d882491317e6b20c
train
ProxyUploadedFile.move
Closes then moves the file to dst.
django_transfer/__init__.py
def move(self, dst): "Closes then moves the file to dst." self.close() shutil.move(self.path, dst)
def move(self, dst): "Closes then moves the file to dst." self.close() shutil.move(self.path, dst)
[ "Closes", "then", "moves", "the", "file", "to", "dst", "." ]
smartfile/django-transfer
python
https://github.com/smartfile/django-transfer/blob/65ef60e011c1b98d7f5a195debd81b3efde897dd/django_transfer/__init__.py#L110-L113
[ "def", "move", "(", "self", ",", "dst", ")", ":", "self", ".", "close", "(", ")", "shutil", ".", "move", "(", "self", ".", "path", ",", "dst", ")" ]
65ef60e011c1b98d7f5a195debd81b3efde897dd
train
sigma_clipping
Remove any fluctuated data points by magnitudes. Parameters ---------- date : array_like An array of dates. mag : array_like An array of magnitudes. err : array_like An array of magnitude errors. threshold : float, optional Threshold for sigma-clipping. itera...
upsilon/utils/utils.py
def sigma_clipping(date, mag, err, threshold=3, iteration=1): """ Remove any fluctuated data points by magnitudes. Parameters ---------- date : array_like An array of dates. mag : array_like An array of magnitudes. err : array_like An array of magnitude errors. t...
def sigma_clipping(date, mag, err, threshold=3, iteration=1): """ Remove any fluctuated data points by magnitudes. Parameters ---------- date : array_like An array of dates. mag : array_like An array of magnitudes. err : array_like An array of magnitude errors. t...
[ "Remove", "any", "fluctuated", "data", "points", "by", "magnitudes", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/utils/utils.py#L4-L47
[ "def", "sigma_clipping", "(", "date", ",", "mag", ",", "err", ",", "threshold", "=", "3", ",", "iteration", "=", "1", ")", ":", "# Check length.", "if", "(", "len", "(", "date", ")", "!=", "len", "(", "mag", ")", ")", "or", "(", "len", "(", "date...
5f381453f26582ef56e62fb8fed7317ce67861af
train
from_spec
Return a schema object from a spec. A spec is either a string for a scalar type, or a list of 0 or 1 specs, or a dictionary with two elements: {'fields': { ... }, required: [...]}.
gcl/schema.py
def from_spec(spec): """Return a schema object from a spec. A spec is either a string for a scalar type, or a list of 0 or 1 specs, or a dictionary with two elements: {'fields': { ... }, required: [...]}. """ if spec == '': return any_schema if framework.is_str(spec): # Scalar type if spec not...
def from_spec(spec): """Return a schema object from a spec. A spec is either a string for a scalar type, or a list of 0 or 1 specs, or a dictionary with two elements: {'fields': { ... }, required: [...]}. """ if spec == '': return any_schema if framework.is_str(spec): # Scalar type if spec not...
[ "Return", "a", "schema", "object", "from", "a", "spec", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/schema.py#L178-L199
[ "def", "from_spec", "(", "spec", ")", ":", "if", "spec", "==", "''", ":", "return", "any_schema", "if", "framework", ".", "is_str", "(", "spec", ")", ":", "# Scalar type", "if", "spec", "not", "in", "SCALAR_TYPES", ":", "raise", "exceptions", ".", "Schem...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
validate
Validate an object according to its own AND an externally imposed schema.
gcl/schema.py
def validate(obj, schema): """Validate an object according to its own AND an externally imposed schema.""" if not framework.EvaluationContext.current().validate: # Short circuit evaluation when disabled return obj # Validate returned object according to its own schema if hasattr(obj, 'tuple_schema'): ...
def validate(obj, schema): """Validate an object according to its own AND an externally imposed schema.""" if not framework.EvaluationContext.current().validate: # Short circuit evaluation when disabled return obj # Validate returned object according to its own schema if hasattr(obj, 'tuple_schema'): ...
[ "Validate", "an", "object", "according", "to", "its", "own", "AND", "an", "externally", "imposed", "schema", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/schema.py#L208-L220
[ "def", "validate", "(", "obj", ",", "schema", ")", ":", "if", "not", "framework", ".", "EvaluationContext", ".", "current", "(", ")", ".", "validate", ":", "# Short circuit evaluation when disabled", "return", "obj", "# Validate returned object according to its own sche...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
attach
Attach the given schema to the given object.
gcl/schema.py
def attach(obj, schema): """Attach the given schema to the given object.""" # We have a silly exception for lists, since they have no 'attach_schema' # method, and I don't feel like making a subclass for List just to add it. # So, we recursively search the list for tuples and attach the schema in # there. ...
def attach(obj, schema): """Attach the given schema to the given object.""" # We have a silly exception for lists, since they have no 'attach_schema' # method, and I don't feel like making a subclass for List just to add it. # So, we recursively search the list for tuples and attach the schema in # there. ...
[ "Attach", "the", "given", "schema", "to", "the", "given", "object", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/schema.py#L223-L236
[ "def", "attach", "(", "obj", ",", "schema", ")", ":", "# We have a silly exception for lists, since they have no 'attach_schema'", "# method, and I don't feel like making a subclass for List just to add it.", "# So, we recursively search the list for tuples and attach the schema in", "# there....
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
get_feature_set_all
Return a list of entire features. A set of entire features regardless of being used to train a model or predict a class. Returns ------- feature_names : list A list of features' names.
upsilon/extract_features/feature_set.py
def get_feature_set_all(): """ Return a list of entire features. A set of entire features regardless of being used to train a model or predict a class. Returns ------- feature_names : list A list of features' names. """ features = get_feature_set() features.append('cu...
def get_feature_set_all(): """ Return a list of entire features. A set of entire features regardless of being used to train a model or predict a class. Returns ------- feature_names : list A list of features' names. """ features = get_feature_set() features.append('cu...
[ "Return", "a", "list", "of", "entire", "features", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/feature_set.py#L23-L49
[ "def", "get_feature_set_all", "(", ")", ":", "features", "=", "get_feature_set", "(", ")", "features", ".", "append", "(", "'cusum'", ")", "features", ".", "append", "(", "'eta'", ")", "features", ".", "append", "(", "'n_points'", ")", "features", ".", "ap...
5f381453f26582ef56e62fb8fed7317ce67861af
train
NeuralNet.parameters
A property that returns all of the model's parameters.
hebel/models/neural_net.py
def parameters(self): """ A property that returns all of the model's parameters. """ parameters = [] for hl in self.hidden_layers: parameters.extend(hl.parameters) parameters.extend(self.top_layer.parameters) return parameters
def parameters(self): """ A property that returns all of the model's parameters. """ parameters = [] for hl in self.hidden_layers: parameters.extend(hl.parameters) parameters.extend(self.top_layer.parameters) return parameters
[ "A", "property", "that", "returns", "all", "of", "the", "model", "s", "parameters", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/models/neural_net.py#L185-L191
[ "def", "parameters", "(", "self", ")", ":", "parameters", "=", "[", "]", "for", "hl", "in", "self", ".", "hidden_layers", ":", "parameters", ".", "extend", "(", "hl", ".", "parameters", ")", "parameters", ".", "extend", "(", "self", ".", "top_layer", "...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
NeuralNet.parameters
Used to set all of the model's parameters to new values. **Parameters:** value : array_like New values for the model parameters. Must be of length ``self.n_parameters``.
hebel/models/neural_net.py
def parameters(self, value): """ Used to set all of the model's parameters to new values. **Parameters:** value : array_like New values for the model parameters. Must be of length ``self.n_parameters``. """ if len(value) != self.n_parameters: ...
def parameters(self, value): """ Used to set all of the model's parameters to new values. **Parameters:** value : array_like New values for the model parameters. Must be of length ``self.n_parameters``. """ if len(value) != self.n_parameters: ...
[ "Used", "to", "set", "all", "of", "the", "model", "s", "parameters", "to", "new", "values", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/models/neural_net.py#L194-L214
[ "def", "parameters", "(", "self", ",", "value", ")", ":", "if", "len", "(", "value", ")", "!=", "self", ".", "n_parameters", ":", "raise", "ValueError", "(", "\"Incorrect length of parameter vector. \"", "\"Model has %d parameters, but got %d\"", "%", "(", "self", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
NeuralNet.checksum
Returns an MD5 digest of the model. This can be used to easily identify whether two models have the same architecture.
hebel/models/neural_net.py
def checksum(self): """ Returns an MD5 digest of the model. This can be used to easily identify whether two models have the same architecture. """ m = md5() for hl in self.hidden_layers: m.update(str(hl.architecture)) m.update(str(self.top_la...
def checksum(self): """ Returns an MD5 digest of the model. This can be used to easily identify whether two models have the same architecture. """ m = md5() for hl in self.hidden_layers: m.update(str(hl.architecture)) m.update(str(self.top_la...
[ "Returns", "an", "MD5", "digest", "of", "the", "model", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/models/neural_net.py#L243-L254
[ "def", "checksum", "(", "self", ")", ":", "m", "=", "md5", "(", ")", "for", "hl", "in", "self", ".", "hidden_layers", ":", "m", ".", "update", "(", "str", "(", "hl", ".", "architecture", ")", ")", "m", ".", "update", "(", "str", "(", "self", "....
1e2c3a9309c2646103901b26a55be4e312dd5005
train
NeuralNet.evaluate
Evaluate the loss function without computing gradients. **Parameters:** input_data : GPUArray Data to evaluate targets: GPUArray Targets return_cache : bool, optional Whether to return intermediary variables from the computation and the...
hebel/models/neural_net.py
def evaluate(self, input_data, targets, return_cache=False, prediction=True): """ Evaluate the loss function without computing gradients. **Parameters:** input_data : GPUArray Data to evaluate targets: GPUArray Targets return_cache : b...
def evaluate(self, input_data, targets, return_cache=False, prediction=True): """ Evaluate the loss function without computing gradients. **Parameters:** input_data : GPUArray Data to evaluate targets: GPUArray Targets return_cache : b...
[ "Evaluate", "the", "loss", "function", "without", "computing", "gradients", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/models/neural_net.py#L256-L308
[ "def", "evaluate", "(", "self", ",", "input_data", ",", "targets", ",", "return_cache", "=", "False", ",", "prediction", "=", "True", ")", ":", "# Forward pass", "activations", ",", "hidden_cache", "=", "self", ".", "feed_forward", "(", "input_data", ",", "r...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
NeuralNet.training_pass
Perform a full forward and backward pass through the model. **Parameters:** input_data : GPUArray Data to train the model with. targets : GPUArray Training targets. **Returns:** loss : float Value of loss function as evaluated on the data ...
hebel/models/neural_net.py
def training_pass(self, input_data, targets): """ Perform a full forward and backward pass through the model. **Parameters:** input_data : GPUArray Data to train the model with. targets : GPUArray Training targets. **Returns:** loss : float ...
def training_pass(self, input_data, targets): """ Perform a full forward and backward pass through the model. **Parameters:** input_data : GPUArray Data to train the model with. targets : GPUArray Training targets. **Returns:** loss : float ...
[ "Perform", "a", "full", "forward", "and", "backward", "pass", "through", "the", "model", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/models/neural_net.py#L310-L359
[ "def", "training_pass", "(", "self", ",", "input_data", ",", "targets", ")", ":", "# Forward pass", "loss", ",", "hidden_cache", ",", "logistic_cache", "=", "self", ".", "evaluate", "(", "input_data", ",", "targets", ",", "return_cache", "=", "True", ",", "p...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
NeuralNet.feed_forward
Run data forward through the model. **Parameters:** input_data : GPUArray Data to run through the model. return_cache : bool, optional Whether to return the intermediary results. prediction : bool, optional Whether to run in prediction mode. Only r...
hebel/models/neural_net.py
def feed_forward(self, input_data, return_cache=False, prediction=True): """ Run data forward through the model. **Parameters:** input_data : GPUArray Data to run through the model. return_cache : bool, optional Whether to return the intermediary results. ...
def feed_forward(self, input_data, return_cache=False, prediction=True): """ Run data forward through the model. **Parameters:** input_data : GPUArray Data to run through the model. return_cache : bool, optional Whether to return the intermediary results. ...
[ "Run", "data", "forward", "through", "the", "model", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/models/neural_net.py#L399-L448
[ "def", "feed_forward", "(", "self", ",", "input_data", ",", "return_cache", "=", "False", ",", "prediction", "=", "True", ")", ":", "hidden_cache", "=", "None", "# Create variable in case there are no hidden layers", "if", "self", ".", "hidden_layers", ":", "# Forwa...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
ExtractFeatures.shallow_run
Derive not-period-based features.
upsilon/extract_features/extract_features.py
def shallow_run(self): """Derive not-period-based features.""" # Number of data points self.n_points = len(self.date) # Weight calculation. # All zero values. if not self.err.any(): self.err = np.ones(len(self.mag)) * np.std(self.mag) # Some zero valu...
def shallow_run(self): """Derive not-period-based features.""" # Number of data points self.n_points = len(self.date) # Weight calculation. # All zero values. if not self.err.any(): self.err = np.ones(len(self.mag)) * np.std(self.mag) # Some zero valu...
[ "Derive", "not", "-", "period", "-", "based", "features", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L86-L139
[ "def", "shallow_run", "(", "self", ")", ":", "# Number of data points", "self", ".", "n_points", "=", "len", "(", "self", ".", "date", ")", "# Weight calculation.", "# All zero values.", "if", "not", "self", ".", "err", ".", "any", "(", ")", ":", "self", "...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.deep_run
Derive period-based features.
upsilon/extract_features/extract_features.py
def deep_run(self): """Derive period-based features.""" # Lomb-Scargle period finding. self.get_period_LS(self.date, self.mag, self.n_threads, self.min_period) # Features based on a phase-folded light curve # such as Eta, slope-percentile, etc. # Should be called after t...
def deep_run(self): """Derive period-based features.""" # Lomb-Scargle period finding. self.get_period_LS(self.date, self.mag, self.n_threads, self.min_period) # Features based on a phase-folded light curve # such as Eta, slope-percentile, etc. # Should be called after t...
[ "Derive", "period", "-", "based", "features", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L141-L166
[ "def", "deep_run", "(", "self", ")", ":", "# Lomb-Scargle period finding.", "self", ".", "get_period_LS", "(", "self", ".", "date", ",", "self", ".", "mag", ",", "self", ".", "n_threads", ",", "self", ".", "min_period", ")", "# Features based on a phase-folded l...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_period_LS
Period finding using the Lomb-Scargle algorithm. Finding two periods. The second period is estimated after whitening the first period. Calculating various other features as well using derived periods. Parameters ---------- date : array_like An array of obser...
upsilon/extract_features/extract_features.py
def get_period_LS(self, date, mag, n_threads, min_period): """ Period finding using the Lomb-Scargle algorithm. Finding two periods. The second period is estimated after whitening the first period. Calculating various other features as well using derived periods. Parame...
def get_period_LS(self, date, mag, n_threads, min_period): """ Period finding using the Lomb-Scargle algorithm. Finding two periods. The second period is estimated after whitening the first period. Calculating various other features as well using derived periods. Parame...
[ "Period", "finding", "using", "the", "Lomb", "-", "Scargle", "algorithm", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L168-L273
[ "def", "get_period_LS", "(", "self", ",", "date", ",", "mag", ",", "n_threads", ",", "min_period", ")", ":", "# DO NOT CHANGE THESE PARAMETERS.", "oversampling", "=", "3.", "hifac", "=", "int", "(", "(", "max", "(", "date", ")", "-", "min", "(", "date", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_period_uncertainty
Get uncertainty of a period. The uncertainty is defined as the half width of the frequencies around the peak, that becomes lower than average + standard deviation of the power spectrum. Since we may not have fine resolution around the peak, we do not assume it is gaussian. So, ...
upsilon/extract_features/extract_features.py
def get_period_uncertainty(self, fx, fy, jmax, fx_width=100): """ Get uncertainty of a period. The uncertainty is defined as the half width of the frequencies around the peak, that becomes lower than average + standard deviation of the power spectrum. Since we may not h...
def get_period_uncertainty(self, fx, fy, jmax, fx_width=100): """ Get uncertainty of a period. The uncertainty is defined as the half width of the frequencies around the peak, that becomes lower than average + standard deviation of the power spectrum. Since we may not h...
[ "Get", "uncertainty", "of", "a", "period", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L275-L340
[ "def", "get_period_uncertainty", "(", "self", ",", "fx", ",", "fy", ",", "jmax", ",", "fx_width", "=", "100", ")", ":", "# Get subset", "start_index", "=", "jmax", "-", "fx_width", "end_index", "=", "jmax", "+", "fx_width", "if", "start_index", "<", "0", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.residuals
Residual of Fourier Series. Parameters ---------- pars : array_like Fourier series parameters. x : array_like An array of date. y : array_like An array of true values to fit. order : int An order of Fourier Series.
upsilon/extract_features/extract_features.py
def residuals(self, pars, x, y, order): """ Residual of Fourier Series. Parameters ---------- pars : array_like Fourier series parameters. x : array_like An array of date. y : array_like An array of true values to fit. ...
def residuals(self, pars, x, y, order): """ Residual of Fourier Series. Parameters ---------- pars : array_like Fourier series parameters. x : array_like An array of date. y : array_like An array of true values to fit. ...
[ "Residual", "of", "Fourier", "Series", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L342-L358
[ "def", "residuals", "(", "self", ",", "pars", ",", "x", ",", "y", ",", "order", ")", ":", "return", "y", "-", "self", ".", "fourier_series", "(", "pars", ",", "x", ",", "order", ")" ]
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.fourier_series
Function to fit Fourier Series. Parameters ---------- x : array_like An array of date divided by period. It doesn't need to be sorted. pars : array_like Fourier series parameters. order : int An order of Fourier series.
upsilon/extract_features/extract_features.py
def fourier_series(self, pars, x, order): """ Function to fit Fourier Series. Parameters ---------- x : array_like An array of date divided by period. It doesn't need to be sorted. pars : array_like Fourier series parameters. order : int ...
def fourier_series(self, pars, x, order): """ Function to fit Fourier Series. Parameters ---------- x : array_like An array of date divided by period. It doesn't need to be sorted. pars : array_like Fourier series parameters. order : int ...
[ "Function", "to", "fit", "Fourier", "Series", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L360-L379
[ "def", "fourier_series", "(", "self", ",", "pars", ",", "x", ",", "order", ")", ":", "sum", "=", "pars", "[", "0", "]", "for", "i", "in", "range", "(", "order", ")", ":", "sum", "+=", "pars", "[", "i", "*", "2", "+", "1", "]", "*", "np", "....
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_stetson_k
Return Stetson K feature. Parameters ---------- mag : array_like An array of magnitude. avg : float An average value of magnitudes. err : array_like An array of magnitude errors. Returns ------- stetson_k : float ...
upsilon/extract_features/extract_features.py
def get_stetson_k(self, mag, avg, err): """ Return Stetson K feature. Parameters ---------- mag : array_like An array of magnitude. avg : float An average value of magnitudes. err : array_like An array of magnitude errors. ...
def get_stetson_k(self, mag, avg, err): """ Return Stetson K feature. Parameters ---------- mag : array_like An array of magnitude. avg : float An average value of magnitudes. err : array_like An array of magnitude errors. ...
[ "Return", "Stetson", "K", "feature", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L381-L404
[ "def", "get_stetson_k", "(", "self", ",", "mag", ",", "avg", ",", "err", ")", ":", "residual", "=", "(", "mag", "-", "avg", ")", "/", "err", "stetson_k", "=", "np", ".", "sum", "(", "np", ".", "fabs", "(", "residual", ")", ")", "/", "np", ".", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.half_mag_amplitude_ratio
Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Parameters ---------- mag : array_like An ar...
upsilon/extract_features/extract_features.py
def half_mag_amplitude_ratio(self, mag, avg, weight): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. ...
def half_mag_amplitude_ratio(self, mag, avg, weight): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. ...
[ "Return", "ratio", "of", "amplitude", "of", "higher", "and", "lower", "magnitudes", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L406-L449
[ "def", "half_mag_amplitude_ratio", "(", "self", ",", "mag", ",", "avg", ",", "weight", ")", ":", "# For lower (fainter) magnitude than average.", "index", "=", "np", ".", "where", "(", "mag", ">", "avg", ")", "lower_weight", "=", "weight", "[", "index", "]", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.half_mag_amplitude_ratio2
Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Parameters ---------- mag : array_like An ar...
upsilon/extract_features/extract_features.py
def half_mag_amplitude_ratio2(self, mag, avg): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Param...
def half_mag_amplitude_ratio2(self, mag, avg): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Param...
[ "Return", "ratio", "of", "amplitude", "of", "higher", "and", "lower", "magnitudes", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L451-L486
[ "def", "half_mag_amplitude_ratio2", "(", "self", ",", "mag", ",", "avg", ")", ":", "# For lower (fainter) magnitude than average.", "index", "=", "np", ".", "where", "(", "mag", ">", "avg", ")", "fainter_mag", "=", "mag", "[", "index", "]", "lower_sum", "=", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_eta
Return Eta feature. Parameters ---------- mag : array_like An array of magnitudes. std : array_like A standard deviation of magnitudes. Returns ------- eta : float The value of Eta index.
upsilon/extract_features/extract_features.py
def get_eta(self, mag, std): """ Return Eta feature. Parameters ---------- mag : array_like An array of magnitudes. std : array_like A standard deviation of magnitudes. Returns ------- eta : float The value of ...
def get_eta(self, mag, std): """ Return Eta feature. Parameters ---------- mag : array_like An array of magnitudes. std : array_like A standard deviation of magnitudes. Returns ------- eta : float The value of ...
[ "Return", "Eta", "feature", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L488-L508
[ "def", "get_eta", "(", "self", ",", "mag", ",", "std", ")", ":", "diff", "=", "mag", "[", "1", ":", "]", "-", "mag", "[", ":", "len", "(", "mag", ")", "-", "1", "]", "eta", "=", "np", ".", "sum", "(", "diff", "*", "diff", ")", "/", "(", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.slope_percentile
Return 10% and 90% percentile of slope. Parameters ---------- date : array_like An array of phase-folded date. Sorted. mag : array_like An array of phase-folded magnitudes. Sorted by date. Returns ------- per_10 : float 10% pe...
upsilon/extract_features/extract_features.py
def slope_percentile(self, date, mag): """ Return 10% and 90% percentile of slope. Parameters ---------- date : array_like An array of phase-folded date. Sorted. mag : array_like An array of phase-folded magnitudes. Sorted by date. Return...
def slope_percentile(self, date, mag): """ Return 10% and 90% percentile of slope. Parameters ---------- date : array_like An array of phase-folded date. Sorted. mag : array_like An array of phase-folded magnitudes. Sorted by date. Return...
[ "Return", "10%", "and", "90%", "percentile", "of", "slope", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L510-L543
[ "def", "slope_percentile", "(", "self", ",", "date", ",", "mag", ")", ":", "date_diff", "=", "date", "[", "1", ":", "]", "-", "date", "[", ":", "len", "(", "date", ")", "-", "1", "]", "mag_diff", "=", "mag", "[", "1", ":", "]", "-", "mag", "[...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_cusum
Return max - min of cumulative sum. Parameters ---------- mag : array_like An array of magnitudes. Returns ------- mm_cusum : float Max - min of cumulative sum.
upsilon/extract_features/extract_features.py
def get_cusum(self, mag): """ Return max - min of cumulative sum. Parameters ---------- mag : array_like An array of magnitudes. Returns ------- mm_cusum : float Max - min of cumulative sum. """ c = np.cumsum(mag ...
def get_cusum(self, mag): """ Return max - min of cumulative sum. Parameters ---------- mag : array_like An array of magnitudes. Returns ------- mm_cusum : float Max - min of cumulative sum. """ c = np.cumsum(mag ...
[ "Return", "max", "-", "min", "of", "cumulative", "sum", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L545-L562
[ "def", "get_cusum", "(", "self", ",", "mag", ")", ":", "c", "=", "np", ".", "cumsum", "(", "mag", "-", "self", ".", "weighted_mean", ")", "/", "len", "(", "mag", ")", "/", "self", ".", "weighted_std", "return", "np", ".", "max", "(", "c", ")", ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_features2
Return all features with its names. Returns ------- names : list Feature names. values : list Feature values
upsilon/extract_features/extract_features.py
def get_features2(self): """ Return all features with its names. Returns ------- names : list Feature names. values : list Feature values """ feature_names = [] feature_values = [] # Get all the names of features....
def get_features2(self): """ Return all features with its names. Returns ------- names : list Feature names. values : list Feature values """ feature_names = [] feature_values = [] # Get all the names of features....
[ "Return", "all", "features", "with", "its", "names", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L564-L600
[ "def", "get_features2", "(", "self", ")", ":", "feature_names", "=", "[", "]", "feature_values", "=", "[", "]", "# Get all the names of features.", "all_vars", "=", "vars", "(", "self", ")", "for", "name", "in", "all_vars", ".", "keys", "(", ")", ":", "# O...
5f381453f26582ef56e62fb8fed7317ce67861af
train
ExtractFeatures.get_features_all
Return all features with its names. Regardless of being used for train and prediction. Sorted by the names. Returns ------- all_features : OrderedDict Features dictionary.
upsilon/extract_features/extract_features.py
def get_features_all(self): """ Return all features with its names. Regardless of being used for train and prediction. Sorted by the names. Returns ------- all_features : OrderedDict Features dictionary. """ features = {} # Get all ...
def get_features_all(self): """ Return all features with its names. Regardless of being used for train and prediction. Sorted by the names. Returns ------- all_features : OrderedDict Features dictionary. """ features = {} # Get all ...
[ "Return", "all", "features", "with", "its", "names", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L631-L654
[ "def", "get_features_all", "(", "self", ")", ":", "features", "=", "{", "}", "# Get all the names of features.", "all_vars", "=", "vars", "(", "self", ")", "for", "name", "in", "all_vars", ".", "keys", "(", ")", ":", "if", "name", "in", "feature_names_list_a...
5f381453f26582ef56e62fb8fed7317ce67861af
train
init
Initialize Hebel. This function creates a CUDA context, CUBLAS context and initializes and seeds the pseudo-random number generator. **Parameters:** device_id : integer, optional The ID of the GPU device to use. If this is omitted, PyCUDA's default context is used, which by defaul...
hebel/__init__.py
def init(device_id=None, random_seed=None): """Initialize Hebel. This function creates a CUDA context, CUBLAS context and initializes and seeds the pseudo-random number generator. **Parameters:** device_id : integer, optional The ID of the GPU device to use. If this is omitted, PyCUDA...
def init(device_id=None, random_seed=None): """Initialize Hebel. This function creates a CUDA context, CUBLAS context and initializes and seeds the pseudo-random number generator. **Parameters:** device_id : integer, optional The ID of the GPU device to use. If this is omitted, PyCUDA...
[ "Initialize", "Hebel", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/__init__.py#L96-L143
[ "def", "init", "(", "device_id", "=", "None", ",", "random_seed", "=", "None", ")", ":", "if", "device_id", "is", "None", ":", "random_seed", "=", "_os", ".", "environ", ".", "get", "(", "'CUDA_DEVICE'", ")", "if", "random_seed", "is", "None", ":", "ra...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
inflate_context_tuple
Instantiate a Tuple from a TupleNode. Walking the AST tree upwards, evaluate from the root down again.
gcl/ast_util.py
def inflate_context_tuple(ast_rootpath, root_env): """Instantiate a Tuple from a TupleNode. Walking the AST tree upwards, evaluate from the root down again. """ with util.LogTime('inflate_context_tuple'): # We only need to look at tuple members going down. inflated = ast_rootpath[0].eval(root_env) ...
def inflate_context_tuple(ast_rootpath, root_env): """Instantiate a Tuple from a TupleNode. Walking the AST tree upwards, evaluate from the root down again. """ with util.LogTime('inflate_context_tuple'): # We only need to look at tuple members going down. inflated = ast_rootpath[0].eval(root_env) ...
[ "Instantiate", "a", "Tuple", "from", "a", "TupleNode", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L24-L52
[ "def", "inflate_context_tuple", "(", "ast_rootpath", ",", "root_env", ")", ":", "with", "util", ".", "LogTime", "(", "'inflate_context_tuple'", ")", ":", "# We only need to look at tuple members going down.", "inflated", "=", "ast_rootpath", "[", "0", "]", ".", "eval"...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
enumerate_scope
Return a dict of { name => Completions } for the given tuple node. Enumerates all keys that are in scope in a given tuple. The node part of the tuple may be None, in case the binding is a built-in.
gcl/ast_util.py
def enumerate_scope(ast_rootpath, root_env=None, include_default_builtins=False): """Return a dict of { name => Completions } for the given tuple node. Enumerates all keys that are in scope in a given tuple. The node part of the tuple may be None, in case the binding is a built-in. """ with util.LogTime('enu...
def enumerate_scope(ast_rootpath, root_env=None, include_default_builtins=False): """Return a dict of { name => Completions } for the given tuple node. Enumerates all keys that are in scope in a given tuple. The node part of the tuple may be None, in case the binding is a built-in. """ with util.LogTime('enu...
[ "Return", "a", "dict", "of", "{", "name", "=", ">", "Completions", "}", "for", "the", "given", "tuple", "node", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L75-L98
[ "def", "enumerate_scope", "(", "ast_rootpath", ",", "root_env", "=", "None", ",", "include_default_builtins", "=", "False", ")", ":", "with", "util", ".", "LogTime", "(", "'enumerate_scope'", ")", ":", "scope", "=", "{", "}", "for", "node", "in", "reversed",...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
find_deref_completions
Returns a dict of { name => Completions }.
gcl/ast_util.py
def find_deref_completions(ast_rootpath, root_env=gcl.default_env): """Returns a dict of { name => Completions }.""" with util.LogTime('find_deref_completions'): tup = inflate_context_tuple(ast_rootpath, root_env) path = path_until(ast_rootpath, is_deref_node) if not path: return {} deref = pa...
def find_deref_completions(ast_rootpath, root_env=gcl.default_env): """Returns a dict of { name => Completions }.""" with util.LogTime('find_deref_completions'): tup = inflate_context_tuple(ast_rootpath, root_env) path = path_until(ast_rootpath, is_deref_node) if not path: return {} deref = pa...
[ "Returns", "a", "dict", "of", "{", "name", "=", ">", "Completions", "}", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L122-L133
[ "def", "find_deref_completions", "(", "ast_rootpath", ",", "root_env", "=", "gcl", ".", "default_env", ")", ":", "with", "util", ".", "LogTime", "(", "'find_deref_completions'", ")", ":", "tup", "=", "inflate_context_tuple", "(", "ast_rootpath", ",", "root_env", ...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
is_identifier_position
Return whether the cursor is in identifier-position in a member declaration.
gcl/ast_util.py
def is_identifier_position(rootpath): """Return whether the cursor is in identifier-position in a member declaration.""" if len(rootpath) >= 2 and is_tuple_member_node(rootpath[-2]) and is_identifier(rootpath[-1]): return True if len(rootpath) >= 1 and is_tuple_node(rootpath[-1]): # No deeper node than tu...
def is_identifier_position(rootpath): """Return whether the cursor is in identifier-position in a member declaration.""" if len(rootpath) >= 2 and is_tuple_member_node(rootpath[-2]) and is_identifier(rootpath[-1]): return True if len(rootpath) >= 1 and is_tuple_node(rootpath[-1]): # No deeper node than tu...
[ "Return", "whether", "the", "cursor", "is", "in", "identifier", "-", "position", "in", "a", "member", "declaration", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L141-L148
[ "def", "is_identifier_position", "(", "rootpath", ")", ":", "if", "len", "(", "rootpath", ")", ">=", "2", "and", "is_tuple_member_node", "(", "rootpath", "[", "-", "2", "]", ")", "and", "is_identifier", "(", "rootpath", "[", "-", "1", "]", ")", ":", "r...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
find_completions_at_cursor
Find completions at the cursor. Return a dict of { name => Completion } objects.
gcl/ast_util.py
def find_completions_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find completions at the cursor. Return a dict of { name => Completion } objects. """ q = gcl.SourceQuery(filename, line, col - 1) rootpath = ast_tree.find_tokens(q) if is_identifier_position(rootpath): return f...
def find_completions_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find completions at the cursor. Return a dict of { name => Completion } objects. """ q = gcl.SourceQuery(filename, line, col - 1) rootpath = ast_tree.find_tokens(q) if is_identifier_position(rootpath): return f...
[ "Find", "completions", "at", "the", "cursor", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L151-L168
[ "def", "find_completions_at_cursor", "(", "ast_tree", ",", "filename", ",", "line", ",", "col", ",", "root_env", "=", "gcl", ".", "default_env", ")", ":", "q", "=", "gcl", ".", "SourceQuery", "(", "filename", ",", "line", ",", "col", "-", "1", ")", "ro...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
find_inherited_key_completions
Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple.
gcl/ast_util.py
def find_inherited_key_completions(rootpath, root_env): """Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple. """ tup = inflate_context_tuple(rootpath, root_env) if is...
def find_inherited_key_completions(rootpath, root_env): """Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple. """ tup = inflate_context_tuple(rootpath, root_env) if is...
[ "Return", "completion", "keys", "from", "INHERITED", "tuples", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L171-L181
[ "def", "find_inherited_key_completions", "(", "rootpath", ",", "root_env", ")", ":", "tup", "=", "inflate_context_tuple", "(", "rootpath", ",", "root_env", ")", "if", "isinstance", "(", "tup", ",", "runtime", ".", "CompositeTuple", ")", ":", "keys", "=", "set"...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
find_value_at_cursor
Find the value of the object under the cursor.
gcl/ast_util.py
def find_value_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find the value of the object under the cursor.""" q = gcl.SourceQuery(filename, line, col) rootpath = ast_tree.find_tokens(q) rootpath = path_until(rootpath, is_thunk) if len(rootpath) <= 1: # Just the file tuple itself...
def find_value_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find the value of the object under the cursor.""" q = gcl.SourceQuery(filename, line, col) rootpath = ast_tree.find_tokens(q) rootpath = path_until(rootpath, is_thunk) if len(rootpath) <= 1: # Just the file tuple itself...
[ "Find", "the", "value", "of", "the", "object", "under", "the", "cursor", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L184-L202
[ "def", "find_value_at_cursor", "(", "ast_tree", ",", "filename", ",", "line", ",", "col", ",", "root_env", "=", "gcl", ".", "default_env", ")", ":", "q", "=", "gcl", ".", "SourceQuery", "(", "filename", ",", "line", ",", "col", ")", "rootpath", "=", "a...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
add_vec_to_mat
Add a vector to a matrix
hebel/pycuda_ops/matrix.py
def add_vec_to_mat(mat, vec, axis=None, inplace=False, target=None, substract=False): """ Add a vector to a matrix """ assert mat.flags.c_contiguous if axis is None: if vec.shape[0] == mat.shape[0]: axis = 0 elif vec.shape[0] == mat.shape[1]: ...
def add_vec_to_mat(mat, vec, axis=None, inplace=False, target=None, substract=False): """ Add a vector to a matrix """ assert mat.flags.c_contiguous if axis is None: if vec.shape[0] == mat.shape[0]: axis = 0 elif vec.shape[0] == mat.shape[1]: ...
[ "Add", "a", "vector", "to", "a", "matrix" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/matrix.py#L130-L179
[ "def", "add_vec_to_mat", "(", "mat", ",", "vec", ",", "axis", "=", "None", ",", "inplace", "=", "False", ",", "target", "=", "None", ",", "substract", "=", "False", ")", ":", "assert", "mat", ".", "flags", ".", "c_contiguous", "if", "axis", "is", "No...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
vector_normalize
Normalize each column vector in mat to length max_vec_norm if it is longer than max_vec_norm
hebel/pycuda_ops/matrix.py
def vector_normalize(mat, max_vec_norm=1.): """ Normalize each column vector in mat to length max_vec_norm if it is longer than max_vec_norm """ assert mat.flags.c_contiguous n, m = mat.shape vector_normalize_kernel.prepared_call( (m, 1, 1), (32, 1, 1), mat.gpudata, np.f...
def vector_normalize(mat, max_vec_norm=1.): """ Normalize each column vector in mat to length max_vec_norm if it is longer than max_vec_norm """ assert mat.flags.c_contiguous n, m = mat.shape vector_normalize_kernel.prepared_call( (m, 1, 1), (32, 1, 1), mat.gpudata, np.f...
[ "Normalize", "each", "column", "vector", "in", "mat", "to", "length", "max_vec_norm", "if", "it", "is", "longer", "than", "max_vec_norm" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/matrix.py#L182-L194
[ "def", "vector_normalize", "(", "mat", ",", "max_vec_norm", "=", "1.", ")", ":", "assert", "mat", ".", "flags", ".", "c_contiguous", "n", ",", "m", "=", "mat", ".", "shape", "vector_normalize_kernel", ".", "prepared_call", "(", "(", "m", ",", "1", ",", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
preprocess
Preprocesses a string, by replacing ${VARNAME} with os.environ['VARNAME'] Parameters ---------- string: the str object to preprocess Returns ------- the preprocessed string
hebel/utils/string_utils.py
def preprocess(string): """ Preprocesses a string, by replacing ${VARNAME} with os.environ['VARNAME'] Parameters ---------- string: the str object to preprocess Returns ------- the preprocessed string """ split = string.split('${') rval = [split[0]] for candidate...
def preprocess(string): """ Preprocesses a string, by replacing ${VARNAME} with os.environ['VARNAME'] Parameters ---------- string: the str object to preprocess Returns ------- the preprocessed string """ split = string.split('${') rval = [split[0]] for candidate...
[ "Preprocesses", "a", "string", "by", "replacing", "$", "{", "VARNAME", "}", "with", "os", ".", "environ", "[", "VARNAME", "]" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L26-L77
[ "def", "preprocess", "(", "string", ")", ":", "split", "=", "string", ".", "split", "(", "'${'", ")", "rval", "=", "[", "split", "[", "0", "]", "]", "for", "candidate", "in", "split", "[", "1", ":", "]", ":", "subsplit", "=", "candidate", ".", "s...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
tokenize_by_number
splits a string into a list of tokens each is either a string containing no numbers or a float
hebel/utils/string_utils.py
def tokenize_by_number(s): """ splits a string into a list of tokens each is either a string containing no numbers or a float """ r = find_number(s) if r == None: return [ s ] else: tokens = [] if r[0] > 0: tokens.append(s[0:r[0]]) tokens.app...
def tokenize_by_number(s): """ splits a string into a list of tokens each is either a string containing no numbers or a float """ r = find_number(s) if r == None: return [ s ] else: tokens = [] if r[0] > 0: tokens.append(s[0:r[0]]) tokens.app...
[ "splits", "a", "string", "into", "a", "list", "of", "tokens", "each", "is", "either", "a", "string", "containing", "no", "numbers", "or", "a", "float" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L93-L110
[ "def", "tokenize_by_number", "(", "s", ")", ":", "r", "=", "find_number", "(", "s", ")", "if", "r", "==", "None", ":", "return", "[", "s", "]", "else", ":", "tokens", "=", "[", "]", "if", "r", "[", "0", "]", ">", "0", ":", "tokens", ".", "app...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
number_aware_alphabetical_cmp
cmp function for sorting a list of strings by alphabetical order, but with numbers sorted numerically. i.e., foo1, foo2, foo10, foo11 instead of foo1, foo10
hebel/utils/string_utils.py
def number_aware_alphabetical_cmp(str1, str2): """ cmp function for sorting a list of strings by alphabetical order, but with numbers sorted numerically. i.e., foo1, foo2, foo10, foo11 instead of foo1, foo10 """ def flatten_tokens(tokens): l = [] for token in tokens...
def number_aware_alphabetical_cmp(str1, str2): """ cmp function for sorting a list of strings by alphabetical order, but with numbers sorted numerically. i.e., foo1, foo2, foo10, foo11 instead of foo1, foo10 """ def flatten_tokens(tokens): l = [] for token in tokens...
[ "cmp", "function", "for", "sorting", "a", "list", "of", "strings", "by", "alphabetical", "order", "but", "with", "numbers", "sorted", "numerically", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L113-L151
[ "def", "number_aware_alphabetical_cmp", "(", "str1", ",", "str2", ")", ":", "def", "flatten_tokens", "(", "tokens", ")", ":", "l", "=", "[", "]", "for", "token", "in", "tokens", ":", "if", "isinstance", "(", "token", ",", "str", ")", ":", "for", "char"...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
match
wrong: a mispelling candidates: a set of correct words returns a guess of which candidate is the right one This should be used with a small number of candidates and a high potential edit distance. ie, use it to correct a wrong filename in a directory, wrong class name i...
hebel/utils/string_utils.py
def match(wrong, candidates): """ wrong: a mispelling candidates: a set of correct words returns a guess of which candidate is the right one This should be used with a small number of candidates and a high potential edit distance. ie, use it to correct a wrong filen...
def match(wrong, candidates): """ wrong: a mispelling candidates: a set of correct words returns a guess of which candidate is the right one This should be used with a small number of candidates and a high potential edit distance. ie, use it to correct a wrong filen...
[ "wrong", ":", "a", "mispelling", "candidates", ":", "a", "set", "of", "correct", "words" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L153-L219
[ "def", "match", "(", "wrong", ",", "candidates", ")", ":", "assert", "len", "(", "candidates", ")", ">", "0", "# Current implementation tries all candidates and outputs the one", "# with the min score", "# Could try to do something smarter", "def", "score", "(", "w1", ","...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
censor_non_alphanum
Returns s with all non-alphanumeric characters replaced with *
hebel/utils/string_utils.py
def censor_non_alphanum(s): """ Returns s with all non-alphanumeric characters replaced with * """ def censor(ch): if (ch >= 'A' and ch <= 'z') or (ch >= '0' and ch <= '9'): return ch return '*' return ''.join([censor(ch) for ch in s])
def censor_non_alphanum(s): """ Returns s with all non-alphanumeric characters replaced with * """ def censor(ch): if (ch >= 'A' and ch <= 'z') or (ch >= '0' and ch <= '9'): return ch return '*' return ''.join([censor(ch) for ch in s])
[ "Returns", "s", "with", "all", "non", "-", "alphanumeric", "characters", "replaced", "with", "*" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L221-L231
[ "def", "censor_non_alphanum", "(", "s", ")", ":", "def", "censor", "(", "ch", ")", ":", "if", "(", "ch", ">=", "'A'", "and", "ch", "<=", "'z'", ")", "or", "(", "ch", ">=", "'0'", "and", "ch", "<=", "'9'", ")", ":", "return", "ch", "return", "'*...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
is_period_alias
Check if a given period is possibly an alias. Parameters ---------- period : float A period to test if it is a possible alias or not. Returns ------- is_alias : boolean True if the given period is in a range of period alias.
upsilon/extract_features/is_period_alias.py
def is_period_alias(period): """ Check if a given period is possibly an alias. Parameters ---------- period : float A period to test if it is a possible alias or not. Returns ------- is_alias : boolean True if the given period is in a range of period alias. """ ...
def is_period_alias(period): """ Check if a given period is possibly an alias. Parameters ---------- period : float A period to test if it is a possible alias or not. Returns ------- is_alias : boolean True if the given period is in a range of period alias. """ ...
[ "Check", "if", "a", "given", "period", "is", "possibly", "an", "alias", "." ]
dwkim78/upsilon
python
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/is_period_alias.py#L1-L57
[ "def", "is_period_alias", "(", "period", ")", ":", "# Based on the period vs periodSN plot of EROS-2 dataset (Kim+ 2014).", "# Period alias occurs mostly at ~1 and ~30.", "# Check each 1, 2, 3, 4, 5 factors.", "for", "i", "in", "range", "(", "1", ",", "6", ")", ":", "# One-day ...
5f381453f26582ef56e62fb8fed7317ce67861af
train
save
Serialize `object` to a file denoted by `filepath`. Parameters ---------- filepath : str A filename. If the suffix is `.joblib` and joblib can be imported, `joblib.dump` is used in place of the regular pickling mechanisms; this results in much faster saves by saving arrays a...
hebel/utils/serial.py
def save(filepath, obj, on_overwrite = 'ignore'): """ Serialize `object` to a file denoted by `filepath`. Parameters ---------- filepath : str A filename. If the suffix is `.joblib` and joblib can be imported, `joblib.dump` is used in place of the regular pickling mechanisms...
def save(filepath, obj, on_overwrite = 'ignore'): """ Serialize `object` to a file denoted by `filepath`. Parameters ---------- filepath : str A filename. If the suffix is `.joblib` and joblib can be imported, `joblib.dump` is used in place of the regular pickling mechanisms...
[ "Serialize", "object", "to", "a", "file", "denoted", "by", "filepath", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/serial.py#L177-L245
[ "def", "save", "(", "filepath", ",", "obj", ",", "on_overwrite", "=", "'ignore'", ")", ":", "filepath", "=", "preprocess", "(", "filepath", ")", "if", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "if", "on_overwrite", "==", "'backup'", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
get_pickle_protocol
Allow configuration of the pickle protocol on a per-machine basis. This way, if you use multiple platforms with different versions of pickle, you can configure each of them to use the highest protocol supported by all of the machines that you want to be able to communicate.
hebel/utils/serial.py
def get_pickle_protocol(): """ Allow configuration of the pickle protocol on a per-machine basis. This way, if you use multiple platforms with different versions of pickle, you can configure each of them to use the highest protocol supported by all of the machines that you want to be able to com...
def get_pickle_protocol(): """ Allow configuration of the pickle protocol on a per-machine basis. This way, if you use multiple platforms with different versions of pickle, you can configure each of them to use the highest protocol supported by all of the machines that you want to be able to com...
[ "Allow", "configuration", "of", "the", "pickle", "protocol", "on", "a", "per", "-", "machine", "basis", ".", "This", "way", "if", "you", "use", "multiple", "platforms", "with", "different", "versions", "of", "pickle", "you", "can", "configure", "each", "of",...
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/serial.py#L248-L265
[ "def", "get_pickle_protocol", "(", ")", ":", "try", ":", "protocol_str", "=", "os", ".", "environ", "[", "'PYLEARN2_PICKLE_PROTOCOL'", "]", "except", "KeyError", ":", "# If not defined, we default to 0 because this is the default", "# protocol used by cPickle.dump (and because ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
load_train_file
Loads and parses a yaml file for a Train object. Publishes the relevant training environment variables
hebel/utils/serial.py
def load_train_file(config_file_path): """Loads and parses a yaml file for a Train object. Publishes the relevant training environment variables""" from pylearn2.config import yaml_parse suffix_to_strip = '.yaml' # publish environment variables related to file name if config_file_path.endswith...
def load_train_file(config_file_path): """Loads and parses a yaml file for a Train object. Publishes the relevant training environment variables""" from pylearn2.config import yaml_parse suffix_to_strip = '.yaml' # publish environment variables related to file name if config_file_path.endswith...
[ "Loads", "and", "parses", "a", "yaml", "file", "for", "a", "Train", "object", ".", "Publishes", "the", "relevant", "training", "environment", "variables" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/serial.py#L426-L451
[ "def", "load_train_file", "(", "config_file_path", ")", ":", "from", "pylearn2", ".", "config", "import", "yaml_parse", "suffix_to_strip", "=", "'.yaml'", "# publish environment variables related to file name", "if", "config_file_path", ".", "endswith", "(", "suffix_to_stri...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
InputDropout.feed_forward
Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. prediction : bool, optional Whether to use prediction model. If true, then the data is scaled by ``1 - dropout_probability`` uses dropout. ...
hebel/layers/input_dropout.py
def feed_forward(self, input_data, prediction=False): """Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. prediction : bool, optional Whether to use prediction model. If true, then the data is ...
def feed_forward(self, input_data, prediction=False): """Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. prediction : bool, optional Whether to use prediction model. If true, then the data is ...
[ "Propagate", "forward", "through", "the", "layer" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/input_dropout.py#L59-L89
[ "def", "feed_forward", "(", "self", ",", "input_data", ",", "prediction", "=", "False", ")", ":", "if", "input_data", ".", "shape", "[", "1", "]", "!=", "self", ".", "n_in", ":", "raise", "ValueError", "(", "'Number of outputs from previous layer (%d) '", "'do...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
InputDropout.backprop
Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. df_output : ``GPUArray`` Gradients with respect to the output of this layer (received from the layer above). cache : list of ``GPUAr...
hebel/layers/input_dropout.py
def backprop(self, input_data, df_output, cache=None): """ Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. df_output : ``GPUArray`` Gradients with respect to the output of this layer ...
def backprop(self, input_data, df_output, cache=None): """ Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. df_output : ``GPUArray`` Gradients with respect to the output of this layer ...
[ "Backpropagate", "through", "the", "hidden", "layer" ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/input_dropout.py#L91-L119
[ "def", "backprop", "(", "self", ",", "input_data", ",", "df_output", ",", "cache", "=", "None", ")", ":", "if", "self", ".", "compute_input_gradients", ":", "apply_dropout_mask", "(", "df_output", ",", "dropout_mask", ")", "return", "tuple", "(", ")", ",", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
POINTER
Create ctypes pointer to object. Notes ----- This function converts None to a real NULL pointer because of bug in how ctypes handles None on 64-bit platforms.
hebel/pycuda_ops/cudart.py
def POINTER(obj): """ Create ctypes pointer to object. Notes ----- This function converts None to a real NULL pointer because of bug in how ctypes handles None on 64-bit platforms. """ p = ctypes.POINTER(obj) if not isinstance(p.from_param, classmethod): def from_param(cls...
def POINTER(obj): """ Create ctypes pointer to object. Notes ----- This function converts None to a real NULL pointer because of bug in how ctypes handles None on 64-bit platforms. """ p = ctypes.POINTER(obj) if not isinstance(p.from_param, classmethod): def from_param(cls...
[ "Create", "ctypes", "pointer", "to", "object", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L63-L83
[ "def", "POINTER", "(", "obj", ")", ":", "p", "=", "ctypes", ".", "POINTER", "(", "obj", ")", "if", "not", "isinstance", "(", "p", ".", "from_param", ",", "classmethod", ")", ":", "def", "from_param", "(", "cls", ",", "x", ")", ":", "if", "x", "is...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
gpuarray_ptr
Return ctypes pointer to data in GPUAarray object.
hebel/pycuda_ops/cudart.py
def gpuarray_ptr(g): """ Return ctypes pointer to data in GPUAarray object. """ addr = int(g.gpudata) if g.dtype == np.int8: return ctypes.cast(addr, POINTER(ctypes.c_byte)) if g.dtype == np.uint8: return ctypes.cast(addr, POINTER(ctypes.c_ubyte)) if g.dtype == np.int16: ...
def gpuarray_ptr(g): """ Return ctypes pointer to data in GPUAarray object. """ addr = int(g.gpudata) if g.dtype == np.int8: return ctypes.cast(addr, POINTER(ctypes.c_byte)) if g.dtype == np.uint8: return ctypes.cast(addr, POINTER(ctypes.c_ubyte)) if g.dtype == np.int16: ...
[ "Return", "ctypes", "pointer", "to", "data", "in", "GPUAarray", "object", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L108-L140
[ "def", "gpuarray_ptr", "(", "g", ")", ":", "addr", "=", "int", "(", "g", ".", "gpudata", ")", "if", "g", ".", "dtype", "==", "np", ".", "int8", ":", "return", "ctypes", ".", "cast", "(", "addr", ",", "POINTER", "(", "ctypes", ".", "c_byte", ")", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaMalloc
Allocate device memory. Allocate memory on the device associated with the current active context. Parameters ---------- count : int Number of bytes of memory to allocate ctype : _ctypes.SimpleType, optional ctypes type to cast returned pointer. Returns ------- ptr ...
hebel/pycuda_ops/cudart.py
def cudaMalloc(count, ctype=None): """ Allocate device memory. Allocate memory on the device associated with the current active context. Parameters ---------- count : int Number of bytes of memory to allocate ctype : _ctypes.SimpleType, optional ctypes type to cast retu...
def cudaMalloc(count, ctype=None): """ Allocate device memory. Allocate memory on the device associated with the current active context. Parameters ---------- count : int Number of bytes of memory to allocate ctype : _ctypes.SimpleType, optional ctypes type to cast retu...
[ "Allocate", "device", "memory", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L485-L511
[ "def", "cudaMalloc", "(", "count", ",", "ctype", "=", "None", ")", ":", "ptr", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudart", ".", "cudaMalloc", "(", "ctypes", ".", "byref", "(", "ptr", ")", ",", "count", ")", "cudaCheckStatus",...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaMallocPitch
Allocate pitched device memory. Allocate pitched memory on the device associated with the current active context. Parameters ---------- pitch : int Pitch for allocation. rows : int Requested pitched allocation height. cols : int Requested pitched allocation width. ...
hebel/pycuda_ops/cudart.py
def cudaMallocPitch(pitch, rows, cols, elesize): """ Allocate pitched device memory. Allocate pitched memory on the device associated with the current active context. Parameters ---------- pitch : int Pitch for allocation. rows : int Requested pitched allocation height....
def cudaMallocPitch(pitch, rows, cols, elesize): """ Allocate pitched device memory. Allocate pitched memory on the device associated with the current active context. Parameters ---------- pitch : int Pitch for allocation. rows : int Requested pitched allocation height....
[ "Allocate", "pitched", "device", "memory", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L536-L566
[ "def", "cudaMallocPitch", "(", "pitch", ",", "rows", ",", "cols", ",", "elesize", ")", ":", "ptr", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudart", ".", "cudaMallocPitch", "(", "ctypes", ".", "byref", "(", "ptr", ")", ",", "ctypes...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaMemcpy_htod
Copy memory from host to device. Copy data from host memory to device memory. Parameters ---------- dst : ctypes pointer Device memory pointer. src : ctypes pointer Host memory pointer. count : int Number of bytes to copy.
hebel/pycuda_ops/cudart.py
def cudaMemcpy_htod(dst, src, count): """ Copy memory from host to device. Copy data from host memory to device memory. Parameters ---------- dst : ctypes pointer Device memory pointer. src : ctypes pointer Host memory pointer. count : int Number of bytes to cop...
def cudaMemcpy_htod(dst, src, count): """ Copy memory from host to device. Copy data from host memory to device memory. Parameters ---------- dst : ctypes pointer Device memory pointer. src : ctypes pointer Host memory pointer. count : int Number of bytes to cop...
[ "Copy", "memory", "from", "host", "to", "device", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L578-L598
[ "def", "cudaMemcpy_htod", "(", "dst", ",", "src", ",", "count", ")", ":", "status", "=", "_libcudart", ".", "cudaMemcpy", "(", "dst", ",", "src", ",", "ctypes", ".", "c_size_t", "(", "count", ")", ",", "cudaMemcpyHostToDevice", ")", "cudaCheckStatus", "(",...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaMemcpy_dtoh
Copy memory from device to host. Copy data from device memory to host memory. Parameters ---------- dst : ctypes pointer Host memory pointer. src : ctypes pointer Device memory pointer. count : int Number of bytes to copy.
hebel/pycuda_ops/cudart.py
def cudaMemcpy_dtoh(dst, src, count): """ Copy memory from device to host. Copy data from device memory to host memory. Parameters ---------- dst : ctypes pointer Host memory pointer. src : ctypes pointer Device memory pointer. count : int Number of bytes to cop...
def cudaMemcpy_dtoh(dst, src, count): """ Copy memory from device to host. Copy data from device memory to host memory. Parameters ---------- dst : ctypes pointer Host memory pointer. src : ctypes pointer Device memory pointer. count : int Number of bytes to cop...
[ "Copy", "memory", "from", "device", "to", "host", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L600-L620
[ "def", "cudaMemcpy_dtoh", "(", "dst", ",", "src", ",", "count", ")", ":", "status", "=", "_libcudart", ".", "cudaMemcpy", "(", "dst", ",", "src", ",", "ctypes", ".", "c_size_t", "(", "count", ")", ",", "cudaMemcpyDeviceToHost", ")", "cudaCheckStatus", "(",...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaMemGetInfo
Return the amount of free and total device memory. Returns ------- free : long Free memory in bytes. total : long Total memory in bytes.
hebel/pycuda_ops/cudart.py
def cudaMemGetInfo(): """ Return the amount of free and total device memory. Returns ------- free : long Free memory in bytes. total : long Total memory in bytes. """ free = ctypes.c_size_t() total = ctypes.c_size_t() status = _libcudart.cudaMemGetInfo(ctypes.b...
def cudaMemGetInfo(): """ Return the amount of free and total device memory. Returns ------- free : long Free memory in bytes. total : long Total memory in bytes. """ free = ctypes.c_size_t() total = ctypes.c_size_t() status = _libcudart.cudaMemGetInfo(ctypes.b...
[ "Return", "the", "amount", "of", "free", "and", "total", "device", "memory", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L625-L643
[ "def", "cudaMemGetInfo", "(", ")", ":", "free", "=", "ctypes", ".", "c_size_t", "(", ")", "total", "=", "ctypes", ".", "c_size_t", "(", ")", "status", "=", "_libcudart", ".", "cudaMemGetInfo", "(", "ctypes", ".", "byref", "(", "free", ")", ",", "ctypes...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaGetDevice
Get current CUDA device. Return the identifying number of the device currently used to process CUDA operations. Returns ------- dev : int Device number.
hebel/pycuda_ops/cudart.py
def cudaGetDevice(): """ Get current CUDA device. Return the identifying number of the device currently used to process CUDA operations. Returns ------- dev : int Device number. """ dev = ctypes.c_int() status = _libcudart.cudaGetDevice(ctypes.byref(dev)) cudaChec...
def cudaGetDevice(): """ Get current CUDA device. Return the identifying number of the device currently used to process CUDA operations. Returns ------- dev : int Device number. """ dev = ctypes.c_int() status = _libcudart.cudaGetDevice(ctypes.byref(dev)) cudaChec...
[ "Get", "current", "CUDA", "device", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L665-L682
[ "def", "cudaGetDevice", "(", ")", ":", "dev", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudart", ".", "cudaGetDevice", "(", "ctypes", ".", "byref", "(", "dev", ")", ")", "cudaCheckStatus", "(", "status", ")", "return", "dev", ".", "val...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaDriverGetVersion
Get installed CUDA driver version. Return the version of the installed CUDA driver as an integer. If no driver is detected, 0 is returned. Returns ------- version : int Driver version.
hebel/pycuda_ops/cudart.py
def cudaDriverGetVersion(): """ Get installed CUDA driver version. Return the version of the installed CUDA driver as an integer. If no driver is detected, 0 is returned. Returns ------- version : int Driver version. """ version = ctypes.c_int() status = _libcudart.cu...
def cudaDriverGetVersion(): """ Get installed CUDA driver version. Return the version of the installed CUDA driver as an integer. If no driver is detected, 0 is returned. Returns ------- version : int Driver version. """ version = ctypes.c_int() status = _libcudart.cu...
[ "Get", "installed", "CUDA", "driver", "version", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L686-L703
[ "def", "cudaDriverGetVersion", "(", ")", ":", "version", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudart", ".", "cudaDriverGetVersion", "(", "ctypes", ".", "byref", "(", "version", ")", ")", "cudaCheckStatus", "(", "status", ")", "return", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
cudaPointerGetAttributes
Get memory pointer attributes. Returns attributes of the specified pointer. Parameters ---------- ptr : ctypes pointer Memory pointer to examine. Returns ------- memory_type : int Memory type; 1 indicates host memory, 2 indicates device memory. device : int ...
hebel/pycuda_ops/cudart.py
def cudaPointerGetAttributes(ptr): """ Get memory pointer attributes. Returns attributes of the specified pointer. Parameters ---------- ptr : ctypes pointer Memory pointer to examine. Returns ------- memory_type : int Memory type; 1 indicates host memory, 2 indica...
def cudaPointerGetAttributes(ptr): """ Get memory pointer attributes. Returns attributes of the specified pointer. Parameters ---------- ptr : ctypes pointer Memory pointer to examine. Returns ------- memory_type : int Memory type; 1 indicates host memory, 2 indica...
[ "Get", "memory", "pointer", "attributes", "." ]
hannes-brt/hebel
python
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L720-L749
[ "def", "cudaPointerGetAttributes", "(", "ptr", ")", ":", "attributes", "=", "cudaPointerAttributes", "(", ")", "status", "=", "_libcudart", ".", "cudaPointerGetAttributes", "(", "ctypes", ".", "byref", "(", "attributes", ")", ",", "ptr", ")", "cudaCheckStatus", ...
1e2c3a9309c2646103901b26a55be4e312dd5005
train
eval
Evaluate a thunk in an environment. Will defer the actual evaluation to the thunk itself, but adds two things: caching and recursion detection. Since we have to use a global evaluation stack (because there is a variety of functions that may be invoked, not just eval() but also __getitem__, and not all of them...
gcl/framework.py
def eval(thunk, env): """Evaluate a thunk in an environment. Will defer the actual evaluation to the thunk itself, but adds two things: caching and recursion detection. Since we have to use a global evaluation stack (because there is a variety of functions that may be invoked, not just eval() but also __get...
def eval(thunk, env): """Evaluate a thunk in an environment. Will defer the actual evaluation to the thunk itself, but adds two things: caching and recursion detection. Since we have to use a global evaluation stack (because there is a variety of functions that may be invoked, not just eval() but also __get...
[ "Evaluate", "a", "thunk", "in", "an", "environment", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/framework.py#L30-L55
[ "def", "eval", "(", "thunk", ",", "env", ")", ":", "key", "=", "Activation", ".", "key", "(", "thunk", ",", "env", ")", "if", "Activation", ".", "activated", "(", "key", ")", ":", "raise", "exceptions", ".", "RecursionError", "(", "'Reference cycle'", ...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
Environment.get_node
Delegate to our current "value provider" for the node belonging to this key.
gcl/framework.py
def get_node(self, key): """Delegate to our current "value provider" for the node belonging to this key.""" if key in self.names: return self.values.get_member_node(key) if hasattr(self.values, 'get_member_node') else None return self.parent.get_node(key)
def get_node(self, key): """Delegate to our current "value provider" for the node belonging to this key.""" if key in self.names: return self.values.get_member_node(key) if hasattr(self.values, 'get_member_node') else None return self.parent.get_node(key)
[ "Delegate", "to", "our", "current", "value", "provider", "for", "the", "node", "belonging", "to", "this", "key", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/framework.py#L170-L174
[ "def", "get_node", "(", "self", ",", "key", ")", ":", "if", "key", "in", "self", ".", "names", ":", "return", "self", ".", "values", ".", "get_member_node", "(", "key", ")", "if", "hasattr", "(", "self", ".", "values", ",", "'get_member_node'", ")", ...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf
train
FakeModel.create_table
create_table Manually create a temporary table for model in test data base. :return:
django_fake_model/models.py
def create_table(cls): """ create_table Manually create a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with schema_editor() as schema_editor: sch...
def create_table(cls): """ create_table Manually create a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with schema_editor() as schema_editor: sch...
[ "create_table" ]
erm0l0v/django-fake-model
python
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L22-L43
[ "def", "create_table", "(", "cls", ")", ":", "schema_editor", "=", "getattr", "(", "connection", ",", "'schema_editor'", ",", "None", ")", "if", "schema_editor", ":", "with", "schema_editor", "(", ")", "as", "schema_editor", ":", "schema_editor", ".", "create_...
42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314
train
FakeModel.delete_table
delete_table Manually delete a temporary table for model in test data base. :return:
django_fake_model/models.py
def delete_table(cls): """ delete_table Manually delete a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with connection.schema_editor() as schema_editor: ...
def delete_table(cls): """ delete_table Manually delete a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with connection.schema_editor() as schema_editor: ...
[ "delete_table" ]
erm0l0v/django-fake-model
python
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L46-L64
[ "def", "delete_table", "(", "cls", ")", ":", "schema_editor", "=", "getattr", "(", "connection", ",", "'schema_editor'", ",", "None", ")", "if", "schema_editor", ":", "with", "connection", ".", "schema_editor", "(", ")", "as", "schema_editor", ":", "schema_edi...
42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314
train
FakeModel.fake_me
fake_me Class or method decorator Class decorator: create temporary table for all tests in SimpleTestCase. Method decorator: create temporary model only for given test method. :param source: SimpleTestCase or test function :return:
django_fake_model/models.py
def fake_me(cls, source): """ fake_me Class or method decorator Class decorator: create temporary table for all tests in SimpleTestCase. Method decorator: create temporary model only for given test method. :param source: SimpleTestCase or test function :return: ...
def fake_me(cls, source): """ fake_me Class or method decorator Class decorator: create temporary table for all tests in SimpleTestCase. Method decorator: create temporary model only for given test method. :param source: SimpleTestCase or test function :return: ...
[ "fake_me" ]
erm0l0v/django-fake-model
python
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L67-L83
[ "def", "fake_me", "(", "cls", ",", "source", ")", ":", "if", "source", "and", "type", "(", "source", ")", "==", "type", "and", "issubclass", "(", "source", ",", "SimpleTestCase", ")", ":", "return", "cls", ".", "_class_extension", "(", "source", ")", "...
42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314
train
vcr
Decorator for capturing and simulating network communication ``debug`` : bool, optional Enables debug mode. ``overwrite`` : bool, optional Will run vcr in recording mode - overwrites any existing vcrtapes. ``playback_only`` : bool, optional Will run vcr in playback mode - will not c...
vcr/core.py
def vcr(decorated_func=None, debug=False, overwrite=False, disabled=False, playback_only=False, tape_name=None): """ Decorator for capturing and simulating network communication ``debug`` : bool, optional Enables debug mode. ``overwrite`` : bool, optional Will run vcr in recordi...
def vcr(decorated_func=None, debug=False, overwrite=False, disabled=False, playback_only=False, tape_name=None): """ Decorator for capturing and simulating network communication ``debug`` : bool, optional Enables debug mode. ``overwrite`` : bool, optional Will run vcr in recordi...
[ "Decorator", "for", "capturing", "and", "simulating", "network", "communication" ]
obspy/vcr
python
https://github.com/obspy/vcr/blob/f961d3bffc57d1761b6de2fb1e67d5f464ebc6b6/vcr/core.py#L413-L555
[ "def", "vcr", "(", "decorated_func", "=", "None", ",", "debug", "=", "False", ",", "overwrite", "=", "False", ",", "disabled", "=", "False", ",", "playback_only", "=", "False", ",", "tape_name", "=", "None", ")", ":", "def", "_vcr_outer", "(", "func", ...
f961d3bffc57d1761b6de2fb1e67d5f464ebc6b6
train
VCRSystem.reset
Reset to default settings
vcr/core.py
def reset(cls): """ Reset to default settings """ cls.debug = False cls.disabled = False cls.overwrite = False cls.playback_only = False cls.recv_timeout = 5 cls.recv_endmarkers = [] cls.recv_size = None
def reset(cls): """ Reset to default settings """ cls.debug = False cls.disabled = False cls.overwrite = False cls.playback_only = False cls.recv_timeout = 5 cls.recv_endmarkers = [] cls.recv_size = None
[ "Reset", "to", "default", "settings" ]
obspy/vcr
python
https://github.com/obspy/vcr/blob/f961d3bffc57d1761b6de2fb1e67d5f464ebc6b6/vcr/core.py#L112-L122
[ "def", "reset", "(", "cls", ")", ":", "cls", ".", "debug", "=", "False", "cls", ".", "disabled", "=", "False", "cls", ".", "overwrite", "=", "False", "cls", ".", "playback_only", "=", "False", "cls", ".", "recv_timeout", "=", "5", "cls", ".", "recv_e...
f961d3bffc57d1761b6de2fb1e67d5f464ebc6b6
train
to_python
Reify values to their Python equivalents. Does recursion detection, failing when that happens.
gcl/util.py
def to_python(value, seen=None): """Reify values to their Python equivalents. Does recursion detection, failing when that happens. """ seen = seen or set() if isinstance(value, framework.TupleLike): if value.ident in seen: raise RecursionException('to_python: infinite recursion while evaluating %r'...
def to_python(value, seen=None): """Reify values to their Python equivalents. Does recursion detection, failing when that happens. """ seen = seen or set() if isinstance(value, framework.TupleLike): if value.ident in seen: raise RecursionException('to_python: infinite recursion while evaluating %r'...
[ "Reify", "values", "to", "their", "Python", "equivalents", "." ]
rix0rrr/gcl
python
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/util.py#L81-L96
[ "def", "to_python", "(", "value", ",", "seen", "=", "None", ")", ":", "seen", "=", "seen", "or", "set", "(", ")", "if", "isinstance", "(", "value", ",", "framework", ".", "TupleLike", ")", ":", "if", "value", ".", "ident", "in", "seen", ":", "raise...
4e3bccc978a9c60aaaffd20f6f291c4d23775cdf