uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
bb70c3c609acf06231a37b7e
train
class
class TestDupeNameBarrier(LocalTestCase): def test__applies(self): creator = self.add(Creator, dict(email='dupe@example.com')) creator_2 = self.add(Creator, dict(email='dupe_2@example.com')) book = self.add(Book, dict( name='test__applies', creator_id=creator.id, ...
class TestDupeNameBarrier(LocalTestCase):
def test__applies(self): creator = self.add(Creator, dict(email='dupe@example.com')) creator_2 = self.add(Creator, dict(email='dupe_2@example.com')) book = self.add(Book, dict( name='test__applies', creator_id=creator.id, book_type_id=1, relea...
self.assertEqual(barrier.code, 'complete_in_progress') def test__description(self): barrier = CompleteInProgressBarrier({}) self.assertTrue( 'process for setting the book as completed' in barrier.description) self.assertTrue('is still in progress' in barrier.description) d...
151
151
505
10
141
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestDupeNameBarrier
TestDupeNameBarrier
276
335
276
277
af3d730dffb0f845e30ba479f68ca69cf1e040cd
bigcode/the-stack
train
1977aa760b24df4309caa84b
train
class
class TestDupeNumberBarrier(LocalTestCase): def test__applies(self): creator = self.add(Creator, dict(name_for_url='test__applies')) book = self.add(Book, dict( name='test__applies', number=2, creator_id=creator.id, book_type_id=1, release...
class TestDupeNumberBarrier(LocalTestCase):
def test__applies(self): creator = self.add(Creator, dict(name_for_url='test__applies')) book = self.add(Book, dict( name='test__applies', number=2, creator_id=creator.id, book_type_id=1, release_date=datetime.date(2014, 12, 31), ))...
def test__description(self): barrier = DupeNameBarrier({}) self.assertTrue( 'name of the book must be unique' in barrier.description) def test__fixes(self): barrier = DupeNameBarrier(Book(id=123, release_date=None)) self.assertEqual(len(barrier.fixes), 2) self....
150
150
502
10
140
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestDupeNumberBarrier
TestDupeNumberBarrier
338
399
338
339
2db12882edd13eeb87cf156e48da5c5202027c46
bigcode/the-stack
train
bdd2f02a2060ef65519fc5b5
train
class
class TestAllRightsReservedBarrier(LocalTestCase): def test__applies(self): cc_by = CCLicence.by_code('CC BY') all_rights = CCLicence.by_code('All Rights Reserved') book = Book(dict( cc_licence_id=cc_by.id, )) barrier = AllRightsReservedBarrier(book) sel...
class TestAllRightsReservedBarrier(LocalTestCase):
def test__applies(self): cc_by = CCLicence.by_code('CC BY') all_rights = CCLicence.by_code('All Rights Reserved') book = Book(dict( cc_licence_id=cc_by.id, )) barrier = AllRightsReservedBarrier(book) self.assertFalse(barrier.applies()) book.updat...
.as_dict()).upload_image() original = upload_img.fullname(size='original') cbz = upload_img.fullname(size='cbz') cbz_dirname = os.path.dirname(cbz) if not os.path.exists(cbz_dirname): os.makedirs(cbz_dirname) shutil.copy(original, cbz) class TestAllRightsReservedBarrier(LocalTestCase):
79
79
264
10
69
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestAllRightsReservedBarrier
TestAllRightsReservedBarrier
65
99
65
66
ba522255191ddb5a7bb099638d191f84c94dcdc1
bigcode/the-stack
train
c59f7501cc038bfb9bdaaad6
train
function
def setUpModule(): """Set up web2py environment.""" # C0103: *Invalid name "%%s" (should match %%s)* # pylint: disable=C0103 LocalTestCase.set_env(globals())
def setUpModule():
"""Set up web2py environment.""" # C0103: *Invalid name "%%s" (should match %%s)* # pylint: disable=C0103 LocalTestCase.set_env(globals())
_book)) self.assertFalse(has_complete_barriers(self._complete_book)) def test__has_filesharing_barriers(self): self.assertTrue(has_filesharing_barriers(self._complete_book)) self.assertFalse(has_filesharing_barriers(self._sharable_book)) def setUpModule():
64
64
52
5
59
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
setUpModule
setUpModule
957
961
957
957
80e7af5b3b4f2f483b84dc07dd8349041b1bd023
bigcode/the-stack
train
bf7955bd9bb53b792de32162
train
class
class TestModalLink(LocalTestCase): def test____init__(self): modal_link = ModalLink( Book(id=123, release_date=None), 'My Link', 'modal-action-btn', 'book_action' ) self.assertTrue(modal_link) def test__link(self): modal_link = M...
class TestModalLink(LocalTestCase):
def test____init__(self): modal_link = ModalLink( Book(id=123, release_date=None), 'My Link', 'modal-action-btn', 'book_action' ) self.assertTrue(modal_link) def test__link(self): modal_link = ModalLink( Book(id=123, re...
self.assertEqual(len(barrier.fixes), 2) self.assertTrue('>Check</a> that images are' in barrier.fixes[0]) def test__reason(self): barrier = InvalidPageNoBarrier({}) self.assertTrue('numbers were not set properly' in barrier.reason) class TestModalLink(LocalTestCase):
71
71
237
8
63
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestModalLink
TestModalLink
464
494
464
465
e04cd1c0e8a9352533e09aa92e609036ededcd95
bigcode/the-stack
train
1566fa2f53600fcd80510b4f
train
class
class TestConstants(LocalTestCase): def test_barrier_classes(self): base_class = BaseReleaseBarrier base_classes = [] classes = [x for x in list(globals().values()) if inspect.isclass(x)] ignore_classes = [base_class] for c in classes: if c not in ignore_classes ...
class TestConstants(LocalTestCase):
def test_barrier_classes(self): base_class = BaseReleaseBarrier base_classes = [] classes = [x for x in list(globals().values()) if inspect.isclass(x)] ignore_classes = [base_class] for c in classes: if c not in ignore_classes and base_class in inspect.getmro(c):...
.fixes), 1) self.assertTrue('>Set the book as completed</a>' in barrier.fixes[0]) def test__reason(self): barrier = NotCompletedBarrier({}) self.assertTrue('book is not set as completed' in barrier.reason) class TestConstants(LocalTestCase):
64
64
130
7
57
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestConstants
TestConstants
804
818
804
804
94072f6d0c561927a841c531e9cc734d8cab6432
bigcode/the-stack
train
d9822c733dfbed0e72a6d345
train
class
class TestCompleteInProgressBarrier(LocalTestCase): def test__applies(self): book = Book(dict( complete_in_progress=False )) barrier = CompleteInProgressBarrier(book) self.assertFalse(barrier.applies()) book.update(complete_in_progress=True) barrier = C...
class TestCompleteInProgressBarrier(LocalTestCase):
def test__applies(self): book = Book(dict( complete_in_progress=False )) barrier = CompleteInProgressBarrier(book) self.assertFalse(barrier.applies()) book.update(complete_in_progress=True) barrier = CompleteInProgressBarrier(book) self.assertTru...
self.assertTrue(isinstance(upload_link[0], Book)) self.assertEqual(upload_link[0].id, 123) self.assertEqual( upload_link[1:], [ 'Upload Me', 'modal-upload-btn', 'book_pages', ] ) class TestCompleteInProgressBarr...
70
70
234
10
60
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestCompleteInProgressBarrier
TestCompleteInProgressBarrier
241
273
241
242
b627c4de946d66ec2108beeaa787d606e5c5c3da
bigcode/the-stack
train
22f3614c1e097201f8c4e3be
train
class
class TestNoLicenceBarrier(LocalTestCase): def test__applies(self): book = Book(dict( cc_licence_id=1, )) barrier = NoLicenceBarrier(book) self.assertFalse(barrier.applies()) book.update(cc_licence_id=0) barrier = NoLicenceBarrier(book) self.ass...
class TestNoLicenceBarrier(LocalTestCase):
def test__applies(self): book = Book(dict( cc_licence_id=1, )) barrier = NoLicenceBarrier(book) self.assertFalse(barrier.applies()) book.update(cc_licence_id=0) barrier = NoLicenceBarrier(book) self.assertTrue(barrier.applies()) def test__co...
(has_size(square_page, 'cbz')) got = barrier.no_cbz_images() self.assertEqual(got, []) def test__reason(self): barrier = NoCBZImageBarrier({}) self.assertTrue('images are not large enough' in barrier.reason) class TestNoLicenceBarrier(LocalTestCase):
66
66
222
9
57
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestNoLicenceBarrier
TestNoLicenceBarrier
660
691
660
661
c9acab35597f7d3670c71a57e76dcfae43e8562e
bigcode/the-stack
train
0691fe35e69bc2f6e54f3304
train
class
class TestNoCBZImageBarrier(ImageTestCase): def test____init__(self): # W0212 (protected-access): *Access to a protected member # pylint: disable=W0212 barrier = NoCBZImageBarrier({}) self.assertTrue(barrier) self.assertEqual(barrier._no_cbz_images, None) def test__appl...
class TestNoCBZImageBarrier(ImageTestCase):
def test____init__(self): # W0212 (protected-access): *Access to a protected member # pylint: disable=W0212 barrier = NoCBZImageBarrier({}) self.assertTrue(barrier) self.assertEqual(barrier._no_cbz_images, None) def test__applies(self): # W0212 (protected-access)...
'] ) self.assertEqual(anchor['data-book_id'], '123') self.assertEqual(anchor['href'], '/login/book_action/123') class TestNoBookNameBarrier(LocalTestCase): def test__applies(self): book = Book(dict( name='test__applies', )) barrier = NoBookNameBarrier(...
256
256
1,033
11
245
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestNoCBZImageBarrier
TestNoCBZImageBarrier
530
657
530
531
88f5207956d15783098aef19ad6b1194364bac41
bigcode/the-stack
train
7743922bf30f8e924ea224c6
train
class
class TestBaseReleaseBarrier(LocalTestCase): _dub_modal_link = None # C0103: *Invalid name "%s" (should match %s)* # pylint: disable=C0103 def setUp(self): class DubModalLink(ModalLink, metaclass=DubMeta): _dub_methods = [ 'link', ] def override...
class TestBaseReleaseBarrier(LocalTestCase):
_dub_modal_link = None # C0103: *Invalid name "%s" (should match %s)* # pylint: disable=C0103 def setUp(self): class DubModalLink(ModalLink, metaclass=DubMeta): _dub_methods = [ 'link', ] def override_link(self): return [ ...
): cc_by = CCLicence.by_code('CC BY') all_rights = CCLicence.by_code('All Rights Reserved') book = Book(dict( cc_licence_id=cc_by.id, )) barrier = AllRightsReservedBarrier(book) self.assertFalse(barrier.applies()) book.update(cc_licence_id=all_rights...
256
256
865
9
247
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestBaseReleaseBarrier
TestBaseReleaseBarrier
102
238
102
103
d5390e41a72020d9c97ef8ddefb1dece78d50aa1
bigcode/the-stack
train
aedddfcbca60536387fdabd6
train
class
class TestNoBookNameBarrier(LocalTestCase): def test__applies(self): book = Book(dict( name='test__applies', )) barrier = NoBookNameBarrier(book) self.assertFalse(barrier.applies()) book.update(name='') barrier = NoBookNameBarrier(book) self.ass...
class TestNoBookNameBarrier(LocalTestCase):
def test__applies(self): book = Book(dict( name='test__applies', )) barrier = NoBookNameBarrier(book) self.assertFalse(barrier.applies()) book.update(name='') barrier = NoBookNameBarrier(book) self.assertTrue(barrier.applies()) def test__cod...
Equal( anchor['class'], ['modal-action-btn', 'close_current_dialog', 'no_rclick_menu'] ) self.assertEqual(anchor['data-book_id'], '123') self.assertEqual(anchor['href'], '/login/book_action/123') class TestNoBookNameBarrier(LocalTestCase):
64
64
214
10
54
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestNoBookNameBarrier
TestNoBookNameBarrier
497
527
497
498
41fe4367ccc064733d00564fba7b053c55e33bbe
bigcode/the-stack
train
dedbf50b7a705b23fcf7c4da
train
class
class TestNotCompletedBarrier(LocalTestCase): def test__applies(self): book = Book(dict( complete_in_progress=False, release_date=datetime.date.today() )) barrier = NotCompletedBarrier(book) self.assertFalse(barrier.applies()) book.update(release_da...
class TestNotCompletedBarrier(LocalTestCase):
def test__applies(self): book = Book(dict( complete_in_progress=False, release_date=datetime.date.today() )) barrier = NotCompletedBarrier(book) self.assertFalse(barrier.applies()) book.update(release_date=None) barrier = NotCompletedBarrier(...
)) self.assertEqual(len(barrier.fixes), 1) self.assertTrue( 'set the Publication Metadata' in str(barrier.fixes[0])) def test__reason(self): barrier = NoPublicationMetadataBarrier({}) self.assertTrue( 'publication metadata has not been set' in barrier.reason)...
77
77
259
9
68
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestNotCompletedBarrier
TestNotCompletedBarrier
765
801
765
766
878b164e8371cb64774b96d6f7f5a4161a987238
bigcode/the-stack
train
036a4b11e3f302cc7935188d
train
class
class TestNoPagesBarrier(LocalTestCase): def test__applies(self): book = self.add(Book, dict(name='test__applies')) barrier = NoPagesBarrier(book) self.assertTrue(barrier.applies()) self.add(BookPage, dict( book_id=book.id )) barrier = NoPagesBarrier(boo...
class TestNoPagesBarrier(LocalTestCase):
def test__applies(self): book = self.add(Book, dict(name='test__applies')) barrier = NoPagesBarrier(book) self.assertTrue(barrier.applies()) self.add(BookPage, dict( book_id=book.id )) barrier = NoPagesBarrier(book) self.assertFalse(barrier.applie...
ixes), 1) self.assertTrue( 'change the Copyright Licence' in str(barrier.fixes[0])) def test__reason(self): barrier = NoLicenceBarrier({}) self.assertTrue('No licence has been selected' in barrier.reason) class TestNoPagesBarrier(LocalTestCase):
64
64
211
9
55
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestNoPagesBarrier
TestNoPagesBarrier
694
722
694
695
fee738f3de69a8e388dcd06e312c97dfa20726b6
bigcode/the-stack
train
fcd6bc2b84dbd675a277fe35
train
class
class TestFunctions(ImageTestCase): _incomplete_book = None _complete_book = None _sharable_book = None # C0103: *Invalid name "%s" (should match %s)* # pylint: disable=C0103 def setUp(self): creator = self.add(Creator, dict( email='test__complete_barriers@gmail.com', ...
class TestFunctions(ImageTestCase):
_incomplete_book = None _complete_book = None _sharable_book = None # C0103: *Invalid name "%s" (should match %s)* # pylint: disable=C0103 def setUp(self): creator = self.add(Creator, dict( email='test__complete_barriers@gmail.com', )) self._incomplete_book ...
.code, 'not_completed') def test__description(self): barrier = NotCompletedBarrier({}) self.assertTrue('It must be set as completed' in barrier.description) def test__fixes(self): barrier = NotCompletedBarrier(Book(id=123)) self.assertEqual(len(barrier.fixes), 1) self....
256
256
1,010
7
249
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestFunctions
TestFunctions
821
954
821
822
ca284d29a2ceba62a36c8101965f46985814a3ff
bigcode/the-stack
train
6eb96e4797d44445b0f66342
train
function
def _create_cbz(book_page): # Quick and dirty method for created a cbz size. Just copy the original upload_img = BookPage(book_page.as_dict()).upload_image() original = upload_img.fullname(size='original') cbz = upload_img.fullname(size='cbz') cbz_dirname = os.path.dirname(cbz) if not os.path.ex...
def _create_cbz(book_page): # Quick and dirty method for created a cbz size. Just copy the original
upload_img = BookPage(book_page.as_dict()).upload_image() original = upload_img.fullname(size='original') cbz = upload_img.fullname(size='cbz') cbz_dirname = os.path.dirname(cbz) if not os.path.exists(cbz_dirname): os.makedirs(cbz_dirname) shutil.copy(original, cbz)
.modules.tests.runner import LocalTestCase # C0111: Missing docstring # R0904: Too many public methods # pylint: disable=C0111,R0904 def _create_cbz(book_page): # Quick and dirty method for created a cbz size. Just copy the original
64
64
103
26
37
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
_create_cbz
_create_cbz
54
62
54
55
0069b0d40973240ca2c9b73c5d6f6259e67233cd
bigcode/the-stack
train
d48e750bcbfb105318da6bc7
train
class
class TestInvalidPageNoBarrier(LocalTestCase): def test__applies(self): book = self.add(Book, dict(name='test__applies')) # Has no pages, alls good (NoPagesBarrier takes care of this) barrier = InvalidPageNoBarrier(book) self.assertFalse(barrier.applies()) book_page_1 = se...
class TestInvalidPageNoBarrier(LocalTestCase):
def test__applies(self): book = self.add(Book, dict(name='test__applies')) # Has no pages, alls good (NoPagesBarrier takes care of this) barrier = InvalidPageNoBarrier(book) self.assertFalse(barrier.applies()) book_page_1 = self.add(BookPage, dict( book_id=book....
of the book must be unique' in barrier.description) def test__fixes(self): barrier = DupeNumberBarrier(Book(id=123, release_date=None)) self.assertEqual(len(barrier.fixes), 2) self.assertTrue('Verify the number' in barrier.fixes[0]) self.assertTrue('>delete</a> the book' in barrie...
126
126
420
10
116
zcomx/zco.mx
applications/zcomx/tests/book/test_release_barriers.py
Python
TestInvalidPageNoBarrier
TestInvalidPageNoBarrier
402
461
402
403
28c443b0b73f676a88934fd8db80ec533dce77b3
bigcode/the-stack
train
f7f94aa112bda35c78c259ce
train
class
class Model(nn.Module): def __init__(self, input_channel, output_channel, hidden_size, num_class, trans='TPS', feat='ResNet', seq='BiLSTM', pred='Attn',\ num_fiducial=20, imgH=32, imgW=100, batch_max_length=25): super(Model, self).__init__() #self.opt = opt self.batch_max_length=b...
class Model(nn.Module):
def __init__(self, input_channel, output_channel, hidden_size, num_class, trans='TPS', feat='ResNet', seq='BiLSTM', pred='Attn',\ num_fiducial=20, imgH=32, imgW=100, batch_max_length=25): super(Model, self).__init__() #self.opt = opt self.batch_max_length=batch_max_length s...
""" Copyright (c) 2019-present NAVER Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
198
217
726
5
192
Adithya-manjunath/EasyOCR
easyocr/model/new_model.py
Python
Model
Model
25
95
25
26
99411fba03e06dfa21728d685ee9d1e19971f86f
bigcode/the-stack
train
e498ba86978838efb9e6b97e
train
class
class CORSRequestHandler (SimpleHTTPRequestHandler): def end_headers (self): self.send_header('Access-Control-Allow-Origin', '*') SimpleHTTPRequestHandler.end_headers(self)
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self): self.send_header('Access-Control-Allow-Origin', '*') SimpleHTTPRequestHandler.end_headers(self)
from SimpleHTTPServer import SimpleHTTPRequestHandler import BaseHTTPServer class CORSRequestHandler (SimpleHTTPRequestHandler):
24
64
37
10
13
riseTJTSA/rise.github.io
Front End/py_server.py
Python
CORSRequestHandler
CORSRequestHandler
4
7
4
4
ad3ab35b9272bdfd96fc208863e8197e9bd48b0e
bigcode/the-stack
train
470c772b43d7aa2784c7deaf
train
function
def get_fairseq_arguments(exp_args): user_dir, langs, save_dir = exp_args.user_dir, exp_args.langs, \ exp_args.save_dir SAVE_DIR = save_dir spm_model = f"{exp_args.home_dir}/sentencepiece/sentencepiece.bpe.model" arch = exp_args.arch return f""" --user-dir {user_dir} \ --bpe 'senten...
def get_fairseq_arguments(exp_args):
user_dir, langs, save_dir = exp_args.user_dir, exp_args.langs, \ exp_args.save_dir SAVE_DIR = save_dir spm_model = f"{exp_args.home_dir}/sentencepiece/sentencepiece.bpe.model" arch = exp_args.arch return f""" --user-dir {user_dir} \ --bpe 'sentencepiece' \ --sentencepiece-model ...
from pathlib import Path import os SOURCE="java" TARGET="en_XX" DATA_HOME="data/codeXglue/code-to-text/" DATA_DIR=f"{SOURCE}/" TASK="translation_from_pretrained_bart" def get_fairseq_arguments(exp_args):
55
137
459
9
46
serjtroshin/PLBART
finetune_v2/tasks/code_to_text/code_summarization/config.py
Python
get_fairseq_arguments
get_fairseq_arguments
12
64
12
12
26d3300fe361809bb965c51f2305c6e0e436aff3
bigcode/the-stack
train
8b56ffc0095c3d0d1a5adb58
train
function
def get_evaluator_arguments(exp_args): user_dir, langs, save_dir, data_dir = exp_args.user_dir, exp_args.langs, \ exp_args.save_dir, exp_args.data_dir fmt_output = exp_args.fmt_output script_dir = Path(os.path.realpath(__file__)).parent model_name = exp_args.checkpoint_for_evaluate retu...
def get_evaluator_arguments(exp_args):
user_dir, langs, save_dir, data_dir = exp_args.user_dir, exp_args.langs, \ exp_args.save_dir, exp_args.data_dir fmt_output = exp_args.fmt_output script_dir = Path(os.path.realpath(__file__)).parent model_name = exp_args.checkpoint_for_evaluate return f""" python3 {script_dir}/ev...
\ --maximize-best-checkpoint-metric \ --eval-bleu-print-samples \ --no-epoch-checkpoints \ --patience 5 \ --ddp-backend no_c10d \ --save-dir {SAVE_DIR} """ def get_evaluator_arguments(exp_args):
64
64
178
8
56
serjtroshin/PLBART
finetune_v2/tasks/code_to_text/code_summarization/config.py
Python
get_evaluator_arguments
get_evaluator_arguments
66
80
66
66
ef3b9c232487e1533f23373579a1dfb1421a063e
bigcode/the-stack
train
ba6fda3423593bf06862b896
train
function
@pytest.mark.filter_policy def test_get_version_default(api, validator): try: assert is_valid_get_version( validator, get_version_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): rai...
@pytest.mark.filter_policy def test_get_version_default(api, validator):
try: assert is_valid_get_version( validator, get_version_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e
JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def get_version_default(api): endpoint_result = api.filter_policy.get_version( ) return endpoint_result @pytest.mark.filter_policy def test_get_version_default(api, validator...
64
64
63
14
49
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_get_version_default
test_get_version_default
345
354
345
346
452e104745928c87fa3ba46e1402823247b94bd7
bigcode/the-stack
train
49a581cfbe8dbe0f6c1515a0
train
function
def create_filter_policy(api): endpoint_result = api.filter_policy.create_filter_policy( active_validation=False, domains='string', payload=None, sgt='string', subnet='string', vn='string' ) return endpoint_result
def create_filter_policy(api):
endpoint_result = api.filter_policy.create_filter_policy( active_validation=False, domains='string', payload=None, sgt='string', subnet='string', vn='string' ) return endpoint_result
') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_22f8082b07ce528f82545e210b84d7de_v3_1_0').validate(obj.response) return True def create_filter_policy(api):
64
64
54
6
57
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
create_filter_policy
create_filter_policy
258
267
258
258
d283b73e9d553eab1b444f1287fd8855921c5643
bigcode/the-stack
train
9ea8cc738ac49feaff650a5a
train
function
def update_filter_policy_by_id_default(api): endpoint_result = api.filter_policy.update_filter_policy_by_id( active_validation=False, id='string', domains=None, payload=None, sgt=None, subnet=None, vn=None ) return endpoint_result
def update_filter_policy_by_id_default(api):
endpoint_result = api.filter_policy.update_filter_policy_by_id( active_validation=False, id='string', domains=None, payload=None, sgt=None, subnet=None, vn=None ) return endpoint_result
_by_id( validator, update_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def update_filter_policy_by_id_default(a...
64
64
60
9
54
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
update_filter_policy_by_id_default
update_filter_policy_by_id_default
120
130
120
120
31bbae70e56b900425559810cf24f6562ad9db26
bigcode/the-stack
train
f59283b3b8e8b58fa38860e0
train
function
def delete_filter_policy_by_id(api): endpoint_result = api.filter_policy.delete_filter_policy_by_id( id='string' ) return endpoint_result
def delete_filter_policy_by_id(api):
endpoint_result = api.filter_policy.delete_filter_policy_by_id( id='string' ) return endpoint_result
'text') assert hasattr(obj, 'response') json_schema_validate('jsd_4a83e0d4f56a5c06946f685aa46fa3e3_v3_1_0').validate(obj.response) return True def delete_filter_policy_by_id(api):
64
64
33
8
55
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
delete_filter_policy_by_id
delete_filter_policy_by_id
156
160
156
156
0cf7a06a838202fc6591d0ea4aa5e3303345ce67
bigcode/the-stack
train
c9536de53f99e1edef32d057
train
function
def get_filter_policy(api): endpoint_result = api.filter_policy.get_filter_policy( page=0, size=0 ) return endpoint_result
def get_filter_policy(api):
endpoint_result = api.filter_policy.get_filter_policy( page=0, size=0 ) return endpoint_result
assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_250a599ae00f5e47b9ece23cd3183d1c_v3_1_0').validate(obj.response) return True def get_filter_policy(api):
64
64
34
6
57
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
get_filter_policy
get_filter_policy
206
211
206
206
a1f6848dec3f414b8f52b990c9df5571eb3a19cd
bigcode/the-stack
train
72a64a49013d5ebae46c38ee
train
function
@pytest.mark.filter_policy def test_create_filter_policy(api, validator): try: assert is_valid_create_filter_policy( validator, create_filter_policy(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): pri...
@pytest.mark.filter_policy def test_create_filter_policy(api, validator):
try: assert is_valid_create_filter_policy( validator, create_filter_policy(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e...
(api): endpoint_result = api.filter_policy.create_filter_policy( active_validation=False, domains='string', payload=None, sgt='string', subnet='string', vn='string' ) return endpoint_result @pytest.mark.filter_policy def test_create_filter_policy(api, validato...
64
64
75
14
49
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_create_filter_policy
test_create_filter_policy
270
280
270
271
ab118a52ace6b0ef7cac1bec6291334425d9ea43
bigcode/the-stack
train
d0eacde754164432b6c8c698
train
function
def is_valid_create_filter_policy(json_schema_validate, obj): if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_22f8082b07ce528f82545e210b84d7de_v3_1_0').validate(ob...
def is_valid_create_filter_policy(json_schema_validate, obj):
if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_22f8082b07ce528f82545e210b84d7de_v3_1_0').validate(obj.response) return True
): try: assert is_valid_get_filter_policy( validator, get_filter_policy_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e def is_valid_create_filter_policy(json_schem...
64
64
94
12
51
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
is_valid_create_filter_policy
is_valid_create_filter_policy
247
255
247
247
4ef5e63f961c5d6aae3f0c55a9fdf1733fd31530
bigcode/the-stack
train
d93be3d26ae228feb24bae6e
train
function
def is_valid_get_version(json_schema_validate, obj): if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_209810ed6cad570d90243b1e0dbbe27b_v3_1_0').validate(obj.respons...
def is_valid_get_version(json_schema_validate, obj):
if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_209810ed6cad570d90243b1e0dbbe27b_v3_1_0').validate(obj.response) return True
validator): try: assert is_valid_create_filter_policy( validator, create_filter_policy_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e def is_valid_get_version(jso...
64
64
92
11
52
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
is_valid_get_version
is_valid_get_version
307
315
307
307
558fd20e9a353044ebb35aac23d47b079d8ae3a8
bigcode/the-stack
train
7c946f3022e3f605c56dbb1e
train
function
@pytest.mark.filter_policy def test_get_filter_policy(api, validator): try: assert is_valid_get_filter_policy( validator, get_filter_policy(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR...
@pytest.mark.filter_policy def test_get_filter_policy(api, validator):
try: assert is_valid_get_filter_policy( validator, get_filter_policy(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e
c_v3_1_0').validate(obj.response) return True def get_filter_policy(api): endpoint_result = api.filter_policy.get_filter_policy( page=0, size=0 ) return endpoint_result @pytest.mark.filter_policy def test_get_filter_policy(api, validator):
64
64
75
14
49
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_get_filter_policy
test_get_filter_policy
214
224
214
215
2d65931b25c3541d5864b4b865e0b72ee55b0ae2
bigcode/the-stack
train
14257caa709e3e066f786171
train
function
@pytest.mark.filter_policy def test_get_version(api, validator): try: assert is_valid_get_version( validator, get_version(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(...
@pytest.mark.filter_policy def test_get_version(api, validator):
try: assert is_valid_get_version( validator, get_version(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e
6cad570d90243b1e0dbbe27b_v3_1_0').validate(obj.response) return True def get_version(api): endpoint_result = api.filter_policy.get_version( ) return endpoint_result @pytest.mark.filter_policy def test_get_version(api, validator):
64
64
72
13
50
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_get_version
test_get_version
325
335
325
326
c9e91e40d85d7828a0ac77bad4097df9e05443f7
bigcode/the-stack
train
54a5ce2288e068d75bd25cab
train
function
def get_filter_policy_default(api): endpoint_result = api.filter_policy.get_filter_policy( page=None, size=None ) return endpoint_result
def get_filter_policy_default(api):
endpoint_result = api.filter_policy.get_filter_policy( page=None, size=None ) return endpoint_result
assert is_valid_get_filter_policy( validator, get_filter_policy(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def get_filter_policy...
64
64
33
7
56
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
get_filter_policy_default
get_filter_policy_default
227
232
227
227
b4813957008e11d2aab41140d7c7d8171c940d0f
bigcode/the-stack
train
62331d1c82272edd7c1ec507
train
function
def update_filter_policy_by_id(api): endpoint_result = api.filter_policy.update_filter_policy_by_id( active_validation=False, domains='string', id='string', payload=None, sgt='string', subnet='string', vn='string' ) return endpoint_result
def update_filter_policy_by_id(api):
endpoint_result = api.filter_policy.update_filter_policy_by_id( active_validation=False, domains='string', id='string', payload=None, sgt='string', subnet='string', vn='string' ) return endpoint_result
hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_95d0006cc03d53c89a3593526bf8dc0f_v3_1_0').validate(obj.response) return True def update_filter_policy_by_id(api):
64
64
63
8
55
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
update_filter_policy_by_id
update_filter_policy_by_id
94
104
94
94
5fd49ec10635a51b227966011b2d2cd303bde5dd
bigcode/the-stack
train
257d9dbafca1a8d410df4bca
train
function
def is_valid_get_filter_policy_by_id(json_schema_validate, obj): if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_16555f5d5ab6568d8bf5f9932f7ed7f4_v3_1_0').validate...
def is_valid_get_filter_policy_by_id(json_schema_validate, obj):
if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_16555f5d5ab6568d8bf5f9932f7ed7f4_v3_1_0').validate(obj.response) return True
isesdk.exceptions import ciscoisesdkException from tests.environment import IDENTITY_SERVICES_ENGINE_VERSION pytestmark = pytest.mark.skipif(IDENTITY_SERVICES_ENGINE_VERSION != '3.1.0', reason='version does not match') def is_valid_get_filter_policy_by_id(json_schema_validate, obj):
64
64
100
14
50
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
is_valid_get_filter_policy_by_id
is_valid_get_filter_policy_by_id
33
41
33
33
086dc0d8088d4d8e573425830c69213b4899c273
bigcode/the-stack
train
316c5093ac1035ece9a9e7d4
train
function
def delete_filter_policy_by_id_default(api): endpoint_result = api.filter_policy.delete_filter_policy_by_id( id='string' ) return endpoint_result
def delete_filter_policy_by_id_default(api):
endpoint_result = api.filter_policy.delete_filter_policy_by_id( id='string' ) return endpoint_result
_by_id( validator, delete_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def delete_filter_policy_by_id_default(a...
64
64
34
9
54
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
delete_filter_policy_by_id_default
delete_filter_policy_by_id_default
176
180
176
176
0dc900758a0ebab97ee5007ee6dea658fdd90b8e
bigcode/the-stack
train
697949addfeeb9e3a20fd23a
train
function
@pytest.mark.filter_policy def test_delete_filter_policy_by_id_default(api, validator): try: assert is_valid_delete_filter_policy_by_id( validator, delete_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, M...
@pytest.mark.filter_policy def test_delete_filter_policy_by_id_default(api, validator):
try: assert is_valid_delete_filter_policy_by_id( validator, delete_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e
error}".format(error=original_e)) raise original_e def delete_filter_policy_by_id_default(api): endpoint_result = api.filter_policy.delete_filter_policy_by_id( id='string' ) return endpoint_result @pytest.mark.filter_policy def test_delete_filter_policy_by_id_default(api, validator):
64
64
72
17
46
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_delete_filter_policy_by_id_default
test_delete_filter_policy_by_id_default
183
192
183
184
4ca27b8324b33280624f4840e948e003af322a7f
bigcode/the-stack
train
16730fd7d3dad3947e722492
train
function
@pytest.mark.filter_policy def test_get_filter_policy_default(api, validator): try: assert is_valid_get_filter_policy( validator, get_filter_policy_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)...
@pytest.mark.filter_policy def test_get_filter_policy_default(api, validator):
try: assert is_valid_get_filter_policy( validator, get_filter_policy_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e
ERROR: {error}".format(error=original_e)) raise original_e def get_filter_policy_default(api): endpoint_result = api.filter_policy.get_filter_policy( page=None, size=None ) return endpoint_result @pytest.mark.filter_policy def test_get_filter_policy_default(api, validator):
64
64
66
15
48
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_get_filter_policy_default
test_get_filter_policy_default
235
244
235
236
320c3978cfab8efb9ef5fc36a91fbaa926021c80
bigcode/the-stack
train
91f6955cc01eeefa3eca8515
train
function
@pytest.mark.filter_policy def test_delete_filter_policy_by_id(api, validator): try: assert is_valid_delete_filter_policy_by_id( validator, delete_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)...
@pytest.mark.filter_policy def test_delete_filter_policy_by_id(api, validator):
try: assert is_valid_delete_filter_policy_by_id( validator, delete_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) rais...
_v3_1_0').validate(obj.response) return True def delete_filter_policy_by_id(api): endpoint_result = api.filter_policy.delete_filter_policy_by_id( id='string' ) return endpoint_result @pytest.mark.filter_policy def test_delete_filter_policy_by_id(api, validator):
64
64
81
16
47
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_delete_filter_policy_by_id
test_delete_filter_policy_by_id
163
173
163
164
0770bd8976deaa7dc47d2c56ac2c060394f6ed52
bigcode/the-stack
train
92eacc85bbd2f9a21c4f5540
train
function
@pytest.mark.filter_policy def test_update_filter_policy_by_id(api, validator): try: assert is_valid_update_filter_policy_by_id( validator, update_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)...
@pytest.mark.filter_policy def test_update_filter_policy_by_id(api, validator):
try: assert is_valid_update_filter_policy_by_id( validator, update_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) rais...
.update_filter_policy_by_id( active_validation=False, domains='string', id='string', payload=None, sgt='string', subnet='string', vn='string' ) return endpoint_result @pytest.mark.filter_policy def test_update_filter_policy_by_id(api, validator):
64
64
81
16
47
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_update_filter_policy_by_id
test_update_filter_policy_by_id
107
117
107
108
4ab15b9f2782dff87e87a5809a3a3ebd11926760
bigcode/the-stack
train
b0a12a98b5ba5b66c2f98622
train
function
def is_valid_get_filter_policy(json_schema_validate, obj): if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_250a599ae00f5e47b9ece23cd3183d1c_v3_1_0').validate(obj.r...
def is_valid_get_filter_policy(json_schema_validate, obj):
if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_250a599ae00f5e47b9ece23cd3183d1c_v3_1_0').validate(obj.response) return True
assert is_valid_delete_filter_policy_by_id( validator, delete_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e def is_valid_get_filter_policy(json_sc...
64
64
95
12
51
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
is_valid_get_filter_policy
is_valid_get_filter_policy
195
203
195
195
d691b2941215bd36eac67c82128cea64a102a118
bigcode/the-stack
train
2a914c657c2ef41c1cda1218
train
function
@pytest.mark.filter_policy def test_get_filter_policy_by_id_default(api, validator): try: assert is_valid_get_filter_policy_by_id( validator, get_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedR...
@pytest.mark.filter_policy def test_get_filter_policy_by_id_default(api, validator):
try: assert is_valid_get_filter_policy_by_id( validator, get_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e
error}".format(error=original_e)) raise original_e def get_filter_policy_by_id_default(api): endpoint_result = api.filter_policy.get_filter_policy_by_id( id='string' ) return endpoint_result @pytest.mark.filter_policy def test_get_filter_policy_by_id_default(api, validator):
64
64
72
17
46
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_get_filter_policy_by_id_default
test_get_filter_policy_by_id_default
71
80
71
72
4f81bf688326e27daa1858205dab29317fe486d9
bigcode/the-stack
train
fd08ed10feef23250b33a84f
train
function
@pytest.mark.filter_policy def test_update_filter_policy_by_id_default(api, validator): try: assert is_valid_update_filter_policy_by_id( validator, update_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, M...
@pytest.mark.filter_policy def test_update_filter_policy_by_id_default(api, validator):
try: assert is_valid_update_filter_policy_by_id( validator, update_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e
api.filter_policy.update_filter_policy_by_id( active_validation=False, id='string', domains=None, payload=None, sgt=None, subnet=None, vn=None ) return endpoint_result @pytest.mark.filter_policy def test_update_filter_policy_by_id_default(api, validator):...
64
64
72
17
46
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_update_filter_policy_by_id_default
test_update_filter_policy_by_id_default
133
142
133
134
7f7af3be5f857a4d8239306d23724ce0e204cace
bigcode/the-stack
train
d9a7793bfc50082a3e9b258b
train
function
def get_filter_policy_by_id_default(api): endpoint_result = api.filter_policy.get_filter_policy_by_id( id='string' ) return endpoint_result
def get_filter_policy_by_id_default(api):
endpoint_result = api.filter_policy.get_filter_policy_by_id( id='string' ) return endpoint_result
_by_id( validator, get_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def get_filter_policy_by_id_default(api):
64
64
34
9
54
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
get_filter_policy_by_id_default
get_filter_policy_by_id_default
64
68
64
64
66073b278955fdcfb4195721865b44acff5e4b5c
bigcode/the-stack
train
8028ae27a4d45e787db40311
train
function
def is_valid_delete_filter_policy_by_id(json_schema_validate, obj): if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_4a83e0d4f56a5c06946f685aa46fa3e3_v3_1_0').valid...
def is_valid_delete_filter_policy_by_id(json_schema_validate, obj):
if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_4a83e0d4f56a5c06946f685aa46fa3e3_v3_1_0').validate(obj.response) return True
is_valid_update_filter_policy_by_id( validator, update_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e def is_valid_delete_filter_policy_by_id(json_schema_...
64
64
100
14
49
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
is_valid_delete_filter_policy_by_id
is_valid_delete_filter_policy_by_id
145
153
145
145
cfe2737a6dd1b7a0928ebf18ed6c9db914acb7e1
bigcode/the-stack
train
72d2a2f6120a1c6000fa1c44
train
function
@pytest.mark.filter_policy def test_create_filter_policy_default(api, validator): try: assert is_valid_create_filter_policy( validator, create_filter_policy_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, T...
@pytest.mark.filter_policy def test_create_filter_policy_default(api, validator):
try: assert is_valid_create_filter_policy( validator, create_filter_policy_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e
_filter_policy_default(api): endpoint_result = api.filter_policy.create_filter_policy( active_validation=False, domains=None, payload=None, sgt=None, subnet=None, vn=None ) return endpoint_result @pytest.mark.filter_policy def test_create_filter_policy_default...
64
64
66
15
48
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_create_filter_policy_default
test_create_filter_policy_default
295
304
295
296
f8496cb824f19d08654ae94e03f67615bee85c5b
bigcode/the-stack
train
6c81e0b7ed4f205936d1859e
train
function
@pytest.mark.filter_policy def test_get_filter_policy_by_id(api, validator): try: assert is_valid_get_filter_policy_by_id( validator, get_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): ...
@pytest.mark.filter_policy def test_get_filter_policy_by_id(api, validator):
try: assert is_valid_get_filter_policy_by_id( validator, get_filter_policy_by_id(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise orig...
_v3_1_0').validate(obj.response) return True def get_filter_policy_by_id(api): endpoint_result = api.filter_policy.get_filter_policy_by_id( id='string' ) return endpoint_result @pytest.mark.filter_policy def test_get_filter_policy_by_id(api, validator):
64
64
81
16
47
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
test_get_filter_policy_by_id
test_get_filter_policy_by_id
51
61
51
52
508314207f39713fa37a630eb9a1e67fc5f3dc64
bigcode/the-stack
train
d97c95ca68053745aeca0c25
train
function
def get_version(api): endpoint_result = api.filter_policy.get_version( ) return endpoint_result
def get_version(api):
endpoint_result = api.filter_policy.get_version( ) return endpoint_result
'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_209810ed6cad570d90243b1e0dbbe27b_v3_1_0').validate(obj.response) return True def get_version(api):
64
64
22
5
58
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
get_version
get_version
318
322
318
318
69475983e865f7886cc4d329858755962a39594e
bigcode/the-stack
train
bd534baf4c1dd90084b57d2c
train
function
def is_valid_update_filter_policy_by_id(json_schema_validate, obj): if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_95d0006cc03d53c89a3593526bf8dc0f_v3_1_0').valid...
def is_valid_update_filter_policy_by_id(json_schema_validate, obj):
if not obj: return False assert hasattr(obj, 'headers') assert hasattr(obj, 'content') assert hasattr(obj, 'text') assert hasattr(obj, 'response') json_schema_validate('jsd_95d0006cc03d53c89a3593526bf8dc0f_v3_1_0').validate(obj.response) return True
is_valid_get_filter_policy_by_id( validator, get_filter_policy_by_id_default(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)): raise original_e def is_valid_update_filter_policy_by_id(json_schema_valida...
64
64
97
14
49
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
is_valid_update_filter_policy_by_id
is_valid_update_filter_policy_by_id
83
91
83
83
f609473acec1e05e59b97cd67f8696784c0f8ef9
bigcode/the-stack
train
710e7b8f02fcf0cfd67508a5
train
function
def create_filter_policy_default(api): endpoint_result = api.filter_policy.create_filter_policy( active_validation=False, domains=None, payload=None, sgt=None, subnet=None, vn=None ) return endpoint_result
def create_filter_policy_default(api):
endpoint_result = api.filter_policy.create_filter_policy( active_validation=False, domains=None, payload=None, sgt=None, subnet=None, vn=None ) return endpoint_result
assert is_valid_create_filter_policy( validator, create_filter_policy(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def create_filt...
64
64
51
7
56
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
create_filter_policy_default
create_filter_policy_default
283
292
283
283
f4c87e8a2fce18fa0b21157882371f12a3c49cec
bigcode/the-stack
train
e110fe86de95007e2c638bb4
train
function
def get_version_default(api): endpoint_result = api.filter_policy.get_version( ) return endpoint_result
def get_version_default(api):
endpoint_result = api.filter_policy.get_version( ) return endpoint_result
try: assert is_valid_get_version( validator, get_version(api) ) except Exception as original_e: with pytest.raises((JsonSchemaException, MalformedRequest)): print("ERROR: {error}".format(error=original_e)) raise original_e def get_version_defa...
64
64
23
6
57
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
get_version_default
get_version_default
338
342
338
338
abce0d0a1e0ffa2539516bc0e1876552a0a8eb59
bigcode/the-stack
train
539e7a75098417af5be4ff23
train
function
def get_filter_policy_by_id(api): endpoint_result = api.filter_policy.get_filter_policy_by_id( id='string' ) return endpoint_result
def get_filter_policy_by_id(api):
endpoint_result = api.filter_policy.get_filter_policy_by_id( id='string' ) return endpoint_result
'text') assert hasattr(obj, 'response') json_schema_validate('jsd_16555f5d5ab6568d8bf5f9932f7ed7f4_v3_1_0').validate(obj.response) return True def get_filter_policy_by_id(api):
64
64
33
8
55
CiscoISE/ciscoisesdk
tests/api/v3_1_0/test_filter_policy.py
Python
get_filter_policy_by_id
get_filter_policy_by_id
44
48
44
44
5c086d150d00be4824b15d42ba2bf5850d86d371
bigcode/the-stack
train
1842792e796cf36e30bb1341
train
class
class ProgMixin(object): def __init__(self,zodiac): global aspcol aspcol = zodiac.get_aspcolors() self.zod = zodiac.zod self.plan = zodiac.plan def prog_nat(self,cr,w,h,chartob): cr.set_source_rgb(1.0,1.0,1.0) cr.rectangle(0,0,w,h) cr.fill() ...
class ProgMixin(object):
def __init__(self,zodiac): global aspcol aspcol = zodiac.get_aspcolors() self.zod = zodiac.zod self.plan = zodiac.plan def prog_nat(self,cr,w,h,chartob): cr.set_source_rgb(1.0,1.0,1.0) cr.rectangle(0,0,w,h) cr.fill() cr.set_line_join(cairo.LI...
# -*- coding: utf-8 -*- import cairo import pango from .. chart import zodnames,planames,aspnames from roundedcharts import NodalChart,SoulChart,LocalChart from .. boss import boss curr = boss.get_state() aspcol = None class ProgMixin(object):
65
256
1,823
5
59
jaratma/astro-nex
astronex/drawing/progsheet.py
Python
ProgMixin
ProgMixin
11
209
11
11
09748163c7a91e90cd81a0bb83df96fd50f34f63
bigcode/the-stack
train
713d4f0deca050fe6ad76c9e
train
function
def importer(name, root_package=False, relative_globals=None, from_packages=[], level=0,): module = None try: module = __import__(name, locals=None, globals=relative_globals, fromlist=[] if root_package else from_packages, ...
def importer(name, root_package=False, relative_globals=None, from_packages=[], level=0,):
module = None try: module = __import__(name, locals=None, globals=relative_globals, fromlist=[] if root_package else from_packages, level=level) except ModuleNotFoundError as e: raise HandlerBuilderImporter...
(built_handler) if url_module: del(url_module) logger.info(f"{len(built_handlers)} URL Handlers were Associated for {len(module_url_defs)} modules.") return built_handlers def importer(name, root_package=False, relative_globals=None, from_packages=[], level=0,):
64
64
88
20
43
DARKMOONlite/Crafty_Controller_Fabric
app/classes/handlerBuilder.py
Python
importer
importer
41
52
41
41
32c612c722a03d3d082aa5eb0afbee278ec71df3
bigcode/the-stack
train
cf18e8d2756d6e68dcd17f08
train
function
def BuildModuleUrls(module_url_defs: list, logger): """Build a handler list for every module passed. Expected input format is a list of module names such as, ``` module_url_lists = [ 'module_name', ] ``` An API path is then constructed according to, global_api_module_prefix/module...
def BuildModuleUrls(module_url_defs: list, logger):
"""Build a handler list for every module passed. Expected input format is a list of module names such as, ``` module_url_lists = [ 'module_name', ] ``` An API path is then constructed according to, global_api_module_prefix/module_name/ It is expected that each module defines a...
def BuildModuleUrls(module_url_defs: list, logger):
12
82
275
12
0
DARKMOONlite/Crafty_Controller_Fabric
app/classes/handlerBuilder.py
Python
BuildModuleUrls
BuildModuleUrls
1
38
1
1
0ddedf74022357b9fe987ba48b09139cc71fcdcf
bigcode/the-stack
train
7f0cdab00e0302b75159fca4
train
class
class HandlerBuilderImporterError(Exception): '''Raise when importing modules for the handler builder throws underlying errors.''' def __init__(self, original_error, module_name): self.original_error = original_error self.module_name = module_name super().__init__(self.module_name) ...
class HandlerBuilderImporterError(Exception):
'''Raise when importing modules for the handler builder throws underlying errors.''' def __init__(self, original_error, module_name): self.original_error = original_error self.module_name = module_name super().__init__(self.module_name) def __str__(self): return f"Attempted...
__import__(name, locals=None, globals=relative_globals, fromlist=[] if root_package else from_packages, level=level) except ModuleNotFoundError as e: raise HandlerBuilderImporterError(e, name) finally: return m...
64
64
102
7
56
DARKMOONlite/Crafty_Controller_Fabric
app/classes/handlerBuilder.py
Python
HandlerBuilderImporterError
HandlerBuilderImporterError
54
63
54
54
ac38ccbc143f1f1e5a2227dc9237c31c938641eb
bigcode/the-stack
train
bb52e63ad40d71769d18e87a
train
function
async def loop(task_status=trio.TASK_STATUS_IGNORED) -> None: journal_path = (await trio.Path.home()).joinpath( 'Saved Games/Frontier Developments/Elite Dangerous' ) journal = _Journal() await journal.find_initial_log(journal_path) awatch = watchgod.awatch(journal_path, watcher_cls=_Journ...
async def loop(task_status=trio.TASK_STATUS_IGNORED) -> None:
journal_path = (await trio.Path.home()).joinpath( 'Saved Games/Frontier Developments/Elite Dangerous' ) journal = _Journal() await journal.find_initial_log(journal_path) awatch = watchgod.awatch(journal_path, watcher_cls=_JournalWatcher, debounce=500, normal_sl...
: watch_map[path].send_nowait(...) if data_affected and log_affected: await trio.sleep(0) if log_affected: log_endpoint.send_nowait(log_affected.path) async def loop(task_status=trio.TASK_STATUS_IGNORED) -> None:
64
64
167
19
45
blubberdiblub/ContinuED
src/continued/journal.py
Python
loop
loop
548
568
548
549
9fcf9f2ad662d8ce2138ae94e55385b1dbc66f1d
bigcode/the-stack
train
202035da03c3c4a96655f417
train
class
class _DataFile: event_name: str path: trio.Path updated: trio.Condition _event_cls: Type[_events.LogEvent] _buffer: Deque[_events.Event] _decoder: json.JSONDecoder def __init__(self, event_cls: Type[_events.LogEvent], path: trio.Path, backlog: int = 10) -> None: ...
class _DataFile:
event_name: str path: trio.Path updated: trio.Condition _event_cls: Type[_events.LogEvent] _buffer: Deque[_events.Event] _decoder: json.JSONDecoder def __init__(self, event_cls: Type[_events.LogEvent], path: trio.Path, backlog: int = 10) -> None: self._event_cls =...
_enrich_event(self, data_file: '_DataFile', event: _events.LogEvent) -> _events.LogEvent: with trio.move_on_after(10): candidate = await self._wait_data_file(data_file, event._timestamp) if candidate._timestamp == event._timestamp: return can...
223
223
745
5
217
blubberdiblub/ContinuED
src/continued/journal.py
Python
_DataFile
_DataFile
352
476
352
353
0ffc6f2cd0a82a1913cc80d8fc8656fd9f4fb5ca
bigcode/the-stack
train
5379bf46cdf413ad13b1d385
train
class
@total_ordering class _LogFile: @dataclasses.dataclass(order=True, frozen=True) class NameData: year: int month: int day: int hour: int minute: int second: int part: int = 1 tag: str = '' suffix: str = '' def replace(self, **kwarg...
@total_ordering class _LogFile: @dataclasses.dataclass(order=True, frozen=True)
class NameData: year: int month: int day: int hour: int minute: int second: int part: int = 1 tag: str = '' suffix: str = '' def replace(self, **kwargs) -> '_LogFile.NameData': return dataclasses.replace(self, **kwargs) ...
_Logger(__name__) EventMap = ContextVar('event_map') class _JournalWatcher(watchgod.watcher.AllWatcher): def __init__(self, root_path: trio.Path) -> None: super().__init__(pathlib.Path(root_path)) def _walk(self, path: str, changes: Set['watchgod.watcher.FileChange'], new_files: Di...
250
250
836
22
228
blubberdiblub/ContinuED
src/continued/journal.py
Python
_LogFile
_LogFile
64
178
64
67
9007ebc5e6d26615533527fe685d52a38e756b4d
bigcode/the-stack
train
94be2f6c87d91536c79ceb21
train
function
async def watch_journal( awatch: watchgod.awatch, watch_map: dict[trio.Path, trio.MemorySendChannel], log_endpoint: trio.MemorySendChannel, ) -> None: async for changes in trio_asyncio.aio_as_trio(awatch): changed = {trio.Path(path) for change, path in changes if...
async def watch_journal( awatch: watchgod.awatch, watch_map: dict[trio.Path, trio.MemorySendChannel], log_endpoint: trio.MemorySendChannel, ) -> None:
async for changes in trio_asyncio.aio_as_trio(awatch): changed = {trio.Path(path) for change, path in changes if change != watchgod.Change.deleted} if not changed: continue data_affected = changed.intersection(watch_map) log_affected = max(filter( ...
(100) nursery.start_soon(journal.async_loop, recv_endpoint) return send_endpoint async def watch_journal( awatch: watchgod.awatch, watch_map: dict[trio.Path, trio.MemorySendChannel], log_endpoint: trio.MemorySendChannel, ) -> None:
64
64
201
43
20
blubberdiblub/ContinuED
src/continued/journal.py
Python
watch_journal
watch_journal
518
545
518
523
005d7e3b38a775af70afe1ba577388f128efa7ff
bigcode/the-stack
train
aea7abb2ba545726be1c7a12
train
class
class _JournalWatcher(watchgod.watcher.AllWatcher): def __init__(self, root_path: trio.Path) -> None: super().__init__(pathlib.Path(root_path)) def _walk(self, path: str, changes: Set['watchgod.watcher.FileChange'], new_files: Dict[str, float]) -> None: for entry in os.scandir(...
class _JournalWatcher(watchgod.watcher.AllWatcher):
def __init__(self, root_path: trio.Path) -> None: super().__init__(pathlib.Path(root_path)) def _walk(self, path: str, changes: Set['watchgod.watcher.FileChange'], new_files: Dict[str, float]) -> None: for entry in os.scandir(path): if entry.is_dir(): ...
import watchgod from . import ( events as _events, data as _data, types as _types, ) from .logging import Logger as _Logger _log = _Logger(__name__) EventMap = ContextVar('event_map') class _JournalWatcher(watchgod.watcher.AllWatcher):
64
64
214
12
52
blubberdiblub/ContinuED
src/continued/journal.py
Python
_JournalWatcher
_JournalWatcher
34
61
34
35
047a6a9a352bb1cb45df2c666a1eb564cf08f92e
bigcode/the-stack
train
caa0b624144ee5c2ec22e722
train
function
def spawn_json_tasks( nursery: trio.Nursery, journal_path: trio.Path ) -> dict[trio.Path, trio.MemorySendChannel]: watch_map = {} event_map = {} for event_cls, file_name in [ (_events.Cargo, 'Cargo.json'), (_events.Market, 'Market.json'), (_events.ModuleInfo, 'ModulesInfo.j...
def spawn_json_tasks( nursery: trio.Nursery, journal_path: trio.Path ) -> dict[trio.Path, trio.MemorySendChannel]:
watch_map = {} event_map = {} for event_cls, file_name in [ (_events.Cargo, 'Cargo.json'), (_events.Market, 'Market.json'), (_events.ModuleInfo, 'ModulesInfo.json'), (_events.NavRoute, 'NavRoute.json'), (_events.Outfitting, 'Outfitting.json'), (_events.Shipya...
_log.exception(str(exc)) else: async with self.updated: self.enqueue(event) self.updated.notify_all() await file_modified.receive() def spawn_json_tasks( nursery: trio.Nursery, journal_path: trio.Path ) -> dic...
64
64
208
32
32
blubberdiblub/ContinuED
src/continued/journal.py
Python
spawn_json_tasks
spawn_json_tasks
479
505
479
482
cb4db3cba0c6e7c997b15608c619a42cd7017b0e
bigcode/the-stack
train
789a395295efed61684741c8
train
function
def spawn_log_task( nursery: trio.Nursery, journal: _Journal ) -> trio.MemorySendChannel: send_endpoint, recv_endpoint = trio.open_memory_channel(100) nursery.start_soon(journal.async_loop, recv_endpoint) return send_endpoint
def spawn_log_task( nursery: trio.Nursery, journal: _Journal ) -> trio.MemorySendChannel:
send_endpoint, recv_endpoint = trio.open_memory_channel(100) nursery.start_soon(journal.async_loop, recv_endpoint) return send_endpoint
, recv_endpoint) watch_map[data_file.path] = send_endpoint event_map[data_file.event_name] = data_file EventMap.set(event_map) return watch_map def spawn_log_task( nursery: trio.Nursery, journal: _Journal ) -> trio.MemorySendChannel:
64
64
57
25
38
blubberdiblub/ContinuED
src/continued/journal.py
Python
spawn_log_task
spawn_log_task
508
515
508
511
5a45dbb27a584936214220c0f53c388d85bd5a76
bigcode/the-stack
train
c2289753f7a55fe83be880f5
train
class
class _Journal: _decoder: json.JSONDecoder log_file: Optional[_LogFile] timestamp: Optional[_types.DateTime] part: Optional[int] language: Optional[str] game_version = Optional[str] build = Optional[str] def __init__(self) -> None: self._decoder = json.JSONDecoder(strict=Tru...
class _Journal:
_decoder: json.JSONDecoder log_file: Optional[_LogFile] timestamp: Optional[_types.DateTime] part: Optional[int] language: Optional[str] game_version = Optional[str] build = Optional[str] def __init__(self) -> None: self._decoder = json.JSONDecoder(strict=True) self....
= None def __repr__(self) -> str: cls = type(self) return f"{cls.__name__}({self.path!r})" def __bool__(self) -> bool: return self.name_data is not None def __eq__(self, other) -> bool: if not isinstance(other, type(self)): return NotImplemented re...
256
256
1,025
4
252
blubberdiblub/ContinuED
src/continued/journal.py
Python
_Journal
_Journal
181
349
181
182
a98e4d4c35c1c146cadf4214159b05ed82e81dae
bigcode/the-stack
train
5c5445c47318905d76b6b5af
train
function
def upgrade(migrate_engine): print(__doc__) metadata.bind = migrate_engine metadata.reflect() # Initialize. if migrate_engine.name == "mysql" or migrate_engine.name == "sqlite": default_false = "0" elif migrate_engine.name in ["postgresql", "postgres"]: default_false = "false" ...
def upgrade(migrate_engine):
print(__doc__) metadata.bind = migrate_engine metadata.reflect() # Initialize. if migrate_engine.name == "mysql" or migrate_engine.name == "sqlite": default_false = "0" elif migrate_engine.name in ["postgresql", "postgres"]: default_false = "false" try: RepositoryMet...
Column, MetaData, Table, ) from sqlalchemy.exc import NoSuchTableError # Need our custom types, but don't import anything else from model from galaxy.model.custom_types import JSONType log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) handler = logging.StreamHandler(sys.stdout) format = "%(name)s...
111
111
373
6
105
beatrizserrano/galaxy
lib/tool_shed/webapp/model/migrate/versions/0018_add_repository_metadata_flag_columns.py
Python
upgrade
upgrade
31
71
31
31
0176af87bc8367e6fe83e85b20acff71290145bd
bigcode/the-stack
train
2329b629fa167c7e4b48b57b
train
function
def downgrade(migrate_engine): metadata.bind = migrate_engine metadata.reflect() # Drop missing_test_components and tool_test_results from the repository_metadata table and add tool_test_errors to the repository_metadata table. RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=T...
def downgrade(migrate_engine):
metadata.bind = migrate_engine metadata.reflect() # Drop missing_test_components and tool_test_results from the repository_metadata table and add tool_test_errors to the repository_metadata table. RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True) # Drop the missing_te...
="ix_repository_metadata_mtc") assert c is RepositoryMetadata_table.c.missing_test_components migrate_engine.execute(f"UPDATE repository_metadata SET missing_test_components={default_false}") except Exception: log.exception("Adding missing_test_components column to the reposi...
63
64
213
6
57
beatrizserrano/galaxy
lib/tool_shed/webapp/model/migrate/versions/0018_add_repository_metadata_flag_columns.py
Python
downgrade
downgrade
74
98
74
74
c5d53b0110450bf8b6c5e147b748bee675f5a25d
bigcode/the-stack
train
4772cefaa30a36808ff053e2
train
class
class SQL(Engine): """ """ __metaclass__ = abc.ABCMeta def __exit__(self, exc_type, exc_value, traceback): if exc_type is None: try: self._conn.commit() except Exception as e: self._conn.rollback() raise e else: ...
class SQL(Engine):
""" """ __metaclass__ = abc.ABCMeta def __exit__(self, exc_type, exc_value, traceback): if exc_type is None: try: self._conn.commit() except Exception as e: self._conn.rollback() raise e else: self._con...
import abc from ..base import Engine class SQL(Engine):
14
123
411
5
8
fossabot/vial
vial/db/sql/base.py
Python
SQL
SQL
6
69
6
6
c34b89a5bd20563c2c67baa9735c9bd4e0500c46
bigcode/the-stack
train
ec72e12a88964eb715fb487e
train
class
class Solution: def uniqueMorseRepresentations(self, words: List[str]) -> int: morse = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] return_set = [] for word in words: ...
class Solution:
def uniqueMorseRepresentations(self, words: List[str]) -> int: morse = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] return_set = [] for word in words: s = "" ...
Explanation: The transformation of each word is: "gin" -> "--...-." "zen" -> "--...-." "gig" -> "--...--." "msg" -> "--...--." There are 2 different transformations, "--...-." and "--...--.". ''' class Solution:
64
64
138
3
61
vanigupta20024/Programming-Challenges
UniqueMorseCode.py
Python
Solution
Solution
20
29
20
20
67b38392e0bdef1bdcd041a0fd219197e121110e
bigcode/the-stack
train
fe3124a79fd9a342e066ff47
train
function
def a_descriptive_name(optional_arguments): """A documentation string.""" # Your function's code goes here. # Your function's code goes here. # Your function's code goes here. return optional_value
def a_descriptive_name(optional_arguments):
"""A documentation string.""" # Your function's code goes here. # Your function's code goes here. # Your function's code goes here. return optional_value
def a_descriptive_name(optional_arguments):
8
64
49
8
0
grahovsky/python-edu
code-example/ch04/function_template.py
Python
a_descriptive_name
a_descriptive_name
2
7
2
2
531424d9fd53d8f63339140daf517af03e23a8f9
bigcode/the-stack
train
abcf8e7f873ad254de16a78e
train
function
def generate_label_q_cifar(): path = 'D:/Experiment Datasets/Image Datasets/CIFAR-FS/' train_data_path = path + 'CIFAR_FS_train.pickle' with open(train_data_path, 'rb') as fp: train_data = pickle.load(fp, encoding='bytes') train_labels = train_data[b'labels'] train_labels = np.un...
def generate_label_q_cifar():
path = 'D:/Experiment Datasets/Image Datasets/CIFAR-FS/' train_data_path = path + 'CIFAR_FS_train.pickle' with open(train_data_path, 'rb') as fp: train_data = pickle.load(fp, encoding='bytes') train_labels = train_data[b'labels'] train_labels = np.unique(np.array(train_labels)) ...
# -*- coding: utf-8 -*- """ @Author: Su Lu @Date: 2021-06-08 16:16:42 """ import pickle import numpy as np def generate_label_q_cifar():
49
76
254
7
41
njulus/GKD
utils/split_class.py
Python
generate_label_q_cifar
generate_label_q_cifar
11
34
11
11
ae00b34ac774ae0d4d68508389cb21d5a35cde07
bigcode/the-stack
train
d089bd20b2953639bc430884
train
function
def generate_label_q_cub(): dataset_path = '../datasets/CUB-200/' train_data_file_path = dataset_path + 'train' with open(train_data_file_path, 'rb') as fp: train_data = pickle.load(fp, encoding='bytes') labels = train_data['labels'] labels = np.array(labels) n_classes = np....
def generate_label_q_cub():
dataset_path = '../datasets/CUB-200/' train_data_file_path = dataset_path + 'train' with open(train_data_file_path, 'rb') as fp: train_data = pickle.load(fp, encoding='bytes') labels = train_data['labels'] labels = np.array(labels) n_classes = np.max(labels) + 1 labe...
_data[b'labels'] test_labels = np.unique(np.array(test_labels)) label_q = np.concatenate([train_labels, val_labels, test_labels]) # print(label_q) np.save('../datasets/CIFAR-100/label_q.npy', label_q) def generate_label_q_cub():
63
64
113
7
56
njulus/GKD
utils/split_class.py
Python
generate_label_q_cub
generate_label_q_cub
38
49
38
38
0b9ff81afeb048db7387842041b6deb505e1f7ec
bigcode/the-stack
train
a85af732e357426319551b36
train
class
class Initializer(six.with_metaclass(SharedDocsABCMeta)): """ Base class for parameter initialization. Methods ------- sample(shape) Returns tensor with specified shape. """ inherit_method_docs = True @abc.abstractmethod def sample(self, shape): """ Returns ...
class Initializer(six.with_metaclass(SharedDocsABCMeta)):
""" Base class for parameter initialization. Methods ------- sample(shape) Returns tensor with specified shape. """ inherit_method_docs = True @abc.abstractmethod def sample(self, shape): """ Returns tensor with specified shape. Parameters -...
return fan_in, fan_out def classname(instance): """ Returns instance class name. Parameters ---------- instance : object Returns ------- str """ return instance.__class__.__name__ class Initializer(six.with_metaclass(SharedDocsABCMeta)):
63
64
195
14
49
vishalbelsare/neupy
neupy/init.py
Python
Initializer
Initializer
60
98
60
60
2eacfe59abb4fdf7599eca41a2216b22155e8a5c
bigcode/the-stack
train
16f2772048b2156f45933713
train
class
class Orthogonal(Initializer): """ Initialize matrix with orthogonal basis. Parameters ---------- scale : int, float Scales output matrix by a specified factor. Defaults to ``1``. Raises ------ ValueError In case if tensor shape has more than 2 dimension...
class Orthogonal(Initializer):
""" Initialize matrix with orthogonal basis. Parameters ---------- scale : int, float Scales output matrix by a specified factor. Defaults to ``1``. Raises ------ ValueError In case if tensor shape has more than 2 dimensions. Methods ------- ...
def sample(self, shape): minval, maxval = self.minval, self.maxval return np.random.random(shape) * (maxval - minval) + minval def __repr__(self): return '{}({}, {})'.format(classname(self), self.minval, self.maxval) class Orthogonal(Initializer):
75
75
253
6
69
vishalbelsare/neupy
neupy/init.py
Python
Orthogonal
Orthogonal
184
226
184
184
652ccd9e2dbdcfc95a1abe99f1bdd7f96a81dfa0
bigcode/the-stack
train
eb74abbc23d4b3ac2ed2b1f2
train
class
class Normal(Initializer): """ Initialize parameter sampling from the normal distribution. Parameters ---------- mean : int, float Mean of the normal distribution. std : int, float Standard deviation of the normal distribution. Methods ------- {Initializer.Meth...
class Normal(Initializer):
""" Initialize parameter sampling from the normal distribution. Parameters ---------- mean : int, float Mean of the normal distribution. std : int, float Standard deviation of the normal distribution. Methods ------- {Initializer.Methods} """ def __init...
s} """ def __init__(self, value=0): self.value = value def sample(self, shape): return np.ones(shape) * self.value def __repr__(self): return '{}({})'.format(classname(self), self.value) class Normal(Initializer):
64
64
147
5
59
vishalbelsare/neupy
neupy/init.py
Python
Normal
Normal
125
151
125
125
01f3d5776b654c208a7bbd1cb9b01ced78ce49b1
bigcode/the-stack
train
05b7b355509b3f9178651955
train
function
def identify_fans(shape): """ Identify fans from shape. Parameters ---------- shape : tuple or list Matrix shape. Returns ------- tuple Tuple that contains :math:`fan_{in}` and :math:`fan_{out}`. """ fan_in = shape[0] output_feature_shape = shape[1:] if...
def identify_fans(shape):
""" Identify fans from shape. Parameters ---------- shape : tuple or list Matrix shape. Returns ------- tuple Tuple that contains :math:`fan_{in}` and :math:`fan_{out}`. """ fan_in = shape[0] output_feature_shape = shape[1:] if output_feature_shape: ...
__all__ = ('Initializer', 'Constant', 'Normal', 'Uniform', 'Orthogonal', 'HeNormal', 'HeUniform', 'XavierNormal', 'XavierUniform') class UninitializedException(Exception): """ Exception for uninitialized parameters. """ def identify_fans(shape):
63
64
115
6
57
vishalbelsare/neupy
neupy/init.py
Python
identify_fans
identify_fans
20
42
20
20
1aa52fa7e6db00a4d0c7101d8d8ac286659a6e56
bigcode/the-stack
train
6a9a320bb3a3ca17c35e7aa2
train
class
class XavierNormal(InitializerWithGain): """ Xavier Glorot parameter initialization method based on normal distribution. Parameters ---------- {InitializerWithGain.Parameters} Methods ------- {Initializer.Methods} References ---------- [1] Xavier Glorot, Y Bengio. Unde...
class XavierNormal(InitializerWithGain):
""" Xavier Glorot parameter initialization method based on normal distribution. Parameters ---------- {InitializerWithGain.Parameters} Methods ------- {Initializer.Methods} References ---------- [1] Xavier Glorot, Y Bengio. Understanding the difficulty of train...
, _ = identify_fans(shape) variance = 6. / fan_in abs_max_value = self.gain * np.sqrt(variance) uniform = Uniform(minval=-abs_max_value, maxval=abs_max_value) return uniform.sample(shape) class XavierNormal(InitializerWithGain):
64
64
147
8
56
vishalbelsare/neupy
neupy/init.py
Python
XavierNormal
XavierNormal
302
324
302
302
1d983b6754feea70027af7b7465fae93c2227bb0
bigcode/the-stack
train
7e9be2409cac82cad2e24ec6
train
function
def classname(instance): """ Returns instance class name. Parameters ---------- instance : object Returns ------- str """ return instance.__class__.__name__
def classname(instance):
""" Returns instance class name. Parameters ---------- instance : object Returns ------- str """ return instance.__class__.__name__
out}`. """ fan_in = shape[0] output_feature_shape = shape[1:] if output_feature_shape: fan_out = np.prod(output_feature_shape).item(0) else: fan_out = 1 return fan_in, fan_out def classname(instance):
64
64
40
4
59
vishalbelsare/neupy
neupy/init.py
Python
classname
classname
45
57
45
45
2b8baafc32f578682509581595157443f6676640
bigcode/the-stack
train
2831df35766324e4ab28c683
train
class
class HeNormal(InitializerWithGain): """ Kaiming He parameter initialization method based on the normal distribution. Parameters ---------- {InitializerWithGain.Parameters} Methods ------- {Initializer.Methods} References ---------- [1] Kaiming He, Xiangyu Zhan, Shaoqi...
class HeNormal(InitializerWithGain):
""" Kaiming He parameter initialization method based on the normal distribution. Parameters ---------- {InitializerWithGain.Parameters} Methods ------- {Initializer.Methods} References ---------- [1] Kaiming He, Xiangyu Zhan, Shaoqing Ren, Jian Sun. Delving Dee...
Defaults to ``1``. """ def __init__(self, gain=1.0): if gain == 'relu': gain = math.sqrt(2) self.gain = gain super(InitializerWithGain, self).__init__() class HeNormal(InitializerWithGain):
63
64
160
8
56
vishalbelsare/neupy
neupy/init.py
Python
HeNormal
HeNormal
248
271
248
248
f41f10a3f11bbd479a181e9007fcca7d36fcea05
bigcode/the-stack
train
cdbb2a296f01d9d34a6e3d2f
train
class
class InitializerWithGain(Initializer): """ Initialization class that has gain property Parameters ---------- gain : float or {{``relu``}} Multiplies scaling factor by speified gain. The ``relu`` values set up gain equal to :math:`\\sqrt{{2}}`. Defaults to ``1``. """ ...
class InitializerWithGain(Initializer):
""" Initialization class that has gain property Parameters ---------- gain : float or {{``relu``}} Multiplies scaling factor by speified gain. The ``relu`` values set up gain equal to :math:`\\sqrt{{2}}`. Defaults to ``1``. """ def __init__(self, gain=1.0): i...
=False) ortho_base = u if nrows > ncols else v return self.scale * ortho_base[:nrows, :ncols] def __repr__(self): return '{}(scale={})'.format(classname(self), self.scale) class InitializerWithGain(Initializer):
64
64
119
8
56
vishalbelsare/neupy
neupy/init.py
Python
InitializerWithGain
InitializerWithGain
229
245
229
229
1614dbaed77145bc8dc5602d72da31f3cf6719fe
bigcode/the-stack
train
03cced94a63762f73c4fdcc5
train
class
class UninitializedException(Exception): """ Exception for uninitialized parameters. """
class UninitializedException(Exception):
""" Exception for uninitialized parameters. """
import six import numpy as np from neupy.core.docs import SharedDocsABCMeta __all__ = ('Initializer', 'Constant', 'Normal', 'Uniform', 'Orthogonal', 'HeNormal', 'HeUniform', 'XavierNormal', 'XavierUniform') class UninitializedException(Exception):
64
64
17
6
58
vishalbelsare/neupy
neupy/init.py
Python
UninitializedException
UninitializedException
14
17
14
14
aec490869b3426ebf5ab81ed2795fd4b9cd70aa9
bigcode/the-stack
train
5cf6f15b2a2b9023474e0135
train
class
class HeUniform(InitializerWithGain): """ Kaiming He parameter initialization method based on the uniformal distribution. Parameters ---------- {InitializerWithGain.Parameters} Methods ------- {Initializer.Methods} References ---------- [1] Kaiming He, Xiangyu Zhan, Sh...
class HeUniform(InitializerWithGain):
""" Kaiming He parameter initialization method based on the uniformal distribution. Parameters ---------- {InitializerWithGain.Parameters} Methods ------- {Initializer.Methods} References ---------- [1] Kaiming He, Xiangyu Zhan, Shaoqing Ren, Jian Sun. Delving ...
def sample(self, shape): fan_in, _ = identify_fans(shape) variance = 2. / fan_in std = self.gain * np.sqrt(variance) return np.random.normal(loc=0, scale=std, size=shape) class HeUniform(InitializerWithGain):
64
64
171
8
56
vishalbelsare/neupy
neupy/init.py
Python
HeUniform
HeUniform
274
299
274
274
082d9a34a1b2f08f6038d69ffe50fa36fb02f701
bigcode/the-stack
train
ac8543a3de0eb6f4fd3b2603
train
class
class Uniform(Initializer): """ Initialize parameter sampling from the uniformal distribution. Parameters ---------- minval : int, float Minimum possible value. maxval : int, float Maximum possible value. Methods ------- {Initializer.Methods} """ def __...
class Uniform(Initializer):
""" Initialize parameter sampling from the uniformal distribution. Parameters ---------- minval : int, float Minimum possible value. maxval : int, float Maximum possible value. Methods ------- {Initializer.Methods} """ def __init__(self, minval=0, maxva...
self.std = std def sample(self, shape): return np.random.normal(loc=self.mean, scale=self.std, size=shape) def __repr__(self): return '{}(mean={}, std={})'.format(classname(self), self.mean, self.std) class Uniform(Initializer):
64
64
165
5
59
vishalbelsare/neupy
neupy/init.py
Python
Uniform
Uniform
154
181
154
154
67db1e4c5d6004ed55587782d60429c8115dff2e
bigcode/the-stack
train
a29dfb2344cfca4a7d4a432e
train
class
class XavierUniform(InitializerWithGain): """ Xavier Glorot parameter initialization method based on uniform distribution. Methods ------- {Initializer.Methods} References ---------- [1] Xavier Glorot, Y Bengio. Understanding the difficulty of training deep feedforward neur...
class XavierUniform(InitializerWithGain):
""" Xavier Glorot parameter initialization method based on uniform distribution. Methods ------- {Initializer.Methods} References ---------- [1] Xavier Glorot, Y Bengio. Understanding the difficulty of training deep feedforward neural networks, 2010. """ def sample(...
): fan_in, fan_out = identify_fans(shape) variance = 2. / (fan_in + fan_out) std = self.gain * np.sqrt(variance) return np.random.normal(loc=0, scale=std, size=shape) class XavierUniform(InitializerWithGain):
64
64
144
8
56
vishalbelsare/neupy
neupy/init.py
Python
XavierUniform
XavierUniform
327
347
327
327
62a7a453502e3ddc790500b9929991d32829c0e8
bigcode/the-stack
train
b8cc9cbbbfe416aca302906f
train
class
class Constant(Initializer): """ Initialize parameter that has constant values. Parameters ---------- value : float, int All parameters in the tensor will be equal to this value. Defaults to ``0``. Methods ------- {Initializer.Methods} """ def __init__(self, val...
class Constant(Initializer):
""" Initialize parameter that has constant values. Parameters ---------- value : float, int All parameters in the tensor will be equal to this value. Defaults to ``0``. Methods ------- {Initializer.Methods} """ def __init__(self, value=0): self.value = v...
to generate understandable message when user try to get value from the uninitialized parameter. """ raise UninitializedException("Cannot get parameter value. " "Parameter hasn't been initialized yet.") def __repr__(self): return '{}()'.f...
64
64
115
5
59
vishalbelsare/neupy
neupy/init.py
Python
Constant
Constant
101
122
101
101
1e827711dfd1f3abac4400882e71101efe4367cf
bigcode/the-stack
train
fec57867e315255e3a3a4acf
train
class
class ApiKey(db.Model): __tablename__ = 'api_keys' api_key = Column('api_key', VARCHAR(20), primary_key=True) created_at = Column('created_at', TIMESTAMP(0), nullable=False) updated_at = Column('updated_at', TIMESTAMP(0), nullable=False) expired_at = Column('expired_at', TIMESTAMP(0), nullable=Fals...
class ApiKey(db.Model):
__tablename__ = 'api_keys' api_key = Column('api_key', VARCHAR(20), primary_key=True) created_at = Column('created_at', TIMESTAMP(0), nullable=False) updated_at = Column('updated_at', TIMESTAMP(0), nullable=False) expired_at = Column('expired_at', TIMESTAMP(0), nullable=False) user = relationsh...
=False, user_id=uuid.uuid4()): self.user_id = user_id self.username = username self.email = email self.phone_number = phone_number self.pswd_hash = generate_password_hash(password) self.is_admin = is_admin self.is_super = is_super def __repr__(self): ...
126
126
420
6
119
fernandoleira/lps-platform
lps/models.py
Python
ApiKey
ApiKey
48
99
48
48
265df0f6d9a20e1e821371841bc999c0e4975386
bigcode/the-stack
train
fee197c9a11f99de0e2a403c
train
class
class User(db.Model, UserMixin): __tablename__ = 'users' user_id = Column('user_id', UUID(as_uuid=True), primary_key=True) username = Column('username', VARCHAR(50), nullable=False, unique=True) phone_number = Column('phone_number', VARCHAR(11)) email = Column('email', VARCHAR(50), nullable=False, ...
class User(db.Model, UserMixin):
__tablename__ = 'users' user_id = Column('user_id', UUID(as_uuid=True), primary_key=True) username = Column('username', VARCHAR(50), nullable=False, unique=True) phone_number = Column('phone_number', VARCHAR(11)) email = Column('email', VARCHAR(50), nullable=False, unique=True) pswd_hash = Colu...
import relativedelta from sqlalchemy import Column, Integer, FLOAT, String, TEXT, VARCHAR, BOOLEAN, TIMESTAMP, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.dialects.postgresql import UUID from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash i...
85
85
284
8
76
fernandoleira/lps-platform
lps/models.py
Python
User
User
15
44
15
15
82f2a0308a38e1de17a67f390144a4a06b1a3fb4
bigcode/the-stack
train
50ef40f726fcfb36960a8f43
train
class
class LocatorPoint(db.Model): __tablename__ = 'locator_points' point_id = Column('point_id', UUID(as_uuid=True), primary_key=True) title = Column('title', VARCHAR(50), nullable=False) description = Column('description', TEXT) point_type = Column('point_type', VARCHAR(50), nullable=False) lat = ...
class LocatorPoint(db.Model):
__tablename__ = 'locator_points' point_id = Column('point_id', UUID(as_uuid=True), primary_key=True) title = Column('title', VARCHAR(50), nullable=False) description = Column('description', TEXT) point_type = Column('point_type', VARCHAR(50), nullable=False) lat = Column('lat', FLOAT, nullable=...
_sms, unit_id=uuid.uuid4()): self.unit_id = unit_id self.name = name self.alert_mail = alert_mail self.alert_sms = alert_sms self.user_id = user_id def __repr__(self): return '<unit {unit_id}>'.format(unit_id=self.unit_id) # Locator Point class class LocatorPoint(d...
81
81
272
6
74
fernandoleira/lps-platform
lps/models.py
Python
LocatorPoint
LocatorPoint
126
153
126
126
0caf086e9f233f09dd413a4da9885d3000b7b446
bigcode/the-stack
train
84f9d158011fb5e24cafbe50
train
class
class Unit(db.Model): __tablename__ = 'units' unit_id = Column('unit_id', UUID(as_uuid=True), primary_key=True) name = Column('name', VARCHAR(50), nullable=False, unique=True) alert_mail = Column('alert_mail', BOOLEAN) alert_sms = Column('alert_sms', BOOLEAN) user = relationship('User', back_po...
class Unit(db.Model):
__tablename__ = 'units' unit_id = Column('unit_id', UUID(as_uuid=True), primary_key=True) name = Column('name', VARCHAR(50), nullable=False, unique=True) alert_mail = Column('alert_mail', BOOLEAN) alert_sms = Column('alert_sms', BOOLEAN) user = relationship('User', back_populates='units') u...
ts): expired_date = datetime.fromtimestamp(ts) + relativedelta(months=+3) return expired_date def update_api_expiration(self): self.updated_at = datetime.now().timestamp() self._get_expiration_timestamp(self.updated_at) # Unit class class Unit(db.Model):
64
64
208
5
58
fernandoleira/lps-platform
lps/models.py
Python
Unit
Unit
103
122
103
103
af49812787fc1c6533207f4381e875d5e748d05c
bigcode/the-stack
train
876f0872869f51fd2127a832
train
function
def extractPossibleDate(bsouparsedHTML): # bsouparsedHTML = BeautifulSoup(parsedHTML, 'html.parser') possibleDate = _extractFromLDJson(bsouparsedHTML) if possibleDate is None: possibleDate = _extractFromMeta(bsouparsedHTML) if possibleDate is None: possibleDate = _extractFromHTMLTag(bsou...
def extractPossibleDate(bsouparsedHTML): # bsouparsedHTML = BeautifulSoup(parsedHTML, 'html.parser')
possibleDate = _extractFromLDJson(bsouparsedHTML) if possibleDate is None: possibleDate = _extractFromMeta(bsouparsedHTML) if possibleDate is None: possibleDate = _extractFromHTMLTag(bsouparsedHTML) return possibleDate
) articleDate = possibleDate except Exception as e: print("Exception in extractArticlePublishedDate for " + articleLink) print(e.args) return articleDate def extractPossibleDate(bsouparsedHTML): # bsouparsedHTML = BeautifulSoup(parsedHTML, 'html.parser')
64
64
85
25
38
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
extractPossibleDate
extractPossibleDate
247
254
247
248
e5d9f2c75b9d6061f81fca7aa60f9f5d725dbaa6
bigcode/the-stack
train
0d5be5081b5af8a4563e0a00
train
function
def _extractFromURL(url): # Regex by Newspaper3k - https://github.com/codelucas/newspaper/blob/master/newspaper/urls.py m = re.search( r"([\./\-_]{0,1}(19|20)\d{2})[\./\-_]{0,1}(([0-3]{0,1}[0-9][\./\-_])|(\w{3,5}[\./\-_]))([0-3]{0,1}[0-9][\./\-]{0,1})?", url, ) if m: return par...
def _extractFromURL(url): # Regex by Newspaper3k - https://github.com/codelucas/newspaper/blob/master/newspaper/urls.py
m = re.search( r"([\./\-_]{0,1}(19|20)\d{2})[\./\-_]{0,1}(([0-3]{0,1}[0-9][\./\-_])|(\w{3,5}[\./\-_]))([0-3]{0,1}[0-9][\./\-]{0,1})?", url, ) if m: return parseStrDate(m.group(0)) return None
return dateTimeObj except: return None # Try to extract from the article URL - simple but might work as a fallback def _extractFromURL(url): # Regex by Newspaper3k - https://github.com/codelucas/newspaper/blob/master/newspaper/urls.py
64
64
145
34
29
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
_extractFromURL
_extractFromURL
16
26
16
18
eef0c153ea237d2143122c58520a3a9d53d58c85
bigcode/the-stack
train
ede7bd6336bec351ff955a8d
train
function
def _extractFromLDJson(parsedHTML): jsonDate = None try: for script in parsedHTML.find_all("script", type="application/ld+json"): try: # print(script) if script is None: return None data = json.loads(script.next) ...
def _extractFromLDJson(parsedHTML):
jsonDate = None try: for script in parsedHTML.find_all("script", type="application/ld+json"): try: # print(script) if script is None: return None data = json.loads(script.next) try: if "...
elif isinstance(v, list): for i,z in enumerate(v): if tocheck in z: return z[tocheck] elif tocheck in k : return v elif tocheck in d: return d[tocheck] def _extractFromLDJson(parsedHTML):
63
64
149
9
54
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
_extractFromLDJson
_extractFromLDJson
44
71
44
44
7e000e4ddfd913c108d5709c6bccbdb0c8acd870
bigcode/the-stack
train
1460dd36bc41c1d6f788d3cf
train
function
def recursivejson(d): tocheck = "datePublished" for k,v in d.items(): if isinstance(v, dict): return recursivejson(v) elif isinstance(v, list): for i,z in enumerate(v): if tocheck in z: return z[tocheck] elif tocheck in k : return v ...
def recursivejson(d):
tocheck = "datePublished" for k,v in d.items(): if isinstance(v, dict): return recursivejson(v) elif isinstance(v, list): for i,z in enumerate(v): if tocheck in z: return z[tocheck] elif tocheck in k : return v elif tocheck in d: ...
])|(\w{3,5}[\./\-_]))([0-3]{0,1}[0-9][\./\-]{0,1})?", url, ) if m: return parseStrDate(m.group(0)) return None def recursivejson(d):
64
64
89
5
58
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
recursivejson
recursivejson
29
41
29
29
662810486c548ab007551b0e3125b842450d5578
bigcode/the-stack
train
31d969a05c2555b04d1f16c6
train
function
def extractArticlePublishedDate(articleLink, html=None): print("Extracting date from " + articleLink) articleDate = None try: articleDate = _extractFromURL(articleLink) if html is None: request = urllib.Request(articleLink) # Using a browser user agent, decreases t...
def extractArticlePublishedDate(articleLink, html=None):
print("Extracting date from " + articleLink) articleDate = None try: articleDate = _extractFromURL(articleLink) if html is None: request = urllib.Request(articleLink) # Using a browser user agent, decreases the change of sites blocking this request - just a suggesti...
), ): dateText = tag.string if dateText is None: dateText = tag.text possibleDate = parseStrDate(dateText) if possibleDate is not None: return possibleDate return None def extractArticlePublishedDate(articleLink, html=None):
64
64
207
11
52
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
extractArticlePublishedDate
extractArticlePublishedDate
218
244
218
219
2307eef9ad58c37085c19eea31277c0f1bebfad9
bigcode/the-stack
train
74ba3fa81dc9f103e6933340
train
function
def _extractFromMeta(parsedHTML): metaDate = None for meta in parsedHTML.findAll("meta"): metaName = meta.get("name", "").lower() itemProp = meta.get("itemprop", "").lower() httpEquiv = meta.get("http-equiv", "").lower() metaProperty = meta.get("property", "").lower() #...
def _extractFromMeta(parsedHTML):
metaDate = None for meta in parsedHTML.findAll("meta"): metaName = meta.get("name", "").lower() itemProp = meta.get("itemprop", "").lower() httpEquiv = meta.get("http-equiv", "").lower() metaProperty = meta.get("property", "").lower() # <meta name="pubdate" content="2015...
(m.group(0)) return None def recursivejson(d): tocheck = "datePublished" for k,v in d.items(): if isinstance(v, dict): return recursivejson(v) elif isinstance(v, list): for i,z in enumerate(v): if tocheck in z: return z[tocheck] elif...
256
256
1,061
8
247
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
_extractFromMeta
_extractFromMeta
74
176
74
75
083d0d2f804f1d04a10dde15336d0df578a0ee04
bigcode/the-stack
train
fd2c441a84a4fc753aa80cf0
train
function
def _extractFromHTMLTag(parsedHTML): classestolook = 'pubdate|timestamp|article_date|articledate|date|decided' # <time> for time in parsedHTML.findAll("time"): datetime = time.get("datetime", "") if len(datetime) > 0: return parseStrDate(datetime) datetime = time.get("cl...
def _extractFromHTMLTag(parsedHTML):
classestolook = 'pubdate|timestamp|article_date|articledate|date|decided' # <time> for time in parsedHTML.findAll("time"): datetime = time.get("datetime", "") if len(datetime) > 0: return parseStrDate(datetime) datetime = time.get("class", "") if len(datetime) > ...
# <meta http-equiv="data" content="10:27:15 AM Thursday, November 26, 2015"> if "date" == httpEquiv: metaDate = meta["content"].strip() break if metaDate is not None: return parseStrDate(metaDate) return None def _extractFromHTMLTag(parsedHTML):
79
79
266
9
69
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
_extractFromHTMLTag
_extractFromHTMLTag
179
215
179
179
979fb540de5bae50a4f8b7bb1c73afb85a48cae9
bigcode/the-stack
train
f66e4cba5a7a09b73d78532b
train
function
def parseStrDate(dateString): try: dateTimeObj = parse(dateString) return dateTimeObj except: return None
def parseStrDate(dateString):
try: dateTimeObj = parse(dateString) return dateTimeObj except: return None
import re, json from dateutil.parser import parse import urllib.request as urllib from bs4 import BeautifulSoup def parseStrDate(dateString):
32
64
32
7
24
blueshirtdeveloper/article-date-extract
articleDateExtract/__init__.py
Python
parseStrDate
parseStrDate
7
12
7
7
4c8d94940ab57bbcb61529d4c73db8dd145ed0c1
bigcode/the-stack
train
ad1ed48f6bfc665846f959cc
train
class
class PersistEventsStore: """Contains all the functions for writing events to the database. Should only be instantiated on one process (when using a worker mode setup). Note: This is not part of the `DataStore` mixin. """ def __init__( self, hs: "HomeServer", db: DatabaseP...
class PersistEventsStore:
"""Contains all the functions for writing events to the database. Should only be instantiated on one process (when using a worker mode setup). Note: This is not part of the `DataStore` mixin. """ def __init__( self, hs: "HomeServer", db: DatabasePool, main_data_sto...
Generator from synapse.types import StateMap, get_domain_from_id from synapse.util import json_encoder from synapse.util.iterutils import batch_iter, sorted_topologically if TYPE_CHECKING: from synapse.server import HomeServer from synapse.storage.databases.main import DataStore logger = logging.getLogger(__...
256
256
16,848
5
250
nicobao/synapse
synapse/storage/databases/main/events.py
Python
PersistEventsStore
PersistEventsStore
88
2,226
88
88
6840c7e6d49aef36d5e988641dba4166a5b0dc30
bigcode/the-stack
train
2cb5068980c05f6101bc4fb0
train
class
@attr.s(slots=True, auto_attribs=True) class DeltaState: """Deltas to use to update the `current_state_events` table. Attributes: to_delete: List of type/state_keys to delete from current state to_insert: Map of state to upsert into current state no_longer_in_room: The server is not lon...
@attr.s(slots=True, auto_attribs=True) class DeltaState:
"""Deltas to use to update the `current_state_events` table. Attributes: to_delete: List of type/state_keys to delete from current state to_insert: Map of state to upsert into current state no_longer_in_room: The server is not longer in the room, so the room should e.g. be r...
_event_counter = Counter("synapse_storage_events_persisted_events", "") event_counter = Counter( "synapse_storage_events_persisted_events_sep", "", ["type", "origin_type", "origin_entity"], ) @attr.s(slots=True, auto_attribs=True) class DeltaState:
64
64
132
17
47
nicobao/synapse
synapse/storage/databases/main/events.py
Python
DeltaState
DeltaState
72
85
72
73
b3242aff9ba92e31fca86d1365fa09c8668eabe1
bigcode/the-stack
train
ec80a6a7056cbcd1f765e259
train
class
@attr.s(slots=True, auto_attribs=True) class _LinkMap: """A helper type for tracking links between chains.""" # Stores the set of links as nested maps: source chain ID -> target chain ID # -> source sequence number -> target sequence number. maps: Dict[int, Dict[int, Dict[int, int]]] = attr.Factory(dic...
@attr.s(slots=True, auto_attribs=True) class _LinkMap:
"""A helper type for tracking links between chains.""" # Stores the set of links as nested maps: source chain ID -> target chain ID # -> source sequence number -> target sequence number. maps: Dict[int, Dict[int, Dict[int, int]]] = attr.Factory(dict) # Stores the links that have been added (with n...
NOT EXISTS (" " SELECT 1 FROM event_backward_extremities" " WHERE event_id = ? AND room_id = ?" " )" " AND NOT EXISTS (" " SELECT 1 FROM events WHERE event_id = ? AND room_id = ? " " AND outlier = ?" " )" ) txn...
256
256
1,071
18
238
nicobao/synapse
synapse/storage/databases/main/events.py
Python
_LinkMap
_LinkMap
2,229
2,355
2,229
2,230
2c4fe082e7239634e3b94d35a1d1b0f5d9b7f309
bigcode/the-stack
train
0521ef6a15ff97f65795f83e
train
function
def Update(defaultSettings,overrides): for label,override in overrides.items(): if isinstance(override, collections.abc.Mapping): Update(defaultSettings[label],override) else: defaultSettings[label] = override return defaultSettings
def Update(defaultSettings,overrides):
for label,override in overrides.items(): if isinstance(override, collections.abc.Mapping): Update(defaultSettings[label],override) else: defaultSettings[label] = override return defaultSettings
else: configOverride = {} if args.environment is not None: envConfigOverride = json.loads(unquote(args.environment)) else: envConfigOverride = {} if args.network is not None: netConfigOverride = json.loads(unquote(args.network)) else: netConfigOverride = {} def Update(defaultSettings,overrides):
64
64
52
8
56
vanstrn/RL_public
AsynchExec.py
Python
Update
Update
45
51
45
45
7d7578992eac623529921a9d8ae4306f1741a5af
bigcode/the-stack
train
a33ffd324f507e814eb03304
train
function
def get_avg_characterisation( characterisation: Dict[str, Any] ) -> Dict[str, Dict[Node, float]]: """ Convert gate-specific characterisation into readout, one- and two-qubit errors Used to convert a typical output from `process_characterisation` into an input noise characterisation for NoiseAwarePl...
def get_avg_characterisation( characterisation: Dict[str, Any] ) -> Dict[str, Dict[Node, float]]:
""" Convert gate-specific characterisation into readout, one- and two-qubit errors Used to convert a typical output from `process_characterisation` into an input noise characterisation for NoiseAwarePlacement """ K = TypeVar("K") V1 = TypeVar("V1") V2 = TypeVar("V2") map_values_t =...
["EdgeErrors"] = link_errors characterisation["ReadoutErrors"] = readout_errors characterisation["Architecture"] = arc characterisation["t1times"] = t1_times_dict characterisation["t2times"] = t2_times_dict characterisation["Frequencies"] = frequencies_dict characterisation["GateTimes"] = gate_t...
112
112
376
26
85
irfankhan10/pytket-extensions
modules/pytket-qiskit/pytket/extensions/qiskit/qiskit_convert.py
Python
get_avg_characterisation
get_avg_characterisation
671
707
671
673
eb83ec0ab55a6aa5d96c3ea86e21897e905a1289
bigcode/the-stack
train
01862c80c788bf747d72eb75
train
function
def _tk_gate_set(backend: "QiskitBackend") -> Set[OpType]: """Set of tket gate types supported by the qiskit backend""" config = backend.configuration() if config.simulator: return { _gate_str_2_optype[gate_str] for gate_str in config.basis_gates if gate_str in _g...
def _tk_gate_set(backend: "QiskitBackend") -> Set[OpType]:
"""Set of tket gate types supported by the qiskit backend""" config = backend.configuration() if config.simulator: return { _gate_str_2_optype[gate_str] for gate_str in config.basis_gates if gate_str in _gate_str_2_optype }.union({OpType.Measure, OpType.Re...
_gate_str_2_optype.items()} # the aliasing of the name is ok in the reverse map _gate_str_2_optype_rev[OpType.Unitary1qBox] = "unitary" def _tk_gate_set(backend: "QiskitBackend") -> Set[OpType]:
64
64
148
20
44
irfankhan10/pytket-extensions
modules/pytket-qiskit/pytket/extensions/qiskit/qiskit_convert.py
Python
_tk_gate_set
_tk_gate_set
197
211
197
197
f28812804b921581056764ce419fa2f4b34f36df
bigcode/the-stack
train