repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
FileToAutodocument.write_rst
def write_rst(self, prefix: str = "", suffix: str = "", heading_underline_char: str = "=", method: AutodocMethod = None, overwrite: bool = False, mock: bool = False) -> None: """ Writes the RST fi...
python
def write_rst(self, prefix: str = "", suffix: str = "", heading_underline_char: str = "=", method: AutodocMethod = None, overwrite: bool = False, mock: bool = False) -> None: """ Writes the RST fi...
[ "def", "write_rst", "(", "self", ",", "prefix", ":", "str", "=", "\"\"", ",", "suffix", ":", "str", "=", "\"\"", ",", "heading_underline_char", ":", "str", "=", "\"=\"", ",", "method", ":", "AutodocMethod", "=", "None", ",", "overwrite", ":", "bool", "...
Writes the RST file to our destination RST filename, making any necessary directories. Args: prefix: as for :func:`rst_content` suffix: as for :func:`rst_content` heading_underline_char: as for :func:`rst_content` method: as for :func:`rst_content` ...
[ "Writes", "the", "RST", "file", "to", "our", "destination", "RST", "filename", "making", "any", "necessary", "directories", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L414-L440
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.add_source_files
def add_source_files( self, source_filenames_or_globs: Union[str, List[str]], method: AutodocMethod = None, recursive: bool = None, source_rst_title_style_python: bool = None, pygments_language_override: Dict[str, str] = None) -> None: """ ...
python
def add_source_files( self, source_filenames_or_globs: Union[str, List[str]], method: AutodocMethod = None, recursive: bool = None, source_rst_title_style_python: bool = None, pygments_language_override: Dict[str, str] = None) -> None: """ ...
[ "def", "add_source_files", "(", "self", ",", "source_filenames_or_globs", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "method", ":", "AutodocMethod", "=", "None", ",", "recursive", ":", "bool", "=", "None", ",", "source_rst_title_style_...
Adds source files to the index. Args: source_filenames_or_globs: string containing a filename or a glob, describing the file(s) to be added, or a list of such strings method: optional method to override ``self.method`` recursive: use :func:`gl...
[ "Adds", "source", "files", "to", "the", "index", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L654-L707
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.get_sorted_source_files
def get_sorted_source_files( self, source_filenames_or_globs: Union[str, List[str]], recursive: bool = True) -> List[str]: """ Returns a sorted list of filenames to process, from a filename, a glob string, or a list of filenames/globs. Args: ...
python
def get_sorted_source_files( self, source_filenames_or_globs: Union[str, List[str]], recursive: bool = True) -> List[str]: """ Returns a sorted list of filenames to process, from a filename, a glob string, or a list of filenames/globs. Args: ...
[ "def", "get_sorted_source_files", "(", "self", ",", "source_filenames_or_globs", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "recursive", ":", "bool", "=", "True", ")", "->", "List", "[", "str", "]", ":", "if", "isinstance", "(", ...
Returns a sorted list of filenames to process, from a filename, a glob string, or a list of filenames/globs. Args: source_filenames_or_globs: filename/glob, or list of them recursive: use :func:`glob.glob` in recursive mode? Returns: sorted list of files to ...
[ "Returns", "a", "sorted", "list", "of", "filenames", "to", "process", "from", "a", "filename", "a", "glob", "string", "or", "a", "list", "of", "filenames", "/", "globs", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L709-L737
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.filename_matches_glob
def filename_matches_glob(filename: str, globtext: str) -> bool: """ The ``glob.glob`` function doesn't do exclusion very well. We don't want to have to specify root directories for exclusion patterns. We don't want to have to trawl a massive set of files to find exclusion files....
python
def filename_matches_glob(filename: str, globtext: str) -> bool: """ The ``glob.glob`` function doesn't do exclusion very well. We don't want to have to specify root directories for exclusion patterns. We don't want to have to trawl a massive set of files to find exclusion files....
[ "def", "filename_matches_glob", "(", "filename", ":", "str", ",", "globtext", ":", "str", ")", "->", "bool", ":", "# Quick check on basename-only matching", "if", "fnmatch", "(", "filename", ",", "globtext", ")", ":", "log", ".", "debug", "(", "\"{!r} matches {!...
The ``glob.glob`` function doesn't do exclusion very well. We don't want to have to specify root directories for exclusion patterns. We don't want to have to trawl a massive set of files to find exclusion files. So let's implement a glob match. Args: filename: filename ...
[ "The", "glob", ".", "glob", "function", "doesn", "t", "do", "exclusion", "very", "well", ".", "We", "don", "t", "want", "to", "have", "to", "specify", "root", "directories", "for", "exclusion", "patterns", ".", "We", "don", "t", "want", "to", "have", "...
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L740-L769
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.should_exclude
def should_exclude(self, filename) -> bool: """ Should we exclude this file from consideration? """ for skip_glob in self.skip_globs: if self.filename_matches_glob(filename, skip_glob): return True return False
python
def should_exclude(self, filename) -> bool: """ Should we exclude this file from consideration? """ for skip_glob in self.skip_globs: if self.filename_matches_glob(filename, skip_glob): return True return False
[ "def", "should_exclude", "(", "self", ",", "filename", ")", "->", "bool", ":", "for", "skip_glob", "in", "self", ".", "skip_globs", ":", "if", "self", ".", "filename_matches_glob", "(", "filename", ",", "skip_glob", ")", ":", "return", "True", "return", "F...
Should we exclude this file from consideration?
[ "Should", "we", "exclude", "this", "file", "from", "consideration?" ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L771-L778
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.specific_file_rst_filename
def specific_file_rst_filename(self, source_filename: str) -> str: """ Gets the RST filename corresponding to a source filename. See the help for the constructor for more details. Args: source_filename: source filename within current project Returns: RST...
python
def specific_file_rst_filename(self, source_filename: str) -> str: """ Gets the RST filename corresponding to a source filename. See the help for the constructor for more details. Args: source_filename: source filename within current project Returns: RST...
[ "def", "specific_file_rst_filename", "(", "self", ",", "source_filename", ":", "str", ")", "->", "str", ":", "highest_code_to_target", "=", "relative_filename_within_dir", "(", "source_filename", ",", "self", ".", "highest_code_dir", ")", "bname", "=", "basename", "...
Gets the RST filename corresponding to a source filename. See the help for the constructor for more details. Args: source_filename: source filename within current project Returns: RST filename Note in particular: the way we structure the directories means that ...
[ "Gets", "the", "RST", "filename", "corresponding", "to", "a", "source", "filename", ".", "See", "the", "help", "for", "the", "constructor", "for", "more", "details", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L799-L823
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.write_index_and_rst_files
def write_index_and_rst_files(self, overwrite: bool = False, mock: bool = False) -> None: """ Writes both the individual RST files and the index. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't ...
python
def write_index_and_rst_files(self, overwrite: bool = False, mock: bool = False) -> None: """ Writes both the individual RST files and the index. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't ...
[ "def", "write_index_and_rst_files", "(", "self", ",", "overwrite", ":", "bool", "=", "False", ",", "mock", ":", "bool", "=", "False", ")", "->", "None", ":", "for", "f", "in", "self", ".", "files_to_index", ":", "if", "isinstance", "(", "f", ",", "File...
Writes both the individual RST files and the index. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't
[ "Writes", "both", "the", "individual", "RST", "files", "and", "the", "index", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L825-L847
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.index_filename_rel_other_index
def index_filename_rel_other_index(self, other: str) -> str: """ Returns the filename of this index, relative to the director of another index. (For inserting a reference to this index into ``other``.) Args: other: the other index Returns: relative filen...
python
def index_filename_rel_other_index(self, other: str) -> str: """ Returns the filename of this index, relative to the director of another index. (For inserting a reference to this index into ``other``.) Args: other: the other index Returns: relative filen...
[ "def", "index_filename_rel_other_index", "(", "self", ",", "other", ":", "str", ")", "->", "str", ":", "return", "relpath", "(", "self", ".", "index_filename", ",", "start", "=", "dirname", "(", "other", ")", ")" ]
Returns the filename of this index, relative to the director of another index. (For inserting a reference to this index into ``other``.) Args: other: the other index Returns: relative filename of our index
[ "Returns", "the", "filename", "of", "this", "index", "relative", "to", "the", "director", "of", "another", "index", ".", "(", "For", "inserting", "a", "reference", "to", "this", "index", "into", "other", ".", ")" ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L857-L868
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.index_content
def index_content(self) -> str: """ Returns the contents of the index RST file. """ # Build the toctree command index_filename = self.index_filename spacer = " " toctree_lines = [ ".. toctree::", spacer + ":maxdepth: {}".format(self.toc...
python
def index_content(self) -> str: """ Returns the contents of the index RST file. """ # Build the toctree command index_filename = self.index_filename spacer = " " toctree_lines = [ ".. toctree::", spacer + ":maxdepth: {}".format(self.toc...
[ "def", "index_content", "(", "self", ")", "->", "str", ":", "# Build the toctree command", "index_filename", "=", "self", ".", "index_filename", "spacer", "=", "\" \"", "toctree_lines", "=", "[", "\".. toctree::\"", ",", "spacer", "+", "\":maxdepth: {}\"", ".", ...
Returns the contents of the index RST file.
[ "Returns", "the", "contents", "of", "the", "index", "RST", "file", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L870-L921
RudolfCardinal/pythonlib
cardinal_pythonlib/sphinxtools.py
AutodocIndex.write_index
def write_index(self, overwrite: bool = False, mock: bool = False) -> None: """ Writes the index file, if permitted. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't """ write_if_allowed(self.index_filename, self....
python
def write_index(self, overwrite: bool = False, mock: bool = False) -> None: """ Writes the index file, if permitted. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't """ write_if_allowed(self.index_filename, self....
[ "def", "write_index", "(", "self", ",", "overwrite", ":", "bool", "=", "False", ",", "mock", ":", "bool", "=", "False", ")", "->", "None", ":", "write_if_allowed", "(", "self", ".", "index_filename", ",", "self", ".", "index_content", "(", ")", ",", "o...
Writes the index file, if permitted. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't
[ "Writes", "the", "index", "file", "if", "permitted", "." ]
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sphinxtools.py#L923-L932
avihad/twistes
twistes/parser.py
EsParser.parse_host
def parse_host(hosts): """ Parsing the hosts parameter, * currently support only one host :param hosts: the hosts json to parse :return: the full host and the authentication if exists """ hosts = EsParser._normalize_hosts(hosts) host = hosts[0] ho...
python
def parse_host(hosts): """ Parsing the hosts parameter, * currently support only one host :param hosts: the hosts json to parse :return: the full host and the authentication if exists """ hosts = EsParser._normalize_hosts(hosts) host = hosts[0] ho...
[ "def", "parse_host", "(", "hosts", ")", ":", "hosts", "=", "EsParser", ".", "_normalize_hosts", "(", "hosts", ")", "host", "=", "hosts", "[", "0", "]", "host_name", "=", "host", "[", "HostParsing", ".", "HOST", "]", "host_port", "=", "host", "[", "Host...
Parsing the hosts parameter, * currently support only one host :param hosts: the hosts json to parse :return: the full host and the authentication if exists
[ "Parsing", "the", "hosts", "parameter", "*", "currently", "support", "only", "one", "host", ":", "param", "hosts", ":", "the", "hosts", "json", "to", "parse", ":", "return", ":", "the", "full", "host", "and", "the", "authentication", "if", "exists" ]
train
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/parser.py#L10-L34
avihad/twistes
twistes/parser.py
EsParser._update_ssl_params
def _update_ssl_params(host): """ Update the host ssl params (port or scheme) if needed. :param host: :return: """ if host[HostParsing.HOST] \ and EsParser._is_secure_connection_type(host): host[HostParsing.PORT] = EsParser.SSL_DEFAULT_PORT ...
python
def _update_ssl_params(host): """ Update the host ssl params (port or scheme) if needed. :param host: :return: """ if host[HostParsing.HOST] \ and EsParser._is_secure_connection_type(host): host[HostParsing.PORT] = EsParser.SSL_DEFAULT_PORT ...
[ "def", "_update_ssl_params", "(", "host", ")", ":", "if", "host", "[", "HostParsing", ".", "HOST", "]", "and", "EsParser", ".", "_is_secure_connection_type", "(", "host", ")", ":", "host", "[", "HostParsing", ".", "PORT", "]", "=", "EsParser", ".", "SSL_DE...
Update the host ssl params (port or scheme) if needed. :param host: :return:
[ "Update", "the", "host", "ssl", "params", "(", "port", "or", "scheme", ")", "if", "needed", ".", ":", "param", "host", ":", ":", "return", ":" ]
train
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/parser.py#L54-L67
avihad/twistes
twistes/parser.py
EsParser._parse_string_host
def _parse_string_host(host_str): """ Parse host string into a dictionary host :param host_str: :return: """ host_str = EsParser._fix_host_prefix(host_str) parsed_url = urlparse(host_str) host = {HostParsing.HOST: parsed_url.hostname} if parsed_url...
python
def _parse_string_host(host_str): """ Parse host string into a dictionary host :param host_str: :return: """ host_str = EsParser._fix_host_prefix(host_str) parsed_url = urlparse(host_str) host = {HostParsing.HOST: parsed_url.hostname} if parsed_url...
[ "def", "_parse_string_host", "(", "host_str", ")", ":", "host_str", "=", "EsParser", ".", "_fix_host_prefix", "(", "host_str", ")", "parsed_url", "=", "urlparse", "(", "host_str", ")", "host", "=", "{", "HostParsing", ".", "HOST", ":", "parsed_url", ".", "ho...
Parse host string into a dictionary host :param host_str: :return:
[ "Parse", "host", "string", "into", "a", "dictionary", "host", ":", "param", "host_str", ":", ":", "return", ":" ]
train
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/parser.py#L70-L91
avihad/twistes
twistes/parser.py
EsParser.make_path
def make_path(*sub_paths): """ Create a path from a list of sub paths. :param sub_paths: a list of sub paths :return: """ queued_params = [quote(c.encode('utf-8'), '') for c in sub_paths if c not in NULL_VALUES] queued_params.insert(0, '') return '/'.join(...
python
def make_path(*sub_paths): """ Create a path from a list of sub paths. :param sub_paths: a list of sub paths :return: """ queued_params = [quote(c.encode('utf-8'), '') for c in sub_paths if c not in NULL_VALUES] queued_params.insert(0, '') return '/'.join(...
[ "def", "make_path", "(", "*", "sub_paths", ")", ":", "queued_params", "=", "[", "quote", "(", "c", ".", "encode", "(", "'utf-8'", ")", ",", "''", ")", "for", "c", "in", "sub_paths", "if", "c", "not", "in", "NULL_VALUES", "]", "queued_params", ".", "i...
Create a path from a list of sub paths. :param sub_paths: a list of sub paths :return:
[ "Create", "a", "path", "from", "a", "list", "of", "sub", "paths", ".", ":", "param", "sub_paths", ":", "a", "list", "of", "sub", "paths", ":", "return", ":" ]
train
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/parser.py#L105-L113
avihad/twistes
twistes/parser.py
EsParser.prepare_url
def prepare_url(hostname, path, params=None): """ Prepare Elasticsearch request url. :param hostname: host name :param path: request path :param params: optional url params :return: """ url = hostname + path if params: url = url + '?' ...
python
def prepare_url(hostname, path, params=None): """ Prepare Elasticsearch request url. :param hostname: host name :param path: request path :param params: optional url params :return: """ url = hostname + path if params: url = url + '?' ...
[ "def", "prepare_url", "(", "hostname", ",", "path", ",", "params", "=", "None", ")", ":", "url", "=", "hostname", "+", "path", "if", "params", ":", "url", "=", "url", "+", "'?'", "+", "urlencode", "(", "params", ")", "if", "not", "url", ".", "start...
Prepare Elasticsearch request url. :param hostname: host name :param path: request path :param params: optional url params :return:
[ "Prepare", "Elasticsearch", "request", "url", ".", ":", "param", "hostname", ":", "host", "name", ":", "param", "path", ":", "request", "path", ":", "param", "params", ":", "optional", "url", "params", ":", "return", ":" ]
train
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/parser.py#L116-L132
carpyncho/feets
doc/source/JSAnimation/examples.py
basic_animation
def basic_animation(frames=100, interval=30): """Plot a basic sine wave with oscillating amplitude""" fig = plt.figure() ax = plt.axes(xlim=(0, 10), ylim=(-2, 2)) line, = ax.plot([], [], lw=2) x = np.linspace(0, 10, 1000) def init(): line.set_data([], []) return line, def ...
python
def basic_animation(frames=100, interval=30): """Plot a basic sine wave with oscillating amplitude""" fig = plt.figure() ax = plt.axes(xlim=(0, 10), ylim=(-2, 2)) line, = ax.plot([], [], lw=2) x = np.linspace(0, 10, 1000) def init(): line.set_data([], []) return line, def ...
[ "def", "basic_animation", "(", "frames", "=", "100", ",", "interval", "=", "30", ")", ":", "fig", "=", "plt", ".", "figure", "(", ")", "ax", "=", "plt", ".", "axes", "(", "xlim", "=", "(", "0", ",", "10", ")", ",", "ylim", "=", "(", "-", "2",...
Plot a basic sine wave with oscillating amplitude
[ "Plot", "a", "basic", "sine", "wave", "with", "oscillating", "amplitude" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/doc/source/JSAnimation/examples.py#L6-L24
carpyncho/feets
doc/source/JSAnimation/examples.py
lorenz_animation
def lorenz_animation(N_trajectories=20, rseed=1, frames=200, interval=30): """Plot a 3D visualization of the dynamics of the Lorenz system""" from scipy import integrate from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames def lorentz_deriv(coords, t0, sigma=10., beta=8./3, ...
python
def lorenz_animation(N_trajectories=20, rseed=1, frames=200, interval=30): """Plot a 3D visualization of the dynamics of the Lorenz system""" from scipy import integrate from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames def lorentz_deriv(coords, t0, sigma=10., beta=8./3, ...
[ "def", "lorenz_animation", "(", "N_trajectories", "=", "20", ",", "rseed", "=", "1", ",", "frames", "=", "200", ",", "interval", "=", "30", ")", ":", "from", "scipy", "import", "integrate", "from", "mpl_toolkits", ".", "mplot3d", "import", "Axes3D", "from"...
Plot a 3D visualization of the dynamics of the Lorenz system
[ "Plot", "a", "3D", "visualization", "of", "the", "dynamics", "of", "the", "Lorenz", "system" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/doc/source/JSAnimation/examples.py#L27-L97
carpyncho/feets
doc/source/JSAnimation/html_writer.py
_included_frames
def _included_frames(frame_list, frame_format): """frame_list should be a list of filenames""" return INCLUDED_FRAMES.format(Nframes=len(frame_list), frame_dir=os.path.dirname(frame_list[0]), frame_format=frame_format)
python
def _included_frames(frame_list, frame_format): """frame_list should be a list of filenames""" return INCLUDED_FRAMES.format(Nframes=len(frame_list), frame_dir=os.path.dirname(frame_list[0]), frame_format=frame_format)
[ "def", "_included_frames", "(", "frame_list", ",", "frame_format", ")", ":", "return", "INCLUDED_FRAMES", ".", "format", "(", "Nframes", "=", "len", "(", "frame_list", ")", ",", "frame_dir", "=", "os", ".", "path", ".", "dirname", "(", "frame_list", "[", "...
frame_list should be a list of filenames
[ "frame_list", "should", "be", "a", "list", "of", "filenames" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/doc/source/JSAnimation/html_writer.py#L222-L226
carpyncho/feets
doc/source/JSAnimation/html_writer.py
_embedded_frames
def _embedded_frames(frame_list, frame_format): """frame_list should be a list of base64-encoded png files""" template = ' frames[{0}] = "data:image/{1};base64,{2}"\n' embedded = "\n" for i, frame_data in enumerate(frame_list): embedded += template.format(i, frame_format, ...
python
def _embedded_frames(frame_list, frame_format): """frame_list should be a list of base64-encoded png files""" template = ' frames[{0}] = "data:image/{1};base64,{2}"\n' embedded = "\n" for i, frame_data in enumerate(frame_list): embedded += template.format(i, frame_format, ...
[ "def", "_embedded_frames", "(", "frame_list", ",", "frame_format", ")", ":", "template", "=", "' frames[{0}] = \"data:image/{1};base64,{2}\"\\n'", "embedded", "=", "\"\\n\"", "for", "i", ",", "frame_data", "in", "enumerate", "(", "frame_list", ")", ":", "embedded", ...
frame_list should be a list of base64-encoded png files
[ "frame_list", "should", "be", "a", "list", "of", "base64", "-", "encoded", "png", "files" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/doc/source/JSAnimation/html_writer.py#L229-L236
carpyncho/feets
feets/preprocess.py
remove_noise
def remove_noise(time, magnitude, error, error_limit=3, std_limit=5): """Points within 'std_limit' standard deviations from the mean and with errors greater than 'error_limit' times the error mean are considered as noise and thus are eliminated. """ data, mjd = magnitude, time data_len = len(m...
python
def remove_noise(time, magnitude, error, error_limit=3, std_limit=5): """Points within 'std_limit' standard deviations from the mean and with errors greater than 'error_limit' times the error mean are considered as noise and thus are eliminated. """ data, mjd = magnitude, time data_len = len(m...
[ "def", "remove_noise", "(", "time", ",", "magnitude", ",", "error", ",", "error_limit", "=", "3", ",", "std_limit", "=", "5", ")", ":", "data", ",", "mjd", "=", "magnitude", ",", "time", "data_len", "=", "len", "(", "mjd", ")", "error_mean", "=", "np...
Points within 'std_limit' standard deviations from the mean and with errors greater than 'error_limit' times the error mean are considered as noise and thus are eliminated.
[ "Points", "within", "std_limit", "standard", "deviations", "from", "the", "mean", "and", "with", "errors", "greater", "than", "error_limit", "times", "the", "error", "mean", "are", "considered", "as", "noise", "and", "thus", "are", "eliminated", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/preprocess.py#L44-L73
carpyncho/feets
feets/preprocess.py
align
def align(time, time2, magnitude, magnitude2, error, error2): """Synchronizes the light-curves in the two different bands. Returns ------- aligned_time aligned_magnitude aligned_magnitude2 aligned_error aligned_error2 """ error = np.zeros(time.shape) if error is None else err...
python
def align(time, time2, magnitude, magnitude2, error, error2): """Synchronizes the light-curves in the two different bands. Returns ------- aligned_time aligned_magnitude aligned_magnitude2 aligned_error aligned_error2 """ error = np.zeros(time.shape) if error is None else err...
[ "def", "align", "(", "time", ",", "time2", ",", "magnitude", ",", "magnitude2", ",", "error", ",", "error2", ")", ":", "error", "=", "np", ".", "zeros", "(", "time", ".", "shape", ")", "if", "error", "is", "None", "else", "error", "error2", "=", "n...
Synchronizes the light-curves in the two different bands. Returns ------- aligned_time aligned_magnitude aligned_magnitude2 aligned_error aligned_error2
[ "Synchronizes", "the", "light", "-", "curves", "in", "the", "two", "different", "bands", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/preprocess.py#L76-L113
carpyncho/feets
feets/datasets/ogle3.py
load_OGLE3_catalog
def load_OGLE3_catalog(): """Return the full list of variables stars of OGLE-3 as a DataFrame """ with bz2.BZ2File(CATALOG_PATH) as bz2fp, warnings.catch_warnings(): warnings.simplefilter("ignore") df = pd.read_table(bz2fp, skiprows=6) df.rename(columns={"# ID": "ID"}, inplace=True) ...
python
def load_OGLE3_catalog(): """Return the full list of variables stars of OGLE-3 as a DataFrame """ with bz2.BZ2File(CATALOG_PATH) as bz2fp, warnings.catch_warnings(): warnings.simplefilter("ignore") df = pd.read_table(bz2fp, skiprows=6) df.rename(columns={"# ID": "ID"}, inplace=True) ...
[ "def", "load_OGLE3_catalog", "(", ")", ":", "with", "bz2", ".", "BZ2File", "(", "CATALOG_PATH", ")", "as", "bz2fp", ",", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "simplefilter", "(", "\"ignore\"", ")", "df", "=", "pd", ".", "rea...
Return the full list of variables stars of OGLE-3 as a DataFrame
[ "Return", "the", "full", "list", "of", "variables", "stars", "of", "OGLE", "-", "3", "as", "a", "DataFrame" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/ogle3.py#L144-L152
carpyncho/feets
feets/datasets/ogle3.py
fetch_OGLE3
def fetch_OGLE3(ogle3_id, data_home=None, metadata=None, download_if_missing=True): """Retrieve a lighte curve from OGLE-3 database Parameters ---------- ogle3_id : str The id of the source (see: ``load_OGLE3_catalog()`` for available sources. data_home : optional, d...
python
def fetch_OGLE3(ogle3_id, data_home=None, metadata=None, download_if_missing=True): """Retrieve a lighte curve from OGLE-3 database Parameters ---------- ogle3_id : str The id of the source (see: ``load_OGLE3_catalog()`` for available sources. data_home : optional, d...
[ "def", "fetch_OGLE3", "(", "ogle3_id", ",", "data_home", "=", "None", ",", "metadata", "=", "None", ",", "download_if_missing", "=", "True", ")", ":", "# retrieve the data dir for ogle", "store_path", "=", "_get_OGLE3_data_home", "(", "data_home", ")", "# the data d...
Retrieve a lighte curve from OGLE-3 database Parameters ---------- ogle3_id : str The id of the source (see: ``load_OGLE3_catalog()`` for available sources. data_home : optional, default: None Specify another download and cache folder for the datasets. By default all fee...
[ "Retrieve", "a", "lighte", "curve", "from", "OGLE", "-", "3", "database" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/ogle3.py#L155-L246
carpyncho/feets
feets/extractors/__init__.py
sort_by_dependencies
def sort_by_dependencies(exts, retry=None): """Calculate the Feature Extractor Resolution Order. """ sorted_ext, features_from_sorted = [], set() pending = [(e, 0) for e in exts] retry = len(exts) * 100 if retry is None else retry while pending: ext, cnt = pending.pop(0) if not...
python
def sort_by_dependencies(exts, retry=None): """Calculate the Feature Extractor Resolution Order. """ sorted_ext, features_from_sorted = [], set() pending = [(e, 0) for e in exts] retry = len(exts) * 100 if retry is None else retry while pending: ext, cnt = pending.pop(0) if not...
[ "def", "sort_by_dependencies", "(", "exts", ",", "retry", "=", "None", ")", ":", "sorted_ext", ",", "features_from_sorted", "=", "[", "]", ",", "set", "(", ")", "pending", "=", "[", "(", "e", ",", "0", ")", "for", "e", "in", "exts", "]", "retry", "...
Calculate the Feature Extractor Resolution Order.
[ "Calculate", "the", "Feature", "Extractor", "Resolution", "Order", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/extractors/__init__.py#L98-L121
carpyncho/feets
paper/reports/fats_vs_feets/lomb.py
getSignificance
def getSignificance(wk1, wk2, nout, ofac): """ returns the peak false alarm probabilities Hence the lower is the probability and the more significant is the peak """ expy = exp(-wk2) effm = 2.0*(nout)/ofac sig = effm*expy ind = (sig > 0.01).nonzero() sig[ind] = 1.0-(1.0-expy[ind])**effm return sig
python
def getSignificance(wk1, wk2, nout, ofac): """ returns the peak false alarm probabilities Hence the lower is the probability and the more significant is the peak """ expy = exp(-wk2) effm = 2.0*(nout)/ofac sig = effm*expy ind = (sig > 0.01).nonzero() sig[ind] = 1.0-(1.0-expy[ind])**effm return sig
[ "def", "getSignificance", "(", "wk1", ",", "wk2", ",", "nout", ",", "ofac", ")", ":", "expy", "=", "exp", "(", "-", "wk2", ")", "effm", "=", "2.0", "*", "(", "nout", ")", "/", "ofac", "sig", "=", "effm", "*", "expy", "ind", "=", "(", "sig", "...
returns the peak false alarm probabilities Hence the lower is the probability and the more significant is the peak
[ "returns", "the", "peak", "false", "alarm", "probabilities", "Hence", "the", "lower", "is", "the", "probability", "and", "the", "more", "significant", "is", "the", "peak" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/paper/reports/fats_vs_feets/lomb.py#L200-L209
carpyncho/feets
feets/datasets/base.py
fetch
def fetch(url, dest, force=False): """Retrieve data from an url and store it into dest. Parameters ---------- url: str Link to the remote data dest: str Path where the file must be stored force: bool (default=False) Overwrite if the file exists Returns ------- ...
python
def fetch(url, dest, force=False): """Retrieve data from an url and store it into dest. Parameters ---------- url: str Link to the remote data dest: str Path where the file must be stored force: bool (default=False) Overwrite if the file exists Returns ------- ...
[ "def", "fetch", "(", "url", ",", "dest", ",", "force", "=", "False", ")", ":", "cached", "=", "True", "if", "force", "or", "not", "os", ".", "path", ".", "exists", "(", "dest", ")", ":", "cached", "=", "False", "r", "=", "requests", ".", "get", ...
Retrieve data from an url and store it into dest. Parameters ---------- url: str Link to the remote data dest: str Path where the file must be stored force: bool (default=False) Overwrite if the file exists Returns ------- cached: bool True if the file a...
[ "Retrieve", "data", "from", "an", "url", "and", "store", "it", "into", "dest", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/base.py#L99-L129
carpyncho/feets
feets/datasets/synthetic.py
create_random
def create_random(magf, magf_params, errf, errf_params, timef=np.linspace, timef_params=None, size=DEFAULT_SIZE, id=None, ds_name=DS_NAME, description=DESCRIPTION, bands=BANDS, metadata=METADATA): """Generate a data with any given random function. Parameter...
python
def create_random(magf, magf_params, errf, errf_params, timef=np.linspace, timef_params=None, size=DEFAULT_SIZE, id=None, ds_name=DS_NAME, description=DESCRIPTION, bands=BANDS, metadata=METADATA): """Generate a data with any given random function. Parameter...
[ "def", "create_random", "(", "magf", ",", "magf_params", ",", "errf", ",", "errf_params", ",", "timef", "=", "np", ".", "linspace", ",", "timef_params", "=", "None", ",", "size", "=", "DEFAULT_SIZE", ",", "id", "=", "None", ",", "ds_name", "=", "DS_NAME"...
Generate a data with any given random function. Parameters ---------- magf : callable Function to generate the magnitudes. magf_params : dict-like Parameters to feed the `magf` function. errf : callable Function to generate the magnitudes. errf_params : dict-like ...
[ "Generate", "a", "data", "with", "any", "given", "random", "function", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/synthetic.py#L63-L135
carpyncho/feets
feets/datasets/synthetic.py
create_normal
def create_normal(mu=0., sigma=1., mu_err=0., sigma_err=1., seed=None, **kwargs): """Generate a data with magnitudes that follows a Gaussian distribution. Also their errors are gaussian. Parameters ---------- mu : float (default=0) Mean of the gaussian distribution of ma...
python
def create_normal(mu=0., sigma=1., mu_err=0., sigma_err=1., seed=None, **kwargs): """Generate a data with magnitudes that follows a Gaussian distribution. Also their errors are gaussian. Parameters ---------- mu : float (default=0) Mean of the gaussian distribution of ma...
[ "def", "create_normal", "(", "mu", "=", "0.", ",", "sigma", "=", "1.", ",", "mu_err", "=", "0.", ",", "sigma_err", "=", "1.", ",", "seed", "=", "None", ",", "*", "*", "kwargs", ")", ":", "random", "=", "np", ".", "random", ".", "RandomState", "("...
Generate a data with magnitudes that follows a Gaussian distribution. Also their errors are gaussian. Parameters ---------- mu : float (default=0) Mean of the gaussian distribution of magnitudes sigma : float (default=1) Standar deviation of the gaussian distribution of magnitude ...
[ "Generate", "a", "data", "with", "magnitudes", "that", "follows", "a", "Gaussian", "distribution", ".", "Also", "their", "errors", "are", "gaussian", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/synthetic.py#L138-L190
carpyncho/feets
feets/datasets/synthetic.py
create_uniform
def create_uniform(low=0., high=1., mu_err=0., sigma_err=1., seed=None, **kwargs): """Generate a data with magnitudes that follows a uniform distribution; the error instead are gaussian. Parameters ---------- low : float, optional Lower boundary of the output interval. ...
python
def create_uniform(low=0., high=1., mu_err=0., sigma_err=1., seed=None, **kwargs): """Generate a data with magnitudes that follows a uniform distribution; the error instead are gaussian. Parameters ---------- low : float, optional Lower boundary of the output interval. ...
[ "def", "create_uniform", "(", "low", "=", "0.", ",", "high", "=", "1.", ",", "mu_err", "=", "0.", ",", "sigma_err", "=", "1.", ",", "seed", "=", "None", ",", "*", "*", "kwargs", ")", ":", "random", "=", "np", ".", "random", ".", "RandomState", "(...
Generate a data with magnitudes that follows a uniform distribution; the error instead are gaussian. Parameters ---------- low : float, optional Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0. high : float...
[ "Generate", "a", "data", "with", "magnitudes", "that", "follows", "a", "uniform", "distribution", ";", "the", "error", "instead", "are", "gaussian", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/synthetic.py#L193-L244
carpyncho/feets
feets/datasets/synthetic.py
create_periodic
def create_periodic(mu_err=0., sigma_err=1., seed=None, **kwargs): """Generate a data with magnitudes with periodic variability distribution; the error instead are gaussian. Parameters ---------- mu_err : float (default=0) Mean of the gaussian distribution of magnitudes sigma_err : flo...
python
def create_periodic(mu_err=0., sigma_err=1., seed=None, **kwargs): """Generate a data with magnitudes with periodic variability distribution; the error instead are gaussian. Parameters ---------- mu_err : float (default=0) Mean of the gaussian distribution of magnitudes sigma_err : flo...
[ "def", "create_periodic", "(", "mu_err", "=", "0.", ",", "sigma_err", "=", "1.", ",", "seed", "=", "None", ",", "*", "*", "kwargs", ")", ":", "random", "=", "np", ".", "random", ".", "RandomState", "(", "seed", ")", "size", "=", "kwargs", ".", "get...
Generate a data with magnitudes with periodic variability distribution; the error instead are gaussian. Parameters ---------- mu_err : float (default=0) Mean of the gaussian distribution of magnitudes sigma_err : float (default=1) Standar deviation of the gaussian distribution of m...
[ "Generate", "a", "data", "with", "magnitudes", "with", "periodic", "variability", "distribution", ";", "the", "error", "instead", "are", "gaussian", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/synthetic.py#L247-L305
carpyncho/feets
feets/libs/ls_fap.py
pdf_single
def pdf_single(z, N, normalization, dH=1, dK=3): """Probability density function for Lomb-Scargle periodogram Compute the expected probability density function of the periodogram for the null hypothesis - i.e. data consisting of Gaussian noise. Parameters ---------- z : array-like the ...
python
def pdf_single(z, N, normalization, dH=1, dK=3): """Probability density function for Lomb-Scargle periodogram Compute the expected probability density function of the periodogram for the null hypothesis - i.e. data consisting of Gaussian noise. Parameters ---------- z : array-like the ...
[ "def", "pdf_single", "(", "z", ",", "N", ",", "normalization", ",", "dH", "=", "1", ",", "dK", "=", "3", ")", ":", "if", "dK", "-", "dH", "!=", "2", ":", "raise", "NotImplementedError", "(", "\"Degrees of freedom != 2\"", ")", "Nk", "=", "N", "-", ...
Probability density function for Lomb-Scargle periodogram Compute the expected probability density function of the periodogram for the null hypothesis - i.e. data consisting of Gaussian noise. Parameters ---------- z : array-like the periodogram value N : int the number of data...
[ "Probability", "density", "function", "for", "Lomb", "-", "Scargle", "periodogram" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L31-L78
carpyncho/feets
feets/libs/ls_fap.py
cdf_single
def cdf_single(z, N, normalization, dH=1, dK=3): """Cumulative distribution for the Lomb-Scargle periodogram Compute the expected cumulative distribution of the periodogram for the null hypothesis - i.e. data consisting of Gaussian noise. Parameters ---------- z : array-like the period...
python
def cdf_single(z, N, normalization, dH=1, dK=3): """Cumulative distribution for the Lomb-Scargle periodogram Compute the expected cumulative distribution of the periodogram for the null hypothesis - i.e. data consisting of Gaussian noise. Parameters ---------- z : array-like the period...
[ "def", "cdf_single", "(", "z", ",", "N", ",", "normalization", ",", "dH", "=", "1", ",", "dK", "=", "3", ")", ":", "return", "1", "-", "fap_single", "(", "z", ",", "N", ",", "normalization", "=", "normalization", ",", "dH", "=", "dH", ",", "dK", ...
Cumulative distribution for the Lomb-Scargle periodogram Compute the expected cumulative distribution of the periodogram for the null hypothesis - i.e. data consisting of Gaussian noise. Parameters ---------- z : array-like the periodogram value N : int the number of data point...
[ "Cumulative", "distribution", "for", "the", "Lomb", "-", "Scargle", "periodogram" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L132-L166
carpyncho/feets
feets/libs/ls_fap.py
tau_davies
def tau_davies(Z, fmax, t, y, dy, normalization='standard', dH=1, dK=3): """tau factor for estimating Davies bound (Baluev 2008, Table 1)""" N = len(t) NH = N - dH # DOF for null hypothesis NK = N - dK # DOF for periodic hypothesis Dt = _weighted_var(t, dy) Teff = np.sqrt(4 * np.pi * Dt) W...
python
def tau_davies(Z, fmax, t, y, dy, normalization='standard', dH=1, dK=3): """tau factor for estimating Davies bound (Baluev 2008, Table 1)""" N = len(t) NH = N - dH # DOF for null hypothesis NK = N - dK # DOF for periodic hypothesis Dt = _weighted_var(t, dy) Teff = np.sqrt(4 * np.pi * Dt) W...
[ "def", "tau_davies", "(", "Z", ",", "fmax", ",", "t", ",", "y", ",", "dy", ",", "normalization", "=", "'standard'", ",", "dH", "=", "1", ",", "dK", "=", "3", ")", ":", "N", "=", "len", "(", "t", ")", "NH", "=", "N", "-", "dH", "# DOF for null...
tau factor for estimating Davies bound (Baluev 2008, Table 1)
[ "tau", "factor", "for", "estimating", "Davies", "bound", "(", "Baluev", "2008", "Table", "1", ")" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L169-L193
carpyncho/feets
feets/libs/ls_fap.py
fap_simple
def fap_simple(Z, fmax, t, y, dy, normalization='standard'): """False Alarm Probability based on estimated number of indep frequencies """ N = len(t) T = max(t) - min(t) N_eff = fmax * T p_s = cdf_single(Z, N, normalization=normalization) return 1 - p_s ** N_eff
python
def fap_simple(Z, fmax, t, y, dy, normalization='standard'): """False Alarm Probability based on estimated number of indep frequencies """ N = len(t) T = max(t) - min(t) N_eff = fmax * T p_s = cdf_single(Z, N, normalization=normalization) return 1 - p_s ** N_eff
[ "def", "fap_simple", "(", "Z", ",", "fmax", ",", "t", ",", "y", ",", "dy", ",", "normalization", "=", "'standard'", ")", ":", "N", "=", "len", "(", "t", ")", "T", "=", "max", "(", "t", ")", "-", "min", "(", "t", ")", "N_eff", "=", "fmax", "...
False Alarm Probability based on estimated number of indep frequencies
[ "False", "Alarm", "Probability", "based", "on", "estimated", "number", "of", "indep", "frequencies" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L196-L204
carpyncho/feets
feets/libs/ls_fap.py
fap_davies
def fap_davies(Z, fmax, t, y, dy, normalization='standard'): """Davies upper-bound to the false alarm probability (Eqn 5 of Baluev 2008) """ N = len(t) fap_s = fap_single(Z, N, normalization=normalization) tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization) return fap_s + tau
python
def fap_davies(Z, fmax, t, y, dy, normalization='standard'): """Davies upper-bound to the false alarm probability (Eqn 5 of Baluev 2008) """ N = len(t) fap_s = fap_single(Z, N, normalization=normalization) tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization) return fap_s + tau
[ "def", "fap_davies", "(", "Z", ",", "fmax", ",", "t", ",", "y", ",", "dy", ",", "normalization", "=", "'standard'", ")", ":", "N", "=", "len", "(", "t", ")", "fap_s", "=", "fap_single", "(", "Z", ",", "N", ",", "normalization", "=", "normalization"...
Davies upper-bound to the false alarm probability (Eqn 5 of Baluev 2008)
[ "Davies", "upper", "-", "bound", "to", "the", "false", "alarm", "probability" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L207-L215
carpyncho/feets
feets/libs/ls_fap.py
fap_baluev
def fap_baluev(Z, fmax, t, y, dy, normalization='standard'): """Alias-free approximation to false alarm probability (Eqn 6 of Baluev 2008) """ cdf = cdf_single(Z, len(t), normalization) tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization) return 1 - cdf * np.exp(-tau)
python
def fap_baluev(Z, fmax, t, y, dy, normalization='standard'): """Alias-free approximation to false alarm probability (Eqn 6 of Baluev 2008) """ cdf = cdf_single(Z, len(t), normalization) tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization) return 1 - cdf * np.exp(-tau)
[ "def", "fap_baluev", "(", "Z", ",", "fmax", ",", "t", ",", "y", ",", "dy", ",", "normalization", "=", "'standard'", ")", ":", "cdf", "=", "cdf_single", "(", "Z", ",", "len", "(", "t", ")", ",", "normalization", ")", "tau", "=", "tau_davies", "(", ...
Alias-free approximation to false alarm probability (Eqn 6 of Baluev 2008)
[ "Alias", "-", "free", "approximation", "to", "false", "alarm", "probability" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L218-L225
carpyncho/feets
feets/libs/ls_fap.py
false_alarm_probability
def false_alarm_probability(Z, fmax, t, y, dy, normalization, method='baluev', method_kwds=None): """Approximate the False Alarm Probability Parameters ---------- TODO Returns ------- TODO """ if method not in METHODS: raise ValueError("Unrecogni...
python
def false_alarm_probability(Z, fmax, t, y, dy, normalization, method='baluev', method_kwds=None): """Approximate the False Alarm Probability Parameters ---------- TODO Returns ------- TODO """ if method not in METHODS: raise ValueError("Unrecogni...
[ "def", "false_alarm_probability", "(", "Z", ",", "fmax", ",", "t", ",", "y", ",", "dy", ",", "normalization", ",", "method", "=", "'baluev'", ",", "method_kwds", "=", "None", ")", ":", "if", "method", "not", "in", "METHODS", ":", "raise", "ValueError", ...
Approximate the False Alarm Probability Parameters ---------- TODO Returns ------- TODO
[ "Approximate", "the", "False", "Alarm", "Probability" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/libs/ls_fap.py#L250-L267
carpyncho/feets
feets/datasets/macho.py
load_MACHO
def load_MACHO(macho_id): """lightcurve of 2 bands (R, B) from the MACHO survey. Notes ----- The files are gathered from the original FATS project tutorial: https://github.com/isadoranun/tsfeat """ tarfname = "{}.tar.bz2".format(macho_id) tarpath = os.path.join(DATA_PATH, tarfname) ...
python
def load_MACHO(macho_id): """lightcurve of 2 bands (R, B) from the MACHO survey. Notes ----- The files are gathered from the original FATS project tutorial: https://github.com/isadoranun/tsfeat """ tarfname = "{}.tar.bz2".format(macho_id) tarpath = os.path.join(DATA_PATH, tarfname) ...
[ "def", "load_MACHO", "(", "macho_id", ")", ":", "tarfname", "=", "\"{}.tar.bz2\"", ".", "format", "(", "macho_id", ")", "tarpath", "=", "os", ".", "path", ".", "join", "(", "DATA_PATH", ",", "tarfname", ")", "rpath", "=", "\"{}.R.mjd\"", ".", "format", "...
lightcurve of 2 bands (R, B) from the MACHO survey. Notes ----- The files are gathered from the original FATS project tutorial: https://github.com/isadoranun/tsfeat
[ "lightcurve", "of", "2", "bands", "(", "R", "B", ")", "from", "the", "MACHO", "survey", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/macho.py#L84-L119
carpyncho/feets
doc/source/JSAnimation/IPython_display.py
anim_to_html
def anim_to_html(anim, fps=None, embed_frames=True, default_mode='loop'): """Generate HTML representation of the animation""" if fps is None and hasattr(anim, '_interval'): # Convert interval in ms to frames per second fps = 1000. / anim._interval plt.close(anim._fig) if hasattr(anim, "...
python
def anim_to_html(anim, fps=None, embed_frames=True, default_mode='loop'): """Generate HTML representation of the animation""" if fps is None and hasattr(anim, '_interval'): # Convert interval in ms to frames per second fps = 1000. / anim._interval plt.close(anim._fig) if hasattr(anim, "...
[ "def", "anim_to_html", "(", "anim", ",", "fps", "=", "None", ",", "embed_frames", "=", "True", ",", "default_mode", "=", "'loop'", ")", ":", "if", "fps", "is", "None", "and", "hasattr", "(", "anim", ",", "'_interval'", ")", ":", "# Convert interval in ms t...
Generate HTML representation of the animation
[ "Generate", "HTML", "representation", "of", "the", "animation" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/doc/source/JSAnimation/IPython_display.py#L60-L80
carpyncho/feets
doc/source/JSAnimation/IPython_display.py
display_animation
def display_animation(anim, **kwargs): """Display the animation with an IPython HTML object""" from IPython.display import HTML return HTML(anim_to_html(anim, **kwargs))
python
def display_animation(anim, **kwargs): """Display the animation with an IPython HTML object""" from IPython.display import HTML return HTML(anim_to_html(anim, **kwargs))
[ "def", "display_animation", "(", "anim", ",", "*", "*", "kwargs", ")", ":", "from", "IPython", ".", "display", "import", "HTML", "return", "HTML", "(", "anim_to_html", "(", "anim", ",", "*", "*", "kwargs", ")", ")" ]
Display the animation with an IPython HTML object
[ "Display", "the", "animation", "with", "an", "IPython", "HTML", "object" ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/doc/source/JSAnimation/IPython_display.py#L83-L86
carpyncho/feets
feets/utils.py
indent
def indent(s, c=" ", n=4): """Indent the string 's' with the character 'c', 'n' times. Parameters ---------- s : str String to indent c : str, default space String to use as indentation n : int, default 4 Number of chars to indent """ indentation = c * n re...
python
def indent(s, c=" ", n=4): """Indent the string 's' with the character 'c', 'n' times. Parameters ---------- s : str String to indent c : str, default space String to use as indentation n : int, default 4 Number of chars to indent """ indentation = c * n re...
[ "def", "indent", "(", "s", ",", "c", "=", "\" \"", ",", "n", "=", "4", ")", ":", "indentation", "=", "c", "*", "n", "return", "\"\\n\"", ".", "join", "(", "[", "indentation", "+", "l", "for", "l", "in", "s", ".", "splitlines", "(", ")", "]", ...
Indent the string 's' with the character 'c', 'n' times. Parameters ---------- s : str String to indent c : str, default space String to use as indentation n : int, default 4 Number of chars to indent
[ "Indent", "the", "string", "s", "with", "the", "character", "c", "n", "times", "." ]
train
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/utils.py#L37-L52
andersinno/hayes
hayes/ext/date_tail.py
generate_date_tail_boost_queries
def generate_date_tail_boost_queries( field, timedeltas_and_boosts, relative_to=None): """ Generate a list of RangeQueries usable to boost the scores of more recent documents. Example: ``` queries = generate_date_tail_boost_queries("publish_date", { timedelta(days=90): 1, ...
python
def generate_date_tail_boost_queries( field, timedeltas_and_boosts, relative_to=None): """ Generate a list of RangeQueries usable to boost the scores of more recent documents. Example: ``` queries = generate_date_tail_boost_queries("publish_date", { timedelta(days=90): 1, ...
[ "def", "generate_date_tail_boost_queries", "(", "field", ",", "timedeltas_and_boosts", ",", "relative_to", "=", "None", ")", ":", "relative_to", "=", "relative_to", "or", "datetime", ".", "datetime", ".", "now", "(", ")", "times", "=", "{", "}", "for", "timede...
Generate a list of RangeQueries usable to boost the scores of more recent documents. Example: ``` queries = generate_date_tail_boost_queries("publish_date", { timedelta(days=90): 1, timedelta(days=30): 2, timedelta(days=10): 4, }) s = Search(BoolQuery(must=....
[ "Generate", "a", "list", "of", "RangeQueries", "usable", "to", "boost", "the", "scores", "of", "more", "recent", "documents", "." ]
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/ext/date_tail.py#L7-L58
andersinno/hayes
hayes/search/queries.py
_clean_dict
def _clean_dict(in_dict): """ Recursively remove None-valued items from dict. :param in_dict: :return: """ out = {} for key, value in iteritems(in_dict): if isinstance(value, dict): value = _clean_dict(value) if value is None: continue out[key]...
python
def _clean_dict(in_dict): """ Recursively remove None-valued items from dict. :param in_dict: :return: """ out = {} for key, value in iteritems(in_dict): if isinstance(value, dict): value = _clean_dict(value) if value is None: continue out[key]...
[ "def", "_clean_dict", "(", "in_dict", ")", ":", "out", "=", "{", "}", "for", "key", ",", "value", "in", "iteritems", "(", "in_dict", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "value", "=", "_clean_dict", "(", "value", ")", ...
Recursively remove None-valued items from dict. :param in_dict: :return:
[ "Recursively", "remove", "None", "-", "valued", "items", "from", "dict", ".", ":", "param", "in_dict", ":", ":", "return", ":" ]
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/search/queries.py#L9-L22
andersinno/hayes
hayes/utils.py
batch_iterable
def batch_iterable(iterable, count): """ Yield batches of `count` items from the given iterable. >>> for x in batch([1, 2, 3, 4, 5, 6, 7], 3): >>> print(x) [1, 2, 3] [4, 5, 6] [7] :param iterable: An iterable :type iterable: Iterable :param count: Number of items per batch. I...
python
def batch_iterable(iterable, count): """ Yield batches of `count` items from the given iterable. >>> for x in batch([1, 2, 3, 4, 5, 6, 7], 3): >>> print(x) [1, 2, 3] [4, 5, 6] [7] :param iterable: An iterable :type iterable: Iterable :param count: Number of items per batch. I...
[ "def", "batch_iterable", "(", "iterable", ",", "count", ")", ":", "if", "count", "<=", "0", ":", "return", "current_batch", "=", "[", "]", "for", "item", "in", "iterable", ":", "if", "len", "(", "current_batch", ")", "==", "count", ":", "yield", "curre...
Yield batches of `count` items from the given iterable. >>> for x in batch([1, 2, 3, 4, 5, 6, 7], 3): >>> print(x) [1, 2, 3] [4, 5, 6] [7] :param iterable: An iterable :type iterable: Iterable :param count: Number of items per batch. If <= 0, nothing is yielded. :type count: int ...
[ "Yield", "batches", "of", "count", "items", "from", "the", "given", "iterable", "." ]
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/utils.py#L31-L57
andersinno/hayes
hayes/models.py
DjangoResultSet.get_objects
def get_objects(self, queryset=None): """ Return an iterator of Django model objects in Elasticsearch order, optionally using the given Django queryset. If no queryset is given, a default queryset (Model.objects.all) is used. :param queryset: Optional queryset to filter in. ...
python
def get_objects(self, queryset=None): """ Return an iterator of Django model objects in Elasticsearch order, optionally using the given Django queryset. If no queryset is given, a default queryset (Model.objects.all) is used. :param queryset: Optional queryset to filter in. ...
[ "def", "get_objects", "(", "self", ",", "queryset", "=", "None", ")", ":", "if", "not", "self", ":", "return", "if", "not", "queryset", ":", "queryset", "=", "self", "[", "0", "]", ".", "django_model", ".", "objects", ".", "all", "(", ")", "pks", "...
Return an iterator of Django model objects in Elasticsearch order, optionally using the given Django queryset. If no queryset is given, a default queryset (Model.objects.all) is used. :param queryset: Optional queryset to filter in. :return:
[ "Return", "an", "iterator", "of", "Django", "model", "objects", "in", "Elasticsearch", "order", "optionally", "using", "the", "given", "Django", "queryset", ".", "If", "no", "queryset", "is", "given", "a", "default", "queryset", "(", "Model", ".", "objects", ...
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/models.py#L23-L51
andersinno/hayes
hayes/ext/word_gatherer.py
WordGatherer.reset
def reset(self): """ Reset target collection (rebuild index). """ self.connection.rebuild_index( self.index, coll_name=self.target_coll_name)
python
def reset(self): """ Reset target collection (rebuild index). """ self.connection.rebuild_index( self.index, coll_name=self.target_coll_name)
[ "def", "reset", "(", "self", ")", ":", "self", ".", "connection", ".", "rebuild_index", "(", "self", ".", "index", ",", "coll_name", "=", "self", ".", "target_coll_name", ")" ]
Reset target collection (rebuild index).
[ "Reset", "target", "collection", "(", "rebuild", "index", ")", "." ]
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/ext/word_gatherer.py#L63-L67
andersinno/hayes
hayes/ext/word_gatherer.py
WordGatherer.update
def update(self, index, fields, tokenizer=default_tokenizer, cutoff=1): """ Update (upsert) the wordgatherer collection. :param index: Source index. :param fields: Fields to read. :param tokenizer: Tokenizer callable. Should split unicode to words :param cutoff: Ignore wo...
python
def update(self, index, fields, tokenizer=default_tokenizer, cutoff=1): """ Update (upsert) the wordgatherer collection. :param index: Source index. :param fields: Fields to read. :param tokenizer: Tokenizer callable. Should split unicode to words :param cutoff: Ignore wo...
[ "def", "update", "(", "self", ",", "index", ",", "fields", ",", "tokenizer", "=", "default_tokenizer", ",", "cutoff", "=", "1", ")", ":", "counts_by_uid", "=", "defaultdict", "(", "Counter", ")", "for", "word", ",", "count", "in", "self", ".", "_gather_w...
Update (upsert) the wordgatherer collection. :param index: Source index. :param fields: Fields to read. :param tokenizer: Tokenizer callable. Should split unicode to words :param cutoff: Ignore words with less than this many occurrences.
[ "Update", "(", "upsert", ")", "the", "wordgatherer", "collection", ".", ":", "param", "index", ":", "Source", "index", ".", ":", "param", "fields", ":", "Fields", "to", "read", ".", ":", "param", "tokenizer", ":", "Tokenizer", "callable", ".", "Should", ...
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/ext/word_gatherer.py#L89-L116
andersinno/hayes
hayes/ext/word_gatherer.py
WordGatherer.search
def search(self, word, limit=30): """ Search for a word within the wordgatherer collection. :param word: Word to search for. :param limit: Maximum number of results to return. """ search = Search(PrefixQuery("word", word), sort={"count": "desc"}) for doc in self.c...
python
def search(self, word, limit=30): """ Search for a word within the wordgatherer collection. :param word: Word to search for. :param limit: Maximum number of results to return. """ search = Search(PrefixQuery("word", word), sort={"count": "desc"}) for doc in self.c...
[ "def", "search", "(", "self", ",", "word", ",", "limit", "=", "30", ")", ":", "search", "=", "Search", "(", "PrefixQuery", "(", "\"word\"", ",", "word", ")", ",", "sort", "=", "{", "\"count\"", ":", "\"desc\"", "}", ")", "for", "doc", "in", "self",...
Search for a word within the wordgatherer collection. :param word: Word to search for. :param limit: Maximum number of results to return.
[ "Search", "for", "a", "word", "within", "the", "wordgatherer", "collection", ".", ":", "param", "word", ":", "Word", "to", "search", "for", ".", ":", "param", "limit", ":", "Maximum", "number", "of", "results", "to", "return", "." ]
train
https://github.com/andersinno/hayes/blob/88d1f6b3e0cd993d9d9fc136506bd01165fea64b/hayes/ext/word_gatherer.py#L118-L127
ipython/ipynb
ipynb/utils.py
validate_nb
def validate_nb(nb): """ Validate that given notebook JSON is importable - Check for nbformat == 4 - Check that language is python Do not re-implement nbformat here :D """ if nb['nbformat'] != 4: return False language_name = (nb.get('metadata', {}) .get('kernelspec', {...
python
def validate_nb(nb): """ Validate that given notebook JSON is importable - Check for nbformat == 4 - Check that language is python Do not re-implement nbformat here :D """ if nb['nbformat'] != 4: return False language_name = (nb.get('metadata', {}) .get('kernelspec', {...
[ "def", "validate_nb", "(", "nb", ")", ":", "if", "nb", "[", "'nbformat'", "]", "!=", "4", ":", "return", "False", "language_name", "=", "(", "nb", ".", "get", "(", "'metadata'", ",", "{", "}", ")", ".", "get", "(", "'kernelspec'", ",", "{", "}", ...
Validate that given notebook JSON is importable - Check for nbformat == 4 - Check that language is python Do not re-implement nbformat here :D
[ "Validate", "that", "given", "notebook", "JSON", "is", "importable" ]
train
https://github.com/ipython/ipynb/blob/2f1526a447104d7d7b97e2a8ab66bee8d2da90ad/ipynb/utils.py#L25-L40
ipython/ipynb
ipynb/utils.py
filter_ast
def filter_ast(module_ast): """ Filters a given module ast, removing non-whitelisted nodes It allows only the following top level items: - imports - function definitions - class definitions - top level assignments where all the targets on the LHS are all caps """ def node_predic...
python
def filter_ast(module_ast): """ Filters a given module ast, removing non-whitelisted nodes It allows only the following top level items: - imports - function definitions - class definitions - top level assignments where all the targets on the LHS are all caps """ def node_predic...
[ "def", "filter_ast", "(", "module_ast", ")", ":", "def", "node_predicate", "(", "node", ")", ":", "\"\"\"\n Return true if given node is whitelisted\n \"\"\"", "for", "an", "in", "ALLOWED_NODES", ":", "if", "isinstance", "(", "node", ",", "an", ")", ":...
Filters a given module ast, removing non-whitelisted nodes It allows only the following top level items: - imports - function definitions - class definitions - top level assignments where all the targets on the LHS are all caps
[ "Filters", "a", "given", "module", "ast", "removing", "non", "-", "whitelisted", "nodes" ]
train
https://github.com/ipython/ipynb/blob/2f1526a447104d7d7b97e2a8ab66bee8d2da90ad/ipynb/utils.py#L43-L70
ipython/ipynb
ipynb/utils.py
code_from_ipynb
def code_from_ipynb(nb, markdown=False): """ Get the code for a given notebook nb is passed in as a dictionary that's a parsed ipynb file """ code = PREAMBLE for cell in nb['cells']: if cell['cell_type'] == 'code': # transform the input to executable Python code ...
python
def code_from_ipynb(nb, markdown=False): """ Get the code for a given notebook nb is passed in as a dictionary that's a parsed ipynb file """ code = PREAMBLE for cell in nb['cells']: if cell['cell_type'] == 'code': # transform the input to executable Python code ...
[ "def", "code_from_ipynb", "(", "nb", ",", "markdown", "=", "False", ")", ":", "code", "=", "PREAMBLE", "for", "cell", "in", "nb", "[", "'cells'", "]", ":", "if", "cell", "[", "'cell_type'", "]", "==", "'code'", ":", "# transform the input to executable Pytho...
Get the code for a given notebook nb is passed in as a dictionary that's a parsed ipynb file
[ "Get", "the", "code", "for", "a", "given", "notebook" ]
train
https://github.com/ipython/ipynb/blob/2f1526a447104d7d7b97e2a8ab66bee8d2da90ad/ipynb/utils.py#L72-L88
ipython/ipynb
ipynb/fs/finder.py
FSFinder._get_paths
def _get_paths(self, fullname): """ Generate ordered list of paths we should look for fullname module in """ real_path = os.path.join(*fullname[len(self.package_prefix):].split('.')) for base_path in sys.path: if base_path == '': # Empty string means p...
python
def _get_paths(self, fullname): """ Generate ordered list of paths we should look for fullname module in """ real_path = os.path.join(*fullname[len(self.package_prefix):].split('.')) for base_path in sys.path: if base_path == '': # Empty string means p...
[ "def", "_get_paths", "(", "self", ",", "fullname", ")", ":", "real_path", "=", "os", ".", "path", ".", "join", "(", "*", "fullname", "[", "len", "(", "self", ".", "package_prefix", ")", ":", "]", ".", "split", "(", "'.'", ")", ")", "for", "base_pat...
Generate ordered list of paths we should look for fullname module in
[ "Generate", "ordered", "list", "of", "paths", "we", "should", "look", "for", "fullname", "module", "in" ]
train
https://github.com/ipython/ipynb/blob/2f1526a447104d7d7b97e2a8ab66bee8d2da90ad/ipynb/fs/finder.py#L24-L37
ipython/ipynb
ipynb/fs/finder.py
FSFinder.find_spec
def find_spec(self, fullname, path, target=None): """ Claims modules that are under ipynb.fs """ if fullname.startswith(self.package_prefix): for path in self._get_paths(fullname): if os.path.exists(path): return ModuleSpec( ...
python
def find_spec(self, fullname, path, target=None): """ Claims modules that are under ipynb.fs """ if fullname.startswith(self.package_prefix): for path in self._get_paths(fullname): if os.path.exists(path): return ModuleSpec( ...
[ "def", "find_spec", "(", "self", ",", "fullname", ",", "path", ",", "target", "=", "None", ")", ":", "if", "fullname", ".", "startswith", "(", "self", ".", "package_prefix", ")", ":", "for", "path", "in", "self", ".", "_get_paths", "(", "fullname", ")"...
Claims modules that are under ipynb.fs
[ "Claims", "modules", "that", "are", "under", "ipynb", ".", "fs" ]
train
https://github.com/ipython/ipynb/blob/2f1526a447104d7d7b97e2a8ab66bee8d2da90ad/ipynb/fs/finder.py#L39-L51
sixty-north/python-transducers
transducer/_util.py
coroutine
def coroutine(func): """Decorator for priming generator-based coroutines. """ @wraps(func) def start(*args, **kwargs): g = func(*args, **kwargs) next(g) return g return start
python
def coroutine(func): """Decorator for priming generator-based coroutines. """ @wraps(func) def start(*args, **kwargs): g = func(*args, **kwargs) next(g) return g return start
[ "def", "coroutine", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "start", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "g", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "next", "(", "g", ")", "return",...
Decorator for priming generator-based coroutines.
[ "Decorator", "for", "priming", "generator", "-", "based", "coroutines", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/_util.py#L16-L25
sixty-north/python-transducers
examples/cooperative.py
ticker
async def ticker(delay, to): """Yield numbers from 0 to `to` every `delay` seconds.""" for i in range(to): yield i await asyncio.sleep(delay)
python
async def ticker(delay, to): """Yield numbers from 0 to `to` every `delay` seconds.""" for i in range(to): yield i await asyncio.sleep(delay)
[ "async", "def", "ticker", "(", "delay", ",", "to", ")", ":", "for", "i", "in", "range", "(", "to", ")", ":", "yield", "i", "await", "asyncio", ".", "sleep", "(", "delay", ")" ]
Yield numbers from 0 to `to` every `delay` seconds.
[ "Yield", "numbers", "from", "0", "to", "to", "every", "delay", "seconds", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/examples/cooperative.py#L7-L11
sixty-north/python-transducers
transducer/sinks.py
rprint
def rprint(sep='\n', end='\n', file=sys.stdout, flush=False): """A coroutine sink which prints received items stdout Args: sep: Optional separator to be printed between received items. end: Optional terminator to be printed after the last item. file: Optional stream to which to print. ...
python
def rprint(sep='\n', end='\n', file=sys.stdout, flush=False): """A coroutine sink which prints received items stdout Args: sep: Optional separator to be printed between received items. end: Optional terminator to be printed after the last item. file: Optional stream to which to print. ...
[ "def", "rprint", "(", "sep", "=", "'\\n'", ",", "end", "=", "'\\n'", ",", "file", "=", "sys", ".", "stdout", ",", "flush", "=", "False", ")", ":", "try", ":", "first_item", "=", "(", "yield", ")", "file", ".", "write", "(", "str", "(", "first_ite...
A coroutine sink which prints received items stdout Args: sep: Optional separator to be printed between received items. end: Optional terminator to be printed after the last item. file: Optional stream to which to print. flush: Optional flag to force flushing after each item.
[ "A", "coroutine", "sink", "which", "prints", "received", "items", "stdout" ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/sinks.py#L14-L37
sixty-north/python-transducers
transducer/sources.py
iterable_source
def iterable_source(iterable, target): """Convert an iterable into a stream of events. Args: iterable: A series of items which will be sent to the target one by one. target: The target coroutine or sink. Returns: An iterator over any remaining items. """ it = iter(iterable)...
python
def iterable_source(iterable, target): """Convert an iterable into a stream of events. Args: iterable: A series of items which will be sent to the target one by one. target: The target coroutine or sink. Returns: An iterator over any remaining items. """ it = iter(iterable)...
[ "def", "iterable_source", "(", "iterable", ",", "target", ")", ":", "it", "=", "iter", "(", "iterable", ")", "for", "item", "in", "it", ":", "try", ":", "target", ".", "send", "(", "item", ")", "except", "StopIteration", ":", "return", "prepend", "(", ...
Convert an iterable into a stream of events. Args: iterable: A series of items which will be sent to the target one by one. target: The target coroutine or sink. Returns: An iterator over any remaining items.
[ "Convert", "an", "iterable", "into", "a", "stream", "of", "events", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/sources.py#L6-L22
sixty-north/python-transducers
transducer/sources.py
poisson_source
def poisson_source(rate, iterable, target): """Send events at random times with uniform probability. Args: rate: The average number of events to send per second. iterable: A series of items which will be sent to the target one by one. target: The target coroutine or sink. Returns: ...
python
def poisson_source(rate, iterable, target): """Send events at random times with uniform probability. Args: rate: The average number of events to send per second. iterable: A series of items which will be sent to the target one by one. target: The target coroutine or sink. Returns: ...
[ "def", "poisson_source", "(", "rate", ",", "iterable", ",", "target", ")", ":", "if", "rate", "<=", "0.0", ":", "raise", "ValueError", "(", "\"poisson_source rate {} is not positive\"", ".", "format", "(", "rate", ")", ")", "it", "=", "iter", "(", "iterable"...
Send events at random times with uniform probability. Args: rate: The average number of events to send per second. iterable: A series of items which will be sent to the target one by one. target: The target coroutine or sink. Returns: An iterator over any remaining items.
[ "Send", "events", "at", "random", "times", "with", "uniform", "probability", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/sources.py#L25-L47
sixty-north/python-transducers
transducer/functional.py
compose
def compose(f, *fs): """Compose functions right to left. compose(f, g, h)(x) -> f(g(h(x))) Args: f, *fs: The head and rest of a sequence of callables. The rightmost function passed can accept any arguments and the returned function will have the same signature as ...
python
def compose(f, *fs): """Compose functions right to left. compose(f, g, h)(x) -> f(g(h(x))) Args: f, *fs: The head and rest of a sequence of callables. The rightmost function passed can accept any arguments and the returned function will have the same signature as ...
[ "def", "compose", "(", "f", ",", "*", "fs", ")", ":", "rfs", "=", "list", "(", "chain", "(", "[", "f", "]", ",", "fs", ")", ")", "rfs", ".", "reverse", "(", ")", "def", "composed", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "retur...
Compose functions right to left. compose(f, g, h)(x) -> f(g(h(x))) Args: f, *fs: The head and rest of a sequence of callables. The rightmost function passed can accept any arguments and the returned function will have the same signature as this last prov...
[ "Compose", "functions", "right", "to", "left", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/functional.py#L5-L31
sixty-north/python-transducers
transducer/transducers.py
reducing
def reducing(reducer, init=UNSET): """Create a reducing transducer with the given reducer. Args: reducer: A two-argument function which will be used to combine the partial cumulative result in the first argument with the next item from the input stream in the second argument. ...
python
def reducing(reducer, init=UNSET): """Create a reducing transducer with the given reducer. Args: reducer: A two-argument function which will be used to combine the partial cumulative result in the first argument with the next item from the input stream in the second argument. ...
[ "def", "reducing", "(", "reducer", ",", "init", "=", "UNSET", ")", ":", "reducer2", "=", "reducer", "def", "reducing_transducer", "(", "reducer", ")", ":", "return", "Reducing", "(", "reducer", ",", "reducer2", ",", "init", ")", "return", "reducing_transduce...
Create a reducing transducer with the given reducer. Args: reducer: A two-argument function which will be used to combine the partial cumulative result in the first argument with the next item from the input stream in the second argument. Returns: A reducing transducer: A singl...
[ "Create", "a", "reducing", "transducer", "with", "the", "given", "reducer", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L99-L119
sixty-north/python-transducers
transducer/transducers.py
scanning
def scanning(reducer, init=UNSET): """Create a scanning reducer.""" reducer2 = reducer def scanning_transducer(reducer): return Scanning(reducer, reducer2, init) return scanning_transducer
python
def scanning(reducer, init=UNSET): """Create a scanning reducer.""" reducer2 = reducer def scanning_transducer(reducer): return Scanning(reducer, reducer2, init) return scanning_transducer
[ "def", "scanning", "(", "reducer", ",", "init", "=", "UNSET", ")", ":", "reducer2", "=", "reducer", "def", "scanning_transducer", "(", "reducer", ")", ":", "return", "Scanning", "(", "reducer", ",", "reducer2", ",", "init", ")", "return", "scanning_transduce...
Create a scanning reducer.
[ "Create", "a", "scanning", "reducer", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L136-L144
sixty-north/python-transducers
transducer/transducers.py
taking
def taking(n): """Create a transducer which takes the first n items""" if n < 0: raise ValueError("Cannot take fewer than zero ({}) items".format(n)) def taking_transducer(reducer): return Taking(reducer, n) return taking_transducer
python
def taking(n): """Create a transducer which takes the first n items""" if n < 0: raise ValueError("Cannot take fewer than zero ({}) items".format(n)) def taking_transducer(reducer): return Taking(reducer, n) return taking_transducer
[ "def", "taking", "(", "n", ")", ":", "if", "n", "<", "0", ":", "raise", "ValueError", "(", "\"Cannot take fewer than zero ({}) items\"", ".", "format", "(", "n", ")", ")", "def", "taking_transducer", "(", "reducer", ")", ":", "return", "Taking", "(", "redu...
Create a transducer which takes the first n items
[ "Create", "a", "transducer", "which", "takes", "the", "first", "n", "items" ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L207-L216
sixty-north/python-transducers
transducer/transducers.py
dropping
def dropping(n): """Create a transducer which drops the first n items""" if n < 0: raise ValueError("Cannot drop fewer than zero ({}) items".format(n)) def dropping_transducer(reducer): return Dropping(reducer, n) return dropping_transducer
python
def dropping(n): """Create a transducer which drops the first n items""" if n < 0: raise ValueError("Cannot drop fewer than zero ({}) items".format(n)) def dropping_transducer(reducer): return Dropping(reducer, n) return dropping_transducer
[ "def", "dropping", "(", "n", ")", ":", "if", "n", "<", "0", ":", "raise", "ValueError", "(", "\"Cannot drop fewer than zero ({}) items\"", ".", "format", "(", "n", ")", ")", "def", "dropping_transducer", "(", "reducer", ")", ":", "return", "Dropping", "(", ...
Create a transducer which drops the first n items
[ "Create", "a", "transducer", "which", "drops", "the", "first", "n", "items" ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L255-L264
sixty-north/python-transducers
transducer/transducers.py
batching
def batching(size): """Create a transducer which produces non-overlapping batches.""" if size < 1: raise ValueError("batching() size must be at least 1") def batching_transducer(reducer): return Batching(reducer, size) return batching_transducer
python
def batching(size): """Create a transducer which produces non-overlapping batches.""" if size < 1: raise ValueError("batching() size must be at least 1") def batching_transducer(reducer): return Batching(reducer, size) return batching_transducer
[ "def", "batching", "(", "size", ")", ":", "if", "size", "<", "1", ":", "raise", "ValueError", "(", "\"batching() size must be at least 1\"", ")", "def", "batching_transducer", "(", "reducer", ")", ":", "return", "Batching", "(", "reducer", ",", "size", ")", ...
Create a transducer which produces non-overlapping batches.
[ "Create", "a", "transducer", "which", "produces", "non", "-", "overlapping", "batches", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L360-L369
sixty-north/python-transducers
transducer/transducers.py
windowing
def windowing(size, padding=UNSET, window_type=tuple): """Create a transducer which produces a moving window over items.""" if size < 1: raise ValueError("windowing() size {} is not at least 1".format(size)) def windowing_transducer(reducer): return Windowing(reducer, size, padding, window...
python
def windowing(size, padding=UNSET, window_type=tuple): """Create a transducer which produces a moving window over items.""" if size < 1: raise ValueError("windowing() size {} is not at least 1".format(size)) def windowing_transducer(reducer): return Windowing(reducer, size, padding, window...
[ "def", "windowing", "(", "size", ",", "padding", "=", "UNSET", ",", "window_type", "=", "tuple", ")", ":", "if", "size", "<", "1", ":", "raise", "ValueError", "(", "\"windowing() size {} is not at least 1\"", ".", "format", "(", "size", ")", ")", "def", "w...
Create a transducer which produces a moving window over items.
[ "Create", "a", "transducer", "which", "produces", "a", "moving", "window", "over", "items", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L398-L407
sixty-north/python-transducers
transducer/transducers.py
first
def first(predicate=None): """Create a transducer which obtains the first item, then terminates.""" predicate = true if predicate is None else predicate def first_transducer(reducer): return First(reducer, predicate) return first_transducer
python
def first(predicate=None): """Create a transducer which obtains the first item, then terminates.""" predicate = true if predicate is None else predicate def first_transducer(reducer): return First(reducer, predicate) return first_transducer
[ "def", "first", "(", "predicate", "=", "None", ")", ":", "predicate", "=", "true", "if", "predicate", "is", "None", "else", "predicate", "def", "first_transducer", "(", "reducer", ")", ":", "return", "First", "(", "reducer", ",", "predicate", ")", "return"...
Create a transducer which obtains the first item, then terminates.
[ "Create", "a", "transducer", "which", "obtains", "the", "first", "item", "then", "terminates", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L422-L430
sixty-north/python-transducers
transducer/transducers.py
last
def last(predicate=None): """Create a transducer which obtains the last item.""" predicate = true if predicate is None else predicate def last_transducer(reducer): return Last(reducer, predicate) return last_transducer
python
def last(predicate=None): """Create a transducer which obtains the last item.""" predicate = true if predicate is None else predicate def last_transducer(reducer): return Last(reducer, predicate) return last_transducer
[ "def", "last", "(", "predicate", "=", "None", ")", ":", "predicate", "=", "true", "if", "predicate", "is", "None", "else", "predicate", "def", "last_transducer", "(", "reducer", ")", ":", "return", "Last", "(", "reducer", ",", "predicate", ")", "return", ...
Create a transducer which obtains the last item.
[ "Create", "a", "transducer", "which", "obtains", "the", "last", "item", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L453-L461
sixty-north/python-transducers
transducer/transducers.py
element_at
def element_at(index): """Create a transducer which obtains the item at the specified index.""" if index < 0: raise IndexError("element_at used with illegal index {}".format(index)) def element_at_transducer(reducer): return ElementAt(reducer, index) return element_at_transducer
python
def element_at(index): """Create a transducer which obtains the item at the specified index.""" if index < 0: raise IndexError("element_at used with illegal index {}".format(index)) def element_at_transducer(reducer): return ElementAt(reducer, index) return element_at_transducer
[ "def", "element_at", "(", "index", ")", ":", "if", "index", "<", "0", ":", "raise", "IndexError", "(", "\"element_at used with illegal index {}\"", ".", "format", "(", "index", ")", ")", "def", "element_at_transducer", "(", "reducer", ")", ":", "return", "Elem...
Create a transducer which obtains the item at the specified index.
[ "Create", "a", "transducer", "which", "obtains", "the", "item", "at", "the", "specified", "index", "." ]
train
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/transducers.py#L486-L495
bjodah/pycompilation
pycompilation/compilation.py
compile_sources
def compile_sources(files, CompilerRunner_=None, destdir=None, cwd=None, keep_dir_struct=False, per_file_kwargs=None, **kwargs): """ Compile source code files to object files. Parameters ---------- files: iterable of pa...
python
def compile_sources(files, CompilerRunner_=None, destdir=None, cwd=None, keep_dir_struct=False, per_file_kwargs=None, **kwargs): """ Compile source code files to object files. Parameters ---------- files: iterable of pa...
[ "def", "compile_sources", "(", "files", ",", "CompilerRunner_", "=", "None", ",", "destdir", "=", "None", ",", "cwd", "=", "None", ",", "keep_dir_struct", "=", "False", ",", "per_file_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_per_file_kwar...
Compile source code files to object files. Parameters ---------- files: iterable of path strings source files, if cwd is given, the paths are taken as relative. CompilerRunner_: CompilerRunner instance (optional) could be e.g. pycompilation.FortranCompilerRunner Will be inferred...
[ "Compile", "source", "code", "files", "to", "object", "files", "." ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L85-L150
bjodah/pycompilation
pycompilation/compilation.py
link
def link(obj_files, out_file=None, shared=False, CompilerRunner_=None, cwd=None, cplus=False, fort=False, **kwargs): """ Link object files. Parameters ---------- obj_files: iterable of path strings out_file: path string (optional) path to executable/shared library, if missing ...
python
def link(obj_files, out_file=None, shared=False, CompilerRunner_=None, cwd=None, cplus=False, fort=False, **kwargs): """ Link object files. Parameters ---------- obj_files: iterable of path strings out_file: path string (optional) path to executable/shared library, if missing ...
[ "def", "link", "(", "obj_files", ",", "out_file", "=", "None", ",", "shared", "=", "False", ",", "CompilerRunner_", "=", "None", ",", "cwd", "=", "None", ",", "cplus", "=", "False", ",", "fort", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if"...
Link object files. Parameters ---------- obj_files: iterable of path strings out_file: path string (optional) path to executable/shared library, if missing it will be deduced from the last item in obj_files. shared: bool Generate a shared library? default: False Compiler...
[ "Link", "object", "files", "." ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L153-L225
bjodah/pycompilation
pycompilation/compilation.py
link_py_so
def link_py_so(obj_files, so_file=None, cwd=None, libraries=None, cplus=False, fort=False, **kwargs): """ Link python extension module (shared object) for importing Parameters ---------- obj_files: iterable of path strings object files to be linked so_file: path string ...
python
def link_py_so(obj_files, so_file=None, cwd=None, libraries=None, cplus=False, fort=False, **kwargs): """ Link python extension module (shared object) for importing Parameters ---------- obj_files: iterable of path strings object files to be linked so_file: path string ...
[ "def", "link_py_so", "(", "obj_files", ",", "so_file", "=", "None", ",", "cwd", "=", "None", ",", "libraries", "=", "None", ",", "cplus", "=", "False", ",", "fort", "=", "False", ",", "*", "*", "kwargs", ")", ":", "libraries", "=", "libraries", "or",...
Link python extension module (shared object) for importing Parameters ---------- obj_files: iterable of path strings object files to be linked so_file: path string Name (path) of shared object file to create. If not specified it will have the basname of the last object f...
[ "Link", "python", "extension", "module", "(", "shared", "object", ")", "for", "importing" ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L228-L308
bjodah/pycompilation
pycompilation/compilation.py
simple_cythonize
def simple_cythonize(src, destdir=None, cwd=None, logger=None, full_module_name=None, only_update=False, **cy_kwargs): """ Generates a C file from a Cython source file. Parameters ---------- src: path string path to Cython source destdir: path s...
python
def simple_cythonize(src, destdir=None, cwd=None, logger=None, full_module_name=None, only_update=False, **cy_kwargs): """ Generates a C file from a Cython source file. Parameters ---------- src: path string path to Cython source destdir: path s...
[ "def", "simple_cythonize", "(", "src", ",", "destdir", "=", "None", ",", "cwd", "=", "None", ",", "logger", "=", "None", ",", "full_module_name", "=", "None", ",", "only_update", "=", "False", ",", "*", "*", "cy_kwargs", ")", ":", "from", "Cython", "."...
Generates a C file from a Cython source file. Parameters ---------- src: path string path to Cython source destdir: path string (optional) Path to output directory (default: '.') cwd: path string (optional) Root of relative paths (default: '.') logger: logging.Logger ...
[ "Generates", "a", "C", "file", "from", "a", "Cython", "source", "file", "." ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L311-L381
bjodah/pycompilation
pycompilation/compilation.py
src2obj
def src2obj(srcpath, CompilerRunner_=None, objpath=None, only_update=False, cwd=None, out_ext=None, inc_py=False, **kwargs): """ Compiles a source code file to an object file. Files ending with '.pyx' assumed to be cython files and are dispatched to pyx2obj. Parameters -...
python
def src2obj(srcpath, CompilerRunner_=None, objpath=None, only_update=False, cwd=None, out_ext=None, inc_py=False, **kwargs): """ Compiles a source code file to an object file. Files ending with '.pyx' assumed to be cython files and are dispatched to pyx2obj. Parameters -...
[ "def", "src2obj", "(", "srcpath", ",", "CompilerRunner_", "=", "None", ",", "objpath", "=", "None", ",", "only_update", "=", "False", ",", "cwd", "=", "None", ",", "out_ext", "=", "None", ",", "inc_py", "=", "False", ",", "*", "*", "kwargs", ")", ":"...
Compiles a source code file to an object file. Files ending with '.pyx' assumed to be cython files and are dispatched to pyx2obj. Parameters ---------- srcpath: path string path to source file CompilerRunner_: pycompilation.CompilerRunner subclass (optional) Default: deduced fro...
[ "Compiles", "a", "source", "code", "file", "to", "an", "object", "file", ".", "Files", "ending", "with", ".", "pyx", "assumed", "to", "be", "cython", "files", "and", "are", "dispatched", "to", "pyx2obj", "." ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L398-L471
bjodah/pycompilation
pycompilation/compilation.py
pyx2obj
def pyx2obj(pyxpath, objpath=None, interm_c_dir=None, cwd=None, logger=None, full_module_name=None, only_update=False, metadir=None, include_numpy=False, include_dirs=None, cy_kwargs=None, gdb=False, cplus=None, **kwargs): """ Convenience function If cwd is specified, py...
python
def pyx2obj(pyxpath, objpath=None, interm_c_dir=None, cwd=None, logger=None, full_module_name=None, only_update=False, metadir=None, include_numpy=False, include_dirs=None, cy_kwargs=None, gdb=False, cplus=None, **kwargs): """ Convenience function If cwd is specified, py...
[ "def", "pyx2obj", "(", "pyxpath", ",", "objpath", "=", "None", ",", "interm_c_dir", "=", "None", ",", "cwd", "=", "None", ",", "logger", "=", "None", ",", "full_module_name", "=", "None", ",", "only_update", "=", "False", ",", "metadir", "=", "None", "...
Convenience function If cwd is specified, pyxpath and dst are taken to be relative If only_update is set to `True` the modification time is checked and compilation is only run if the source is newer than the destination Parameters ---------- pyxpath: path string path to Cython sour...
[ "Convenience", "function" ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L474-L596
bjodah/pycompilation
pycompilation/compilation.py
compile_link_import_py_ext
def compile_link_import_py_ext( srcs, extname=None, build_dir=None, compile_kwargs=None, link_kwargs=None, **kwargs): """ Compiles sources in `srcs` to a shared object (python extension) which is imported. If shared object is newer than the sources, they are not recompiled but instead it...
python
def compile_link_import_py_ext( srcs, extname=None, build_dir=None, compile_kwargs=None, link_kwargs=None, **kwargs): """ Compiles sources in `srcs` to a shared object (python extension) which is imported. If shared object is newer than the sources, they are not recompiled but instead it...
[ "def", "compile_link_import_py_ext", "(", "srcs", ",", "extname", "=", "None", ",", "build_dir", "=", "None", ",", "compile_kwargs", "=", "None", ",", "link_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "build_dir", "=", "build_dir", "or", "'.'"...
Compiles sources in `srcs` to a shared object (python extension) which is imported. If shared object is newer than the sources, they are not recompiled but instead it is imported. Parameters ---------- srcs: string list of paths to sources extname: string name of extension (defa...
[ "Compiles", "sources", "in", "srcs", "to", "a", "shared", "object", "(", "python", "extension", ")", "which", "is", "imported", ".", "If", "shared", "object", "is", "newer", "than", "the", "sources", "they", "are", "not", "recompiled", "but", "instead", "i...
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L617-L673
bjodah/pycompilation
pycompilation/compilation.py
compile_link_import_strings
def compile_link_import_strings(codes, build_dir=None, **kwargs): """ Creates a temporary directory and dumps, compiles and links provided source code. Parameters ---------- codes: iterable of name/source pair tuples build_dir: string (default: None) path to cache_dir. None implies ...
python
def compile_link_import_strings(codes, build_dir=None, **kwargs): """ Creates a temporary directory and dumps, compiles and links provided source code. Parameters ---------- codes: iterable of name/source pair tuples build_dir: string (default: None) path to cache_dir. None implies ...
[ "def", "compile_link_import_strings", "(", "codes", ",", "build_dir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "build_dir", "=", "build_dir", "or", "tempfile", ".", "mkdtemp", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "build_dir...
Creates a temporary directory and dumps, compiles and links provided source code. Parameters ---------- codes: iterable of name/source pair tuples build_dir: string (default: None) path to cache_dir. None implies use a temporary directory. **kwargs: keyword arguments passed onto...
[ "Creates", "a", "temporary", "directory", "and", "dumps", "compiles", "and", "links", "provided", "source", "code", "." ]
train
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/compilation.py#L676-L717
reclosedev/lathermail
lathermail/storage/mongo.py
switch_db
def switch_db(name): """ Hack to switch Flask-Pymongo db :param name: db name """ with app.app_context(): app.extensions['pymongo'][mongo.config_prefix] = mongo.cx, mongo.cx[name]
python
def switch_db(name): """ Hack to switch Flask-Pymongo db :param name: db name """ with app.app_context(): app.extensions['pymongo'][mongo.config_prefix] = mongo.cx, mongo.cx[name]
[ "def", "switch_db", "(", "name", ")", ":", "with", "app", ".", "app_context", "(", ")", ":", "app", ".", "extensions", "[", "'pymongo'", "]", "[", "mongo", ".", "config_prefix", "]", "=", "mongo", ".", "cx", ",", "mongo", ".", "cx", "[", "name", "]...
Hack to switch Flask-Pymongo db :param name: db name
[ "Hack", "to", "switch", "Flask", "-", "Pymongo", "db", ":", "param", "name", ":", "db", "name" ]
train
https://github.com/reclosedev/lathermail/blob/be006b4e4082002db31afea125c58345de1cd606/lathermail/storage/mongo.py#L22-L27
BlueBrain/hpcbench
hpcbench/benchmark/osu.py
OSU.arguments
def arguments(self): """Dictionary providing the list of arguments for every benchmark""" if 'arguments' in self.attributes: LOGGER.warning( "WARNING: 'arguments' use in OSU yaml configuration file is deprecated. Please use 'options'!" ) argume...
python
def arguments(self): """Dictionary providing the list of arguments for every benchmark""" if 'arguments' in self.attributes: LOGGER.warning( "WARNING: 'arguments' use in OSU yaml configuration file is deprecated. Please use 'options'!" ) argume...
[ "def", "arguments", "(", "self", ")", ":", "if", "'arguments'", "in", "self", ".", "attributes", ":", "LOGGER", ".", "warning", "(", "\"WARNING: 'arguments' use in OSU yaml configuration file is deprecated. Please use 'options'!\"", ")", "arguments", "=", "self", ".", "...
Dictionary providing the list of arguments for every benchmark
[ "Dictionary", "providing", "the", "list", "of", "arguments", "for", "every", "benchmark" ]
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/benchmark/osu.py#L289-L306
portfoliome/foil
foil/serializers.py
_
def _(obj): """ISO 8601 format. Interprets naive datetime as UTC with zulu suffix.""" tz_offset = obj.utcoffset() if not tz_offset or tz_offset == UTC_ZERO: iso_datetime = obj.strftime('%Y-%m-%dT%H:%M:%S.%fZ') else: iso_datetime = obj.isoformat() return iso_datetime
python
def _(obj): """ISO 8601 format. Interprets naive datetime as UTC with zulu suffix.""" tz_offset = obj.utcoffset() if not tz_offset or tz_offset == UTC_ZERO: iso_datetime = obj.strftime('%Y-%m-%dT%H:%M:%S.%fZ') else: iso_datetime = obj.isoformat() return iso_datetime
[ "def", "_", "(", "obj", ")", ":", "tz_offset", "=", "obj", ".", "utcoffset", "(", ")", "if", "not", "tz_offset", "or", "tz_offset", "==", "UTC_ZERO", ":", "iso_datetime", "=", "obj", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%S.%fZ'", ")", "else", ":", "iso...
ISO 8601 format. Interprets naive datetime as UTC with zulu suffix.
[ "ISO", "8601", "format", ".", "Interprets", "naive", "datetime", "as", "UTC", "with", "zulu", "suffix", "." ]
train
https://github.com/portfoliome/foil/blob/b66d8cf4ab048a387d8c7a033b47e922ed6917d6/foil/serializers.py#L26-L36
Metatab/metatab
metatab/resolver.py
WebResolver.get_row_generator
def get_row_generator(self, ref, cache=None): """Return a row generator for a reference""" from inspect import isgenerator from rowgenerators import get_generator g = get_generator(ref) if not g: raise GenerateError("Cant figure out how to generate rows from {} ref...
python
def get_row_generator(self, ref, cache=None): """Return a row generator for a reference""" from inspect import isgenerator from rowgenerators import get_generator g = get_generator(ref) if not g: raise GenerateError("Cant figure out how to generate rows from {} ref...
[ "def", "get_row_generator", "(", "self", ",", "ref", ",", "cache", "=", "None", ")", ":", "from", "inspect", "import", "isgenerator", "from", "rowgenerators", "import", "get_generator", "g", "=", "get_generator", "(", "ref", ")", "if", "not", "g", ":", "ra...
Return a row generator for a reference
[ "Return", "a", "row", "generator", "for", "a", "reference" ]
train
https://github.com/Metatab/metatab/blob/8336ec3e4bd8da84a9a5cb86de1c1086e14b8b22/metatab/resolver.py#L34-L45
portfoliome/foil
foil/filters.py
create_key_filter
def create_key_filter(properties: Dict[str, list]) -> List[Tuple]: """Generate combinations of key, value pairs for each key in properties. Examples -------- properties = {'ent': ['geo_rev', 'supply_chain'], 'own', 'fi'} >> create_key_filter(properties) --> [('ent', 'geo_rev'), ('ent', 'suppl...
python
def create_key_filter(properties: Dict[str, list]) -> List[Tuple]: """Generate combinations of key, value pairs for each key in properties. Examples -------- properties = {'ent': ['geo_rev', 'supply_chain'], 'own', 'fi'} >> create_key_filter(properties) --> [('ent', 'geo_rev'), ('ent', 'suppl...
[ "def", "create_key_filter", "(", "properties", ":", "Dict", "[", "str", ",", "list", "]", ")", "->", "List", "[", "Tuple", "]", ":", "combinations", "=", "(", "product", "(", "[", "k", "]", ",", "v", ")", "for", "k", ",", "v", "in", "properties", ...
Generate combinations of key, value pairs for each key in properties. Examples -------- properties = {'ent': ['geo_rev', 'supply_chain'], 'own', 'fi'} >> create_key_filter(properties) --> [('ent', 'geo_rev'), ('ent', 'supply_chain'), ('own', 'fi')]
[ "Generate", "combinations", "of", "key", "value", "pairs", "for", "each", "key", "in", "properties", "." ]
train
https://github.com/portfoliome/foil/blob/b66d8cf4ab048a387d8c7a033b47e922ed6917d6/foil/filters.py#L38-L50
portfoliome/foil
foil/filters.py
create_indexer
def create_indexer(indexes: list): """Create indexer function to pluck values from list.""" if len(indexes) == 1: index = indexes[0] return lambda x: (x[index],) else: return itemgetter(*indexes)
python
def create_indexer(indexes: list): """Create indexer function to pluck values from list.""" if len(indexes) == 1: index = indexes[0] return lambda x: (x[index],) else: return itemgetter(*indexes)
[ "def", "create_indexer", "(", "indexes", ":", "list", ")", ":", "if", "len", "(", "indexes", ")", "==", "1", ":", "index", "=", "indexes", "[", "0", "]", "return", "lambda", "x", ":", "(", "x", "[", "index", "]", ",", ")", "else", ":", "return", ...
Create indexer function to pluck values from list.
[ "Create", "indexer", "function", "to", "pluck", "values", "from", "list", "." ]
train
https://github.com/portfoliome/foil/blob/b66d8cf4ab048a387d8c7a033b47e922ed6917d6/foil/filters.py#L53-L60
portfoliome/foil
foil/filters.py
AttributeFilter.including
def including(self, sequence) -> Generator: """Include the sequence elements matching the filter set.""" return (element for element in sequence if self.indexer(element) in self.predicates)
python
def including(self, sequence) -> Generator: """Include the sequence elements matching the filter set.""" return (element for element in sequence if self.indexer(element) in self.predicates)
[ "def", "including", "(", "self", ",", "sequence", ")", "->", "Generator", ":", "return", "(", "element", "for", "element", "in", "sequence", "if", "self", ".", "indexer", "(", "element", ")", "in", "self", ".", "predicates", ")" ]
Include the sequence elements matching the filter set.
[ "Include", "the", "sequence", "elements", "matching", "the", "filter", "set", "." ]
train
https://github.com/portfoliome/foil/blob/b66d8cf4ab048a387d8c7a033b47e922ed6917d6/foil/filters.py#L27-L30
portfoliome/foil
foil/filters.py
AttributeFilter.excluding
def excluding(self, sequence) -> Generator: """Exclude the sequence elements matching the filter set.""" return (element for element in sequence if self.indexer(element) not in self.predicates)
python
def excluding(self, sequence) -> Generator: """Exclude the sequence elements matching the filter set.""" return (element for element in sequence if self.indexer(element) not in self.predicates)
[ "def", "excluding", "(", "self", ",", "sequence", ")", "->", "Generator", ":", "return", "(", "element", "for", "element", "in", "sequence", "if", "self", ".", "indexer", "(", "element", ")", "not", "in", "self", ".", "predicates", ")" ]
Exclude the sequence elements matching the filter set.
[ "Exclude", "the", "sequence", "elements", "matching", "the", "filter", "set", "." ]
train
https://github.com/portfoliome/foil/blob/b66d8cf4ab048a387d8c7a033b47e922ed6917d6/foil/filters.py#L32-L35
bruziev/security_interface
security_interface/api.py
Security.can
async def can(self, identity, permission) -> bool: """ Check user permissions. :return: ``True`` if the identity is allowed the permission, else return ``False``. """ assert isinstance(permission, (str, enum.Enum)), permission assert permission identify = await s...
python
async def can(self, identity, permission) -> bool: """ Check user permissions. :return: ``True`` if the identity is allowed the permission, else return ``False``. """ assert isinstance(permission, (str, enum.Enum)), permission assert permission identify = await s...
[ "async", "def", "can", "(", "self", ",", "identity", ",", "permission", ")", "->", "bool", ":", "assert", "isinstance", "(", "permission", ",", "(", "str", ",", "enum", ".", "Enum", ")", ")", ",", "permission", "assert", "permission", "identify", "=", ...
Check user permissions. :return: ``True`` if the identity is allowed the permission, else return ``False``.
[ "Check", "user", "permissions", "." ]
train
https://github.com/bruziev/security_interface/blob/ec1f30c8ac051291694b0099caa0a7fde97ddfe6/security_interface/api.py#L25-L36
bruziev/security_interface
security_interface/api.py
Security.check_authorized
async def check_authorized(self, identity): """ Works like :func:`Security.identity`, but when check is failed :func:`UnauthorizedError` exception is raised. :param identity: Claim :return: Checked claim or return ``None`` :raise: :func:`UnauthorizedError` """ ...
python
async def check_authorized(self, identity): """ Works like :func:`Security.identity`, but when check is failed :func:`UnauthorizedError` exception is raised. :param identity: Claim :return: Checked claim or return ``None`` :raise: :func:`UnauthorizedError` """ ...
[ "async", "def", "check_authorized", "(", "self", ",", "identity", ")", ":", "identify", "=", "await", "self", ".", "identify", "(", "identity", ")", "if", "identify", "is", "None", ":", "raise", "UnauthorizedError", "(", ")", "return", "identify" ]
Works like :func:`Security.identity`, but when check is failed :func:`UnauthorizedError` exception is raised. :param identity: Claim :return: Checked claim or return ``None`` :raise: :func:`UnauthorizedError`
[ "Works", "like", ":", "func", ":", "Security", ".", "identity", "but", "when", "check", "is", "failed", ":", "func", ":", "UnauthorizedError", "exception", "is", "raised", "." ]
train
https://github.com/bruziev/security_interface/blob/ec1f30c8ac051291694b0099caa0a7fde97ddfe6/security_interface/api.py#L49-L61
bruziev/security_interface
security_interface/api.py
Security.check_permission
async def check_permission(self, identity, permission): """ Works like :func:`Security.can`, but when check is failed :func:`ForbiddenError` exception is raised. :param identity: Claim :param permission: Permission :return: Checked claim :raise: :func:`ForbiddenE...
python
async def check_permission(self, identity, permission): """ Works like :func:`Security.can`, but when check is failed :func:`ForbiddenError` exception is raised. :param identity: Claim :param permission: Permission :return: Checked claim :raise: :func:`ForbiddenE...
[ "async", "def", "check_permission", "(", "self", ",", "identity", ",", "permission", ")", ":", "await", "self", ".", "check_authorized", "(", "identity", ")", "allowed", "=", "await", "self", ".", "can", "(", "identity", ",", "permission", ")", "if", "not"...
Works like :func:`Security.can`, but when check is failed :func:`ForbiddenError` exception is raised. :param identity: Claim :param permission: Permission :return: Checked claim :raise: :func:`ForbiddenError`
[ "Works", "like", ":", "func", ":", "Security", ".", "can", "but", "when", "check", "is", "failed", ":", "func", ":", "ForbiddenError", "exception", "is", "raised", "." ]
train
https://github.com/bruziev/security_interface/blob/ec1f30c8ac051291694b0099caa0a7fde97ddfe6/security_interface/api.py#L63-L76
jfear/sramongo
sramongo/sra2mongo.py
arguments
def arguments(): """Pulls in command line arguments.""" DESCRIPTION = """\ """ parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=Raw) parser.add_argument("--email", dest="email", action='store', required=False, default=False, help="An email address ...
python
def arguments(): """Pulls in command line arguments.""" DESCRIPTION = """\ """ parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=Raw) parser.add_argument("--email", dest="email", action='store', required=False, default=False, help="An email address ...
[ "def", "arguments", "(", ")", ":", "DESCRIPTION", "=", "\"\"\"\\\n \"\"\"", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "DESCRIPTION", ",", "formatter_class", "=", "Raw", ")", "parser", ".", "add_argument", "(", "\"--email\"", "...
Pulls in command line arguments.
[ "Pulls", "in", "command", "line", "arguments", "." ]
train
https://github.com/jfear/sramongo/blob/82a9a157e44bda4100be385c644b3ac21be66038/sramongo/sra2mongo.py#L24-L62
BlueBrain/hpcbench
hpcbench/net/__init__.py
BeNet.run
def run(self, *nodes): """Execute benchmarks on every node specified in arguments. If none are given, then execute benchmarks on every nodes specified in the ``network.nodes`` campaign configuration. """ nodes = nodes or self.nodes self._prelude(*nodes) @write_ya...
python
def run(self, *nodes): """Execute benchmarks on every node specified in arguments. If none are given, then execute benchmarks on every nodes specified in the ``network.nodes`` campaign configuration. """ nodes = nodes or self.nodes self._prelude(*nodes) @write_ya...
[ "def", "run", "(", "self", ",", "*", "nodes", ")", ":", "nodes", "=", "nodes", "or", "self", ".", "nodes", "self", ".", "_prelude", "(", "*", "nodes", ")", "@", "write_yaml_report", "def", "_run", "(", ")", ":", "self", ".", "_build_installer", "(", ...
Execute benchmarks on every node specified in arguments. If none are given, then execute benchmarks on every nodes specified in the ``network.nodes`` campaign configuration.
[ "Execute", "benchmarks", "on", "every", "node", "specified", "in", "arguments", ".", "If", "none", "are", "given", "then", "execute", "benchmarks", "on", "every", "nodes", "specified", "in", "the", "network", ".", "nodes", "campaign", "configuration", "." ]
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/net/__init__.py#L97-L118
BlueBrain/hpcbench
hpcbench/net/__init__.py
BeNetHost.run
def run(self): """Execute benchmark on the specified node """ with self._scp_bensh_runner(): self._execute_bensh_runner() path = self._retrieve_tarball() try: self._aggregate_tarball(path) finally: os.remove(path)
python
def run(self): """Execute benchmark on the specified node """ with self._scp_bensh_runner(): self._execute_bensh_runner() path = self._retrieve_tarball() try: self._aggregate_tarball(path) finally: os.remove(path)
[ "def", "run", "(", "self", ")", ":", "with", "self", ".", "_scp_bensh_runner", "(", ")", ":", "self", ".", "_execute_bensh_runner", "(", ")", "path", "=", "self", ".", "_retrieve_tarball", "(", ")", "try", ":", "self", ".", "_aggregate_tarball", "(", "pa...
Execute benchmark on the specified node
[ "Execute", "benchmark", "on", "the", "specified", "node" ]
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/net/__init__.py#L190-L199
BlueBrain/hpcbench
hpcbench/benchmark/imb.py
IMB.node_pairing
def node_pairing(self): """if "node" then test current node and next one if "tag", then create tests for every pair of the current tag. """ value = self.attributes['node_pairing'] if value not in IMB.NODE_PAIRING: msg = 'Unexpected {0} value: got "{1}" but valid value...
python
def node_pairing(self): """if "node" then test current node and next one if "tag", then create tests for every pair of the current tag. """ value = self.attributes['node_pairing'] if value not in IMB.NODE_PAIRING: msg = 'Unexpected {0} value: got "{1}" but valid value...
[ "def", "node_pairing", "(", "self", ")", ":", "value", "=", "self", ".", "attributes", "[", "'node_pairing'", "]", "if", "value", "not", "in", "IMB", ".", "NODE_PAIRING", ":", "msg", "=", "'Unexpected {0} value: got \"{1}\" but valid values are {2}'", "msg", "=", ...
if "node" then test current node and next one if "tag", then create tests for every pair of the current tag.
[ "if", "node", "then", "test", "current", "node", "and", "next", "one", "if", "tag", "then", "create", "tests", "for", "every", "pair", "of", "the", "current", "tag", "." ]
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/benchmark/imb.py#L252-L261
PolyJIT/benchbuild
benchbuild/projects/gentoo/gentoo.py
write_makeconfig
def write_makeconfig(_path): """ Write a valid gentoo make.conf file to :path:. Args: path - The output path of the make.conf """ http_proxy = str(CFG["gentoo"]["http_proxy"]) ftp_proxy = str(CFG["gentoo"]["ftp_proxy"]) rsync_proxy = str(CFG["gentoo"]["rsync_proxy"]) path.mkfil...
python
def write_makeconfig(_path): """ Write a valid gentoo make.conf file to :path:. Args: path - The output path of the make.conf """ http_proxy = str(CFG["gentoo"]["http_proxy"]) ftp_proxy = str(CFG["gentoo"]["ftp_proxy"]) rsync_proxy = str(CFG["gentoo"]["rsync_proxy"]) path.mkfil...
[ "def", "write_makeconfig", "(", "_path", ")", ":", "http_proxy", "=", "str", "(", "CFG", "[", "\"gentoo\"", "]", "[", "\"http_proxy\"", "]", ")", "ftp_proxy", "=", "str", "(", "CFG", "[", "\"gentoo\"", "]", "[", "\"ftp_proxy\"", "]", ")", "rsync_proxy", ...
Write a valid gentoo make.conf file to :path:. Args: path - The output path of the make.conf
[ "Write", "a", "valid", "gentoo", "make", ".", "conf", "file", "to", ":", "path", ":", "." ]
train
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/projects/gentoo/gentoo.py#L139-L184
PolyJIT/benchbuild
benchbuild/projects/gentoo/gentoo.py
write_bashrc
def write_bashrc(_path): """ Write a valid gentoo bashrc file to :path:. Args: path - The output path of the make.conf """ cfg_mounts = CFG["container"]["mounts"].value cfg_prefix = CFG["container"]["prefixes"].value path.mkfile_uchroot("/etc/portage/bashrc") mounts = uchroot.m...
python
def write_bashrc(_path): """ Write a valid gentoo bashrc file to :path:. Args: path - The output path of the make.conf """ cfg_mounts = CFG["container"]["mounts"].value cfg_prefix = CFG["container"]["prefixes"].value path.mkfile_uchroot("/etc/portage/bashrc") mounts = uchroot.m...
[ "def", "write_bashrc", "(", "_path", ")", ":", "cfg_mounts", "=", "CFG", "[", "\"container\"", "]", "[", "\"mounts\"", "]", ".", "value", "cfg_prefix", "=", "CFG", "[", "\"container\"", "]", "[", "\"prefixes\"", "]", ".", "value", "path", ".", "mkfile_uchr...
Write a valid gentoo bashrc file to :path:. Args: path - The output path of the make.conf
[ "Write", "a", "valid", "gentoo", "bashrc", "file", "to", ":", "path", ":", "." ]
train
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/projects/gentoo/gentoo.py#L187-L211
PolyJIT/benchbuild
benchbuild/projects/gentoo/gentoo.py
write_layout
def write_layout(_path): """ Write a valid gentoo layout file to :path:. Args: path - The output path of the layout.conf """ path.mkdir_uchroot("/etc/portage/metadata") path.mkfile_uchroot("/etc/portage/metadata/layout.conf") with open(_path, 'w') as layoutconf: lines = '''...
python
def write_layout(_path): """ Write a valid gentoo layout file to :path:. Args: path - The output path of the layout.conf """ path.mkdir_uchroot("/etc/portage/metadata") path.mkfile_uchroot("/etc/portage/metadata/layout.conf") with open(_path, 'w') as layoutconf: lines = '''...
[ "def", "write_layout", "(", "_path", ")", ":", "path", ".", "mkdir_uchroot", "(", "\"/etc/portage/metadata\"", ")", "path", ".", "mkfile_uchroot", "(", "\"/etc/portage/metadata/layout.conf\"", ")", "with", "open", "(", "_path", ",", "'w'", ")", "as", "layoutconf",...
Write a valid gentoo layout file to :path:. Args: path - The output path of the layout.conf
[ "Write", "a", "valid", "gentoo", "layout", "file", "to", ":", "path", ":", "." ]
train
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/projects/gentoo/gentoo.py#L214-L226
PolyJIT/benchbuild
benchbuild/projects/gentoo/gentoo.py
write_wgetrc
def write_wgetrc(_path): """ Write a valid gentoo wgetrc file to :path:. Args: path - The output path of the wgetrc """ http_proxy = str(CFG["gentoo"]["http_proxy"]) ftp_proxy = str(CFG["gentoo"]["ftp_proxy"]) path.mkfile_uchroot("/etc/wgetrc") with open(_path, 'w') as wgetrc: ...
python
def write_wgetrc(_path): """ Write a valid gentoo wgetrc file to :path:. Args: path - The output path of the wgetrc """ http_proxy = str(CFG["gentoo"]["http_proxy"]) ftp_proxy = str(CFG["gentoo"]["ftp_proxy"]) path.mkfile_uchroot("/etc/wgetrc") with open(_path, 'w') as wgetrc: ...
[ "def", "write_wgetrc", "(", "_path", ")", ":", "http_proxy", "=", "str", "(", "CFG", "[", "\"gentoo\"", "]", "[", "\"http_proxy\"", "]", ")", "ftp_proxy", "=", "str", "(", "CFG", "[", "\"gentoo\"", "]", "[", "\"ftp_proxy\"", "]", ")", "path", ".", "mkf...
Write a valid gentoo wgetrc file to :path:. Args: path - The output path of the wgetrc
[ "Write", "a", "valid", "gentoo", "wgetrc", "file", "to", ":", "path", ":", "." ]
train
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/projects/gentoo/gentoo.py#L229-L250
PolyJIT/benchbuild
benchbuild/projects/gentoo/gentoo.py
setup_benchbuild
def setup_benchbuild(): """ Setup benchbuild inside a container. This will query a for an existing installation of benchbuild and try to upgrade it to the latest version, if possible. """ LOG.debug("Setting up Benchbuild...") venv_dir = local.path("/benchbuild") prefixes = CFG["contain...
python
def setup_benchbuild(): """ Setup benchbuild inside a container. This will query a for an existing installation of benchbuild and try to upgrade it to the latest version, if possible. """ LOG.debug("Setting up Benchbuild...") venv_dir = local.path("/benchbuild") prefixes = CFG["contain...
[ "def", "setup_benchbuild", "(", ")", ":", "LOG", ".", "debug", "(", "\"Setting up Benchbuild...\"", ")", "venv_dir", "=", "local", ".", "path", "(", "\"/benchbuild\"", ")", "prefixes", "=", "CFG", "[", "\"container\"", "]", "[", "\"prefixes\"", "]", ".", "va...
Setup benchbuild inside a container. This will query a for an existing installation of benchbuild and try to upgrade it to the latest version, if possible.
[ "Setup", "benchbuild", "inside", "a", "container", "." ]
train
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/projects/gentoo/gentoo.py#L288-L317
BlueBrain/hpcbench
hpcbench/cli/bennett.py
main
def main(argv=None): """ben-nett entry point""" arguments = cli_common(__doc__, argv=argv) benet = BeNet(arguments['CAMPAIGN_FILE']) benet.run() if argv is not None: return benet
python
def main(argv=None): """ben-nett entry point""" arguments = cli_common(__doc__, argv=argv) benet = BeNet(arguments['CAMPAIGN_FILE']) benet.run() if argv is not None: return benet
[ "def", "main", "(", "argv", "=", "None", ")", ":", "arguments", "=", "cli_common", "(", "__doc__", ",", "argv", "=", "argv", ")", "benet", "=", "BeNet", "(", "arguments", "[", "'CAMPAIGN_FILE'", "]", ")", "benet", ".", "run", "(", ")", "if", "argv", ...
ben-nett entry point
[ "ben", "-", "nett", "entry", "point" ]
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/cli/bennett.py#L19-L25
BlueBrain/hpcbench
hpcbench/cli/benelastic.py
main
def main(argv=None): """ben-elastic entry point""" arguments = cli_common(__doc__, argv=argv) es_export = ESExporter(arguments['CAMPAIGN-DIR'], arguments['--es']) es_export.export() if argv is not None: return es_export
python
def main(argv=None): """ben-elastic entry point""" arguments = cli_common(__doc__, argv=argv) es_export = ESExporter(arguments['CAMPAIGN-DIR'], arguments['--es']) es_export.export() if argv is not None: return es_export
[ "def", "main", "(", "argv", "=", "None", ")", ":", "arguments", "=", "cli_common", "(", "__doc__", ",", "argv", "=", "argv", ")", "es_export", "=", "ESExporter", "(", "arguments", "[", "'CAMPAIGN-DIR'", "]", ",", "arguments", "[", "'--es'", "]", ")", "...
ben-elastic entry point
[ "ben", "-", "elastic", "entry", "point" ]
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/cli/benelastic.py#L20-L26
KelSolaar/Manager
manager/QObject_component.py
QObjectComponent.name
def name(self, value): """ Setter for **self.__name** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format("name", value) self._...
python
def name(self, value): """ Setter for **self.__name** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format("name", value) self._...
[ "def", "name", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "assert", "type", "(", "value", ")", "is", "unicode", ",", "\"'{0}' attribute: '{1}' type is not 'unicode'!\"", ".", "format", "(", "\"name\"", ",", "value", ")", ...
Setter for **self.__name** attribute. :param value: Attribute value. :type value: unicode
[ "Setter", "for", "**", "self", ".", "__name", "**", "attribute", "." ]
train
https://github.com/KelSolaar/Manager/blob/39c8153fc021fc8a76e345a6e336ec2644f089d1/manager/QObject_component.py#L101-L111
KelSolaar/Manager
manager/QObject_component.py
QObjectComponent.activated
def activated(self, value): """ Setter for **self.__activated** attribute. :param value: Attribute value. :type value: bool """ if value is not None: assert type(value) is bool, "'{0}' attribute: '{1}' type is not 'bool'!".format("activated", value) ...
python
def activated(self, value): """ Setter for **self.__activated** attribute. :param value: Attribute value. :type value: bool """ if value is not None: assert type(value) is bool, "'{0}' attribute: '{1}' type is not 'bool'!".format("activated", value) ...
[ "def", "activated", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "assert", "type", "(", "value", ")", "is", "bool", ",", "\"'{0}' attribute: '{1}' type is not 'bool'!\"", ".", "format", "(", "\"activated\"", ",", "value", ")"...
Setter for **self.__activated** attribute. :param value: Attribute value. :type value: bool
[ "Setter", "for", "**", "self", ".", "__activated", "**", "attribute", "." ]
train
https://github.com/KelSolaar/Manager/blob/39c8153fc021fc8a76e345a6e336ec2644f089d1/manager/QObject_component.py#L136-L147