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
795938340b7cd14325d3a130634b1c24ea8a74471066cd42c07608aaea4b7b3c
def test_set_basis_polynomial_family(): 'Test setting the basis_polynomial_family property.' m = 'askey' c.basis_polynomial_family = m assert_equal(c.basis_polynomial_family, m)
Test setting the basis_polynomial_family property.
dakotathon/tests/test_method_base_uq.py
test_set_basis_polynomial_family
csdms/dakotathon
8
python
def test_set_basis_polynomial_family(): m = 'askey' c.basis_polynomial_family = m assert_equal(c.basis_polynomial_family, m)
def test_set_basis_polynomial_family(): m = 'askey' c.basis_polynomial_family = m assert_equal(c.basis_polynomial_family, m)<|docstring|>Test setting the basis_polynomial_family property.<|endoftext|>
fff6f00d819b6b5a74a9121eee9f3a5f1dda4478462a27e86e80551c99cdd92e
@raises(TypeError) def test_basis_polynomial_family_fails_if_unknown_type(): 'Test that setting basis_polynomial_family to an unknown type fails.' value = 'foobar' c.basis_polynomial_family = value
Test that setting basis_polynomial_family to an unknown type fails.
dakotathon/tests/test_method_base_uq.py
test_basis_polynomial_family_fails_if_unknown_type
csdms/dakotathon
8
python
@raises(TypeError) def test_basis_polynomial_family_fails_if_unknown_type(): value = 'foobar' c.basis_polynomial_family = value
@raises(TypeError) def test_basis_polynomial_family_fails_if_unknown_type(): value = 'foobar' c.basis_polynomial_family = value<|docstring|>Test that setting basis_polynomial_family to an unknown type fails.<|endoftext|>
c7de538d10bedc64c879a5948b583254811ac11507b4763a9ea24177654ec91c
def test_get_probability_levels(): 'Test getting the probability_levels property.' assert_true((type(c.probability_levels) is tuple))
Test getting the probability_levels property.
dakotathon/tests/test_method_base_uq.py
test_get_probability_levels
csdms/dakotathon
8
python
def test_get_probability_levels(): assert_true((type(c.probability_levels) is tuple))
def test_get_probability_levels(): assert_true((type(c.probability_levels) is tuple))<|docstring|>Test getting the probability_levels property.<|endoftext|>
49af5d78c6f8c20cb16cfd207f304bff833eb3bb6d89e0af55aa2fd8c9b044e1
def test_set_probability_levels(): 'Test setting the probability_levels property.' m = Concrete() for items in [[0, 1], (0, 1)]: m.probability_levels = items assert_equal(m.probability_levels, items)
Test setting the probability_levels property.
dakotathon/tests/test_method_base_uq.py
test_set_probability_levels
csdms/dakotathon
8
python
def test_set_probability_levels(): m = Concrete() for items in [[0, 1], (0, 1)]: m.probability_levels = items assert_equal(m.probability_levels, items)
def test_set_probability_levels(): m = Concrete() for items in [[0, 1], (0, 1)]: m.probability_levels = items assert_equal(m.probability_levels, items)<|docstring|>Test setting the probability_levels property.<|endoftext|>
9e135467fc87112a401dd2e546013e4943649ef06c5c33b3eed20cc2db2db2f0
@raises(TypeError) def test_set_probability_levels_fails_if_scalar(): 'Test that the probability_levels property fails with scalar.' m = Concrete() pt = 42 m.probability_levels = pt
Test that the probability_levels property fails with scalar.
dakotathon/tests/test_method_base_uq.py
test_set_probability_levels_fails_if_scalar
csdms/dakotathon
8
python
@raises(TypeError) def test_set_probability_levels_fails_if_scalar(): m = Concrete() pt = 42 m.probability_levels = pt
@raises(TypeError) def test_set_probability_levels_fails_if_scalar(): m = Concrete() pt = 42 m.probability_levels = pt<|docstring|>Test that the probability_levels property fails with scalar.<|endoftext|>
06a5ece0f0854f78140ea6661126b7e2e21dccf946a8357a3fae1e92787a441a
def test_get_response_levels(): 'Test getting the response_levels property.' assert_true((type(c.response_levels) is tuple))
Test getting the response_levels property.
dakotathon/tests/test_method_base_uq.py
test_get_response_levels
csdms/dakotathon
8
python
def test_get_response_levels(): assert_true((type(c.response_levels) is tuple))
def test_get_response_levels(): assert_true((type(c.response_levels) is tuple))<|docstring|>Test getting the response_levels property.<|endoftext|>
4634e1a57fe4a9389978efffc818ea6973b254bad973ae019e35dadac3ddcf40
def test_set_response_levels(): 'Test setting the response_levels property.' m = Concrete() for items in [[0, 1], (0, 1)]: m.response_levels = items assert_equal(m.response_levels, items)
Test setting the response_levels property.
dakotathon/tests/test_method_base_uq.py
test_set_response_levels
csdms/dakotathon
8
python
def test_set_response_levels(): m = Concrete() for items in [[0, 1], (0, 1)]: m.response_levels = items assert_equal(m.response_levels, items)
def test_set_response_levels(): m = Concrete() for items in [[0, 1], (0, 1)]: m.response_levels = items assert_equal(m.response_levels, items)<|docstring|>Test setting the response_levels property.<|endoftext|>
ed386c46273b770f7f06b2e3483cc6bb2cba243c55caf2c4f13a50437e530a49
@raises(TypeError) def test_set_response_levels_fails_if_scalar(): 'Test that the response_levels property fails with scalar.' m = Concrete() pt = 42 m.response_levels = pt
Test that the response_levels property fails with scalar.
dakotathon/tests/test_method_base_uq.py
test_set_response_levels_fails_if_scalar
csdms/dakotathon
8
python
@raises(TypeError) def test_set_response_levels_fails_if_scalar(): m = Concrete() pt = 42 m.response_levels = pt
@raises(TypeError) def test_set_response_levels_fails_if_scalar(): m = Concrete() pt = 42 m.response_levels = pt<|docstring|>Test that the response_levels property fails with scalar.<|endoftext|>
e114606cef5f343a7e227dd5613b5694f4a51e670c9707f5419e7280816a3038
def test_get_samples(): 'Test getting the samples property.' assert_true((type(c.samples) is int))
Test getting the samples property.
dakotathon/tests/test_method_base_uq.py
test_get_samples
csdms/dakotathon
8
python
def test_get_samples(): assert_true((type(c.samples) is int))
def test_get_samples(): assert_true((type(c.samples) is int))<|docstring|>Test getting the samples property.<|endoftext|>
ae47dcde1a910ecba7c478210f14de194103f2b0fb0cd8bc658d940d425713ad
def test_set_samples(): 'Test setting the samples property.' m = Concrete() samples = 42 m.samples = samples assert_equal(m.samples, samples)
Test setting the samples property.
dakotathon/tests/test_method_base_uq.py
test_set_samples
csdms/dakotathon
8
python
def test_set_samples(): m = Concrete() samples = 42 m.samples = samples assert_equal(m.samples, samples)
def test_set_samples(): m = Concrete() samples = 42 m.samples = samples assert_equal(m.samples, samples)<|docstring|>Test setting the samples property.<|endoftext|>
2a6ad19c013a19cf621b0438e95164914c584f845ebb3743452ae8c0942d466b
@raises(TypeError) def test_set_samples_fails_if_float(): 'Test that the samples property fails with a float.' m = Concrete() samples = 42.0 m.samples = samples
Test that the samples property fails with a float.
dakotathon/tests/test_method_base_uq.py
test_set_samples_fails_if_float
csdms/dakotathon
8
python
@raises(TypeError) def test_set_samples_fails_if_float(): m = Concrete() samples = 42.0 m.samples = samples
@raises(TypeError) def test_set_samples_fails_if_float(): m = Concrete() samples = 42.0 m.samples = samples<|docstring|>Test that the samples property fails with a float.<|endoftext|>
02bf6f438f5461ef28ca2caa8bdfb92defc21baaa281fd0c9421bf079f0c0540
def test_get_sample_type(): 'Test getting the sample_type property.' assert_true(((c.sample_type == 'random') or (c.sample_type == 'lhs')))
Test getting the sample_type property.
dakotathon/tests/test_method_base_uq.py
test_get_sample_type
csdms/dakotathon
8
python
def test_get_sample_type(): assert_true(((c.sample_type == 'random') or (c.sample_type == 'lhs')))
def test_get_sample_type(): assert_true(((c.sample_type == 'random') or (c.sample_type == 'lhs')))<|docstring|>Test getting the sample_type property.<|endoftext|>
8dcd4a412a3eeb6d21035524187c549ba39e48e0c693597273f81a967c0140bd
def test_set_sample_type(): 'Test setting the sample_type property.' m = Concrete() sample_type = 'lhs' m.sample_type = sample_type assert_equal(m.sample_type, sample_type)
Test setting the sample_type property.
dakotathon/tests/test_method_base_uq.py
test_set_sample_type
csdms/dakotathon
8
python
def test_set_sample_type(): m = Concrete() sample_type = 'lhs' m.sample_type = sample_type assert_equal(m.sample_type, sample_type)
def test_set_sample_type(): m = Concrete() sample_type = 'lhs' m.sample_type = sample_type assert_equal(m.sample_type, sample_type)<|docstring|>Test setting the sample_type property.<|endoftext|>
6b88cf6fcaecc605ba8dd4b76694d57d34a0377eaf03e81da261e89033c7af49
@raises(TypeError) def test_set_sample_type_fails_if_not_lhs_or_random(): 'Test that the sample_type property fails with unknown type.' m = Concrete() sample_type = 'mcmc' m.sample_type = sample_type
Test that the sample_type property fails with unknown type.
dakotathon/tests/test_method_base_uq.py
test_set_sample_type_fails_if_not_lhs_or_random
csdms/dakotathon
8
python
@raises(TypeError) def test_set_sample_type_fails_if_not_lhs_or_random(): m = Concrete() sample_type = 'mcmc' m.sample_type = sample_type
@raises(TypeError) def test_set_sample_type_fails_if_not_lhs_or_random(): m = Concrete() sample_type = 'mcmc' m.sample_type = sample_type<|docstring|>Test that the sample_type property fails with unknown type.<|endoftext|>
334d680b7e5d159f537398ce0855c96f822c99b369124f5bd5775c91495eb9aa
def test_get_seed1(): 'Test getting the seed property.' assert_is_none(c.seed)
Test getting the seed property.
dakotathon/tests/test_method_base_uq.py
test_get_seed1
csdms/dakotathon
8
python
def test_get_seed1(): assert_is_none(c.seed)
def test_get_seed1(): assert_is_none(c.seed)<|docstring|>Test getting the seed property.<|endoftext|>
1560b7f2a9527902f307f08bcd4306a9127de633f16e0f753fe50d5738bf9892
def test_get_seed2(): 'Test getting the seed property.' m = Concrete(seed=42) assert_true((type(m.seed) is int))
Test getting the seed property.
dakotathon/tests/test_method_base_uq.py
test_get_seed2
csdms/dakotathon
8
python
def test_get_seed2(): m = Concrete(seed=42) assert_true((type(m.seed) is int))
def test_get_seed2(): m = Concrete(seed=42) assert_true((type(m.seed) is int))<|docstring|>Test getting the seed property.<|endoftext|>
231f08c3bd21b5770d07155fa8d408baf0dc24aeb615e17661013f92a7e4d5fd
def test_set_seed(): 'Test setting the seed property.' m = Concrete() seed = 42 m.seed = seed assert_equal(m.seed, seed)
Test setting the seed property.
dakotathon/tests/test_method_base_uq.py
test_set_seed
csdms/dakotathon
8
python
def test_set_seed(): m = Concrete() seed = 42 m.seed = seed assert_equal(m.seed, seed)
def test_set_seed(): m = Concrete() seed = 42 m.seed = seed assert_equal(m.seed, seed)<|docstring|>Test setting the seed property.<|endoftext|>
07cf22e34652ab3c25bee653eeee0f38f06a4515cf1ee229c1718c19c2f3e6b6
@raises(TypeError) def test_set_seed_fails_if_float(): 'Test that the seed property fails with a float.' m = Concrete() seed = 42.0 m.seed = seed
Test that the seed property fails with a float.
dakotathon/tests/test_method_base_uq.py
test_set_seed_fails_if_float
csdms/dakotathon
8
python
@raises(TypeError) def test_set_seed_fails_if_float(): m = Concrete() seed = 42.0 m.seed = seed
@raises(TypeError) def test_set_seed_fails_if_float(): m = Concrete() seed = 42.0 m.seed = seed<|docstring|>Test that the seed property fails with a float.<|endoftext|>
8271d8155832189588add08361277d3a5572afcf0be239c8cfcb5bc5e3a21a2a
def test_get_variance_based_decomp(): 'Test getting the variance_based_decomp property.' assert_true((type(c.variance_based_decomp) is bool))
Test getting the variance_based_decomp property.
dakotathon/tests/test_method_base_uq.py
test_get_variance_based_decomp
csdms/dakotathon
8
python
def test_get_variance_based_decomp(): assert_true((type(c.variance_based_decomp) is bool))
def test_get_variance_based_decomp(): assert_true((type(c.variance_based_decomp) is bool))<|docstring|>Test getting the variance_based_decomp property.<|endoftext|>
147d5090f2db6b312a24117752e7fc3bde8f509130b548e45b1a76846c20b2cf
def test_set_variance_based_decomp(): 'Test setting the variance_based_decomp property.' m = Concrete() variance_based_decomp = True m.variance_based_decomp = variance_based_decomp assert_equal(m.variance_based_decomp, variance_based_decomp)
Test setting the variance_based_decomp property.
dakotathon/tests/test_method_base_uq.py
test_set_variance_based_decomp
csdms/dakotathon
8
python
def test_set_variance_based_decomp(): m = Concrete() variance_based_decomp = True m.variance_based_decomp = variance_based_decomp assert_equal(m.variance_based_decomp, variance_based_decomp)
def test_set_variance_based_decomp(): m = Concrete() variance_based_decomp = True m.variance_based_decomp = variance_based_decomp assert_equal(m.variance_based_decomp, variance_based_decomp)<|docstring|>Test setting the variance_based_decomp property.<|endoftext|>
6ff973d3861d68be9871c655016a10ceba60de8a6225b5f3f752dcc7d526a80d
@raises(TypeError) def test_set_variance_based_decomp_fails_if_float(): 'Test that the variance_based_decomp property fails with a float.' m = Concrete() variance_based_decomp = 42.0 m.variance_based_decomp = variance_based_decomp
Test that the variance_based_decomp property fails with a float.
dakotathon/tests/test_method_base_uq.py
test_set_variance_based_decomp_fails_if_float
csdms/dakotathon
8
python
@raises(TypeError) def test_set_variance_based_decomp_fails_if_float(): m = Concrete() variance_based_decomp = 42.0 m.variance_based_decomp = variance_based_decomp
@raises(TypeError) def test_set_variance_based_decomp_fails_if_float(): m = Concrete() variance_based_decomp = 42.0 m.variance_based_decomp = variance_based_decomp<|docstring|>Test that the variance_based_decomp property fails with a float.<|endoftext|>
8cf1d13f6aec5c86641ccd188a27751e7641280afd204a49cf75470546ffc504
def test_str_special(): 'Test type of __str__ method results.' s = str(c) assert_true((type(s) is str))
Test type of __str__ method results.
dakotathon/tests/test_method_base_uq.py
test_str_special
csdms/dakotathon
8
python
def test_str_special(): s = str(c) assert_true((type(s) is str))
def test_str_special(): s = str(c) assert_true((type(s) is str))<|docstring|>Test type of __str__ method results.<|endoftext|>
1f7ce155b47c8814412d74889d8e30d56a374713d8f66fbdf0dc49481df74e15
def test_default_str_length(): 'Test the default length of __str__.' s = str(c) n_lines = len(s.splitlines()) assert_equal(n_lines, 6)
Test the default length of __str__.
dakotathon/tests/test_method_base_uq.py
test_default_str_length
csdms/dakotathon
8
python
def test_default_str_length(): s = str(c) n_lines = len(s.splitlines()) assert_equal(n_lines, 6)
def test_default_str_length(): s = str(c) n_lines = len(s.splitlines()) assert_equal(n_lines, 6)<|docstring|>Test the default length of __str__.<|endoftext|>
3e4f9848c10a8e1e5d90b1c99a25ddb1ae1894be7c48bfc52e91279126e5d9cd
def test_str_length_with_zero_seed_value(): 'Test the length of __str__ with seed = 0.' x = Concrete(seed=0) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 5)
Test the length of __str__ with seed = 0.
dakotathon/tests/test_method_base_uq.py
test_str_length_with_zero_seed_value
csdms/dakotathon
8
python
def test_str_length_with_zero_seed_value(): x = Concrete(seed=0) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 5)
def test_str_length_with_zero_seed_value(): x = Concrete(seed=0) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 5)<|docstring|>Test the length of __str__ with seed = 0.<|endoftext|>
047961ac0abf5974a8e1adbec7b33a1793c73f908e4fe48af94d8ed240221247
def test_str_length_with_nonzero_seed_value(): 'Test the length of __str__ with seed != 0.' x = Concrete(seed=42) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 6)
Test the length of __str__ with seed != 0.
dakotathon/tests/test_method_base_uq.py
test_str_length_with_nonzero_seed_value
csdms/dakotathon
8
python
def test_str_length_with_nonzero_seed_value(): x = Concrete(seed=42) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 6)
def test_str_length_with_nonzero_seed_value(): x = Concrete(seed=42) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 6)<|docstring|>Test the length of __str__ with seed != 0.<|endoftext|>
26b77b9d59131b0be7a8d23ef3afeb2541f2dfcfa42c248dd0b57597787cd418
def test_str_length_with_options(): 'Test the length of __str__ with optional props set.' x = Concrete(seed=42, probability_levels=list(range(3)), response_levels=list(range(3)), variance_based_decomp=True) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 8)
Test the length of __str__ with optional props set.
dakotathon/tests/test_method_base_uq.py
test_str_length_with_options
csdms/dakotathon
8
python
def test_str_length_with_options(): x = Concrete(seed=42, probability_levels=list(range(3)), response_levels=list(range(3)), variance_based_decomp=True) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 8)
def test_str_length_with_options(): x = Concrete(seed=42, probability_levels=list(range(3)), response_levels=list(range(3)), variance_based_decomp=True) s = str(x) n_lines = len(s.splitlines()) assert_equal(n_lines, 8)<|docstring|>Test the length of __str__ with optional props set.<|endoftext|>
46a5baae668eeba6ae1562b300bace52c8f1d35aa17242953e308ba74b347b9a
def test_print_levels1(): 'Test _print_levels with list and tuple.' for item in [[0, 1], (0, 1)]: s = _print_levels(item) assert_true((type(s) is str))
Test _print_levels with list and tuple.
dakotathon/tests/test_method_base_uq.py
test_print_levels1
csdms/dakotathon
8
python
def test_print_levels1(): for item in [[0, 1], (0, 1)]: s = _print_levels(item) assert_true((type(s) is str))
def test_print_levels1(): for item in [[0, 1], (0, 1)]: s = _print_levels(item) assert_true((type(s) is str))<|docstring|>Test _print_levels with list and tuple.<|endoftext|>
8cce2345d3cbde105b964a6e3e24279d86ebb743fb66f230346efe74bfe27aa4
def test_print_levels2(): 'Test _print_levels with list of tuples.' items = [(1, 2, 3), (4, 5, 6)] s = _print_levels(items) assert_true((type(s) is str))
Test _print_levels with list of tuples.
dakotathon/tests/test_method_base_uq.py
test_print_levels2
csdms/dakotathon
8
python
def test_print_levels2(): items = [(1, 2, 3), (4, 5, 6)] s = _print_levels(items) assert_true((type(s) is str))
def test_print_levels2(): items = [(1, 2, 3), (4, 5, 6)] s = _print_levels(items) assert_true((type(s) is str))<|docstring|>Test _print_levels with list of tuples.<|endoftext|>
e6e17a966da883fb5cab01e7f1ef9c30edb1c62091b45510603376918fa5ed81
def test_default_config(self): 'Check that if no config file exists, then default config is used.' reload(ana_photo_flow) with init_config() as config: for (section, subconfig) in _DEFAULT_CONFIG.items(): for (key, value) in subconfig.items(): self.assertEqual(config[section][key], value)
Check that if no config file exists, then default config is used.
tests/test_config_parser.py
test_default_config
ariegenature/ana-photo-flow
0
python
def test_default_config(self): reload(ana_photo_flow) with init_config() as config: for (section, subconfig) in _DEFAULT_CONFIG.items(): for (key, value) in subconfig.items(): self.assertEqual(config[section][key], value)
def test_default_config(self): reload(ana_photo_flow) with init_config() as config: for (section, subconfig) in _DEFAULT_CONFIG.items(): for (key, value) in subconfig.items(): self.assertEqual(config[section][key], value)<|docstring|>Check that if no config file exists, then default config is used.<|endoftext|>
03226d01543a965e19448bc6906ed256f70d0d6120a9619f6fa460ab0481297b
@patch('xdg.XDG_CONFIG_DIRS', new=MOCK_CONFIG_DIRS) def test_only_global_config(self): 'Check that if only global config file exists, then it is used.' reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://global_user:global_password@global_host/global_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:global_password@global_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])
Check that if only global config file exists, then it is used.
tests/test_config_parser.py
test_only_global_config
ariegenature/ana-photo-flow
0
python
@patch('xdg.XDG_CONFIG_DIRS', new=MOCK_CONFIG_DIRS) def test_only_global_config(self): reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://global_user:global_password@global_host/global_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:global_password@global_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])
@patch('xdg.XDG_CONFIG_DIRS', new=MOCK_CONFIG_DIRS) def test_only_global_config(self): reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://global_user:global_password@global_host/global_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:global_password@global_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])<|docstring|>Check that if only global config file exists, then it is used.<|endoftext|>
e66edd54b8965d98241eccda1a3dfd4b5b835cb160a35291a882922978f72226
@patch('xdg.XDG_CONFIG_HOME', new=MOCK_CONFIG_HOME) def test_only_local_config(self): 'Check that if only local config file exists, then it is used.' reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://local_user:local_password@local_host/local_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:local_password@local_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])
Check that if only local config file exists, then it is used.
tests/test_config_parser.py
test_only_local_config
ariegenature/ana-photo-flow
0
python
@patch('xdg.XDG_CONFIG_HOME', new=MOCK_CONFIG_HOME) def test_only_local_config(self): reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://local_user:local_password@local_host/local_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:local_password@local_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])
@patch('xdg.XDG_CONFIG_HOME', new=MOCK_CONFIG_HOME) def test_only_local_config(self): reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://local_user:local_password@local_host/local_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:local_password@local_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])<|docstring|>Check that if only local config file exists, then it is used.<|endoftext|>
7db798114ec3c9ad464ad469dd6cefa5c5ff79c53843770ab94b1b639697864f
@patch.dict('ana_photo_flow.os.environ', {'ANA_PHOTO_FLOW_CONF': MOCK_ANA_PHOTO_FLOW_CONF}) def test_only_env_config(self): 'Check that if only config file given by environment varialbe exists, then it is used.' reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://env_user:env_password@env_host/env_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:env_password@env_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])
Check that if only config file given by environment varialbe exists, then it is used.
tests/test_config_parser.py
test_only_env_config
ariegenature/ana-photo-flow
0
python
@patch.dict('ana_photo_flow.os.environ', {'ANA_PHOTO_FLOW_CONF': MOCK_ANA_PHOTO_FLOW_CONF}) def test_only_env_config(self): reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://env_user:env_password@env_host/env_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:env_password@env_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])
@patch.dict('ana_photo_flow.os.environ', {'ANA_PHOTO_FLOW_CONF': MOCK_ANA_PHOTO_FLOW_CONF}) def test_only_env_config(self): reload(ana_photo_flow) with init_config() as config: self.assertEqual(config['celery']['broker_url'], 'amqp://env_user:env_password@env_host/env_vhost') self.assertEqual(config['celery']['result_backend'], 'redis://:env_password@env_host') self.assertEqual(config['celery']['worker_log_format'], _DEFAULT_CONFIG['celery']['worker_log_format'])<|docstring|>Check that if only config file given by environment varialbe exists, then it is used.<|endoftext|>
7d8251f8ae70c0e535f9cbad95a32424f56259abebb03bd32f02caa69973a91f
def bin_img_preprocessing(rgbimg='test2.jpg'): 'Gives the binary image representation of an RGB image\n\n Given an RGB image, do the following image processing steps:\n 1) Convert to grayscale\n 2) Apply a Gaussian Blurring Filter to smooth image\n 3) Convert to a black/white image using Adaptive Gaussian thresholding\n 4) Apply morphological operations (opening and then closing)\n 5) Apply adaptive Gaussian thresholding again\n Returns a string of the binary image representation file\n\n Keyword arguments:\n rgbimg -- a string that represents the file of an RGB image of maze\n in JPEG, PNG, TIFF, BMP\n\n In the future, implement a way to manipulate the image contrast,\n brightness, and saturation to better preserve maze walls\n\n ' img = cv.imread(rgbimg, 0) blurred_img = cv.GaussianBlur(img, (5, 5), 0) bin_img = cv.adaptiveThreshold(blurred_img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2) for i in range(1, 5): bin_img = cv.morphologyEx(bin_img, cv.MORPH_OPEN, cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))) bin_img = cv.morphologyEx(bin_img, cv.MORPH_CLOSE, cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))) bin_img = cv.adaptiveThreshold(bin_img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2) did_write = cv.imwrite('bin_img.png', bin_img) if did_write: return 'bin_img.png'
Gives the binary image representation of an RGB image Given an RGB image, do the following image processing steps: 1) Convert to grayscale 2) Apply a Gaussian Blurring Filter to smooth image 3) Convert to a black/white image using Adaptive Gaussian thresholding 4) Apply morphological operations (opening and then closing) 5) Apply adaptive Gaussian thresholding again Returns a string of the binary image representation file Keyword arguments: rgbimg -- a string that represents the file of an RGB image of maze in JPEG, PNG, TIFF, BMP In the future, implement a way to manipulate the image contrast, brightness, and saturation to better preserve maze walls
lib/util/ImageProcessing/preprocessing.py
bin_img_preprocessing
Thukor/MazeSolver
5
python
def bin_img_preprocessing(rgbimg='test2.jpg'): 'Gives the binary image representation of an RGB image\n\n Given an RGB image, do the following image processing steps:\n 1) Convert to grayscale\n 2) Apply a Gaussian Blurring Filter to smooth image\n 3) Convert to a black/white image using Adaptive Gaussian thresholding\n 4) Apply morphological operations (opening and then closing)\n 5) Apply adaptive Gaussian thresholding again\n Returns a string of the binary image representation file\n\n Keyword arguments:\n rgbimg -- a string that represents the file of an RGB image of maze\n in JPEG, PNG, TIFF, BMP\n\n In the future, implement a way to manipulate the image contrast,\n brightness, and saturation to better preserve maze walls\n\n ' img = cv.imread(rgbimg, 0) blurred_img = cv.GaussianBlur(img, (5, 5), 0) bin_img = cv.adaptiveThreshold(blurred_img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2) for i in range(1, 5): bin_img = cv.morphologyEx(bin_img, cv.MORPH_OPEN, cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))) bin_img = cv.morphologyEx(bin_img, cv.MORPH_CLOSE, cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))) bin_img = cv.adaptiveThreshold(bin_img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2) did_write = cv.imwrite('bin_img.png', bin_img) if did_write: return 'bin_img.png'
def bin_img_preprocessing(rgbimg='test2.jpg'): 'Gives the binary image representation of an RGB image\n\n Given an RGB image, do the following image processing steps:\n 1) Convert to grayscale\n 2) Apply a Gaussian Blurring Filter to smooth image\n 3) Convert to a black/white image using Adaptive Gaussian thresholding\n 4) Apply morphological operations (opening and then closing)\n 5) Apply adaptive Gaussian thresholding again\n Returns a string of the binary image representation file\n\n Keyword arguments:\n rgbimg -- a string that represents the file of an RGB image of maze\n in JPEG, PNG, TIFF, BMP\n\n In the future, implement a way to manipulate the image contrast,\n brightness, and saturation to better preserve maze walls\n\n ' img = cv.imread(rgbimg, 0) blurred_img = cv.GaussianBlur(img, (5, 5), 0) bin_img = cv.adaptiveThreshold(blurred_img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2) for i in range(1, 5): bin_img = cv.morphologyEx(bin_img, cv.MORPH_OPEN, cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))) bin_img = cv.morphologyEx(bin_img, cv.MORPH_CLOSE, cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))) bin_img = cv.adaptiveThreshold(bin_img, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 11, 2) did_write = cv.imwrite('bin_img.png', bin_img) if did_write: return 'bin_img.png'<|docstring|>Gives the binary image representation of an RGB image Given an RGB image, do the following image processing steps: 1) Convert to grayscale 2) Apply a Gaussian Blurring Filter to smooth image 3) Convert to a black/white image using Adaptive Gaussian thresholding 4) Apply morphological operations (opening and then closing) 5) Apply adaptive Gaussian thresholding again Returns a string of the binary image representation file Keyword arguments: rgbimg -- a string that represents the file of an RGB image of maze in JPEG, PNG, TIFF, BMP In the future, implement a way to manipulate the image contrast, brightness, and saturation to better preserve maze walls<|endoftext|>
18558b8762aa401cd0343fcb86befba8b8f1693b5a2821ed530d3d0720127d3e
def flip_segment(X_spikes, segment): '\n Flips the values of a segment in X_spikes format\n :param X_spikes: spiking input data from spike generator\n :param segment: segment in X_spikes to be flipped\n :return: spiking data with flipped segment\n ' (_, (d, t_start, t_end)) = segment X_perturbed = X_spikes.to_dense() X_perturbed[(:, t_start:t_end, d)] = torch.abs((X_perturbed[(:, t_start:t_end, d)] - 1)) X_perturbed = X_perturbed.to_sparse() return X_perturbed
Flips the values of a segment in X_spikes format :param X_spikes: spiking input data from spike generator :param segment: segment in X_spikes to be flipped :return: spiking data with flipped segment
tsa/correctness_evaluation.py
flip_segment
ElisaNguyen/tsa-explanations
0
python
def flip_segment(X_spikes, segment): '\n Flips the values of a segment in X_spikes format\n :param X_spikes: spiking input data from spike generator\n :param segment: segment in X_spikes to be flipped\n :return: spiking data with flipped segment\n ' (_, (d, t_start, t_end)) = segment X_perturbed = X_spikes.to_dense() X_perturbed[(:, t_start:t_end, d)] = torch.abs((X_perturbed[(:, t_start:t_end, d)] - 1)) X_perturbed = X_perturbed.to_sparse() return X_perturbed
def flip_segment(X_spikes, segment): '\n Flips the values of a segment in X_spikes format\n :param X_spikes: spiking input data from spike generator\n :param segment: segment in X_spikes to be flipped\n :return: spiking data with flipped segment\n ' (_, (d, t_start, t_end)) = segment X_perturbed = X_spikes.to_dense() X_perturbed[(:, t_start:t_end, d)] = torch.abs((X_perturbed[(:, t_start:t_end, d)] - 1)) X_perturbed = X_perturbed.to_sparse() return X_perturbed<|docstring|>Flips the values of a segment in X_spikes format :param X_spikes: spiking input data from spike generator :param segment: segment in X_spikes to be flipped :return: spiking data with flipped segment<|endoftext|>
ebcf8a2f3d938ddd671bf607d34c463005096e04d699beb21f6d32f249ab1810
def flip_and_predict(nb_layers, X_data, y_data, model_explanations, testset_t): '\n Function to get the predictions of the model with nb_layers on X_data when flipping the feature segments\n :param nb_layers: number of layers of the SNN model\n :param X_data: input data\n :param y_data: labels\n :param model_explanations: extracted explanations for X_data\n :param testset_t: timestamps that are part of the testset\n :return: model predictions for perturbed data and original predictions\n ' model = initiate_model(nb_layers, 1) y_preds_flipped = [] y_preds = [] for t in tqdm(testset_t): (e, prediction) = model_explanations[t] y_preds.append(prediction) start_t = ((t - 3600) if (t >= 3600) else 0) model.nb_steps = (t - start_t) model.max_time = (t - start_t) X = {'times': (X_data['times'][(:, np.where(((X_data['times'] >= start_t) & (X_data['times'] < t)))[1])] - start_t), 'units': X_data['units'][(:, np.where(((X_data['times'] >= start_t) & (X_data['times'] < t)))[1])]} y = y_data[(:, start_t:t)] data_generator = sparse_data_generator_from_spikes(X, y, len(y), model.layer_sizes[0], model.max_time, shuffle=False) (X_spikes, _) = next(data_generator) feature_segments = segment_features(e) ranked_fs = rank_segments(e, feature_segments) y_pred_perturbed = [] X_perturbed = X_spikes for (i, segment) in enumerate(ranked_fs): X_perturbed = flip_segment(X_perturbed, segment) (pred_perturbed, _, _) = predict_from_spikes(model, X_perturbed) y_pred_perturbed.append(pred_perturbed[0][(- 1)]) y_preds_flipped.append(y_pred_perturbed) return (y_preds_flipped, y_preds)
Function to get the predictions of the model with nb_layers on X_data when flipping the feature segments :param nb_layers: number of layers of the SNN model :param X_data: input data :param y_data: labels :param model_explanations: extracted explanations for X_data :param testset_t: timestamps that are part of the testset :return: model predictions for perturbed data and original predictions
tsa/correctness_evaluation.py
flip_and_predict
ElisaNguyen/tsa-explanations
0
python
def flip_and_predict(nb_layers, X_data, y_data, model_explanations, testset_t): '\n Function to get the predictions of the model with nb_layers on X_data when flipping the feature segments\n :param nb_layers: number of layers of the SNN model\n :param X_data: input data\n :param y_data: labels\n :param model_explanations: extracted explanations for X_data\n :param testset_t: timestamps that are part of the testset\n :return: model predictions for perturbed data and original predictions\n ' model = initiate_model(nb_layers, 1) y_preds_flipped = [] y_preds = [] for t in tqdm(testset_t): (e, prediction) = model_explanations[t] y_preds.append(prediction) start_t = ((t - 3600) if (t >= 3600) else 0) model.nb_steps = (t - start_t) model.max_time = (t - start_t) X = {'times': (X_data['times'][(:, np.where(((X_data['times'] >= start_t) & (X_data['times'] < t)))[1])] - start_t), 'units': X_data['units'][(:, np.where(((X_data['times'] >= start_t) & (X_data['times'] < t)))[1])]} y = y_data[(:, start_t:t)] data_generator = sparse_data_generator_from_spikes(X, y, len(y), model.layer_sizes[0], model.max_time, shuffle=False) (X_spikes, _) = next(data_generator) feature_segments = segment_features(e) ranked_fs = rank_segments(e, feature_segments) y_pred_perturbed = [] X_perturbed = X_spikes for (i, segment) in enumerate(ranked_fs): X_perturbed = flip_segment(X_perturbed, segment) (pred_perturbed, _, _) = predict_from_spikes(model, X_perturbed) y_pred_perturbed.append(pred_perturbed[0][(- 1)]) y_preds_flipped.append(y_pred_perturbed) return (y_preds_flipped, y_preds)
def flip_and_predict(nb_layers, X_data, y_data, model_explanations, testset_t): '\n Function to get the predictions of the model with nb_layers on X_data when flipping the feature segments\n :param nb_layers: number of layers of the SNN model\n :param X_data: input data\n :param y_data: labels\n :param model_explanations: extracted explanations for X_data\n :param testset_t: timestamps that are part of the testset\n :return: model predictions for perturbed data and original predictions\n ' model = initiate_model(nb_layers, 1) y_preds_flipped = [] y_preds = [] for t in tqdm(testset_t): (e, prediction) = model_explanations[t] y_preds.append(prediction) start_t = ((t - 3600) if (t >= 3600) else 0) model.nb_steps = (t - start_t) model.max_time = (t - start_t) X = {'times': (X_data['times'][(:, np.where(((X_data['times'] >= start_t) & (X_data['times'] < t)))[1])] - start_t), 'units': X_data['units'][(:, np.where(((X_data['times'] >= start_t) & (X_data['times'] < t)))[1])]} y = y_data[(:, start_t:t)] data_generator = sparse_data_generator_from_spikes(X, y, len(y), model.layer_sizes[0], model.max_time, shuffle=False) (X_spikes, _) = next(data_generator) feature_segments = segment_features(e) ranked_fs = rank_segments(e, feature_segments) y_pred_perturbed = [] X_perturbed = X_spikes for (i, segment) in enumerate(ranked_fs): X_perturbed = flip_segment(X_perturbed, segment) (pred_perturbed, _, _) = predict_from_spikes(model, X_perturbed) y_pred_perturbed.append(pred_perturbed[0][(- 1)]) y_preds_flipped.append(y_pred_perturbed) return (y_preds_flipped, y_preds)<|docstring|>Function to get the predictions of the model with nb_layers on X_data when flipping the feature segments :param nb_layers: number of layers of the SNN model :param X_data: input data :param y_data: labels :param model_explanations: extracted explanations for X_data :param testset_t: timestamps that are part of the testset :return: model predictions for perturbed data and original predictions<|endoftext|>
d071990fb20285c2e7aa9ac554b882a296e6124a299318a547760226e6d3fb1b
def embed_seq(time_series, tau, embedding_dimension): 'Build a set of embedding sequences from given time series `time_series`\n with lag `tau` and embedding dimension `embedding_dimension`.\n Let time_series = [x(1), x(2), ... , x(N)], then for each i such that\n 1 < i < N - (embedding_dimension - 1) * tau,\n we build an embedding sequence,\n Y(i) = [x(i), x(i + tau), ... , x(i + (embedding_dimension - 1) * tau)].\n All embedding sequences are placed in a matrix Y.\n Parameters\n ----------\n time_series\n list or numpy.ndarray\n a time series\n tau\n integer\n the lag or delay when building embedding sequence\n embedding_dimension\n integer\n the embedding dimension\n Returns\n -------\n Y\n 2-embedding_dimension list\n embedding matrix built\n Examples\n ---------------\n >>> import pyeeg\n >>> a=range(0,9)\n >>> pyeeg.embed_seq(a,1,4)\n array([[0, 1, 2, 3],\n [1, 2, 3, 4],\n [2, 3, 4, 5],\n [3, 4, 5, 6],\n [4, 5, 6, 7],\n [5, 6, 7, 8]])\n >>> pyeeg.embed_seq(a,2,3)\n array([[0, 2, 4],\n [1, 3, 5],\n [2, 4, 6],\n [3, 5, 7],\n [4, 6, 8]])\n >>> pyeeg.embed_seq(a,4,1)\n array([[0],\n [1],\n [2],\n [3],\n [4],\n [5],\n [6],\n [7],\n [8]])\n ' if (not (type(time_series) == np.ndarray)): typed_time_series = np.asarray(time_series) else: typed_time_series = time_series shape = ((typed_time_series.size - (tau * (embedding_dimension - 1))), embedding_dimension) strides = (typed_time_series.itemsize, (tau * typed_time_series.itemsize)) return np.lib.stride_tricks.as_strided(typed_time_series, shape=shape, strides=strides)
Build a set of embedding sequences from given time series `time_series` with lag `tau` and embedding dimension `embedding_dimension`. Let time_series = [x(1), x(2), ... , x(N)], then for each i such that 1 < i < N - (embedding_dimension - 1) * tau, we build an embedding sequence, Y(i) = [x(i), x(i + tau), ... , x(i + (embedding_dimension - 1) * tau)]. All embedding sequences are placed in a matrix Y. Parameters ---------- time_series list or numpy.ndarray a time series tau integer the lag or delay when building embedding sequence embedding_dimension integer the embedding dimension Returns ------- Y 2-embedding_dimension list embedding matrix built Examples --------------- >>> import pyeeg >>> a=range(0,9) >>> pyeeg.embed_seq(a,1,4) array([[0, 1, 2, 3], [1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]) >>> pyeeg.embed_seq(a,2,3) array([[0, 2, 4], [1, 3, 5], [2, 4, 6], [3, 5, 7], [4, 6, 8]]) >>> pyeeg.embed_seq(a,4,1) array([[0], [1], [2], [3], [4], [5], [6], [7], [8]])
src/py_msent.py
embed_seq
mlavanga/nonlinear_signals_analysis
0
python
def embed_seq(time_series, tau, embedding_dimension): 'Build a set of embedding sequences from given time series `time_series`\n with lag `tau` and embedding dimension `embedding_dimension`.\n Let time_series = [x(1), x(2), ... , x(N)], then for each i such that\n 1 < i < N - (embedding_dimension - 1) * tau,\n we build an embedding sequence,\n Y(i) = [x(i), x(i + tau), ... , x(i + (embedding_dimension - 1) * tau)].\n All embedding sequences are placed in a matrix Y.\n Parameters\n ----------\n time_series\n list or numpy.ndarray\n a time series\n tau\n integer\n the lag or delay when building embedding sequence\n embedding_dimension\n integer\n the embedding dimension\n Returns\n -------\n Y\n 2-embedding_dimension list\n embedding matrix built\n Examples\n ---------------\n >>> import pyeeg\n >>> a=range(0,9)\n >>> pyeeg.embed_seq(a,1,4)\n array([[0, 1, 2, 3],\n [1, 2, 3, 4],\n [2, 3, 4, 5],\n [3, 4, 5, 6],\n [4, 5, 6, 7],\n [5, 6, 7, 8]])\n >>> pyeeg.embed_seq(a,2,3)\n array([[0, 2, 4],\n [1, 3, 5],\n [2, 4, 6],\n [3, 5, 7],\n [4, 6, 8]])\n >>> pyeeg.embed_seq(a,4,1)\n array([[0],\n [1],\n [2],\n [3],\n [4],\n [5],\n [6],\n [7],\n [8]])\n ' if (not (type(time_series) == np.ndarray)): typed_time_series = np.asarray(time_series) else: typed_time_series = time_series shape = ((typed_time_series.size - (tau * (embedding_dimension - 1))), embedding_dimension) strides = (typed_time_series.itemsize, (tau * typed_time_series.itemsize)) return np.lib.stride_tricks.as_strided(typed_time_series, shape=shape, strides=strides)
def embed_seq(time_series, tau, embedding_dimension): 'Build a set of embedding sequences from given time series `time_series`\n with lag `tau` and embedding dimension `embedding_dimension`.\n Let time_series = [x(1), x(2), ... , x(N)], then for each i such that\n 1 < i < N - (embedding_dimension - 1) * tau,\n we build an embedding sequence,\n Y(i) = [x(i), x(i + tau), ... , x(i + (embedding_dimension - 1) * tau)].\n All embedding sequences are placed in a matrix Y.\n Parameters\n ----------\n time_series\n list or numpy.ndarray\n a time series\n tau\n integer\n the lag or delay when building embedding sequence\n embedding_dimension\n integer\n the embedding dimension\n Returns\n -------\n Y\n 2-embedding_dimension list\n embedding matrix built\n Examples\n ---------------\n >>> import pyeeg\n >>> a=range(0,9)\n >>> pyeeg.embed_seq(a,1,4)\n array([[0, 1, 2, 3],\n [1, 2, 3, 4],\n [2, 3, 4, 5],\n [3, 4, 5, 6],\n [4, 5, 6, 7],\n [5, 6, 7, 8]])\n >>> pyeeg.embed_seq(a,2,3)\n array([[0, 2, 4],\n [1, 3, 5],\n [2, 4, 6],\n [3, 5, 7],\n [4, 6, 8]])\n >>> pyeeg.embed_seq(a,4,1)\n array([[0],\n [1],\n [2],\n [3],\n [4],\n [5],\n [6],\n [7],\n [8]])\n ' if (not (type(time_series) == np.ndarray)): typed_time_series = np.asarray(time_series) else: typed_time_series = time_series shape = ((typed_time_series.size - (tau * (embedding_dimension - 1))), embedding_dimension) strides = (typed_time_series.itemsize, (tau * typed_time_series.itemsize)) return np.lib.stride_tricks.as_strided(typed_time_series, shape=shape, strides=strides)<|docstring|>Build a set of embedding sequences from given time series `time_series` with lag `tau` and embedding dimension `embedding_dimension`. Let time_series = [x(1), x(2), ... , x(N)], then for each i such that 1 < i < N - (embedding_dimension - 1) * tau, we build an embedding sequence, Y(i) = [x(i), x(i + tau), ... , x(i + (embedding_dimension - 1) * tau)]. All embedding sequences are placed in a matrix Y. Parameters ---------- time_series list or numpy.ndarray a time series tau integer the lag or delay when building embedding sequence embedding_dimension integer the embedding dimension Returns ------- Y 2-embedding_dimension list embedding matrix built Examples --------------- >>> import pyeeg >>> a=range(0,9) >>> pyeeg.embed_seq(a,1,4) array([[0, 1, 2, 3], [1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]) >>> pyeeg.embed_seq(a,2,3) array([[0, 2, 4], [1, 3, 5], [2, 4, 6], [3, 5, 7], [4, 6, 8]]) >>> pyeeg.embed_seq(a,4,1) array([[0], [1], [2], [3], [4], [5], [6], [7], [8]])<|endoftext|>
699278f8a3b378d5d84611d4f07a1a076d301c3487524a073e8b685e92ae7991
def in_range(Template, Scroll, Distance): 'Determines whether one vector is the the range of another vector.\n\t\n\tThe two vectors should have equal length.\n\t\n\tParameters\n\t-----------------\n\tTemplate\n\t\tlist\n\t\tThe template vector, one of two vectors being compared\n\tScroll\n\t\tlist\n\t\tThe scroll vector, one of the two vectors being compared\n\t\t\n\tD\n\t\tfloat\n\t\tTwo vectors match if their distance is less than D\n\t\t\n\tBit\n\t\t\n\t\n\tNotes\n\t-------\n\tThe distance between two vectors can be defined as Euclidean distance\n\taccording to some publications.\n\t\n\tThe two vector should of equal length\n\t\n\t' for i in range(0, len(Template)): if (abs((Template[i] - Scroll[i])) > Distance): return False return True ' Desperate code, but do not delete\n\tdef bit_in_range(Index): \n\t\tif abs(Scroll[Index] - Template[Bit]) <= Distance : \n\t\t\tprint "Bit=", Bit, "Scroll[Index]", Scroll[Index], "Template[Bit]",\t\t\t Template[Bit], "abs(Scroll[Index] - Template[Bit])",\t\t\t abs(Scroll[Index] - Template[Bit])\n\t\t\treturn Index + 1 # move \n\tMatch_No_Tail = range(0, len(Scroll) - 1) # except the last one \n#\tprint Match_No_Tail\n\t# first compare Template[:-2] and Scroll[:-2]\n\tfor Bit in range(0, len(Template) - 1): # every bit of Template is in range of Scroll\n\t\tMatch_No_Tail = filter(bit_in_range, Match_No_Tail)\n\t\tprint Match_No_Tail\n\t\t\n\t# second and last, check whether Template[-1] is in range of Scroll and \n\t#\tScroll[-1] in range of Template\n\t# 2.1 Check whether Template[-1] is in the range of Scroll\n\tBit = - 1\n\tMatch_All = filter(bit_in_range, Match_No_Tail)\n\t\n\t# 2.2 Check whether Scroll[-1] is in the range of Template\n\t# I just write a loop for this. \n\tfor i in Match_All:\n\t\tif abs(Scroll[-1] - Template[i] ) <= Distance:\n\t\t\tMatch_All.remove(i)\n\t\n\t\n\treturn len(Match_All), len(Match_No_Tail)\n\t'
Determines whether one vector is the the range of another vector. The two vectors should have equal length. Parameters ----------------- Template list The template vector, one of two vectors being compared Scroll list The scroll vector, one of the two vectors being compared D float Two vectors match if their distance is less than D Bit Notes ------- The distance between two vectors can be defined as Euclidean distance according to some publications. The two vector should of equal length
src/py_msent.py
in_range
mlavanga/nonlinear_signals_analysis
0
python
def in_range(Template, Scroll, Distance): 'Determines whether one vector is the the range of another vector.\n\t\n\tThe two vectors should have equal length.\n\t\n\tParameters\n\t-----------------\n\tTemplate\n\t\tlist\n\t\tThe template vector, one of two vectors being compared\n\tScroll\n\t\tlist\n\t\tThe scroll vector, one of the two vectors being compared\n\t\t\n\tD\n\t\tfloat\n\t\tTwo vectors match if their distance is less than D\n\t\t\n\tBit\n\t\t\n\t\n\tNotes\n\t-------\n\tThe distance between two vectors can be defined as Euclidean distance\n\taccording to some publications.\n\t\n\tThe two vector should of equal length\n\t\n\t' for i in range(0, len(Template)): if (abs((Template[i] - Scroll[i])) > Distance): return False return True ' Desperate code, but do not delete\n\tdef bit_in_range(Index): \n\t\tif abs(Scroll[Index] - Template[Bit]) <= Distance : \n\t\t\tprint "Bit=", Bit, "Scroll[Index]", Scroll[Index], "Template[Bit]",\t\t\t Template[Bit], "abs(Scroll[Index] - Template[Bit])",\t\t\t abs(Scroll[Index] - Template[Bit])\n\t\t\treturn Index + 1 # move \n\tMatch_No_Tail = range(0, len(Scroll) - 1) # except the last one \n#\tprint Match_No_Tail\n\t# first compare Template[:-2] and Scroll[:-2]\n\tfor Bit in range(0, len(Template) - 1): # every bit of Template is in range of Scroll\n\t\tMatch_No_Tail = filter(bit_in_range, Match_No_Tail)\n\t\tprint Match_No_Tail\n\t\t\n\t# second and last, check whether Template[-1] is in range of Scroll and \n\t#\tScroll[-1] in range of Template\n\t# 2.1 Check whether Template[-1] is in the range of Scroll\n\tBit = - 1\n\tMatch_All = filter(bit_in_range, Match_No_Tail)\n\t\n\t# 2.2 Check whether Scroll[-1] is in the range of Template\n\t# I just write a loop for this. \n\tfor i in Match_All:\n\t\tif abs(Scroll[-1] - Template[i] ) <= Distance:\n\t\t\tMatch_All.remove(i)\n\t\n\t\n\treturn len(Match_All), len(Match_No_Tail)\n\t'
def in_range(Template, Scroll, Distance): 'Determines whether one vector is the the range of another vector.\n\t\n\tThe two vectors should have equal length.\n\t\n\tParameters\n\t-----------------\n\tTemplate\n\t\tlist\n\t\tThe template vector, one of two vectors being compared\n\tScroll\n\t\tlist\n\t\tThe scroll vector, one of the two vectors being compared\n\t\t\n\tD\n\t\tfloat\n\t\tTwo vectors match if their distance is less than D\n\t\t\n\tBit\n\t\t\n\t\n\tNotes\n\t-------\n\tThe distance between two vectors can be defined as Euclidean distance\n\taccording to some publications.\n\t\n\tThe two vector should of equal length\n\t\n\t' for i in range(0, len(Template)): if (abs((Template[i] - Scroll[i])) > Distance): return False return True ' Desperate code, but do not delete\n\tdef bit_in_range(Index): \n\t\tif abs(Scroll[Index] - Template[Bit]) <= Distance : \n\t\t\tprint "Bit=", Bit, "Scroll[Index]", Scroll[Index], "Template[Bit]",\t\t\t Template[Bit], "abs(Scroll[Index] - Template[Bit])",\t\t\t abs(Scroll[Index] - Template[Bit])\n\t\t\treturn Index + 1 # move \n\tMatch_No_Tail = range(0, len(Scroll) - 1) # except the last one \n#\tprint Match_No_Tail\n\t# first compare Template[:-2] and Scroll[:-2]\n\tfor Bit in range(0, len(Template) - 1): # every bit of Template is in range of Scroll\n\t\tMatch_No_Tail = filter(bit_in_range, Match_No_Tail)\n\t\tprint Match_No_Tail\n\t\t\n\t# second and last, check whether Template[-1] is in range of Scroll and \n\t#\tScroll[-1] in range of Template\n\t# 2.1 Check whether Template[-1] is in the range of Scroll\n\tBit = - 1\n\tMatch_All = filter(bit_in_range, Match_No_Tail)\n\t\n\t# 2.2 Check whether Scroll[-1] is in the range of Template\n\t# I just write a loop for this. \n\tfor i in Match_All:\n\t\tif abs(Scroll[-1] - Template[i] ) <= Distance:\n\t\t\tMatch_All.remove(i)\n\t\n\t\n\treturn len(Match_All), len(Match_No_Tail)\n\t'<|docstring|>Determines whether one vector is the the range of another vector. The two vectors should have equal length. Parameters ----------------- Template list The template vector, one of two vectors being compared Scroll list The scroll vector, one of the two vectors being compared D float Two vectors match if their distance is less than D Bit Notes ------- The distance between two vectors can be defined as Euclidean distance according to some publications. The two vector should of equal length<|endoftext|>
046bb3548edf7f9159cef87e42ac7c43e0d808356aaf121efa5a1a379ff3670b
def samp_entropy(X, M, R): 'Computer sample entropy (SampEn) of series X, specified by M and R.\n SampEn is very close to ApEn.\n \n Suppose given time series is X = [x(1), x(2), ... , x(N)]. We first build\n embedding matrix Em, of dimension (N-M+1)-by-M, such that the i-th row of\n Em is x(i),x(i+1), ... , x(i+M-1). Hence, the embedding lag and dimension\n are 1 and M-1 respectively. Such a matrix can be built by calling pyeeg\n function as Em = embed_seq(X, 1, M). Then we build matrix Emp, whose only\n difference with Em is that the length of each embedding sequence is M + 1\n \n Denote the i-th and j-th row of Em as Em[i] and Em[j]. Their k-th elements\n are Em[i][k] and Em[j][k] respectively. The distance between Em[i] and\n Em[j] is defined as 1) the maximum difference of their corresponding scalar\n components, thus, max(Em[i]-Em[j]), or 2) Euclidean distance. We say two\n 1-D vectors Em[i] and Em[j] *match* in *tolerance* R, if the distance\n between them is no greater than R, thus, max(Em[i]-Em[j]) <= R. Mostly, the\n value of R is defined as 20% - 30% of standard deviation of X.\n \n Pick Em[i] as a template, for all j such that 0 < j < N - M , we can\n check whether Em[j] matches with Em[i]. Denote the number of Em[j],\n which is in the range of Em[i], as k[i], which is the i-th element of the\n vector k.\n \n We repeat the same process on Emp and obtained Cmp[i], 0 < i < N - M.\n The SampEn is defined as log(sum(Cm)/sum(Cmp))\n References\n ----------\n Costa M, Goldberger AL, Peng C-K, Multiscale entropy analysis of biological\n signals, Physical Review E, 71:021906, 2005\n See also\n --------\n ap_entropy: approximate entropy of a time series\n ' N = len(X) Em = embed_seq(X, 1, M) A = np.tile(Em, (len(Em), 1, 1)) B = np.transpose(A, [1, 0, 2]) D = np.abs((A - B)) InRange = (np.max(D, axis=2) <= R) np.fill_diagonal(InRange, 0) Cm = InRange.sum(axis=0) Dp = np.abs((np.tile(X[M:], ((N - M), 1)) - np.tile(X[M:], ((N - M), 1)).T)) Cmp = np.logical_and((Dp <= R), InRange[(:(- 1), :(- 1))]).sum(axis=0) Samp_En = np.log((np.sum((Cm + 1e-100)) / np.sum((Cmp + 1e-100)))) return Samp_En
Computer sample entropy (SampEn) of series X, specified by M and R. SampEn is very close to ApEn. Suppose given time series is X = [x(1), x(2), ... , x(N)]. We first build embedding matrix Em, of dimension (N-M+1)-by-M, such that the i-th row of Em is x(i),x(i+1), ... , x(i+M-1). Hence, the embedding lag and dimension are 1 and M-1 respectively. Such a matrix can be built by calling pyeeg function as Em = embed_seq(X, 1, M). Then we build matrix Emp, whose only difference with Em is that the length of each embedding sequence is M + 1 Denote the i-th and j-th row of Em as Em[i] and Em[j]. Their k-th elements are Em[i][k] and Em[j][k] respectively. The distance between Em[i] and Em[j] is defined as 1) the maximum difference of their corresponding scalar components, thus, max(Em[i]-Em[j]), or 2) Euclidean distance. We say two 1-D vectors Em[i] and Em[j] *match* in *tolerance* R, if the distance between them is no greater than R, thus, max(Em[i]-Em[j]) <= R. Mostly, the value of R is defined as 20% - 30% of standard deviation of X. Pick Em[i] as a template, for all j such that 0 < j < N - M , we can check whether Em[j] matches with Em[i]. Denote the number of Em[j], which is in the range of Em[i], as k[i], which is the i-th element of the vector k. We repeat the same process on Emp and obtained Cmp[i], 0 < i < N - M. The SampEn is defined as log(sum(Cm)/sum(Cmp)) References ---------- Costa M, Goldberger AL, Peng C-K, Multiscale entropy analysis of biological signals, Physical Review E, 71:021906, 2005 See also -------- ap_entropy: approximate entropy of a time series
src/py_msent.py
samp_entropy
mlavanga/nonlinear_signals_analysis
0
python
def samp_entropy(X, M, R): 'Computer sample entropy (SampEn) of series X, specified by M and R.\n SampEn is very close to ApEn.\n \n Suppose given time series is X = [x(1), x(2), ... , x(N)]. We first build\n embedding matrix Em, of dimension (N-M+1)-by-M, such that the i-th row of\n Em is x(i),x(i+1), ... , x(i+M-1). Hence, the embedding lag and dimension\n are 1 and M-1 respectively. Such a matrix can be built by calling pyeeg\n function as Em = embed_seq(X, 1, M). Then we build matrix Emp, whose only\n difference with Em is that the length of each embedding sequence is M + 1\n \n Denote the i-th and j-th row of Em as Em[i] and Em[j]. Their k-th elements\n are Em[i][k] and Em[j][k] respectively. The distance between Em[i] and\n Em[j] is defined as 1) the maximum difference of their corresponding scalar\n components, thus, max(Em[i]-Em[j]), or 2) Euclidean distance. We say two\n 1-D vectors Em[i] and Em[j] *match* in *tolerance* R, if the distance\n between them is no greater than R, thus, max(Em[i]-Em[j]) <= R. Mostly, the\n value of R is defined as 20% - 30% of standard deviation of X.\n \n Pick Em[i] as a template, for all j such that 0 < j < N - M , we can\n check whether Em[j] matches with Em[i]. Denote the number of Em[j],\n which is in the range of Em[i], as k[i], which is the i-th element of the\n vector k.\n \n We repeat the same process on Emp and obtained Cmp[i], 0 < i < N - M.\n The SampEn is defined as log(sum(Cm)/sum(Cmp))\n References\n ----------\n Costa M, Goldberger AL, Peng C-K, Multiscale entropy analysis of biological\n signals, Physical Review E, 71:021906, 2005\n See also\n --------\n ap_entropy: approximate entropy of a time series\n ' N = len(X) Em = embed_seq(X, 1, M) A = np.tile(Em, (len(Em), 1, 1)) B = np.transpose(A, [1, 0, 2]) D = np.abs((A - B)) InRange = (np.max(D, axis=2) <= R) np.fill_diagonal(InRange, 0) Cm = InRange.sum(axis=0) Dp = np.abs((np.tile(X[M:], ((N - M), 1)) - np.tile(X[M:], ((N - M), 1)).T)) Cmp = np.logical_and((Dp <= R), InRange[(:(- 1), :(- 1))]).sum(axis=0) Samp_En = np.log((np.sum((Cm + 1e-100)) / np.sum((Cmp + 1e-100)))) return Samp_En
def samp_entropy(X, M, R): 'Computer sample entropy (SampEn) of series X, specified by M and R.\n SampEn is very close to ApEn.\n \n Suppose given time series is X = [x(1), x(2), ... , x(N)]. We first build\n embedding matrix Em, of dimension (N-M+1)-by-M, such that the i-th row of\n Em is x(i),x(i+1), ... , x(i+M-1). Hence, the embedding lag and dimension\n are 1 and M-1 respectively. Such a matrix can be built by calling pyeeg\n function as Em = embed_seq(X, 1, M). Then we build matrix Emp, whose only\n difference with Em is that the length of each embedding sequence is M + 1\n \n Denote the i-th and j-th row of Em as Em[i] and Em[j]. Their k-th elements\n are Em[i][k] and Em[j][k] respectively. The distance between Em[i] and\n Em[j] is defined as 1) the maximum difference of their corresponding scalar\n components, thus, max(Em[i]-Em[j]), or 2) Euclidean distance. We say two\n 1-D vectors Em[i] and Em[j] *match* in *tolerance* R, if the distance\n between them is no greater than R, thus, max(Em[i]-Em[j]) <= R. Mostly, the\n value of R is defined as 20% - 30% of standard deviation of X.\n \n Pick Em[i] as a template, for all j such that 0 < j < N - M , we can\n check whether Em[j] matches with Em[i]. Denote the number of Em[j],\n which is in the range of Em[i], as k[i], which is the i-th element of the\n vector k.\n \n We repeat the same process on Emp and obtained Cmp[i], 0 < i < N - M.\n The SampEn is defined as log(sum(Cm)/sum(Cmp))\n References\n ----------\n Costa M, Goldberger AL, Peng C-K, Multiscale entropy analysis of biological\n signals, Physical Review E, 71:021906, 2005\n See also\n --------\n ap_entropy: approximate entropy of a time series\n ' N = len(X) Em = embed_seq(X, 1, M) A = np.tile(Em, (len(Em), 1, 1)) B = np.transpose(A, [1, 0, 2]) D = np.abs((A - B)) InRange = (np.max(D, axis=2) <= R) np.fill_diagonal(InRange, 0) Cm = InRange.sum(axis=0) Dp = np.abs((np.tile(X[M:], ((N - M), 1)) - np.tile(X[M:], ((N - M), 1)).T)) Cmp = np.logical_and((Dp <= R), InRange[(:(- 1), :(- 1))]).sum(axis=0) Samp_En = np.log((np.sum((Cm + 1e-100)) / np.sum((Cmp + 1e-100)))) return Samp_En<|docstring|>Computer sample entropy (SampEn) of series X, specified by M and R. SampEn is very close to ApEn. Suppose given time series is X = [x(1), x(2), ... , x(N)]. We first build embedding matrix Em, of dimension (N-M+1)-by-M, such that the i-th row of Em is x(i),x(i+1), ... , x(i+M-1). Hence, the embedding lag and dimension are 1 and M-1 respectively. Such a matrix can be built by calling pyeeg function as Em = embed_seq(X, 1, M). Then we build matrix Emp, whose only difference with Em is that the length of each embedding sequence is M + 1 Denote the i-th and j-th row of Em as Em[i] and Em[j]. Their k-th elements are Em[i][k] and Em[j][k] respectively. The distance between Em[i] and Em[j] is defined as 1) the maximum difference of their corresponding scalar components, thus, max(Em[i]-Em[j]), or 2) Euclidean distance. We say two 1-D vectors Em[i] and Em[j] *match* in *tolerance* R, if the distance between them is no greater than R, thus, max(Em[i]-Em[j]) <= R. Mostly, the value of R is defined as 20% - 30% of standard deviation of X. Pick Em[i] as a template, for all j such that 0 < j < N - M , we can check whether Em[j] matches with Em[i]. Denote the number of Em[j], which is in the range of Em[i], as k[i], which is the i-th element of the vector k. We repeat the same process on Emp and obtained Cmp[i], 0 < i < N - M. The SampEn is defined as log(sum(Cm)/sum(Cmp)) References ---------- Costa M, Goldberger AL, Peng C-K, Multiscale entropy analysis of biological signals, Physical Review E, 71:021906, 2005 See also -------- ap_entropy: approximate entropy of a time series<|endoftext|>
50574e7c84b93e7501f818027a8938945588c8d07404d84c3dafd647a7d66e18
def verify_token(): "Verify the token and store it in the session if it's valid." token = request.args.get('token', None) if token: try: data = SecretLink.load_token(token) if data: session['rdm-records-token'] = data if hasattr(g, 'identity'): g.identity.provides.add(LinkNeed(data['id'])) except SignatureExpired: session.pop('rdm-records-token', None) flash(_('Your shared link has expired.'))
Verify the token and store it in the session if it's valid.
invenio_rdm_records/ext.py
verify_token
effervescent-shot/invenio-rdm-records
0
python
def verify_token(): token = request.args.get('token', None) if token: try: data = SecretLink.load_token(token) if data: session['rdm-records-token'] = data if hasattr(g, 'identity'): g.identity.provides.add(LinkNeed(data['id'])) except SignatureExpired: session.pop('rdm-records-token', None) flash(_('Your shared link has expired.'))
def verify_token(): token = request.args.get('token', None) if token: try: data = SecretLink.load_token(token) if data: session['rdm-records-token'] = data if hasattr(g, 'identity'): g.identity.provides.add(LinkNeed(data['id'])) except SignatureExpired: session.pop('rdm-records-token', None) flash(_('Your shared link has expired.'))<|docstring|>Verify the token and store it in the session if it's valid.<|endoftext|>
b1f06c9090dd322be00660c2aec9c225435ed9452f437de41359ad8cfc67b23b
@identity_loaded.connect def on_identity_loaded(sender, identity): 'Add the secret link token need to the freshly loaded Identity.' token_data = session.get('rdm-records-token') if token_data: identity.provides.add(LinkNeed(token_data['id']))
Add the secret link token need to the freshly loaded Identity.
invenio_rdm_records/ext.py
on_identity_loaded
effervescent-shot/invenio-rdm-records
0
python
@identity_loaded.connect def on_identity_loaded(sender, identity): token_data = session.get('rdm-records-token') if token_data: identity.provides.add(LinkNeed(token_data['id']))
@identity_loaded.connect def on_identity_loaded(sender, identity): token_data = session.get('rdm-records-token') if token_data: identity.provides.add(LinkNeed(token_data['id']))<|docstring|>Add the secret link token need to the freshly loaded Identity.<|endoftext|>
0dcbfdf48aeae0c95462f54bd4cb9d11ca6de674ede8ef0d5341fccae30c9529
def __init__(self, app=None): 'Extension initialization.' if app: self.init_app(app)
Extension initialization.
invenio_rdm_records/ext.py
__init__
effervescent-shot/invenio-rdm-records
0
python
def __init__(self, app=None): if app: self.init_app(app)
def __init__(self, app=None): if app: self.init_app(app)<|docstring|>Extension initialization.<|endoftext|>
882999818ac4dae8db6e97a6f1f4478b68f10029908d5cb20696027ba9e44189
def init_app(self, app): 'Flask application initialization.' self.init_config(app) self.metadata_extensions = MetadataExtensions(app.config['RDM_RECORDS_METADATA_NAMESPACES'], app.config['RDM_RECORDS_METADATA_EXTENSIONS']) self.init_services(app) self.init_resource(app) app.before_request(verify_token) app.extensions['invenio-rdm-records'] = self
Flask application initialization.
invenio_rdm_records/ext.py
init_app
effervescent-shot/invenio-rdm-records
0
python
def init_app(self, app): self.init_config(app) self.metadata_extensions = MetadataExtensions(app.config['RDM_RECORDS_METADATA_NAMESPACES'], app.config['RDM_RECORDS_METADATA_EXTENSIONS']) self.init_services(app) self.init_resource(app) app.before_request(verify_token) app.extensions['invenio-rdm-records'] = self
def init_app(self, app): self.init_config(app) self.metadata_extensions = MetadataExtensions(app.config['RDM_RECORDS_METADATA_NAMESPACES'], app.config['RDM_RECORDS_METADATA_EXTENSIONS']) self.init_services(app) self.init_resource(app) app.before_request(verify_token) app.extensions['invenio-rdm-records'] = self<|docstring|>Flask application initialization.<|endoftext|>
76dd6b3ea9502737fbe0b64463a8167f106620ba0afdafa4959c89ca919dcd03
def init_config(self, app): 'Initialize configuration.' supported_configurations = ['FILES_REST_PERMISSION_FACTORY', 'RECORDS_REFRESOLVER_CLS', 'RECORDS_REFRESOLVER_STORE', 'RECORDS_UI_ENDPOINTS', 'THEME_SITEURL'] overriding_configurations = ['PREVIEWER_RECORD_FILE_FACTORY'] for k in dir(config): if ((k in supported_configurations) or k.startswith('RDM_RECORDS_')): app.config.setdefault(k, getattr(config, k)) if ((k in overriding_configurations) and (not app.config.get(k))): app.config[k] = getattr(config, k)
Initialize configuration.
invenio_rdm_records/ext.py
init_config
effervescent-shot/invenio-rdm-records
0
python
def init_config(self, app): supported_configurations = ['FILES_REST_PERMISSION_FACTORY', 'RECORDS_REFRESOLVER_CLS', 'RECORDS_REFRESOLVER_STORE', 'RECORDS_UI_ENDPOINTS', 'THEME_SITEURL'] overriding_configurations = ['PREVIEWER_RECORD_FILE_FACTORY'] for k in dir(config): if ((k in supported_configurations) or k.startswith('RDM_RECORDS_')): app.config.setdefault(k, getattr(config, k)) if ((k in overriding_configurations) and (not app.config.get(k))): app.config[k] = getattr(config, k)
def init_config(self, app): supported_configurations = ['FILES_REST_PERMISSION_FACTORY', 'RECORDS_REFRESOLVER_CLS', 'RECORDS_REFRESOLVER_STORE', 'RECORDS_UI_ENDPOINTS', 'THEME_SITEURL'] overriding_configurations = ['PREVIEWER_RECORD_FILE_FACTORY'] for k in dir(config): if ((k in supported_configurations) or k.startswith('RDM_RECORDS_')): app.config.setdefault(k, getattr(config, k)) if ((k in overriding_configurations) and (not app.config.get(k))): app.config[k] = getattr(config, k)<|docstring|>Initialize configuration.<|endoftext|>
1e32c0b5c80b76eb8e31e066ce2a91a015aa9d0363ae219062d2f31869dfdd47
def _filter_record_service_config(self, app, service_config_cls): 'Filter record service config based on app global config.' if (not app.config['RDM_RECORDS_DOI_DATACITE_ENABLED']): service_config_cls.pids_providers.pop('doi', None) return service_config_cls
Filter record service config based on app global config.
invenio_rdm_records/ext.py
_filter_record_service_config
effervescent-shot/invenio-rdm-records
0
python
def _filter_record_service_config(self, app, service_config_cls): if (not app.config['RDM_RECORDS_DOI_DATACITE_ENABLED']): service_config_cls.pids_providers.pop('doi', None) return service_config_cls
def _filter_record_service_config(self, app, service_config_cls): if (not app.config['RDM_RECORDS_DOI_DATACITE_ENABLED']): service_config_cls.pids_providers.pop('doi', None) return service_config_cls<|docstring|>Filter record service config based on app global config.<|endoftext|>
d8a9bf3646584a0441a5dafa3e39b01f154fab7d9b9d63aeafbcdcc25cabe6cf
def init_services(self, app): 'Initialize vocabulary resources.' self.records_service = RDMRecordService(self._filter_record_service_config(app, RDMRecordServiceConfig), files_service=FileService(RDMFileRecordServiceConfig), draft_files_service=FileService(RDMFileDraftServiceConfig), secret_links_service=SecretLinkService(RDMRecordServiceConfig)) self.subjects_service = subject_record_type.service_cls(config=subject_record_type.service_config_cls) self.affiliations_service = affiliations_record_type.service_cls(config=affiliations_record_type.service_config_cls)
Initialize vocabulary resources.
invenio_rdm_records/ext.py
init_services
effervescent-shot/invenio-rdm-records
0
python
def init_services(self, app): self.records_service = RDMRecordService(self._filter_record_service_config(app, RDMRecordServiceConfig), files_service=FileService(RDMFileRecordServiceConfig), draft_files_service=FileService(RDMFileDraftServiceConfig), secret_links_service=SecretLinkService(RDMRecordServiceConfig)) self.subjects_service = subject_record_type.service_cls(config=subject_record_type.service_config_cls) self.affiliations_service = affiliations_record_type.service_cls(config=affiliations_record_type.service_config_cls)
def init_services(self, app): self.records_service = RDMRecordService(self._filter_record_service_config(app, RDMRecordServiceConfig), files_service=FileService(RDMFileRecordServiceConfig), draft_files_service=FileService(RDMFileDraftServiceConfig), secret_links_service=SecretLinkService(RDMRecordServiceConfig)) self.subjects_service = subject_record_type.service_cls(config=subject_record_type.service_config_cls) self.affiliations_service = affiliations_record_type.service_cls(config=affiliations_record_type.service_config_cls)<|docstring|>Initialize vocabulary resources.<|endoftext|>
febd1b8db7d97c95c7d40f3e34d384ac12bb88f4dd2935741653f4545c180bd8
def init_resource(self, app): 'Initialize vocabulary resources.' self.records_resource = RDMRecordResource(RDMRecordResourceConfig, self.records_service) self.record_files_resource = FileResource(service=self.records_service.files, config=RDMRecordFilesResourceConfig) self.draft_files_resource = FileResource(service=self.records_service.draft_files, config=RDMDraftFilesResourceConfig) self.parent_record_links_resource = RDMParentRecordLinksResource(service=self.records_service, config=RDMParentRecordLinksResourceConfig) self.subjects_resource = subject_record_type.resource_cls(service=self.subjects_service, config=subject_record_type.resource_config_cls) self.affiliations_resource = affiliations_record_type.resource_cls(service=self.affiliations_service, config=affiliations_record_type.resource_config_cls)
Initialize vocabulary resources.
invenio_rdm_records/ext.py
init_resource
effervescent-shot/invenio-rdm-records
0
python
def init_resource(self, app): self.records_resource = RDMRecordResource(RDMRecordResourceConfig, self.records_service) self.record_files_resource = FileResource(service=self.records_service.files, config=RDMRecordFilesResourceConfig) self.draft_files_resource = FileResource(service=self.records_service.draft_files, config=RDMDraftFilesResourceConfig) self.parent_record_links_resource = RDMParentRecordLinksResource(service=self.records_service, config=RDMParentRecordLinksResourceConfig) self.subjects_resource = subject_record_type.resource_cls(service=self.subjects_service, config=subject_record_type.resource_config_cls) self.affiliations_resource = affiliations_record_type.resource_cls(service=self.affiliations_service, config=affiliations_record_type.resource_config_cls)
def init_resource(self, app): self.records_resource = RDMRecordResource(RDMRecordResourceConfig, self.records_service) self.record_files_resource = FileResource(service=self.records_service.files, config=RDMRecordFilesResourceConfig) self.draft_files_resource = FileResource(service=self.records_service.draft_files, config=RDMDraftFilesResourceConfig) self.parent_record_links_resource = RDMParentRecordLinksResource(service=self.records_service, config=RDMParentRecordLinksResourceConfig) self.subjects_resource = subject_record_type.resource_cls(service=self.subjects_service, config=subject_record_type.resource_config_cls) self.affiliations_resource = affiliations_record_type.resource_cls(service=self.affiliations_service, config=affiliations_record_type.resource_config_cls)<|docstring|>Initialize vocabulary resources.<|endoftext|>
ad3f9e1e9934b195c60366e218d0c5a7ad339600534f327efc8a9789c513bde0
def stick_figure(): '\n Creates a stick figure person. \n ' baba = turtle.Turtle() baba.hideturtle() baba.pensize(10) baba.penup() baba.left(90) baba.forward(100) baba.right(90) baba.pendown() baba.fillcolor('sandy brown') baba.begin_fill() baba.circle(50) baba.end_fill() baba.right(90) baba.forward(95) baba.left(150) baba.fd(90) baba.back(90) baba.left(8) baba.back(90) baba.fd(90) baba.left(22) baba.back(105) baba.left(15) baba.back(120) baba.fd(120) baba.right(30) baba.back(120)
Creates a stick figure person.
a03_tartakj.py
stick_figure
2020-Spring-CSC-226/a03-master
0
python
def stick_figure(): '\n \n ' baba = turtle.Turtle() baba.hideturtle() baba.pensize(10) baba.penup() baba.left(90) baba.forward(100) baba.right(90) baba.pendown() baba.fillcolor('sandy brown') baba.begin_fill() baba.circle(50) baba.end_fill() baba.right(90) baba.forward(95) baba.left(150) baba.fd(90) baba.back(90) baba.left(8) baba.back(90) baba.fd(90) baba.left(22) baba.back(105) baba.left(15) baba.back(120) baba.fd(120) baba.right(30) baba.back(120)
def stick_figure(): '\n \n ' baba = turtle.Turtle() baba.hideturtle() baba.pensize(10) baba.penup() baba.left(90) baba.forward(100) baba.right(90) baba.pendown() baba.fillcolor('sandy brown') baba.begin_fill() baba.circle(50) baba.end_fill() baba.right(90) baba.forward(95) baba.left(150) baba.fd(90) baba.back(90) baba.left(8) baba.back(90) baba.fd(90) baba.left(22) baba.back(105) baba.left(15) baba.back(120) baba.fd(120) baba.right(30) baba.back(120)<|docstring|>Creates a stick figure person.<|endoftext|>
21d463aee276c5ab275e0b7c6b8c41fc4fe61773ea111fa8531aef1eaa9e5444
def create_face(): "\n Creates the person's face\n " mandy: Turtle = turtle.Turtle() mandy.hideturtle() mandy.penup() mandy.shape('circle') mandy.left(90) mandy.fd(165) mandy.left(90) mandy.fd(20) mandy.stamp() mandy.back(40) mandy.stamp() mandy.fd(20) mandy.left(90) mandy.fd(40) mandy.left(90) mandy.fillcolor('salmon') mandy.pendown() mandy.begin_fill() mandy.circle(8) mandy.end_fill() mandy.penup() mandy.left(90) mandy.fd(40) mandy.left(90) mandy.fd(4) mandy.right(40) mandy.pendown() mandy.pensize(5) mandy.fd(25) mandy.penup() mandy.back(25) mandy.left(40) mandy.back(8) mandy.left(40) mandy.pendown() mandy.back(25)
Creates the person's face
a03_tartakj.py
create_face
2020-Spring-CSC-226/a03-master
0
python
def create_face(): "\n \n " mandy: Turtle = turtle.Turtle() mandy.hideturtle() mandy.penup() mandy.shape('circle') mandy.left(90) mandy.fd(165) mandy.left(90) mandy.fd(20) mandy.stamp() mandy.back(40) mandy.stamp() mandy.fd(20) mandy.left(90) mandy.fd(40) mandy.left(90) mandy.fillcolor('salmon') mandy.pendown() mandy.begin_fill() mandy.circle(8) mandy.end_fill() mandy.penup() mandy.left(90) mandy.fd(40) mandy.left(90) mandy.fd(4) mandy.right(40) mandy.pendown() mandy.pensize(5) mandy.fd(25) mandy.penup() mandy.back(25) mandy.left(40) mandy.back(8) mandy.left(40) mandy.pendown() mandy.back(25)
def create_face(): "\n \n " mandy: Turtle = turtle.Turtle() mandy.hideturtle() mandy.penup() mandy.shape('circle') mandy.left(90) mandy.fd(165) mandy.left(90) mandy.fd(20) mandy.stamp() mandy.back(40) mandy.stamp() mandy.fd(20) mandy.left(90) mandy.fd(40) mandy.left(90) mandy.fillcolor('salmon') mandy.pendown() mandy.begin_fill() mandy.circle(8) mandy.end_fill() mandy.penup() mandy.left(90) mandy.fd(40) mandy.left(90) mandy.fd(4) mandy.right(40) mandy.pendown() mandy.pensize(5) mandy.fd(25) mandy.penup() mandy.back(25) mandy.left(40) mandy.back(8) mandy.left(40) mandy.pendown() mandy.back(25)<|docstring|>Creates the person's face<|endoftext|>
a7615ceebfd56fa98ef0fbe8af5ba7007953ef89064cfe83322df570b37da29c
def pokéball(wn): "\n Puts a Pokéball in the person's hand\n " pika = turtle.Turtle() pika.hideturtle() wn.register_shape('Pokeball2.gif') pika.color('white') pika.penup() pika.left(90) pika.fd(5) pika.right(30) pika.fd(95) pika.shape('Pokeball2.gif') pika.stamp()
Puts a Pokéball in the person's hand
a03_tartakj.py
pokéball
2020-Spring-CSC-226/a03-master
0
python
def pokéball(wn): "\n \n " pika = turtle.Turtle() pika.hideturtle() wn.register_shape('Pokeball2.gif') pika.color('white') pika.penup() pika.left(90) pika.fd(5) pika.right(30) pika.fd(95) pika.shape('Pokeball2.gif') pika.stamp()
def pokéball(wn): "\n \n " pika = turtle.Turtle() pika.hideturtle() wn.register_shape('Pokeball2.gif') pika.color('white') pika.penup() pika.left(90) pika.fd(5) pika.right(30) pika.fd(95) pika.shape('Pokeball2.gif') pika.stamp()<|docstring|>Puts a Pokéball in the person's hand<|endoftext|>
7e27682d20f18e37f82fa9c757296c7a50cd075e50d16771695944505e94a225
def text(): '\n Writes the words "Go Pikachu!"\n ' phrase = turtle.Turtle() phrase.hideturtle() phrase.penup() phrase.setpos(90, 150) phrase.color(255, 220, 5) phrase.write('Go, Pikachu!', font=('Arial', 30))
Writes the words "Go Pikachu!"
a03_tartakj.py
text
2020-Spring-CSC-226/a03-master
0
python
def text(): '\n \n ' phrase = turtle.Turtle() phrase.hideturtle() phrase.penup() phrase.setpos(90, 150) phrase.color(255, 220, 5) phrase.write('Go, Pikachu!', font=('Arial', 30))
def text(): '\n \n ' phrase = turtle.Turtle() phrase.hideturtle() phrase.penup() phrase.setpos(90, 150) phrase.color(255, 220, 5) phrase.write('Go, Pikachu!', font=('Arial', 30))<|docstring|>Writes the words "Go Pikachu!"<|endoftext|>
d32a36f48e862b711e2711d9f0f2e4c5be133c6171457b27418db806bd677f8c
def main(): "\n Sets the window attributes.\n Calls functions to create person's body and creates a face for the person.\n Calls function to put a Pokéball on the person's hand.\n Calls function to write the words.\n " wn = turtle.Screen() wn.colormode(255) wn.bgcolor(115, 139, 120) stick_figure() create_face() pokéball(wn) text() wn.exitonclick()
Sets the window attributes. Calls functions to create person's body and creates a face for the person. Calls function to put a Pokéball on the person's hand. Calls function to write the words.
a03_tartakj.py
main
2020-Spring-CSC-226/a03-master
0
python
def main(): "\n Sets the window attributes.\n Calls functions to create person's body and creates a face for the person.\n Calls function to put a Pokéball on the person's hand.\n Calls function to write the words.\n " wn = turtle.Screen() wn.colormode(255) wn.bgcolor(115, 139, 120) stick_figure() create_face() pokéball(wn) text() wn.exitonclick()
def main(): "\n Sets the window attributes.\n Calls functions to create person's body and creates a face for the person.\n Calls function to put a Pokéball on the person's hand.\n Calls function to write the words.\n " wn = turtle.Screen() wn.colormode(255) wn.bgcolor(115, 139, 120) stick_figure() create_face() pokéball(wn) text() wn.exitonclick()<|docstring|>Sets the window attributes. Calls functions to create person's body and creates a face for the person. Calls function to put a Pokéball on the person's hand. Calls function to write the words.<|endoftext|>
c96851b97770e4fd979990c184b067331b9c42b0fd6f2fe52aea514ebc92f588
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n The available fields are:\n target_distance\n\n :param args: complete set of field values, in .msg order\n :param kwds: use keyword arguments corresponding to message field names\n to set specific fields.\n ' if (args or kwds): super(TimePastRequest, self).__init__(*args, **kwds) if (self.target_distance is None): self.target_distance = 0.0 else: self.target_distance = 0.0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: target_distance :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields.
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
__init__
a-yildiz/ROS-Simple-Sample-Packages
1
python
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n The available fields are:\n target_distance\n\n :param args: complete set of field values, in .msg order\n :param kwds: use keyword arguments corresponding to message field names\n to set specific fields.\n ' if (args or kwds): super(TimePastRequest, self).__init__(*args, **kwds) if (self.target_distance is None): self.target_distance = 0.0 else: self.target_distance = 0.0
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n The available fields are:\n target_distance\n\n :param args: complete set of field values, in .msg order\n :param kwds: use keyword arguments corresponding to message field names\n to set specific fields.\n ' if (args or kwds): super(TimePastRequest, self).__init__(*args, **kwds) if (self.target_distance is None): self.target_distance = 0.0 else: self.target_distance = 0.0<|docstring|>Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: target_distance :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields.<|endoftext|>
1fb6b2b708db1f101aab56633ecd49b6f4087e60f5bbe6926e83ee92f9106530
def _get_types(self): '\n internal API method\n ' return self._slot_types
internal API method
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
_get_types
a-yildiz/ROS-Simple-Sample-Packages
1
python
def _get_types(self): '\n \n ' return self._slot_types
def _get_types(self): '\n \n ' return self._slot_types<|docstring|>internal API method<|endoftext|>
9980df8e62fa3a4ff08d7cdff0a7ca22b257a9b65837d7501cc60193855cbc46
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self.target_distance buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
serialize message into buffer :param buff: buffer, ``StringIO``
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
serialize
a-yildiz/ROS-Simple-Sample-Packages
1
python
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self.target_distance buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self.target_distance buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))<|docstring|>serialize message into buffer :param buff: buffer, ``StringIO``<|endoftext|>
4ee7c61821051f910da4c7cc4683727bb3b60a2c203c9aa9cd359afd403b79b4
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.target_distance,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
deserialize
a-yildiz/ROS-Simple-Sample-Packages
1
python
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.target_distance,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.target_distance,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)<|docstring|>unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``<|endoftext|>
9d95d528b21060f00fa3eb9cfbd4476fae862df34be0c7c55cc064bae1675cf1
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self.target_distance buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
serialize_numpy
a-yildiz/ROS-Simple-Sample-Packages
1
python
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self.target_distance buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self.target_distance buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))<|docstring|>serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module<|endoftext|>
8add8e8717ab595ecf83e117329918533330e8157a7c7538983ab9e6952599ff
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.target_distance,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
deserialize_numpy
a-yildiz/ROS-Simple-Sample-Packages
1
python
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.target_distance,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.target_distance,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)<|docstring|>unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module<|endoftext|>
1f104d76804b123d62f4b0b273d107850d04a41af40aaf2e20a62f2362aa502c
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n The available fields are:\n time_past\n\n :param args: complete set of field values, in .msg order\n :param kwds: use keyword arguments corresponding to message field names\n to set specific fields.\n ' if (args or kwds): super(TimePastResponse, self).__init__(*args, **kwds) if (self.time_past is None): self.time_past = 0.0 else: self.time_past = 0.0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: time_past :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields.
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
__init__
a-yildiz/ROS-Simple-Sample-Packages
1
python
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n The available fields are:\n time_past\n\n :param args: complete set of field values, in .msg order\n :param kwds: use keyword arguments corresponding to message field names\n to set specific fields.\n ' if (args or kwds): super(TimePastResponse, self).__init__(*args, **kwds) if (self.time_past is None): self.time_past = 0.0 else: self.time_past = 0.0
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n The available fields are:\n time_past\n\n :param args: complete set of field values, in .msg order\n :param kwds: use keyword arguments corresponding to message field names\n to set specific fields.\n ' if (args or kwds): super(TimePastResponse, self).__init__(*args, **kwds) if (self.time_past is None): self.time_past = 0.0 else: self.time_past = 0.0<|docstring|>Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: time_past :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields.<|endoftext|>
1fb6b2b708db1f101aab56633ecd49b6f4087e60f5bbe6926e83ee92f9106530
def _get_types(self): '\n internal API method\n ' return self._slot_types
internal API method
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
_get_types
a-yildiz/ROS-Simple-Sample-Packages
1
python
def _get_types(self): '\n \n ' return self._slot_types
def _get_types(self): '\n \n ' return self._slot_types<|docstring|>internal API method<|endoftext|>
385b182f5a898af204c25a694bd3aea20154ea38db01cb9695d704580df3c9c9
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self.time_past buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
serialize message into buffer :param buff: buffer, ``StringIO``
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
serialize
a-yildiz/ROS-Simple-Sample-Packages
1
python
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self.time_past buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self.time_past buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))<|docstring|>serialize message into buffer :param buff: buffer, ``StringIO``<|endoftext|>
de8ca640c5b31509c608c458063e989586aac5d0ab04585c98ff19ee0b52f3b9
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.time_past,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
deserialize
a-yildiz/ROS-Simple-Sample-Packages
1
python
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.time_past,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.time_past,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)<|docstring|>unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``<|endoftext|>
dadd15b390e0538897f0e84e932218c133cd0b091701103bd050011418bc1707
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self.time_past buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
serialize_numpy
a-yildiz/ROS-Simple-Sample-Packages
1
python
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self.time_past buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self.time_past buff.write(_get_struct_d().pack(_x)) except struct.error as se: self._check_types(struct.error(("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))) except TypeError as te: self._check_types(ValueError(("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))))<|docstring|>serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module<|endoftext|>
d5502f0c99a3a02d8ae7162142afb929007b35ab50eae3d42082e4b7a8b0d53e
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.time_past,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
catkin_ws/devel/lib/python3/dist-packages/fundamentals/srv/_TimePast.py
deserialize_numpy
a-yildiz/ROS-Simple-Sample-Packages
1
python
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.time_past,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' if python3: codecs.lookup_error('rosmsg').msg_type = self._type try: end = 0 start = end end += 8 (self.time_past,) = _get_struct_d().unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e)<|docstring|>unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module<|endoftext|>
86b47acaae6160dec6e40ee24d20ecaa31585872bc49930801ccc0c34db8db86
@pytest.yield_fixture(scope='session') def driver(pytestconfig): ' Select and configure a Selenium webdriver for integration tests.\n\n ' driver_name = pytestconfig.getoption('driver', 'chrome').lower() if (driver_name == 'chrome'): from selenium.webdriver.chrome.options import Options options = Options() options.add_argument('--headless') options.add_argument('--no-sandbox') options.add_argument('--window-size=1920x1080') driver = webdriver.Chrome(chrome_options=options) elif (driver_name == 'firefox'): from selenium.webdriver.firefox.options import Options options = Options() options.add_argument('--headless') options.add_argument('--window-size=1920x1080') driver = webdriver.Firefox(firefox_options=options) elif (driver_name == 'safari'): driver = webdriver.Safari() driver.implicitly_wait(10) (yield driver) driver.quit()
Select and configure a Selenium webdriver for integration tests.
bokeh/_testing/plugins/selenium.py
driver
crypto-jeronimo/bokeh
445
python
@pytest.yield_fixture(scope='session') def driver(pytestconfig): ' \n\n ' driver_name = pytestconfig.getoption('driver', 'chrome').lower() if (driver_name == 'chrome'): from selenium.webdriver.chrome.options import Options options = Options() options.add_argument('--headless') options.add_argument('--no-sandbox') options.add_argument('--window-size=1920x1080') driver = webdriver.Chrome(chrome_options=options) elif (driver_name == 'firefox'): from selenium.webdriver.firefox.options import Options options = Options() options.add_argument('--headless') options.add_argument('--window-size=1920x1080') driver = webdriver.Firefox(firefox_options=options) elif (driver_name == 'safari'): driver = webdriver.Safari() driver.implicitly_wait(10) (yield driver) driver.quit()
@pytest.yield_fixture(scope='session') def driver(pytestconfig): ' \n\n ' driver_name = pytestconfig.getoption('driver', 'chrome').lower() if (driver_name == 'chrome'): from selenium.webdriver.chrome.options import Options options = Options() options.add_argument('--headless') options.add_argument('--no-sandbox') options.add_argument('--window-size=1920x1080') driver = webdriver.Chrome(chrome_options=options) elif (driver_name == 'firefox'): from selenium.webdriver.firefox.options import Options options = Options() options.add_argument('--headless') options.add_argument('--window-size=1920x1080') driver = webdriver.Firefox(firefox_options=options) elif (driver_name == 'safari'): driver = webdriver.Safari() driver.implicitly_wait(10) (yield driver) driver.quit()<|docstring|>Select and configure a Selenium webdriver for integration tests.<|endoftext|>
2b884191893ad57b56ffd4913a9fe757ff36fc1ceaf11ffedae3b1de624eb65c
@pytest.fixture(scope='session') def has_no_console_errors(pytestconfig): ' Provide a function to assert no browser console errors are present.\n\n Unfortunately logs are only accessibly with Chrome web driver, see e.g.\n\n https://github.com/mozilla/geckodriver/issues/284\n\n For non-Chrome webdrivers this check always returns True.\n\n ' driver_name = pytestconfig.getoption('driver').lower() if (driver_name == 'chrome'): def func(driver): logs = driver.get_log('browser') severe_errors = [x for x in logs if (x.get('level') == 'SEVERE')] non_network_errors = [l for l in severe_errors if (l.get('type') != 'network')] if (len(non_network_errors) == 0): if (len(severe_errors) != 0): warn(('There were severe network errors (this may or may not have affected your test): %s' % severe_errors)) return True pytest.fail(('Console errors: %s' % non_network_errors)) else: def func(driver): return True return func
Provide a function to assert no browser console errors are present. Unfortunately logs are only accessibly with Chrome web driver, see e.g. https://github.com/mozilla/geckodriver/issues/284 For non-Chrome webdrivers this check always returns True.
bokeh/_testing/plugins/selenium.py
has_no_console_errors
crypto-jeronimo/bokeh
445
python
@pytest.fixture(scope='session') def has_no_console_errors(pytestconfig): ' Provide a function to assert no browser console errors are present.\n\n Unfortunately logs are only accessibly with Chrome web driver, see e.g.\n\n https://github.com/mozilla/geckodriver/issues/284\n\n For non-Chrome webdrivers this check always returns True.\n\n ' driver_name = pytestconfig.getoption('driver').lower() if (driver_name == 'chrome'): def func(driver): logs = driver.get_log('browser') severe_errors = [x for x in logs if (x.get('level') == 'SEVERE')] non_network_errors = [l for l in severe_errors if (l.get('type') != 'network')] if (len(non_network_errors) == 0): if (len(severe_errors) != 0): warn(('There were severe network errors (this may or may not have affected your test): %s' % severe_errors)) return True pytest.fail(('Console errors: %s' % non_network_errors)) else: def func(driver): return True return func
@pytest.fixture(scope='session') def has_no_console_errors(pytestconfig): ' Provide a function to assert no browser console errors are present.\n\n Unfortunately logs are only accessibly with Chrome web driver, see e.g.\n\n https://github.com/mozilla/geckodriver/issues/284\n\n For non-Chrome webdrivers this check always returns True.\n\n ' driver_name = pytestconfig.getoption('driver').lower() if (driver_name == 'chrome'): def func(driver): logs = driver.get_log('browser') severe_errors = [x for x in logs if (x.get('level') == 'SEVERE')] non_network_errors = [l for l in severe_errors if (l.get('type') != 'network')] if (len(non_network_errors) == 0): if (len(severe_errors) != 0): warn(('There were severe network errors (this may or may not have affected your test): %s' % severe_errors)) return True pytest.fail(('Console errors: %s' % non_network_errors)) else: def func(driver): return True return func<|docstring|>Provide a function to assert no browser console errors are present. Unfortunately logs are only accessibly with Chrome web driver, see e.g. https://github.com/mozilla/geckodriver/issues/284 For non-Chrome webdrivers this check always returns True.<|endoftext|>
718c959226ea77b84f7bb49f029929c1f9028d20945d08334497182ab059c882
def check_sum(self): 'Executed when check button pressed' num = self.imp_field.get() if (int(num) == (self.first_num + self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
Executed when check button pressed
learn_basic_math.py
check_sum
iliankostadinov/forKalin
0
python
def check_sum(self): num = self.imp_field.get() if (int(num) == (self.first_num + self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
def check_sum(self): num = self.imp_field.get() if (int(num) == (self.first_num + self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False<|docstring|>Executed when check button pressed<|endoftext|>
8d28a87ecc4a405a06513a3321b5d6888a1138fe790dc47af2bc9083409a690b
def check_substr(self): 'Executed when check button pressed' num = self.imp_field.get() if (int(num) == (self.first_num - self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
Executed when check button pressed
learn_basic_math.py
check_substr
iliankostadinov/forKalin
0
python
def check_substr(self): num = self.imp_field.get() if (int(num) == (self.first_num - self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
def check_substr(self): num = self.imp_field.get() if (int(num) == (self.first_num - self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False<|docstring|>Executed when check button pressed<|endoftext|>
85c3292a3b91887fd6f70c80a6299e222d712ed531cfc0f64f0ce7dbe0130e17
def check_unknown(self): 'Executed when check button pressed' num = self.imp_field.get() if (int(num) == (self.second_num - self.first_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
Executed when check button pressed
learn_basic_math.py
check_unknown
iliankostadinov/forKalin
0
python
def check_unknown(self): num = self.imp_field.get() if (int(num) == (self.second_num - self.first_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
def check_unknown(self): num = self.imp_field.get() if (int(num) == (self.second_num - self.first_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False<|docstring|>Executed when check button pressed<|endoftext|>
dd6c12eb0b35226ca293c143bf41545a01231c02a6636f3e1fc755e139903f9d
def check_unknown_minus(self): 'Executed when check button pressed' num = self.imp_field.get() if (int(num) == (self.first_num - self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
Executed when check button pressed
learn_basic_math.py
check_unknown_minus
iliankostadinov/forKalin
0
python
def check_unknown_minus(self): num = self.imp_field.get() if (int(num) == (self.first_num - self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False
def check_unknown_minus(self): num = self.imp_field.get() if (int(num) == (self.first_num - self.second_num)): self.imp_field.configure({'background': 'green'}) return True self.imp_field.configure({'background': 'red'}) self.imp_field.delete(0, 'end') return False<|docstring|>Executed when check button pressed<|endoftext|>
b3a32168bfa5b6b20bc77eab275cdefe523bc35d4367979d557d0a7db034e1cf
def summ_fun(): 'Creating name object for drawing summ examples' for (name, number) in ALL_LINES: name = OneLine(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_sum) check_but.grid(row=number, column=5)
Creating name object for drawing summ examples
learn_basic_math.py
summ_fun
iliankostadinov/forKalin
0
python
def summ_fun(): for (name, number) in ALL_LINES: name = OneLine(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_sum) check_but.grid(row=number, column=5)
def summ_fun(): for (name, number) in ALL_LINES: name = OneLine(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_sum) check_but.grid(row=number, column=5)<|docstring|>Creating name object for drawing summ examples<|endoftext|>
606b6e335e24232254c2f153f62cf4798bfc41b34c84127eba10f796b30186bc
def substr_fun(): 'Creating name object for drawing substrac examples' for (name, number) in ALL_LINES: name = OneLineSubstr(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_substr) check_but.grid(row=number, column=5)
Creating name object for drawing substrac examples
learn_basic_math.py
substr_fun
iliankostadinov/forKalin
0
python
def substr_fun(): for (name, number) in ALL_LINES: name = OneLineSubstr(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_substr) check_but.grid(row=number, column=5)
def substr_fun(): for (name, number) in ALL_LINES: name = OneLineSubstr(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_substr) check_but.grid(row=number, column=5)<|docstring|>Creating name object for drawing substrac examples<|endoftext|>
73b493bc19a828dae7590066b3a2803ebc492a5a7c43b3b8f35cee8a84654660
def unknow_fun(): 'Creating name object for drawing unknown examples' for (name, number) in ALL_LINES: name = OneLineUnknown(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown) check_but.grid(row=number, column=5)
Creating name object for drawing unknown examples
learn_basic_math.py
unknow_fun
iliankostadinov/forKalin
0
python
def unknow_fun(): for (name, number) in ALL_LINES: name = OneLineUnknown(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown) check_but.grid(row=number, column=5)
def unknow_fun(): for (name, number) in ALL_LINES: name = OneLineUnknown(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown) check_but.grid(row=number, column=5)<|docstring|>Creating name object for drawing unknown examples<|endoftext|>
8bc7d42a8fed0b21d5044c09d12bbcf4ba3a5ab740281cf3cbbe4fab9e9b0aad
def unknow_minus_fun(): 'Creating name object for drawing unknown examples' for (name, number) in ALL_LINES: name = OneLineUnknownMinus(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown_minus) check_but.grid(row=number, column=5)
Creating name object for drawing unknown examples
learn_basic_math.py
unknow_minus_fun
iliankostadinov/forKalin
0
python
def unknow_minus_fun(): for (name, number) in ALL_LINES: name = OneLineUnknownMinus(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown_minus) check_but.grid(row=number, column=5)
def unknow_minus_fun(): for (name, number) in ALL_LINES: name = OneLineUnknownMinus(root_win, number) check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown_minus) check_but.grid(row=number, column=5)<|docstring|>Creating name object for drawing unknown examples<|endoftext|>
65c4829d760f09445496e9cbc446b6470fe9077a1fe1a60a0ac862a5fc6c127d
def combine_fun(): 'Create name object for drawing combine examples' func_list = [OneLine, OneLineSubstr, OneLineUnknown, OneLineUnknownMinus] for (name, number) in ALL_LINES_COMB: func_name = random.choice(func_list) name = func_name(root_win, number) print(func_name) print(isinstance(func_name, OneLine)) if (func_name == OneLine): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_sum) check_but.grid(row=number, column=5) if (func_name == OneLineSubstr): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_substr) check_but.grid(row=number, column=5) if (func_name == OneLineUnknown): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown) check_but.grid(row=number, column=5) if (func_name == OneLineUnknownMinus): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown_minus) check_but.grid(row=number, column=5)
Create name object for drawing combine examples
learn_basic_math.py
combine_fun
iliankostadinov/forKalin
0
python
def combine_fun(): func_list = [OneLine, OneLineSubstr, OneLineUnknown, OneLineUnknownMinus] for (name, number) in ALL_LINES_COMB: func_name = random.choice(func_list) name = func_name(root_win, number) print(func_name) print(isinstance(func_name, OneLine)) if (func_name == OneLine): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_sum) check_but.grid(row=number, column=5) if (func_name == OneLineSubstr): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_substr) check_but.grid(row=number, column=5) if (func_name == OneLineUnknown): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown) check_but.grid(row=number, column=5) if (func_name == OneLineUnknownMinus): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown_minus) check_but.grid(row=number, column=5)
def combine_fun(): func_list = [OneLine, OneLineSubstr, OneLineUnknown, OneLineUnknownMinus] for (name, number) in ALL_LINES_COMB: func_name = random.choice(func_list) name = func_name(root_win, number) print(func_name) print(isinstance(func_name, OneLine)) if (func_name == OneLine): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_sum) check_but.grid(row=number, column=5) if (func_name == OneLineSubstr): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_substr) check_but.grid(row=number, column=5) if (func_name == OneLineUnknown): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown) check_but.grid(row=number, column=5) if (func_name == OneLineUnknownMinus): check_but = tk.Button(root_win, text='ПРОВЕРИ', font=600, command=name.check_unknown_minus) check_but.grid(row=number, column=5)<|docstring|>Create name object for drawing combine examples<|endoftext|>
339834441c981b1aee3e8a096e4ae1d2d260848104285c5d4edcb6248433e67e
def normalize_config(config, prefix='botocore.', **kwargs): '\n :type config: dict\n :type prefix: str\n :rtype: dict\n ' config = dict(((k[len(prefix):], config[k]) for k in config if (k.startswith(prefix) and (len(config[k]) > 0)))) config.update(kwargs) for (logical, v) in botocore.session.Session.SESSION_VARIABLES.items(): (config_file_key, env_key, default, conversion) = v if (conversion and (logical in config)): config[logical] = conversion(config[logical]) return config
:type config: dict :type prefix: str :rtype: dict
botocore_paste/__init__.py
normalize_config
gjo/botocore_paste
0
python
def normalize_config(config, prefix='botocore.', **kwargs): '\n :type config: dict\n :type prefix: str\n :rtype: dict\n ' config = dict(((k[len(prefix):], config[k]) for k in config if (k.startswith(prefix) and (len(config[k]) > 0)))) config.update(kwargs) for (logical, v) in botocore.session.Session.SESSION_VARIABLES.items(): (config_file_key, env_key, default, conversion) = v if (conversion and (logical in config)): config[logical] = conversion(config[logical]) return config
def normalize_config(config, prefix='botocore.', **kwargs): '\n :type config: dict\n :type prefix: str\n :rtype: dict\n ' config = dict(((k[len(prefix):], config[k]) for k in config if (k.startswith(prefix) and (len(config[k]) > 0)))) config.update(kwargs) for (logical, v) in botocore.session.Session.SESSION_VARIABLES.items(): (config_file_key, env_key, default, conversion) = v if (conversion and (logical in config)): config[logical] = conversion(config[logical]) return config<|docstring|>:type config: dict :type prefix: str :rtype: dict<|endoftext|>
081617b1e6ac327b2c883fc17ed3e3b4b08e9a620ea9d31e7bd2c03f8a875dad
def session_from_config(config, prefix='botocore.', **kwargs): '\n :type config: dict\n :type prefix: str\n :rtype: botocore.session.Session\n ' config = normalize_config(config, prefix, **kwargs) session = botocore.session.Session() for (k, v) in config.items(): session.set_config_variable(k, v) return session
:type config: dict :type prefix: str :rtype: botocore.session.Session
botocore_paste/__init__.py
session_from_config
gjo/botocore_paste
0
python
def session_from_config(config, prefix='botocore.', **kwargs): '\n :type config: dict\n :type prefix: str\n :rtype: botocore.session.Session\n ' config = normalize_config(config, prefix, **kwargs) session = botocore.session.Session() for (k, v) in config.items(): session.set_config_variable(k, v) return session
def session_from_config(config, prefix='botocore.', **kwargs): '\n :type config: dict\n :type prefix: str\n :rtype: botocore.session.Session\n ' config = normalize_config(config, prefix, **kwargs) session = botocore.session.Session() for (k, v) in config.items(): session.set_config_variable(k, v) return session<|docstring|>:type config: dict :type prefix: str :rtype: botocore.session.Session<|endoftext|>
1a6f7f1cfcf00dad35204ff1f94788658f3c92f2841325e3e68f62094086e0a0
def image_cb(self, msg): "Identifies red lights in the incoming camera image and publishes the index\n of the waypoint closest to the red light's stop line to /traffic_waypoint\n\n Args:\n msg (Image): image from car-mounted camera\n\n " self.has_image = True self.camera_image = msg
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light's stop line to /traffic_waypoint Args: msg (Image): image from car-mounted camera
ros/src/tl_detector/tl_detector.py
image_cb
ysavchenko/carnd-capstone
0
python
def image_cb(self, msg): "Identifies red lights in the incoming camera image and publishes the index\n of the waypoint closest to the red light's stop line to /traffic_waypoint\n\n Args:\n msg (Image): image from car-mounted camera\n\n " self.has_image = True self.camera_image = msg
def image_cb(self, msg): "Identifies red lights in the incoming camera image and publishes the index\n of the waypoint closest to the red light's stop line to /traffic_waypoint\n\n Args:\n msg (Image): image from car-mounted camera\n\n " self.has_image = True self.camera_image = msg<|docstring|>Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light's stop line to /traffic_waypoint Args: msg (Image): image from car-mounted camera<|endoftext|>
72c1d49a1f44c2ee056da625156c31285893c698b56a5327b89e1282ca0b4722
def get_closest_waypoint(self, pos): 'Identifies the closest path waypoint to the given position\n https://en.wikipedia.org/wiki/Closest_pair_of_points_problem\n Args:\n pose (Pose): position to match a waypoint to\n\n Returns:\n int: index of the closest waypoint in self.waypoints\n\n ' result = self.waypoint_tree.query(pos, 1) return result[1]
Identifies the closest path waypoint to the given position https://en.wikipedia.org/wiki/Closest_pair_of_points_problem Args: pose (Pose): position to match a waypoint to Returns: int: index of the closest waypoint in self.waypoints
ros/src/tl_detector/tl_detector.py
get_closest_waypoint
ysavchenko/carnd-capstone
0
python
def get_closest_waypoint(self, pos): 'Identifies the closest path waypoint to the given position\n https://en.wikipedia.org/wiki/Closest_pair_of_points_problem\n Args:\n pose (Pose): position to match a waypoint to\n\n Returns:\n int: index of the closest waypoint in self.waypoints\n\n ' result = self.waypoint_tree.query(pos, 1) return result[1]
def get_closest_waypoint(self, pos): 'Identifies the closest path waypoint to the given position\n https://en.wikipedia.org/wiki/Closest_pair_of_points_problem\n Args:\n pose (Pose): position to match a waypoint to\n\n Returns:\n int: index of the closest waypoint in self.waypoints\n\n ' result = self.waypoint_tree.query(pos, 1) return result[1]<|docstring|>Identifies the closest path waypoint to the given position https://en.wikipedia.org/wiki/Closest_pair_of_points_problem Args: pose (Pose): position to match a waypoint to Returns: int: index of the closest waypoint in self.waypoints<|endoftext|>
a39bb998d0b2925c5ec4d7f70377a30150b1aac7f137fb75b2e1a7e85bd5cafa
def get_light_state(self, light): 'Determines the current color of the traffic light\n\n Args:\n light (TrafficLight): light to classify\n\n Returns:\n int: ID of traffic light color (specified in styx_msgs/TrafficLight)\n\n ' return light.state
Determines the current color of the traffic light Args: light (TrafficLight): light to classify Returns: int: ID of traffic light color (specified in styx_msgs/TrafficLight)
ros/src/tl_detector/tl_detector.py
get_light_state
ysavchenko/carnd-capstone
0
python
def get_light_state(self, light): 'Determines the current color of the traffic light\n\n Args:\n light (TrafficLight): light to classify\n\n Returns:\n int: ID of traffic light color (specified in styx_msgs/TrafficLight)\n\n ' return light.state
def get_light_state(self, light): 'Determines the current color of the traffic light\n\n Args:\n light (TrafficLight): light to classify\n\n Returns:\n int: ID of traffic light color (specified in styx_msgs/TrafficLight)\n\n ' return light.state<|docstring|>Determines the current color of the traffic light Args: light (TrafficLight): light to classify Returns: int: ID of traffic light color (specified in styx_msgs/TrafficLight)<|endoftext|>
bf7cee2a33d577c343b1277c9d604582324f545ba5122871c98ceae5070ac8e5
def process_traffic_lights(self): 'Finds closest visible traffic light, if one exists, and determines its\n location and color\n\n Returns:\n int: index of waypoint closes to the upcoming stop line for a traffic light (-1 if none exists)\n int: ID of traffic light color (specified in styx_msgs/TrafficLight)\n\n ' closest_light = None closest_stop_line_wp = None stop_line_positions = self.config['stop_line_positions'] if ((self.pose is not None) and (self.waypoints is not None)): car_wp = self.get_closest_waypoint([self.pose.pose.position.x, self.pose.pose.position.y]) min_distance = len(self.waypoints.waypoints) for (stop_line, light) in zip(stop_line_positions, self.lights): stop_line_wp = self.get_closest_waypoint(stop_line) distance = (stop_line_wp - car_wp) if ((distance > 0) and (distance < min_distance)): min_distance = distance closest_light = light closest_stop_line_wp = stop_line_wp if closest_light: state = self.get_light_state(closest_light) return (closest_stop_line_wp, state) self.waypoints = None return ((- 1), TrafficLight.UNKNOWN)
Finds closest visible traffic light, if one exists, and determines its location and color Returns: int: index of waypoint closes to the upcoming stop line for a traffic light (-1 if none exists) int: ID of traffic light color (specified in styx_msgs/TrafficLight)
ros/src/tl_detector/tl_detector.py
process_traffic_lights
ysavchenko/carnd-capstone
0
python
def process_traffic_lights(self): 'Finds closest visible traffic light, if one exists, and determines its\n location and color\n\n Returns:\n int: index of waypoint closes to the upcoming stop line for a traffic light (-1 if none exists)\n int: ID of traffic light color (specified in styx_msgs/TrafficLight)\n\n ' closest_light = None closest_stop_line_wp = None stop_line_positions = self.config['stop_line_positions'] if ((self.pose is not None) and (self.waypoints is not None)): car_wp = self.get_closest_waypoint([self.pose.pose.position.x, self.pose.pose.position.y]) min_distance = len(self.waypoints.waypoints) for (stop_line, light) in zip(stop_line_positions, self.lights): stop_line_wp = self.get_closest_waypoint(stop_line) distance = (stop_line_wp - car_wp) if ((distance > 0) and (distance < min_distance)): min_distance = distance closest_light = light closest_stop_line_wp = stop_line_wp if closest_light: state = self.get_light_state(closest_light) return (closest_stop_line_wp, state) self.waypoints = None return ((- 1), TrafficLight.UNKNOWN)
def process_traffic_lights(self): 'Finds closest visible traffic light, if one exists, and determines its\n location and color\n\n Returns:\n int: index of waypoint closes to the upcoming stop line for a traffic light (-1 if none exists)\n int: ID of traffic light color (specified in styx_msgs/TrafficLight)\n\n ' closest_light = None closest_stop_line_wp = None stop_line_positions = self.config['stop_line_positions'] if ((self.pose is not None) and (self.waypoints is not None)): car_wp = self.get_closest_waypoint([self.pose.pose.position.x, self.pose.pose.position.y]) min_distance = len(self.waypoints.waypoints) for (stop_line, light) in zip(stop_line_positions, self.lights): stop_line_wp = self.get_closest_waypoint(stop_line) distance = (stop_line_wp - car_wp) if ((distance > 0) and (distance < min_distance)): min_distance = distance closest_light = light closest_stop_line_wp = stop_line_wp if closest_light: state = self.get_light_state(closest_light) return (closest_stop_line_wp, state) self.waypoints = None return ((- 1), TrafficLight.UNKNOWN)<|docstring|>Finds closest visible traffic light, if one exists, and determines its location and color Returns: int: index of waypoint closes to the upcoming stop line for a traffic light (-1 if none exists) int: ID of traffic light color (specified in styx_msgs/TrafficLight)<|endoftext|>
eb5cb44dea073cd83eb660c28d20a2e6bd7bd17e0cacb349c09d5276997d3f6d
def __init__(self, robot, max_attr=15, weight_attr=0.5, weight_rep=2.4, radius_obs=7, max_obs=6, trigger_obs=0.75): '\n Instantiates a PotentialField.\n :param robot: The robot.\n :type robot: Robot\n :param weight_attr: The weight to apply to the attractive force.\n :type weight_attr: float\n :param weight_rep: The weight to apply to the repulsive force.\n :type weight_rep: float\n :param radius_obs: Radius of the circle to analyze around the robot for obstacles.\n :type radius_obs: integer\n :param max_obs: The maximum number of obstacles that will influence the repulsive force.\n :type max_obs: integer\n :param trigger_obs: The minimum value to be considered as a relevant obstacle here.\n :type trigger_obs: float\n ' self.__robot = robot self.__weight_attr = weight_attr self.__weight_rep = weight_rep self.__radius_obs = radius_obs self.__trigger_obs = trigger_obs self.__max_obs = max_obs self.__max_attr = max_attr
Instantiates a PotentialField. :param robot: The robot. :type robot: Robot :param weight_attr: The weight to apply to the attractive force. :type weight_attr: float :param weight_rep: The weight to apply to the repulsive force. :type weight_rep: float :param radius_obs: Radius of the circle to analyze around the robot for obstacles. :type radius_obs: integer :param max_obs: The maximum number of obstacles that will influence the repulsive force. :type max_obs: integer :param trigger_obs: The minimum value to be considered as a relevant obstacle here. :type trigger_obs: float
submission/potential_field.py
__init__
ThomasRanvier/map_maker
0
python
def __init__(self, robot, max_attr=15, weight_attr=0.5, weight_rep=2.4, radius_obs=7, max_obs=6, trigger_obs=0.75): '\n Instantiates a PotentialField.\n :param robot: The robot.\n :type robot: Robot\n :param weight_attr: The weight to apply to the attractive force.\n :type weight_attr: float\n :param weight_rep: The weight to apply to the repulsive force.\n :type weight_rep: float\n :param radius_obs: Radius of the circle to analyze around the robot for obstacles.\n :type radius_obs: integer\n :param max_obs: The maximum number of obstacles that will influence the repulsive force.\n :type max_obs: integer\n :param trigger_obs: The minimum value to be considered as a relevant obstacle here.\n :type trigger_obs: float\n ' self.__robot = robot self.__weight_attr = weight_attr self.__weight_rep = weight_rep self.__radius_obs = radius_obs self.__trigger_obs = trigger_obs self.__max_obs = max_obs self.__max_attr = max_attr
def __init__(self, robot, max_attr=15, weight_attr=0.5, weight_rep=2.4, radius_obs=7, max_obs=6, trigger_obs=0.75): '\n Instantiates a PotentialField.\n :param robot: The robot.\n :type robot: Robot\n :param weight_attr: The weight to apply to the attractive force.\n :type weight_attr: float\n :param weight_rep: The weight to apply to the repulsive force.\n :type weight_rep: float\n :param radius_obs: Radius of the circle to analyze around the robot for obstacles.\n :type radius_obs: integer\n :param max_obs: The maximum number of obstacles that will influence the repulsive force.\n :type max_obs: integer\n :param trigger_obs: The minimum value to be considered as a relevant obstacle here.\n :type trigger_obs: float\n ' self.__robot = robot self.__weight_attr = weight_attr self.__weight_rep = weight_rep self.__radius_obs = radius_obs self.__trigger_obs = trigger_obs self.__max_obs = max_obs self.__max_attr = max_attr<|docstring|>Instantiates a PotentialField. :param robot: The robot. :type robot: Robot :param weight_attr: The weight to apply to the attractive force. :type weight_attr: float :param weight_rep: The weight to apply to the repulsive force. :type weight_rep: float :param radius_obs: Radius of the circle to analyze around the robot for obstacles. :type radius_obs: integer :param max_obs: The maximum number of obstacles that will influence the repulsive force. :type max_obs: integer :param trigger_obs: The minimum value to be considered as a relevant obstacle here. :type trigger_obs: float<|endoftext|>
2a8017b0c6b80e79cd84daa0fa36c4e531f01d683bc77b17c6c1e31b4a830213
def get_forces(self, robot_cell, goal_point, robot_map): '\n Gives the attractive, repulsive and general forces to apply to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param robot_map: The map of the environment\n :type robot_map: Map\n :param goal_point: Position of the goal of the robot in the grid.\n :type goal_point: Position\n :return: The 3 forces.\n :rtype: A dictionary containing the 3 forces, which also are dictionaries.\n ' forces = {'gen_force': None, 'attr_force': None, 'rep_force': None} forces['attr_force'] = self.__get_attractive_force(robot_cell, goal_point) forces['rep_force'] = self.__get_repulsive_force(robot_cell, robot_map) forces['gen_force'] = {'x': (forces['attr_force']['x'] + forces['rep_force']['x']), 'y': (forces['attr_force']['y'] + forces['rep_force']['y'])} return forces
Gives the attractive, repulsive and general forces to apply to the robot. :param robot_cell: Position of the robot in the grid. :type robot_cell: Position :param robot_map: The map of the environment :type robot_map: Map :param goal_point: Position of the goal of the robot in the grid. :type goal_point: Position :return: The 3 forces. :rtype: A dictionary containing the 3 forces, which also are dictionaries.
submission/potential_field.py
get_forces
ThomasRanvier/map_maker
0
python
def get_forces(self, robot_cell, goal_point, robot_map): '\n Gives the attractive, repulsive and general forces to apply to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param robot_map: The map of the environment\n :type robot_map: Map\n :param goal_point: Position of the goal of the robot in the grid.\n :type goal_point: Position\n :return: The 3 forces.\n :rtype: A dictionary containing the 3 forces, which also are dictionaries.\n ' forces = {'gen_force': None, 'attr_force': None, 'rep_force': None} forces['attr_force'] = self.__get_attractive_force(robot_cell, goal_point) forces['rep_force'] = self.__get_repulsive_force(robot_cell, robot_map) forces['gen_force'] = {'x': (forces['attr_force']['x'] + forces['rep_force']['x']), 'y': (forces['attr_force']['y'] + forces['rep_force']['y'])} return forces
def get_forces(self, robot_cell, goal_point, robot_map): '\n Gives the attractive, repulsive and general forces to apply to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param robot_map: The map of the environment\n :type robot_map: Map\n :param goal_point: Position of the goal of the robot in the grid.\n :type goal_point: Position\n :return: The 3 forces.\n :rtype: A dictionary containing the 3 forces, which also are dictionaries.\n ' forces = {'gen_force': None, 'attr_force': None, 'rep_force': None} forces['attr_force'] = self.__get_attractive_force(robot_cell, goal_point) forces['rep_force'] = self.__get_repulsive_force(robot_cell, robot_map) forces['gen_force'] = {'x': (forces['attr_force']['x'] + forces['rep_force']['x']), 'y': (forces['attr_force']['y'] + forces['rep_force']['y'])} return forces<|docstring|>Gives the attractive, repulsive and general forces to apply to the robot. :param robot_cell: Position of the robot in the grid. :type robot_cell: Position :param robot_map: The map of the environment :type robot_map: Map :param goal_point: Position of the goal of the robot in the grid. :type goal_point: Position :return: The 3 forces. :rtype: A dictionary containing the 3 forces, which also are dictionaries.<|endoftext|>
61dcbca9d040e758487a5367070d530a708519b92471e23ffd46ef4f6d96ffa2
def __get_attractive_force(self, robot_cell, goal_point): '\n Gives the attractive force to apply to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param goal_point: Position of the goal of the robot in the grid.\n :type goal_point: Position\n :return: The attractive force.\n :rtype: A dictionary containing the coordinates of the attractive vector.\n ' if (goal_point == None): return {'x': 0, 'y': 0} length = min(self.__max_attr, (self.__weight_attr * hypot((robot_cell.x - goal_point.x), (robot_cell.y - goal_point.y)))) dx = (goal_point.x - robot_cell.x) dy = (goal_point.y - robot_cell.y) angle = atan2(dy, dx) return {'x': (length * cos(angle)), 'y': (length * sin(angle))}
Gives the attractive force to apply to the robot. :param robot_cell: Position of the robot in the grid. :type robot_cell: Position :param goal_point: Position of the goal of the robot in the grid. :type goal_point: Position :return: The attractive force. :rtype: A dictionary containing the coordinates of the attractive vector.
submission/potential_field.py
__get_attractive_force
ThomasRanvier/map_maker
0
python
def __get_attractive_force(self, robot_cell, goal_point): '\n Gives the attractive force to apply to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param goal_point: Position of the goal of the robot in the grid.\n :type goal_point: Position\n :return: The attractive force.\n :rtype: A dictionary containing the coordinates of the attractive vector.\n ' if (goal_point == None): return {'x': 0, 'y': 0} length = min(self.__max_attr, (self.__weight_attr * hypot((robot_cell.x - goal_point.x), (robot_cell.y - goal_point.y)))) dx = (goal_point.x - robot_cell.x) dy = (goal_point.y - robot_cell.y) angle = atan2(dy, dx) return {'x': (length * cos(angle)), 'y': (length * sin(angle))}
def __get_attractive_force(self, robot_cell, goal_point): '\n Gives the attractive force to apply to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param goal_point: Position of the goal of the robot in the grid.\n :type goal_point: Position\n :return: The attractive force.\n :rtype: A dictionary containing the coordinates of the attractive vector.\n ' if (goal_point == None): return {'x': 0, 'y': 0} length = min(self.__max_attr, (self.__weight_attr * hypot((robot_cell.x - goal_point.x), (robot_cell.y - goal_point.y)))) dx = (goal_point.x - robot_cell.x) dy = (goal_point.y - robot_cell.y) angle = atan2(dy, dx) return {'x': (length * cos(angle)), 'y': (length * sin(angle))}<|docstring|>Gives the attractive force to apply to the robot. :param robot_cell: Position of the robot in the grid. :type robot_cell: Position :param goal_point: Position of the goal of the robot in the grid. :type goal_point: Position :return: The attractive force. :rtype: A dictionary containing the coordinates of the attractive vector.<|endoftext|>
59a98436094e6153f44d64223997aafde05eab31961ef1607c5e4dc381266dbd
def __get_repulsive_force(self, robot_cell, robot_map): '\n Gives the repulsive force to apply to the robot.\n Obtained by summing the repulsive forces applied by the 5 closest obstacles (if they exist) to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param robot_map: The map of the environment\n :type robot_map: Map\n :return: The repulsive force.\n :rtype: A dictionary containing the coordinates of the repulsive vector.\n ' circle = filled_midpoint_circle(robot_cell.x, robot_cell.y, self.__radius_obs) closest_obstacles = ([None] * self.__max_obs) min_dists = ([inf] * self.__max_obs) for point in circle: if (robot_map.is_in_bound(point) and (robot_map.grid[point.x][point.y] >= 0.75)): dist = hypot((robot_cell.x - point.x), (robot_cell.y - point.y)) for i in range(self.__max_obs): if (dist < min_dists[i]): for ii in range((self.__max_obs - 1), (i + 2), (- 1)): min_dists[ii] = min_dists[(ii - 1)] closest_obstacles[ii] = closest_obstacles[(ii - 1)] min_dists[i] = dist closest_obstacles[i] = point break result = {'x': 0, 'y': 0} for obstacle in closest_obstacles: if (obstacle != None): dist = hypot((robot_cell.x - obstacle.x), (robot_cell.y - obstacle.y)) rep_factor = min(0.9, (abs((self.__radius_obs - dist)) / self.__radius_obs)) length = (((- 2) * log10((1 - rep_factor))) * self.__weight_rep) dx = (obstacle.x - robot_cell.x) dy = (obstacle.y - robot_cell.y) angle = atan2(dy, dx) result['x'] += ((- length) * cos(angle)) result['y'] += ((- length) * sin(angle)) return result
Gives the repulsive force to apply to the robot. Obtained by summing the repulsive forces applied by the 5 closest obstacles (if they exist) to the robot. :param robot_cell: Position of the robot in the grid. :type robot_cell: Position :param robot_map: The map of the environment :type robot_map: Map :return: The repulsive force. :rtype: A dictionary containing the coordinates of the repulsive vector.
submission/potential_field.py
__get_repulsive_force
ThomasRanvier/map_maker
0
python
def __get_repulsive_force(self, robot_cell, robot_map): '\n Gives the repulsive force to apply to the robot.\n Obtained by summing the repulsive forces applied by the 5 closest obstacles (if they exist) to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param robot_map: The map of the environment\n :type robot_map: Map\n :return: The repulsive force.\n :rtype: A dictionary containing the coordinates of the repulsive vector.\n ' circle = filled_midpoint_circle(robot_cell.x, robot_cell.y, self.__radius_obs) closest_obstacles = ([None] * self.__max_obs) min_dists = ([inf] * self.__max_obs) for point in circle: if (robot_map.is_in_bound(point) and (robot_map.grid[point.x][point.y] >= 0.75)): dist = hypot((robot_cell.x - point.x), (robot_cell.y - point.y)) for i in range(self.__max_obs): if (dist < min_dists[i]): for ii in range((self.__max_obs - 1), (i + 2), (- 1)): min_dists[ii] = min_dists[(ii - 1)] closest_obstacles[ii] = closest_obstacles[(ii - 1)] min_dists[i] = dist closest_obstacles[i] = point break result = {'x': 0, 'y': 0} for obstacle in closest_obstacles: if (obstacle != None): dist = hypot((robot_cell.x - obstacle.x), (robot_cell.y - obstacle.y)) rep_factor = min(0.9, (abs((self.__radius_obs - dist)) / self.__radius_obs)) length = (((- 2) * log10((1 - rep_factor))) * self.__weight_rep) dx = (obstacle.x - robot_cell.x) dy = (obstacle.y - robot_cell.y) angle = atan2(dy, dx) result['x'] += ((- length) * cos(angle)) result['y'] += ((- length) * sin(angle)) return result
def __get_repulsive_force(self, robot_cell, robot_map): '\n Gives the repulsive force to apply to the robot.\n Obtained by summing the repulsive forces applied by the 5 closest obstacles (if they exist) to the robot.\n :param robot_cell: Position of the robot in the grid.\n :type robot_cell: Position\n :param robot_map: The map of the environment\n :type robot_map: Map\n :return: The repulsive force.\n :rtype: A dictionary containing the coordinates of the repulsive vector.\n ' circle = filled_midpoint_circle(robot_cell.x, robot_cell.y, self.__radius_obs) closest_obstacles = ([None] * self.__max_obs) min_dists = ([inf] * self.__max_obs) for point in circle: if (robot_map.is_in_bound(point) and (robot_map.grid[point.x][point.y] >= 0.75)): dist = hypot((robot_cell.x - point.x), (robot_cell.y - point.y)) for i in range(self.__max_obs): if (dist < min_dists[i]): for ii in range((self.__max_obs - 1), (i + 2), (- 1)): min_dists[ii] = min_dists[(ii - 1)] closest_obstacles[ii] = closest_obstacles[(ii - 1)] min_dists[i] = dist closest_obstacles[i] = point break result = {'x': 0, 'y': 0} for obstacle in closest_obstacles: if (obstacle != None): dist = hypot((robot_cell.x - obstacle.x), (robot_cell.y - obstacle.y)) rep_factor = min(0.9, (abs((self.__radius_obs - dist)) / self.__radius_obs)) length = (((- 2) * log10((1 - rep_factor))) * self.__weight_rep) dx = (obstacle.x - robot_cell.x) dy = (obstacle.y - robot_cell.y) angle = atan2(dy, dx) result['x'] += ((- length) * cos(angle)) result['y'] += ((- length) * sin(angle)) return result<|docstring|>Gives the repulsive force to apply to the robot. Obtained by summing the repulsive forces applied by the 5 closest obstacles (if they exist) to the robot. :param robot_cell: Position of the robot in the grid. :type robot_cell: Position :param robot_map: The map of the environment :type robot_map: Map :return: The repulsive force. :rtype: A dictionary containing the coordinates of the repulsive vector.<|endoftext|>
0254bfcfe8b4c3ecba2eea7a6af8ce76ab470e6a57c6a7b500e934c3d4f34302
def process(request): 'Responds to any HTTP request.\n Args:\n request (flask.Request): HTTP request object.\n Returns:\n The response text or any set of values that can be turned into a\n Response object using\n `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.\n ' if (request.method == 'OPTIONS'): headers = {'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '3600'} return ('', 204, headers) headers = {'Access-Control-Allow-Origin': '*'} request_json = {'url': unquote(request.args.get('url'))} rrp = RequestResponseProcessor(request_json) return (str(rrp.orchestrate()), 200, headers)
Responds to any HTTP request. Args: request (flask.Request): HTTP request object. Returns: The response text or any set of values that can be turned into a Response object using `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.
api/validateUrl/main.py
process
yankai14/AntiFish
1
python
def process(request): 'Responds to any HTTP request.\n Args:\n request (flask.Request): HTTP request object.\n Returns:\n The response text or any set of values that can be turned into a\n Response object using\n `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.\n ' if (request.method == 'OPTIONS'): headers = {'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '3600'} return (, 204, headers) headers = {'Access-Control-Allow-Origin': '*'} request_json = {'url': unquote(request.args.get('url'))} rrp = RequestResponseProcessor(request_json) return (str(rrp.orchestrate()), 200, headers)
def process(request): 'Responds to any HTTP request.\n Args:\n request (flask.Request): HTTP request object.\n Returns:\n The response text or any set of values that can be turned into a\n Response object using\n `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.\n ' if (request.method == 'OPTIONS'): headers = {'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '3600'} return (, 204, headers) headers = {'Access-Control-Allow-Origin': '*'} request_json = {'url': unquote(request.args.get('url'))} rrp = RequestResponseProcessor(request_json) return (str(rrp.orchestrate()), 200, headers)<|docstring|>Responds to any HTTP request. Args: request (flask.Request): HTTP request object. Returns: The response text or any set of values that can be turned into a Response object using `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.<|endoftext|>
40e987038f781edd2cf5222e9ef345298420b02ad61aea677a82d7d9b6c9a11e
def get_localizer(language='English'): 'The factory method' languages = dict(English=EnglishGetter, Greek=GreekGetter) return languages[language]()
The factory method
python/patterns/creational/factory_method.py
get_localizer
harkhuang/designpatterns
2
python
def get_localizer(language='English'): languages = dict(English=EnglishGetter, Greek=GreekGetter) return languages[language]()
def get_localizer(language='English'): languages = dict(English=EnglishGetter, Greek=GreekGetter) return languages[language]()<|docstring|>The factory method<|endoftext|>
209c972d193357c2c8de4da2de76698501dc5ed13877dc110b5ee48c06e45e3e
def get(self, msgid): "We'll punt if we don't have a translation" return self.trans.get(msgid, str(msgid))
We'll punt if we don't have a translation
python/patterns/creational/factory_method.py
get
harkhuang/designpatterns
2
python
def get(self, msgid): return self.trans.get(msgid, str(msgid))
def get(self, msgid): return self.trans.get(msgid, str(msgid))<|docstring|>We'll punt if we don't have a translation<|endoftext|>
4342dffbd58ddd4bcb7a7a86304aafff14adbbc36b43df5b8bad294935d08079
def test_alias_args_error(): 'Error expanding with wrong number of arguments' _ip.alias_manager.define_alias('parts', 'echo first %s second %s') with capture_output() as cap: _ip.run_cell('parts 1') nt.assert_equal(cap.stderr.split(':')[0], 'UsageError')
Error expanding with wrong number of arguments
extern_libs/Python27/lib/python2.7/site-packages/IPython/core/tests/test_alias.py
test_alias_args_error
onceawaken/MKL-DNN_Eigen_Boost_OpenMPI_GoogleTests_Examples
652
python
def test_alias_args_error(): _ip.alias_manager.define_alias('parts', 'echo first %s second %s') with capture_output() as cap: _ip.run_cell('parts 1') nt.assert_equal(cap.stderr.split(':')[0], 'UsageError')
def test_alias_args_error(): _ip.alias_manager.define_alias('parts', 'echo first %s second %s') with capture_output() as cap: _ip.run_cell('parts 1') nt.assert_equal(cap.stderr.split(':')[0], 'UsageError')<|docstring|>Error expanding with wrong number of arguments<|endoftext|>
f34d02ad20c661b3d0a4194f2bba9c333ca3b10febf4d5aaa9fcab65ad866d56
def test_alias_args_commented(): "Check that alias correctly ignores 'commented out' args" _ip.magic('alias commetarg echo this is %%s a commented out arg') with capture_output() as cap: _ip.run_cell('commetarg') nt.assert_equal(cap.stdout, 'this is %s a commented out arg')
Check that alias correctly ignores 'commented out' args
extern_libs/Python27/lib/python2.7/site-packages/IPython/core/tests/test_alias.py
test_alias_args_commented
onceawaken/MKL-DNN_Eigen_Boost_OpenMPI_GoogleTests_Examples
652
python
def test_alias_args_commented(): _ip.magic('alias commetarg echo this is %%s a commented out arg') with capture_output() as cap: _ip.run_cell('commetarg') nt.assert_equal(cap.stdout, 'this is %s a commented out arg')
def test_alias_args_commented(): _ip.magic('alias commetarg echo this is %%s a commented out arg') with capture_output() as cap: _ip.run_cell('commetarg') nt.assert_equal(cap.stdout, 'this is %s a commented out arg')<|docstring|>Check that alias correctly ignores 'commented out' args<|endoftext|>
4b6ebfac01d627b28258f18e8c55792529181b57f0e8c4d5c6991f600792675c
def test_alias_args_commented_nargs(): 'Check that alias correctly counts args, excluding those commented out' am = _ip.alias_manager alias_name = 'comargcount' cmd = 'echo this is %%s a commented out arg and this is not %s' am.define_alias(alias_name, cmd) assert am.is_alias(alias_name) thealias = am.get_alias(alias_name) nt.assert_equal(thealias.nargs, 1)
Check that alias correctly counts args, excluding those commented out
extern_libs/Python27/lib/python2.7/site-packages/IPython/core/tests/test_alias.py
test_alias_args_commented_nargs
onceawaken/MKL-DNN_Eigen_Boost_OpenMPI_GoogleTests_Examples
652
python
def test_alias_args_commented_nargs(): am = _ip.alias_manager alias_name = 'comargcount' cmd = 'echo this is %%s a commented out arg and this is not %s' am.define_alias(alias_name, cmd) assert am.is_alias(alias_name) thealias = am.get_alias(alias_name) nt.assert_equal(thealias.nargs, 1)
def test_alias_args_commented_nargs(): am = _ip.alias_manager alias_name = 'comargcount' cmd = 'echo this is %%s a commented out arg and this is not %s' am.define_alias(alias_name, cmd) assert am.is_alias(alias_name) thealias = am.get_alias(alias_name) nt.assert_equal(thealias.nargs, 1)<|docstring|>Check that alias correctly counts args, excluding those commented out<|endoftext|>
9b160be94bf9cdae24b264bf5264ed4446443806ee532b4d857b6e380345e688
def sample_weights(W_mu, b_mu, W_p, b_p): 'Quick method for sampling weights and exporting weights\n \n Sampling W from N(W_mu, std_w^2) as follows:\n eps_W ~ N(0, 1^2)\n std_w = 1e-6 + log(1+exp(W_p)) (if W_p > 20, std_w = 1e-6 + W_p)\n W = W_mu + 1 * std_w * eps_W\n\n Sampling b from N(b_mu, std_b^2) as follows:\n eps_b ~ N(0, 1^2)\n std_b = 1e-6 + log(1+exp(b_p)) (if b_p > 20, std_w = 1e-6 + b_p)\n b = b_mu + 1 * std_b * eps_b\n\n This function samples b only if b_mu is not `None`\n ' eps_W = W_mu.data.new(W_mu.size()).normal_() std_w = w_to_std(W_p) W = (W_mu + ((1 * std_w) * eps_W)) if (b_mu is not None): std_b = w_to_std(b_p) eps_b = b_mu.data.new(b_mu.size()).normal_() b = (b_mu + ((1 * std_b) * eps_b)) else: b = None return (W, b)
Quick method for sampling weights and exporting weights Sampling W from N(W_mu, std_w^2) as follows: eps_W ~ N(0, 1^2) std_w = 1e-6 + log(1+exp(W_p)) (if W_p > 20, std_w = 1e-6 + W_p) W = W_mu + 1 * std_w * eps_W Sampling b from N(b_mu, std_b^2) as follows: eps_b ~ N(0, 1^2) std_b = 1e-6 + log(1+exp(b_p)) (if b_p > 20, std_w = 1e-6 + b_p) b = b_mu + 1 * std_b * eps_b This function samples b only if b_mu is not `None`
BNNs/Bayes_By_Backprop/utils.py
sample_weights
kw-lee/Bayesian-Neural-Networks
1
python
def sample_weights(W_mu, b_mu, W_p, b_p): 'Quick method for sampling weights and exporting weights\n \n Sampling W from N(W_mu, std_w^2) as follows:\n eps_W ~ N(0, 1^2)\n std_w = 1e-6 + log(1+exp(W_p)) (if W_p > 20, std_w = 1e-6 + W_p)\n W = W_mu + 1 * std_w * eps_W\n\n Sampling b from N(b_mu, std_b^2) as follows:\n eps_b ~ N(0, 1^2)\n std_b = 1e-6 + log(1+exp(b_p)) (if b_p > 20, std_w = 1e-6 + b_p)\n b = b_mu + 1 * std_b * eps_b\n\n This function samples b only if b_mu is not `None`\n ' eps_W = W_mu.data.new(W_mu.size()).normal_() std_w = w_to_std(W_p) W = (W_mu + ((1 * std_w) * eps_W)) if (b_mu is not None): std_b = w_to_std(b_p) eps_b = b_mu.data.new(b_mu.size()).normal_() b = (b_mu + ((1 * std_b) * eps_b)) else: b = None return (W, b)
def sample_weights(W_mu, b_mu, W_p, b_p): 'Quick method for sampling weights and exporting weights\n \n Sampling W from N(W_mu, std_w^2) as follows:\n eps_W ~ N(0, 1^2)\n std_w = 1e-6 + log(1+exp(W_p)) (if W_p > 20, std_w = 1e-6 + W_p)\n W = W_mu + 1 * std_w * eps_W\n\n Sampling b from N(b_mu, std_b^2) as follows:\n eps_b ~ N(0, 1^2)\n std_b = 1e-6 + log(1+exp(b_p)) (if b_p > 20, std_w = 1e-6 + b_p)\n b = b_mu + 1 * std_b * eps_b\n\n This function samples b only if b_mu is not `None`\n ' eps_W = W_mu.data.new(W_mu.size()).normal_() std_w = w_to_std(W_p) W = (W_mu + ((1 * std_w) * eps_W)) if (b_mu is not None): std_b = w_to_std(b_p) eps_b = b_mu.data.new(b_mu.size()).normal_() b = (b_mu + ((1 * std_b) * eps_b)) else: b = None return (W, b)<|docstring|>Quick method for sampling weights and exporting weights Sampling W from N(W_mu, std_w^2) as follows: eps_W ~ N(0, 1^2) std_w = 1e-6 + log(1+exp(W_p)) (if W_p > 20, std_w = 1e-6 + W_p) W = W_mu + 1 * std_w * eps_W Sampling b from N(b_mu, std_b^2) as follows: eps_b ~ N(0, 1^2) std_b = 1e-6 + log(1+exp(b_p)) (if b_p > 20, std_w = 1e-6 + b_p) b = b_mu + 1 * std_b * eps_b This function samples b only if b_mu is not `None`<|endoftext|>
328f63e9678aa49ebd2d0c4fb7fe55dd15e9a256c66da734a28e13d1f7f4049b
@classmethod @abc.abstractmethod def get_params_info(cls) -> dict: ' Return a dictionary describing all parameters in the layout generator ' return dict()
Return a dictionary describing all parameters in the layout generator
ACG/AyarLayoutGenerator.py
get_params_info
AyarLabs/ACG
7
python
@classmethod @abc.abstractmethod def get_params_info(cls) -> dict: ' ' return dict()
@classmethod @abc.abstractmethod def get_params_info(cls) -> dict: ' ' return dict()<|docstring|>Return a dictionary describing all parameters in the layout generator<|endoftext|>
a934e1f239e764f4fea693ceca29adaa58225de417d8b86d49231f06222ba88f
@classmethod def get_default_param_values(cls) -> dict: ' Return a dictionary of all default parameter values ' return dict()
Return a dictionary of all default parameter values
ACG/AyarLayoutGenerator.py
get_default_param_values
AyarLabs/ACG
7
python
@classmethod def get_default_param_values(cls) -> dict: ' ' return dict()
@classmethod def get_default_param_values(cls) -> dict: ' ' return dict()<|docstring|>Return a dictionary of all default parameter values<|endoftext|>
3462e737349ba51b7b602d8484b6dff54fad5586d62ff49276c654b6a481145c
def export_locations(self) -> dict: '\n Returns a dictionary of shapes/inst in the layout. It is recommended to override this method and only return\n relevant shapes in a dict() with easily interpretable key names\n ' return self.loc
Returns a dictionary of shapes/inst in the layout. It is recommended to override this method and only return relevant shapes in a dict() with easily interpretable key names
ACG/AyarLayoutGenerator.py
export_locations
AyarLabs/ACG
7
python
def export_locations(self) -> dict: '\n Returns a dictionary of shapes/inst in the layout. It is recommended to override this method and only return\n relevant shapes in a dict() with easily interpretable key names\n ' return self.loc
def export_locations(self) -> dict: '\n Returns a dictionary of shapes/inst in the layout. It is recommended to override this method and only return\n relevant shapes in a dict() with easily interpretable key names\n ' return self.loc<|docstring|>Returns a dictionary of shapes/inst in the layout. It is recommended to override this method and only return relevant shapes in a dict() with easily interpretable key names<|endoftext|>
7534ae0b587be1d590f7fc9039d6ef1b201996f44379b0782a8b85dee9aa4715
@abc.abstractmethod def layout_procedure(self): ' Implement this method to describe how the layout is drawn ' pass
Implement this method to describe how the layout is drawn
ACG/AyarLayoutGenerator.py
layout_procedure
AyarLabs/ACG
7
python
@abc.abstractmethod def layout_procedure(self): ' ' pass
@abc.abstractmethod def layout_procedure(self): ' ' pass<|docstring|>Implement this method to describe how the layout is drawn<|endoftext|>
7d5c5604b5eed1c8a7d70d462a01286f532a4da03028b3bc244df2a17b7bc463
def add_rect(self, layer: Optional[Union[(str, Tuple[(str, str)], List[str])]]=None, xy=None, virtual: bool=False, *, index: Optional[int]=None) -> Rectangle: '\n Instantiates a rectangle, adds the Rectangle object to local db, and returns it for further user manipulation\n\n Parameters\n ----------\n layer : Optional[str]\n layer that the rectangle should be drawn on\n xy : Tuple[[float, float], [float, float]]\n list of xy coordinates representing the lower left and upper right corner of the rectangle. If None,\n select default size of 100nm by 100nm at origin\n virtual : bool\n If true, the rectangle object will be created but will not be drawn in the final layout. If false, the\n rectangle will be drawn as normal in the final layout\n index : Optional[int]\n If provided, will look up the layer name associated with the index, and then draw the rectangle on\n that layer.\n\n Returns\n -------\n rect: Rectangle\n the created rectangle object\n ' if (index is not None): layer = self.grid.tech_info.get_layer_name(index) if (xy is None): layer_params = tech_info.tech_info['metal_tech']['metals'] layer_lookup = layer if isinstance(layer, list): layer_lookup = layer[0] if (layer_lookup in layer_params): metal_params = tech_info.tech_info['metal_tech']['metals'][layer_lookup] default_w = metal_params['min_width'] else: default_w = 0.1 xy = [[0, 0], [default_w, default_w]] self._db['rect'].append(Rectangle(xy, layer=layer, virtual=virtual)) return self._db['rect'][(- 1)]
Instantiates a rectangle, adds the Rectangle object to local db, and returns it for further user manipulation Parameters ---------- layer : Optional[str] layer that the rectangle should be drawn on xy : Tuple[[float, float], [float, float]] list of xy coordinates representing the lower left and upper right corner of the rectangle. If None, select default size of 100nm by 100nm at origin virtual : bool If true, the rectangle object will be created but will not be drawn in the final layout. If false, the rectangle will be drawn as normal in the final layout index : Optional[int] If provided, will look up the layer name associated with the index, and then draw the rectangle on that layer. Returns ------- rect: Rectangle the created rectangle object
ACG/AyarLayoutGenerator.py
add_rect
AyarLabs/ACG
7
python
def add_rect(self, layer: Optional[Union[(str, Tuple[(str, str)], List[str])]]=None, xy=None, virtual: bool=False, *, index: Optional[int]=None) -> Rectangle: '\n Instantiates a rectangle, adds the Rectangle object to local db, and returns it for further user manipulation\n\n Parameters\n ----------\n layer : Optional[str]\n layer that the rectangle should be drawn on\n xy : Tuple[[float, float], [float, float]]\n list of xy coordinates representing the lower left and upper right corner of the rectangle. If None,\n select default size of 100nm by 100nm at origin\n virtual : bool\n If true, the rectangle object will be created but will not be drawn in the final layout. If false, the\n rectangle will be drawn as normal in the final layout\n index : Optional[int]\n If provided, will look up the layer name associated with the index, and then draw the rectangle on\n that layer.\n\n Returns\n -------\n rect: Rectangle\n the created rectangle object\n ' if (index is not None): layer = self.grid.tech_info.get_layer_name(index) if (xy is None): layer_params = tech_info.tech_info['metal_tech']['metals'] layer_lookup = layer if isinstance(layer, list): layer_lookup = layer[0] if (layer_lookup in layer_params): metal_params = tech_info.tech_info['metal_tech']['metals'][layer_lookup] default_w = metal_params['min_width'] else: default_w = 0.1 xy = [[0, 0], [default_w, default_w]] self._db['rect'].append(Rectangle(xy, layer=layer, virtual=virtual)) return self._db['rect'][(- 1)]
def add_rect(self, layer: Optional[Union[(str, Tuple[(str, str)], List[str])]]=None, xy=None, virtual: bool=False, *, index: Optional[int]=None) -> Rectangle: '\n Instantiates a rectangle, adds the Rectangle object to local db, and returns it for further user manipulation\n\n Parameters\n ----------\n layer : Optional[str]\n layer that the rectangle should be drawn on\n xy : Tuple[[float, float], [float, float]]\n list of xy coordinates representing the lower left and upper right corner of the rectangle. If None,\n select default size of 100nm by 100nm at origin\n virtual : bool\n If true, the rectangle object will be created but will not be drawn in the final layout. If false, the\n rectangle will be drawn as normal in the final layout\n index : Optional[int]\n If provided, will look up the layer name associated with the index, and then draw the rectangle on\n that layer.\n\n Returns\n -------\n rect: Rectangle\n the created rectangle object\n ' if (index is not None): layer = self.grid.tech_info.get_layer_name(index) if (xy is None): layer_params = tech_info.tech_info['metal_tech']['metals'] layer_lookup = layer if isinstance(layer, list): layer_lookup = layer[0] if (layer_lookup in layer_params): metal_params = tech_info.tech_info['metal_tech']['metals'][layer_lookup] default_w = metal_params['min_width'] else: default_w = 0.1 xy = [[0, 0], [default_w, default_w]] self._db['rect'].append(Rectangle(xy, layer=layer, virtual=virtual)) return self._db['rect'][(- 1)]<|docstring|>Instantiates a rectangle, adds the Rectangle object to local db, and returns it for further user manipulation Parameters ---------- layer : Optional[str] layer that the rectangle should be drawn on xy : Tuple[[float, float], [float, float]] list of xy coordinates representing the lower left and upper right corner of the rectangle. If None, select default size of 100nm by 100nm at origin virtual : bool If true, the rectangle object will be created but will not be drawn in the final layout. If false, the rectangle will be drawn as normal in the final layout index : Optional[int] If provided, will look up the layer name associated with the index, and then draw the rectangle on that layer. Returns ------- rect: Rectangle the created rectangle object<|endoftext|>
df4411b9dbd499c96e04dbff007fc5282f009846b72d5bc4f45f574ddfaf9c3f
def copy_rect(self, rect: Rectangle, layer=None, virtual: bool=False) -> Rectangle: '\n Creates a copy of the given rectangle and adds it to the local db\n\n Args:\n rect (Rectangle):\n rectangle object to be copied\n layer (str):\n layer that the copied rectangle should be drawn on. If None, the copied rectangle will use the same\n layer as the provided rectangle\n virtual (bool):\n If true, the rectangle object will be created but will not be drawn in the final layout. If false, the\n rectangle will be drawn as normal in the final layout\n\n Returns:\n (Rectangle):\n a new rectangle object copied from provided rectangle\n ' temp = rect.copy(layer=layer, virtual=virtual) self._db['rect'].append(temp) return self._db['rect'][(- 1)]
Creates a copy of the given rectangle and adds it to the local db Args: rect (Rectangle): rectangle object to be copied layer (str): layer that the copied rectangle should be drawn on. If None, the copied rectangle will use the same layer as the provided rectangle virtual (bool): If true, the rectangle object will be created but will not be drawn in the final layout. If false, the rectangle will be drawn as normal in the final layout Returns: (Rectangle): a new rectangle object copied from provided rectangle
ACG/AyarLayoutGenerator.py
copy_rect
AyarLabs/ACG
7
python
def copy_rect(self, rect: Rectangle, layer=None, virtual: bool=False) -> Rectangle: '\n Creates a copy of the given rectangle and adds it to the local db\n\n Args:\n rect (Rectangle):\n rectangle object to be copied\n layer (str):\n layer that the copied rectangle should be drawn on. If None, the copied rectangle will use the same\n layer as the provided rectangle\n virtual (bool):\n If true, the rectangle object will be created but will not be drawn in the final layout. If false, the\n rectangle will be drawn as normal in the final layout\n\n Returns:\n (Rectangle):\n a new rectangle object copied from provided rectangle\n ' temp = rect.copy(layer=layer, virtual=virtual) self._db['rect'].append(temp) return self._db['rect'][(- 1)]
def copy_rect(self, rect: Rectangle, layer=None, virtual: bool=False) -> Rectangle: '\n Creates a copy of the given rectangle and adds it to the local db\n\n Args:\n rect (Rectangle):\n rectangle object to be copied\n layer (str):\n layer that the copied rectangle should be drawn on. If None, the copied rectangle will use the same\n layer as the provided rectangle\n virtual (bool):\n If true, the rectangle object will be created but will not be drawn in the final layout. If false, the\n rectangle will be drawn as normal in the final layout\n\n Returns:\n (Rectangle):\n a new rectangle object copied from provided rectangle\n ' temp = rect.copy(layer=layer, virtual=virtual) self._db['rect'].append(temp) return self._db['rect'][(- 1)]<|docstring|>Creates a copy of the given rectangle and adds it to the local db Args: rect (Rectangle): rectangle object to be copied layer (str): layer that the copied rectangle should be drawn on. If None, the copied rectangle will use the same layer as the provided rectangle virtual (bool): If true, the rectangle object will be created but will not be drawn in the final layout. If false, the rectangle will be drawn as normal in the final layout Returns: (Rectangle): a new rectangle object copied from provided rectangle<|endoftext|>
b65ae793a74f61450a7cedf9fb0b08d194d6b06e2ebb3171d3d5e140ef02150a
def add_track(self, name: str, dim: str, spacing: float, origin: float=0) -> Track: "\n Creates and returns a track object for alignment use\n\n Parameters\n ----------\n name\n Name to use for the added track\n dim:\n 'x' for a horizontal track and 'y' for a vertical track\n spacing:\n number representing the space between tracks\n origin:\n coordinate for the 0th track\n\n Returns\n -------\n Track:\n track object for user manipulation\n " self.tracks.add_track(name=name, dim=dim, spacing=spacing, origin=origin) return self.tracks[name]
Creates and returns a track object for alignment use Parameters ---------- name Name to use for the added track dim: 'x' for a horizontal track and 'y' for a vertical track spacing: number representing the space between tracks origin: coordinate for the 0th track Returns ------- Track: track object for user manipulation
ACG/AyarLayoutGenerator.py
add_track
AyarLabs/ACG
7
python
def add_track(self, name: str, dim: str, spacing: float, origin: float=0) -> Track: "\n Creates and returns a track object for alignment use\n\n Parameters\n ----------\n name\n Name to use for the added track\n dim:\n 'x' for a horizontal track and 'y' for a vertical track\n spacing:\n number representing the space between tracks\n origin:\n coordinate for the 0th track\n\n Returns\n -------\n Track:\n track object for user manipulation\n " self.tracks.add_track(name=name, dim=dim, spacing=spacing, origin=origin) return self.tracks[name]
def add_track(self, name: str, dim: str, spacing: float, origin: float=0) -> Track: "\n Creates and returns a track object for alignment use\n\n Parameters\n ----------\n name\n Name to use for the added track\n dim:\n 'x' for a horizontal track and 'y' for a vertical track\n spacing:\n number representing the space between tracks\n origin:\n coordinate for the 0th track\n\n Returns\n -------\n Track:\n track object for user manipulation\n " self.tracks.add_track(name=name, dim=dim, spacing=spacing, origin=origin) return self.tracks[name]<|docstring|>Creates and returns a track object for alignment use Parameters ---------- name Name to use for the added track dim: 'x' for a horizontal track and 'y' for a vertical track spacing: number representing the space between tracks origin: coordinate for the 0th track Returns ------- Track: track object for user manipulation<|endoftext|>
46e481ffa52e88f4ac1fff748ab6138c9b1b4caad362f6c17f97c9d858298445
def new_template(self, params: dict=None, temp_cls=None, debug: bool=False, **kwargs): '\n Generates a layout master of specified class and parameter set\n\n Args:\n params (dict):\n dictionary of parameters to specify the layout to be created\n temp_cls:\n the layout generator class to be used\n debug (bool):\n True to print debug messages\n ' return TemplateBase.new_template(self, params=params, temp_cls=temp_cls, debug=debug, **kwargs)
Generates a layout master of specified class and parameter set Args: params (dict): dictionary of parameters to specify the layout to be created temp_cls: the layout generator class to be used debug (bool): True to print debug messages
ACG/AyarLayoutGenerator.py
new_template
AyarLabs/ACG
7
python
def new_template(self, params: dict=None, temp_cls=None, debug: bool=False, **kwargs): '\n Generates a layout master of specified class and parameter set\n\n Args:\n params (dict):\n dictionary of parameters to specify the layout to be created\n temp_cls:\n the layout generator class to be used\n debug (bool):\n True to print debug messages\n ' return TemplateBase.new_template(self, params=params, temp_cls=temp_cls, debug=debug, **kwargs)
def new_template(self, params: dict=None, temp_cls=None, debug: bool=False, **kwargs): '\n Generates a layout master of specified class and parameter set\n\n Args:\n params (dict):\n dictionary of parameters to specify the layout to be created\n temp_cls:\n the layout generator class to be used\n debug (bool):\n True to print debug messages\n ' return TemplateBase.new_template(self, params=params, temp_cls=temp_cls, debug=debug, **kwargs)<|docstring|>Generates a layout master of specified class and parameter set Args: params (dict): dictionary of parameters to specify the layout to be created temp_cls: the layout generator class to be used debug (bool): True to print debug messages<|endoftext|>
179308db2355bc8e96f3d42d2722028f1850d3062969324e9d0d1e887af93e5a
def add_instance(self, master, inst_name=None, loc=(0, 0), orient='R0') -> VirtualInst: ' Adds a single instance from a provided template master ' temp = VirtualInst(master, inst_name=inst_name) temp.shift_origin(loc, orient=orient) self._db['instance'].append(temp) return temp
Adds a single instance from a provided template master
ACG/AyarLayoutGenerator.py
add_instance
AyarLabs/ACG
7
python
def add_instance(self, master, inst_name=None, loc=(0, 0), orient='R0') -> VirtualInst: ' ' temp = VirtualInst(master, inst_name=inst_name) temp.shift_origin(loc, orient=orient) self._db['instance'].append(temp) return temp
def add_instance(self, master, inst_name=None, loc=(0, 0), orient='R0') -> VirtualInst: ' ' temp = VirtualInst(master, inst_name=inst_name) temp.shift_origin(loc, orient=orient) self._db['instance'].append(temp) return temp<|docstring|>Adds a single instance from a provided template master<|endoftext|>