body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def test_get_filepaths_by_extensions(self): 'Test get_filepaths_by_extensions only returns filepaths in\n directory with given extensions.\n ' filepaths = [] build.ensure_directory_exists(MOCK_ASSETS_DEV_DIR) extensions = ('.json', '.svg') self.assertEqual(len(filepaths), 0) filepa...
-3,231,396,549,521,197,600
Test get_filepaths_by_extensions only returns filepaths in directory with given extensions.
scripts/build_test.py
test_get_filepaths_by_extensions
muarachmann/oppia
python
def test_get_filepaths_by_extensions(self): 'Test get_filepaths_by_extensions only returns filepaths in\n directory with given extensions.\n ' filepaths = [] build.ensure_directory_exists(MOCK_ASSETS_DEV_DIR) extensions = ('.json', '.svg') self.assertEqual(len(filepaths), 0) filepa...
def test_get_file_hashes(self): 'Test get_file_hashes gets hashes of all files in directory,\n excluding file with extensions in FILE_EXTENSIONS_TO_IGNORE.\n ' with self.swap(build, 'FILE_EXTENSIONS_TO_IGNORE', ('.html',)): file_hashes = dict() self.assertEqual(len(file_hashes), 0)...
-5,967,998,651,860,690,000
Test get_file_hashes gets hashes of all files in directory, excluding file with extensions in FILE_EXTENSIONS_TO_IGNORE.
scripts/build_test.py
test_get_file_hashes
muarachmann/oppia
python
def test_get_file_hashes(self): 'Test get_file_hashes gets hashes of all files in directory,\n excluding file with extensions in FILE_EXTENSIONS_TO_IGNORE.\n ' with self.swap(build, 'FILE_EXTENSIONS_TO_IGNORE', ('.html',)): file_hashes = dict() self.assertEqual(len(file_hashes), 0)...
def test_filter_hashes(self): 'Test filter_hashes filters the provided hash correctly.' with self.swap(build, 'FILEPATHS_PROVIDED_TO_FRONTEND', ('*',)): hashes = {'path/to/file.js': '123456', 'path/file.min.js': '123456'} filtered_hashes = build.filter_hashes(hashes) self.assertEqual(fil...
-8,685,788,288,741,124,000
Test filter_hashes filters the provided hash correctly.
scripts/build_test.py
test_filter_hashes
muarachmann/oppia
python
def test_filter_hashes(self): with self.swap(build, 'FILEPATHS_PROVIDED_TO_FRONTEND', ('*',)): hashes = {'path/to/file.js': '123456', 'path/file.min.js': '123456'} filtered_hashes = build.filter_hashes(hashes) self.assertEqual(filtered_hashes['/path/to/file.js'], hashes['path/to/file.js...
def test_get_hashes_json_file_contents(self): 'Test get_hashes_json_file_contents parses provided hash dict\n correctly to JSON format.\n ' with self.swap(build, 'FILEPATHS_PROVIDED_TO_FRONTEND', ('*',)): hashes = {'path/file.js': '123456'} self.assertEqual(build.get_hashes_json_fi...
6,738,413,142,785,860,000
Test get_hashes_json_file_contents parses provided hash dict correctly to JSON format.
scripts/build_test.py
test_get_hashes_json_file_contents
muarachmann/oppia
python
def test_get_hashes_json_file_contents(self): 'Test get_hashes_json_file_contents parses provided hash dict\n correctly to JSON format.\n ' with self.swap(build, 'FILEPATHS_PROVIDED_TO_FRONTEND', ('*',)): hashes = {'path/file.js': '123456'} self.assertEqual(build.get_hashes_json_fi...
def test_execute_tasks(self): 'Test _execute_tasks joins all threads after executing all tasks.' build_tasks = collections.deque() TASK_COUNT = 2 count = TASK_COUNT while count: task = threading.Thread(target=build._minify, args=(INVALID_INPUT_FILEPATH, INVALID_OUTPUT_FILEPATH)) buil...
-1,951,065,411,219,942,100
Test _execute_tasks joins all threads after executing all tasks.
scripts/build_test.py
test_execute_tasks
muarachmann/oppia
python
def test_execute_tasks(self): build_tasks = collections.deque() TASK_COUNT = 2 count = TASK_COUNT while count: task = threading.Thread(target=build._minify, args=(INVALID_INPUT_FILEPATH, INVALID_OUTPUT_FILEPATH)) build_tasks.append(task) count -= 1 self.assertEqual(threa...
def test_generate_build_tasks_to_build_all_files_in_directory(self): 'Test generate_build_tasks_to_build_all_files_in_directory queues up\n the same number of build tasks as the number of files in the source\n directory.\n ' asset_hashes = build.get_file_hashes(MOCK_ASSETS_DEV_DIR) task...
-4,802,834,169,793,278,000
Test generate_build_tasks_to_build_all_files_in_directory queues up the same number of build tasks as the number of files in the source directory.
scripts/build_test.py
test_generate_build_tasks_to_build_all_files_in_directory
muarachmann/oppia
python
def test_generate_build_tasks_to_build_all_files_in_directory(self): 'Test generate_build_tasks_to_build_all_files_in_directory queues up\n the same number of build tasks as the number of files in the source\n directory.\n ' asset_hashes = build.get_file_hashes(MOCK_ASSETS_DEV_DIR) task...
def test_generate_build_tasks_to_build_files_from_filepaths(self): 'Test generate_build_tasks_to_build_files_from_filepaths queues up a\n corresponding number of build tasks to the number of file changes.\n ' new_filename = 'manifest.json' recently_changed_filenames = [os.path.join(MOCK_ASSETS...
-7,522,509,054,264,482,000
Test generate_build_tasks_to_build_files_from_filepaths queues up a corresponding number of build tasks to the number of file changes.
scripts/build_test.py
test_generate_build_tasks_to_build_files_from_filepaths
muarachmann/oppia
python
def test_generate_build_tasks_to_build_files_from_filepaths(self): 'Test generate_build_tasks_to_build_files_from_filepaths queues up a\n corresponding number of build tasks to the number of file changes.\n ' new_filename = 'manifest.json' recently_changed_filenames = [os.path.join(MOCK_ASSETS...
def test_generate_build_tasks_to_build_directory(self): 'Test generate_build_tasks_to_build_directory queues up a\n corresponding number of build tasks according to the given scenario.\n ' EXTENSIONS_DIRNAMES_TO_DIRPATHS = {'dev_dir': MOCK_EXTENSIONS_DEV_DIR, 'compiled_js_dir': MOCK_EXTENSIONS_COM...
-4,306,466,468,645,775,000
Test generate_build_tasks_to_build_directory queues up a corresponding number of build tasks according to the given scenario.
scripts/build_test.py
test_generate_build_tasks_to_build_directory
muarachmann/oppia
python
def test_generate_build_tasks_to_build_directory(self): 'Test generate_build_tasks_to_build_directory queues up a\n corresponding number of build tasks according to the given scenario.\n ' EXTENSIONS_DIRNAMES_TO_DIRPATHS = {'dev_dir': MOCK_EXTENSIONS_DEV_DIR, 'compiled_js_dir': MOCK_EXTENSIONS_COM...
def test_get_recently_changed_filenames(self): 'Test get_recently_changed_filenames detects file recently added.' build.ensure_directory_exists(EMPTY_DIR) assets_hashes = build.get_file_hashes(MOCK_ASSETS_DEV_DIR) recently_changed_filenames = [] self.assertEqual(len(recently_changed_filenames), 0) ...
-888,671,311,690,525,000
Test get_recently_changed_filenames detects file recently added.
scripts/build_test.py
test_get_recently_changed_filenames
muarachmann/oppia
python
def test_get_recently_changed_filenames(self): build.ensure_directory_exists(EMPTY_DIR) assets_hashes = build.get_file_hashes(MOCK_ASSETS_DEV_DIR) recently_changed_filenames = [] self.assertEqual(len(recently_changed_filenames), 0) recently_changed_filenames = build.get_recently_changed_filenam...
def test_generate_delete_tasks_to_remove_deleted_files(self): 'Test generate_delete_tasks_to_remove_deleted_files queues up the\n same number of deletion task as the number of deleted files.\n ' delete_tasks = collections.deque() file_hashes = dict() self.assertEqual(len(delete_tasks), 0) ...
-5,156,963,052,401,631,000
Test generate_delete_tasks_to_remove_deleted_files queues up the same number of deletion task as the number of deleted files.
scripts/build_test.py
test_generate_delete_tasks_to_remove_deleted_files
muarachmann/oppia
python
def test_generate_delete_tasks_to_remove_deleted_files(self): 'Test generate_delete_tasks_to_remove_deleted_files queues up the\n same number of deletion task as the number of deleted files.\n ' delete_tasks = collections.deque() file_hashes = dict() self.assertEqual(len(delete_tasks), 0) ...
def test_compiled_js_dir_validation(self): 'Test that build.COMPILED_JS_DIR is validated correctly with\n outDir in build.TSCONFIG_FILEPATH.\n ' build.require_compiled_js_dir_to_be_valid() out_dir = '' with open(build.TSCONFIG_FILEPATH) as f: config_data = json.load(f) out_...
3,159,340,658,849,626,600
Test that build.COMPILED_JS_DIR is validated correctly with outDir in build.TSCONFIG_FILEPATH.
scripts/build_test.py
test_compiled_js_dir_validation
muarachmann/oppia
python
def test_compiled_js_dir_validation(self): 'Test that build.COMPILED_JS_DIR is validated correctly with\n outDir in build.TSCONFIG_FILEPATH.\n ' build.require_compiled_js_dir_to_be_valid() out_dir = with open(build.TSCONFIG_FILEPATH) as f: config_data = json.load(f) out_di...
def test_compiled_js_dir_is_deleted_before_compilation(self): 'Test that compiled_js_dir is deleted before a fresh compilation.' def mock_check_call(unused_cmd): pass def mock_require_compiled_js_dir_to_be_valid(): pass with self.swap(build, 'COMPILED_JS_DIR', MOCK_COMPILED_JS_DIR), se...
-8,542,689,104,886,041,000
Test that compiled_js_dir is deleted before a fresh compilation.
scripts/build_test.py
test_compiled_js_dir_is_deleted_before_compilation
muarachmann/oppia
python
def test_compiled_js_dir_is_deleted_before_compilation(self): def mock_check_call(unused_cmd): pass def mock_require_compiled_js_dir_to_be_valid(): pass with self.swap(build, 'COMPILED_JS_DIR', MOCK_COMPILED_JS_DIR), self.swap(build, 'require_compiled_js_dir_to_be_valid', mock_require...
def test_compiled_js_dir_is_deleted_before_watch_mode_compilation(self): 'Test that compiled_js_dir is deleted before a fresh watch mode\n compilation.\n ' def mock_call(unused_cmd, shell, stdout): pass def mock_popen(unused_cmd, stdout): pass def mock_require_compiled_j...
-4,450,239,991,488,878,000
Test that compiled_js_dir is deleted before a fresh watch mode compilation.
scripts/build_test.py
test_compiled_js_dir_is_deleted_before_watch_mode_compilation
muarachmann/oppia
python
def test_compiled_js_dir_is_deleted_before_watch_mode_compilation(self): 'Test that compiled_js_dir is deleted before a fresh watch mode\n compilation.\n ' def mock_call(unused_cmd, shell, stdout): pass def mock_popen(unused_cmd, stdout): pass def mock_require_compiled_j...
def _mock_safe_delete_file(unused_filepath): 'Mocks build.safe_delete_file().' pass
-2,236,168,809,398,343,000
Mocks build.safe_delete_file().
scripts/build_test.py
_mock_safe_delete_file
muarachmann/oppia
python
def _mock_safe_delete_file(unused_filepath): pass
@pytest.mark.usefixtures('os', 'instance') def test_existing_hosted_zone(hosted_zone_factory, pcluster_config_reader, clusters_factory, vpc_stack, cfn_stacks_factory, key_name, scheduler, region, instance): 'Test hosted_zone_id is provided in the config file.' num_computes = 2 (hosted_zone_id, domain_name) ...
-1,448,538,545,670,695,400
Test hosted_zone_id is provided in the config file.
tests/integration-tests/tests/dns/test_dns.py
test_existing_hosted_zone
Chen188/aws-parallelcluster
python
@pytest.mark.usefixtures('os', 'instance') def test_existing_hosted_zone(hosted_zone_factory, pcluster_config_reader, clusters_factory, vpc_stack, cfn_stacks_factory, key_name, scheduler, region, instance): num_computes = 2 (hosted_zone_id, domain_name) = hosted_zone_factory() cluster_config = pcluster...
@pytest.fixture(scope='class') def hosted_zone_factory(vpc_stack, cfn_stacks_factory, request, region): 'Create a hosted zone stack.' hosted_zone_stack_name = generate_stack_name('integ-tests-hosted-zone', request.config.getoption('stackname_suffix')) domain_name = (hosted_zone_stack_name + '.com') def...
-8,856,291,509,646,637,000
Create a hosted zone stack.
tests/integration-tests/tests/dns/test_dns.py
hosted_zone_factory
Chen188/aws-parallelcluster
python
@pytest.fixture(scope='class') def hosted_zone_factory(vpc_stack, cfn_stacks_factory, request, region): hosted_zone_stack_name = generate_stack_name('integ-tests-hosted-zone', request.config.getoption('stackname_suffix')) domain_name = (hosted_zone_stack_name + '.com') def create_hosted_zone(): ...
def build_run_config(): 'Return RunConfig for TPU estimator.' tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver(FLAGS.tpu, zone=FLAGS.tpu_zone, project=FLAGS.gcp_project) eval_steps = (FLAGS.num_eval_images // FLAGS.eval_batch_size) iterations_per_loop = (eval_steps if (FLAGS.mode ==...
4,576,793,555,163,632,600
Return RunConfig for TPU estimator.
models/official/amoeba_net/amoeba_net.py
build_run_config
boristown/tpu
python
def build_run_config(): tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver(FLAGS.tpu, zone=FLAGS.tpu_zone, project=FLAGS.gcp_project) eval_steps = (FLAGS.num_eval_images // FLAGS.eval_batch_size) iterations_per_loop = (eval_steps if (FLAGS.mode == 'eval') else FLAGS.iterations_per_lo...
def build_image_serving_input_receiver_fn(shape, dtype=tf.float32): 'Returns a input_receiver_fn for raw images during serving.' def _preprocess_image(encoded_image): 'Preprocess a single raw image.' image = tf.image.decode_image(encoded_image, channels=shape[(- 1)]) image.set_shape(sha...
3,808,841,042,814,280,700
Returns a input_receiver_fn for raw images during serving.
models/official/amoeba_net/amoeba_net.py
build_image_serving_input_receiver_fn
boristown/tpu
python
def build_image_serving_input_receiver_fn(shape, dtype=tf.float32): def _preprocess_image(encoded_image): 'Preprocess a single raw image.' image = tf.image.decode_image(encoded_image, channels=shape[(- 1)]) image.set_shape(shape) return tf.cast(image, dtype) def serving_in...
def _encode_image(image_array, fmt='PNG'): 'encodes an (numpy) image array to string.\n\n Args:\n image_array: (numpy) image array\n fmt: image format to use\n\n Returns:\n encoded image string\n ' pil_image = Image.fromarray(image_array) image_io = io.BytesIO() pil_image.save(image_io, form...
-2,579,279,950,762,076,700
encodes an (numpy) image array to string. Args: image_array: (numpy) image array fmt: image format to use Returns: encoded image string
models/official/amoeba_net/amoeba_net.py
_encode_image
boristown/tpu
python
def _encode_image(image_array, fmt='PNG'): 'encodes an (numpy) image array to string.\n\n Args:\n image_array: (numpy) image array\n fmt: image format to use\n\n Returns:\n encoded image string\n ' pil_image = Image.fromarray(image_array) image_io = io.BytesIO() pil_image.save(image_io, form...
def write_warmup_requests(savedmodel_dir, model_name, image_size, batch_sizes=None, num_requests=8): 'Writes warmup requests for inference into a tfrecord file.\n\n Args:\n savedmodel_dir: string, the file to the exported model folder.\n model_name: string, a model name used inside the model server.\n ima...
2,654,014,410,891,139,600
Writes warmup requests for inference into a tfrecord file. Args: savedmodel_dir: string, the file to the exported model folder. model_name: string, a model name used inside the model server. image_size: int, size of image, assuming image height and width. batch_sizes: list, a list of batch sizes to create diff...
models/official/amoeba_net/amoeba_net.py
write_warmup_requests
boristown/tpu
python
def write_warmup_requests(savedmodel_dir, model_name, image_size, batch_sizes=None, num_requests=8): 'Writes warmup requests for inference into a tfrecord file.\n\n Args:\n savedmodel_dir: string, the file to the exported model folder.\n model_name: string, a model name used inside the model server.\n ima...
def override_with_flags(hparams): 'Overrides parameters with flag values.' override_flag_names = ['aux_scaling', 'train_batch_size', 'batch_norm_decay', 'batch_norm_epsilon', 'dense_dropout_keep_prob', 'drop_connect_keep_prob', 'drop_connect_version', 'eval_batch_size', 'gradient_clipping_by_global_norm', 'lr',...
4,258,256,473,116,058,600
Overrides parameters with flag values.
models/official/amoeba_net/amoeba_net.py
override_with_flags
boristown/tpu
python
def override_with_flags(hparams): override_flag_names = ['aux_scaling', 'train_batch_size', 'batch_norm_decay', 'batch_norm_epsilon', 'dense_dropout_keep_prob', 'drop_connect_keep_prob', 'drop_connect_version', 'eval_batch_size', 'gradient_clipping_by_global_norm', 'lr', 'lr_decay_method', 'lr_decay_value', 'l...
def build_hparams(): 'Build tf.Hparams for training Amoeba Net.' hparams = model_lib.build_hparams(FLAGS.cell_name) override_with_flags(hparams) return hparams
7,598,903,149,163,873,000
Build tf.Hparams for training Amoeba Net.
models/official/amoeba_net/amoeba_net.py
build_hparams
boristown/tpu
python
def build_hparams(): hparams = model_lib.build_hparams(FLAGS.cell_name) override_with_flags(hparams) return hparams
def _preprocess_image(encoded_image): 'Preprocess a single raw image.' image = tf.image.decode_image(encoded_image, channels=shape[(- 1)]) image.set_shape(shape) return tf.cast(image, dtype)
-2,410,232,163,323,720,000
Preprocess a single raw image.
models/official/amoeba_net/amoeba_net.py
_preprocess_image
boristown/tpu
python
def _preprocess_image(encoded_image): image = tf.image.decode_image(encoded_image, channels=shape[(- 1)]) image.set_shape(shape) return tf.cast(image, dtype)
def add_port(component: Component, **kwargs) -> Component: 'Return Component with a new port.' component.add_port(**kwargs) return component
-5,908,829,619,112,604,000
Return Component with a new port.
gdsfactory/functions.py
add_port
jorgepadilla19/gdsfactory
python
def add_port(component: Component, **kwargs) -> Component: component.add_port(**kwargs) return component
@cell def add_text(component: ComponentOrFactory, text: str='', text_offset: Float2=(0, 0), text_anchor: Anchor='cc', text_factory: ComponentFactory=text_rectangular_multi_layer) -> Component: 'Return component inside a new component with text geometry.\n\n Args:\n component:\n text: text string.\n...
6,078,697,613,539,204,000
Return component inside a new component with text geometry. Args: component: text: text string. text_offset: relative to component anchor. Defaults to center (cc). text_anchor: relative to component (ce cw nc ne nw sc se sw center cc). text_factory: function to add text labels.
gdsfactory/functions.py
add_text
jorgepadilla19/gdsfactory
python
@cell def add_text(component: ComponentOrFactory, text: str=, text_offset: Float2=(0, 0), text_anchor: Anchor='cc', text_factory: ComponentFactory=text_rectangular_multi_layer) -> Component: 'Return component inside a new component with text geometry.\n\n Args:\n component:\n text: text string.\n ...
def add_texts(components: List[ComponentOrFactory], prefix: str='', index0: int=0, **kwargs) -> List[Component]: 'Return a list of Component with text labels.\n\n Args:\n components: list of components\n prefix: Optional prefix for the labels\n index0: defaults to 0 (0, for first component, ...
2,259,754,371,796,914,400
Return a list of Component with text labels. Args: components: list of components prefix: Optional prefix for the labels index0: defaults to 0 (0, for first component, 1 for second ...) keyword Args: text_offset: relative to component size info anchor. Defaults to center. text_anchor: relative to ...
gdsfactory/functions.py
add_texts
jorgepadilla19/gdsfactory
python
def add_texts(components: List[ComponentOrFactory], prefix: str=, index0: int=0, **kwargs) -> List[Component]: 'Return a list of Component with text labels.\n\n Args:\n components: list of components\n prefix: Optional prefix for the labels\n index0: defaults to 0 (0, for first component, 1 ...
@cell def rotate(component: ComponentOrFactory, angle: float=90) -> Component: 'Return rotated component inside a new component.\n\n Most times you just need to place a reference and rotate it.\n This rotate function just encapsulates the rotated reference into a new component.\n\n Args:\n component...
3,448,322,324,605,236,700
Return rotated component inside a new component. Most times you just need to place a reference and rotate it. This rotate function just encapsulates the rotated reference into a new component. Args: component: angle: in degrees
gdsfactory/functions.py
rotate
jorgepadilla19/gdsfactory
python
@cell def rotate(component: ComponentOrFactory, angle: float=90) -> Component: 'Return rotated component inside a new component.\n\n Most times you just need to place a reference and rotate it.\n This rotate function just encapsulates the rotated reference into a new component.\n\n Args:\n component...
@cell def mirror(component: Component, p1: Float2=(0, 1), p2: Float2=(0, 0)) -> Component: 'Return new Component with a mirrored reference.\n\n Args:\n p1: first point to define mirror axis\n p2: second point to define mirror axis\n ' component_new = Component() component_new.component =...
2,300,571,083,734,599,700
Return new Component with a mirrored reference. Args: p1: first point to define mirror axis p2: second point to define mirror axis
gdsfactory/functions.py
mirror
jorgepadilla19/gdsfactory
python
@cell def mirror(component: Component, p1: Float2=(0, 1), p2: Float2=(0, 0)) -> Component: 'Return new Component with a mirrored reference.\n\n Args:\n p1: first point to define mirror axis\n p2: second point to define mirror axis\n ' component_new = Component() component_new.component =...
@cell def move(component: Component, origin=(0, 0), destination=None, axis: Optional[Axis]=None) -> Component: 'Return new Component with a moved reference to the original component.\n\n Args:\n origin: of component\n destination:\n axis: x or y axis\n ' component_new = Component() ...
-3,906,964,808,911,511,000
Return new Component with a moved reference to the original component. Args: origin: of component destination: axis: x or y axis
gdsfactory/functions.py
move
jorgepadilla19/gdsfactory
python
@cell def move(component: Component, origin=(0, 0), destination=None, axis: Optional[Axis]=None) -> Component: 'Return new Component with a moved reference to the original component.\n\n Args:\n origin: of component\n destination:\n axis: x or y axis\n ' component_new = Component() ...
def move_port_to_zero(component: Component, port_name: str='o1'): 'Return a container that contains a reference to the original component.\n where the new component has port_name in (0, 0)\n ' if (port_name not in component.ports): raise ValueError(f'port_name = {port_name!r} not in {list(componen...
3,064,900,530,110,951,000
Return a container that contains a reference to the original component. where the new component has port_name in (0, 0)
gdsfactory/functions.py
move_port_to_zero
jorgepadilla19/gdsfactory
python
def move_port_to_zero(component: Component, port_name: str='o1'): 'Return a container that contains a reference to the original component.\n where the new component has port_name in (0, 0)\n ' if (port_name not in component.ports): raise ValueError(f'port_name = {port_name!r} not in {list(componen...
def update_info(component: Component, **kwargs) -> Component: 'Return Component with updated info.' component.info.update(**kwargs) return component
2,849,792,957,458,223,000
Return Component with updated info.
gdsfactory/functions.py
update_info
jorgepadilla19/gdsfactory
python
def update_info(component: Component, **kwargs) -> Component: component.info.update(**kwargs) return component
@validate_arguments def add_settings_label(component: Component, layer_label: Layer=(66, 0), settings: Optional[Strs]=None) -> Component: 'Add a settings label to a component.\n\n Args:\n component:\n layer_label:\n settings: tuple or list of settings. if None, adds all changed settings\n\n ...
-811,722,326,502,638,200
Add a settings label to a component. Args: component: layer_label: settings: tuple or list of settings. if None, adds all changed settings
gdsfactory/functions.py
add_settings_label
jorgepadilla19/gdsfactory
python
@validate_arguments def add_settings_label(component: Component, layer_label: Layer=(66, 0), settings: Optional[Strs]=None) -> Component: 'Add a settings label to a component.\n\n Args:\n component:\n layer_label:\n settings: tuple or list of settings. if None, adds all changed settings\n\n ...
def _summarize_str(st): 'Aux function' return (st[:56][::(- 1)].split(',', 1)[(- 1)][::(- 1)] + ', ...')
30,060,154,108,599,572
Aux function
mne/fiff/meas_info.py
_summarize_str
Anevar/mne-python
python
def _summarize_str(st): return (st[:56][::(- 1)].split(',', 1)[(- 1)][::(- 1)] + ', ...')
def read_fiducials(fname): 'Read fiducials from a fiff file\n\n Returns\n -------\n pts : list of dicts\n List of digitizer points (each point in a dict).\n coord_frame : int\n The coordinate frame of the points (one of\n mne.fiff.FIFF.FIFFV_COORD_...)\n ' (fid, tree, _) = fi...
-6,872,709,896,282,553,000
Read fiducials from a fiff file Returns ------- pts : list of dicts List of digitizer points (each point in a dict). coord_frame : int The coordinate frame of the points (one of mne.fiff.FIFF.FIFFV_COORD_...)
mne/fiff/meas_info.py
read_fiducials
Anevar/mne-python
python
def read_fiducials(fname): 'Read fiducials from a fiff file\n\n Returns\n -------\n pts : list of dicts\n List of digitizer points (each point in a dict).\n coord_frame : int\n The coordinate frame of the points (one of\n mne.fiff.FIFF.FIFFV_COORD_...)\n ' (fid, tree, _) = fi...
def write_fiducials(fname, pts, coord_frame=0): "Write fiducials to a fiff file\n\n Parameters\n ----------\n fname : str\n Destination file name.\n pts : iterator of dict\n Iterator through digitizer points. Each point is a dictionary with\n the keys 'kind', 'ident' and 'r'.\n c...
-5,395,714,530,013,654,000
Write fiducials to a fiff file Parameters ---------- fname : str Destination file name. pts : iterator of dict Iterator through digitizer points. Each point is a dictionary with the keys 'kind', 'ident' and 'r'. coord_frame : int The coordinate frame of the points (one of mne.fiff.FIFF.FIFFV_COORD_...
mne/fiff/meas_info.py
write_fiducials
Anevar/mne-python
python
def write_fiducials(fname, pts, coord_frame=0): "Write fiducials to a fiff file\n\n Parameters\n ----------\n fname : str\n Destination file name.\n pts : iterator of dict\n Iterator through digitizer points. Each point is a dictionary with\n the keys 'kind', 'ident' and 'r'.\n c...
@verbose def read_info(fname, verbose=None): 'Read measurement info from a file\n\n Parameters\n ----------\n fname : str\n File name.\n verbose : bool, str, int, or None\n If not None, override default verbose level (see mne.verbose).\n\n Returns\n -------\n info : instance of mn...
8,250,280,954,245,872,000
Read measurement info from a file Parameters ---------- fname : str File name. verbose : bool, str, int, or None If not None, override default verbose level (see mne.verbose). Returns ------- info : instance of mne.fiff.meas_info.Info Info on dataset.
mne/fiff/meas_info.py
read_info
Anevar/mne-python
python
@verbose def read_info(fname, verbose=None): 'Read measurement info from a file\n\n Parameters\n ----------\n fname : str\n File name.\n verbose : bool, str, int, or None\n If not None, override default verbose level (see mne.verbose).\n\n Returns\n -------\n info : instance of mn...
@verbose def read_meas_info(fid, tree, verbose=None): 'Read the measurement info\n\n Parameters\n ----------\n fid : file\n Open file descriptor.\n tree : tree\n FIF tree structure.\n verbose : bool, str, int, or None\n If not None, override default verbose level (see mne.verbose...
-1,168,243,709,760,774,000
Read the measurement info Parameters ---------- fid : file Open file descriptor. tree : tree FIF tree structure. verbose : bool, str, int, or None If not None, override default verbose level (see mne.verbose). Returns ------- info : instance of mne.fiff.meas_info.Info Info on dataset. meas : dict N...
mne/fiff/meas_info.py
read_meas_info
Anevar/mne-python
python
@verbose def read_meas_info(fid, tree, verbose=None): 'Read the measurement info\n\n Parameters\n ----------\n fid : file\n Open file descriptor.\n tree : tree\n FIF tree structure.\n verbose : bool, str, int, or None\n If not None, override default verbose level (see mne.verbose...
def read_extra_meas_info(fid, tree, info): 'Read extra blocks from fid' blocks = [FIFF.FIFFB_EVENTS, FIFF.FIFFB_HPI_RESULT, FIFF.FIFFB_HPI_MEAS, FIFF.FIFFB_PROCESSING_HISTORY] info['orig_blocks'] = blocks fid_str = BytesIO() fid_str = start_file(fid_str) start_block(fid_str, FIFF.FIFFB_MEAS_INFO...
-7,852,157,372,996,325,000
Read extra blocks from fid
mne/fiff/meas_info.py
read_extra_meas_info
Anevar/mne-python
python
def read_extra_meas_info(fid, tree, info): blocks = [FIFF.FIFFB_EVENTS, FIFF.FIFFB_HPI_RESULT, FIFF.FIFFB_HPI_MEAS, FIFF.FIFFB_PROCESSING_HISTORY] info['orig_blocks'] = blocks fid_str = BytesIO() fid_str = start_file(fid_str) start_block(fid_str, FIFF.FIFFB_MEAS_INFO) for block in blocks: ...
def write_extra_meas_info(fid, info): 'Write otherwise left out blocks of data' if (('orig_blocks' in info) and (info['orig_blocks'] is not None)): blocks = info['orig_blocks'] (fid_str, tree, _) = fiff_open(info['orig_fid_str']) for block in blocks: nodes = dir_tree_find(tre...
1,894,005,886,610,068,200
Write otherwise left out blocks of data
mne/fiff/meas_info.py
write_extra_meas_info
Anevar/mne-python
python
def write_extra_meas_info(fid, info): if (('orig_blocks' in info) and (info['orig_blocks'] is not None)): blocks = info['orig_blocks'] (fid_str, tree, _) = fiff_open(info['orig_fid_str']) for block in blocks: nodes = dir_tree_find(tree, block) copy_tree(fid_str, ...
def write_meas_info(fid, info, data_type=None, reset_range=True): "Write measurement info into a file id (from a fif file)\n\n Parameters\n ----------\n fid : file\n Open file descriptor\n info : instance of mne.fiff.meas_info.Info\n The measurement info structure\n data_type : int\n ...
-3,615,014,654,560,701,400
Write measurement info into a file id (from a fif file) Parameters ---------- fid : file Open file descriptor info : instance of mne.fiff.meas_info.Info The measurement info structure data_type : int The data_type in case it is necessary. Should be 4 (FIFFT_FLOAT), 5 (FIFFT_DOUBLE), or 16 (mne.fiff.FIF...
mne/fiff/meas_info.py
write_meas_info
Anevar/mne-python
python
def write_meas_info(fid, info, data_type=None, reset_range=True): "Write measurement info into a file id (from a fif file)\n\n Parameters\n ----------\n fid : file\n Open file descriptor\n info : instance of mne.fiff.meas_info.Info\n The measurement info structure\n data_type : int\n ...
def write_info(fname, info, data_type=None, reset_range=True): "Write measurement info in fif file.\n\n Parameters\n ----------\n fname : str\n The name of the file. Should end by -info.fif.\n info : instance of mne.fiff.meas_info.Info\n The measurement info structure\n data_type : int\...
-2,834,309,715,596,339,700
Write measurement info in fif file. Parameters ---------- fname : str The name of the file. Should end by -info.fif. info : instance of mne.fiff.meas_info.Info The measurement info structure data_type : int The data_type in case it is necessary. Should be 4 (FIFFT_FLOAT), 5 (FIFFT_DOUBLE), or 16 (mne.f...
mne/fiff/meas_info.py
write_info
Anevar/mne-python
python
def write_info(fname, info, data_type=None, reset_range=True): "Write measurement info in fif file.\n\n Parameters\n ----------\n fname : str\n The name of the file. Should end by -info.fif.\n info : instance of mne.fiff.meas_info.Info\n The measurement info structure\n data_type : int\...
def __repr__(self): 'Summarize info instead of printing all' strs = ['<Info | %s non-empty fields'] non_empty = 0 for (k, v) in self.items(): if (k in ['bads', 'ch_names']): entr = (', '.join((b for (ii, b) in enumerate(v) if (ii < 10))) if v else '0 items') if (len(entr)...
-5,143,204,878,215,623,000
Summarize info instead of printing all
mne/fiff/meas_info.py
__repr__
Anevar/mne-python
python
def __repr__(self): strs = ['<Info | %s non-empty fields'] non_empty = 0 for (k, v) in self.items(): if (k in ['bads', 'ch_names']): entr = (', '.join((b for (ii, b) in enumerate(v) if (ii < 10))) if v else '0 items') if (len(entr) >= 56): entr = _summari...
def generate_code(root_path, gen_dict=None): 'Generate pyleecan Classes code according to doc in root_path\n\n Parameters\n ----------\n root_path : str\n Path to the main folder of Pyleecan\n gen_dict : dict\n Generation dictionnary (contains all the csv data)\n Returns\n -------\n ...
-3,105,398,278,533,187,000
Generate pyleecan Classes code according to doc in root_path Parameters ---------- root_path : str Path to the main folder of Pyleecan gen_dict : dict Generation dictionnary (contains all the csv data) Returns ------- None
pyleecan/Generator/run_generate_classes.py
generate_code
IrakozeFD/pyleecan
python
def generate_code(root_path, gen_dict=None): 'Generate pyleecan Classes code according to doc in root_path\n\n Parameters\n ----------\n root_path : str\n Path to the main folder of Pyleecan\n gen_dict : dict\n Generation dictionnary (contains all the csv data)\n Returns\n -------\n ...
@property def action_space(self): 'See class definition.' max_decel = self.env_params.additional_params['max_decel'] max_accel = self.env_params.additional_params['max_accel'] lb = ([1, (- 0.2)] * self.num_rl) ub = ([2, 0.2] * self.num_rl) return Box(np.array(lb), np.array(ub), dtype=np.float32)
54,758,527,748,066,650
See class definition.
traci_pedestrian_crossing/movexy_ped.py
action_space
KarlRong/Safe-RL-for-Driving
python
@property def action_space(self): max_decel = self.env_params.additional_params['max_decel'] max_accel = self.env_params.additional_params['max_accel'] lb = ([1, (- 0.2)] * self.num_rl) ub = ([2, 0.2] * self.num_rl) return Box(np.array(lb), np.array(ub), dtype=np.float32)
@property def observation_space(self): 'See class definition.' return Box(low=(- 1000), high=3000, shape=((((4 * self.num_rl) * self.num_lanes) + (2 * self.num_rl)),), dtype=np.float32)
5,053,630,444,488,890,000
See class definition.
traci_pedestrian_crossing/movexy_ped.py
observation_space
KarlRong/Safe-RL-for-Driving
python
@property def observation_space(self): return Box(low=(- 1000), high=3000, shape=((((4 * self.num_rl) * self.num_lanes) + (2 * self.num_rl)),), dtype=np.float32)
def compute_reward(self, rl_actions, **kwargs): 'See class definition.' reward = 0 rl_velocity = np.array(self.k.vehicle.get_speed(self.rl_veh)) target_vel = self.env_params.additional_params['target_velocity'] max_cost = np.array(([target_vel] * self.num_rl)) max_cost = np.linalg.norm(max_cost)...
589,851,366,946,258,200
See class definition.
traci_pedestrian_crossing/movexy_ped.py
compute_reward
KarlRong/Safe-RL-for-Driving
python
def compute_reward(self, rl_actions, **kwargs): reward = 0 rl_velocity = np.array(self.k.vehicle.get_speed(self.rl_veh)) target_vel = self.env_params.additional_params['target_velocity'] max_cost = np.array(([target_vel] * self.num_rl)) max_cost = np.linalg.norm(max_cost) cost = (rl_velocit...
def _apply_rl_actions(self, actions): 'See class definition.' acceleration = actions[::2] direction = actions[1::2] for (i, veh_id) in enumerate(self.rl_veh): if (self.time_counter <= (self.env_params.additional_params['lane_change_duration'] + self.k.vehicle.get_last_lc(veh_id))): d...
3,311,372,121,974,978,600
See class definition.
traci_pedestrian_crossing/movexy_ped.py
_apply_rl_actions
KarlRong/Safe-RL-for-Driving
python
def _apply_rl_actions(self, actions): acceleration = actions[::2] direction = actions[1::2] for (i, veh_id) in enumerate(self.rl_veh): if (self.time_counter <= (self.env_params.additional_params['lane_change_duration'] + self.k.vehicle.get_last_lc(veh_id))): direction[i] = 0 ...
def get_state(self): 'See class definition.' obs = [0 for _ in range((((4 * self.num_rl) * self.num_lanes) + (2 * self.num_rl)))] self.visible = [] self.update_veh_id() speeds = [] for (i, rl_id) in enumerate(self.rl_veh): x = self.k.vehicle.get_x_by_id(rl_id) if (x == (- 1001)):...
-5,605,300,636,699,024,000
See class definition.
traci_pedestrian_crossing/movexy_ped.py
get_state
KarlRong/Safe-RL-for-Driving
python
def get_state(self): obs = [0 for _ in range((((4 * self.num_rl) * self.num_lanes) + (2 * self.num_rl)))] self.visible = [] self.update_veh_id() speeds = [] for (i, rl_id) in enumerate(self.rl_veh): x = self.k.vehicle.get_x_by_id(rl_id) if (x == (- 1001)): continue ...
def checkWaitingPersons(self): 'check whether a person has requested to cross the street' for edge in self.WALKINGAREAS: peds = self.k.kernel_api.edge.getLastStepPersonIDs(edge) for ped in peds: if ((self.k.kernel_api.person.getWaitingTime(ped) == 1) and (self.k.kernel_api.person.get...
3,743,804,071,605,469,000
check whether a person has requested to cross the street
traci_pedestrian_crossing/movexy_ped.py
checkWaitingPersons
KarlRong/Safe-RL-for-Driving
python
def checkWaitingPersons(self): for edge in self.WALKINGAREAS: peds = self.k.kernel_api.edge.getLastStepPersonIDs(edge) for ped in peds: if ((self.k.kernel_api.person.getWaitingTime(ped) == 1) and (self.k.kernel_api.person.getNextEdge(ped) in self.CROSSINGS)): numWait...
def step(self, rl_actions): "Advance the environment by one step.\n\n Assigns actions to autonomous and human-driven agents (i.e. vehicles,\n traffic lights, etc...). Actions that are not assigned are left to the\n control of the simulator. The actions are then used to advance the\n simu...
2,799,618,293,451,251,000
Advance the environment by one step. Assigns actions to autonomous and human-driven agents (i.e. vehicles, traffic lights, etc...). Actions that are not assigned are left to the control of the simulator. The actions are then used to advance the simulator by the number of time steps requested per environment step. Res...
traci_pedestrian_crossing/movexy_ped.py
step
KarlRong/Safe-RL-for-Driving
python
def step(self, rl_actions): "Advance the environment by one step.\n\n Assigns actions to autonomous and human-driven agents (i.e. vehicles,\n traffic lights, etc...). Actions that are not assigned are left to the\n control of the simulator. The actions are then used to advance the\n simu...
def reset(self): 'See parent class.\n\n This also includes updating the initial absolute position and previous\n position.\n ' self.rl_queue.clear() self.rl_veh.clear() obs = super().reset() print('reset') for veh_id in self.k.vehicle.get_ids(): self.absolute_positio...
-2,498,678,424,320,711,000
See parent class. This also includes updating the initial absolute position and previous position.
traci_pedestrian_crossing/movexy_ped.py
reset
KarlRong/Safe-RL-for-Driving
python
def reset(self): 'See parent class.\n\n This also includes updating the initial absolute position and previous\n position.\n ' self.rl_queue.clear() self.rl_veh.clear() obs = super().reset() print('reset') for veh_id in self.k.vehicle.get_ids(): self.absolute_positio...
def loss_fn(outputs, labels): '\n Compute the cross entropy loss given outputs and labels.\n\n Args:\n outputs: (Variable) dimension batch_size x 6 - output of the model\n labels: (Variable) dimension batch_size, where each element is a value in [0, 1, 2, 3, 4, 5]\n\n Returns:\n loss (...
-8,691,466,486,941,953,000
Compute the cross entropy loss given outputs and labels. Args: outputs: (Variable) dimension batch_size x 6 - output of the model labels: (Variable) dimension batch_size, where each element is a value in [0, 1, 2, 3, 4, 5] Returns: loss (Variable): cross entropy loss for all images in the batch Note: you...
model/studentB.py
loss_fn
eungbean/knowledge-distillation-cifar10
python
def loss_fn(outputs, labels): '\n Compute the cross entropy loss given outputs and labels.\n\n Args:\n outputs: (Variable) dimension batch_size x 6 - output of the model\n labels: (Variable) dimension batch_size, where each element is a value in [0, 1, 2, 3, 4, 5]\n\n Returns:\n loss (...
def loss_fn_kd(outputs, labels, teacher_outputs, params): '\n Compute the knowledge-distillation (KD) loss given outputs, labels.\n "Hyperparameters": temperature and alpha\n\n NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher\n and student expects the input tensor to be log probabil...
3,821,292,463,632,088,000
Compute the knowledge-distillation (KD) loss given outputs, labels. "Hyperparameters": temperature and alpha NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher and student expects the input tensor to be log probabilities! See Issue #2
model/studentB.py
loss_fn_kd
eungbean/knowledge-distillation-cifar10
python
def loss_fn_kd(outputs, labels, teacher_outputs, params): '\n Compute the knowledge-distillation (KD) loss given outputs, labels.\n "Hyperparameters": temperature and alpha\n\n NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher\n and student expects the input tensor to be log probabil...
def accuracy(outputs, labels): '\n Compute the accuracy, given the outputs and labels for all images.\n\n Args:\n outputs: (np.ndarray) output of the model\n labels: (np.ndarray) [0, 1, ..., num_classes-1]\n\n Returns: (float) accuracy in [0,1]\n ' outputs = np.argmax(outputs, axis=1) ...
-2,892,165,881,102,442,500
Compute the accuracy, given the outputs and labels for all images. Args: outputs: (np.ndarray) output of the model labels: (np.ndarray) [0, 1, ..., num_classes-1] Returns: (float) accuracy in [0,1]
model/studentB.py
accuracy
eungbean/knowledge-distillation-cifar10
python
def accuracy(outputs, labels): '\n Compute the accuracy, given the outputs and labels for all images.\n\n Args:\n outputs: (np.ndarray) output of the model\n labels: (np.ndarray) [0, 1, ..., num_classes-1]\n\n Returns: (float) accuracy in [0,1]\n ' outputs = np.argmax(outputs, axis=1) ...
def __init__(self, params): '\n We define an convolutional network that predicts the sign from an image. The components\n required are:\n\n Args:\n params: (Params) contains num_channels\n ' super(studentB, self).__init__() self.num_channels = params.num_channels s...
7,160,409,673,777,569,000
We define an convolutional network that predicts the sign from an image. The components required are: Args: params: (Params) contains num_channels
model/studentB.py
__init__
eungbean/knowledge-distillation-cifar10
python
def __init__(self, params): '\n We define an convolutional network that predicts the sign from an image. The components\n required are:\n\n Args:\n params: (Params) contains num_channels\n ' super(studentB, self).__init__() self.num_channels = params.num_channels s...
def forward(self, s): '\n This function defines how we use the components of our network to operate on an input batch.\n\n Args:\n s: (Variable) contains a batch of images, of dimension batch_size x 3 x 32 x 32 .\n\n Returns:\n out: (Variable) dimension batch_size x 6 with...
-3,429,025,557,422,772,700
This function defines how we use the components of our network to operate on an input batch. Args: s: (Variable) contains a batch of images, of dimension batch_size x 3 x 32 x 32 . Returns: out: (Variable) dimension batch_size x 6 with the log probabilities for the labels of each image. Note: the dimensions ...
model/studentB.py
forward
eungbean/knowledge-distillation-cifar10
python
def forward(self, s): '\n This function defines how we use the components of our network to operate on an input batch.\n\n Args:\n s: (Variable) contains a batch of images, of dimension batch_size x 3 x 32 x 32 .\n\n Returns:\n out: (Variable) dimension batch_size x 6 with...
def create_or_get_cache_dir(self, module=''): 'create (if not exists) or return cache dir path for module' cache_dir = '{}/{}'.format(self.__cache_dir, module) if (not os.path.exists(cache_dir)): os.makedirs(cache_dir) return cache_dir
-3,946,185,517,127,907,300
create (if not exists) or return cache dir path for module
ods/ods.py
create_or_get_cache_dir
open-datastudio/ods
python
def create_or_get_cache_dir(self, module=): cache_dir = '{}/{}'.format(self.__cache_dir, module) if (not os.path.exists(cache_dir)): os.makedirs(cache_dir) return cache_dir
def main(): 'Run the simulation that infers an embedding for three groups.' n_stimuli = 30 n_dim = 4 n_group = 3 n_restart = 1 epochs = 1000 n_trial = 2000 batch_size = 128 model_true = ground_truth(n_stimuli, n_dim, n_group) generator = psiz.trials.RandomRank(n_stimuli, n_refere...
-4,177,223,168,496,596,500
Run the simulation that infers an embedding for three groups.
examples/rank/mle_3g.py
main
rgerkin/psiz
python
def main(): n_stimuli = 30 n_dim = 4 n_group = 3 n_restart = 1 epochs = 1000 n_trial = 2000 batch_size = 128 model_true = ground_truth(n_stimuli, n_dim, n_group) generator = psiz.trials.RandomRank(n_stimuli, n_reference=8, n_select=2) docket = generator.generate(n_trial) ...
def ground_truth(n_stimuli, n_dim, n_group): 'Return a ground truth embedding.' stimuli = tf.keras.layers.Embedding((n_stimuli + 1), n_dim, mask_zero=True, embeddings_initializer=tf.keras.initializers.RandomNormal(stddev=0.17)) shared_similarity = psiz.keras.layers.ExponentialSimilarity(trainable=False, bet...
3,894,005,208,590,680,600
Return a ground truth embedding.
examples/rank/mle_3g.py
ground_truth
rgerkin/psiz
python
def ground_truth(n_stimuli, n_dim, n_group): stimuli = tf.keras.layers.Embedding((n_stimuli + 1), n_dim, mask_zero=True, embeddings_initializer=tf.keras.initializers.RandomNormal(stddev=0.17)) shared_similarity = psiz.keras.layers.ExponentialSimilarity(trainable=False, beta_initializer=tf.keras.initializer...
def build_model(n_stimuli, n_dim, n_group): 'Build model.\n\n Arguments:\n n_stimuli: Integer indicating the number of stimuli in the\n embedding.\n n_dim: Integer indicating the dimensionality of the embedding.\n\n Returns:\n model: A TensorFlow Keras model.\n\n ' stimu...
3,748,000,712,402,987,500
Build model. Arguments: n_stimuli: Integer indicating the number of stimuli in the embedding. n_dim: Integer indicating the dimensionality of the embedding. Returns: model: A TensorFlow Keras model.
examples/rank/mle_3g.py
build_model
rgerkin/psiz
python
def build_model(n_stimuli, n_dim, n_group): 'Build model.\n\n Arguments:\n n_stimuli: Integer indicating the number of stimuli in the\n embedding.\n n_dim: Integer indicating the dimensionality of the embedding.\n\n Returns:\n model: A TensorFlow Keras model.\n\n ' stimu...
def build_kernel(similarity, n_dim): 'Build kernel for single group.' mink = psiz.keras.layers.Minkowski(rho_trainable=False, rho_initializer=tf.keras.initializers.Constant(2.0), w_constraint=psiz.keras.constraints.NonNegNorm(scale=n_dim, p=1.0)) kernel = psiz.keras.layers.DistanceBased(distance=mink, simil...
-5,725,182,606,263,217,000
Build kernel for single group.
examples/rank/mle_3g.py
build_kernel
rgerkin/psiz
python
def build_kernel(similarity, n_dim): mink = psiz.keras.layers.Minkowski(rho_trainable=False, rho_initializer=tf.keras.initializers.Constant(2.0), w_constraint=psiz.keras.constraints.NonNegNorm(scale=n_dim, p=1.0)) kernel = psiz.keras.layers.DistanceBased(distance=mink, similarity=similarity) return ker...
def __repr__(self): 'Return a string representation of the device.' return '<WeMo LightSwitch "{name}">'.format(name=self.name)
-6,814,544,005,257,611,000
Return a string representation of the device.
pywemo/ouimeaux_device/lightswitch.py
__repr__
GarlicToum/pywemo
python
def __repr__(self): return '<WeMo LightSwitch "{name}">'.format(name=self.name)
@property def device_type(self): 'Return what kind of WeMo this device is.' return 'LightSwitch'
1,603,105,175,854,432,300
Return what kind of WeMo this device is.
pywemo/ouimeaux_device/lightswitch.py
device_type
GarlicToum/pywemo
python
@property def device_type(self): return 'LightSwitch'
def send_single_ans(self, ID, name: str): '\n Send a single message to specific id with a specific name.\n\n :params ID: User quiz id.\n :type ID: int\n :params name: Name you want on the message.\n :type name: str\n ' self.data = {'userFullName': name, 'userQuizId': 1}...
-2,713,328,840,263,826,000
Send a single message to specific id with a specific name. :params ID: User quiz id. :type ID: int :params name: Name you want on the message. :type name: str
buddymojoAPI/BuddyMojoAPI.py
send_single_ans
jasonjustin/BuddymojoAPI
python
def send_single_ans(self, ID, name: str): '\n Send a single message to specific id with a specific name.\n\n :params ID: User quiz id.\n :type ID: int\n :params name: Name you want on the message.\n :type name: str\n ' self.data = {'userFullName': name, 'userQuizId': 1}...
def send_range_ans(self, start, end, name: str): '\n Send messages to a range of users id.\n\n :params start: The start user id.\n :type start: int\n :params end: The end user id.\n :type end: int\n :params name: The name you want.\n :type name: str\n ' fo...
-2,403,878,059,931,526,700
Send messages to a range of users id. :params start: The start user id. :type start: int :params end: The end user id. :type end: int :params name: The name you want. :type name: str
buddymojoAPI/BuddyMojoAPI.py
send_range_ans
jasonjustin/BuddymojoAPI
python
def send_range_ans(self, start, end, name: str): '\n Send messages to a range of users id.\n\n :params start: The start user id.\n :type start: int\n :params end: The end user id.\n :type end: int\n :params name: The name you want.\n :type name: str\n ' fo...
def get_userQuizId(self, encUserQuizId): '\n Returns a user id string of the encUserQuizId.\n ' try: req = requests.request('GET', str((match + encUserQuizId))) data = json.loads(req.text) print(data) except: return 'User not found'
-5,446,436,008,461,802,000
Returns a user id string of the encUserQuizId.
buddymojoAPI/BuddyMojoAPI.py
get_userQuizId
jasonjustin/BuddymojoAPI
python
def get_userQuizId(self, encUserQuizId): '\n \n ' try: req = requests.request('GET', str((match + encUserQuizId))) data = json.loads(req.text) print(data) except: return 'User not found'
def get_link(self, ID): '\n Returns a url string of the id.\n\n :params ID: The id to get the url from.\n :type ID: int\n :returns: A url string.\n :rtype: String\n ' self.payloadf.update(userQuizId=ID) try: req = requests.request('GET', self.url, params=sel...
8,604,263,190,504,289,000
Returns a url string of the id. :params ID: The id to get the url from. :type ID: int :returns: A url string. :rtype: String
buddymojoAPI/BuddyMojoAPI.py
get_link
jasonjustin/BuddymojoAPI
python
def get_link(self, ID): '\n Returns a url string of the id.\n\n :params ID: The id to get the url from.\n :type ID: int\n :returns: A url string.\n :rtype: String\n ' self.payloadf.update(userQuizId=ID) try: req = requests.request('GET', self.url, params=sel...
def _detect_thread_group(self, executor): '\n Detect preferred thread group\n :param executor:\n :return:\n ' tg = self.TG if (not self.force_ctg): return tg msg = 'Thread group detection: %s, regular ThreadGroup will be used' if (not self.load.duration): ...
-4,644,660,773,016,732,000
Detect preferred thread group :param executor: :return:
bzt/jmx/tools.py
_detect_thread_group
greyfenrir/taurus
python
def _detect_thread_group(self, executor): '\n Detect preferred thread group\n :param executor:\n :return:\n ' tg = self.TG if (not self.force_ctg): return tg msg = 'Thread group detection: %s, regular ThreadGroup will be used' if (not self.load.duration): ...
def _divide_concurrency(self, concurrency_list): '\n calculate target concurrency for every thread group\n ' total_old_concurrency = sum(concurrency_list) for (idx, concurrency) in enumerate(concurrency_list): if (total_old_concurrency and (concurrency_list[idx] != 0)): par...
209,768,109,835,262,200
calculate target concurrency for every thread group
bzt/jmx/tools.py
_divide_concurrency
greyfenrir/taurus
python
def _divide_concurrency(self, concurrency_list): '\n \n ' total_old_concurrency = sum(concurrency_list) for (idx, concurrency) in enumerate(concurrency_list): if (total_old_concurrency and (concurrency_list[idx] != 0)): part_of_load = (((1.0 * self.load.concurrency) * concu...
def _add_shaper(self, jmx): '\n Add shaper\n :param jmx: JMX\n :return:\n ' if (not self.load.duration): self.log.warning("You must set 'ramp-up' and/or 'hold-for' when using 'throughput' option") return etree_shaper = jmx.get_rps_shaper() if self.load.ramp_up...
5,178,974,408,345,509,000
Add shaper :param jmx: JMX :return:
bzt/jmx/tools.py
_add_shaper
greyfenrir/taurus
python
def _add_shaper(self, jmx): '\n Add shaper\n :param jmx: JMX\n :return:\n ' if (not self.load.duration): self.log.warning("You must set 'ramp-up' and/or 'hold-for' when using 'throughput' option") return etree_shaper = jmx.get_rps_shaper() if self.load.ramp_up...
def __init__(self, executor, original=None): '\n :type executor: ScenarioExecutor\n :type original: JMX\n ' super(JMeterScenarioBuilder, self).__init__(original) self.executor = executor self.scenario = executor.get_scenario() self.engine = executor.engine self.system_props ...
11,199,671,135,209,920
:type executor: ScenarioExecutor :type original: JMX
bzt/jmx/tools.py
__init__
greyfenrir/taurus
python
def __init__(self, executor, original=None): '\n :type executor: ScenarioExecutor\n :type original: JMX\n ' super(JMeterScenarioBuilder, self).__init__(original) self.executor = executor self.scenario = executor.get_scenario() self.engine = executor.engine self.system_props ...
@staticmethod def __add_jsr_elements(children, req, get_from_config=True): '\n :type children: etree.Element\n :type req: Request\n ' jsrs = [] if get_from_config: jsrs = req.config.get('jsr223', []) else: jsrs = req.get('jsr223', []) if (not isinstance(jsrs, lis...
-3,542,814,545,030,569,500
:type children: etree.Element :type req: Request
bzt/jmx/tools.py
__add_jsr_elements
greyfenrir/taurus
python
@staticmethod def __add_jsr_elements(children, req, get_from_config=True): '\n :type children: etree.Element\n :type req: Request\n ' jsrs = [] if get_from_config: jsrs = req.config.get('jsr223', []) else: jsrs = req.get('jsr223', []) if (not isinstance(jsrs, lis...
def compile_request(self, request): '\n\n :type request: HierarchicHTTPRequest\n :return:\n ' sampler = children = None protocol_name = request.priority_option('protocol', default=self.default_protocol) if (protocol_name in self.protocol_handlers): protocol = self.protocol_h...
-1,291,728,201,988,147,500
:type request: HierarchicHTTPRequest :return:
bzt/jmx/tools.py
compile_request
greyfenrir/taurus
python
def compile_request(self, request): '\n\n :type request: HierarchicHTTPRequest\n :return:\n ' sampler = children = None protocol_name = request.priority_option('protocol', default=self.default_protocol) if (protocol_name in self.protocol_handlers): protocol = self.protocol_h...
def compile_foreach_block(self, block): '\n :type block: ForEachBlock\n ' elements = [] controller = JMX._get_foreach_controller(block.input_var, block.loop_var) children = etree.Element('hashTree') for compiled in self.compile_requests(block.requests): for element in compiled:...
3,921,619,715,577,166,300
:type block: ForEachBlock
bzt/jmx/tools.py
compile_foreach_block
greyfenrir/taurus
python
def compile_foreach_block(self, block): '\n \n ' elements = [] controller = JMX._get_foreach_controller(block.input_var, block.loop_var) children = etree.Element('hashTree') for compiled in self.compile_requests(block.requests): for element in compiled: children.app...
def compile_action_block(self, block): '\n :type block: ActionBlock\n :return:\n ' actions = {'stop': 0, 'pause': 1, 'stop-now': 2, 'continue': 3} targets = {'current-thread': 0, 'all-threads': 2} action = actions[block.action] target = targets[block.target] duration = 0 ...
7,389,238,544,759,741,000
:type block: ActionBlock :return:
bzt/jmx/tools.py
compile_action_block
greyfenrir/taurus
python
def compile_action_block(self, block): '\n :type block: ActionBlock\n :return:\n ' actions = {'stop': 0, 'pause': 1, 'stop-now': 2, 'continue': 3} targets = {'current-thread': 0, 'all-threads': 2} action = actions[block.action] target = targets[block.target] duration = 0 ...
def __generate(self): '\n Generate the test plan\n ' thread_group = JMX.get_thread_group(testname=self.executor.label) thread_group_ht = etree.Element('hashTree', type='tg') self.request_compiler = RequestCompiler(self) for element in self.compile_scenario(self.scenario): threa...
-7,969,458,648,921,240,000
Generate the test plan
bzt/jmx/tools.py
__generate
greyfenrir/taurus
python
def __generate(self): '\n \n ' thread_group = JMX.get_thread_group(testname=self.executor.label) thread_group_ht = etree.Element('hashTree', type='tg') self.request_compiler = RequestCompiler(self) for element in self.compile_scenario(self.scenario): thread_group_ht.append(elem...
def save(self, filename): '\n Generate test plan and save\n\n :type filename: str\n ' self.__generate() super(JMeterScenarioBuilder, self).save(filename)
861,738,620,378,334,000
Generate test plan and save :type filename: str
bzt/jmx/tools.py
save
greyfenrir/taurus
python
def save(self, filename): '\n Generate test plan and save\n\n :type filename: str\n ' self.__generate() super(JMeterScenarioBuilder, self).save(filename)
@staticmethod def __gen_authorization(scenario): '\n Generates HTTP Authorization Manager\n\n ' elements = [] authorizations = scenario.get('authorization') if authorizations: clear_flag = False if isinstance(authorizations, dict): if (('clear' in authorizations...
4,335,678,651,450,887,000
Generates HTTP Authorization Manager
bzt/jmx/tools.py
__gen_authorization
greyfenrir/taurus
python
@staticmethod def __gen_authorization(scenario): '\n \n\n ' elements = [] authorizations = scenario.get('authorization') if authorizations: clear_flag = False if isinstance(authorizations, dict): if (('clear' in authorizations) or ('list' in authorizations)): ...
def __init__(self, label=None, display_order=None, local_vars_configuration=None): 'PropertyGroupUpdate - a model defined in OpenAPI' if (local_vars_configuration is None): local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._label = None ...
5,236,590,290,660,018,000
PropertyGroupUpdate - a model defined in OpenAPI
hubspot/crm/properties/models/property_group_update.py
__init__
cclauss/hubspot-api-python
python
def __init__(self, label=None, display_order=None, local_vars_configuration=None): if (local_vars_configuration is None): local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._label = None self._display_order = None self.discriminator ...
@property def label(self): 'Gets the label of this PropertyGroupUpdate. # noqa: E501\n\n A human-readable label that will be shown in HubSpot. # noqa: E501\n\n :return: The label of this PropertyGroupUpdate. # noqa: E501\n :rtype: str\n ' return self._label
2,917,488,915,512,171,500
Gets the label of this PropertyGroupUpdate. # noqa: E501 A human-readable label that will be shown in HubSpot. # noqa: E501 :return: The label of this PropertyGroupUpdate. # noqa: E501 :rtype: str
hubspot/crm/properties/models/property_group_update.py
label
cclauss/hubspot-api-python
python
@property def label(self): 'Gets the label of this PropertyGroupUpdate. # noqa: E501\n\n A human-readable label that will be shown in HubSpot. # noqa: E501\n\n :return: The label of this PropertyGroupUpdate. # noqa: E501\n :rtype: str\n ' return self._label
@label.setter def label(self, label): 'Sets the label of this PropertyGroupUpdate.\n\n A human-readable label that will be shown in HubSpot. # noqa: E501\n\n :param label: The label of this PropertyGroupUpdate. # noqa: E501\n :type: str\n ' self._label = label
3,503,763,217,207,940,000
Sets the label of this PropertyGroupUpdate. A human-readable label that will be shown in HubSpot. # noqa: E501 :param label: The label of this PropertyGroupUpdate. # noqa: E501 :type: str
hubspot/crm/properties/models/property_group_update.py
label
cclauss/hubspot-api-python
python
@label.setter def label(self, label): 'Sets the label of this PropertyGroupUpdate.\n\n A human-readable label that will be shown in HubSpot. # noqa: E501\n\n :param label: The label of this PropertyGroupUpdate. # noqa: E501\n :type: str\n ' self._label = label
@property def display_order(self): 'Gets the display_order of this PropertyGroupUpdate. # noqa: E501\n\n Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. # noqa: E501\n\n :ret...
5,386,896,482,861,787,000
Gets the display_order of this PropertyGroupUpdate. # noqa: E501 Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. # noqa: E501 :return: The display_order of this PropertyGroupUpdate. # noqa:...
hubspot/crm/properties/models/property_group_update.py
display_order
cclauss/hubspot-api-python
python
@property def display_order(self): 'Gets the display_order of this PropertyGroupUpdate. # noqa: E501\n\n Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. # noqa: E501\n\n :ret...
@display_order.setter def display_order(self, display_order): 'Sets the display_order of this PropertyGroupUpdate.\n\n Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. # noqa: E501\n\...
-5,371,300,951,071,094,000
Sets the display_order of this PropertyGroupUpdate. Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. # noqa: E501 :param display_order: The display_order of this PropertyGroupUpdate. # noqa: ...
hubspot/crm/properties/models/property_group_update.py
display_order
cclauss/hubspot-api-python
python
@display_order.setter def display_order(self, display_order): 'Sets the display_order of this PropertyGroupUpdate.\n\n Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. # noqa: E501\n\...
def to_dict(self): 'Returns the model properties as a dict' result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) e...
8,442,519,487,048,767,000
Returns the model properties as a dict
hubspot/crm/properties/models/property_group_update.py
to_dict
cclauss/hubspot-api-python
python
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): ...
def to_str(self): 'Returns the string representation of the model' return pprint.pformat(self.to_dict())
5,849,158,643,760,736,000
Returns the string representation of the model
hubspot/crm/properties/models/property_group_update.py
to_str
cclauss/hubspot-api-python
python
def to_str(self): return pprint.pformat(self.to_dict())
def __repr__(self): 'For `print` and `pprint`' return self.to_str()
-8,960,031,694,814,905,000
For `print` and `pprint`
hubspot/crm/properties/models/property_group_update.py
__repr__
cclauss/hubspot-api-python
python
def __repr__(self): return self.to_str()
def __eq__(self, other): 'Returns true if both objects are equal' if (not isinstance(other, PropertyGroupUpdate)): return False return (self.to_dict() == other.to_dict())
-2,793,007,724,244,214,000
Returns true if both objects are equal
hubspot/crm/properties/models/property_group_update.py
__eq__
cclauss/hubspot-api-python
python
def __eq__(self, other): if (not isinstance(other, PropertyGroupUpdate)): return False return (self.to_dict() == other.to_dict())
def __ne__(self, other): 'Returns true if both objects are not equal' if (not isinstance(other, PropertyGroupUpdate)): return True return (self.to_dict() != other.to_dict())
-8,805,428,320,412,282,000
Returns true if both objects are not equal
hubspot/crm/properties/models/property_group_update.py
__ne__
cclauss/hubspot-api-python
python
def __ne__(self, other): if (not isinstance(other, PropertyGroupUpdate)): return True return (self.to_dict() != other.to_dict())
@property def hexagonal_edges(self): 'Gets the three half-edges on the hexagonal boundary incident to a black node and point in ccw direction.' first = self.half_edge res = [first] second = first.opposite.next.opposite.next res.append(second) third = second.opposite.next.opposite.next res.ap...
6,849,385,400,819,632,000
Gets the three half-edges on the hexagonal boundary incident to a black node and point in ccw direction.
planar_graph_sampler/combinatorial_classes/dissection.py
hexagonal_edges
petrovp/networkx-related
python
@property def hexagonal_edges(self): first = self.half_edge res = [first] second = first.opposite.next.opposite.next res.append(second) third = second.opposite.next.opposite.next res.append(third) for he in res: assert (he.is_hexagonal and (he.color is 'black')) return res
def root_at_random_hexagonal_edge(self): 'Selects a random hexagonal half-edge and makes it the root.' self._half_edge = rnd.choice(self.hexagonal_edges)
8,306,759,444,568,594,000
Selects a random hexagonal half-edge and makes it the root.
planar_graph_sampler/combinatorial_classes/dissection.py
root_at_random_hexagonal_edge
petrovp/networkx-related
python
def root_at_random_hexagonal_edge(self): self._half_edge = rnd.choice(self.hexagonal_edges)
@property def is_admissible_slow(self): 'Checks if there is a path of length 3 with an inner edge from the root to the opposite outer vertex.' start_node = self.half_edge assert (start_node.color is 'black') end_node = self.half_edge.opposite.next.opposite.next.opposite assert (end_node.color is 'wh...
5,505,801,646,970,087,000
Checks if there is a path of length 3 with an inner edge from the root to the opposite outer vertex.
planar_graph_sampler/combinatorial_classes/dissection.py
is_admissible_slow
petrovp/networkx-related
python
@property def is_admissible_slow(self): start_node = self.half_edge assert (start_node.color is 'black') end_node = self.half_edge.opposite.next.opposite.next.opposite assert (end_node.color is 'white') start_node = start_node.node_nr end_node = end_node.node_nr g = self.to_networkx_gra...
@property def is_admissible(self): 'Checks if there is a path of length 3 with an inner edge from the root to the opposite outer vertex.' start_node = self.half_edge assert (start_node.color is 'black') end_node = self.half_edge.opposite.next.opposite.next.opposite assert (end_node.color is 'white')...
4,637,412,663,304,804,000
Checks if there is a path of length 3 with an inner edge from the root to the opposite outer vertex.
planar_graph_sampler/combinatorial_classes/dissection.py
is_admissible
petrovp/networkx-related
python
@property def is_admissible(self): start_node = self.half_edge assert (start_node.color is 'black') end_node = self.half_edge.opposite.next.opposite.next.opposite assert (end_node.color is 'white') queue = deque(list()) queue.append((self.half_edge, 0, False, set())) while (len(queue) !...
@property def u_size(self): 'The u-size is the number of inner faces.' return ((self.number_of_half_edges - 6) / 4)
7,695,950,379,170,463,000
The u-size is the number of inner faces.
planar_graph_sampler/combinatorial_classes/dissection.py
u_size
petrovp/networkx-related
python
@property def u_size(self): return ((self.number_of_half_edges - 6) / 4)
@property def l_size(self): 'The l-size is the number of black inner vertices.' node_dict = self.half_edge.node_dict() black_vertices = len([node_nr for node_nr in node_dict if (node_dict[node_nr][0].color is 'black')]) return (black_vertices - 3)
-6,482,723,490,751,050,000
The l-size is the number of black inner vertices.
planar_graph_sampler/combinatorial_classes/dissection.py
l_size
petrovp/networkx-related
python
@property def l_size(self): node_dict = self.half_edge.node_dict() black_vertices = len([node_nr for node_nr in node_dict if (node_dict[node_nr][0].color is 'black')]) return (black_vertices - 3)
def to_networkx_graph(self, include_unpaired=None): 'Converts to networkx graph, encodes hexagonal nodes with colors.' from planar_graph_sampler.combinatorial_classes.half_edge_graph import color_scale nodes = self.half_edge.node_dict() G = super(IrreducibleDissection, self).to_networkx_graph(include_un...
-7,118,483,803,622,384,000
Converts to networkx graph, encodes hexagonal nodes with colors.
planar_graph_sampler/combinatorial_classes/dissection.py
to_networkx_graph
petrovp/networkx-related
python
def to_networkx_graph(self, include_unpaired=None): from planar_graph_sampler.combinatorial_classes.half_edge_graph import color_scale nodes = self.half_edge.node_dict() G = super(IrreducibleDissection, self).to_networkx_graph(include_unpaired=False) for v in G: if any([he.is_hexagonal for ...
def read_json(json_file: str, debug=False) -> List[Dict]: '\n reads the json files, and formats the description that\n is associated with each of the json dictionaries that are read in.\n\n :param json_file: json file to parse from\n :param debug: if set to true, will print the json dictionaries as\n ...
-2,822,950,693,851,630,000
reads the json files, and formats the description that is associated with each of the json dictionaries that are read in. :param json_file: json file to parse from :param debug: if set to true, will print the json dictionaries as they are read in :return: list of all of the json dictionaries
app.py
read_json
Jim-Shaddix/Personal-Website
python
def read_json(json_file: str, debug=False) -> List[Dict]: '\n reads the json files, and formats the description that\n is associated with each of the json dictionaries that are read in.\n\n :param json_file: json file to parse from\n :param debug: if set to true, will print the json dictionaries as\n ...
def translate_batch(self, batch, fast=False): "\n Translate a batch of sentences.\n\n Mostly a wrapper around :obj:`Beam`.\n\n Args:\n batch (:obj:`Batch`): a batch from a dataset object\n data (:obj:`Dataset`): the dataset object\n fast (bool): enables fast beam s...
-2,044,400,624,652,274,400
Translate a batch of sentences. Mostly a wrapper around :obj:`Beam`. Args: batch (:obj:`Batch`): a batch from a dataset object data (:obj:`Dataset`): the dataset object fast (bool): enables fast beam search (may not support all features) Todo: Shouldn't need the original dataset.
src/models/predictor.py
translate_batch
SebastianVeile/PreSumm
python
def translate_batch(self, batch, fast=False): "\n Translate a batch of sentences.\n\n Mostly a wrapper around :obj:`Beam`.\n\n Args:\n batch (:obj:`Batch`): a batch from a dataset object\n data (:obj:`Dataset`): the dataset object\n fast (bool): enables fast beam s...
def log(self, sent_number): '\n Log translation.\n ' output = '\nSENT {}: {}\n'.format(sent_number, self.src_raw) best_pred = self.pred_sents[0] best_score = self.pred_scores[0] pred_sent = ' '.join(best_pred) output += 'PRED {}: {}\n'.format(sent_number, pred_sent) output += '...
6,652,500,622,530,272,000
Log translation.
src/models/predictor.py
log
SebastianVeile/PreSumm
python
def log(self, sent_number): '\n \n ' output = '\nSENT {}: {}\n'.format(sent_number, self.src_raw) best_pred = self.pred_sents[0] best_score = self.pred_scores[0] pred_sent = ' '.join(best_pred) output += 'PRED {}: {}\n'.format(sent_number, pred_sent) output += 'PRED SCORE: {:.4...
def test_get_scalars_with_actual_inf_and_nan(self): 'Test for get_scalars() call that involve inf and nan in user data.' mock_api_client = mock.Mock() def stream_experiment_data(request, **kwargs): self.assertEqual(request.experiment_id, '789') self.assertEqual(kwargs['metadata'], grpc_util...
2,623,809,314,212,357,600
Test for get_scalars() call that involve inf and nan in user data.
tensorboard/data/experimental/experiment_from_dev_test.py
test_get_scalars_with_actual_inf_and_nan
AseiSugiyama/tensorboard
python
def test_get_scalars_with_actual_inf_and_nan(self): mock_api_client = mock.Mock() def stream_experiment_data(request, **kwargs): self.assertEqual(request.experiment_id, '789') self.assertEqual(kwargs['metadata'], grpc_util.version_metadata()) response = export_service_pb2.StreamExp...
def class_from_module_path(module_path: Text, lookup_path: Optional[Text]=None) -> Type: 'Given the module name and path of a class, tries to retrieve the class.\n\n The loaded class can be used to instantiate new objects.\n\n Args:\n module_path: either an absolute path to a Python class,\n ...
-4,786,117,763,749,435,000
Given the module name and path of a class, tries to retrieve the class. The loaded class can be used to instantiate new objects. Args: module_path: either an absolute path to a Python class, or the name of the class in the local / global scope. lookup_path: a path where to load the class from...
rasa/shared/utils/common.py
class_from_module_path
GCES-2021-1/rasa
python
def class_from_module_path(module_path: Text, lookup_path: Optional[Text]=None) -> Type: 'Given the module name and path of a class, tries to retrieve the class.\n\n The loaded class can be used to instantiate new objects.\n\n Args:\n module_path: either an absolute path to a Python class,\n ...