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 |
|---|---|---|---|---|---|---|---|---|---|
d95e295f58693a3bc1898beac9ed474c88b9104195d968e46f0e74af48f35632 | def test_bool_for_numeric(self):
'Test that validator does not allow bool data where numeric is specified.'
self.set_up_spec('numeric')
value = np.bool(1)
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vm... | Test that validator does not allow bool data where numeric is specified. | tests/unit/validator_tests/test_validate.py | test_bool_for_numeric | hrnciar/hdmf | 0 | python | def test_bool_for_numeric(self):
self.set_up_spec('numeric')
value = np.bool(1)
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
result_strings = set([str(s) for s in results... | def test_bool_for_numeric(self):
self.set_up_spec('numeric')
value = np.bool(1)
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
result_strings = set([str(s) for s in results... |
77798ebd3d6cb5195ecf4a5081d5cc127eba1d7c83a663968e16f3fb0b82c0c6 | def test_np_bool_for_bool(self):
'Test that validator allows np.bool_ data where bool is specified.'
self.set_up_spec('bool')
value = np.bool_(True)
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.val... | Test that validator allows np.bool_ data where bool is specified. | tests/unit/validator_tests/test_validate.py | test_np_bool_for_bool | hrnciar/hdmf | 0 | python | def test_np_bool_for_bool(self):
self.set_up_spec('bool')
value = np.bool_(True)
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
self.assertEqual(len(results), 0) | def test_np_bool_for_bool(self):
self.set_up_spec('bool')
value = np.bool_(True)
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
self.assertEqual(len(results), 0)<|docstring... |
20a45a43d761af8f1fe0daa73b37dd88d93dd168a4d0008348ab0253df804bb7 | def test_scalar(self):
'Test that validator does not allow a scalar where an array is specified.'
self.set_up_spec('text')
value = 'a string'
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(b... | Test that validator does not allow a scalar where an array is specified. | tests/unit/validator_tests/test_validate.py | test_scalar | hrnciar/hdmf | 0 | python | def test_scalar(self):
self.set_up_spec('text')
value = 'a string'
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
result_strings = set([str(s) for s in results])
expect... | def test_scalar(self):
self.set_up_spec('text')
value = 'a string'
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
result_strings = set([str(s) for s in results])
expect... |
9e06a931526eca1bb623a4a1d19168ec0733f8f053107b3847cacd248a702c04 | def test_empty_list(self):
'Test that validator allows an empty list where an array is specified.'
self.set_up_spec('text')
value = []
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_buil... | Test that validator allows an empty list where an array is specified. | tests/unit/validator_tests/test_validate.py | test_empty_list | hrnciar/hdmf | 0 | python | def test_empty_list(self):
self.set_up_spec('text')
value = []
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
self.assertEqual(len(results), 0) | def test_empty_list(self):
self.set_up_spec('text')
value = []
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
self.assertEqual(len(results), 0)<|docstring|>Test that valida... |
d03ba0853f332d0a3830df51e85332afbd1ebd1cae826765a178d2db249580a2 | def test_empty_nparray(self):
'Test that validator allows an empty numpy array where an array is specified.'
self.set_up_spec('text')
value = np.array([])
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vm... | Test that validator allows an empty numpy array where an array is specified. | tests/unit/validator_tests/test_validate.py | test_empty_nparray | hrnciar/hdmf | 0 | python | def test_empty_nparray(self):
self.set_up_spec('text')
value = np.array([])
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
self.assertEqual(len(results), 0) | def test_empty_nparray(self):
self.set_up_spec('text')
value = np.array([])
bar_builder = GroupBuilder('my_bar', attributes={'data_type': 'Bar', 'attr1': value}, datasets=[DatasetBuilder('data', value)])
results = self.vmap.validate(bar_builder)
self.assertEqual(len(results), 0)<|docstring|>Tes... |
885f79a43d1c76966a34d41aae8eba7f158c4ad9555daabbe8d68f30c2e95988 | def validate_linkability(self, link, expect_error):
'Execute a linkability test and assert whether or not an IllegalLinkError is returned'
self.set_up_spec()
builder = GroupBuilder('my_baz', attributes={'data_type': 'Baz'}, links=[link])
result = self.vmap.validate(builder)
if expect_error:
... | Execute a linkability test and assert whether or not an IllegalLinkError is returned | tests/unit/validator_tests/test_validate.py | validate_linkability | hrnciar/hdmf | 0 | python | def validate_linkability(self, link, expect_error):
self.set_up_spec()
builder = GroupBuilder('my_baz', attributes={'data_type': 'Baz'}, links=[link])
result = self.vmap.validate(builder)
if expect_error:
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], IllegalLinkE... | def validate_linkability(self, link, expect_error):
self.set_up_spec()
builder = GroupBuilder('my_baz', attributes={'data_type': 'Baz'}, links=[link])
result = self.vmap.validate(builder)
if expect_error:
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], IllegalLinkE... |
e1b730bf67ba8aded73b528710843052461faf18682e33372d85cff1d73de5cb | def test_untyped_linkable_dataset_accepts_link(self):
'Test that the validator accepts a link when the spec has an untyped linkable dataset'
link = LinkBuilder(name='untyped_linkable_ds', builder=DatasetBuilder('foo'))
self.validate_linkability(link, expect_error=False) | Test that the validator accepts a link when the spec has an untyped linkable dataset | tests/unit/validator_tests/test_validate.py | test_untyped_linkable_dataset_accepts_link | hrnciar/hdmf | 0 | python | def test_untyped_linkable_dataset_accepts_link(self):
link = LinkBuilder(name='untyped_linkable_ds', builder=DatasetBuilder('foo'))
self.validate_linkability(link, expect_error=False) | def test_untyped_linkable_dataset_accepts_link(self):
link = LinkBuilder(name='untyped_linkable_ds', builder=DatasetBuilder('foo'))
self.validate_linkability(link, expect_error=False)<|docstring|>Test that the validator accepts a link when the spec has an untyped linkable dataset<|endoftext|> |
f6e030c369aff3cf30694027d4bb78417ec5e4a9ecc4ba6bc1d0168747dffe3d | def test_untyped_nonlinkable_dataset_does_not_accept_link(self):
'Test that the validator returns an IllegalLinkError when the spec has an untyped non-linkable dataset'
link = LinkBuilder(name='untyped_nonlinkable_ds', builder=DatasetBuilder('foo'))
self.validate_linkability(link, expect_error=True) | Test that the validator returns an IllegalLinkError when the spec has an untyped non-linkable dataset | tests/unit/validator_tests/test_validate.py | test_untyped_nonlinkable_dataset_does_not_accept_link | hrnciar/hdmf | 0 | python | def test_untyped_nonlinkable_dataset_does_not_accept_link(self):
link = LinkBuilder(name='untyped_nonlinkable_ds', builder=DatasetBuilder('foo'))
self.validate_linkability(link, expect_error=True) | def test_untyped_nonlinkable_dataset_does_not_accept_link(self):
link = LinkBuilder(name='untyped_nonlinkable_ds', builder=DatasetBuilder('foo'))
self.validate_linkability(link, expect_error=True)<|docstring|>Test that the validator returns an IllegalLinkError when the spec has an untyped non-linkable data... |
96c8b66e25e39aa59b8a16adba28e553e2cfaf696a6eb865e562cff266db0c29 | def test_typed_linkable_dataset_accepts_link(self):
'Test that the validator accepts a link when the spec has a typed linkable dataset'
link = LinkBuilder(name='typed_linkable_ds', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'}))
self.validate_linkability(link, expect_error=False) | Test that the validator accepts a link when the spec has a typed linkable dataset | tests/unit/validator_tests/test_validate.py | test_typed_linkable_dataset_accepts_link | hrnciar/hdmf | 0 | python | def test_typed_linkable_dataset_accepts_link(self):
link = LinkBuilder(name='typed_linkable_ds', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'}))
self.validate_linkability(link, expect_error=False) | def test_typed_linkable_dataset_accepts_link(self):
link = LinkBuilder(name='typed_linkable_ds', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'}))
self.validate_linkability(link, expect_error=False)<|docstring|>Test that the validator accepts a link when the spec has a typed linkable dataset<... |
bdd6d005adc2a22e6336f6abf889adcaae2940298cb2e1fcdc941fe48f094ddf | def test_typed_nonlinkable_dataset_does_not_accept_link(self):
'Test that the validator returns an IllegalLinkError when the spec has a typed non-linkable dataset'
link = LinkBuilder(name='typed_nonlinkable_ds', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'}))
self.validate_linkability(link, ... | Test that the validator returns an IllegalLinkError when the spec has a typed non-linkable dataset | tests/unit/validator_tests/test_validate.py | test_typed_nonlinkable_dataset_does_not_accept_link | hrnciar/hdmf | 0 | python | def test_typed_nonlinkable_dataset_does_not_accept_link(self):
link = LinkBuilder(name='typed_nonlinkable_ds', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'}))
self.validate_linkability(link, expect_error=True) | def test_typed_nonlinkable_dataset_does_not_accept_link(self):
link = LinkBuilder(name='typed_nonlinkable_ds', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'}))
self.validate_linkability(link, expect_error=True)<|docstring|>Test that the validator returns an IllegalLinkError when the spec has... |
4423e32f2e293af708d957331db686b831f7f7ff896c7fab8ee88c1f4b503148 | def test_untyped_linkable_group_accepts_link(self):
'Test that the validator accepts a link when the spec has an untyped linkable group'
link = LinkBuilder(name='untyped_linkable_group', builder=GroupBuilder('foo'))
self.validate_linkability(link, expect_error=False) | Test that the validator accepts a link when the spec has an untyped linkable group | tests/unit/validator_tests/test_validate.py | test_untyped_linkable_group_accepts_link | hrnciar/hdmf | 0 | python | def test_untyped_linkable_group_accepts_link(self):
link = LinkBuilder(name='untyped_linkable_group', builder=GroupBuilder('foo'))
self.validate_linkability(link, expect_error=False) | def test_untyped_linkable_group_accepts_link(self):
link = LinkBuilder(name='untyped_linkable_group', builder=GroupBuilder('foo'))
self.validate_linkability(link, expect_error=False)<|docstring|>Test that the validator accepts a link when the spec has an untyped linkable group<|endoftext|> |
acf0206ac145d0ebc1c26c7a32391b84d647ba8ca7b94c257ce17a8fe1828f03 | def test_untyped_nonlinkable_group_does_not_accept_link(self):
'Test that the validator returns an IllegalLinkError when the spec has an untyped non-linkable group'
link = LinkBuilder(name='untyped_nonlinkable_group', builder=GroupBuilder('foo'))
self.validate_linkability(link, expect_error=True) | Test that the validator returns an IllegalLinkError when the spec has an untyped non-linkable group | tests/unit/validator_tests/test_validate.py | test_untyped_nonlinkable_group_does_not_accept_link | hrnciar/hdmf | 0 | python | def test_untyped_nonlinkable_group_does_not_accept_link(self):
link = LinkBuilder(name='untyped_nonlinkable_group', builder=GroupBuilder('foo'))
self.validate_linkability(link, expect_error=True) | def test_untyped_nonlinkable_group_does_not_accept_link(self):
link = LinkBuilder(name='untyped_nonlinkable_group', builder=GroupBuilder('foo'))
self.validate_linkability(link, expect_error=True)<|docstring|>Test that the validator returns an IllegalLinkError when the spec has an untyped non-linkable group... |
dc70e062ba05c1211a16156d345ecd58636e96563a3a4316ab6df3e748012951 | def test_typed_linkable_group_accepts_link(self):
'Test that the validator accepts a link when the spec has a typed linkable group'
link = LinkBuilder(name='typed_linkable_group', builder=GroupBuilder('foo', attributes={'data_type': 'Bar'}))
self.validate_linkability(link, expect_error=False) | Test that the validator accepts a link when the spec has a typed linkable group | tests/unit/validator_tests/test_validate.py | test_typed_linkable_group_accepts_link | hrnciar/hdmf | 0 | python | def test_typed_linkable_group_accepts_link(self):
link = LinkBuilder(name='typed_linkable_group', builder=GroupBuilder('foo', attributes={'data_type': 'Bar'}))
self.validate_linkability(link, expect_error=False) | def test_typed_linkable_group_accepts_link(self):
link = LinkBuilder(name='typed_linkable_group', builder=GroupBuilder('foo', attributes={'data_type': 'Bar'}))
self.validate_linkability(link, expect_error=False)<|docstring|>Test that the validator accepts a link when the spec has a typed linkable group<|en... |
eb5185c59151146924bafd04cb7853d2743a10732581107569168ce36ad0bfde | def test_typed_nonlinkable_group_does_not_accept_link(self):
'Test that the validator returns an IllegalLinkError when the spec has a typed non-linkable group'
link = LinkBuilder(name='typed_nonlinkable_group', builder=GroupBuilder('foo', attributes={'data_type': 'Bar'}))
self.validate_linkability(link, exp... | Test that the validator returns an IllegalLinkError when the spec has a typed non-linkable group | tests/unit/validator_tests/test_validate.py | test_typed_nonlinkable_group_does_not_accept_link | hrnciar/hdmf | 0 | python | def test_typed_nonlinkable_group_does_not_accept_link(self):
link = LinkBuilder(name='typed_nonlinkable_group', builder=GroupBuilder('foo', attributes={'data_type': 'Bar'}))
self.validate_linkability(link, expect_error=True) | def test_typed_nonlinkable_group_does_not_accept_link(self):
link = LinkBuilder(name='typed_nonlinkable_group', builder=GroupBuilder('foo', attributes={'data_type': 'Bar'}))
self.validate_linkability(link, expect_error=True)<|docstring|>Test that the validator returns an IllegalLinkError when the spec has ... |
c3b2e6313476903f68b9845a7ecd809fa550d9bdd4f38dc118e11ec351f53cde | @mock.patch('hdmf.validate.validator.DatasetValidator.validate')
def test_should_not_validate_illegally_linked_objects(self, mock_validator):
'Test that an illegally linked child dataset is not validated\n\n Note: this behavior is expected to change in the future:\n https://github.com/hdmf-dev/hdmf/is... | Test that an illegally linked child dataset is not validated
Note: this behavior is expected to change in the future:
https://github.com/hdmf-dev/hdmf/issues/516 | tests/unit/validator_tests/test_validate.py | test_should_not_validate_illegally_linked_objects | hrnciar/hdmf | 0 | python | @mock.patch('hdmf.validate.validator.DatasetValidator.validate')
def test_should_not_validate_illegally_linked_objects(self, mock_validator):
'Test that an illegally linked child dataset is not validated\n\n Note: this behavior is expected to change in the future:\n https://github.com/hdmf-dev/hdmf/is... | @mock.patch('hdmf.validate.validator.DatasetValidator.validate')
def test_should_not_validate_illegally_linked_objects(self, mock_validator):
'Test that an illegally linked child dataset is not validated\n\n Note: this behavior is expected to change in the future:\n https://github.com/hdmf-dev/hdmf/is... |
9669e2d39ade896144094fb5c7bdff73ed74c42796b364ef9f61fafd34eae54a | def validate_multiple_children(self, dataset_names, group_names):
'Utility function to validate a builder with the specified named dataset and group children'
self.set_up_spec()
datasets = [DatasetBuilder(ds, attributes={'data_type': 'Foo'}) for ds in dataset_names]
groups = [GroupBuilder(gr, attributes... | Utility function to validate a builder with the specified named dataset and group children | tests/unit/validator_tests/test_validate.py | validate_multiple_children | hrnciar/hdmf | 0 | python | def validate_multiple_children(self, dataset_names, group_names):
self.set_up_spec()
datasets = [DatasetBuilder(ds, attributes={'data_type': 'Foo'}) for ds in dataset_names]
groups = [GroupBuilder(gr, attributes={'data_type': 'Bar'}) for gr in group_names]
builder = GroupBuilder('my_baz', attribute... | def validate_multiple_children(self, dataset_names, group_names):
self.set_up_spec()
datasets = [DatasetBuilder(ds, attributes={'data_type': 'Foo'}) for ds in dataset_names]
groups = [GroupBuilder(gr, attributes={'data_type': 'Bar'}) for gr in group_names]
builder = GroupBuilder('my_baz', attribute... |
01a648eafc5fa92d59acc120a8b742a3115e6c72998cf3ad8725016759a1618b | def test_missing_first_dataset_should_return_error(self):
'Test that the validator returns a MissingDataType error if the first dataset is missing'
result = self.validate_multiple_children(['b'], ['x', 'y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | Test that the validator returns a MissingDataType error if the first dataset is missing | tests/unit/validator_tests/test_validate.py | test_missing_first_dataset_should_return_error | hrnciar/hdmf | 0 | python | def test_missing_first_dataset_should_return_error(self):
result = self.validate_multiple_children(['b'], ['x', 'y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | def test_missing_first_dataset_should_return_error(self):
result = self.validate_multiple_children(['b'], ['x', 'y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType)<|docstring|>Test that the validator returns a MissingDataType error if the first dataset is missing<|e... |
8968bc7e5611cfe370d45fc8f6bdddbdabf3793483e152a7f33b2d99c7c8b22e | def test_missing_last_dataset_should_return_error(self):
'Test that the validator returns a MissingDataType error if the last dataset is missing'
result = self.validate_multiple_children(['a'], ['x', 'y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | Test that the validator returns a MissingDataType error if the last dataset is missing | tests/unit/validator_tests/test_validate.py | test_missing_last_dataset_should_return_error | hrnciar/hdmf | 0 | python | def test_missing_last_dataset_should_return_error(self):
result = self.validate_multiple_children(['a'], ['x', 'y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | def test_missing_last_dataset_should_return_error(self):
result = self.validate_multiple_children(['a'], ['x', 'y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType)<|docstring|>Test that the validator returns a MissingDataType error if the last dataset is missing<|end... |
f96b07999009e94467700b27caf59007440ba23b6edb978f6fda897aded43e0b | def test_missing_first_group_should_return_error(self):
'Test that the validator returns a MissingDataType error if the first group is missing'
result = self.validate_multiple_children(['a', 'b'], ['y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | Test that the validator returns a MissingDataType error if the first group is missing | tests/unit/validator_tests/test_validate.py | test_missing_first_group_should_return_error | hrnciar/hdmf | 0 | python | def test_missing_first_group_should_return_error(self):
result = self.validate_multiple_children(['a', 'b'], ['y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | def test_missing_first_group_should_return_error(self):
result = self.validate_multiple_children(['a', 'b'], ['y'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType)<|docstring|>Test that the validator returns a MissingDataType error if the first group is missing<|endof... |
b5e8b831d2cf8f4dee55d820212536f4a011c08f8e6335f0b0dccd8ecf2f200b | def test_missing_last_group_should_return_error(self):
'Test that the validator returns a MissingDataType error if the last group is missing'
result = self.validate_multiple_children(['a', 'b'], ['x'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | Test that the validator returns a MissingDataType error if the last group is missing | tests/unit/validator_tests/test_validate.py | test_missing_last_group_should_return_error | hrnciar/hdmf | 0 | python | def test_missing_last_group_should_return_error(self):
result = self.validate_multiple_children(['a', 'b'], ['x'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType) | def test_missing_last_group_should_return_error(self):
result = self.validate_multiple_children(['a', 'b'], ['x'])
self.assertEqual(len(result), 1)
self.assertIsInstance(result[0], MissingDataType)<|docstring|>Test that the validator returns a MissingDataType error if the last group is missing<|endofte... |
75796437674bfb8d315bc15e8f175066000515f22d27eff5c0ea197f56734883 | def test_no_errors_when_all_children_satisfied(self):
'Test that the validator does not return an error if all child specs are satisfied'
result = self.validate_multiple_children(['a', 'b'], ['x', 'y'])
self.assertEqual(len(result), 0) | Test that the validator does not return an error if all child specs are satisfied | tests/unit/validator_tests/test_validate.py | test_no_errors_when_all_children_satisfied | hrnciar/hdmf | 0 | python | def test_no_errors_when_all_children_satisfied(self):
result = self.validate_multiple_children(['a', 'b'], ['x', 'y'])
self.assertEqual(len(result), 0) | def test_no_errors_when_all_children_satisfied(self):
result = self.validate_multiple_children(['a', 'b'], ['x', 'y'])
self.assertEqual(len(result), 0)<|docstring|>Test that the validator does not return an error if all child specs are satisfied<|endoftext|> |
3bcb7ae5eed431929b29408452dcae582a614b674c6e1b68240f85c73cf483be | def validate_matching_link_data_type_case(self, datasets, groups, links):
'Execute validation against a group builder using the provided group\n children and verify that a MissingDataType error is returned\n '
self.set_up_spec()
builder = GroupBuilder('my_baz', attributes={'data_type': 'Baz'},... | Execute validation against a group builder using the provided group
children and verify that a MissingDataType error is returned | tests/unit/validator_tests/test_validate.py | validate_matching_link_data_type_case | hrnciar/hdmf | 0 | python | def validate_matching_link_data_type_case(self, datasets, groups, links):
'Execute validation against a group builder using the provided group\n children and verify that a MissingDataType error is returned\n '
self.set_up_spec()
builder = GroupBuilder('my_baz', attributes={'data_type': 'Baz'},... | def validate_matching_link_data_type_case(self, datasets, groups, links):
'Execute validation against a group builder using the provided group\n children and verify that a MissingDataType error is returned\n '
self.set_up_spec()
builder = GroupBuilder('my_baz', attributes={'data_type': 'Baz'},... |
06ba0c1d7b236b0a26b33fccde7fa9987d301794c409d8de9c8fd1298a9d0e27 | def test_error_on_missing_child_dataset(self):
'Test that a MissingDataType is returned when the child dataset is missing'
datasets = []
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo... | Test that a MissingDataType is returned when the child dataset is missing | tests/unit/validator_tests/test_validate.py | test_error_on_missing_child_dataset | hrnciar/hdmf | 0 | python | def test_error_on_missing_child_dataset(self):
datasets = []
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'})), LinkBuilder(name='group_link', builder=GroupBuilder('bar', attributes... | def test_error_on_missing_child_dataset(self):
datasets = []
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'})), LinkBuilder(name='group_link', builder=GroupBuilder('bar', attributes... |
90f1358e67968dd65009016f0a24319038ec082e21c3d0ca596f11e68e46a728 | def test_error_on_missing_linked_dataset(self):
'Test that a MissingDataType is returned when the linked dataset is missing'
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='group_link', b... | Test that a MissingDataType is returned when the linked dataset is missing | tests/unit/validator_tests/test_validate.py | test_error_on_missing_linked_dataset | hrnciar/hdmf | 0 | python | def test_error_on_missing_linked_dataset(self):
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='group_link', builder=GroupBuilder('bar', attributes={'data_type': 'Bar'}))]
self.valid... | def test_error_on_missing_linked_dataset(self):
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='group_link', builder=GroupBuilder('bar', attributes={'data_type': 'Bar'}))]
self.valid... |
719590ecaa52f6913982c25cf6a6956d247041ceb3d7a2bbdaac08c3a2369a1e | def test_error_on_missing_group(self):
'Test that a MissingDataType is returned when the child group is missing'
self.set_up_spec()
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = []
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={... | Test that a MissingDataType is returned when the child group is missing | tests/unit/validator_tests/test_validate.py | test_error_on_missing_group | hrnciar/hdmf | 0 | python | def test_error_on_missing_group(self):
self.set_up_spec()
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = []
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'})), LinkBuilder(name='group_link', builder=GroupBuilde... | def test_error_on_missing_group(self):
self.set_up_spec()
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = []
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type': 'Foo'})), LinkBuilder(name='group_link', builder=GroupBuilde... |
7f3f556477e842f81b9e70d731ebc4a60a336dbdc7a185a34f10a815e86192aa | def test_error_on_missing_linked_group(self):
'Test that a MissingDataType is returned when the linked group is missing'
self.set_up_spec()
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(n... | Test that a MissingDataType is returned when the linked group is missing | tests/unit/validator_tests/test_validate.py | test_error_on_missing_linked_group | hrnciar/hdmf | 0 | python | def test_error_on_missing_linked_group(self):
self.set_up_spec()
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type':... | def test_error_on_missing_linked_group(self):
self.set_up_spec()
datasets = [DatasetBuilder('dataset', attributes={'data_type': 'Foo'})]
groups = [GroupBuilder('group', attributes={'data_type': 'Bar'})]
links = [LinkBuilder(name='dataset_link', builder=DatasetBuilder('foo', attributes={'data_type':... |
8158a6c2f9260ab8e48e275e2e609a7a638bd4f19a0dcd22d3842a662a9a1539 | def test_error_returned_when_child_at_highest_level_missing(self):
'Test that a MissingDataType error is returned when the dataset at\n the highest level of the inheritance hierarchy is missing\n '
self.set_up_spec()
datasets = [DatasetBuilder('bar', attributes={'data_type': 'Bar'})]
build... | Test that a MissingDataType error is returned when the dataset at
the highest level of the inheritance hierarchy is missing | tests/unit/validator_tests/test_validate.py | test_error_returned_when_child_at_highest_level_missing | hrnciar/hdmf | 0 | python | def test_error_returned_when_child_at_highest_level_missing(self):
'Test that a MissingDataType error is returned when the dataset at\n the highest level of the inheritance hierarchy is missing\n '
self.set_up_spec()
datasets = [DatasetBuilder('bar', attributes={'data_type': 'Bar'})]
build... | def test_error_returned_when_child_at_highest_level_missing(self):
'Test that a MissingDataType error is returned when the dataset at\n the highest level of the inheritance hierarchy is missing\n '
self.set_up_spec()
datasets = [DatasetBuilder('bar', attributes={'data_type': 'Bar'})]
build... |
92a27ebe4a541e9ff6a67c10f099bfef14bfd6d15fdb601d679f7992d6bb5c79 | def test_error_returned_when_child_at_lowest_level_missing(self):
'Test that a MissingDataType error is returned when the dataset at\n the lowest level of the inheritance hierarchy is missing\n '
self.set_up_spec()
datasets = [DatasetBuilder('foo', attributes={'data_type': 'Foo'})]
builder... | Test that a MissingDataType error is returned when the dataset at
the lowest level of the inheritance hierarchy is missing | tests/unit/validator_tests/test_validate.py | test_error_returned_when_child_at_lowest_level_missing | hrnciar/hdmf | 0 | python | def test_error_returned_when_child_at_lowest_level_missing(self):
'Test that a MissingDataType error is returned when the dataset at\n the lowest level of the inheritance hierarchy is missing\n '
self.set_up_spec()
datasets = [DatasetBuilder('foo', attributes={'data_type': 'Foo'})]
builder... | def test_error_returned_when_child_at_lowest_level_missing(self):
'Test that a MissingDataType error is returned when the dataset at\n the lowest level of the inheritance hierarchy is missing\n '
self.set_up_spec()
datasets = [DatasetBuilder('foo', attributes={'data_type': 'Foo'})]
builder... |
631071499eb8a083bb80129e8b6234400d7d2e692ed3ad3cd874e410294b8c55 | def test_both_levels_of_hierarchy_validated(self):
'Test that when both required children at separate levels of\n inheritance hierarchy are present, both child specs are satisfied\n '
self.set_up_spec()
datasets = [DatasetBuilder('foo', attributes={'data_type': 'Foo'}), DatasetBuilder('bar', a... | Test that when both required children at separate levels of
inheritance hierarchy are present, both child specs are satisfied | tests/unit/validator_tests/test_validate.py | test_both_levels_of_hierarchy_validated | hrnciar/hdmf | 0 | python | def test_both_levels_of_hierarchy_validated(self):
'Test that when both required children at separate levels of\n inheritance hierarchy are present, both child specs are satisfied\n '
self.set_up_spec()
datasets = [DatasetBuilder('foo', attributes={'data_type': 'Foo'}), DatasetBuilder('bar', a... | def test_both_levels_of_hierarchy_validated(self):
'Test that when both required children at separate levels of\n inheritance hierarchy are present, both child specs are satisfied\n '
self.set_up_spec()
datasets = [DatasetBuilder('foo', attributes={'data_type': 'Foo'}), DatasetBuilder('bar', a... |
358825b7021c5938ce9a4761252f08daa79a7bab4ee4d41c83e4c36ef3b1c3d3 | @skip('Functionality not yet supported')
def test_both_levels_of_hierarchy_validated_inverted_order(self):
'Test that when both required children at separate levels of\n inheritance hierarchy are present, both child specs are satisfied.\n This should work no matter what the order of the builders.\n ... | Test that when both required children at separate levels of
inheritance hierarchy are present, both child specs are satisfied.
This should work no matter what the order of the builders. | tests/unit/validator_tests/test_validate.py | test_both_levels_of_hierarchy_validated_inverted_order | hrnciar/hdmf | 0 | python | @skip('Functionality not yet supported')
def test_both_levels_of_hierarchy_validated_inverted_order(self):
'Test that when both required children at separate levels of\n inheritance hierarchy are present, both child specs are satisfied.\n This should work no matter what the order of the builders.\n ... | @skip('Functionality not yet supported')
def test_both_levels_of_hierarchy_validated_inverted_order(self):
'Test that when both required children at separate levels of\n inheritance hierarchy are present, both child specs are satisfied.\n This should work no matter what the order of the builders.\n ... |
acf1a07ec1fb601816c5b13ed08dbde90c69ac7d3a0c2f023bf6b88017c69fac | def get(isamAppliance, check_mode=False, force=False):
'\n Retrieve the stored ISAM credential\n '
return isamAppliance.invoke_get('Retrieve the stored ISAM credential', '{0}'.format(uri), requires_modules=requires_modules, requires_version=requires_version) | Retrieve the stored ISAM credential | ibmsecurity/isam/web/api_access_control/utilities/credential.py | get | zone-zero/ibmsecurity | 46 | python | def get(isamAppliance, check_mode=False, force=False):
'\n \n '
return isamAppliance.invoke_get(, '{0}'.format(uri), requires_modules=requires_modules, requires_version=requires_version) | def get(isamAppliance, check_mode=False, force=False):
'\n \n '
return isamAppliance.invoke_get(, '{0}'.format(uri), requires_modules=requires_modules, requires_version=requires_version)<|docstring|>Retrieve the stored ISAM credential<|endoftext|> |
2ed943bae847646166288828469e64a6317b5ffe65726335c0699c9f0c4f5b09 | def add(isamAppliance, admin_id, admin_pwd, admin_domain='Default', check_mode=False, force=False):
'\n Store the ISAM administrator credentials\n '
(exist, warnings) = _check(isamAppliance)
if ((force is True) or (exist is False)):
if (check_mode is True):
return isamAppliance.cre... | Store the ISAM administrator credentials | ibmsecurity/isam/web/api_access_control/utilities/credential.py | add | zone-zero/ibmsecurity | 46 | python | def add(isamAppliance, admin_id, admin_pwd, admin_domain='Default', check_mode=False, force=False):
'\n \n '
(exist, warnings) = _check(isamAppliance)
if ((force is True) or (exist is False)):
if (check_mode is True):
return isamAppliance.create_return_object(changed=True, warnings... | def add(isamAppliance, admin_id, admin_pwd, admin_domain='Default', check_mode=False, force=False):
'\n \n '
(exist, warnings) = _check(isamAppliance)
if ((force is True) or (exist is False)):
if (check_mode is True):
return isamAppliance.create_return_object(changed=True, warnings... |
5ddd4ab72e2414b58785ba9276d665cc69e085935cfe70e993dd07248285a3ac | def delete(isamAppliance, check_mode=False, force=False):
'\n Delete the stored ISAM administrator credential\n '
(exist, warnings) = _check(isamAppliance)
if ((force is True) or (exist is True)):
if (check_mode is True):
return isamAppliance.create_return_object(changed=True, warn... | Delete the stored ISAM administrator credential | ibmsecurity/isam/web/api_access_control/utilities/credential.py | delete | zone-zero/ibmsecurity | 46 | python | def delete(isamAppliance, check_mode=False, force=False):
'\n \n '
(exist, warnings) = _check(isamAppliance)
if ((force is True) or (exist is True)):
if (check_mode is True):
return isamAppliance.create_return_object(changed=True, warnings=warnings)
else:
return... | def delete(isamAppliance, check_mode=False, force=False):
'\n \n '
(exist, warnings) = _check(isamAppliance)
if ((force is True) or (exist is True)):
if (check_mode is True):
return isamAppliance.create_return_object(changed=True, warnings=warnings)
else:
return... |
7e49f2d7beca186f9573fdc54f571e1a9a947a8e14f484244a8452c5e6339d07 | def harary(A: SparseTensor, vtx_color=None, threshold=0.97):
'\n Harary bipartite decomposition\n\n Parameters\n ----------\n A: :py:class:`SparseTensor`\n The adjacency matrix\n vtx_color: array_like, optional\n All valid type for :py:func:`np.asarray` is acceptable, including :py... | Harary bipartite decomposition
Parameters
----------
A: :py:class:`SparseTensor`
The adjacency matrix
vtx_color: array_like, optional
All valid type for :py:func:`np.asarray` is acceptable, including :py:class:`torch.Tensor` on cpu. If None,
this function will invoke :py:func:`thgsp.alg.dsatur` silent... | thgsp/bga/harary.py | harary | bwdeng20/thgsp | 22 | python | def harary(A: SparseTensor, vtx_color=None, threshold=0.97):
'\n Harary bipartite decomposition\n\n Parameters\n ----------\n A: :py:class:`SparseTensor`\n The adjacency matrix\n vtx_color: array_like, optional\n All valid type for :py:func:`np.asarray` is acceptable, including :py... | def harary(A: SparseTensor, vtx_color=None, threshold=0.97):
'\n Harary bipartite decomposition\n\n Parameters\n ----------\n A: :py:class:`SparseTensor`\n The adjacency matrix\n vtx_color: array_like, optional\n All valid type for :py:func:`np.asarray` is acceptable, including :py... |
5d4d847b5140e9bb7ead55ce75e70904b98d37616f795e10c410210608e684f5 | def get_landmark_seen(self, frame_idx):
'Get landmark index that camera sees in a frame. \n\n Args:\n frame_idx (int): index of the frame\n\n Returns:\n tuple: index of all features in given frame, pixel coordinates\n '
pixels = self.features[(:, :, frame_idx)]
val... | Get landmark index that camera sees in a frame.
Args:
frame_idx (int): index of the frame
Returns:
tuple: index of all features in given frame, pixel coordinates | sensors.py | get_landmark_seen | chenfengw/visual-inertial-slam | 2 | python | def get_landmark_seen(self, frame_idx):
'Get landmark index that camera sees in a frame. \n\n Args:\n frame_idx (int): index of the frame\n\n Returns:\n tuple: index of all features in given frame, pixel coordinates\n '
pixels = self.features[(:, :, frame_idx)]
val... | def get_landmark_seen(self, frame_idx):
'Get landmark index that camera sees in a frame. \n\n Args:\n frame_idx (int): index of the frame\n\n Returns:\n tuple: index of all features in given frame, pixel coordinates\n '
pixels = self.features[(:, :, frame_idx)]
val... |
d961510f5ccbde854fc37e5722090fc272c50a9345cf4cc0fa1f7e659e8153e7 | def pixel_to_xyz(self, pixels, max_depth=25):
'Given pixel coordinates find out xyz in camera frame\n\n Args:\n pixels (np array): 4 x N_features\n max_depth (int): set max pixel depth in meter\n Returns:\n np array: xyz coordinates of pixels in homogenous coordinates,... | Given pixel coordinates find out xyz in camera frame
Args:
pixels (np array): 4 x N_features
max_depth (int): set max pixel depth in meter
Returns:
np array: xyz coordinates of pixels in homogenous coordinates,
3 (x,y,z) x N_features | sensors.py | pixel_to_xyz | chenfengw/visual-inertial-slam | 2 | python | def pixel_to_xyz(self, pixels, max_depth=25):
'Given pixel coordinates find out xyz in camera frame\n\n Args:\n pixels (np array): 4 x N_features\n max_depth (int): set max pixel depth in meter\n Returns:\n np array: xyz coordinates of pixels in homogenous coordinates,... | def pixel_to_xyz(self, pixels, max_depth=25):
'Given pixel coordinates find out xyz in camera frame\n\n Args:\n pixels (np array): 4 x N_features\n max_depth (int): set max pixel depth in meter\n Returns:\n np array: xyz coordinates of pixels in homogenous coordinates,... |
2867acf63f000bd0992ed252646964a182236007419d57e3fc8f94ce9bc1b2bc | def _is_key_file_encrypted(key_file):
'Detects if a key file is encrypted or not.\n\n Copy of the internal urllib function (urllib3.util.ssl_)'
with open(key_file, 'r') as f:
for line in f:
if ('ENCRYPTED' in line):
return True
return False | Detects if a key file is encrypted or not.
Copy of the internal urllib function (urllib3.util.ssl_) | httpie/ssl_.py | _is_key_file_encrypted | 10088/httpie | 2 | python | def _is_key_file_encrypted(key_file):
'Detects if a key file is encrypted or not.\n\n Copy of the internal urllib function (urllib3.util.ssl_)'
with open(key_file, 'r') as f:
for line in f:
if ('ENCRYPTED' in line):
return True
return False | def _is_key_file_encrypted(key_file):
'Detects if a key file is encrypted or not.\n\n Copy of the internal urllib function (urllib3.util.ssl_)'
with open(key_file, 'r') as f:
for line in f:
if ('ENCRYPTED' in line):
return True
return False<|docstring|>Detects if a key... |
65be57d7f132c51f750ebc9f1f6012ab2e228fa75908df09fff7e075c53d0a55 | def to_raw_cert(self):
"Synthesize a requests-compatible (2-item tuple of cert and key file)\n object from HTTPie's internal representation of a certificate."
return (self.cert_file, self.key_file) | Synthesize a requests-compatible (2-item tuple of cert and key file)
object from HTTPie's internal representation of a certificate. | httpie/ssl_.py | to_raw_cert | 10088/httpie | 2 | python | def to_raw_cert(self):
"Synthesize a requests-compatible (2-item tuple of cert and key file)\n object from HTTPie's internal representation of a certificate."
return (self.cert_file, self.key_file) | def to_raw_cert(self):
"Synthesize a requests-compatible (2-item tuple of cert and key file)\n object from HTTPie's internal representation of a certificate."
return (self.cert_file, self.key_file)<|docstring|>Synthesize a requests-compatible (2-item tuple of cert and key file)
object from HTTPie's inter... |
588d4080a890487d7d4d94fb73d3ace3f10266f09181e185095be7f5546bd881 | @lru_cache
def get_user_model():
'\n use settings.SLACKBOT_USER_MODEL to use your own model for Slack users\n pretty much like django.contrib.auth.get_user_model\n '
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
try:
... | use settings.SLACKBOT_USER_MODEL to use your own model for Slack users
pretty much like django.contrib.auth.get_user_model | slackbot/__init__.py | get_user_model | surface-security/django-slackbot | 1 | python | @lru_cache
def get_user_model():
'\n use settings.SLACKBOT_USER_MODEL to use your own model for Slack users\n pretty much like django.contrib.auth.get_user_model\n '
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
try:
... | @lru_cache
def get_user_model():
'\n use settings.SLACKBOT_USER_MODEL to use your own model for Slack users\n pretty much like django.contrib.auth.get_user_model\n '
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
try:
... |
021354a1db5b318fe0ff5f8ef17049c9cbf70d2ec8b4f844349edb234c7ab113 | @staticmethod
def is_supported(session: Session):
'Whether search is implemented'
return session.has_fragment(SearchHandler) | Whether search is implemented | novelsave/client/bots/discord/endpoints/search.py | is_supported | mensch272/novelsave | 12 | python | @staticmethod
def is_supported(session: Session):
return session.has_fragment(SearchHandler) | @staticmethod
def is_supported(session: Session):
return session.has_fragment(SearchHandler)<|docstring|>Whether search is implemented<|endoftext|> |
abb85fbfb2854362bdcfa771932452e27a2d81ff083a8824c80591ed2cc78a17 | @commands.command()
async def search(self, ctx: commands.Context, *, words):
'Start a search task'
session = self.session_handler.get_or_create(ctx)
if (not self.is_supported(session)):
(await ctx.send(self.unsupported))
return
(await session.run(ctx, SearchHandler.search, words)) | Start a search task | novelsave/client/bots/discord/endpoints/search.py | search | mensch272/novelsave | 12 | python | @commands.command()
async def search(self, ctx: commands.Context, *, words):
session = self.session_handler.get_or_create(ctx)
if (not self.is_supported(session)):
(await ctx.send(self.unsupported))
return
(await session.run(ctx, SearchHandler.search, words)) | @commands.command()
async def search(self, ctx: commands.Context, *, words):
session = self.session_handler.get_or_create(ctx)
if (not self.is_supported(session)):
(await ctx.send(self.unsupported))
return
(await session.run(ctx, SearchHandler.search, words))<|docstring|>Start a search ... |
9e99dfe64898045a442ff9d4ee0eea388b0ada3d8860e61cbb206a26c3ae0814 | @commands.command()
async def select(self, ctx: commands.Context, num: int):
'Select from the provided search results'
session = self.session_handler.get_or_create(ctx)
if (not self.is_supported(session)):
(await ctx.send(self.unsupported))
return
if (not session.get(SearchHandler.is_sel... | Select from the provided search results | novelsave/client/bots/discord/endpoints/search.py | select | mensch272/novelsave | 12 | python | @commands.command()
async def select(self, ctx: commands.Context, num: int):
session = self.session_handler.get_or_create(ctx)
if (not self.is_supported(session)):
(await ctx.send(self.unsupported))
return
if (not session.get(SearchHandler.is_select)()):
(await ctx.send('Session... | @commands.command()
async def select(self, ctx: commands.Context, num: int):
session = self.session_handler.get_or_create(ctx)
if (not self.is_supported(session)):
(await ctx.send(self.unsupported))
return
if (not session.get(SearchHandler.is_select)()):
(await ctx.send('Session... |
19dcb62af7a966a4bba310aef9146ea85a18664b337b8af01d06882f2115707d | def __init__(self, read_file: Union[(str, Path)], file_headers=True):
"\n This object takes a read file directory as its core argument. By default file headers are turned on, but if a\n file doesn't have any file headers users can turn file headers of.\n\n This object has the following attribut... | This object takes a read file directory as its core argument. By default file headers are turned on, but if a
file doesn't have any file headers users can turn file headers of.
This object has the following attributes:
file_name: The file name of the read file minus any file extension
sheet_column_lengths: The numbe... | xlsxObject/XlsxObject.py | __init__ | sbaker-dev/xslxObject | 0 | python | def __init__(self, read_file: Union[(str, Path)], file_headers=True):
"\n This object takes a read file directory as its core argument. By default file headers are turned on, but if a\n file doesn't have any file headers users can turn file headers of.\n\n This object has the following attribut... | def __init__(self, read_file: Union[(str, Path)], file_headers=True):
"\n This object takes a read file directory as its core argument. By default file headers are turned on, but if a\n file doesn't have any file headers users can turn file headers of.\n\n This object has the following attribut... |
f4288174a5f1cd9c2b8406617441a472d31e4f1b61fb6c359510fa3ca0038ffc | def __repr__(self):
'Human readable print'
return f'{self.file_name}.xlsx with {len(self.sheet_names)} sheets' | Human readable print | xlsxObject/XlsxObject.py | __repr__ | sbaker-dev/xslxObject | 0 | python | def __repr__(self):
return f'{self.file_name}.xlsx with {len(self.sheet_names)} sheets' | def __repr__(self):
return f'{self.file_name}.xlsx with {len(self.sheet_names)} sheets'<|docstring|>Human readable print<|endoftext|> |
226a9c7eb2322b15b94f1757084161268fa404fb2c058a1544678764ab1a9f78 | def __getitem__(self, item):
'Extract the data '
if isinstance(item, int):
return self.sheet_data[item]
else:
raise TypeError(f'Getting sheet data via __getitem__ requires an item yet was passed {type(item)}') | Extract the data | xlsxObject/XlsxObject.py | __getitem__ | sbaker-dev/xslxObject | 0 | python | def __getitem__(self, item):
' '
if isinstance(item, int):
return self.sheet_data[item]
else:
raise TypeError(f'Getting sheet data via __getitem__ requires an item yet was passed {type(item)}') | def __getitem__(self, item):
' '
if isinstance(item, int):
return self.sheet_data[item]
else:
raise TypeError(f'Getting sheet data via __getitem__ requires an item yet was passed {type(item)}')<|docstring|>Extract the data<|endoftext|> |
49d821d44bf6c7b19f6d2362186a31a1c5f6d513d04f4a8c97f870c13558bb50 | def _set_sheet_names(self) -> List[str]:
'\n This extracts the sheets titles from the xlsx workbook\n '
return [sheet.title for sheet in self._workbook.worksheets] | This extracts the sheets titles from the xlsx workbook | xlsxObject/XlsxObject.py | _set_sheet_names | sbaker-dev/xslxObject | 0 | python | def _set_sheet_names(self) -> List[str]:
'\n \n '
return [sheet.title for sheet in self._workbook.worksheets] | def _set_sheet_names(self) -> List[str]:
'\n \n '
return [sheet.title for sheet in self._workbook.worksheets]<|docstring|>This extracts the sheets titles from the xlsx workbook<|endoftext|> |
9ca5c274f6e73bebd20f4ac3a2b501b07654d29b02d88347851ed3e7b414cd8e | def _set_sheet_header_list(self) -> List[List[str]]:
'\n Isolates headers if they exist, else creates dummy header names for each sheet in workbook\n '
if self._file_headers:
sheet_headers = [[sheet[f'{get_column_letter(i)}{1}'].value for i in range(1, (sheet_length + 1))] for (sheet_lengt... | Isolates headers if they exist, else creates dummy header names for each sheet in workbook | xlsxObject/XlsxObject.py | _set_sheet_header_list | sbaker-dev/xslxObject | 0 | python | def _set_sheet_header_list(self) -> List[List[str]]:
'\n \n '
if self._file_headers:
sheet_headers = [[sheet[f'{get_column_letter(i)}{1}'].value for i in range(1, (sheet_length + 1))] for (sheet_length, sheet) in zip(self.sheet_col_count, self._workbook.worksheets)]
else:
sheet... | def _set_sheet_header_list(self) -> List[List[str]]:
'\n \n '
if self._file_headers:
sheet_headers = [[sheet[f'{get_column_letter(i)}{1}'].value for i in range(1, (sheet_length + 1))] for (sheet_length, sheet) in zip(self.sheet_col_count, self._workbook.worksheets)]
else:
sheet... |
2e4ecaa751771d114714a2aee7a051e5bd71b006d15f18e2168895add21368dd | def _set_sheet_data(self) -> List[SheetData]:
'\n Iterator that will work through the sheets by using the column and row lengths, isolating all the content\n within a given sheet. This means that the end result is a nested list of sheet-column-row.\n '
return [self._set_data(sheet, sheet_in... | Iterator that will work through the sheets by using the column and row lengths, isolating all the content
within a given sheet. This means that the end result is a nested list of sheet-column-row. | xlsxObject/XlsxObject.py | _set_sheet_data | sbaker-dev/xslxObject | 0 | python | def _set_sheet_data(self) -> List[SheetData]:
'\n Iterator that will work through the sheets by using the column and row lengths, isolating all the content\n within a given sheet. This means that the end result is a nested list of sheet-column-row.\n '
return [self._set_data(sheet, sheet_in... | def _set_sheet_data(self) -> List[SheetData]:
'\n Iterator that will work through the sheets by using the column and row lengths, isolating all the content\n within a given sheet. This means that the end result is a nested list of sheet-column-row.\n '
return [self._set_data(sheet, sheet_in... |
9cd350564ca674be68bdaa3da3d4c3ec89b28f893ff7cab51ca9da1abc3519ec | def _set_data(self, sheet, sheet_index: int) -> SheetData:
'\n This sets the data for a given sheet by taking the row and column lengths and then iterating through the sheets\n columns and rows by using range indexing.\n\n NOTE\n ----\n openpyxl requires base 1 not base 0 hence ra... | This sets the data for a given sheet by taking the row and column lengths and then iterating through the sheets
columns and rows by using range indexing.
NOTE
----
openpyxl requires base 1 not base 0 hence range | xlsxObject/XlsxObject.py | _set_data | sbaker-dev/xslxObject | 0 | python | def _set_data(self, sheet, sheet_index: int) -> SheetData:
'\n This sets the data for a given sheet by taking the row and column lengths and then iterating through the sheets\n columns and rows by using range indexing.\n\n NOTE\n ----\n openpyxl requires base 1 not base 0 hence ra... | def _set_data(self, sheet, sheet_index: int) -> SheetData:
'\n This sets the data for a given sheet by taking the row and column lengths and then iterating through the sheets\n columns and rows by using range indexing.\n\n NOTE\n ----\n openpyxl requires base 1 not base 0 hence ra... |
0465e52f387ad8fd3528ad5a711c45a8e6a68feb62c6275d92141b5a46f76c46 | def _area_of_pixel(pixel_size, center_lat):
'Calculate m^2 area of a wgs84 square pixel.\n\n Adapted from: https://gis.stackexchange.com/a/127327/2397\n\n Args:\n pixel_size (float): length of side of pixel in degrees.\n center_lat (float): latitude of the center of the pixel. Note this\n ... | Calculate m^2 area of a wgs84 square pixel.
Adapted from: https://gis.stackexchange.com/a/127327/2397
Args:
pixel_size (float): length of side of pixel in degrees.
center_lat (float): latitude of the center of the pixel. Note this
value +/- half the `pixel-size` must not exceed 90/-90 degrees
... | raster_stats.py | _area_of_pixel | richpsharp/raster_calculations | 2 | python | def _area_of_pixel(pixel_size, center_lat):
'Calculate m^2 area of a wgs84 square pixel.\n\n Adapted from: https://gis.stackexchange.com/a/127327/2397\n\n Args:\n pixel_size (float): length of side of pixel in degrees.\n center_lat (float): latitude of the center of the pixel. Note this\n ... | def _area_of_pixel(pixel_size, center_lat):
'Calculate m^2 area of a wgs84 square pixel.\n\n Adapted from: https://gis.stackexchange.com/a/127327/2397\n\n Args:\n pixel_size (float): length of side of pixel in degrees.\n center_lat (float): latitude of the center of the pixel. Note this\n ... |
d5a3160913f88f1d90860499788e4954e8e692933477c1e1818c7b4a7865d078 | def main():
'Entry point.'
parser = argparse.ArgumentParser(description='Calculate raster stats.')
parser.add_argument('raster_path', help='path to raster')
args = parser.parse_args()
raster_info = get_raster_info(args.raster_path)
raster_srs = osr.SpatialReference()
raster_srs.ImportFromWkt... | Entry point. | raster_stats.py | main | richpsharp/raster_calculations | 2 | python | def main():
parser = argparse.ArgumentParser(description='Calculate raster stats.')
parser.add_argument('raster_path', help='path to raster')
args = parser.parse_args()
raster_info = get_raster_info(args.raster_path)
raster_srs = osr.SpatialReference()
raster_srs.ImportFromWkt(raster_info['... | def main():
parser = argparse.ArgumentParser(description='Calculate raster stats.')
parser.add_argument('raster_path', help='path to raster')
args = parser.parse_args()
raster_info = get_raster_info(args.raster_path)
raster_srs = osr.SpatialReference()
raster_srs.ImportFromWkt(raster_info['... |
031115dda8db74db8db2780913caa1b5404186286213dc7ca3f665e498e95262 | @pytest.fixture()
def vera_component_factory():
'Return a factory for initializing the vera component.'
with patch('pyvera.init_controller') as init_controller_mock:
(yield ComponentFactory(init_controller_mock)) | Return a factory for initializing the vera component. | tests/components/vera/conftest.py | vera_component_factory | nferreyra/home-assistant | 23 | python | @pytest.fixture()
def vera_component_factory():
with patch('pyvera.init_controller') as init_controller_mock:
(yield ComponentFactory(init_controller_mock)) | @pytest.fixture()
def vera_component_factory():
with patch('pyvera.init_controller') as init_controller_mock:
(yield ComponentFactory(init_controller_mock))<|docstring|>Return a factory for initializing the vera component.<|endoftext|> |
bf591bad9f1c083d707716ccb22a68ffc86e80741f3bd040a8870a18aacce05d | def list(self, **kwargs):
'List Indicator objects\n\n The list method accepts the following kwargs:\n\n :param list filters: (optional) the filters to apply\n :param str search: (optional) a search keyword to apply for the listing\n :param int first: (optional) return the first n rows fr... | List Indicator objects
The list method accepts the following kwargs:
:param list filters: (optional) the filters to apply
:param str search: (optional) a search keyword to apply for the listing
:param int first: (optional) return the first n rows from the `after` ID
or the beginning if not set
:pa... | pycti/entities/opencti_indicator.py | list | djds/client-python | 1 | python | def list(self, **kwargs):
'List Indicator objects\n\n The list method accepts the following kwargs:\n\n :param list filters: (optional) the filters to apply\n :param str search: (optional) a search keyword to apply for the listing\n :param int first: (optional) return the first n rows fr... | def list(self, **kwargs):
'List Indicator objects\n\n The list method accepts the following kwargs:\n\n :param list filters: (optional) the filters to apply\n :param str search: (optional) a search keyword to apply for the listing\n :param int first: (optional) return the first n rows fr... |
17ad06175c871725c8b2c5fa51d85560f2c1ccc7350800c8fe8b31e5ddf39280 | def read(self, **kwargs):
'Read an Indicator object\n\n read can be either used with a known OpenCTI entity `id` or by using a\n valid filter to search and return a single Indicator entity or None.\n\n The list method accepts the following kwargs.\n\n Note: either `id` or `filters` is re... | Read an Indicator object
read can be either used with a known OpenCTI entity `id` or by using a
valid filter to search and return a single Indicator entity or None.
The list method accepts the following kwargs.
Note: either `id` or `filters` is required.
:param str id: the id of the Threat-Actor
:param list filters... | pycti/entities/opencti_indicator.py | read | djds/client-python | 1 | python | def read(self, **kwargs):
'Read an Indicator object\n\n read can be either used with a known OpenCTI entity `id` or by using a\n valid filter to search and return a single Indicator entity or None.\n\n The list method accepts the following kwargs.\n\n Note: either `id` or `filters` is re... | def read(self, **kwargs):
'Read an Indicator object\n\n read can be either used with a known OpenCTI entity `id` or by using a\n valid filter to search and return a single Indicator entity or None.\n\n The list method accepts the following kwargs.\n\n Note: either `id` or `filters` is re... |
706a9a6a7e02223d8ec3aeae5bacc1c0b49091fba11fe17a0bb8733b5dab9113 | def create(self, **kwargs):
'\n Create an Indicator object\n\n :param str name: the name of the Indicator\n :param str pattern: stix indicator pattern\n :param str x_opencti_main_observable_type: type of the observable\n\n :return: Indicator object\n :rtype: Indicator\n ... | Create an Indicator object
:param str name: the name of the Indicator
:param str pattern: stix indicator pattern
:param str x_opencti_main_observable_type: type of the observable
:return: Indicator object
:rtype: Indicator | pycti/entities/opencti_indicator.py | create | djds/client-python | 1 | python | def create(self, **kwargs):
'\n Create an Indicator object\n\n :param str name: the name of the Indicator\n :param str pattern: stix indicator pattern\n :param str x_opencti_main_observable_type: type of the observable\n\n :return: Indicator object\n :rtype: Indicator\n ... | def create(self, **kwargs):
'\n Create an Indicator object\n\n :param str name: the name of the Indicator\n :param str pattern: stix indicator pattern\n :param str x_opencti_main_observable_type: type of the observable\n\n :return: Indicator object\n :rtype: Indicator\n ... |
3455d22b39a963e1169d68ff7ad11fb8bb757aa617ddf17ccedc8ad532f2b792 | def add_stix_cyber_observable(self, **kwargs):
'\n Add a Stix-Cyber-Observable object to Indicator object (based-on)\n\n :param id: the id of the Indicator\n :param indicator: Indicator object\n :param stix_cyber_observable_id: the id of the Stix-Observable\n\n :return: Boolean Tr... | Add a Stix-Cyber-Observable object to Indicator object (based-on)
:param id: the id of the Indicator
:param indicator: Indicator object
:param stix_cyber_observable_id: the id of the Stix-Observable
:return: Boolean True if there has been no import error | pycti/entities/opencti_indicator.py | add_stix_cyber_observable | djds/client-python | 1 | python | def add_stix_cyber_observable(self, **kwargs):
'\n Add a Stix-Cyber-Observable object to Indicator object (based-on)\n\n :param id: the id of the Indicator\n :param indicator: Indicator object\n :param stix_cyber_observable_id: the id of the Stix-Observable\n\n :return: Boolean Tr... | def add_stix_cyber_observable(self, **kwargs):
'\n Add a Stix-Cyber-Observable object to Indicator object (based-on)\n\n :param id: the id of the Indicator\n :param indicator: Indicator object\n :param stix_cyber_observable_id: the id of the Stix-Observable\n\n :return: Boolean Tr... |
3402b4efcf3876844233069297a4c173d310893f703801115fe9a33d48bc6ba0 | def import_from_stix2(self, **kwargs):
'\n Import an Indicator object from a STIX2 object\n\n :param stixObject: the Stix-Object Indicator\n :param extras: extra dict\n :param bool update: set the update flag on import\n\n :return: Indicator object\n :rtype: Indicator\n ... | Import an Indicator object from a STIX2 object
:param stixObject: the Stix-Object Indicator
:param extras: extra dict
:param bool update: set the update flag on import
:return: Indicator object
:rtype: Indicator | pycti/entities/opencti_indicator.py | import_from_stix2 | djds/client-python | 1 | python | def import_from_stix2(self, **kwargs):
'\n Import an Indicator object from a STIX2 object\n\n :param stixObject: the Stix-Object Indicator\n :param extras: extra dict\n :param bool update: set the update flag on import\n\n :return: Indicator object\n :rtype: Indicator\n ... | def import_from_stix2(self, **kwargs):
'\n Import an Indicator object from a STIX2 object\n\n :param stixObject: the Stix-Object Indicator\n :param extras: extra dict\n :param bool update: set the update flag on import\n\n :return: Indicator object\n :rtype: Indicator\n ... |
381899db2574e473a871e173f74c17e6ecac7722c1f286d6dba2e70efc4b4a36 | def customSortString(self, S, T):
'\n :type S: str\n :type T: str\n :rtype: str\n '
order = dict(((v, i) for (i, v) in enumerate(S)))
T = list(T)
T.sort(key=(lambda x: (order[x] if (x in order) else 27)))
return ''.join(T) | :type S: str
:type T: str
:rtype: str | String/791. Custom Sort String.py | customSortString | beckswu/Leetcode | 138 | python | def customSortString(self, S, T):
'\n :type S: str\n :type T: str\n :rtype: str\n '
order = dict(((v, i) for (i, v) in enumerate(S)))
T = list(T)
T.sort(key=(lambda x: (order[x] if (x in order) else 27)))
return .join(T) | def customSortString(self, S, T):
'\n :type S: str\n :type T: str\n :rtype: str\n '
order = dict(((v, i) for (i, v) in enumerate(S)))
T = list(T)
T.sort(key=(lambda x: (order[x] if (x in order) else 27)))
return .join(T)<|docstring|>:type S: str
:type T: str
:rtype: str<|... |
04c2d073ff02b8c1eb69502647c85482ab38e7d69674ffe15ff071fed07e4872 | def customSortString(self, S, T):
'\n :type S: str\n :type T: str\n :rtype: str\n '
m = {c: idx for (idx, c) in enumerate(S)}
queue = []
for c in T:
heapq.heappush(queue, (m.get(c, sys.maxint), c))
ret = ''
while queue:
(_, v) = heapq.heappop(queue)
... | :type S: str
:type T: str
:rtype: str | String/791. Custom Sort String.py | customSortString | beckswu/Leetcode | 138 | python | def customSortString(self, S, T):
'\n :type S: str\n :type T: str\n :rtype: str\n '
m = {c: idx for (idx, c) in enumerate(S)}
queue = []
for c in T:
heapq.heappush(queue, (m.get(c, sys.maxint), c))
ret =
while queue:
(_, v) = heapq.heappop(queue)
... | def customSortString(self, S, T):
'\n :type S: str\n :type T: str\n :rtype: str\n '
m = {c: idx for (idx, c) in enumerate(S)}
queue = []
for c in T:
heapq.heappush(queue, (m.get(c, sys.maxint), c))
ret =
while queue:
(_, v) = heapq.heappop(queue)
... |
0b6cf160ceb47b6d6211ec3daee5542ac70f789d818cee07d7d85314e3208000 | def parse_cookie(cookie):
'\n Return a dictionary parsed from a `Cookie:` header string.\n '
cookiedict = {}
for chunk in cookie.split(';'):
if ('=' in chunk):
(key, val) = chunk.split('=', 1)
else:
(key, val) = ('', chunk)
(key, val) = (key.strip(), val... | Return a dictionary parsed from a `Cookie:` header string. | http/cookie.py | parse_cookie | krispati2013/django | 61,676 | python | def parse_cookie(cookie):
'\n \n '
cookiedict = {}
for chunk in cookie.split(';'):
if ('=' in chunk):
(key, val) = chunk.split('=', 1)
else:
(key, val) = (, chunk)
(key, val) = (key.strip(), val.strip())
if (key or val):
cookiedict[ke... | def parse_cookie(cookie):
'\n \n '
cookiedict = {}
for chunk in cookie.split(';'):
if ('=' in chunk):
(key, val) = chunk.split('=', 1)
else:
(key, val) = (, chunk)
(key, val) = (key.strip(), val.strip())
if (key or val):
cookiedict[ke... |
cf2ebeea07917d4981bfcb002559f3c49c23a54b14bd09fdf8d5385fcc709a3b | @argument('supported_connection_id')
def get(self, supported_connection_id):
'Get the supported connection with the specified ID\n\n \x0c\n :param supported_connection_id: the id of the supported connection\n to retrieve\n :type supported_connection_id: str\n\n :returns: a sup... | Get the supported connection with the specified ID
:param supported_connection_id: the id of the supported connection
to retrieve
:type supported_connection_id: str
:returns: a supported connection object
:type: dict | pureport_client/commands/supported_connections/__init__.py | get | pureport/pureport-python-client | 4 | python | @argument('supported_connection_id')
def get(self, supported_connection_id):
'Get the supported connection with the specified ID\n\n \x0c\n :param supported_connection_id: the id of the supported connection\n to retrieve\n :type supported_connection_id: str\n\n :returns: a sup... | @argument('supported_connection_id')
def get(self, supported_connection_id):
'Get the supported connection with the specified ID\n\n \x0c\n :param supported_connection_id: the id of the supported connection\n to retrieve\n :type supported_connection_id: str\n\n :returns: a sup... |
81a823f5258b16cfa5c6935467bdd338a052d22fbdae6dca1a39f065611af224 | def beginning_of_day(dt: datetime) -> datetime:
'\n Returns a data object representing beginning of day on the date specified.\n Here beginning is defined as 0 hours, minutes, second, microseconds after day\n starts.\n '
time_into_day = timedelta(hours=dt.hour, minutes=dt.minute, seconds=dt.second, ... | Returns a data object representing beginning of day on the date specified.
Here beginning is defined as 0 hours, minutes, second, microseconds after day
starts. | scl_time.py | beginning_of_day | slessans/scl-time | 0 | python | def beginning_of_day(dt: datetime) -> datetime:
'\n Returns a data object representing beginning of day on the date specified.\n Here beginning is defined as 0 hours, minutes, second, microseconds after day\n starts.\n '
time_into_day = timedelta(hours=dt.hour, minutes=dt.minute, seconds=dt.second, ... | def beginning_of_day(dt: datetime) -> datetime:
'\n Returns a data object representing beginning of day on the date specified.\n Here beginning is defined as 0 hours, minutes, second, microseconds after day\n starts.\n '
time_into_day = timedelta(hours=dt.hour, minutes=dt.minute, seconds=dt.second, ... |
49e61f48d210f570651f7e278fed2f27f6c4da55e3c827c90724ba12f66cedca | def _check_valid_aware_datetime(dt):
'\n Checks that the argument is a valid instance of datetime and that it is not naive\n '
if (not isinstance(dt, datetime)):
raise ValueError('datetime expected')
if (dt.tzinfo is None):
raise ValueError('DateTimeInterval cannot handle naive datetim... | Checks that the argument is a valid instance of datetime and that it is not naive | scl_time.py | _check_valid_aware_datetime | slessans/scl-time | 0 | python | def _check_valid_aware_datetime(dt):
'\n \n '
if (not isinstance(dt, datetime)):
raise ValueError('datetime expected')
if (dt.tzinfo is None):
raise ValueError('DateTimeInterval cannot handle naive datetimes.') | def _check_valid_aware_datetime(dt):
'\n \n '
if (not isinstance(dt, datetime)):
raise ValueError('datetime expected')
if (dt.tzinfo is None):
raise ValueError('DateTimeInterval cannot handle naive datetimes.')<|docstring|>Checks that the argument is a valid instance of datetime and th... |
1b4eea95124ebec8ce1c5fc9d7fba08591ee9b1675eb9a81b2674c9ad0829e0e | def time_intervals_between(start: datetime, end: datetime, interval_length: timedelta, limit_to_end=False):
'\n Generator for DateTimeIntervals of length interval_length during this time period.\n\n If limit_by_end is True, the end date of the last time period will not exceed self.end even if\n it causes t... | Generator for DateTimeIntervals of length interval_length during this time period.
If limit_by_end is True, the end date of the last time period will not exceed self.end even if
it causes the final interval to be shorter than interval_length.
If limit_by_end is False, the last interval will be interval_length even if... | scl_time.py | time_intervals_between | slessans/scl-time | 0 | python | def time_intervals_between(start: datetime, end: datetime, interval_length: timedelta, limit_to_end=False):
'\n Generator for DateTimeIntervals of length interval_length during this time period.\n\n If limit_by_end is True, the end date of the last time period will not exceed self.end even if\n it causes t... | def time_intervals_between(start: datetime, end: datetime, interval_length: timedelta, limit_to_end=False):
'\n Generator for DateTimeIntervals of length interval_length during this time period.\n\n If limit_by_end is True, the end date of the last time period will not exceed self.end even if\n it causes t... |
980ae24f8ce7bb16d0a265de3d72ce708a2edd7d1c4306f7ba515f774d5f3f66 | def days_between(start_of: datetime, end_of: datetime):
'\n Generator for intervals of length 1 day. They will start at the beginning of\n start_of -- that is, beginning_of_day(start_of) and end at the end of end_of,\n that is beginning_of_day(end + timedelta(days=1)). The datetimes either must both be\n ... | Generator for intervals of length 1 day. They will start at the beginning of
start_of -- that is, beginning_of_day(start_of) and end at the end of end_of,
that is beginning_of_day(end + timedelta(days=1)). The datetimes either must both be
naive, or must have the same timezone. | scl_time.py | days_between | slessans/scl-time | 0 | python | def days_between(start_of: datetime, end_of: datetime):
'\n Generator for intervals of length 1 day. They will start at the beginning of\n start_of -- that is, beginning_of_day(start_of) and end at the end of end_of,\n that is beginning_of_day(end + timedelta(days=1)). The datetimes either must both be\n ... | def days_between(start_of: datetime, end_of: datetime):
'\n Generator for intervals of length 1 day. They will start at the beginning of\n start_of -- that is, beginning_of_day(start_of) and end at the end of end_of,\n that is beginning_of_day(end + timedelta(days=1)). The datetimes either must both be\n ... |
04f99c6179b90c86757deed711405acfb47d4932d36e7ba88470d97ae17bb0f4 | def intersection_of_intervals(intervals1, intervals2):
'\n intervals1 and intervals2 must be iterable or collection of non-overlapping DateTimeInterval objects\n in strictly ascending order.\n\n Returns generator x of ascending non-overlapping intervals i such that for all i in x\n i is contained by som... | intervals1 and intervals2 must be iterable or collection of non-overlapping DateTimeInterval objects
in strictly ascending order.
Returns generator x of ascending non-overlapping intervals i such that for all i in x
i is contained by some interval in intervals1 and i is contained by some interval in intervals2. | scl_time.py | intersection_of_intervals | slessans/scl-time | 0 | python | def intersection_of_intervals(intervals1, intervals2):
'\n intervals1 and intervals2 must be iterable or collection of non-overlapping DateTimeInterval objects\n in strictly ascending order.\n\n Returns generator x of ascending non-overlapping intervals i such that for all i in x\n i is contained by som... | def intersection_of_intervals(intervals1, intervals2):
'\n intervals1 and intervals2 must be iterable or collection of non-overlapping DateTimeInterval objects\n in strictly ascending order.\n\n Returns generator x of ascending non-overlapping intervals i such that for all i in x\n i is contained by som... |
42b7db3d9a87383be9bc373a4d120f7841f1e2eafe78a0ab6d9d870b7a91b486 | def _non_overlapping_intervals(of_interval: DateTimeInterval, with_interval: DateTimeInterval):
'\n Returns intervals from of_interval that do not overlap with with_interval.\n '
before = None
after = None
if (with_interval.start > of_interval.start):
before = DateTimeInterval(of_interval.... | Returns intervals from of_interval that do not overlap with with_interval. | scl_time.py | _non_overlapping_intervals | slessans/scl-time | 0 | python | def _non_overlapping_intervals(of_interval: DateTimeInterval, with_interval: DateTimeInterval):
'\n \n '
before = None
after = None
if (with_interval.start > of_interval.start):
before = DateTimeInterval(of_interval.start, with_interval.start)
if (of_interval.end > with_interval.end):
... | def _non_overlapping_intervals(of_interval: DateTimeInterval, with_interval: DateTimeInterval):
'\n \n '
before = None
after = None
if (with_interval.start > of_interval.start):
before = DateTimeInterval(of_interval.start, with_interval.start)
if (of_interval.end > with_interval.end):
... |
57149d52fa3bc78abebed194c44eb1271213c63c94070773b31775c9c8dc4abd | def _smooth_status_intervals(status_intervals):
'\n Finds intervals that abut with the same status and turns them into one larger interval\n '
smoothed = []
last_status_interval = None
for status_interval in status_intervals:
assert ((last_status_interval is None) or (last_status_interval.... | Finds intervals that abut with the same status and turns them into one larger interval | scl_time.py | _smooth_status_intervals | slessans/scl-time | 0 | python | def _smooth_status_intervals(status_intervals):
'\n \n '
smoothed = []
last_status_interval = None
for status_interval in status_intervals:
assert ((last_status_interval is None) or (last_status_interval.interval.end <= status_interval.interval.start))
if (last_status_interval and ... | def _smooth_status_intervals(status_intervals):
'\n \n '
smoothed = []
last_status_interval = None
for status_interval in status_intervals:
assert ((last_status_interval is None) or (last_status_interval.interval.end <= status_interval.interval.start))
if (last_status_interval and ... |
e0caa79b9d081dac469f49aa791100e5a68c83b72f21b75a8c3437ca98d1bc74 | def contains(self, dt: datetime) -> bool:
'\n If this moment is contained by this time interval\n :param dt:\n :return:\n '
_check_valid_aware_datetime(dt)
return (self.start <= dt < self.end) | If this moment is contained by this time interval
:param dt:
:return: | scl_time.py | contains | slessans/scl-time | 0 | python | def contains(self, dt: datetime) -> bool:
'\n If this moment is contained by this time interval\n :param dt:\n :return:\n '
_check_valid_aware_datetime(dt)
return (self.start <= dt < self.end) | def contains(self, dt: datetime) -> bool:
'\n If this moment is contained by this time interval\n :param dt:\n :return:\n '
_check_valid_aware_datetime(dt)
return (self.start <= dt < self.end)<|docstring|>If this moment is contained by this time interval
:param dt:
:return:<|endo... |
5461708e8fd7c56c45ba8279fcea27c0adcebf7697013d3f5069e75125695715 | def covers(self, time_interval) -> bool:
"\n Returns true if the passed time interval is completely covered by this time interval.\n Note that this is true if the ends dates are equal. since they aren't part of the interval, if\n the end dates are equal then all instances of the passed time ... | Returns true if the passed time interval is completely covered by this time interval.
Note that this is true if the ends dates are equal. since they aren't part of the interval, if
the end dates are equal then all instances of the passed time zone still have a corresponding instance
in this time zone.
:param time_... | scl_time.py | covers | slessans/scl-time | 0 | python | def covers(self, time_interval) -> bool:
"\n Returns true if the passed time interval is completely covered by this time interval.\n Note that this is true if the ends dates are equal. since they aren't part of the interval, if\n the end dates are equal then all instances of the passed time ... | def covers(self, time_interval) -> bool:
"\n Returns true if the passed time interval is completely covered by this time interval.\n Note that this is true if the ends dates are equal. since they aren't part of the interval, if\n the end dates are equal then all instances of the passed time ... |
d63a51a250bbe3268e36457401eda3194776409f4d454688335020a5eada4b1d | def overlaps(self, time_interval) -> bool:
'\n True if any instants of the passed time interval are in this time interval\n :param time_interval:\n :return:\n '
return ((time_interval.start < self.end) and (self.start < time_interval.end)) | True if any instants of the passed time interval are in this time interval
:param time_interval:
:return: | scl_time.py | overlaps | slessans/scl-time | 0 | python | def overlaps(self, time_interval) -> bool:
'\n True if any instants of the passed time interval are in this time interval\n :param time_interval:\n :return:\n '
return ((time_interval.start < self.end) and (self.start < time_interval.end)) | def overlaps(self, time_interval) -> bool:
'\n True if any instants of the passed time interval are in this time interval\n :param time_interval:\n :return:\n '
return ((time_interval.start < self.end) and (self.start < time_interval.end))<|docstring|>True if any instants of the pass... |
308725d48a219a04ac0590313ba4170aa6b35d8b21ee92360d4f0302f9b3918d | def intervals(self, interval_length: timedelta, limit_by_end=True):
'\n see time_intervals_between for argument info\n '
return time_intervals_between(self.start, self.end, interval_length, limit_by_end) | see time_intervals_between for argument info | scl_time.py | intervals | slessans/scl-time | 0 | python | def intervals(self, interval_length: timedelta, limit_by_end=True):
'\n \n '
return time_intervals_between(self.start, self.end, interval_length, limit_by_end) | def intervals(self, interval_length: timedelta, limit_by_end=True):
'\n \n '
return time_intervals_between(self.start, self.end, interval_length, limit_by_end)<|docstring|>see time_intervals_between for argument info<|endoftext|> |
1e9ccc367f09545e0bcac2b76c948e81f024bf66d9d0581fc3617e437413e467 | def intervals_with_status(self, status):
'\n Returns DateTimeIntervals where status is status. Returned intervals\n will be ascending, non-overlapping.\n '
return (si.interval for si in self._intervals if (si.status == status)) | Returns DateTimeIntervals where status is status. Returned intervals
will be ascending, non-overlapping. | scl_time.py | intervals_with_status | slessans/scl-time | 0 | python | def intervals_with_status(self, status):
'\n Returns DateTimeIntervals where status is status. Returned intervals\n will be ascending, non-overlapping.\n '
return (si.interval for si in self._intervals if (si.status == status)) | def intervals_with_status(self, status):
'\n Returns DateTimeIntervals where status is status. Returned intervals\n will be ascending, non-overlapping.\n '
return (si.interval for si in self._intervals if (si.status == status))<|docstring|>Returns DateTimeIntervals where status is status. R... |
95dee262fdfa24937c6e2974136bb8b7b8ec666d2b0cb703d89a26dd203eaa8c | def cleanText(Ctext):
'\n removes punctuation, stopwords and returns lowercase text in a list of single words\n '
Ctext = Ctext.lower()
from bs4 import BeautifulSoup
Ctext = BeautifulSoup(Ctext, features='lxml').get_text()
from nltk.tokenize import RegexpTokenizer
tokenizer = Regex... | removes punctuation, stopwords and returns lowercase text in a list of single words | project_sol.py | cleanText | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def cleanText(Ctext):
'\n \n '
Ctext = Ctext.lower()
from bs4 import BeautifulSoup
Ctext = BeautifulSoup(Ctext, features='lxml').get_text()
from nltk.tokenize import RegexpTokenizer
tokenizer = RegexpTokenizer('\\w+')
Ctext = tokenizer.tokenize(Ctext)
from nltk.corpus impor... | def cleanText(Ctext):
'\n \n '
Ctext = Ctext.lower()
from bs4 import BeautifulSoup
Ctext = BeautifulSoup(Ctext, features='lxml').get_text()
from nltk.tokenize import RegexpTokenizer
tokenizer = RegexpTokenizer('\\w+')
Ctext = tokenizer.tokenize(Ctext)
from nltk.corpus impor... |
1e719c9310057fd8c2b7cf945108e01960a8b033ef8aa846a285e2a83acf1f1d | def loadPositive():
'\n loading positive dictionary\n '
myfile = open('positive.csv', 'r')
positives = myfile.readlines()
positive = [pos.strip().lower() for pos in positives]
return positive | loading positive dictionary | project_sol.py | loadPositive | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def loadPositive():
'\n \n '
myfile = open('positive.csv', 'r')
positives = myfile.readlines()
positive = [pos.strip().lower() for pos in positives]
return positive | def loadPositive():
'\n \n '
myfile = open('positive.csv', 'r')
positives = myfile.readlines()
positive = [pos.strip().lower() for pos in positives]
return positive<|docstring|>loading positive dictionary<|endoftext|> |
069eb368f286175e7f5db5fa6189c57db442ed13968df08e36c0e1c0e872538d | def loadNegative():
'\n loading positive dictionary\n '
myfile = open('negative.csv', 'r')
negatives = myfile.readlines()
negative = [neg.strip().lower() for neg in negatives]
return negative | loading positive dictionary | project_sol.py | loadNegative | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def loadNegative():
'\n \n '
myfile = open('negative.csv', 'r')
negatives = myfile.readlines()
negative = [neg.strip().lower() for neg in negatives]
return negative | def loadNegative():
'\n \n '
myfile = open('negative.csv', 'r')
negatives = myfile.readlines()
negative = [neg.strip().lower() for neg in negatives]
return negative<|docstring|>loading positive dictionary<|endoftext|> |
f0d293cefaf5db60df5bc2ea01b16ce9b62bc20407cb850b127a2d9a3285bff0 | def loadConstrain():
'\n loading constraining dictionary\n '
myfile = open('constraining_dictionary.xlsx', 'r')
constrains = myfile.readlines()
constrain = [con.strip().lower() for con in constrains]
return constrain | loading constraining dictionary | project_sol.py | loadConstrain | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def loadConstrain():
'\n \n '
myfile = open('constraining_dictionary.xlsx', 'r')
constrains = myfile.readlines()
constrain = [con.strip().lower() for con in constrains]
return constrain | def loadConstrain():
'\n \n '
myfile = open('constraining_dictionary.xlsx', 'r')
constrains = myfile.readlines()
constrain = [con.strip().lower() for con in constrains]
return constrain<|docstring|>loading constraining dictionary<|endoftext|> |
3da3e25a180080c0645a2f0fd0c639e2d50735ceffd5dbc83a03a04f300577be | def loadUncertain():
'\n loading uncertainity dictionary\n '
myfile = open('uncertainty_dictionary.xlsx', 'r')
uncertains = myfile.readlines()
uncertain = [un.strip().lower() for un in uncertains]
return uncertain | loading uncertainity dictionary | project_sol.py | loadUncertain | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def loadUncertain():
'\n \n '
myfile = open('uncertainty_dictionary.xlsx', 'r')
uncertains = myfile.readlines()
uncertain = [un.strip().lower() for un in uncertains]
return uncertain | def loadUncertain():
'\n \n '
myfile = open('uncertainty_dictionary.xlsx', 'r')
uncertains = myfile.readlines()
uncertain = [un.strip().lower() for un in uncertains]
return uncertain<|docstring|>loading uncertainity dictionary<|endoftext|> |
9b89352ab9b2c3a90d5a3cf7d48d1122116397240a861a0e0b8ebb658e5b218c | def countNeg(cleantext, negative):
'\n counts negative words in cleantext\n '
negs = [word for word in cleantext if (word in negative)]
return len(negs) | counts negative words in cleantext | project_sol.py | countNeg | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def countNeg(cleantext, negative):
'\n \n '
negs = [word for word in cleantext if (word in negative)]
return len(negs) | def countNeg(cleantext, negative):
'\n \n '
negs = [word for word in cleantext if (word in negative)]
return len(negs)<|docstring|>counts negative words in cleantext<|endoftext|> |
b57c6a95f6bc6a31bc903a456cbaba93ff1775cfc1138522a7dff5205705854f | def countPos(cleantext, positive):
'\n counts negative words in cleantext\n '
pos = [word for word in cleantext if (word in positive)]
return len(pos) | counts negative words in cleantext | project_sol.py | countPos | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def countPos(cleantext, positive):
'\n \n '
pos = [word for word in cleantext if (word in positive)]
return len(pos) | def countPos(cleantext, positive):
'\n \n '
pos = [word for word in cleantext if (word in positive)]
return len(pos)<|docstring|>counts negative words in cleantext<|endoftext|> |
dc1ea9686666227d1518c0e2ebf3f04da8beca2c07ca59d8db5d512046f8b965 | def countCons(cleantext, constrain):
'\n counts negative words in cleantext\n '
con = [word for word in cleantext if (word in constrain)]
return len(con) | counts negative words in cleantext | project_sol.py | countCons | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def countCons(cleantext, constrain):
'\n \n '
con = [word for word in cleantext if (word in constrain)]
return len(con) | def countCons(cleantext, constrain):
'\n \n '
con = [word for word in cleantext if (word in constrain)]
return len(con)<|docstring|>counts negative words in cleantext<|endoftext|> |
2813cfd08cae65fe69d34caf94ea4082358da9ee4ef8ea09529d465629f9c206 | def countUn(cleantext, uncertain):
'\n counts negative words in cleantext\n '
un = [word for word in cleantext if (word in uncertain)]
return len(un) | counts negative words in cleantext | project_sol.py | countUn | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def countUn(cleantext, uncertain):
'\n \n '
un = [word for word in cleantext if (word in uncertain)]
return len(un) | def countUn(cleantext, uncertain):
'\n \n '
un = [word for word in cleantext if (word in uncertain)]
return len(un)<|docstring|>counts negative words in cleantext<|endoftext|> |
387712305fcd30a5056d1510844f569fafafd505ce08dbaf1d1b39a0a623371c | def getSentiment(cleantext, negative, positive):
'\n counts negative and positive words in cleantext and returns a score accordingly\n '
positive = loadPositive()
negative = loadNegative()
return ((countPos(cleantext, positive) - countNeg(cleantext, negative)) / ((countPos(cleantext, posit... | counts negative and positive words in cleantext and returns a score accordingly | project_sol.py | getSentiment | heroorkrishna/financial_texts_Sentimental_Analysis | 2 | python | def getSentiment(cleantext, negative, positive):
'\n \n '
positive = loadPositive()
negative = loadNegative()
return ((countPos(cleantext, positive) - countNeg(cleantext, negative)) / ((countPos(cleantext, positive) + countNeg(cleantext, negative)) + 1e-06)) | def getSentiment(cleantext, negative, positive):
'\n \n '
positive = loadPositive()
negative = loadNegative()
return ((countPos(cleantext, positive) - countNeg(cleantext, negative)) / ((countPos(cleantext, positive) + countNeg(cleantext, negative)) + 1e-06))<|docstring|>counts negative and... |
ff082dd13c825b6799a7a36233d18b2fc5483c24efb47a78d755e4dc9e46570b | def install_bio2bel_module(name: str, connection: Optional[str]=None, rebuild: bool=False) -> Optional[str]:
'Install Bio2BEL module.\n\n :param name: The name of the Bio2BEL module\n :param connection: The optional database connection\n :param rebuild: Should the cache not be used? Defaults to False.\n ... | Install Bio2BEL module.
:param name: The name of the Bio2BEL module
:param connection: The optional database connection
:param rebuild: Should the cache not be used? Defaults to False. | src/biokeen/content.py | install_bio2bel_module | SmartDataAnalytics/Bio-KEEN | 38 | python | def install_bio2bel_module(name: str, connection: Optional[str]=None, rebuild: bool=False) -> Optional[str]:
'Install Bio2BEL module.\n\n :param name: The name of the Bio2BEL module\n :param connection: The optional database connection\n :param rebuild: Should the cache not be used? Defaults to False.\n ... | def install_bio2bel_module(name: str, connection: Optional[str]=None, rebuild: bool=False) -> Optional[str]:
'Install Bio2BEL module.\n\n :param name: The name of the Bio2BEL module\n :param connection: The optional database connection\n :param rebuild: Should the cache not be used? Defaults to False.\n ... |
5066d1f532fa47abc827b2e5d8b3682b540a843bddda93076e31d7d02df625ec | def ensure_bio2bel_installation(package: str):
'Import a package, or install it.'
try:
b_module = importlib.import_module(package)
except ImportError:
logger.info(f'{EMOJI} pip install {package}')
from pip._internal import main as pip_main
with redirect_stdout(sys.stderr):
... | Import a package, or install it. | src/biokeen/content.py | ensure_bio2bel_installation | SmartDataAnalytics/Bio-KEEN | 38 | python | def ensure_bio2bel_installation(package: str):
try:
b_module = importlib.import_module(package)
except ImportError:
logger.info(f'{EMOJI} pip install {package}')
from pip._internal import main as pip_main
with redirect_stdout(sys.stderr):
pip_exit_code = pip_main... | def ensure_bio2bel_installation(package: str):
try:
b_module = importlib.import_module(package)
except ImportError:
logger.info(f'{EMOJI} pip install {package}')
from pip._internal import main as pip_main
with redirect_stdout(sys.stderr):
pip_exit_code = pip_main... |
09e65b6633fa02d7039817d0a76ef9c18490a635b9325e24c15727760fbd69a6 | def handle_bio2bel(module_name: str) -> np.ndarray:
'Load a Bio2BEL repository.\n\n :param module_name: The name of the bio2bel repository (with no prefix)\n '
path = install_bio2bel_module(module_name)
return np.loadtxt(fname=path, dtype=str, comments='@Comment@ Subject Predicate Object', delimiter='... | Load a Bio2BEL repository.
:param module_name: The name of the bio2bel repository (with no prefix) | src/biokeen/content.py | handle_bio2bel | SmartDataAnalytics/Bio-KEEN | 38 | python | def handle_bio2bel(module_name: str) -> np.ndarray:
'Load a Bio2BEL repository.\n\n :param module_name: The name of the bio2bel repository (with no prefix)\n '
path = install_bio2bel_module(module_name)
return np.loadtxt(fname=path, dtype=str, comments='@Comment@ Subject Predicate Object', delimiter='... | def handle_bio2bel(module_name: str) -> np.ndarray:
'Load a Bio2BEL repository.\n\n :param module_name: The name of the bio2bel repository (with no prefix)\n '
path = install_bio2bel_module(module_name)
return np.loadtxt(fname=path, dtype=str, comments='@Comment@ Subject Predicate Object', delimiter='... |
7b44092c7b373e79216e287301b8457da341832d7c3b7889f9691424f35e1c5c | def handle_bel_commons(network_id: Union[(int, str)], host: Optional[str]=None) -> np.ndarray:
'Load a BEL document from BEL Commons.\n\n :param network_id: The network identifier in BEL Commons\n :param host: The host for BEL Commons. Defaults to the Fraunhofer SCAI public instance.\n '
graph = from_w... | Load a BEL document from BEL Commons.
:param network_id: The network identifier in BEL Commons
:param host: The host for BEL Commons. Defaults to the Fraunhofer SCAI public instance. | src/biokeen/content.py | handle_bel_commons | SmartDataAnalytics/Bio-KEEN | 38 | python | def handle_bel_commons(network_id: Union[(int, str)], host: Optional[str]=None) -> np.ndarray:
'Load a BEL document from BEL Commons.\n\n :param network_id: The network identifier in BEL Commons\n :param host: The host for BEL Commons. Defaults to the Fraunhofer SCAI public instance.\n '
graph = from_w... | def handle_bel_commons(network_id: Union[(int, str)], host: Optional[str]=None) -> np.ndarray:
'Load a BEL document from BEL Commons.\n\n :param network_id: The network identifier in BEL Commons\n :param host: The host for BEL Commons. Defaults to the Fraunhofer SCAI public instance.\n '
graph = from_w... |
8e1dcb11a3b214e4a6248ea3cd8e93377cd3fdf1a8d33fa141fb44f90e8e53ad | def build_optimizer(opt_method, lr, loss, max_gradient_norm=None, global_step=None, decay_steps=None):
" Build an optimizer and return a training op.\n\n Will also add checks for Nans in the gradient, and add some monitoring to\n tensorboard.\n\n Parameters\n ----------\n opt_method : str\n Ei... | Build an optimizer and return a training op.
Will also add checks for Nans in the gradient, and add some monitoring to
tensorboard.
Parameters
----------
opt_method : str
Either 'adam', 'sgd', or 'momentum'
lr : float
Learning rate for the optimizer
loss : tf.Tensor
Tensor containing the loss operation
ma... | tf_ops/general.py | build_optimizer | fbcotter/tf_ops | 0 | python | def build_optimizer(opt_method, lr, loss, max_gradient_norm=None, global_step=None, decay_steps=None):
" Build an optimizer and return a training op.\n\n Will also add checks for Nans in the gradient, and add some monitoring to\n tensorboard.\n\n Parameters\n ----------\n opt_method : str\n Ei... | def build_optimizer(opt_method, lr, loss, max_gradient_norm=None, global_step=None, decay_steps=None):
" Build an optimizer and return a training op.\n\n Will also add checks for Nans in the gradient, and add some monitoring to\n tensorboard.\n\n Parameters\n ----------\n opt_method : str\n Ei... |
a4b56869d1ee62090e8a0b821d70f1843086e240156182cc8e40538e58a9c6b0 | def variable_with_wd(name, shape, stddev=None, wd=None, norm=2):
' Helper to create an initialized variable with weight decay.\n\n Note that the variable is initialized with a truncated normal distribution.\n A weight decay is added only if one is specified. Also will add summaries\n for this variable.\n\n... | Helper to create an initialized variable with weight decay.
Note that the variable is initialized with a truncated normal distribution.
A weight decay is added only if one is specified. Also will add summaries
for this variable.
Internally, it calls tf.get_variable, so you can use this to re-get already
defined varia... | tf_ops/general.py | variable_with_wd | fbcotter/tf_ops | 0 | python | def variable_with_wd(name, shape, stddev=None, wd=None, norm=2):
' Helper to create an initialized variable with weight decay.\n\n Note that the variable is initialized with a truncated normal distribution.\n A weight decay is added only if one is specified. Also will add summaries\n for this variable.\n\n... | def variable_with_wd(name, shape, stddev=None, wd=None, norm=2):
' Helper to create an initialized variable with weight decay.\n\n Note that the variable is initialized with a truncated normal distribution.\n A weight decay is added only if one is specified. Also will add summaries\n for this variable.\n\n... |
e5c91efb75ac46e7d9935270d5071103e0dfc23881495b2030ca4fcfc2384eb4 | def variable_summaries(var, name='summaries'):
'Attach a lot of summaries to a variable (for TensorBoard visualization).\n\n Parameters\n ----------\n var : :py:class:`tf.Tensor`\n variable for which you wish to create summaries\n name : str\n scope under which you want to add your summary... | Attach a lot of summaries to a variable (for TensorBoard visualization).
Parameters
----------
var : :py:class:`tf.Tensor`
variable for which you wish to create summaries
name : str
scope under which you want to add your summary ops | tf_ops/general.py | variable_summaries | fbcotter/tf_ops | 0 | python | def variable_summaries(var, name='summaries'):
'Attach a lot of summaries to a variable (for TensorBoard visualization).\n\n Parameters\n ----------\n var : :py:class:`tf.Tensor`\n variable for which you wish to create summaries\n name : str\n scope under which you want to add your summary... | def variable_summaries(var, name='summaries'):
'Attach a lot of summaries to a variable (for TensorBoard visualization).\n\n Parameters\n ----------\n var : :py:class:`tf.Tensor`\n variable for which you wish to create summaries\n name : str\n scope under which you want to add your summary... |
861701efbee355b19db26947f23d1a201a542dd18bd88761370e2fa0a3977ceb | def loss(labels, logits, one_hot=True, num_classes=None, λ=1):
" Compute sum of data + regularization losses.\n\n loss = data_loss + λ * reg_losses\n\n The regularization loss will sum over all the variables that already\n exist in the GraphKeys.REGULARIZATION_LOSSES.\n\n Parameters\n ----------\n ... | Compute sum of data + regularization losses.
loss = data_loss + λ * reg_losses
The regularization loss will sum over all the variables that already
exist in the GraphKeys.REGULARIZATION_LOSSES.
Parameters
----------
labels : ndarray(dtype=float, ndim=(N,C))
The vector of labels.
one_hot : bool
True if the la... | tf_ops/general.py | loss | fbcotter/tf_ops | 0 | python | def loss(labels, logits, one_hot=True, num_classes=None, λ=1):
" Compute sum of data + regularization losses.\n\n loss = data_loss + λ * reg_losses\n\n The regularization loss will sum over all the variables that already\n exist in the GraphKeys.REGULARIZATION_LOSSES.\n\n Parameters\n ----------\n ... | def loss(labels, logits, one_hot=True, num_classes=None, λ=1):
" Compute sum of data + regularization losses.\n\n loss = data_loss + λ * reg_losses\n\n The regularization loss will sum over all the variables that already\n exist in the GraphKeys.REGULARIZATION_LOSSES.\n\n Parameters\n ----------\n ... |
e2093e28238cd529c14bcca76f5469b75d67ed05a599a5a716c7298a7db84799 | def fixed_padding(inputs, kernel_size, data_format):
"Pads the input along the spatial dimensions independently of input size.\n\n Parameters\n ----------\n inputs: tf.Tensor\n A tensor of size [batch, channels, height_in, width_in] or\n [batch, height_in, width_in, channels] depending on dat... | Pads the input along the spatial dimensions independently of input size.
Parameters
----------
inputs: tf.Tensor
A tensor of size [batch, channels, height_in, width_in] or
[batch, height_in, width_in, channels] depending on data_format.
kernel_size: int
The kernel to be used in the conv2d or max_pool2d ope... | tf_ops/general.py | fixed_padding | fbcotter/tf_ops | 0 | python | def fixed_padding(inputs, kernel_size, data_format):
"Pads the input along the spatial dimensions independently of input size.\n\n Parameters\n ----------\n inputs: tf.Tensor\n A tensor of size [batch, channels, height_in, width_in] or\n [batch, height_in, width_in, channels] depending on dat... | def fixed_padding(inputs, kernel_size, data_format):
"Pads the input along the spatial dimensions independently of input size.\n\n Parameters\n ----------\n inputs: tf.Tensor\n A tensor of size [batch, channels, height_in, width_in] or\n [batch, height_in, width_in, channels] depending on dat... |
bf36cdd2f0e4cdcfff2d1b2e74c47704ed0c56b2c21f73e63fa37f7af674fe4f | def _residual_core(x, filters, kernel_size=3, stride=1, train=True, wd=0.0, bn_momentum=0.99, bn_epsilon=0.001):
' Core function of a residual unit.\n\n In -> conv -> bn -> relu -> conv\n\n Note that the normal residual layer has a batch norm and relu before the\n first conv. This is in the residual functi... | Core function of a residual unit.
In -> conv -> bn -> relu -> conv
Note that the normal residual layer has a batch norm and relu before the
first conv. This is in the residual function which calls this.
Parameters
----------
x : tf tensor
Input to be modified
filters : int
Number of output filters (will be u... | tf_ops/general.py | _residual_core | fbcotter/tf_ops | 0 | python | def _residual_core(x, filters, kernel_size=3, stride=1, train=True, wd=0.0, bn_momentum=0.99, bn_epsilon=0.001):
' Core function of a residual unit.\n\n In -> conv -> bn -> relu -> conv\n\n Note that the normal residual layer has a batch norm and relu before the\n first conv. This is in the residual functi... | def _residual_core(x, filters, kernel_size=3, stride=1, train=True, wd=0.0, bn_momentum=0.99, bn_epsilon=0.001):
' Core function of a residual unit.\n\n In -> conv -> bn -> relu -> conv\n\n Note that the normal residual layer has a batch norm and relu before the\n first conv. This is in the residual functi... |
23c9e1fc005d3fb41a88db4ccfc90cd6a8a3218b5bc69d54bfa236baf83b03c1 | def residual(x, filters, kernel_size=3, stride=1, train=True, wd=0.0, bn_momentum=0.99, bn_epsilon=0.001, name='res'):
' Residual layer\n\n Uses the _residual_core function to create F(x), then adds x to it.\n\n Parameters\n ----------\n x : tf tensor\n Input to be modified\n filters : int\n ... | Residual layer
Uses the _residual_core function to create F(x), then adds x to it.
Parameters
----------
x : tf tensor
Input to be modified
filters : int
Number of output filters (will be used for all convolutions in the
resnet core).
stride : int
Conv stride
train : bool or tf boolean tensor
Whet... | tf_ops/general.py | residual | fbcotter/tf_ops | 0 | python | def residual(x, filters, kernel_size=3, stride=1, train=True, wd=0.0, bn_momentum=0.99, bn_epsilon=0.001, name='res'):
' Residual layer\n\n Uses the _residual_core function to create F(x), then adds x to it.\n\n Parameters\n ----------\n x : tf tensor\n Input to be modified\n filters : int\n ... | def residual(x, filters, kernel_size=3, stride=1, train=True, wd=0.0, bn_momentum=0.99, bn_epsilon=0.001, name='res'):
' Residual layer\n\n Uses the _residual_core function to create F(x), then adds x to it.\n\n Parameters\n ----------\n x : tf tensor\n Input to be modified\n filters : int\n ... |
b26bf83b464dac74c30aee6b066861673f884b91ed0564791eeb6dc4126f1a1e | def lift_residual_resample(x1, x2, filters, train=True, downsize=True, wd=0.0001):
'Define a Lifting Layer with resizing\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting... | Define a Lifting Layer with resizing
The P and the U blocks for this lifting layer are non-linear functions.
These are the same form as the F(x) in a residual layer (i.e. two
convolutions). In block form, a lifting layer looks like this::
_______________
| |
x1->|---(+)---------|->... | tf_ops/general.py | lift_residual_resample | fbcotter/tf_ops | 0 | python | def lift_residual_resample(x1, x2, filters, train=True, downsize=True, wd=0.0001):
'Define a Lifting Layer with resizing\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting... | def lift_residual_resample(x1, x2, filters, train=True, downsize=True, wd=0.0001):
'Define a Lifting Layer with resizing\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting... |
38aeb63e8f75508a108441ce4b8a3d664b2866df6920a412d5fc46254589a6f5 | def lift_residual_resample_inv(d, s, out_size, train=True, wd=0.0001):
'Define a inverse Lifting Layer with resizing\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting lay... | Define a inverse Lifting Layer with resizing
The P and the U blocks for this lifting layer are non-linear functions.
These are the same form as the F(x) in a residual layer (i.e. two
convolutions). In block form, a lifting layer looks like this::
We share the variables with the forward lifting.
In block form, the i... | tf_ops/general.py | lift_residual_resample_inv | fbcotter/tf_ops | 0 | python | def lift_residual_resample_inv(d, s, out_size, train=True, wd=0.0001):
'Define a inverse Lifting Layer with resizing\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting lay... | def lift_residual_resample_inv(d, s, out_size, train=True, wd=0.0001):
'Define a inverse Lifting Layer with resizing\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting lay... |
9b5c6d835760c014a2fa68a1a1a1687c780bb85bb70720dd6f368365569c7412 | def lift_residual(x1, x2, train=True, wd=0.0001):
'Define a Lifting Layer\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting layer looks like this::\n\n ______... | Define a Lifting Layer
The P and the U blocks for this lifting layer are non-linear functions.
These are the same form as the F(x) in a residual layer (i.e. two
convolutions). In block form, a lifting layer looks like this::
_______________
| |
x1->|---(+)---------|->d
| ... | tf_ops/general.py | lift_residual | fbcotter/tf_ops | 0 | python | def lift_residual(x1, x2, train=True, wd=0.0001):
'Define a Lifting Layer\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting layer looks like this::\n\n ______... | def lift_residual(x1, x2, train=True, wd=0.0001):
'Define a Lifting Layer\n\n The P and the U blocks for this lifting layer are non-linear functions.\n These are the same form as the F(x) in a residual layer (i.e. two\n convolutions). In block form, a lifting layer looks like this::\n\n ______... |
7b197756414880fbfc03fd4284f84207dd18d5a3aac9f47c713d8dad7e2a99e6 | def lift_residual_inv(d, s, train=True, wd=0.0001):
'Define the inverse of a lifting layer\n\n We share the variables with the forward lifting.\n\n In block form, the inverse lifting layer looks like this (note the sign swap\n and flow direction reversal compared to the forward case)::\n\n ____... | Define the inverse of a lifting layer
We share the variables with the forward lifting.
In block form, the inverse lifting layer looks like this (note the sign swap
and flow direction reversal compared to the forward case)::
_______________
| |
x1<-|---(+)---------|<-d
| ... | tf_ops/general.py | lift_residual_inv | fbcotter/tf_ops | 0 | python | def lift_residual_inv(d, s, train=True, wd=0.0001):
'Define the inverse of a lifting layer\n\n We share the variables with the forward lifting.\n\n In block form, the inverse lifting layer looks like this (note the sign swap\n and flow direction reversal compared to the forward case)::\n\n ____... | def lift_residual_inv(d, s, train=True, wd=0.0001):
'Define the inverse of a lifting layer\n\n We share the variables with the forward lifting.\n\n In block form, the inverse lifting layer looks like this (note the sign swap\n and flow direction reversal compared to the forward case)::\n\n ____... |
8461898ab77c9857b793f5dbba9f16e749bc4022e12fa092946dbfee28a1f5bf | def complex_convolution(x, output_dim, size=3, stride=1, stddev=None, wd=0.0, norm=1.0, name='conv2d', with_bias=False, bias_start=0.0):
'Function to do complex convolution\n\n In a similar way we have a convenience function, :py:func:`convolution` to\n wrap tf.nn.conv2d (create variables, add a relu, etc.), ... | Function to do complex convolution
In a similar way we have a convenience function, :py:func:`convolution` to
wrap tf.nn.conv2d (create variables, add a relu, etc.), this function wraps
:py:func:`cconv2d`. If you want more fine control over things, use
cconv2d directly, but for most purposes, this function should do
w... | tf_ops/general.py | complex_convolution | fbcotter/tf_ops | 0 | python | def complex_convolution(x, output_dim, size=3, stride=1, stddev=None, wd=0.0, norm=1.0, name='conv2d', with_bias=False, bias_start=0.0):
'Function to do complex convolution\n\n In a similar way we have a convenience function, :py:func:`convolution` to\n wrap tf.nn.conv2d (create variables, add a relu, etc.), ... | def complex_convolution(x, output_dim, size=3, stride=1, stddev=None, wd=0.0, norm=1.0, name='conv2d', with_bias=False, bias_start=0.0):
'Function to do complex convolution\n\n In a similar way we have a convenience function, :py:func:`convolution` to\n wrap tf.nn.conv2d (create variables, add a relu, etc.), ... |
3be224fb5770069482cbd4f88102676e6248e44155d76e2bf7bfec267df811a6 | def complex_convolution_transpose(x, output_dim, shape, size=3, stride=1, stddev=None, wd=0.0, norm=1, name='conv2d'):
'Function to do the conjugate transpose of complex convolution\n\n In a similar way we have a convenience function, :py:func:`convolution` to\n wrap tf.nn.conv2d (create variables, add a relu... | Function to do the conjugate transpose of complex convolution
In a similar way we have a convenience function, :py:func:`convolution` to
wrap tf.nn.conv2d (create variables, add a relu, etc.), this function wraps
:py:func:`cconv2d_transpose`. If you want more fine control over things, use
cconv2d_transpose directly, b... | tf_ops/general.py | complex_convolution_transpose | fbcotter/tf_ops | 0 | python | def complex_convolution_transpose(x, output_dim, shape, size=3, stride=1, stddev=None, wd=0.0, norm=1, name='conv2d'):
'Function to do the conjugate transpose of complex convolution\n\n In a similar way we have a convenience function, :py:func:`convolution` to\n wrap tf.nn.conv2d (create variables, add a relu... | def complex_convolution_transpose(x, output_dim, shape, size=3, stride=1, stddev=None, wd=0.0, norm=1, name='conv2d'):
'Function to do the conjugate transpose of complex convolution\n\n In a similar way we have a convenience function, :py:func:`convolution` to\n wrap tf.nn.conv2d (create variables, add a relu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.