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
51f920af5fa6baef21adc57328d0d0b064eb7ba476d92da836f84444d933afca
def extract_configurations_from_yml(config_path: Path=None) -> YAML: '\n Parse YAML for package and model configurations.\n ' if (not config_path): config_path = detect_config_file() if config_path: with open(config_path, 'r') as config_file: parsed_config_file = load(confi...
Parse YAML for package and model configurations.
costa_rica_poverty/packages/model/model/config/config.py
extract_configurations_from_yml
Cawiess/costa_rica_poverty
0
python
def extract_configurations_from_yml(config_path: Path=None) -> YAML: '\n \n ' if (not config_path): config_path = detect_config_file() if config_path: with open(config_path, 'r') as config_file: parsed_config_file = load(config_file.read()) return parsed_config_...
def extract_configurations_from_yml(config_path: Path=None) -> YAML: '\n \n ' if (not config_path): config_path = detect_config_file() if config_path: with open(config_path, 'r') as config_file: parsed_config_file = load(config_file.read()) return parsed_config_...
976ce31aa1ce2256927ad6df2219f7105509eb9bca2abea2385b2df46c93c209
def create_and_validate_configurations(parsed_config_file: YAML=None) -> Config: '\n Run valdidation procedure for configuration information.\n ' if (parsed_config_file is None): parsed_config_file = extract_configurations_from_yml() _config = Config(package_config=PackageConfig(**parsed_confi...
Run valdidation procedure for configuration information.
costa_rica_poverty/packages/model/model/config/config.py
create_and_validate_configurations
Cawiess/costa_rica_poverty
0
python
def create_and_validate_configurations(parsed_config_file: YAML=None) -> Config: '\n \n ' if (parsed_config_file is None): parsed_config_file = extract_configurations_from_yml() _config = Config(package_config=PackageConfig(**parsed_config_file.data), preprocessing_config=PreprocessingConfig(*...
def create_and_validate_configurations(parsed_config_file: YAML=None) -> Config: '\n \n ' if (parsed_config_file is None): parsed_config_file = extract_configurations_from_yml() _config = Config(package_config=PackageConfig(**parsed_config_file.data), preprocessing_config=PreprocessingConfig(*...
1ca65446e529cf4cefa5d551080792ba1c0b88438be135186c9fb22247f655f6
def __genrandomstruct__(self): 'generating randomstruct' oxyz = self.xyz.copy() Ri = np.random.uniform(low=self.l_val, high=self.h_val, size=None) oxyz = (oxyz + (Ri * self.nmo)) return oxyz
generating randomstruct
lib/nmstools.py
__genrandomstruct__
Jussmith01/ANI-Tools
8
python
def __genrandomstruct__(self): oxyz = self.xyz.copy() Ri = np.random.uniform(low=self.l_val, high=self.h_val, size=None) oxyz = (oxyz + (Ri * self.nmo)) return oxyz
def __genrandomstruct__(self): oxyz = self.xyz.copy() Ri = np.random.uniform(low=self.l_val, high=self.h_val, size=None) oxyz = (oxyz + (Ri * self.nmo)) return oxyz<|docstring|>generating randomstruct<|endoftext|>
461019696e6f34db88e6bc7d83a7e539ecd453bbecda391e5c145ef07af7169d
def normalize_rgb_values(color: tuple) -> tuple: '\n Clean-up any slight color differences in PIL sampling.\n\n :param color: a tuple of RGB color values eg. (255, 255, 255)\n :returns: a tuple of RGB color values\n ' return tuple([(0 if (val <= 3) else (255 if (val >= 253) else val)) for val in col...
Clean-up any slight color differences in PIL sampling. :param color: a tuple of RGB color values eg. (255, 255, 255) :returns: a tuple of RGB color values
swatcher/color.py
normalize_rgb_values
joshbduncan/swatcher
0
python
def normalize_rgb_values(color: tuple) -> tuple: '\n Clean-up any slight color differences in PIL sampling.\n\n :param color: a tuple of RGB color values eg. (255, 255, 255)\n :returns: a tuple of RGB color values\n ' return tuple([(0 if (val <= 3) else (255 if (val >= 253) else val)) for val in col...
def normalize_rgb_values(color: tuple) -> tuple: '\n Clean-up any slight color differences in PIL sampling.\n\n :param color: a tuple of RGB color values eg. (255, 255, 255)\n :returns: a tuple of RGB color values\n ' return tuple([(0 if (val <= 3) else (255 if (val >= 253) else val)) for val in col...
74e8a9fef75226090d92d65d529e559fc1caae8b62ab8be933ddd141359fd2db
def rgb_2_luma(color: tuple) -> int: '\n Calculate the "brightness" of a color.\n\n ...and, yes I know this is a debated subject\n but this way works for just fine my purposes.\n\n :param color: a tuple of RGB color values eg. (255, 255, 255)\n :returns: luminance "brightness" value\n ' (r, g,...
Calculate the "brightness" of a color. ...and, yes I know this is a debated subject but this way works for just fine my purposes. :param color: a tuple of RGB color values eg. (255, 255, 255) :returns: luminance "brightness" value
swatcher/color.py
rgb_2_luma
joshbduncan/swatcher
0
python
def rgb_2_luma(color: tuple) -> int: '\n Calculate the "brightness" of a color.\n\n ...and, yes I know this is a debated subject\n but this way works for just fine my purposes.\n\n :param color: a tuple of RGB color values eg. (255, 255, 255)\n :returns: luminance "brightness" value\n ' (r, g,...
def rgb_2_luma(color: tuple) -> int: '\n Calculate the "brightness" of a color.\n\n ...and, yes I know this is a debated subject\n but this way works for just fine my purposes.\n\n :param color: a tuple of RGB color values eg. (255, 255, 255)\n :returns: luminance "brightness" value\n ' (r, g,...
8df9262c0b0db73f057ab79e59dfb9b66843ee60d05af3001c466a67964386a4
def sort_by_brightness(colors: list) -> list: '\n Sort of list of RGB colors values by their brightness.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: list of color value dictionaries\n ' l = {color: rgb_2_luma(color) for color in colors} return sorted(l, key=l....
Sort of list of RGB colors values by their brightness. :param color: tuple of RGB values for color eg. (255, 255, 255) :returns: list of color value dictionaries
swatcher/color.py
sort_by_brightness
joshbduncan/swatcher
0
python
def sort_by_brightness(colors: list) -> list: '\n Sort of list of RGB colors values by their brightness.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: list of color value dictionaries\n ' l = {color: rgb_2_luma(color) for color in colors} return sorted(l, key=l....
def sort_by_brightness(colors: list) -> list: '\n Sort of list of RGB colors values by their brightness.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: list of color value dictionaries\n ' l = {color: rgb_2_luma(color) for color in colors} return sorted(l, key=l....
9e46bdd4ebafabddd30c675e9d0f73203347566f808181f7e40bb96620e7ea06
def rgb_2_hex(color: tuple) -> str: '\n Convert RGB color vales to Hex code (eg. #ffffff).\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: color Hex code\n ' (r, g, b) = color return f'#{r:02x}{g:02x}{b:02x}'
Convert RGB color vales to Hex code (eg. #ffffff). :param color: tuple of RGB values for color eg. (255, 255, 255) :returns: color Hex code
swatcher/color.py
rgb_2_hex
joshbduncan/swatcher
0
python
def rgb_2_hex(color: tuple) -> str: '\n Convert RGB color vales to Hex code (eg. #ffffff).\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: color Hex code\n ' (r, g, b) = color return f'#{r:02x}{g:02x}{b:02x}'
def rgb_2_hex(color: tuple) -> str: '\n Convert RGB color vales to Hex code (eg. #ffffff).\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: color Hex code\n ' (r, g, b) = color return f'#{r:02x}{g:02x}{b:02x}'<|docstring|>Convert RGB color vales to Hex code (eg. #f...
0d0598aad30ebf071e3f8b57569e8d5144c34b663c53e681eeff8c6233f1f889
def rgb_2_cmyk(color: tuple) -> tuple: '\n Convert RGB color vales to CMYK color values.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: CMYK values eg. (C, M, Y, K)\n ' if (color == (0, 0, 0)): return (0, 0, 0, 100) (r, g, b) = color k = (1 - (max((r,...
Convert RGB color vales to CMYK color values. :param color: tuple of RGB values for color eg. (255, 255, 255) :returns: CMYK values eg. (C, M, Y, K)
swatcher/color.py
rgb_2_cmyk
joshbduncan/swatcher
0
python
def rgb_2_cmyk(color: tuple) -> tuple: '\n Convert RGB color vales to CMYK color values.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: CMYK values eg. (C, M, Y, K)\n ' if (color == (0, 0, 0)): return (0, 0, 0, 100) (r, g, b) = color k = (1 - (max((r,...
def rgb_2_cmyk(color: tuple) -> tuple: '\n Convert RGB color vales to CMYK color values.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: CMYK values eg. (C, M, Y, K)\n ' if (color == (0, 0, 0)): return (0, 0, 0, 100) (r, g, b) = color k = (1 - (max((r,...
a1336c0130cc307d89b1509a1b6a93996c3dea0127213434b3a1053d2d9e33af
def color_2_dict(color: tuple) -> dict: '\n Convert tuple of RGB color vales to HEX and CMYK then\n combine into a dictionary in the following format.\n\n {"rgb": (0, 0, 0), "hex": "#000000", "cmyk": (0, 0, 0, 100)}\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: RGB, ...
Convert tuple of RGB color vales to HEX and CMYK then combine into a dictionary in the following format. {"rgb": (0, 0, 0), "hex": "#000000", "cmyk": (0, 0, 0, 100)} :param color: tuple of RGB values for color eg. (255, 255, 255) :returns: RGB, HEX and CMYK values
swatcher/color.py
color_2_dict
joshbduncan/swatcher
0
python
def color_2_dict(color: tuple) -> dict: '\n Convert tuple of RGB color vales to HEX and CMYK then\n combine into a dictionary in the following format.\n\n {"rgb": (0, 0, 0), "hex": "#000000", "cmyk": (0, 0, 0, 100)}\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: RGB, ...
def color_2_dict(color: tuple) -> dict: '\n Convert tuple of RGB color vales to HEX and CMYK then\n combine into a dictionary in the following format.\n\n {"rgb": (0, 0, 0), "hex": "#000000", "cmyk": (0, 0, 0, 100)}\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: RGB, ...
72d548b4c3da78de241885e98dc1aad4625654bccd516d491edb880fedc36ca9
def colors_2_dicts(colors: list) -> list: '\n Convert a list of RGB color vales to a list of\n dicts with RGB, HEX, and CMYK values.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: list of color value dictionaries\n ' return [color_2_dict(color) for color in colors...
Convert a list of RGB color vales to a list of dicts with RGB, HEX, and CMYK values. :param color: tuple of RGB values for color eg. (255, 255, 255) :returns: list of color value dictionaries
swatcher/color.py
colors_2_dicts
joshbduncan/swatcher
0
python
def colors_2_dicts(colors: list) -> list: '\n Convert a list of RGB color vales to a list of\n dicts with RGB, HEX, and CMYK values.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: list of color value dictionaries\n ' return [color_2_dict(color) for color in colors...
def colors_2_dicts(colors: list) -> list: '\n Convert a list of RGB color vales to a list of\n dicts with RGB, HEX, and CMYK values.\n\n :param color: tuple of RGB values for color eg. (255, 255, 255)\n :returns: list of color value dictionaries\n ' return [color_2_dict(color) for color in colors...
8b5b3bb1c1fab7a9447d8368574c6e981f5a61ce6ca68e82d23497672ceb4201
def color_distance(color1: tuple, color2: tuple) -> int: '\n Calculate the Euclidean distance between two colors.\n\n https://en.wikipedia.org/wiki/Color_difference\n\n :param color1: tuple of RGB color values eg. (255, 255, 255)\n :param color2: tuple of RGB color values\n :returns: Euclidean distan...
Calculate the Euclidean distance between two colors. https://en.wikipedia.org/wiki/Color_difference :param color1: tuple of RGB color values eg. (255, 255, 255) :param color2: tuple of RGB color values :returns: Euclidean distance of two colors
swatcher/color.py
color_distance
joshbduncan/swatcher
0
python
def color_distance(color1: tuple, color2: tuple) -> int: '\n Calculate the Euclidean distance between two colors.\n\n https://en.wikipedia.org/wiki/Color_difference\n\n :param color1: tuple of RGB color values eg. (255, 255, 255)\n :param color2: tuple of RGB color values\n :returns: Euclidean distan...
def color_distance(color1: tuple, color2: tuple) -> int: '\n Calculate the Euclidean distance between two colors.\n\n https://en.wikipedia.org/wiki/Color_difference\n\n :param color1: tuple of RGB color values eg. (255, 255, 255)\n :param color2: tuple of RGB color values\n :returns: Euclidean distan...
8fc2ea9b2fa17e8a7727d77e6bdf2379325192deb0695a61d0d0dbc0828b2448
def get_colors(image: object) -> list: '\n Sample all pixels from an image and sort their RGB values by most common\n\n :param image: PIL Image object\n :returns: list of RGB tuples (255, 255, 255)\n ' colors = Counter([pixel for pixel in image.getdata()]) return [color for (color, _) in colors....
Sample all pixels from an image and sort their RGB values by most common :param image: PIL Image object :returns: list of RGB tuples (255, 255, 255)
swatcher/color.py
get_colors
joshbduncan/swatcher
0
python
def get_colors(image: object) -> list: '\n Sample all pixels from an image and sort their RGB values by most common\n\n :param image: PIL Image object\n :returns: list of RGB tuples (255, 255, 255)\n ' colors = Counter([pixel for pixel in image.getdata()]) return [color for (color, _) in colors....
def get_colors(image: object) -> list: '\n Sample all pixels from an image and sort their RGB values by most common\n\n :param image: PIL Image object\n :returns: list of RGB tuples (255, 255, 255)\n ' colors = Counter([pixel for pixel in image.getdata()]) return [color for (color, _) in colors....
6b76a04239ffde15001f2e46049a3194f75b1d11557fbf07b501d024676ed7b1
def get_worker_registrar_for(head): 'Return a class that will handle worker registration for the given head.' class WorkerRegistrarService(Service): 'An RPyC service to register workers with a head.' def exposed_register_worker(self, host, port): 'Register a worker with my head, in...
Return a class that will handle worker registration for the given head.
tgen/parallel_seq2seq_train.py
get_worker_registrar_for
schneider20/tgen
222
python
def get_worker_registrar_for(head): class WorkerRegistrarService(Service): 'An RPyC service to register workers with a head.' def exposed_register_worker(self, host, port): 'Register a worker with my head, initialize it.' log_info(('Worker %s:%d connected, initializing...
def get_worker_registrar_for(head): class WorkerRegistrarService(Service): 'An RPyC service to register workers with a head.' def exposed_register_worker(self, host, port): 'Register a worker with my head, initialize it.' log_info(('Worker %s:%d connected, initializing...
cf6fe97ce2190d1e760c9bd7552d8b0dcbf3fb72ede61f6947ac7af7223f76fd
def run_training(head_host, head_port, debug_out=None): 'Main worker training routine (creates the Seq2SeqTrainingService and connects it to the\n head.\n\n @param head_host: hostname of the head\n @param head_port: head port number\n @param debug_out: path to the debugging output file (debug output dis...
Main worker training routine (creates the Seq2SeqTrainingService and connects it to the head. @param head_host: hostname of the head @param head_port: head port number @param debug_out: path to the debugging output file (debug output discarded if None)
tgen/parallel_seq2seq_train.py
run_training
schneider20/tgen
222
python
def run_training(head_host, head_port, debug_out=None): 'Main worker training routine (creates the Seq2SeqTrainingService and connects it to the\n head.\n\n @param head_host: hostname of the head\n @param head_port: head port number\n @param debug_out: path to the debugging output file (debug output dis...
def run_training(head_host, head_port, debug_out=None): 'Main worker training routine (creates the Seq2SeqTrainingService and connects it to the\n head.\n\n @param head_host: hostname of the head\n @param head_port: head port number\n @param debug_out: path to the debugging output file (debug output dis...
3869d33bfa5b81dee685bc8f4d9b1f0f9b14fe5de56864b35e84583d04f688cf
def train(self, das_file, ttree_file, data_portion=1.0, context_file=None, validation_files=None): 'Run parallel perceptron training, start and manage workers.' log_info('Initializing...') self._init_server() log_info('Spawning jobs...') (host_short, _) = self.host.split('.', 1) for j in range(s...
Run parallel perceptron training, start and manage workers.
tgen/parallel_seq2seq_train.py
train
schneider20/tgen
222
python
def train(self, das_file, ttree_file, data_portion=1.0, context_file=None, validation_files=None): log_info('Initializing...') self._init_server() log_info('Spawning jobs...') (host_short, _) = self.host.split('.', 1) for j in range(self.jobs_number): debug_logfile = (('"PRT%02d.debug-o...
def train(self, das_file, ttree_file, data_portion=1.0, context_file=None, validation_files=None): log_info('Initializing...') self._init_server() log_info('Spawning jobs...') (host_short, _) = self.host.split('.', 1) for j in range(self.jobs_number): debug_logfile = (('"PRT%02d.debug-o...
97f2dfb3de785e17d3482387d3bd6c341be0aecde0ebd844f16482911ed5da5b
def _check_pending_request(self, sc, job_no, req): 'Check whether the given request has finished (i.e., job is loaded or job has\n processed the given data portion.\n\n If the request is finished, the worker that processed it is moved to the pool\n of free services.\n\n @param iter_no: c...
Check whether the given request has finished (i.e., job is loaded or job has processed the given data portion. If the request is finished, the worker that processed it is moved to the pool of free services. @param iter_no: current iteration number (for logging) @param sc: a ServiceConn object that stores the worker c...
tgen/parallel_seq2seq_train.py
_check_pending_request
schneider20/tgen
222
python
def _check_pending_request(self, sc, job_no, req): 'Check whether the given request has finished (i.e., job is loaded or job has\n processed the given data portion.\n\n If the request is finished, the worker that processed it is moved to the pool\n of free services.\n\n @param iter_no: c...
def _check_pending_request(self, sc, job_no, req): 'Check whether the given request has finished (i.e., job is loaded or job has\n processed the given data portion.\n\n If the request is finished, the worker that processed it is moved to the pool\n of free services.\n\n @param iter_no: c...
a929ed9c7e1610876e90c2d602ada1f0fe35c7ba087bda361119eafc78ba469e
def _init_server(self): 'Initializes a server that registers new workers.' registrar_class = get_worker_registrar_for(self) n_tries = 0 self.server = None last_error = None while ((self.server is None) and (n_tries < 10)): try: n_tries += 1 self.server = ThreadPoo...
Initializes a server that registers new workers.
tgen/parallel_seq2seq_train.py
_init_server
schneider20/tgen
222
python
def _init_server(self): registrar_class = get_worker_registrar_for(self) n_tries = 0 self.server = None last_error = None while ((self.server is None) and (n_tries < 10)): try: n_tries += 1 self.server = ThreadPoolServer(service=registrar_class, nbThreads=1, port...
def _init_server(self): registrar_class = get_worker_registrar_for(self) n_tries = 0 self.server = None last_error = None while ((self.server is None) and (n_tries < 10)): try: n_tries += 1 self.server = ThreadPoolServer(service=registrar_class, nbThreads=1, port...
c0289781dd099ef76a405e6fbee4636dd53b1787bf4eb84ea76302efc090bb7b
def save_to_file(self, model_fname): 'This will actually just move the best generator (which is saved in a temporary file)\n to the final location.' log_info(('Moving generator to %s...' % model_fname)) orig_model_fname = self.model_temp_path shutil.move(orig_model_fname, model_fname) orig_tf...
This will actually just move the best generator (which is saved in a temporary file) to the final location.
tgen/parallel_seq2seq_train.py
save_to_file
schneider20/tgen
222
python
def save_to_file(self, model_fname): 'This will actually just move the best generator (which is saved in a temporary file)\n to the final location.' log_info(('Moving generator to %s...' % model_fname)) orig_model_fname = self.model_temp_path shutil.move(orig_model_fname, model_fname) orig_tf...
def save_to_file(self, model_fname): 'This will actually just move the best generator (which is saved in a temporary file)\n to the final location.' log_info(('Moving generator to %s...' % model_fname)) orig_model_fname = self.model_temp_path shutil.move(orig_model_fname, model_fname) orig_tf...
88f0b25a8d0970f292c8f7d97d6ce8f352eea43105a277bcd7f1a2f6a9e6d370
def build_ensemble_model(self, results): 'Load the models computed by the individual jobs and compose them into a single\n ensemble model.\n\n @param results: list of tuples (cost, ServiceConn object), where cost is not used' ensemble = Seq2SeqEnsemble(self.cfg) models = [] for (_, sc) in ...
Load the models computed by the individual jobs and compose them into a single ensemble model. @param results: list of tuples (cost, ServiceConn object), where cost is not used
tgen/parallel_seq2seq_train.py
build_ensemble_model
schneider20/tgen
222
python
def build_ensemble_model(self, results): 'Load the models computed by the individual jobs and compose them into a single\n ensemble model.\n\n @param results: list of tuples (cost, ServiceConn object), where cost is not used' ensemble = Seq2SeqEnsemble(self.cfg) models = [] for (_, sc) in ...
def build_ensemble_model(self, results): 'Load the models computed by the individual jobs and compose them into a single\n ensemble model.\n\n @param results: list of tuples (cost, ServiceConn object), where cost is not used' ensemble = Seq2SeqEnsemble(self.cfg) models = [] for (_, sc) in ...
e910177b001692621666204a8af7f415263d401ebfe2d6c57cdb5e102ea76163
def exposed_init_training(self, cfg): 'Create the Seq2SeqGen object.' cfg = pickle.loads(cfg) tstart = time.time() log_info('Initializing training...') self.seq2seq = Seq2SeqGen(cfg) log_info(('Training initialized. Time taken: %f secs.' % (time.time() - tstart)))
Create the Seq2SeqGen object.
tgen/parallel_seq2seq_train.py
exposed_init_training
schneider20/tgen
222
python
def exposed_init_training(self, cfg): cfg = pickle.loads(cfg) tstart = time.time() log_info('Initializing training...') self.seq2seq = Seq2SeqGen(cfg) log_info(('Training initialized. Time taken: %f secs.' % (time.time() - tstart)))
def exposed_init_training(self, cfg): cfg = pickle.loads(cfg) tstart = time.time() log_info('Initializing training...') self.seq2seq = Seq2SeqGen(cfg) log_info(('Training initialized. Time taken: %f secs.' % (time.time() - tstart)))<|docstring|>Create the Seq2SeqGen object.<|endoftext|>
278c73819d3eb6d7e997e1b284e2f4d489c89cec83da26a9c4ef70982be6efd9
def exposed_train(self, rnd_seed, das_file, ttree_file, data_portion, context_file, validation_files): 'Run the whole training.\n ' rnd.seed(rnd_seed) log_info(('Random seed: %f' % rnd_seed)) tstart = time.time() log_info('Starting training...') self.seq2seq.train(das_file, ttree_file, da...
Run the whole training.
tgen/parallel_seq2seq_train.py
exposed_train
schneider20/tgen
222
python
def exposed_train(self, rnd_seed, das_file, ttree_file, data_portion, context_file, validation_files): '\n ' rnd.seed(rnd_seed) log_info(('Random seed: %f' % rnd_seed)) tstart = time.time() log_info('Starting training...') self.seq2seq.train(das_file, ttree_file, data_portion, context_fil...
def exposed_train(self, rnd_seed, das_file, ttree_file, data_portion, context_file, validation_files): '\n ' rnd.seed(rnd_seed) log_info(('Random seed: %f' % rnd_seed)) tstart = time.time() log_info('Starting training...') self.seq2seq.train(das_file, ttree_file, data_portion, context_fil...
f4e5078bc2e9d3c299cce111abff46066da5ce2a1b1829c91fb0a6ce62a752fb
def exposed_save_model(self, model_fname): "Save the model to the given file (must be given relative to the worker's working\n directory!).\n @param model_fname: target path where to save the model (relative to worker's working directory)\n " self.seq2seq.save_to_file(model_...
Save the model to the given file (must be given relative to the worker's working directory!). @param model_fname: target path where to save the model (relative to worker's working directory)
tgen/parallel_seq2seq_train.py
exposed_save_model
schneider20/tgen
222
python
def exposed_save_model(self, model_fname): "Save the model to the given file (must be given relative to the worker's working\n directory!).\n @param model_fname: target path where to save the model (relative to worker's working directory)\n " self.seq2seq.save_to_file(model_...
def exposed_save_model(self, model_fname): "Save the model to the given file (must be given relative to the worker's working\n directory!).\n @param model_fname: target path where to save the model (relative to worker's working directory)\n " self.seq2seq.save_to_file(model_...
96e94d97761df30e982f581b95ce81fa12dec17394abed2d83402a0047d781b8
def exposed_get_model_params(self): "Retrieve all parameters of the worker's local model (as a dictionary)\n @return: model parameters in a pickled dictionary -- keys are names, values are numpy arrays\n " p_dump = pickle.dumps(self.seq2seq.get_model_params(), protocol=pickle.HIGHEST_PROTOCOL) ...
Retrieve all parameters of the worker's local model (as a dictionary) @return: model parameters in a pickled dictionary -- keys are names, values are numpy arrays
tgen/parallel_seq2seq_train.py
exposed_get_model_params
schneider20/tgen
222
python
def exposed_get_model_params(self): "Retrieve all parameters of the worker's local model (as a dictionary)\n @return: model parameters in a pickled dictionary -- keys are names, values are numpy arrays\n " p_dump = pickle.dumps(self.seq2seq.get_model_params(), protocol=pickle.HIGHEST_PROTOCOL) ...
def exposed_get_model_params(self): "Retrieve all parameters of the worker's local model (as a dictionary)\n @return: model parameters in a pickled dictionary -- keys are names, values are numpy arrays\n " p_dump = pickle.dumps(self.seq2seq.get_model_params(), protocol=pickle.HIGHEST_PROTOCOL) ...
41e39d4ce8280375c23a89461f9861fcd57bb33499a886e040ee7e4ca6301cbb
def exposed_get_all_settings(self): 'Call `get_all_settings` on the worker and return the result as a pickle.' settings = pickle.dumps(self.seq2seq.get_all_settings(), protocol=pickle.HIGHEST_PROTOCOL) return settings
Call `get_all_settings` on the worker and return the result as a pickle.
tgen/parallel_seq2seq_train.py
exposed_get_all_settings
schneider20/tgen
222
python
def exposed_get_all_settings(self): settings = pickle.dumps(self.seq2seq.get_all_settings(), protocol=pickle.HIGHEST_PROTOCOL) return settings
def exposed_get_all_settings(self): settings = pickle.dumps(self.seq2seq.get_all_settings(), protocol=pickle.HIGHEST_PROTOCOL) return settings<|docstring|>Call `get_all_settings` on the worker and return the result as a pickle.<|endoftext|>
cfeb87a24cc9de9476998de9706008b8fbd321e360fb5c8cef8d32d4f76f676a
def exposed_get_rerank_params(self): "Call `get_model_params` on the worker's reranker and return the result as a pickle." if (not self.seq2seq.classif_filter): return None p_dump = pickle.dumps(self.seq2seq.classif_filter.get_model_params(), protocol=pickle.HIGHEST_PROTOCOL) return p_dump
Call `get_model_params` on the worker's reranker and return the result as a pickle.
tgen/parallel_seq2seq_train.py
exposed_get_rerank_params
schneider20/tgen
222
python
def exposed_get_rerank_params(self): if (not self.seq2seq.classif_filter): return None p_dump = pickle.dumps(self.seq2seq.classif_filter.get_model_params(), protocol=pickle.HIGHEST_PROTOCOL) return p_dump
def exposed_get_rerank_params(self): if (not self.seq2seq.classif_filter): return None p_dump = pickle.dumps(self.seq2seq.classif_filter.get_model_params(), protocol=pickle.HIGHEST_PROTOCOL) return p_dump<|docstring|>Call `get_model_params` on the worker's reranker and return the result as a pi...
dfcc42685b5d50d07c7c65807a0c44055fd5830945b39bc51a6529fe19809f28
def exposed_get_rerank_settings(self): "Call `get_all_settings` on the worker's reranker and return the result as a pickle." if (not self.seq2seq.classif_filter): return None settings = pickle.dumps(self.seq2seq.classif_filter.get_all_settings(), protocol=pickle.HIGHEST_PROTOCOL) return settings
Call `get_all_settings` on the worker's reranker and return the result as a pickle.
tgen/parallel_seq2seq_train.py
exposed_get_rerank_settings
schneider20/tgen
222
python
def exposed_get_rerank_settings(self): if (not self.seq2seq.classif_filter): return None settings = pickle.dumps(self.seq2seq.classif_filter.get_all_settings(), protocol=pickle.HIGHEST_PROTOCOL) return settings
def exposed_get_rerank_settings(self): if (not self.seq2seq.classif_filter): return None settings = pickle.dumps(self.seq2seq.classif_filter.get_all_settings(), protocol=pickle.HIGHEST_PROTOCOL) return settings<|docstring|>Call `get_all_settings` on the worker's reranker and return the result a...
3a17389ed453a77c8ac95d3a67496b2993c98476bc2d5f9d4cb94282003ba822
def exposed_register_worker(self, host, port): 'Register a worker with my head, initialize it.' log_info(('Worker %s:%d connected, initializing training.' % (host, port))) conn = connect(host, port, config={'allow_pickle': True}) init_func = async_(conn.root.init_training) head.cfg['scope_suffix'] =...
Register a worker with my head, initialize it.
tgen/parallel_seq2seq_train.py
exposed_register_worker
schneider20/tgen
222
python
def exposed_register_worker(self, host, port): log_info(('Worker %s:%d connected, initializing training.' % (host, port))) conn = connect(host, port, config={'allow_pickle': True}) init_func = async_(conn.root.init_training) head.cfg['scope_suffix'] = hashlib.md5(('%s:%d' % (host, port))).hexdigest...
def exposed_register_worker(self, host, port): log_info(('Worker %s:%d connected, initializing training.' % (host, port))) conn = connect(host, port, config={'allow_pickle': True}) init_func = async_(conn.root.init_training) head.cfg['scope_suffix'] = hashlib.md5(('%s:%d' % (host, port))).hexdigest...
64cb90bb146c85f0e11adef8163a314f4a42996e3ad3152e4a2ba67bef930958
def insert_items(table_name: str, columns: List[str], values: List[List[Union[(str, int, float)]]]) -> str: '\n 单表插入\n 支持同时插入多条记录\n Args:\n table_name: 要插入的表名\n columns: 指明要插入的表属性,必须包含表中没有默认参数的属性,不允许为空列表\n values: 对应要插入的属性的值列表,列表里每个值要与colums对应\n Return:\n "success"\n Example:\n insert_...
单表插入 支持同时插入多条记录 Args: table_name: 要插入的表名 columns: 指明要插入的表属性,必须包含表中没有默认参数的属性,不允许为空列表 values: 对应要插入的属性的值列表,列表里每个值要与colums对应 Return: "success" Example: insert_items(table_name='person', columns=['name', 'age'], values=[['周杰伦', 30], ['马云', 35]])
dao/crud.py
insert_items
leexinhao/boya-backend
0
python
def insert_items(table_name: str, columns: List[str], values: List[List[Union[(str, int, float)]]]) -> str: '\n 单表插入\n 支持同时插入多条记录\n Args:\n table_name: 要插入的表名\n columns: 指明要插入的表属性,必须包含表中没有默认参数的属性,不允许为空列表\n values: 对应要插入的属性的值列表,列表里每个值要与colums对应\n Return:\n "success"\n Example:\n insert_...
def insert_items(table_name: str, columns: List[str], values: List[List[Union[(str, int, float)]]]) -> str: '\n 单表插入\n 支持同时插入多条记录\n Args:\n table_name: 要插入的表名\n columns: 指明要插入的表属性,必须包含表中没有默认参数的属性,不允许为空列表\n values: 对应要插入的属性的值列表,列表里每个值要与colums对应\n Return:\n "success"\n Example:\n insert_...
8fa5881bba8fbcd3bcb7196f4b95604a3930bbd6bbae51f5833d2ade16321384
def delete_items(table_name: str, where: Optional[Dict[(str, Union[(str, int, float)])]]=None) -> str: '\n 单表删除\n 一次可以根据传入条件删除多条记录,注意传入where要小心,不然很容易误删\n 如果指定的条件对应的记录不存在也会返回success\n Args:\n table_name: 要删除的表名\n where: 要删除的条件键值对,若为None或空字典删除整个表或所有指定的colums条目,目前只能使用=判断\n Return:\n {"code": 20...
单表删除 一次可以根据传入条件删除多条记录,注意传入where要小心,不然很容易误删 如果指定的条件对应的记录不存在也会返回success Args: table_name: 要删除的表名 where: 要删除的条件键值对,若为None或空字典删除整个表或所有指定的colums条目,目前只能使用=判断 Return: {"code": 200, "message": "success"} Example: delete_items(table_name='person', where={"name": "周杰伦", "age": 30})
dao/crud.py
delete_items
leexinhao/boya-backend
0
python
def delete_items(table_name: str, where: Optional[Dict[(str, Union[(str, int, float)])]]=None) -> str: '\n 单表删除\n 一次可以根据传入条件删除多条记录,注意传入where要小心,不然很容易误删\n 如果指定的条件对应的记录不存在也会返回success\n Args:\n table_name: 要删除的表名\n where: 要删除的条件键值对,若为None或空字典删除整个表或所有指定的colums条目,目前只能使用=判断\n Return:\n {"code": 20...
def delete_items(table_name: str, where: Optional[Dict[(str, Union[(str, int, float)])]]=None) -> str: '\n 单表删除\n 一次可以根据传入条件删除多条记录,注意传入where要小心,不然很容易误删\n 如果指定的条件对应的记录不存在也会返回success\n Args:\n table_name: 要删除的表名\n where: 要删除的条件键值对,若为None或空字典删除整个表或所有指定的colums条目,目前只能使用=判断\n Return:\n {"code": 20...
53bbb0bb2d3a9f0e98d9d8314a10cc0c5acf9ef3b281aabd58cdb5c502e8728d
def select_items(table_name: str, columns: Optional[List[str]]=None, where: Optional[Dict[(str, Union[(str, int, float)])]]=None, limit: Optional[int]=None, skip: int=0, use_like=False) -> List[Dict[(str, Union[(str, int, float)])]]: "\n 单表查询\n Args:\n table_name: 要查询的表名\n columns: 要查询的属性,若为None或空列表则返回全...
单表查询 Args: table_name: 要查询的表名 columns: 要查询的属性,若为None或空列表则返回全部属性 where: 要查询的条件键值对,若为None或空字典返回整个表或所有指定的colums条目,目前只能使用=判断 limit: 返回条目的最大数量,为None时全部返回 skip: 返回条目的查询偏移 Return: 一个包含数个查询条目的列表 Example: select_items(table_name='person', columns=['name', 'age'], where={'name':'周杰伦', 'age':20})
dao/crud.py
select_items
leexinhao/boya-backend
0
python
def select_items(table_name: str, columns: Optional[List[str]]=None, where: Optional[Dict[(str, Union[(str, int, float)])]]=None, limit: Optional[int]=None, skip: int=0, use_like=False) -> List[Dict[(str, Union[(str, int, float)])]]: "\n 单表查询\n Args:\n table_name: 要查询的表名\n columns: 要查询的属性,若为None或空列表则返回全...
def select_items(table_name: str, columns: Optional[List[str]]=None, where: Optional[Dict[(str, Union[(str, int, float)])]]=None, limit: Optional[int]=None, skip: int=0, use_like=False) -> List[Dict[(str, Union[(str, int, float)])]]: "\n 单表查询\n Args:\n table_name: 要查询的表名\n columns: 要查询的属性,若为None或空列表则返回全...
1c02ee727d4b8a79a3b837ad3e8cb18ea3a6ef53058687ca212c97b85dedccd1
def update_items(table_name: str, items: Dict[(str, Union[(str, int, float)])], where: Optional[Dict[(str, Union[(str, int, float)])]]=None) -> str: '\n 单表更新\n Args:\n table_name: 要更新的表名\n items: 要更新的属性与值,若为None或者大小为0则不更新\n where: 要更新的条件键值对,若为None或空字典更新整个表或所有指定的colums条目,目前只能使用=判断\n Return:\n {"...
单表更新 Args: table_name: 要更新的表名 items: 要更新的属性与值,若为None或者大小为0则不更新 where: 要更新的条件键值对,若为None或空字典更新整个表或所有指定的colums条目,目前只能使用=判断 Return: {"code": 200, "message": "success"} Example: update_items(table_name='person', items={'name': 'Jay', 'age': 21}, where={'name': '周杰伦', 'age': 20})
dao/crud.py
update_items
leexinhao/boya-backend
0
python
def update_items(table_name: str, items: Dict[(str, Union[(str, int, float)])], where: Optional[Dict[(str, Union[(str, int, float)])]]=None) -> str: '\n 单表更新\n Args:\n table_name: 要更新的表名\n items: 要更新的属性与值,若为None或者大小为0则不更新\n where: 要更新的条件键值对,若为None或空字典更新整个表或所有指定的colums条目,目前只能使用=判断\n Return:\n {"...
def update_items(table_name: str, items: Dict[(str, Union[(str, int, float)])], where: Optional[Dict[(str, Union[(str, int, float)])]]=None) -> str: '\n 单表更新\n Args:\n table_name: 要更新的表名\n items: 要更新的属性与值,若为None或者大小为0则不更新\n where: 要更新的条件键值对,若为None或空字典更新整个表或所有指定的colums条目,目前只能使用=判断\n Return:\n {"...
1e6bed32b0a21551a8643aabc4b2934df50dc375eea32f283ae46800fd9def2c
def hold(unit: 'Unit', seperation: float, direction: float) -> None: 'This unit will never move' unit.hold()
This unit will never move
src/stratgey.py
hold
alexdawn/battle-cogitator
1
python
def hold(unit: 'Unit', seperation: float, direction: float) -> None: unit.hold()
def hold(unit: 'Unit', seperation: float, direction: float) -> None: unit.hold()<|docstring|>This unit will never move<|endoftext|>
53532cd40a3dcb5c9706879b54d4bab8cf388936c0dcf387e0c5462afaf941f8
def slow_advance(unit: 'Unit', seperation: float, direction: float) -> None: 'This unit will move into range and hold' if (seperation > unit.max_effective_range()): unit.move(min(unit.unit_movement(), (seperation - unit.max_effective_range())), direction) else: unit.hold()
This unit will move into range and hold
src/stratgey.py
slow_advance
alexdawn/battle-cogitator
1
python
def slow_advance(unit: 'Unit', seperation: float, direction: float) -> None: if (seperation > unit.max_effective_range()): unit.move(min(unit.unit_movement(), (seperation - unit.max_effective_range())), direction) else: unit.hold()
def slow_advance(unit: 'Unit', seperation: float, direction: float) -> None: if (seperation > unit.max_effective_range()): unit.move(min(unit.unit_movement(), (seperation - unit.max_effective_range())), direction) else: unit.hold()<|docstring|>This unit will move into range and hold<|endoft...
717862329067f809e3e10608dc3269043e89dce3299a82accab68bbfacc3282e
def charge(unit: 'Unit', seperation: float, direction: float) -> None: 'This unit will move, shoot and attempt to charge when in range' if (seperation > (12 + unit.unit_movement())): unit.move(unit.unit_movement(), direction) elif (seperation > 1): unit.move(min(unit.unit_movement(), (sepera...
This unit will move, shoot and attempt to charge when in range
src/stratgey.py
charge
alexdawn/battle-cogitator
1
python
def charge(unit: 'Unit', seperation: float, direction: float) -> None: if (seperation > (12 + unit.unit_movement())): unit.move(unit.unit_movement(), direction) elif (seperation > 1): unit.move(min(unit.unit_movement(), (seperation - 1)), direction) else: unit.hold()
def charge(unit: 'Unit', seperation: float, direction: float) -> None: if (seperation > (12 + unit.unit_movement())): unit.move(unit.unit_movement(), direction) elif (seperation > 1): unit.move(min(unit.unit_movement(), (seperation - 1)), direction) else: unit.hold()<|docstring|...
cf525eff76b4b67d244b6ffd44bf3f1751b0796ae973efc2a4781b52fdffa7da
def headlong_charge(unit: 'Unit', seperation: float, direction: float) -> None: 'This unit will move as fast as it can, then charge' if (seperation > (12 + unit.unit_movement())): unit.advance(unit.unit_movement(), direction) elif (seperation > 1): unit.move(min(unit.unit_movement(), (sepera...
This unit will move as fast as it can, then charge
src/stratgey.py
headlong_charge
alexdawn/battle-cogitator
1
python
def headlong_charge(unit: 'Unit', seperation: float, direction: float) -> None: if (seperation > (12 + unit.unit_movement())): unit.advance(unit.unit_movement(), direction) elif (seperation > 1): unit.move(min(unit.unit_movement(), (seperation - 1)), direction) else: unit.hold()
def headlong_charge(unit: 'Unit', seperation: float, direction: float) -> None: if (seperation > (12 + unit.unit_movement())): unit.advance(unit.unit_movement(), direction) elif (seperation > 1): unit.move(min(unit.unit_movement(), (seperation - 1)), direction) else: unit.hold()...
8e88f80c7e7efe52367fd44d6a58b8a6753f58d69c0849e5c49ae1bf2031135c
def keep_seperation(unit: 'Unit', seperation: float, direction: float) -> None: 'This unit will actively try and keep its range from enemies' if unit.engaged: unit.fall_back(unit.unit_movement(), (- direction)) elif (seperation < unit.max_effective_range()): unit.move(min(unit.unit_movement(...
This unit will actively try and keep its range from enemies
src/stratgey.py
keep_seperation
alexdawn/battle-cogitator
1
python
def keep_seperation(unit: 'Unit', seperation: float, direction: float) -> None: if unit.engaged: unit.fall_back(unit.unit_movement(), (- direction)) elif (seperation < unit.max_effective_range()): unit.move(min(unit.unit_movement(), (unit.max_effective_range() - seperation)), (- direction))...
def keep_seperation(unit: 'Unit', seperation: float, direction: float) -> None: if unit.engaged: unit.fall_back(unit.unit_movement(), (- direction)) elif (seperation < unit.max_effective_range()): unit.move(min(unit.unit_movement(), (unit.max_effective_range() - seperation)), (- direction))...
d022024079d6ecfba32ab14a0bb35bb5800f99fa49681d31abc787af055427c5
def query(self, question): '\n Args:\n - quesion (str) : utterance\n Return:\n result (dict) { \n "answers" (list) ,\n "ner_response" (list of dict),\n "answer_dislay" (list): \n }\n ' entities = self.ner.inferenc...
Args: - quesion (str) : utterance Return: result (dict) { "answers" (list) , "ner_response" (list of dict), "answer_dislay" (list): }
src/search_engine/entity_search.py
query
phamnam-mta/know-life
0
python
def query(self, question): '\n Args:\n - quesion (str) : utterance\n Return:\n result (dict) { \n "answers" (list) ,\n "ner_response" (list of dict),\n "answer_dislay" (list): \n }\n ' entities = self.ner.inferenc...
def query(self, question): '\n Args:\n - quesion (str) : utterance\n Return:\n result (dict) { \n "answers" (list) ,\n "ner_response" (list of dict),\n "answer_dislay" (list): \n }\n ' entities = self.ner.inferenc...
4ff00235968a576c2c3d35946cc162876880dba1505e38919a569eb43a13636a
def query_single_entity(self, entity, relation): '\n Return:\n - result (list)\n - kb_answer (list)\n ' results = [] scores = [] kb_answer = [] result = '' for sample in self.database: if (SYNONYM_KEY in sample): for synonym in sample[SYNON...
Return: - result (list) - kb_answer (list)
src/search_engine/entity_search.py
query_single_entity
phamnam-mta/know-life
0
python
def query_single_entity(self, entity, relation): '\n Return:\n - result (list)\n - kb_answer (list)\n ' results = [] scores = [] kb_answer = [] result = for sample in self.database: if (SYNONYM_KEY in sample): for synonym in sample[SYNONYM...
def query_single_entity(self, entity, relation): '\n Return:\n - result (list)\n - kb_answer (list)\n ' results = [] scores = [] kb_answer = [] result = for sample in self.database: if (SYNONYM_KEY in sample): for synonym in sample[SYNONYM...
d8216f21b56497bcba420a57d010f13e5a90a53de0bbd267dfbd846b02282ba3
def main(args=None): 'The main routine.' if (args is None): args = sys.argv[1:] app = TimecardGenerator() app.run()
The main routine.
timecardgenerator/__main__.py
main
TBPixel/Sage300-TimecardGenerator
0
python
def main(args=None): if (args is None): args = sys.argv[1:] app = TimecardGenerator() app.run()
def main(args=None): if (args is None): args = sys.argv[1:] app = TimecardGenerator() app.run()<|docstring|>The main routine.<|endoftext|>
2928013096e7dd225d4ece838f324e21920bfa88b5bb694c9412bc7ed7f8736c
async def set_isolation_level(self, connection, level): '\n Given an asyncpg connection, set its isolation level.\n\n ' level = level.replace('_', ' ') if (level not in self._isolation_lookup): raise exc.ArgumentError(("Invalid value '%s' for isolation_level. Valid isolation levels for...
Given an asyncpg connection, set its isolation level.
src/gino/dialects/asyncpg.py
set_isolation_level
wwwjfy/gino
1,376
python
async def set_isolation_level(self, connection, level): '\n \n\n ' level = level.replace('_', ' ') if (level not in self._isolation_lookup): raise exc.ArgumentError(("Invalid value '%s' for isolation_level. Valid isolation levels for %s are %s" % (level, self.name, ', '.join(self._isol...
async def set_isolation_level(self, connection, level): '\n \n\n ' level = level.replace('_', ' ') if (level not in self._isolation_lookup): raise exc.ArgumentError(("Invalid value '%s' for isolation_level. Valid isolation levels for %s are %s" % (level, self.name, ', '.join(self._isol...
e4ced2191b0fb960d9b0c98b3ea4ad963479e4f3388030c56faccf8b44af30c2
async def get_isolation_level(self, connection): '\n Given an asyncpg connection, return its isolation level.\n\n ' val = (await connection.fetchval('show transaction isolation level')) return val.upper()
Given an asyncpg connection, return its isolation level.
src/gino/dialects/asyncpg.py
get_isolation_level
wwwjfy/gino
1,376
python
async def get_isolation_level(self, connection): '\n \n\n ' val = (await connection.fetchval('show transaction isolation level')) return val.upper()
async def get_isolation_level(self, connection): '\n \n\n ' val = (await connection.fetchval('show transaction isolation level')) return val.upper()<|docstring|>Given an asyncpg connection, return its isolation level.<|endoftext|>
a2171c156266c597b6bf0d5f5ae01ab2d9b0a9d3973cfdc57fba9080a490220a
def _temporal_cross_entropy_loss(logits, labels, label_lengths, mx_seq_length): 'Do cross-entropy loss accounting for sequence lengths\n\n :param logits: a `Tensor` with shape `[timesteps, batch, timesteps, vocab]`\n :param labels: an integer `Tensor` with shape `[batch, timesteps]`\n :param label_lengths:...
Do cross-entropy loss accounting for sequence lengths :param logits: a `Tensor` with shape `[timesteps, batch, timesteps, vocab]` :param labels: an integer `Tensor` with shape `[batch, timesteps]` :param label_lengths: The actual length of the target text. Assume right-padded :param mx_seq_length: The maximum length ...
baseline/tf/seq2seq/model.py
_temporal_cross_entropy_loss
sagnik/baseline
20
python
def _temporal_cross_entropy_loss(logits, labels, label_lengths, mx_seq_length): 'Do cross-entropy loss accounting for sequence lengths\n\n :param logits: a `Tensor` with shape `[timesteps, batch, timesteps, vocab]`\n :param labels: an integer `Tensor` with shape `[batch, timesteps]`\n :param label_lengths:...
def _temporal_cross_entropy_loss(logits, labels, label_lengths, mx_seq_length): 'Do cross-entropy loss accounting for sequence lengths\n\n :param logits: a `Tensor` with shape `[timesteps, batch, timesteps, vocab]`\n :param labels: an integer `Tensor` with shape `[batch, timesteps]`\n :param label_lengths:...
41afc2ae8a3101ea12a6bbf9429ce206d167bdb4b827a659c9a23d0e7a33b094
def embed(self, inputs): 'This method performs "embedding" of the inputs. The base method here then concatenates along depth\n dimension to form word embeddings\n\n :return: A 3-d vector where the last dimension is the concatenated dimensions of all embeddings\n ' return self.s...
This method performs "embedding" of the inputs. The base method here then concatenates along depth dimension to form word embeddings :return: A 3-d vector where the last dimension is the concatenated dimensions of all embeddings
baseline/tf/seq2seq/model.py
embed
sagnik/baseline
20
python
def embed(self, inputs): 'This method performs "embedding" of the inputs. The base method here then concatenates along depth\n dimension to form word embeddings\n\n :return: A 3-d vector where the last dimension is the concatenated dimensions of all embeddings\n ' return self.s...
def embed(self, inputs): 'This method performs "embedding" of the inputs. The base method here then concatenates along depth\n dimension to form word embeddings\n\n :return: A 3-d vector where the last dimension is the concatenated dimensions of all embeddings\n ' return self.s...
98c1620715b9bc0efe4cb54fabd0ab99655f4c7ecdb9df818f412d67614e6cfa
def step(self, batch_dict): '\n Generate probability distribution over output V for next token\n ' feed_dict = self.make_input(batch_dict) x = self.sess.run(self.decoder.probs, feed_dict=feed_dict) return x
Generate probability distribution over output V for next token
baseline/tf/seq2seq/model.py
step
sagnik/baseline
20
python
def step(self, batch_dict): '\n \n ' feed_dict = self.make_input(batch_dict) x = self.sess.run(self.decoder.probs, feed_dict=feed_dict) return x
def step(self, batch_dict): '\n \n ' feed_dict = self.make_input(batch_dict) x = self.sess.run(self.decoder.probs, feed_dict=feed_dict) return x<|docstring|>Generate probability distribution over output V for next token<|endoftext|>
60c6394c275aea106db9cf9ac7c5dfabad4e6585497c0f9c9326a1d74a5f1942
def make_input(self, batch_dict: Dict[(str, TensorDef)], train: bool=False) -> Dict[(str, TensorDef)]: 'Transform a `batch_dict` into format suitable for tagging\n :param batch_dict: (``dict``) A dictionary containing all inputs to the embeddings for this model\n :param train: (``bool``) Are w...
Transform a `batch_dict` into format suitable for tagging :param batch_dict: (``dict``) A dictionary containing all inputs to the embeddings for this model :param train: (``bool``) Are we training. Defaults to False :return: A dictionary representation of this batch suitable for processing
baseline/tf/seq2seq/model.py
make_input
sagnik/baseline
20
python
def make_input(self, batch_dict: Dict[(str, TensorDef)], train: bool=False) -> Dict[(str, TensorDef)]: 'Transform a `batch_dict` into format suitable for tagging\n :param batch_dict: (``dict``) A dictionary containing all inputs to the embeddings for this model\n :param train: (``bool``) Are w...
def make_input(self, batch_dict: Dict[(str, TensorDef)], train: bool=False) -> Dict[(str, TensorDef)]: 'Transform a `batch_dict` into format suitable for tagging\n :param batch_dict: (``dict``) A dictionary containing all inputs to the embeddings for this model\n :param train: (``bool``) Are w...
53252b07e24f1452c391dc3bd9462164285a6c29e58b0e57906f8c46c3c7f17a
def drop_inputs(self, key, x, do_dropout): 'Do dropout on inputs, using the dropout value (or none if not set)\n This works by applying a dropout mask with the probability given by a\n value within the `dropin_value: Dict[str, float]`, keyed off the text name\n of the feature\n ...
Do dropout on inputs, using the dropout value (or none if not set) This works by applying a dropout mask with the probability given by a value within the `dropin_value: Dict[str, float]`, keyed off the text name of the feature :param key: The feature name :param x: The tensor to drop inputs for :param do_dropout: A `bo...
baseline/tf/seq2seq/model.py
drop_inputs
sagnik/baseline
20
python
def drop_inputs(self, key, x, do_dropout): 'Do dropout on inputs, using the dropout value (or none if not set)\n This works by applying a dropout mask with the probability given by a\n value within the `dropin_value: Dict[str, float]`, keyed off the text name\n of the feature\n ...
def drop_inputs(self, key, x, do_dropout): 'Do dropout on inputs, using the dropout value (or none if not set)\n This works by applying a dropout mask with the probability given by a\n value within the `dropin_value: Dict[str, float]`, keyed off the text name\n of the feature\n ...
4808f044382012b34fda9725f665d3e444947ef9625b7df3863509da81e92371
def init_embed(self, src_embeddings, tgt_embedding, **kwargs): 'This is the hook for providing embeddings. It takes in a dictionary of `src_embeddings` and a single\n tgt_embedding` of type `PyTorchEmbedding`\n :param src_embeddings: (``dict``) A dictionary of PyTorchEmbeddings, one per embed...
This is the hook for providing embeddings. It takes in a dictionary of `src_embeddings` and a single tgt_embedding` of type `PyTorchEmbedding` :param src_embeddings: (``dict``) A dictionary of PyTorchEmbeddings, one per embedding :param tgt_embedding: (``PyTorchEmbeddings``) A single PyTorchEmbeddings object :param kw...
baseline/tf/seq2seq/model.py
init_embed
sagnik/baseline
20
python
def init_embed(self, src_embeddings, tgt_embedding, **kwargs): 'This is the hook for providing embeddings. It takes in a dictionary of `src_embeddings` and a single\n tgt_embedding` of type `PyTorchEmbedding`\n :param src_embeddings: (``dict``) A dictionary of PyTorchEmbeddings, one per embed...
def init_embed(self, src_embeddings, tgt_embedding, **kwargs): 'This is the hook for providing embeddings. It takes in a dictionary of `src_embeddings` and a single\n tgt_embedding` of type `PyTorchEmbedding`\n :param src_embeddings: (``dict``) A dictionary of PyTorchEmbeddings, one per embed...
3ba01c0372179dfe29e9add56b2c56492b5fff127632f3b5fbf11db779319b98
def encode(self, input, lengths): '\n\n :param input:\n :param lengths:\n :return:\n ' embed_in_seq = self.embed(input) return self.encoder((embed_in_seq, lengths))
:param input: :param lengths: :return:
baseline/tf/seq2seq/model.py
encode
sagnik/baseline
20
python
def encode(self, input, lengths): '\n\n :param input:\n :param lengths:\n :return:\n ' embed_in_seq = self.embed(input) return self.encoder((embed_in_seq, lengths))
def encode(self, input, lengths): '\n\n :param input:\n :param lengths:\n :return:\n ' embed_in_seq = self.embed(input) return self.encoder((embed_in_seq, lengths))<|docstring|>:param input: :param lengths: :return:<|endoftext|>
b0ea69133d551a41fb231c17aa0e46dd9c2a316d4d4e9c7525a2fde6ec31b0a6
def save_values(self, basename): 'Save tensor files out\n\n :param basename: Base name of model\n :return:\n ' self.save_weights(f'{basename}.wgt')
Save tensor files out :param basename: Base name of model :return:
baseline/tf/seq2seq/model.py
save_values
sagnik/baseline
20
python
def save_values(self, basename): 'Save tensor files out\n\n :param basename: Base name of model\n :return:\n ' self.save_weights(f'{basename}.wgt')
def save_values(self, basename): 'Save tensor files out\n\n :param basename: Base name of model\n :return:\n ' self.save_weights(f'{basename}.wgt')<|docstring|>Save tensor files out :param basename: Base name of model :return:<|endoftext|>
fb1f9765c85be169387777bed544012ab45a9ce2ca50ebc4d16faaf9be3927cd
def predict(self, inputs, **kwargs): 'Predict based on the batch.\n\n If `make_input` is True then run make_input on the batch_dict.\n This is false for being used during dev eval where the inputs\n are already transformed.\n ' SET_TRAIN_FLAG(False) make = kwargs....
Predict based on the batch. If `make_input` is True then run make_input on the batch_dict. This is false for being used during dev eval where the inputs are already transformed.
baseline/tf/seq2seq/model.py
predict
sagnik/baseline
20
python
def predict(self, inputs, **kwargs): 'Predict based on the batch.\n\n If `make_input` is True then run make_input on the batch_dict.\n This is false for being used during dev eval where the inputs\n are already transformed.\n ' SET_TRAIN_FLAG(False) make = kwargs....
def predict(self, inputs, **kwargs): 'Predict based on the batch.\n\n If `make_input` is True then run make_input on the batch_dict.\n This is false for being used during dev eval where the inputs\n are already transformed.\n ' SET_TRAIN_FLAG(False) make = kwargs....
776678b78f288945264cfec4e26787b46bb594ddb75d3a53aa20f2973e57db83
def __init__(self, src_embeddings, tgt_embedding, **kwargs): 'This base model is extensible for attention and other uses. It declares minimal fields allowing the\n subclass to take over most of the duties for drastically different implementations\n\n :param src_embeddings: (``dict``) A dictio...
This base model is extensible for attention and other uses. It declares minimal fields allowing the subclass to take over most of the duties for drastically different implementations :param src_embeddings: (``dict``) A dictionary of PyTorchEmbeddings :param tgt_embedding: (``PyTorchEmbeddings``) A single PyTorchEmbed...
baseline/tf/seq2seq/model.py
__init__
sagnik/baseline
20
python
def __init__(self, src_embeddings, tgt_embedding, **kwargs): 'This base model is extensible for attention and other uses. It declares minimal fields allowing the\n subclass to take over most of the duties for drastically different implementations\n\n :param src_embeddings: (``dict``) A dictio...
def __init__(self, src_embeddings, tgt_embedding, **kwargs): 'This base model is extensible for attention and other uses. It declares minimal fields allowing the\n subclass to take over most of the duties for drastically different implementations\n\n :param src_embeddings: (``dict``) A dictio...
4c9f50890162355adfa88ddf3cebbf14163b90bfc631e9dc94e649f53e47c89e
def __init__(self, sync_async_store: pa.PersistenceAdaptor=None, work_description_store: pa.PersistenceAdaptor=None, resynchroniser: sync_async_resynchroniser.SyncAsyncResynchroniser=None): 'Create a new SyncAsyncWorkflow that uses the specified dependencies to load config, build a message and\n send it.\n ...
Create a new SyncAsyncWorkflow that uses the specified dependencies to load config, build a message and send it. :param sync_async_store: The resynchronisor state store :param work_description_store: The persistence store instance that holds the work description data :param sync_async_store_retry_delay: time between sy...
mhs/common/mhs_common/workflow/sync_async.py
__init__
petervdm/integration-adaptors
15
python
def __init__(self, sync_async_store: pa.PersistenceAdaptor=None, work_description_store: pa.PersistenceAdaptor=None, resynchroniser: sync_async_resynchroniser.SyncAsyncResynchroniser=None): 'Create a new SyncAsyncWorkflow that uses the specified dependencies to load config, build a message and\n send it.\n ...
def __init__(self, sync_async_store: pa.PersistenceAdaptor=None, work_description_store: pa.PersistenceAdaptor=None, resynchroniser: sync_async_resynchroniser.SyncAsyncResynchroniser=None): 'Create a new SyncAsyncWorkflow that uses the specified dependencies to load config, build a message and\n send it.\n ...
357fdc1a79e085b5318336d553e4bfe46bb00ad1166053a91cf5e7750d33b302
@pytest.mark.parametrize('code,expected_kinds', [['def fun(a): pass', [POSITIONAL_OR_KEYWORD]], ['def fun(a, b): pass', ([POSITIONAL_OR_KEYWORD] * 2)], ['def fun(a, b, /): pass', ([POSITIONAL_ONLY] * 2)], ['def fun(a, b, /, c): pass', [POSITIONAL_ONLY, POSITIONAL_ONLY, POSITIONAL_OR_KEYWORD]], ['def fun(a, b, *args): p...
Tests that it processes argument names correctly
tests/utils/test_get_argument_kinds.py
test_it_processes_argument_kinds_correctly
marco-rubio/sphinx-ast-autodoc
0
python
@pytest.mark.parametrize('code,expected_kinds', [['def fun(a): pass', [POSITIONAL_OR_KEYWORD]], ['def fun(a, b): pass', ([POSITIONAL_OR_KEYWORD] * 2)], ['def fun(a, b, /): pass', ([POSITIONAL_ONLY] * 2)], ['def fun(a, b, /, c): pass', [POSITIONAL_ONLY, POSITIONAL_ONLY, POSITIONAL_OR_KEYWORD]], ['def fun(a, b, *args): p...
@pytest.mark.parametrize('code,expected_kinds', [['def fun(a): pass', [POSITIONAL_OR_KEYWORD]], ['def fun(a, b): pass', ([POSITIONAL_OR_KEYWORD] * 2)], ['def fun(a, b, /): pass', ([POSITIONAL_ONLY] * 2)], ['def fun(a, b, /, c): pass', [POSITIONAL_ONLY, POSITIONAL_ONLY, POSITIONAL_OR_KEYWORD]], ['def fun(a, b, *args): p...
70e34169b2a38de9bf7e043b5ca89f0137d559afe54db66d2d30e573adc1615d
def cleanup(self) -> None: ' Closes the database connection' self.conn.close()
Closes the database connection
postr/schedule/reader.py
cleanup
dbgrigsby/Postr
3
python
def cleanup(self) -> None: ' ' self.conn.close()
def cleanup(self) -> None: ' ' self.conn.close()<|docstring|>Closes the database connection<|endoftext|>
4a1bb8d66283ea1d7c030965067ad7910aee6779bd00a92fdb17e43e7645f72c
@classmethod def now(cls) -> int: ' Returns the current time ' return int(dt.now().timestamp())
Returns the current time
postr/schedule/reader.py
now
dbgrigsby/Postr
3
python
@classmethod def now(cls) -> int: ' ' return int(dt.now().timestamp())
@classmethod def now(cls) -> int: ' ' return int(dt.now().timestamp())<|docstring|>Returns the current time<|endoftext|>
79b18950d81c10b11ec06d040dc69dbb45f5e1e92cf56c83cc3f26f691bcb715
def scan_custom_jobs(self, seconds: int=30) -> List[Dict[(str, Any)]]: " Scans jobs every 'seconds' seconds, and returns a JSON\n object representing any jobs to be operated on " lower = self.schedule_range(seconds) upper = self.now() self.cursor.execute(f'''SELECT * FROM CustomJob ...
Scans jobs every 'seconds' seconds, and returns a JSON object representing any jobs to be operated on
postr/schedule/reader.py
scan_custom_jobs
dbgrigsby/Postr
3
python
def scan_custom_jobs(self, seconds: int=30) -> List[Dict[(str, Any)]]: " Scans jobs every 'seconds' seconds, and returns a JSON\n object representing any jobs to be operated on " lower = self.schedule_range(seconds) upper = self.now() self.cursor.execute(f'SELECT * FROM CustomJob ...
def scan_custom_jobs(self, seconds: int=30) -> List[Dict[(str, Any)]]: " Scans jobs every 'seconds' seconds, and returns a JSON\n object representing any jobs to be operated on " lower = self.schedule_range(seconds) upper = self.now() self.cursor.execute(f'SELECT * FROM CustomJob ...
a5884fa5bcf6951099f00b115af1b0e2c11fafa09dc2cb12754892e95ea5ef91
async def scan(self) -> Any: ' Scans every 30 seconds for new jobs in the past 30 seconds ' while True: time.sleep(30) tasks = self.scan_custom_jobs() cleaned_tasks = [clean_empty_strings(task) for task in tasks] (await process_scheduler_events(cleaned_tasks))
Scans every 30 seconds for new jobs in the past 30 seconds
postr/schedule/reader.py
scan
dbgrigsby/Postr
3
python
async def scan(self) -> Any: ' ' while True: time.sleep(30) tasks = self.scan_custom_jobs() cleaned_tasks = [clean_empty_strings(task) for task in tasks] (await process_scheduler_events(cleaned_tasks))
async def scan(self) -> Any: ' ' while True: time.sleep(30) tasks = self.scan_custom_jobs() cleaned_tasks = [clean_empty_strings(task) for task in tasks] (await process_scheduler_events(cleaned_tasks))<|docstring|>Scans every 30 seconds for new jobs in the past 30 seconds<|endof...
b22cc9fc586aca663d241a9c3e3ff3dae8467f8da787ad4a0cd13f84b6393054
def schedule_range(self, seconds: int) -> int: ' Returns the lower bound for a scheduled range ' now = self.now() return (now - seconds)
Returns the lower bound for a scheduled range
postr/schedule/reader.py
schedule_range
dbgrigsby/Postr
3
python
def schedule_range(self, seconds: int) -> int: ' ' now = self.now() return (now - seconds)
def schedule_range(self, seconds: int) -> int: ' ' now = self.now() return (now - seconds)<|docstring|>Returns the lower bound for a scheduled range<|endoftext|>
e4156cf88966d6c07b164c274db63df3fbc0f1b0832592eaaf0e25e940bd902e
def degree_prune(graph, max_degree=20): 'Prune the k-neighbors graph back so that nodes have a maximum\n degree of ``max_degree``.\n\n Parameters\n ----------\n graph: sparse matrix\n The adjacency matrix of the graph\n\n max_degree: int (optional, default 20)\n The maximum degree of an...
Prune the k-neighbors graph back so that nodes have a maximum degree of ``max_degree``. Parameters ---------- graph: sparse matrix The adjacency matrix of the graph max_degree: int (optional, default 20) The maximum degree of any node in the pruned graph Returns ------- result: sparse matrix The pruned g...
pynndescent/pynndescent_.py
degree_prune
yupbank/pynndescent
0
python
def degree_prune(graph, max_degree=20): 'Prune the k-neighbors graph back so that nodes have a maximum\n degree of ``max_degree``.\n\n Parameters\n ----------\n graph: sparse matrix\n The adjacency matrix of the graph\n\n max_degree: int (optional, default 20)\n The maximum degree of an...
def degree_prune(graph, max_degree=20): 'Prune the k-neighbors graph back so that nodes have a maximum\n degree of ``max_degree``.\n\n Parameters\n ----------\n graph: sparse matrix\n The adjacency matrix of the graph\n\n max_degree: int (optional, default 20)\n The maximum degree of an...
1a7f81a6949a263866c54ee8b810bc0a6ac849a6f0a61bcee932829362bf35ea
def prune(graph, prune_level=0, n_neighbors=10): 'Perform pruning on the graph so that there are fewer edges to\n be followed. In practice this operates in two passes. The first pass\n removes edges such that no node has degree more than ``3 * n_neighbors -\n prune_level``. The second pass builds up a grap...
Perform pruning on the graph so that there are fewer edges to be followed. In practice this operates in two passes. The first pass removes edges such that no node has degree more than ``3 * n_neighbors - prune_level``. The second pass builds up a graph out of spanning trees; each iteration constructs a minimum panning ...
pynndescent/pynndescent_.py
prune
yupbank/pynndescent
0
python
def prune(graph, prune_level=0, n_neighbors=10): 'Perform pruning on the graph so that there are fewer edges to\n be followed. In practice this operates in two passes. The first pass\n removes edges such that no node has degree more than ``3 * n_neighbors -\n prune_level``. The second pass builds up a grap...
def prune(graph, prune_level=0, n_neighbors=10): 'Perform pruning on the graph so that there are fewer edges to\n be followed. In practice this operates in two passes. The first pass\n removes edges such that no node has degree more than ``3 * n_neighbors -\n prune_level``. The second pass builds up a grap...
fbbb6baa7b83d7a47ad2ca75911f7c30fad0155927346b32a6dc2bc964415cb8
def query(self, query_data, k=10, queue_size=5.0): 'Query the training data for the k nearest neighbors\n\n Parameters\n ----------\n query_data: array-like, last dimension self.dim\n An array of points to query\n\n k: integer (default = 10)\n The number of nearest ...
Query the training data for the k nearest neighbors Parameters ---------- query_data: array-like, last dimension self.dim An array of points to query k: integer (default = 10) The number of nearest neighbors to return queue_size: float (default 5.0) The multiplier of the internal search queue. This contr...
pynndescent/pynndescent_.py
query
yupbank/pynndescent
0
python
def query(self, query_data, k=10, queue_size=5.0): 'Query the training data for the k nearest neighbors\n\n Parameters\n ----------\n query_data: array-like, last dimension self.dim\n An array of points to query\n\n k: integer (default = 10)\n The number of nearest ...
def query(self, query_data, k=10, queue_size=5.0): 'Query the training data for the k nearest neighbors\n\n Parameters\n ----------\n query_data: array-like, last dimension self.dim\n An array of points to query\n\n k: integer (default = 10)\n The number of nearest ...
e08d055a05280624476f0c88a5f89036e2b54c87e44553bc2c71225ff5cbad8f
def fit(self, X): 'Fit the PyNNDescent transformer to build KNN graphs with\n neighbors given by the dataset X.\n\n Parameters\n ----------\n X : array-like, shape (n_samples, n_features)\n Sample data\n\n Returns\n -------\n transformer : PyNNDescentTrans...
Fit the PyNNDescent transformer to build KNN graphs with neighbors given by the dataset X. Parameters ---------- X : array-like, shape (n_samples, n_features) Sample data Returns ------- transformer : PyNNDescentTransformer The trained transformer
pynndescent/pynndescent_.py
fit
yupbank/pynndescent
0
python
def fit(self, X): 'Fit the PyNNDescent transformer to build KNN graphs with\n neighbors given by the dataset X.\n\n Parameters\n ----------\n X : array-like, shape (n_samples, n_features)\n Sample data\n\n Returns\n -------\n transformer : PyNNDescentTrans...
def fit(self, X): 'Fit the PyNNDescent transformer to build KNN graphs with\n neighbors given by the dataset X.\n\n Parameters\n ----------\n X : array-like, shape (n_samples, n_features)\n Sample data\n\n Returns\n -------\n transformer : PyNNDescentTrans...
6da5d2922c15e5c3ef1eea1ac8f7f9cf7bec8a90b987a0ac5097435fb67a67ed
def transform(self, X, y=None): 'Computes the (weighted) graph of Neighbors for points in X\n\n Parameters\n ----------\n X : array-like, shape (n_samples_transform, n_features)\n Sample data\n\n Returns\n -------\n Xt : CSR sparse matrix, shape (n_samples_fit, n...
Computes the (weighted) graph of Neighbors for points in X Parameters ---------- X : array-like, shape (n_samples_transform, n_features) Sample data Returns ------- Xt : CSR sparse matrix, shape (n_samples_fit, n_samples_transform) Xt[i, j] is assigned the weight of edge that connects i to j. Only the nei...
pynndescent/pynndescent_.py
transform
yupbank/pynndescent
0
python
def transform(self, X, y=None): 'Computes the (weighted) graph of Neighbors for points in X\n\n Parameters\n ----------\n X : array-like, shape (n_samples_transform, n_features)\n Sample data\n\n Returns\n -------\n Xt : CSR sparse matrix, shape (n_samples_fit, n...
def transform(self, X, y=None): 'Computes the (weighted) graph of Neighbors for points in X\n\n Parameters\n ----------\n X : array-like, shape (n_samples_transform, n_features)\n Sample data\n\n Returns\n -------\n Xt : CSR sparse matrix, shape (n_samples_fit, n...
8ed833a7428b3b126a3cd0e9226e4222164b49e6680613c6591906e19ce1a827
def fit_transform(self, X, y=None, **fit_params): 'Fit to data, then transform it.\n\n Fits transformer to X and y with optional parameters fit_params\n and returns a transformed version of X.\n\n Parameters\n ----------\n X : numpy array of shape (n_samples, n_features)\n ...
Fit to data, then transform it. Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X. Parameters ---------- X : numpy array of shape (n_samples, n_features) Training set. y : ignored Returns ------- Xt : CSR sparse matrix, shape (n_samples, n_samples) Xt[i, ...
pynndescent/pynndescent_.py
fit_transform
yupbank/pynndescent
0
python
def fit_transform(self, X, y=None, **fit_params): 'Fit to data, then transform it.\n\n Fits transformer to X and y with optional parameters fit_params\n and returns a transformed version of X.\n\n Parameters\n ----------\n X : numpy array of shape (n_samples, n_features)\n ...
def fit_transform(self, X, y=None, **fit_params): 'Fit to data, then transform it.\n\n Fits transformer to X and y with optional parameters fit_params\n and returns a transformed version of X.\n\n Parameters\n ----------\n X : numpy array of shape (n_samples, n_features)\n ...
31a3c86890022d77e9ffeb480a7effe2f34bbc19c422c975fb59cb2b92b00597
def encrypt_text(text: StrOrBytes, password: str=None) -> bytes: 'Encrypts text.\n\n Args:\n text (StrOrBytes): text to encrypt.\n password (str, optional): password to encrypt the file. If None,\n the user will have to type it. Defaults to None.\n\n Returns:\n bytes: text encr...
Encrypts text. Args: text (StrOrBytes): text to encrypt. password (str, optional): password to encrypt the file. If None, the user will have to type it. Defaults to None. Returns: bytes: text encrypted.
aes/text.py
encrypt_text
sralloza/aes
0
python
def encrypt_text(text: StrOrBytes, password: str=None) -> bytes: 'Encrypts text.\n\n Args:\n text (StrOrBytes): text to encrypt.\n password (str, optional): password to encrypt the file. If None,\n the user will have to type it. Defaults to None.\n\n Returns:\n bytes: text encr...
def encrypt_text(text: StrOrBytes, password: str=None) -> bytes: 'Encrypts text.\n\n Args:\n text (StrOrBytes): text to encrypt.\n password (str, optional): password to encrypt the file. If None,\n the user will have to type it. Defaults to None.\n\n Returns:\n bytes: text encr...
31b67c8db9635f71ac129e8ddfa7b892dfb6eab16ad919dbef85e2be0075033c
def decrypt_text(text: StrOrBytes, password: str=None) -> bytes: "Decrypts text.\n\n Args:\n text (StrOrBytes): text to decrypt.\n password (str, optional): password to decrypt the file. If None,\n the user will have to type it. Defaults to None.\n\n Raises:\n IncorrectPassword...
Decrypts text. Args: text (StrOrBytes): text to decrypt. password (str, optional): password to decrypt the file. If None, the user will have to type it. Defaults to None. Raises: IncorrectPasswordError: if the AES algorithm doesn't work due to an incorrect password. Returns: bytes: te...
aes/text.py
decrypt_text
sralloza/aes
0
python
def decrypt_text(text: StrOrBytes, password: str=None) -> bytes: "Decrypts text.\n\n Args:\n text (StrOrBytes): text to decrypt.\n password (str, optional): password to decrypt the file. If None,\n the user will have to type it. Defaults to None.\n\n Raises:\n IncorrectPassword...
def decrypt_text(text: StrOrBytes, password: str=None) -> bytes: "Decrypts text.\n\n Args:\n text (StrOrBytes): text to decrypt.\n password (str, optional): password to decrypt the file. If None,\n the user will have to type it. Defaults to None.\n\n Raises:\n IncorrectPassword...
690ce9ed801ce1436c042d68474c46ff8ae9fdc4d8df627c04efec07c263d814
def remediate(session, alert, lambda_context): '\n Main Function invoked by index_prisma.py\n ' resource = None region = alert['region'] ec2 = session.client('ec2', region_name=region) try: eips = ec2.describe_addresses()['Addresses'] except ClientError as e: print(e.response['...
Main Function invoked by index_prisma.py
AWS/lambda_package/runbooks/AWS-VPC-013.py
remediate
nathanawmk/Prisma-Enhanced-Remediation
34
python
def remediate(session, alert, lambda_context): '\n \n ' resource = None region = alert['region'] ec2 = session.client('ec2', region_name=region) try: eips = ec2.describe_addresses()['Addresses'] except ClientError as e: print(e.response['Error']['Message']) return u...
def remediate(session, alert, lambda_context): '\n \n ' resource = None region = alert['region'] ec2 = session.client('ec2', region_name=region) try: eips = ec2.describe_addresses()['Addresses'] except ClientError as e: print(e.response['Error']['Message']) return u...
7a5685afdbc6c16a7b3f67a4dc58adf26bcad7233e335d8470d87fa4a458cfdc
def __init__(self, temboo_session): '\n Create a new instance of the SpacialFeaturesSearch Choreo. A TembooSession object, containing a valid\n set of Temboo credentials, must be supplied.\n ' super(SpacialFeaturesSearch, self).__init__(temboo_session, '/Library/UnlockPlaces/SpacialFeatures...
Create a new instance of the SpacialFeaturesSearch Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
__init__
jordanemedlock/psychtruths
7
python
def __init__(self, temboo_session): '\n Create a new instance of the SpacialFeaturesSearch Choreo. A TembooSession object, containing a valid\n set of Temboo credentials, must be supplied.\n ' super(SpacialFeaturesSearch, self).__init__(temboo_session, '/Library/UnlockPlaces/SpacialFeatures...
def __init__(self, temboo_session): '\n Create a new instance of the SpacialFeaturesSearch Choreo. A TembooSession object, containing a valid\n set of Temboo credentials, must be supplied.\n ' super(SpacialFeaturesSearch, self).__init__(temboo_session, '/Library/UnlockPlaces/SpacialFeatures...
93b4fb65117e0e32903881110e7cac5357f35fd9fc9a046931069a72a155f47d
def set_FeatureType(self, value): '\n Set the value of the FeatureType input for this Choreo. ((string) The feature type that the place is (i.e. "Cities"). See http://unlock.edina.ac.uk/ws/supportedFeatureTypes?format=txt for a complete list of supported Feature Types.)\n ' super(SpacialFeaturesSe...
Set the value of the FeatureType input for this Choreo. ((string) The feature type that the place is (i.e. "Cities"). See http://unlock.edina.ac.uk/ws/supportedFeatureTypes?format=txt for a complete list of supported Feature Types.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_FeatureType
jordanemedlock/psychtruths
7
python
def set_FeatureType(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('FeatureType', value)
def set_FeatureType(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('FeatureType', value)<|docstring|>Set the value of the FeatureType input for this Choreo. ((string) The feature type that the place is (i.e. "Cities"). See http://unlock.edina.ac.uk/ws/supportedFeature...
8bbfb53f4977627b1ff94b74a65b017000cec138a71276ed547115ed6d95ba0f
def set_Format(self, value): '\n Set the value of the Format input for this Choreo. ((optional, string) The format of the place search results. One of xml, kml, json, georss or txt. Defaults to "xml".)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Format', value)
Set the value of the Format input for this Choreo. ((optional, string) The format of the place search results. One of xml, kml, json, georss or txt. Defaults to "xml".)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_Format
jordanemedlock/psychtruths
7
python
def set_Format(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Format', value)
def set_Format(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Format', value)<|docstring|>Set the value of the Format input for this Choreo. ((optional, string) The format of the place search results. One of xml, kml, json, georss or txt. Defaults to "xml".)<|endofte...
a5b0ffdc8c39c8a5e823d85e3e9d3d7480492d239337ae659aa6e91fb3e9bce4
def set_Gazetteer(self, value): '\n Set the value of the Gazetteer input for this Choreo. ((optional, string) The place-name source to take locations from. The options are geonames, os, naturalearth or unlock which combines all the previous. Defaults to "unlock".)\n ' super(SpacialFeaturesSearchIn...
Set the value of the Gazetteer input for this Choreo. ((optional, string) The place-name source to take locations from. The options are geonames, os, naturalearth or unlock which combines all the previous. Defaults to "unlock".)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_Gazetteer
jordanemedlock/psychtruths
7
python
def set_Gazetteer(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Gazetteer', value)
def set_Gazetteer(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Gazetteer', value)<|docstring|>Set the value of the Gazetteer input for this Choreo. ((optional, string) The place-name source to take locations from. The options are geonames, os, naturalearth or unloc...
0d57d6e7a84b11f0ec30b6c6e5827829bad8a45b696af1ff855b27cb6ae91187
def set_MaxLatitude(self, value): '\n Set the value of the MaxLatitude input for this Choreo. ((decimal) The maximum latitude point of a bounding box.)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxLatitude', value)
Set the value of the MaxLatitude input for this Choreo. ((decimal) The maximum latitude point of a bounding box.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_MaxLatitude
jordanemedlock/psychtruths
7
python
def set_MaxLatitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxLatitude', value)
def set_MaxLatitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxLatitude', value)<|docstring|>Set the value of the MaxLatitude input for this Choreo. ((decimal) The maximum latitude point of a bounding box.)<|endoftext|>
75e30e7c1fba1fb59d468c3220f6a3a83f56195a3e638aaa669fe0622c2f3a3f
def set_MaxLongitude(self, value): '\n Set the value of the MaxLongitude input for this Choreo. ((decimal) The maximum longitude point of a bounding box.)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxLongitude', value)
Set the value of the MaxLongitude input for this Choreo. ((decimal) The maximum longitude point of a bounding box.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_MaxLongitude
jordanemedlock/psychtruths
7
python
def set_MaxLongitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxLongitude', value)
def set_MaxLongitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxLongitude', value)<|docstring|>Set the value of the MaxLongitude input for this Choreo. ((decimal) The maximum longitude point of a bounding box.)<|endoftext|>
45094b63cc4e5d0ed743f2f2b363da83f2db02bcb246475fe7fcf0fb6c49b081
def set_MaxRows(self, value): '\n Set the value of the MaxRows input for this Choreo. ((optional, integer) The maximum number of results to return. Defaults to 20. Cannot exceed 1000.)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxRows', value)
Set the value of the MaxRows input for this Choreo. ((optional, integer) The maximum number of results to return. Defaults to 20. Cannot exceed 1000.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_MaxRows
jordanemedlock/psychtruths
7
python
def set_MaxRows(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxRows', value)
def set_MaxRows(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MaxRows', value)<|docstring|>Set the value of the MaxRows input for this Choreo. ((optional, integer) The maximum number of results to return. Defaults to 20. Cannot exceed 1000.)<|endoftext|>
6d4d15b6d9b2549c9a8faa9458e322b6cb234e4a2833d6ff1cc101bf7427dc65
def set_MinLatitude(self, value): '\n Set the value of the MinLatitude input for this Choreo. ((decimal) The minimum latitude point of a bounding box.)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MinLatitude', value)
Set the value of the MinLatitude input for this Choreo. ((decimal) The minimum latitude point of a bounding box.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_MinLatitude
jordanemedlock/psychtruths
7
python
def set_MinLatitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MinLatitude', value)
def set_MinLatitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MinLatitude', value)<|docstring|>Set the value of the MinLatitude input for this Choreo. ((decimal) The minimum latitude point of a bounding box.)<|endoftext|>
e638407d4e8f71ab64f5f236e4507e46fb351a287b69450d663e265a8632cab2
def set_MinLongitude(self, value): '\n Set the value of the MinLongitude input for this Choreo. ((decimal) The minimum longitude point of a bounding box.)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MinLongitude', value)
Set the value of the MinLongitude input for this Choreo. ((decimal) The minimum longitude point of a bounding box.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_MinLongitude
jordanemedlock/psychtruths
7
python
def set_MinLongitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MinLongitude', value)
def set_MinLongitude(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('MinLongitude', value)<|docstring|>Set the value of the MinLongitude input for this Choreo. ((decimal) The minimum longitude point of a bounding box.)<|endoftext|>
9a2a42afd8ef301dbc6b93199d0c8cc821589bffbea6ea656b2bf1ea1a6fad9c
def set_Operator(self, value): '\n Set the value of the Operator input for this Choreo. (Valid values are: "within" and "intersect". The results will therefore be entirely within, or overlapping with (intersecting), the bounding box. Defaults to "within".)\n ' super(SpacialFeaturesSearchInputSet, ...
Set the value of the Operator input for this Choreo. (Valid values are: "within" and "intersect". The results will therefore be entirely within, or overlapping with (intersecting), the bounding box. Defaults to "within".)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_Operator
jordanemedlock/psychtruths
7
python
def set_Operator(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Operator', value)
def set_Operator(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('Operator', value)<|docstring|>Set the value of the Operator input for this Choreo. (Valid values are: "within" and "intersect". The results will therefore be entirely within, or overlapping with (interse...
17ec1e4060a8b97fda8193292242c64bde8cc595ae800b6562c15a5b2f3cf0be
def set_StartRow(self, value): '\n Set the value of the StartRow input for this Choreo. ((optional, integer) The row to start results display from. Defaults to 1.)\n ' super(SpacialFeaturesSearchInputSet, self)._set_input('StartRow', value)
Set the value of the StartRow input for this Choreo. ((optional, integer) The row to start results display from. Defaults to 1.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
set_StartRow
jordanemedlock/psychtruths
7
python
def set_StartRow(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('StartRow', value)
def set_StartRow(self, value): '\n \n ' super(SpacialFeaturesSearchInputSet, self)._set_input('StartRow', value)<|docstring|>Set the value of the StartRow input for this Choreo. ((optional, integer) The row to start results display from. Defaults to 1.)<|endoftext|>
903db85b29fdabcd6cde9351247086ecd192732d71cb1c45be1e973f9ff48627
def get_Response(self): '\n Retrieve the value for the "Response" output from this Choreo execution. ((XML) The response from Unlock. Defaults to XML based on the format input parameter.)\n ' return self._output.get('Response', None)
Retrieve the value for the "Response" output from this Choreo execution. ((XML) The response from Unlock. Defaults to XML based on the format input parameter.)
temboo/core/Library/UnlockPlaces/SpacialFeaturesSearch.py
get_Response
jordanemedlock/psychtruths
7
python
def get_Response(self): '\n \n ' return self._output.get('Response', None)
def get_Response(self): '\n \n ' return self._output.get('Response', None)<|docstring|>Retrieve the value for the "Response" output from this Choreo execution. ((XML) The response from Unlock. Defaults to XML based on the format input parameter.)<|endoftext|>
e5f402993ba4c499abe40c24fcf66917917eed26045359fd34af0e7463aa4f0c
def test_student_code(): 'Homemade unit test for student work\n Return True if all of the tests pass\n Return False if at least one test fails' test1 = False test2 = False test3 = False print('<h2>Testing your code...</h2>') if (recursive_power(5, 5) == 3125): test1 = True ...
Homemade unit test for student work Return True if all of the tests pass Return False if at least one test fails
.guides/secure/unit_tests/recursion/lab_challenge_test.py
test_student_code
codio-content/cs-intro-python-fundamentals
0
python
def test_student_code(): 'Homemade unit test for student work\n Return True if all of the tests pass\n Return False if at least one test fails' test1 = False test2 = False test3 = False print('<h2>Testing your code...</h2>') if (recursive_power(5, 5) == 3125): test1 = True ...
def test_student_code(): 'Homemade unit test for student work\n Return True if all of the tests pass\n Return False if at least one test fails' test1 = False test2 = False test3 = False print('<h2>Testing your code...</h2>') if (recursive_power(5, 5) == 3125): test1 = True ...
699f9a839bb04e8900d0aba1202b079dfc1547b7c86ded3a4bda5094e20b7316
def create_or_update_packages(self, child_inst): '\n Since m2m and foreignkey accept objects in their set\n ' child_instances = [] for data in child_inst: (child_instance, _) = self.child.objects.update_or_create(pk=data.get('id'), defaults=data) child_instances.append(child_in...
Since m2m and foreignkey accept objects in their set
backend/core/utils.py
create_or_update_packages
harryface/cbt-django-react
0
python
def create_or_update_packages(self, child_inst): '\n \n ' child_instances = [] for data in child_inst: (child_instance, _) = self.child.objects.update_or_create(pk=data.get('id'), defaults=data) child_instances.append(child_instance) return child_instances
def create_or_update_packages(self, child_inst): '\n \n ' child_instances = [] for data in child_inst: (child_instance, _) = self.child.objects.update_or_create(pk=data.get('id'), defaults=data) child_instances.append(child_instance) return child_instances<|docstring|>Since...
dcc758f040a330000ff477c6227419511f7363de80455aff660d6cc278697cd7
def repr2hash(repr): '\n repr = representation of board state, 0 for empty, 1 for current player, 2 for the other player\n ' hash = 0 for i in repr: hash = ((hash * 3) + i) return hash
repr = representation of board state, 0 for empty, 1 for current player, 2 for the other player
tic_toc_toe.py
repr2hash
lzhang12/Reinforcement_Learning
0
python
def repr2hash(repr): '\n \n ' hash = 0 for i in repr: hash = ((hash * 3) + i) return hash
def repr2hash(repr): '\n \n ' hash = 0 for i in repr: hash = ((hash * 3) + i) return hash<|docstring|>repr = representation of board state, 0 for empty, 1 for current player, 2 for the other player<|endoftext|>
6a7398aa24c10093ab603cfa10fb750757fcce0641dd855bd8f9cfa07559e5d8
@inlineCallbacks def _remoteHome(self, txn, uid): "\n Create a synthetic external home object that maps to the actual remote home.\n\n @param ownerUID: directory uid of the user's home\n @type ownerUID: L{str}\n " from txdav.caldav.datastore.sql_external import CalendarHomeExternal ...
Create a synthetic external home object that maps to the actual remote home. @param ownerUID: directory uid of the user's home @type ownerUID: L{str}
txdav/common/datastore/podding/test/test_store_api.py
_remoteHome
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def _remoteHome(self, txn, uid): "\n Create a synthetic external home object that maps to the actual remote home.\n\n @param ownerUID: directory uid of the user's home\n @type ownerUID: L{str}\n " from txdav.caldav.datastore.sql_external import CalendarHomeExternal ...
@inlineCallbacks def _remoteHome(self, txn, uid): "\n Create a synthetic external home object that maps to the actual remote home.\n\n @param ownerUID: directory uid of the user's home\n @type ownerUID: L{str}\n " from txdav.caldav.datastore.sql_external import CalendarHomeExternal ...
60f04730a69ae8c0479d258b6fbcece4eb5079aff8c239312632ce70bb42b1df
@inlineCallbacks def test_remote_home(self): '\n Test that a remote home can be accessed.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) (yield self.commitTransaction(0)) home = (yield self....
Test that a remote home can be accessed.
txdav/common/datastore/podding/test/test_store_api.py
test_remote_home
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_remote_home(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) (yield self.commitTransaction(0)) home = (yield self._remoteHome(self.theTransactionUnderTest...
@inlineCallbacks def test_remote_home(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) (yield self.commitTransaction(0)) home = (yield self._remoteHome(self.theTransactionUnderTest...
e4c2230ef617df6f7f9e1527882d0f82db080d3b99b328823973e0a6187c45ef
@inlineCallbacks def test_homechild_listobjects(self): '\n Test that a remote home L{listChildren} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) children01 = (yield home01.listChildren()...
Test that a remote home L{listChildren} works.
txdav/common/datastore/podding/test/test_store_api.py
test_homechild_listobjects
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_homechild_listobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) children01 = (yield home01.listChildren()) (yield self.commitTransaction(0)) ho...
@inlineCallbacks def test_homechild_listobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) children01 = (yield home01.listChildren()) (yield self.commitTransaction(0)) ho...
8f21e6bd964b13afceeb9febeb3e043bd8d9409dbe9912e45a6443d2b3dfcab7
@inlineCallbacks def test_homechild_loadallobjects(self): '\n Test that a remote home L{loadChildren} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) children01 = (yield home01.loadChildre...
Test that a remote home L{loadChildren} works.
txdav/common/datastore/podding/test/test_store_api.py
test_homechild_loadallobjects
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_homechild_loadallobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) children01 = (yield home01.loadChildren()) names01 = [child.name() for child in ...
@inlineCallbacks def test_homechild_loadallobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) children01 = (yield home01.loadChildren()) names01 = [child.name() for child in ...
2a8b860a6da77b5a9d4219b6228a8e6a592c312c64296421465d3f64b28c96ce
@inlineCallbacks def test_homechild_objectwith(self): '\n Test that a remote home L{loadChildren} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('...
Test that a remote home L{loadChildren} works.
txdav/common/datastore/podding/test/test_store_api.py
test_homechild_objectwith
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_homechild_objectwith(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield self.commitTransaction(...
@inlineCallbacks def test_homechild_objectwith(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield self.commitTransaction(...
5a744d1ebf469b61eb59807d01b1de6ea65f68d209e0fe068f8840fbfe20998e
@inlineCallbacks def test_objectresource_loadallobjects(self): '\n Test that a remote home child L{objectResources} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home...
Test that a remote home child L{objectResources} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_loadallobjects
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_loadallobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.cre...
@inlineCallbacks def test_objectresource_loadallobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.cre...
11627a6b5bc94a85153c1e02e908c22b758aaf1c920b482acb16c247727a188f
@inlineCallbacks def test_objectresource_loadallobjectswithnames(self): '\n Test that a remote home child L{objectResourcesWithNames} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calend...
Test that a remote home child L{objectResourcesWithNames} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_loadallobjectswithnames
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_loadallobjectswithnames(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calen...
@inlineCallbacks def test_objectresource_loadallobjectswithnames(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calen...
1a56a774e62db5338e5decce8dc166913533829633e2b157f498c5c9e89c87b4
@inlineCallbacks def test_objectresource_listobjects(self): '\n Test that a remote home child L{listObjectResources} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield hom...
Test that a remote home child L{listObjectResources} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_listobjects
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_listobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.create...
@inlineCallbacks def test_objectresource_listobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.create...
41bf513a1ea5c2e7b43ce637db5ce76c6037958997a26bf2df5151bf5b5e82a9
@inlineCallbacks def test_objectresource_countobjects(self): '\n Test that a remote home child L{countObjectResources} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield h...
Test that a remote home child L{countObjectResources} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_countobjects
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_countobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.creat...
@inlineCallbacks def test_objectresource_countobjects(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.creat...
c83dc6848aa5e72d19b04f04a7d8553cb06993e3912dbe2defdeb66d7759c262
@inlineCallbacks def test_objectresource_objectwith(self): '\n Test that a remote home child L{objectResourceWithName} and L{objectResourceWithUID} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not Non...
Test that a remote home child L{objectResourceWithName} and L{objectResourceWithUID} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_objectwith
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_objectwith(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) resource01 = (yield calen...
@inlineCallbacks def test_objectresource_objectwith(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) resource01 = (yield calen...
4f8699888e86e0b1db3848b9084fa5ec2e2da4f83e200f36e4471d5328421ec7
@inlineCallbacks def test_objectresource_resourcenameforuid(self): '\n Test that a remote home child L{resourceNameForUID} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yie...
Test that a remote home child L{resourceNameForUID} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_resourcenameforuid
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_resourcenameforuid(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01...
@inlineCallbacks def test_objectresource_resourcenameforuid(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01...
c14249e02c94c981eb4cb867e07d61059532f8e73728a25bbeb1683546bc74cd
@inlineCallbacks def test_objectresource_resourceuidforname(self): '\n Test that a remote home child L{resourceUIDForName} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yie...
Test that a remote home child L{resourceUIDForName} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_resourceuidforname
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_resourceuidforname(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01...
@inlineCallbacks def test_objectresource_resourceuidforname(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01...
c86b52b0cb84e17529add8dff51e9134536424217c045c9b861a4a11e4333de9
@inlineCallbacks def test_objectresource_create(self): '\n Test that a remote object resource L{create} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) (yield home01.childWithName('calenda...
Test that a remote object resource L{create} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_create
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_create(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) (yield home01.childWithName('calendar')) (yield self.commitTransaction(0)) home...
@inlineCallbacks def test_objectresource_create(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) (yield home01.childWithName('calendar')) (yield self.commitTransaction(0)) home...
08552266f09d4a5dd904f66bcf3c3f1a1fe611adc13920c626ca6c048a3c193d
@inlineCallbacks def test_objectresource_setcomponent(self): '\n Test that a remote object resource L{setComponent} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home...
Test that a remote object resource L{setComponent} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_setcomponent
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_setcomponent(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.creat...
@inlineCallbacks def test_objectresource_setcomponent(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.creat...
e1ea8781830aa0be596475386518944908fa1e8301d373dd3a623f8a5fad5f8b
@inlineCallbacks def test_objectresource_component(self): '\n Test that a remote object resource L{component} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.chi...
Test that a remote object resource L{component} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_component
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_component(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.createCa...
@inlineCallbacks def test_objectresource_component(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.createCa...
a48d30afc1ca037d7211b148b368c37136c130339c4abbe59fdd7f825fe5ff40
@inlineCallbacks def test_objectresource_remove(self): '\n Test that a remote object resource L{component} works.\n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childW...
Test that a remote object resource L{component} works.
txdav/common/datastore/podding/test/test_store_api.py
test_objectresource_remove
m-thielen/ccs-calendarserver
462
python
@inlineCallbacks def test_objectresource_remove(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.createCalen...
@inlineCallbacks def test_objectresource_remove(self): '\n \n ' home01 = (yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name='user01', create=True)) self.assertTrue((home01 is not None)) calendar01 = (yield home01.childWithName('calendar')) (yield calendar01.createCalen...
0af699aa2776576a528425f31aeb7f08b119c94a6611bee09da6fe6fcc542efc
def random_mask(input_ids: torch.Tensor, attention_mask: torch.tensor, masking_percent: float=0.15, min_char_replacement: int=1, max_char_replacement: int=CodepointTokenizer.MAX_CODEPOINT) -> Tuple[(torch.Tensor, torch.Tensor, torch.Tensor)]: 'The standard way to do this (how HuggingFace does it) is to randomly mas...
The standard way to do this (how HuggingFace does it) is to randomly mask each token with masking_prob. However, this can result in a different number of masks for different sentences, which would prevent us from using gather() to save compute like CANINE does. consequently, we instead always mask exactly length * mask...
training/masking.py
random_mask
cdleong/shiba
71
python
def random_mask(input_ids: torch.Tensor, attention_mask: torch.tensor, masking_percent: float=0.15, min_char_replacement: int=1, max_char_replacement: int=CodepointTokenizer.MAX_CODEPOINT) -> Tuple[(torch.Tensor, torch.Tensor, torch.Tensor)]: 'The standard way to do this (how HuggingFace does it) is to randomly mas...
def random_mask(input_ids: torch.Tensor, attention_mask: torch.tensor, masking_percent: float=0.15, min_char_replacement: int=1, max_char_replacement: int=CodepointTokenizer.MAX_CODEPOINT) -> Tuple[(torch.Tensor, torch.Tensor, torch.Tensor)]: 'The standard way to do this (how HuggingFace does it) is to randomly mas...
cbca5dac9e725427da15134c14a03fd32d40aade438e603b469b5463d9f66aa8
def random_span_mask(input_ids: torch.Tensor, attention_mask: torch.Tensor, replacement_vocab: Dict[(int, List[str])], masking_percent: float=0.15, span_length: int=2) -> Tuple[(torch.Tensor, torch.Tensor, torch.Tensor)]: "randomly mask spans, and replace some of the spans with same length subwords. note that chara...
randomly mask spans, and replace some of the spans with same length subwords. note that character-trained canine only does masking (no replacement) for some reason, so this is slightly different to what we're doing
training/masking.py
random_span_mask
cdleong/shiba
71
python
def random_span_mask(input_ids: torch.Tensor, attention_mask: torch.Tensor, replacement_vocab: Dict[(int, List[str])], masking_percent: float=0.15, span_length: int=2) -> Tuple[(torch.Tensor, torch.Tensor, torch.Tensor)]: "randomly mask spans, and replace some of the spans with same length subwords. note that chara...
def random_span_mask(input_ids: torch.Tensor, attention_mask: torch.Tensor, replacement_vocab: Dict[(int, List[str])], masking_percent: float=0.15, span_length: int=2) -> Tuple[(torch.Tensor, torch.Tensor, torch.Tensor)]: "randomly mask spans, and replace some of the spans with same length subwords. note that chara...