text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: chenmich/Quantities path: /quantities/time.py from .quantity_type import QuantityType from .quantity import Quantity from .units import Unit class s(Unit): profile = { "name":"second", "symbol":"s", "express_by_SI_base":"s", "express_by_SI":"s" } class ...
code_fim
hard
{ "lang": "python", "repo": "chenmich/Quantities", "path": "/quantities/time.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> BonsaiWS._PREDICT = predict def set_flaky_mode(flaky): BonsaiWS._FLAKY = flaky def set_unauthorized_mode(unauthorized): """ Returns 401 error on get requests when set to True """ BonsaiWS._UNAUTHORIZED = unauthorized def set_slow_mode(slow): BrainRequestHandler._SLOW = slow B...
code_fim
hard
{ "lang": "python", "repo": "BartVanDerVurst/bonsai-sdk", "path": "/bonsai-ai/tests/ws.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: BartVanDerVurst/bonsai-sdk path: /bonsai-ai/tests/ws.py # Copyright (C) 2018 Bonsai, Inc. import json import logging import sys from tornado import web, websocket, ioloop from google.protobuf.json_format import Parse from time import sleep from bonsai_ai.proto.generator_simulator_api_pb2 impor...
code_fim
hard
{ "lang": "python", "repo": "BartVanDerVurst/bonsai-sdk", "path": "/bonsai-ai/tests/ws.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def set_unauthorized_mode(unauthorized): """ Returns 401 error on get requests when set to True """ BonsaiWS._UNAUTHORIZED = unauthorized def set_slow_mode(slow): BrainRequestHandler._SLOW = slow BonsaiWS._SLOW = slow def set_fail_duration(duration): duration = int(duration) if...
code_fim
hard
{ "lang": "python", "repo": "BartVanDerVurst/bonsai-sdk", "path": "/bonsai-ai/tests/ws.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: googleapis/python-bigquery path: /google/cloud/bigquery/job/__init__.py # Copyright 2015 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
code_fim
hard
{ "lang": "python", "repo": "googleapis/python-bigquery", "path": "/google/cloud/bigquery/job/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Include classes previously in job.py for backwards compatibility. __all__ = [ "_AsyncJob", "_error_result_to_exception", "_DONE_STATE", "_JobConfig", "_JobReference", "ReservationUsage", "ScriptStatistics", "ScriptStackFrame", "UnknownJob", "CopyJob", "CopyJob...
code_fim
hard
{ "lang": "python", "repo": "googleapis/python-bigquery", "path": "/google/cloud/bigquery/job/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: redmoo-info/proddict path: /ru/sport.py 'helmets', 'шлемы'): {}, ('protective gear', 'защитное снаряжение'): {}, ('sunglasses', 'очки темные'): {}, ('other', 'другое'): {}, }, ('other bikes', 'другие велосипеды'): {}, ...
code_fim
hard
{ "lang": "python", "repo": "redmoo-info/proddict", "path": "/ru/sport.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ('accessories', 'аксессуары'): {}, ('clothing', 'одежда'): { ('boys', 'мальчики'): {}, ('girls', 'девочки'): {}, ('men', 'мужчины'): {}, ('women', 'женщины'): {}, }, ('shoes', 'обувь'): { ...
code_fim
hard
{ "lang": "python", "repo": "redmoo-info/proddict", "path": "/ru/sport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ('cassettes, freewheels', 'кассеты'): {}, ('chain rings', 'цепи, звенья'): {}, ('derailleurs', 'переключатели передач'): {}, ('shifters', 'манетки'): {}, ('stems', 'вынос руля'): {}, ('other', 'другое'): {}, ...
code_fim
hard
{ "lang": "python", "repo": "redmoo-info/proddict", "path": "/ru/sport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ret = no_gui_batch.load_data() if ret[0] is not False and ret[0] >= 0: server = simbatch_server.SimBatchServer(no_gui_batch) server.run(argv=sys.argv) else: no_gui_batch.logger.err("Database NOT loaded properly !")<|fim_prefix|># repo: MarkusVFX/simbatch path: /simbatch/SimBatch_server.py imp...
code_fim
medium
{ "lang": "python", "repo": "MarkusVFX/simbatch", "path": "/simbatch/SimBatch_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarkusVFX/simbatch path: /simbatch/SimBatch_server.py import sys import core.core as simbatch_core import server.server as simbatch_server <|fim_suffix|>ret = no_gui_batch.load_data() if ret[0] is not False and ret[0] >= 0: server = simbatch_server.SimBatchServer(no_gui_batch) server.run...
code_fim
medium
{ "lang": "python", "repo": "MarkusVFX/simbatch", "path": "/simbatch/SimBatch_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>post1 = Post(body='Post 1', user=bob) session.add(post1) session.flush() post2 = Post(body='Post 2 long-long body', user=bob) session.add(post2) session.flush() # <User #1 'Bob'> print(bob) # <Post #1 body: 'Post 1' user: <User #1 ...> print(post1) # <Post #2 body: 'Post 2 long-...' user: <User #1 ......
code_fim
hard
{ "lang": "python", "repo": "absent1706/sqlalchemy-mixins", "path": "/examples/repr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> id = sa.Column(sa.Integer, primary_key=True) body = sa.Column(sa.String) user_id = sa.Column(sa.Integer, sa.ForeignKey('user.id')) Base.metadata.create_all(engine) bob = User(name='Bob') session.add(bob) session.flush() post1 = Post(body='Post 1', user=bob) session.add(post1) session.flush...
code_fim
hard
{ "lang": "python", "repo": "absent1706/sqlalchemy-mixins", "path": "/examples/repr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: absent1706/sqlalchemy-mixins path: /examples/repr.py from __future__ import print_function import sqlalchemy as sa from sqlalchemy.orm import scoped_session, sessionmaker, DeclarativeBase <|fim_suffix|> class BaseModel(Base, ReprMixin): __abstract__ = True __repr__ = ReprMixin.__repr__ ...
code_fim
medium
{ "lang": "python", "repo": "absent1706/sqlalchemy-mixins", "path": "/examples/repr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: karan-parekh/ga-learner-dsmp-repo path: /Pandas/code.py # -------------- # Import packages import numpy as np import pandas as pd from scipy.stats import mode # code starts here bank = pd.read_csv(path) categorical_var = bank.select_dtypes(include='object') print(categorical_var) numerical_va...
code_fim
hard
{ "lang": "python", "repo": "karan-parekh/ga-learner-dsmp-repo", "path": "/Pandas/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # -------------- # code starts here loan_term = banks['Loan_Amount_Term'].apply(lambda x: x/12 if isinstance(x, float) else None) loan_term_without_na = loan_term.dropna() >= 25 # print(loan_term) # big_loan_term = len(loan_term_without_na) big_loan_term = loan_term_without_na.value_counts()[True] ...
code_fim
hard
{ "lang": "python", "repo": "karan-parekh/ga-learner-dsmp-repo", "path": "/Pandas/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iplweb/bpp path: /src/api_v1/viewsets/struktura.py from rest_framework import viewsets from api_v1.serializers.struktura import ( JednostkaSerializer, WydzialSerializer, UczelniaSerializer, ) from bpp.models import Jednostka, Wydzial, Uczelnia class JednostkaViewSet(viewsets.ReadOn...
code_fim
hard
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/api_v1/viewsets/struktura.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> queryset = Uczelnia.objects.all() serializer_class = UczelniaSerializer<|fim_prefix|># repo: iplweb/bpp path: /src/api_v1/viewsets/struktura.py from rest_framework import viewsets from api_v1.serializers.struktura import ( JednostkaSerializer, WydzialSerializer, UczelniaSerializer, )...
code_fim
hard
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/api_v1/viewsets/struktura.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: omerb01/pywren-ibm-cloud path: /lithops/compute/compute.py # # (C) Copyright IBM Corp. 2018 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
code_fim
hard
{ "lang": "python", "repo": "omerb01/pywren-ibm-cloud", "path": "/lithops/compute/compute.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Invoke -- return information about this invocation """ return self.compute_handler.invoke(runtime_name, memory, payload) def build_runtime(self, runtime_name, file): """ Wrapper method to build a new runtime for the compute backend. return: ...
code_fim
hard
{ "lang": "python", "repo": "omerb01/pywren-ibm-cloud", "path": "/lithops/compute/compute.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def delete_all_runtimes(self): """ Wrapper method to create a runtime in the compute backend """ self.compute_handler.delete_all_runtimes() def list_runtimes(self, runtime_name='all'): """ Wrapper method to list deployed runtime in the compute backe...
code_fim
hard
{ "lang": "python", "repo": "omerb01/pywren-ibm-cloud", "path": "/lithops/compute/compute.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># def create_tx_and_redirect(payment, name, number): # try: # tx = payment.create_tx(item_name=name, item_number=number) # payment.status = PAYMENT_STATUS_PENDING # payment.save() # return redirect(reverse('main:payment_detail', kwargs={'pk': payment.pk})) # except ...
code_fim
hard
{ "lang": "python", "repo": "Bearle/django-coinpayments", "path": "/django_coinpayments/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bearle/django-coinpayments path: /django_coinpayments/views.py # -*- coding: utf-8 -*- from django.views.generic import ( CreateView, DeleteView, DetailView, UpdateView, ListView ) from .models import ( CoinPaymentsTransaction, Payment, ) from django.views.decorators...
code_fim
hard
{ "lang": "python", "repo": "Bearle/django-coinpayments", "path": "/django_coinpayments/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for j in range(1, len(a)): if a[j] == N - 1: return j return -1 # test N = 4 trust = [[1,3],[1,4],[2,3],[2,4],[4,3]] print(findJudge(N, trust))<|fim_prefix|># repo: lance-lh/Data-Structures-and-Algorithms path: /DSA/graph/findJudge.py def findJudge(N, trust): '...
code_fim
medium
{ "lang": "python", "repo": "lance-lh/Data-Structures-and-Algorithms", "path": "/DSA/graph/findJudge.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lance-lh/Data-Structures-and-Algorithms path: /DSA/graph/findJudge.py def findJudge(N, trust): ''' :param N: int :param trust: List[List[int]] :return: int ''' # if judge exists, it has N - 1 votes # we consider each person as a vertex and each trust relationshi...
code_fim
medium
{ "lang": "python", "repo": "lance-lh/Data-Structures-and-Algorithms", "path": "/DSA/graph/findJudge.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: naveens33/ctreport-selenium path: /venv/Lib/site-packages/twine/cli.py # Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.ap...
code_fim
hard
{ "lang": "python", "repo": "naveens33/ctreport-selenium", "path": "/venv/Lib/site-packages/twine/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def list_dependencies_and_versions(): return [ ('pkginfo', Installed(pkginfo).version), ('requests', requests.__version__), ('setuptools', setuptools.__version__), ('requests-toolbelt', requests_toolbelt.__version__), ('tqdm', tqdm.__version__), ] def dep_...
code_fim
medium
{ "lang": "python", "repo": "naveens33/ctreport-selenium", "path": "/venv/Lib/site-packages/twine/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TSG405/SMS-Sender--BOT path: /APIs/TWILIO/twilio_sms.py from twilio.rest import Client from credentials import SID,TOKEN,sender print("\n\n---**--- WELCOME TO THE SMS-SENDING BOT ---**---\n") print("\nAccessing URL...") # Authroization client = Client(SID,TOKEN) # Driver Code.. def main(): ...
code_fim
medium
{ "lang": "python", "repo": "TSG405/SMS-Sender--BOT", "path": "/APIs/TWILIO/twilio_sms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: temp=int(receiver) except: print("BOT: ERROR! Follow the instructions.. and Type correctly !") main() bo = input("BOT: Enter the text message: \t") print("\nBOT: Please wait..\n") message = client.messages.create( to=receiver, from_=...
code_fim
medium
{ "lang": "python", "repo": "TSG405/SMS-Sender--BOT", "path": "/APIs/TWILIO/twilio_sms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Test output to a file. """ outf = tempfile.TemporaryFile() yamlish.dump(IN, outf) outf.seek(0) got_str = outf.read() outf.close() logging.debug("got_str = %s", got_str) got = yaml.safe_load(got_str) self.assertEqua...
code_fim
hard
{ "lang": "python", "repo": "Bottom-Line-Software/ember-toastr", "path": "/node_modules/yamlish/yamlish-py/test/test_output.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): """ Transform expected list into string which we actually use. """ self._expected = yaml.safe_load(OUT) def test_file_output(self): """ Test output to a file. """ outf = tempfile.TemporaryFile() yamlish.dump(...
code_fim
hard
{ "lang": "python", "repo": "Bottom-Line-Software/ember-toastr", "path": "/node_modules/yamlish/yamlish-py/test/test_output.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bottom-Line-Software/ember-toastr path: /node_modules/yamlish/yamlish-py/test/test_output.py # -*- coding: utf-8 -*- """ Test general output functionality. Without much stress on the format itself. """ from __future__ import absolute_import, print_function, unicode_literals import yamlish import...
code_fim
hard
{ "lang": "python", "repo": "Bottom-Line-Software/ember-toastr", "path": "/node_modules/yamlish/yamlish-py/test/test_output.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: AoEiuV020/LearningPython path: /pycurl/ip.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- <|fim_suffix|>print(buf.getvalue().decode('utf-8').strip())<|fim_middle|>import pycurl from io import BytesIO buf = BytesIO() c = pycurl.Curl() c.setopt(c.URL, 'http://ip.cip.cc') c.setopt(c.WRITEDATA, b...
code_fim
hard
{ "lang": "python", "repo": "AoEiuV020/LearningPython", "path": "/pycurl/ip.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(buf.getvalue().decode('utf-8').strip())<|fim_prefix|># repo: AoEiuV020/LearningPython path: /pycurl/ip.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import pycurl from io import BytesIO <|fim_middle|>buf = BytesIO() c = pycurl.Curl() c.setopt(c.URL, 'http://ip.cip.cc') c.setopt(c.WRITEDATA, b...
code_fim
medium
{ "lang": "python", "repo": "AoEiuV020/LearningPython", "path": "/pycurl/ip.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ianhi/pymm_raman path: /setup.py from os import path from setuptools import find_packages, setup <|fim_suffix|>setup_args = dict( version=version, ) if __name__ == "__main__": setup(**setup_args)<|fim_middle|># extract version path = path.realpath("pymm_raman/_version.py") version_ns =...
code_fim
medium
{ "lang": "python", "repo": "ianhi/pymm_raman", "path": "/setup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": setup(**setup_args)<|fim_prefix|># repo: ianhi/pymm_raman path: /setup.py from os import path from setuptools import find_packages, setup <|fim_middle|># extract version path = path.realpath("pymm_raman/_version.py") version_ns = {} with open(path, encoding="utf8") as f: ...
code_fim
hard
{ "lang": "python", "repo": "ianhi/pymm_raman", "path": "/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @detail_route(renderer_classes=(renderers.StaticHTMLRenderer,)) def highlight(self, request, *args, **kwargs): snippet = self.get_object() return Response(snippet.highlighted) def perform_create(self, serializer): serializer.save(owner=self.request.user)<|fim_prefix|>#...
code_fim
hard
{ "lang": "python", "repo": "yrchen/CommonRepo", "path": "/commonrepo/snippets_api/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yrchen/CommonRepo path: /commonrepo/snippets_api/views.py # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from rest_framework import permissions from rest_framework import ...
code_fim
hard
{ "lang": "python", "repo": "yrchen/CommonRepo", "path": "/commonrepo/snippets_api/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>templateNews = templateEnv.get_template( "news.html" ) with open('news.html', 'w') as f: f.write( templateNews.render( templateVars ) )<|fim_prefix|># repo: icedwater/jinja2-tutorial path: /04_bootstraps/site.py #!/usr/bin/python import jinja2 templateLoader = jinja2.FileSystemLoader( searchpath="t...
code_fim
medium
{ "lang": "python", "repo": "icedwater/jinja2-tutorial", "path": "/04_bootstraps/site.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: icedwater/jinja2-tutorial path: /04_bootstraps/site.py #!/usr/bin/python import jinja2 templateLoader = jinja2.FileSystemLoader( searchpath="template" ) templateEnv = jinja2.Environment( loader=templateLoader ) templateVars = { "license_info": "This site is released under the GNU General P...
code_fim
medium
{ "lang": "python", "repo": "icedwater/jinja2-tutorial", "path": "/04_bootstraps/site.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>ken I can just for loop this- for name in names: print(name)<|fim_prefix|># repo: awakun/LearningPython path: /Python/PythonCrashCourse2ndEdition/3-1_names.py names = ['Dave', 'Joe', 'Tucker', 'Julia', 'Amber', 'Equinox'] print(names[0]) print(names[1]) print(names[2]) print(names[3]) p<|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "awakun/LearningPython", "path": "/Python/PythonCrashCourse2ndEdition/3-1_names.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rint(names[4]) print(names[5]) print('----') # If I'm not mistaken I can just for loop this- for name in names: print(name)<|fim_prefix|># repo: awakun/LearningPython path: /Python/PythonCrashCourse2ndEdition/3-1_names.py names = ['Dave', 'Joe', 'Tucker', 'Julia', 'Amber', 'Equinox'] p<|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "awakun/LearningPython", "path": "/Python/PythonCrashCourse2ndEdition/3-1_names.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: awakun/LearningPython path: /Python/PythonCrashCourse2ndEdition/3-1_names.py names = ['Dave', 'Joe', 'Tucker', 'Julia', 'Amber', 'Equinox'] p<|fim_suffix|>rint(names[4]) print(names[5]) print('----') # If I'm not mistaken I can just for loop this- for name in names: print(name)<|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "awakun/LearningPython", "path": "/Python/PythonCrashCourse2ndEdition/3-1_names.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devprocommunity/DesafiosExercicios path: /Python/002-NumerosPares/script.py # Essa é a nossa lista de números com números IMPARES e também PARES numeros = [10,11,12,13,17,21,<|fim_suffix|>gual a 0 faça: if (n % 2) == 0: #Imprima na tela o número com resto 0 print(n)<|fim_middl...
code_fim
medium
{ "lang": "python", "repo": "devprocommunity/DesafiosExercicios", "path": "/Python/002-NumerosPares/script.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>gual a 0 faça: if (n % 2) == 0: #Imprima na tela o número com resto 0 print(n)<|fim_prefix|># repo: devprocommunity/DesafiosExercicios path: /Python/002-NumerosPares/script.py # Essa é a nossa lista de números com números IMPARES e também PARES numeros = [10,11,12,13,17,21,<|fim_middl...
code_fim
medium
{ "lang": "python", "repo": "devprocommunity/DesafiosExercicios", "path": "/Python/002-NumerosPares/script.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>] + quick_sort(greater) test = [10, 5, 2, 3, 11, 109] print(quick_sort(test))<|fim_prefix|># repo: AzuLiu/Algorithms-by-Python path: /Grokking-Algorithms/Quick_Sort.py def quick_sort(arr): if len(arr) < 2: return arr else: <|fim_middle|> pivot = arr[0] less = [i fo...
code_fim
medium
{ "lang": "python", "repo": "AzuLiu/Algorithms-by-Python", "path": "/Grokking-Algorithms/Quick_Sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AzuLiu/Algorithms-by-Python path: /Grokking-Algorithms/Quick_Sort.py def quick_sort(arr): if len(arr) < 2: return arr else: <|fim_suffix|>ter = [i for i in arr[1:] if i > pivot] return quick_sort(less) + [pivot] + quick_sort(greater) test = [10, 5, 2, 3, 11, ...
code_fim
medium
{ "lang": "python", "repo": "AzuLiu/Algorithms-by-Python", "path": "/Grokking-Algorithms/Quick_Sort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ter = [i for i in arr[1:] if i > pivot] return quick_sort(less) + [pivot] + quick_sort(greater) test = [10, 5, 2, 3, 11, 109] print(quick_sort(test))<|fim_prefix|># repo: AzuLiu/Algorithms-by-Python path: /Grokking-Algorithms/Quick_Sort.py def quick_sort(arr): if len(arr) < 2: ...
code_fim
medium
{ "lang": "python", "repo": "AzuLiu/Algorithms-by-Python", "path": "/Grokking-Algorithms/Quick_Sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: verdesmarald/ascended-tracking path: /ascended_tracking/resource.py """Convienience wrapper around pkg_resources""" import pkg_resources def stream(filename): <|fim_suffix|>def get(filename): return pkg_resources.resource_string('ascended_tracking.resources', filename)<|fim_middle|> retu...
code_fim
medium
{ "lang": "python", "repo": "verdesmarald/ascended-tracking", "path": "/ascended_tracking/resource.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get(filename): return pkg_resources.resource_string('ascended_tracking.resources', filename)<|fim_prefix|># repo: verdesmarald/ascended-tracking path: /ascended_tracking/resource.py """Convienience wrapper around pkg_resources""" import pkg_resources def stream(filename): <|fim_middle|> retu...
code_fim
medium
{ "lang": "python", "repo": "verdesmarald/ascended-tracking", "path": "/ascended_tracking/resource.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hirogwa/plain-blog path: /models.py from django.db import models from django.template.defaultfilters import slugify import escontrol import datetime import urllib import hashlib class BlogModel(models.Model): class Meta: abstract = True app_label = 'blog' class Theme(BlogM...
code_fim
hard
{ "lang": "python", "repo": "hirogwa/plain-blog", "path": "/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def spaced_datetime(self): return '%d %02d %02d %02d %02d' % \ (self.pub_date.year, self.pub_date.month, self.pub_date.day, self.pub_date.hour, self.pub_date.minute) def pub_date_string(self): date = self.pub_date return '%d %02d %02d %02d:%02d' % \ ...
code_fim
hard
{ "lang": "python", "repo": "hirogwa/plain-blog", "path": "/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self,): _CHOIR.__init__(self) self.name = "CHOIRS" self.specie = 'nouns' self.basic = "choir" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_choirs.py from xai.brain.wordbase.nouns._choir import _CHOIR <|fim_middle|>#calss header class _C...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_choirs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _CHOIR.__init__(self) self.name = "CHOIRS" self.specie = 'nouns' self.basic = "choir" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_choirs.py from xai.brain.wordbase.nouns._choir import _CHOIR <|fim_middle|>#calss header class _CHOIRS(_CHOIR, ): def _...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_choirs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_choirs.py from xai.brain.wordbase.nouns._choir import _CHOIR <|fim_suffix|> _CHOIR.__init__(self) self.name = "CHOIRS" self.specie = 'nouns' self.basic = "choir" self.jsondata = {}<|fim_middle|>#calss header class _CHOIRS(_CHOIR, ): def _...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_choirs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: umbrashia/universal-sql path: /universal-sql-builder/src/example.py from UniversalSqlBuilder import UniversalSqlBuilder, SqlLoader print(UniversalSqlBuilder.table("employee") .select("id,name") .select(",department") .where("city=", "delhi") .where("order_id=("+Universal...
code_fim
medium
{ "lang": "python", "repo": "umbrashia/universal-sql", "path": "/universal-sql-builder/src/example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> .orWhere("brand=", 'rock') .having("city=", "delhi") .orHaving("seller=", '100') .orHaving("brand=", 'rock') .whereBetween("age", [200, 300]) .join("users", "users.id=employee.emp_id", "left") .join("cars", "cars.id=employee.emp_id") .groupBy("name") ...
code_fim
medium
{ "lang": "python", "repo": "umbrashia/universal-sql", "path": "/universal-sql-builder/src/example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tufts-ml/GAN-Ensemble-for-Anomaly-Detection path: /dataloader/dataloader.py import os import torch from torchvision import transforms from torchvision.transforms import functional as F from torch.utils.data import DataLoader from torchvision.datasets import MNIST, CIFAR10, ImageFolder from datal...
code_fim
hard
{ "lang": "python", "repo": "tufts-ml/GAN-Ensemble-for-Anomaly-Detection", "path": "/dataloader/dataloader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> train_ds = MNIST(root='./data', train=True, download=True, transform=transform) valid_ds = MNIST(root='./data', train=False, download=True, transform=transform) train_ds, valid_ds = get_mnist_anomaly_dataset(train_ds, valid_ds, int(opt.abnormal_class)) # FOLDER elif opt.da...
code_fim
hard
{ "lang": "python", "repo": "tufts-ml/GAN-Ensemble-for-Anomaly-Detection", "path": "/dataloader/dataloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m{}\033[m é maior que \033[34m{}\033[m'.format(num2,num1)) else: print('Os números são iguais!')<|fim_prefix|># repo: RutyRibeiro/CursoEmVideo-Python path: /Exercícios/Desafio_38.py #recebe dois números e vê qual o maior, se os dois forem iguais gera mensagem de aviso num1 = input('Digite o primeiro ...
code_fim
medium
{ "lang": "python", "repo": "RutyRibeiro/CursoEmVideo-Python", "path": "/Exercícios/Desafio_38.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RutyRibeiro/CursoEmVideo-Python path: /Exercícios/Desafio_38.py #recebe dois números e vê qual o maior, se os dois forem iguais gera mensagem de aviso num1 = input<|fim_suffix|>m{}\033[m é maior que \033[34m{}\033[m'.format(num2,num1)) else: print('Os números são iguais!')<|fim_middle|>('Digi...
code_fim
medium
{ "lang": "python", "repo": "RutyRibeiro/CursoEmVideo-Python", "path": "/Exercícios/Desafio_38.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: f = open('userData.json', 'r') fin = json.load(f) f.close() #type(fin) for i in fin['visited static patterns']: visitedStaticPattern.append(i) print ("worked1") for i in fin['user static response']: user_static_re...
code_fim
hard
{ "lang": "python", "repo": "bjduarte/hapwrap", "path": "/python/examples/Hapwrap V1.0/hapwrap_GUI test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bjduarte/hapwrap path: /python/examples/Hapwrap V1.0/hapwrap_GUI test.py ) # strip.setPixelColor(pixPointer,pulse_on) # print ("On") # strip.show() # print(beat) # time.sleep(0.99) # strip.setPixelCol...
code_fim
hard
{ "lang": "python", "repo": "bjduarte/hapwrap", "path": "/python/examples/Hapwrap V1.0/hapwrap_GUI test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bjduarte/hapwrap path: /python/examples/Hapwrap V1.0/hapwrap_GUI test.py ) # time.sleep(heartbeat_gap) # print("Beginning Heartbeat") # pointerDone = True # # Heartbeat pattern for 10 through 20 feet # if ((distance == 2) or...
code_fim
hard
{ "lang": "python", "repo": "bjduarte/hapwrap", "path": "/python/examples/Hapwrap V1.0/hapwrap_GUI test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pylib = clang_build.target.TargetDescription( "pylib", { "target_type": "shared library", "output_name": "pylib", "output_prefix": "", "output_suffix": py_library_extension, "dependencies": ["pybind", "mylib"], "so...
code_fim
hard
{ "lang": "python", "repo": "Trick-17/clang-build", "path": "/test/pybind11/clang-build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Trick-17/clang-build path: /test/pybind11/clang-build.py import clang_build def get_project(directory, environment, parent=None) -> clang_build.project.Project: py_include_dir = environment.toolchain.platform_defaults[ "PLATFORM_PYTHON_INCLUDE_PATH" ] py_library_dir = enviro...
code_fim
hard
{ "lang": "python", "repo": "Trick-17/clang-build", "path": "/test/pybind11/clang-build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KONAPAVANKUMAR/paying-guest-django path: /pgapp/roomtypeviews.py from django.shortcuts import render,redirect from django.contrib import messages from django.contrib.auth.models import User from django.contrib.auth import login,logout,authenticate from .models import * def roomtypeview(request):...
code_fim
medium
{ "lang": "python", "repo": "KONAPAVANKUMAR/paying-guest-django", "path": "/pgapp/roomtypeviews.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> description = request.POST['description'] fees = request.POST['fees'] RoomTypeModel(description = description,fees = fees).save() return redirect('roomtypepage')<|fim_prefix|># repo: KONAPAVANKUMAR/paying-guest-django path: /pgapp/roomtypeviews.py from django.shortcuts import render,redir...
code_fim
medium
{ "lang": "python", "repo": "KONAPAVANKUMAR/paying-guest-django", "path": "/pgapp/roomtypeviews.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class OtherCompoundNamesIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) other_names = indexes.EdgeNgramField(model_attr='other_names') id_compound=indexes.IntegerField(model_attr='id_compound__id') def get_model(self): ret...
code_fim
hard
{ "lang": "python", "repo": "GPCRmd/GPCRmd", "path": "/modules/dynadb/search_indexes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GPCRmd/GPCRmd path: /modules/dynadb/search_indexes.py ''' This file defines indexes for haystack search indexer manager. If the definition of any of these indexes is modified, the solr schema.xml file must be regenerated, sorl engine must be restarted and the indexes rebuilt. Also, the HTTP serve...
code_fim
hard
{ "lang": "python", "repo": "GPCRmd/GPCRmd", "path": "/modules/dynadb/search_indexes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_model(self): return DyndbOtherProteinNames def index_queryset(self, using=None): """Used when the entire index for model is updated.""" return self.get_model().objects.all() class CompoundIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(...
code_fim
hard
{ "lang": "python", "repo": "GPCRmd/GPCRmd", "path": "/modules/dynadb/search_indexes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert inst.pubkey.schnorr_verify(b'hello', raw_sig, 'test_schnorr_simple') assert not inst.pubkey.schnorr_verify(b'hello', raw_sig, 'test_schnorr_simple2') key2 = secp256k1.PrivateKey() assert not key2.pubkey.schnorr_verify(b'hello', raw_sig, ...
code_fim
hard
{ "lang": "python", "repo": "cdecker/secp256k1-py", "path": "/tests/test_schnorr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdecker/secp256k1-py path: /tests/test_schnorr.py import pytest import secp256k1 def test_schnorr_simple(): if not secp256k1.HAS_SCHNORR: pytest.skip('secp256k1_schnorr not enabled, skipping') return <|fim_suffix|> assert inst.pubkey.schnorr_verify(b'hello', raw_sig, 't...
code_fim
hard
{ "lang": "python", "repo": "cdecker/secp256k1-py", "path": "/tests/test_schnorr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> System" products.close() print("All Products data saved in our shelve")<|fim_prefix|># repo: aksharanigam1112/MachineLearningIITK path: /packageML01/Practical50.py import shelve products = shelve.open("MyProduct.txt") products['P001'] = <|fim_middle|>"Mouse" products['P002'] = "Keyboard" products['P003...
code_fim
medium
{ "lang": "python", "repo": "aksharanigam1112/MachineLearningIITK", "path": "/packageML01/Practical50.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aksharanigam1112/MachineLearningIITK path: /packageML01/Practical50.py import shelve products = shelve.open("MyProduct.txt") products['P001'] = "Mouse" products['P002'] = "Keyboard" products['P003'] = "Monitor" produc<|fim_suffix|> System" products.close() print("All Products data saved in our s...
code_fim
medium
{ "lang": "python", "repo": "aksharanigam1112/MachineLearningIITK", "path": "/packageML01/Practical50.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ts['P004'] = "Printer" products['P005'] = "DVD" products['P003'] = "Music System" products.close() print("All Products data saved in our shelve")<|fim_prefix|># repo: aksharanigam1112/MachineLearningIITK path: /packageML01/Practical50.py import shelve products = shelve.open("MyProduct.txt") products['P0...
code_fim
medium
{ "lang": "python", "repo": "aksharanigam1112/MachineLearningIITK", "path": "/packageML01/Practical50.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> project = XcodeProject(self.obj) build_phases = project.get_build_phases_by_name('PBXGenericBuildPhase') self.assertEqual(build_phases.__len__(), 2) def testGetBuildConfigurationsByTarget(self): project = XcodeProject(self.obj) build_configurations = project....
code_fim
hard
{ "lang": "python", "repo": "kronenthaler/mod-pbxproj", "path": "/tests/TestXCodeProject.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kronenthaler/mod-pbxproj path: /tests/TestXCodeProject.py import os import shutil import unittest from pbxproj import XcodeProject class XCodeProjectTest(unittest.TestCase): def setUp(self): self.obj = { 'objects': { '0': {'isa': 'PBXGroup', 'children': ...
code_fim
hard
{ "lang": "python", "repo": "kronenthaler/mod-pbxproj", "path": "/tests/TestXCodeProject.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> project = XcodeProject(self.obj) build_configurations = project.get_build_configurations_by_target( 'appThatDoesNotExists') self.assertIsNone(build_configurations) def testConsistency(self): with open('samplescli/massive.pbxproj', 'r') as file: ...
code_fim
hard
{ "lang": "python", "repo": "kronenthaler/mod-pbxproj", "path": "/tests/TestXCodeProject.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: A-New-Eruption/PaddlePaddle-DeepSpeech path: /tools/generate_audio/generate_audio.py import _thread import argparse import logging import os import random import threading from pathlib import Path import numpy as np import paddle import soundfile import yaml from tqdm import tqdm from yacs.confi...
code_fim
hard
{ "lang": "python", "repo": "A-New-Eruption/PaddlePaddle-DeepSpeech", "path": "/tools/generate_audio/generate_audio.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> stat = np.load(args.fastspeech2_stat) mu, std = stat mu = paddle.to_tensor(mu) std = paddle.to_tensor(std) fastspeech2_normalizer = ZScore(mu, std) stat = np.load(args.pwg_stat) mu, std = stat mu = paddle.to_tensor(mu) std = paddle.to_tensor(std) pwg_normalizer = Z...
code_fim
hard
{ "lang": "python", "repo": "A-New-Eruption/PaddlePaddle-DeepSpeech", "path": "/tools/generate_audio/generate_audio.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output_dir = Path(args.output_dir) output_dir.mkdir(parents=True, exist_ok=True) annotation_path = Path(os.path.dirname(args.annotation_path)) annotation_path.mkdir(parents=True, exist_ok=True) start_num = 0 if os.path.exists(args.annotation_path): with open(args.annotation...
code_fim
hard
{ "lang": "python", "repo": "A-New-Eruption/PaddlePaddle-DeepSpeech", "path": "/tools/generate_audio/generate_audio.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(HouseInformation) admin.site.register(PredictionLog)<|fim_prefix|># repo: THelsby/IowaHomes path: /prediction/admin.py from django.contrib import admin from .models import HouseInformation, PredictionLog <|fim_middle|># Register your models here.
code_fim
easy
{ "lang": "python", "repo": "THelsby/IowaHomes", "path": "/prediction/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: THelsby/IowaHomes path: /prediction/admin.py from django.contrib import admin from .models import HouseInformation, PredictionLog <|fim_suffix|>admin.site.register(HouseInformation) admin.site.register(PredictionLog)<|fim_middle|># Register your models here.
code_fim
easy
{ "lang": "python", "repo": "THelsby/IowaHomes", "path": "/prediction/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mallik-G/Mocha path: /mocha/skel/create/brew.py # -*- coding: utf-8 -*- """" ________________________________________________________________________________ MOCHA: https://github.com/mardix/mocha ________________________________________________________________________________ """ from mocha imp...
code_fim
medium
{ "lang": "python", "repo": "Mallik-G/Mocha", "path": "/mocha/skel/create/brew.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # == PROJECTS == # Apps is a dict with list of views that will be loaded by name # ie: `app=main mocha :serve` will serve all the views in the `main` list # Views are placed in application/views directory, and should be listed as string # without the `.py` # You can add as many projects as you want, cont...
code_fim
medium
{ "lang": "python", "repo": "Mallik-G/Mocha", "path": "/mocha/skel/create/brew.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>apps = { "main": [ "main" ] } # == INIT == # Init the application # 'app' variable is mandatory if you plan on using the mocha cli app = Brew(__name__, apps)<|fim_prefix|># repo: Mallik-G/Mocha path: /mocha/skel/create/brew.py # -*- coding: utf-8 -*- """" ________________________________...
code_fim
hard
{ "lang": "python", "repo": "Mallik-G/Mocha", "path": "/mocha/skel/create/brew.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ensity from . import power_density_1D from . import yaw from . import yaw_wind_rose from . import yaw_wind_rose_parallel<|fim_prefix|># repo: jialrs/floris-enhanced path: /floris/tools/optimization/scipy/__init__.py from . import base_COE from . import layout from . import la<|fim_middle|>yout_height fro...
code_fim
medium
{ "lang": "python", "repo": "jialrs/floris-enhanced", "path": "/floris/tools/optimization/scipy/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jialrs/floris-enhanced path: /floris/tools/optimization/scipy/__init__.py from . import base_COE from . import layout from . import la<|fim_suffix|>ensity from . import power_density_1D from . import yaw from . import yaw_wind_rose from . import yaw_wind_rose_parallel<|fim_middle|>yout_height fro...
code_fim
medium
{ "lang": "python", "repo": "jialrs/floris-enhanced", "path": "/floris/tools/optimization/scipy/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#TESTED def HEffExponentSetProductionBinary(H, jumpOpsPaired, deltaT, settings): HEff = HEffProduction(H, jumpOpsPaired) #Defines a HEff Exponent using a small time-steps HEffExponentDtSet = [] dtSet = [] dt = deltaT * 2 #TODO add a safety check that the smallest dt in the list isn't smaller (if so...
code_fim
hard
{ "lang": "python", "repo": "Xyao2001/Quantum-Jump-Monte-Carlo-Adaptive-Algorithm", "path": "/QJMCSetUp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xyao2001/Quantum-Jump-Monte-Carlo-Adaptive-Algorithm path: /QJMCSetUp.py #Edited 12/3/17 Ben Everest #Functions used to set up the algorithm and perform checks on the given #variables import scipy import numpy import sys import random import QJMCAA import QJMCMath #TESTED def dimensionTest(H,ju...
code_fim
hard
{ "lang": "python", "repo": "Xyao2001/Quantum-Jump-Monte-Carlo-Adaptive-Algorithm", "path": "/QJMCSetUp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(self.step, int): return base_lr * (self.gamma**(progress // self.step)) exp = len(self.step) for i, s in enumerate(self.step): if progress < s: exp = i break return base_lr * self.gamma**exp<|fim_prefix...
code_fim
hard
{ "lang": "python", "repo": "openvinotoolkit/mmaction2", "path": "/mmaction/core/lr/customstep_lr_hook.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openvinotoolkit/mmaction2 path: /mmaction/core/lr/customstep_lr_hook.py from mmcv.runner.hooks import HOOKS from .base_lr_hook import BaseLrUpdaterHook @HOOKS.register_module() class CustomstepLrUpdaterHook(BaseLrUpdaterHook): <|fim_suffix|> assert isinstance(step, (list, int)) ...
code_fim
hard
{ "lang": "python", "repo": "openvinotoolkit/mmaction2", "path": "/mmaction/core/lr/customstep_lr_hook.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> progress = runner.epoch if isinstance(self.step, int): return base_lr * (self.gamma**(progress // self.step)) exp = len(self.step) for i, s in enumerate(self.step): if progress < s: exp = i break return base...
code_fim
hard
{ "lang": "python", "repo": "openvinotoolkit/mmaction2", "path": "/mmaction/core/lr/customstep_lr_hook.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adamcharnock/lightbus path: /lightbus_examples/ex03_worked_example/dashboard/bus.py """ This bus.py file listens for events only and does not provide any APIs. It receives page view events and writes the data to .exampledb.json. """ import json import lightbus bus = lightbus.create() page_views...
code_fim
medium
{ "lang": "python", "repo": "adamcharnock/lightbus", "path": "/lightbus_examples/ex03_worked_example/dashboard/bus.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> page_views.setdefault(url, 0) page_views[url] += 1 with open("/tmp/.dashboard.db.json", "w") as f: json.dump(page_views, f) @bus.client.on_start() def my_startup(client): bus.store.page_view.listen(handle_page_view, listener_name="handle_page_view")<|fim_prefix|># repo: adamcharn...
code_fim
medium
{ "lang": "python", "repo": "adamcharnock/lightbus", "path": "/lightbus_examples/ex03_worked_example/dashboard/bus.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>om . import models from .models.base import * from .models.filter import * from .models.transferfunc import *<|fim_prefix|># repo: xikasan/xsim path: /xsim/__init__.py # coding: utf-8 from .rungekutta import * from .time <|fim_middle|>import * from .logger import * from .batch import * fr
code_fim
easy
{ "lang": "python", "repo": "xikasan/xsim", "path": "/xsim/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xikasan/xsim path: /xsim/__init__.py # coding: utf-8 from .rungekutta import * from .time <|fim_suffix|>om . import models from .models.base import * from .models.filter import * from .models.transferfunc import *<|fim_middle|>import * from .logger import * from .batch import * fr
code_fim
easy
{ "lang": "python", "repo": "xikasan/xsim", "path": "/xsim/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cityofaustin/joplin path: /joplin/pages/form_container/models.py from django.db import models from modelcluster.fields import ParentalKey from modelcluster.models import ClusterableModel from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, PageChooserPanel from base.forms import For...
code_fim
hard
{ "lang": "python", "repo": "cityofaustin/joplin", "path": "/joplin/pages/form_container/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> description = models.TextField(verbose_name='Form description', blank=True) form_url = models.URLField( verbose_name='Enter the URL of your Formstack form', help_text='This link can be found under Share > "Link to this form on your website or email:"', blank=True, ) ...
code_fim
hard
{ "lang": "python", "repo": "cityofaustin/joplin", "path": "/joplin/pages/form_container/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }