blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
6ddcb54cda22725876188c50966bb04907de47a0
[ "libprep = self.get_libprep(projectid, sampleid, libprepid)\nif not libprep:\n return\nself.add_libprep_links(libprep)\nself.write(libprep)", "try:\n libprep = self.get_libprep(projectid, sampleid, libprepid)\n data = json.loads(self.request.body)\nexcept Exception as msg:\n self.send_error(400, reaso...
<|body_start_0|> libprep = self.get_libprep(projectid, sampleid, libprepid) if not libprep: return self.add_libprep_links(libprep) self.write(libprep) <|end_body_0|> <|body_start_1|> try: libprep = self.get_libprep(projectid, sampleid, libprepid) ...
Access a libprep.
ApiLibprep
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiLibprep: """Access a libprep.""" def get(self, projectid, sampleid, libprepid): """Return the libprep data as JSON. Return HTTP 404 if no such libprep, sample or project.""" <|body_0|> def put(self, projectid, sampleid, libprepid): """Update the libprep with t...
stack_v2_sparse_classes_75kplus_train_074100
8,693
permissive
[ { "docstring": "Return the libprep data as JSON. Return HTTP 404 if no such libprep, sample or project.", "name": "get", "signature": "def get(self, projectid, sampleid, libprepid)" }, { "docstring": "Update the libprep with the given JSON data. Return HTTP 204 \"No Content\". Return HTTP 400 if...
3
stack_v2_sparse_classes_30k_train_032717
Implement the Python class `ApiLibprep` described below. Class description: Access a libprep. Method signatures and docstrings: - def get(self, projectid, sampleid, libprepid): Return the libprep data as JSON. Return HTTP 404 if no such libprep, sample or project. - def put(self, projectid, sampleid, libprepid): Upda...
Implement the Python class `ApiLibprep` described below. Class description: Access a libprep. Method signatures and docstrings: - def get(self, projectid, sampleid, libprepid): Return the libprep data as JSON. Return HTTP 404 if no such libprep, sample or project. - def put(self, projectid, sampleid, libprepid): Upda...
655400042cf782cf93c2d45388ed205d9a1ad296
<|skeleton|> class ApiLibprep: """Access a libprep.""" def get(self, projectid, sampleid, libprepid): """Return the libprep data as JSON. Return HTTP 404 if no such libprep, sample or project.""" <|body_0|> def put(self, projectid, sampleid, libprepid): """Update the libprep with t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApiLibprep: """Access a libprep.""" def get(self, projectid, sampleid, libprepid): """Return the libprep data as JSON. Return HTTP 404 if no such libprep, sample or project.""" libprep = self.get_libprep(projectid, sampleid, libprepid) if not libprep: return se...
the_stack_v2_python_sparse
charon/libprep.py
NationalGenomicsInfrastructure/charon
train
3
2f5107b2d501904fb90c67da4d6e8ad43dddf028
[ "password = validated_data.pop('password')\nuser_instance = auth_models.User(**validated_data)\nuser_instance.set_password(password)\nuser_instance.save()\nreturn user_instance", "password = validated_data.pop('password', None)\nif password is not None:\n instance.set_password(password)\nfor field, value in va...
<|body_start_0|> password = validated_data.pop('password') user_instance = auth_models.User(**validated_data) user_instance.set_password(password) user_instance.save() return user_instance <|end_body_0|> <|body_start_1|> password = validated_data.pop('password', None) ...
UserSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSerializer: def create(self, validated_data: dict) -> auth_models.User: """Create the user instance Args: validated_data: The validated serializer data Returns: A django auth user instance""" <|body_0|> def update(self, instance: auth_models.User, validated_data: dict) -...
stack_v2_sparse_classes_75kplus_train_074101
1,758
no_license
[ { "docstring": "Create the user instance Args: validated_data: The validated serializer data Returns: A django auth user instance", "name": "create", "signature": "def create(self, validated_data: dict) -> auth_models.User" }, { "docstring": "Update the user instance Args: instance: The user ins...
2
stack_v2_sparse_classes_30k_train_036528
Implement the Python class `UserSerializer` described below. Class description: Implement the UserSerializer class. Method signatures and docstrings: - def create(self, validated_data: dict) -> auth_models.User: Create the user instance Args: validated_data: The validated serializer data Returns: A django auth user i...
Implement the Python class `UserSerializer` described below. Class description: Implement the UserSerializer class. Method signatures and docstrings: - def create(self, validated_data: dict) -> auth_models.User: Create the user instance Args: validated_data: The validated serializer data Returns: A django auth user i...
195b8992cea8c54a602308065c8a7c626e8e061b
<|skeleton|> class UserSerializer: def create(self, validated_data: dict) -> auth_models.User: """Create the user instance Args: validated_data: The validated serializer data Returns: A django auth user instance""" <|body_0|> def update(self, instance: auth_models.User, validated_data: dict) -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserSerializer: def create(self, validated_data: dict) -> auth_models.User: """Create the user instance Args: validated_data: The validated serializer data Returns: A django auth user instance""" password = validated_data.pop('password') user_instance = auth_models.User(**validated_dat...
the_stack_v2_python_sparse
accounts/serializers.py
BradleyKirton/tangent-backend
train
0
75239f2e0f0a59cb9b706c37c00e2bb14010b311
[ "Parametre.__init__(self, 'lister', 'list')\nself.schema = ''\nself.aide_courte = 'liste les attitudes existantes'\nself.aide_longue = 'Cette sous-commande offre une liste des attitudes existantes.'", "attitudes = None\nif personnage.est_immortel():\n attitudes = type(self).importeur.communication.attitudes.va...
<|body_start_0|> Parametre.__init__(self, 'lister', 'list') self.schema = '' self.aide_courte = 'liste les attitudes existantes' self.aide_longue = 'Cette sous-commande offre une liste des attitudes existantes.' <|end_body_0|> <|body_start_1|> attitudes = None if personn...
Commande 'attitudes lister'.
PrmLister
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmLister: """Commande 'attitudes lister'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre...
stack_v2_sparse_classes_75kplus_train_074102
3,460
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_041207
Implement the Python class `PrmLister` described below. Class description: Commande 'attitudes lister'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmLister` described below. Class description: Commande 'attitudes lister'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmLister: """Commande 'attitu...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmLister: """Commande 'attitudes lister'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmLister: """Commande 'attitudes lister'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'lister', 'list') self.schema = '' self.aide_courte = 'liste les attitudes existantes' self.aide_longue = 'Cette sous-commande offre une liste...
the_stack_v2_python_sparse
src/primaires/communication/commandes/attitudes/lister.py
vincent-lg/tsunami
train
5
8a8b6aa150245cba15e44e049b8e8593469c94a6
[ "parser.add_argument('repo', metavar='REPO', help='Docker repository name')\nparser.add_argument('tag', metavar='TAG', help='Tag of the Docker image used in analysis')\nparser.add_argument('sha256', metavar='SHA256', help='SHA256 id of the Docker image')", "try:\n Version.objects.create(repo=opts['repo'], tag=...
<|body_start_0|> parser.add_argument('repo', metavar='REPO', help='Docker repository name') parser.add_argument('tag', metavar='TAG', help='Tag of the Docker image used in analysis') parser.add_argument('sha256', metavar='SHA256', help='SHA256 id of the Docker image') <|end_body_0|> <|body_star...
Add a docker image tag to the database.
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Add a docker image tag to the database.""" def add_arguments(self, parser): """Command line arguements.""" <|body_0|> def handle(self, *args, **opts): """Add a docker image tag to the database.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_074103
1,228
no_license
[ { "docstring": "Command line arguements.", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": "Add a docker image tag to the database.", "name": "handle", "signature": "def handle(self, *args, **opts)" } ]
2
stack_v2_sparse_classes_30k_train_052171
Implement the Python class `Command` described below. Class description: Add a docker image tag to the database. Method signatures and docstrings: - def add_arguments(self, parser): Command line arguements. - def handle(self, *args, **opts): Add a docker image tag to the database.
Implement the Python class `Command` described below. Class description: Add a docker image tag to the database. Method signatures and docstrings: - def add_arguments(self, parser): Command line arguements. - def handle(self, *args, **opts): Add a docker image tag to the database. <|skeleton|> class Command: """...
2c35ee47e131a74642e60fae6f1cc23561d8b1a6
<|skeleton|> class Command: """Add a docker image tag to the database.""" def add_arguments(self, parser): """Command line arguements.""" <|body_0|> def handle(self, *args, **opts): """Add a docker image tag to the database.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Command: """Add a docker image tag to the database.""" def add_arguments(self, parser): """Command line arguements.""" parser.add_argument('repo', metavar='REPO', help='Docker repository name') parser.add_argument('tag', metavar='TAG', help='Tag of the Docker image used in analysi...
the_stack_v2_python_sparse
version/management/commands/add_docker_tag.py
staphopia/staphopia-web
train
5
8d186842ae3a41bc6d217034c9ec605047f200d8
[ "super().__init__(label, parent=parent)\nself.setFocusPolicy(QtCore.Qt.StrongFocus)\nself.setDefault(False)\nself.setAutoDefault(False)\nself.clicked.connect(slot)\nif checkable:\n self.setCheckable(True)\nif width:\n self.setFixedWidth(width)", "if event.key() == QtCore.Qt.Key_Return or event.key() == QtCo...
<|body_start_0|> super().__init__(label, parent=parent) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setDefault(False) self.setAutoDefault(False) self.clicked.connect(slot) if checkable: self.setCheckable(True) if width: self.setFixedWid...
A button with associated label and slot function.
NXPushButton
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NXPushButton: """A button with associated label and slot function.""" def __init__(self, label, slot, checkable=False, width=None, parent=None): """Initialize button Parameters ---------- label : str Text describing the button slot : func Function to be called when the button is pres...
stack_v2_sparse_classes_75kplus_train_074104
43,131
permissive
[ { "docstring": "Initialize button Parameters ---------- label : str Text describing the button slot : func Function to be called when the button is pressed parent : QObject, optional Parent of button.", "name": "__init__", "signature": "def __init__(self, label, slot, checkable=False, width=None, parent...
2
stack_v2_sparse_classes_30k_train_048096
Implement the Python class `NXPushButton` described below. Class description: A button with associated label and slot function. Method signatures and docstrings: - def __init__(self, label, slot, checkable=False, width=None, parent=None): Initialize button Parameters ---------- label : str Text describing the button ...
Implement the Python class `NXPushButton` described below. Class description: A button with associated label and slot function. Method signatures and docstrings: - def __init__(self, label, slot, checkable=False, width=None, parent=None): Initialize button Parameters ---------- label : str Text describing the button ...
97110aa2ebeff95cc78496bf5396d6b51fc151a7
<|skeleton|> class NXPushButton: """A button with associated label and slot function.""" def __init__(self, label, slot, checkable=False, width=None, parent=None): """Initialize button Parameters ---------- label : str Text describing the button slot : func Function to be called when the button is pres...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NXPushButton: """A button with associated label and slot function.""" def __init__(self, label, slot, checkable=False, width=None, parent=None): """Initialize button Parameters ---------- label : str Text describing the button slot : func Function to be called when the button is pressed parent : ...
the_stack_v2_python_sparse
src/nexpy/gui/widgets.py
nexpy/nexpy
train
42
7e83a32018aefe02b63bcd7fa6d94fda20abdb54
[ "self.assertEqual(6, yourtest.sum(1, 2, 3))\nself.assertEqual(9, yourtest.sum(6, 3, 0))\nself.assertEqual(0, yourtest.sum(0, 0, 0))\nself.assertEqual(-30, yourtest.sum(-100, 50, 20))", "self.assertEqual('hellohello', yourtest.double('hello')())\nself.assertEqual(10, yourtest.double(5)())\nself.assertEqual(16, you...
<|body_start_0|> self.assertEqual(6, yourtest.sum(1, 2, 3)) self.assertEqual(9, yourtest.sum(6, 3, 0)) self.assertEqual(0, yourtest.sum(0, 0, 0)) self.assertEqual(-30, yourtest.sum(-100, 50, 20)) <|end_body_0|> <|body_start_1|> self.assertEqual('hellohello', yourtest.double('hel...
BasicFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicFunction: def test_basic(self): """3개의 arguments 를 받는 함수를 만들어라. 그 함수는 3개의 arguments를 모두 더한 값을 리턴시킨다.""" <|body_0|> def test_lambda(self): """주어진 값을 더블시키는 lambda 함수를 리턴시켜라""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertEqual(6, yourt...
stack_v2_sparse_classes_75kplus_train_074105
973
no_license
[ { "docstring": "3개의 arguments 를 받는 함수를 만들어라. 그 함수는 3개의 arguments를 모두 더한 값을 리턴시킨다.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "주어진 값을 더블시키는 lambda 함수를 리턴시켜라", "name": "test_lambda", "signature": "def test_lambda(self)" } ]
2
null
Implement the Python class `BasicFunction` described below. Class description: Implement the BasicFunction class. Method signatures and docstrings: - def test_basic(self): 3개의 arguments 를 받는 함수를 만들어라. 그 함수는 3개의 arguments를 모두 더한 값을 리턴시킨다. - def test_lambda(self): 주어진 값을 더블시키는 lambda 함수를 리턴시켜라
Implement the Python class `BasicFunction` described below. Class description: Implement the BasicFunction class. Method signatures and docstrings: - def test_basic(self): 3개의 arguments 를 받는 함수를 만들어라. 그 함수는 3개의 arguments를 모두 더한 값을 리턴시킨다. - def test_lambda(self): 주어진 값을 더블시키는 lambda 함수를 리턴시켜라 <|skeleton|> class Basic...
eafbeddc7a7706377478282252806de3a56cc5bb
<|skeleton|> class BasicFunction: def test_basic(self): """3개의 arguments 를 받는 함수를 만들어라. 그 함수는 3개의 arguments를 모두 더한 값을 리턴시킨다.""" <|body_0|> def test_lambda(self): """주어진 값을 더블시키는 lambda 함수를 리턴시켜라""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicFunction: def test_basic(self): """3개의 arguments 를 받는 함수를 만들어라. 그 함수는 3개의 arguments를 모두 더한 값을 리턴시킨다.""" self.assertEqual(6, yourtest.sum(1, 2, 3)) self.assertEqual(9, yourtest.sum(6, 3, 0)) self.assertEqual(0, yourtest.sum(0, 0, 0)) self.assertEqual(-30, yourtest.s...
the_stack_v2_python_sparse
003_basic_function/basic_function.py
AndersonJo/python-lab
train
0
486e310f29216480f63f060de5c48302d593cd54
[ "config_info = mongo_cli[config_db].find_one({'config_name': settings.CONFIG_NAME})\nconfig_info['_id'] = '%s' % config_info['_id']\nresponse_data = self.wrap_json_response(data=config_info, code=ReturnCode.SUCCESS)\nreturn jsonify(response_data)", "body_data = json.loads(request.get_data().decode())\nmongo_cli[c...
<|body_start_0|> config_info = mongo_cli[config_db].find_one({'config_name': settings.CONFIG_NAME}) config_info['_id'] = '%s' % config_info['_id'] response_data = self.wrap_json_response(data=config_info, code=ReturnCode.SUCCESS) return jsonify(response_data) <|end_body_0|> <|body_start...
SysConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SysConfig: def get(self): """系统数据 --- tags: - 系统设置 definitions: - schema: id: dao.system_config_info properties: _id: type: string config_name: type: integer description: 配置名 poc_thread: type: integer description: Poc线程扫描数 port_thread: type: integer description: 端口扫描线程数 auth_tester_threa...
stack_v2_sparse_classes_75kplus_train_074106
5,725
no_license
[ { "docstring": "系统数据 --- tags: - 系统设置 definitions: - schema: id: dao.system_config_info properties: _id: type: string config_name: type: integer description: 配置名 poc_thread: type: integer description: Poc线程扫描数 port_thread: type: integer description: 端口扫描线程数 auth_tester_thread: type: integer description: 认证爆破线程数...
2
stack_v2_sparse_classes_30k_train_018047
Implement the Python class `SysConfig` described below. Class description: Implement the SysConfig class. Method signatures and docstrings: - def get(self): 系统数据 --- tags: - 系统设置 definitions: - schema: id: dao.system_config_info properties: _id: type: string config_name: type: integer description: 配置名 poc_thread: typ...
Implement the Python class `SysConfig` described below. Class description: Implement the SysConfig class. Method signatures and docstrings: - def get(self): 系统数据 --- tags: - 系统设置 definitions: - schema: id: dao.system_config_info properties: _id: type: string config_name: type: integer description: 配置名 poc_thread: typ...
aa75f06ad25b1238176165a0dcf4685c59cd8284
<|skeleton|> class SysConfig: def get(self): """系统数据 --- tags: - 系统设置 definitions: - schema: id: dao.system_config_info properties: _id: type: string config_name: type: integer description: 配置名 poc_thread: type: integer description: Poc线程扫描数 port_thread: type: integer description: 端口扫描线程数 auth_tester_threa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SysConfig: def get(self): """系统数据 --- tags: - 系统设置 definitions: - schema: id: dao.system_config_info properties: _id: type: string config_name: type: integer description: 配置名 poc_thread: type: integer description: Poc线程扫描数 port_thread: type: integer description: 端口扫描线程数 auth_tester_thread: type: integ...
the_stack_v2_python_sparse
aquaman/views/sys_config.py
jstang9527/aquaman
train
15
8413d179779225a524591035b2fde6415a4ff698
[ "json_data = request.body\nstream = io.BytesIO(json_data)\nparsedata = JSONParser().parse(stream)\ngetId = parsedata.get('eid', None)\nif getId is not None:\n employee = Employee.objects.get(id=getId)\n serializer = EmployeeSerializer(employee)\n return JsonResponse(serializer.data, safe=False)\nemployees ...
<|body_start_0|> json_data = request.body stream = io.BytesIO(json_data) parsedata = JSONParser().parse(stream) getId = parsedata.get('eid', None) if getId is not None: employee = Employee.objects.get(id=getId) serializer = EmployeeSerializer(employee) ...
EmployeeModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeeModule: def get(self, request, *args, **kwargs): """Get Specific record""" <|body_0|> def post(self, request, *args, **kwargs): """Create Specific record""" <|body_1|> def put(self, request, *args, **kwargs): """Update Specific record""" ...
stack_v2_sparse_classes_75kplus_train_074107
3,425
no_license
[ { "docstring": "Get Specific record", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Create Specific record", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Update Specific record", "name": ...
4
stack_v2_sparse_classes_30k_train_010077
Implement the Python class `EmployeeModule` described below. Class description: Implement the EmployeeModule class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Get Specific record - def post(self, request, *args, **kwargs): Create Specific record - def put(self, request, *args, **kwar...
Implement the Python class `EmployeeModule` described below. Class description: Implement the EmployeeModule class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Get Specific record - def post(self, request, *args, **kwargs): Create Specific record - def put(self, request, *args, **kwar...
9cabb5bb511361da1cfff07ee694c1f1a02cc689
<|skeleton|> class EmployeeModule: def get(self, request, *args, **kwargs): """Get Specific record""" <|body_0|> def post(self, request, *args, **kwargs): """Create Specific record""" <|body_1|> def put(self, request, *args, **kwargs): """Update Specific record""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmployeeModule: def get(self, request, *args, **kwargs): """Get Specific record""" json_data = request.body stream = io.BytesIO(json_data) parsedata = JSONParser().parse(stream) getId = parsedata.get('eid', None) if getId is not None: employee = Empl...
the_stack_v2_python_sparse
user/views.py
Talibali/DRF-Code-Style
train
0
5b2d9b847408c6bd8df3ed9f69b8e6c100e9a79c
[ "typeid, value = (userindex.typeid, userindex.value)\nif Retrieve.byindex(typeid, value):\n raise error.UserIndexValueBound(typeid + ' - ' + value)\ntry:\n user: User = Retrieve.byid(userid)\n user.indexs.append(userindex)\nexcept mongoengine.NotUniqueError as _error:\n raise error.UserIndexTypeBound(ty...
<|body_start_0|> typeid, value = (userindex.typeid, userindex.value) if Retrieve.byindex(typeid, value): raise error.UserIndexValueBound(typeid + ' - ' + value) try: user: User = Retrieve.byid(userid) user.indexs.append(userindex) except mongoengine.No...
创建用户静态函数集合
Create
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """创建用户静态函数集合""" def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: """该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误""" <|body_0|> def group(userid: ObjectId, groupid: ObjectId) -> User: """向组中添加用户: 向用户组的用户记录中添加 向用户的...
stack_v2_sparse_classes_75kplus_train_074108
4,956
permissive
[ { "docstring": "该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误", "name": "index", "signature": "def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]" }, { "docstring": "向组中添加用户: 向用户组的用户记录中添加 向用户的组记录中添加", "name": "group", "signature": "def group(userid: ...
2
stack_v2_sparse_classes_30k_test_000382
Implement the Python class `Create` described below. Class description: 创建用户静态函数集合 Method signatures and docstrings: - def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: 该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误 - def group(userid: ObjectId, groupid: ObjectId) -> User: 向组中添加...
Implement the Python class `Create` described below. Class description: 创建用户静态函数集合 Method signatures and docstrings: - def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: 该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误 - def group(userid: ObjectId, groupid: ObjectId) -> User: 向组中添加...
79e34f4b8fba8c6fd208b5a3049103dca2064ab5
<|skeleton|> class Create: """创建用户静态函数集合""" def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: """该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误""" <|body_0|> def group(userid: ObjectId, groupid: ObjectId) -> User: """向组中添加用户: 向用户组的用户记录中添加 向用户的...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Create: """创建用户静态函数集合""" def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: """该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误""" typeid, value = (userindex.typeid, userindex.value) if Retrieve.byindex(typeid, value): raise error.Us...
the_stack_v2_python_sparse
leaf/rbac/functions/user.py
guiqiqi/leaf
train
122
1d7ee4d6487cb006fa1123eb93463030b1521eab
[ "super(GraphConvolution, self).__init__()\nself.use_bias = use_bias\nself.weight = nn.Parameter(torch.Tensor(input_dim, output_dim))\nif self.use_bias:\n self.bias = nn.Parameter(torch.Tensor(output_dim))\nelse:\n self.register_parameter('bias', None)\nself.__init_parameters()\nreturn", "nn.init.kaiming_nor...
<|body_start_0|> super(GraphConvolution, self).__init__() self.use_bias = use_bias self.weight = nn.Parameter(torch.Tensor(input_dim, output_dim)) if self.use_bias: self.bias = nn.Parameter(torch.Tensor(output_dim)) else: self.register_parameter('bias', No...
图卷积层
GraphConvolution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphConvolution: """图卷积层""" def __init__(self, input_dim, output_dim, use_bias=True): """图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置""" <|body_0|> def __init_parameters(self): """初始...
stack_v2_sparse_classes_75kplus_train_074109
5,537
permissive
[ { "docstring": "图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置", "name": "__init__", "signature": "def __init__(self, input_dim, output_dim, use_bias=True)" }, { "docstring": "初始化权重和偏置", "name": "__init_parameters"...
3
stack_v2_sparse_classes_30k_train_048760
Implement the Python class `GraphConvolution` described below. Class description: 图卷积层 Method signatures and docstrings: - def __init__(self, input_dim, output_dim, use_bias=True): 图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 - def __init...
Implement the Python class `GraphConvolution` described below. Class description: 图卷积层 Method signatures and docstrings: - def __init__(self, input_dim, output_dim, use_bias=True): 图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 - def __init...
ee16c37fd065ba4c732138096f715f04c0ad6fcf
<|skeleton|> class GraphConvolution: """图卷积层""" def __init__(self, input_dim, output_dim, use_bias=True): """图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置""" <|body_0|> def __init_parameters(self): """初始...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphConvolution: """图卷积层""" def __init__(self, input_dim, output_dim, use_bias=True): """图卷积层 SAGPool中使用图卷积层计算每个图中每个节点的score Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置""" super(GraphConvolution, self).__init__() self.use_bias = use_bi...
the_stack_v2_python_sparse
Graph/SAGPool/script/layers.py
robbinc91/GNN-Pytorch
train
0
3aeb41a80c0dc58eba2cdb659f09a718dcf681db
[ "self.linux_current_password = linux_current_password\nself.linux_password = linux_password\nself.linux_username = linux_username\nself.verify_password = verify_password", "if dictionary is None:\n return None\nlinux_current_password = dictionary.get('linuxCurrentPassword')\nlinux_password = dictionary.get('li...
<|body_start_0|> self.linux_current_password = linux_current_password self.linux_password = linux_password self.linux_username = linux_username self.verify_password = verify_password <|end_body_0|> <|body_start_1|> if dictionary is None: return None linux_cur...
Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (string, required): Specifies the linux username for which the...
UpdateLinuxPasswordReqParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateLinuxPasswordReqParams: """Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (strin...
stack_v2_sparse_classes_75kplus_train_074110
2,432
permissive
[ { "docstring": "Constructor for the UpdateLinuxPasswordReqParams class", "name": "__init__", "signature": "def __init__(self, linux_current_password=None, linux_password=None, linux_username=None, verify_password=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args:...
2
stack_v2_sparse_classes_30k_train_048623
Implement the Python class `UpdateLinuxPasswordReqParams` described below. Class description: Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the ne...
Implement the Python class `UpdateLinuxPasswordReqParams` described below. Class description: Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the ne...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class UpdateLinuxPasswordReqParams: """Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (strin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateLinuxPasswordReqParams: """Implementation of the 'UpdateLinuxPasswordReqParams' model. Specifies the user input parameters. Attributes: linux_current_password (string): Specifies the current password. linux_password (string, required): Specifies the new linux password. linux_username (string, required):...
the_stack_v2_python_sparse
cohesity_management_sdk/models/update_linux_password_req_params.py
cohesity/management-sdk-python
train
24
0e8cc52db41cde801e0436c78f04692eeae707b0
[ "if len(prices) <= 1:\n return 0\nmaxPro = 0\nminPrice = prices[0]\nfor i in range(1, len(prices)):\n maxPro = max(maxPro, prices[i] - minPrice)\n minPrice = min(minPrice, prices[i])\nreturn maxPro", "minPirce = prices[0]\nmaxPro = 0\nlength = len(prices)\nfor i in range(1, length):\n if prices[i] < m...
<|body_start_0|> if len(prices) <= 1: return 0 maxPro = 0 minPrice = prices[0] for i in range(1, len(prices)): maxPro = max(maxPro, prices[i] - minPrice) minPrice = min(minPrice, prices[i]) return maxPro <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int 动态规划""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int 非动态规划""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) <= 1: ...
stack_v2_sparse_classes_75kplus_train_074111
854
permissive
[ { "docstring": ":type prices: List[int] :rtype: int 动态规划", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int 非动态规划", "name": "maxProfit", "signature": "def maxProfit(self, prices)" } ]
2
stack_v2_sparse_classes_30k_test_001166
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int 动态规划 - def maxProfit(self, prices): :type prices: List[int] :rtype: int 非动态规划
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int 动态规划 - def maxProfit(self, prices): :type prices: List[int] :rtype: int 非动态规划 <|skeleton|> class Solution: ...
d2b8a1dfe986d71d02d2568b55bad6e5b1c81492
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int 动态规划""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int 非动态规划""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int 动态规划""" if len(prices) <= 1: return 0 maxPro = 0 minPrice = prices[0] for i in range(1, len(prices)): maxPro = max(maxPro, prices[i] - minPrice) minPrice = ...
the_stack_v2_python_sparse
Easy/Que121.py
HuangZengPei/LeetCode
train
2
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e
[ "super(TriggerVelocity, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._target_velocity = target_velocity", "new_status = py_trees.common.Status.RUNNING\ndelta_velocity = self._target_velocity - CarlaDataProvider.get_velocity(self._actor)\nif delta_ve...
<|body_start_0|> super(TriggerVelocity, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._target_velocity = target_velocity <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status.RUNNING delta_velocit...
This class contains the trigger velocity (condition) of a scenario The behavior is successful, if the actor is at least as fast as requested
TriggerVelocity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerVelocity: """This class contains the trigger velocity (condition) of a scenario The behavior is successful, if the actor is at least as fast as requested""" def __init__(self, actor, target_velocity, name='TriggerVelocity'): """Setup trigger velocity""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_074112
25,380
permissive
[ { "docstring": "Setup trigger velocity", "name": "__init__", "signature": "def __init__(self, actor, target_velocity, name='TriggerVelocity')" }, { "docstring": "Check if the actor has the trigger velocity", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_020111
Implement the Python class `TriggerVelocity` described below. Class description: This class contains the trigger velocity (condition) of a scenario The behavior is successful, if the actor is at least as fast as requested Method signatures and docstrings: - def __init__(self, actor, target_velocity, name='TriggerVelo...
Implement the Python class `TriggerVelocity` described below. Class description: This class contains the trigger velocity (condition) of a scenario The behavior is successful, if the actor is at least as fast as requested Method signatures and docstrings: - def __init__(self, actor, target_velocity, name='TriggerVelo...
1d3e8339f8e60f7bdcaefeff49ec238b1746b047
<|skeleton|> class TriggerVelocity: """This class contains the trigger velocity (condition) of a scenario The behavior is successful, if the actor is at least as fast as requested""" def __init__(self, actor, target_velocity, name='TriggerVelocity'): """Setup trigger velocity""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TriggerVelocity: """This class contains the trigger velocity (condition) of a scenario The behavior is successful, if the actor is at least as fast as requested""" def __init__(self, actor, target_velocity, name='TriggerVelocity'): """Setup trigger velocity""" super(TriggerVelocity, self)...
the_stack_v2_python_sparse
srunner/scenariomanager/atomic_scenario_behavior.py
chauvinSimon/scenario_runner
train
2
a6ca2fe5a69e871af1ddf6c59cb15c36749aa848
[ "i = 0\nn1, n2 = (len(word1), len(word2))\nwhile i < n1 and i < n2 and (word1[i] == word2[i]):\n i += 1\nif i == n1 or i == n2:\n return n1 < n2\nreturn order.index(word1[i]) < order.index(word2[i])", "n = len(words)\nfor i in range(n - 1):\n flag = self.compare(words[i], words[i + 1], order)\n if not...
<|body_start_0|> i = 0 n1, n2 = (len(word1), len(word2)) while i < n1 and i < n2 and (word1[i] == word2[i]): i += 1 if i == n1 or i == n2: return n1 < n2 return order.index(word1[i]) < order.index(word2[i]) <|end_body_0|> <|body_start_1|> n = len(...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compare(self, word1, word2, order): """比较字符串 Args: word1: 字符1 word2: 字符2 order: 顺序串 Returns: 布尔值""" <|body_0|> def contains_nearby_duplicate(self, words: List[str], order: str) -> bool: """字符串是否按照顺序 Args: words: 字符串数组 order: 顺序 Returns: 布尔值""" <...
stack_v2_sparse_classes_75kplus_train_074113
3,160
permissive
[ { "docstring": "比较字符串 Args: word1: 字符1 word2: 字符2 order: 顺序串 Returns: 布尔值", "name": "compare", "signature": "def compare(self, word1, word2, order)" }, { "docstring": "字符串是否按照顺序 Args: words: 字符串数组 order: 顺序 Returns: 布尔值", "name": "contains_nearby_duplicate", "signature": "def contains_ne...
2
stack_v2_sparse_classes_30k_train_004244
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compare(self, word1, word2, order): 比较字符串 Args: word1: 字符1 word2: 字符2 order: 顺序串 Returns: 布尔值 - def contains_nearby_duplicate(self, words: List[str], order: str) -> bool: 字符串...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compare(self, word1, word2, order): 比较字符串 Args: word1: 字符1 word2: 字符2 order: 顺序串 Returns: 布尔值 - def contains_nearby_duplicate(self, words: List[str], order: str) -> bool: 字符串...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def compare(self, word1, word2, order): """比较字符串 Args: word1: 字符1 word2: 字符2 order: 顺序串 Returns: 布尔值""" <|body_0|> def contains_nearby_duplicate(self, words: List[str], order: str) -> bool: """字符串是否按照顺序 Args: words: 字符串数组 order: 顺序 Returns: 布尔值""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def compare(self, word1, word2, order): """比较字符串 Args: word1: 字符1 word2: 字符2 order: 顺序串 Returns: 布尔值""" i = 0 n1, n2 = (len(word1), len(word2)) while i < n1 and i < n2 and (word1[i] == word2[i]): i += 1 if i == n1 or i == n2: return n1 ...
the_stack_v2_python_sparse
src/leetcodepython/string/verifying_alien_dictionary_953.py
zhangyu345293721/leetcode
train
101
9c11c6da233e3900f2da3e472b504178fc990c16
[ "Frame.__init__(self, master)\nself.pack()\nself.createAlbumWidgets()", "top_frame = Frame(self)\nself.labelInput = Label(top_frame, text='Get Album Name')\nself.text_in = Entry(top_frame)\nself.labelResult = Label(top_frame, text='Result')\nself.labelInput.pack()\nself.text_in.pack()\nself.labelResult.pack()\nto...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createAlbumWidgets() <|end_body_0|> <|body_start_1|> top_frame = Frame(self) self.labelInput = Label(top_frame, text='Get Album Name') self.text_in = Entry(top_frame) self.labelResult = Label(top_fram...
Application main window class.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createAlbumWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_75kplus_train_074114
2,154
no_license
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createAlbumWidgets", "signature": "def createAlbumWidgets(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_050181
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createAlbumWidgets(self): Add all the widgets to the main frame. - def handle(self): Handl...
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createAlbumWidgets(self): Add all the widgets to the main frame. - def handle(self): Handl...
2dba11861f91e4bdc1ef28279132a6d8dd4ccf54
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createAlbumWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createAlbumWidgets() def createAlbumWidgets(self): """Add all the widgets to the...
the_stack_v2_python_sparse
Mux_Gui/Get_Album_GUI.py
rduvalwa5/Mux
train
0
25ca7de0afd39bb415e566223b2c2df816051fda
[ "self.size = size\nsuper(SVGSprite, self).__init__(*args)\nif svg:\n self.setSVG(svg)", "self.svg = svg\nif self.size:\n width, height = self.size\nelse:\n width, height = (None, None)\nself.image = self._render(width, height).convert_alpha()\nrect = self.image.get_rect()\nif self.rect:\n rect.move(se...
<|body_start_0|> self.size = size super(SVGSprite, self).__init__(*args) if svg: self.setSVG(svg) <|end_body_0|> <|body_start_1|> self.svg = svg if self.size: width, height = self.size else: width, height = (None, None) self.im...
Sprite class which renders SVG source-code as a Pygame image Note: Currently this sprite class is a bit over-engineered, it gets in the way if you want to, e.g. animate among a number of SVG drawings, as it assumes that setSVG will always set a single SVG file for rendering.
SVGSprite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SVGSprite: """Sprite class which renders SVG source-code as a Pygame image Note: Currently this sprite class is a bit over-engineered, it gets in the way if you want to, e.g. animate among a number of SVG drawings, as it assumes that setSVG will always set a single SVG file for rendering.""" ...
stack_v2_sparse_classes_75kplus_train_074115
3,108
no_license
[ { "docstring": "Initialise the svg sprite svg -- svg source text (i.e. content of an svg file) size -- optional, to constrain size, (width,height), leaving one as None or 0 causes proportional scaling, leaving both as None or 0 causes natural scaling (screen resolution) args -- if present, groups to which to au...
4
stack_v2_sparse_classes_30k_train_047467
Implement the Python class `SVGSprite` described below. Class description: Sprite class which renders SVG source-code as a Pygame image Note: Currently this sprite class is a bit over-engineered, it gets in the way if you want to, e.g. animate among a number of SVG drawings, as it assumes that setSVG will always set a...
Implement the Python class `SVGSprite` described below. Class description: Sprite class which renders SVG source-code as a Pygame image Note: Currently this sprite class is a bit over-engineered, it gets in the way if you want to, e.g. animate among a number of SVG drawings, as it assumes that setSVG will always set a...
b1d94a78c31af39d89075a2c621de89d98eb2958
<|skeleton|> class SVGSprite: """Sprite class which renders SVG source-code as a Pygame image Note: Currently this sprite class is a bit over-engineered, it gets in the way if you want to, e.g. animate among a number of SVG drawings, as it assumes that setSVG will always set a single SVG file for rendering.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SVGSprite: """Sprite class which renders SVG source-code as a Pygame image Note: Currently this sprite class is a bit over-engineered, it gets in the way if you want to, e.g. animate among a number of SVG drawings, as it assumes that setSVG will always set a single SVG file for rendering.""" def __init__...
the_stack_v2_python_sparse
Tateti/olpcgames/svgsprite.py
nexo-developers/nexo
train
4
3bedee9173cfd4b6163910c548982ab086ddefec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn LoginPageLayoutConfiguration()", "from .layout_template_type import LayoutTemplateType\nfrom .layout_template_type import LayoutTemplateType\nfields: Dict[str, Callable[[Any], None]] = {'isFooterShown': lambda n: setattr(self, 'is_foot...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return LoginPageLayoutConfiguration() <|end_body_0|> <|body_start_1|> from .layout_template_type import LayoutTemplateType from .layout_template_type import LayoutTemplateType fields: D...
LoginPageLayoutConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPageLayoutConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_75kplus_train_074116
3,646
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: LoginPageLayoutConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
stack_v2_sparse_classes_30k_train_048015
Implement the Python class `LoginPageLayoutConfiguration` described below. Class description: Implement the LoginPageLayoutConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: Creates a new instance of the a...
Implement the Python class `LoginPageLayoutConfiguration` described below. Class description: Implement the LoginPageLayoutConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class LoginPageLayoutConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginPageLayoutConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create th...
the_stack_v2_python_sparse
msgraph/generated/models/login_page_layout_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
34872bb31d1b806ee9f27b434fff301c0b07d41b
[ "res = super(lot_create_revaluation, self).default_get(cr, uid, fields, context=context)\nlot_data = self.pool.get('stock.production.lot').browse(cr, uid, context.get('active_id'), context=context)\nres.update({'product_id': lot_data.product_id.id, 'lot_id': lot_data.id, 'cost_price': lot_data.cost_price_per_unit})...
<|body_start_0|> res = super(lot_create_revaluation, self).default_get(cr, uid, fields, context=context) lot_data = self.pool.get('stock.production.lot').browse(cr, uid, context.get('active_id'), context=context) res.update({'product_id': lot_data.product_id.id, 'lot_id': lot_data.id, 'cost_pric...
lot_create_revaluation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lot_create_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A ...
stack_v2_sparse_classes_75kplus_train_074117
3,543
no_license
[ { "docstring": "Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List of fields @param context: A standard dictionary @return: Return a dictionary which h...
2
stack_v2_sparse_classes_30k_train_030932
Implement the Python class `lot_create_revaluation` described below. Class description: Implement the lot_create_revaluation class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): Get the default value from invoice line ---------------------------------------- @param self: Th...
Implement the Python class `lot_create_revaluation` described below. Class description: Implement the lot_create_revaluation class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): Get the default value from invoice line ---------------------------------------- @param self: Th...
f2b44a8af0e7bee87d52d258fca012bf44ca876f
<|skeleton|> class lot_create_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class lot_create_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List of fields...
the_stack_v2_python_sparse
via_lot_valuation/wizard/lot_create_revaluation.py
eksotama/prln-via-custom-addons
train
0
f603835c6d2ca91a7a22b5b729d0a0a1c1cba2cf
[ "super().__init__(openuv, sensor_type)\nself._attr_icon = icon\nself._attr_name = name", "data = self.openuv.data[DATA_PROTECTION_WINDOW]\nif not data:\n self._attr_available = False\n return\nself._attr_available = True\nfor key in ('from_time', 'to_time', 'from_uv', 'to_uv'):\n if not data.get(key):\n ...
<|body_start_0|> super().__init__(openuv, sensor_type) self._attr_icon = icon self._attr_name = name <|end_body_0|> <|body_start_1|> data = self.openuv.data[DATA_PROTECTION_WINDOW] if not data: self._attr_available = False return self._attr_availa...
Define a binary sensor for OpenUV.
OpenUvBinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenUvBinarySensor: """Define a binary sensor for OpenUV.""" def __init__(self, openuv, sensor_type, name, icon): """Initialize the sensor.""" <|body_0|> def update_from_latest_data(self): """Update the state.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_75kplus_train_074118
2,591
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, openuv, sensor_type, name, icon)" }, { "docstring": "Update the state.", "name": "update_from_latest_data", "signature": "def update_from_latest_data(self)" } ]
2
stack_v2_sparse_classes_30k_train_008812
Implement the Python class `OpenUvBinarySensor` described below. Class description: Define a binary sensor for OpenUV. Method signatures and docstrings: - def __init__(self, openuv, sensor_type, name, icon): Initialize the sensor. - def update_from_latest_data(self): Update the state.
Implement the Python class `OpenUvBinarySensor` described below. Class description: Define a binary sensor for OpenUV. Method signatures and docstrings: - def __init__(self, openuv, sensor_type, name, icon): Initialize the sensor. - def update_from_latest_data(self): Update the state. <|skeleton|> class OpenUvBinary...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class OpenUvBinarySensor: """Define a binary sensor for OpenUV.""" def __init__(self, openuv, sensor_type, name, icon): """Initialize the sensor.""" <|body_0|> def update_from_latest_data(self): """Update the state.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OpenUvBinarySensor: """Define a binary sensor for OpenUV.""" def __init__(self, openuv, sensor_type, name, icon): """Initialize the sensor.""" super().__init__(openuv, sensor_type) self._attr_icon = icon self._attr_name = name def update_from_latest_data(self): ...
the_stack_v2_python_sparse
homeassistant/components/openuv/binary_sensor.py
BenWoodford/home-assistant
train
11
935df2ec377bf19acde61258d1dbe70710fca16e
[ "code = status.HTTP_200_OK\nstatus_text = 'OK'\nif not django_settings.CONSOLE_DEBUG:\n if not self.celery_is_ok():\n status_text = 'ERROR - celery down'\n code = status.HTTP_503_SERVICE_UNAVAILABLE\n elif not self.db_is_ok():\n status_text = 'ERROR - db down'\n code = status.HTTP_...
<|body_start_0|> code = status.HTTP_200_OK status_text = 'OK' if not django_settings.CONSOLE_DEBUG: if not self.celery_is_ok(): status_text = 'ERROR - celery down' code = status.HTTP_503_SERVICE_UNAVAILABLE elif not self.db_is_ok(): ...
Gets the current status of the api
HealthcheckView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthcheckView: """Gets the current status of the api""" def get(self, request): """Check db and celery connectivity and return a 200 if healthy, 503 if not.""" <|body_0|> def celery_is_ok(self) -> bool: """Verify a healthy celery connection. :return: True if he...
stack_v2_sparse_classes_75kplus_train_074119
1,921
permissive
[ { "docstring": "Check db and celery connectivity and return a 200 if healthy, 503 if not.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Verify a healthy celery connection. :return: True if healthy, False it not.", "name": "celery_is_ok", "signature": "def cele...
3
stack_v2_sparse_classes_30k_train_016545
Implement the Python class `HealthcheckView` described below. Class description: Gets the current status of the api Method signatures and docstrings: - def get(self, request): Check db and celery connectivity and return a 200 if healthy, 503 if not. - def celery_is_ok(self) -> bool: Verify a healthy celery connection...
Implement the Python class `HealthcheckView` described below. Class description: Gets the current status of the api Method signatures and docstrings: - def get(self, request): Check db and celery connectivity and return a 200 if healthy, 503 if not. - def celery_is_ok(self) -> bool: Verify a healthy celery connection...
4a301ec37e6c07af73abbbeaeb9e747a248a44e1
<|skeleton|> class HealthcheckView: """Gets the current status of the api""" def get(self, request): """Check db and celery connectivity and return a 200 if healthy, 503 if not.""" <|body_0|> def celery_is_ok(self) -> bool: """Verify a healthy celery connection. :return: True if he...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HealthcheckView: """Gets the current status of the api""" def get(self, request): """Check db and celery connectivity and return a 200 if healthy, 503 if not.""" code = status.HTTP_200_OK status_text = 'OK' if not django_settings.CONSOLE_DEBUG: if not self.cele...
the_stack_v2_python_sparse
src/server/oasisapi/healthcheck/views.py
OasisLMF/OasisPlatform
train
43
36de83eaf8cae08613c6d337aa429e062c4f2b2b
[ "super().__init__(hass, LOGGER, name=f'{DOMAIN} base {base}', update_interval=update_interval)\nself.base = base\nself.client = Client(api_key, session)", "try:\n async with asyncio.timeout(CLIENT_TIMEOUT):\n latest = await self.client.get_latest(base=self.base)\nexcept OpenExchangeRatesAuthError as err...
<|body_start_0|> super().__init__(hass, LOGGER, name=f'{DOMAIN} base {base}', update_interval=update_interval) self.base = base self.client = Client(api_key, session) <|end_body_0|> <|body_start_1|> try: async with asyncio.timeout(CLIENT_TIMEOUT): latest = aw...
Represent a coordinator for Open Exchange Rates API.
OpenexchangeratesCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenexchangeratesCoordinator: """Represent a coordinator for Open Exchange Rates API.""" def __init__(self, hass: HomeAssistant, session: ClientSession, api_key: str, base: str, update_interval: timedelta) -> None: """Initialize the coordinator.""" <|body_0|> async def _...
stack_v2_sparse_classes_75kplus_train_074120
1,607
permissive
[ { "docstring": "Initialize the coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, session: ClientSession, api_key: str, base: str, update_interval: timedelta) -> None" }, { "docstring": "Update data from Open Exchange Rates.", "name": "_async_update_data...
2
stack_v2_sparse_classes_30k_train_004561
Implement the Python class `OpenexchangeratesCoordinator` described below. Class description: Represent a coordinator for Open Exchange Rates API. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, session: ClientSession, api_key: str, base: str, update_interval: timedelta) -> None: Initializ...
Implement the Python class `OpenexchangeratesCoordinator` described below. Class description: Represent a coordinator for Open Exchange Rates API. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, session: ClientSession, api_key: str, base: str, update_interval: timedelta) -> None: Initializ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OpenexchangeratesCoordinator: """Represent a coordinator for Open Exchange Rates API.""" def __init__(self, hass: HomeAssistant, session: ClientSession, api_key: str, base: str, update_interval: timedelta) -> None: """Initialize the coordinator.""" <|body_0|> async def _...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OpenexchangeratesCoordinator: """Represent a coordinator for Open Exchange Rates API.""" def __init__(self, hass: HomeAssistant, session: ClientSession, api_key: str, base: str, update_interval: timedelta) -> None: """Initialize the coordinator.""" super().__init__(hass, LOGGER, name=f'{D...
the_stack_v2_python_sparse
homeassistant/components/openexchangerates/coordinator.py
home-assistant/core
train
35,501
63e36106197155f3777fd5212ee11a06a539ce20
[ "super().__init__(**kwargs)\nself._name = 'value'\nself._type = 'min'", "if self._data_id is not None:\n self._storegate.set_data_id(self._data_id)\nvalue = self._storegate.get_data(phase=self._phase, var_name=self._pred_var_name)\nreturn value" ]
<|body_start_0|> super().__init__(**kwargs) self._name = 'value' self._type = 'min' <|end_body_0|> <|body_start_1|> if self._data_id is not None: self._storegate.set_data_id(self._data_id) value = self._storegate.get_data(phase=self._phase, var_name=self._pred_var_na...
A metric class to return a single value.
ValueMetric
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueMetric: """A metric class to return a single value.""" def __init__(self, **kwargs): """Initialize ValueMetric.""" <|body_0|> def calculate(self): """Returns value.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(**kwargs) ...
stack_v2_sparse_classes_75kplus_train_074121
7,080
permissive
[ { "docstring": "Initialize ValueMetric.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Returns value.", "name": "calculate", "signature": "def calculate(self)" } ]
2
stack_v2_sparse_classes_30k_val_002668
Implement the Python class `ValueMetric` described below. Class description: A metric class to return a single value. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize ValueMetric. - def calculate(self): Returns value.
Implement the Python class `ValueMetric` described below. Class description: A metric class to return a single value. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize ValueMetric. - def calculate(self): Returns value. <|skeleton|> class ValueMetric: """A metric class to return a singl...
cbf468f030ab6b337d549ca77c5158eac6429f2a
<|skeleton|> class ValueMetric: """A metric class to return a single value.""" def __init__(self, **kwargs): """Initialize ValueMetric.""" <|body_0|> def calculate(self): """Returns value.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValueMetric: """A metric class to return a single value.""" def __init__(self, **kwargs): """Initialize ValueMetric.""" super().__init__(**kwargs) self._name = 'value' self._type = 'min' def calculate(self): """Returns value.""" if self._data_id is not...
the_stack_v2_python_sparse
multiml/agent/metric.py
camellia26/multiml
train
0
ab42a93423a8d8e1a0a15092c669dd567b5fa27b
[ "request_user = None\nif hasattr(request, 'user') and request.user and request.user.is_authenticated:\n request_user = request.user\nif not request_user and (not user or not user.is_authenticated):\n return None\nsession_user = user if user else request_user\ntunnistamo_session_id = request.session.get('tunni...
<|body_start_0|> request_user = None if hasattr(request, 'user') and request.user and request.user.is_authenticated: request_user = request.user if not request_user and (not user or not user.is_authenticated): return None session_user = user if user else request_u...
TunnistamoSessionManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TunnistamoSessionManager: def get_or_create_from_request(self, request, user=None): """Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as...
stack_v2_sparse_classes_75kplus_train_074122
11,271
permissive
[ { "docstring": "Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as an argument. e.g. in social auth pipeline where the user is not yet logged in but exists.", ...
2
stack_v2_sparse_classes_30k_train_018714
Implement the Python class `TunnistamoSessionManager` described below. Class description: Implement the TunnistamoSessionManager class. Method signatures and docstrings: - def get_or_create_from_request(self, request, user=None): Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django ses...
Implement the Python class `TunnistamoSessionManager` described below. Class description: Implement the TunnistamoSessionManager class. Method signatures and docstrings: - def get_or_create_from_request(self, request, user=None): Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django ses...
508116944aa8583d374763ad1e35e1c845010c8b
<|skeleton|> class TunnistamoSessionManager: def get_or_create_from_request(self, request, user=None): """Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TunnistamoSessionManager: def get_or_create_from_request(self, request, user=None): """Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as an argument. ...
the_stack_v2_python_sparse
users/models.py
City-of-Helsinki/tunnistamo
train
9
0610dc5dbcbf1f512f6285bdb1beff7f96cdd032
[ "self.db = db\nself.verbose = verbose\nself.notification_type = notification_type\nself.notification_origin = notification_origin\nself.process_id = process_id", "type_id = self.db.grep_id_from_lookup_table(id_field_name='NotificationTypeID', table_name='notification_types', where_field_name='Type', where_value=s...
<|body_start_0|> self.db = db self.verbose = verbose self.notification_type = notification_type self.notification_origin = notification_origin self.process_id = process_id <|end_body_0|> <|body_start_1|> type_id = self.db.grep_id_from_lookup_table(id_field_name='Notifica...
Notification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Notification: def __init__(self, db, verbose, notification_type, notification_origin, process_id): """Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : ...
stack_v2_sparse_classes_75kplus_train_074123
2,669
no_license
[ { "docstring": "Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : notification type to use for the notification_spool table :type notification_type : str :param notification_or...
2
stack_v2_sparse_classes_30k_train_004081
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def __init__(self, db, verbose, notification_type, notification_origin, process_id): Constructor method for the Notification class. :param db : Database class object :typ...
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def __init__(self, db, verbose, notification_type, notification_origin, process_id): Constructor method for the Notification class. :param db : Database class object :typ...
f9df1b78cd96882009264d7fba122b294c7c6329
<|skeleton|> class Notification: def __init__(self, db, verbose, notification_type, notification_origin, process_id): """Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Notification: def __init__(self, db, verbose, notification_type, notification_origin, process_id): """Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : notification t...
the_stack_v2_python_sparse
python/lib/database_lib/notification.py
gdevenyi/Loris-MRI
train
0
6ec9dd495713dded9fe90670d5c6de915d2f69f7
[ "iss = []\nfor u in users:\n iss.append(self.client.new('InstrumentScientist', instrument=self, user=u))\nif iss:\n self.client.createMany(iss)", "if attribute is not None:\n query = 'User.%s <-> InstrumentScientist <-> Instrument [id=%d]' % (attribute, self.id)\nelse:\n query = 'User <-> InstrumentSc...
<|body_start_0|> iss = [] for u in users: iss.append(self.client.new('InstrumentScientist', instrument=self, user=u)) if iss: self.client.createMany(iss) <|end_body_0|> <|body_start_1|> if attribute is not None: query = 'User.%s <-> InstrumentScientis...
Mixin class to define custom methods for Instrument objects.
InstrumentMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstrumentMixin: """Mixin class to define custom methods for Instrument objects.""" def addInstrumentScientists(self, users): """Add instrument scientists to the instrument.""" <|body_0|> def getInstrumentScientists(self, attribute=None): """Get instrument scient...
stack_v2_sparse_classes_75kplus_train_074124
9,511
permissive
[ { "docstring": "Add instrument scientists to the instrument.", "name": "addInstrumentScientists", "signature": "def addInstrumentScientists(self, users)" }, { "docstring": "Get instrument scientists of the instrument. If `attribute` is given, return the corresponding attribute for all users rela...
2
null
Implement the Python class `InstrumentMixin` described below. Class description: Mixin class to define custom methods for Instrument objects. Method signatures and docstrings: - def addInstrumentScientists(self, users): Add instrument scientists to the instrument. - def getInstrumentScientists(self, attribute=None): ...
Implement the Python class `InstrumentMixin` described below. Class description: Mixin class to define custom methods for Instrument objects. Method signatures and docstrings: - def addInstrumentScientists(self, users): Add instrument scientists to the instrument. - def getInstrumentScientists(self, attribute=None): ...
1dc34f337823471f46940fb87cbe6b3dcc51c89f
<|skeleton|> class InstrumentMixin: """Mixin class to define custom methods for Instrument objects.""" def addInstrumentScientists(self, users): """Add instrument scientists to the instrument.""" <|body_0|> def getInstrumentScientists(self, attribute=None): """Get instrument scient...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InstrumentMixin: """Mixin class to define custom methods for Instrument objects.""" def addInstrumentScientists(self, users): """Add instrument scientists to the instrument.""" iss = [] for u in users: iss.append(self.client.new('InstrumentScientist', instrument=self, ...
the_stack_v2_python_sparse
icat/entities.py
icatproject/python-icat
train
9
13190ffb01b946770834e9c571f62032d114ebe2
[ "super(WheelBuildHelper, self).__init__(project_definition, l2tdevtools_path, dependency_definitions)\nself.architecture = None\narchitecture = platform.architecture()[0]\nif architecture == '32bit':\n self.architecture = 'win32'\nelif architecture == '64bit':\n self.architecture = 'win_amd64'", "if self._p...
<|body_start_0|> super(WheelBuildHelper, self).__init__(project_definition, l2tdevtools_path, dependency_definitions) self.architecture = None architecture = platform.architecture()[0] if architecture == '32bit': self.architecture = 'win32' elif architecture == '64bit...
Helper to build Python wheel packages (.whl).
WheelBuildHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WheelBuildHelper: """Helper to build Python wheel packages (.whl).""" def __init__(self, project_definition, l2tdevtools_path, dependency_definitions): """Initializes a build helper. Args: project_definition (ProjectDefinition): definition of the project to build. l2tdevtools_path (s...
stack_v2_sparse_classes_75kplus_train_074125
10,830
permissive
[ { "docstring": "Initializes a build helper. Args: project_definition (ProjectDefinition): definition of the project to build. l2tdevtools_path (str): path to the l2tdevtools directory. dependency_definitions (dict[str, ProjectDefinition]): definitions of all projects, which is used to determine the properties o...
6
null
Implement the Python class `WheelBuildHelper` described below. Class description: Helper to build Python wheel packages (.whl). Method signatures and docstrings: - def __init__(self, project_definition, l2tdevtools_path, dependency_definitions): Initializes a build helper. Args: project_definition (ProjectDefinition)...
Implement the Python class `WheelBuildHelper` described below. Class description: Helper to build Python wheel packages (.whl). Method signatures and docstrings: - def __init__(self, project_definition, l2tdevtools_path, dependency_definitions): Initializes a build helper. Args: project_definition (ProjectDefinition)...
34709706cc3bee84db45883043b9dfc1811ba65b
<|skeleton|> class WheelBuildHelper: """Helper to build Python wheel packages (.whl).""" def __init__(self, project_definition, l2tdevtools_path, dependency_definitions): """Initializes a build helper. Args: project_definition (ProjectDefinition): definition of the project to build. l2tdevtools_path (s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WheelBuildHelper: """Helper to build Python wheel packages (.whl).""" def __init__(self, project_definition, l2tdevtools_path, dependency_definitions): """Initializes a build helper. Args: project_definition (ProjectDefinition): definition of the project to build. l2tdevtools_path (str): path to ...
the_stack_v2_python_sparse
l2tdevtools/build_helpers/wheel.py
log2timeline/l2tdevtools
train
7
1447754c4822da2b93fbc0d2875a771e87987efb
[ "mock_client = Taxii2FeedClient(url='', collection_to_fetch='default', proxies=[], verify=False, objects_to_fetch=[])\ndefault_id = 1\nnondefault_id = 2\nmock_client.collections = [MockCollection(default_id, 'default'), MockCollection(nondefault_id, 'not_default')]\nmock_client.collection_to_fetch = mock_client.col...
<|body_start_0|> mock_client = Taxii2FeedClient(url='', collection_to_fetch='default', proxies=[], verify=False, objects_to_fetch=[]) default_id = 1 nondefault_id = 2 mock_client.collections = [MockCollection(default_id, 'default'), MockCollection(nondefault_id, 'not_default')] m...
Scenario: Test fetch_indicators_command
TestFetchIndicators
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFetchIndicators: """Scenario: Test fetch_indicators_command""" def test_single_no_context(self, mocker): """Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - ini...
stack_v2_sparse_classes_75kplus_train_074126
12,922
permissive
[ { "docstring": "Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - initial interval is `1 day` When: - fetch_indicators_command is called Then: - update last run with latest collection fetch tim...
4
stack_v2_sparse_classes_30k_train_047619
Implement the Python class `TestFetchIndicators` described below. Class description: Scenario: Test fetch_indicators_command Method signatures and docstrings: - def test_single_no_context(self, mocker): Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'defau...
Implement the Python class `TestFetchIndicators` described below. Class description: Scenario: Test fetch_indicators_command Method signatures and docstrings: - def test_single_no_context(self, mocker): Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'defau...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestFetchIndicators: """Scenario: Test fetch_indicators_command""" def test_single_no_context(self, mocker): """Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - ini...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFetchIndicators: """Scenario: Test fetch_indicators_command""" def test_single_no_context(self, mocker): """Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - initial interval...
the_stack_v2_python_sparse
Packs/FeedTAXII/Integrations/FeedTAXII2/FeedTAXII2_test.py
demisto/content
train
1,023
92c08a8be8446a972bc2a0766cf129cc85174325
[ "cli.JobPollReportCbBase.__init__(self)\nself._abort_check_fn = abort_check_fn\nself._remote_import_fn = remote_import_fn", "if log_type == constants.ELOG_REMOTE_IMPORT:\n logging.debug('Received remote import information')\n if not self._remote_import_fn:\n raise RuntimeError('Received unexpected re...
<|body_start_0|> cli.JobPollReportCbBase.__init__(self) self._abort_check_fn = abort_check_fn self._remote_import_fn = remote_import_fn <|end_body_0|> <|body_start_1|> if log_type == constants.ELOG_REMOTE_IMPORT: logging.debug('Received remote import information') ...
MoveJobPollReportCb
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoveJobPollReportCb: def __init__(self, abort_check_fn, remote_import_fn): """Initializes this class. @type abort_check_fn: callable @param abort_check_fn: Function to check whether move is aborted @type remote_import_fn: callable or None @param remote_import_fn: Callback for reporting r...
stack_v2_sparse_classes_75kplus_train_074127
40,615
permissive
[ { "docstring": "Initializes this class. @type abort_check_fn: callable @param abort_check_fn: Function to check whether move is aborted @type remote_import_fn: callable or None @param remote_import_fn: Callback for reporting received remote import information", "name": "__init__", "signature": "def __in...
3
stack_v2_sparse_classes_30k_train_053242
Implement the Python class `MoveJobPollReportCb` described below. Class description: Implement the MoveJobPollReportCb class. Method signatures and docstrings: - def __init__(self, abort_check_fn, remote_import_fn): Initializes this class. @type abort_check_fn: callable @param abort_check_fn: Function to check whethe...
Implement the Python class `MoveJobPollReportCb` described below. Class description: Implement the MoveJobPollReportCb class. Method signatures and docstrings: - def __init__(self, abort_check_fn, remote_import_fn): Initializes this class. @type abort_check_fn: callable @param abort_check_fn: Function to check whethe...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class MoveJobPollReportCb: def __init__(self, abort_check_fn, remote_import_fn): """Initializes this class. @type abort_check_fn: callable @param abort_check_fn: Function to check whether move is aborted @type remote_import_fn: callable or None @param remote_import_fn: Callback for reporting r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MoveJobPollReportCb: def __init__(self, abort_check_fn, remote_import_fn): """Initializes this class. @type abort_check_fn: callable @param abort_check_fn: Function to check whether move is aborted @type remote_import_fn: callable or None @param remote_import_fn: Callback for reporting received remote...
the_stack_v2_python_sparse
tools/move-instance
ganeti/ganeti
train
465
0ecb175a72f176bd965f3c4a5837253c7fc4ff50
[ "loss = TestLoss(1, 1, 1)\noptimizer = BoltOn(TestOptimizer(), loss)\nn_classes = 2\ninput_dim = 5\nepsilon = 1\nbatch_size = 1\nn_samples = 10\nclf = _do_fit(n_samples, input_dim, n_classes, epsilon, generator, batch_size, reset_n_samples, optimizer, loss)\nself.assertEqual(hasattr(clf, 'layers'), True)", "loss ...
<|body_start_0|> loss = TestLoss(1, 1, 1) optimizer = BoltOn(TestOptimizer(), loss) n_classes = 2 input_dim = 5 epsilon = 1 batch_size = 1 n_samples = 10 clf = _do_fit(n_samples, input_dim, n_classes, epsilon, generator, batch_size, reset_n_samples, optimi...
Test cases for keras model fitting.
FitTests
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FitTests: """Test cases for keras model fitting.""" def test_fit(self, generator, reset_n_samples): """Tests fitting of BoltOnModel. Args: generator: True for generator test, False for iterator test. reset_n_samples: True to reset the n_samples to None, False does nothing""" ...
stack_v2_sparse_classes_75kplus_train_074128
16,102
permissive
[ { "docstring": "Tests fitting of BoltOnModel. Args: generator: True for generator test, False for iterator test. reset_n_samples: True to reset the n_samples to None, False does nothing", "name": "test_fit", "signature": "def test_fit(self, generator, reset_n_samples)" }, { "docstring": "Tests t...
5
stack_v2_sparse_classes_30k_train_009835
Implement the Python class `FitTests` described below. Class description: Test cases for keras model fitting. Method signatures and docstrings: - def test_fit(self, generator, reset_n_samples): Tests fitting of BoltOnModel. Args: generator: True for generator test, False for iterator test. reset_n_samples: True to re...
Implement the Python class `FitTests` described below. Class description: Test cases for keras model fitting. Method signatures and docstrings: - def test_fit(self, generator, reset_n_samples): Tests fitting of BoltOnModel. Args: generator: True for generator test, False for iterator test. reset_n_samples: True to re...
c92610e37aa340932ed2d963813e0890035a22bc
<|skeleton|> class FitTests: """Test cases for keras model fitting.""" def test_fit(self, generator, reset_n_samples): """Tests fitting of BoltOnModel. Args: generator: True for generator test, False for iterator test. reset_n_samples: True to reset the n_samples to None, False does nothing""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FitTests: """Test cases for keras model fitting.""" def test_fit(self, generator, reset_n_samples): """Tests fitting of BoltOnModel. Args: generator: True for generator test, False for iterator test. reset_n_samples: True to reset the n_samples to None, False does nothing""" loss = TestLo...
the_stack_v2_python_sparse
tensorflow_privacy/privacy/bolt_on/models_test.py
tensorflow/privacy
train
1,881
404b2d72888574be5d1c678054e822807d6d3da2
[ "import matplotlib.pyplot as plt\nkymo._check_is_sliceable()\nplt.figure()\nself._ax = plt.subplot(1, 1, 1, projection=KymoEditorProjection(kymo, channel, kwargs))\nself._tether_length_kbp = tether_length_kbp", "new_kymo = self._ax.get_edited_kymo()\nif self._tether_length_kbp is not None:\n new_kymo = new_kym...
<|body_start_0|> import matplotlib.pyplot as plt kymo._check_is_sliceable() plt.figure() self._ax = plt.subplot(1, 1, 1, projection=KymoEditorProjection(kymo, channel, kwargs)) self._tether_length_kbp = tether_length_kbp <|end_body_0|> <|body_start_1|> new_kymo = self._a...
KymoEditorWidget
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KymoEditorWidget: def __init__(self, kymo, channel='rgb', tether_length_kbp=None, **kwargs): """Wrapper class to handle interactive tether axes. Parameters ---------- kymo: lk.kymo.Kymo Kymograph object channel : {'rgb', 'red', 'green', 'blue'} Color channel to plot tether_length_kbp : f...
stack_v2_sparse_classes_75kplus_train_074129
11,091
permissive
[ { "docstring": "Wrapper class to handle interactive tether axes. Parameters ---------- kymo: lk.kymo.Kymo Kymograph object channel : {'rgb', 'red', 'green', 'blue'} Color channel to plot tether_length_kbp : float Length of the tether in the cropped region in kilobase pairs. If provided, the kymo returned from t...
2
stack_v2_sparse_classes_30k_train_007518
Implement the Python class `KymoEditorWidget` described below. Class description: Implement the KymoEditorWidget class. Method signatures and docstrings: - def __init__(self, kymo, channel='rgb', tether_length_kbp=None, **kwargs): Wrapper class to handle interactive tether axes. Parameters ---------- kymo: lk.kymo.Ky...
Implement the Python class `KymoEditorWidget` described below. Class description: Implement the KymoEditorWidget class. Method signatures and docstrings: - def __init__(self, kymo, channel='rgb', tether_length_kbp=None, **kwargs): Wrapper class to handle interactive tether axes. Parameters ---------- kymo: lk.kymo.Ky...
5b7331f23f261b968b9dada3ddea2378cb07ac4c
<|skeleton|> class KymoEditorWidget: def __init__(self, kymo, channel='rgb', tether_length_kbp=None, **kwargs): """Wrapper class to handle interactive tether axes. Parameters ---------- kymo: lk.kymo.Kymo Kymograph object channel : {'rgb', 'red', 'green', 'blue'} Color channel to plot tether_length_kbp : f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KymoEditorWidget: def __init__(self, kymo, channel='rgb', tether_length_kbp=None, **kwargs): """Wrapper class to handle interactive tether axes. Parameters ---------- kymo: lk.kymo.Kymo Kymograph object channel : {'rgb', 'red', 'green', 'blue'} Color channel to plot tether_length_kbp : float Length of...
the_stack_v2_python_sparse
lumicks/pylake/nb_widgets/image_editing.py
lumicks/pylake
train
16
e5d62b559d6e309344d0247a1420de4adffcd386
[ "super(SpatialTransformer, self).__init__()\nvectors = [torch.arange(0, s) for s in size]\ngrids = torch.meshgrid(vectors)\ngrid = torch.stack(grids)\ngrid = torch.unsqueeze(grid, 0)\ngrid = grid.type(torch.FloatTensor)\nself.register_buffer('grid', grid)\nself.mode = mode", "try:\n new_locs = self.grid + flow...
<|body_start_0|> super(SpatialTransformer, self).__init__() vectors = [torch.arange(0, s) for s in size] grids = torch.meshgrid(vectors) grid = torch.stack(grids) grid = torch.unsqueeze(grid, 0) grid = grid.type(torch.FloatTensor) self.register_buffer('grid', grid...
[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample
SpatialTransformer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialTransformer: """[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample""" def __init__(self, size, mode='bilinear'): """Instiatiate the block :...
stack_v2_sparse_classes_75kplus_train_074130
8,888
permissive
[ { "docstring": "Instiatiate the block :param size: size of input to the spatial transformer block :param mode: method of interpolation for grid_sampler", "name": "__init__", "signature": "def __init__(self, size, mode='bilinear')" }, { "docstring": "Push the src and flow through the spatial tran...
2
stack_v2_sparse_classes_30k_train_035986
Implement the Python class `SpatialTransformer` described below. Class description: [SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample Method signatures and docstrings: - def __ini...
Implement the Python class `SpatialTransformer` described below. Class description: [SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample Method signatures and docstrings: - def __ini...
730f7dff2239ef716841390311b5b9250149acaf
<|skeleton|> class SpatialTransformer: """[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample""" def __init__(self, size, mode='bilinear'): """Instiatiate the block :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpatialTransformer: """[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample""" def __init__(self, size, mode='bilinear'): """Instiatiate the block :param size: s...
the_stack_v2_python_sparse
annolid/motion/deformation.py
healthonrails/annolid
train
25
1b24588ec16026a310004395bf1c768dd85d33fd
[ "self.name = name\nself.label = label\nself.tag_name = tag_name\nself.description = description\nself.uri = None", "def cpo(method, *args, **kwargs):\n f = getattr(self, method)\n out = f(*args, **kwargs)\n result = {'method': method, 'result': out, 'schema': None}\n return result\nreturn cpo", "nam...
<|body_start_0|> self.name = name self.label = label self.tag_name = tag_name self.description = description self.uri = None <|end_body_0|> <|body_start_1|> def cpo(method, *args, **kwargs): f = getattr(self, method) out = f(*args, **kwargs) ...
View
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class View: def __init__(self, name, label, tag_name, description=''): """Initializes a View object Parameters ---------- name : The full name of the view label : The label to display in a (tab) layout tag_name : The web component labels description : Decription text for view""" <|body...
stack_v2_sparse_classes_75kplus_train_074131
2,887
no_license
[ { "docstring": "Initializes a View object Parameters ---------- name : The full name of the view label : The label to display in a (tab) layout tag_name : The web component labels description : Decription text for view", "name": "__init__", "signature": "def __init__(self, name, label, tag_name, descrip...
4
stack_v2_sparse_classes_30k_val_002244
Implement the Python class `View` described below. Class description: Implement the View class. Method signatures and docstrings: - def __init__(self, name, label, tag_name, description=''): Initializes a View object Parameters ---------- name : The full name of the view label : The label to display in a (tab) layout...
Implement the Python class `View` described below. Class description: Implement the View class. Method signatures and docstrings: - def __init__(self, name, label, tag_name, description=''): Initializes a View object Parameters ---------- name : The full name of the view label : The label to display in a (tab) layout...
535472844a046cadd9230302da647a54afff95e8
<|skeleton|> class View: def __init__(self, name, label, tag_name, description=''): """Initializes a View object Parameters ---------- name : The full name of the view label : The label to display in a (tab) layout tag_name : The web component labels description : Decription text for view""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class View: def __init__(self, name, label, tag_name, description=''): """Initializes a View object Parameters ---------- name : The full name of the view label : The label to display in a (tab) layout tag_name : The web component labels description : Decription text for view""" self.name = name ...
the_stack_v2_python_sparse
env/lib/python2.7/site-packages/graphlab/_beta/views/platform/_view.py
hophamtenquang/RecSys
train
2
e98c17b010c1258e3c9b144718ae074979299732
[ "self.needed_locks = {}\nif self.op.duration <= 0:\n raise errors.OpPrereqError('Duration must be greater than zero')\nif not self.op.no_locks and (self.op.on_nodes or self.op.on_master):\n self.needed_locks[locking.LEVEL_NODE] = []\nself.op.on_node_uuids = []\nif self.op.on_nodes:\n self.op.on_node_uuids,...
<|body_start_0|> self.needed_locks = {} if self.op.duration <= 0: raise errors.OpPrereqError('Duration must be greater than zero') if not self.op.no_locks and (self.op.on_nodes or self.op.on_master): self.needed_locks[locking.LEVEL_NODE] = [] self.op.on_node_uuids...
Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.
LUTestDelay
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LUTestDelay: """Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.""" def ExpandNames(self): """Expand names and set required locks. This expands the node list, if any.""" <|body_0|> def _InterruptibleDelay(sel...
stack_v2_sparse_classes_75kplus_train_074132
16,228
permissive
[ { "docstring": "Expand names and set required locks. This expands the node list, if any.", "name": "ExpandNames", "signature": "def ExpandNames(self)" }, { "docstring": "Delays but provides the mechanisms necessary to interrupt the delay as needed.", "name": "_InterruptibleDelay", "signa...
5
stack_v2_sparse_classes_30k_train_046210
Implement the Python class `LUTestDelay` described below. Class description: Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time. Method signatures and docstrings: - def ExpandNames(self): Expand names and set required locks. This expands the node list, if an...
Implement the Python class `LUTestDelay` described below. Class description: Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time. Method signatures and docstrings: - def ExpandNames(self): Expand names and set required locks. This expands the node list, if an...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class LUTestDelay: """Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.""" def ExpandNames(self): """Expand names and set required locks. This expands the node list, if any.""" <|body_0|> def _InterruptibleDelay(sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LUTestDelay: """Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.""" def ExpandNames(self): """Expand names and set required locks. This expands the node list, if any.""" self.needed_locks = {} if self.op.duration <= 0:...
the_stack_v2_python_sparse
lib/cmdlib/test.py
ganeti/ganeti
train
465
61106e8de673ddc0d96a74e3bc887fc5d10b1d80
[ "if isinstance(key, int):\n return TransType(key)\nif key not in TransType._member_map_:\n extend_enum(TransType, key, default)\nreturn TransType[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 144 <= value <= 252:\n ...
<|body_start_0|> if isinstance(key, int): return TransType(key) if key not in TransType._member_map_: extend_enum(TransType, key, default) return TransType[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 255): rai...
[TransType] Transport Layer Protocol Numbers
TransType
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransType: """[TransType] Transport Layer Protocol Numbers""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_074133
12,333
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_005551
Implement the Python class `TransType` described below. Class description: [TransType] Transport Layer Protocol Numbers Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `TransType` described below. Class description: [TransType] Transport Layer Protocol Numbers Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class Tran...
90cd07d67df28d5c5ab0585bc60f467a78d9db33
<|skeleton|> class TransType: """[TransType] Transport Layer Protocol Numbers""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransType: """[TransType] Transport Layer Protocol Numbers""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return TransType(key) if key not in TransType._member_map_: extend_enum(TransType, key, default) ...
the_stack_v2_python_sparse
pcapkit/const/reg/transtype.py
stjordanis/PyPCAPKit
train
0
ec0d731ec57d62298d405bd47cbafb254d86bc27
[ "hr('StreamHandler')\nself._run_streamhandler_example()\nhr('FileHandler')\nself._run_filehandler_example()", "logdir = pathlib.Path(tempfile.gettempdir())\nlogfile = logdir / 'logging05.log'\nhandler = logging.FileHandler(logfile, mode='w', encoding='utf-8')\nlogger = logging.getLogger('filehandler1')\nlogger.ad...
<|body_start_0|> hr('StreamHandler') self._run_streamhandler_example() hr('FileHandler') self._run_filehandler_example() <|end_body_0|> <|body_start_1|> logdir = pathlib.Path(tempfile.gettempdir()) logfile = logdir / 'logging05.log' handler = logging.FileHandler(...
サンプルクラス
Sample
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sample: """サンプルクラス""" def exec(self): """サンプル処理を実行します""" <|body_0|> def _run_filehandler_example(self): """logging.FileHandler のサンプル""" <|body_1|> def _run_streamhandler_example(self): """logging.StreamHandler のサンプル""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus_train_074134
5,131
permissive
[ { "docstring": "サンプル処理を実行します", "name": "exec", "signature": "def exec(self)" }, { "docstring": "logging.FileHandler のサンプル", "name": "_run_filehandler_example", "signature": "def _run_filehandler_example(self)" }, { "docstring": "logging.StreamHandler のサンプル", "name": "_run_str...
3
stack_v2_sparse_classes_30k_test_000800
Implement the Python class `Sample` described below. Class description: サンプルクラス Method signatures and docstrings: - def exec(self): サンプル処理を実行します - def _run_filehandler_example(self): logging.FileHandler のサンプル - def _run_streamhandler_example(self): logging.StreamHandler のサンプル
Implement the Python class `Sample` described below. Class description: サンプルクラス Method signatures and docstrings: - def exec(self): サンプル処理を実行します - def _run_filehandler_example(self): logging.FileHandler のサンプル - def _run_streamhandler_example(self): logging.StreamHandler のサンプル <|skeleton|> class Sample: """サンプルクラ...
8f0e9997012c7ef5a4f71c15c98ea2832424136d
<|skeleton|> class Sample: """サンプルクラス""" def exec(self): """サンプル処理を実行します""" <|body_0|> def _run_filehandler_example(self): """logging.FileHandler のサンプル""" <|body_1|> def _run_streamhandler_example(self): """logging.StreamHandler のサンプル""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sample: """サンプルクラス""" def exec(self): """サンプル処理を実行します""" hr('StreamHandler') self._run_streamhandler_example() hr('FileHandler') self._run_filehandler_example() def _run_filehandler_example(self): """logging.FileHandler のサンプル""" logdir = pathli...
the_stack_v2_python_sparse
trypython/stdlib/logging_/logging05.py
devlights/try-python
train
6
537223d234aa63eb5d556eecd039e90335f7a91f
[ "document = self.get_object(request, document_id)\nresponse_serializer = serializers.DocumentStatusSerializer(document)\nreturn JsonResponse(response_serializer.data, status=200)", "document = self.get_object(request, document_id)\nif document.status == 2:\n document = document.get_self_clone()\nrequest_serial...
<|body_start_0|> document = self.get_object(request, document_id) response_serializer = serializers.DocumentStatusSerializer(document) return JsonResponse(response_serializer.data, status=200) <|end_body_0|> <|body_start_1|> document = self.get_object(request, document_id) if do...
DocumentAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentAPIView: def get(self, request, document_id, format=None): """Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users""" <|body_0|> def put(self, request, document_id, format=None): """Launches u...
stack_v2_sparse_classes_75kplus_train_074135
8,316
no_license
[ { "docstring": "Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users", "name": "get", "signature": "def get(self, request, document_id, format=None)" }, { "docstring": "Launches uploading file to DBMS with selected_parameters. If...
3
stack_v2_sparse_classes_30k_train_046077
Implement the Python class `DocumentAPIView` described below. Class description: Implement the DocumentAPIView class. Method signatures and docstrings: - def get(self, request, document_id, format=None): Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: ...
Implement the Python class `DocumentAPIView` described below. Class description: Implement the DocumentAPIView class. Method signatures and docstrings: - def get(self, request, document_id, format=None): Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: ...
fcb2cad8ff4aa7c5dbddc109f6a001d0dd0e45c7
<|skeleton|> class DocumentAPIView: def get(self, request, document_id, format=None): """Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users""" <|body_0|> def put(self, request, document_id, format=None): """Launches u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocumentAPIView: def get(self, request, document_id, format=None): """Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users""" document = self.get_object(request, document_id) response_serializer = serializers.DocumentSt...
the_stack_v2_python_sparse
fileupload/views.py
squizduos/File2UploadDB
train
0
d8add02c4584d8263f7cebcd87d70f375e75c7b5
[ "super(EngineRichViewHandler, self).init_info(info)\ninfo.on_trait_change(self.select_selected, 'initialized')\nreturn", "editors = self.info.ui._editors\nif editors is not None:\n for editor in editors:\n if editor.factory is self.info.object.tree_editor:\n tree_editor = editor\n ...
<|body_start_0|> super(EngineRichViewHandler, self).init_info(info) info.on_trait_change(self.select_selected, 'initialized') return <|end_body_0|> <|body_start_1|> editors = self.info.ui._editors if editors is not None: for editor in editors: if edit...
A handler for the EngineRichView object.
EngineRichViewHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EngineRichViewHandler: """A handler for the EngineRichView object.""" def init_info(self, info): """Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.""" <|body_0|> def select_selected(self, initi...
stack_v2_sparse_classes_75kplus_train_074136
6,676
no_license
[ { "docstring": "Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.", "name": "init_info", "signature": "def init_info(self, info)" }, { "docstring": "Force the tree editor to select the current engine selection, and event...
3
stack_v2_sparse_classes_30k_test_000377
Implement the Python class `EngineRichViewHandler` described below. Class description: A handler for the EngineRichView object. Method signatures and docstrings: - def init_info(self, info): Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view. -...
Implement the Python class `EngineRichViewHandler` described below. Class description: A handler for the EngineRichView object. Method signatures and docstrings: - def init_info(self, info): Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view. -...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class EngineRichViewHandler: """A handler for the EngineRichView object.""" def init_info(self, info): """Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.""" <|body_0|> def select_selected(self, initi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EngineRichViewHandler: """A handler for the EngineRichView object.""" def init_info(self, info): """Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.""" super(EngineRichViewHandler, self).init_info(info) i...
the_stack_v2_python_sparse
maps/build/mayavi/enthought/mayavi/core/ui/engine_rich_view.py
m-elhussieny/code
train
0
5553ca2491752d544383be876a85cc5a399cb482
[ "self.id = id\nself.callback_url = callback_url\nself.publish_permissions = publish_permissions\nself.sessions = sessions\nself.subscriptions = subscriptions\nself.tag = tag\nself.device_api_version = device_api_version", "if dictionary is None:\n return None\nid = dictionary.get('id')\ncallback_url = dictiona...
<|body_start_0|> self.id = id self.callback_url = callback_url self.publish_permissions = publish_permissions self.sessions = sessions self.subscriptions = subscriptions self.tag = tag self.device_api_version = device_api_version <|end_body_0|> <|body_start_1|> ...
Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this participant can publish audio or video sessi...
Participant
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Participant: """Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this parti...
stack_v2_sparse_classes_75kplus_train_074137
3,403
permissive
[ { "docstring": "Constructor for the Participant class", "name": "__init__", "signature": "def __init__(self, id=None, callback_url=None, publish_permissions=None, sessions=None, subscriptions=None, tag=None, device_api_version='V2')" }, { "docstring": "Creates an instance of this model from a di...
2
stack_v2_sparse_classes_30k_train_021842
Implement the Python class `Participant` described below. Class description: Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of Publis...
Implement the Python class `Participant` described below. Class description: Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of Publis...
447df3cc8cb7acaf3361d842630c432a9c31ce6e
<|skeleton|> class Participant: """Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this parti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Participant: """Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this participant can pu...
the_stack_v2_python_sparse
bandwidth/webrtc/models/participant.py
Bandwidth/python-sdk
train
10
8f70a325f416deac47e351b4688a61565bbae999
[ "b = 2\nG = [('a', 'b'), ('a', 'c'), ('b', 'c'), ('d', 'e'), ('e', 'a')]\ng1 = bf.And([bf.Or([bf.Var('a1'), bf.Var('a2')]), bf.Or([bf.Var('c1'), bf.Var('c2')]), bf.Or([bf.Var('b1'), bf.Var('b2')]), bf.Or([bf.Var('e1'), bf.Var('e2')]), bf.Or([bf.Var('d1'), bf.Var('d2')])])\ng2 = bf.And([bf.Not(bf.And([bf.Var('a1'), ...
<|body_start_0|> b = 2 G = [('a', 'b'), ('a', 'c'), ('b', 'c'), ('d', 'e'), ('e', 'a')] g1 = bf.And([bf.Or([bf.Var('a1'), bf.Var('a2')]), bf.Or([bf.Var('c1'), bf.Var('c2')]), bf.Or([bf.Var('b1'), bf.Var('b2')]), bf.Or([bf.Var('e1'), bf.Var('e2')]), bf.Or([bf.Var('d1'), bf.Var('d2')])]) g...
Unit test for the translation of the hadamard problem to a SAT problem.
graph_coloring_to_SAT_unit_test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class graph_coloring_to_SAT_unit_test: """Unit test for the translation of the hadamard problem to a SAT problem.""" def test_graph_coloring_1(self): """Tests the translation of the graph coloring to a SAT problem for a given graph G and color b.""" <|body_0|> def test_graph_c...
stack_v2_sparse_classes_75kplus_train_074138
1,988
no_license
[ { "docstring": "Tests the translation of the graph coloring to a SAT problem for a given graph G and color b.", "name": "test_graph_coloring_1", "signature": "def test_graph_coloring_1(self)" }, { "docstring": "Tests the translation of the graph coloring to a SAT problem for a given graph G and ...
2
stack_v2_sparse_classes_30k_val_001087
Implement the Python class `graph_coloring_to_SAT_unit_test` described below. Class description: Unit test for the translation of the hadamard problem to a SAT problem. Method signatures and docstrings: - def test_graph_coloring_1(self): Tests the translation of the graph coloring to a SAT problem for a given graph G...
Implement the Python class `graph_coloring_to_SAT_unit_test` described below. Class description: Unit test for the translation of the hadamard problem to a SAT problem. Method signatures and docstrings: - def test_graph_coloring_1(self): Tests the translation of the graph coloring to a SAT problem for a given graph G...
bb4e876919bb956b75c442d528f3892553f1ee6f
<|skeleton|> class graph_coloring_to_SAT_unit_test: """Unit test for the translation of the hadamard problem to a SAT problem.""" def test_graph_coloring_1(self): """Tests the translation of the graph coloring to a SAT problem for a given graph G and color b.""" <|body_0|> def test_graph_c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class graph_coloring_to_SAT_unit_test: """Unit test for the translation of the hadamard problem to a SAT problem.""" def test_graph_coloring_1(self): """Tests the translation of the graph coloring to a SAT problem for a given graph G and color b.""" b = 2 G = [('a', 'b'), ('a', 'c'), ('...
the_stack_v2_python_sparse
unit_tests/graph_coloring_to_SAT_unit_test.py
KePcA/LVR-sat
train
0
f6474db7b3a553b42b7cdadb928d75e0c136aa42
[ "Mask.__init__(self, *args, **kwargs)\nself._ranges = ranges\nself._vrad = vrad\nself._component = component\nself._vrad_parameter = vrad_parameter", "if mode == Spectrum.Mode.LAMBDA:\n return wave * (1.0 + vrad / 299792.458)\nelse:\n return wave + np.log(1.0 + vrad / 299792.458)", "vrad = 0.0\nif self._c...
<|body_start_0|> Mask.__init__(self, *args, **kwargs) self._ranges = ranges self._vrad = vrad self._component = component self._vrad_parameter = vrad_parameter <|end_body_0|> <|body_start_1|> if mode == Spectrum.Mode.LAMBDA: return wave * (1.0 + vrad / 299792...
Masks ranges in spectra. This class, when called, creates a mask on the given wavelength ranges
MaskRanges
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskRanges: """Masks ranges in spectra. This class, when called, creates a mask on the given wavelength ranges""" def __init__(self, ranges: list, vrad: Union[str, float]=None, component: str=None, vrad_parameter: str=None, *args, **kwargs): """Initializes a new mask. Args: ranges: L...
stack_v2_sparse_classes_75kplus_train_074139
4,208
permissive
[ { "docstring": "Initializes a new mask. Args: ranges: List of tuples defining (start, end) of wavelength ranges to mask. vrad: Radial velocity to shift by, either a number or the name of a FITS header entry, in which case \"-<name>\" negates the value. component: Name of component to read the radial velocity fr...
3
stack_v2_sparse_classes_30k_test_000641
Implement the Python class `MaskRanges` described below. Class description: Masks ranges in spectra. This class, when called, creates a mask on the given wavelength ranges Method signatures and docstrings: - def __init__(self, ranges: list, vrad: Union[str, float]=None, component: str=None, vrad_parameter: str=None, ...
Implement the Python class `MaskRanges` described below. Class description: Masks ranges in spectra. This class, when called, creates a mask on the given wavelength ranges Method signatures and docstrings: - def __init__(self, ranges: list, vrad: Union[str, float]=None, component: str=None, vrad_parameter: str=None, ...
648eb1758e3744d9e3d6669edc4a0c4753559f17
<|skeleton|> class MaskRanges: """Masks ranges in spectra. This class, when called, creates a mask on the given wavelength ranges""" def __init__(self, ranges: list, vrad: Union[str, float]=None, component: str=None, vrad_parameter: str=None, *args, **kwargs): """Initializes a new mask. Args: ranges: L...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MaskRanges: """Masks ranges in spectra. This class, when called, creates a mask on the given wavelength ranges""" def __init__(self, ranges: list, vrad: Union[str, float]=None, component: str=None, vrad_parameter: str=None, *args, **kwargs): """Initializes a new mask. Args: ranges: List of tuples...
the_stack_v2_python_sparse
spexxy/mask/ranges.py
thusser/spexxy
train
4
472da661567a0e09553063aaa774ee2069f700af
[ "if divid == 'scratch_div_id':\n divid += '_%s' % str(uuid.uuid4()).replace('-', '')\nself.filename = filename\nself.divid = divid if divid else str(uuid.uuid4()).replace('-', '')\nself.width = width\nself.height = height", "w = self.width\nh = self.height\ndivid = self.divid\njs_path = os.path.dirname(locatio...
<|body_start_0|> if divid == 'scratch_div_id': divid += '_%s' % str(uuid.uuid4()).replace('-', '') self.filename = filename self.divid = divid if divid else str(uuid.uuid4()).replace('-', '') self.width = width self.height = height <|end_body_0|> <|body_start_1|> ...
Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.
RenderSnapRaw
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RenderSnapRaw: """Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.""" def __init__(self, width='1000', height='600', divid=None, filename=None): """initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|...
stack_v2_sparse_classes_75kplus_train_074140
2,981
permissive
[ { "docstring": "initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|None) filename", "name": "__init__", "signature": "def __init__(self, width='1000', height='600', divid=None, filename=None)" }, { "docstring": "Return a coup...
2
stack_v2_sparse_classes_30k_train_040173
Implement the Python class `RenderSnapRaw` described below. Class description: Renders `Snap <https://snap.berkeley.edu/>`_ using javascript. Method signatures and docstrings: - def __init__(self, width='1000', height='600', divid=None, filename=None): initialize @param width (str) width @param height (str) height @p...
Implement the Python class `RenderSnapRaw` described below. Class description: Renders `Snap <https://snap.berkeley.edu/>`_ using javascript. Method signatures and docstrings: - def __init__(self, width='1000', height='600', divid=None, filename=None): initialize @param width (str) width @param height (str) height @p...
e39f8ae416c23940c1a227c11c667c19104b2ff4
<|skeleton|> class RenderSnapRaw: """Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.""" def __init__(self, width='1000', height='600', divid=None, filename=None): """initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RenderSnapRaw: """Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.""" def __init__(self, width='1000', height='600', divid=None, filename=None): """initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|None) filenam...
the_stack_v2_python_sparse
src/code_beatrix/jsscripts/nbsnap.py
sdpython/code_beatrix
train
1
e30c5ddbcb322cb05cd077c16437e20f962c0124
[ "super(DatabaseWrapper, self).__init__(*args, **kwargs)\nops_cls = self.ops.__class__\nif not hasattr(ops_cls, 'binary_placeholder_sql'):\n from django.db.models.fields import BinaryField\n assert not hasattr(BinaryField, 'get_placeholder')\n ops_cls.binary_placeholder_sql = self._ops_binary_placeholder_sq...
<|body_start_0|> super(DatabaseWrapper, self).__init__(*args, **kwargs) ops_cls = self.ops.__class__ if not hasattr(ops_cls, 'binary_placeholder_sql'): from django.db.models.fields import BinaryField assert not hasattr(BinaryField, 'get_placeholder') ops_cls.b...
Database backend for MySQL. This is a specialized version of the standard Django MySQL database backend which adds backported compatibility fixes from newer versions of Django. Currently, this fixes an issue where contents going into a :py:class:`~django.db.models.BinaryField` could trigger a MySQL warning due to the b...
DatabaseWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseWrapper: """Database backend for MySQL. This is a specialized version of the standard Django MySQL database backend which adds backported compatibility fixes from newer versions of Django. Currently, this fixes an issue where contents going into a :py:class:`~django.db.models.BinaryField`...
stack_v2_sparse_classes_75kplus_train_074141
3,962
no_license
[ { "docstring": "Initialize the database backend. Args: *args (tuple): Positional arguments for the backend. **kwargs (dict): Keyword arguments for the backend.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Return the placeholder format string for bin...
3
stack_v2_sparse_classes_30k_train_038750
Implement the Python class `DatabaseWrapper` described below. Class description: Database backend for MySQL. This is a specialized version of the standard Django MySQL database backend which adds backported compatibility fixes from newer versions of Django. Currently, this fixes an issue where contents going into a :p...
Implement the Python class `DatabaseWrapper` described below. Class description: Database backend for MySQL. This is a specialized version of the standard Django MySQL database backend which adds backported compatibility fixes from newer versions of Django. Currently, this fixes an issue where contents going into a :p...
99ea69d80a3a393b0da4da3152ef26e808dd8487
<|skeleton|> class DatabaseWrapper: """Database backend for MySQL. This is a specialized version of the standard Django MySQL database backend which adds backported compatibility fixes from newer versions of Django. Currently, this fixes an issue where contents going into a :py:class:`~django.db.models.BinaryField`...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DatabaseWrapper: """Database backend for MySQL. This is a specialized version of the standard Django MySQL database backend which adds backported compatibility fixes from newer versions of Django. Currently, this fixes an issue where contents going into a :py:class:`~django.db.models.BinaryField` could trigge...
the_stack_v2_python_sparse
djblets/db/backends/mysql/base.py
chipx86/djblets
train
2
dfc6a42d38f5cea66c588e9bedb6a593450e3ffc
[ "with open(file_path, 'a') as file:\n for i in range(0, len(circuits)):\n file.write(circuits[i].qasm())\n if i != len(circuits) - 1:\n file.write(qasm_file_separator_token + '\\n')", "with open(file_path, 'r') as file:\n circuits_strings = file.read().split(qasm_file_separator_toke...
<|body_start_0|> with open(file_path, 'a') as file: for i in range(0, len(circuits)): file.write(circuits[i].qasm()) if i != len(circuits) - 1: file.write(qasm_file_separator_token + '\n') <|end_body_0|> <|body_start_1|> with open(file_pat...
A class for serializing Qiskit Quantum Circuits.
QiskitSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QiskitSerializer: """A class for serializing Qiskit Quantum Circuits.""" def serialize(circuits, file_path): """Serializes the given Qiskit Quantum Circuits and stores it at the given location.""" <|body_0|> def deserialize(file_path): """Deserializes the file be...
stack_v2_sparse_classes_75kplus_train_074142
1,158
no_license
[ { "docstring": "Serializes the given Qiskit Quantum Circuits and stores it at the given location.", "name": "serialize", "signature": "def serialize(circuits, file_path)" }, { "docstring": "Deserializes the file behind the given url to list of Qiskit Quantum Circuits.", "name": "deserialize"...
2
stack_v2_sparse_classes_30k_train_042981
Implement the Python class `QiskitSerializer` described below. Class description: A class for serializing Qiskit Quantum Circuits. Method signatures and docstrings: - def serialize(circuits, file_path): Serializes the given Qiskit Quantum Circuits and stores it at the given location. - def deserialize(file_path): Des...
Implement the Python class `QiskitSerializer` described below. Class description: A class for serializing Qiskit Quantum Circuits. Method signatures and docstrings: - def serialize(circuits, file_path): Serializes the given Qiskit Quantum Circuits and stores it at the given location. - def deserialize(file_path): Des...
ee78db14c0d5fc37d9990cf8ad634f5e264c161b
<|skeleton|> class QiskitSerializer: """A class for serializing Qiskit Quantum Circuits.""" def serialize(circuits, file_path): """Serializes the given Qiskit Quantum Circuits and stores it at the given location.""" <|body_0|> def deserialize(file_path): """Deserializes the file be...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QiskitSerializer: """A class for serializing Qiskit Quantum Circuits.""" def serialize(circuits, file_path): """Serializes the given Qiskit Quantum Circuits and stores it at the given location.""" with open(file_path, 'a') as file: for i in range(0, len(circuits)): ...
the_stack_v2_python_sparse
qhana_openapi/clustering/qiskitSerializer.py
IndikaKuma/quantum
train
0
7678f4c421ff69dd93275c0a0215d12d27df056e
[ "try:\n username = self.request.META['persistent-id']\nexcept KeyError:\n username = self.request.META['persistent_id']\ntry:\n JenkinsUser.objects.get(username=username)\n messages.error(request, 'User already registered')\n return bad_request(request, None, template_name=LOGIN_TEMPLATE)\nexcept Jen...
<|body_start_0|> try: username = self.request.META['persistent-id'] except KeyError: username = self.request.META['persistent_id'] try: JenkinsUser.objects.get(username=username) messages.error(request, 'User already registered') return...
This must be protected by shibboleth. Create a local account to associate with the shibboleth
ShibbolethUserRegistration
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShibbolethUserRegistration: """This must be protected by shibboleth. Create a local account to associate with the shibboleth""" def get(self, request, *args, **kwargs): """Check that the persistent-id has not already been registered, before providing the form.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_074143
21,511
permissive
[ { "docstring": "Check that the persistent-id has not already been registered, before providing the form.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Override the method from RegistrationView. Create a new user. Based on code from RegistrationView.re...
2
stack_v2_sparse_classes_30k_train_010494
Implement the Python class `ShibbolethUserRegistration` described below. Class description: This must be protected by shibboleth. Create a local account to associate with the shibboleth Method signatures and docstrings: - def get(self, request, *args, **kwargs): Check that the persistent-id has not already been regis...
Implement the Python class `ShibbolethUserRegistration` described below. Class description: This must be protected by shibboleth. Create a local account to associate with the shibboleth Method signatures and docstrings: - def get(self, request, *args, **kwargs): Check that the persistent-id has not already been regis...
598b3bc10b72b7b277510cf40e1a4bc56b07452a
<|skeleton|> class ShibbolethUserRegistration: """This must be protected by shibboleth. Create a local account to associate with the shibboleth""" def get(self, request, *args, **kwargs): """Check that the persistent-id has not already been registered, before providing the form.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShibbolethUserRegistration: """This must be protected by shibboleth. Create a local account to associate with the shibboleth""" def get(self, request, *args, **kwargs): """Check that the persistent-id has not already been registered, before providing the form.""" try: username...
the_stack_v2_python_sparse
jenkins_auth/views.py
antony-wilson/jenkins_auth
train
0
2e75f3f70ab13799d3b163d4f2873035a0de5839
[ "self.active = False\nLabel.__init__(self, name, None, rect, background_color)\nself.return_callback = return_callback\nreturn", "if len(keydown_event.unicode) and unicodedata.category(keydown_event.unicode)[0] in 'LNPSZ':\n self.text = self.text + keydown_event.unicode\nelif keydown_event.key == pygame.K_BACK...
<|body_start_0|> self.active = False Label.__init__(self, name, None, rect, background_color) self.return_callback = return_callback return <|end_body_0|> <|body_start_1|> if len(keydown_event.unicode) and unicodedata.category(keydown_event.unicode)[0] in 'LNPSZ': se...
A box where the user can type text. To actually receive key events, the TextBox must be registered with the Display using Display.key_sensitive(TextBox). Attributes: TextBox.text Standard Label attribute, holding the text typed so far. TextBox.active Boolean flag whether this TextBox is active, initally False.
TextBox
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextBox: """A box where the user can type text. To actually receive key events, the TextBox must be registered with the Display using Display.key_sensitive(TextBox). Attributes: TextBox.text Standard Label attribute, holding the text typed so far. TextBox.active Boolean flag whether this TextBox ...
stack_v2_sparse_classes_75kplus_train_074144
27,668
permissive
[ { "docstring": "Initialise the TextBox. If return_callback is given, return_callback(TextBox.text) will be called when [RETURN] is pressed.", "name": "__init__", "signature": "def __init__(self, name, rect, return_callback=None, background_color=(250, 250, 250))" }, { "docstring": "If printable,...
5
stack_v2_sparse_classes_30k_train_013447
Implement the Python class `TextBox` described below. Class description: A box where the user can type text. To actually receive key events, the TextBox must be registered with the Display using Display.key_sensitive(TextBox). Attributes: TextBox.text Standard Label attribute, holding the text typed so far. TextBox.ac...
Implement the Python class `TextBox` described below. Class description: A box where the user can type text. To actually receive key events, the TextBox must be registered with the Display using Display.key_sensitive(TextBox). Attributes: TextBox.text Standard Label attribute, holding the text typed so far. TextBox.ac...
c2fc3d4e9beedb8487cfa4bfa13bdf55ec36af97
<|skeleton|> class TextBox: """A box where the user can type text. To actually receive key events, the TextBox must be registered with the Display using Display.key_sensitive(TextBox). Attributes: TextBox.text Standard Label attribute, holding the text typed so far. TextBox.active Boolean flag whether this TextBox ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextBox: """A box where the user can type text. To actually receive key events, the TextBox must be registered with the Display using Display.key_sensitive(TextBox). Attributes: TextBox.text Standard Label attribute, holding the text typed so far. TextBox.active Boolean flag whether this TextBox is active, in...
the_stack_v2_python_sparse
reference_scripts/clickndrag-0.4.1/clickndrag/gui.py
stivosaurus/rpi-snippets
train
1
52a6bf90c5b046618e80d29445eed68b3a3a4422
[ "self.agent_num = agent_num\nself.PID_acc = PIDController(1.0, 0, 0)\nself.PID_steer = PIDController(2.0, 0, 0)", "obj = state.dynamic_objects[type_of_agent][str(self.agent_num)]\nif not obj.trajectory.is_empty():\n p = obj.trajectory.first()\n target_loc = p[:2].tolist()\n target_vel = p[2]\n while o...
<|body_start_0|> self.agent_num = agent_num self.PID_acc = PIDController(1.0, 0, 0) self.PID_steer = PIDController(2.0, 0, 0) <|end_body_0|> <|body_start_1|> obj = state.dynamic_objects[type_of_agent][str(self.agent_num)] if not obj.trajectory.is_empty(): p = obj.tra...
PursuitAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PursuitAgent: def __init__(self, agent_num=0): """Initializes the PlanningPursuitAgent Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary state.dynamic_objects['background_cars']""" <|body_0|> def eval_policy(self, state, type_o...
stack_v2_sparse_classes_75kplus_train_074145
2,061
permissive
[ { "docstring": "Initializes the PlanningPursuitAgent Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary state.dynamic_objects['background_cars']", "name": "__init__", "signature": "def __init__(self, agent_num=0)" }, { "docstring": "Returns action b...
2
stack_v2_sparse_classes_30k_train_042101
Implement the Python class `PursuitAgent` described below. Class description: Implement the PursuitAgent class. Method signatures and docstrings: - def __init__(self, agent_num=0): Initializes the PlanningPursuitAgent Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary st...
Implement the Python class `PursuitAgent` described below. Class description: Implement the PursuitAgent class. Method signatures and docstrings: - def __init__(self, agent_num=0): Initializes the PlanningPursuitAgent Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary st...
c4d420e2bad173e5ddd0f93e98449c786d90f2db
<|skeleton|> class PursuitAgent: def __init__(self, agent_num=0): """Initializes the PlanningPursuitAgent Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary state.dynamic_objects['background_cars']""" <|body_0|> def eval_policy(self, state, type_o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PursuitAgent: def __init__(self, agent_num=0): """Initializes the PlanningPursuitAgent Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary state.dynamic_objects['background_cars']""" self.agent_num = agent_num self.PID_acc = PIDController(1...
the_stack_v2_python_sparse
gym_urbandriving/agents/background/pursuit_agent.py
mikolajblaz/Urban_Driving_Simulator
train
0
9f80b8fce268c87e43adbe8d3abc995e502b2d84
[ "main.clear_collections()\nresult = main.import_data('./data/', 'products', 'customers', 'rentals')\nself.assertEqual(result[1], 1000)\nself.assertEqual(result[2], 0)\nself.assertEqual(result[3], 1000)\nself.assertGreater(result[4], 0)", "function = main.show_available_products()\nproduct_1 = function['prd0018'][...
<|body_start_0|> main.clear_collections() result = main.import_data('./data/', 'products', 'customers', 'rentals') self.assertEqual(result[1], 1000) self.assertEqual(result[2], 0) self.assertEqual(result[3], 1000) self.assertGreater(result[4], 0) <|end_body_0|> <|body_st...
Class for testing HP Norton database
ModuleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" <|body_0|> def test_show_available_products(self): """Test DB to show all available products as a Python diction...
stack_v2_sparse_classes_75kplus_train_074146
2,469
no_license
[ { "docstring": "Test CSV import and correct database insertion functionality", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test DB to show all available products as a Python dictionary", "name": "test_show_available_products", "signature": "de...
3
stack_v2_sparse_classes_30k_train_038504
Implement the Python class `ModuleTests` described below. Class description: Class for testing HP Norton database Method signatures and docstrings: - def test_import_data(self): Test CSV import and correct database insertion functionality - def test_show_available_products(self): Test DB to show all available product...
Implement the Python class `ModuleTests` described below. Class description: Class for testing HP Norton database Method signatures and docstrings: - def test_import_data(self): Test CSV import and correct database insertion functionality - def test_show_available_products(self): Test DB to show all available product...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" <|body_0|> def test_show_available_products(self): """Test DB to show all available products as a Python diction...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" main.clear_collections() result = main.import_data('./data/', 'products', 'customers', 'rentals') self.assertEqual(result[...
the_stack_v2_python_sparse
students/stellie/lesson07/assignment/test_parallel.py
JavaRod/SP_Python220B_2019
train
1
6a6fd20a701d903a2e6219b9fb8d96f3fa485404
[ "self.time = 0\nself.tweets = {}\nself.friends = {}\nself.timetweetId = {}", "if userId not in self.tweets.keys():\n self.tweets[userId] = []\nself.tweets[userId].append(self.time)\nself.timetweetId[self.time] = tweetId\nself.time += 1", "tem = []\nres = []\nif userId not in self.friends.keys():\n self.fr...
<|body_start_0|> self.time = 0 self.tweets = {} self.friends = {} self.timetweetId = {} <|end_body_0|> <|body_start_1|> if userId not in self.tweets.keys(): self.tweets[userId] = [] self.tweets[userId].append(self.time) self.timetweetId[self.time] = t...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int) -> List[int]: """Retrieve the 10 m...
stack_v2_sparse_classes_75kplus_train_074147
2,349
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet.", "name": "postTweet", "signature": "def postTweet(self, userId: int, tweetId: int) -> None" }, { "docstring": "Retrieve the 10 mos...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int) -> List...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int) -> List...
92ea694c70765aa8fed82055871f06d7a9c85de2
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int) -> List[int]: """Retrieve the 10 m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Twitter: def __init__(self): """Initialize your data structure here.""" self.time = 0 self.tweets = {} self.friends = {} self.timetweetId = {} def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" if userId not in self.t...
the_stack_v2_python_sparse
heregreat/python/355.design-twitter.py
SH-202/LeetCode-202
train
0
00e446368e3fc28af9c3cc14c670c47d0f932ca8
[ "for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return [i, j]", "for i, n in enumerate(nums):\n remain = target - n\n if remain in nums[i + 1:]:\n return (nums.index(n), nums[i + 1:].index(remain) + (i + 1))", "dic = {}\nfor i...
<|body_start_0|> for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return [i, j] <|end_body_0|> <|body_start_1|> for i, n in enumerate(nums): remain = target - n if remain in nums[i + 1:]:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def twoSum3(self, nums, targ...
stack_v2_sparse_classes_75kplus_train_074148
2,311
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum1", "signature": "def twoSum1(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum2", "signature": "def twoSum2(self, nums, target)" ...
4
stack_v2_sparse_classes_30k_train_023652
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List...
bea9d655338af9ce35c70927888930507bb6aae8
<|skeleton|> class Solution: def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def twoSum3(self, nums, targ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return [i, j] def twoSum2(self, nums, tar...
the_stack_v2_python_sparse
twoSum.py
lilly9117/Algorithm_study
train
0
78a1408deef03fad68d996803d9ce610f21966d3
[ "assert isinstance(address, str), 'The address is no string'\nassert isinstance(port, int), 'The port is no int'\nsuper(RemoteAdapterClient, self).__init__()\nif address == '127.0.0.1':\n address = 'localhost'\nself._address = address\nself._port = port\ntry:\n self._transport = TSocket.TSocket(host=self._add...
<|body_start_0|> assert isinstance(address, str), 'The address is no string' assert isinstance(port, int), 'The port is no int' super(RemoteAdapterClient, self).__init__() if address == '127.0.0.1': address = 'localhost' self._address = address self._port = po...
A wrapper for a adapter client connection Attributes ---------- _address : str The address of the service _port : str The port of the service _transport : TTransport The thrift transport _acces : MMIAdapter.Iface The actual access
RemoteAdapterClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteAdapterClient: """A wrapper for a adapter client connection Attributes ---------- _address : str The address of the service _port : str The port of the service _transport : TTransport The thrift transport _acces : MMIAdapter.Iface The actual access""" def __init__(self, address, port):...
stack_v2_sparse_classes_75kplus_train_074149
2,394
permissive
[ { "docstring": "Constructor which needs an address, a port and an access_type. Parameters ---------- address : str The address of the service port : str The port of the service", "name": "__init__", "signature": "def __init__(self, address, port)" }, { "docstring": "Closes the connection to the ...
2
stack_v2_sparse_classes_30k_val_001676
Implement the Python class `RemoteAdapterClient` described below. Class description: A wrapper for a adapter client connection Attributes ---------- _address : str The address of the service _port : str The port of the service _transport : TTransport The thrift transport _acces : MMIAdapter.Iface The actual access Me...
Implement the Python class `RemoteAdapterClient` described below. Class description: A wrapper for a adapter client connection Attributes ---------- _address : str The address of the service _port : str The port of the service _transport : TTransport The thrift transport _acces : MMIAdapter.Iface The actual access Me...
329b41541e1debe22ecaf414e1eade0e0786d82d
<|skeleton|> class RemoteAdapterClient: """A wrapper for a adapter client connection Attributes ---------- _address : str The address of the service _port : str The port of the service _transport : TTransport The thrift transport _acces : MMIAdapter.Iface The actual access""" def __init__(self, address, port):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoteAdapterClient: """A wrapper for a adapter client connection Attributes ---------- _address : str The address of the service _port : str The port of the service _transport : TTransport The thrift transport _acces : MMIAdapter.Iface The actual access""" def __init__(self, address, port): """C...
the_stack_v2_python_sparse
Framework/LanguageSupport/python/MMIPython/src/MMIPython/abstraction/access/remote/remote_adapter_client.py
mercedes-benz/MOSIM_Core
train
3
3f590307c4e50d1541efba93db3325a8e347bd33
[ "self.instance_keypair = self.os_conn.create_key(key_name='instancekey')\nzone = self.os_conn.nova.availability_zones.find(zoneName='nova')\nvm_hosts = zone.hosts.keys()[:2]\nself.setup_rules_for_default_sec_group()\nrouter = self.os_conn.create_router(name='router01')\nfor i, hostname in enumerate(vm_hosts, 1):\n ...
<|body_start_0|> self.instance_keypair = self.os_conn.create_key(key_name='instancekey') zone = self.os_conn.nova.availability_zones.find(zoneName='nova') vm_hosts = zone.hosts.keys()[:2] self.setup_rules_for_default_sec_group() router = self.os_conn.create_router(name='router01'...
Check restarts of openvswitch-agents.
TestOVSRestartTwoVms
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOVSRestartTwoVms: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/2...
stack_v2_sparse_classes_75kplus_train_074150
41,546
no_license
[ { "docstring": "Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/24 and attach them to router01. 3. Launch vm1 in net01 network and vm2 in net02 network on different computes 4....
3
stack_v2_sparse_classes_30k_train_010345
Implement the Python class `TestOVSRestartTwoVms` described below. Class description: Check restarts of openvswitch-agents. Method signatures and docstrings: - def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__su...
Implement the Python class `TestOVSRestartTwoVms` described below. Class description: Check restarts of openvswitch-agents. Method signatures and docstrings: - def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__su...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class TestOVSRestartTwoVms: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/2...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestOVSRestartTwoVms: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/24 and attach ...
the_stack_v2_python_sparse
mos_tests/neutron/python_tests/test_ovs_restart.py
Mirantis/mos-integration-tests
train
16
0385c7f0deeb55f6c38847633693a9160f816003
[ "super(RnnEncoder, self).__init__()\ncells = {'GRU': nn.GRU, 'LSTM': nn.LSTM}\nself.rnn = cells[args.cell_type](input_size=args.embedding_dim, hidden_size=args.hidden_dim // 2, num_layers=args.layer_num, bidirectional=True)", "e_T = e.permute(1, 0, 2)\nif m is not None:\n seq_lens = list(map(int, torch.sum(m, ...
<|body_start_0|> super(RnnEncoder, self).__init__() cells = {'GRU': nn.GRU, 'LSTM': nn.LSTM} self.rnn = cells[args.cell_type](input_size=args.embedding_dim, hidden_size=args.hidden_dim // 2, num_layers=args.layer_num, bidirectional=True) <|end_body_0|> <|body_start_1|> e_T = e.permute(1...
Basic RNN encoder module, input embeddings and output hidden states.
RnnEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RnnEncoder: """Basic RNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, "GRU" or "LSTM". args.embedding_dim ...
stack_v2_sparse_classes_75kplus_train_074151
6,319
no_license
[ { "docstring": "Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, \"GRU\" or \"LSTM\". args.embedding_dim -- dimension of word embeddings.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstri...
2
stack_v2_sparse_classes_30k_val_000876
Implement the Python class `RnnEncoder` described below. Class description: Basic RNN encoder module, input embeddings and output hidden states. Method signatures and docstrings: - def __init__(self, args): Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -...
Implement the Python class `RnnEncoder` described below. Class description: Basic RNN encoder module, input embeddings and output hidden states. Method signatures and docstrings: - def __init__(self, args): Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -...
e79606e24ecc6fd713b481afb527c34eec7d5d66
<|skeleton|> class RnnEncoder: """Basic RNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, "GRU" or "LSTM". args.embedding_dim ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RnnEncoder: """Basic RNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, "GRU" or "LSTM". args.embedding_dim -- dimension ...
the_stack_v2_python_sparse
rationalize/models/encoder.py
anshiquanshu66/factcheck-acl2021
train
0
20b15068e8816399b24575a7fa9a0bf5d93bbbc9
[ "self.result = []\nl1 = len(v1)\nl2 = len(v2)\nif l1 == 0 and l2 > 0:\n self.result.extend(v2)\nelif l2 == 0 and l1 > 0:\n self.result.extend(v1)\nelif l1 == 0 and l2 == 0:\n self.result = []\nelse:\n for num in v1:\n self.result.append(num)\n self.result.append(None)\n i = 1\n for n...
<|body_start_0|> self.result = [] l1 = len(v1) l2 = len(v2) if l1 == 0 and l2 > 0: self.result.extend(v2) elif l2 == 0 and l1 > 0: self.result.extend(v1) elif l1 == 0 and l2 == 0: self.result = [] else: for num in v1...
ZigzagIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_75kplus_train_074152
2,741
no_license
[ { "docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]", "name": "__init__", "signature": "def __init__(self, v1, v2)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name"...
3
stack_v2_sparse_classes_30k_train_010828
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
fcf6c3d5d60d13706950247d8a2327adc5faf17e
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" self.result = [] l1 = len(v1) l2 = len(v2) if l1 == 0 and l2 > 0: self.result.extend(v2) elif l2 == 0 and l1 > 0: ...
the_stack_v2_python_sparse
Medium/ZigzagIterator.py
mangalagb/Leetcode
train
0
dccb9a58a5fdd6a5cd902f44ed7b9dcc6fa92218
[ "self.access_key = access_key\nself.s3_config = s3_config\nself.secret_key = secret_key", "if dictionary is None:\n return None\naccess_key = dictionary.get('accessKey')\ns3_config = cohesity_management_sdk.models.s3_bucket_config_proto.S3BucketConfigProto.from_dictionary(dictionary.get('s3Config')) if diction...
<|body_start_0|> self.access_key = access_key self.s3_config = s3_config self.secret_key = secret_key <|end_body_0|> <|body_start_1|> if dictionary is None: return None access_key = dictionary.get('accessKey') s3_config = cohesity_management_sdk.models.s3_buc...
Implementation of the 'UdaS3ViewBackupProperties' model. // ----------------------------------------------------------------------------- Attributes: access_key (string): Access key for the buckets which will be created for the source initiated jobs. This needs to be passed to UDA for doing all s3 communications. s3_co...
UdaS3ViewBackupProperties
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UdaS3ViewBackupProperties: """Implementation of the 'UdaS3ViewBackupProperties' model. // ----------------------------------------------------------------------------- Attributes: access_key (string): Access key for the buckets which will be created for the source initiated jobs. This needs to be...
stack_v2_sparse_classes_75kplus_train_074153
2,459
permissive
[ { "docstring": "Constructor for the UdaS3ViewBackupProperties class", "name": "__init__", "signature": "def __init__(self, access_key=None, s3_config=None, secret_key=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe...
2
stack_v2_sparse_classes_30k_train_034959
Implement the Python class `UdaS3ViewBackupProperties` described below. Class description: Implementation of the 'UdaS3ViewBackupProperties' model. // ----------------------------------------------------------------------------- Attributes: access_key (string): Access key for the buckets which will be created for the ...
Implement the Python class `UdaS3ViewBackupProperties` described below. Class description: Implementation of the 'UdaS3ViewBackupProperties' model. // ----------------------------------------------------------------------------- Attributes: access_key (string): Access key for the buckets which will be created for the ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class UdaS3ViewBackupProperties: """Implementation of the 'UdaS3ViewBackupProperties' model. // ----------------------------------------------------------------------------- Attributes: access_key (string): Access key for the buckets which will be created for the source initiated jobs. This needs to be...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UdaS3ViewBackupProperties: """Implementation of the 'UdaS3ViewBackupProperties' model. // ----------------------------------------------------------------------------- Attributes: access_key (string): Access key for the buckets which will be created for the source initiated jobs. This needs to be passed to UD...
the_stack_v2_python_sparse
cohesity_management_sdk/models/uda_s3_view_backup_properties.py
cohesity/management-sdk-python
train
24
55d8b8d39d0d973eae1d03492c651000aa56960b
[ "while 1:\n url = 'http://www.milk.com.hk/content/%E5%88%A5%E6%B3%A8%E5%A8%81%E5%A3%AB%E5%BF%8C-johnnie-walker-x-hbo%E6%AC%8A%E5%8A%9B%E9%81%8A%E6%88%B2-white-walker-johnnie-walker'\n flag = ''\n title = \"//h2[@class='headtitle']/text()\"\n content = \"//div[@class='node']\"\n author = ''\n creat...
<|body_start_0|> while 1: url = 'http://www.milk.com.hk/content/%E5%88%A5%E6%B3%A8%E5%A8%81%E5%A3%AB%E5%BF%8C-johnnie-walker-x-hbo%E6%AC%8A%E5%8A%9B%E9%81%8A%E6%88%B2-white-walker-johnnie-walker' flag = '' title = "//h2[@class='headtitle']/text()" content = "//div...
SpiderSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpiderSpider: def start_requests(self): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:""" <|body_0|> def parse(self, response): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :...
stack_v2_sparse_classes_75kplus_train_074154
2,271
no_license
[ { "docstring": "flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:", ...
2
null
Implement the Python class `SpiderSpider` described below. Class description: Implement the SpiderSpider class. Method signatures and docstrings: - def start_requests(self): flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return: - def parse(self, response): flag 标志位:是否已经爬取 title...
Implement the Python class `SpiderSpider` described below. Class description: Implement the SpiderSpider class. Method signatures and docstrings: - def start_requests(self): flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return: - def parse(self, response): flag 标志位:是否已经爬取 title...
206fa55b1a0b471478beaad06a09f6718cbeb00f
<|skeleton|> class SpiderSpider: def start_requests(self): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:""" <|body_0|> def parse(self, response): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpiderSpider: def start_requests(self): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:""" while 1: url = 'http://www.milk.com.hk/content/%E5%88%A5%E6%B3%A8%E5%A8%81%E5%A3%AB%E5%BF%8C-johnnie-walker-x-hbo%E6%AC%8A%E5%8A%9B%E9%81%8A%E...
the_stack_v2_python_sparse
spider_system/spider_page/spider_page/spiders/spider.py
logonmy/colely
train
0
cd1718512ffec446355644b1ccb459abbb4db480
[ "Part.__init__(self, config_, simulator, name)\nfor muscle_config in config_['muscles']:\n self.muscles.append(eval(self.muscle_type))\nself.connection_matrix = config_['connection_matrix']", "for i in range(len(self.muscles)):\n if len(self.connection_matrix[self.muscles[i].name]) != len(brain_output):\n ...
<|body_start_0|> Part.__init__(self, config_, simulator, name) for muscle_config in config_['muscles']: self.muscles.append(eval(self.muscle_type)) self.connection_matrix = config_['connection_matrix'] <|end_body_0|> <|body_start_1|> for i in range(len(self.muscles)): ...
This class represents a generic leg and its current behaviour in the control process
Leg
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Leg: """This class represents a generic leg and its current behaviour in the control process""" def __init__(self, config_, simulator, name): """Class initialization :param config_: Dictionary containing part parameters :param simulator: String name of the simulator class utility :pa...
stack_v2_sparse_classes_75kplus_train_074155
8,402
no_license
[ { "docstring": "Class initialization :param config_: Dictionary containing part parameters :param simulator: String name of the simulator class utility :param name: String name of the part", "name": "__init__", "signature": "def __init__(self, config_, simulator, name)" }, { "docstring": "Update...
2
stack_v2_sparse_classes_30k_train_048148
Implement the Python class `Leg` described below. Class description: This class represents a generic leg and its current behaviour in the control process Method signatures and docstrings: - def __init__(self, config_, simulator, name): Class initialization :param config_: Dictionary containing part parameters :param ...
Implement the Python class `Leg` described below. Class description: This class represents a generic leg and its current behaviour in the control process Method signatures and docstrings: - def __init__(self, config_, simulator, name): Class initialization :param config_: Dictionary containing part parameters :param ...
f4f212a7533a63d1148068bacf1cc13d3f64db49
<|skeleton|> class Leg: """This class represents a generic leg and its current behaviour in the control process""" def __init__(self, config_, simulator, name): """Class initialization :param config_: Dictionary containing part parameters :param simulator: String name of the simulator class utility :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Leg: """This class represents a generic leg and its current behaviour in the control process""" def __init__(self, config_, simulator, name): """Class initialization :param config_: Dictionary containing part parameters :param simulator: String name of the simulator class utility :param name: Str...
the_stack_v2_python_sparse
src/musculoskeletals/body.py
mahedjaved/mouse_locomotion
train
0
602efb730f57e75598282ad0e6903e7d4ff8de21
[ "lookups = [('all_except_waste', u'All except waste')]\nlocations = StorageLocation.objects.all()\nfor location in locations:\n lookups.append((location.id, location.name))\nlookups = set(lookups)\nlookups = sorted(lookups, key=lambda tup: tup[1])\nreturn lookups", "if self.value() == None:\n return queryse...
<|body_start_0|> lookups = [('all_except_waste', u'All except waste')] locations = StorageLocation.objects.all() for location in locations: lookups.append((location.id, location.name)) lookups = set(lookups) lookups = sorted(lookups, key=lambda tup: tup[1]) re...
InstanceStorageLocationListFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceStorageLocationListFilter: def lookups(self, request, model_admin): """We add the option to filter by 'all but waste' in order to get an overview of what is currently in stock in an easy way""" <|body_0|> def queryset(self, request, queryset): """Returns the ...
stack_v2_sparse_classes_75kplus_train_074156
11,321
no_license
[ { "docstring": "We add the option to filter by 'all but waste' in order to get an overview of what is currently in stock in an easy way", "name": "lookups", "signature": "def lookups(self, request, model_admin)" }, { "docstring": "Returns the filtered queryset based on the value provided in the ...
2
null
Implement the Python class `InstanceStorageLocationListFilter` described below. Class description: Implement the InstanceStorageLocationListFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): We add the option to filter by 'all but waste' in order to get an overview of what is c...
Implement the Python class `InstanceStorageLocationListFilter` described below. Class description: Implement the InstanceStorageLocationListFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): We add the option to filter by 'all but waste' in order to get an overview of what is c...
a2afeded81c6fc535f484c97a2267d6f9c555993
<|skeleton|> class InstanceStorageLocationListFilter: def lookups(self, request, model_admin): """We add the option to filter by 'all but waste' in order to get an overview of what is currently in stock in an easy way""" <|body_0|> def queryset(self, request, queryset): """Returns the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InstanceStorageLocationListFilter: def lookups(self, request, model_admin): """We add the option to filter by 'all but waste' in order to get an overview of what is currently in stock in an easy way""" lookups = [('all_except_waste', u'All except waste')] locations = StorageLocation.ob...
the_stack_v2_python_sparse
src/cheminventory/admin.py
nano-bio/labbooks
train
1
969a5256783748b7494d123929cf87693148018a
[ "if hasattr(self, '_y'):\n return\nself._y = Int(0)", "from apysc.type import value_util\nself._initialize_y_if_not_initialized()\nreturn value_util.get_copy(value=self._y)", "from apysc.type.number_value_interface import NumberValueInterface\nfrom apysc.validation import number_validation\nif not isinstance...
<|body_start_0|> if hasattr(self, '_y'): return self._y = Int(0) <|end_body_0|> <|body_start_1|> from apysc.type import value_util self._initialize_y_if_not_initialized() return value_util.get_copy(value=self._y) <|end_body_1|> <|body_start_2|> from apysc.ty...
YInterface
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YInterface: def _initialize_y_if_not_initialized(self) -> None: """Initialize _y attribute if it is not initialized yet.""" <|body_0|> def y(self) -> Int: """Get a y-coordinate. Returns ------- y : Int Y-coordinate.""" <|body_1|> def y(self, value: Int) ...
stack_v2_sparse_classes_75kplus_train_074157
2,964
permissive
[ { "docstring": "Initialize _y attribute if it is not initialized yet.", "name": "_initialize_y_if_not_initialized", "signature": "def _initialize_y_if_not_initialized(self) -> None" }, { "docstring": "Get a y-coordinate. Returns ------- y : Int Y-coordinate.", "name": "y", "signature": "...
6
null
Implement the Python class `YInterface` described below. Class description: Implement the YInterface class. Method signatures and docstrings: - def _initialize_y_if_not_initialized(self) -> None: Initialize _y attribute if it is not initialized yet. - def y(self) -> Int: Get a y-coordinate. Returns ------- y : Int Y-...
Implement the Python class `YInterface` described below. Class description: Implement the YInterface class. Method signatures and docstrings: - def _initialize_y_if_not_initialized(self) -> None: Initialize _y attribute if it is not initialized yet. - def y(self) -> Int: Get a y-coordinate. Returns ------- y : Int Y-...
5c6a4674e2e9684cb2cb1325dc9b070879d4d355
<|skeleton|> class YInterface: def _initialize_y_if_not_initialized(self) -> None: """Initialize _y attribute if it is not initialized yet.""" <|body_0|> def y(self) -> Int: """Get a y-coordinate. Returns ------- y : Int Y-coordinate.""" <|body_1|> def y(self, value: Int) ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class YInterface: def _initialize_y_if_not_initialized(self) -> None: """Initialize _y attribute if it is not initialized yet.""" if hasattr(self, '_y'): return self._y = Int(0) def y(self) -> Int: """Get a y-coordinate. Returns ------- y : Int Y-coordinate.""" ...
the_stack_v2_python_sparse
apysc/display/y_interface.py
TrendingTechnology/apysc
train
0
35b856c324cb40ca03d3a6af3f2448ebc3c74975
[ "self._action_ph = tf.placeholder(tf.float32, (batch_size, action_size))\nself._batch_size = batch_size\nself._action_size = action_size\nself._build_target = build_target\nself._action_space = spaces.Box(low=-1, high=1, shape=(action_size,))\nself._include_timestep = include_timestep\nsuper(CEMActorPolicy, self)._...
<|body_start_0|> self._action_ph = tf.placeholder(tf.float32, (batch_size, action_size)) self._batch_size = batch_size self._action_size = action_size self._build_target = build_target self._action_space = spaces.Box(low=-1, high=1, shape=(action_size,)) self._include_tim...
Learned policy for grasping (continuous). Uses CEM for selecting actions.
CEMActorPolicy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CEMActorPolicy: """Learned policy for grasping (continuous). Uses CEM for selecting actions.""" def __init__(self, q_func, state_shape, action_size, use_gpu=True, batch_size=64, build_target=False, include_timestep=True, checkpoint=None): """Initializes the policy. Args: q_func: Pyth...
stack_v2_sparse_classes_75kplus_train_074158
14,341
permissive
[ { "docstring": "Initializes the policy. Args: q_func: Python function that takes in state, action, scope as input and returns Q(state, action) and intermediate endpoints dictionary. state_shape: Tuple of ints describing shape of the state observation. action_size: (int) Size of the vector-encoded action. use_gp...
3
stack_v2_sparse_classes_30k_train_024486
Implement the Python class `CEMActorPolicy` described below. Class description: Learned policy for grasping (continuous). Uses CEM for selecting actions. Method signatures and docstrings: - def __init__(self, q_func, state_shape, action_size, use_gpu=True, batch_size=64, build_target=False, include_timestep=True, che...
Implement the Python class `CEMActorPolicy` described below. Class description: Learned policy for grasping (continuous). Uses CEM for selecting actions. Method signatures and docstrings: - def __init__(self, q_func, state_shape, action_size, use_gpu=True, batch_size=64, build_target=False, include_timestep=True, che...
dea327aa9e7ef7f7bca5a6c225dbdca1077a06e9
<|skeleton|> class CEMActorPolicy: """Learned policy for grasping (continuous). Uses CEM for selecting actions.""" def __init__(self, q_func, state_shape, action_size, use_gpu=True, batch_size=64, build_target=False, include_timestep=True, checkpoint=None): """Initializes the policy. Args: q_func: Pyth...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CEMActorPolicy: """Learned policy for grasping (continuous). Uses CEM for selecting actions.""" def __init__(self, q_func, state_shape, action_size, use_gpu=True, batch_size=64, build_target=False, include_timestep=True, checkpoint=None): """Initializes the policy. Args: q_func: Python function t...
the_stack_v2_python_sparse
dql_grasping/policies.py
Tarkiyah/googleResearch
train
11
f386bc0d41495e451459fac687841b98ba29c578
[ "self.num_items = 0\nself.midpoint = None\nself.left = []\nself.right = []", "if self.num_items == 0:\n self.midpoint = num\n self.num_items += 1\n return\nif self.num_items % 2:\n if self.midpoint is not None and num < self.midpoint:\n heapq.heappush(self.left, -num)\n heapq.heappush(se...
<|body_start_0|> self.num_items = 0 self.midpoint = None self.left = [] self.right = [] <|end_body_0|> <|body_start_1|> if self.num_items == 0: self.midpoint = num self.num_items += 1 return if self.num_items % 2: if self.m...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_074159
3,307
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: None", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_044438
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float <|skeleton|> class Me...
de7022d81fd56c2cb3d451e972e6d3e9c45fb8fa
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.num_items = 0 self.midpoint = None self.left = [] self.right = [] def addNum(self, num): """:type num: int :rtype: None""" if self.num_items == 0: self.mid...
the_stack_v2_python_sparse
median-from-data-stream/jhalley.py
zuohao/interviewprep
train
0
ed1f2c5753cf33da658abbfec9412f2bad8a6272
[ "i = 0\ns = sorted(set(nums))\nfor n in s:\n nums[i] = n\n i += 1\nreturn len(s)", "if not nums:\n return 0\nindex = 0\nfor num in nums:\n if num == nums[index]:\n continue\n index += 1\n nums[index] = num\nreturn index + 1" ]
<|body_start_0|> i = 0 s = sorted(set(nums)) for n in s: nums[i] = n i += 1 return len(s) <|end_body_0|> <|body_start_1|> if not nums: return 0 index = 0 for num in nums: if num == nums[index]: conti...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicates2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int 必要要修改输入数组nums""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 0 s = so...
stack_v2_sparse_classes_75kplus_train_074160
930
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates2", "signature": "def removeDuplicates2(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 必要要修改输入数组nums", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_050678
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates2(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int 必要要修改输入数组nums
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates2(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int 必要要修改输入数组nums <|skeleton|> class Solut...
ae6e61b947820aca69baeba428262ec1c22d14a8
<|skeleton|> class Solution: def removeDuplicates2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int 必要要修改输入数组nums""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeDuplicates2(self, nums): """:type nums: List[int] :rtype: int""" i = 0 s = sorted(set(nums)) for n in s: nums[i] = n i += 1 return len(s) def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int 必要要修...
the_stack_v2_python_sparse
Array/26.py
LiPingjiang/leetcode
train
0
9316c31ff42ccdbb2bf3d2ccdfdef70f6f19c27f
[ "headers = {'Content-Type': 'text/html'}\npage = self.MESSAGE_TEMPLATE % dict(message=message)\nreturn Response(page, status_code, headers=headers)", "if not secret:\n return self.html_response(404, _('No confirmation code provided'))\nif not resource_id:\n return self.html_response(404, _('No resource ID p...
<|body_start_0|> headers = {'Content-Type': 'text/html'} page = self.MESSAGE_TEMPLATE % dict(message=message) return Response(page, status_code, headers=headers) <|end_body_0|> <|body_start_1|> if not secret: return self.html_response(404, _('No confirmation code provided'))...
Validates Resources based on validation codes. The confirmation codes were sent out in emails to the addresses that need to be validated, or otherwise communicated to someone who needs to click on the link to this controller.
ValidationController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidationController: """Validates Resources based on validation codes. The confirmation codes were sent out in emails to the addresses that need to be validated, or otherwise communicated to someone who needs to click on the link to this controller.""" def html_response(self, status_code, m...
stack_v2_sparse_classes_75kplus_train_074161
14,531
permissive
[ { "docstring": "Return a human-readable message as a minimal HTML page. This controller is used by human beings, so HTML is better than Problem Detail Documents.", "name": "html_response", "signature": "def html_response(self, status_code, message)" }, { "docstring": "Confirm a secret for a URI,...
2
stack_v2_sparse_classes_30k_val_002873
Implement the Python class `ValidationController` described below. Class description: Validates Resources based on validation codes. The confirmation codes were sent out in emails to the addresses that need to be validated, or otherwise communicated to someone who needs to click on the link to this controller. Method...
Implement the Python class `ValidationController` described below. Class description: Validates Resources based on validation codes. The confirmation codes were sent out in emails to the addresses that need to be validated, or otherwise communicated to someone who needs to click on the link to this controller. Method...
b13e8ad6b2e28c4b5f071c55e3590c2be280d928
<|skeleton|> class ValidationController: """Validates Resources based on validation codes. The confirmation codes were sent out in emails to the addresses that need to be validated, or otherwise communicated to someone who needs to click on the link to this controller.""" def html_response(self, status_code, m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidationController: """Validates Resources based on validation codes. The confirmation codes were sent out in emails to the addresses that need to be validated, or otherwise communicated to someone who needs to click on the link to this controller.""" def html_response(self, status_code, message): ...
the_stack_v2_python_sparse
library_registry/library_registration_protocol/controller.py
NYPL-Simplified/library_registry
train
3
3db5f3a2e2e3b286072b45c00847e839e99886c9
[ "try:\n if 'key' in request.query_params:\n key = request.query_params['key']\n else:\n key = None\n request_args = {'service': 'meta', 'collection_name': collection, 'experiment_name': experiment, 'channel_name': channel, 'key': key}\n req = BossRequest(request, request_args)\n lookup_...
<|body_start_0|> try: if 'key' in request.query_params: key = request.query_params['key'] else: key = None request_args = {'service': 'meta', 'collection_name': collection, 'experiment_name': experiment, 'channel_name': channel, 'key': key} ...
View to handle read,write,update and delete metadata queries
BossMeta
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BossMeta: """View to handle read,write,update and delete metadata queries""" def get(self, request, collection, experiment=None, channel=None): """View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. defau...
stack_v2_sparse_classes_75kplus_train_074162
8,196
permissive
[ { "docstring": "View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. default = None channel: Channel name Returns:", "name": "get", "signature": "def get(self, request, collection, experiment=None, channel=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_052431
Implement the Python class `BossMeta` described below. Class description: View to handle read,write,update and delete metadata queries Method signatures and docstrings: - def get(self, request, collection, experiment=None, channel=None): View to handle GET requests for metadata Args: request: DRF Request object colle...
Implement the Python class `BossMeta` described below. Class description: View to handle read,write,update and delete metadata queries Method signatures and docstrings: - def get(self, request, collection, experiment=None, channel=None): View to handle GET requests for metadata Args: request: DRF Request object colle...
c2e26d272bd7b8d54abdc2948193163537e31291
<|skeleton|> class BossMeta: """View to handle read,write,update and delete metadata queries""" def get(self, request, collection, experiment=None, channel=None): """View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. defau...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BossMeta: """View to handle read,write,update and delete metadata queries""" def get(self, request, collection, experiment=None, channel=None): """View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. default = None cha...
the_stack_v2_python_sparse
django/bossmeta/views.py
jhuapl-boss/boss
train
20
8df21068e48347e5373c8d650c2848aaad322ac7
[ "super().__init__()\nself.qv_linear = nn.Linear(d_model, d_model * 2, bias=False)\nself.n_head = n_head\nself.head_dim = d_model // n_head\nself.dropout_layer = nn.Dropout(dropout)\nself.pos_embed = RelativeSinusoidalPositionalEmbedding(d_model // n_head, 0, 1200)\nif scale:\n self.scale = math.sqrt(d_model // n...
<|body_start_0|> super().__init__() self.qv_linear = nn.Linear(d_model, d_model * 2, bias=False) self.n_head = n_head self.head_dim = d_model // n_head self.dropout_layer = nn.Dropout(dropout) self.pos_embed = RelativeSinusoidalPositionalEmbedding(d_model // n_head, 0, 12...
RelativeMultiHeadAttn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativeMultiHeadAttn: def __init__(self, d_model, n_head, dropout, r_w_bias=None, r_r_bias=None, scale=False): """:param int d_model: :param int n_head: :param dropout: 对attention map的dropout :param r_w_bias: n_head x head_dim or None, 如果为dim :param r_r_bias: n_head x head_dim or None, ...
stack_v2_sparse_classes_75kplus_train_074163
14,372
no_license
[ { "docstring": ":param int d_model: :param int n_head: :param dropout: 对attention map的dropout :param r_w_bias: n_head x head_dim or None, 如果为dim :param r_r_bias: n_head x head_dim or None, :param scale: :param rel_pos_embed:", "name": "__init__", "signature": "def __init__(self, d_model, n_head, dropout...
3
stack_v2_sparse_classes_30k_val_002508
Implement the Python class `RelativeMultiHeadAttn` described below. Class description: Implement the RelativeMultiHeadAttn class. Method signatures and docstrings: - def __init__(self, d_model, n_head, dropout, r_w_bias=None, r_r_bias=None, scale=False): :param int d_model: :param int n_head: :param dropout: 对attenti...
Implement the Python class `RelativeMultiHeadAttn` described below. Class description: Implement the RelativeMultiHeadAttn class. Method signatures and docstrings: - def __init__(self, d_model, n_head, dropout, r_w_bias=None, r_r_bias=None, scale=False): :param int d_model: :param int n_head: :param dropout: 对attenti...
f1881ff24fbed1dc5fc5364832ef502d8d96cc54
<|skeleton|> class RelativeMultiHeadAttn: def __init__(self, d_model, n_head, dropout, r_w_bias=None, r_r_bias=None, scale=False): """:param int d_model: :param int n_head: :param dropout: 对attention map的dropout :param r_w_bias: n_head x head_dim or None, 如果为dim :param r_r_bias: n_head x head_dim or None, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RelativeMultiHeadAttn: def __init__(self, d_model, n_head, dropout, r_w_bias=None, r_r_bias=None, scale=False): """:param int d_model: :param int n_head: :param dropout: 对attention map的dropout :param r_w_bias: n_head x head_dim or None, 如果为dim :param r_r_bias: n_head x head_dim or None, :param scale: ...
the_stack_v2_python_sparse
MRC_Reading comprehension/down_layer/tener.py
aivolcano/BERT_MRC_CLS
train
11
72212a69d5e718f4513488f0b200d6f2b0eae302
[ "self.cpu = 0.0\nself._start = None\nself._depth = 0", "if self._depth == 0:\n assert self._start is None\n self._start = time.time()\nself._depth += 1", "if self._depth > 0:\n assert self._start is not None\n self._depth -= 1\nif self._depth == 0:\n self.cpu += time.time() - self._start\n sel...
<|body_start_0|> self.cpu = 0.0 self._start = None self._depth = 0 <|end_body_0|> <|body_start_1|> if self._depth == 0: assert self._start is None self._start = time.time() self._depth += 1 <|end_body_1|> <|body_start_2|> if self._depth > 0: ...
Keep track of CPU time of a part of the program. This is the bare-bones timer. It does not make any distinction between time spent in its own code or code of other functions it calls (if they are also timed).
Timer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timer: """Keep track of CPU time of a part of the program. This is the bare-bones timer. It does not make any distinction between time spent in its own code or code of other functions it calls (if they are also timed).""" def __init__(self): """Initialize the Timer object.""" ...
stack_v2_sparse_classes_75kplus_train_074164
18,418
permissive
[ { "docstring": "Initialize the Timer object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Mark start of a function.", "name": "start", "signature": "def start(self)" }, { "docstring": "Mark end of a function.", "name": "stop", "signature": "d...
3
stack_v2_sparse_classes_30k_train_048237
Implement the Python class `Timer` described below. Class description: Keep track of CPU time of a part of the program. This is the bare-bones timer. It does not make any distinction between time spent in its own code or code of other functions it calls (if they are also timed). Method signatures and docstrings: - de...
Implement the Python class `Timer` described below. Class description: Keep track of CPU time of a part of the program. This is the bare-bones timer. It does not make any distinction between time spent in its own code or code of other functions it calls (if they are also timed). Method signatures and docstrings: - de...
dc6c21b016f7d55009832957f5654b7c3d464b8b
<|skeleton|> class Timer: """Keep track of CPU time of a part of the program. This is the bare-bones timer. It does not make any distinction between time spent in its own code or code of other functions it calls (if they are also timed).""" def __init__(self): """Initialize the Timer object.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Timer: """Keep track of CPU time of a part of the program. This is the bare-bones timer. It does not make any distinction between time spent in its own code or code of other functions it calls (if they are also timed).""" def __init__(self): """Initialize the Timer object.""" self.cpu = 0...
the_stack_v2_python_sparse
moha/io/log.py
ZhaoYilin/moha
train
16
fd2597244b7307e26fcd7331a1f99d68e8e32fc9
[ "self.group = com_pk.group\nself.order = self.group.order()\norder_bits = self.order.num_bits()\nmodulo_bits = modulo.num_bits()\nself.upper_bound_calculations = Bn.from_num(2) ** upper_bound_moduli\nself.lower_bound_calculations = -Bn.from_num(2) ** upper_bound_moduli\nself.time_range_proofs = time()\nself.range_a...
<|body_start_0|> self.group = com_pk.group self.order = self.group.order() order_bits = self.order.num_bits() modulo_bits = modulo.num_bits() self.upper_bound_calculations = Bn.from_num(2) ** upper_bound_moduli self.lower_bound_calculations = -Bn.from_num(2) ** upper_boun...
ModularAdditionZKP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModularAdditionZKP: def __init__(self, com_pk, added_value_1, added_value_2, result, modulo, commitment_added_1, commitment_added_2, commitment_result, commitment_modulo, random_comm_value1, random_comm_value2, random_comm_result, random_comm_modulo, upper_bound_moduli=2050): """Prove th...
stack_v2_sparse_classes_75kplus_train_074165
8,093
no_license
[ { "docstring": "Prove that added_value_1 + added_value_2 = result mod modulo in zero knowledge. :param security_parameter: We should prepare it in such a way that we do not use the hardcoded values. For the moment we stick to that for evaluation", "name": "__init__", "signature": "def __init__(self, com...
2
stack_v2_sparse_classes_30k_train_016315
Implement the Python class `ModularAdditionZKP` described below. Class description: Implement the ModularAdditionZKP class. Method signatures and docstrings: - def __init__(self, com_pk, added_value_1, added_value_2, result, modulo, commitment_added_1, commitment_added_2, commitment_result, commitment_modulo, random_...
Implement the Python class `ModularAdditionZKP` described below. Class description: Implement the ModularAdditionZKP class. Method signatures and docstrings: - def __init__(self, com_pk, added_value_1, added_value_2, result, modulo, commitment_added_1, commitment_added_2, commitment_result, commitment_modulo, random_...
bf6b2ba1dc7f3d6fc81a7d83b5fea122eecb8871
<|skeleton|> class ModularAdditionZKP: def __init__(self, com_pk, added_value_1, added_value_2, result, modulo, commitment_added_1, commitment_added_2, commitment_result, commitment_modulo, random_comm_value1, random_comm_value2, random_comm_result, random_comm_modulo, upper_bound_moduli=2050): """Prove th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModularAdditionZKP: def __init__(self, com_pk, added_value_1, added_value_2, result, modulo, commitment_added_1, commitment_added_2, commitment_result, commitment_modulo, random_comm_value1, random_comm_value2, random_comm_result, random_comm_modulo, upper_bound_moduli=2050): """Prove that added_value...
the_stack_v2_python_sparse
zero_knowledge_proofs/ff_based/linear_algebra/modular_addition.py
iquerejeta/rsa_sign_ring
train
1
9b427360d67190f16d7c4d34fef9e8ec80624fb8
[ "self.active_user = User.objects.create_user(username='active_user', email='activeuser@gmail.com', password='p@55words')\nself.inactive_user = User.objects.create_user(username='inactive_user', email='inactiveuser@gmail.com', password='p@55words')\nself.inactive_user.is_active = False\nself.inactive_user.save()\nse...
<|body_start_0|> self.active_user = User.objects.create_user(username='active_user', email='activeuser@gmail.com', password='p@55words') self.inactive_user = User.objects.create_user(username='inactive_user', email='inactiveuser@gmail.com', password='p@55words') self.inactive_user.is_active = Fa...
A class containing generic tests that are utilised throughout the different view tests.
ViewsTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewsTestCase: """A class containing generic tests that are utilised throughout the different view tests.""" def setUp(self): """Set up users to be used throughout testing.""" <|body_0|> def only_active_user_access_test(self, view_url, template_name): """Tests th...
stack_v2_sparse_classes_75kplus_train_074166
2,779
permissive
[ { "docstring": "Set up users to be used throughout testing.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests that only active users have access to this view. :param view_url: The url of the view being tested. :param template_name: The name of the template for the view b...
3
stack_v2_sparse_classes_30k_train_035811
Implement the Python class `ViewsTestCase` described below. Class description: A class containing generic tests that are utilised throughout the different view tests. Method signatures and docstrings: - def setUp(self): Set up users to be used throughout testing. - def only_active_user_access_test(self, view_url, tem...
Implement the Python class `ViewsTestCase` described below. Class description: A class containing generic tests that are utilised throughout the different view tests. Method signatures and docstrings: - def setUp(self): Set up users to be used throughout testing. - def only_active_user_access_test(self, view_url, tem...
85b450d7f6d0313c5e5ef53a262a850b7e93c3d6
<|skeleton|> class ViewsTestCase: """A class containing generic tests that are utilised throughout the different view tests.""" def setUp(self): """Set up users to be used throughout testing.""" <|body_0|> def only_active_user_access_test(self, view_url, template_name): """Tests th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ViewsTestCase: """A class containing generic tests that are utilised throughout the different view tests.""" def setUp(self): """Set up users to be used throughout testing.""" self.active_user = User.objects.create_user(username='active_user', email='activeuser@gmail.com', password='p@55w...
the_stack_v2_python_sparse
communique/utils/utils_tests.py
michael-xander/communique-webapp
train
0
28a6665f30445d832a4187f201d23bfb8dae55f3
[ "super(AverageMetric, self).__init__(result_folder, output_folder)\nself.node = node\nif result_file_name is None:\n self._result_file_name = self.DEFAULT_RESULTS_FILE\nelse:\n self._result_file_name = result_file_name\nif metric_file_name is None:\n self._metric_file_name = self.DEFAULT_OUTPUT_FILE\nelse:...
<|body_start_0|> super(AverageMetric, self).__init__(result_folder, output_folder) self.node = node if result_file_name is None: self._result_file_name = self.DEFAULT_RESULTS_FILE else: self._result_file_name = result_file_name if metric_file_name is None:...
The AverageMetric class represents the computation of the average of a metric. It reads a file providing float or integer value and computes a simple average on these values. It creates an output file containing the minimum, average, and maximum.
AverageMetric
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AverageMetric: """The AverageMetric class represents the computation of the average of a metric. It reads a file providing float or integer value and computes a simple average on these values. It creates an output file containing the minimum, average, and maximum.""" def __init__(self, node,...
stack_v2_sparse_classes_75kplus_train_074167
5,082
permissive
[ { "docstring": "Create a AverageMetric object. @param node: ROS2 node @type node: rclpy.node.Node @param result_folder: The path on filesystem for the data to be analyzed @type result_folder: str @param output_folder: The path on filesystem for the output files after the computation of the metric @type output_f...
3
stack_v2_sparse_classes_30k_train_043506
Implement the Python class `AverageMetric` described below. Class description: The AverageMetric class represents the computation of the average of a metric. It reads a file providing float or integer value and computes a simple average on these values. It creates an output file containing the minimum, average, and ma...
Implement the Python class `AverageMetric` described below. Class description: The AverageMetric class represents the computation of the average of a metric. It reads a file providing float or integer value and computes a simple average on these values. It creates an output file containing the minimum, average, and ma...
ff8950abbb72366ed3072de790c405de8875ecc3
<|skeleton|> class AverageMetric: """The AverageMetric class represents the computation of the average of a metric. It reads a file providing float or integer value and computes a simple average on these values. It creates an output file containing the minimum, average, and maximum.""" def __init__(self, node,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AverageMetric: """The AverageMetric class represents the computation of the average of a metric. It reads a file providing float or integer value and computes a simple average on these values. It creates an output file containing the minimum, average, and maximum.""" def __init__(self, node, result_folde...
the_stack_v2_python_sparse
src/tools/benchmark_tool/benchmark_tool/metric/average_metric.py
bytetok/vde
train
0
f16aafda82a1dceb9219445533ef5ed766304e59
[ "extractor = Extractor()\nextracted = extractor.extract(content)\nreturn Readable(url=self.url, title=extracted.title, content=content, summary=extracted.description, image=extracted.image)", "parent = self.parent.fetched_news if not self.is_root else None\nstored = self.backend.get_news_by(owner=self.owner, url=...
<|body_start_0|> extractor = Extractor() extracted = extractor.extract(content) return Readable(url=self.url, title=extracted.title, content=content, summary=extracted.description, image=extracted.image) <|end_body_0|> <|body_start_1|> parent = self.parent.fetched_news if not self.is_ro...
URL Reporter for fetching news from plain html web pages. :param meta: Reporter meta from which to populate the reporter. :type meta: :class:`~news.reporters.ReporterMeta` :param backend: Backend to report news. :type backend: :class:`~news.backends.abstract.AbstractBackend` implementation :param intel: Intels to use f...
URLReporter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URLReporter: """URL Reporter for fetching news from plain html web pages. :param meta: Reporter meta from which to populate the reporter. :type meta: :class:`~news.reporters.ReporterMeta` :param backend: Backend to report news. :type backend: :class:`~news.backends.abstract.AbstractBackend` imple...
stack_v2_sparse_classes_75kplus_train_074168
3,069
permissive
[ { "docstring": "Parses html content of http response body into a single :class:`~news.models.abstract.Readable`. Internally uses :class:`~extraction.Extractor` extractor to extract sementic tags from the plain html content. :param content: Http response body :type content: :class:`str` :returns: A parsed readab...
3
stack_v2_sparse_classes_30k_train_006265
Implement the Python class `URLReporter` described below. Class description: URL Reporter for fetching news from plain html web pages. :param meta: Reporter meta from which to populate the reporter. :type meta: :class:`~news.reporters.ReporterMeta` :param backend: Backend to report news. :type backend: :class:`~news.b...
Implement the Python class `URLReporter` described below. Class description: URL Reporter for fetching news from plain html web pages. :param meta: Reporter meta from which to populate the reporter. :type meta: :class:`~news.reporters.ReporterMeta` :param backend: Backend to report news. :type backend: :class:`~news.b...
215f87e6ce1a7fc99175596e6fd5b4b50a3179c6
<|skeleton|> class URLReporter: """URL Reporter for fetching news from plain html web pages. :param meta: Reporter meta from which to populate the reporter. :type meta: :class:`~news.reporters.ReporterMeta` :param backend: Backend to report news. :type backend: :class:`~news.backends.abstract.AbstractBackend` imple...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class URLReporter: """URL Reporter for fetching news from plain html web pages. :param meta: Reporter meta from which to populate the reporter. :type meta: :class:`~news.reporters.ReporterMeta` :param backend: Backend to report news. :type backend: :class:`~news.backends.abstract.AbstractBackend` implementation :pa...
the_stack_v2_python_sparse
news/reporters/url.py
kuc2477/news
train
2
19445d8c1c6defe77a7d69523a592a9457c22cea
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
JobServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobServiceServicer: """Missing associated documentation comment in .proto file.""" def ClaimStatus(self, request, context): """Claims status for the specified job.""" <|body_0|> def Get(self, request, context): """Returns the job for the specified agent.""" ...
stack_v2_sparse_classes_75kplus_train_074169
8,636
permissive
[ { "docstring": "Claims status for the specified job.", "name": "ClaimStatus", "signature": "def ClaimStatus(self, request, context)" }, { "docstring": "Returns the job for the specified agent.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Retu...
4
stack_v2_sparse_classes_30k_train_046789
Implement the Python class `JobServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def ClaimStatus(self, request, context): Claims status for the specified job. - def Get(self, request, context): Returns the job for the spec...
Implement the Python class `JobServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def ClaimStatus(self, request, context): Claims status for the specified job. - def Get(self, request, context): Returns the job for the spec...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class JobServiceServicer: """Missing associated documentation comment in .proto file.""" def ClaimStatus(self, request, context): """Claims status for the specified job.""" <|body_0|> def Get(self, request, context): """Returns the job for the specified agent.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JobServiceServicer: """Missing associated documentation comment in .proto file.""" def ClaimStatus(self, request, context): """Claims status for the specified job.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotIm...
the_stack_v2_python_sparse
yandex/cloud/loadtesting/agent/v1/job_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
06da311921d74f96c59bbad681a872b87a4bedd3
[ "kwargs1 = {'call_num': '100.200.300', 'title': 'Harry Potter 1', 'num_copies': 2}\nkwargs2 = {'call_num': '425.63.775', 'title': 'Toy Story', 'num_copies': 2}\nkwargs3 = {'call_num': '874.234.863', 'title': 'Science Journal', 'num_copies': 5}\nitem_list = [Book('J K Rowling', **kwargs1), Dvd('10-10-2004', 'NA', **...
<|body_start_0|> kwargs1 = {'call_num': '100.200.300', 'title': 'Harry Potter 1', 'num_copies': 2} kwargs2 = {'call_num': '425.63.775', 'title': 'Toy Story', 'num_copies': 2} kwargs3 = {'call_num': '874.234.863', 'title': 'Science Journal', 'num_copies': 5} item_list = [Book('J K Rowling...
LibraryItemGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LibraryItemGenerator: def generate_test_items(): """Return a list of items with dummy data. :return: a list""" <|body_0|> def create_item(self): """Gets user input to create item :return: item""" <|body_1|> <|end_skeleton|> <|body_start_0|> kwargs1 ...
stack_v2_sparse_classes_75kplus_train_074170
3,146
no_license
[ { "docstring": "Return a list of items with dummy data. :return: a list", "name": "generate_test_items", "signature": "def generate_test_items()" }, { "docstring": "Gets user input to create item :return: item", "name": "create_item", "signature": "def create_item(self)" } ]
2
stack_v2_sparse_classes_30k_train_037501
Implement the Python class `LibraryItemGenerator` described below. Class description: Implement the LibraryItemGenerator class. Method signatures and docstrings: - def generate_test_items(): Return a list of items with dummy data. :return: a list - def create_item(self): Gets user input to create item :return: item
Implement the Python class `LibraryItemGenerator` described below. Class description: Implement the LibraryItemGenerator class. Method signatures and docstrings: - def generate_test_items(): Return a list of items with dummy data. :return: a list - def create_item(self): Gets user input to create item :return: item ...
766c6d3ba46ef665fe10077f9cb6a5738af80169
<|skeleton|> class LibraryItemGenerator: def generate_test_items(): """Return a list of items with dummy data. :return: a list""" <|body_0|> def create_item(self): """Gets user input to create item :return: item""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LibraryItemGenerator: def generate_test_items(): """Return a list of items with dummy data. :return: a list""" kwargs1 = {'call_num': '100.200.300', 'title': 'Harry Potter 1', 'num_copies': 2} kwargs2 = {'call_num': '425.63.775', 'title': 'Toy Story', 'num_copies': 2} kwargs3 =...
the_stack_v2_python_sparse
Labs/Lab 8/library_item_generator.py
norman-c/3522_A00893016
train
0
e94c3dfcfd2ae6aff863318415fb3ee40e16c3c6
[ "wb = load_workbook(file_name)\nsheet = wb[sheet_name]\ntest_case = []\nfor i in range(2, sheet.max_row + 1):\n single_case = {}\n single_case[sheet.cell(1, 1).value] = sheet.cell(i, 1).value\n single_case[sheet.cell(1, 2).value] = sheet.cell(i, 2).value\n single_case[sheet.cell(1, 3).value] = sheet.cel...
<|body_start_0|> wb = load_workbook(file_name) sheet = wb[sheet_name] test_case = [] for i in range(2, sheet.max_row + 1): single_case = {} single_case[sheet.cell(1, 1).value] = sheet.cell(i, 1).value single_case[sheet.cell(1, 2).value] = sheet.cell(i,...
DoExcel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoExcel: def do_excel(file_name, sheet_name): """利用 openpyxl 进行读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据""" <|body_0|> def do_pandas(file_name, sheet_name): """利用pandas读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回lis...
stack_v2_sparse_classes_75kplus_train_074171
1,986
no_license
[ { "docstring": "利用 openpyxl 进行读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据", "name": "do_excel", "signature": "def do_excel(file_name, sheet_name)" }, { "docstring": "利用pandas读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据", "name": "d...
2
stack_v2_sparse_classes_30k_train_025048
Implement the Python class `DoExcel` described below. Class description: Implement the DoExcel class. Method signatures and docstrings: - def do_excel(file_name, sheet_name): 利用 openpyxl 进行读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据 - def do_pandas(file_name, sheet_name): 利用pandas读取数据 :...
Implement the Python class `DoExcel` described below. Class description: Implement the DoExcel class. Method signatures and docstrings: - def do_excel(file_name, sheet_name): 利用 openpyxl 进行读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据 - def do_pandas(file_name, sheet_name): 利用pandas读取数据 :...
2d648f7efcbad4d3c8049a5717b85fc9356482ee
<|skeleton|> class DoExcel: def do_excel(file_name, sheet_name): """利用 openpyxl 进行读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据""" <|body_0|> def do_pandas(file_name, sheet_name): """利用pandas读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DoExcel: def do_excel(file_name, sheet_name): """利用 openpyxl 进行读取数据 :param file_name: 工作薄地址 :param sheet_name: 表单名 :return: 返回list包裹的字典数据""" wb = load_workbook(file_name) sheet = wb[sheet_name] test_case = [] for i in range(2, sheet.max_row + 1): single_case...
the_stack_v2_python_sparse
python_api_test_first/do_excel.py
xibei5678/api_auto
train
0
954e8b7ff41fa7c808d82257b2e6abf7f9547abf
[ "super().__init__()\nimport sklearn\nimport sklearn.svm\nself.model = sklearn.svm.NuSVR", "specs = super(NuSVR, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{NuSVR} \\\\textit{Nu-Support Vector Regression} is an Nu-Support Vector Regressor.\\n It is very similar to ...
<|body_start_0|> super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.NuSVR <|end_body_0|> <|body_start_1|> specs = super(NuSVR, cls).getInputSpecification() specs.description = 'The \\xmlNode{NuSVR} \\textit{Nu-Support Vector Regression} is an N...
Nu Support Vector Classifier
NuSVR
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NuSVR: """Nu Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that specifie...
stack_v2_sparse_classes_75kplus_train_074172
6,326
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
stack_v2_sparse_classes_30k_train_004799
Implement the Python class `NuSVR` described below. Class description: Nu Support Vector Classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a reference to ...
Implement the Python class `NuSVR` described below. Class description: Nu Support Vector Classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a reference to ...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class NuSVR: """Nu Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that specifie...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NuSVR: """Nu Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.NuSVR def getIn...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/SVM/NuSVR.py
idaholab/raven
train
201
4c8d201d1380896dc7e8f29f62fbc4ba7402c5e6
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), username=username)\nuser.set_password(password)\nuser.is_active = False\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, username=username, password=password)\nus...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), username=username) user.set_password(password) user.is_active = False user.save(using=self._db) return user <|end_body_0|> ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, username, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, username, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_75kplus_train_074173
4,477
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, username, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name"...
2
stack_v2_sparse_classes_30k_train_033202
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, username, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, us...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, username, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, us...
ed12966cddea761d5d5828c1ace890b98229f1bd
<|skeleton|> class MyUserManager: def create_user(self, email, username, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, username, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyUserManager: def create_user(self, email, username, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), use...
the_stack_v2_python_sparse
webapp/models.py
OpsWorld/SimpletourDevops
train
7
8ae9a171797486d72554628078786015d170ed3a
[ "digit = 0\nfor d in range(1, 10):\n if d * 9 * 10 ** (d - 1) >= n:\n digit = d\n break\nnum = 0\nfor d in range(1, digit + 1):\n num += int(9 * (d - 1) * 10 ** (d - 2))\nret = (n - num - 1) / digit + 10 ** (digit - 1)\nreturn int(str(ret)[(n - num - 1) % digit])", "list_n = range(1, n + 1)\nt...
<|body_start_0|> digit = 0 for d in range(1, 10): if d * 9 * 10 ** (d - 1) >= n: digit = d break num = 0 for d in range(1, digit + 1): num += int(9 * (d - 1) * 10 ** (d - 2)) ret = (n - num - 1) / digit + 10 ** (digit - 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findNthDigit(self, n): """:type n: int :rtype: int""" <|body_0|> def findNthDigit2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> digit = 0 for d in range(1, 10): if d * 9 * 10...
stack_v2_sparse_classes_75kplus_train_074174
1,137
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "findNthDigit", "signature": "def findNthDigit(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "findNthDigit2", "signature": "def findNthDigit2(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findNthDigit(self, n): :type n: int :rtype: int - def findNthDigit2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findNthDigit(self, n): :type n: int :rtype: int - def findNthDigit2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def findNthDigit(self, n): "...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def findNthDigit(self, n): """:type n: int :rtype: int""" <|body_0|> def findNthDigit2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findNthDigit(self, n): """:type n: int :rtype: int""" digit = 0 for d in range(1, 10): if d * 9 * 10 ** (d - 1) >= n: digit = d break num = 0 for d in range(1, digit + 1): num += int(9 * (d - 1) * 10 ...
the_stack_v2_python_sparse
400_第N个数字.py
lovehhf/LeetCode
train
0
1549b0612745a794c50b3c8e4328234b305ec8f8
[ "context = super(DestinationListView, self).get_context_data(**kwargs)\ncontext['form'] = SearchTripsForm()\nreturn context", "form = SearchTripsForm(self.request.POST)\nif form.is_valid():\n date = form.cleaned_data['request_date']\n date = json.dumps(date, cls=DjangoJSONEncoder)\n self.request.session[...
<|body_start_0|> context = super(DestinationListView, self).get_context_data(**kwargs) context['form'] = SearchTripsForm() return context <|end_body_0|> <|body_start_1|> form = SearchTripsForm(self.request.POST) if form.is_valid(): date = form.cleaned_data['request_d...
A view to to showcase all types of trip available and handle the post request for the SearchTripsForm.
DestinationListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationListView: """A view to to showcase all types of trip available and handle the post request for the SearchTripsForm.""" def get_context_data(self, **kwargs): """Add SearchTripsForm to the context""" <|body_0|> def post(self, request): """Process the Sea...
stack_v2_sparse_classes_75kplus_train_074175
1,799
no_license
[ { "docstring": "Add SearchTripsForm to the context", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Process the SearchTripForm and saves input values to session", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `DestinationListView` described below. Class description: A view to to showcase all types of trip available and handle the post request for the SearchTripsForm. Method signatures and docstrings: - def get_context_data(self, **kwargs): Add SearchTripsForm to the context - def post(self, requ...
Implement the Python class `DestinationListView` described below. Class description: A view to to showcase all types of trip available and handle the post request for the SearchTripsForm. Method signatures and docstrings: - def get_context_data(self, **kwargs): Add SearchTripsForm to the context - def post(self, requ...
a266482b8ea8a1a12ec83d8c65b9c4505f581e7f
<|skeleton|> class DestinationListView: """A view to to showcase all types of trip available and handle the post request for the SearchTripsForm.""" def get_context_data(self, **kwargs): """Add SearchTripsForm to the context""" <|body_0|> def post(self, request): """Process the Sea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DestinationListView: """A view to to showcase all types of trip available and handle the post request for the SearchTripsForm.""" def get_context_data(self, **kwargs): """Add SearchTripsForm to the context""" context = super(DestinationListView, self).get_context_data(**kwargs) co...
the_stack_v2_python_sparse
products/views.py
zaheerkzz/to-infinity
train
0
150889e01da1f226bdc2e47e8d0f9ffe126531c4
[ "from danceschool.core.models import Customer\nfirst_name = first_name or invoice.firstName\nlast_name = last_name or invoice.lastName\nemail = email or invoice.email\ncustomer = Customer.objects.filter(first_name=first_name, last_name=last_name, email=email).first()\nvoucher_response = check_voucher.send(sender=Re...
<|body_start_0|> from danceschool.core.models import Customer first_name = first_name or invoice.firstName last_name = last_name or invoice.lastName email = email or invoice.email customer = Customer.objects.filter(first_name=first_name, last_name=last_name, email=email).first() ...
This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view itself.
RegistrationAdjustmentsMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationAdjustmentsMixin: """This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view its...
stack_v2_sparse_classes_75kplus_train_074176
30,664
permissive
[ { "docstring": "This method looks for a voucher with the associated voucher ID, it checks for eligibility, and it returns an updated dictionary", "name": "getVoucher", "signature": "def getVoucher(self, voucherId, invoice, prior_adjustment=0, first_name=None, last_name=None, email=None)" }, { "d...
3
stack_v2_sparse_classes_30k_train_052196
Implement the Python class `RegistrationAdjustmentsMixin` described below. Class description: This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify ...
Implement the Python class `RegistrationAdjustmentsMixin` described below. Class description: This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify ...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class RegistrationAdjustmentsMixin: """This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view its...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegistrationAdjustmentsMixin: """This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view itself.""" ...
the_stack_v2_python_sparse
danceschool/core/mixins.py
django-danceschool/django-danceschool
train
40
424aa5251aa62a85eb4ea77c40bbad520aea490d
[ "self.substitutions = []\nfor pattern, replacement in substitutions:\n if isinstance(pattern, six.string_types):\n pattern = re.compile(pattern, re.I | re.U)\n self.substitutions.append((pattern, replacement))", "for pattern, replacement in self.substitutions:\n t = pattern.sub(replacement, t)\nre...
<|body_start_0|> self.substitutions = [] for pattern, replacement in substitutions: if isinstance(pattern, six.string_types): pattern = re.compile(pattern, re.I | re.U) self.substitutions.append((pattern, replacement)) <|end_body_0|> <|body_start_1|> for ...
Perform a list of substitutions defined by regex on text. Useful to clean up text where placeholders are used in place of actual unicode characters.
Substitutor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Substitutor: """Perform a list of substitutions defined by regex on text. Useful to clean up text where placeholders are used in place of actual unicode characters.""" def __init__(self, substitutions): """:param substitutions: List of (regex, string) tuples that define the substitut...
stack_v2_sparse_classes_75kplus_train_074177
4,963
permissive
[ { "docstring": ":param substitutions: List of (regex, string) tuples that define the substitution.", "name": "__init__", "signature": "def __init__(self, substitutions)" }, { "docstring": "Run substitutions on given text and return it. :param string t: The text to run substitutions on.", "na...
2
null
Implement the Python class `Substitutor` described below. Class description: Perform a list of substitutions defined by regex on text. Useful to clean up text where placeholders are used in place of actual unicode characters. Method signatures and docstrings: - def __init__(self, substitutions): :param substitutions:...
Implement the Python class `Substitutor` described below. Class description: Perform a list of substitutions defined by regex on text. Useful to clean up text where placeholders are used in place of actual unicode characters. Method signatures and docstrings: - def __init__(self, substitutions): :param substitutions:...
a5750d5313a250468e29d244cd4aeafdfc3250da
<|skeleton|> class Substitutor: """Perform a list of substitutions defined by regex on text. Useful to clean up text where placeholders are used in place of actual unicode characters.""" def __init__(self, substitutions): """:param substitutions: List of (regex, string) tuples that define the substitut...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Substitutor: """Perform a list of substitutions defined by regex on text. Useful to clean up text where placeholders are used in place of actual unicode characters.""" def __init__(self, substitutions): """:param substitutions: List of (regex, string) tuples that define the substitution.""" ...
the_stack_v2_python_sparse
chemdataextractor/text/processors.py
edbeard/chemdataextractor-uvvis2018
train
7
29a204a74dcdd3cbcb42fb6096d4c2a3fbf54f9d
[ "page = CataloguePage(browser, LINK)\npage.open()\nproducts = page.load_products()\nproduct = random.choice(products)\nproduct_title = product.title\nproduct.add_to_basket()\nproduct_title = re.sub('\\\\.\\\\.\\\\.$', '', product_title).strip()\nassert page.is_text_present_at(BasePageLocators.SUCCESS_MESSAGE, Catal...
<|body_start_0|> page = CataloguePage(browser, LINK) page.open() products = page.load_products() product = random.choice(products) product_title = product.title product.add_to_basket() product_title = re.sub('\\.\\.\\.$', '', product_title).strip() assert ...
Тесты каталога
TestCataloguePage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCataloguePage: """Тесты каталога""" def test_add_to_basket_confirmed(self, browser): """Тест проверяет, что при добавлении пользователем товара в корзину будет отображено сообщение об успехе добавления""" <|body_0|> def test_add_to_basket_updated_price(self, browser)...
stack_v2_sparse_classes_75kplus_train_074178
2,582
no_license
[ { "docstring": "Тест проверяет, что при добавлении пользователем товара в корзину будет отображено сообщение об успехе добавления", "name": "test_add_to_basket_confirmed", "signature": "def test_add_to_basket_confirmed(self, browser)" }, { "docstring": "Тест проверяет, что при добавлении пользов...
2
stack_v2_sparse_classes_30k_train_040642
Implement the Python class `TestCataloguePage` described below. Class description: Тесты каталога Method signatures and docstrings: - def test_add_to_basket_confirmed(self, browser): Тест проверяет, что при добавлении пользователем товара в корзину будет отображено сообщение об успехе добавления - def test_add_to_bas...
Implement the Python class `TestCataloguePage` described below. Class description: Тесты каталога Method signatures and docstrings: - def test_add_to_basket_confirmed(self, browser): Тест проверяет, что при добавлении пользователем товара в корзину будет отображено сообщение об успехе добавления - def test_add_to_bas...
fb7ed1b83c37302b303cc829d6e5caa99aa43649
<|skeleton|> class TestCataloguePage: """Тесты каталога""" def test_add_to_basket_confirmed(self, browser): """Тест проверяет, что при добавлении пользователем товара в корзину будет отображено сообщение об успехе добавления""" <|body_0|> def test_add_to_basket_updated_price(self, browser)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCataloguePage: """Тесты каталога""" def test_add_to_basket_confirmed(self, browser): """Тест проверяет, что при добавлении пользователем товара в корзину будет отображено сообщение об успехе добавления""" page = CataloguePage(browser, LINK) page.open() products = page....
the_stack_v2_python_sparse
final/test_catalogue_page.py
qnikst/stepik_lessons
train
1
5622ee5bd3a50c072521453c8f8966ef5a5ce4d2
[ "total = 0\nmax_value = -float('inf')\nfor a in A:\n if total < 0:\n total = 0\n total += a\n max_value = max(max_value, total)\ntotal = 0\nmin_value = float('inf')\nfor a in A:\n if total > 0:\n total = 0\n total += a\n min_value = min(min_value, total)\ntemp = sum(A) - min_value\nr...
<|body_start_0|> total = 0 max_value = -float('inf') for a in A: if total < 0: total = 0 total += a max_value = max(max_value, total) total = 0 min_value = float('inf') for a in A: if total > 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubarraySumCircular(self, A): """:type A: List[int] :rtype: int 216 ms""" <|body_0|> def maxSubarraySumCircular_1(self, A): """:type A: List[int] :rtype: int 116ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> total = 0 ma...
stack_v2_sparse_classes_75kplus_train_074179
3,145
no_license
[ { "docstring": ":type A: List[int] :rtype: int 216 ms", "name": "maxSubarraySumCircular", "signature": "def maxSubarraySumCircular(self, A)" }, { "docstring": ":type A: List[int] :rtype: int 116ms", "name": "maxSubarraySumCircular_1", "signature": "def maxSubarraySumCircular_1(self, A)" ...
2
stack_v2_sparse_classes_30k_train_041365
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubarraySumCircular(self, A): :type A: List[int] :rtype: int 216 ms - def maxSubarraySumCircular_1(self, A): :type A: List[int] :rtype: int 116ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubarraySumCircular(self, A): :type A: List[int] :rtype: int 216 ms - def maxSubarraySumCircular_1(self, A): :type A: List[int] :rtype: int 116ms <|skeleton|> class Solut...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def maxSubarraySumCircular(self, A): """:type A: List[int] :rtype: int 216 ms""" <|body_0|> def maxSubarraySumCircular_1(self, A): """:type A: List[int] :rtype: int 116ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubarraySumCircular(self, A): """:type A: List[int] :rtype: int 216 ms""" total = 0 max_value = -float('inf') for a in A: if total < 0: total = 0 total += a max_value = max(max_value, total) total = 0 ...
the_stack_v2_python_sparse
MaximumSumCircularSubarray_MID_918.py
953250587/leetcode-python
train
2
2b67dd36d7dd1572f39286da85087c1741336de4
[ "players_sufficient = len(self.players) >= 2\nif not players_sufficient:\n return False\nplayers_ready = all((p.ready for p in self.players.values()))\nif not players_ready:\n return False\nmap_specified = self.map_template is not None\nif not map_specified:\n return False\nreturn True", "if player_oid i...
<|body_start_0|> players_sufficient = len(self.players) >= 2 if not players_sufficient: return False players_ready = all((p.ready for p in self.players.values())) if not players_ready: return False map_specified = self.map_template is not None if n...
Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.
PendingGame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PendingGame: """Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.""" def ready(self): """Check if the game is ready to be started. For the gam...
stack_v2_sparse_classes_75kplus_train_074180
3,604
permissive
[ { "docstring": "Check if the game is ready to be started. For the game to be ready to start, **ALL** of the following conditions must be fulfilled: - Player count >= 2 - All players are ready (``ready`` is set to ``True``) - Map to be used is specified :return: game is ready to be started or not", "name": "...
4
stack_v2_sparse_classes_30k_train_005492
Implement the Python class `PendingGame` described below. Class description: Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play. Method signatures and docstrings: - def ready(sel...
Implement the Python class `PendingGame` described below. Class description: Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play. Method signatures and docstrings: - def ready(sel...
c7da1e91783dce3a2b71b955b3a22b68db9056cf
<|skeleton|> class PendingGame: """Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.""" def ready(self): """Check if the game is ready to be started. For the gam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PendingGame: """Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.""" def ready(self): """Check if the game is ready to be started. For the game to be ready...
the_stack_v2_python_sparse
game/pkchess/game/pending.py
RxJellyBot/Jelly-Bot
train
5
e666b13d2c3a98c9fb1b1989fa46a405628eae77
[ "super().__init__(interpolation=None)\nself.logger = logger\nself.path, content = self._find_ioc_file(parent_path, file_name)\nself.optionxform = lambda option: option\nself.read_string(f'[{IocConfig.fake_section_name}]\\n' + content)\nself.header = stm32pio.core.util.extract_header_comment(content, comment_symbol=...
<|body_start_0|> super().__init__(interpolation=None) self.logger = logger self.path, content = self._find_ioc_file(parent_path, file_name) self.optionxform = lambda option: option self.read_string(f'[{IocConfig.fake_section_name}]\n' + content) self.header = stm32pio.cor...
.ioc file structure is actually very similar to traditional INI-style configs and can be managed by the ``ConfigParser`` with small tweaks
IocConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IocConfig: """.ioc file structure is actually very similar to traditional INI-style configs and can be managed by the ``ConfigParser`` with small tweaks""" def __init__(self, parent_path: Path, file_name: str, logger: stm32pio.core.log.Logger): """Concentrate a CubeMX .ioc-file-relat...
stack_v2_sparse_classes_75kplus_train_074181
11,211
permissive
[ { "docstring": "Concentrate a CubeMX .ioc-file-related logic. As such file is a fundamental piece of every stm32pio project, this constructor throws in case of an absent or incorrect one. :param parent_path: project folder :param file_name: expected file name :param logger: logging.Logger-compatible object", ...
4
stack_v2_sparse_classes_30k_train_026144
Implement the Python class `IocConfig` described below. Class description: .ioc file structure is actually very similar to traditional INI-style configs and can be managed by the ``ConfigParser`` with small tweaks Method signatures and docstrings: - def __init__(self, parent_path: Path, file_name: str, logger: stm32p...
Implement the Python class `IocConfig` described below. Class description: .ioc file structure is actually very similar to traditional INI-style configs and can be managed by the ``ConfigParser`` with small tweaks Method signatures and docstrings: - def __init__(self, parent_path: Path, file_name: str, logger: stm32p...
c75194802a24347482d276066ea78aafd8b47973
<|skeleton|> class IocConfig: """.ioc file structure is actually very similar to traditional INI-style configs and can be managed by the ``ConfigParser`` with small tweaks""" def __init__(self, parent_path: Path, file_name: str, logger: stm32pio.core.log.Logger): """Concentrate a CubeMX .ioc-file-relat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IocConfig: """.ioc file structure is actually very similar to traditional INI-style configs and can be managed by the ``ConfigParser`` with small tweaks""" def __init__(self, parent_path: Path, file_name: str, logger: stm32pio.core.log.Logger): """Concentrate a CubeMX .ioc-file-related logic. As ...
the_stack_v2_python_sparse
stm32pio/core/cubemx.py
AndreTeixeira1998/stm32pio
train
0
cb635bd49c9326e1b529b47e939202a7ec668f66
[ "patches, maxRange = (0, 0)\nnums.append(n + 1)\nfor i in nums:\n num = min(i, n + 1)\n while maxRange + 1 < num:\n maxRange += maxRange + 1\n patches += 1\n maxRange += num\nreturn patches", "patches, maxRange = (0, 0)\nnums.append(n + 1)\nfor num in nums:\n num = min(num, n + 1)\n w...
<|body_start_0|> patches, maxRange = (0, 0) nums.append(n + 1) for i in nums: num = min(i, n + 1) while maxRange + 1 < num: maxRange += maxRange + 1 patches += 1 maxRange += num return patches <|end_body_0|> <|body_star...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPatches1(self, nums, n): """:type nums: List[int] :type n: int :rtype: int""" <|body_0|> def minPatches(self, nums, n): """:type nums: List[int] :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> patches, maxRa...
stack_v2_sparse_classes_75kplus_train_074182
2,801
no_license
[ { "docstring": ":type nums: List[int] :type n: int :rtype: int", "name": "minPatches1", "signature": "def minPatches1(self, nums, n)" }, { "docstring": ":type nums: List[int] :type n: int :rtype: int", "name": "minPatches", "signature": "def minPatches(self, nums, n)" } ]
2
stack_v2_sparse_classes_30k_train_005741
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPatches1(self, nums, n): :type nums: List[int] :type n: int :rtype: int - def minPatches(self, nums, n): :type nums: List[int] :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPatches1(self, nums, n): :type nums: List[int] :type n: int :rtype: int - def minPatches(self, nums, n): :type nums: List[int] :type n: int :rtype: int <|skeleton|> class...
e07b85a4121f2665393f1176befbdbe06f1e1ad0
<|skeleton|> class Solution: def minPatches1(self, nums, n): """:type nums: List[int] :type n: int :rtype: int""" <|body_0|> def minPatches(self, nums, n): """:type nums: List[int] :type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minPatches1(self, nums, n): """:type nums: List[int] :type n: int :rtype: int""" patches, maxRange = (0, 0) nums.append(n + 1) for i in nums: num = min(i, n + 1) while maxRange + 1 < num: maxRange += maxRange + 1 ...
the_stack_v2_python_sparse
Algorithms/patching-array.py
feilniu/LeetCode
train
0
552a13a1ce1e7cd938b45c94e91ae7585f5443eb
[ "if name and (not namespace) and (not identifier):\n x = gmod_mappings[name]['xrefs'][0]\n namespace, identifier, name = (x.namespace, x.identifier, x.name)\nsuper().__init__(name=name, namespace=namespace, identifier=identifier, xrefs=xrefs)", "if use_identifiers and self.entity.identifier and self.entity....
<|body_start_0|> if name and (not namespace) and (not identifier): x = gmod_mappings[name]['xrefs'][0] namespace, identifier, name = (x.namespace, x.identifier, x.name) super().__init__(name=name, namespace=namespace, identifier=identifier, xrefs=xrefs) <|end_body_0|> <|body_sta...
Build a gene modification variant dictionary.
GeneModification
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneModification: """Build a gene modification variant dictionary.""" def __init__(self, name: str, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: """Build a protein modification variant data dictionary. :param name: The na...
stack_v2_sparse_classes_75kplus_train_074183
34,684
permissive
[ { "docstring": "Build a protein modification variant data dictionary. :param name: The name of the modification :param namespace: The namespace to which the name of this modification belongs :param identifier: The identifier of the name of the modification :param xrefs: Alternative database xrefs Either the nam...
2
stack_v2_sparse_classes_30k_train_026422
Implement the Python class `GeneModification` described below. Class description: Build a gene modification variant dictionary. Method signatures and docstrings: - def __init__(self, name: str, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: Build a protein ...
Implement the Python class `GeneModification` described below. Class description: Build a gene modification variant dictionary. Method signatures and docstrings: - def __init__(self, name: str, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: Build a protein ...
ed66f013a77f9cbc513892b0dad1025b8f68bb46
<|skeleton|> class GeneModification: """Build a gene modification variant dictionary.""" def __init__(self, name: str, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: """Build a protein modification variant data dictionary. :param name: The na...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeneModification: """Build a gene modification variant dictionary.""" def __init__(self, name: str, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: """Build a protein modification variant data dictionary. :param name: The name of the mod...
the_stack_v2_python_sparse
src/pybel/dsl/node_classes.py
pybel/pybel
train
133
d886d356ffd07a6d4f05cb04d2902311de428754
[ "super().__init__(in_rank=len(in_size), out_size=out_size, bias_type=Bias.DENSE if has_bias else Bias.NONE, gadditional=gadditional, radditional=radditional, region=region, temp_indices=template, learn_cols=learn_cols, chunk_size=chunk_size)\nself.k = k\nself.in_size = in_size\nself.out_size = out_size\nself.sigma_...
<|body_start_0|> super().__init__(in_rank=len(in_size), out_size=out_size, bias_type=Bias.DENSE if has_bias else Bias.NONE, gadditional=gadditional, radditional=radditional, region=region, temp_indices=template, learn_cols=learn_cols, chunk_size=chunk_size) self.k = k self.in_size = in_size ...
Sparse layer with free sparse parameters, no hypernetwork, no template.
NASLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NASLayer: """Sparse layer with free sparse parameters, no hypernetwork, no template.""" def __init__(self, in_size, out_size, k, sigma_scale=0.2, fix_values=False, has_bias=False, min_sigma=0.0, gadditional=0, region=None, radditional=None, template=None, learn_cols=None, chunk_size=None): ...
stack_v2_sparse_classes_75kplus_train_074184
30,012
permissive
[ { "docstring": ":param in_size: :param out_size: :param k: :param sigma_scale: :param fix_values: :param has_bias: :param min_sigma: :param gadditional: :param region: :param radditional: :param clamp: :param template: LongTensor Template for the matrix of index tuples. Learnable columns are updated through bac...
2
stack_v2_sparse_classes_30k_train_038462
Implement the Python class `NASLayer` described below. Class description: Sparse layer with free sparse parameters, no hypernetwork, no template. Method signatures and docstrings: - def __init__(self, in_size, out_size, k, sigma_scale=0.2, fix_values=False, has_bias=False, min_sigma=0.0, gadditional=0, region=None, r...
Implement the Python class `NASLayer` described below. Class description: Sparse layer with free sparse parameters, no hypernetwork, no template. Method signatures and docstrings: - def __init__(self, in_size, out_size, k, sigma_scale=0.2, fix_values=False, has_bias=False, min_sigma=0.0, gadditional=0, region=None, r...
a1b2186e2d0c9047085ef4273909d207facbeeb3
<|skeleton|> class NASLayer: """Sparse layer with free sparse parameters, no hypernetwork, no template.""" def __init__(self, in_size, out_size, k, sigma_scale=0.2, fix_values=False, has_bias=False, min_sigma=0.0, gadditional=0, region=None, radditional=None, template=None, learn_cols=None, chunk_size=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NASLayer: """Sparse layer with free sparse parameters, no hypernetwork, no template.""" def __init__(self, in_size, out_size, k, sigma_scale=0.2, fix_values=False, has_bias=False, min_sigma=0.0, gadditional=0, region=None, radditional=None, template=None, learn_cols=None, chunk_size=None): """:pa...
the_stack_v2_python_sparse
sparse/layers.py
MaestroGraph/sparse-hyper
train
47
12f6e29760ce34ffb34cd1c3b0145dab21358ca9
[ "min1 = min2 = 134217727\nfor n in nums:\n if n < min1:\n min1 = n\n elif min1 < n < min2:\n min2 = n\n elif n > min2:\n return True\nreturn False", "if not nums or len(nums) < 3:\n return False\nn = len(nums)\nforwards = [float('inf')] * n\nbackwards = [float('-inf')] * n\nfor i ...
<|body_start_0|> min1 = min2 = 134217727 for n in nums: if n < min1: min1 = n elif min1 < n < min2: min2 = n elif n > min2: return True return False <|end_body_0|> <|body_start_1|> if not nums or len(num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def increasingTriplet_range(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> min1 = min2 = 134217727 ...
stack_v2_sparse_classes_75kplus_train_074185
1,964
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "increasingTriplet", "signature": "def increasingTriplet(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "increasingTriplet_range", "signature": "def increasingTriplet_range(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_004847
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool - def increasingTriplet_range(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool - def increasingTriplet_range(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def increasingTriplet_range(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" min1 = min2 = 134217727 for n in nums: if n < min1: min1 = n elif min1 < n < min2: min2 = n elif n > min2: return Tr...
the_stack_v2_python_sparse
src/lt_334.py
oxhead/CodingYourWay
train
0
4f50a6e5591c36627d8fc55b865cfd1d62d6f1f9
[ "self._path = path\nself._parser = example_parser.ExampleParser(example_specs)\nself._file_format = file_format", "splits_dict = splits_lib.SplitDict(split_infos=split_infos)\n\ndef _read_instruction_to_ds(instruction):\n file_instructions = splits_dict[instruction].file_instructions\n return self.read_file...
<|body_start_0|> self._path = path self._parser = example_parser.ExampleParser(example_specs) self._file_format = file_format <|end_body_0|> <|body_start_1|> splits_dict = splits_lib.SplitDict(split_infos=split_infos) def _read_instruction_to_ds(instruction): file_i...
Build a tf.data.Dataset object out of Instruction instance(s). This class should not typically be exposed to the TFDS user.
Reader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Build a tf.data.Dataset object out of Instruction instance(s). This class should not typically be exposed to the TFDS user.""" def __init__(self, path, example_specs, file_format=file_adapters.DEFAULT_FILE_FORMAT): """Initializes Reader. Args: path (str): path where tfreco...
stack_v2_sparse_classes_75kplus_train_074186
16,929
permissive
[ { "docstring": "Initializes Reader. Args: path (str): path where tfrecords are stored. example_specs: spec to build ExampleParser. file_format: file_adapters.FileFormat, format of the record files in which the dataset will be read/written from.", "name": "__init__", "signature": "def __init__(self, path...
3
stack_v2_sparse_classes_30k_test_002182
Implement the Python class `Reader` described below. Class description: Build a tf.data.Dataset object out of Instruction instance(s). This class should not typically be exposed to the TFDS user. Method signatures and docstrings: - def __init__(self, path, example_specs, file_format=file_adapters.DEFAULT_FILE_FORMAT)...
Implement the Python class `Reader` described below. Class description: Build a tf.data.Dataset object out of Instruction instance(s). This class should not typically be exposed to the TFDS user. Method signatures and docstrings: - def __init__(self, path, example_specs, file_format=file_adapters.DEFAULT_FILE_FORMAT)...
41ae3cf1439711ed2f50f99caa0e6702082e6d37
<|skeleton|> class Reader: """Build a tf.data.Dataset object out of Instruction instance(s). This class should not typically be exposed to the TFDS user.""" def __init__(self, path, example_specs, file_format=file_adapters.DEFAULT_FILE_FORMAT): """Initializes Reader. Args: path (str): path where tfreco...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Reader: """Build a tf.data.Dataset object out of Instruction instance(s). This class should not typically be exposed to the TFDS user.""" def __init__(self, path, example_specs, file_format=file_adapters.DEFAULT_FILE_FORMAT): """Initializes Reader. Args: path (str): path where tfrecords are store...
the_stack_v2_python_sparse
tensorflow_datasets/core/reader.py
tensorflow/datasets
train
4,224
bcdbebfa4d8693a33adb23b2d37d47237b4ba330
[ "data = first_line(filename)\ndata = json.loads(data)\nreturn total_nums(data)", "data = first_line(filename)\ndata = json.loads(data)\nreturn total_nums_no_red(data)" ]
<|body_start_0|> data = first_line(filename) data = json.loads(data) return total_nums(data) <|end_body_0|> <|body_start_1|> data = first_line(filename) data = json.loads(data) return total_nums_no_red(data) <|end_body_1|>
AoC 2015 Day 12
Day12
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day12: """AoC 2015 Day 12""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 12 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2015 day 12 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_074187
1,440
no_license
[ { "docstring": "Given a filename, solve 2015 day 12 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2015 day 12 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_008270
Implement the Python class `Day12` described below. Class description: AoC 2015 Day 12 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2015 day 12 part 1 - def part2(filename: str) -> int: Given a filename, solve 2015 day 12 part 2
Implement the Python class `Day12` described below. Class description: AoC 2015 Day 12 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2015 day 12 part 1 - def part2(filename: str) -> int: Given a filename, solve 2015 day 12 part 2 <|skeleton|> class Day12: """AoC 201...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day12: """AoC 2015 Day 12""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 12 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2015 day 12 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Day12: """AoC 2015 Day 12""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 12 part 1""" data = first_line(filename) data = json.loads(data) return total_nums(data) def part2(filename: str) -> int: """Given a filename, solve 2015 day 12 p...
the_stack_v2_python_sparse
2015/python2015/aoc/day12.py
mreishus/aoc
train
16
9bd3d85d42cb30a880341c82a5882b0c0f162fd3
[ "user = User.objects.create(username='seller', user_type=USER_TYPE['seller'])\nuser.set_password('123')\nuser.save()\nseller = SellerInfo(seller=user, price=22, city='cq')\nseller.save()\nuser = User.objects.create(username='iseller', user_type=USER_TYPE['consultant'])\nuser.set_password('321')\nuser.save()", "cl...
<|body_start_0|> user = User.objects.create(username='seller', user_type=USER_TYPE['seller']) user.set_password('123') user.save() seller = SellerInfo(seller=user, price=22, city='cq') seller.save() user = User.objects.create(username='iseller', user_type=USER_TYPE['consu...
地推人员视图测试
SellerviewsTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SellerviewsTestCase: """地推人员视图测试""" def setUp(self): """初始化数据""" <|body_0|> def test_qrcode(self): """测试二维码生成和获得返回功能""" <|body_1|> def test_identity_error(self): """测试生成二维码时输入人员的身份不正确时返回Identity Error code""" <|body_2|> <|end_skeleto...
stack_v2_sparse_classes_75kplus_train_074188
6,381
no_license
[ { "docstring": "初始化数据", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "测试二维码生成和获得返回功能", "name": "test_qrcode", "signature": "def test_qrcode(self)" }, { "docstring": "测试生成二维码时输入人员的身份不正确时返回Identity Error code", "name": "test_identity_error", "signature"...
3
stack_v2_sparse_classes_30k_train_017675
Implement the Python class `SellerviewsTestCase` described below. Class description: 地推人员视图测试 Method signatures and docstrings: - def setUp(self): 初始化数据 - def test_qrcode(self): 测试二维码生成和获得返回功能 - def test_identity_error(self): 测试生成二维码时输入人员的身份不正确时返回Identity Error code
Implement the Python class `SellerviewsTestCase` described below. Class description: 地推人员视图测试 Method signatures and docstrings: - def setUp(self): 初始化数据 - def test_qrcode(self): 测试二维码生成和获得返回功能 - def test_identity_error(self): 测试生成二维码时输入人员的身份不正确时返回Identity Error code <|skeleton|> class SellerviewsTestCase: """地推人...
cbbb688f4156eb8679db70fbdf306416d72e2b14
<|skeleton|> class SellerviewsTestCase: """地推人员视图测试""" def setUp(self): """初始化数据""" <|body_0|> def test_qrcode(self): """测试二维码生成和获得返回功能""" <|body_1|> def test_identity_error(self): """测试生成二维码时输入人员的身份不正确时返回Identity Error code""" <|body_2|> <|end_skeleto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SellerviewsTestCase: """地推人员视图测试""" def setUp(self): """初始化数据""" user = User.objects.create(username='seller', user_type=USER_TYPE['seller']) user.set_password('123') user.save() seller = SellerInfo(seller=user, price=22, city='cq') seller.save() us...
the_stack_v2_python_sparse
server/users/tests.py
ASAKARUM/manage_system
train
0
aecd9ab2c2fdb5339a51cdda2264c774395821ff
[ "recentHistory = ticker.getHistoryWindow(20)\nif recentHistory != None:\n if self.isUpwardTrend(recentHistory):\n amount = self.portfolio.calculateStockAmountFromBalancePercentage(tick['close'], 10)\n initialValue = amount * tick['close']\n self.portfolio.buyLong(ticker.getSymbol(), amount, ...
<|body_start_0|> recentHistory = ticker.getHistoryWindow(20) if recentHistory != None: if self.isUpwardTrend(recentHistory): amount = self.portfolio.calculateStockAmountFromBalancePercentage(tick['close'], 10) initialValue = amount * tick['close'] ...
This class represents an investment strategy based on simple trend analysis.
SimpleTrendStrategy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleTrendStrategy: """This class represents an investment strategy based on simple trend analysis.""" def handleTick(self, ticker: StockTicker, tick: dict): """Handle a new stock market tick.""" <|body_0|> def isUpwardTrend(self, history: StockTicker): """Retur...
stack_v2_sparse_classes_75kplus_train_074189
1,296
no_license
[ { "docstring": "Handle a new stock market tick.", "name": "handleTick", "signature": "def handleTick(self, ticker: StockTicker, tick: dict)" }, { "docstring": "Return whether the given history shows an upward trend.", "name": "isUpwardTrend", "signature": "def isUpwardTrend(self, history...
2
stack_v2_sparse_classes_30k_train_023891
Implement the Python class `SimpleTrendStrategy` described below. Class description: This class represents an investment strategy based on simple trend analysis. Method signatures and docstrings: - def handleTick(self, ticker: StockTicker, tick: dict): Handle a new stock market tick. - def isUpwardTrend(self, history...
Implement the Python class `SimpleTrendStrategy` described below. Class description: This class represents an investment strategy based on simple trend analysis. Method signatures and docstrings: - def handleTick(self, ticker: StockTicker, tick: dict): Handle a new stock market tick. - def isUpwardTrend(self, history...
0b0908fdffaba0a58eb568081fa23d1071b1193e
<|skeleton|> class SimpleTrendStrategy: """This class represents an investment strategy based on simple trend analysis.""" def handleTick(self, ticker: StockTicker, tick: dict): """Handle a new stock market tick.""" <|body_0|> def isUpwardTrend(self, history: StockTicker): """Retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleTrendStrategy: """This class represents an investment strategy based on simple trend analysis.""" def handleTick(self, ticker: StockTicker, tick: dict): """Handle a new stock market tick.""" recentHistory = ticker.getHistoryWindow(20) if recentHistory != None: if...
the_stack_v2_python_sparse
modules/strategies/trends.py
HansSchouten/Stock-Farm
train
2
1f2c27db44ab8ec8039a39b360392ba658ba4304
[ "self._display = SevenSegment.SevenSegment(address=int(address, 0))\nself._display.begin()\nself._display.set_brightness(int(brightness))\nif self.parse_bool(invert):\n self._display.set_invert(True)\nself._decimal_digits = int(decimal_digits)\nself._justify_right = self.parse_bool(justify_right)\nself._display....
<|body_start_0|> self._display = SevenSegment.SevenSegment(address=int(address, 0)) self._display.begin() self._display.set_brightness(int(brightness)) if self.parse_bool(invert): self._display.set_invert(True) self._decimal_digits = int(decimal_digits) self._...
Seven segment LED backpack widget. Can display simple numeric values in the range of -999 to 9999.
SevenSegmentWidget
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SevenSegmentWidget: """Seven segment LED backpack widget. Can display simple numeric values in the range of -999 to 9999.""" def __init__(self, address='0x70', brightness='15', decimal_digits='0', justify_right='True', invert='False'): """Create an instance of the seven segment displ...
stack_v2_sparse_classes_75kplus_train_074190
8,866
permissive
[ { "docstring": "Create an instance of the seven segment display widget. Can pass in the following optional parameters to control the widget (note all parameters are strings as they are parsed from config files): - address: I2C address, default is 0x70 - brightness: Brightness of the display, can be a value from...
2
null
Implement the Python class `SevenSegmentWidget` described below. Class description: Seven segment LED backpack widget. Can display simple numeric values in the range of -999 to 9999. Method signatures and docstrings: - def __init__(self, address='0x70', brightness='15', decimal_digits='0', justify_right='True', inver...
Implement the Python class `SevenSegmentWidget` described below. Class description: Seven segment LED backpack widget. Can display simple numeric values in the range of -999 to 9999. Method signatures and docstrings: - def __init__(self, address='0x70', brightness='15', decimal_digits='0', justify_right='True', inver...
0c14c316898d4d06015912ac4a8cb7b71a3980c0
<|skeleton|> class SevenSegmentWidget: """Seven segment LED backpack widget. Can display simple numeric values in the range of -999 to 9999.""" def __init__(self, address='0x70', brightness='15', decimal_digits='0', justify_right='True', invert='False'): """Create an instance of the seven segment displ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SevenSegmentWidget: """Seven segment LED backpack widget. Can display simple numeric values in the range of -999 to 9999.""" def __init__(self, address='0x70', brightness='15', decimal_digits='0', justify_right='True', invert='False'): """Create an instance of the seven segment display widget. Ca...
the_stack_v2_python_sparse
Pi_Physical_Dashboard/led_backpacks.py
pranavlathigara/Raspberry-Pi-DIY-Projects
train
1
a9f35547fd929285bbc97074203e4ed8c7bb14b0
[ "super().__init__()\nself.self1 = EntityAwareSelfAttention(config)\nself.output = BertSelfOutput(config)\nself.cat1 = ops.Concat(1)\nself.cast = ops.Cast()", "word_self_output, entity_self_output = self.self1(word_hidden_states, entity_hidden_states, attention_mask)\nhidden_states = self.cat1([word_hidden_states,...
<|body_start_0|> super().__init__() self.self1 = EntityAwareSelfAttention(config) self.output = BertSelfOutput(config) self.cat1 = ops.Concat(1) self.cast = ops.Cast() <|end_body_0|> <|body_start_1|> word_self_output, entity_self_output = self.self1(word_hidden_states, e...
entity attention
EntityAwareAttention
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityAwareAttention: """entity attention""" def __init__(self, config): """init fun""" <|body_0|> def construct(self, word_hidden_states, entity_hidden_states, attention_mask): """construct fun""" <|body_1|> <|end_skeleton|> <|body_start_0|> su...
stack_v2_sparse_classes_75kplus_train_074191
14,686
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "construct fun", "name": "construct", "signature": "def construct(self, word_hidden_states, entity_hidden_states, attention_mask)" } ]
2
null
Implement the Python class `EntityAwareAttention` described below. Class description: entity attention Method signatures and docstrings: - def __init__(self, config): init fun - def construct(self, word_hidden_states, entity_hidden_states, attention_mask): construct fun
Implement the Python class `EntityAwareAttention` described below. Class description: entity attention Method signatures and docstrings: - def __init__(self, config): init fun - def construct(self, word_hidden_states, entity_hidden_states, attention_mask): construct fun <|skeleton|> class EntityAwareAttention: "...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class EntityAwareAttention: """entity attention""" def __init__(self, config): """init fun""" <|body_0|> def construct(self, word_hidden_states, entity_hidden_states, attention_mask): """construct fun""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntityAwareAttention: """entity attention""" def __init__(self, config): """init fun""" super().__init__() self.self1 = EntityAwareSelfAttention(config) self.output = BertSelfOutput(config) self.cat1 = ops.Concat(1) self.cast = ops.Cast() def construct...
the_stack_v2_python_sparse
research/nlp/luke/src/luke/tacred_model.py
mindspore-ai/models
train
301
8dd0e16dee75de4a3b1ad430d5debe7c279b6557
[ "super(GRUInitialState, self).__init__(**kwargs)\nself.attended_dim = attended_dim\nself.init_strategy = init_strategy\nif self.init_strategy != 'constant':\n self.initial_transformer = MLP(activations=[Tanh()], dims=[attended_dim, self.dim], name='state_initializer')\n self.children.append(self.initial_trans...
<|body_start_0|> super(GRUInitialState, self).__init__(**kwargs) self.attended_dim = attended_dim self.init_strategy = init_strategy if self.init_strategy != 'constant': self.initial_transformer = MLP(activations=[Tanh()], dims=[attended_dim, self.dim], name='state_initialize...
Gated Recurrent with special initial state.
GRUInitialState
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRUInitialState: """Gated Recurrent with special initial state.""" def __init__(self, attended_dim, init_strategy='last', **kwargs): """Creates a GRU cell with special custom initial state. Args: attended_dim (int): Dimension of the annotations init_strategy (string): This string def...
stack_v2_sparse_classes_75kplus_train_074192
25,118
permissive
[ { "docstring": "Creates a GRU cell with special custom initial state. Args: attended_dim (int): Dimension of the annotations init_strategy (string): This string defines how to set the initial hidden layer state. \"last\" uses an affine transform plus tanh conditioned on the last annotation. \"average\" is simil...
3
stack_v2_sparse_classes_30k_train_022949
Implement the Python class `GRUInitialState` described below. Class description: Gated Recurrent with special initial state. Method signatures and docstrings: - def __init__(self, attended_dim, init_strategy='last', **kwargs): Creates a GRU cell with special custom initial state. Args: attended_dim (int): Dimension o...
Implement the Python class `GRUInitialState` described below. Class description: Gated Recurrent with special initial state. Method signatures and docstrings: - def __init__(self, attended_dim, init_strategy='last', **kwargs): Creates a GRU cell with special custom initial state. Args: attended_dim (int): Dimension o...
533b0e5627d8dcef3adccf76e776d3dea5c24a3c
<|skeleton|> class GRUInitialState: """Gated Recurrent with special initial state.""" def __init__(self, attended_dim, init_strategy='last', **kwargs): """Creates a GRU cell with special custom initial state. Args: attended_dim (int): Dimension of the annotations init_strategy (string): This string def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GRUInitialState: """Gated Recurrent with special initial state.""" def __init__(self, attended_dim, init_strategy='last', **kwargs): """Creates a GRU cell with special custom initial state. Args: attended_dim (int): Dimension of the annotations init_strategy (string): This string defines how to s...
the_stack_v2_python_sparse
cam/sgnmt/blocks/decoder.py
srgangireddy/sgnmt
train
0
a6d583eee21b98557fc64d31c8400f44334e55ff
[ "student = StudentModel.objects(id=get_jwt_identity()).first()\nif not student:\n return Response('', 403)\nif not student.stay_apply:\n return Response('', 204)\nreturn ({'value': student.stay_apply.value}, 200)", "student = StudentModel.objects(id=get_jwt_identity()).first()\nif not student:\n return R...
<|body_start_0|> student = StudentModel.objects(id=get_jwt_identity()).first() if not student: return Response('', 403) if not student.stay_apply: return Response('', 204) return ({'value': student.stay_apply.value}, 200) <|end_body_0|> <|body_start_1|> s...
Stay
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stay: def get(self): """잔류신청 정보 조회""" <|body_0|> def post(self): """잔류신청""" <|body_1|> <|end_skeleton|> <|body_start_0|> student = StudentModel.objects(id=get_jwt_identity()).first() if not student: return Response('', 403) ...
stack_v2_sparse_classes_75kplus_train_074193
1,509
permissive
[ { "docstring": "잔류신청 정보 조회", "name": "get", "signature": "def get(self)" }, { "docstring": "잔류신청", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_044374
Implement the Python class `Stay` described below. Class description: Implement the Stay class. Method signatures and docstrings: - def get(self): 잔류신청 정보 조회 - def post(self): 잔류신청
Implement the Python class `Stay` described below. Class description: Implement the Stay class. Method signatures and docstrings: - def get(self): 잔류신청 정보 조회 - def post(self): 잔류신청 <|skeleton|> class Stay: def get(self): """잔류신청 정보 조회""" <|body_0|> def post(self): """잔류신청""" ...
73a5d8fc2310bca90169414abf50f541ca0724c7
<|skeleton|> class Stay: def get(self): """잔류신청 정보 조회""" <|body_0|> def post(self): """잔류신청""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Stay: def get(self): """잔류신청 정보 조회""" student = StudentModel.objects(id=get_jwt_identity()).first() if not student: return Response('', 403) if not student.stay_apply: return Response('', 204) return ({'value': student.stay_apply.value}, 200) ...
the_stack_v2_python_sparse
server/server-flask/app/views/student/apply/stay.py
DSM-DMS/DMS
train
6
e974ab31a54bb1bc41c1ff4071f2384bf233d618
[ "badges = cls._get(user_email=user_email, badge_id=badge_id, status=status, single_record=single_record)\nif single_record:\n if badges:\n return SentBadgeDTO(badges)\n else:\n return None\nelif badges:\n return [SentBadgeDTO(sent_badge) for sent_badge in badges]\nelse:\n return []", "qu...
<|body_start_0|> badges = cls._get(user_email=user_email, badge_id=badge_id, status=status, single_record=single_record) if single_record: if badges: return SentBadgeDTO(badges) else: return None elif badges: return [SentBadgeDT...
Generic DAO to filter usual fields for SentBadge
SentBadgeDAO
[ "CC-BY-2.5", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentBadgeDAO: """Generic DAO to filter usual fields for SentBadge""" def get(cls, user_email=None, badge_id=None, status=None, single_record=False): """Get filtered SEntBadges by any field Params: - user_email: String - badge_id: String - status: String (this must be ENDING, SENT, AL...
stack_v2_sparse_classes_75kplus_train_074194
4,837
permissive
[ { "docstring": "Get filtered SEntBadges by any field Params: - user_email: String - badge_id: String - status: String (this must be ENDING, SENT, ALREADY_SENT or ERROR) - single_record: Boolean if you want just one record Returns: - None or SentBadgeDTO | [] or [SentBadgeDTO,...]", "name": "get", "signa...
5
null
Implement the Python class `SentBadgeDAO` described below. Class description: Generic DAO to filter usual fields for SentBadge Method signatures and docstrings: - def get(cls, user_email=None, badge_id=None, status=None, single_record=False): Get filtered SEntBadges by any field Params: - user_email: String - badge_i...
Implement the Python class `SentBadgeDAO` described below. Class description: Generic DAO to filter usual fields for SentBadge Method signatures and docstrings: - def get(cls, user_email=None, badge_id=None, status=None, single_record=False): Get filtered SEntBadges by any field Params: - user_email: String - badge_i...
10156a362247adc3638b1f33eee420ec3a15d27f
<|skeleton|> class SentBadgeDAO: """Generic DAO to filter usual fields for SentBadge""" def get(cls, user_email=None, badge_id=None, status=None, single_record=False): """Get filtered SEntBadges by any field Params: - user_email: String - badge_id: String - status: String (this must be ENDING, SENT, AL...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentBadgeDAO: """Generic DAO to filter usual fields for SentBadge""" def get(cls, user_email=None, badge_id=None, status=None, single_record=False): """Get filtered SEntBadges by any field Params: - user_email: String - badge_id: String - status: String (this must be ENDING, SENT, ALREADY_SENT or...
the_stack_v2_python_sparse
modules/um_badges/model.py
UniMOOC/AAClassroom
train
0
7f0eaf95151b29bb8d78aaf9dcb3b6dd582c0a49
[ "form = CourseSettingsForm()\nfetchCourseSettings(courseID, form)\nreturn Response(form.toJSON())", "form = CourseSettingsForm(request.data)\nupdateCourseSettings(courseID, form)\nreturn Response(form.toJSON())" ]
<|body_start_0|> form = CourseSettingsForm() fetchCourseSettings(courseID, form) return Response(form.toJSON()) <|end_body_0|> <|body_start_1|> form = CourseSettingsForm(request.data) updateCourseSettings(courseID, form) return Response(form.toJSON()) <|end_body_1|>
View handling requests related to Mofa's course settings
CourseSettings
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseSettings: """View handling requests related to Mofa's course settings""" def get(self, request, courseID): """Fetches current course settings""" <|body_0|> def post(self, request, courseID): """Updates current course settings to the recieved settings""" ...
stack_v2_sparse_classes_75kplus_train_074195
2,138
permissive
[ { "docstring": "Fetches current course settings", "name": "get", "signature": "def get(self, request, courseID)" }, { "docstring": "Updates current course settings to the recieved settings", "name": "post", "signature": "def post(self, request, courseID)" } ]
2
stack_v2_sparse_classes_30k_train_046176
Implement the Python class `CourseSettings` described below. Class description: View handling requests related to Mofa's course settings Method signatures and docstrings: - def get(self, request, courseID): Fetches current course settings - def post(self, request, courseID): Updates current course settings to the rec...
Implement the Python class `CourseSettings` described below. Class description: View handling requests related to Mofa's course settings Method signatures and docstrings: - def get(self, request, courseID): Fetches current course settings - def post(self, request, courseID): Updates current course settings to the rec...
ad351978faa37ab867a86d2f4023a2b3e5a2ce19
<|skeleton|> class CourseSettings: """View handling requests related to Mofa's course settings""" def get(self, request, courseID): """Fetches current course settings""" <|body_0|> def post(self, request, courseID): """Updates current course settings to the recieved settings""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CourseSettings: """View handling requests related to Mofa's course settings""" def get(self, request, courseID): """Fetches current course settings""" form = CourseSettingsForm() fetchCourseSettings(courseID, form) return Response(form.toJSON()) def post(self, request...
the_stack_v2_python_sparse
mofa/database_API/views.py
BoxInABoxICT/BoxPlugin
train
0
da1b082ea60ba91fd8143cb7914b313a29004fc9
[ "user_object = User.objects.get(pk=request.user.pk)\nprofile_data = {}\ntry:\n profile = UserProfile.objects.get(user_id=request.user.pk)\n profile_data = model_to_dict(profile, fields=['recording_time', 'parental_lock', 'package'])\nexcept ObjectDoesNotExist:\n pass\nuser_data = model_to_dict(user_object,...
<|body_start_0|> user_object = User.objects.get(pk=request.user.pk) profile_data = {} try: profile = UserProfile.objects.get(user_id=request.user.pk) profile_data = model_to_dict(profile, fields=['recording_time', 'parental_lock', 'package']) except ObjectDoesNotE...
This View handles retreiving and updating of users profile
ProfileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileView: """This View handles retreiving and updating of users profile""" def get(self, request): """Retreive a users profile without their security answer and question""" <|body_0|> def patch(self, request): """Update a users profile""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_074196
11,267
no_license
[ { "docstring": "Retreive a users profile without their security answer and question", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Update a users profile", "name": "patch", "signature": "def patch(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_005811
Implement the Python class `ProfileView` described below. Class description: This View handles retreiving and updating of users profile Method signatures and docstrings: - def get(self, request): Retreive a users profile without their security answer and question - def patch(self, request): Update a users profile
Implement the Python class `ProfileView` described below. Class description: This View handles retreiving and updating of users profile Method signatures and docstrings: - def get(self, request): Retreive a users profile without their security answer and question - def patch(self, request): Update a users profile <|...
5dcda7b791a8f0c71d2b176f0f27c4a9e85ccea0
<|skeleton|> class ProfileView: """This View handles retreiving and updating of users profile""" def get(self, request): """Retreive a users profile without their security answer and question""" <|body_0|> def patch(self, request): """Update a users profile""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProfileView: """This View handles retreiving and updating of users profile""" def get(self, request): """Retreive a users profile without their security answer and question""" user_object = User.objects.get(pk=request.user.pk) profile_data = {} try: profile = U...
the_stack_v2_python_sparse
authentication/v3views.py
rk110047/ipserver
train
0
3526a519f2d906d116fbecdd4930a0d76e93586f
[ "err = np.ones(k + 1)\ngroup_size = len(traindata) // 5\nfor j in range(1, k + 1):\n err_sum = 0.0\n classifier = KNeighborsClassifier(n_neighbors=j)\n for i in range(5):\n tdata = np.concatenate((traindata[:i * group_size, :], traindata[(i + 1) * group_size:, :]), axis=0)\n tlabels = np.appe...
<|body_start_0|> err = np.ones(k + 1) group_size = len(traindata) // 5 for j in range(1, k + 1): err_sum = 0.0 classifier = KNeighborsClassifier(n_neighbors=j) for i in range(5): tdata = np.concatenate((traindata[:i * group_size, :], traindata[...
Question2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Question2: def crossValidationkNN(self, traindata, trainlabels, k): """Write a function which implements 5-fold cross-validation to estimate the error of a classifier with cross-validation with the 0,1-loss for k-Nearest Neighbors (kNN). For this problem, take your folds to be 0:N/5, N/5...
stack_v2_sparse_classes_75kplus_train_074197
21,354
no_license
[ { "docstring": "Write a function which implements 5-fold cross-validation to estimate the error of a classifier with cross-validation with the 0,1-loss for k-Nearest Neighbors (kNN). For this problem, take your folds to be 0:N/5, N/5:2N/5, ..., 4N/5:N for cross-validation. Parameters: 1. traindata (Nt, d) numpy...
3
stack_v2_sparse_classes_30k_train_017486
Implement the Python class `Question2` described below. Class description: Implement the Question2 class. Method signatures and docstrings: - def crossValidationkNN(self, traindata, trainlabels, k): Write a function which implements 5-fold cross-validation to estimate the error of a classifier with cross-validation w...
Implement the Python class `Question2` described below. Class description: Implement the Question2 class. Method signatures and docstrings: - def crossValidationkNN(self, traindata, trainlabels, k): Write a function which implements 5-fold cross-validation to estimate the error of a classifier with cross-validation w...
adcb6b47164a909fe8b3cd3969c8bc3f3696893a
<|skeleton|> class Question2: def crossValidationkNN(self, traindata, trainlabels, k): """Write a function which implements 5-fold cross-validation to estimate the error of a classifier with cross-validation with the 0,1-loss for k-Nearest Neighbors (kNN). For this problem, take your folds to be 0:N/5, N/5...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Question2: def crossValidationkNN(self, traindata, trainlabels, k): """Write a function which implements 5-fold cross-validation to estimate the error of a classifier with cross-validation with the 0,1-loss for k-Nearest Neighbors (kNN). For this problem, take your folds to be 0:N/5, N/5:2N/5, ..., 4N...
the_stack_v2_python_sparse
ECE365/ML/lab3/main.py
RickyL-2000/ZJUI-lib
train
1
c7645ca2b6483552dc3395a2abfce2562cfeb6df
[ "caller = auth.get_current_identity()\nif not caller.is_user:\n self.abort_with_error(400, text='Caller must use email-based auth')\nreturn caller.name", "try:\n return self.send_response({'topic': pubsub.topic_name(), 'authorized': pubsub.is_authorized_subscriber(self.caller_email()), 'gs': {'auth_db_gs_pa...
<|body_start_0|> caller = auth.get_current_identity() if not caller.is_user: self.abort_with_error(400, text='Caller must use email-based auth') return caller.name <|end_body_0|> <|body_start_1|> try: return self.send_response({'topic': pubsub.topic_name(), 'auth...
Manages authorization to AuthDB PubSub topic and Google Storage object. Members of 'auth-trusted-services' group may use this endpoint to make sure they: 1. Can subscribe to AuthDB change notification PubSub topic. 2. Read Google Storage object that contains AuthDB dump.
AuthDBSubscriptionAuthHandler
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthDBSubscriptionAuthHandler: """Manages authorization to AuthDB PubSub topic and Google Storage object. Members of 'auth-trusted-services' group may use this endpoint to make sure they: 1. Can subscribe to AuthDB change notification PubSub topic. 2. Read Google Storage object that contains Auth...
stack_v2_sparse_classes_75kplus_train_074198
16,263
permissive
[ { "docstring": "Validates caller is using email for auth, returns it. Raises HTTP 400 if some other kind of authentication is used.", "name": "caller_email", "signature": "def caller_email(self)" }, { "docstring": "Queries whether the caller is authorized to access AuthDB already. Response body:...
4
stack_v2_sparse_classes_30k_train_043583
Implement the Python class `AuthDBSubscriptionAuthHandler` described below. Class description: Manages authorization to AuthDB PubSub topic and Google Storage object. Members of 'auth-trusted-services' group may use this endpoint to make sure they: 1. Can subscribe to AuthDB change notification PubSub topic. 2. Read G...
Implement the Python class `AuthDBSubscriptionAuthHandler` described below. Class description: Manages authorization to AuthDB PubSub topic and Google Storage object. Members of 'auth-trusted-services' group may use this endpoint to make sure they: 1. Can subscribe to AuthDB change notification PubSub topic. 2. Read G...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class AuthDBSubscriptionAuthHandler: """Manages authorization to AuthDB PubSub topic and Google Storage object. Members of 'auth-trusted-services' group may use this endpoint to make sure they: 1. Can subscribe to AuthDB change notification PubSub topic. 2. Read Google Storage object that contains Auth...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthDBSubscriptionAuthHandler: """Manages authorization to AuthDB PubSub topic and Google Storage object. Members of 'auth-trusted-services' group may use this endpoint to make sure they: 1. Can subscribe to AuthDB change notification PubSub topic. 2. Read Google Storage object that contains AuthDB dump.""" ...
the_stack_v2_python_sparse
appengine/auth_service/handlers_frontend.py
luci/luci-py
train
84
843a80c37dc2dbd3884aada3d734dc44195c82d9
[ "super(ForgetfulGrudger, self).__init__()\nself.history = []\nself.score = 0\nself.mem_length = 10\nself.grudged = False\nself.grudge_memory = 0", "if self.grudge_memory >= self.mem_length:\n self.grudge_memory = 0\n self.grudged = False\nif self.grudged:\n self.grudge_memory += 1\n return 'D'\nelif '...
<|body_start_0|> super(ForgetfulGrudger, self).__init__() self.history = [] self.score = 0 self.mem_length = 10 self.grudged = False self.grudge_memory = 0 <|end_body_0|> <|body_start_1|> if self.grudge_memory >= self.mem_length: self.grudge_memory = ...
A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches.
ForgetfulGrudger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForgetfulGrudger: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches.""" def __init__(self): """Initialised the player.""" <|body_0|> def strategy(self, opponent): """Begins by pl...
stack_v2_sparse_classes_75kplus_train_074199
1,841
permissive
[ { "docstring": "Initialised the player.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Begins by playing C, then plays D for mem_length rounds if the opponent ever plays D.", "name": "strategy", "signature": "def strategy(self, opponent)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_013587
Implement the Python class `ForgetfulGrudger` described below. Class description: A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches. Method signatures and docstrings: - def __init__(self): Initialised the player. - def strategy(self, op...
Implement the Python class `ForgetfulGrudger` described below. Class description: A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches. Method signatures and docstrings: - def __init__(self): Initialised the player. - def strategy(self, op...
e59fc40ebb705afe05cea6f30e282d1e9c621259
<|skeleton|> class ForgetfulGrudger: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches.""" def __init__(self): """Initialised the player.""" <|body_0|> def strategy(self, opponent): """Begins by pl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ForgetfulGrudger: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches.""" def __init__(self): """Initialised the player.""" super(ForgetfulGrudger, self).__init__() self.history = [] self.sc...
the_stack_v2_python_sparse
axelrod/strategies/grudger.py
DEFALT303/Axelrod
train
0