text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: mononobi/pyrin path: /src/pyrin/database/interface.py # -*- coding: utf-8 -*- """ database interface module. """ from abc import abstractmethod from threading import Lock from pyrin.core.structs import CoreObject, MultiSingletonMeta from pyrin.core.exceptions import CoreNotImplementedError cl...
code_fim
medium
{ "lang": "python", "repo": "mononobi/pyrin", "path": "/src/pyrin/database/interface.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # decrement in_degree of succs for succ in node.get_succs(): decrement_in_degree(succ) # if in_degree is zero, append to queue if get_in_degree(succ) == 0: queue.append(succ) return out<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "manasiumn37/public", "path": "/genesys/genesys/codelets/graph/bfs_topological_sorter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # if inside queue node = queue.pop(0) out.append(node) # decrement in_degree of succs for succ in node.get_succs(): decrement_in_degree(succ) # if in_degree is zero, append to queue if get_in_degr...
code_fim
hard
{ "lang": "python", "repo": "manasiumn37/public", "path": "/genesys/genesys/codelets/graph/bfs_topological_sorter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: manasiumn37/public path: /genesys/genesys/codelets/graph/bfs_topological_sorter.py import copy from .node import Node from .graph import Graph from .topological_sorter import TopologicalSorter def get_in_degree(node): return node.get_attr('__ts_in_degree') <|fim_suffix|> # if in...
code_fim
hard
{ "lang": "python", "repo": "manasiumn37/public", "path": "/genesys/genesys/codelets/graph/bfs_topological_sorter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: GafferHQ/gaffer path: /python/GafferSceneUITest/SetEditorTest.py ########################################################################## # # Copyright (c) 2023, Cinesite VFX Ltd. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are ...
code_fim
hard
{ "lang": "python", "repo": "GafferHQ/gaffer", "path": "/python/GafferSceneUITest/SetEditorTest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> plane = GafferScene.Plane() plane["sets"].setValue( "A A:B A:C D E:F:G" ) path = _GafferSceneUI._SetEditor.SetPath( plane["out"], Gaffer.Context(), "/" ) self.assertTrue( path.isValid() ) self.assertFalse( path.isLeaf() ) for parent, valid in [ ( "/", True ), ( "/A", True ), ( "/A/...
code_fim
hard
{ "lang": "python", "repo": "GafferHQ/gaffer", "path": "/python/GafferSceneUITest/SetEditorTest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # simple search space, represented by a dictionary graph = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B", "E"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"] } result = bfsShortestPath(graph, "G", "D") ...
code_fim
hard
{ "lang": "python", "repo": "melodrivemusic/CodeOfAI", "path": "/02 - BFS II/python/02_path_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: melodrivemusic/CodeOfAI path: /02 - BFS II/python/02_path_example.py def bfsShortestPath(graph, start, goal): """Finds shortest path between 2 nodes in a graph using BFS Args: graph (dict): Search space represented by a graph start (str): Starting state goal (str)...
code_fim
hard
{ "lang": "python", "repo": "melodrivemusic/CodeOfAI", "path": "/02 - BFS II/python/02_path_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # add node to list of checked nodes explored.append(node) # get neighbours if node is present, otherwise default to empty list neighbours = graph.get(node, []) # go through all neighbour nodes for neighbour in neighbours: ...
code_fim
hard
{ "lang": "python", "repo": "melodrivemusic/CodeOfAI", "path": "/02 - BFS II/python/02_path_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thunlp/OpenPrompt path: /tutorial/1.2_soft_verbalizers.py from openprompt.data_utils.text_classification_dataset import AgnewsProcessor dataset = {} dataset['train'] = AgnewsProcessor().get_train_examples("./datasets/TextClassification/agnews") # We sample a few examples to form the few-shot t...
code_fim
hard
{ "lang": "python", "repo": "thunlp/OpenPrompt", "path": "/tutorial/1.2_soft_verbalizers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>optimizer_grouped_parameters2 = [ {'params': prompt_model.verbalizer.group_parameters_1, "lr":3e-5}, {'params': prompt_model.verbalizer.group_parameters_2, "lr":3e-4}, ] optimizer1 = AdamW(optimizer_grouped_parameters1, lr=3e-5) optimizer2 = AdamW(optimizer_grouped_parameters2) for epoch in ra...
code_fim
hard
{ "lang": "python", "repo": "thunlp/OpenPrompt", "path": "/tutorial/1.2_soft_verbalizers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ykelle/spotipy-control path: /webserver.py import random import threading from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn from urllib.parse import urlparse, parse_qs import json from google.protobuf import text_format from blob import Blob import...
code_fim
hard
{ "lang": "python", "repo": "ykelle/spotipy-control", "path": "/webserver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.listener is not None: self.listener.new_blob_status(blob) def register_listener(self, listener): self.listener = listener class HTTPServerController: def __init__(self, port): self.port = port self.server_address = ('', port) self.htt...
code_fim
hard
{ "lang": "python", "repo": "ykelle/spotipy-control", "path": "/webserver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.port = port self.server_address = ('', port) self.httpServer = MyHttpServer(self.server_address, RequestHandler) self.register_listener = self.httpServer.register_listener def start_server_thread(self): thread = threading.Thread(target=self.httpServer.serv...
code_fim
hard
{ "lang": "python", "repo": "ykelle/spotipy-control", "path": "/webserver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: casework/CASE-Implementation-DC3DD path: /wrapper-prototype/proto/conv-and-trans/converter.py #NOTICE # © 2020 The MITRE Corporation #This software (or technical data) was produced for the U. S. Government under contract SB-1341-14-CQ-0010, and is subject to the Rights in Data-General Clause 52....
code_fim
medium
{ "lang": "python", "repo": "casework/CASE-Implementation-DC3DD", "path": "/wrapper-prototype/proto/conv-and-trans/converter.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if type_val == 'str': con_val = str(prop_val.strip('"')) elif type_val == 'bool': if prop_val == 'True' or prop_val == 'true': con_val = True elif prop_val == 'False' or prop_val == 'false': con_val = False else: print '~~~ Improp...
code_fim
hard
{ "lang": "python", "repo": "casework/CASE-Implementation-DC3DD", "path": "/wrapper-prototype/proto/conv-and-trans/converter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def run(): """Default Run Method""" return problem62(3, 5) if __name__ == '__main__': print("Result: ", run())<|fim_prefix|># repo: rado0x54/project-euler path: /python/problem0062.py #!/usr/bin/env python3 """Project Euler - Problem 62 Module""" def exponent_number_generator(exponent): ...
code_fim
hard
{ "lang": "python", "repo": "rado0x54/project-euler", "path": "/python/problem0062.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rado0x54/project-euler path: /python/problem0062.py #!/usr/bin/env python3 """Project Euler - Problem 62 Module""" def exponent_number_generator(exponent): "Generator for exponent numbers. Unlimited" i = 1 while True: yield i ** exponent i += 1 permutation_count_dic...
code_fim
medium
{ "lang": "python", "repo": "rado0x54/project-euler", "path": "/python/problem0062.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TomAugspurger/dolo path: /dolo/tests/test_division.py import unittest class DivisionTestCase(unittest.TestCase): def test_division(self): import yaml with open('examples/global_models/rbc.yaml') as f: txt = f.read() yaml_content = yaml.load(txt) ...
code_fim
medium
{ "lang": "python", "repo": "TomAugspurger/dolo", "path": "/dolo/tests/test_division.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> from dolo.misc.yamlfile import parse_yaml_text from dolo.symbolic.model import compute_residuals from dolo.symbolic.symbolic import Parameter model = parse_yaml_text(new_txt) [y,x,p] = model.read_calibration() i_alpha = model.parameters.index(Parameter('...
code_fim
hard
{ "lang": "python", "repo": "TomAugspurger/dolo", "path": "/dolo/tests/test_division.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Moms-Day/Moms-Day_Backend path: /Server/app/views/daughter/connect.py import re import uuid from flask import Blueprint, request, Response from flask_restful import Api from flasgger import swag_from from app.views import BaseResource, json_required, auth_required from app.models.facility impo...
code_fim
hard
{ "lang": "python", "repo": "Moms-Day/Moms-Day_Backend", "path": "/Server/app/views/daughter/connect.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '', 201 @api.resource('/plus2') class InsertDummyDataCare(BaseResource): def post(self): CareWorkerModel( id=request.json["id"], pw=request.json["pw"], phone_number=request.json['phoneNumber'], name=request.json["name"], ...
code_fim
hard
{ "lang": "python", "repo": "Moms-Day/Moms-Day_Backend", "path": "/Server/app/views/daughter/connect.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = request.args.get('facilityName') facs = FacilityModel.objects(name=re.compile(str('.*' + name + '.*'))) data = [{ 'facilityCode': fac.facility_code, 'name': fac.name, 'address': fac.address, 'careWorkers': [{ '...
code_fim
hard
{ "lang": "python", "repo": "Moms-Day/Moms-Day_Backend", "path": "/Server/app/views/daughter/connect.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rodekruis/shelter-database path: /migrations/versions/c5cf60c29302_add_new_section_table.py """add new section table Revision ID: c5cf60c29302 Revises: c6d598fbe4bb Create Date: 2016-06-21 13:26:54.041246 """ <|fim_suffix|> op.create_table('section', sa.Column('id', sa.INTEGER()...
code_fim
hard
{ "lang": "python", "repo": "rodekruis/shelter-database", "path": "/migrations/versions/c5cf60c29302_add_new_section_table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> op.create_table('section', sa.Column('id', sa.INTEGER()), sa.Column('name', sa.String(), default=''), sa.PrimaryKeyConstraint('id')) op.add_column('category', sa.Column('section_id', sa.INTEGER())) sa.ForeignKeyConstraint(['section_id'], ['section.id']) de...
code_fim
medium
{ "lang": "python", "repo": "rodekruis/shelter-database", "path": "/migrations/versions/c5cf60c29302_add_new_section_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuilhermeEsdras/Mamba-3 path: /Exercícios Resolvidos/URI Online Judge/Ex 1 - Salário com Bônus.py NOME_VENDEDOR = input() SALARIO_BASE = float(input()) VENDAS = float(input()) <|fim_suffix|>print("TOTAL = R$ {:.2f}".format(TOTAL))<|fim_middle|>TOTAL = SALARIO_BASE + (0.15 * VENDAS)
code_fim
easy
{ "lang": "python", "repo": "GuilhermeEsdras/Mamba-3", "path": "/Exercícios Resolvidos/URI Online Judge/Ex 1 - Salário com Bônus.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("TOTAL = R$ {:.2f}".format(TOTAL))<|fim_prefix|># repo: GuilhermeEsdras/Mamba-3 path: /Exercícios Resolvidos/URI Online Judge/Ex 1 - Salário com Bônus.py NOME_VENDEDOR = input() SALARIO_BASE = float(input()) VENDAS = float(input()) <|fim_middle|>TOTAL = SALARIO_BASE + (0.15 * VENDAS)
code_fim
easy
{ "lang": "python", "repo": "GuilhermeEsdras/Mamba-3", "path": "/Exercícios Resolvidos/URI Online Judge/Ex 1 - Salário com Bônus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def sum_list_mult(list_of_numbers, x): total = 0 for num in list_of_numbers: total = total+num return total*x if __name__ == "__main__": args = (3, 6) pw = lithops.ibm_cf_executor() pw.call_async(my_function, args) print(pw.get_result()) """ The parameters ca...
code_fim
medium
{ "lang": "python", "repo": "omerb01/pywren-ibm-cloud", "path": "/examples/multiple_args_call_async.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: omerb01/pywren-ibm-cloud path: /examples/multiple_args_call_async.py """ Simple Lithops examples using one single function invocation with multiple parameters. You can send multiple parameters to a single call function writing them into a list. The parameters will be mapped in the order you wrot...
code_fim
hard
{ "lang": "python", "repo": "omerb01/pywren-ibm-cloud", "path": "/examples/multiple_args_call_async.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xenotropic/python90minutes path: /example.py user_input = "" while ( user_input != "bananas" ): user_input = input ( "Say<|fim_suffix|>": print ("Hey, that's my name too!") else: print ("Oh hello, " + user_input)<|fim_middle|> bananas or I'll keep asking for bananas! ") print ( "Thanks, we're...
code_fim
medium
{ "lang": "python", "repo": "xenotropic/python90minutes", "path": "/example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>": print ("Hey, that's my name too!") else: print ("Oh hello, " + user_input)<|fim_prefix|># repo: xenotropic/python90minutes path: /example.py user_input = "" while ( user_input != "bananas" ): user_input = input ( "Say bananas or I'll keep asking for bananas! ") print ( "Thanks, we're done here. <|...
code_fim
medium
{ "lang": "python", "repo": "xenotropic/python90minutes", "path": "/example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #url = f"http://127.0.0.1:8000/{url}" url = f"https://ankileaderboard.pythonanywhere.com/{url}" try: if jsn: x = requests.post(url, data=data, timeout=30).json() else: x = requests.post(url, data=data, timeout=30) if response: if x.text == response: return x else: ...
code_fim
medium
{ "lang": "python", "repo": "dave-cao/Anki-Packages", "path": "/Anki Add-Ons/41708974/api_connect.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dave-cao/Anki-Packages path: /Anki Add-Ons/41708974/api_connect.py import json import requests from aqt.utils import showWarning <|fim_suffix|> #url = f"http://127.0.0.1:8000/{url}" url = f"https://ankileaderboard.pythonanywhere.com/{url}" try: if jsn: x = requests.post(url, data=...
code_fim
medium
{ "lang": "python", "repo": "dave-cao/Anki-Packages", "path": "/Anki Add-Ons/41708974/api_connect.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>async def async_unload_entry(opp: OpenPeerPower, entry: ConfigEntry) -> bool: """Unload Gogogate2 config entry.""" return await opp.config_entries.async_unload_platforms(entry, PLATFORMS)<|fim_prefix|># repo: OpenPeerPower/core path: /openpeerpower/components/gogogate2/__init__.py """The gogogate...
code_fim
medium
{ "lang": "python", "repo": "OpenPeerPower/core", "path": "/openpeerpower/components/gogogate2/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenPeerPower/core path: /openpeerpower/components/gogogate2/__init__.py """The gogogate2 component.""" from openpeerpower.components.cover import DOMAIN as COVER from openpeerpower.components.sensor import DOMAIN as SENSOR from openpeerpower.config_entries import ConfigEntry from openpeerpower....
code_fim
medium
{ "lang": "python", "repo": "OpenPeerPower/core", "path": "/openpeerpower/components/gogogate2/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def async_unload_entry(opp: OpenPeerPower, entry: ConfigEntry) -> bool: """Unload Gogogate2 config entry.""" return await opp.config_entries.async_unload_platforms(entry, PLATFORMS)<|fim_prefix|># repo: OpenPeerPower/core path: /openpeerpower/components/gogogate2/__init__.py """The gogogat...
code_fim
hard
{ "lang": "python", "repo": "OpenPeerPower/core", "path": "/openpeerpower/components/gogogate2/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: envoyproxy/envoy-perf path: /salvo/src/lib/docker_management/docker_image_builder.py """This module manages the steps needed to build missing docker images.""" import logging from src.lib import (source_tree, source_manager) from src.lib.docker_management import docker_image from src.lib.builder...
code_fim
hard
{ "lang": "python", "repo": "envoyproxy/envoy-perf", "path": "/salvo/src/lib/docker_management/docker_image_builder.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> If a tag is specified use the "envoyproxy/envoy" prefix. Otherwise assume that it is a development image and use "envoyproxy/envoy-dev" Args: image_tag: The tag for the Envoy docker image Returns: The prefix used to generate the full Envoy docker image name """ return "envoyproxy/en...
code_fim
hard
{ "lang": "python", "repo": "envoyproxy/envoy-perf", "path": "/salvo/src/lib/docker_management/docker_image_builder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def build_nighthawk_benchmark_image_from_source(manager: source_manager.SourceManager) -> None: """Build the nighthawk benchmark image from source. Args: manager: A SourceManager object that is a wrapper for git operations. The source manager can navigate the commit hashes or tags to determ...
code_fim
hard
{ "lang": "python", "repo": "envoyproxy/envoy-perf", "path": "/salvo/src/lib/docker_management/docker_image_builder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Set the sequence hit start coordinate (PRIVATE).""" self._hit_start = self._prep_coord(value, "hit_end", le) hit_start = property( fget=_hit_start_get, fset=_hit_start_set, doc="Hit sequence start coordinate, defaults to None.", ) def _query_start_g...
code_fim
hard
{ "lang": "python", "repo": "abner-lucas/tp-cruzi-db", "path": "/.venv/Lib/site-packages/Bio/SearchIO/_model/hsp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abner-lucas/tp-cruzi-db path: /.venv/Lib/site-packages/Bio/SearchIO/_model/hsp.py eitem( "query_strand", doc="Query strand orientation, first fragment." ) hit_frame = singleitem( "hit_frame", doc="Hit sequence reading frame, first fragment." ) query_frame = singl...
code_fim
hard
{ "lang": "python", "repo": "abner-lucas/tp-cruzi-db", "path": "/.venv/Lib/site-packages/Bio/SearchIO/_model/hsp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abner-lucas/tp-cruzi-db path: /.venv/Lib/site-packages/Bio/SearchIO/_model/hsp.py # evalue evalue = getattr_str(self, "evalue", fmt="%.2g") statline.append("evalue " + evalue) # bitscore bitscore = getattr_str(self, "bitscore", fmt="%.2f") statline.append("...
code_fim
hard
{ "lang": "python", "repo": "abner-lucas/tp-cruzi-db", "path": "/.venv/Lib/site-packages/Bio/SearchIO/_model/hsp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wan58169/deep-loglizer path: /data_preprocess/utils.py import random import json def decision(probability): return random.random() < probability <|fim_suffix|> with open(filename, "w") as fw: json.dump( obj, fw, sort_keys=True, in...
code_fim
easy
{ "lang": "python", "repo": "Wan58169/deep-loglizer", "path": "/data_preprocess/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with open(filename, "w") as fw: json.dump( obj, fw, sort_keys=True, indent=4, separators=(",", ": "), ensure_ascii=False, )<|fim_prefix|># repo: Wan58169/deep-loglizer path: /data_preprocess/utils.py import random...
code_fim
easy
{ "lang": "python", "repo": "Wan58169/deep-loglizer", "path": "/data_preprocess/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.points.add((y, x)) grid[y][x] = '*' for (my, mx) in [(-1, 0), (0, 1), (1, 0), (0, -1)]: ny = y + my nx = x + mx if 0 <= ny < self.n and 0 <= nx < self.m and grid[ny][nx] == color: self.dfs(grid,...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Leetcode/Algorithm/python/2000/01034-Coloring A Border.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /Leetcode/Algorithm/python/2000/01034-Coloring A Border.py class Solution(object): def colorBorder(self, grid, r0, c0, color): self.n = len(grid) self.m = len(grid[0]) self.points = set() origin = grid[r0][c0] se...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Leetcode/Algorithm/python/2000/01034-Coloring A Border.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> # match = 1 # mismatch = -1 # scoring = swalign.NucleotideScoringMatrix(match, mismatch) # test = list(tweet_entity)[:20] # sw = swalign.LocalAlignment(scoring) matches = entity_match(tweet_entity, news_entity) random_matches = entity_match(tweet_entity, rand_news_entity)...
code_fim
hard
{ "lang": "python", "repo": "dheeraj7596/HashNews", "path": "/retriever/modifiedBM25/getEntityMatch/entity_match.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # parser = argparse.ArgumentParser(description='pass day') # parser.add_argument('--day', '-d') # args = parser.parse_args() if __name__ == '__main__': # use this for first dataset # day = datetime(2018, 10, int(args.day)).date() # if (int(args.day) > 24): # day = datetime...
code_fim
hard
{ "lang": "python", "repo": "dheeraj7596/HashNews", "path": "/retriever/modifiedBM25/getEntityMatch/entity_match.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dheeraj7596/HashNews path: /retriever/modifiedBM25/getEntityMatch/entity_match.py # get entity_matches.json and entity_matches_random.json import pandas as pd from collections import defaultdict import json import argparse import time from datetime import datetime, timedelta # entity_pat...
code_fim
hard
{ "lang": "python", "repo": "dheeraj7596/HashNews", "path": "/retriever/modifiedBM25/getEntityMatch/entity_match.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hrabalm/ivis-arima path: /demo/data_uploader/data/ALO_process.py #!/usr/bin/env python3 import pandas # daily resampling ################## df = pandas.read_csv('ALO.csv', index_col='valid') df.index.rename('ts', inplace=True) # rename datetime field to 'ts' df.index = pandas.to_datetime(df.i...
code_fim
hard
{ "lang": "python", "repo": "hrabalm/ivis-arima", "path": "/demo/data_uploader/data/ALO_process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># filter missing values ####################### df = pandas.read_csv('ALO.csv', index_col='valid') df.index.rename('ts', inplace=True) # rename datetime field to 'ts' df.index = pandas.to_datetime(df.index) # convert it to datetime # drop missing values and the 'station' column df.dropna(inplace=True)...
code_fim
hard
{ "lang": "python", "repo": "hrabalm/ivis-arima", "path": "/demo/data_uploader/data/ALO_process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ENDPOINT_NOT_FOUND = { 'status': 'error', 'data': 'Endpoint not found', 'type': 'ENF' }<|fim_prefix|># repo: kradalby/sourceapi path: /errors.py MISSING_DATA = { 'status': 'error', 'data': 'Missing data field', 'type': 'MD' } <|fim_middle|>NO_RESPONSE = { 'status': 'error', ...
code_fim
hard
{ "lang": "python", "repo": "kradalby/sourceapi", "path": "/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kradalby/sourceapi path: /errors.py MISSING_DATA = { 'status': 'error', 'data': 'Missing data field', 'type': 'MD' } <|fim_suffix|>NOT_VALID_JSON = { 'status': 'error', 'data': 'The JSON is not valid', 'type': 'NVJ' } ENDPOINT_NOT_FOUND = { 'status': 'error', 'da...
code_fim
medium
{ "lang": "python", "repo": "kradalby/sourceapi", "path": "/errors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Qwaz/solved-hacking-problem path: /GoogleCTF/2021 Quals/tiramisu/crt.py import pwnlib import challenge_pb2 import struct from curve import Coord, EC from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.ha...
code_fim
hard
{ "lang": "python", "repo": "Qwaz/solved-hacking-problem", "path": "/GoogleCTF/2021 Quals/tiramisu/crt.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>def proto2key(key): assert isinstance(key, challenge_pb2.EcdhKey) assert key.curve == challenge_pb2.EcdhKey.CurveID.SECP224R1 x = int.from_bytes(key.public.x, "big") y = int.from_bytes(key.public.y, "big") return (x, y) con = pwnlib.tubes.remote.remote("tiramisu.2021.ctfcompetition.c...
code_fim
hard
{ "lang": "python", "repo": "Qwaz/solved-hacking-problem", "path": "/GoogleCTF/2021 Quals/tiramisu/crt.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> # compute output output = model(images) loss = criterion(output, target) # measure accuracy and record loss acc1, acc5 = accuracy(output, target, topk=(1, 5)) losses.update(loss.item(), images.size(0)) top1.update(acc1.i...
code_fim
hard
{ "lang": "python", "repo": "allenai/hidden-networks", "path": "/trainers/ss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def validate(val_loader, model, criterion, args, writer, epoch): batch_time = AverageMeter("Time", ":6.3f", write_val=False) losses = AverageMeter("Loss", ":.3f", write_val=False) top1 = AverageMeter("Acc@1", ":6.2f", write_val=False) top5 = AverageMeter("Acc@5", ":6.2f", write_val=False) ...
code_fim
hard
{ "lang": "python", "repo": "allenai/hidden-networks", "path": "/trainers/ss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: allenai/hidden-networks path: /trainers/ss.py import time import torch import tqdm from utils.eval_utils import accuracy from utils.logging import AverageMeter, ProgressMeter from utils.net_utils import SubnetL1RegLoss __all__ = ["train", "validate", "modifier"] def train(train_loader, model...
code_fim
hard
{ "lang": "python", "repo": "allenai/hidden-networks", "path": "/trainers/ss.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kumarasakti/lms path: /app/model/person.py class Person: def __init__(self, name, gender, age, person_id): <|fim_suffix|> return self.__person_id def setName(self, name): self.__name = name def setAge(self, age): self.__age = age def setGender...
code_fim
hard
{ "lang": "python", "repo": "kumarasakti/lms", "path": "/app/model/person.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setGender(self, gender): self.__gender = gender def setPersonId(self, person_id): self.__person_id = person_id<|fim_prefix|># repo: kumarasakti/lms path: /app/model/person.py class Person: def __init__(self, name, gender, age, person_id): self.__name = nam...
code_fim
hard
{ "lang": "python", "repo": "kumarasakti/lms", "path": "/app/model/person.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Runner-42/HomePortal path: /home_portal/kookboek/database.py '''Database Models for the Kookboek application''' from home_portal.extensions import db_kookboek as db class RecipesIngredients(db.Model): ''' The RecipiesIngredients class defines the attributes required to create a many...
code_fim
hard
{ "lang": "python", "repo": "Runner-42/HomePortal", "path": "/home_portal/kookboek/database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' The Ingredient class defines the attributes of the ingredient table. ''' __bind_key__ = 'kookboek_db' __tablename__ = 'Ingredients' id = db.Column( db.Integer, primary_key=True ) name = db.Column( db.String(64), unique=True, n...
code_fim
hard
{ "lang": "python", "repo": "Runner-42/HomePortal", "path": "/home_portal/kookboek/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Category(db.Model): ''' The Category class defines the attributes of the category table. ''' __bind_key__ = 'kookboek_db' __tablename__ = 'Categories' id = db.Column( db.Integer, primary_key=True ) name = db.Column( db.String(64), ...
code_fim
hard
{ "lang": "python", "repo": "Runner-42/HomePortal", "path": "/home_portal/kookboek/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Beirdo/HavokMud-redux path: /src/HavokMud/bank.py import logging import stackless import time from time import sleep from HavokMud.currency import Currency from HavokMud.database_object import DatabaseObject from HavokMud.eosio.action import EOSAction from HavokMud.eosio.permission import EOSPer...
code_fim
hard
{ "lang": "python", "repo": "Beirdo/HavokMud-redux", "path": "/src/HavokMud/bank.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_rate = int(new_rate * 100.0) self.interest_rate = new_rate self.save_to_db() wallet: Wallet = self.wallets.get(WalletType.Stored, None) with wallet.transaction() as transaction: auth = [EOSPermission(System.account_name, "active")] param...
code_fim
hard
{ "lang": "python", "repo": "Beirdo/HavokMud-redux", "path": "/src/HavokMud/bank.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> wallet: Wallet = self.wallets.get(WalletType.Stored, None) with wallet.transaction() as transaction: auth = [EOSPermission(System.account_name, "active")] params = { "rate": new_rate, } action = EOSAction("banker", "setinteres...
code_fim
hard
{ "lang": "python", "repo": "Beirdo/HavokMud-redux", "path": "/src/HavokMud/bank.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yayuchen/Disaster_pipeline_project path: /data/process_data.py import sys import pandas as pd import re import sqlite3 """ Using process_data.py script to automatically extract raw data, transforming categories data into new features dataframe, concatenating with message dataframe to form a new...
code_fim
hard
{ "lang": "python", "repo": "yayuchen/Disaster_pipeline_project", "path": "/data/process_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Cleaning data...') df = clean_data(df) print('Saving data...\n DATABASE: {}'.format(database_filepath)) save_data(df, database_filepath) print('Cleaned data saved to database!') else: print('Please provide the filepaths o...
code_fim
hard
{ "lang": "python", "repo": "yayuchen/Disaster_pipeline_project", "path": "/data/process_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sinsai/Sahana_eden path: /modules/s3/s3import.py # -*- coding: utf-8 -*- """ Resource Import Tools @see: U{B{I{S3XRC}} <http://eden.sahanafoundation.org/wiki/S3XRC>} @requires: U{B{I{gluon}} <http://web2py.com>} @requires: U{B{I{lxml}} <http://codespeak.net/lxml>} @author: Dom...
code_fim
hard
{ "lang": "python", "repo": "sinsai/Sahana_eden", "path": "/modules/s3/s3import.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check permission for the resource authorised = permit("create", resource.table) and \ permit("update", resource.table) if not authorised: raise IOError("Insufficient permissions") # Resource data prefix = resource.prefix n...
code_fim
hard
{ "lang": "python", "repo": "sinsai/Sahana_eden", "path": "/modules/s3/s3import.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ xml = self.manager.xml permit = self.manager.permit # Check permission for the resource authorised = permit("create", resource.table) and \ permit("update", resource.table) if not authorised: raise IOError("Insufficient...
code_fim
hard
{ "lang": "python", "repo": "sinsai/Sahana_eden", "path": "/modules/s3/s3import.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: natorsc/databases-with-python path: /src/sqlite3-sqlalchemy/models.py # -*- coding: utf-8 -*- """Exemplo de CRUD com Python, SQLAlchemy e SQLite3.""" from sqlalchemy import Column, Integer, String, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import s...
code_fim
hard
{ "lang": "python", "repo": "natorsc/databases-with-python", "path": "/src/sqlite3-sqlalchemy/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Classe representa uma tabela do banco.""" # ``__tablename__`` - Define o nome da tabela. # Se o nome da tabela não for definido é utilizado o nome da classe. __tablename__ = 'table_name' # Colunas da tabela. user_id = Column('user_id', Integer, primary_key=True) name = Colu...
code_fim
hard
{ "lang": "python", "repo": "natorsc/databases-with-python", "path": "/src/sqlite3-sqlalchemy/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": # Removendo todas as tabelas do banco. Base.metadata.drop_all(engine) # Criando todas as tabelas. Base.metadata.create_all(engine) # Criando uma sessão (add, commit, query, etc). session = Session() # Criando os dados que serão inseridos na tabela...
code_fim
hard
{ "lang": "python", "repo": "natorsc/databases-with-python", "path": "/src/sqlite3-sqlalchemy/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hoonkai/realtime_object_detection path: /rod/visualizer.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ @author: www.github.com/GustavZ """ import collections import numpy as np import cv2 import random from rod.config import Config class Visualizer(object): """ Visualizer Class t...
code_fim
hard
{ "lang": "python", "repo": "hoonkai/realtime_object_detection", "path": "/rod/visualizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _exit_visualization(self,millis=1): """ - sets exit variable on key 'q' - saves screenshot on key 's' """ k = cv2.waitKey(millis) & 0xFF if k == ord('q'): # wait for 'q' key to exit print("> User exit request") self.stopped =...
code_fim
hard
{ "lang": "python", "repo": "hoonkai/realtime_object_detection", "path": "/rod/visualizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _draw_single_box_on_image(self,box,label,id): """ draws single box and label on image """ p1 = (box[1], box[0]) p2 = (box[3], box[2]) if self.config.DISCO_MODE: color = random.choice(self.STANDARD_COLORS) else: color =...
code_fim
hard
{ "lang": "python", "repo": "hoonkai/realtime_object_detection", "path": "/rod/visualizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if verbose: print("Clock frequencies:", freqs.tolist()) print("Power consumption:", nvml_power.tolist()) ridge_frequency, fitted_params, scaling = fit_power_frequency_model(freqs, nvml_power) if verbose: print(f"Modelled most energy efficient frequency: {ridge_frequen...
code_fim
hard
{ "lang": "python", "repo": "KernelTuner/kernel_tuner", "path": "/kernel_tuner/energy/energy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KernelTuner/kernel_tuner path: /kernel_tuner/energy/energy.py """ This module contains a set of helper functions specifically for auto-tuning codes for energy efficiency. """ from collections import OrderedDict import numpy as np from kernel_tuner import tune_kernel, util from kernel_tuner.obser...
code_fim
hard
{ "lang": "python", "repo": "KernelTuner/kernel_tuner", "path": "/kernel_tuner/energy/energy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # fit the model p0 = (clock_threshold, voltage_scale, clock_scale, power_max) bounds = ([clock_min, 0, 0, 0.9*power_max], [clock_max, 1, 1, 1.1*power_max]) res = optimize.curve_fit(estimated_power, x, y, p0=p0, bounds=bounds) clock_threshold, voltage_scale, clock_scale, p...
code_fim
hard
{ "lang": "python", "repo": "KernelTuner/kernel_tuner", "path": "/kernel_tuner/energy/energy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DuTra01/aarin-pix-sdk path: /aarin/sdk.py from .config import RequestOptions from .http import HttpClient from .resources import Collection, BankAccount, DestinationAccount, Pix class SDK: def __init__(self, access_token, contaBancariaIdconta=None, http_client=None, request_options=None) -> ...
code_fim
medium
{ "lang": "python", "repo": "DuTra01/aarin-pix-sdk", "path": "/aarin/sdk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Collection(request_options is not None and request_options or self.request_options, self.http_client) def bank_account(self, request_options=None): return BankAccount(request_options is not None and request_options or self.request_options, self.http_client) ...
code_fim
medium
{ "lang": "python", "repo": "DuTra01/aarin-pix-sdk", "path": "/aarin/sdk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ericchen12377/BRDT-Python path: /brdt/Indicator.py import numpy as np class Indicator: def __init__(self, name): ''' Constructor for this class. ''' """ :type name: str :rtype: int """ self.name = name # assign the name of distribution d...
code_fim
hard
{ "lang": "python", "repo": "ericchen12377/BRDT-Python", "path": "/brdt/Indicator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': p = Indicator(name = 'Binomial') print(p.Binary_Indicator(prob = 0.1, R = 0.8))<|fim_prefix|># repo: ericchen12377/BRDT-Python path: /brdt/Indicator.py import numpy as np class Indicator: def __init__(self, name): ''' Constructor for this class. ''' ...
code_fim
hard
{ "lang": "python", "repo": "ericchen12377/BRDT-Python", "path": "/brdt/Indicator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, screen): self.pyScreen = screen self.position = Vector2(0,0) image_path = "assets/Spielwelt/spielwelt.png" self._load_texture(image_path) def _load_texture(self, image_path): self.background_texture = self.food_texture = pygame.i...
code_fim
medium
{ "lang": "python", "repo": "Rosikobu/snake-reloaded", "path": "/frame/components/background.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _load_texture(self, image_path): self.background_texture = self.food_texture = pygame.image.load(image_path).convert_alpha() def draw_background(self): background_obj = pygame.Rect(int(self.position.x),int(self.position.y),cell_size,cell_size) self.pyScreen.blit(self.b...
code_fim
medium
{ "lang": "python", "repo": "Rosikobu/snake-reloaded", "path": "/frame/components/background.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rosikobu/snake-reloaded path: /frame/components/background.py import random import pygame from pygame.math import Vector2 from .loc_conf import xSize, ySize, cell_size, cell_number class Background: def __init__(self, screen): <|fim_suffix|> image_path = "assets/Spielwelt/spielwelt....
code_fim
medium
{ "lang": "python", "repo": "Rosikobu/snake-reloaded", "path": "/frame/components/background.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> **postprocess_params) -> Dict[str, str]: """process the prediction results Args: inputs (Dict[str, Any]): should be tensors from model Returns: Dict[str, str]: the prediction results """ text = inputs['text'] log...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/modelscope/modelscope/pipelines/nlp/word_segmentation_pipeline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alldatacenter/alldata path: /ai/modelscope/modelscope/pipelines/nlp/word_segmentation_pipeline.py # Copyright (c) Alibaba, Inc. and its affiliates. from typing import Any, Dict, Optional, Union import torch from modelscope.metainfo import Pipelines from modelscope.models import Model from mode...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/modelscope/modelscope/pipelines/nlp/word_segmentation_pipeline.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sample_name = models.CharField(max_length=200) description = models.TextField() time = models.DateTimeField(default=timezone.now) def __str__(self): return self.sample_name<|fim_prefix|># repo: ericlee0920/2021-Data-Science-Projects path: /Project 1 miRNA Expression-Based Class...
code_fim
easy
{ "lang": "python", "repo": "ericlee0920/2021-Data-Science-Projects", "path": "/Project 1 miRNA Expression-Based Classification of Breast Cancer/django_assignment/database/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ericlee0920/2021-Data-Science-Projects path: /Project 1 miRNA Expression-Based Classification of Breast Cancer/django_assignment/database/models.py from django.db import models from django.utils import timezone # Create your models here. class Sample(models.Model): <|fim_suffix|> def __str__...
code_fim
medium
{ "lang": "python", "repo": "ericlee0920/2021-Data-Science-Projects", "path": "/Project 1 miRNA Expression-Based Classification of Breast Cancer/django_assignment/database/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_changed_files(commit_range, log=False): ''' Get a list of existing files changed in current PR ''' cmd = "git diff --no-commit-id --name-only -r --diff-filter=M {}".format( commit_range) output = run_git_command(cmd, log) return output.splitlines() def get_commit_...
code_fim
hard
{ "lang": "python", "repo": "JuulLabs-OSS/mynewt-travis-ci", "path": "/utils/cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JuulLabs-OSS/mynewt-travis-ci path: /utils/cli.py #!/usr/bin/env python3 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF l...
code_fim
hard
{ "lang": "python", "repo": "JuulLabs-OSS/mynewt-travis-ci", "path": "/utils/cli.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Qvineox/School148 path: /api/urls.py from django.urls import path, include from rest_framework.authtoken.views import obtain_auth_token <|fim_suffix|>app_name = 'api' urlpatterns = [ path('test/', Test.as_view(), name='test'), path('user_auth/', UserAuthView.as_view(), name='user_auth'),...
code_fim
medium
{ "lang": "python", "repo": "Qvineox/School148", "path": "/api/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>app_name = 'api' urlpatterns = [ path('test/', Test.as_view(), name='test'), path('user_auth/', UserAuthView.as_view(), name='user_auth'), path('token/', obtain_auth_token, name='obtain_token'), path('week_lessons/', WeekLessonsView.as_view(), name='view_week_lessons'), path('profile/<...
code_fim
medium
{ "lang": "python", "repo": "Qvineox/School148", "path": "/api/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sbuss/tastypie-client-generator path: /tastypieclient/resources.py class ResourceMetaClass(type): def __new__(cls, name, bases, attrs): super_new = super(ResourceMetaClass, cls).__new__ # Create the class. module = attrs.pop('__module__') new_class = super_new...
code_fim
hard
{ "lang": "python", "repo": "sbuss/tastypie-client-generator", "path": "/tastypieclient/resources.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Resource(object): __metaclass__ = ResourceMetaClass def __init__(self, base_url, **kwargs): """Initialize a Resource. Args: base_url: The base url to use for this Resource. kwargs: Kwargs for the Resource subclass, as defined by that ...
code_fim
hard
{ "lang": "python", "repo": "sbuss/tastypie-client-generator", "path": "/tastypieclient/resources.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.price.append(price) x = HousePlan("Alice") print(x.name) x.add_price(200) """<|fim_prefix|># repo: ayueha/python-class-assignment path: /untitled/self-study/house_hunting.py class HousePlan: def __init__(self, name, houseprice, savingrate, salary): self.name = name self....
code_fim
hard
{ "lang": "python", "repo": "ayueha/python-class-assignment", "path": "/untitled/self-study/house_hunting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ayueha/python-class-assignment path: /untitled/self-study/house_hunting.py class HousePlan: def __init__(self, name, houseprice, savingrate, salary): self.name = name self.housePrice = houseprice self.rate = savingrate self.salary = salary @houseprice.sett...
code_fim
hard
{ "lang": "python", "repo": "ayueha/python-class-assignment", "path": "/untitled/self-study/house_hunting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> direction = self.search_func(self.game.board) return direction class MyOwnAgent(Agent): def step(self): model.eval() arr1=log2(np.reshape(self.game.board,newshape=(16,))) arr1=grid_ohe(np.int_(arr1)) arr1 = torch.FloatTensor(arr1) # place=[...
code_fim
hard
{ "lang": "python", "repo": "StingSting/2048-api", "path": "/game2048/agents.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }