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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
edf36732dfd284ea8038cb57 | train | function | def func(x):
return x*x | def func(x):
| return x*x | def func(x):
| 4 | 64 | 8 | 4 | 0 | furnstahl/binder_test | test.py | Python | func | func | 1 | 2 | 1 | 1 | 60b9928f042dde1bb1bc6e35d2141210bfc65240 | bigcode/the-stack | train |
af4a56e32008df03239e84e5 | train | class | class TestInitialisation(unittest.TestCase):
"""
Test initialisation of the Workbook class and call a method.
"""
def setUp(self):
self.fh = StringIO()
self.workbook = Workbook()
self.workbook._set_filehandle(self.fh)
def test_xml_declaration(self):
"""Test Workboo... | class TestInitialisation(unittest.TestCase):
| """
Test initialisation of the Workbook class and call a method.
"""
def setUp(self):
self.fh = StringIO()
self.workbook = Workbook()
self.workbook._set_filehandle(self.fh)
def test_xml_declaration(self):
"""Test Workbook xml_declaration()"""
self.workbook... | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...workbook import Workbook
class TestInitialisation(unittest.TestCase):
| 63 | 64 | 144 | 8 | 54 | edparcell/XlsxWriter | xlsxwriter/test/workbook/test_initialisation.py | Python | TestInitialisation | TestInitialisation | 13 | 35 | 13 | 13 | ef72fc3e9f403f3e7e464c0f6036f8eb0f98c24b | bigcode/the-stack | train |
ba471639ae875afbaa77dd60 | train | class | class Migration(migrations.Migration):
dependencies = [
('blogging', '0006_auto_20170214_0037'),
]
operations = [
migrations.AlterModelManagers(
name='category',
managers=[
('objects', django.db.models.manager.Manager()),
('on_site', ... | class Migration(migrations.Migration):
| dependencies = [
('blogging', '0006_auto_20170214_0037'),
]
operations = [
migrations.AlterModelManagers(
name='category',
managers=[
('objects', django.db.models.manager.Manager()),
('on_site', django.contrib.sites.managers.CurrentSit... | coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-12 18:52
from __future__ import unicode_literals
import django.contrib.sites.managers
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
| 64 | 64 | 122 | 7 | 56 | jibaku/blogging | blogging/migrations/0007_auto_20171012_2052.py | Python | Migration | Migration | 10 | 31 | 10 | 11 | 7cff241b94bf046ae4aa75a12f9becdae79cad93 | bigcode/the-stack | train |
45f8a39369fd5cb2c7fe5b12 | train | function | def param_func():
pass
| def param_func():
| pass
| from to_import import func
def param_func():
| 10 | 64 | 7 | 4 | 5 | WenJinfeng/PyCG | micro-benchmark/snippets/args/imported_assigned_call/main.py | Python | param_func | param_func | 3 | 4 | 3 | 3 | c9c211710bbcdd7afee2e237c7f765901e30890a | bigcode/the-stack | train |
214756dbf3c114a7409444d3 | train | function | def setup_app(my_app):
"""Setup the flask app.
Mostly this is setting up a simple username/password. This will be
logged to the console so you can go to http://127.0.0.1:5000/login
and login. For your purposes, you can just hard code the password
below instead of randomly generating it, but since t... | def setup_app(my_app):
| """Setup the flask app.
Mostly this is setting up a simple username/password. This will be
logged to the console so you can go to http://127.0.0.1:5000/login
and login. For your purposes, you can just hard code the password
below instead of randomly generating it, but since this is on github
we... | root and points the user to the ox_herd
blueprint inside the main app.
"""
oh_index = url_for('ox_herd.index')
link = '<A HREF="%s">%s</A>' % (oh_index, oh_index)
msg = Markup('Welcome to ox_herd_example! Interesting stuff is at %s.' % (
link))
return msg
def setup_app(my_app):
| 92 | 92 | 307 | 6 | 85 | emin63/ox_herd_example | app.py | Python | setup_app | setup_app | 38 | 65 | 38 | 38 | 5be95ecb930d4aa333b22f8ee5206b41b5e1b2c7 | bigcode/the-stack | train |
27a2b49cd7e094b03db94e94 | train | function | @APP.route('/')
@login_stub.login_required
def index():
"""Route for main index.
This basically serves as the root and points the user to the ox_herd
blueprint inside the main app.
"""
oh_index = url_for('ox_herd.index')
link = '<A HREF="%s">%s</A>' % (oh_index, oh_index)
msg = Markup('Welc... | @APP.route('/')
@login_stub.login_required
def index():
| """Route for main index.
This basically serves as the root and points the user to the ox_herd
blueprint inside the main app.
"""
oh_index = url_for('ox_herd.index')
link = '<A HREF="%s">%s</A>' % (oh_index, oh_index)
msg = Markup('Welcome to ox_herd_example! Interesting stuff is at %s.' % (... | _herd import views as ox_herd_views
# The following imports the ox_herd blueprint.
from ox_herd.ui.flask_web_ui.ox_herd import OX_HERD_BP
APP = Flask(__name__)
@APP.route('/')
@login_stub.login_required
def index():
| 64 | 64 | 111 | 12 | 52 | emin63/ox_herd_example | app.py | Python | index | index | 23 | 35 | 23 | 25 | df58dfad78bb62337beea766b40016195ac72bc9 | bigcode/the-stack | train |
79207cb5ca7c3b38bb66ad14 | train | class | class Migration(migrations.Migration):
dependencies = [
('matches', '0002_employermatch_jobmatch_locationmatch'),
]
operations = [
migrations.AlterField(
model_name='employermatch',
name='liked',
field=models.NullBooleanField(),
),
migrat... | class Migration(migrations.Migration):
| dependencies = [
('matches', '0002_employermatch_jobmatch_locationmatch'),
]
operations = [
migrations.AlterField(
model_name='employermatch',
name='liked',
field=models.NullBooleanField(),
),
migrations.AlterField(
model_name=... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
| 31 | 64 | 115 | 7 | 23 | codingforentrepreneurs/matchmaker-2 | src/matches/migrations/0003_auto_20150720_2109.py | Python | Migration | Migration | 7 | 29 | 7 | 8 | 2739353d74a8c50bab3635efedcc74064e6f832a | bigcode/the-stack | train |
aa0837dac6b1b5278ae34989 | train | class | class Test_RunParameterFitting(unittest.TestCase):
def setUp(self):
self.model=Test_CreateSimpleModel.createModel()
def test_runParameterFittingOnSimpleModel(self):
self.datamodel=COPASI.CCopasiRootContainer.addDatamodel()
fitTask=COPASI.self.datamodel.addTask(COPASI.CCopasiTask.parameterFitt... | class Test_RunParameterFitting(unittest.TestCase):
| def setUp(self):
self.model=Test_CreateSimpleModel.createModel()
def test_runParameterFittingOnSimpleModel(self):
self.datamodel=COPASI.CCopasiRootContainer.addDatamodel()
fitTask=COPASI.self.datamodel.addTask(COPASI.CCopasiTask.parameterFitting)
self.assert_(fitTask!=None)
se... | 25 39 61
2.5 35 65
2.75 32 68
3 28 72
3.25 25 75
3.5 22 78
3.75 20 80
4 20 80
4.25 19 81
4.5 18 82
4.75 16 84
5 14 86
0 100 0
0.25 92 8
0.5 82 18
0.75 73 27
1 67 33
1.25 61 39
1.5 54 46
1.75 47 53
2 40 60
2.25 36 64
2.5 29 71
2.75 26 74
3 24 76
3.25 22 78
3.5 19 81
3.75 18 82
4 17 83
4.25 16 84
4.5 15 85
4.75 13 87
5 ... | 255 | 256 | 1,661 | 10 | 245 | bmoreau/COPASI | copasi/bindings/python/unittests/Test_RunParameterFitting.py | Python | Test_RunParameterFitting | Test_RunParameterFitting | 252 | 392 | 252 | 252 | 55e8f3aa8b15b1ba722f1da8e9a30d638864b34f | bigcode/the-stack | train |
9da157c5e446cecb3418af30 | train | function | def suite():
tests=[
'test_runParameterFittingOnSimpleModel'
,'test_runParameterFittingOnExtendedModel'
]
return unittest.TestSuite(map(Test_RunParameterFitting,tests))
| def suite():
| tests=[
'test_runParameterFittingOnSimpleModel'
,'test_runParameterFittingOnExtendedModel'
]
return unittest.TestSuite(map(Test_RunParameterFitting,tests))
| is
# probably off since we use only one experiment to fit
self.assert_((fitItem.getLocalValue()-0.5)/0.5 < 1.0)
def test_runParameterFittingOnExtendedModel(self):
Test_CreateSimpleModel.extendModel(self.model)
def suite():
| 64 | 64 | 44 | 3 | 61 | bmoreau/COPASI | copasi/bindings/python/unittests/Test_RunParameterFitting.py | Python | suite | suite | 395 | 400 | 395 | 395 | ad887d2ff2f5393caf409c76d566f11587fa7f47 | bigcode/the-stack | train |
13424a1336ce26e280072211 | train | class | class Permutation(Transform):
"""Permutes inputs on a given dimension using a given permutation."""
def __init__(self, permutation, dim=1):
if permutation.ndimension() != 1:
raise ValueError("Permutation must be a 1D tensor.")
if not check.is_positive_int(dim):
raise Val... | class Permutation(Transform):
| """Permutes inputs on a given dimension using a given permutation."""
def __init__(self, permutation, dim=1):
if permutation.ndimension() != 1:
raise ValueError("Permutation must be a 1D tensor.")
if not check.is_positive_int(dim):
raise ValueError("dim must be a positiv... | """Implementations of permutation-like transforms."""
import torch
from nflows.transforms.base import Transform
import nflows.utils.typechecks as check
class Permutation(Transform):
| 34 | 88 | 295 | 6 | 27 | lemonwaffle/nflows | nflows/transforms/permutations.py | Python | Permutation | Permutation | 9 | 45 | 9 | 9 | 8e9cc05381fd9d47ee7bb90cf4a88385b8c9b0cd | bigcode/the-stack | train |
296da3f1b70e11e0992d08ca | train | class | class RandomPermutation(Permutation):
"""Permutes using a random, but fixed, permutation. Only works with 1D inputs."""
def __init__(self, features, dim=1):
if not check.is_positive_int(features):
raise ValueError("Number of features must be a positive integer.")
super().__init__(to... | class RandomPermutation(Permutation):
| """Permutes using a random, but fixed, permutation. Only works with 1D inputs."""
def __init__(self, features, dim=1):
if not check.is_positive_int(features):
raise ValueError("Number of features must be a positive integer.")
super().__init__(torch.randperm(features), dim)
| det
def forward(self, inputs, context=None):
return self._permute(inputs, self._permutation, self._dim)
def inverse(self, inputs, context=None):
return self._permute(inputs, self._inverse_permutation, self._dim)
class RandomPermutation(Permutation):
| 64 | 64 | 76 | 7 | 57 | lemonwaffle/nflows | nflows/transforms/permutations.py | Python | RandomPermutation | RandomPermutation | 48 | 54 | 48 | 48 | 43c8d0d1ad72c8480bc8845e357b57d0bc5cd199 | bigcode/the-stack | train |
d6e4bb9821f737cc3ffda4c4 | train | class | class ReversePermutation(Permutation):
"""Reverses the elements of the input. Only works with 1D inputs."""
def __init__(self, features, dim=1):
if not check.is_positive_int(features):
raise ValueError("Number of features must be a positive integer.")
super().__init__(torch.arange(f... | class ReversePermutation(Permutation):
| """Reverses the elements of the input. Only works with 1D inputs."""
def __init__(self, features, dim=1):
if not check.is_positive_int(features):
raise ValueError("Number of features must be a positive integer.")
super().__init__(torch.arange(features - 1, -1, -1), dim)
| . Only works with 1D inputs."""
def __init__(self, features, dim=1):
if not check.is_positive_int(features):
raise ValueError("Number of features must be a positive integer.")
super().__init__(torch.randperm(features), dim)
class ReversePermutation(Permutation):
| 64 | 64 | 82 | 7 | 57 | lemonwaffle/nflows | nflows/transforms/permutations.py | Python | ReversePermutation | ReversePermutation | 57 | 63 | 57 | 57 | da048c085fd2d9a48124bac33853356d6a3efa42 | bigcode/the-stack | train |
da4ac801c321fad85de8553b | train | class | class Migration(migrations.Migration):
dependencies = [
('contact', '0020_texasimageryservicerequest_active'),
]
operations = [
migrations.AlterField(
model_name='texasimageryservicerequest',
name='contractor_access',
field=models.CharField(choices=[('Ye... | class Migration(migrations.Migration):
| dependencies = [
('contact', '0020_texasimageryservicerequest_active'),
]
operations = [
migrations.AlterField(
model_name='texasimageryservicerequest',
name='contractor_access',
field=models.CharField(choices=[('Yes', 'Yes'), ('No', 'No')], default='No',... | # Generated by Django 2.0.13 on 2019-10-11 14:59
from django.db import migrations, models
class Migration(migrations.Migration):
| 38 | 64 | 216 | 7 | 30 | TNRIS/api.tnris.org | src/data_hub/contact/migrations/0021_auto_20191011_0959.py | Python | Migration | Migration | 6 | 23 | 6 | 7 | 656eb488e426688e3f78eeea603ebba1c4f24e3b | bigcode/the-stack | train |
b3171a4ce75b879082fa23b2 | train | class | class Solution:
def validTree(self, n: int, edges: List[List[int]]) -> bool:
g = defaultdict(set)
for a, b in edges:
g[a].add(b)
g[b].add(a)
v = set([0])
q = deque([0])
p = {}
while q:
node = q.popleft()
for nei in g[nod... | class Solution:
| def validTree(self, n: int, edges: List[List[int]]) -> bool:
g = defaultdict(set)
for a, b in edges:
g[a].add(b)
g[b].add(a)
v = set([0])
q = deque([0])
p = {}
while q:
node = q.popleft()
for nei in g[node]:
... | class Solution:
| 3 | 64 | 140 | 3 | 0 | YiqunPeng/leetcode_pro | solutions/261_graph_valid_tree.py | Python | Solution | Solution | 1 | 20 | 1 | 1 | 1dea089f9a7630423f16113920a14f81059e6ca1 | bigcode/the-stack | train |
aeebf91242e08502a8f14c55 | train | function | def handler(event, context):
logger.info("Processing feeds...")
db_session = DB_Session()
for feed in db_session.query(Feed).all():
data = feedparser.parse(feed.href)
insert_stmt = pg.insert(Entry.__table__)
db_session.execute(
insert_stmt.on_conflict_do_update(
index_elements=['id'],
set_=dict... | def handler(event, context):
| logger.info("Processing feeds...")
db_session = DB_Session()
for feed in db_session.query(Feed).all():
data = feedparser.parse(feed.href)
insert_stmt = pg.insert(Entry.__table__)
db_session.execute(
insert_stmt.on_conflict_do_update(
index_elements=['id'],
set_=dict(
title=insert_stmt.excl... | (logging, os.environ.get("LOG_LEVEL", 'INFO'))
logger = logging.getLogger()
logger.setLevel(LOG_LEVEL)
DATABASE_URL = os.environ["DATABASE_URL"]
logger.info("Connecting to database %s...", DATABASE_URL)
DB_ENGINE = create_engine(DATABASE_URL, echo=LOG_LEVEL <= logging.DEBUG)
DB_Session = sessionmaker()
DB_Session.con... | 90 | 91 | 306 | 6 | 84 | asmello/feed-tracker-bot | src/crawler.py | Python | handler | handler | 31 | 76 | 31 | 31 | 81a7c89d8dfe0a39ac8c82325671c64b754553b3 | bigcode/the-stack | train |
7e010f120335911e9b70046b | train | class | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
| class TreeNode:
| def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
| """
Question Source:Leetcode
Level: Easy
Topic: Tree
Solver: Tayyrov
Date: 14.04.2022
"""
class TreeNode:
| 35 | 64 | 39 | 4 | 31 | tayyrov/Daily_Coding_Challenge | April/Day14-Search in a Binary Search Tree.py | Python | TreeNode | TreeNode | 10 | 14 | 10 | 10 | 739311e7db0b435b49f41c5cca2fe76c2f0375f6 | bigcode/the-stack | train |
ecc9053e51e91848ebdac82e | train | class | class Solution:
def searchBST(self, root: TreeNode, val: int) -> TreeNode:
if not root:
return None
if root.val == val:
return root
if root.val > val:
return self.searchBST(root.left, val)
else:
return self.searchBST(root.right... | class Solution:
| def searchBST(self, root: TreeNode, val: int) -> TreeNode:
if not root:
return None
if root.val == val:
return root
if root.val > val:
return self.searchBST(root.left, val)
else:
return self.searchBST(root.right, val)
|
Topic: Tree
Solver: Tayyrov
Date: 14.04.2022
"""
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
| 64 | 64 | 72 | 3 | 60 | tayyrov/Daily_Coding_Challenge | April/Day14-Search in a Binary Search Tree.py | Python | Solution | Solution | 17 | 26 | 17 | 17 | cae8c037d761ce7b8388ad31f071c993c39f939b | bigcode/the-stack | train |
de60ccbc468353de5fc14c12 | train | function | def parse_args():
parser = argparse.ArgumentParser(description="Dyslipidemia Prediction")
parser.add_argument("model", choices=["mlmodel", "dlmodel", "all"],
help="ML Model, DL Model or Run all Models?")
parser.add_argument("--mode", choices=["public", "private"],
... | def parse_args():
| parser = argparse.ArgumentParser(description="Dyslipidemia Prediction")
parser.add_argument("model", choices=["mlmodel", "dlmodel", "all"],
help="ML Model, DL Model or Run all Models?")
parser.add_argument("--mode", choices=["public", "private"],
help="Using... | import logging
import argparse
import torch
from lib.config import Config
from lib.runner import Runner
def parse_args():
| 25 | 89 | 297 | 4 | 20 | CuongVoThanh/Dyslipidemia_Prediction | main.py | Python | parse_args | parse_args | 8 | 24 | 8 | 8 | bb9a4de4c31851f5ff4a1ec310eeeae091884b18 | bigcode/the-stack | train |
f4b3968a1d45a2d0286bcffa | train | function | def main():
args = parse_args()
device = torch.device('cpu') if not torch.cuda.is_available() or args.cpu else torch.device('cuda')
cfg = Config(device, args.one_hot, args.drop_col, args.pca_transform, args.mode,
args.epochs, args.model, args.kfold, args.lr, args.weight_decay)
if ar... | def main():
| args = parse_args()
device = torch.device('cpu') if not torch.cuda.is_available() or args.cpu else torch.device('cuda')
cfg = Config(device, args.one_hot, args.drop_col, args.pca_transform, args.mode,
args.epochs, args.model, args.kfold, args.lr, args.weight_decay)
if args.model in ... | .add_argument("--epochs", type=int, default=50, help="Epochs to test the model on (Default: 50)")
parser.add_argument("--cpu", action="store_true", help="(Unsupported) Use CPU instead of GPU")
args = parser.parse_args()
return args
def main():
| 64 | 64 | 119 | 3 | 60 | CuongVoThanh/Dyslipidemia_Prediction | main.py | Python | main | main | 26 | 38 | 26 | 26 | 9db42813d8dc730ec3f4d8b48149af0cc96f2432 | bigcode/the-stack | train |
baadda70a44cb496291ca52d | train | class | class Sentinel2:
"""
Collect and parse sentinel2 files.
It uses the sentinel2 file name format specified after 6th December 2016.
"""
PATTERN = re.compile(
# example pattern to match
# T37MBN_20170718T075211_B02.jp2
r'(?P<tile_n>^T\d{2}\D{3})'
r'_(?P<... | class Sentinel2:
| """
Collect and parse sentinel2 files.
It uses the sentinel2 file name format specified after 6th December 2016.
"""
PATTERN = re.compile(
# example pattern to match
# T37MBN_20170718T075211_B02.jp2
r'(?P<tile_n>^T\d{2}\D{3})'
r'_(?P<date>[0-9]{8})'
... | import os
import re
import pdb
class Sentinel2:
| 13 | 175 | 586 | 4 | 8 | ESS-uzh/geoRpro | geoRpro/sent2.py | Python | Sentinel2 | Sentinel2 | 5 | 75 | 5 | 5 | 7a0ca143e67182ccbb676a08b28a9a9ba5001e52 | bigcode/the-stack | train |
ee5e427c6e684a674baae021 | train | function | def update_security_groups_acl_by_id(api):
endpoint_result = api.security_groups_acls.update_security_groups_acl_by_id(
aclcontent='string',
active_validation=False,
description='string',
generation_id='string',
id='string',
ip_version='string',
is_read_only=T... | def update_security_groups_acl_by_id(api):
| endpoint_result = api.security_groups_acls.update_security_groups_acl_by_id(
aclcontent='string',
active_validation=False,
description='string',
generation_id='string',
id='string',
ip_version='string',
is_read_only=True,
modelled_content={},
n... | (obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_afc81cd1e25c50319f75606b97c23b3d_v3_1_1').validate(obj.response)
return True
def update_security_groups_acl_by_id(api):
| 64 | 64 | 86 | 9 | 54 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | update_security_groups_acl_by_id | update_security_groups_acl_by_id | 94 | 107 | 94 | 94 | c6b5a5a57f740330d44083d43a2ec7a6d82a93b6 | bigcode/the-stack | train |
ea2129785a5dd708b397abab | train | function | @pytest.mark.security_groups_acls
def test_bulk_request_for_security_groups_acl_default(api, validator):
try:
assert is_valid_bulk_request_for_security_groups_acl(
validator,
bulk_request_for_security_groups_acl_default(api)
)
except Exception as original_e:
with ... | @pytest.mark.security_groups_acls
def test_bulk_request_for_security_groups_acl_default(api, validator):
| try:
assert is_valid_bulk_request_for_security_groups_acl(
validator,
bulk_request_for_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| ):
endpoint_result = api.security_groups_acls.bulk_request_for_security_groups_acl(
active_validation=False,
operation_type=None,
payload=None,
resource_media_type=None
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_bulk_request_for_security_groups_acl_de... | 64 | 64 | 77 | 20 | 43 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_bulk_request_for_security_groups_acl_default | test_bulk_request_for_security_groups_acl_default | 421 | 430 | 421 | 422 | b46d71d0fa978acae5390d5b648ccf3d6fc06a3e | bigcode/the-stack | train |
882bbbf22568bd276c0aba93 | train | function | def create_security_groups_acl(api):
endpoint_result = api.security_groups_acls.create_security_groups_acl(
aclcontent='string',
active_validation=False,
description='string',
generation_id='string',
ip_version='string',
is_read_only=True,
modelled_content={},... | def create_security_groups_acl(api):
| endpoint_result = api.security_groups_acls.create_security_groups_acl(
aclcontent='string',
active_validation=False,
description='string',
generation_id='string',
ip_version='string',
is_read_only=True,
modelled_content={},
name='string',
paylo... | ')
assert hasattr(obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_9ab61f24bdaf508590f7686e1130913f_v3_1_1').validate(obj.response)
return True
def create_security_groups_acl(api):
| 64 | 64 | 77 | 7 | 56 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | create_security_groups_acl | create_security_groups_acl | 272 | 284 | 272 | 272 | 3e6e90f741cb50fa35f19f7cfa5326c257cebed0 | bigcode/the-stack | train |
1ca208cffa561ee224ddc9bd | train | function | def get_version_default(api):
endpoint_result = api.security_groups_acls.get_version(
)
return endpoint_result
| def get_version_default(api):
| endpoint_result = api.security_groups_acls.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 | 25 | 6 | 57 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | get_version_default | get_version_default | 358 | 362 | 358 | 358 | 79b1dd14512b420137f87e1fc488bd3c62f43af7 | bigcode/the-stack | train |
2c0de69e9e35e4097910f901 | train | function | @pytest.mark.security_groups_acls
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}".... | @pytest.mark.security_groups_acls
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
| aa794d8377da9a1de_v3_1_1').validate(obj.response)
return True
def get_version(api):
endpoint_result = api.security_groups_acls.get_version(
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_get_version(api, validator):
| 64 | 64 | 74 | 15 | 48 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_get_version | test_get_version | 345 | 355 | 345 | 346 | 744f4bd2ed7969926a2201eed489442942db7ac4 | bigcode/the-stack | train |
e1bb676143cb66f7ae14dec5 | train | function | def is_valid_get_security_groups_acl(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_999b22d6ad9f595ab7e3eee5cf44de8a_v3_1_1').validate... | def is_valid_get_security_groups_acl(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_999b22d6ad9f595ab7e3eee5cf44de8a_v3_1_1').validate(obj.response)
return True
| _valid_delete_security_groups_acl_by_id(
validator,
delete_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
def is_valid_get_security_groups_acl(json_s... | 64 | 64 | 97 | 13 | 50 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_get_security_groups_acl | is_valid_get_security_groups_acl | 201 | 209 | 201 | 201 | 4bfaf37e3b16ea5f56e538695f038073a7309b7e | bigcode/the-stack | train |
eb97343aad04f12dea00265f | train | function | @pytest.mark.security_groups_acls
def test_update_security_groups_acl_by_id_default(api, validator):
try:
assert is_valid_update_security_groups_acl_by_id(
validator,
update_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raise... | @pytest.mark.security_groups_acls
def test_update_security_groups_acl_by_id_default(api, validator):
| try:
assert is_valid_update_security_groups_acl_by_id(
validator,
update_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| content=None,
description=None,
generation_id=None,
ip_version=None,
is_read_only=None,
modelled_content=None,
name=None,
payload=None
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_update_security_groups_acl_by_id_default(api, validat... | 64 | 64 | 77 | 20 | 43 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_update_security_groups_acl_by_id_default | test_update_security_groups_acl_by_id_default | 139 | 148 | 139 | 140 | a016121dcd35b120933e1671958ada31526b2e98 | bigcode/the-stack | train |
095aad61bcc07cb0607a9df2 | train | function | @pytest.mark.security_groups_acls
def test_get_security_groups_acl(api, validator):
try:
assert is_valid_get_security_groups_acl(
validator,
get_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):... | @pytest.mark.security_groups_acls
def test_get_security_groups_acl(api, validator):
| try:
assert is_valid_get_security_groups_acl(
validator,
get_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
raise orig... | _groups_acl(
filter='value1,value2',
filter_type='string',
page=0,
size=0,
sortasc='string',
sortdsc='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_get_security_groups_acl(api, validator):
| 64 | 64 | 80 | 17 | 46 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_get_security_groups_acl | test_get_security_groups_acl | 224 | 234 | 224 | 225 | fa195d89dabe0d555a1723eab46c9f8f55514c61 | bigcode/the-stack | train |
ed353da5ecd364a6f1806dac | train | function | def get_security_groups_acl_by_id_default(api):
endpoint_result = api.security_groups_acls.get_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| def get_security_groups_acl_by_id_default(api):
| endpoint_result = api.security_groups_acls.get_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| (
validator,
get_security_groups_acl_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_security_groups_acl_by_id_default(a... | 64 | 64 | 38 | 10 | 53 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | get_security_groups_acl_by_id_default | get_security_groups_acl_by_id_default | 64 | 68 | 64 | 64 | 442332df5e8003d0db3e478ae11ab30204be2b98 | bigcode/the-stack | train |
f7402d5dcac0c77435a743aa | train | function | @pytest.mark.security_groups_acls
def test_delete_security_groups_acl_by_id_default(api, validator):
try:
assert is_valid_delete_security_groups_acl_by_id(
validator,
delete_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raise... | @pytest.mark.security_groups_acls
def test_delete_security_groups_acl_by_id_default(api, validator):
| try:
assert is_valid_delete_security_groups_acl_by_id(
validator,
delete_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| ))
raise original_e
def delete_security_groups_acl_by_id_default(api):
endpoint_result = api.security_groups_acls.delete_security_groups_acl_by_id(
id='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_delete_security_groups_acl_by_id_default(api, validator):
| 64 | 64 | 77 | 20 | 43 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_delete_security_groups_acl_by_id_default | test_delete_security_groups_acl_by_id_default | 189 | 198 | 189 | 190 | 8a60cf86b23c62b91cc54988577e792db5e2eb60 | bigcode/the-stack | train |
0628bce175ea254830e5e211 | train | function | def is_valid_monitor_bulk_status_security_groups_acl(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_07af5ee576605a5a915d888924c1e804_v... | def is_valid_monitor_bulk_status_security_groups_acl(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_07af5ee576605a5a915d888924c1e804_v3_1_1').validate(obj.response)
return True
| _request_for_security_groups_acl(
validator,
bulk_request_for_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
def is_valid_monitor_bulk_status_security_grou... | 64 | 64 | 96 | 15 | 48 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_monitor_bulk_status_security_groups_acl | is_valid_monitor_bulk_status_security_groups_acl | 433 | 441 | 433 | 433 | 76ae79648edae5f4b356bd0f4226f8e4ed4852ee | bigcode/the-stack | train |
549181d02c2ecc49897fb34a | train | function | def is_valid_create_security_groups_acl(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_9ab61f24bdaf508590f7686e1130913f_v3_1_1').valid... | def is_valid_create_security_groups_acl(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_9ab61f24bdaf508590f7686e1130913f_v3_1_1').validate(obj.response)
return True
| :
assert is_valid_get_security_groups_acl(
validator,
get_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
def is_valid_create_security_groups_acl(js... | 64 | 64 | 94 | 13 | 50 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_create_security_groups_acl | is_valid_create_security_groups_acl | 261 | 269 | 261 | 261 | 9c855fe9e95ecc644660d2f8e55d25fee04635ae | bigcode/the-stack | train |
7393aa11f926cef4c86d2f9a | train | function | def get_security_groups_acl(api):
endpoint_result = api.security_groups_acls.get_security_groups_acl(
filter='value1,value2',
filter_type='string',
page=0,
size=0,
sortasc='string',
sortdsc='string'
)
return endpoint_result
| def get_security_groups_acl(api):
| endpoint_result = api.security_groups_acls.get_security_groups_acl(
filter='value1,value2',
filter_type='string',
page=0,
size=0,
sortasc='string',
sortdsc='string'
)
return endpoint_result
| hasattr(obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_999b22d6ad9f595ab7e3eee5cf44de8a_v3_1_1').validate(obj.response)
return True
def get_security_groups_acl(api):
| 64 | 64 | 65 | 7 | 56 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | get_security_groups_acl | get_security_groups_acl | 212 | 221 | 212 | 212 | e66a7ea0cb1e6751c8ca5e9204fd8d53a74129de | bigcode/the-stack | train |
1ef950f6748880cad2b6bd72 | train | function | def bulk_request_for_security_groups_acl(api):
endpoint_result = api.security_groups_acls.bulk_request_for_security_groups_acl(
active_validation=False,
operation_type='string',
payload=None,
resource_media_type='string'
)
return endpoint_result
| def bulk_request_for_security_groups_acl(api):
| endpoint_result = api.security_groups_acls.bulk_request_for_security_groups_acl(
active_validation=False,
operation_type='string',
payload=None,
resource_media_type='string'
)
return endpoint_result
| (obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_7da250e23ac05e6a8dcf32a81effcee9_v3_1_1').validate(obj.response)
return True
def bulk_request_for_security_groups_acl(api):
| 64 | 64 | 54 | 9 | 54 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | bulk_request_for_security_groups_acl | bulk_request_for_security_groups_acl | 388 | 395 | 388 | 388 | 7929bfcfb26857f77e33d8f080b3668c98501423 | bigcode/the-stack | train |
1967c0af1e8e5105b21a80e8 | train | function | @pytest.mark.security_groups_acls
def test_create_security_groups_acl_default(api, validator):
try:
assert is_valid_create_security_groups_acl(
validator,
create_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaExcep... | @pytest.mark.security_groups_acls
def test_create_security_groups_acl_default(api, validator):
| try:
assert is_valid_create_security_groups_acl(
validator,
create_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| aclcontent=None,
description=None,
generation_id=None,
ip_version=None,
is_read_only=None,
modelled_content=None,
name=None,
payload=None
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_create_security_groups_acl_default(api, va... | 64 | 64 | 71 | 18 | 45 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_create_security_groups_acl_default | test_create_security_groups_acl_default | 315 | 324 | 315 | 316 | bc21c715903ec8445a8289be9206c7b828400d71 | bigcode/the-stack | train |
4b8ee6cd5519073c32d9f19e | train | function | @pytest.mark.security_groups_acls
def test_create_security_groups_acl(api, validator):
try:
assert is_valid_create_security_groups_acl(
validator,
create_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedR... | @pytest.mark.security_groups_acls
def test_create_security_groups_acl(api, validator):
| try:
assert is_valid_create_security_groups_acl(
validator,
create_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
rais... | =False,
description='string',
generation_id='string',
ip_version='string',
is_read_only=True,
modelled_content={},
name='string',
payload=None
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_create_security_groups_acl(api, validator):
| 64 | 64 | 80 | 17 | 46 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_create_security_groups_acl | test_create_security_groups_acl | 287 | 297 | 287 | 288 | a035a73dda35d4a8079b008a93de19377fd78905 | bigcode/the-stack | train |
f913a9a561e19098699b90ca | train | function | def delete_security_groups_acl_by_id_default(api):
endpoint_result = api.security_groups_acls.delete_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| def delete_security_groups_acl_by_id_default(api):
| endpoint_result = api.security_groups_acls.delete_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| (
validator,
delete_security_groups_acl_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_security_groups_acl_by_id_def... | 64 | 64 | 38 | 10 | 53 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | delete_security_groups_acl_by_id_default | delete_security_groups_acl_by_id_default | 182 | 186 | 182 | 182 | 645ef37d3a4a1f45316908be805ba7a0045b8071 | bigcode/the-stack | train |
5a7ee9d48c4cc014b7411536 | train | function | def is_valid_delete_security_groups_acl_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_b0a2bea8bfec52b68663ef3f7ac6d7a7_v3_1_1')... | def is_valid_delete_security_groups_acl_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_b0a2bea8bfec52b68663ef3f7ac6d7a7_v3_1_1').validate(obj.response)
return True
| _security_groups_acl_by_id(
validator,
update_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
def is_valid_delete_security_groups_acl_by_id(json_schem... | 64 | 64 | 100 | 15 | 48 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_delete_security_groups_acl_by_id | is_valid_delete_security_groups_acl_by_id | 151 | 159 | 151 | 151 | 9f0804f45568e7a5739b13585bd9f50ab439de9a | bigcode/the-stack | train |
1feb86c8646eaab618505b1c | train | function | @pytest.mark.security_groups_acls
def test_get_security_groups_acl_by_id(api, validator):
try:
assert is_valid_get_security_groups_acl_by_id(
validator,
get_security_groups_acl_by_id(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, M... | @pytest.mark.security_groups_acls
def test_get_security_groups_acl_by_id(api, validator):
| try:
assert is_valid_get_security_groups_acl_by_id(
validator,
get_security_groups_acl_by_id(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
... | validate(obj.response)
return True
def get_security_groups_acl_by_id(api):
endpoint_result = api.security_groups_acls.get_security_groups_acl_by_id(
id='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_get_security_groups_acl_by_id(api, validator):
| 64 | 64 | 86 | 19 | 44 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_get_security_groups_acl_by_id | test_get_security_groups_acl_by_id | 51 | 61 | 51 | 52 | a83463bd6dc98183d56161d85bc7ffa895f58e6c | bigcode/the-stack | train |
5917a9e95f0b50857702bc65 | train | function | def get_security_groups_acl_default(api):
endpoint_result = api.security_groups_acls.get_security_groups_acl(
filter=None,
filter_type=None,
page=None,
size=None,
sortasc=None,
sortdsc=None
)
return endpoint_result
| def get_security_groups_acl_default(api):
| endpoint_result = api.security_groups_acls.get_security_groups_acl(
filter=None,
filter_type=None,
page=None,
size=None,
sortasc=None,
sortdsc=None
)
return endpoint_result
| _get_security_groups_acl(
validator,
get_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
raise original_e
def get_security_groups_a... | 64 | 64 | 57 | 8 | 55 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | get_security_groups_acl_default | get_security_groups_acl_default | 237 | 246 | 237 | 237 | 84d5d8179ed708cca10e775a8bbc2291e107f910 | bigcode/the-stack | train |
9dc65c664b007b3182ab6f8b | train | function | def delete_security_groups_acl_by_id(api):
endpoint_result = api.security_groups_acls.delete_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| def delete_security_groups_acl_by_id(api):
| endpoint_result = api.security_groups_acls.delete_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_b0a2bea8bfec52b68663ef3f7ac6d7a7_v3_1_1').validate(obj.response)
return True
def delete_security_groups_acl_by_id(api):
| 64 | 64 | 37 | 9 | 54 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | delete_security_groups_acl_by_id | delete_security_groups_acl_by_id | 162 | 166 | 162 | 162 | d5bcd9d405845f6df6c8df37a1fee3c74bfaec1c | bigcode/the-stack | train |
28b99cfe7d1d9fab0e83c1a2 | train | function | @pytest.mark.security_groups_acls
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)):
... | @pytest.mark.security_groups_acls
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
| MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
raise original_e
def get_version_default(api):
endpoint_result = api.security_groups_acls.get_version(
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_get_version_default(api, validator):
| 64 | 64 | 65 | 16 | 47 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_get_version_default | test_get_version_default | 365 | 374 | 365 | 366 | 2aae1eae972fcb67ee4e31b4070f360446625e9a | bigcode/the-stack | train |
2583076e00154acc6dca0140 | train | function | @pytest.mark.security_groups_acls
def test_get_security_groups_acl_by_id_default(api, validator):
try:
assert is_valid_get_security_groups_acl_by_id(
validator,
get_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSc... | @pytest.mark.security_groups_acls
def test_get_security_groups_acl_by_id_default(api, validator):
| try:
assert is_valid_get_security_groups_acl_by_id(
validator,
get_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| ))
raise original_e
def get_security_groups_acl_by_id_default(api):
endpoint_result = api.security_groups_acls.get_security_groups_acl_by_id(
id='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_get_security_groups_acl_by_id_default(api, validator):
| 64 | 64 | 77 | 20 | 43 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_get_security_groups_acl_by_id_default | test_get_security_groups_acl_by_id_default | 71 | 80 | 71 | 72 | 09c895d1a1b22997f73edb6c0903b97e4b6d1843 | bigcode/the-stack | train |
ad9f76d52a6ce0a3ad20df78 | train | function | def bulk_request_for_security_groups_acl_default(api):
endpoint_result = api.security_groups_acls.bulk_request_for_security_groups_acl(
active_validation=False,
operation_type=None,
payload=None,
resource_media_type=None
)
return endpoint_result
| def bulk_request_for_security_groups_acl_default(api):
| endpoint_result = api.security_groups_acls.bulk_request_for_security_groups_acl(
active_validation=False,
operation_type=None,
payload=None,
resource_media_type=None
)
return endpoint_result
| (
validator,
bulk_request_for_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
raise original_e
def bulk_request_for_security_groups... | 64 | 64 | 53 | 10 | 53 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | bulk_request_for_security_groups_acl_default | bulk_request_for_security_groups_acl_default | 411 | 418 | 411 | 411 | fce6706362662cc0e392b1bd8c61adde13557adf | bigcode/the-stack | train |
c0a763d10ef137af6f1678af | train | function | def monitor_bulk_status_security_groups_acl(api):
endpoint_result = api.security_groups_acls.monitor_bulk_status_security_groups_acl(
bulkid='string'
)
return endpoint_result
| def monitor_bulk_status_security_groups_acl(api):
| endpoint_result = api.security_groups_acls.monitor_bulk_status_security_groups_acl(
bulkid='string'
)
return endpoint_result
| assert hasattr(obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_07af5ee576605a5a915d888924c1e804_v3_1_1').validate(obj.response)
return True
def monitor_bulk_status_security_groups_acl(api):
| 64 | 64 | 38 | 9 | 54 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | monitor_bulk_status_security_groups_acl | monitor_bulk_status_security_groups_acl | 444 | 448 | 444 | 444 | 03f12f82d8f67b67f8f3b1e338fe35b71c55bae3 | bigcode/the-stack | train |
b95f99efe58e50cb4709b214 | train | function | @pytest.mark.security_groups_acls
def test_monitor_bulk_status_security_groups_acl_default(api, validator):
try:
assert is_valid_monitor_bulk_status_security_groups_acl(
validator,
monitor_bulk_status_security_groups_acl_default(api)
)
except Exception as original_e:
... | @pytest.mark.security_groups_acls
def test_monitor_bulk_status_security_groups_acl_default(api, validator):
| try:
assert is_valid_monitor_bulk_status_security_groups_acl(
validator,
monitor_bulk_status_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| raise original_e
def monitor_bulk_status_security_groups_acl_default(api):
endpoint_result = api.security_groups_acls.monitor_bulk_status_security_groups_acl(
bulkid='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_monitor_bulk_status_security_groups_acl_def... | 64 | 64 | 77 | 20 | 43 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_monitor_bulk_status_security_groups_acl_default | test_monitor_bulk_status_security_groups_acl_default | 471 | 480 | 471 | 472 | 6616df678909b1381186c8448f2c3a7c5d214b36 | bigcode/the-stack | train |
85c8cee8c0425b33bb4d97fd | train | function | @pytest.mark.security_groups_acls
def test_bulk_request_for_security_groups_acl(api, validator):
try:
assert is_valid_bulk_request_for_security_groups_acl(
validator,
bulk_request_for_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((J... | @pytest.mark.security_groups_acls
def test_bulk_request_for_security_groups_acl(api, validator):
| try:
assert is_valid_bulk_request_for_security_groups_acl(
validator,
bulk_request_for_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_... | endpoint_result = api.security_groups_acls.bulk_request_for_security_groups_acl(
active_validation=False,
operation_type='string',
payload=None,
resource_media_type='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_bulk_request_for_security_groups_a... | 64 | 64 | 86 | 19 | 44 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_bulk_request_for_security_groups_acl | test_bulk_request_for_security_groups_acl | 398 | 408 | 398 | 399 | 5275237650578ae7d03eb4dfa5bc3b0d4ac766f5 | bigcode/the-stack | train |
657877dfbda9199a69d28d17 | train | function | def get_security_groups_acl_by_id(api):
endpoint_result = api.security_groups_acls.get_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| def get_security_groups_acl_by_id(api):
| endpoint_result = api.security_groups_acls.get_security_groups_acl_by_id(
id='string'
)
return endpoint_result
| (obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_a50d1bd34d5f593aadf8eb02083c67b0_v3_1_1').validate(obj.response)
return True
def get_security_groups_acl_by_id(api):
| 64 | 64 | 37 | 9 | 54 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | get_security_groups_acl_by_id | get_security_groups_acl_by_id | 44 | 48 | 44 | 44 | a6e75e32262d0e0033f3d748ab5cc8d3e6fc3dc4 | bigcode/the-stack | train |
82962d92b2f8910e3b9c45f7 | train | function | def monitor_bulk_status_security_groups_acl_default(api):
endpoint_result = api.security_groups_acls.monitor_bulk_status_security_groups_acl(
bulkid='string'
)
return endpoint_result
| def monitor_bulk_status_security_groups_acl_default(api):
| endpoint_result = api.security_groups_acls.monitor_bulk_status_security_groups_acl(
bulkid='string'
)
return endpoint_result
| (
validator,
monitor_bulk_status_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
raise original_e
def monitor_bulk_status_security_... | 64 | 64 | 39 | 10 | 53 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | monitor_bulk_status_security_groups_acl_default | monitor_bulk_status_security_groups_acl_default | 464 | 468 | 464 | 464 | 4593006389365af4b56fb190e8820a31b83223a0 | bigcode/the-stack | train |
8bfef8bce22844094821ff3e | train | function | def create_security_groups_acl_default(api):
endpoint_result = api.security_groups_acls.create_security_groups_acl(
active_validation=False,
aclcontent=None,
description=None,
generation_id=None,
ip_version=None,
is_read_only=None,
modelled_content=None,
... | def create_security_groups_acl_default(api):
| endpoint_result = api.security_groups_acls.create_security_groups_acl(
active_validation=False,
aclcontent=None,
description=None,
generation_id=None,
ip_version=None,
is_read_only=None,
modelled_content=None,
name=None,
payload=None
)
... | _create_security_groups_acl(
validator,
create_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
raise original_e
def create_security... | 64 | 64 | 73 | 8 | 55 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | create_security_groups_acl_default | create_security_groups_acl_default | 300 | 312 | 300 | 300 | 90f897dfd3111a2e91ccd4734691dce2841d6644 | bigcode/the-stack | train |
f95815a868c2ee62281c24d9 | train | function | @pytest.mark.security_groups_acls
def test_delete_security_groups_acl_by_id(api, validator):
try:
assert is_valid_delete_security_groups_acl_by_id(
validator,
delete_security_groups_acl_by_id(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaExc... | @pytest.mark.security_groups_acls
def test_delete_security_groups_acl_by_id(api, validator):
| try:
assert is_valid_delete_security_groups_acl_by_id(
validator,
delete_security_groups_acl_by_id(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
... | validate(obj.response)
return True
def delete_security_groups_acl_by_id(api):
endpoint_result = api.security_groups_acls.delete_security_groups_acl_by_id(
id='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_delete_security_groups_acl_by_id(api, validator):
| 64 | 64 | 86 | 19 | 44 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_delete_security_groups_acl_by_id | test_delete_security_groups_acl_by_id | 169 | 179 | 169 | 170 | 471fa5928f3b7fa2cfb2633cf6efdf0f1a05088a | bigcode/the-stack | train |
7db7ef93c0b958d5b3de308c | train | function | @pytest.mark.security_groups_acls
def test_get_security_groups_acl_default(api, validator):
try:
assert is_valid_get_security_groups_acl(
validator,
get_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, Mal... | @pytest.mark.security_groups_acls
def test_get_security_groups_acl_default(api, validator):
| try:
assert is_valid_get_security_groups_acl(
validator,
get_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
| = api.security_groups_acls.get_security_groups_acl(
filter=None,
filter_type=None,
page=None,
size=None,
sortasc=None,
sortdsc=None
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_get_security_groups_acl_default(api, validator):
| 64 | 64 | 71 | 18 | 45 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_get_security_groups_acl_default | test_get_security_groups_acl_default | 249 | 258 | 249 | 250 | bcdcd4a9a8d7581643afaacfe19aab4640d0c47d | bigcode/the-stack | train |
b08a929e2bdc7d4586b7189b | train | function | def is_valid_get_security_groups_acl_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_a50d1bd34d5f593aadf8eb02083c67b0_v3_1_1').va... | def is_valid_get_security_groups_acl_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_a50d1bd34d5f593aadf8eb02083c67b0_v3_1_1').validate(obj.response)
return True
| dk.exceptions import ciscoisesdkException
from tests.environment import IDENTITY_SERVICES_ENGINE_VERSION
pytestmark = pytest.mark.skipif(IDENTITY_SERVICES_ENGINE_VERSION != '3.1.1', reason='version does not match')
def is_valid_get_security_groups_acl_by_id(json_schema_validate, obj):
| 64 | 64 | 98 | 15 | 49 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_get_security_groups_acl_by_id | is_valid_get_security_groups_acl_by_id | 33 | 41 | 33 | 33 | 02b61bd665f6615adbb07cc79a923fc2251d136e | bigcode/the-stack | train |
22e9cc597db4d548fba75e9e | train | function | def is_valid_bulk_request_for_security_groups_acl(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_7da250e23ac05e6a8dcf32a81effcee9_v3_1... | def is_valid_bulk_request_for_security_groups_acl(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_7da250e23ac05e6a8dcf32a81effcee9_v3_1_1').validate(obj.response)
return True
| 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
def is_valid_bulk_request_for_security_groups_acl(json_sche... | 64 | 64 | 98 | 15 | 48 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_bulk_request_for_security_groups_acl | is_valid_bulk_request_for_security_groups_acl | 377 | 385 | 377 | 377 | 0837f69767075589f50570b626676ad9ffbdd940 | bigcode/the-stack | train |
bd1330ec8acce8af910dbcff | 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_6704e67a1131578aa794d8377da9a1de_v3_1_1').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_6704e67a1131578aa794d8377da9a1de_v3_1_1').validate(obj.response)
return True
| try:
assert is_valid_create_security_groups_acl(
validator,
create_security_groups_acl_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
def is_valid_get_version(json... | 64 | 64 | 93 | 11 | 52 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_get_version | is_valid_get_version | 327 | 335 | 327 | 327 | 7a266ca9d91cd06c3097619ffc54d826bd12427c | bigcode/the-stack | train |
1e8f68a9eea9d8e554424457 | train | function | def get_version(api):
endpoint_result = api.security_groups_acls.get_version(
)
return endpoint_result
| def get_version(api):
| endpoint_result = api.security_groups_acls.get_version(
)
return endpoint_result
| content')
assert hasattr(obj, 'text')
assert hasattr(obj, 'response')
json_schema_validate('jsd_6704e67a1131578aa794d8377da9a1de_v3_1_1').validate(obj.response)
return True
def get_version(api):
| 64 | 64 | 24 | 5 | 58 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | get_version | get_version | 338 | 342 | 338 | 338 | cf71b6773f8134e2edb865e11773788c8567f153 | bigcode/the-stack | train |
614628fedc3a8e65d626121f | train | function | def is_valid_update_security_groups_acl_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_afc81cd1e25c50319f75606b97c23b3d_v3_1_1')... | def is_valid_update_security_groups_acl_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_afc81cd1e25c50319f75606b97c23b3d_v3_1_1').validate(obj.response)
return True
| _security_groups_acl_by_id(
validator,
get_security_groups_acl_by_id_default(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest, TypeError)):
raise original_e
def is_valid_update_security_groups_acl_by_id(json_schema_v... | 64 | 64 | 98 | 15 | 48 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | is_valid_update_security_groups_acl_by_id | is_valid_update_security_groups_acl_by_id | 83 | 91 | 83 | 83 | 5e407330a021d07ee50cd2fdaf4f056961cce997 | bigcode/the-stack | train |
e006a2de3bd65fb1ff284744 | train | function | def update_security_groups_acl_by_id_default(api):
endpoint_result = api.security_groups_acls.update_security_groups_acl_by_id(
active_validation=False,
id='string',
aclcontent=None,
description=None,
generation_id=None,
ip_version=None,
is_read_only=None,
... | def update_security_groups_acl_by_id_default(api):
| endpoint_result = api.security_groups_acls.update_security_groups_acl_by_id(
active_validation=False,
id='string',
aclcontent=None,
description=None,
generation_id=None,
ip_version=None,
is_read_only=None,
modelled_content=None,
name=None,
... | (
validator,
update_security_groups_acl_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_security_groups_acl_by_id_def... | 64 | 64 | 82 | 10 | 53 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | update_security_groups_acl_by_id_default | update_security_groups_acl_by_id_default | 123 | 136 | 123 | 123 | aa0143abca022f96104626eef5ee1825bfafc08b | bigcode/the-stack | train |
eb087455dc4089fa9fac2f37 | train | function | @pytest.mark.security_groups_acls
def test_monitor_bulk_status_security_groups_acl(api, validator):
try:
assert is_valid_monitor_bulk_status_security_groups_acl(
validator,
monitor_bulk_status_security_groups_acl(api)
)
except Exception as original_e:
with pytest.... | @pytest.mark.security_groups_acls
def test_monitor_bulk_status_security_groups_acl(api, validator):
| try:
assert is_valid_monitor_bulk_status_security_groups_acl(
validator,
monitor_bulk_status_security_groups_acl(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=ori... | (obj.response)
return True
def monitor_bulk_status_security_groups_acl(api):
endpoint_result = api.security_groups_acls.monitor_bulk_status_security_groups_acl(
bulkid='string'
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_monitor_bulk_status_security_groups_acl(api, vali... | 64 | 64 | 86 | 19 | 44 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_monitor_bulk_status_security_groups_acl | test_monitor_bulk_status_security_groups_acl | 451 | 461 | 451 | 452 | 00afba97d7e68964aabae72a6d666d0ec7dae1d4 | bigcode/the-stack | train |
5354ad70fe6b1cef8966b97d | train | function | @pytest.mark.security_groups_acls
def test_update_security_groups_acl_by_id(api, validator):
try:
assert is_valid_update_security_groups_acl_by_id(
validator,
update_security_groups_acl_by_id(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaExc... | @pytest.mark.security_groups_acls
def test_update_security_groups_acl_by_id(api, validator):
| try:
assert is_valid_update_security_groups_acl_by_id(
validator,
update_security_groups_acl_by_id(api)
)
except Exception as original_e:
with pytest.raises((JsonSchemaException, MalformedRequest)):
print("ERROR: {error}".format(error=original_e))
... | generation_id='string',
id='string',
ip_version='string',
is_read_only=True,
modelled_content={},
name='string',
payload=None
)
return endpoint_result
@pytest.mark.security_groups_acls
def test_update_security_groups_acl_by_id(api, validator):
| 64 | 64 | 86 | 19 | 44 | CiscoISE/ciscoisesdk | tests/api/v3_1_1/test_security_groups_acls.py | Python | test_update_security_groups_acl_by_id | test_update_security_groups_acl_by_id | 110 | 120 | 110 | 111 | cedcfcd0d55ea915a2d1fd77e0e9cc807c9278af | bigcode/the-stack | train |
ab16a32c26b7f412b318594d | train | class | class MaterializedFieldsTest(unittest.TestCase):
def setUp(self):
self.database = Database('test-db', log_statements=True)
self.database.create_table(ModelWithAliasFields)
def tearDown(self):
self.database.drop_database()
def test_insert_and_select(self):
instanc... | class MaterializedFieldsTest(unittest.TestCase):
| def setUp(self):
self.database = Database('test-db', log_statements=True)
self.database.create_table(ModelWithAliasFields)
def tearDown(self):
self.database.drop_database()
def test_insert_and_select(self):
instance = ModelWithAliasFields(
date_field='2... | from __future__ import unicode_literals
import unittest
from datetime import date
from infi.clickhouse_orm.database import Database
from infi.clickhouse_orm.models import Model
from infi.clickhouse_orm.fields import *
from infi.clickhouse_orm.engines import *
class MaterializedFieldsTest(unittest.TestCase):
| 68 | 129 | 431 | 9 | 59 | Romamo/infi.clickhouse_orm | tests/test_alias_fields.py | Python | MaterializedFieldsTest | MaterializedFieldsTest | 11 | 56 | 11 | 12 | 538b71a9f6741bc9a15b1cfae8908a47135c35b1 | bigcode/the-stack | train |
9d80c60032ca70666d9d328e | train | class | class ModelWithAliasFields(Model):
int_field = Int32Field()
date_field = DateField()
str_field = StringField()
alias_str = StringField(alias=u'str_field')
alias_int = Int32Field(alias='int_field')
alias_date = DateField(alias='date_field')
engine = MergeTree('date_field', ('date_f... | class ModelWithAliasFields(Model):
| int_field = Int32Field()
date_field = DateField()
str_field = StringField()
alias_str = StringField(alias=u'str_field')
alias_int = Int32Field(alias='int_field')
alias_date = DateField(alias='date_field')
engine = MergeTree('date_field', ('date_field',))
| (alias=123)
def test_duplicate_default(self):
with self.assertRaises(AssertionError):
StringField(alias='str_field', default='with default')
with self.assertRaises(AssertionError):
StringField(alias='str_field', materialized='str_field')
class ModelWithAliasFields(Mo... | 63 | 64 | 78 | 7 | 56 | Romamo/infi.clickhouse_orm | tests/test_alias_fields.py | Python | ModelWithAliasFields | ModelWithAliasFields | 59 | 68 | 59 | 59 | 28ff19a003ee0e4a68fb07cf0682591ba921c8e0 | bigcode/the-stack | train |
8b57c97144ccedb12f32ea0f | train | function | def resnet34(num_classes=1000, **kwargs):
"""resnet34"""
return ResNet([3, 4, 6, 3], num_classes, BasicBlock)
| def resnet34(num_classes=1000, **kwargs):
| """resnet34"""
return ResNet([3, 4, 6, 3], num_classes, BasicBlock)
| x = self.fc(x)
return x
def resnet18(num_classes=1000, **kwargs):
"""resnet18"""
return ResNet([2, 2, 2, 2], num_classes, BasicBlock)
def resnet34(num_classes=1000, **kwargs):
| 64 | 64 | 41 | 13 | 51 | akanametov/classification-pytorch | models/resnet.py | Python | resnet34 | resnet34 | 158 | 160 | 158 | 158 | 95e0a21c196354accffd594c483e72893a100f51 | bigcode/the-stack | train |
62b504c533fde1a2a1ea7773 | train | class | class ResNet(nn.Module):
"""ResNet"""
def __init__(self, layers, num_classes=1000, block=BasicBlock):
super(ResNet, self).__init__()
self.layers=layers
self.num_classes=num_classes
self.inplanes=64
# input
self.conv1 = nn.Conv2d(3, self.inplanes, kernel_size=7, st... | class ResNet(nn.Module):
| """ResNet"""
def __init__(self, layers, num_classes=1000, block=BasicBlock):
super(ResNet, self).__init__()
self.layers=layers
self.num_classes=num_classes
self.inplanes=64
# input
self.conv1 = nn.Conv2d(3, self.inplanes, kernel_size=7, stride=2, padding=3, bias=F... | conv1x1(planes, planes * self.expansion)
self.bn3 = nn.BatchNorm2d(planes * self.expansion)
self.relu = nn.ReLU(inplace=True)
self.downsample = downsample
self.stride = stride
def forward(self, x):
fx = x
fx = self.conv1(fx)
fx = self.bn1(fx)
fx = s... | 179 | 179 | 599 | 6 | 172 | akanametov/classification-pytorch | models/resnet.py | Python | ResNet | ResNet | 89 | 152 | 89 | 89 | c05a55a2914a25317827097152342b9e19c4e7bc | bigcode/the-stack | train |
c30691a7a2e1310355415be6 | train | function | def conv1x1(in_planes, out_planes, **kwargs):
"""1x1 convolution"""
kwargs['kernel_size'] = 1
kwargs['bias'] = False
return nn.Conv2d(in_planes, out_planes, **kwargs)
| def conv1x1(in_planes, out_planes, **kwargs):
| """1x1 convolution"""
kwargs['kernel_size'] = 1
kwargs['bias'] = False
return nn.Conv2d(in_planes, out_planes, **kwargs)
| """3x3 convolution with padding"""
kwargs['kernel_size'] = 3
kwargs['padding'] = 1
kwargs['bias'] = False
return nn.Conv2d(in_planes, out_planes, **kwargs)
def conv1x1(in_planes, out_planes, **kwargs):
| 64 | 64 | 54 | 14 | 50 | akanametov/classification-pytorch | models/resnet.py | Python | conv1x1 | conv1x1 | 13 | 17 | 13 | 13 | 75e8512cc032e96de2a1346e58e1152f6108b687 | bigcode/the-stack | train |
3c81cb78456911fbe3b7aac8 | train | function | def conv3x3(in_planes, out_planes, **kwargs):
"""3x3 convolution with padding"""
kwargs['kernel_size'] = 3
kwargs['padding'] = 1
kwargs['bias'] = False
return nn.Conv2d(in_planes, out_planes, **kwargs)
| def conv3x3(in_planes, out_planes, **kwargs):
| """3x3 convolution with padding"""
kwargs['kernel_size'] = 3
kwargs['padding'] = 1
kwargs['bias'] = False
return nn.Conv2d(in_planes, out_planes, **kwargs)
| import torch
import torch.nn as nn
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152']
def conv3x3(in_planes, out_planes, **kwargs):
| 56 | 64 | 65 | 14 | 42 | akanametov/classification-pytorch | models/resnet.py | Python | conv3x3 | conv3x3 | 6 | 11 | 6 | 6 | 107677ece0064f45978270a2007dc970d06d293f | bigcode/the-stack | train |
fbd1ed424da4b8accd6bc19c | train | function | def resnet101(num_classes=1000, **kwargs):
"""resnet101"""
return ResNet([3, 4, 23, 3], num_classes, Bottleneck)
| def resnet101(num_classes=1000, **kwargs):
| """resnet101"""
return ResNet([3, 4, 23, 3], num_classes, Bottleneck)
| , 3], num_classes, BasicBlock)
def resnet50(num_classes=1000, **kwargs):
"""resnet50"""
return ResNet([3, 4, 6, 3], num_classes, Bottleneck)
def resnet101(num_classes=1000, **kwargs):
| 64 | 64 | 41 | 13 | 51 | akanametov/classification-pytorch | models/resnet.py | Python | resnet101 | resnet101 | 166 | 168 | 166 | 166 | c67e1fa1ba53a372176421fb12b798c619e503a6 | bigcode/the-stack | train |
0217b08ba4fff6cbc0f13aa7 | train | function | def resnet50(num_classes=1000, **kwargs):
"""resnet50"""
return ResNet([3, 4, 6, 3], num_classes, Bottleneck)
| def resnet50(num_classes=1000, **kwargs):
| """resnet50"""
return ResNet([3, 4, 6, 3], num_classes, Bottleneck)
| , 2], num_classes, BasicBlock)
def resnet34(num_classes=1000, **kwargs):
"""resnet34"""
return ResNet([3, 4, 6, 3], num_classes, BasicBlock)
def resnet50(num_classes=1000, **kwargs):
| 64 | 64 | 41 | 13 | 51 | akanametov/classification-pytorch | models/resnet.py | Python | resnet50 | resnet50 | 162 | 164 | 162 | 162 | 5263bfd9bcb969c9679a6e958923334efc2aef10 | bigcode/the-stack | train |
387bcac4edd1c4d25709c1dc | train | class | class Bottleneck(nn.Module):
"""Bottleneck"""
expansion = 4
def __init__(self, inplanes, planes, stride=1, downsample=None):
super(Bottleneck, self).__init__()
self.conv1 = conv1x1(inplanes, planes)
self.bn1 = nn.BatchNorm2d(planes)
self.conv2 = conv3x3(planes, planes, strid... | class Bottleneck(nn.Module):
| """Bottleneck"""
expansion = 4
def __init__(self, inplanes, planes, stride=1, downsample=None):
super(Bottleneck, self).__init__()
self.conv1 = conv1x1(inplanes, planes)
self.bn1 = nn.BatchNorm2d(planes)
self.conv2 = conv3x3(planes, planes, stride=stride)
self.bn2 = ... | fx = self.conv1(fx)
fx = self.bn1(fx)
fx = self.relu(fx)
fx = self.conv2(fx)
fx = self.bn2(fx)
if self.downsample is not None:
x = self.downsample(x)
fx = fx + x
fx = self.relu(fx)
return fx
class Bottleneck(nn.Module):
| 85 | 85 | 284 | 6 | 78 | akanametov/classification-pytorch | models/resnet.py | Python | Bottleneck | Bottleneck | 51 | 87 | 51 | 51 | a3898adbcfaa269f27688c92f72e261201d7d016 | bigcode/the-stack | train |
f20586c84e472f3f7c1a6092 | train | class | class BasicBlock(nn.Module):
"""BasicBlock"""
expansion = 1
def __init__(self, inplanes, planes, stride=1, downsample=None):
super(BasicBlock, self).__init__()
self.conv1 = conv3x3(inplanes, planes, stride=stride)
self.bn1 = nn.BatchNorm2d(planes)
self.relu = nn.ReLU... | class BasicBlock(nn.Module):
| """BasicBlock"""
expansion = 1
def __init__(self, inplanes, planes, stride=1, downsample=None):
super(BasicBlock, self).__init__()
self.conv1 = conv3x3(inplanes, planes, stride=stride)
self.bn1 = nn.BatchNorm2d(planes)
self.relu = nn.ReLU(inplace=True)
self.c... | out_planes, **kwargs)
def conv1x1(in_planes, out_planes, **kwargs):
"""1x1 convolution"""
kwargs['kernel_size'] = 1
kwargs['bias'] = False
return nn.Conv2d(in_planes, out_planes, **kwargs)
class BasicBlock(nn.Module):
| 66 | 66 | 223 | 6 | 60 | akanametov/classification-pytorch | models/resnet.py | Python | BasicBlock | BasicBlock | 19 | 49 | 19 | 19 | 4dc23fa1e03cc9a05ae2b6d4c382dac23317f97b | bigcode/the-stack | train |
dfd5c5d0c139db983d838b75 | train | function | def resnet152(num_classes=1000, **kwargs):
"""resnet152"""
return ResNet([3, 8, 36, 3], num_classes, Bottleneck) | def resnet152(num_classes=1000, **kwargs):
| """resnet152"""
return ResNet([3, 8, 36, 3], num_classes, Bottleneck) | , 3], num_classes, Bottleneck)
def resnet101(num_classes=1000, **kwargs):
"""resnet101"""
return ResNet([3, 4, 23, 3], num_classes, Bottleneck)
def resnet152(num_classes=1000, **kwargs):
| 64 | 64 | 41 | 13 | 51 | akanametov/classification-pytorch | models/resnet.py | Python | resnet152 | resnet152 | 170 | 172 | 170 | 170 | 2a133cec05ecfdc465c1463bb0a10efb72869d21 | bigcode/the-stack | train |
ee487fad1c753bbc8d73537e | train | function | def resnet18(num_classes=1000, **kwargs):
"""resnet18"""
return ResNet([2, 2, 2, 2], num_classes, BasicBlock)
| def resnet18(num_classes=1000, **kwargs):
| """resnet18"""
return ResNet([2, 2, 2, 2], num_classes, BasicBlock)
| = self.layer2(x)
x = self.layer3(x)
x = self.layer4(x)
x = self.avgpool(x)
x = torch.flatten(x, 1)
x = self.fc(x)
return x
def resnet18(num_classes=1000, **kwargs):
| 64 | 64 | 41 | 13 | 50 | akanametov/classification-pytorch | models/resnet.py | Python | resnet18 | resnet18 | 154 | 156 | 154 | 154 | 3376904af26722988a520d3c8337fe26a5b54c48 | bigcode/the-stack | train |
a17a69d76a7662bf8050d97a | train | function | def load(filepath, column):
"""
Reads a binary file to load dataset.
:param
file path
column Used to label the dataframe
:return
Pandas.Dataframe Contains the dataset.
"""
with open(filepath, 'r', encoding='ISO-8859-1') as f:
text = str(f.read()).strip().split('\... | def load(filepath, column):
| """
Reads a binary file to load dataset.
:param
file path
column Used to label the dataframe
:return
Pandas.Dataframe Contains the dataset.
"""
with open(filepath, 'r', encoding='ISO-8859-1') as f:
text = str(f.read()).strip().split('\n')
return pandas.Da... | import numpy
import pandas
from .config import rating_dataset
def load(filepath, column):
| 19 | 64 | 105 | 6 | 12 | PranjalGupta2199/recommendation-systems | svd/database.py | Python | load | load | 7 | 19 | 7 | 7 | a12f44b3b6dcca77e54d4a81a0b97dbbb51f1149 | bigcode/the-stack | train |
5b27458d0dcad8ab56611105 | train | function | def preprocess():
"""Wrapper function which loads dataset, preprocesses it and
also assigns missing values to the sparse matrix
:return
utility_matrix numpy.ndarray containing the matrix
representation of the dataset
"""
dataset = load(rating_datas... | def preprocess():
| """Wrapper function which loads dataset, preprocesses it and
also assigns missing values to the sparse matrix
:return
utility_matrix numpy.ndarray containing the matrix
representation of the dataset
"""
dataset = load(rating_dataset,
... | dataset.
"""
with open(filepath, 'r', encoding='ISO-8859-1') as f:
text = str(f.read()).strip().split('\n')
return pandas.DataFrame.from_records(
[sentence.split('::') for sentence in text], columns=column)
def preprocess():
| 64 | 64 | 194 | 3 | 61 | PranjalGupta2199/recommendation-systems | svd/database.py | Python | preprocess | preprocess | 22 | 49 | 22 | 22 | 3ba21f669da3b774013322bc2338251643e88861 | bigcode/the-stack | train |
7beed4beb280a8ce55e18d72 | train | function | def send_message(message, **kwargs):
handler = get_message_handler(message)
handler.send(**kwargs)
| def send_message(message, **kwargs):
| handler = get_message_handler(message)
handler.send(**kwargs)
| kind = message.kind
handler = settings.FROIDE_CONFIG["message_handlers"].get(kind)
if handler is None:
handler_klass = DefaultMessageHandler
else:
handler_klass = get_message_handler_class(handler)
return handler_klass(message)
def send_message(message, **kwargs):
| 64 | 64 | 22 | 8 | 56 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | send_message | send_message | 25 | 27 | 25 | 25 | 6bba2a0a75ff9c7f918b7016f797afbddab9b4d2 | bigcode/the-stack | train |
0d439ddb0e08a993f6b186e7 | train | class | class MessageHandler(object):
def __init__(self, message):
self.message = message
def send(self, **kwargs):
message = self.message
if message.is_response:
return
request = message.request
ds = message.get_delivery_status()
if ds is not None and ds.is... | class MessageHandler(object):
| def __init__(self, message):
self.message = message
def send(self, **kwargs):
message = self.message
if message.is_response:
return
request = message.request
ds = message.get_delivery_status()
if ds is not None and ds.is_sent() and not kwargs.get("fo... | = get_message_handler_class(handler)
return handler_klass(message)
def send_message(message, **kwargs):
handler = get_message_handler(message)
handler.send(**kwargs)
def resend_message(message, **kwargs):
handler = get_message_handler(message)
handler.resend(**kwargs)
class MessageHandler(objec... | 64 | 64 | 209 | 5 | 59 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | MessageHandler | MessageHandler | 35 | 72 | 35 | 35 | 452955254ab79b218f2d09ab775fe89f0dc8b2e3 | bigcode/the-stack | train |
9850acf10f96cc48c4aff840 | train | class | class EmailMessageHandler(MessageHandler):
def run_send(self, **kwargs):
message = self.message
request = message.request
attachments = kwargs.get("attachments", [])
extra_kwargs = {}
# Use send_foi_mail here
from_addr = make_address(
request.secret_addr... | class EmailMessageHandler(MessageHandler):
| def run_send(self, **kwargs):
message = self.message
request = message.request
attachments = kwargs.get("attachments", [])
extra_kwargs = {}
# Use send_foi_mail here
from_addr = make_address(
request.secret_address,
"{} [#{}]".format(request.... | if ds is not None and ds.is_sent() and not kwargs.get("force"):
# If status is received, do not send
return
if ds:
ds.retry_count += 1
ds.save()
message.sent = False
message.save()
self.send(**kwargs)
def run_send(self, **kw... | 115 | 115 | 384 | 7 | 107 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | EmailMessageHandler | EmailMessageHandler | 83 | 139 | 83 | 83 | 4e729de641e3717ffae4acaa887214b72f06d9d1 | bigcode/the-stack | train |
e44e315b641ff7825c76cc4d | train | function | def get_message_handler_class(dotted):
return get_module_attr_from_dotted_path(dotted)
| def get_message_handler_class(dotted):
| return get_module_attr_from_dotted_path(dotted)
| from django.conf import settings
from django.utils import timezone
from froide.helper.email_utils import make_address
from froide.helper.utils import get_module_attr_from_dotted_path
from .foi_mail import send_foi_mail
from .models import DeliveryStatus
def get_message_handler_class(dotted):
| 61 | 64 | 20 | 8 | 52 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | get_message_handler_class | get_message_handler_class | 11 | 12 | 11 | 11 | 6af9ae60da4756daccd515fc5b012771044562d5 | bigcode/the-stack | train |
f7993c5a86c06a5c7148b879 | train | function | def resend_message(message, **kwargs):
handler = get_message_handler(message)
handler.resend(**kwargs)
| def resend_message(message, **kwargs):
| handler = get_message_handler(message)
handler.resend(**kwargs)
| handler is None:
handler_klass = DefaultMessageHandler
else:
handler_klass = get_message_handler_class(handler)
return handler_klass(message)
def send_message(message, **kwargs):
handler = get_message_handler(message)
handler.send(**kwargs)
def resend_message(message, **kwargs):
| 64 | 64 | 23 | 8 | 56 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | resend_message | resend_message | 30 | 32 | 30 | 30 | d9cabc5c5942dbc65b0295b37334602ec57b9451 | bigcode/the-stack | train |
307a96d45b83592f57b82df8 | train | class | class DefaultMessageHandler(MessageHandler):
def send(self, **kwargs):
pass
def resend(self, **kwargs):
pass
| class DefaultMessageHandler(MessageHandler):
| def send(self, **kwargs):
pass
def resend(self, **kwargs):
pass
| is received, do not send
return
if ds:
ds.retry_count += 1
ds.save()
message.sent = False
message.save()
self.send(**kwargs)
def run_send(self, **kwargs):
raise NotImplementedError
class DefaultMessageHandler(MessageHandler):
| 64 | 64 | 29 | 7 | 56 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | DefaultMessageHandler | DefaultMessageHandler | 75 | 80 | 75 | 75 | 8ccf10cea323ffdaf4a906f2e6a83414d7a7481d | bigcode/the-stack | train |
d16757b9e31d90b46aac0b06 | train | function | def get_message_handler(message):
kind = message.kind
handler = settings.FROIDE_CONFIG["message_handlers"].get(kind)
if handler is None:
handler_klass = DefaultMessageHandler
else:
handler_klass = get_message_handler_class(handler)
return handler_klass(message)
| def get_message_handler(message):
| kind = message.kind
handler = settings.FROIDE_CONFIG["message_handlers"].get(kind)
if handler is None:
handler_klass = DefaultMessageHandler
else:
handler_klass = get_message_handler_class(handler)
return handler_klass(message)
| .email_utils import make_address
from froide.helper.utils import get_module_attr_from_dotted_path
from .foi_mail import send_foi_mail
from .models import DeliveryStatus
def get_message_handler_class(dotted):
return get_module_attr_from_dotted_path(dotted)
def get_message_handler(message):
| 64 | 64 | 63 | 6 | 58 | MrKrisKrisu/froide | froide/foirequest/message_handlers.py | Python | get_message_handler | get_message_handler | 15 | 22 | 15 | 15 | cb05ebbe163ae34277e6797afe47870028287f65 | bigcode/the-stack | train |
ee34a2d7cf48bd5aa6082a9f | train | class | class Error(Exception):
pass
| class Error(Exception):
| pass
| #!/usr/bin/env python
"""Connection pooling for MySQLdb connections."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import threading
from future.utils import string_types
import MySQLdb
class Error(Exception):
| 60 | 64 | 7 | 4 | 55 | nkrios/grr | grr/server/grr_response_server/databases/mysql_pool.py | Python | Error | Error | 15 | 16 | 15 | 15 | c8e1f8a5c317a0f0e168cf6f96d1b6bb4946a1a7 | bigcode/the-stack | train |
e2becfd72b79a74324df21b4 | train | class | class _CursorProxy(object):
"""A proxy/wrapper of an underlying database cursor object.
This class exists to mark the connection to be closed, instead of returned to
the pool, when the connection may be broken.
"""
def __init__(self, con, cursor):
self.con = con
self.cursor = cursor
@property
d... | class _CursorProxy(object):
| """A proxy/wrapper of an underlying database cursor object.
This class exists to mark the connection to be closed, instead of returned to
the pool, when the connection may be broken.
"""
def __init__(self, con, cursor):
self.con = con
self.cursor = cursor
@property
def description(self):
re... | database connection object.
This class exists to return the underlying connection to the pool instead of
closing it. With the help of _CursorProxy, it does close the underlying
connection when it may be in an errored state.
"""
def __init__(self, pool, con):
self.con = con
self.pool = pool
self... | 256 | 256 | 877 | 6 | 250 | nkrios/grr | grr/server/grr_response_server/databases/mysql_pool.py | Python | _CursorProxy | _CursorProxy | 142 | 250 | 142 | 142 | 78ac94b29e81d7b0ca082dceed8d207815497005 | bigcode/the-stack | train |
4ac7dce7c89a77f503cd3a4a | train | class | class Pool(object):
"""A Pool of database connections.
A simple pool, with a maximum number of simultaneous connections. Primary goal
is to do the right thing when using MySQLdb in obvious ways (our use case),
but we also try to stay loosely within the PEP-249 standard.
Intends to be thread safe in that mul... | class Pool(object):
| """A Pool of database connections.
A simple pool, with a maximum number of simultaneous connections. Primary goal
is to do the right thing when using MySQLdb in obvious ways (our use case),
but we also try to stay loosely within the PEP-249 standard.
Intends to be thread safe in that multiple connections ca... | #!/usr/bin/env python
"""Connection pooling for MySQLdb connections."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import threading
from future.utils import string_types
import MySQLdb
class Error(Exception):
pass
class PoolAlre... | 90 | 148 | 494 | 4 | 85 | nkrios/grr | grr/server/grr_response_server/databases/mysql_pool.py | Python | Pool | Pool | 27 | 92 | 27 | 27 | 057e0ca9927089caa450eaeec7edcc932d805caa | bigcode/the-stack | train |
9caca39d1a9a4fccd29ace61 | train | class | class SemicolonNotAllowedInQueryError(Error):
pass
| class SemicolonNotAllowedInQueryError(Error):
| pass
| import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import threading
from future.utils import string_types
import MySQLdb
class Error(Exception):
pass
class PoolAlreadyClosedError(Error):
pass
class SemicolonNotAllowedInQueryError(Error):
| 64 | 64 | 13 | 10 | 53 | nkrios/grr | grr/server/grr_response_server/databases/mysql_pool.py | Python | SemicolonNotAllowedInQueryError | SemicolonNotAllowedInQueryError | 23 | 24 | 23 | 23 | 10b9dad3be7a024f5ae60c457912c60fe88845f6 | bigcode/the-stack | train |
17c2ea7f3f31ab8be3ee4a63 | train | class | class _ConnectionProxy(object):
"""A proxy/wrapper of the underlying database connection object.
This class exists to return the underlying connection to the pool instead of
closing it. With the help of _CursorProxy, it does close the underlying
connection when it may be in an errored state.
"""
def __ini... | class _ConnectionProxy(object):
| """A proxy/wrapper of the underlying database connection object.
This class exists to return the underlying connection to the pool instead of
closing it. With the help of _CursorProxy, it does close the underlying
connection when it may be in an errored state.
"""
def __init__(self, pool, con):
self.c... | Error:
# Create a connection, release the pool allocation if it fails.
try:
c = self.connect_func()
except Exception:
self.limiter.release()
raise
return _ConnectionProxy(self, c)
def close(self):
self.closed = True
for conn in self.idle_conns:
conn.close()... | 79 | 79 | 265 | 6 | 73 | nkrios/grr | grr/server/grr_response_server/databases/mysql_pool.py | Python | _ConnectionProxy | _ConnectionProxy | 95 | 139 | 95 | 95 | 2ffc54d96bb1315df36998a40166d557cfcba4cc | bigcode/the-stack | train |
824456ef9a4529e35f6585e1 | train | class | class PoolAlreadyClosedError(Error):
pass
| class PoolAlreadyClosedError(Error):
| pass
| """Connection pooling for MySQLdb connections."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import threading
from future.utils import string_types
import MySQLdb
class Error(Exception):
pass
class PoolAlreadyClosedError(Error):
| 64 | 64 | 10 | 7 | 56 | nkrios/grr | grr/server/grr_response_server/databases/mysql_pool.py | Python | PoolAlreadyClosedError | PoolAlreadyClosedError | 19 | 20 | 19 | 19 | bd6fd156f7bcfa1d09b4c783d7ec6dfa1b3996f7 | bigcode/the-stack | train |
32a652de992cecb62b92a533 | train | function | @click.command()
def main():
api.validate()
| @click.command()
def main():
| api.validate()
| import click
from rtm import api
@click.command()
def main():
| 15 | 64 | 10 | 6 | 8 | erickirch/fdr | rtm/cli.py | Python | main | main | 5 | 7 | 5 | 6 | eb0fdc9440fffa3013ae34b526cccd010698afaa | bigcode/the-stack | train |
9f64500071cdf3136b4a38f4 | train | class | class Cfg( ctypes.Structure ):
_fields_ = [
("ident", uint), # r-
# 4'700'00'00 subarctic 2.1
# 4'700'02'00 aegis pruss1 (according to TRM)
# 4'701'01'00 aegis pruss0 (according to TRM)
# 4'700'02'01 am572x 2.0 (both instances)
... | class Cfg( ctypes.Structure ):
| _fields_ = [
("ident", uint), # r-
# 4'700'00'00 subarctic 2.1
# 4'700'02'00 aegis pruss1 (according to TRM)
# 4'701'01'00 aegis pruss0 (according to TRM)
# 4'700'02'01 am572x 2.0 (both instances)
# sysconfig
("_id... | ########## PRU-ICSS subsystem config module ####################################
##
## Note that sigma-delta and EnDAT were not yet present in ICSS v0, which is
## present in subarctic (am335x) and silicon versions 1.x of vayu (am572x).
import ctypes
from ctypes import c_uint32 as uint
from uio.ti.irqc4 import IrqComb... | 109 | 256 | 1,918 | 8 | 101 | mvduin/py-uio | src/uio/ti/icss/cfg.py | Python | Cfg | Cfg | 13 | 174 | 13 | 13 | 56d46b85857ad3c81c31e0242fa918594b705b71 | bigcode/the-stack | train |
0490d4fb3e86423138613705 | train | class | class FoodStrategy(object):
def __init__(self, raw_config):
# Load learner parameters from learner.json
config = cf.LearnerConfig(raw_config)
self.num_actions = config.num_actions
self.small_area_threshold = 11
def start(self, data):
pass
def end(self, dat... | class FoodStrategy(object):
| def __init__(self, raw_config):
# Load learner parameters from learner.json
config = cf.LearnerConfig(raw_config)
self.num_actions = config.num_actions
self.small_area_threshold = 11
def start(self, data):
pass
def end(self, data):
pass
def ... | import util
import config as cf
import numpy as np
class State(object):
def __init__(self, pos, direct, parent):
self.pos = pos
self.direct = direct
self.parent = parent
class FoodStrategy(object):
| 53 | 256 | 1,143 | 5 | 47 | pcliu0822/battlesnake | FoodStrategy.py | Python | FoodStrategy | FoodStrategy | 11 | 133 | 11 | 11 | 45d2ed6d3722eb4e57fb92cae11591e6ced7b8cb | bigcode/the-stack | train |
35257a4d059275009ab9188a | train | class | class State(object):
def __init__(self, pos, direct, parent):
self.pos = pos
self.direct = direct
self.parent = parent
| class State(object):
| def __init__(self, pos, direct, parent):
self.pos = pos
self.direct = direct
self.parent = parent
| import util
import config as cf
import numpy as np
class State(object):
| 17 | 64 | 35 | 4 | 12 | pcliu0822/battlesnake | FoodStrategy.py | Python | State | State | 5 | 9 | 5 | 5 | 033764c757b16784c70e1463b1b3aede5169d323 | bigcode/the-stack | train |
87c48abf1c692869c226e488 | train | class | class BaseConversations:
"""
Attributes:
server - TelegramBotServer server object
entry_cmd - List of commands for entry_points,
will be binded to self.start eg. ["/start"]
fallback_cmd - List of commands for fallbacks,
will be binded to self.cancel eg. ["/cancelstart"]
"""
_... | class BaseConversations:
| """
Attributes:
server - TelegramBotServer server object
entry_cmd - List of commands for entry_points,
will be binded to self.start eg. ["/start"]
fallback_cmd - List of commands for fallbacks,
will be binded to self.cancel eg. ["/cancelstart"]
"""
__slots__ = ("server", "en... | from telegram.ext import (
CommandHandler, ConversationHandler,
Filters, MessageHandler
)
class BaseConversations:
| 24 | 138 | 462 | 5 | 19 | joh90/iot | iot/conversations/__init__.py | Python | BaseConversations | BaseConversations | 7 | 75 | 7 | 7 | 6c5eec38e87d9b90164a559a98343b69466bd0b6 | bigcode/the-stack | train |
413cdc99048734f4d138af02 | train | function | def nbest_loss(acwt=0.6):
def loss(y_true, y_pred):
'''
y_pred : (block, batch, time, unit)
y_true[0] : (block, batch, time, unit) # 1-best path
y_true[1] : (block, batch) # log-scaled lm-score
y_true[2] : (n-best, block, batch, time, unit) # n-best path
y_true[3]... | def nbest_loss(acwt=0.6):
| def loss(y_true, y_pred):
'''
y_pred : (block, batch, time, unit)
y_true[0] : (block, batch, time, unit) # 1-best path
y_true[1] : (block, batch) # log-scaled lm-score
y_true[2] : (n-best, block, batch, time, unit) # n-best path
y_true[3] : (n-best, block, batch) #... | import numpy as np
import tensorflow as tf
def nbest_loss(acwt=0.6):
| 21 | 104 | 348 | 11 | 9 | akio-kobayashi/lc_lstm | nbest_loss.py | Python | nbest_loss | nbest_loss | 4 | 38 | 4 | 5 | 5951d8b70032407f9ca53a2ea96351c086f9d083 | bigcode/the-stack | train |
67838cba4ea909eb8130fdab | train | class | class YoloV5Segmenter(Executor):
"""
Segment the image into bounding boxes and set labels
:param model_name_or_path: the yolov5 model to use, can be a model name specified in ultralytics/yolov5's hubconf.py
file, a custom model path or url
:param default_batch_size: default batch size
:param... | class YoloV5Segmenter(Executor):
| """
Segment the image into bounding boxes and set labels
:param model_name_or_path: the yolov5 model to use, can be a model name specified in ultralytics/yolov5's hubconf.py
file, a custom model path or url
:param default_batch_size: default batch size
:param default_traversal_paths: default... | __copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from typing import Dict, Iterable, Optional, Tuple
import torch
from jina import Document, DocumentArray, Executor, requests
from jina.logging.logger import JinaLogger
from jina_commons.batching import get_docs_... | 92 | 256 | 961 | 10 | 81 | vivek2301/executors | jinahub/segmenters/YoloV5Segmenter/yolov5_segmenter.py | Python | YoloV5Segmenter | YoloV5Segmenter | 12 | 121 | 12 | 12 | f0bbbf54a1845d0bb4e070ce08ba944ec4941dea | bigcode/the-stack | train |
5d842378e35bd649e848105d | train | function | def test_fixed_ref_behind(qisrc_action, git_server, record_messages):
git_server.create_repo("foo.git")
git_server.push_file("foo.git", "a.txt", "a")
git_server.push_tag("foo.git", "v0.1")
git_server.set_fixed_ref("foo.git", "v0.1")
qisrc_action("init", git_server.manifest_url)
git_worktree = Te... | def test_fixed_ref_behind(qisrc_action, git_server, record_messages):
| git_server.create_repo("foo.git")
git_server.push_file("foo.git", "a.txt", "a")
git_server.push_tag("foo.git", "v0.1")
git_server.set_fixed_ref("foo.git", "v0.1")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
... | )
qisrc_action("status")
assert record_messages.find("foo fixed ref v0.1")
record_messages.reset()
qisrc_action("status", "--short")
assert not record_messages.find("fixed ref")
def test_fixed_ref_behind(qisrc_action, git_server, record_messages):
| 64 | 64 | 157 | 17 | 47 | vbarbaresi/qibuild | python/qisrc/test/test_qisrc_status.py | Python | test_fixed_ref_behind | test_fixed_ref_behind | 80 | 91 | 80 | 80 | 5edfce832b4b78b1a45fbd5c7faaab389942241f | bigcode/the-stack | train |
33a578eca964a15e11c1ebfb | train | function | def test_untracked(qisrc_action, record_messages):
git_worktree = qisrc_action.git_worktree
foo = git_worktree.create_git_project("foo")
bar = git_worktree.create_git_project("bar")
# pylint: disable-msg=E1101
foo_path = py.path.local(foo.path)
foo_path.ensure("untracked", file=True)
qisrc_a... | def test_untracked(qisrc_action, record_messages):
| git_worktree = qisrc_action.git_worktree
foo = git_worktree.create_git_project("foo")
bar = git_worktree.create_git_project("bar")
# pylint: disable-msg=E1101
foo_path = py.path.local(foo.path)
foo_path.ensure("untracked", file=True)
qisrc_action("status")
dirty = record_messages.find("D... | the COPYING file.
import py
import qisrc.git
from qisrc.test.conftest import TestGitWorkTree
# allow the existing foo/bar/baz names
# pylint: disable=blacklisted-name
# pylint: disable=unused-variable
def test_untracked(qisrc_action, record_messages):
| 64 | 64 | 138 | 12 | 51 | vbarbaresi/qibuild | python/qisrc/test/test_qisrc_status.py | Python | test_untracked | test_untracked | 14 | 28 | 14 | 14 | 70f66c80c4ffaf2f9150094cd0d46dc8ed7fefcd | bigcode/the-stack | train |
15427536a18e4d3aafd09e19 | train | function | def test_not_on_any_branch(qisrc_action, record_messages):
git_worktree = TestGitWorkTree()
foo = git_worktree.create_git_project("foo")
foo_git = qisrc.git.Git(foo.path)
(rc, out) = foo_git.call("log", "-1", "HEAD", "--pretty=%H", raises=False)
foo_git.checkout(out)
qisrc_action("status")
a... | def test_not_on_any_branch(qisrc_action, record_messages):
| git_worktree = TestGitWorkTree()
foo = git_worktree.create_git_project("foo")
foo_git = qisrc.git.Git(foo.path)
(rc, out) = foo_git.call("log", "-1", "HEAD", "--pretty=%H", raises=False)
foo_git.checkout(out)
qisrc_action("status")
assert record_messages.find("not on any branch")
| foo_git.checkout("-B", "devel")
qisrc_action("status")
assert record_messages.find("Some projects are not on the expected branch")
assert record_messages.find(r"\* foo\s+devel\s+master")
def test_not_on_any_branch(qisrc_action, record_messages):
| 64 | 64 | 99 | 14 | 50 | vbarbaresi/qibuild | python/qisrc/test/test_qisrc_status.py | Python | test_not_on_any_branch | test_not_on_any_branch | 58 | 65 | 58 | 58 | 796365a05eae3357532eea2d2769f44c069d9f46 | bigcode/the-stack | train |
db8d313d45b130b08046f8d8 | train | function | def test_fixed_ref_up_to_date(qisrc_action, git_server, record_messages):
git_server.create_repo("foo.git")
git_server.push_tag("foo.git", "v0.1")
git_server.set_fixed_ref("foo.git", "v0.1")
qisrc_action("init", git_server.manifest_url)
qisrc_action("status")
assert record_messages.find("foo fix... | def test_fixed_ref_up_to_date(qisrc_action, git_server, record_messages):
| git_server.create_repo("foo.git")
git_server.push_tag("foo.git", "v0.1")
git_server.set_fixed_ref("foo.git", "v0.1")
qisrc_action("init", git_server.manifest_url)
qisrc_action("status")
assert record_messages.find("foo fixed ref v0.1")
record_messages.reset()
qisrc_action("status", "--sh... | ) = foo_git.call("log", "-1", "HEAD", "--pretty=%H", raises=False)
foo_git.checkout(out)
qisrc_action("status")
assert record_messages.find("not on any branch")
def test_fixed_ref_up_to_date(qisrc_action, git_server, record_messages):
| 64 | 64 | 117 | 18 | 46 | vbarbaresi/qibuild | python/qisrc/test/test_qisrc_status.py | Python | test_fixed_ref_up_to_date | test_fixed_ref_up_to_date | 68 | 77 | 68 | 68 | a3db33b29af78d43d9c1463143d705c3cb855ce0 | bigcode/the-stack | train |
af4c8ea4c4e8bb1549315364 | train | function | def test_behind(qisrc_action, git_server, record_messages):
git_server.create_repo("foo.git")
git_server.create_repo("bar.git")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
git_server.push_file("foo.git", "new_file", "")... | def test_behind(qisrc_action, git_server, record_messages):
| git_server.create_repo("foo.git")
git_server.create_repo("bar.git")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
git_server.push_file("foo.git", "new_file", "")
foo_git = qisrc.git.Git(foo.path)
foo_git.fetch()
... | = record_messages.find("Dirty projects")
assert "0" in dirty
record_messages.reset()
qisrc_action("status", "-u")
dirty = record_messages.find("Dirty projects")
assert "1" in dirty
def test_behind(qisrc_action, git_server, record_messages):
| 64 | 64 | 119 | 15 | 48 | vbarbaresi/qibuild | python/qisrc/test/test_qisrc_status.py | Python | test_behind | test_behind | 31 | 41 | 31 | 31 | d87d3288918485e218e735ed52e13b07950d4205 | bigcode/the-stack | train |
d9b5aa625717017ff76d4b2d | train | function | def test_wrong_branch(qisrc_action, git_server, record_messages):
git_server.create_repo("foo.git")
git_server.create_repo("bar.git")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
bar = git_worktree.get_git_project("bar")... | def test_wrong_branch(qisrc_action, git_server, record_messages):
| git_server.create_repo("foo.git")
git_server.create_repo("bar.git")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
bar = git_worktree.get_git_project("bar")
foo_git = qisrc.git.Git(foo.path)
foo_git.checkout("-B", ... | _server.push_file("foo.git", "new_file", "")
foo_git = qisrc.git.Git(foo.path)
foo_git.fetch()
qisrc_action("status")
assert record_messages.find("foo : master tracking -1")
def test_wrong_branch(qisrc_action, git_server, record_messages):
| 64 | 64 | 142 | 15 | 49 | vbarbaresi/qibuild | python/qisrc/test/test_qisrc_status.py | Python | test_wrong_branch | test_wrong_branch | 44 | 55 | 44 | 44 | 903d58b1246d9de2608098448e76a609ce4ae651 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.