text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: home-assistant/core path: /tests/components/mqtt/test_select.py ntry: MqttMockHAClientGenerator ) -> None: """Test that it fetches the given payload with a template.""" await mqtt_mock_entry() async_fire_mqtt_message(hass, "test/select_stat", '{"val":"milk"}') await hass.async_b...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/mqtt/test_select.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kwasnydam/coding_challanges path: /coursera/array_inversions_count/test_array_inversion_count.py import unittest import array_inversions_count class TestCountInversions(unittest.TestCase): def setUp(self): self.object_under_test = array_inversions_count.count_inversions ...
code_fim
medium
{ "lang": "python", "repo": "kwasnydam/coding_challanges", "path": "/coursera/array_inversions_count/test_array_inversion_count.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_data = [1] expected_value = 0 self._test_inversions_count(test_data, expected_value) def test_should_return_15_on_654321_input(self): test_data = [6, 5, 4, 3, 2, 1] expected_value = 15 self._test_inversions_count(test_data, expected_value) ...
code_fim
hard
{ "lang": "python", "repo": "kwasnydam/coding_challanges", "path": "/coursera/array_inversions_count/test_array_inversion_count.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_should_return_0_on_1_element_input(self): test_data = [1] expected_value = 0 self._test_inversions_count(test_data, expected_value) def test_should_return_15_on_654321_input(self): test_data = [6, 5, 4, 3, 2, 1] expected_value = 15 ...
code_fim
hard
{ "lang": "python", "repo": "kwasnydam/coding_challanges", "path": "/coursera/array_inversions_count/test_array_inversion_count.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def train(self, data, labels, C, scale=True, weights = True, mem_size=512): ''' Train the ELM Classifier ----------------------- Input: ------ data - (numpy array) - shape n x p n - number of observatio...
code_fim
hard
{ "lang": "python", "repo": "neurophysics/meet", "path": "/meet/elm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neurophysics/meet path: /meet/elm.py tives and negatives and is generally regarded as a balanced measure which can be used even if the classes are of very different sizes. The MCC is in essence a correlation coefficient between the observed and predicted binary classifications; it...
code_fim
hard
{ "lang": "python", "repo": "neurophysics/meet", "path": "/meet/elm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neurophysics/meet path: /meet/elm.py (TP + FP)/float(N) try: MCC = (TP/float(N) - S*P) / _np.sqrt(S*P*(1 - S)*(1 - P)) except: MCC = 0 return MCC def PPV2DR1(conf_matrix): """ Calculate the weighted average (WA) of Positive Preditive Value (PPV) and Detection Rate (DR): ...
code_fim
hard
{ "lang": "python", "repo": "neurophysics/meet", "path": "/meet/elm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(response.status_code, 201) # Created self.assertEqual(Measurement.objects.count(), 1) self.assertEqual(Alarm.objects.count(), 1) data = { "Measurements": [ { "date": measurement_time + 500, ...
code_fim
hard
{ "lang": "python", "repo": "sigurdsa/angelika-api", "path": "/measurement/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sigurdsa/angelika-api path: /measurement/tests.py from test.testcase import AngelikaAPITestCase from patient.models import Patient from measurement.models import Measurement from threshold_value.models import ThresholdValue from alarm.models import Alarm import time class PostMeasurementTests(A...
code_fim
hard
{ "lang": "python", "repo": "sigurdsa/angelika-api", "path": "/measurement/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def create_observation(self, loc): cur = {} cur['poses'] = [] cur['poses_in_arm'] = [] cur['last_seen'] = [] cur['labels'] = [] cur['counter'] = 0 cur['type'] = [] cur['blacklisted'] = False self.objects_at_location[loc].append(cu...
code_fim
hard
{ "lang": "python", "repo": "smARTLab-liv/smartlabatwork-release", "path": "/slaw_manipulation/src/object_manager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smARTLab-liv/smartlabatwork-release path: /slaw_manipulation/src/object_manager.py aw_srvs.srv import SwitchOnForLocation, SwitchOnForLocationResponse, GetObjectAtLocation, \ GetObjectAtLocationResponse, RemoveObjectAtLocation, RemoveObjectAtLocationResponse from collections import Counter M...
code_fim
hard
{ "lang": "python", "repo": "smARTLab-liv/smartlabatwork-release", "path": "/slaw_manipulation/src/object_manager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smARTLab-liv/smartlabatwork-release path: /slaw_manipulation/src/object_manager.py = 1. BETTER_COLOR = ['M20_h', 'RV20_h'] merged_map = {'RV20': ['RV20_v', 'RV20_h'], 'F20_20': ['F20_20_v'], 'S40_40': ['S40_40_v'] } objects_map = {'R20': ['RV20_h', 'RV20_v'], ...
code_fim
hard
{ "lang": "python", "repo": "smARTLab-liv/smartlabatwork-release", "path": "/slaw_manipulation/src/object_manager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert actual == expected<|fim_prefix|># repo: bmoretz/Daily-Coding-Problem path: /py/tests/leetcode/arr_tests/find_pivot_test.py import unittest from dcp.leetcode.arr import find_pivot <|fim_middle|>class Test_FindPivot(unittest.TestCase): def setUp(self): pass def test_c...
code_fim
medium
{ "lang": "python", "repo": "bmoretz/Daily-Coding-Problem", "path": "/py/tests/leetcode/arr_tests/find_pivot_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmoretz/Daily-Coding-Problem path: /py/tests/leetcode/arr_tests/find_pivot_test.py import unittest from dcp.leetcode.arr import find_pivot class Test_FindPivot(unittest.TestCase): def setUp(self): pass <|fim_suffix|> assert actual == expected<|fim_middle|> def test_c...
code_fim
medium
{ "lang": "python", "repo": "bmoretz/Daily-Coding-Problem", "path": "/py/tests/leetcode/arr_tests/find_pivot_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> train_order = list(range(len(instance_triple))) save_epoch = FLAGS.save_epoch if FLAGS.restore_epoch > 0: saver.restore(sess, FLAGS.model_dir + FLAGS.model + "-" + str(1832 * FLAGS.restore_epoch)) print('restored model from epoch {}'.format(FLAGS.restore_epoch)) for one_...
code_fim
hard
{ "lang": "python", "repo": "YangLi1221/CoRA", "path": "/script/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YangLi1221/CoRA path: /script/train.py import tensorflow as tf import numpy as np import datetime, os, sys, json, pickle from model.model_CoRA import CoRA config = json.loads(open("./data/config", 'r').read()) FLAGS = tf.app.flags.FLAGS # overall tf.app.flags.DEFINE_string('model', 'CoRA', 'n...
code_fim
hard
{ "lang": "python", "repo": "YangLi1221/CoRA", "path": "/script/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OCR-D/ocrd_tesserocr path: /test/test_cli.py from click.testing import CliRunner from test.base import main from pathlib import Path runner = CliRunner() def test_show_resource(tmpdir, monkeypatch): <|fim_suffix|>def test_list_all_resources(tmpdir, monkeypatch): samplefile = Path(tmpdir, '...
code_fim
hard
{ "lang": "python", "repo": "OCR-D/ocrd_tesserocr", "path": "/test/test_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_list_all_resources(tmpdir, monkeypatch): samplefile = Path(tmpdir, 'foo.traineddata') samplefile.write_text('foo') # simulate a Tesseract compiled with custom tessdata dir monkeypatch.setenv('TESSDATA_PREFIX', str(tmpdir)) # envvars influence tesserocr's module initialization ...
code_fim
hard
{ "lang": "python", "repo": "OCR-D/ocrd_tesserocr", "path": "/test/test_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Read all pins again await websocket.send(json.dumps(READ_ALL)) print(f"Sent > {READ_ALL}") response = await websocket.recv() print(f"Received < {response}") # Parse JSON response data = json.loads(response) p...
code_fim
hard
{ "lang": "python", "repo": "logimic/iqrfboard", "path": "/examples/digital-input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: logimic/iqrfboard path: /examples/digital-input.py # # Copyright Logimic,s.r.o., www.logimic.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
code_fim
hard
{ "lang": "python", "repo": "logimic/iqrfboard", "path": "/examples/digital-input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Wait 2 sec time.sleep(3) # Read all pins again await websocket.send(json.dumps(READ_ALL)) print(f"Sent > {READ_ALL}") response = await websocket.recv() print(f"Received < {response}") # Parse JSON ...
code_fim
hard
{ "lang": "python", "repo": "logimic/iqrfboard", "path": "/examples/digital-input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match.solve() match.reviewers[0].matching.append(Player(name="foo", pref_names=[])) with pytest.raises(Exception): match._check_reviewer_matching() @HOSPITAL_RESIDENT def test_reviewer_capacity(resident_names, hospital_names, capacities, seed): """ Test that HospitalResident rec...
code_fim
hard
{ "lang": "python", "repo": "Nikoleta-v3/matching", "path": "/tests/hospital_resident/test_solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nikoleta-v3/matching path: /tests/hospital_resident/test_solver.py """ Unit tests for the HR solver. """ import numpy as np import pytest from matching import HospitalResident, Matching, Player from .params import HOSPITAL_RESIDENT, _make_match @HOSPITAL_RESIDENT def test_init(resident_names...
code_fim
hard
{ "lang": "python", "repo": "Nikoleta-v3/matching", "path": "/tests/hospital_resident/test_solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hussainmustafa2190/Karl path: /features/bot1.py import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import TruncatedSVD from sklearn.neighbors import BallTree from sklearn.base import BaseEstimator from sklearn.pipeli...
code_fim
hard
{ "lang": "python", "repo": "hussainmustafa2190/Karl", "path": "/features/bot1.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> self.tree_ = BallTree(X) self.y_ = np.array(y) def predict(self, X, random_state = None): distances, indeces = self.tree_.query(X, return_distance = True, k = self.k) result = [] for distance, index in zip(distances, indeces): result....
code_fim
hard
{ "lang": "python", "repo": "hussainmustafa2190/Karl", "path": "/features/bot1.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def parse(self, conf): """ Parse the BOUNDARIES section of the config into the bcs list. Args: conf (configparser section or dict): The full BOUNDARIES section from the config. """ boundaries = process_args(conf, ...
code_fim
hard
{ "lang": "python", "repo": "AndrewLister-STFC/TTiP", "path": "/TTiP/parsers/boundary_conds_parser.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndrewLister-STFC/TTiP path: /TTiP/parsers/boundary_conds_parser.py """ This contains the parser for parsing the BOUNDARIES section of the config. """ from TTiP.parsers.parse_args import process_args from TTiP.parsers.parser import FunctionSectionParser class BoundaryCondsParser(FunctionSection...
code_fim
hard
{ "lang": "python", "repo": "AndrewLister-STFC/TTiP", "path": "/TTiP/parsers/boundary_conds_parser.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lung21/caliper-min path: /benchmark/custom/fabric_log_script/process_occ-standard_orderer.py import sys import math def main(): if len(sys.argv) < 2: print "python process_occ-standard_orderer.py <order/log/path>" return 1 total_schedule_count = 0 total_drop_count = ...
code_fim
hard
{ "lang": "python", "repo": "lung21/caliper-min", "path": "/benchmark/custom/fabric_log_script/process_occ-standard_orderer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> total_drop_count = middle_drop_count + rw_drop_count + anti_drop_count + cww_drop_count print "total # of scheduled txns: \t", total_schedule_count print "total # of dropped txns: \t", total_drop_count print "\t# of dropped txns due to cww: \t", cww_drop_count print "\t# of dropped txn...
code_fim
hard
{ "lang": "python", "repo": "lung21/caliper-min", "path": "/benchmark/custom/fabric_log_script/process_occ-standard_orderer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> parser = get_parser( description=( 'initialises an aiida environment via yaml config file') ) parser.add_argument('--version', action='version', version=__version__) parser.add_argument("filepath", type=str, nargs='?', help="path to config file",...
code_fim
hard
{ "lang": "python", "repo": "ezpzbz/activate_aiida", "path": "/activate_aiida/parse_args.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return CustomParser( formatter_class=CustomFormatter, **kwargs ) def run(sys_args=None): if sys_args is None: sys_args = sys.argv[1:] parser = get_parser( description=( 'initialises an aiida environment via yaml config file') ) parser...
code_fim
hard
{ "lang": "python", "repo": "ezpzbz/activate_aiida", "path": "/activate_aiida/parse_args.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ezpzbz/activate_aiida path: /activate_aiida/parse_args.py import argparse import sys from activate_aiida import __version__ class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter, ): pass class Custom...
code_fim
hard
{ "lang": "python", "repo": "ezpzbz/activate_aiida", "path": "/activate_aiida/parse_args.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert len(patch.get_atomics('LineReplacement')) == 2 assert len(patch.get_atomics('LineInsertion')) == 1 atomics = patch.get_atomics() count = 0 for edit in patch.edit_list: for atomic in edit.atomic_operators: assert atomic in ...
code_fim
hard
{ "lang": "python", "repo": "yrko1/CS454", "path": "/pyggi_hj/test/test_patch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yrko1/CS454 path: /pyggi_hj/test/test_patch.py import pytest from pyggi import Program, Patch, GranularityLevel from pyggi.custom_operator import LineDeletion, LineMoving @pytest.fixture(scope='session') def setup(): program = Program('./resource/Triangle_bug', GranularityLevel.LINE) as...
code_fim
hard
{ "lang": "python", "repo": "yrko1/CS454", "path": "/pyggi_hj/test/test_patch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>PROJECTIONS = { 'none': NoProjection, 'linesearch': BisectionPerceptualProjection, 'bisection': BisectionPerceptualProjection, 'gradient': NewtonsPerceptualProjection, 'newtons': NewtonsPerceptualProjection, } class FirstOrderStepPerceptualAttack(nn.Module): def __init__(self, mo...
code_fim
hard
{ "lang": "python", "repo": "samyakjain0112/OAAT", "path": "/perceptual_advex/perceptual_attacks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: samyakjain0112/OAAT path: /perceptual_advex/perceptual_attacks.py uts.device) lam_max = torch.ones(batch_size, device=inputs.device) lam = 0.5 * torch.ones(batch_size, device=inputs.device) for _ in range(self.num_steps): projected_adv_inputs = ( ...
code_fim
hard
{ "lang": "python", "repo": "samyakjain0112/OAAT", "path": "/perceptual_advex/perceptual_attacks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> max_iterations=10): super().__init__() self.bound = bound self.lpips_model = lpips_model self.projection_overshoot = projection_overshoot self.max_iterations = max_iterations self.bisection_projection = BisectionPerceptualProjection( ...
code_fim
hard
{ "lang": "python", "repo": "samyakjain0112/OAAT", "path": "/perceptual_advex/perceptual_attacks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # then _assert_with_static_payload( checkout, data, amount, webhook, expected_data, response, mock_request ) @freeze_time() @mock.patch("saleor.plugins.webhook.tasks.send_webhook_request_sync") def test_gateway_initialize_checkout_without_request_data( mock_request, webhook_plugi...
code_fim
hard
{ "lang": "python", "repo": "vineetb/saleor", "path": "/saleor/plugins/webhook/tests/test_payment_gateway_initialize_session_webhook.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # then _assert_with_subscription( checkout, None, amount, webhook, expected_data, response, mock_request ) @freeze_time() @mock.patch("saleor.plugins.webhook.tasks.send_webhook_request_sync") def test_gateway_initialize_checkout_with_request_data( mock_request, webhook_plugin, we...
code_fim
hard
{ "lang": "python", "repo": "vineetb/saleor", "path": "/saleor/plugins/webhook/tests/test_payment_gateway_initialize_session_webhook.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vineetb/saleor path: /saleor/plugins/webhook/tests/test_payment_gateway_initialize_session_webhook.py import json from decimal import Decimal from unittest import mock import graphene from freezegun import freeze_time from ....core import EventDeliveryStatus from ....core.models import EventDel...
code_fim
hard
{ "lang": "python", "repo": "vineetb/saleor", "path": "/saleor/plugins/webhook/tests/test_payment_gateway_initialize_session_webhook.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: robotenique/mlAlgorithms path: /supervised/modelEvaluation/learningCurve.py import numpy as np from trainLinearReg import trainLinearReg from linearRegCostFunction import linearRegCostFunction <|fim_suffix|> In this function, you will compute the train and test errors for dataset sizes f...
code_fim
hard
{ "lang": "python", "repo": "robotenique/mlAlgorithms", "path": "/supervised/modelEvaluation/learningCurve.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(m): theta = trainLinearReg(X[:i + 1], y[:i + 1], Lambda) error_train[i], _ = linearRegCostFunction(X[:i + 1], y[:i + 1], theta, 0) error_val[i], _ = linearRegCostFunction(Xval, yval, theta, 0) return error_train, error_val<|fim_prefix|># repo: roboteniq...
code_fim
medium
{ "lang": "python", "repo": "robotenique/mlAlgorithms", "path": "/supervised/modelEvaluation/learningCurve.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> # Number of training examples m, _ = X.shape # You need to return these values correctly error_train = np.zeros(m) error_val = np.zeros(m) for i in range(m): theta = trainLinearReg(X[:i + 1], y[:i + 1], Lambda) error_train[i], _ = linearRegCostFunction(X[:i + 1], ...
code_fim
hard
{ "lang": "python", "repo": "robotenique/mlAlgorithms", "path": "/supervised/modelEvaluation/learningCurve.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|># @app.get('/users') # async def list_users(): # users = [] # for user in db.users.find(): # users.append(User(**user)) # return {'users': users}<|fim_prefix|># repo: shuxiaokai/favv path: /fastapi/app/api/routes/test.py # either in one file or put in folder... from fastapi import API...
code_fim
hard
{ "lang": "python", "repo": "shuxiaokai/favv", "path": "/fastapi/app/api/routes/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shuxiaokai/favv path: /fastapi/app/api/routes/test.py # either in one file or put in folder... from fastapi import APIRouter, Depends, Query from typing import Optional import subprocess from services.db import get_db from services.redis import get_redis from services.mongodb import get_mongodb,...
code_fim
hard
{ "lang": "python", "repo": "shuxiaokai/favv", "path": "/fastapi/app/api/routes/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_fail(self): self.assertEqual(add(2,2), 5) if __name__ == '__main__': unittest.main(argv=[''], exit=False)<|fim_prefix|># repo: AMoazeni/PyOffice path: /PyOffice/test.py import unittest def add(a,b): return a+b class TestDemo(unittest.TestCase): <|fim_middle|> """Example o...
code_fim
medium
{ "lang": "python", "repo": "AMoazeni/PyOffice", "path": "/PyOffice/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AMoazeni/PyOffice path: /PyOffice/test.py import unittest def add(a,b): return a+b class TestDemo(unittest.TestCase): """Example of how to use unittest in Jupyter. Functions must contain the word 'test'.""" def test_pass(self): <|fim_suffix|>if __name__ == '__main__': unittes...
code_fim
medium
{ "lang": "python", "repo": "AMoazeni/PyOffice", "path": "/PyOffice/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AMoazeni/PyOffice path: /PyOffice/test.py import unittest def add(a,b): return a+b <|fim_suffix|> self.assertEqual(add(2,2), 5) if __name__ == '__main__': unittest.main(argv=[''], exit=False)<|fim_middle|>class TestDemo(unittest.TestCase): """Example of how to use unittest in ...
code_fim
hard
{ "lang": "python", "repo": "AMoazeni/PyOffice", "path": "/PyOffice/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(switch_it_up(8), 'Eight') def test_equal_10(self): self.assertEqual(switch_it_up(9), 'Nine')<|fim_prefix|># repo: mveselov/CodeWars path: /tests/kyu_8_tests/test_switch_it_up.py import unittest from katas.kyu_8.switch_it_up import switch_it_up class SwitchItUpTest...
code_fim
hard
{ "lang": "python", "repo": "mveselov/CodeWars", "path": "/tests/kyu_8_tests/test_switch_it_up.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mveselov/CodeWars path: /tests/kyu_8_tests/test_switch_it_up.py import unittest from katas.kyu_8.switch_it_up import switch_it_up class SwitchItUpTestCase(unittest.TestCase): <|fim_suffix|> def test_equal_8(self): self.assertEqual(switch_it_up(7), 'Seven') def test_equal_9(self...
code_fim
hard
{ "lang": "python", "repo": "mveselov/CodeWars", "path": "/tests/kyu_8_tests/test_switch_it_up.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return LaunchDescription([ Node(package='rm_task', node_executable='task_show_image', parameters=[ {'cam_topic_name': 'sim_cam/image_raw'} ], output='screen') ])<|fim_prefix|># repo: Hqz971016/rmoss_core path: /rm_task/launch...
code_fim
easy
{ "lang": "python", "repo": "Hqz971016/rmoss_core", "path": "/rm_task/launch/task_show_image.launch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hqz971016/rmoss_core path: /rm_task/launch/task_show_image.launch.py import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch_ros.actions import Node <|fim_suffix|> return LaunchDescription([ Node(package='rm_task',...
code_fim
easy
{ "lang": "python", "repo": "Hqz971016/rmoss_core", "path": "/rm_task/launch/task_show_image.launch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Reference: 1. S. Bravyi, D. Maslov, *Hadamard-free circuits expose the structure of the Clifford group*, `arXiv:2003.09412 [quant-ph] <https://arxiv.org/abs/2003.09412>`_ """ if not isinstance(stab, StabilizerState): raise QiskitError("The input is not a ...
code_fim
hard
{ "lang": "python", "repo": "1ucian0/qiskit-terra", "path": "/qiskit/synthesis/stabilizer/stabilizer_decompose.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1ucian0/qiskit-terra path: /qiskit/synthesis/stabilizer/stabilizer_decompose.py # This code is part of Qiskit. # # (C) Copyright IBM 2023. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of th...
code_fim
hard
{ "lang": "python", "repo": "1ucian0/qiskit-terra", "path": "/qiskit/synthesis/stabilizer/stabilizer_decompose.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> phase = [] phase.extend(phase_destab) phase.extend(phase_stab) phase = np.array(phase, dtype=int) A = cliff.symplectic_matrix.astype(int) Ainv = calc_inverse_matrix(A) # By carefully writing how X, Y, Z gates affect each qubit, all we need to compute # is A^{-1} * (phase)...
code_fim
hard
{ "lang": "python", "repo": "1ucian0/qiskit-terra", "path": "/qiskit/synthesis/stabilizer/stabilizer_decompose.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Build all submodels for DeepLook """ self.backbone = Backbone( self.configs['backbone'], freeze_backbone=self.configs['freeze_backbone'], freeze_batchnorm=True ) backbone_channel_sizes = get_backbone_channel_sizes(self.backbone) ...
code_fim
hard
{ "lang": "python", "repo": "mingruimingrui/DeepLook", "path": "/deep_look/modules/deep_look.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def build_modules(self): """ Build all submodels for DeepLook """ self.backbone = Backbone( self.configs['backbone'], freeze_backbone=self.configs['freeze_backbone'], freeze_batchnorm=True ) backbone_channel_sizes = get_backbone_chan...
code_fim
hard
{ "lang": "python", "repo": "mingruimingrui/DeepLook", "path": "/deep_look/modules/deep_look.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mingruimingrui/DeepLook path: /deep_look/modules/deep_look.py """ DeepLook implementation in pytorch """ import torch # Default configs from ._deep_look_configs import make_configs # Other modules from ._backbone import ( Backbone, get_backbone_channel_sizes ) from ._feature_pyramid_n...
code_fim
hard
{ "lang": "python", "repo": "mingruimingrui/DeepLook", "path": "/deep_look/modules/deep_look.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dm_data = pd.read_csv('AUS_vt_test_sentences.csv') df = pd.DataFrame(dm_data, columns=['VideoID', 'Text', 'Top5%', 'Emoji_1', 'Emoji_2', 'Emoji_3', 'Emoji_4', 'Emoji_5', 'Pct_1', 'Pct_2', 'Pct_3', 'Pct_4', 'Pct_5']) kmeans = KMeans(n_clusters=8...
code_fim
medium
{ "lang": "python", "repo": "dmougouei/ValueTube", "path": "/backend/scripts/torchMoji3/examples/kmeans_emojized.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmougouei/ValueTube path: /backend/scripts/torchMoji3/examples/kmeans_emojized.py import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn.datasets import make_blobs from sklearn.cluster import KMeans <|fim_suffix|> dm_data = pd.read_csv('AUS_vt_test_sentences....
code_fim
medium
{ "lang": "python", "repo": "dmougouei/ValueTube", "path": "/backend/scripts/torchMoji3/examples/kmeans_emojized.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: topix-hackademy/contact-tools path: /contacts/models.py from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.core.exceptions import ValidationError import datetime from imagekit.models import ImageSpecFiel...
code_fim
hard
{ "lang": "python", "repo": "topix-hackademy/contact-tools", "path": "/contacts/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @python_2_unicode_compatible class Contact(models.Model): # this is needed to sync with the old CS contact_centralservices_id = models.IntegerField('Old Centralservices ID', null=True, blank=True, help_text="ID of this contact in the old CS") contact_username = models.CharField('Contact ...
code_fim
hard
{ "lang": "python", "repo": "topix-hackademy/contact-tools", "path": "/contacts/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>params = { "df_generator": 'pd.DataFrame(np.random.randint(1, df_size, (df_size, 2)), columns=list("AB"))', "functions_to_evaluate": [numpy_values_sum, numpy_values_nansum, pandas_sum, numpy_sum], "title": "Pandas Sum vs Numpy Sum", "largest_df_single_test": False, } benchmark = Benchmar...
code_fim
medium
{ "lang": "python", "repo": "EduardoRubioM/mat281_portfolio", "path": "/m02_data_analysis/m02_c06_development/fast_pandas/benchmark_sum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return np.sum(df["A"].values) def numpy_values_nansum(df): return np.nansum(df["A"].values) params = { "df_generator": 'pd.DataFrame(np.random.randint(1, df_size, (df_size, 2)), columns=list("AB"))', "functions_to_evaluate": [numpy_values_sum, numpy_values_nansum, pandas_sum, numpy_sum],...
code_fim
medium
{ "lang": "python", "repo": "EduardoRubioM/mat281_portfolio", "path": "/m02_data_analysis/m02_c06_development/fast_pandas/benchmark_sum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EduardoRubioM/mat281_portfolio path: /m02_data_analysis/m02_c06_development/fast_pandas/benchmark_sum.py from Benchmarker import Benchmarker import numpy as np def pandas_sum(df): return df["A"].sum() def numpy_sum(df): return np.sum(df["A"]) def numpy_values_sum(df): return np.su...
code_fim
hard
{ "lang": "python", "repo": "EduardoRubioM/mat281_portfolio", "path": "/m02_data_analysis/m02_c06_development/fast_pandas/benchmark_sum.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: parashardhapola/bartide path: /bartide/utils.py from typing import Generator, Tuple from .config import logger import os import glob __all__ = ["glob_files"] def glob_files( directory: str, read1_pattern: str = "R1", read2_pattern: str = "R2", file_extension: str = "fastq.gz", ...
code_fim
hard
{ "lang": "python", "repo": "parashardhapola/bartide", "path": "/bartide/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ension are correct. " "Also that `read1_pattern` and `read2_pattern` parameter are correct. " "For example, for miSeq runs `read1_pattern` and `read2_pattern` could " "look like: 'R1_001' and 'R2_001' respectively." ) return None ...
code_fim
hard
{ "lang": "python", "repo": "parashardhapola/bartide", "path": "/bartide/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brucelevis/cherrysoda-engine path: /Tools/create_project.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import lib.cherrysoda as cherry import argparse import sys <|fim_suffix|> template_path = cherry.join_path(cherry.tool_path, 'res/CherrySoda/ProjectTemplate') project_path = cherry...
code_fim
medium
{ "lang": "python", "repo": "brucelevis/cherrysoda-engine", "path": "/Tools/create_project.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): parser = argparse.ArgumentParser() parser.add_argument('project_name') args = parser.parse_args(sys.argv[1:]) create_project('.', args.project_name) if __name__ == '__main__': main()<|fim_prefix|># repo: brucelevis/cherrysoda-engine path: /Tools/create_project.py #!/usr...
code_fim
hard
{ "lang": "python", "repo": "brucelevis/cherrysoda-engine", "path": "/Tools/create_project.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # def test_put_task_to_retry_table(self): # _ = self.scavenger.get_db_field_name # # raise NotImplementedError<|fim_prefix|># repo: sosw/sosw path: /sosw/test/integration/test_scavenger_i.py import os import unittest from copy import deepcopy from unittest.mock import Mock from...
code_fim
medium
{ "lang": "python", "repo": "sosw/sosw", "path": "/sosw/test/integration/test_scavenger_i.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sosw/sosw path: /sosw/test/integration/test_scavenger_i.py import os import unittest from copy import deepcopy from unittest.mock import Mock from sosw.scavenger import Scavenger from sosw.test.variables import TEST_SCAVENGER_CONFIG from sosw.components.dynamo_db import DynamoDbClient <|fim_su...
code_fim
medium
{ "lang": "python", "repo": "sosw/sosw", "path": "/sosw/test/integration/test_scavenger_i.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IamWangYunKai/CapsuleNet path: /utils.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import numpy as np import torch.nn as nn import matplotlib if os.environ.get('DISPLAY','') == '': print('no display found. Using non-interactive Agg backend') matplotlib.use('Agg') import ma...
code_fim
hard
{ "lang": "python", "repo": "IamWangYunKai/CapsuleNet", "path": "/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> big_image = np.ones((3, imsize*4, imsize*6+1)) images = denormalize(images).view(-1, 3, imsize, imsize) reconstructions = denormalize(reconstructions).view(-1, 3, imsize, imsize) images = images.data.cpu().numpy() reconstructions = reconstructions.data.cpu().numpy() for i in range(...
code_fim
hard
{ "lang": "python", "repo": "IamWangYunKai/CapsuleNet", "path": "/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vinu76jsr/django_profiler path: /fabfile.py from fabric.operations import local def rst_generate(): local('pandoc --from=markdown --to=rst README.md -o README.rst') <|fim_suffix|> # local('rm -f README.rst') # rst_generate() local('python setup.py sdist upload')<|fim_middle|> de...
code_fim
easy
{ "lang": "python", "repo": "vinu76jsr/django_profiler", "path": "/fabfile.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vinu76jsr/django_profiler path: /fabfile.py from fabric.operations import local <|fim_suffix|> local('pandoc --from=markdown --to=rst README.md -o README.rst') def publish(): # local('rm -f README.rst') # rst_generate() local('python setup.py sdist upload')<|fim_middle|>def rst...
code_fim
easy
{ "lang": "python", "repo": "vinu76jsr/django_profiler", "path": "/fabfile.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def publish(): # local('rm -f README.rst') # rst_generate() local('python setup.py sdist upload')<|fim_prefix|># repo: vinu76jsr/django_profiler path: /fabfile.py from fabric.operations import local <|fim_middle|> def rst_generate(): local('pandoc --from=markdown --to=rst README.md -o RE...
code_fim
medium
{ "lang": "python", "repo": "vinu76jsr/django_profiler", "path": "/fabfile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: luanphantiki/vault-kv-backup path: /vmb/transit.py import base64 import logging from hvac import Client logger = logging.LoggerAdapter(logging.getLogger(__name__), {'STAGE': 'Transit encryption'}) class Transit: <|fim_suffix|> def backup_key(self): se...
code_fim
hard
{ "lang": "python", "repo": "luanphantiki/vault-kv-backup", "path": "/vmb/transit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.client.secrets.transit.update_key_configuration( name=self.encryption_key, exportable=True, allow_plaintext_backup=True, ) backup_key_response = self.client.secrets.transit.backup_key( name=self.encryption_key, ) ...
code_fim
hard
{ "lang": "python", "repo": "luanphantiki/vault-kv-backup", "path": "/vmb/transit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('user', 'check_code', 'add_time') class UserRelationshipAdmin(admin.ModelAdmin): list_display = ('from_user', 'to_user', 'add_time') admin.site.register(User, UserAdmin) admin.site.register(CheckCode, CheckCodeAdmin) admin.site.register(UserRelationship, UserRelationshipAdmin)<...
code_fim
medium
{ "lang": "python", "repo": "guojy1314/stw1209", "path": "/user/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guojy1314/stw1209 path: /user/admin.py from django.contrib import admin from .models import User, CheckCode, UserRelationship <|fim_suffix|> admin.site.register(User, UserAdmin) admin.site.register(CheckCode, CheckCodeAdmin) admin.site.register(UserRelationship, UserRelationshipAdmin)<|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "guojy1314/stw1209", "path": "/user/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class UserRelationshipAdmin(admin.ModelAdmin): list_display = ('from_user', 'to_user', 'add_time') admin.site.register(User, UserAdmin) admin.site.register(CheckCode, CheckCodeAdmin) admin.site.register(UserRelationship, UserRelationshipAdmin)<|fim_prefix|># repo: guojy1314/stw1209 path: /user/admi...
code_fim
medium
{ "lang": "python", "repo": "guojy1314/stw1209", "path": "/user/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Set parameters for LJ m = 1 sigma = 1.0e-10 eps = 30.0 lambda_a = 6.0 lambda_r = 12.0 svrm.init("Ar") svrm.set_tmin(temp=2.0) svrm.set_pure_fluid_param(1, m, sigma, eps, lambda_a, lambda_r) svrm.redefine_critical_parameters(False) # Plot phase envelope z = np.array([1.0]) T, P, v = svrm.get_envelope_tw...
code_fim
hard
{ "lang": "python", "repo": "ibell/thermopack", "path": "/addon/pyExamples/saft_vr_mie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ibell/thermopack path: /addon/pyExamples/saft_vr_mie.py #!/usr/bin/python # Support for python2 from __future__ import print_function #Modify system path import sys sys.path.append('../pycThermopack/') # Importing pyThermopack from pyctp import saftvrmie # Importing Numpy (math, arrays, etc...) i...
code_fim
hard
{ "lang": "python", "repo": "ibell/thermopack", "path": "/addon/pyExamples/saft_vr_mie.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Calculate reduced density """ rhoStar = np.zeros_like(rhoa) rhoStar = sigma**3*NA*rhoa return rhoStar # Instanciate and init SAFT-VR Mie object svrm = saftvrmie.saftvrmie() svrm.init("H2") svrm.set_tmin(temp=2.0) # Get parameters for H2 m, sigma, eps, lambda_a, lambda_r = svrm.ge...
code_fim
medium
{ "lang": "python", "repo": "ibell/thermopack", "path": "/addon/pyExamples/saft_vr_mie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__( self, method: str, has_data: Optional[bool] = None ) -> None: ... class ResolutionQuery(SimpleQuery): def __init__(self, min: float, max: float) -> None: ... class BFactorQuery(SimpleQuery): def __init__(self, min: float, max: float) -> None: ... class MolecularWei...
code_fim
hard
{ "lang": "python", "repo": "Dr-Moreb/biotite", "path": "/src/biotite/database/rcsb/search.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dr-Moreb/biotite path: /src/biotite/database/rcsb/search.pyi # This source code is part of the Biotite package and is distributed # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further # information. from typing import Iterable, List, Union, Optional from abc import abstractmetho...
code_fim
medium
{ "lang": "python", "repo": "Dr-Moreb/biotite", "path": "/src/biotite/database/rcsb/search.pyi", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class SimpleQuery(Query): def __init__(self, query_type: str, parameter_class: str = "") -> None: ... def add_param(self, param: str, content: str) -> None: ... class MethodQuery(SimpleQuery): def __init__( self, method: str, has_data: Optional[bool] = None ) -> None: ... class R...
code_fim
hard
{ "lang": "python", "repo": "Dr-Moreb/biotite", "path": "/src/biotite/database/rcsb/search.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def list_installed_depends_by_extra( installed_dists: InstalledDistributions, project_name: NormalizedName, ) -> Dict[Optional[NormalizedName], Set[NormalizedName]]: """Get installed dependencies of a project, grouped by extra.""" res = {} # type: Dict[Optional[NormalizedName], Set[Normal...
code_fim
hard
{ "lang": "python", "repo": "ThomasBinsfeld/pip-deepfreeze", "path": "/src/pip_deepfreeze/list_installed_depends.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThomasBinsfeld/pip-deepfreeze path: /src/pip_deepfreeze/list_installed_depends.py from typing import Dict, Optional, Sequence, Set from packaging.requirements import Requirement from packaging.utils import canonicalize_name from .compat import NormalizedName from .installed_dist import Installe...
code_fim
hard
{ "lang": "python", "repo": "ThomasBinsfeld/pip-deepfreeze", "path": "/src/pip_deepfreeze/list_installed_depends.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def list_installed_depends_by_extra( installed_dists: InstalledDistributions, project_name: NormalizedName, ) -> Dict[Optional[NormalizedName], Set[NormalizedName]]: """Get installed dependencies of a project, grouped by extra.""" res = {} # type: Dict[Optional[NormalizedName], Set[Norma...
code_fim
medium
{ "lang": "python", "repo": "ThomasBinsfeld/pip-deepfreeze", "path": "/src/pip_deepfreeze/list_installed_depends.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> license_plate = db.Column(db.String(16), primary_key=True) user_id = db.Column(db.String(64), unique=True) brand = db.Column(db.String(64)) color = db.Column(db.String(64)) type = db.Column(db.String(64)) horsepower = db.Column(db.Integer) build_year = db.Column(db.Integer) fuel_type = db.Column(d...
code_fim
medium
{ "lang": "python", "repo": "Deedss/Vroomrr", "path": "/vroomrr-api/flask/model/car.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Deedss/Vroomrr path: /vroomrr-api/flask/model/car.py from ext import db from dataclasses import dataclass from dataclasses_json import dataclass_json <|fim_suffix|> license_plate = db.Column(db.String(16), primary_key=True) user_id = db.Column(db.String(64), unique=True) brand = db.Column(db.S...
code_fim
hard
{ "lang": "python", "repo": "Deedss/Vroomrr", "path": "/vroomrr-api/flask/model/car.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def vote(solid): #TODO: validate oauth pass if __name__ == '__main__': app.run(debug=True, port=31415)<|fim_prefix|># repo: xxranagazooxx/alaalametcys-sol-finder path: /api.py #!flask/bin/python from flask import Flask, jsonify from models import get_solution app = Flask(__name__) SECMAP = ...
code_fim
hard
{ "lang": "python", "repo": "xxranagazooxx/alaalametcys-sol-finder", "path": "/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xxranagazooxx/alaalametcys-sol-finder path: /api.py #!flask/bin/python from flask import Flask, jsonify from models import get_solution app = Flask(__name__) SECMAP = { # translate uri to db namespace "CP": "C/P", "SB": "S/B", "BB" : "B/B", "CARS" : "CARS"} @app.route('/') d...
code_fim
medium
{ "lang": "python", "repo": "xxranagazooxx/alaalametcys-sol-finder", "path": "/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return jsonify(get_solution(mod, rsec, num)) def vote(solid): #TODO: validate oauth pass if __name__ == '__main__': app.run(debug=True, port=31415)<|fim_prefix|># repo: xxranagazooxx/alaalametcys-sol-finder path: /api.py #!flask/bin/python from flask import Flask, jsonify from models im...
code_fim
hard
{ "lang": "python", "repo": "xxranagazooxx/alaalametcys-sol-finder", "path": "/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> template_fields: Any template_ext: Any ui_color: str source_project_dataset_tables: Any destination_project_dataset_table: Any write_disposition: Any create_disposition: Any bigquery_conn_id: Any delegate_to: Any labels: Any encryption_configuration: Any def...
code_fim
medium
{ "lang": "python", "repo": "viewthespace/mypy-stubs", "path": "/src/airflow-stubs/contrib/operators/bigquery_to_bigquery.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: viewthespace/mypy-stubs path: /src/airflow-stubs/contrib/operators/bigquery_to_bigquery.pyi from airflow.contrib.hooks.bigquery_hook import BigQueryHook as BigQueryHook from airflow.models import BaseOperator as BaseOperator from airflow.utils.decorators import apply_defaults as apply_defaults fr...
code_fim
medium
{ "lang": "python", "repo": "viewthespace/mypy-stubs", "path": "/src/airflow-stubs/contrib/operators/bigquery_to_bigquery.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fit_plane(points): '''Fit a plane to the 3D beads surface''' import scipy.optimize import functools fun = functools.partial(squared_error, points=points) params0 = [0.0, 0.0, 0.0] return scipy.optimize.minimize(fun, params0) def interpolate_surface(coords, output_shape, met...
code_fim
hard
{ "lang": "python", "repo": "scottberry/JtModules", "path": "/src/python/jtmodules/generate_volume_image.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scottberry/JtModules path: /src/python/jtmodules/generate_volume_image.py use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # dis...
code_fim
hard
{ "lang": "python", "repo": "scottberry/JtModules", "path": "/src/python/jtmodules/generate_volume_image.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return filtered_coords_global def main(image, mask, threshold=25, mean_size=6, min_size=10, filter_type='log_2d', minimum_bead_intensity=150, z_step=0.333, pixel_size=0.1625, alpha=0, plot=False): '''Converts an image stack with labelled cell surface ...
code_fim
hard
{ "lang": "python", "repo": "scottberry/JtModules", "path": "/src/python/jtmodules/generate_volume_image.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }