repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
Locu-Unofficial/locu-python
locu/api.py
VenueApiClient.is_open
def is_open(self,id,time,day): """ Checks if the venue is open at the time of day given a venue id. args: id: string of venue id time: string of the format ex: "12:00:00" day: string of weekday ex: "Monday" returns: ...
python
def is_open(self,id,time,day): """ Checks if the venue is open at the time of day given a venue id. args: id: string of venue id time: string of the format ex: "12:00:00" day: string of weekday ex: "Monday" returns: ...
[ "def", "is_open", "(", "self", ",", "id", ",", "time", ",", "day", ")", ":", "details", "=", "self", ".", "get_details", "(", "id", ")", "has_data", "=", "False", "for", "obj", "in", "details", "[", "\"objects\"", "]", ":", "hours", "=", "obj", "["...
Checks if the venue is open at the time of day given a venue id. args: id: string of venue id time: string of the format ex: "12:00:00" day: string of weekday ex: "Monday" returns: Bool if there is hours data available ...
[ "Checks", "if", "the", "venue", "is", "open", "at", "the", "time", "of", "day", "given", "a", "venue", "id", "." ]
fcdf136b68333ab7055e623591801dd35df3bc45
https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L316-L356
train
Locu-Unofficial/locu-python
locu/api.py
MenuItemApiClient.search
def search(self, name = None, category = None, description = None, price = None, \ price__gt = None, price__gte = None, price__lt = None, price__lte = None, \ location = (None, None), radius = None, tl_coord = (None, None), \ br_coord = (None, None), country = No...
python
def search(self, name = None, category = None, description = None, price = None, \ price__gt = None, price__gte = None, price__lt = None, price__lte = None, \ location = (None, None), radius = None, tl_coord = (None, None), \ br_coord = (None, None), country = No...
[ "def", "search", "(", "self", ",", "name", "=", "None", ",", "category", "=", "None", ",", "description", "=", "None", ",", "price", "=", "None", ",", "price__gt", "=", "None", ",", "price__gte", "=", "None", ",", "price__lt", "=", "None", ",", "pric...
Locu Menu Item Search API Call Wrapper Args: *Note that none of the arguments are required category : List of category types that need to be filtered by: ['restaurant', 'spa', 'beauty salon', 'gym', 'laundry', 'hair care', 'other'] type : [string] loc...
[ "Locu", "Menu", "Item", "Search", "API", "Call", "Wrapper" ]
fcdf136b68333ab7055e623591801dd35df3bc45
https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L366-L428
train
lsst-sqre/documenteer
documenteer/stackdocs/stackcli.py
main
def main(ctx, root_project_dir, verbose): """stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile...
python
def main(ctx, root_project_dir, verbose): """stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile...
[ "def", "main", "(", "ctx", ",", "root_project_dir", ",", "verbose", ")", ":", "root_project_dir", "=", "discover_conf_py_directory", "(", "root_project_dir", ")", "ctx", ".", "obj", "=", "{", "'root_project_dir'", ":", "root_project_dir", ",", "'verbose'", ":", ...
stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile and sphinx-build system for Sphinx projects....
[ "stack", "-", "docs", "is", "a", "CLI", "for", "building", "LSST", "Stack", "documentation", "such", "as", "pipelines", ".", "lsst", ".", "io", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L38-L77
train
lsst-sqre/documenteer
documenteer/stackdocs/stackcli.py
help
def help(ctx, topic, **kw): """Show help for any command. """ # The help command implementation is taken from # https://www.burgundywall.com/post/having-click-help-subcommand if topic is None: click.echo(ctx.parent.get_help()) else: click.echo(main.commands[topic].get_help(ctx))
python
def help(ctx, topic, **kw): """Show help for any command. """ # The help command implementation is taken from # https://www.burgundywall.com/post/having-click-help-subcommand if topic is None: click.echo(ctx.parent.get_help()) else: click.echo(main.commands[topic].get_help(ctx))
[ "def", "help", "(", "ctx", ",", "topic", ",", "**", "kw", ")", ":", "if", "topic", "is", "None", ":", "click", ".", "echo", "(", "ctx", ".", "parent", ".", "get_help", "(", ")", ")", "else", ":", "click", ".", "echo", "(", "main", ".", "command...
Show help for any command.
[ "Show", "help", "for", "any", "command", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L83-L91
train
lsst-sqre/documenteer
documenteer/stackdocs/stackcli.py
clean
def clean(ctx): """Clean Sphinx build products. Use this command to clean out build products after a failed build, or in preparation for running a build from a clean state. This command removes the following directories from the ``pipelines_lsst_io`` directory: - ``_build`` (the Sphinx build ...
python
def clean(ctx): """Clean Sphinx build products. Use this command to clean out build products after a failed build, or in preparation for running a build from a clean state. This command removes the following directories from the ``pipelines_lsst_io`` directory: - ``_build`` (the Sphinx build ...
[ "def", "clean", "(", "ctx", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "dirnames", "=", "[", "'py-api'", ",", "'_build'", ",", "'modules'", ",", "'packages'", "]", "dirnames", "=", "[", "os", ".", "path", ".", "join", ...
Clean Sphinx build products. Use this command to clean out build products after a failed build, or in preparation for running a build from a clean state. This command removes the following directories from the ``pipelines_lsst_io`` directory: - ``_build`` (the Sphinx build itself) - ``modules...
[ "Clean", "Sphinx", "build", "products", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L134-L158
train
ehansis/ozelot
examples/leonardo/leonardo/kvstore/models.py
Entity.query_with_attributes
def query_with_attributes(type_to_query, client): """Query all entities of a specific type, with their attributes Args: type_to_query (str): type of entity to query client: DB client to perform query with Returns: pandas.DataFrame: table of entities, with at...
python
def query_with_attributes(type_to_query, client): """Query all entities of a specific type, with their attributes Args: type_to_query (str): type of entity to query client: DB client to perform query with Returns: pandas.DataFrame: table of entities, with at...
[ "def", "query_with_attributes", "(", "type_to_query", ",", "client", ")", ":", "session", "=", "client", ".", "create_session", "(", ")", "query", "=", "session", ".", "query", "(", "Attribute", ".", "name", ",", "Attribute", ".", "value", ",", "Entity", "...
Query all entities of a specific type, with their attributes Args: type_to_query (str): type of entity to query client: DB client to perform query with Returns: pandas.DataFrame: table of entities, with attributes as columns
[ "Query", "all", "entities", "of", "a", "specific", "type", "with", "their", "attributes" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/leonardo/leonardo/kvstore/models.py#L18-L50
train
zsimic/runez
src/runez/serialize.py
Serializable.reset
def reset(self): """ Reset all fields of this object to class defaults """ for name in self.__dict__: if name.startswith("_"): continue attr = getattr(self, name) setattr(self, name, attr and attr.__class__())
python
def reset(self): """ Reset all fields of this object to class defaults """ for name in self.__dict__: if name.startswith("_"): continue attr = getattr(self, name) setattr(self, name, attr and attr.__class__())
[ "def", "reset", "(", "self", ")", ":", "for", "name", "in", "self", ".", "__dict__", ":", "if", "name", ".", "startswith", "(", "\"_\"", ")", ":", "continue", "attr", "=", "getattr", "(", "self", ",", "name", ")", "setattr", "(", "self", ",", "name...
Reset all fields of this object to class defaults
[ "Reset", "all", "fields", "of", "this", "object", "to", "class", "defaults" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L88-L97
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
geojson_polygon_to_mask
def geojson_polygon_to_mask(feature, shape, lat_idx, lon_idx): """Convert a GeoJSON polygon feature to a numpy array Args: feature (pygeoj.Feature): polygon feature to draw shape (tuple(int, int)): shape of 2D target numpy array to draw polygon in lat_idx (func): function converting a l...
python
def geojson_polygon_to_mask(feature, shape, lat_idx, lon_idx): """Convert a GeoJSON polygon feature to a numpy array Args: feature (pygeoj.Feature): polygon feature to draw shape (tuple(int, int)): shape of 2D target numpy array to draw polygon in lat_idx (func): function converting a l...
[ "def", "geojson_polygon_to_mask", "(", "feature", ",", "shape", ",", "lat_idx", ",", "lon_idx", ")", ":", "import", "matplotlib", "matplotlib", ".", "use", "(", "'agg'", ")", "import", "matplotlib", ".", "pyplot", "as", "plt", "from", "matplotlib", "import", ...
Convert a GeoJSON polygon feature to a numpy array Args: feature (pygeoj.Feature): polygon feature to draw shape (tuple(int, int)): shape of 2D target numpy array to draw polygon in lat_idx (func): function converting a latitude to the (fractional) row index in the map lon_idx (func...
[ "Convert", "a", "GeoJSON", "polygon", "feature", "to", "a", "numpy", "array" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L549-L637
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
NUTS2InputFile.load
def load(self): """Load data, from default location Returns: pandas.DataFrame: columns 'key' (NUTS2 code), 'name' """ # read file, keep all values as strings df = pd.read_csv(self.input_file, sep=',', quotechar='"', ...
python
def load(self): """Load data, from default location Returns: pandas.DataFrame: columns 'key' (NUTS2 code), 'name' """ # read file, keep all values as strings df = pd.read_csv(self.input_file, sep=',', quotechar='"', ...
[ "def", "load", "(", "self", ")", ":", "df", "=", "pd", ".", "read_csv", "(", "self", ".", "input_file", ",", "sep", "=", "','", ",", "quotechar", "=", "'\"'", ",", "encoding", "=", "'utf-8'", ",", "dtype", "=", "object", ")", "df", "=", "df", "["...
Load data, from default location Returns: pandas.DataFrame: columns 'key' (NUTS2 code), 'name'
[ "Load", "data", "from", "default", "location" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L50-L73
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
EuroStatsInputFile.input_file
def input_file(self): """Returns the input file name, with a default relative path """ return path.join(path.dirname(__file__), 'data', 'tgs{:s}.tsv'.format(self.number))
python
def input_file(self): """Returns the input file name, with a default relative path """ return path.join(path.dirname(__file__), 'data', 'tgs{:s}.tsv'.format(self.number))
[ "def", "input_file", "(", "self", ")", ":", "return", "path", ".", "join", "(", "path", ".", "dirname", "(", "__file__", ")", ",", "'data'", ",", "'tgs{:s}.tsv'", ".", "format", "(", "self", ".", "number", ")", ")" ]
Returns the input file name, with a default relative path
[ "Returns", "the", "input", "file", "name", "with", "a", "default", "relative", "path" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L133-L136
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
EuroStatsInputFile.load
def load(self, key_filter=None, header_preproc=None): """Load data table from tsv file, from default location Args: key_filter (str): additional filter for key column - regex matching key values to include; None for no filter header_preproc (func): function to a...
python
def load(self, key_filter=None, header_preproc=None): """Load data table from tsv file, from default location Args: key_filter (str): additional filter for key column - regex matching key values to include; None for no filter header_preproc (func): function to a...
[ "def", "load", "(", "self", ",", "key_filter", "=", "None", ",", "header_preproc", "=", "None", ")", ":", "df", "=", "pd", ".", "read_csv", "(", "self", ".", "input_file", ",", "sep", "=", "'\\t'", ",", "dtype", "=", "object", ")", "if", "key_filter"...
Load data table from tsv file, from default location Args: key_filter (str): additional filter for key column - regex matching key values to include; None for no filter header_preproc (func): function to apply to column headers to extract year numbers (as strings) ...
[ "Load", "data", "table", "from", "tsv", "file", "from", "default", "location" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L138-L179
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
ClimateDataInputFile.load
def load(self): """Load the climate data as a map Returns: dict: {data: masked 3D numpy array containing climate data per month (first axis), lat_idx: function converting a latitude to the (fractional) row index in the map, lon_idx: function converting ...
python
def load(self): """Load the climate data as a map Returns: dict: {data: masked 3D numpy array containing climate data per month (first axis), lat_idx: function converting a latitude to the (fractional) row index in the map, lon_idx: function converting ...
[ "def", "load", "(", "self", ")", ":", "from", "scipy", ".", "io", "import", "netcdf_file", "from", "scipy", "import", "interpolate", "import", "numpy", "as", "np", "f", "=", "netcdf_file", "(", "self", ".", "input_file", ")", "out", "=", "dict", "(", "...
Load the climate data as a map Returns: dict: {data: masked 3D numpy array containing climate data per month (first axis), lat_idx: function converting a latitude to the (fractional) row index in the map, lon_idx: function converting a longitude to the (fractio...
[ "Load", "the", "climate", "data", "as", "a", "map" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L659-L701
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
LoadClimateData.clear
def clear(self): """Clear output of one climate variable """ # mark this task as incomplete self.mark_incomplete() # Delete the indicator metadata, this also deletes values by cascading. for suffix in list(CLIMATE_SEASON_SUFFIXES.values()): try: ...
python
def clear(self): """Clear output of one climate variable """ # mark this task as incomplete self.mark_incomplete() # Delete the indicator metadata, this also deletes values by cascading. for suffix in list(CLIMATE_SEASON_SUFFIXES.values()): try: ...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "mark_incomplete", "(", ")", "for", "suffix", "in", "list", "(", "CLIMATE_SEASON_SUFFIXES", ".", "values", "(", ")", ")", ":", "try", ":", "indicator", "=", "self", ".", "session", ".", "query", "(", ...
Clear output of one climate variable
[ "Clear", "output", "of", "one", "climate", "variable" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L731-L749
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
LoadClimateData.run
def run(self): """Load climate data and convert to indicator objects """ import numpy as np # get all NUTS region IDs, for linking values to region objects query = self.session.query(models.NUTS2Region.key, models.NUTS2Region.id) region...
python
def run(self): """Load climate data and convert to indicator objects """ import numpy as np # get all NUTS region IDs, for linking values to region objects query = self.session.query(models.NUTS2Region.key, models.NUTS2Region.id) region...
[ "def", "run", "(", "self", ")", ":", "import", "numpy", "as", "np", "query", "=", "self", ".", "session", ".", "query", "(", "models", ".", "NUTS2Region", ".", "key", ",", "models", ".", "NUTS2Region", ".", "id", ")", "region_ids", "=", "self", ".", ...
Load climate data and convert to indicator objects
[ "Load", "climate", "data", "and", "convert", "to", "indicator", "objects" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L751-L836
train
untwisted/untwisted
untwisted/iostd.py
lose
def lose(spin): """ It is used to close TCP connection and unregister the Spin instance from untwisted reactor. Diagram: lose -> (int:err | socket.error:err) -> CLOSE_ERR """ try: spin.close() except Exception as excpt: err = excpt.args[0] spin.drive(CLOSE_ERR,...
python
def lose(spin): """ It is used to close TCP connection and unregister the Spin instance from untwisted reactor. Diagram: lose -> (int:err | socket.error:err) -> CLOSE_ERR """ try: spin.close() except Exception as excpt: err = excpt.args[0] spin.drive(CLOSE_ERR,...
[ "def", "lose", "(", "spin", ")", ":", "try", ":", "spin", ".", "close", "(", ")", "except", "Exception", "as", "excpt", ":", "err", "=", "excpt", ".", "args", "[", "0", "]", "spin", ".", "drive", "(", "CLOSE_ERR", ",", "err", ")", "finally", ":",...
It is used to close TCP connection and unregister the Spin instance from untwisted reactor. Diagram: lose -> (int:err | socket.error:err) -> CLOSE_ERR
[ "It", "is", "used", "to", "close", "TCP", "connection", "and", "unregister", "the", "Spin", "instance", "from", "untwisted", "reactor", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iostd.py#L10-L27
train
untwisted/untwisted
untwisted/iostd.py
create_server
def create_server(addr, port, backlog): """ Set up a TCP server and installs the basic handles Stdin, Stdout in the clients. Example: def send_data(server, client): # No need to install Stdin or Stdout. client.dump('foo bar!') server = create_server('0.0.0.0', 1024, 50) ...
python
def create_server(addr, port, backlog): """ Set up a TCP server and installs the basic handles Stdin, Stdout in the clients. Example: def send_data(server, client): # No need to install Stdin or Stdout. client.dump('foo bar!') server = create_server('0.0.0.0', 1024, 50) ...
[ "def", "create_server", "(", "addr", ",", "port", ",", "backlog", ")", ":", "server", "=", "Spin", "(", ")", "server", ".", "bind", "(", "(", "addr", ",", "port", ")", ")", "server", ".", "listen", "(", "backlog", ")", "Server", "(", "server", ")",...
Set up a TCP server and installs the basic handles Stdin, Stdout in the clients. Example: def send_data(server, client): # No need to install Stdin or Stdout. client.dump('foo bar!') server = create_server('0.0.0.0', 1024, 50) xmap(server, on_accept, send_data)
[ "Set", "up", "a", "TCP", "server", "and", "installs", "the", "basic", "handles", "Stdin", "Stdout", "in", "the", "clients", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iostd.py#L37-L57
train
untwisted/untwisted
untwisted/iostd.py
create_client
def create_client(addr, port): """ Set up a TCP client and installs the basic handles Stdin, Stdout. def send_data(client): client.dump('GET / HTTP/1.1\r\n') xmap(client, LOAD, iostd.put) client = create_client('www.google.com.br', 80) xmap(client, CONNECT, send_data) """ s...
python
def create_client(addr, port): """ Set up a TCP client and installs the basic handles Stdin, Stdout. def send_data(client): client.dump('GET / HTTP/1.1\r\n') xmap(client, LOAD, iostd.put) client = create_client('www.google.com.br', 80) xmap(client, CONNECT, send_data) """ s...
[ "def", "create_client", "(", "addr", ",", "port", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "connect_ex", "(", "(", "addr", ",", "port", ")", ")", "spin", "=", ...
Set up a TCP client and installs the basic handles Stdin, Stdout. def send_data(client): client.dump('GET / HTTP/1.1\r\n') xmap(client, LOAD, iostd.put) client = create_client('www.google.com.br', 80) xmap(client, CONNECT, send_data)
[ "Set", "up", "a", "TCP", "client", "and", "installs", "the", "basic", "handles", "Stdin", "Stdout", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iostd.py#L67-L88
train
kataev/flake8-rst
flake8_rst/cli.py
main
def main(argv=None): # type: (Union[NoneType, List[str]]) -> NoneType """Execute the main bit of the application. This handles the creation of an instance of :class:`Application`, runs it, and then exits the application. :param list argv: The arguments to be passed to the application for p...
python
def main(argv=None): # type: (Union[NoneType, List[str]]) -> NoneType """Execute the main bit of the application. This handles the creation of an instance of :class:`Application`, runs it, and then exits the application. :param list argv: The arguments to be passed to the application for p...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "app", "=", "application", ".", "Application", "(", ")", "app", ".", "run", "(", "argv", ")", "app", ".", "exit", "(", ")" ]
Execute the main bit of the application. This handles the creation of an instance of :class:`Application`, runs it, and then exits the application. :param list argv: The arguments to be passed to the application for parsing.
[ "Execute", "the", "main", "bit", "of", "the", "application", "." ]
ca6d41c7a309b9e8cd4fa6f428b82db96b6a986f
https://github.com/kataev/flake8-rst/blob/ca6d41c7a309b9e8cd4fa6f428b82db96b6a986f/flake8_rst/cli.py#L5-L17
train
mojaie/chorus
chorus/indigo.py
fingerprint_similarity
def fingerprint_similarity(mol1, mol2): """Calculate Indigo fingerprint similarity """ idmol1 = to_real_mol(mol1) idmol2 = to_real_mol(mol2) fp1 = idmol1.fingerprint("sim") fp2 = idmol2.fingerprint("sim") return round(idg.similarity(fp1, fp2, "tanimoto"), 2)
python
def fingerprint_similarity(mol1, mol2): """Calculate Indigo fingerprint similarity """ idmol1 = to_real_mol(mol1) idmol2 = to_real_mol(mol2) fp1 = idmol1.fingerprint("sim") fp2 = idmol2.fingerprint("sim") return round(idg.similarity(fp1, fp2, "tanimoto"), 2)
[ "def", "fingerprint_similarity", "(", "mol1", ",", "mol2", ")", ":", "idmol1", "=", "to_real_mol", "(", "mol1", ")", "idmol2", "=", "to_real_mol", "(", "mol2", ")", "fp1", "=", "idmol1", ".", "fingerprint", "(", "\"sim\"", ")", "fp2", "=", "idmol2", ".",...
Calculate Indigo fingerprint similarity
[ "Calculate", "Indigo", "fingerprint", "similarity" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/indigo.py#L64-L71
train
wesleybeckner/salty
salty/core.py
devmodel_to_array
def devmodel_to_array(model_name, train_fraction=1): """ a standardized method of turning a dev_model object into training and testing arrays Parameters ---------- model_name: dev_model the dev_model object to be interrogated train_fraction: int the fraction to be reserved f...
python
def devmodel_to_array(model_name, train_fraction=1): """ a standardized method of turning a dev_model object into training and testing arrays Parameters ---------- model_name: dev_model the dev_model object to be interrogated train_fraction: int the fraction to be reserved f...
[ "def", "devmodel_to_array", "(", "model_name", ",", "train_fraction", "=", "1", ")", ":", "model_outputs", "=", "-", "6", "+", "model_name", ".", "Data_summary", ".", "shape", "[", "0", "]", "devmodel", "=", "model_name", "rawdf", "=", "devmodel", ".", "Da...
a standardized method of turning a dev_model object into training and testing arrays Parameters ---------- model_name: dev_model the dev_model object to be interrogated train_fraction: int the fraction to be reserved for training Returns ---------- X_train: array ...
[ "a", "standardized", "method", "of", "turning", "a", "dev_model", "object", "into", "training", "and", "testing", "arrays" ]
ef17a97aea3e4f81fcd0359ce85b3438c0e6499b
https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L162-L207
train
potash/drain
drain/exploration.py
dapply
def dapply(self, fn, pairwise=False, symmetric=True, diagonal=False, block=None, **kwargs): """ Apply function to each step object in the index Args: fn: function to apply. If a list then each function is applied pairwise: whether to apply the function to pairs of steps symmetric, d...
python
def dapply(self, fn, pairwise=False, symmetric=True, diagonal=False, block=None, **kwargs): """ Apply function to each step object in the index Args: fn: function to apply. If a list then each function is applied pairwise: whether to apply the function to pairs of steps symmetric, d...
[ "def", "dapply", "(", "self", ",", "fn", ",", "pairwise", "=", "False", ",", "symmetric", "=", "True", ",", "diagonal", "=", "False", ",", "block", "=", "None", ",", "**", "kwargs", ")", ":", "search_keys", "=", "[", "k", "for", "k", ",", "v", "i...
Apply function to each step object in the index Args: fn: function to apply. If a list then each function is applied pairwise: whether to apply the function to pairs of steps symmetric, diagonal, block: passed to apply_pairwise when pairwise=True kwargs: a keyword arguments to pass ...
[ "Apply", "function", "to", "each", "step", "object", "in", "the", "index" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/exploration.py#L125-L177
train
maljovec/topopy
topopy/ContourTree.py
ContourTree._identifyBranches
def _identifyBranches(self): """ A helper function for determining all of the branches in the tree. This should be called after the tree has been fully constructed and its nodes and edges are populated. """ if self.debug: sys.stdout.write("Identifying branche...
python
def _identifyBranches(self): """ A helper function for determining all of the branches in the tree. This should be called after the tree has been fully constructed and its nodes and edges are populated. """ if self.debug: sys.stdout.write("Identifying branche...
[ "def", "_identifyBranches", "(", "self", ")", ":", "if", "self", ".", "debug", ":", "sys", ".", "stdout", ".", "write", "(", "\"Identifying branches: \"", ")", "start", "=", "time", ".", "clock", "(", ")", "seen", "=", "set", "(", ")", "self", ".", "...
A helper function for determining all of the branches in the tree. This should be called after the tree has been fully constructed and its nodes and edges are populated.
[ "A", "helper", "function", "for", "determining", "all", "of", "the", "branches", "in", "the", "tree", ".", "This", "should", "be", "called", "after", "the", "tree", "has", "been", "fully", "constructed", "and", "its", "nodes", "and", "edges", "are", "popul...
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L144-L172
train
maljovec/topopy
topopy/ContourTree.py
ContourTree._identifySuperGraph
def _identifySuperGraph(self): """ A helper function for determining the condensed representation of the tree. That is, one that does not hold all of the internal nodes of the graph. The results will be stored in ContourTree.superNodes and ContourTree.superArcs. T...
python
def _identifySuperGraph(self): """ A helper function for determining the condensed representation of the tree. That is, one that does not hold all of the internal nodes of the graph. The results will be stored in ContourTree.superNodes and ContourTree.superArcs. T...
[ "def", "_identifySuperGraph", "(", "self", ")", ":", "if", "self", ".", "debug", ":", "sys", ".", "stdout", ".", "write", "(", "\"Condensing Graph: \"", ")", "start", "=", "time", ".", "clock", "(", ")", "G", "=", "nx", ".", "DiGraph", "(", ")", "G",...
A helper function for determining the condensed representation of the tree. That is, one that does not hold all of the internal nodes of the graph. The results will be stored in ContourTree.superNodes and ContourTree.superArcs. These two can be used to potentially speed u...
[ "A", "helper", "function", "for", "determining", "the", "condensed", "representation", "of", "the", "tree", ".", "That", "is", "one", "that", "does", "not", "hold", "all", "of", "the", "internal", "nodes", "of", "the", "graph", ".", "The", "results", "will...
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L174-L263
train
maljovec/topopy
topopy/ContourTree.py
ContourTree.get_seeds
def get_seeds(self, threshold): """ Returns a list of seed points for isosurface extraction given a threshold value @ In, threshold, float, the isovalue for which we want to identify seed points for isosurface extraction """ seeds = [] for e1, e2 i...
python
def get_seeds(self, threshold): """ Returns a list of seed points for isosurface extraction given a threshold value @ In, threshold, float, the isovalue for which we want to identify seed points for isosurface extraction """ seeds = [] for e1, e2 i...
[ "def", "get_seeds", "(", "self", ",", "threshold", ")", ":", "seeds", "=", "[", "]", "for", "e1", ",", "e2", "in", "self", ".", "superArcs", ":", "if", "self", ".", "Y", "[", "e1", "]", "<=", "threshold", "<=", "self", ".", "Y", "[", "e2", "]",...
Returns a list of seed points for isosurface extraction given a threshold value @ In, threshold, float, the isovalue for which we want to identify seed points for isosurface extraction
[ "Returns", "a", "list", "of", "seed", "points", "for", "isosurface", "extraction", "given", "a", "threshold", "value" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L265-L296
train
maljovec/topopy
topopy/ContourTree.py
ContourTree._construct_nx_tree
def _construct_nx_tree(self, thisTree, thatTree=None): """ A function for creating networkx instances that can be used more efficiently for graph manipulation than the MergeTree class. @ In, thisTree, a MergeTree instance for which we will construct a networkx...
python
def _construct_nx_tree(self, thisTree, thatTree=None): """ A function for creating networkx instances that can be used more efficiently for graph manipulation than the MergeTree class. @ In, thisTree, a MergeTree instance for which we will construct a networkx...
[ "def", "_construct_nx_tree", "(", "self", ",", "thisTree", ",", "thatTree", "=", "None", ")", ":", "if", "self", ".", "debug", ":", "sys", ".", "stdout", ".", "write", "(", "\"Networkx Tree construction: \"", ")", "start", "=", "time", ".", "clock", "(", ...
A function for creating networkx instances that can be used more efficiently for graph manipulation than the MergeTree class. @ In, thisTree, a MergeTree instance for which we will construct a networkx graph @ In, thatTree, a MergeTree instance optionally ...
[ "A", "function", "for", "creating", "networkx", "instances", "that", "can", "be", "used", "more", "efficiently", "for", "graph", "manipulation", "than", "the", "MergeTree", "class", "." ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L298-L348
train
maljovec/topopy
topopy/ContourTree.py
ContourTree._process_tree
def _process_tree(self, thisTree, thatTree): """ A function that will process either a split or join tree with reference to the other tree and store it as part of this CT instance. @ In, thisTree, a networkx.Graph instance representing a merge tree for which w...
python
def _process_tree(self, thisTree, thatTree): """ A function that will process either a split or join tree with reference to the other tree and store it as part of this CT instance. @ In, thisTree, a networkx.Graph instance representing a merge tree for which w...
[ "def", "_process_tree", "(", "self", ",", "thisTree", ",", "thatTree", ")", ":", "if", "self", ".", "debug", ":", "sys", ".", "stdout", ".", "write", "(", "\"Processing Tree: \"", ")", "start", "=", "time", ".", "clock", "(", ")", "if", "len", "(", "...
A function that will process either a split or join tree with reference to the other tree and store it as part of this CT instance. @ In, thisTree, a networkx.Graph instance representing a merge tree for which we will process all of its leaf nodes into...
[ "A", "function", "that", "will", "process", "either", "a", "split", "or", "join", "tree", "with", "reference", "to", "the", "other", "tree", "and", "store", "it", "as", "part", "of", "this", "CT", "instance", "." ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L350-L472
train
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
read_git_branch
def read_git_branch(): """Obtain the current branch name from the Git repository. If on Travis CI, use the ``TRAVIS_BRANCH`` environment variable. """ if os.getenv('TRAVIS'): return os.getenv('TRAVIS_BRANCH') else: try: repo = git.repo.base.Repo(search_parent_directories=...
python
def read_git_branch(): """Obtain the current branch name from the Git repository. If on Travis CI, use the ``TRAVIS_BRANCH`` environment variable. """ if os.getenv('TRAVIS'): return os.getenv('TRAVIS_BRANCH') else: try: repo = git.repo.base.Repo(search_parent_directories=...
[ "def", "read_git_branch", "(", ")", ":", "if", "os", ".", "getenv", "(", "'TRAVIS'", ")", ":", "return", "os", ".", "getenv", "(", "'TRAVIS_BRANCH'", ")", "else", ":", "try", ":", "repo", "=", "git", ".", "repo", ".", "base", ".", "Repo", "(", "sea...
Obtain the current branch name from the Git repository. If on Travis CI, use the ``TRAVIS_BRANCH`` environment variable.
[ "Obtain", "the", "current", "branch", "name", "from", "the", "Git", "repository", ".", "If", "on", "Travis", "CI", "use", "the", "TRAVIS_BRANCH", "environment", "variable", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L17-L28
train
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
read_git_commit_timestamp
def read_git_commit_timestamp(repo_path=None): """Obtain the timestamp from the current head commit of a Git repository. Parameters ---------- repo_path : `str`, optional Path to the Git repository. Leave as `None` to use the current working directory. Returns ------- commi...
python
def read_git_commit_timestamp(repo_path=None): """Obtain the timestamp from the current head commit of a Git repository. Parameters ---------- repo_path : `str`, optional Path to the Git repository. Leave as `None` to use the current working directory. Returns ------- commi...
[ "def", "read_git_commit_timestamp", "(", "repo_path", "=", "None", ")", ":", "repo", "=", "git", ".", "repo", ".", "base", ".", "Repo", "(", "path", "=", "repo_path", ",", "search_parent_directories", "=", "True", ")", "head_commit", "=", "repo", ".", "hea...
Obtain the timestamp from the current head commit of a Git repository. Parameters ---------- repo_path : `str`, optional Path to the Git repository. Leave as `None` to use the current working directory. Returns ------- commit_timestamp : `datetime.datetime` The datetime...
[ "Obtain", "the", "timestamp", "from", "the", "current", "head", "commit", "of", "a", "Git", "repository", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L31-L47
train
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
read_git_commit_timestamp_for_file
def read_git_commit_timestamp_for_file(filepath, repo_path=None): """Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Repository-relative path for a file. repo_path : `str`, optional Path to the Git repos...
python
def read_git_commit_timestamp_for_file(filepath, repo_path=None): """Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Repository-relative path for a file. repo_path : `str`, optional Path to the Git repos...
[ "def", "read_git_commit_timestamp_for_file", "(", "filepath", ",", "repo_path", "=", "None", ")", ":", "repo", "=", "git", ".", "repo", ".", "base", ".", "Repo", "(", "path", "=", "repo_path", ",", "search_parent_directories", "=", "True", ")", "head_commit", ...
Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Repository-relative path for a file. repo_path : `str`, optional Path to the Git repository. Leave as `None` to use the current working directory. ...
[ "Obtain", "the", "timestamp", "for", "the", "most", "recent", "commit", "to", "a", "given", "file", "in", "a", "Git", "repository", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L50-L80
train
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
get_filepaths_with_extension
def get_filepaths_with_extension(extname, root_dir='.'): """Get relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (e.g. 'txt', 'rst'). Extension comparison is case-insensitive. root_dir...
python
def get_filepaths_with_extension(extname, root_dir='.'): """Get relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (e.g. 'txt', 'rst'). Extension comparison is case-insensitive. root_dir...
[ "def", "get_filepaths_with_extension", "(", "extname", ",", "root_dir", "=", "'.'", ")", ":", "if", "not", "extname", ".", "startswith", "(", "'.'", ")", ":", "extname", "=", "'.'", "+", "extname", "extname", "=", "extname", ".", "lower", "(", ")", "root...
Get relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (e.g. 'txt', 'rst'). Extension comparison is case-insensitive. root_dir : `str`, optional Root directory. Current working direc...
[ "Get", "relative", "filepaths", "of", "files", "in", "a", "directory", "and", "sub", "-", "directories", "with", "the", "given", "extension", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L83-L116
train
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
get_project_content_commit_date
def get_project_content_commit_date(root_dir='.', exclusions=None): """Get the datetime for the most recent commit to a project that affected Sphinx content. *Content* is considered any file with one of these extensions: - ``rst`` (README.rst and LICENSE.rst are excluded) - ``ipynb`` - ``png``...
python
def get_project_content_commit_date(root_dir='.', exclusions=None): """Get the datetime for the most recent commit to a project that affected Sphinx content. *Content* is considered any file with one of these extensions: - ``rst`` (README.rst and LICENSE.rst are excluded) - ``ipynb`` - ``png``...
[ "def", "get_project_content_commit_date", "(", "root_dir", "=", "'.'", ",", "exclusions", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "extensions", "=", "(", "'rst'", ",", "'ipynb'", ",", "'png'", ",", "'jpeg'", ...
Get the datetime for the most recent commit to a project that affected Sphinx content. *Content* is considered any file with one of these extensions: - ``rst`` (README.rst and LICENSE.rst are excluded) - ``ipynb`` - ``png`` - ``jpeg`` - ``jpg`` - ``svg`` - ``gif`` This functio...
[ "Get", "the", "datetime", "for", "the", "most", "recent", "commit", "to", "a", "project", "that", "affected", "Sphinx", "content", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L119-L192
train
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
form_ltd_edition_name
def form_ltd_edition_name(git_ref_name=None): """Form the LSST the Docs edition name for this branch, using the same logic as LTD Keeper does for transforming branch names into edition names. Parameters ---------- git_ref_name : `str` Name of the git branch (or git ref, in general, like a ta...
python
def form_ltd_edition_name(git_ref_name=None): """Form the LSST the Docs edition name for this branch, using the same logic as LTD Keeper does for transforming branch names into edition names. Parameters ---------- git_ref_name : `str` Name of the git branch (or git ref, in general, like a ta...
[ "def", "form_ltd_edition_name", "(", "git_ref_name", "=", "None", ")", ":", "if", "git_ref_name", "is", "None", ":", "name", "=", "read_git_branch", "(", ")", "else", ":", "name", "=", "git_ref_name", "m", "=", "TICKET_BRANCH_PATTERN", ".", "match", "(", "na...
Form the LSST the Docs edition name for this branch, using the same logic as LTD Keeper does for transforming branch names into edition names. Parameters ---------- git_ref_name : `str` Name of the git branch (or git ref, in general, like a tag) that. Notes ----- The LTD Keeper (git...
[ "Form", "the", "LSST", "the", "Docs", "edition", "name", "for", "this", "branch", "using", "the", "same", "logic", "as", "LTD", "Keeper", "does", "for", "transforming", "branch", "names", "into", "edition", "names", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L195-L235
train
fkarb/xltable
xltable/workbook.py
Workbook.itersheets
def itersheets(self): """ Iterates over the worksheets in the book, and sets the active worksheet as the current one before yielding. """ for ws in self.worksheets: # Expression with no explicit table specified will use None # when calling get_table, which...
python
def itersheets(self): """ Iterates over the worksheets in the book, and sets the active worksheet as the current one before yielding. """ for ws in self.worksheets: # Expression with no explicit table specified will use None # when calling get_table, which...
[ "def", "itersheets", "(", "self", ")", ":", "for", "ws", "in", "self", ".", "worksheets", ":", "prev_ws", "=", "self", ".", "active_worksheet", "self", ".", "active_worksheet", "=", "ws", "try", ":", "yield", "ws", "finally", ":", "self", ".", "active_wo...
Iterates over the worksheets in the book, and sets the active worksheet as the current one before yielding.
[ "Iterates", "over", "the", "worksheets", "in", "the", "book", "and", "sets", "the", "active", "worksheet", "as", "the", "current", "one", "before", "yielding", "." ]
7a592642d27ad5ee90d2aa8c26338abaa9d84bea
https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/workbook.py#L47-L60
train
fkarb/xltable
xltable/workbook.py
Workbook.to_xlsx
def to_xlsx(self, **kwargs): """ Write workbook to a .xlsx file using xlsxwriter. Return a xlsxwriter.workbook.Workbook. :param kwargs: Extra arguments passed to the xlsxwriter.Workbook constructor. """ from xlsxwriter.workbook import Workbook as _Workbook ...
python
def to_xlsx(self, **kwargs): """ Write workbook to a .xlsx file using xlsxwriter. Return a xlsxwriter.workbook.Workbook. :param kwargs: Extra arguments passed to the xlsxwriter.Workbook constructor. """ from xlsxwriter.workbook import Workbook as _Workbook ...
[ "def", "to_xlsx", "(", "self", ",", "**", "kwargs", ")", ":", "from", "xlsxwriter", ".", "workbook", "import", "Workbook", "as", "_Workbook", "self", ".", "workbook_obj", "=", "_Workbook", "(", "**", "kwargs", ")", "self", ".", "workbook_obj", ".", "set_ca...
Write workbook to a .xlsx file using xlsxwriter. Return a xlsxwriter.workbook.Workbook. :param kwargs: Extra arguments passed to the xlsxwriter.Workbook constructor.
[ "Write", "workbook", "to", "a", ".", "xlsx", "file", "using", "xlsxwriter", ".", "Return", "a", "xlsxwriter", ".", "workbook", ".", "Workbook", "." ]
7a592642d27ad5ee90d2aa8c26338abaa9d84bea
https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/workbook.py#L62-L80
train
fkarb/xltable
xltable/workbook.py
Workbook.get_table
def get_table(self, name): """ Return a table, worksheet pair for the named table """ if name is None: assert self.active_table, "Can't get table without name unless an active table is set" name = self.active_table.name if self.active_worksheet: ...
python
def get_table(self, name): """ Return a table, worksheet pair for the named table """ if name is None: assert self.active_table, "Can't get table without name unless an active table is set" name = self.active_table.name if self.active_worksheet: ...
[ "def", "get_table", "(", "self", ",", "name", ")", ":", "if", "name", "is", "None", ":", "assert", "self", ".", "active_table", ",", "\"Can't get table without name unless an active table is set\"", "name", "=", "self", ".", "active_table", ".", "name", "if", "s...
Return a table, worksheet pair for the named table
[ "Return", "a", "table", "worksheet", "pair", "for", "the", "named", "table" ]
7a592642d27ad5ee90d2aa8c26338abaa9d84bea
https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/workbook.py#L141-L186
train
mastro35/flows
flows/Actions/Action.py
Action.send_message
def send_message(self, output): """ Send a message to the socket """ file_system_event = None if self.my_action_input: file_system_event = self.my_action_input.file_system_event or None output_action = ActionInput(file_system_event, ...
python
def send_message(self, output): """ Send a message to the socket """ file_system_event = None if self.my_action_input: file_system_event = self.my_action_input.file_system_event or None output_action = ActionInput(file_system_event, ...
[ "def", "send_message", "(", "self", ",", "output", ")", ":", "file_system_event", "=", "None", "if", "self", ".", "my_action_input", ":", "file_system_event", "=", "self", ".", "my_action_input", ".", "file_system_event", "or", "None", "output_action", "=", "Act...
Send a message to the socket
[ "Send", "a", "message", "to", "the", "socket" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L107-L121
train
mastro35/flows
flows/Actions/Action.py
Action.stop
def stop(self): ''' Stop the current action ''' Global.LOGGER.debug(f"action {self.name} stopped") self.is_running = False self.on_stop()
python
def stop(self): ''' Stop the current action ''' Global.LOGGER.debug(f"action {self.name} stopped") self.is_running = False self.on_stop()
[ "def", "stop", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "f\"action {self.name} stopped\"", ")", "self", ".", "is_running", "=", "False", "self", ".", "on_stop", "(", ")" ]
Stop the current action
[ "Stop", "the", "current", "action" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L123-L127
train
mastro35/flows
flows/Actions/Action.py
Action.run
def run(self): """ Start the action """ Global.LOGGER.debug(f"action {self.name} is running") for tmp_monitored_input in self.monitored_input: sender = "*" + tmp_monitored_input + "*" Global.LOGGER.debug(f"action {self.name} is monitoring {sender}") ...
python
def run(self): """ Start the action """ Global.LOGGER.debug(f"action {self.name} is running") for tmp_monitored_input in self.monitored_input: sender = "*" + tmp_monitored_input + "*" Global.LOGGER.debug(f"action {self.name} is monitoring {sender}") ...
[ "def", "run", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "f\"action {self.name} is running\"", ")", "for", "tmp_monitored_input", "in", "self", ".", "monitored_input", ":", "sender", "=", "\"*\"", "+", "tmp_monitored_input", "+", "\"*\"",...
Start the action
[ "Start", "the", "action" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L129-L145
train
mastro35/flows
flows/Actions/Action.py
Action.create_action_for_code
def create_action_for_code(cls, action_code, name, configuration, managed_input): """ Factory method to create an instance of an Action from an input code """ Global.LOGGER.debug(f"creating action {name} for code {action_code}") Global.LOGGER.debug(f"configuration length: {len(co...
python
def create_action_for_code(cls, action_code, name, configuration, managed_input): """ Factory method to create an instance of an Action from an input code """ Global.LOGGER.debug(f"creating action {name} for code {action_code}") Global.LOGGER.debug(f"configuration length: {len(co...
[ "def", "create_action_for_code", "(", "cls", ",", "action_code", ",", "name", ",", "configuration", ",", "managed_input", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "f\"creating action {name} for code {action_code}\"", ")", "Global", ".", "LOGGER", ".", ...
Factory method to create an instance of an Action from an input code
[ "Factory", "method", "to", "create", "an", "instance", "of", "an", "Action", "from", "an", "input", "code" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/Action.py#L214-L238
train
bluekeyes/sphinx-javalink
javalink/loader.py
extract_class
def extract_class(jar, name): """Extracts a LinkableClass from a jar. Args: jar: An open ZipFile instance. name: A string containing the binary name of a class. Raises: KeyError: The class does not exist in the jar. """ with jar.open(name) as entry: return Linkable...
python
def extract_class(jar, name): """Extracts a LinkableClass from a jar. Args: jar: An open ZipFile instance. name: A string containing the binary name of a class. Raises: KeyError: The class does not exist in the jar. """ with jar.open(name) as entry: return Linkable...
[ "def", "extract_class", "(", "jar", ",", "name", ")", ":", "with", "jar", ".", "open", "(", "name", ")", "as", "entry", ":", "return", "LinkableClass", "(", "javatools", ".", "unpack_class", "(", "entry", ")", ")" ]
Extracts a LinkableClass from a jar. Args: jar: An open ZipFile instance. name: A string containing the binary name of a class. Raises: KeyError: The class does not exist in the jar.
[ "Extracts", "a", "LinkableClass", "from", "a", "jar", "." ]
490e37506efa53e95ad88a665e347536e75b6254
https://github.com/bluekeyes/sphinx-javalink/blob/490e37506efa53e95ad88a665e347536e75b6254/javalink/loader.py#L10-L22
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._format_summary_node
def _format_summary_node(self, task_class): """Format a section node containg a summary of a Task class's key APIs. """ modulename = task_class.__module__ classname = task_class.__name__ nodes = [] nodes.append( self._format_class_nodes(task_class)) ...
python
def _format_summary_node(self, task_class): """Format a section node containg a summary of a Task class's key APIs. """ modulename = task_class.__module__ classname = task_class.__name__ nodes = [] nodes.append( self._format_class_nodes(task_class)) ...
[ "def", "_format_summary_node", "(", "self", ",", "task_class", ")", ":", "modulename", "=", "task_class", ".", "__module__", "classname", "=", "task_class", ".", "__name__", "nodes", "=", "[", "]", "nodes", ".", "append", "(", "self", ".", "_format_class_nodes...
Format a section node containg a summary of a Task class's key APIs.
[ "Format", "a", "section", "node", "containg", "a", "summary", "of", "a", "Task", "class", "s", "key", "APIs", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L62-L84
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._format_class_nodes
def _format_class_nodes(self, task_class): """Create a ``desc`` node summarizing the class docstring. """ # Patterned after PyObject.handle_signature in Sphinx. # https://github.com/sphinx-doc/sphinx/blob/3e57ea0a5253ac198c1bff16c40abe71951bb586/sphinx/domains/python.py#L246 mod...
python
def _format_class_nodes(self, task_class): """Create a ``desc`` node summarizing the class docstring. """ # Patterned after PyObject.handle_signature in Sphinx. # https://github.com/sphinx-doc/sphinx/blob/3e57ea0a5253ac198c1bff16c40abe71951bb586/sphinx/domains/python.py#L246 mod...
[ "def", "_format_class_nodes", "(", "self", ",", "task_class", ")", ":", "modulename", "=", "task_class", ".", "__module__", "classname", "=", "task_class", ".", "__name__", "fullname", "=", "'.'", ".", "join", "(", "(", "modulename", ",", "classname", ")", "...
Create a ``desc`` node summarizing the class docstring.
[ "Create", "a", "desc", "node", "summarizing", "the", "class", "docstring", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L86-L112
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._format_method_nodes
def _format_method_nodes(self, task_method, modulename, classname): """Create a ``desc`` node summarizing a method docstring. """ methodname = task_method.__name__ fullname = '.'.join((modulename, classname, methodname)) # The signature term signature = Signature(task_me...
python
def _format_method_nodes(self, task_method, modulename, classname): """Create a ``desc`` node summarizing a method docstring. """ methodname = task_method.__name__ fullname = '.'.join((modulename, classname, methodname)) # The signature term signature = Signature(task_me...
[ "def", "_format_method_nodes", "(", "self", ",", "task_method", ",", "modulename", ",", "classname", ")", ":", "methodname", "=", "task_method", ".", "__name__", "fullname", "=", "'.'", ".", "join", "(", "(", "modulename", ",", "classname", ",", "methodname", ...
Create a ``desc`` node summarizing a method docstring.
[ "Create", "a", "desc", "node", "summarizing", "a", "method", "docstring", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L114-L136
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._create_doc_summary
def _create_doc_summary(self, obj, fullname, refrole): """Create a paragraph containing the object's one-sentence docstring summary with a link to further documentation. The paragrah should be inserted into the ``desc`` node's ``desc_content``. """ summary_text = extract...
python
def _create_doc_summary(self, obj, fullname, refrole): """Create a paragraph containing the object's one-sentence docstring summary with a link to further documentation. The paragrah should be inserted into the ``desc`` node's ``desc_content``. """ summary_text = extract...
[ "def", "_create_doc_summary", "(", "self", ",", "obj", ",", "fullname", ",", "refrole", ")", ":", "summary_text", "=", "extract_docstring_summary", "(", "get_docstring", "(", "obj", ")", ")", "summary_text", "=", "summary_text", ".", "strip", "(", ")", "if", ...
Create a paragraph containing the object's one-sentence docstring summary with a link to further documentation. The paragrah should be inserted into the ``desc`` node's ``desc_content``.
[ "Create", "a", "paragraph", "containing", "the", "object", "s", "one", "-", "sentence", "docstring", "summary", "with", "a", "link", "to", "further", "documentation", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L175-L189
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._create_api_details_link
def _create_api_details_link(self, fullname, refrole): """Appends a link to the API docs, labelled as "...", that is appended to the content paragraph of an API description. This affordance indicates that more documentation is available, and that by clicking on the ellipsis the user can...
python
def _create_api_details_link(self, fullname, refrole): """Appends a link to the API docs, labelled as "...", that is appended to the content paragraph of an API description. This affordance indicates that more documentation is available, and that by clicking on the ellipsis the user can...
[ "def", "_create_api_details_link", "(", "self", ",", "fullname", ",", "refrole", ")", ":", "ref_text", "=", "'... <{}>'", ".", "format", "(", "fullname", ")", "xref", "=", "PyXRefRole", "(", ")", "xref_nodes", ",", "_", "=", "xref", "(", "refrole", ",", ...
Appends a link to the API docs, labelled as "...", that is appended to the content paragraph of an API description. This affordance indicates that more documentation is available, and that by clicking on the ellipsis the user can find that documentation.
[ "Appends", "a", "link", "to", "the", "API", "docs", "labelled", "as", "...", "that", "is", "appended", "to", "the", "content", "paragraph", "of", "an", "API", "description", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L191-L204
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._format_config_nodes
def _format_config_nodes(self, modulename, classname): """Create a ``desc`` node summarizing the config attribute The ``config`` attribute is not statically available from a task class. This method manually creates a signature and docstring for the config attribute. """ ...
python
def _format_config_nodes(self, modulename, classname): """Create a ``desc`` node summarizing the config attribute The ``config`` attribute is not statically available from a task class. This method manually creates a signature and docstring for the config attribute. """ ...
[ "def", "_format_config_nodes", "(", "self", ",", "modulename", ",", "classname", ")", ":", "fullname", "=", "'{0}.{1}.config'", ".", "format", "(", "modulename", ",", "classname", ")", "desc_sig_node", "=", "desc_signature", "(", ")", "desc_sig_node", "[", "'mod...
Create a ``desc`` node summarizing the config attribute The ``config`` attribute is not statically available from a task class. This method manually creates a signature and docstring for the config attribute.
[ "Create", "a", "desc", "node", "summarizing", "the", "config", "attribute" ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L206-L242
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._format_import_example
def _format_import_example(self, task_class): """Generate nodes that show a code sample demonstrating how to import the task class. Parameters ---------- task_class : ``lsst.pipe.base.Task``-type The Task class. Returns ------- nodes : `list`...
python
def _format_import_example(self, task_class): """Generate nodes that show a code sample demonstrating how to import the task class. Parameters ---------- task_class : ``lsst.pipe.base.Task``-type The Task class. Returns ------- nodes : `list`...
[ "def", "_format_import_example", "(", "self", ",", "task_class", ")", ":", "code", "=", "'from {0.__module__} import {0.__name__}'", ".", "format", "(", "task_class", ")", "literal_node", "=", "nodes", ".", "literal_block", "(", "code", ",", "code", ")", "literal_...
Generate nodes that show a code sample demonstrating how to import the task class. Parameters ---------- task_class : ``lsst.pipe.base.Task``-type The Task class. Returns ------- nodes : `list` of docutils nodes Docutils nodes showing a c...
[ "Generate", "nodes", "that", "show", "a", "code", "sample", "demonstrating", "how", "to", "import", "the", "task", "class", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L244-L265
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/pyapisummary.py
TaskApiDirective._format_api_docs_link_message
def _format_api_docs_link_message(self, task_class): """Format a message referring the reader to the full API docs. Parameters ---------- task_class : ``lsst.pipe.base.Task``-type The Task class. Returns ------- nodes : `list` of docutils nodes ...
python
def _format_api_docs_link_message(self, task_class): """Format a message referring the reader to the full API docs. Parameters ---------- task_class : ``lsst.pipe.base.Task``-type The Task class. Returns ------- nodes : `list` of docutils nodes ...
[ "def", "_format_api_docs_link_message", "(", "self", ",", "task_class", ")", ":", "fullname", "=", "'{0.__module__}.{0.__name__}'", ".", "format", "(", "task_class", ")", "p_node", "=", "nodes", ".", "paragraph", "(", ")", "_", "=", "'See the '", "p_node", "+=",...
Format a message referring the reader to the full API docs. Parameters ---------- task_class : ``lsst.pipe.base.Task``-type The Task class. Returns ------- nodes : `list` of docutils nodes Docutils nodes showing a link to the full API docs.
[ "Format", "a", "message", "referring", "the", "reader", "to", "the", "full", "API", "docs", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/pyapisummary.py#L267-L303
train
nathan-hoad/aiomanhole
aiomanhole/__init__.py
InteractiveInterpreter.send_exception
def send_exception(self): """When an exception has occurred, write the traceback to the user.""" self.compiler.reset() exc = traceback.format_exc() self.writer.write(exc.encode('utf8')) yield from self.writer.drain()
python
def send_exception(self): """When an exception has occurred, write the traceback to the user.""" self.compiler.reset() exc = traceback.format_exc() self.writer.write(exc.encode('utf8')) yield from self.writer.drain()
[ "def", "send_exception", "(", "self", ")", ":", "self", ".", "compiler", ".", "reset", "(", ")", "exc", "=", "traceback", ".", "format_exc", "(", ")", "self", ".", "writer", ".", "write", "(", "exc", ".", "encode", "(", "'utf8'", ")", ")", "yield", ...
When an exception has occurred, write the traceback to the user.
[ "When", "an", "exception", "has", "occurred", "write", "the", "traceback", "to", "the", "user", "." ]
a13394c79e1878cde67aa2637ae5664df468ed04
https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L66-L73
train
nathan-hoad/aiomanhole
aiomanhole/__init__.py
InteractiveInterpreter.handle_one_command
def handle_one_command(self): """Process a single command. May have many lines.""" while True: yield from self.write_prompt() codeobj = yield from self.read_command() if codeobj is not None: yield from self.run_command(codeobj)
python
def handle_one_command(self): """Process a single command. May have many lines.""" while True: yield from self.write_prompt() codeobj = yield from self.read_command() if codeobj is not None: yield from self.run_command(codeobj)
[ "def", "handle_one_command", "(", "self", ")", ":", "while", "True", ":", "yield", "from", "self", ".", "write_prompt", "(", ")", "codeobj", "=", "yield", "from", "self", ".", "read_command", "(", ")", "if", "codeobj", "is", "not", "None", ":", "yield", ...
Process a single command. May have many lines.
[ "Process", "a", "single", "command", ".", "May", "have", "many", "lines", "." ]
a13394c79e1878cde67aa2637ae5664df468ed04
https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L88-L96
train
nathan-hoad/aiomanhole
aiomanhole/__init__.py
InteractiveInterpreter.run_command
def run_command(self, codeobj): """Execute a compiled code object, and write the output back to the client.""" try: value, stdout = yield from self.attempt_exec(codeobj, self.namespace) except Exception: yield from self.send_exception() return else: ...
python
def run_command(self, codeobj): """Execute a compiled code object, and write the output back to the client.""" try: value, stdout = yield from self.attempt_exec(codeobj, self.namespace) except Exception: yield from self.send_exception() return else: ...
[ "def", "run_command", "(", "self", ",", "codeobj", ")", ":", "try", ":", "value", ",", "stdout", "=", "yield", "from", "self", ".", "attempt_exec", "(", "codeobj", ",", "self", ".", "namespace", ")", "except", "Exception", ":", "yield", "from", "self", ...
Execute a compiled code object, and write the output back to the client.
[ "Execute", "a", "compiled", "code", "object", "and", "write", "the", "output", "back", "to", "the", "client", "." ]
a13394c79e1878cde67aa2637ae5664df468ed04
https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L99-L107
train
nathan-hoad/aiomanhole
aiomanhole/__init__.py
InteractiveInterpreter.read_command
def read_command(self): """Read a command from the user line by line. Returns a code object suitable for execution. """ reader = self.reader line = yield from reader.readline() if line == b'': # lost connection raise ConnectionResetError() try: ...
python
def read_command(self): """Read a command from the user line by line. Returns a code object suitable for execution. """ reader = self.reader line = yield from reader.readline() if line == b'': # lost connection raise ConnectionResetError() try: ...
[ "def", "read_command", "(", "self", ")", ":", "reader", "=", "self", ".", "reader", "line", "=", "yield", "from", "reader", ".", "readline", "(", ")", "if", "line", "==", "b''", ":", "raise", "ConnectionResetError", "(", ")", "try", ":", "codeobj", "="...
Read a command from the user line by line. Returns a code object suitable for execution.
[ "Read", "a", "command", "from", "the", "user", "line", "by", "line", "." ]
a13394c79e1878cde67aa2637ae5664df468ed04
https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L121-L140
train
nathan-hoad/aiomanhole
aiomanhole/__init__.py
InteractiveInterpreter.send_output
def send_output(self, value, stdout): """Write the output or value of the expression back to user. >>> 5 5 >>> print('cash rules everything around me') cash rules everything around me """ writer = self.writer if value is not None: writer.wri...
python
def send_output(self, value, stdout): """Write the output or value of the expression back to user. >>> 5 5 >>> print('cash rules everything around me') cash rules everything around me """ writer = self.writer if value is not None: writer.wri...
[ "def", "send_output", "(", "self", ",", "value", ",", "stdout", ")", ":", "writer", "=", "self", ".", "writer", "if", "value", "is", "not", "None", ":", "writer", ".", "write", "(", "'{!r}\\n'", ".", "format", "(", "value", ")", ".", "encode", "(", ...
Write the output or value of the expression back to user. >>> 5 5 >>> print('cash rules everything around me') cash rules everything around me
[ "Write", "the", "output", "or", "value", "of", "the", "expression", "back", "to", "user", "." ]
a13394c79e1878cde67aa2637ae5664df468ed04
https://github.com/nathan-hoad/aiomanhole/blob/a13394c79e1878cde67aa2637ae5664df468ed04/aiomanhole/__init__.py#L143-L160
train
jslang/responsys
responsys/client.py
InteractClient.call
def call(self, method, *args): """ Calls the service method defined with the arguments provided """ try: response = getattr(self.client.service, method)(*args) except (URLError, SSLError) as e: log.exception('Failed to connect to responsys service') raise Conn...
python
def call(self, method, *args): """ Calls the service method defined with the arguments provided """ try: response = getattr(self.client.service, method)(*args) except (URLError, SSLError) as e: log.exception('Failed to connect to responsys service') raise Conn...
[ "def", "call", "(", "self", ",", "method", ",", "*", "args", ")", ":", "try", ":", "response", "=", "getattr", "(", "self", ".", "client", ".", "service", ",", "method", ")", "(", "*", "args", ")", "except", "(", "URLError", ",", "SSLError", ")", ...
Calls the service method defined with the arguments provided
[ "Calls", "the", "service", "method", "defined", "with", "the", "arguments", "provided" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L110-L131
train
jslang/responsys
responsys/client.py
InteractClient.connect
def connect(self): """ Connects to the Responsys soap service Uses the credentials passed to the client init to login and setup the session id returned. Returns True on successful connection, otherwise False. """ if self.session and self.session.is_expired: # Close ...
python
def connect(self): """ Connects to the Responsys soap service Uses the credentials passed to the client init to login and setup the session id returned. Returns True on successful connection, otherwise False. """ if self.session and self.session.is_expired: # Close ...
[ "def", "connect", "(", "self", ")", ":", "if", "self", ".", "session", "and", "self", ".", "session", ".", "is_expired", ":", "self", ".", "disconnect", "(", "abandon_session", "=", "True", ")", "if", "not", "self", ".", "session", ":", "try", ":", "...
Connects to the Responsys soap service Uses the credentials passed to the client init to login and setup the session id returned. Returns True on successful connection, otherwise False.
[ "Connects", "to", "the", "Responsys", "soap", "service" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L133-L155
train
jslang/responsys
responsys/client.py
InteractClient.disconnect
def disconnect(self, abandon_session=False): """ Disconnects from the Responsys soap service Calls the service logout method and destroys the client's session information. Returns True on success, False otherwise. """ self.connected = False if (self.session and self.sess...
python
def disconnect(self, abandon_session=False): """ Disconnects from the Responsys soap service Calls the service logout method and destroys the client's session information. Returns True on success, False otherwise. """ self.connected = False if (self.session and self.sess...
[ "def", "disconnect", "(", "self", ",", "abandon_session", "=", "False", ")", ":", "self", ".", "connected", "=", "False", "if", "(", "self", ".", "session", "and", "self", ".", "session", ".", "is_expired", ")", "or", "abandon_session", ":", "try", ":", ...
Disconnects from the Responsys soap service Calls the service logout method and destroys the client's session information. Returns True on success, False otherwise.
[ "Disconnects", "from", "the", "Responsys", "soap", "service" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L157-L173
train
jslang/responsys
responsys/client.py
InteractClient.merge_list_members
def merge_list_members(self, list_, record_data, merge_rule): """ Responsys.mergeListMembers call Accepts: InteractObject list_ RecordData record_data ListMergeRule merge_rule Returns a MergeResult """ list_ = list_.get_soap_object(self.clien...
python
def merge_list_members(self, list_, record_data, merge_rule): """ Responsys.mergeListMembers call Accepts: InteractObject list_ RecordData record_data ListMergeRule merge_rule Returns a MergeResult """ list_ = list_.get_soap_object(self.clien...
[ "def", "merge_list_members", "(", "self", ",", "list_", ",", "record_data", ",", "merge_rule", ")", ":", "list_", "=", "list_", ".", "get_soap_object", "(", "self", ".", "client", ")", "record_data", "=", "record_data", ".", "get_soap_object", "(", "self", "...
Responsys.mergeListMembers call Accepts: InteractObject list_ RecordData record_data ListMergeRule merge_rule Returns a MergeResult
[ "Responsys", ".", "mergeListMembers", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L205-L218
train
jslang/responsys
responsys/client.py
InteractClient.merge_list_members_RIID
def merge_list_members_RIID(self, list_, record_data, merge_rule): """ Responsys.mergeListMembersRIID call Accepts: InteractObject list_ RecordData record_data ListMergeRule merge_rule Returns a RecipientResult """ list_ = list_.get_soap_obje...
python
def merge_list_members_RIID(self, list_, record_data, merge_rule): """ Responsys.mergeListMembersRIID call Accepts: InteractObject list_ RecordData record_data ListMergeRule merge_rule Returns a RecipientResult """ list_ = list_.get_soap_obje...
[ "def", "merge_list_members_RIID", "(", "self", ",", "list_", ",", "record_data", ",", "merge_rule", ")", ":", "list_", "=", "list_", ".", "get_soap_object", "(", "self", ".", "client", ")", "result", "=", "self", ".", "call", "(", "'mergeListMembersRIID'", "...
Responsys.mergeListMembersRIID call Accepts: InteractObject list_ RecordData record_data ListMergeRule merge_rule Returns a RecipientResult
[ "Responsys", ".", "mergeListMembersRIID", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L220-L232
train
jslang/responsys
responsys/client.py
InteractClient.delete_list_members
def delete_list_members(self, list_, query_column, ids_to_delete): """ Responsys.deleteListMembers call Accepts: InteractObject list_ string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete ...
python
def delete_list_members(self, list_, query_column, ids_to_delete): """ Responsys.deleteListMembers call Accepts: InteractObject list_ string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete ...
[ "def", "delete_list_members", "(", "self", ",", "list_", ",", "query_column", ",", "ids_to_delete", ")", ":", "list_", "=", "list_", ".", "get_soap_object", "(", "self", ".", "client", ")", "result", "=", "self", ".", "call", "(", "'deleteListMembers'", ",",...
Responsys.deleteListMembers call Accepts: InteractObject list_ string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete Returns a list of DeleteResult instances
[ "Responsys", ".", "deleteListMembers", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L234-L249
train
jslang/responsys
responsys/client.py
InteractClient.retrieve_list_members
def retrieve_list_members(self, list_, query_column, field_list, ids_to_retrieve): """ Responsys.retrieveListMembers call Accepts: InteractObject list_ string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list fiel...
python
def retrieve_list_members(self, list_, query_column, field_list, ids_to_retrieve): """ Responsys.retrieveListMembers call Accepts: InteractObject list_ string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list fiel...
[ "def", "retrieve_list_members", "(", "self", ",", "list_", ",", "query_column", ",", "field_list", ",", "ids_to_retrieve", ")", ":", "list_", "=", "list_", ".", "get_soap_object", "(", "self", ".", "client", ")", "result", "=", "self", ".", "call", "(", "'...
Responsys.retrieveListMembers call Accepts: InteractObject list_ string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list field_list list ids_to_retrieve Returns a RecordData instance
[ "Responsys", ".", "retrieveListMembers", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L251-L265
train
jslang/responsys
responsys/client.py
InteractClient.create_table
def create_table(self, table, fields): """ Responsys.createTable call Accepts: InteractObject table list fields Returns True on success """ table = table.get_soap_object(self.client) return self.call('createTable', table, fields)
python
def create_table(self, table, fields): """ Responsys.createTable call Accepts: InteractObject table list fields Returns True on success """ table = table.get_soap_object(self.client) return self.call('createTable', table, fields)
[ "def", "create_table", "(", "self", ",", "table", ",", "fields", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "return", "self", ".", "call", "(", "'createTable'", ",", "table", ",", "fields", ")" ]
Responsys.createTable call Accepts: InteractObject table list fields Returns True on success
[ "Responsys", ".", "createTable", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L268-L278
train
jslang/responsys
responsys/client.py
InteractClient.create_table_with_pk
def create_table_with_pk(self, table, fields, primary_keys): """ Responsys.createTableWithPK call Accepts: InteractObject table list fields list primary_keys Returns True on success """ table = table.get_soap_object(self.client) retur...
python
def create_table_with_pk(self, table, fields, primary_keys): """ Responsys.createTableWithPK call Accepts: InteractObject table list fields list primary_keys Returns True on success """ table = table.get_soap_object(self.client) retur...
[ "def", "create_table_with_pk", "(", "self", ",", "table", ",", "fields", ",", "primary_keys", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "return", "self", ".", "call", "(", "'createTableWithPK'", ",", "table", ...
Responsys.createTableWithPK call Accepts: InteractObject table list fields list primary_keys Returns True on success
[ "Responsys", ".", "createTableWithPK", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L280-L291
train
jslang/responsys
responsys/client.py
InteractClient.delete_table
def delete_table(self, table): """ Responsys.deleteTable call Accepts: InteractObject table Returns True on success """ table = table.get_soap_object(self.client) return self.call('deleteTable', table)
python
def delete_table(self, table): """ Responsys.deleteTable call Accepts: InteractObject table Returns True on success """ table = table.get_soap_object(self.client) return self.call('deleteTable', table)
[ "def", "delete_table", "(", "self", ",", "table", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "return", "self", ".", "call", "(", "'deleteTable'", ",", "table", ")" ]
Responsys.deleteTable call Accepts: InteractObject table Returns True on success
[ "Responsys", ".", "deleteTable", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L293-L302
train
jslang/responsys
responsys/client.py
InteractClient.delete_profile_extension_members
def delete_profile_extension_members(self, profile_extension, query_column, ids_to_delete): """ Responsys.deleteProfileExtensionRecords call Accepts: InteractObject profile_extension list field_list list ids_to_retrieve string query_column ...
python
def delete_profile_extension_members(self, profile_extension, query_column, ids_to_delete): """ Responsys.deleteProfileExtensionRecords call Accepts: InteractObject profile_extension list field_list list ids_to_retrieve string query_column ...
[ "def", "delete_profile_extension_members", "(", "self", ",", "profile_extension", ",", "query_column", ",", "ids_to_delete", ")", ":", "profile_extension", "=", "profile_extension", ".", "get_soap_object", "(", "self", ".", "client", ")", "result", "=", "self", ".",...
Responsys.deleteProfileExtensionRecords call Accepts: InteractObject profile_extension list field_list list ids_to_retrieve string query_column default: 'RIID' Returns list of DeleteResults
[ "Responsys", ".", "deleteProfileExtensionRecords", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L304-L321
train
jslang/responsys
responsys/client.py
InteractClient.retrieve_profile_extension_records
def retrieve_profile_extension_records(self, profile_extension, field_list, ids_to_retrieve, query_column='RIID'): """ Responsys.retrieveProfileExtensionRecords call Accepts: InteractObject profile_extension list field_list ...
python
def retrieve_profile_extension_records(self, profile_extension, field_list, ids_to_retrieve, query_column='RIID'): """ Responsys.retrieveProfileExtensionRecords call Accepts: InteractObject profile_extension list field_list ...
[ "def", "retrieve_profile_extension_records", "(", "self", ",", "profile_extension", ",", "field_list", ",", "ids_to_retrieve", ",", "query_column", "=", "'RIID'", ")", ":", "profile_extension", "=", "profile_extension", ".", "get_soap_object", "(", "self", ".", "clien...
Responsys.retrieveProfileExtensionRecords call Accepts: InteractObject profile_extension list field_list list ids_to_retrieve string query_column default: 'RIID' Returns RecordData
[ "Responsys", ".", "retrieveProfileExtensionRecords", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L323-L339
train
jslang/responsys
responsys/client.py
InteractClient.truncate_table
def truncate_table(self, table): """ Responsys.truncateTable call Accepts: InteractObject table Returns True on success """ table = table.get_soap_object(self.client) return self.call('truncateTable', table)
python
def truncate_table(self, table): """ Responsys.truncateTable call Accepts: InteractObject table Returns True on success """ table = table.get_soap_object(self.client) return self.call('truncateTable', table)
[ "def", "truncate_table", "(", "self", ",", "table", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "return", "self", ".", "call", "(", "'truncateTable'", ",", "table", ")" ]
Responsys.truncateTable call Accepts: InteractObject table Returns True on success
[ "Responsys", ".", "truncateTable", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L341-L350
train
jslang/responsys
responsys/client.py
InteractClient.delete_table_records
def delete_table_records(self, table, query_column, ids_to_delete): """ Responsys.deleteTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete ...
python
def delete_table_records(self, table, query_column, ids_to_delete): """ Responsys.deleteTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete ...
[ "def", "delete_table_records", "(", "self", ",", "table", ",", "query_column", ",", "ids_to_delete", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "result", "=", "self", ".", "call", "(", "'deleteTableRecords'", ",...
Responsys.deleteTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete Returns a list of DeleteResult instances
[ "Responsys", ".", "deleteTableRecords", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L352-L367
train
jslang/responsys
responsys/client.py
InteractClient.merge_table_records
def merge_table_records(self, table, record_data, match_column_names): """ Responsys.mergeTableRecords call Accepts: InteractObject table RecordData record_data list match_column_names Returns a MergeResult """ table = table.get_soap_object(s...
python
def merge_table_records(self, table, record_data, match_column_names): """ Responsys.mergeTableRecords call Accepts: InteractObject table RecordData record_data list match_column_names Returns a MergeResult """ table = table.get_soap_object(s...
[ "def", "merge_table_records", "(", "self", ",", "table", ",", "record_data", ",", "match_column_names", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "record_data", "=", "record_data", ".", "get_soap_object", "(", "s...
Responsys.mergeTableRecords call Accepts: InteractObject table RecordData record_data list match_column_names Returns a MergeResult
[ "Responsys", ".", "mergeTableRecords", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L369-L382
train
jslang/responsys
responsys/client.py
InteractClient.merge_table_records_with_pk
def merge_table_records_with_pk(self, table, record_data, insert_on_no_match, update_on_match): """ Responsys.mergeTableRecordsWithPK call Accepts: InteractObject table RecordData record_data string insert_on_no_match string update_on_match Retur...
python
def merge_table_records_with_pk(self, table, record_data, insert_on_no_match, update_on_match): """ Responsys.mergeTableRecordsWithPK call Accepts: InteractObject table RecordData record_data string insert_on_no_match string update_on_match Retur...
[ "def", "merge_table_records_with_pk", "(", "self", ",", "table", ",", "record_data", ",", "insert_on_no_match", ",", "update_on_match", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "record_data", "=", "record_data", "...
Responsys.mergeTableRecordsWithPK call Accepts: InteractObject table RecordData record_data string insert_on_no_match string update_on_match Returns a MergeResult
[ "Responsys", ".", "mergeTableRecordsWithPK", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L384-L398
train
jslang/responsys
responsys/client.py
InteractClient.merge_into_profile_extension
def merge_into_profile_extension(self, profile_extension, record_data, match_column, insert_on_no_match, update_on_match): """ Responsys.mergeIntoProfileExtension call Accepts: InteractObject profile_extension RecordData record_data ...
python
def merge_into_profile_extension(self, profile_extension, record_data, match_column, insert_on_no_match, update_on_match): """ Responsys.mergeIntoProfileExtension call Accepts: InteractObject profile_extension RecordData record_data ...
[ "def", "merge_into_profile_extension", "(", "self", ",", "profile_extension", ",", "record_data", ",", "match_column", ",", "insert_on_no_match", ",", "update_on_match", ")", ":", "profile_extension", "=", "profile_extension", ".", "get_soap_object", "(", "self", ".", ...
Responsys.mergeIntoProfileExtension call Accepts: InteractObject profile_extension RecordData record_data string match_column string insert_on_no_match string update_on_match Returns a RecipientResult
[ "Responsys", ".", "mergeIntoProfileExtension", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L400-L418
train
jslang/responsys
responsys/client.py
InteractClient.retrieve_table_records
def retrieve_table_records(self, table, query_column, field_list, ids_to_retrieve): """ Responsys.retrieveTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list fi...
python
def retrieve_table_records(self, table, query_column, field_list, ids_to_retrieve): """ Responsys.retrieveTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list fi...
[ "def", "retrieve_table_records", "(", "self", ",", "table", ",", "query_column", ",", "field_list", ",", "ids_to_retrieve", ")", ":", "table", "=", "table", ".", "get_soap_object", "(", "self", ".", "client", ")", "return", "RecordData", ".", "from_soap_type", ...
Responsys.retrieveTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list field_list list ids_to_retrieve Returns a RecordData
[ "Responsys", ".", "retrieveTableRecords", "call" ]
9b355a444c0c75dff41064502c1e2b76dfd5cb93
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L420-L434
train
bluekeyes/sphinx-javalink
javalink/ref.py
normalize_docroot
def normalize_docroot(app, root): """Creates a package-list URL and a link base from a docroot element. Args: app: the global app object root: the docroot element [string or dictionary] """ srcdir = app.env.srcdir default_version = app.config.javalink_default_version if isinst...
python
def normalize_docroot(app, root): """Creates a package-list URL and a link base from a docroot element. Args: app: the global app object root: the docroot element [string or dictionary] """ srcdir = app.env.srcdir default_version = app.config.javalink_default_version if isinst...
[ "def", "normalize_docroot", "(", "app", ",", "root", ")", ":", "srcdir", "=", "app", ".", "env", ".", "srcdir", "default_version", "=", "app", ".", "config", ".", "javalink_default_version", "if", "isinstance", "(", "root", ",", "basestring", ")", ":", "("...
Creates a package-list URL and a link base from a docroot element. Args: app: the global app object root: the docroot element [string or dictionary]
[ "Creates", "a", "package", "-", "list", "URL", "and", "a", "link", "base", "from", "a", "docroot", "element", "." ]
490e37506efa53e95ad88a665e347536e75b6254
https://github.com/bluekeyes/sphinx-javalink/blob/490e37506efa53e95ad88a665e347536e75b6254/javalink/ref.py#L296-L324
train
mojaie/chorus
chorus/descriptor.py
assign_valence
def assign_valence(mol): """Assign pi electron and hydrogens""" for u, v, bond in mol.bonds_iter(): if bond.order == 2: mol.atom(u).pi = 1 mol.atom(v).pi = 1 if mol.atom(u).symbol == "O" and not mol.atom(u).charge: mol.atom(v).carbonyl_C = 1 ...
python
def assign_valence(mol): """Assign pi electron and hydrogens""" for u, v, bond in mol.bonds_iter(): if bond.order == 2: mol.atom(u).pi = 1 mol.atom(v).pi = 1 if mol.atom(u).symbol == "O" and not mol.atom(u).charge: mol.atom(v).carbonyl_C = 1 ...
[ "def", "assign_valence", "(", "mol", ")", ":", "for", "u", ",", "v", ",", "bond", "in", "mol", ".", "bonds_iter", "(", ")", ":", "if", "bond", ".", "order", "==", "2", ":", "mol", ".", "atom", "(", "u", ")", ".", "pi", "=", "1", "mol", ".", ...
Assign pi electron and hydrogens
[ "Assign", "pi", "electron", "and", "hydrogens" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/descriptor.py#L10-L32
train
mojaie/chorus
chorus/descriptor.py
assign_charge
def assign_charge(mol, force_recalc=False): """Assign charges in physiological condition""" # TODO: not implemented yet mol.require("Aromatic") for i, nbrs in mol.neighbors_iter(): atom = mol.atom(i) nbrcnt = len(nbrs) if atom.symbol == "N": if not atom.pi: ...
python
def assign_charge(mol, force_recalc=False): """Assign charges in physiological condition""" # TODO: not implemented yet mol.require("Aromatic") for i, nbrs in mol.neighbors_iter(): atom = mol.atom(i) nbrcnt = len(nbrs) if atom.symbol == "N": if not atom.pi: ...
[ "def", "assign_charge", "(", "mol", ",", "force_recalc", "=", "False", ")", ":", "mol", ".", "require", "(", "\"Aromatic\"", ")", "for", "i", ",", "nbrs", "in", "mol", ".", "neighbors_iter", "(", ")", ":", "atom", "=", "mol", ".", "atom", "(", "i", ...
Assign charges in physiological condition
[ "Assign", "charges", "in", "physiological", "condition" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/descriptor.py#L99-L146
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
get_type
def get_type(type_name): """Get a type given its importable name. Parameters ---------- task_name : `str` Name of the Python type, such as ``mypackage.MyClass``. Returns ------- object The object. """ parts = type_name.split('.') if len(parts) < 2: raise...
python
def get_type(type_name): """Get a type given its importable name. Parameters ---------- task_name : `str` Name of the Python type, such as ``mypackage.MyClass``. Returns ------- object The object. """ parts = type_name.split('.') if len(parts) < 2: raise...
[ "def", "get_type", "(", "type_name", ")", ":", "parts", "=", "type_name", ".", "split", "(", "'.'", ")", "if", "len", "(", "parts", ")", "<", "2", ":", "raise", "SphinxError", "(", "'Type must be fully-qualified, '", "'of the form ``module.MyClass``. Got: {}'", ...
Get a type given its importable name. Parameters ---------- task_name : `str` Name of the Python type, such as ``mypackage.MyClass``. Returns ------- object The object.
[ "Get", "a", "type", "given", "its", "importable", "name", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L35-L56
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
get_task_config_fields
def get_task_config_fields(config_class): """Get all configuration Fields from a Config class. Parameters ---------- config_class : ``lsst.pipe.base.Config``-type The configuration class (not an instance) corresponding to a Task. Returns ------- config_fields : `dict` Mappi...
python
def get_task_config_fields(config_class): """Get all configuration Fields from a Config class. Parameters ---------- config_class : ``lsst.pipe.base.Config``-type The configuration class (not an instance) corresponding to a Task. Returns ------- config_fields : `dict` Mappi...
[ "def", "get_task_config_fields", "(", "config_class", ")", ":", "from", "lsst", ".", "pex", ".", "config", "import", "Field", "def", "is_config_field", "(", "obj", ")", ":", "return", "isinstance", "(", "obj", ",", "Field", ")", "return", "_get_alphabetical_me...
Get all configuration Fields from a Config class. Parameters ---------- config_class : ``lsst.pipe.base.Config``-type The configuration class (not an instance) corresponding to a Task. Returns ------- config_fields : `dict` Mapping where keys are the config attribute names and ...
[ "Get", "all", "configuration", "Fields", "from", "a", "Config", "class", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L59-L79
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
get_subtask_fields
def get_subtask_fields(config_class): """Get all configurable subtask fields from a Config class. Parameters ---------- config_class : ``lsst.pipe.base.Config``-type The configuration class (not an instance) corresponding to a Task. Returns ------- subtask_fields : `dict` M...
python
def get_subtask_fields(config_class): """Get all configurable subtask fields from a Config class. Parameters ---------- config_class : ``lsst.pipe.base.Config``-type The configuration class (not an instance) corresponding to a Task. Returns ------- subtask_fields : `dict` M...
[ "def", "get_subtask_fields", "(", "config_class", ")", ":", "from", "lsst", ".", "pex", ".", "config", "import", "ConfigurableField", ",", "RegistryField", "def", "is_subtask_field", "(", "obj", ")", ":", "return", "isinstance", "(", "obj", ",", "(", "Configur...
Get all configurable subtask fields from a Config class. Parameters ---------- config_class : ``lsst.pipe.base.Config``-type The configuration class (not an instance) corresponding to a Task. Returns ------- subtask_fields : `dict` Mapping where keys are the config attribute na...
[ "Get", "all", "configurable", "subtask", "fields", "from", "a", "Config", "class", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L82-L103
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
_get_alphabetical_members
def _get_alphabetical_members(obj, predicate): """Get members of an object, sorted alphabetically. Parameters ---------- obj An object. predicate : callable Callable that takes an attribute and returns a bool of whether the attribute should be returned or not. Returns ...
python
def _get_alphabetical_members(obj, predicate): """Get members of an object, sorted alphabetically. Parameters ---------- obj An object. predicate : callable Callable that takes an attribute and returns a bool of whether the attribute should be returned or not. Returns ...
[ "def", "_get_alphabetical_members", "(", "obj", ",", "predicate", ")", ":", "fields", "=", "dict", "(", "inspect", ".", "getmembers", "(", "obj", ",", "predicate", ")", ")", "keys", "=", "list", "(", "fields", ".", "keys", "(", ")", ")", "keys", ".", ...
Get members of an object, sorted alphabetically. Parameters ---------- obj An object. predicate : callable Callable that takes an attribute and returns a bool of whether the attribute should be returned or not. Returns ------- members : `dict` Dictionary of ...
[ "Get", "members", "of", "an", "object", "sorted", "alphabetically", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L106-L138
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
typestring
def typestring(obj): """Make a string for the object's type Parameters ---------- obj : obj Python object. Returns ------- `str` String representation of the object's type. This is the type's importable namespace. Examples -------- >>> import docutils.n...
python
def typestring(obj): """Make a string for the object's type Parameters ---------- obj : obj Python object. Returns ------- `str` String representation of the object's type. This is the type's importable namespace. Examples -------- >>> import docutils.n...
[ "def", "typestring", "(", "obj", ")", ":", "obj_type", "=", "type", "(", "obj", ")", "return", "'.'", ".", "join", "(", "(", "obj_type", ".", "__module__", ",", "obj_type", ".", "__name__", ")", ")" ]
Make a string for the object's type Parameters ---------- obj : obj Python object. Returns ------- `str` String representation of the object's type. This is the type's importable namespace. Examples -------- >>> import docutils.nodes >>> para = docutils...
[ "Make", "a", "string", "for", "the", "object", "s", "type" ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L141-L163
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
get_docstring
def get_docstring(obj): """Extract the docstring from an object as individual lines. Parameters ---------- obj : object The Python object (class, function or method) to extract docstrings from. Returns ------- lines : `list` of `str` Individual docstring lines with ...
python
def get_docstring(obj): """Extract the docstring from an object as individual lines. Parameters ---------- obj : object The Python object (class, function or method) to extract docstrings from. Returns ------- lines : `list` of `str` Individual docstring lines with ...
[ "def", "get_docstring", "(", "obj", ")", ":", "docstring", "=", "getdoc", "(", "obj", ",", "allow_inherited", "=", "True", ")", "if", "docstring", "is", "None", ":", "logger", "=", "getLogger", "(", "__name__", ")", "logger", ".", "warning", "(", "\"Obje...
Extract the docstring from an object as individual lines. Parameters ---------- obj : object The Python object (class, function or method) to extract docstrings from. Returns ------- lines : `list` of `str` Individual docstring lines with common indentation removed, and...
[ "Extract", "the", "docstring", "from", "an", "object", "as", "individual", "lines", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L166-L193
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/taskutils.py
extract_docstring_summary
def extract_docstring_summary(docstring): """Get the first summary sentence from a docstring. Parameters ---------- docstring : `list` of `str` Output from `get_docstring`. Returns ------- summary : `str` The plain-text summary sentence from the docstring. """ summa...
python
def extract_docstring_summary(docstring): """Get the first summary sentence from a docstring. Parameters ---------- docstring : `list` of `str` Output from `get_docstring`. Returns ------- summary : `str` The plain-text summary sentence from the docstring. """ summa...
[ "def", "extract_docstring_summary", "(", "docstring", ")", ":", "summary_lines", "=", "[", "]", "for", "line", "in", "docstring", ":", "if", "line", "==", "''", ":", "break", "else", ":", "summary_lines", ".", "append", "(", "line", ")", "return", "' '", ...
Get the first summary sentence from a docstring. Parameters ---------- docstring : `list` of `str` Output from `get_docstring`. Returns ------- summary : `str` The plain-text summary sentence from the docstring.
[ "Get", "the", "first", "summary", "sentence", "from", "a", "docstring", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/taskutils.py#L196-L215
train
ehansis/ozelot
examples/superheroes/superheroes/pipeline.py
LoadMovieAppearances.run
def run(self): """Run loading of movie appearances. The wiki page structure for this part cannot be easily handled by simple xpath queries. We need to iterate over the respective portion of the page and parse appearances. """ # make all requests via a cache instance req...
python
def run(self): """Run loading of movie appearances. The wiki page structure for this part cannot be easily handled by simple xpath queries. We need to iterate over the respective portion of the page and parse appearances. """ # make all requests via a cache instance req...
[ "def", "run", "(", "self", ")", ":", "request_cache", "=", "cache", ".", "get_request_cache", "(", ")", "session", "=", "client", ".", "get_client", "(", ")", ".", "create_session", "(", ")", "self", ".", "mark_incomplete", "(", ")", "universes", "=", "[...
Run loading of movie appearances. The wiki page structure for this part cannot be easily handled by simple xpath queries. We need to iterate over the respective portion of the page and parse appearances.
[ "Run", "loading", "of", "movie", "appearances", "." ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L635-L733
train
ehansis/ozelot
examples/superheroes/superheroes/pipeline.py
InflationAdjustMovieBudgets.run
def run(self): """Compute and store inflation-adjusted movie budgets """ self.mark_incomplete() session = client.get_client().create_session() # load CPI data cpi = ConsumerPriceIndexFile().load() # max year we have CPI data for max_cpi_year = cpi['Year'...
python
def run(self): """Compute and store inflation-adjusted movie budgets """ self.mark_incomplete() session = client.get_client().create_session() # load CPI data cpi = ConsumerPriceIndexFile().load() # max year we have CPI data for max_cpi_year = cpi['Year'...
[ "def", "run", "(", "self", ")", ":", "self", ".", "mark_incomplete", "(", ")", "session", "=", "client", ".", "get_client", "(", ")", ".", "create_session", "(", ")", "cpi", "=", "ConsumerPriceIndexFile", "(", ")", ".", "load", "(", ")", "max_cpi_year", ...
Compute and store inflation-adjusted movie budgets
[ "Compute", "and", "store", "inflation", "-", "adjusted", "movie", "budgets" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/pipeline.py#L822-L850
train
potash/drain
drain/metrics.py
_argsort
def _argsort(y_score, k=None): """ Returns the indexes in descending order of the top k score or all scores if k is None """ ranks = y_score.argsort() argsort = ranks[::-1] if k is not None: argsort = argsort[0:k] return argsort
python
def _argsort(y_score, k=None): """ Returns the indexes in descending order of the top k score or all scores if k is None """ ranks = y_score.argsort() argsort = ranks[::-1] if k is not None: argsort = argsort[0:k] return argsort
[ "def", "_argsort", "(", "y_score", ",", "k", "=", "None", ")", ":", "ranks", "=", "y_score", ".", "argsort", "(", ")", "argsort", "=", "ranks", "[", ":", ":", "-", "1", "]", "if", "k", "is", "not", "None", ":", "argsort", "=", "argsort", "[", "...
Returns the indexes in descending order of the top k score or all scores if k is None
[ "Returns", "the", "indexes", "in", "descending", "order", "of", "the", "top", "k", "score", "or", "all", "scores", "if", "k", "is", "None" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L16-L26
train
potash/drain
drain/metrics.py
count
def count(y_true, y_score=None, countna=False): """ Counts the number of examples. If countna is False then only count labeled examples, i.e. those with y_true not NaN """ if not countna: return (~np.isnan(to_float(y_true))).sum() else: return len(y_true)
python
def count(y_true, y_score=None, countna=False): """ Counts the number of examples. If countna is False then only count labeled examples, i.e. those with y_true not NaN """ if not countna: return (~np.isnan(to_float(y_true))).sum() else: return len(y_true)
[ "def", "count", "(", "y_true", ",", "y_score", "=", "None", ",", "countna", "=", "False", ")", ":", "if", "not", "countna", ":", "return", "(", "~", "np", ".", "isnan", "(", "to_float", "(", "y_true", ")", ")", ")", ".", "sum", "(", ")", "else", ...
Counts the number of examples. If countna is False then only count labeled examples, i.e. those with y_true not NaN
[ "Counts", "the", "number", "of", "examples", ".", "If", "countna", "is", "False", "then", "only", "count", "labeled", "examples", "i", ".", "e", ".", "those", "with", "y_true", "not", "NaN" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L40-L48
train
potash/drain
drain/metrics.py
count_series
def count_series(y_true, y_score, countna=False): """ Returns series whose i-th entry is the number of examples in the top i """ y_true, y_score = to_float(y_true, y_score) top = _argsort(y_score) if not countna: a = (~np.isnan(y_true[top])).cumsum() else: a = range(1, len(y...
python
def count_series(y_true, y_score, countna=False): """ Returns series whose i-th entry is the number of examples in the top i """ y_true, y_score = to_float(y_true, y_score) top = _argsort(y_score) if not countna: a = (~np.isnan(y_true[top])).cumsum() else: a = range(1, len(y...
[ "def", "count_series", "(", "y_true", ",", "y_score", ",", "countna", "=", "False", ")", ":", "y_true", ",", "y_score", "=", "to_float", "(", "y_true", ",", "y_score", ")", "top", "=", "_argsort", "(", "y_score", ")", "if", "not", "countna", ":", "a", ...
Returns series whose i-th entry is the number of examples in the top i
[ "Returns", "series", "whose", "i", "-", "th", "entry", "is", "the", "number", "of", "examples", "in", "the", "top", "i" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L51-L63
train
potash/drain
drain/metrics.py
baseline
def baseline(y_true, y_score=None): """ Number of positive labels divided by number of labels, or zero if there are no labels """ if len(y_true) > 0: return np.nansum(y_true)/count(y_true, countna=False) else: return 0.0
python
def baseline(y_true, y_score=None): """ Number of positive labels divided by number of labels, or zero if there are no labels """ if len(y_true) > 0: return np.nansum(y_true)/count(y_true, countna=False) else: return 0.0
[ "def", "baseline", "(", "y_true", ",", "y_score", "=", "None", ")", ":", "if", "len", "(", "y_true", ")", ">", "0", ":", "return", "np", ".", "nansum", "(", "y_true", ")", "/", "count", "(", "y_true", ",", "countna", "=", "False", ")", "else", ":...
Number of positive labels divided by number of labels, or zero if there are no labels
[ "Number", "of", "positive", "labels", "divided", "by", "number", "of", "labels", "or", "zero", "if", "there", "are", "no", "labels" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L66-L74
train
potash/drain
drain/metrics.py
roc_auc
def roc_auc(y_true, y_score): """ Returns are under the ROC curve """ notnull = ~np.isnan(y_true) fpr, tpr, thresholds = sklearn.metrics.roc_curve(y_true[notnull], y_score[notnull]) return sklearn.metrics.auc(fpr, tpr)
python
def roc_auc(y_true, y_score): """ Returns are under the ROC curve """ notnull = ~np.isnan(y_true) fpr, tpr, thresholds = sklearn.metrics.roc_curve(y_true[notnull], y_score[notnull]) return sklearn.metrics.auc(fpr, tpr)
[ "def", "roc_auc", "(", "y_true", ",", "y_score", ")", ":", "notnull", "=", "~", "np", ".", "isnan", "(", "y_true", ")", "fpr", ",", "tpr", ",", "thresholds", "=", "sklearn", ".", "metrics", ".", "roc_curve", "(", "y_true", "[", "notnull", "]", ",", ...
Returns are under the ROC curve
[ "Returns", "are", "under", "the", "ROC", "curve" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L77-L83
train
potash/drain
drain/metrics.py
recall_series
def recall_series(y_true, y_score, k=None, value=True): """ Returns series of length k whose i-th entry is the recall in the top i """ y_true, y_score = to_float(y_true, y_score) top = _argsort(y_score, k) if not value: y_true = 1-y_true a = np.nan_to_num(y_true[top]).cumsum() ...
python
def recall_series(y_true, y_score, k=None, value=True): """ Returns series of length k whose i-th entry is the recall in the top i """ y_true, y_score = to_float(y_true, y_score) top = _argsort(y_score, k) if not value: y_true = 1-y_true a = np.nan_to_num(y_true[top]).cumsum() ...
[ "def", "recall_series", "(", "y_true", ",", "y_score", ",", "k", "=", "None", ",", "value", "=", "True", ")", ":", "y_true", ",", "y_score", "=", "to_float", "(", "y_true", ",", "y_score", ")", "top", "=", "_argsort", "(", "y_score", ",", "k", ")", ...
Returns series of length k whose i-th entry is the recall in the top i
[ "Returns", "series", "of", "length", "k", "whose", "i", "-", "th", "entry", "is", "the", "recall", "in", "the", "top", "i" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/metrics.py#L143-L154
train
hbldh/imdirect
imdirect/_autorotate.py
autorotate
def autorotate(image, orientation=None): """Rotate and return an image according to its Exif information. ROTATION_NEEDED = { 1: 0, 2: 0 (Mirrored), 3: 180, 4: 180 (Mirrored), 5: -90 (Mirrored), 6: -90, 7: 90 (Mirrored), 8: 90, } Args: ...
python
def autorotate(image, orientation=None): """Rotate and return an image according to its Exif information. ROTATION_NEEDED = { 1: 0, 2: 0 (Mirrored), 3: 180, 4: 180 (Mirrored), 5: -90 (Mirrored), 6: -90, 7: 90 (Mirrored), 8: 90, } Args: ...
[ "def", "autorotate", "(", "image", ",", "orientation", "=", "None", ")", ":", "orientation_value", "=", "orientation", "if", "orientation", "else", "image", ".", "_getexif", "(", ")", ".", "get", "(", "EXIF_KEYS", ".", "get", "(", "'Orientation'", ")", ")"...
Rotate and return an image according to its Exif information. ROTATION_NEEDED = { 1: 0, 2: 0 (Mirrored), 3: 180, 4: 180 (Mirrored), 5: -90 (Mirrored), 6: -90, 7: 90 (Mirrored), 8: 90, } Args: image (PIL.Image.Image): PIL image to rota...
[ "Rotate", "and", "return", "an", "image", "according", "to", "its", "Exif", "information", "." ]
12275b9f9faa6952cde2f2fe612bbefab215251a
https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L47-L89
train
hbldh/imdirect
imdirect/_autorotate.py
imdirect_open
def imdirect_open(fp): """Opens, identifies the given image file, and rotates it if it is a JPEG. Note that this method does NOT employ the lazy loading methodology that the PIL Images otherwise use. This is done to avoid having to save new Args: fp: A filename (string), pathlib.Path object or...
python
def imdirect_open(fp): """Opens, identifies the given image file, and rotates it if it is a JPEG. Note that this method does NOT employ the lazy loading methodology that the PIL Images otherwise use. This is done to avoid having to save new Args: fp: A filename (string), pathlib.Path object or...
[ "def", "imdirect_open", "(", "fp", ")", ":", "img", "=", "pil_open", "(", "fp", ",", "'r'", ")", "if", "img", ".", "format", "==", "'JPEG'", ":", "if", "isinstance", "(", "fp", ",", "string_types", ")", ":", "exif", "=", "piexif", ".", "load", "(",...
Opens, identifies the given image file, and rotates it if it is a JPEG. Note that this method does NOT employ the lazy loading methodology that the PIL Images otherwise use. This is done to avoid having to save new Args: fp: A filename (string), pathlib.Path object or a file-like object. Retu...
[ "Opens", "identifies", "the", "given", "image", "file", "and", "rotates", "it", "if", "it", "is", "a", "JPEG", "." ]
12275b9f9faa6952cde2f2fe612bbefab215251a
https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L168-L218
train
hbldh/imdirect
imdirect/_autorotate.py
monkey_patch
def monkey_patch(enabled=True): """Monkey patching PIL.Image.open method Args: enabled (bool): If the monkey patch should be activated or deactivated. """ if enabled: Image.open = imdirect_open else: Image.open = pil_open
python
def monkey_patch(enabled=True): """Monkey patching PIL.Image.open method Args: enabled (bool): If the monkey patch should be activated or deactivated. """ if enabled: Image.open = imdirect_open else: Image.open = pil_open
[ "def", "monkey_patch", "(", "enabled", "=", "True", ")", ":", "if", "enabled", ":", "Image", ".", "open", "=", "imdirect_open", "else", ":", "Image", ".", "open", "=", "pil_open" ]
Monkey patching PIL.Image.open method Args: enabled (bool): If the monkey patch should be activated or deactivated.
[ "Monkey", "patching", "PIL", ".", "Image", ".", "open", "method" ]
12275b9f9faa6952cde2f2fe612bbefab215251a
https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L221-L232
train
hbldh/imdirect
imdirect/_autorotate.py
save_with_exif_info
def save_with_exif_info(img, *args, **kwargs): """Saves an image using PIL, preserving the exif information. Args: img (PIL.Image.Image): *args: The arguments for the `save` method of the Image class. **kwargs: The keywords for the `save` method of the Image class. """ if 'exif...
python
def save_with_exif_info(img, *args, **kwargs): """Saves an image using PIL, preserving the exif information. Args: img (PIL.Image.Image): *args: The arguments for the `save` method of the Image class. **kwargs: The keywords for the `save` method of the Image class. """ if 'exif...
[ "def", "save_with_exif_info", "(", "img", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "'exif'", "in", "kwargs", ":", "exif", "=", "kwargs", ".", "pop", "(", "'exif'", ")", "else", ":", "exif", "=", "img", ".", "info", ".", "get", "(", ...
Saves an image using PIL, preserving the exif information. Args: img (PIL.Image.Image): *args: The arguments for the `save` method of the Image class. **kwargs: The keywords for the `save` method of the Image class.
[ "Saves", "an", "image", "using", "PIL", "preserving", "the", "exif", "information", "." ]
12275b9f9faa6952cde2f2fe612bbefab215251a
https://github.com/hbldh/imdirect/blob/12275b9f9faa6952cde2f2fe612bbefab215251a/imdirect/_autorotate.py#L235-L248
train
redhat-cip/python-dciclient
dciclient/v1/api/base.py
create
def create(context, resource, **kwargs): """Create a resource""" data = utils.sanitize_kwargs(**kwargs) uri = '%s/%s' % (context.dci_cs_api, resource) r = context.session.post(uri, timeout=HTTP_TIMEOUT, json=data) return r
python
def create(context, resource, **kwargs): """Create a resource""" data = utils.sanitize_kwargs(**kwargs) uri = '%s/%s' % (context.dci_cs_api, resource) r = context.session.post(uri, timeout=HTTP_TIMEOUT, json=data) return r
[ "def", "create", "(", "context", ",", "resource", ",", "**", "kwargs", ")", ":", "data", "=", "utils", ".", "sanitize_kwargs", "(", "**", "kwargs", ")", "uri", "=", "'%s/%s'", "%", "(", "context", ".", "dci_cs_api", ",", "resource", ")", "r", "=", "c...
Create a resource
[ "Create", "a", "resource" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/base.py#L22-L28
train
redhat-cip/python-dciclient
dciclient/v1/api/base.py
get
def get(context, resource, **kwargs): """List a specific resource""" uri = '%s/%s/%s' % (context.dci_cs_api, resource, kwargs.pop('id')) r = context.session.get(uri, timeout=HTTP_TIMEOUT, params=kwargs) return r
python
def get(context, resource, **kwargs): """List a specific resource""" uri = '%s/%s/%s' % (context.dci_cs_api, resource, kwargs.pop('id')) r = context.session.get(uri, timeout=HTTP_TIMEOUT, params=kwargs) return r
[ "def", "get", "(", "context", ",", "resource", ",", "**", "kwargs", ")", ":", "uri", "=", "'%s/%s/%s'", "%", "(", "context", ".", "dci_cs_api", ",", "resource", ",", "kwargs", ".", "pop", "(", "'id'", ")", ")", "r", "=", "context", ".", "session", ...
List a specific resource
[ "List", "a", "specific", "resource" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/base.py#L69-L73
train
redhat-cip/python-dciclient
dciclient/v1/api/base.py
get_data
def get_data(context, resource, **kwargs): """Retrieve data field from a resource""" url_suffix = '' if 'keys' in kwargs and kwargs['keys']: url_suffix = '/?keys=%s' % ','.join(kwargs.pop('keys')) uri = '%s/%s/%s/data%s' % (context.dci_cs_api, resource, kwargs.po...
python
def get_data(context, resource, **kwargs): """Retrieve data field from a resource""" url_suffix = '' if 'keys' in kwargs and kwargs['keys']: url_suffix = '/?keys=%s' % ','.join(kwargs.pop('keys')) uri = '%s/%s/%s/data%s' % (context.dci_cs_api, resource, kwargs.po...
[ "def", "get_data", "(", "context", ",", "resource", ",", "**", "kwargs", ")", ":", "url_suffix", "=", "''", "if", "'keys'", "in", "kwargs", "and", "kwargs", "[", "'keys'", "]", ":", "url_suffix", "=", "'/?keys=%s'", "%", "','", ".", "join", "(", "kwarg...
Retrieve data field from a resource
[ "Retrieve", "data", "field", "from", "a", "resource" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/base.py#L76-L87
train
redhat-cip/python-dciclient
dciclient/v1/api/base.py
update
def update(context, resource, **kwargs): """Update a specific resource""" etag = kwargs.pop('etag') id = kwargs.pop('id') data = utils.sanitize_kwargs(**kwargs) uri = '%s/%s/%s' % (context.dci_cs_api, resource, id) r = context.session.put(uri, timeout=HTTP_TIMEOUT, he...
python
def update(context, resource, **kwargs): """Update a specific resource""" etag = kwargs.pop('etag') id = kwargs.pop('id') data = utils.sanitize_kwargs(**kwargs) uri = '%s/%s/%s' % (context.dci_cs_api, resource, id) r = context.session.put(uri, timeout=HTTP_TIMEOUT, he...
[ "def", "update", "(", "context", ",", "resource", ",", "**", "kwargs", ")", ":", "etag", "=", "kwargs", ".", "pop", "(", "'etag'", ")", "id", "=", "kwargs", ".", "pop", "(", "'id'", ")", "data", "=", "utils", ".", "sanitize_kwargs", "(", "**", "kwa...
Update a specific resource
[ "Update", "a", "specific", "resource" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/base.py#L90-L99
train
redhat-cip/python-dciclient
dciclient/v1/api/base.py
delete
def delete(context, resource, id, **kwargs): """Delete a specific resource""" etag = kwargs.pop('etag', None) id = id subresource = kwargs.pop('subresource', None) subresource_id = kwargs.pop('subresource_id', None) uri = '%s/%s/%s' % (context.dci_cs_api, resource, id) if subresource: ...
python
def delete(context, resource, id, **kwargs): """Delete a specific resource""" etag = kwargs.pop('etag', None) id = id subresource = kwargs.pop('subresource', None) subresource_id = kwargs.pop('subresource_id', None) uri = '%s/%s/%s' % (context.dci_cs_api, resource, id) if subresource: ...
[ "def", "delete", "(", "context", ",", "resource", ",", "id", ",", "**", "kwargs", ")", ":", "etag", "=", "kwargs", ".", "pop", "(", "'etag'", ",", "None", ")", "id", "=", "id", "subresource", "=", "kwargs", ".", "pop", "(", "'subresource'", ",", "N...
Delete a specific resource
[ "Delete", "a", "specific", "resource" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/base.py#L102-L116
train
redhat-cip/python-dciclient
dciclient/v1/api/base.py
purge
def purge(context, resource, **kwargs): """Purge resource type.""" uri = '%s/%s/purge' % (context.dci_cs_api, resource) if 'force' in kwargs and kwargs['force']: r = context.session.post(uri, timeout=HTTP_TIMEOUT) else: r = context.session.get(uri, timeout=HTTP_TIMEOUT) return r
python
def purge(context, resource, **kwargs): """Purge resource type.""" uri = '%s/%s/purge' % (context.dci_cs_api, resource) if 'force' in kwargs and kwargs['force']: r = context.session.post(uri, timeout=HTTP_TIMEOUT) else: r = context.session.get(uri, timeout=HTTP_TIMEOUT) return r
[ "def", "purge", "(", "context", ",", "resource", ",", "**", "kwargs", ")", ":", "uri", "=", "'%s/%s/purge'", "%", "(", "context", ".", "dci_cs_api", ",", "resource", ")", "if", "'force'", "in", "kwargs", "and", "kwargs", "[", "'force'", "]", ":", "r", ...
Purge resource type.
[ "Purge", "resource", "type", "." ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/base.py#L119-L126
train
lsst-sqre/documenteer
documenteer/sphinxext/utils.py
parse_rst_content
def parse_rst_content(content, state): """Parse rST-formatted string content into docutils nodes Parameters ---------- content : `str` ReStructuredText-formatted content state : ``docutils.statemachine.State`` Usually the directive's ``state`` attribute. Returns ------- ...
python
def parse_rst_content(content, state): """Parse rST-formatted string content into docutils nodes Parameters ---------- content : `str` ReStructuredText-formatted content state : ``docutils.statemachine.State`` Usually the directive's ``state`` attribute. Returns ------- ...
[ "def", "parse_rst_content", "(", "content", ",", "state", ")", ":", "container_node", "=", "nodes", ".", "section", "(", ")", "container_node", ".", "document", "=", "state", ".", "document", "viewlist", "=", "ViewList", "(", ")", "for", "i", ",", "line", ...
Parse rST-formatted string content into docutils nodes Parameters ---------- content : `str` ReStructuredText-formatted content state : ``docutils.statemachine.State`` Usually the directive's ``state`` attribute. Returns ------- instance from ``docutils.nodes`` Docu...
[ "Parse", "rST", "-", "formatted", "string", "content", "into", "docutils", "nodes" ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/utils.py#L14-L41
train