body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
daa306c75117618cb2dd7c65be9cdc96c86037754d52187f8596c4b31eceac96 | def is_same_class(obj, a_class):
'\n check if instance is same\n '
return issubclass(a_class, type(obj)) | check if instance is same | 0x0A-python-inheritance/2-is_same_class.py | is_same_class | flourishcodes/holbertonschool-higher_level_programming | 0 | python | def is_same_class(obj, a_class):
'\n \n '
return issubclass(a_class, type(obj)) | def is_same_class(obj, a_class):
'\n \n '
return issubclass(a_class, type(obj))<|docstring|>check if instance is same<|endoftext|> |
4d8cfb10d82c2f62b4633aa0ac6abde40a64982ec6a232ac6c65db5afa25b68a | def qqplot(data, labels, n_quantiles=100, alpha=0.95, error_type='theoretical', distribution='binomial', log10conv=True, color=['k', 'r', 'b'], fill_dens=[0.1, 0.1, 0.1], type='uniform', title='title'):
"\n Function for plotting Quantile Quantile (QQ) plots with confidence interval (CI)\n :param data: NumPy 1... | Function for plotting Quantile Quantile (QQ) plots with confidence interval (CI)
:param data: NumPy 1D array with data
:param labels:
:param type: type of the plot
:param n_quantiles: number of quntiles to plot
:param alpha: confidence interval
:param distribution: beta/normal/binomial -- type of the error estimation. ... | scripts/graphs.py | qqplot | Andisani96/gwas | 1 | python | def qqplot(data, labels, n_quantiles=100, alpha=0.95, error_type='theoretical', distribution='binomial', log10conv=True, color=['k', 'r', 'b'], fill_dens=[0.1, 0.1, 0.1], type='uniform', title='title'):
"\n Function for plotting Quantile Quantile (QQ) plots with confidence interval (CI)\n :param data: NumPy 1... | def qqplot(data, labels, n_quantiles=100, alpha=0.95, error_type='theoretical', distribution='binomial', log10conv=True, color=['k', 'r', 'b'], fill_dens=[0.1, 0.1, 0.1], type='uniform', title='title'):
"\n Function for plotting Quantile Quantile (QQ) plots with confidence interval (CI)\n :param data: NumPy 1... |
16c1300bcf1bbdffb623f7dca158d5bd1e78f8e1b2003bef52198763f1f24372 | def sorted_nicely(l):
' Sort the given iterable in the way that humans expect.'
convert = (lambda text: (int(text) if text.isdigit() else text))
alphanum_key = (lambda key: [convert(c) for c in re.split('([0-9]+)', key)])
return sorted(l, key=alphanum_key) | Sort the given iterable in the way that humans expect. | scripts/graphs.py | sorted_nicely | Andisani96/gwas | 1 | python | def sorted_nicely(l):
' '
convert = (lambda text: (int(text) if text.isdigit() else text))
alphanum_key = (lambda key: [convert(c) for c in re.split('([0-9]+)', key)])
return sorted(l, key=alphanum_key) | def sorted_nicely(l):
' '
convert = (lambda text: (int(text) if text.isdigit() else text))
alphanum_key = (lambda key: [convert(c) for c in re.split('([0-9]+)', key)])
return sorted(l, key=alphanum_key)<|docstring|>Sort the given iterable in the way that humans expect.<|endoftext|> |
9b71ab561f0212d7b2b96ad265a1f7182d9ebc6e84b5f05bf2ad653509af20c8 | def manhattan(p1, pos1, chr1, label1, p2=None, pos2=None, chr2=None, label2=None, plot_type='single', chrs_plot=None, chrs_names=None, cut=2, colors=['k', '0.5'], title='Title', xlabel='chromosome', ylabel='-log10(p-value)', top1=0, top2=0, lines=[10, 15], lines_colors=['g', 'r'], zoom=None, scaling='-log10'):
"\n ... | Static Manhattan plot
:param p1: p-values for the top panel
:param pos1: positions
:param chr1: chromosomes numbers
:param label1: label
:param p2: p-values for the bottom panel
:param pos2: positions
:param chr2: chromosomes numbers
:param label2: label
:param type: Can be 'single', 'double' or 'inverted'
:param chrs_... | scripts/graphs.py | manhattan | Andisani96/gwas | 1 | python | def manhattan(p1, pos1, chr1, label1, p2=None, pos2=None, chr2=None, label2=None, plot_type='single', chrs_plot=None, chrs_names=None, cut=2, colors=['k', '0.5'], title='Title', xlabel='chromosome', ylabel='-log10(p-value)', top1=0, top2=0, lines=[10, 15], lines_colors=['g', 'r'], zoom=None, scaling='-log10'):
"\n ... | def manhattan(p1, pos1, chr1, label1, p2=None, pos2=None, chr2=None, label2=None, plot_type='single', chrs_plot=None, chrs_names=None, cut=2, colors=['k', '0.5'], title='Title', xlabel='chromosome', ylabel='-log10(p-value)', top1=0, top2=0, lines=[10, 15], lines_colors=['g', 'r'], zoom=None, scaling='-log10'):
"\n ... |
8f46499eea90651ab79cbf3704d7e06852a17e7496168fad2c8de9e4feeb8ee7 | def text_file_record_generator_creator(filename: str, compression: str=None) -> RecordGeneratorType:
'\n A helper function that returns a generator that we can use to iterate through lines in the input file\n Args:\n filename: The input filename\n compression: The compression type of the input f... | A helper function that returns a generator that we can use to iterate through lines in the input file
Args:
filename: The input filename
compression: The compression type of the input file or None if its not compressed | pyqstrat/marketdata_processor.py | text_file_record_generator_creator | vishalbelsare/pyqstrat | 284 | python | def text_file_record_generator_creator(filename: str, compression: str=None) -> RecordGeneratorType:
'\n A helper function that returns a generator that we can use to iterate through lines in the input file\n Args:\n filename: The input filename\n compression: The compression type of the input f... | def text_file_record_generator_creator(filename: str, compression: str=None) -> RecordGeneratorType:
'\n A helper function that returns a generator that we can use to iterate through lines in the input file\n Args:\n filename: The input filename\n compression: The compression type of the input f... |
7375f0a121861b182d0db7e2097e5edf700d9f7c5ed35bd71239320b34dce895 | def base_date_filename_mapper(input_file_path: str) -> int:
'\n A helper function that parses out the date from a filename. For example, given a file such as "/tmp/spx_2018-08-09", this parses out the \n date part of the filename and returns milliseconds (no fractions) since the epoch to that date.\n \n ... | A helper function that parses out the date from a filename. For example, given a file such as "/tmp/spx_2018-08-09", this parses out the
date part of the filename and returns milliseconds (no fractions) since the epoch to that date.
Args:
input_filepath (str): Full path to the input file
Returns:
int: Millis... | pyqstrat/marketdata_processor.py | base_date_filename_mapper | vishalbelsare/pyqstrat | 284 | python | def base_date_filename_mapper(input_file_path: str) -> int:
'\n A helper function that parses out the date from a filename. For example, given a file such as "/tmp/spx_2018-08-09", this parses out the \n date part of the filename and returns milliseconds (no fractions) since the epoch to that date.\n \n ... | def base_date_filename_mapper(input_file_path: str) -> int:
'\n A helper function that parses out the date from a filename. For example, given a file such as "/tmp/spx_2018-08-09", this parses out the \n date part of the filename and returns milliseconds (no fractions) since the epoch to that date.\n \n ... |
a06cc5678b8fb19215ce5ae8d3e9f3c6f8fe7dbb0efb4a04d3919f12609a0265 | def get_field_indices(field_names: Sequence[str], headers: Sequence[str]) -> Sequence[int]:
'\n Helper function to get indices of field names in a list of headers\n \n Args:\n field_names (list of str): The fields we want indices of\n headers (list of str): All headers\n \n Returns:... | Helper function to get indices of field names in a list of headers
Args:
field_names (list of str): The fields we want indices of
headers (list of str): All headers
Returns:
list of int: indices of each field name in the headers list | pyqstrat/marketdata_processor.py | get_field_indices | vishalbelsare/pyqstrat | 284 | python | def get_field_indices(field_names: Sequence[str], headers: Sequence[str]) -> Sequence[int]:
'\n Helper function to get indices of field names in a list of headers\n \n Args:\n field_names (list of str): The fields we want indices of\n headers (list of str): All headers\n \n Returns:... | def get_field_indices(field_names: Sequence[str], headers: Sequence[str]) -> Sequence[int]:
'\n Helper function to get indices of field names in a list of headers\n \n Args:\n field_names (list of str): The fields we want indices of\n headers (list of str): All headers\n \n Returns:... |
ea51d5260fc31bdcae7c4cbd7e36324e5fa49064f6d11c7037fc98eb55d2cbfc | def process_marketdata_file(input_filename: str, compression: str, output_file_prefix_mapper: OutputFilePrefixMapperType, record_parser_creator: RecordParserCreatorType, aggregator_creator: AggregatorCreatorType, line_filter: LineFilterType=None, base_date_mapper: BaseDateMapperType=None, file_processor_creator: FilePr... | Processes a single market data file
Args:
input_filename: File name (including path) to process
compression: Compression type for the input file. If not set, we try to infer the compression type from the filename.
output_file_prefix_mapper: A function that takes an input filename and returns the correspon... | pyqstrat/marketdata_processor.py | process_marketdata_file | vishalbelsare/pyqstrat | 284 | python | def process_marketdata_file(input_filename: str, compression: str, output_file_prefix_mapper: OutputFilePrefixMapperType, record_parser_creator: RecordParserCreatorType, aggregator_creator: AggregatorCreatorType, line_filter: LineFilterType=None, base_date_mapper: BaseDateMapperType=None, file_processor_creator: FilePr... | def process_marketdata_file(input_filename: str, compression: str, output_file_prefix_mapper: OutputFilePrefixMapperType, record_parser_creator: RecordParserCreatorType, aggregator_creator: AggregatorCreatorType, line_filter: LineFilterType=None, base_date_mapper: BaseDateMapperType=None, file_processor_creator: FilePr... |
b64fd45420b69d29c44b8efbf27b39ea0b134c13d4a9cec861267b21e05efc17 | def process_marketdata(input_filename_provider: InputFileNameProviderType, file_processor: FileProcessorType, num_processes: int=None, raise_on_error: bool=True) -> None:
'\n Top level function to process a set of market data files\n \n Args:\n input_filename_provider: A function that returns a list... | Top level function to process a set of market data files
Args:
input_filename_provider: A function that returns a list of filenames (incl path) we need to process.
file_processor: A function that takes an input filename and processes it, returning number of lines processed.
num_processes (int, optional): ... | pyqstrat/marketdata_processor.py | process_marketdata | vishalbelsare/pyqstrat | 284 | python | def process_marketdata(input_filename_provider: InputFileNameProviderType, file_processor: FileProcessorType, num_processes: int=None, raise_on_error: bool=True) -> None:
'\n Top level function to process a set of market data files\n \n Args:\n input_filename_provider: A function that returns a list... | def process_marketdata(input_filename_provider: InputFileNameProviderType, file_processor: FileProcessorType, num_processes: int=None, raise_on_error: bool=True) -> None:
'\n Top level function to process a set of market data files\n \n Args:\n input_filename_provider: A function that returns a list... |
b4ddf7473e98026eecd40ad6a0a44257f9e688bdeb9d68a063b874875bec267a | def __init__(self, path: str, include_pattern: str=None, exclude_pattern: str=None) -> None:
'\n Args:\n path: A pattern such as "/tmp/abc*.gz"\n include_pattern: Given a pattern such as "xzy", will return only filenames that contain xyz\n exclude_pattern: Given a pattern suc... | Args:
path: A pattern such as "/tmp/abc*.gz"
include_pattern: Given a pattern such as "xzy", will return only filenames that contain xyz
exclude_pattern: Given a pattern such as "_tmp", will exclude all filenames containing _tmp | pyqstrat/marketdata_processor.py | __init__ | vishalbelsare/pyqstrat | 284 | python | def __init__(self, path: str, include_pattern: str=None, exclude_pattern: str=None) -> None:
'\n Args:\n path: A pattern such as "/tmp/abc*.gz"\n include_pattern: Given a pattern such as "xzy", will return only filenames that contain xyz\n exclude_pattern: Given a pattern suc... | def __init__(self, path: str, include_pattern: str=None, exclude_pattern: str=None) -> None:
'\n Args:\n path: A pattern such as "/tmp/abc*.gz"\n include_pattern: Given a pattern such as "xzy", will return only filenames that contain xyz\n exclude_pattern: Given a pattern suc... |
0abfae018b19e7b8ef56185c585059357decc3a0c1798891427dcbe5266d75cd | def __call__(self) -> Sequence[Tuple[(str, str)]]:
'\n Returns:\n All matching filenames\n '
files = glob.glob(self.path)
if (not len(files)):
raise Exception(f'no matching files found with pattern: {self.path}')
if self.include_pattern:
files = [file for file in... | Returns:
All matching filenames | pyqstrat/marketdata_processor.py | __call__ | vishalbelsare/pyqstrat | 284 | python | def __call__(self) -> Sequence[Tuple[(str, str)]]:
'\n Returns:\n All matching filenames\n '
files = glob.glob(self.path)
if (not len(files)):
raise Exception(f'no matching files found with pattern: {self.path}')
if self.include_pattern:
files = [file for file in... | def __call__(self) -> Sequence[Tuple[(str, str)]]:
'\n Returns:\n All matching filenames\n '
files = glob.glob(self.path)
if (not len(files)):
raise Exception(f'no matching files found with pattern: {self.path}')
if self.include_pattern:
files = [file for file in... |
9a3a7e5d22667ea0aa38256920efdb44ebe273ae342c4694c47895f225dd97ac | def __init__(self, output_dir: str) -> None:
'\n Args:\n output_dir: The directory where we want to write output files\n '
if (not os.path.isdir(output_dir)):
raise Exception(f'{output_dir} does not exist')
self.output_dir = output_dir | Args:
output_dir: The directory where we want to write output files | pyqstrat/marketdata_processor.py | __init__ | vishalbelsare/pyqstrat | 284 | python | def __init__(self, output_dir: str) -> None:
'\n Args:\n output_dir: The directory where we want to write output files\n '
if (not os.path.isdir(output_dir)):
raise Exception(f'{output_dir} does not exist')
self.output_dir = output_dir | def __init__(self, output_dir: str) -> None:
'\n Args:\n output_dir: The directory where we want to write output files\n '
if (not os.path.isdir(output_dir)):
raise Exception(f'{output_dir} does not exist')
self.output_dir = output_dir<|docstring|>Args:
output_dir: The d... |
011727895d49191bf7da44fa95f5bafcecdf2347237b80c184f832eb8775be68 | def __call__(self, input_filepath: str) -> str:
'\n Args:\n input_filepath: The input file that we are creating an output file for, e.g. "/home/xzy.gz"\n Returns:\n Output file path for that input. We take the filename from the input filepath, strip out any extension \n ... | Args:
input_filepath: The input file that we are creating an output file for, e.g. "/home/xzy.gz"
Returns:
Output file path for that input. We take the filename from the input filepath, strip out any extension
and prepend the output directory name | pyqstrat/marketdata_processor.py | __call__ | vishalbelsare/pyqstrat | 284 | python | def __call__(self, input_filepath: str) -> str:
'\n Args:\n input_filepath: The input file that we are creating an output file for, e.g. "/home/xzy.gz"\n Returns:\n Output file path for that input. We take the filename from the input filepath, strip out any extension \n ... | def __call__(self, input_filepath: str) -> str:
'\n Args:\n input_filepath: The input file that we are creating an output file for, e.g. "/home/xzy.gz"\n Returns:\n Output file path for that input. We take the filename from the input filepath, strip out any extension \n ... |
e3417e0e0fd0dc3b4a46ecbee41235db7eaadc289c294dacdd6b6ab9375838f2 | def __init__(self, record_generator_creator: RecordGeneratorCreatorType, skip_rows: int=0, separator: str=',', make_lowercase: bool=True) -> None:
'\n Args:\n \n record_generator: A function that takes a filename and its compression type and returns an object\n that we can us... | Args:
record_generator: A function that takes a filename and its compression type and returns an object
that we can use to iterate through lines in that file
skip_rows: Number of rows to skip before starting to read the file. Default is 0
separator: Separator for headers. Defaults to ,
make_l... | pyqstrat/marketdata_processor.py | __init__ | vishalbelsare/pyqstrat | 284 | python | def __init__(self, record_generator_creator: RecordGeneratorCreatorType, skip_rows: int=0, separator: str=',', make_lowercase: bool=True) -> None:
'\n Args:\n \n record_generator: A function that takes a filename and its compression type and returns an object\n that we can us... | def __init__(self, record_generator_creator: RecordGeneratorCreatorType, skip_rows: int=0, separator: str=',', make_lowercase: bool=True) -> None:
'\n Args:\n \n record_generator: A function that takes a filename and its compression type and returns an object\n that we can us... |
caac53843bde6251f002cd3fffb09033c54564a42686ce94624c33d47ed1c178 | def __call__(self, input_filename: str, compression: str) -> Sequence[str]:
'\n Args:\n \n input_filename The file to read\n compression: Compression type, e.g. "gzip", or None if the file is not compressed\n \n Returns:\n Column headers\n '
decode_nee... | Args:
input_filename The file to read
compression: Compression type, e.g. "gzip", or None if the file is not compressed
Returns:
Column headers | pyqstrat/marketdata_processor.py | __call__ | vishalbelsare/pyqstrat | 284 | python | def __call__(self, input_filename: str, compression: str) -> Sequence[str]:
'\n Args:\n \n input_filename The file to read\n compression: Compression type, e.g. "gzip", or None if the file is not compressed\n \n Returns:\n Column headers\n '
decode_nee... | def __call__(self, input_filename: str, compression: str) -> Sequence[str]:
'\n Args:\n \n input_filename The file to read\n compression: Compression type, e.g. "gzip", or None if the file is not compressed\n \n Returns:\n Column headers\n '
decode_nee... |
dfb4a1960a6783e468052f2867d58fdec745370ab9130404cf3b1620ad540037 | def get_logger(name=None):
"\n Equivalent to new_logger(), but doesn't reset its log level.\n "
logger = logging.getLogger(prefixed(name=name))
return logger | Equivalent to new_logger(), but doesn't reset its log level. | mediaman/core/logtools.py | get_logger | MattCCS/MediaMan | 1 | python | def get_logger(name=None):
"\n \n "
logger = logging.getLogger(prefixed(name=name))
return logger | def get_logger(name=None):
"\n \n "
logger = logging.getLogger(prefixed(name=name))
return logger<|docstring|>Equivalent to new_logger(), but doesn't reset its log level.<|endoftext|> |
b6d0ee1a7a3886d8bbf48cecb9f31508fd4833be4e58f2747cd94a04614463c6 | def new_logger(name):
"\n Returns the requested logger, with the log level set to 'NOTSET'.\n "
logger = get_logger(name=name)
logger.setLevel(logging.NOTSET)
return logger | Returns the requested logger, with the log level set to 'NOTSET'. | mediaman/core/logtools.py | new_logger | MattCCS/MediaMan | 1 | python | def new_logger(name):
"\n \n "
logger = get_logger(name=name)
logger.setLevel(logging.NOTSET)
return logger | def new_logger(name):
"\n \n "
logger = get_logger(name=name)
logger.setLevel(logging.NOTSET)
return logger<|docstring|>Returns the requested logger, with the log level set to 'NOTSET'.<|endoftext|> |
5b966a421247d1eef274d2d092589a6eff38b8006db01f16730449e8582eeb88 | def set_level(level_or_name, logger=None):
'\n Sets the level of the given logger to the given level (e.g. 10)\n or the level defined by the given name (e.g., "DEBUG").\n\n If no logger is provided, the root logger\'s level is set.\n\n For reference, check mediaman.settings.LOG_LEVELS,\n or https://d... | Sets the level of the given logger to the given level (e.g. 10)
or the level defined by the given name (e.g., "DEBUG").
If no logger is provided, the root logger's level is set.
For reference, check mediaman.settings.LOG_LEVELS,
or https://docs.python.org/3/library/logging.html#levels. | mediaman/core/logtools.py | set_level | MattCCS/MediaMan | 1 | python | def set_level(level_or_name, logger=None):
'\n Sets the level of the given logger to the given level (e.g. 10)\n or the level defined by the given name (e.g., "DEBUG").\n\n If no logger is provided, the root logger\'s level is set.\n\n For reference, check mediaman.settings.LOG_LEVELS,\n or https://d... | def set_level(level_or_name, logger=None):
'\n Sets the level of the given logger to the given level (e.g. 10)\n or the level defined by the given name (e.g., "DEBUG").\n\n If no logger is provided, the root logger\'s level is set.\n\n For reference, check mediaman.settings.LOG_LEVELS,\n or https://d... |
a59c20d8707dbd9aac1b3e4c0cd58e7df1c27c486145600dec69f6a13bc03efb | def add_log_parser(parser, logger=None):
"\n Adds an optional flag to the given parser to set the\n given logger's initial log level based on user input.\n\n If no logger is provided, the root logger's level is set.\n "
def set_level_on_parse(level):
if (level in settings.LOG_LEVELS):
... | Adds an optional flag to the given parser to set the
given logger's initial log level based on user input.
If no logger is provided, the root logger's level is set. | mediaman/core/logtools.py | add_log_parser | MattCCS/MediaMan | 1 | python | def add_log_parser(parser, logger=None):
"\n Adds an optional flag to the given parser to set the\n given logger's initial log level based on user input.\n\n If no logger is provided, the root logger's level is set.\n "
def set_level_on_parse(level):
if (level in settings.LOG_LEVELS):
... | def add_log_parser(parser, logger=None):
"\n Adds an optional flag to the given parser to set the\n given logger's initial log level based on user input.\n\n If no logger is provided, the root logger's level is set.\n "
def set_level_on_parse(level):
if (level in settings.LOG_LEVELS):
... |
01eeb1845de58d12f6ceeed900a951a68a34d25b48d7dd7e041a412051b1881b | def test_tran_reweight(self):
'Test the functionality of tran_reweight()\n\n '
md_new = (self.md >> gr.cp_marginals(x=dict(dist='norm', loc=0, scale=sqrt((4 / 5)))))
df_base = (self.md >> gr.ev_monte_carlo(n=500, df_det='nom', seed=101))
df = ((df_base >> gr.tf_reweight(md_base=self.md, md_new=md... | Test the functionality of tran_reweight() | tests/test_is.py | test_tran_reweight | OscarDeGar/py_grama | 13 | python | def test_tran_reweight(self):
'\n\n '
md_new = (self.md >> gr.cp_marginals(x=dict(dist='norm', loc=0, scale=sqrt((4 / 5)))))
df_base = (self.md >> gr.ev_monte_carlo(n=500, df_det='nom', seed=101))
df = ((df_base >> gr.tf_reweight(md_base=self.md, md_new=md_new)) >> gr.tf_summarize(mu=gr.mean((DF.... | def test_tran_reweight(self):
'\n\n '
md_new = (self.md >> gr.cp_marginals(x=dict(dist='norm', loc=0, scale=sqrt((4 / 5)))))
df_base = (self.md >> gr.ev_monte_carlo(n=500, df_det='nom', seed=101))
df = ((df_base >> gr.tf_reweight(md_base=self.md, md_new=md_new)) >> gr.tf_summarize(mu=gr.mean((DF.... |
9fb884c7228773aba09b92b930750f5886ecb2acb2069be2ada7dd284e30872f | def getEditorRootCanvas(self):
' returns the canvas element which acts as the root parent for all\n elements in the editors edit area '
return self.editorFrame.getEditorRootCanvas() | returns the canvas element which acts as the root parent for all
elements in the editors edit area | DirectGuiDesigner/GUI/MainView.py | getEditorRootCanvas | fireclawthefox/DirectGuiEditor | 0 | python | def getEditorRootCanvas(self):
' returns the canvas element which acts as the root parent for all\n elements in the editors edit area '
return self.editorFrame.getEditorRootCanvas() | def getEditorRootCanvas(self):
' returns the canvas element which acts as the root parent for all\n elements in the editors edit area '
return self.editorFrame.getEditorRootCanvas()<|docstring|>returns the canvas element which acts as the root parent for all
elements in the editors edit area<|endoftext|> |
4e068cf1a41d6d7a04f5fbdd804d545ffd134829cd9ba7a6e03df27009b66ca9 | def getEditorPlacer(self, placerName):
'Returns the nodepath to a specific placer in the editor. Those\n usually are located at the edges and corners of the editor and resemble\n the a2d* counterparts from the engine'
return self.editorFrame.getEditorPlacer(placerName) | Returns the nodepath to a specific placer in the editor. Those
usually are located at the edges and corners of the editor and resemble
the a2d* counterparts from the engine | DirectGuiDesigner/GUI/MainView.py | getEditorPlacer | fireclawthefox/DirectGuiEditor | 0 | python | def getEditorPlacer(self, placerName):
'Returns the nodepath to a specific placer in the editor. Those\n usually are located at the edges and corners of the editor and resemble\n the a2d* counterparts from the engine'
return self.editorFrame.getEditorPlacer(placerName) | def getEditorPlacer(self, placerName):
'Returns the nodepath to a specific placer in the editor. Those\n usually are located at the edges and corners of the editor and resemble\n the a2d* counterparts from the engine'
return self.editorFrame.getEditorPlacer(placerName)<|docstring|>Returns the node... |
1701af89740d844b335026b90bc5ddf0c017279ff53e2177b940b12d6f9fe9dd | def multiGF8(input1, input2, modP8):
'\n multiGF8 - multiply 2 number on a Galois Field defined by a polynomial.\n Args:\n input1: first number to multiply.\n input2: second number to multiply.\n modP8: polynomial defining the Galos Field.\n Returns:\n the multiplication result.... | multiGF8 - multiply 2 number on a Galois Field defined by a polynomial.
Args:
input1: first number to multiply.
input2: second number to multiply.
modP8: polynomial defining the Galos Field.
Returns:
the multiplication result. | flexaeadv1/python/genSBoxesFlexAE.py | multiGF8 | edunasci/FlexAEAD | 1 | python | def multiGF8(input1, input2, modP8):
'\n multiGF8 - multiply 2 number on a Galois Field defined by a polynomial.\n Args:\n input1: first number to multiply.\n input2: second number to multiply.\n modP8: polynomial defining the Galos Field.\n Returns:\n the multiplication result.... | def multiGF8(input1, input2, modP8):
'\n multiGF8 - multiply 2 number on a Galois Field defined by a polynomial.\n Args:\n input1: first number to multiply.\n input2: second number to multiply.\n modP8: polynomial defining the Galos Field.\n Returns:\n the multiplication result.... |
8b4dd3971fc092ef83150ab8f02e4bc8190c43444ce582eae179d2392a0fd8a7 | def invMultiGF8(input1, modP8):
'\n invMultiGF8 - calculate the inverse multiplicative of a number\n on a Galois Field defined by a polynomial.\n Args:\n input1: number to find the inverse multiplicative.\n modP8: polynomial defining the Galos Field.\n Returns:\n the... | invMultiGF8 - calculate the inverse multiplicative of a number
on a Galois Field defined by a polynomial.
Args:
input1: number to find the inverse multiplicative.
modP8: polynomial defining the Galos Field.
Returns:
the inverse multiplicative. | flexaeadv1/python/genSBoxesFlexAE.py | invMultiGF8 | edunasci/FlexAEAD | 1 | python | def invMultiGF8(input1, modP8):
'\n invMultiGF8 - calculate the inverse multiplicative of a number\n on a Galois Field defined by a polynomial.\n Args:\n input1: number to find the inverse multiplicative.\n modP8: polynomial defining the Galos Field.\n Returns:\n the... | def invMultiGF8(input1, modP8):
'\n invMultiGF8 - calculate the inverse multiplicative of a number\n on a Galois Field defined by a polynomial.\n Args:\n input1: number to find the inverse multiplicative.\n modP8: polynomial defining the Galos Field.\n Returns:\n the... |
1da6c77aed20498e0cd88813fa450ea08daca225c4c6bd51eb8ac8d5edf2e236 | def affTransf(input1, addConst, multConst):
'\n affTransf - performs an affine transformation using an additive and\n an multiplicative constants.\n Args:\n input1: number to transform.\n addConst: the additive constant to be used.\n multConst: the multiplicative consta... | affTransf - performs an affine transformation using an additive and
an multiplicative constants.
Args:
input1: number to transform.
addConst: the additive constant to be used.
multConst: the multiplicative constant to be used.
Returns:
the transformed number. | flexaeadv1/python/genSBoxesFlexAE.py | affTransf | edunasci/FlexAEAD | 1 | python | def affTransf(input1, addConst, multConst):
'\n affTransf - performs an affine transformation using an additive and\n an multiplicative constants.\n Args:\n input1: number to transform.\n addConst: the additive constant to be used.\n multConst: the multiplicative consta... | def affTransf(input1, addConst, multConst):
'\n affTransf - performs an affine transformation using an additive and\n an multiplicative constants.\n Args:\n input1: number to transform.\n addConst: the additive constant to be used.\n multConst: the multiplicative consta... |
12a785003964cc9b198b676b95c2b66485840e248ce13b79b7337188d2a37cd0 | def genSBox(IP, MC, AC):
'\n genSBox - generates a SBox using the same method as proposed on AES\n definition but can use other parameters.\n Args:\n IP: Irreducible Polynomial to define the Galois Field.\n MC: Multiplicative Constant to be used on the affine transformation.\n ... | genSBox - generates a SBox using the same method as proposed on AES
definition but can use other parameters.
Args:
IP: Irreducible Polynomial to define the Galois Field.
MC: Multiplicative Constant to be used on the affine transformation.
AC: Additive Constant to be used on the affine transforma... | flexaeadv1/python/genSBoxesFlexAE.py | genSBox | edunasci/FlexAEAD | 1 | python | def genSBox(IP, MC, AC):
'\n genSBox - generates a SBox using the same method as proposed on AES\n definition but can use other parameters.\n Args:\n IP: Irreducible Polynomial to define the Galois Field.\n MC: Multiplicative Constant to be used on the affine transformation.\n ... | def genSBox(IP, MC, AC):
'\n genSBox - generates a SBox using the same method as proposed on AES\n definition but can use other parameters.\n Args:\n IP: Irreducible Polynomial to define the Galois Field.\n MC: Multiplicative Constant to be used on the affine transformation.\n ... |
6eb7dc25ce86f7f79dcb80660903aad581f59e181ebecf06c86ccaa33b0fe983 | def parityOf(n):
'\n parityOf - determine if the number of bits is odd or even\n Args:\n n: the number to be tested.\n Returns:\n o - if the number has even bits.\n 1 - if the number has odd bits.\n '
parity = 0
while n:
parity ^= (n & 1)
n >>= 1
return ... | parityOf - determine if the number of bits is odd or even
Args:
n: the number to be tested.
Returns:
o - if the number has even bits.
1 - if the number has odd bits. | flexaeadv1/python/genSBoxesFlexAE.py | parityOf | edunasci/FlexAEAD | 1 | python | def parityOf(n):
'\n parityOf - determine if the number of bits is odd or even\n Args:\n n: the number to be tested.\n Returns:\n o - if the number has even bits.\n 1 - if the number has odd bits.\n '
parity = 0
while n:
parity ^= (n & 1)
n >>= 1
return ... | def parityOf(n):
'\n parityOf - determine if the number of bits is odd or even\n Args:\n n: the number to be tested.\n Returns:\n o - if the number has even bits.\n 1 - if the number has odd bits.\n '
parity = 0
while n:
parity ^= (n & 1)
n >>= 1
return ... |
41f03d000877f15b6e53757e1c0e3e09721a9a0e345f041d29c07ac36bac01be | def genInvSBox(SBox):
'\n genInvSBox - generates inverse of an SBox.\n Args:\n SBox: The SBox to generate the inverse.\n Returns:\n The inverse SBox.\n '
InvSBox = ([0] * 256)
for i in range(256):
InvSBox[SBox[i]] = i
return InvSBox | genInvSBox - generates inverse of an SBox.
Args:
SBox: The SBox to generate the inverse.
Returns:
The inverse SBox. | flexaeadv1/python/genSBoxesFlexAE.py | genInvSBox | edunasci/FlexAEAD | 1 | python | def genInvSBox(SBox):
'\n genInvSBox - generates inverse of an SBox.\n Args:\n SBox: The SBox to generate the inverse.\n Returns:\n The inverse SBox.\n '
InvSBox = ([0] * 256)
for i in range(256):
InvSBox[SBox[i]] = i
return InvSBox | def genInvSBox(SBox):
'\n genInvSBox - generates inverse of an SBox.\n Args:\n SBox: The SBox to generate the inverse.\n Returns:\n The inverse SBox.\n '
InvSBox = ([0] * 256)
for i in range(256):
InvSBox[SBox[i]] = i
return InvSBox<|docstring|>genInvSBox - generates in... |
1d91eb2f15488fc1877fecb037132beed8802aa35a74e630c9b50cda69305891 | def tweakSBox(SBox):
'\n tweakSBox - tweak the SBox to make stronger for FlexAE cipher.\n Args:\n SBox: the SBoxto be Tweaked.\n Returns:\n a tweaked SBox.\n '
TweakSBox = ([0] * 256)
for i in range(256):
left = ((SBox[i] & 240) >> 4)
right = (SBox[i] & 15)
... | tweakSBox - tweak the SBox to make stronger for FlexAE cipher.
Args:
SBox: the SBoxto be Tweaked.
Returns:
a tweaked SBox. | flexaeadv1/python/genSBoxesFlexAE.py | tweakSBox | edunasci/FlexAEAD | 1 | python | def tweakSBox(SBox):
'\n tweakSBox - tweak the SBox to make stronger for FlexAE cipher.\n Args:\n SBox: the SBoxto be Tweaked.\n Returns:\n a tweaked SBox.\n '
TweakSBox = ([0] * 256)
for i in range(256):
left = ((SBox[i] & 240) >> 4)
right = (SBox[i] & 15)
... | def tweakSBox(SBox):
'\n tweakSBox - tweak the SBox to make stronger for FlexAE cipher.\n Args:\n SBox: the SBoxto be Tweaked.\n Returns:\n a tweaked SBox.\n '
TweakSBox = ([0] * 256)
for i in range(256):
left = ((SBox[i] & 240) >> 4)
right = (SBox[i] & 15)
... |
1097cf6cff1283fa262e8ceb6979428925a03bfd160dfce81cdbb32623461b3d | def printSBox(name, SBox):
'\n printSBox - print the SBox on screen.\n Args:\n name: the SBox name.\n SBox: the SBox to be printed.\n Returns:\n nothing.\n '
print(' """')
print(' {}: '.format(name))
print(' - 0 1 2 3 4 5 6 7 8 9 A B C D E F')
... | printSBox - print the SBox on screen.
Args:
name: the SBox name.
SBox: the SBox to be printed.
Returns:
nothing. | flexaeadv1/python/genSBoxesFlexAE.py | printSBox | edunasci/FlexAEAD | 1 | python | def printSBox(name, SBox):
'\n printSBox - print the SBox on screen.\n Args:\n name: the SBox name.\n SBox: the SBox to be printed.\n Returns:\n nothing.\n '
print(' "')
print(' {}: '.format(name))
print(' - 0 1 2 3 4 5 6 7 8 9 A B C D E F')
... | def printSBox(name, SBox):
'\n printSBox - print the SBox on screen.\n Args:\n name: the SBox name.\n SBox: the SBox to be printed.\n Returns:\n nothing.\n '
print(' "')
print(' {}: '.format(name))
print(' - 0 1 2 3 4 5 6 7 8 9 A B C D E F')
... |
ba8865c965c19e670df15c6df0e8cc09d1e946cc9b47a1e9b3fe6efb54c64bc7 | def printFlexAESBoxClass(SBoxDict):
'\n printFlexAESBoxClass - print the FlexAESBox Class Code on screen.\n Args:\n SBox0, SBox1, SBox2: the SBoxes to be used on the class.\n Returns:\n nothing.\n '
print('class FlexAESBox:')
for (name, SBox) in SBoxDict.items():
printSBox(... | printFlexAESBoxClass - print the FlexAESBox Class Code on screen.
Args:
SBox0, SBox1, SBox2: the SBoxes to be used on the class.
Returns:
nothing. | flexaeadv1/python/genSBoxesFlexAE.py | printFlexAESBoxClass | edunasci/FlexAEAD | 1 | python | def printFlexAESBoxClass(SBoxDict):
'\n printFlexAESBoxClass - print the FlexAESBox Class Code on screen.\n Args:\n SBox0, SBox1, SBox2: the SBoxes to be used on the class.\n Returns:\n nothing.\n '
print('class FlexAESBox:')
for (name, SBox) in SBoxDict.items():
printSBox(... | def printFlexAESBoxClass(SBoxDict):
'\n printFlexAESBoxClass - print the FlexAESBox Class Code on screen.\n Args:\n SBox0, SBox1, SBox2: the SBoxes to be used on the class.\n Returns:\n nothing.\n '
print('class FlexAESBox:')
for (name, SBox) in SBoxDict.items():
printSBox(... |
0f1aa8443dd462f809af62d0522ff86d012e17c96d5e84bd6f49dcabdff4087a | def update_advanced_custom_fields(self, data: list):
"Takes a list of dictionaries in the format {'<FIELDNAME>':'<VALUE>'}.\n Advanced custom userfields may not be enabled by default"
return API.add_sub_resource(self.__class__.name(), self.Id, 'usercustomfields', data) | Takes a list of dictionaries in the format {'<FIELDNAME>':'<VALUE>'}.
Advanced custom userfields may not be enabled by default | src/litmos/user.py | update_advanced_custom_fields | NexthinkGuru/python-litmos-api | 1 | python | def update_advanced_custom_fields(self, data: list):
"Takes a list of dictionaries in the format {'<FIELDNAME>':'<VALUE>'}.\n Advanced custom userfields may not be enabled by default"
return API.add_sub_resource(self.__class__.name(), self.Id, 'usercustomfields', data) | def update_advanced_custom_fields(self, data: list):
"Takes a list of dictionaries in the format {'<FIELDNAME>':'<VALUE>'}.\n Advanced custom userfields may not be enabled by default"
return API.add_sub_resource(self.__class__.name(), self.Id, 'usercustomfields', data)<|docstring|>Takes a list of diction... |
50b9278db6c93eb5876805029bdda578f5317ebe246b7074d07a4fbe5e1f4bdb | def glInitShaderPrecisionARB():
'Return boolean indicating whether this extension is available'
from OpenGL import extensions
return extensions.hasGLExtension(_EXTENSION_NAME) | Return boolean indicating whether this extension is available | OpenGL/GL/ARB/shader_precision.py | glInitShaderPrecisionARB | keunhong/pyopengl | 210 | python | def glInitShaderPrecisionARB():
from OpenGL import extensions
return extensions.hasGLExtension(_EXTENSION_NAME) | def glInitShaderPrecisionARB():
from OpenGL import extensions
return extensions.hasGLExtension(_EXTENSION_NAME)<|docstring|>Return boolean indicating whether this extension is available<|endoftext|> |
1a4c0dd2f1d2ab355054b6415aa968b1b6980c257eda3532a23913f13f5caff9 | def get_net(args, criterion):
'\n Get Network Architecture based on arguments provided\n '
net = get_model(network=('network.' + args.arch), num_classes=cfg.DATASET.NUM_CLASSES, criterion=criterion)
num_params = sum([param.nelement() for param in net.parameters()])
logx.msg('Model params = {:2.1f}... | Get Network Architecture based on arguments provided | network/__init__.py | get_net | sijin-dm/semantic-segmentation | 1,584 | python | def get_net(args, criterion):
'\n \n '
net = get_model(network=('network.' + args.arch), num_classes=cfg.DATASET.NUM_CLASSES, criterion=criterion)
num_params = sum([param.nelement() for param in net.parameters()])
logx.msg('Model params = {:2.1f}M'.format((num_params / 1000000)))
net = net.cud... | def get_net(args, criterion):
'\n \n '
net = get_model(network=('network.' + args.arch), num_classes=cfg.DATASET.NUM_CLASSES, criterion=criterion)
num_params = sum([param.nelement() for param in net.parameters()])
logx.msg('Model params = {:2.1f}M'.format((num_params / 1000000)))
net = net.cud... |
6a528fc2b2640018235be0c74cb60e0243598e1132af3d5a8000abd2bc24210e | def is_gscnn_arch(args):
'\n Network is a GSCNN network\n '
return ('gscnn' in args.arch) | Network is a GSCNN network | network/__init__.py | is_gscnn_arch | sijin-dm/semantic-segmentation | 1,584 | python | def is_gscnn_arch(args):
'\n \n '
return ('gscnn' in args.arch) | def is_gscnn_arch(args):
'\n \n '
return ('gscnn' in args.arch)<|docstring|>Network is a GSCNN network<|endoftext|> |
fe9224a63c43de763c929f6a05ff4f1cf9852bafd576fb513bc3ab061180104f | def wrap_network_in_dataparallel(net, use_apex_data_parallel=False):
'\n Wrap the network in Dataparallel\n '
if use_apex_data_parallel:
import apex
net = apex.parallel.DistributedDataParallel(net)
else:
net = torch.nn.DataParallel(net)
return net | Wrap the network in Dataparallel | network/__init__.py | wrap_network_in_dataparallel | sijin-dm/semantic-segmentation | 1,584 | python | def wrap_network_in_dataparallel(net, use_apex_data_parallel=False):
'\n \n '
if use_apex_data_parallel:
import apex
net = apex.parallel.DistributedDataParallel(net)
else:
net = torch.nn.DataParallel(net)
return net | def wrap_network_in_dataparallel(net, use_apex_data_parallel=False):
'\n \n '
if use_apex_data_parallel:
import apex
net = apex.parallel.DistributedDataParallel(net)
else:
net = torch.nn.DataParallel(net)
return net<|docstring|>Wrap the network in Dataparallel<|endoftext|> |
4822c902c35cdc371b5cef89797cf0e4f73bb40198beaadcbd1deab0364bb45c | def get_model(network, num_classes, criterion):
'\n Fetch Network Function Pointer\n '
module = network[:network.rfind('.')]
model = network[(network.rfind('.') + 1):]
mod = importlib.import_module(module)
net_func = getattr(mod, model)
net = net_func(num_classes=num_classes, criterion=cri... | Fetch Network Function Pointer | network/__init__.py | get_model | sijin-dm/semantic-segmentation | 1,584 | python | def get_model(network, num_classes, criterion):
'\n \n '
module = network[:network.rfind('.')]
model = network[(network.rfind('.') + 1):]
mod = importlib.import_module(module)
net_func = getattr(mod, model)
net = net_func(num_classes=num_classes, criterion=criterion)
return net | def get_model(network, num_classes, criterion):
'\n \n '
module = network[:network.rfind('.')]
model = network[(network.rfind('.') + 1):]
mod = importlib.import_module(module)
net_func = getattr(mod, model)
net = net_func(num_classes=num_classes, criterion=criterion)
return net<|docstr... |
baf5ae1973f172ba90bc6500db29b3686dac81e5d9368379f784a413dc41648e | def isotime(at=None, subsecond=False):
'Stringify time in ISO 8601 format.'
if (not at):
at = timeutils.utcnow()
st = at.strftime((_ISO8601_TIME_FORMAT if (not subsecond) else _ISO8601_TIME_FORMAT_SUBSECOND))
tz = (at.tzinfo.tzname(None) if at.tzinfo else 'UTC')
st += ('Z' if (tz in ['UTC', ... | Stringify time in ISO 8601 format. | manila/utils.py | isotime | bswartz/manila | 3 | python | def isotime(at=None, subsecond=False):
if (not at):
at = timeutils.utcnow()
st = at.strftime((_ISO8601_TIME_FORMAT if (not subsecond) else _ISO8601_TIME_FORMAT_SUBSECOND))
tz = (at.tzinfo.tzname(None) if at.tzinfo else 'UTC')
st += ('Z' if (tz in ['UTC', 'UTC+00:00']) else tz)
return st | def isotime(at=None, subsecond=False):
if (not at):
at = timeutils.utcnow()
st = at.strftime((_ISO8601_TIME_FORMAT if (not subsecond) else _ISO8601_TIME_FORMAT_SUBSECOND))
tz = (at.tzinfo.tzname(None) if at.tzinfo else 'UTC')
st += ('Z' if (tz in ['UTC', 'UTC+00:00']) else tz)
return st... |
47ee789cf5969ed2edea632c15b5e178332935714060a3d4e0a60b98b3abe428 | def execute(*cmd, **kwargs):
"Convenience wrapper around oslo's execute() function."
if (('run_as_root' in kwargs) and ('root_helper' not in kwargs)):
kwargs['root_helper'] = _get_root_helper()
return processutils.execute(*cmd, **kwargs) | Convenience wrapper around oslo's execute() function. | manila/utils.py | execute | bswartz/manila | 3 | python | def execute(*cmd, **kwargs):
if (('run_as_root' in kwargs) and ('root_helper' not in kwargs)):
kwargs['root_helper'] = _get_root_helper()
return processutils.execute(*cmd, **kwargs) | def execute(*cmd, **kwargs):
if (('run_as_root' in kwargs) and ('root_helper' not in kwargs)):
kwargs['root_helper'] = _get_root_helper()
return processutils.execute(*cmd, **kwargs)<|docstring|>Convenience wrapper around oslo's execute() function.<|endoftext|> |
4f794231bba9b875c50851fecfde22cc0674fc0cab40aec63de945b9807c7726 | def trycmd(*args, **kwargs):
"Convenience wrapper around oslo's trycmd() function."
if (('run_as_root' in kwargs) and ('root_helper' not in kwargs)):
kwargs['root_helper'] = _get_root_helper()
return processutils.trycmd(*args, **kwargs) | Convenience wrapper around oslo's trycmd() function. | manila/utils.py | trycmd | bswartz/manila | 3 | python | def trycmd(*args, **kwargs):
if (('run_as_root' in kwargs) and ('root_helper' not in kwargs)):
kwargs['root_helper'] = _get_root_helper()
return processutils.trycmd(*args, **kwargs) | def trycmd(*args, **kwargs):
if (('run_as_root' in kwargs) and ('root_helper' not in kwargs)):
kwargs['root_helper'] = _get_root_helper()
return processutils.trycmd(*args, **kwargs)<|docstring|>Convenience wrapper around oslo's trycmd() function.<|endoftext|> |
3fcc3c97e5def8a751005af347db856df6c774195df57afb9cffb6d1e67a8273 | def is_eventlet_bug105():
'Check if eventlet support IPv6 addresses.\n\n See https://bitbucket.org/eventlet/eventlet/issue/105\n\n :rtype: bool\n '
try:
mod = sys.modules['eventlet.support.greendns']
except KeyError:
return False
try:
connect_data = mod.getaddrinfo('::1'... | Check if eventlet support IPv6 addresses.
See https://bitbucket.org/eventlet/eventlet/issue/105
:rtype: bool | manila/utils.py | is_eventlet_bug105 | bswartz/manila | 3 | python | def is_eventlet_bug105():
'Check if eventlet support IPv6 addresses.\n\n See https://bitbucket.org/eventlet/eventlet/issue/105\n\n :rtype: bool\n '
try:
mod = sys.modules['eventlet.support.greendns']
except KeyError:
return False
try:
connect_data = mod.getaddrinfo('::1'... | def is_eventlet_bug105():
'Check if eventlet support IPv6 addresses.\n\n See https://bitbucket.org/eventlet/eventlet/issue/105\n\n :rtype: bool\n '
try:
mod = sys.modules['eventlet.support.greendns']
except KeyError:
return False
try:
connect_data = mod.getaddrinfo('::1'... |
d5ac94b0cdb55085384de2fa06e167c72d4710ab4369cda81e5863c799a7627e | def monkey_patch():
'Patch decorator.\n\n If the Flags.monkey_patch set as True,\n this function patches a decorator\n for all functions in specified modules.\n You can set decorators for each modules\n using CONF.monkey_patch_modules.\n The format is "Module path:Decorator function".\n Example... | Patch decorator.
If the Flags.monkey_patch set as True,
this function patches a decorator
for all functions in specified modules.
You can set decorators for each modules
using CONF.monkey_patch_modules.
The format is "Module path:Decorator function".
Example: 'manila.api.ec2.cloud:' manila.openstack.common.notifi... | manila/utils.py | monkey_patch | bswartz/manila | 3 | python | def monkey_patch():
'Patch decorator.\n\n If the Flags.monkey_patch set as True,\n this function patches a decorator\n for all functions in specified modules.\n You can set decorators for each modules\n using CONF.monkey_patch_modules.\n The format is "Module path:Decorator function".\n Example... | def monkey_patch():
'Patch decorator.\n\n If the Flags.monkey_patch set as True,\n this function patches a decorator\n for all functions in specified modules.\n You can set decorators for each modules\n using CONF.monkey_patch_modules.\n The format is "Module path:Decorator function".\n Example... |
61952d046e7c2d2e093ae459f13206834a661fb2ef23b5709481d473508368fb | def file_open(*args, **kwargs):
"Open file\n\n see built-in open() documentation for more details\n\n Note: The reason this is kept in a separate module is to easily\n be able to provide a stub module that doesn't alter system\n state at all (for unit tests)\n "
return open(*args, **k... | Open file
see built-in open() documentation for more details
Note: The reason this is kept in a separate module is to easily
be able to provide a stub module that doesn't alter system
state at all (for unit tests) | manila/utils.py | file_open | bswartz/manila | 3 | python | def file_open(*args, **kwargs):
"Open file\n\n see built-in open() documentation for more details\n\n Note: The reason this is kept in a separate module is to easily\n be able to provide a stub module that doesn't alter system\n state at all (for unit tests)\n "
return open(*args, **k... | def file_open(*args, **kwargs):
"Open file\n\n see built-in open() documentation for more details\n\n Note: The reason this is kept in a separate module is to easily\n be able to provide a stub module that doesn't alter system\n state at all (for unit tests)\n "
return open(*args, **k... |
a4862151f191d85fd99bef45f02f742fbf392739b83464a8762c3b2076a82a5e | def service_is_up(service):
'Check whether a service is up based on last heartbeat.'
last_heartbeat = (service['updated_at'] or service['created_at'])
tdelta = (timeutils.utcnow() - last_heartbeat)
elapsed = tdelta.total_seconds()
return (abs(elapsed) <= CONF.service_down_time) | Check whether a service is up based on last heartbeat. | manila/utils.py | service_is_up | bswartz/manila | 3 | python | def service_is_up(service):
last_heartbeat = (service['updated_at'] or service['created_at'])
tdelta = (timeutils.utcnow() - last_heartbeat)
elapsed = tdelta.total_seconds()
return (abs(elapsed) <= CONF.service_down_time) | def service_is_up(service):
last_heartbeat = (service['updated_at'] or service['created_at'])
tdelta = (timeutils.utcnow() - last_heartbeat)
elapsed = tdelta.total_seconds()
return (abs(elapsed) <= CONF.service_down_time)<|docstring|>Check whether a service is up based on last heartbeat.<|endoftext... |
0b6452ed300c51a3b59ee0844bb3ad68c1bd8b49857b18501282b457e59ba901 | def walk_class_hierarchy(clazz, encountered=None):
'Walk class hierarchy, yielding most derived classes first.'
if (not encountered):
encountered = []
for subclass in clazz.__subclasses__():
if (subclass not in encountered):
encountered.append(subclass)
for subsubclas... | Walk class hierarchy, yielding most derived classes first. | manila/utils.py | walk_class_hierarchy | bswartz/manila | 3 | python | def walk_class_hierarchy(clazz, encountered=None):
if (not encountered):
encountered = []
for subclass in clazz.__subclasses__():
if (subclass not in encountered):
encountered.append(subclass)
for subsubclass in walk_class_hierarchy(subclass, encountered):
... | def walk_class_hierarchy(clazz, encountered=None):
if (not encountered):
encountered = []
for subclass in clazz.__subclasses__():
if (subclass not in encountered):
encountered.append(subclass)
for subsubclass in walk_class_hierarchy(subclass, encountered):
... |
3645825f0824d351ddf2c996dc2805908e91f0dd98e8650b2153dffd181b70c7 | def cidr_to_network(cidr):
'Convert cidr to network.'
try:
network = netaddr.IPNetwork(cidr)
return network
except netaddr.AddrFormatError:
raise exception.InvalidInput((_('Invalid cidr supplied %s') % cidr)) | Convert cidr to network. | manila/utils.py | cidr_to_network | bswartz/manila | 3 | python | def cidr_to_network(cidr):
try:
network = netaddr.IPNetwork(cidr)
return network
except netaddr.AddrFormatError:
raise exception.InvalidInput((_('Invalid cidr supplied %s') % cidr)) | def cidr_to_network(cidr):
try:
network = netaddr.IPNetwork(cidr)
return network
except netaddr.AddrFormatError:
raise exception.InvalidInput((_('Invalid cidr supplied %s') % cidr))<|docstring|>Convert cidr to network.<|endoftext|> |
904a7914b5feaaf23f65add715ec039d4b2a1eb384272483b3441c2daef68e3a | def cidr_to_netmask(cidr):
'Convert cidr to netmask.'
return six.text_type(cidr_to_network(cidr).netmask) | Convert cidr to netmask. | manila/utils.py | cidr_to_netmask | bswartz/manila | 3 | python | def cidr_to_netmask(cidr):
return six.text_type(cidr_to_network(cidr).netmask) | def cidr_to_netmask(cidr):
return six.text_type(cidr_to_network(cidr).netmask)<|docstring|>Convert cidr to netmask.<|endoftext|> |
258b6589fde730302561ed23a7de7564d5fcc3955eb24f0a48e155e8daa8cf7e | def cidr_to_prefixlen(cidr):
'Convert cidr to prefix length.'
return cidr_to_network(cidr).prefixlen | Convert cidr to prefix length. | manila/utils.py | cidr_to_prefixlen | bswartz/manila | 3 | python | def cidr_to_prefixlen(cidr):
return cidr_to_network(cidr).prefixlen | def cidr_to_prefixlen(cidr):
return cidr_to_network(cidr).prefixlen<|docstring|>Convert cidr to prefix length.<|endoftext|> |
567e5e0dd02b4279a34223ce129a85fb74de026b5e1a87b54419b4ca35898d29 | def retry(exception, interval=1, retries=10, backoff_rate=2, wait_random=False, backoff_sleep_max=None):
"A wrapper around retrying library.\n\n This decorator allows to log and to check 'retries' input param.\n Time interval between retries is calculated in the following way:\n interval * backoff_rate ^ p... | A wrapper around retrying library.
This decorator allows to log and to check 'retries' input param.
Time interval between retries is calculated in the following way:
interval * backoff_rate ^ previous_attempt_number
:param exception: expected exception type. When wrapped function
raises an exception... | manila/utils.py | retry | bswartz/manila | 3 | python | def retry(exception, interval=1, retries=10, backoff_rate=2, wait_random=False, backoff_sleep_max=None):
"A wrapper around retrying library.\n\n This decorator allows to log and to check 'retries' input param.\n Time interval between retries is calculated in the following way:\n interval * backoff_rate ^ p... | def retry(exception, interval=1, retries=10, backoff_rate=2, wait_random=False, backoff_sleep_max=None):
"A wrapper around retrying library.\n\n This decorator allows to log and to check 'retries' input param.\n Time interval between retries is calculated in the following way:\n interval * backoff_rate ^ p... |
f579f031673b56a7947688cd8f2254e88662e09fe66c3d73a8730524fdfa9f6a | def get_bool_from_api_params(key, params, default=False, strict=True):
'Parse bool value from request params.\n\n HTTPBadRequest will be directly raised either of the cases below:\n 1. invalid bool string was found by key(with strict on).\n 2. key not found while default value is invalid(with strict on).\n... | Parse bool value from request params.
HTTPBadRequest will be directly raised either of the cases below:
1. invalid bool string was found by key(with strict on).
2. key not found while default value is invalid(with strict on). | manila/utils.py | get_bool_from_api_params | bswartz/manila | 3 | python | def get_bool_from_api_params(key, params, default=False, strict=True):
'Parse bool value from request params.\n\n HTTPBadRequest will be directly raised either of the cases below:\n 1. invalid bool string was found by key(with strict on).\n 2. key not found while default value is invalid(with strict on).\n... | def get_bool_from_api_params(key, params, default=False, strict=True):
'Parse bool value from request params.\n\n HTTPBadRequest will be directly raised either of the cases below:\n 1. invalid bool string was found by key(with strict on).\n 2. key not found while default value is invalid(with strict on).\n... |
c5ccb6762c841ae1906519db43009964a7ffd580cd846bf33a18236acc4fa642 | def check_params_exist(keys, params):
'Validates if keys exist in params.\n\n :param keys: List of keys to check\n :param params: Parameters received from REST API\n '
if any((set(keys) - set(params))):
msg = (_('Must specify all mandatory parameters: %s') % keys)
raise exc.HTTPBadReque... | Validates if keys exist in params.
:param keys: List of keys to check
:param params: Parameters received from REST API | manila/utils.py | check_params_exist | bswartz/manila | 3 | python | def check_params_exist(keys, params):
'Validates if keys exist in params.\n\n :param keys: List of keys to check\n :param params: Parameters received from REST API\n '
if any((set(keys) - set(params))):
msg = (_('Must specify all mandatory parameters: %s') % keys)
raise exc.HTTPBadReque... | def check_params_exist(keys, params):
'Validates if keys exist in params.\n\n :param keys: List of keys to check\n :param params: Parameters received from REST API\n '
if any((set(keys) - set(params))):
msg = (_('Must specify all mandatory parameters: %s') % keys)
raise exc.HTTPBadReque... |
5e0f994d96124fd512ad0faff8235067e07f721f6aa02a5254f6a344411a463f | def check_params_are_boolean(keys, params, default=False):
'Validates if keys in params are boolean.\n\n :param keys: List of keys to check\n :param params: Parameters received from REST API\n :param default: default value when it does not exist\n :return: a dictionary with keys and respective retrieved... | Validates if keys in params are boolean.
:param keys: List of keys to check
:param params: Parameters received from REST API
:param default: default value when it does not exist
:return: a dictionary with keys and respective retrieved value | manila/utils.py | check_params_are_boolean | bswartz/manila | 3 | python | def check_params_are_boolean(keys, params, default=False):
'Validates if keys in params are boolean.\n\n :param keys: List of keys to check\n :param params: Parameters received from REST API\n :param default: default value when it does not exist\n :return: a dictionary with keys and respective retrieved... | def check_params_are_boolean(keys, params, default=False):
'Validates if keys in params are boolean.\n\n :param keys: List of keys to check\n :param params: Parameters received from REST API\n :param default: default value when it does not exist\n :return: a dictionary with keys and respective retrieved... |
210ada632ac93f7ae38e82cd8f20f627aaacd2d9b5913f67a2a09d595b3ff261 | def convert_str(text):
'Convert to native string.\n\n Convert bytes and Unicode strings to native strings:\n\n * convert to bytes on Python 2:\n encode Unicode using encodeutils.safe_encode()\n * convert to Unicode on Python 3: decode bytes from UTF-8\n '
if six.PY2:
return encodeutils.... | Convert to native string.
Convert bytes and Unicode strings to native strings:
* convert to bytes on Python 2:
encode Unicode using encodeutils.safe_encode()
* convert to Unicode on Python 3: decode bytes from UTF-8 | manila/utils.py | convert_str | bswartz/manila | 3 | python | def convert_str(text):
'Convert to native string.\n\n Convert bytes and Unicode strings to native strings:\n\n * convert to bytes on Python 2:\n encode Unicode using encodeutils.safe_encode()\n * convert to Unicode on Python 3: decode bytes from UTF-8\n '
if six.PY2:
return encodeutils.... | def convert_str(text):
'Convert to native string.\n\n Convert bytes and Unicode strings to native strings:\n\n * convert to bytes on Python 2:\n encode Unicode using encodeutils.safe_encode()\n * convert to Unicode on Python 3: decode bytes from UTF-8\n '
if six.PY2:
return encodeutils.... |
8259ab3948c1f1b9ea990b503392c0ed25a7ce91baf51e5cb4c09449a2b98df9 | def translate_string_size_to_float(string, multiplier='G'):
"Translates human-readable storage size to float value.\n\n Supported values for 'multiplier' are following:\n K - kilo | 1\n M - mega | 1024\n G - giga | 1024 * 1024\n T - tera | 1024 * 1024 * 1024\n P = peta | 1024 *... | Translates human-readable storage size to float value.
Supported values for 'multiplier' are following:
K - kilo | 1
M - mega | 1024
G - giga | 1024 * 1024
T - tera | 1024 * 1024 * 1024
P = peta | 1024 * 1024 * 1024 * 1024
returns:
- float if correct input data provided
- None if incorrect | manila/utils.py | translate_string_size_to_float | bswartz/manila | 3 | python | def translate_string_size_to_float(string, multiplier='G'):
"Translates human-readable storage size to float value.\n\n Supported values for 'multiplier' are following:\n K - kilo | 1\n M - mega | 1024\n G - giga | 1024 * 1024\n T - tera | 1024 * 1024 * 1024\n P = peta | 1024 *... | def translate_string_size_to_float(string, multiplier='G'):
"Translates human-readable storage size to float value.\n\n Supported values for 'multiplier' are following:\n K - kilo | 1\n M - mega | 1024\n G - giga | 1024 * 1024\n T - tera | 1024 * 1024 * 1024\n P = peta | 1024 *... |
76631df8c375eb8c6a190f8516b866e1a46ee35deae666dfa58315f67097532a | def notifications_enabled(conf):
'Check if oslo notifications are enabled.'
notifications_driver = set(conf.oslo_messaging_notifications.driver)
return (notifications_driver and (notifications_driver != {'noop'})) | Check if oslo notifications are enabled. | manila/utils.py | notifications_enabled | bswartz/manila | 3 | python | def notifications_enabled(conf):
notifications_driver = set(conf.oslo_messaging_notifications.driver)
return (notifications_driver and (notifications_driver != {'noop'})) | def notifications_enabled(conf):
notifications_driver = set(conf.oslo_messaging_notifications.driver)
return (notifications_driver and (notifications_driver != {'noop'}))<|docstring|>Check if oslo notifications are enabled.<|endoftext|> |
c4cd736c0f81eeb864215bc81b9ceaf66d13b74fb9b4ea1ed1667466d9d39f1b | def if_notifications_enabled(function):
'Calls decorated method only if notifications are enabled.'
@functools.wraps(function)
def wrapped(*args, **kwargs):
if notifications_enabled(CONF):
return function(*args, **kwargs)
return DO_NOTHING
return wrapped | Calls decorated method only if notifications are enabled. | manila/utils.py | if_notifications_enabled | bswartz/manila | 3 | python | def if_notifications_enabled(function):
@functools.wraps(function)
def wrapped(*args, **kwargs):
if notifications_enabled(CONF):
return function(*args, **kwargs)
return DO_NOTHING
return wrapped | def if_notifications_enabled(function):
@functools.wraps(function)
def wrapped(*args, **kwargs):
if notifications_enabled(CONF):
return function(*args, **kwargs)
return DO_NOTHING
return wrapped<|docstring|>Calls decorated method only if notifications are enabled.<|endoftex... |
4bc64e73871686b48ff2d50fbdfd428c4ec86ad2bc1a5d3733202e4917170b60 | def get(self):
'Return an item from the pool, when one is available.\n\n This may cause the calling greenthread to block. Check if a\n connection is active before returning it. For dead connections\n create and return a new connection.\n '
if self.free_items:
conn = self.free... | Return an item from the pool, when one is available.
This may cause the calling greenthread to block. Check if a
connection is active before returning it. For dead connections
create and return a new connection. | manila/utils.py | get | bswartz/manila | 3 | python | def get(self):
'Return an item from the pool, when one is available.\n\n This may cause the calling greenthread to block. Check if a\n connection is active before returning it. For dead connections\n create and return a new connection.\n '
if self.free_items:
conn = self.free... | def get(self):
'Return an item from the pool, when one is available.\n\n This may cause the calling greenthread to block. Check if a\n connection is active before returning it. For dead connections\n create and return a new connection.\n '
if self.free_items:
conn = self.free... |
df3beff823de41a4d37e4b0d5ec4001d169072a245f24744dd467099798307ee | def remove(self, ssh):
'Close an ssh client and remove it from free_items.'
ssh.close()
ssh = None
if (ssh in self.free_items):
self.free_items.pop(ssh)
if (self.current_size > 0):
self.current_size -= 1 | Close an ssh client and remove it from free_items. | manila/utils.py | remove | bswartz/manila | 3 | python | def remove(self, ssh):
ssh.close()
ssh = None
if (ssh in self.free_items):
self.free_items.pop(ssh)
if (self.current_size > 0):
self.current_size -= 1 | def remove(self, ssh):
ssh.close()
ssh = None
if (ssh in self.free_items):
self.free_items.pop(ssh)
if (self.current_size > 0):
self.current_size -= 1<|docstring|>Close an ssh client and remove it from free_items.<|endoftext|> |
d4a2b022444125622bbeb6efe6a701ab6260a111f2ed0040af0443f89bfc8db8 | def get_profile(self, user_id='me'):
"Get a user's profile"
res = self.api.request('GET', f'profiles/{user_id}')
if (res.status_code == 200):
self.db.user_id = res.json().get('user_id')
return res.json() | Get a user's profile | src/synack/plugins/users.py | get_profile | bamhm182/synackAPI | 6 | python | def get_profile(self, user_id='me'):
res = self.api.request('GET', f'profiles/{user_id}')
if (res.status_code == 200):
self.db.user_id = res.json().get('user_id')
return res.json() | def get_profile(self, user_id='me'):
res = self.api.request('GET', f'profiles/{user_id}')
if (res.status_code == 200):
self.db.user_id = res.json().get('user_id')
return res.json()<|docstring|>Get a user's profile<|endoftext|> |
ecc791d00c42f046376fedf38f2e57c98efab686f1e85873ba095e0ab90e7ba2 | def readResults(file_name, _start_time, _end_time):
'Read micro-data from file_name, structured on a separate line per year. In particular, read from start_year until\n end_year, both inclusive'
data_float = []
with open(file_name, 'r') as _f:
for line in _f:
if (_start_time <= int(li... | Read micro-data from file_name, structured on a separate line per year. In particular, read from start_year until
end_year, both inclusive | src/main/resources/validation-code/FinancialWealthDist.py | readResults | adrian-carro/housing-model-spain | 18 | python | def readResults(file_name, _start_time, _end_time):
'Read micro-data from file_name, structured on a separate line per year. In particular, read from start_year until\n end_year, both inclusive'
data_float = []
with open(file_name, 'r') as _f:
for line in _f:
if (_start_time <= int(li... | def readResults(file_name, _start_time, _end_time):
'Read micro-data from file_name, structured on a separate line per year. In particular, read from start_year until\n end_year, both inclusive'
data_float = []
with open(file_name, 'r') as _f:
for line in _f:
if (_start_time <= int(li... |
3fd9d140511e653ca89770ea9bbaac56d2dc1a10dbf8f6d1358bbd1901b54a50 | def acquireLinks(pokemon, file):
'\n pokemon = pokemon to pull images of\n file = file to save to\n '
url = 'https://pokemondb.net/pokedex/{}#dex-sprites'
page = requests.get(url.format(pokemon))
soup = BeautifulSoup(page.content, 'html.parser')
sprite_tags = soup.find_all('img', class_='im... | pokemon = pokemon to pull images of
file = file to save to | pokemon_ml/poke_pics_acquisition.py | acquireLinks | DrakeWagner/projects | 1 | python | def acquireLinks(pokemon, file):
'\n pokemon = pokemon to pull images of\n file = file to save to\n '
url = 'https://pokemondb.net/pokedex/{}#dex-sprites'
page = requests.get(url.format(pokemon))
soup = BeautifulSoup(page.content, 'html.parser')
sprite_tags = soup.find_all('img', class_='im... | def acquireLinks(pokemon, file):
'\n pokemon = pokemon to pull images of\n file = file to save to\n '
url = 'https://pokemondb.net/pokedex/{}#dex-sprites'
page = requests.get(url.format(pokemon))
soup = BeautifulSoup(page.content, 'html.parser')
sprite_tags = soup.find_all('img', class_='im... |
a400e774f0137d49294bad5db404a15cfb84aa54668d2f5028e57865f98db93f | def main(args=None, plugins=None):
' return exit code, after performing an in-process test run.\n\n :arg args: list of command line arguments.\n\n :arg plugins: list of plugin objects to be auto-registered during\n initialization.\n '
config = _prepareconfig(args, plugins)
return c... | return exit code, after performing an in-process test run.
:arg args: list of command line arguments.
:arg plugins: list of plugin objects to be auto-registered during
initialization. | _pytest/config.py | main | wdv4758h/mu-client-pypy | 34 | python | def main(args=None, plugins=None):
' return exit code, after performing an in-process test run.\n\n :arg args: list of command line arguments.\n\n :arg plugins: list of plugin objects to be auto-registered during\n initialization.\n '
config = _prepareconfig(args, plugins)
return c... | def main(args=None, plugins=None):
' return exit code, after performing an in-process test run.\n\n :arg args: list of command line arguments.\n\n :arg plugins: list of plugin objects to be auto-registered during\n initialization.\n '
config = _prepareconfig(args, plugins)
return c... |
4142b156e8091fcf9fcd4440b06885173ff760a854c1d513d56f12596ba2bb7f | def getgroup(self, name, description='', after=None):
' get (or create) a named option Group.\n\n :name: name of the option group.\n :description: long description for --help output.\n :after: name of other group, used for ordering --help output.\n\n The returned group object has an ``ad... | get (or create) a named option Group.
:name: name of the option group.
:description: long description for --help output.
:after: name of other group, used for ordering --help output.
The returned group object has an ``addoption`` method with the same
signature as :py:func:`parser.addoption
<_pytest.config.Parser.addo... | _pytest/config.py | getgroup | wdv4758h/mu-client-pypy | 34 | python | def getgroup(self, name, description=, after=None):
' get (or create) a named option Group.\n\n :name: name of the option group.\n :description: long description for --help output.\n :after: name of other group, used for ordering --help output.\n\n The returned group object has an ``addo... | def getgroup(self, name, description=, after=None):
' get (or create) a named option Group.\n\n :name: name of the option group.\n :description: long description for --help output.\n :after: name of other group, used for ordering --help output.\n\n The returned group object has an ``addo... |
4e07127352d3ca50e615dd5eb880fe9b52bdf1ad54f58fa6ceaddcee0f6bc497 | def addoption(self, *opts, **attrs):
' register a command line option.\n\n :opts: option names, can be short or long options.\n :attrs: same attributes which the ``add_option()`` function of the\n `argparse library\n <http://docs.python.org/2/library/argparse.html>`_\n ac... | register a command line option.
:opts: option names, can be short or long options.
:attrs: same attributes which the ``add_option()`` function of the
`argparse library
<http://docs.python.org/2/library/argparse.html>`_
accepts.
After command line parsing options are available on the pytest config
object via ... | _pytest/config.py | addoption | wdv4758h/mu-client-pypy | 34 | python | def addoption(self, *opts, **attrs):
' register a command line option.\n\n :opts: option names, can be short or long options.\n :attrs: same attributes which the ``add_option()`` function of the\n `argparse library\n <http://docs.python.org/2/library/argparse.html>`_\n ac... | def addoption(self, *opts, **attrs):
' register a command line option.\n\n :opts: option names, can be short or long options.\n :attrs: same attributes which the ``add_option()`` function of the\n `argparse library\n <http://docs.python.org/2/library/argparse.html>`_\n ac... |
c40b203050fc5d3e81bf71dabdb4dba174fd7db4b2df368844454c100bc539e8 | def addini(self, name, help, type=None, default=None):
' register an ini-file option.\n\n :name: name of the ini-variable\n :type: type of the variable, can be ``pathlist``, ``args`` or ``linelist``.\n :default: default value if no ini-file option exists but is queried.\n\n The value of ... | register an ini-file option.
:name: name of the ini-variable
:type: type of the variable, can be ``pathlist``, ``args`` or ``linelist``.
:default: default value if no ini-file option exists but is queried.
The value of ini-variables can be retrieved via a call to
:py:func:`config.getini(name) <_pytest.config.Config.g... | _pytest/config.py | addini | wdv4758h/mu-client-pypy | 34 | python | def addini(self, name, help, type=None, default=None):
' register an ini-file option.\n\n :name: name of the ini-variable\n :type: type of the variable, can be ``pathlist``, ``args`` or ``linelist``.\n :default: default value if no ini-file option exists but is queried.\n\n The value of ... | def addini(self, name, help, type=None, default=None):
' register an ini-file option.\n\n :name: name of the ini-variable\n :type: type of the variable, can be ``pathlist``, ``args`` or ``linelist``.\n :default: default value if no ini-file option exists but is queried.\n\n The value of ... |
8166bcde60dc931b16fde06faf84e2dc978cc078864dde50f83a8ff3a23dfcd2 | def __init__(self, *names, **attrs):
'store parms in private vars for use in add_argument'
self._attrs = attrs
self._short_opts = []
self._long_opts = []
self.dest = attrs.get('dest')
if self.TYPE_WARN:
try:
help = attrs['help']
if ('%default' in help):
... | store parms in private vars for use in add_argument | _pytest/config.py | __init__ | wdv4758h/mu-client-pypy | 34 | python | def __init__(self, *names, **attrs):
self._attrs = attrs
self._short_opts = []
self._long_opts = []
self.dest = attrs.get('dest')
if self.TYPE_WARN:
try:
help = attrs['help']
if ('%default' in help):
py.std.warnings.warn('pytest now uses argparse.... | def __init__(self, *names, **attrs):
self._attrs = attrs
self._short_opts = []
self._long_opts = []
self.dest = attrs.get('dest')
if self.TYPE_WARN:
try:
help = attrs['help']
if ('%default' in help):
py.std.warnings.warn('pytest now uses argparse.... |
97785b711e5d2bb758a86373f4a2720608bb072dfce37d718bf2451963519b15 | def _set_opt_strings(self, opts):
'directly from optparse\n\n might not be necessary as this is passed to argparse later on'
for opt in opts:
if (len(opt) < 2):
raise ArgumentError(('invalid option string %r: must be at least two characters long' % opt), self)
elif (len(opt) =... | directly from optparse
might not be necessary as this is passed to argparse later on | _pytest/config.py | _set_opt_strings | wdv4758h/mu-client-pypy | 34 | python | def _set_opt_strings(self, opts):
'directly from optparse\n\n might not be necessary as this is passed to argparse later on'
for opt in opts:
if (len(opt) < 2):
raise ArgumentError(('invalid option string %r: must be at least two characters long' % opt), self)
elif (len(opt) =... | def _set_opt_strings(self, opts):
'directly from optparse\n\n might not be necessary as this is passed to argparse later on'
for opt in opts:
if (len(opt) < 2):
raise ArgumentError(('invalid option string %r: must be at least two characters long' % opt), self)
elif (len(opt) =... |
85b336ffe8c3df72d37f9a045c96864298971a71261642a43dada8a21f2fedaf | def addoption(self, *optnames, **attrs):
" add an option to this group.\n\n if a shortened version of a long option is specified it will\n be suppressed in the help. addoption('--twowords', '--two-words')\n results in help showing '--two-words' only, but --twowords gets\n accepted **and*... | add an option to this group.
if a shortened version of a long option is specified it will
be suppressed in the help. addoption('--twowords', '--two-words')
results in help showing '--two-words' only, but --twowords gets
accepted **and** the automatic destination is in args.twowords | _pytest/config.py | addoption | wdv4758h/mu-client-pypy | 34 | python | def addoption(self, *optnames, **attrs):
" add an option to this group.\n\n if a shortened version of a long option is specified it will\n be suppressed in the help. addoption('--twowords', '--two-words')\n results in help showing '--two-words' only, but --twowords gets\n accepted **and*... | def addoption(self, *optnames, **attrs):
" add an option to this group.\n\n if a shortened version of a long option is specified it will\n be suppressed in the help. addoption('--twowords', '--two-words')\n results in help showing '--two-words' only, but --twowords gets\n accepted **and*... |
3b65b6fc14be2baac4248e1f990cd0a7b7204370672e20a9f51498c7ba0c359c | def parse_args(self, args=None, namespace=None):
'allow splitting of positional arguments'
(args, argv) = self.parse_known_args(args, namespace)
if argv:
for arg in argv:
if (arg and (arg[0] == '-')):
msg = py.std.argparse._('unrecognized arguments: %s')
s... | allow splitting of positional arguments | _pytest/config.py | parse_args | wdv4758h/mu-client-pypy | 34 | python | def parse_args(self, args=None, namespace=None):
(args, argv) = self.parse_known_args(args, namespace)
if argv:
for arg in argv:
if (arg and (arg[0] == '-')):
msg = py.std.argparse._('unrecognized arguments: %s')
self.error((msg % ' '.join(argv)))
... | def parse_args(self, args=None, namespace=None):
(args, argv) = self.parse_known_args(args, namespace)
if argv:
for arg in argv:
if (arg and (arg[0] == '-')):
msg = py.std.argparse._('unrecognized arguments: %s')
self.error((msg % ' '.join(argv)))
... |
7eee11dcbb5f2b080e98fec027adf36701e444a66a7bfcb9778a2abc5c70cd76 | def setinitial(self, args):
' try to find a first anchor path for looking up global values\n from conftests. This function is usually called _before_\n argument parsing. conftest files may add command line options\n and we thus have no completely safe way of determining\n ... | try to find a first anchor path for looking up global values
from conftests. This function is usually called _before_
argument parsing. conftest files may add command line options
and we thus have no completely safe way of determining
which parts of the arguments are actually related to options
and which are file syst... | _pytest/config.py | setinitial | wdv4758h/mu-client-pypy | 34 | python | def setinitial(self, args):
' try to find a first anchor path for looking up global values\n from conftests. This function is usually called _before_\n argument parsing. conftest files may add command line options\n and we thus have no completely safe way of determining\n ... | def setinitial(self, args):
' try to find a first anchor path for looking up global values\n from conftests. This function is usually called _before_\n argument parsing. conftest files may add command line options\n and we thus have no completely safe way of determining\n ... |
1500c6a016d285ddc0bbf52e91dade08fc4ad2b9eefa4b9d982c04d6f8e74603 | @classmethod
def fromdictargs(cls, option_dict, args):
' constructor useable for subprocesses. '
pluginmanager = get_plugin_manager()
config = pluginmanager.config
config._preparse(args, addopts=False)
config.option.__dict__.update(option_dict)
for x in config.option.plugins:
config.plug... | constructor useable for subprocesses. | _pytest/config.py | fromdictargs | wdv4758h/mu-client-pypy | 34 | python | @classmethod
def fromdictargs(cls, option_dict, args):
' '
pluginmanager = get_plugin_manager()
config = pluginmanager.config
config._preparse(args, addopts=False)
config.option.__dict__.update(option_dict)
for x in config.option.plugins:
config.pluginmanager.consider_pluginarg(x)
r... | @classmethod
def fromdictargs(cls, option_dict, args):
' '
pluginmanager = get_plugin_manager()
config = pluginmanager.config
config._preparse(args, addopts=False)
config.option.__dict__.update(option_dict)
for x in config.option.plugins:
config.pluginmanager.consider_pluginarg(x)
r... |
e488baedf89f1ba59accf7f295877671369075441b13e843dbe53d5bbd694e11 | def addinivalue_line(self, name, line):
' add a line to an ini-file option. The option must have been\n declared but might not yet be set in which case the line becomes the\n the first line in its value. '
x = self.getini(name)
assert isinstance(x, list)
x.append(line) | add a line to an ini-file option. The option must have been
declared but might not yet be set in which case the line becomes the
the first line in its value. | _pytest/config.py | addinivalue_line | wdv4758h/mu-client-pypy | 34 | python | def addinivalue_line(self, name, line):
' add a line to an ini-file option. The option must have been\n declared but might not yet be set in which case the line becomes the\n the first line in its value. '
x = self.getini(name)
assert isinstance(x, list)
x.append(line) | def addinivalue_line(self, name, line):
' add a line to an ini-file option. The option must have been\n declared but might not yet be set in which case the line becomes the\n the first line in its value. '
x = self.getini(name)
assert isinstance(x, list)
x.append(line)<|docstring|>add a li... |
9d54161102678baa2e975cc1770de41c400403e7c424b939fc264c14228e80c3 | def getini(self, name):
" return configuration value from an :ref:`ini file <inifiles>`. If the\n specified name hasn't been registered through a prior\n :py:func:`parser.addini <pytest.config.Parser.addini>`\n call (usually from a plugin), a ValueError is raised. "
try:
return self... | return configuration value from an :ref:`ini file <inifiles>`. If the
specified name hasn't been registered through a prior
:py:func:`parser.addini <pytest.config.Parser.addini>`
call (usually from a plugin), a ValueError is raised. | _pytest/config.py | getini | wdv4758h/mu-client-pypy | 34 | python | def getini(self, name):
" return configuration value from an :ref:`ini file <inifiles>`. If the\n specified name hasn't been registered through a prior\n :py:func:`parser.addini <pytest.config.Parser.addini>`\n call (usually from a plugin), a ValueError is raised. "
try:
return self... | def getini(self, name):
" return configuration value from an :ref:`ini file <inifiles>`. If the\n specified name hasn't been registered through a prior\n :py:func:`parser.addini <pytest.config.Parser.addini>`\n call (usually from a plugin), a ValueError is raised. "
try:
return self... |
d0239c03bf8a5eca79a1b3326f16bb0992fbbb1a4ff3072dd07c4fdf069311d8 | def getoption(self, name):
' return command line option value.\n\n :arg name: name of the option. You may also specify\n the literal ``--OPT`` option instead of the "dest" option name.\n '
name = self._opt2dest.get(name, name)
try:
return getattr(self.option, name)
exce... | return command line option value.
:arg name: name of the option. You may also specify
the literal ``--OPT`` option instead of the "dest" option name. | _pytest/config.py | getoption | wdv4758h/mu-client-pypy | 34 | python | def getoption(self, name):
' return command line option value.\n\n :arg name: name of the option. You may also specify\n the literal ``--OPT`` option instead of the "dest" option name.\n '
name = self._opt2dest.get(name, name)
try:
return getattr(self.option, name)
exce... | def getoption(self, name):
' return command line option value.\n\n :arg name: name of the option. You may also specify\n the literal ``--OPT`` option instead of the "dest" option name.\n '
name = self._opt2dest.get(name, name)
try:
return getattr(self.option, name)
exce... |
70271f9f2d0acd38856d5eea893ca312e32fef7781fc5c0f8e46dfe7053eaddc | def getvalue(self, name, path=None):
" return command line option value.\n\n :arg name: name of the command line option\n\n (deprecated) if we can't find the option also lookup\n the name in a matching conftest file.\n "
try:
return getattr(self.option, name)
except Attri... | return command line option value.
:arg name: name of the command line option
(deprecated) if we can't find the option also lookup
the name in a matching conftest file. | _pytest/config.py | getvalue | wdv4758h/mu-client-pypy | 34 | python | def getvalue(self, name, path=None):
" return command line option value.\n\n :arg name: name of the command line option\n\n (deprecated) if we can't find the option also lookup\n the name in a matching conftest file.\n "
try:
return getattr(self.option, name)
except Attri... | def getvalue(self, name, path=None):
" return command line option value.\n\n :arg name: name of the command line option\n\n (deprecated) if we can't find the option also lookup\n the name in a matching conftest file.\n "
try:
return getattr(self.option, name)
except Attri... |
a3e5802fad1f47e608cef7cfb0a39fa100c43b1b998dfb1fa0b63da868eed912 | def getvalueorskip(self, name, path=None):
' (deprecated) return getvalue(name) or call\n pytest.skip if no value exists. '
__tracebackhide__ = True
try:
val = self.getvalue(name, path)
if (val is None):
raise KeyError(name)
return val
except KeyError:
... | (deprecated) return getvalue(name) or call
pytest.skip if no value exists. | _pytest/config.py | getvalueorskip | wdv4758h/mu-client-pypy | 34 | python | def getvalueorskip(self, name, path=None):
' (deprecated) return getvalue(name) or call\n pytest.skip if no value exists. '
__tracebackhide__ = True
try:
val = self.getvalue(name, path)
if (val is None):
raise KeyError(name)
return val
except KeyError:
... | def getvalueorskip(self, name, path=None):
' (deprecated) return getvalue(name) or call\n pytest.skip if no value exists. '
__tracebackhide__ = True
try:
val = self.getvalue(name, path)
if (val is None):
raise KeyError(name)
return val
except KeyError:
... |
a963230f6dad5695bec13c79144fdc67e420146b8cc5f5c8ba35d2fbdc619f67 | def velocity_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return velocity vector of orbit at ut\n\n Return velocity vector of orbit at ut\n If we could access KSP Orbit.getOrbitalVelocityAtUT() via kRPC api...\n\n Args:\n orbit: kRPC orbit object\n at_ut: at speci... | Return velocity vector of orbit at ut
Return velocity vector of orbit at ut
If we could access KSP Orbit.getOrbitalVelocityAtUT() via kRPC api...
Args:
orbit: kRPC orbit object
at_ut: at specific time
reference_frame: reference_frame to be used
Returns:
return velocity vector | scripts/utils/maneuver.py | velocity_at_ut | haeena/KSP-kRPC-carrier | 1 | python | def velocity_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return velocity vector of orbit at ut\n\n Return velocity vector of orbit at ut\n If we could access KSP Orbit.getOrbitalVelocityAtUT() via kRPC api...\n\n Args:\n orbit: kRPC orbit object\n at_ut: at speci... | def velocity_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return velocity vector of orbit at ut\n\n Return velocity vector of orbit at ut\n If we could access KSP Orbit.getOrbitalVelocityAtUT() via kRPC api...\n\n Args:\n orbit: kRPC orbit object\n at_ut: at speci... |
abaaa27ad8eeb3dcdd682654fce047bfb8a8c7f30f1492eea242b9ba03474d8f | def prograde_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return prograde vector of orbit at ut\n\n Return prograde vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n ... | Return prograde vector of orbit at ut
Return prograde vector of orbit at ut
Args:
orbit: kRPC orbit object
at_ut: at specific time
reference_frame: reference_frame to be used
Returns:
return prograde unit vector | scripts/utils/maneuver.py | prograde_vector_at_ut | haeena/KSP-kRPC-carrier | 1 | python | def prograde_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return prograde vector of orbit at ut\n\n Return prograde vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n ... | def prograde_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return prograde vector of orbit at ut\n\n Return prograde vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n ... |
01313a6031ebe010d4029bf315e677a42391f966e611d546f072f03185f45cd1 | def anti_radial_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return anti-radial vector of orbit at ut\n\n Return anti-radial vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be us... | Return anti-radial vector of orbit at ut
Return anti-radial vector of orbit at ut
Args:
orbit: kRPC orbit object
at_ut: at specific time
reference_frame: reference_frame to be used
Returns:
return anti-radial unit vector | scripts/utils/maneuver.py | anti_radial_vector_at_ut | haeena/KSP-kRPC-carrier | 1 | python | def anti_radial_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return anti-radial vector of orbit at ut\n\n Return anti-radial vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be us... | def anti_radial_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return anti-radial vector of orbit at ut\n\n Return anti-radial vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be us... |
fe5001d068d403ad7bbdae65acc5b4d12255925b44c42f4e4a79d9e724b5c3b2 | def normal_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return normal vector of orbit at ut\n\n Return normal vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n Retur... | Return normal vector of orbit at ut
Return normal vector of orbit at ut
Args:
orbit: kRPC orbit object
at_ut: at specific time
reference_frame: reference_frame to be used
Returns:
return normal unit vector | scripts/utils/maneuver.py | normal_vector_at_ut | haeena/KSP-kRPC-carrier | 1 | python | def normal_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return normal vector of orbit at ut\n\n Return normal vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n Retur... | def normal_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return normal vector of orbit at ut\n\n Return normal vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n Retur... |
de6d42172623e64f835a580b66bae9070249adfd30e099c65ac8358f10531543 | def upward_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return upward vector of orbit at ut\n\n Return upward vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n Retur... | Return upward vector of orbit at ut
Return upward vector of orbit at ut
Args:
orbit: kRPC orbit object
at_ut: at specific time
reference_frame: reference_frame to be used
Returns:
return upward unit vector | scripts/utils/maneuver.py | upward_vector_at_ut | haeena/KSP-kRPC-carrier | 1 | python | def upward_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return upward vector of orbit at ut\n\n Return upward vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n Retur... | def upward_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return upward vector of orbit at ut\n\n Return upward vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\n\n Retur... |
a88bbe7623a14c6424bb50902ec2b35442e13a9e8a4bc6852a2082c93d6b6dce | def horizontal_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return horizontal vector of orbit at ut\n\n Return horizontal vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\... | Return horizontal vector of orbit at ut
Return horizontal vector of orbit at ut
Args:
orbit: kRPC orbit object
at_ut: at specific time
reference_frame: reference_frame to be used
Returns:
return horizontal unit vector | scripts/utils/maneuver.py | horizontal_vector_at_ut | haeena/KSP-kRPC-carrier | 1 | python | def horizontal_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return horizontal vector of orbit at ut\n\n Return horizontal vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\... | def horizontal_vector_at_ut(orbit: Orbit, at_ut: float, reference_frame: ReferenceFrame=None):
'Return horizontal vector of orbit at ut\n\n Return horizontal vector of orbit at ut\n\n Args:\n orbit: kRPC orbit object\n at_ut: at specific time\n reference_frame: reference_frame to be used\... |
cbf62653021fc6f7956cdc0dbb243969f847aa9f4485940c531f171634a88bc3 | def circularize(conn: Client, node_ut: float):
'Execute circularize burn\n\n Execute circularize burn.\n At least one of (at_apoapsis, at_periapsis, at_ut) must be specified\n\n Args:\n conn: kRPC connection\n node_ut: schedule burn at specific time\n\n Returns:\n return nothing, re... | Execute circularize burn
Execute circularize burn.
At least one of (at_apoapsis, at_periapsis, at_ut) must be specified
Args:
conn: kRPC connection
node_ut: schedule burn at specific time
Returns:
return nothing, return when procedure finished | scripts/utils/maneuver.py | circularize | haeena/KSP-kRPC-carrier | 1 | python | def circularize(conn: Client, node_ut: float):
'Execute circularize burn\n\n Execute circularize burn.\n At least one of (at_apoapsis, at_periapsis, at_ut) must be specified\n\n Args:\n conn: kRPC connection\n node_ut: schedule burn at specific time\n\n Returns:\n return nothing, re... | def circularize(conn: Client, node_ut: float):
'Execute circularize burn\n\n Execute circularize burn.\n At least one of (at_apoapsis, at_periapsis, at_ut) must be specified\n\n Args:\n conn: kRPC connection\n node_ut: schedule burn at specific time\n\n Returns:\n return nothing, re... |
eaa3e38da0a461ba35cb46024a8cf3f5dfe938c7f277cbd6609fabdf8a9daecb | def change_apoapsis(conn: Client, node_ut: float, new_apoapsis_alt: float):
'Execute to change apoapsis\n\n Execute to change apoapsis.\n To be simple, burn only prograde/retrograde, so it might be not optimal\n\n Args:\n conn: kRPC connection\n new_apoapsis_alt: new apoapsis altitude\n ... | Execute to change apoapsis
Execute to change apoapsis.
To be simple, burn only prograde/retrograde, so it might be not optimal
Args:
conn: kRPC connection
new_apoapsis_alt: new apoapsis altitude
node_ut: schedule burn at specific time, if not specified burn at next periapsis
Returns:
return nothing, ... | scripts/utils/maneuver.py | change_apoapsis | haeena/KSP-kRPC-carrier | 1 | python | def change_apoapsis(conn: Client, node_ut: float, new_apoapsis_alt: float):
'Execute to change apoapsis\n\n Execute to change apoapsis.\n To be simple, burn only prograde/retrograde, so it might be not optimal\n\n Args:\n conn: kRPC connection\n new_apoapsis_alt: new apoapsis altitude\n ... | def change_apoapsis(conn: Client, node_ut: float, new_apoapsis_alt: float):
'Execute to change apoapsis\n\n Execute to change apoapsis.\n To be simple, burn only prograde/retrograde, so it might be not optimal\n\n Args:\n conn: kRPC connection\n new_apoapsis_alt: new apoapsis altitude\n ... |
a3b4b33ee9e1d034f274e326698099e5af67fa1bb1b95d04375f1333925f4382 | def change_periapsis(conn: Client, node_ut: float, new_periapsis_alt: float):
'Execute to change periapsis\n\n Execute to change periapsis.\n To be simple, burn only horizontal, so it might be not optimal\n\n Args:\n conn: kRPC connection\n new_periapsis_alt: new periapsis altitude\n n... | Execute to change periapsis
Execute to change periapsis.
To be simple, burn only horizontal, so it might be not optimal
Args:
conn: kRPC connection
new_periapsis_alt: new periapsis altitude
node_ut: schedule burn at specific time, if not specified burn at next apoapsis
Returns:
return nothing, return... | scripts/utils/maneuver.py | change_periapsis | haeena/KSP-kRPC-carrier | 1 | python | def change_periapsis(conn: Client, node_ut: float, new_periapsis_alt: float):
'Execute to change periapsis\n\n Execute to change periapsis.\n To be simple, burn only horizontal, so it might be not optimal\n\n Args:\n conn: kRPC connection\n new_periapsis_alt: new periapsis altitude\n n... | def change_periapsis(conn: Client, node_ut: float, new_periapsis_alt: float):
'Execute to change periapsis\n\n Execute to change periapsis.\n To be simple, burn only horizontal, so it might be not optimal\n\n Args:\n conn: kRPC connection\n new_periapsis_alt: new periapsis altitude\n n... |
23539811c6ccf726802552508ad0c05f895de0fd4beb46106df7938b10d17ccc | def match_plane_with_target(conn: Client):
'match plane with target\n\n Extended description here\n\n Args:\n conn: kRPC connection\n\n Returns:\n return nothing, return when procedure finished\n '
dialog = StatusDialog(conn)
vessel = conn.space_center.active_vessel
target = co... | match plane with target
Extended description here
Args:
conn: kRPC connection
Returns:
return nothing, return when procedure finished | scripts/utils/maneuver.py | match_plane_with_target | haeena/KSP-kRPC-carrier | 1 | python | def match_plane_with_target(conn: Client):
'match plane with target\n\n Extended description here\n\n Args:\n conn: kRPC connection\n\n Returns:\n return nothing, return when procedure finished\n '
dialog = StatusDialog(conn)
vessel = conn.space_center.active_vessel
target = co... | def match_plane_with_target(conn: Client):
'match plane with target\n\n Extended description here\n\n Args:\n conn: kRPC connection\n\n Returns:\n return nothing, return when procedure finished\n '
dialog = StatusDialog(conn)
vessel = conn.space_center.active_vessel
target = co... |
1eefcdaa40cd85313a5654db671a8399714ffbe166fba6a7020d6ef2be5a067a | def build_sed_model(wave, w1=4500, w2=9400, velscale=200, sample=None, fwhm=2.95, nssps=1, porder=0):
' Build model for simulations'
sample = ('all' if (sample is None) else sample)
templates_file = os.path.join(context.home, 'templates', 'emiles_muse_vel{}_w{}_{}_{}_fwhm{}.fits'.format(velscale, w1, w2, sa... | Build model for simulations | simulations_paintbox.py | build_sed_model | cebarbosa/hydraimf | 0 | python | def build_sed_model(wave, w1=4500, w2=9400, velscale=200, sample=None, fwhm=2.95, nssps=1, porder=0):
' '
sample = ('all' if (sample is None) else sample)
templates_file = os.path.join(context.home, 'templates', 'emiles_muse_vel{}_w{}_{}_{}_fwhm{}.fits'.format(velscale, w1, w2, sample, fwhm))
templates ... | def build_sed_model(wave, w1=4500, w2=9400, velscale=200, sample=None, fwhm=2.95, nssps=1, porder=0):
' '
sample = ('all' if (sample is None) else sample)
templates_file = os.path.join(context.home, 'templates', 'emiles_muse_vel{}_w{}_{}_{}_fwhm{}.fits'.format(velscale, w1, w2, sample, fwhm))
templates ... |
ef2e9590c34bf62f58ea5ac2bdead88a3fee724fa1834d8d951b0f71ccdf4e85 | def get_user(self, user_field):
' login_field could be email or mobile or id'
try:
return User.objects.get(((Q(email=user_field) | Q(id=user_field)) | Q(mobile=user_field)))
except User.DoesNotExist as err:
return False
except ValueError as err:
return False | login_field could be email or mobile or id | core/user_manager.py | get_user | aiflare/django-custom-user | 0 | python | def get_user(self, user_field):
' '
try:
return User.objects.get(((Q(email=user_field) | Q(id=user_field)) | Q(mobile=user_field)))
except User.DoesNotExist as err:
return False
except ValueError as err:
return False | def get_user(self, user_field):
' '
try:
return User.objects.get(((Q(email=user_field) | Q(id=user_field)) | Q(mobile=user_field)))
except User.DoesNotExist as err:
return False
except ValueError as err:
return False<|docstring|>login_field could be email or mobile or id<|endofte... |
38aba871f3c53b9d9dc53a14898785b8989fdc65e67d7d9a4f47f87e52939471 | def initialize(self, plane, markers):
' Basic initialization of algorithm before use. '
self.plane = plane
self.markers = markers | Basic initialization of algorithm before use. | Algorithms/HullAlgorithm.py | initialize | Eckankar/PyConvexHullDemo | 0 | python | def initialize(self, plane, markers):
' '
self.plane = plane
self.markers = markers | def initialize(self, plane, markers):
' '
self.plane = plane
self.markers = markers<|docstring|>Basic initialization of algorithm before use.<|endoftext|> |
61c90591457cdf7e5dd9f993b553407aaded7347e065a507c35c4c79a95e813e | def execute(self):
'\n Does the actual hull-finding.\n\n Should be implemented as a generator function, that is, it should yield\n execution after each significant step in its execution, to allow for\n redrawing of the display, as well as slowing down the execution for\n better vi... | Does the actual hull-finding.
Should be implemented as a generator function, that is, it should yield
execution after each significant step in its execution, to allow for
redrawing of the display, as well as slowing down the execution for
better visual effect.
In addition, the algorithm should yield before doing anyt... | Algorithms/HullAlgorithm.py | execute | Eckankar/PyConvexHullDemo | 0 | python | def execute(self):
'\n Does the actual hull-finding.\n\n Should be implemented as a generator function, that is, it should yield\n execution after each significant step in its execution, to allow for\n redrawing of the display, as well as slowing down the execution for\n better vi... | def execute(self):
'\n Does the actual hull-finding.\n\n Should be implemented as a generator function, that is, it should yield\n execution after each significant step in its execution, to allow for\n redrawing of the display, as well as slowing down the execution for\n better vi... |
a0715362d91548ab505a671755ef2cc28d037f479e92ffaadc2314440388f333 | def _is_valid_key(key):
'Check if a session key has the correct format.'
return (_UUID_RE.match(key.split('.')[(- 1)]) is not None) | Check if a session key has the correct format. | tipfy/appengine/sessions.py | _is_valid_key | pombreda/tipfy | 23 | python | def _is_valid_key(key):
return (_UUID_RE.match(key.split('.')[(- 1)]) is not None) | def _is_valid_key(key):
return (_UUID_RE.match(key.split('.')[(- 1)]) is not None)<|docstring|>Check if a session key has the correct format.<|endoftext|> |
47b0720f2aef616691767b616606fa00a8e32a3c1e5bf4f8c9dbdbf8ada67b61 | @property
def sid(self):
'Returns the session id, which is the same as the key name.\n\n :returns:\n A session unique id.\n '
return self.key().name() | Returns the session id, which is the same as the key name.
:returns:
A session unique id. | tipfy/appengine/sessions.py | sid | pombreda/tipfy | 23 | python | @property
def sid(self):
'Returns the session id, which is the same as the key name.\n\n :returns:\n A session unique id.\n '
return self.key().name() | @property
def sid(self):
'Returns the session id, which is the same as the key name.\n\n :returns:\n A session unique id.\n '
return self.key().name()<|docstring|>Returns the session id, which is the same as the key name.
:returns:
A session unique id.<|endoftext|> |
a88d23e6f8d7119ea900197e34e7fe68818fa139652777cea89159045d4bc843 | @classmethod
def kind(cls):
'Returns the datastore kind we use for this model.'
return cls.kind_name | Returns the datastore kind we use for this model. | tipfy/appengine/sessions.py | kind | pombreda/tipfy | 23 | python | @classmethod
def kind(cls):
return cls.kind_name | @classmethod
def kind(cls):
return cls.kind_name<|docstring|>Returns the datastore kind we use for this model.<|endoftext|> |
70ba9066d6928fb8d4e5d242caebe33ba35903c9d83462b6e4168036aa9fd689 | @classmethod
def get_by_sid(cls, sid):
'Returns a ``Session`` instance by session id.\n\n :param sid:\n A session id.\n :returns:\n An existing ``Session`` entity.\n '
session = cls.get_cache(sid)
if (not session):
session = SessionModel.get_by_key_name(sid... | Returns a ``Session`` instance by session id.
:param sid:
A session id.
:returns:
An existing ``Session`` entity. | tipfy/appengine/sessions.py | get_by_sid | pombreda/tipfy | 23 | python | @classmethod
def get_by_sid(cls, sid):
'Returns a ``Session`` instance by session id.\n\n :param sid:\n A session id.\n :returns:\n An existing ``Session`` entity.\n '
session = cls.get_cache(sid)
if (not session):
session = SessionModel.get_by_key_name(sid... | @classmethod
def get_by_sid(cls, sid):
'Returns a ``Session`` instance by session id.\n\n :param sid:\n A session id.\n :returns:\n An existing ``Session`` entity.\n '
session = cls.get_cache(sid)
if (not session):
session = SessionModel.get_by_key_name(sid... |
a64e13da3d38f540dc72bc9b20941921c9e6650acf4689983cc8aebc222c31d4 | @classmethod
def create(cls, sid, data=None):
'Returns a new, empty session entity.\n\n :param sid:\n A session id.\n :returns:\n A new and not saved session entity.\n '
return cls(key_name=sid, data=(data or {})) | Returns a new, empty session entity.
:param sid:
A session id.
:returns:
A new and not saved session entity. | tipfy/appengine/sessions.py | create | pombreda/tipfy | 23 | python | @classmethod
def create(cls, sid, data=None):
'Returns a new, empty session entity.\n\n :param sid:\n A session id.\n :returns:\n A new and not saved session entity.\n '
return cls(key_name=sid, data=(data or {})) | @classmethod
def create(cls, sid, data=None):
'Returns a new, empty session entity.\n\n :param sid:\n A session id.\n :returns:\n A new and not saved session entity.\n '
return cls(key_name=sid, data=(data or {}))<|docstring|>Returns a new, empty session entity.
:para... |
e541495e664a3d42d1e0185a4216211697f47f70c824c19f53c0118839916629 | def set_cache(self):
'Saves a new cache for this entity.'
memcache.set(self.sid, get_protobuf_from_entity(self)) | Saves a new cache for this entity. | tipfy/appengine/sessions.py | set_cache | pombreda/tipfy | 23 | python | def set_cache(self):
memcache.set(self.sid, get_protobuf_from_entity(self)) | def set_cache(self):
memcache.set(self.sid, get_protobuf_from_entity(self))<|docstring|>Saves a new cache for this entity.<|endoftext|> |
8c4b2deb3aff8654e30a486063858715c1d7ab41c55d464b97d7312f94d40bdf | def delete_cache(self):
'Saves a new cache for this entity.'
memcache.delete(self.sid) | Saves a new cache for this entity. | tipfy/appengine/sessions.py | delete_cache | pombreda/tipfy | 23 | python | def delete_cache(self):
memcache.delete(self.sid) | def delete_cache(self):
memcache.delete(self.sid)<|docstring|>Saves a new cache for this entity.<|endoftext|> |
f82a12c45dedc90e59e5e0dcb2f7f9cfa379e029284380d14cc5fd06be7f2157 | def put(self):
'Saves the session and updates the memcache entry.'
self.set_cache()
db.put(self) | Saves the session and updates the memcache entry. | tipfy/appengine/sessions.py | put | pombreda/tipfy | 23 | python | def put(self):
self.set_cache()
db.put(self) | def put(self):
self.set_cache()
db.put(self)<|docstring|>Saves the session and updates the memcache entry.<|endoftext|> |
cff9e56e1333b25e2aa2ace83436482e290f147cd4cf8fb17b1faa8775a682b8 | def delete(self):
'Deletes the session and the memcache entry.'
self.delete_cache()
db.delete(self) | Deletes the session and the memcache entry. | tipfy/appengine/sessions.py | delete | pombreda/tipfy | 23 | python | def delete(self):
self.delete_cache()
db.delete(self) | def delete(self):
self.delete_cache()
db.delete(self)<|docstring|>Deletes the session and the memcache entry.<|endoftext|> |
07975866a6509085dfc3bc9e95125bfc1c57515d06040975d9dffd874503eefb | @classmethod
def _get_by_sid(cls, sid, **kwargs):
'Returns a session given a session id.'
entity = cls.model_class.get_by_sid(sid)
if (entity is not None):
return cls(entity.data, sid)
return cls(new=True) | Returns a session given a session id. | tipfy/appengine/sessions.py | _get_by_sid | pombreda/tipfy | 23 | python | @classmethod
def _get_by_sid(cls, sid, **kwargs):
entity = cls.model_class.get_by_sid(sid)
if (entity is not None):
return cls(entity.data, sid)
return cls(new=True) | @classmethod
def _get_by_sid(cls, sid, **kwargs):
entity = cls.model_class.get_by_sid(sid)
if (entity is not None):
return cls(entity.data, sid)
return cls(new=True)<|docstring|>Returns a session given a session id.<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.