text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> if not myStack.isEmpty(): return "Invalid" return "Valid" if __name__ == "__main__": print(checkValid(validSample)) print(checkValid(invalidSample)) print(checkValid(invalidSample2))<|fim_prefix|># repo: vivekkhimani/DataStructuresAndAlgorithmsPractice path: /StacksAndQueues/Applications_And_Inte...
code_fim
hard
{ "lang": "python", "repo": "vivekkhimani/DataStructuresAndAlgorithmsPractice", "path": "/StacksAndQueues/Applications_And_Interview/SymbolCheck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: drewstone/dynamic-governance path: /gov.py import math import vcg import constants from errors import value_error import statistics import copy class Government(object): def __init__(self, options): super(Government, self).__init__() self.prev_param = None self.param...
code_fim
hard
{ "lang": "python", "repo": "drewstone/dynamic-governance", "path": "/gov.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if majority_index == 0: return self.param - 1, None if majority_index == 1: return self.param, None else: return self.param + 1, None def vcg_selection(self, reports): # find social welfare maximizing parameter given capacity reports...
code_fim
hard
{ "lang": "python", "repo": "drewstone/dynamic-governance", "path": "/gov.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeepCognition/KittiBox path: /evals/kitti_eval.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Trains, evaluates and saves the MediSeg model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import subprocess import s...
code_fim
hard
{ "lang": "python", "repo": "DeepCognition/KittiBox", "path": "/evals/kitti_eval.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if validation and i % 15 == 0: image_name = os.path.basename(pred_anno.imageName) image_name = os.path.join(img_dir, image_name) scp.misc.imsave(image_name, new_img) if validation: image_name = os.path.basename(pred_anno.imageName) ...
code_fim
hard
{ "lang": "python", "repo": "DeepCognition/KittiBox", "path": "/evals/kitti_eval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nkato/psd-tools2 path: /src/psd_tools/decoder/decoder.py # -*- coding: utf-8 -*- from __future__ import absolute_import from . import image_resources, tagged_blocks, color import io from psd_tools.constants import TaggedBlock def parse(reader_parse_result): """ Decode :py:class:`~psd_t...
code_fim
hard
{ "lang": "python", "repo": "nkato/psd-tools2", "path": "/src/psd_tools/decoder/decoder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # XXX: this code is complicated because of the namedtuple abuse layer_and_mask_data = layer_and_mask_data._replace( layers=_layers, global_mask_info=_global_mask_info, tagged_blocks=_tagged_blocks ) reader_parse_result = reader_parse_result._replace( image_...
code_fim
hard
{ "lang": "python", "repo": "nkato/psd-tools2", "path": "/src/psd_tools/decoder/decoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def decode_layers(layers, version): if layers.layer_count == 0: return layers _layer_records = [ record._replace( tagged_blocks=tagged_blocks.decode(record.tagged_blocks, version) ) for record in layers.layer_records ] return layers._replace(layer_reco...
code_fim
hard
{ "lang": "python", "repo": "nkato/psd-tools2", "path": "/src/psd_tools/decoder/decoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PhilaController/phlcensus path: /phlcensus/acs/employment.py from .core import ACSDataset, approximate_ratio, approximate_sum import collections __all__ = ["EmploymentStatus", "EmploymentAge", "HoursWorked"] class EmploymentStatus(ACSDataset): """ Employment status for the population 1...
code_fim
hard
{ "lang": "python", "repo": "PhilaController/phlcensus", "path": "/phlcensus/acs/employment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # cols to sum over cols_to_sum = [f"{tag}_{f}" for f in group_list] # do the aggregation newcols = [f"{tag}_{groupset}", f"{tag}_{groupset}_moe"] df[newcols] = df.apply(approximate_sum, cols=cols_to_sum, axis=1) retu...
code_fim
hard
{ "lang": "python", "repo": "PhilaController/phlcensus", "path": "/phlcensus/acs/employment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # the columns to sum cols_to_sum = [f"{tag}_{g}" for tag in ["male", "female"]] # approximate the sum new_cols = [f"total_{g}", f"total_{g}_moe"] df[new_cols] = df.apply(approximate_sum, cols=cols_to_sum, axis=1) # Calculate custom grou...
code_fim
hard
{ "lang": "python", "repo": "PhilaController/phlcensus", "path": "/phlcensus/acs/employment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': opt = parser.parse_args() config_path = opt.model_config_path print(opt) cuda = torch.cuda.is_available() and opt.use_cuda os.makedirs(opt.checkpoint_dir, exist_ok=True) os.makedirs(opt.log_dir, exist_ok=True) # Get data configuration train_pa...
code_fim
hard
{ "lang": "python", "repo": "LiamLYJ/YOLOv3", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LiamLYJ/YOLOv3 path: /train.py from __future__ import division from models import * from utils.utils import * from utils.datasets import * from utils.parse_config import * import os import sys import time import datetime import argparse import torch from torch.utils.data import DataLoader from...
code_fim
hard
{ "lang": "python", "repo": "LiamLYJ/YOLOv3", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anaconda-Platform/anaconda-project path: /anaconda_project/internal/cli/prepare_with_mode.py # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2016, Anaconda, Inc. All rights reserved. # # Licensed under the terms of the BSD 3-...
code_fim
hard
{ "lang": "python", "repo": "Anaconda-Platform/anaconda-project", "path": "/anaconda_project/internal/cli/prepare_with_mode.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># ASK_QUESTIONS mode is supposed to ask about default actions too, # like whether to start servers. It isn't implemented yet. UI_MODE_TEXT_ASK_QUESTIONS = "ask" UI_MODE_TEXT_DEVELOPMENT_DEFAULTS_OR_ASK = "development_defaults_or_ask" UI_MODE_TEXT_ASSUME_YES_PRODUCTION = "production_defaults" UI_MODE_TEXT...
code_fim
hard
{ "lang": "python", "repo": "Anaconda-Platform/anaconda-project", "path": "/anaconda_project/internal/cli/prepare_with_mode.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def _interactively_fix_missing_variables(project, result): """Return True if we need to re-prepare.""" if project.problems: return False if not console_utils.stdin_is_interactive(): return False # We don't ask the user to manually enter CONDA_PREFIX # (CondaEnvRequire...
code_fim
hard
{ "lang": "python", "repo": "Anaconda-Platform/anaconda-project", "path": "/anaconda_project/internal/cli/prepare_with_mode.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ireval/cwl path: /cwl/ruler/ranking.py import numpy as np class Ranking(object): def __init__(self, topic_id, gains, costs, max_gain=1.0, min_gain=0.0, max_cost=1.0, min_cost=1.0, max_n=1000): """ The ranking object encapsulates the data about the items in the ranked...
code_fim
hard
{ "lang": "python", "repo": "ireval/cwl", "path": "/cwl/ruler/ranking.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ For a given document and element type returns the cost given the cost dictionary (cost_lookup) if no cost lookup exists or if the element is not in the dictionary, a nan value is assigned. :param doc_id: string :param element_type: string :return: r...
code_fim
hard
{ "lang": "python", "repo": "ireval/cwl", "path": "/cwl/ruler/ranking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if done==True: env.render() print(reward) if reward == 20: print("*** Success *** \n\n") time.sleep(3) else: print("*** Wrong drop ***\n\n") time.sleep(3) break ...
code_fim
hard
{ "lang": "python", "repo": "anushaihalapathirana/Gym-environmets-Solutions", "path": "/taxiv3/taxiv3-q-learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> exploration_rate = min_exploration_rate + (max_exploration_rate - min_exploration_rate)*np.exp(-exploration_decay_rate*episode) reward_all_episodes.append(current_episode_reward) #calculate the average reward per 1000 episodes rewards_per_thousand_episodes = np.split(np.array(reward_all_episodes...
code_fim
hard
{ "lang": "python", "repo": "anushaihalapathirana/Gym-environmets-Solutions", "path": "/taxiv3/taxiv3-q-learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anushaihalapathirana/Gym-environmets-Solutions path: /taxiv3/taxiv3-q-learning.py import numpy as np import time import random import gym env = gym.make("Taxi-v3") state_space = env.observation_space.n action_space = env.action_space.n # define q table q_table = np.zeros((state_space, action...
code_fim
hard
{ "lang": "python", "repo": "anushaihalapathirana/Gym-environmets-Solutions", "path": "/taxiv3/taxiv3-q-learning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: raphaelgyory/gilded_rose_refactoring_kata path: /tests/test_gilded_rose_refactoring_kata.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `gilded_rose_refactoring_kata` package.""" import pytest from click.testing import CliRunner from gilded_rose_refactoring_kata import gilded_r...
code_fim
medium
{ "lang": "python", "repo": "raphaelgyory/gilded_rose_refactoring_kata", "path": "/tests/test_gilded_rose_refactoring_kata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Make sure legacy data keeps working. """ manager.update() compare_results_attrs(manager.items, fixtures.FIXTURES[1]) def test_day_11(manager): manager.update(days=10) compare_results_attrs(manager.items, fixtures.FIXTURES[11]) def test_limits(manager): """ Makes sure 0 < qu...
code_fim
medium
{ "lang": "python", "repo": "raphaelgyory/gilded_rose_refactoring_kata", "path": "/tests/test_gilded_rose_refactoring_kata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sys.path.append(libDir) print (os.path) import x, y print ('hi')<|fim_prefix|># repo: John-Colvin/pyd path: /examples/misc/d_and_c/test.py import os.path, sys import distutils.util libDir = os.path.join<|fim_middle|>('build', 'lib.%s-%s' % ( distutils.util.get_platform(), '.'.join(str(v) for v in...
code_fim
medium
{ "lang": "python", "repo": "John-Colvin/pyd", "path": "/examples/misc/d_and_c/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: John-Colvin/pyd path: /examples/misc/d_and_c/test.py import os.path, sys import distutils.util libDir = os.path.join('build', 'lib.%s-%s' % ( distutils.util.get_platform(), <|fim_suffix|>sys.path.append(libDir) print (os.path) import x, y print ('hi')<|fim_middle|> '.'.join(str(v) for v in...
code_fim
medium
{ "lang": "python", "repo": "John-Colvin/pyd", "path": "/examples/misc/d_and_c/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '.'.join(str(v) for v in sys.version_info[:2]) )) import sys sys.path.append(libDir) print (os.path) import x, y print ('hi')<|fim_prefix|># repo: John-Colvin/pyd path: /examples/misc/d_and_c/test.py import os.path, sys import distutils.util libDir = os.path.join<|fim_middle|>('build', 'lib.%s-%s' % ( ...
code_fim
medium
{ "lang": "python", "repo": "John-Colvin/pyd", "path": "/examples/misc/d_and_c/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zjt9101/doubleml-for-py path: /doubleml/tests/test_plr.py import numpy as np import pytest import math import scipy from sklearn.base import clone from sklearn.linear_model import LinearRegression, Lasso from sklearn.ensemble import RandomForestRegressor import doubleml as dml from ._utils im...
code_fim
hard
{ "lang": "python", "repo": "zjt9101/doubleml-for-py", "path": "/doubleml/tests/test_plr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> obj_dml_data = dml.DoubleMLData(data, 'y', ['d'], x_cols) dml_plr_obj = dml.DoubleMLPLR(obj_dml_data, ml_g, ml_m, n_folds, score=score, dml_procedure=dml_procedur...
code_fim
hard
{ "lang": "python", "repo": "zjt9101/doubleml-for-py", "path": "/doubleml/tests/test_plr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: appressoas/django_cradmin path: /django_cradmin/tests/test_sortable/cradmin_sortable_testapp/models.py """ An example app using Sortable. """ from django.db import models from django_cradmin.sortable.models import SortableBase, SortableQuerySetBase class ItemContainer(models.Model): """ ...
code_fim
medium
{ "lang": "python", "repo": "appressoas/django_cradmin", "path": "/django_cradmin/tests/test_sortable/cradmin_sortable_testapp/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class SortableItemQuerySet(SortableQuerySetBase): """ Sortable items that inherit SortableBase must also have a queryset that inherits SortableQuerySetBase. The `parent_attribute` must be set, and it must have the name of the parent in which the items belong. """ parent_attrib...
code_fim
hard
{ "lang": "python", "repo": "appressoas/django_cradmin", "path": "/django_cradmin/tests/test_sortable/cradmin_sortable_testapp/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iabok/sales-tracker path: /web/sales_app/apps/accounts/urls.py from django.conf.urls import url from accounts.views import Ac<|fim_suffix|>^accounts/add/$', AccountsFormView.as_view(), name='signup'), ]<|fim_middle|>countsFormView, accountsList urlpatterns = [ url(r'^accounts/$', accountsLis...
code_fim
medium
{ "lang": "python", "repo": "iabok/sales-tracker", "path": "/web/sales_app/apps/accounts/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ts/$', accountsList.as_view(), name='account-list'), url(r'^accounts/add/$', AccountsFormView.as_view(), name='signup'), ]<|fim_prefix|># repo: iabok/sales-tracker path: /web/sales_app/apps/accounts/urls.py from django.conf.urls import url from accounts.views import Ac<|fim_middle|>countsFormView, ac...
code_fim
medium
{ "lang": "python", "repo": "iabok/sales-tracker", "path": "/web/sales_app/apps/accounts/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Read the settings file and convert it to a dict.""" with open(self.settingsFilePath, 'r') as settingsFile: self.settings = json.loads(settingsFile.read()) @property def settingsFilePath(self): """Getter for the _settingsFileData attribute.""" return ...
code_fim
hard
{ "lang": "python", "repo": "Tehnix/PyIRCb", "path": "/src/settings.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tehnix/PyIRCb path: /src/settings.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Settings file reader """ import sys import json import src.utilities as util DEFAULT_SETTINGS_PATH = 'pybot.conf' DEFAULT_CONF = '{\n\ "nickname": "Innocence",\n\ "realname": "Motoko Kusanagi",\n\ ...
code_fim
hard
{ "lang": "python", "repo": "Tehnix/PyIRCb", "path": "/src/settings.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lint-ai/vibora path: /tests/cache.py import time from multiprocessing import Manager from vibora import Vibora, Request, Hook from vibora.hooks import Events from vibora.cache import Static, CacheEngine from vibora.responses import JsonResponse from vibora.tests import TestSuite class CacheTest...
code_fim
hard
{ "lang": "python", "repo": "lint-ai/vibora", "path": "/tests/cache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with app.test_client() as client: response1 = await client.get('/') response2 = await client.get('/') self.assertEqual(len(calls), 1) self.assertEqual(response1.content, response2.content) async def test_async_cache_engine_not_skipping_hooks(self): ...
code_fim
hard
{ "lang": "python", "repo": "lint-ai/vibora", "path": "/tests/cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Loopring/hummingbot path: /test/test_config_security.py #!/usr/bin/env python from os.path import ( join, realpath, ) import sys; sys.path.insert(0, realpath(join(__file__, "../../"))) import unittest from hummingbot.client.config.security import Security from hummingbot.client import se...
code_fim
hard
{ "lang": "python", "repo": "Loopring/hummingbot", "path": "/test/test_config_security.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def _test_existing_password(self): # check the 2 encrypted files exist self.assertTrue(os.path.exists(f"{temp_folder}encrypted_test_key_1.json")) self.assertTrue(os.path.exists(f"{temp_folder}encrypted_test_key_2.json")) self.assertTrue(Security.any_encryped_files...
code_fim
hard
{ "lang": "python", "repo": "Loopring/hummingbot", "path": "/test/test_config_security.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def tearDown(self): shutil.rmtree(temp_folder) def test_new_password_process(self): # empty folder, new password is required self.assertFalse(Security.any_encryped_files()) self.assertTrue(Security.new_password_required()) # login will pass with any passwor...
code_fim
medium
{ "lang": "python", "repo": "Loopring/hummingbot", "path": "/test/test_config_security.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.time1 = np.dot(m.tau1,m.tf1()) self.time2 = np.dot(m.tau2,m.tf2())+m.tf1() # states self.x1 = [m.x1[t]() * m.x_scale for t in m.tau1] self.y1 = [m.y1[t]() * m.y_scale for t in m.tau1] self.theta1 = [m.theta1[t]() * m.theta_scale for t in m.tau...
code_fim
medium
{ "lang": "python", "repo": "sandialabs/pyomo_optimization_example_problems", "path": "/planar_problem_multiphase/utilities/VarContainer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sandialabs/pyomo_optimization_example_problems path: /planar_problem_multiphase/utilities/VarContainer.py # -*- coding: utf-8 -*- import numpy as np # Store the values of the optimal solution class VarContainer(): def __init__(self, m): <|fim_suffix|> # states s...
code_fim
medium
{ "lang": "python", "repo": "sandialabs/pyomo_optimization_example_problems", "path": "/planar_problem_multiphase/utilities/VarContainer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.x2 = [m.x2[t]() * m.x_scale for t in m.tau2] self.y2 = [m.y2[t]() * m.y_scale for t in m.tau2] self.theta2 = [m.theta2[t]() * m.theta_scale for t in m.tau2] self.v2 = [m.v2[t]() * m.v_scale for t in m.tau2] self.omega2 = [m.omega2[t]() * m.omega_scale for t in ...
code_fim
hard
{ "lang": "python", "repo": "sandialabs/pyomo_optimization_example_problems", "path": "/planar_problem_multiphase/utilities/VarContainer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ppolxda/restkit path: /restkit/gen/errors_trans/make_error_info.py # -*- coding: utf-8 -*- """ Created on 2019-10-11 19:30:45. @author: name """ import re import os import csv import codecs import pkg_resources from tornado.template import Template from tornado.options import options, define FP...
code_fim
hard
{ "lang": "python", "repo": "ppolxda/restkit", "path": "/restkit/gen/errors_trans/make_error_info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if i[1] in default_error_enum: raise TypeError('csv enum duplicate [{}]'.format(i)) error_data = error_data else: error_data = [] template = Template(error_jinja) make_data = template.generate(**{ 'service': options.service, ...
code_fim
hard
{ "lang": "python", "repo": "ppolxda/restkit", "path": "/restkit/gen/errors_trans/make_error_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Result(success=True,error=None, result=result),status def containStr(list,str): for s in list: if s == str: return True return False def getInt(s): try: v = int(s) return v,None except Exception as inst: return None,str(inst) def ge...
code_fim
medium
{ "lang": "python", "repo": "relax-space/python-api", "path": "/controllers/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: relax-space/python-api path: /controllers/utils.py from flask import Response import json from controllers.type_result import Error,Result <|fim_suffix|>def getIntNone(s): try: if s ==None: return 0,None v = int(s) return v,None except Exception as ins...
code_fim
hard
{ "lang": "python", "repo": "relax-space/python-api", "path": "/controllers/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def getIntNone(s): try: if s ==None: return 0,None v = int(s) return v,None except Exception as inst: return None,str(inst)<|fim_prefix|># repo: relax-space/python-api path: /controllers/utils.py from flask import Response import json from controllers.t...
code_fim
medium
{ "lang": "python", "repo": "relax-space/python-api", "path": "/controllers/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mnakao/GraphGolf path: /scripts/generalTogrid.py #!/usr/bin/python2.7 # coding: utf-8 import argparse import os argumentparser = argparse.ArgumentParser() argumentparser.add_argument("edges_path", help="Input edgelist file path") argumentparser.add_argument('-W', required=True, type=int) argument...
code_fim
medium
{ "lang": "python", "repo": "mnakao/GraphGolf", "path": "/scripts/generalTogrid.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> f = open(args.edges_path, "r") for line in f: data = line.split() print("{},{} {},{}".format(int(data[0])/height, int(data[0])%height, int(data[1])/height, int(data[1])%height)) f.close() if __name__ == '__main__': main()<|fim_prefix|># repo: mnakao/GraphGolf ...
code_fim
hard
{ "lang": "python", "repo": "mnakao/GraphGolf", "path": "/scripts/generalTogrid.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def handler500(request): """500 error handler which includes ``request`` in the context. Templates: `500.html` Context: None """ import sys,traceback from django.template import Context, loader from django.http import HttpResponseServerError t = loader.get_template('500.h...
code_fim
hard
{ "lang": "python", "repo": "LucasMagnum/pyexplain", "path": "/pyexplain/pyexplain/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LucasMagnum/pyexplain path: /pyexplain/pyexplain/urls.py from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.views import generic from django.contrib import admin admin.autodiscover() urlpatterns = patterns(...
code_fim
medium
{ "lang": "python", "repo": "LucasMagnum/pyexplain", "path": "/pyexplain/pyexplain/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Defender allies (Name/ID):") for k,v in battle_info.defender_allies.items(): print "\t",k,v['id'] print("-"*30) except ValueError: print("Invalid battle ID, try again...") # Output # Enter battle id: # >>>39841 # TH (attacker) VS HR (defender) # ...
code_fim
hard
{ "lang": "python", "repo": "nikolak/erepAPI", "path": "/docs/examples/battle_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikolak/erepAPI path: /docs/examples/battle_example.py #Ask for battle/resistance ID from user then show battle info #Python 2.7, change raw_input to input for 3.x version from erepapi import api, Battle api.public_key="your public key goes here" api.private_key="your private key goes here" wh...
code_fim
hard
{ "lang": "python", "repo": "nikolak/erepAPI", "path": "/docs/examples/battle_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> battle_info=Battle(39841) try: print("{} (attacker) VS {} (defender)".format(battle_info.attacker_initials, battle_info.defender_initials)) print("Battle:{}; for {}\nResistance:{}\nStarted:{}\nEnded:{}".format(battle_info.id, ...
code_fim
hard
{ "lang": "python", "repo": "nikolak/erepAPI", "path": "/docs/examples/battle_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture def connection(dbsession): return dbsession.connection()<|fim_prefix|># repo: cgons/dbinspector path: /tests/conftest.py import pytest import sqlalchemy as sa from sqlalchemy.orm import sessionmaker @pytest.fixture def engine(): engine = sa.create_engine("postgresql://postgres@...
code_fim
hard
{ "lang": "python", "repo": "cgons/dbinspector", "path": "/tests/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cgons/dbinspector path: /tests/conftest.py import pytest import sqlalchemy as sa from sqlalchemy.orm import sessionmaker <|fim_suffix|> @pytest.fixture def dbsession(engine): Session = sessionmaker(bind=engine) session = Session() return session @pytest.fixture def connection(dbses...
code_fim
hard
{ "lang": "python", "repo": "cgons/dbinspector", "path": "/tests/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Process archive file. Extract it and insert GamesDeals submissions into database. :param config: :param archive_file: :return: """ logger = logging.getLogger(__name__) logger.info(f"Processing file {archive_file.name} ") conn = psycopg2.connect(config.psql_conn_str...
code_fim
hard
{ "lang": "python", "repo": "mikolajkalwa/pushshift-downloader", "path": "/src/data_processor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> submissions_found = 0 with conn: proc = archive.decompress(archive_file) for line in io.TextIOWrapper(proc.stdout, encoding='utf-8'): if line: try: submission = json.loads(line) if submission.get('subreddit') == c...
code_fim
hard
{ "lang": "python", "repo": "mikolajkalwa/pushshift-downloader", "path": "/src/data_processor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikolajkalwa/pushshift-downloader path: /src/data_processor.py import io import json import logging import os from datetime import datetime from pathlib import Path import psycopg2 from src import archive from src.config import Config def get_already_processed_files(config: Config) -> list[st...
code_fim
hard
{ "lang": "python", "repo": "mikolajkalwa/pushshift-downloader", "path": "/src/data_processor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BackupTheBerlios/cl-calc-svn path: /trunk/src/cl-calc/interpreter/ast.py # ------------------------------------------------------------ # # ast.py - abstract syntax tree. Defines a bunch of # functions that evaluate an expression from # the context free grammar # # The r...
code_fim
hard
{ "lang": "python", "repo": "BackupTheBerlios/cl-calc-svn", "path": "/trunk/src/cl-calc/interpreter/ast.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.symtable = symbol_table.SymbolTable() #XXX num1 and num2 are bad names - can be any type of object def binop(self, num1, num2, symbol): if symbol == '+': return lib.builtin.add(num1, num2) elif symbol == '-': return lib.builtin.subtract(num1, n...
code_fim
medium
{ "lang": "python", "repo": "BackupTheBerlios/cl-calc-svn", "path": "/trunk/src/cl-calc/interpreter/ast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.user = User.create("pytest", "pytest") self.group = Group.create("name") if self.user is None: self.user = User.find_by_username("pytest") self.window = Window.create(time.time(), 1000, self.group.obj["_id"]) def teardown(self): print("\nTearin...
code_fim
hard
{ "lang": "python", "repo": "Sailer43/Whistle", "path": "/server/tests/test_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sailer43/Whistle path: /server/tests/test_models.py import os import tempfile import pytest import time from .context import make_app, mongo, User, Window, Group class TestUser: def setup(self): self.user = User.create("pytest", "pytest") self.group = Group.create("name") ...
code_fim
hard
{ "lang": "python", "repo": "Sailer43/Whistle", "path": "/server/tests/test_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Benardakaka/Blog-Site path: /app/main/forms.py from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, SubmitField, SelectField from wtforms.validators import Required, DataRequired class BlogForm(FlaskForm): <|fim_suffix|> comment = TextAreaField("Comment") submi...
code_fim
hard
{ "lang": "python", "repo": "Benardakaka/Blog-Site", "path": "/app/main/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SubscriberForm(FlaskForm): email = StringField('Your Email Address') name = StringField('Enter your name',validators = [Required()]) submit = SubmitField('Subscribe')<|fim_prefix|># repo: Benardakaka/Blog-Site path: /app/main/forms.py from flask_wtf import FlaskForm from wtforms import ...
code_fim
medium
{ "lang": "python", "repo": "Benardakaka/Blog-Site", "path": "/app/main/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BayLee001/gntp path: /gntp/lookup/faiss.py # -*- coding: utf-8 -*- try: import faiss except ImportError: from gntp.lookup.nms import NMSLookupIndex class FAISSLookupIndex(NMSLookupIndex): pass else: import numpy as np from gntp.lookup.base import BaseLookupIndex ...
code_fim
hard
{ "lang": "python", "repo": "BayLee001/gntp", "path": "/gntp/lookup/faiss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _build_approximate_index(self, data: np.ndarray): dimensionality = data.shape[1] nlist = 100 if data.shape[0] > 100 else 2 if self.kernel_name in {'rbf'}: quantizer = faiss.IndexFlatL2(dimensionality) ...
code_fim
hard
{ "lang": "python", "repo": "BayLee001/gntp", "path": "/gntp/lookup/faiss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>KEY = {"UP": 1, "DOWN": 2, "LEFT": 3, "RIGHT": 4} # Deep Learning Params IMG_SIZE = 84 BATCH_SIZE = 64 GAMMA = 0.999 EPS_START = 0.9 EPS_END = 0.01 EPS_DECAY = 1500 EPOCHS = 10_000 TARGET_UPDATE = 1_000 MODEL_SAVE = 20_000 MEM_LENGTH = 7_000 MEM_CLEAN_SIZE = 7_000 LEARNING_RATE = 1e-7 MOMENTUM = 0.95<|fi...
code_fim
hard
{ "lang": "python", "repo": "dmytroleonenko/snakeplissken", "path": "/configs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmytroleonenko/snakeplissken path: /configs.py import numpy as np FPS = 5000 FPS_PLAY = 48 W_WIDTH, W_HEIGHT = 150, 150 BLACK = np.array([0, 0, 0]) GRAY = np.array([128, 128, 128]) CRIMSON = np.array([220, 20, 60]) WHITE = np.array([255, 255, 255]) GREEN = np.array([34, 139, 34]) SNAKE_SIZE =...
code_fim
medium
{ "lang": "python", "repo": "dmytroleonenko/snakeplissken", "path": "/configs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def db_user(func): @wraps(func) def decorated_view(*args, **kwargs): res = func(*args, **kwargs) return res return decorated_view<|fim_prefix|># repo: norserage/scoring path: /ScoringEngine/ScoringEngine/web/flask_utils.py from flask_login import current_user from functools im...
code_fim
hard
{ "lang": "python", "repo": "norserage/scoring", "path": "/ScoringEngine/ScoringEngine/web/flask_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: norserage/scoring path: /ScoringEngine/ScoringEngine/web/flask_utils.py from flask_login import current_user from functools import wraps from flask import render_template <|fim_suffix|> if current_user.group >= group: return func(*args, **kwargs) return ren...
code_fim
medium
{ "lang": "python", "repo": "norserage/scoring", "path": "/ScoringEngine/ScoringEngine/web/flask_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> res = func(*args, **kwargs) return res return decorated_view<|fim_prefix|># repo: norserage/scoring path: /ScoringEngine/ScoringEngine/web/flask_utils.py from flask_login import current_user from functools import wraps from flask import render_template def require_group(group): ...
code_fim
medium
{ "lang": "python", "repo": "norserage/scoring", "path": "/ScoringEngine/ScoringEngine/web/flask_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Comment fields = ('comment', 'date_created', 'user', 'avatar_image')<|fim_prefix|># repo: fergalmoran/dss path: /api/serialisers.py from rest_framework import serializers from spa.models.comment import Comment <|fim_middle|>class CommentSerialiser(serializers.Hyp...
code_fim
medium
{ "lang": "python", "repo": "fergalmoran/dss", "path": "/api/serialisers.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fergalmoran/dss path: /api/serialisers.py from rest_framework import serializers from spa.models.comment import Comment class CommentSerialiser(serializers.HyperlinkedModelSerializer): user = serializers.RelatedField(many=False) avatar_image = serializers.Field(source='avatar_image') <...
code_fim
easy
{ "lang": "python", "repo": "fergalmoran/dss", "path": "/api/serialisers.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self._chameleon_1 = Chameleon() self._chameleon_2 = Chameleon() super(DoubleChameleon, self).__init__() def function( self, x, y, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2,...
code_fim
hard
{ "lang": "python", "repo": "ajshajib/lenstronomy", "path": "/lenstronomy/LensModel/Profiles/chameleon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajshajib/lenstronomy path: /lenstronomy/LensModel/Profiles/chameleon.py y_2 return f_x, f_y def hessian(self, x, y, alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0): """ :param x: ra-coordinate :param y: dec-coordinate :param alpha_1: deflection ang...
code_fim
hard
{ "lang": "python", "repo": "ajshajib/lenstronomy", "path": "/lenstronomy/LensModel/Profiles/chameleon.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def function( self, x, y, alpha_1, ratio12, ratio13, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, w_c3, w_t3, e13, e23, center_x=0, center_y=0,...
code_fim
hard
{ "lang": "python", "repo": "ajshajib/lenstronomy", "path": "/lenstronomy/LensModel/Profiles/chameleon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AntoninoScala/air-water-vv path: /2d/benchmarks/wavesloshing/wavesloshing.py """ Wavesloshing Problem """ import numpy as np from math import cos from proteus import (Domain, Context, FemTools as ft, MeshTools as mt, WaveTools as wt) ...
code_fim
hard
{ "lang": "python", "repo": "AntoninoScala/air-water-vv", "path": "/2d/benchmarks/wavesloshing/wavesloshing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def d_phi1_d_y(x, y, t, h, w0): return 2.*3./(16.*np.cosh(2.*h))*(w0-w0**(-7))*np.sin(2.*t)*np.cos(2.*x)*np.sinh(2.*(y+h)) def d_phi2_d_t(x, y, t, h, w0): beta13 = 1./(128.*np.cosh(3.*h))*(1+3*w0**4)*(3*w0**(-9)-5.*w0**(-1)+2*w0**3) beta31 = 1./(128.*np.cosh(h))*(9.*w0**(-9)+62.*w0**(-5)-...
code_fim
hard
{ "lang": "python", "repo": "AntoninoScala/air-water-vv", "path": "/2d/benchmarks/wavesloshing/wavesloshing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r""" converts nitro response into object and returns the object array in case of get request. """ try : result = service.payload_formatter.string_to_resource(rewriteaction_response, response, self.__class__.__name__) if(result.errorcode != 0) : if (result.errorcode == 444) : service.c...
code_fim
hard
{ "lang": "python", "repo": "MayankTahil/nitro-ide", "path": "/nitro-python-1.0/nssrc/com/citrix/netscaler/nitro/resource/config/rewrite/rewriteaction.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MayankTahil/nitro-ide path: /nitro-python-1.0/nssrc/com/citrix/netscaler/nitro/resource/config/rewrite/rewriteaction.py re_all, insert_after_all, clientless_vpn_encode, clientless_vpn_encode_all, clientless_vpn_decode, clientless_vpn_decode_all, insert_sip_header, delete_sip_header, corrupt_sip_h...
code_fim
hard
{ "lang": "python", "repo": "MayankTahil/nitro-ide", "path": "/nitro-python-1.0/nssrc/com/citrix/netscaler/nitro/resource/config/rewrite/rewriteaction.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UniversitaDellaCalabria/uniAuth path: /uniauth_saml2_idp/models.py import defusedxml import logging import os import json import requests import saml2.xmldsig from datetime import timedelta from django.conf import settings from django.db import models from django.utils import timezone from djang...
code_fim
hard
{ "lang": "python", "repo": "UniversitaDellaCalabria/uniAuth", "path": "/uniauth_saml2_idp/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class MetadataStore(models.Model): MDStype = (('remote', 'remote'), ('mdq', 'mdq'), ('local', 'local')) name = models.CharField(max_length=256) url = models.CharField(max_length=255, blank=True, null=True, he...
code_fim
hard
{ "lang": "python", "repo": "UniversitaDellaCalabria/uniAuth", "path": "/uniauth_saml2_idp/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: komal3120/freshlybuiltimagebol path: /freshlybuiltimagebol/__init__.py # Class import from freshlybuiltimagebol.photo_se_nikali_awaj import PhotoAwaj fro<|fim_suffix|>photo_se_text import PhotoShabd from freshlybuiltimagebol.natural_photo_se_text import NaturalPhotoShabd from freshlybuiltimagebo...
code_fim
medium
{ "lang": "python", "repo": "komal3120/freshlybuiltimagebol", "path": "/freshlybuiltimagebol/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ort NaturalPhotoShabd from freshlybuiltimagebol.OCR_Printed_Text import ImageProcess<|fim_prefix|># repo: komal3120/freshlybuiltimagebol path: /freshlybuiltimagebol/__init__.py # Class import from freshlybuiltimagebol.photo_se_nikali_awaj import PhotoAwaj from freshlybuiltimagebol.text_bol_uthega import...
code_fim
medium
{ "lang": "python", "repo": "komal3120/freshlybuiltimagebol", "path": "/freshlybuiltimagebol/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_contract_uri_updates(nft, beneficiary): nft.setContractURI("test", {"from": beneficiary}) assert nft.contractURI() == "ipfs://test"<|fim_prefix|># repo: pacdao/bonus-nft path: /tests/unitary/test_metadata.py import brownie def test_token_uri_ipfs(nft_minted): assert nft_minted.tok...
code_fim
hard
{ "lang": "python", "repo": "pacdao/bonus-nft", "path": "/tests/unitary/test_metadata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pacdao/bonus-nft path: /tests/unitary/test_metadata.py import brownie def test_token_uri_ipfs(nft_minted): assert nft_minted.tokenURI(1)[0:7] == "ipfs://" def test_mints_with_updated_metadata(nft, owner, alice): new_data = "new_uri" nft.setDefaultMetadata(new_data, {"from": owner}...
code_fim
medium
{ "lang": "python", "repo": "pacdao/bonus-nft", "path": "/tests/unitary/test_metadata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('weixin', '0002_auto_20200409_1738'), ] operations = [ migrations.AddField( model_name='resourcemessage', name='resource_code', field=models.IntegerField(default=999999, unique=True, ...
code_fim
easy
{ "lang": "python", "repo": "qui910/wechat", "path": "/home/ubuntu/wechat/weixin/migrations/0003_resourcemessage_resource_code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qui910/wechat path: /home/ubuntu/wechat/weixin/migrations/0003_resourcemessage_resource_code.py # Generated by Django 3.0.4 on 2020-04-11 05:38 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('weixin', '0002_auto_20200409_1738'), ] operations = [ ...
code_fim
easy
{ "lang": "python", "repo": "qui910/wechat", "path": "/home/ubuntu/wechat/weixin/migrations/0003_resourcemessage_resource_code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.current_portfolio['cash'] -= unit_px * qty if ticker in self.current_portfolio.keys(): self.current_portfolio[ticker] += qty else: self.current_portfolio[ticker] = qty self.trade_list.append(("buy", ticker, qty, unit_px)) def flat(se...
code_fim
hard
{ "lang": "python", "repo": "geome-mitbbs/QTS_Research", "path": "/Portfolio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geome-mitbbs/QTS_Research path: /Portfolio.py import numpy as np try: from . import Quant_Indicators as QI from . import Data_API except: import Quant_Indicators as QI import Data_API class Portfolio: def __init__(self,init_cash_amt=0,init_pos=None,allow_short_...
code_fim
hard
{ "lang": "python", "repo": "geome-mitbbs/QTS_Research", "path": "/Portfolio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yunjung-lee/class_python_data path: /day10_02_Q.py ##여러개의 대용량 csv --> SQLite from tkinter import * from tkinter.simpledialog import * from tkinter.filedialog import * import csv import json import os import os.path import xlrd import xlwt import sqlite3 import pymysql import glob ...
code_fim
hard
{ "lang": "python", "repo": "yunjung-lee/class_python_data", "path": "/day10_02_Q.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sql = "SELECT * FROM " + name cur.execute(sql) while True: row = cur.fetchone() if row == None: break for ii in range(1,len(row)) : cNameList.append(str(row[ii])) data_list = ','.join(cNameLi...
code_fim
hard
{ "lang": "python", "repo": "yunjung-lee/class_python_data", "path": "/day10_02_Q.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> row = cur.fetchone() if row == None: break cNameList.append(row[0]) for name in cNameList: fileName = input_file+'/'+name+'.csv' print(fileName) filewriter = open(fileName,'w', newline='') csvWrite = csv.writer(filewriter) sql = "SELECT *...
code_fim
hard
{ "lang": "python", "repo": "yunjung-lee/class_python_data", "path": "/day10_02_Q.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: harshp8l/deep-learning-lang-detection path: /data/test/python/f718df30f82beb6e6e21b89a28a1753ce7989932manage_cases_tool.py from ert_gui.tools.manage_cases.case_init_configuration import CaseInitializationConfigurationPanel from ert_gui.tools import Tool from ert_gui.widgets import util from ert_g...
code_fim
medium
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/test/python/f718df30f82beb6e6e21b89a28a1753ce7989932manage_cases_tool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dialog = ClosableDialog("Manage Cases", case_management_widget, self.parent()) dialog.exec_()<|fim_prefix|># repo: harshp8l/deep-learning-lang-detection path: /data/test/python/f718df30f82beb6e6e21b89a28a1753ce7989932manage_cases_tool.py from ert_gui.tools.manage_cases.case_init_configura...
code_fim
hard
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/test/python/f718df30f82beb6e6e21b89a28a1753ce7989932manage_cases_tool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> case_management_widget = CaseInitializationConfigurationPanel() dialog = ClosableDialog("Manage Cases", case_management_widget, self.parent()) dialog.exec_()<|fim_prefix|># repo: harshp8l/deep-learning-lang-detection path: /data/test/python/f718df30f82beb6e6e21b89a28a1753ce798993...
code_fim
hard
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/test/python/f718df30f82beb6e6e21b89a28a1753ce7989932manage_cases_tool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nantonel/ClassifierMetrics.jl path: /test/sklearn_fom.py import pandas as pd from sklearn.metrics import roc_curve, precision_recall_curve, auc <|fim_suffix|>precision , recall , _ = precision_recall_curve(list(df["labels"]), list(df["predictions"])) print("AUC PR {}".format(auc(recall,precisio...
code_fim
hard
{ "lang": "python", "repo": "nantonel/ClassifierMetrics.jl", "path": "/test/sklearn_fom.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pr_sklearn = pd.DataFrame({"precision":precision, "recall":recall}) pr_sklearn.to_csv("data/pr_sklearn.csv",index=False)<|fim_prefix|># repo: nantonel/ClassifierMetrics.jl path: /test/sklearn_fom.py import pandas as pd from sklearn.metrics import roc_curve, precision_recall_curve, auc df = pd.read_csv("...
code_fim
hard
{ "lang": "python", "repo": "nantonel/ClassifierMetrics.jl", "path": "/test/sklearn_fom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>roc_sklearn = pd.DataFrame({"fpr":fpr, "tpr":tpr, "op":threshold}) roc_sklearn.to_csv("data/roc_sklearn.csv",index=False) precision , recall , _ = precision_recall_curve(list(df["labels"]), list(df["predictions"])) print("AUC PR {}".format(auc(recall,precision))) pr_sklearn = pd.DataFrame({"precision":...
code_fim
medium
{ "lang": "python", "repo": "nantonel/ClassifierMetrics.jl", "path": "/test/sklearn_fom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }