text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> assert (await resp.text()) == 'pong'<|fim_prefix|># repo: daniellima/desafio-lojaintegrada path: /src/tests/test_ping.py async def test_ping(unauthorized_client): <|fim_middle|> resp = await unauthorized_client.get('/ping') assert resp.status == 200
code_fim
medium
{ "lang": "python", "repo": "daniellima/desafio-lojaintegrada", "path": "/src/tests/test_ping.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daniellima/desafio-lojaintegrada path: /src/tests/test_ping.py async def test_ping(unauthorized_client): resp = await unauthorized_client.get('/ping') <|fim_suffix|> assert (await resp.text()) == 'pong'<|fim_middle|> assert resp.status == 200
code_fim
easy
{ "lang": "python", "repo": "daniellima/desafio-lojaintegrada", "path": "/src/tests/test_ping.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> MARK[pc] = True op, i_arg = code[pc] arg = int(i_arg) new_pc, new_acc = pc + 1, acc if op == 'acc': new_acc += arg if op == 'jmp': new_pc += arg - 1 #! return new_pc, new_acc pc, acc = 0, 0 while True: try: pc, acc = step(CODE, pc, acc...
code_fim
medium
{ "lang": "python", "repo": "pshatov/AoC", "path": "/2020/8/8.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: pshatov/AoC path: /2020/8/8.py CODE = [] with open('input.txt') as f: for fl in f: CODE.append(tuple(fl.strip().split(' '))) MARK = [] for i in range(len(CODE)): MARK.append(False) def step(code, pc, acc): if MARK[pc]: raise RuntimeError MARK[p...
code_fim
medium
{ "lang": "python", "repo": "pshatov/AoC", "path": "/2020/8/8.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> # run fixed code pc, acc = 0, 0 for i in range(len(CODE)): MARK[i] = False while True: if pc == len(CODE): fixed = True break try: pc, acc = step(NEW_CODE, pc, acc) except RuntimeError: #p...
code_fim
hard
{ "lang": "python", "repo": "pshatov/AoC", "path": "/2020/8/8.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: lzx325/COVID-19-repo path: /03.baselines.demo/MPUnet/MultiPlanarUNet_26/mpunet/logging/default_logger.py class ScreenLogger(object): """ Minimal wrapper class around the built-in print function replicating some functionality of the mpunet Logger class so that this class can be u...
code_fim
hard
{ "lang": "python", "repo": "lzx325/COVID-19-repo", "path": "/03.baselines.demo/MPUnet/MultiPlanarUNet_26/mpunet/logging/default_logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __enter__(self): return def __exit__(self, *args): return<|fim_prefix|># repo: lzx325/COVID-19-repo path: /03.baselines.demo/MPUnet/MultiPlanarUNet_26/mpunet/logging/default_logger.py class ScreenLogger(object): """ Minimal wrapper class around the built-in print fu...
code_fim
hard
{ "lang": "python", "repo": "lzx325/COVID-19-repo", "path": "/03.baselines.demo/MPUnet/MultiPlanarUNet_26/mpunet/logging/default_logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wesleywh/Scripts path: /Linux - Python/getCommand.py import urllib2 import os pageRequest = raw_input("Enter Webpag<|fim_suffix|>ageContent = urllib2.urlopen(urlToCall).read() print pageContent<|fim_middle|>e(EX:www.byu.edu): ") getRequest = raw_input("Page Request(EX:index.html): ") urlToCall =...
code_fim
medium
{ "lang": "python", "repo": "wesleywh/Scripts", "path": "/Linux - Python/getCommand.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ageContent = urllib2.urlopen(urlToCall).read() print pageContent<|fim_prefix|># repo: wesleywh/Scripts path: /Linux - Python/getCommand.py import urllib2 import os pageRequest = raw_input("Enter Webpag<|fim_middle|>e(EX:www.byu.edu): ") getRequest = raw_input("Page Request(EX:index.html): ") urlToCall =...
code_fim
medium
{ "lang": "python", "repo": "wesleywh/Scripts", "path": "/Linux - Python/getCommand.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Infosecurity-LLC/unicon_v3 path: /modules/tools.py from retry import retry from typing import Dict, NoReturn from raven.conf import setup_logging from raven.handlers.logging import SentryHandler import logging import redis logger = logging.getLogger('unicon') def prepare_logging(settings: Dict...
code_fim
hard
{ "lang": "python", "repo": "Infosecurity-LLC/unicon_v3", "path": "/modules/tools.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @retry(Exception, tries=5, delay=15, logger=logger) def health_check_rmq(rmq_config: Dict) -> NoReturn: """ Проверяем, прогрузился ли RMQ при старте сборки docker-compose считает сервис запущенным по факту запуска сервиса, не проверяя его окончательную загрузку (depends_on в этому слу...
code_fim
hard
{ "lang": "python", "repo": "Infosecurity-LLC/unicon_v3", "path": "/modules/tools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Проверяем, прогрузился ли RMQ при старте сборки docker-compose считает сервис запущенным по факту запуска сервиса, не проверяя его окончательную загрузку (depends_on в этому случае не спасает), поэтому зависимый сервис может начать стучаться в непрогруженный RMQ :param ...
code_fim
hard
{ "lang": "python", "repo": "Infosecurity-LLC/unicon_v3", "path": "/modules/tools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hbuiOnline/AMS path: /app/models.py from django.db import models from django.contrib.auth.models import User from datetime import datetime, date # Create your models here. # Create class that represent our database class Customer(models.Model): # when user us deleted, we will delete that r...
code_fim
hard
{ "lang": "python", "repo": "hbuiOnline/AMS", "path": "/app/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.name def get_absolute_url(self): return "/customer/%i" % self.id class Staff(models.Model): user = models.OneToOneField(User, null=True, on_delete=models.CASCADE) name = models.CharField(max_length=200, null=True) phone = models.CharField(max_length=200, null...
code_fim
hard
{ "lang": "python", "repo": "hbuiOnline/AMS", "path": "/app/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # This was clunky but it allows you to load test fixtures... # class DocTest(TestCase): # def test_util(self, module=pug.nlp.util): # failure_count, test_count = doctest.testmod(module, raise_on_error=False, verbose=True) # msg = "Ran {0} tests in {3} and {1} passed ({2} failed)".f...
code_fim
hard
{ "lang": "python", "repo": "lowks/pug", "path": "/pug/miner/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lowks/pug path: /pug/miner/tests.py from django.test import LiveServerTestCase, TestCase from selenium import webdriver import pug.nlp.util import pug.nlp.djdb class HomeTest(LiveServerTestCase): def setUp(self): self.page = webdriver.Firefox() self.page.implicitly_wait(1) ...
code_fim
hard
{ "lang": "python", "repo": "lowks/pug", "path": "/pug/miner/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check for inconsistencies if request.method in ("PUT", "POST", "PATCH", "DELETE"): resource_name = utils.get_resource_name( parser_context, expand_polymorphic_types=True ) if isinstance(resource_name, str): if data.get("...
code_fim
hard
{ "lang": "python", "repo": "Chemical-Curation/chemcurator_django", "path": "/chemreg/jsonapi/parsers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chemical-Curation/chemcurator_django path: /chemreg/jsonapi/parsers.py from rest_framework.exceptions import ParseError from rest_framework_json_api import exceptions, parsers, serializers, utils class JSONParser(parsers.JSONParser): def parse(self, stream, media_type=None, parser_context=...
code_fim
hard
{ "lang": "python", "repo": "Chemical-Curation/chemcurator_django", "path": "/chemreg/jsonapi/parsers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Construct the return data serializer_class = getattr(view, "serializer_class", None) parsed_data = {"id": data.get("id")} if "id" in data else {} # `type` field needs to be allowed in none polymorphic serializers if serializer_class is not None: if iss...
code_fim
hard
{ "lang": "python", "repo": "Chemical-Curation/chemcurator_django", "path": "/chemreg/jsonapi/parsers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_deseason(self): # just do a simple row count to verify functionality # write additional tests to verify data integrity actual = gelato.deseason(self.inputData) expected = self.outputData actual = pd.DataFrame(actual) expected = pd.DataFrame(exp...
code_fim
hard
{ "lang": "python", "repo": "jsheedy/affogato", "path": "/gelato/test/test_gelato.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: jsheedy/affogato path: /gelato/test/test_gelato.py import numpy as np import pandas as pd import unittest from gelato import gelato class TestGelato(unittest.TestCase): def setUp(self): self.inputData = [ {'datetime': '2014-01-01', 'inbound': 125, 'outbound': 121}, ...
code_fim
hard
{ "lang": "python", "repo": "jsheedy/affogato", "path": "/gelato/test/test_gelato.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: albertopoljak/minesweeper path: /minesweeper_console.py import argparse from backend.grid import Grid class MinesweeperConsole: def __init__(self, grid_height: int, grid_width: int, mine_count: int, *, seed: int = None, cheat: bool = False): self.game = Grid(grid_height, grid_width,...
code_fim
hard
{ "lang": "python", "repo": "albertopoljak/minesweeper", "path": "/minesweeper_console.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: user_input = input("Enter 'row col flag' or to just open tile 'row col':").split() if len(user_input) == 2: return int(user_input[0]), int(user_input[1]), False elif len(user_input) == 3: return int(user_input[0]), int...
code_fim
hard
{ "lang": "python", "repo": "albertopoljak/minesweeper", "path": "/minesweeper_console.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> resp = self.client.post(path, data={ 'name': 'junit.xml', 'file': (StringIO('hello world!\n'), 'junit.xml'), }) assert resp.status_code == 201, resp.data data = self.unserialize(resp) artifact = Artifact.query.get(data['id']) assert ...
code_fim
hard
{ "lang": "python", "repo": "jhance/changes", "path": "/tests/changes/api/test_jobstep_artifacts.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhance/changes path: /tests/changes/api/test_jobstep_artifacts.py from cStringIO import StringIO from changes.models.artifact import Artifact from changes.testutils import APITestCase class JobStepArtifactsCreateTest(APITestCase): def test_simple(self): <|fim_suffix|> path = '/api/0...
code_fim
hard
{ "lang": "python", "repo": "jhance/changes", "path": "/tests/changes/api/test_jobstep_artifacts.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ishine/lattice-rescore path: /lattice.py arc in enumerate(self.arcs): string = 'J=%d\tS=%d\tE=%d\ta=%.2f\tl=%.3f' % ( idx, mapping[arc.src], mapping[arc.dest], arc.ascr, arc.lscr, ...
code_fim
hard
{ "lang": "python", "repo": "ishine/lattice-rescore", "path": "/lattice.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def onebest(self, aw=1.0, lw=1.0, nw=[], iw=[], ip=0.0): """Find best path in the lattice using Viterbi algorithm.""" if not hasattr(nw, '__len__'): nw = np.ones_like(self.arcs[0].nscr) * nw if not hasattr(iw, '__len__'): iw = np.ones_like(self.arcs[0].i...
code_fim
hard
{ "lang": "python", "repo": "ishine/lattice-rescore", "path": "/lattice.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def backward(self, aw, lw): """ Compute backward variable for all arcs in the lattice. Store beta value on each arc. """ # This can be accelerated by storing beta for nodes without recomputing for vx in self.traverse_arcs_topo(reverse=True): ...
code_fim
hard
{ "lang": "python", "repo": "ishine/lattice-rescore", "path": "/lattice.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> np.testing.assert_array_equal(self.driver.focal2pixel_lines, [0.0, 0.0, 1.0 / 0.014]) def test_focal2pixel_samples(self): np.testing.assert_array_equal(self.driver.focal2pixel_samples, [0.0, -1.0 / 0.014, 0.0]) # ========= Test EIS NAC FC isislabel and naifspice driver ========= cla...
code_fim
hard
{ "lang": "python", "repo": "acpaquette/ale", "path": "/tests/pytests/test_clipper_drivers.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def test_detector_center_sample(self): assert self.driver.detector_center_sample == 2048 def test_detector_center_line(self): assert self.driver.detector_center_line == 1024 def test_detector_start_line(self): assert self.driver.detector_start_line == 415 def tes...
code_fim
hard
{ "lang": "python", "repo": "acpaquette/ale", "path": "/tests/pytests/test_clipper_drivers.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: acpaquette/ale path: /tests/pytests/test_clipper_drivers.py import pytest import ale import struct import numpy as np import unittest from unittest.mock import patch from conftest import get_image, get_image_label from ale.drivers.clipper_drivers import ClipperEISWACFCIsisLabelNaifSpiceDriver, ...
code_fim
hard
{ "lang": "python", "repo": "acpaquette/ale", "path": "/tests/pytests/test_clipper_drivers.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: oaken-source/pyd2s path: /src/pyd2s/gamedata.py ''' this module provides access to the games data files ''' import os import csv import struct class _GameData: ''' provide access to the games data files ''' _TABLE_ALIAS = { 'itemdata': ['armor', 'weapons', 'misc'], ...
code_fim
hard
{ "lang": "python", "repo": "oaken-source/pyd2s", "path": "/src/pyd2s/gamedata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return entries def _load_strings(self): ''' load the string table into memory on first access ''' string_tbl_classic = [ 'gamedata/d2data/data/local/lng/eng/string.tbl'] string_tbl_expansion = [ 'gamedata/d2exp/data/local/lng/eng...
code_fim
hard
{ "lang": "python", "repo": "oaken-source/pyd2s", "path": "/src/pyd2s/gamedata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add_macro2minimizer(X, E): """ The function takes the minimizers (corrector function with zero-mean property or equaling to macroscopic value) and returns a corrector function with mean that equals to macroscopic value E. """ if np.allclose(X.mean(), E): return X e...
code_fim
hard
{ "lang": "python", "repo": "song2001/FFTHomPy", "path": "/ffthompy/postprocess.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ The function assembles the homogenized matrix from minimizers (corrector functions). """ dim = len(solutions) if not np.allclose(Afun.N, solutions[0].N): Nbar = Afun.N sol = [] for ii in np.arange(dim): sol.append(solutions[ii].project(Nbar))...
code_fim
hard
{ "lang": "python", "repo": "song2001/FFTHomPy", "path": "/ffthompy/postprocess.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: song2001/FFTHomPy path: /ffthompy/postprocess.py import numpy as np from ffthompy.general.base import Timer from ffthompy.matvec import VecTri def postprocess(pb, A, mat, solutions, results, primaldual): """ The function post-process the results. """ tim = Timer(name='postproces...
code_fim
hard
{ "lang": "python", "repo": "song2001/FFTHomPy", "path": "/ffthompy/postprocess.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RobotLocomotion/drake path: /tools/model_visualizer_private.py """(Internal use only) This program allows Drake developers to visualize model files used by tests, e.g.: <|fim_suffix|>When using a Drake URI (package://drake), the filegroup with the model to be visualized must be added to either `...
code_fim
medium
{ "lang": "python", "repo": "RobotLocomotion/drake", "path": "/tools/model_visualizer_private.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>from pydrake.visualization.model_visualizer import _main _main()<|fim_prefix|># repo: RobotLocomotion/drake path: /tools/model_visualizer_private.py """(Internal use only) This program allows Drake developers to visualize model files used by tests, e.g.: <|fim_middle|> bazel run //tools:model_visualiz...
code_fim
hard
{ "lang": "python", "repo": "RobotLocomotion/drake", "path": "/tools/model_visualizer_private.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def getRow(self, rowIndex: int) -> List[int]: if rowIndex == 0: return [1] if rowIndex == 1: return [1,1] result = [1,1] while rowIndex >= 2: temp = [1,1] for i in range(len(result)-1): temp.insert(1+i,resu...
code_fim
medium
{ "lang": "python", "repo": "Davidxswang/leetcode", "path": "/easy/119-Pascal's Triangle II.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Davidxswang/leetcode path: /easy/119-Pascal's Triangle II.py """ https://leetcode.com/problems/pascals-triangle-ii/ Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. <|fim_suffix|>Could you optimize your algorithm to use only O(k) extra space? """ # t...
code_fim
medium
{ "lang": "python", "repo": "Davidxswang/leetcode", "path": "/easy/119-Pascal's Triangle II.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tehdragonfly/gopher_server path: /examples/directory_example.py from asyncio import get_event_loop from gopher_server.application import Application from gopher_server.handlers import DirectoryHandler from gopher_server.listeners import tcp_listener, tcp_tls_listener, quic_listener <|fim_suffi...
code_fim
medium
{ "lang": "python", "repo": "tehdragonfly/gopher_server", "path": "/examples/directory_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": loop = get_event_loop() loop.create_task(tcp_listener(application, "localhost", "0.0.0.0", 7000)) loop.create_task(tcp_tls_listener( application, "localhost", "0.0.0.0", 7001, "server.crt", "key.pem", )) loop.create_task(quic_listener( ...
code_fim
medium
{ "lang": "python", "repo": "tehdragonfly/gopher_server", "path": "/examples/directory_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": loop = get_event_loop() loop.create_task(tcp_listener(application, "localhost", "0.0.0.0", 7000)) loop.create_task(tcp_tls_listener( application, "localhost", "0.0.0.0", 7001, "server.crt", "key.pem", )) loop.create_task(quic_listener( ...
code_fim
medium
{ "lang": "python", "repo": "tehdragonfly/gopher_server", "path": "/examples/directory_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if inp == 'x': run = False continue intinp = int(inp) if intinp in range(1,101,1): print("adding calibration item") meter_calibration[intinp] = dc meter_calibration[0] = 0 print(meter_calibration) with open('mt.calibration'...
code_fim
medium
{ "lang": "python", "repo": "perryngordon/meterthingy", "path": "/mt-calibrate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: perryngordon/meterthingy path: /mt-calibrate.py #!/usr/local/bin/python ## # mt-calibrate.py # Copyright: 2019 Perryn Gordon # License: MIT # Calibrate meter to align settings with needle positions. # Creates the mt.calibration file ## import RPi.GPIO as GPIO import time import os rpigpio_versi...
code_fim
hard
{ "lang": "python", "repo": "perryngordon/meterthingy", "path": "/mt-calibrate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> my_model = XGBRegressor(n_estimators = 500, learning_rate=0.05, n_jobs = 4) my_model.fit(X_train, y_train, early_stopping_rounds = 5, eval_set=[(X_valid, y_valid)], verbose=False) predictions = my_model.predict(X_valid) print("Mean Absolute Error: " + str(mean_absolute_error(predictions, y...
code_fim
medium
{ "lang": "python", "repo": "juanmendezcuartas/Learning", "path": "/GradientBoosting/GradientBoosting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juanmendezcuartas/Learning path: /GradientBoosting/GradientBoosting.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 12 10:10:34 2020 @author: juanmendezcuartas """ import pandas as pd from sklearn.model_selection import train_test_split from xgboost import XGBRegressor f...
code_fim
hard
{ "lang": "python", "repo": "juanmendezcuartas/Learning", "path": "/GradientBoosting/GradientBoosting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> predictions = my_model.predict(X_valid) print("Mean Absolute Error: " + str(mean_absolute_error(predictions, y_valid)))<|fim_prefix|># repo: juanmendezcuartas/Learning path: /GradientBoosting/GradientBoosting.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 12 10:10:34 2020 @aut...
code_fim
hard
{ "lang": "python", "repo": "juanmendezcuartas/Learning", "path": "/GradientBoosting/GradientBoosting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: propeller-app/eaip-lib path: /eaip/runway.py import re import typing from functools import cached_property from geopy.point import Point import eaip class Runway: """ An object representation of an airfield runway. """ designation: str bearing: typing.Union[None, floa...
code_fim
hard
{ "lang": "python", "repo": "propeller-app/eaip-lib", "path": "/eaip/runway.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Dimensions of runway in metres. 0x0m if not available. """ dimensions = self.data[2] dimensions = re.findall(r'(\d+)\s+x\s+(\d+)\s+M', dimensions.replace('-', '0')) return dimensions[0] if dimensions else (0, 0) @cached_property def surface_type...
code_fim
hard
{ "lang": "python", "repo": "propeller-app/eaip-lib", "path": "/eaip/runway.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # check it compiles arr = run_extract(os.path.abspath(file_path), args['name'], args['length'], out_dir) return arr def test_window_function_hann(): file_path = os.path.join(here, 'out','window_function', 'window_func.h') args = dict( window='hann', length=512, ...
code_fim
hard
{ "lang": "python", "repo": "emlearn/emlearn", "path": "/test/test_window_function.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emlearn/emlearn path: /test/test_window_function.py import os.path import subprocess import json import numpy from distutils.ccompiler import new_compiler here = os.path.dirname(__file__) def run_window_function(options): module = 'emlearn.tools.window_function' args = ['python3', '-m...
code_fim
hard
{ "lang": "python", "repo": "emlearn/emlearn", "path": "/test/test_window_function.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // write as JSON array printf("["); for (int i=0; i<length; i++) {{ printf("%f%s", arr[i], (i != length-1) ? ", " : ""); }} printf("]"); }} int main() {{ const float *arr = {name}; const int length = {length}; print_jso...
code_fim
hard
{ "lang": "python", "repo": "emlearn/emlearn", "path": "/test/test_window_function.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_arguments_amount_error(func_def: AnyFuncdef, max_parameters_amount: int) -> Tuple[int, int, str]: arguments_amount = get_arguments_amount_for(func_def) if arguments_amount > max_parameters_amount: return ( func_def.lineno, func_def.col_offset, f'...
code_fim
hard
{ "lang": "python", "repo": "best-doctor/flake8-functions", "path": "/flake8_functions/function_arguments_amount.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: best-doctor/flake8-functions path: /flake8_functions/function_arguments_amount.py import ast from typing import Tuple, Union AnyFuncdef = Union[ast.FunctionDef, ast.AsyncFunctionDef] <|fim_suffix|> arguments_amount = 0 args = func_def.args arguments_amount += len(args.args) + len(ar...
code_fim
medium
{ "lang": "python", "repo": "best-doctor/flake8-functions", "path": "/flake8_functions/function_arguments_amount.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, mesh, num_layers, num_channels, pretrained_checkpoint=None): super(CMR, self).__init__() self.graph_cnn = GraphCNN(mesh.adjmat, mesh.ref_vertices.t(), num_layers, num_channels) self.smpl_param_regressor = SMPLParamRegressor()...
code_fim
hard
{ "lang": "python", "repo": "syenpark/GraphCMR", "path": "/models/cmr.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: syenpark/GraphCMR path: /models/cmr.py """ This file provides a wrapper around GraphCNN and SMPLParamRegressor and is useful for inference since it fuses both forward passes in one. It returns both the non-parametric and parametric shapes, as well as the camera and the regressed SMPL parameters. ...
code_fim
hard
{ "lang": "python", "repo": "syenpark/GraphCMR", "path": "/models/cmr.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_data_source(self, name): for item in self.get_data_sources(): if item.get_name() == name: return item return None def add_data_source(self, data_source): new_data_source = data_source.d # keep standard md5 hahes for _id values....
code_fim
hard
{ "lang": "python", "repo": "DigiLog-N/DigiLog-N", "path": "/digilog_n/DataSourceRegistry.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DigiLog-N/DigiLog-N path: /digilog_n/DataSourceRegistry.py ############################################################################## # DataSourceRegistry.py # https://github.com/DigiLog-N/DigiLog-N # Copyright 2020 Canvass Labs, Inc. # # Licensed under the Apache License, Version 2.0 (the "...
code_fim
hard
{ "lang": "python", "repo": "DigiLog-N/DigiLog-N", "path": "/digilog_n/DataSourceRegistry.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dguenms/Dawn-of-Civilization path: /Assets/Python/BUG/Tabs/BugErrorOptionsTab.py ## BugErrorOptionsTab ## ## Tab for the BUG Error Tracker. ## ## TODO: ## * Display all config errors ## ## Copyright (c) 2007-2008 The BUG Mod. ## ## Author: EmperorFool <|fim_suffix|> tab = self.creat...
code_fim
hard
{ "lang": "python", "repo": "dguenms/Dawn-of-Civilization", "path": "/Assets/Python/BUG/Tabs/BugErrorOptionsTab.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.addLabel(screen, column, "DataDirectory", "Data Directory:") self.addLabel(screen, column, "DataPath", BugPath.getDataDir())<|fim_prefix|># repo: dguenms/Dawn-of-Civilization path: /Assets/Python/BUG/Tabs/BugErrorOptionsTab.py ## BugErrorOptionsTab ## ## Tab for the BUG Error Tracker. ## ##...
code_fim
medium
{ "lang": "python", "repo": "dguenms/Dawn-of-Civilization", "path": "/Assets/Python/BUG/Tabs/BugErrorOptionsTab.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Penta0308/j-bot path: /bb2cogs/talk.py import discord import random import json import platform import youtube_dl from discord.ext import commands from time import strftime, localtime class Talk(commands.Cog): def __init__(self, client): self.client = client pr...
code_fim
hard
{ "lang": "python", "repo": "Penta0308/j-bot", "path": "/bb2cogs/talk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @commands.command(pass_context=True) async def 나무위키(self, ctx, *, search=None): result = search.replace(" ", "%20") url = f"https://namu.wiki/w/{result}" embed = discord.Embed(title="나무위키 검색 결과", description=f"'{search}'의 검색 결과입니다.", colou...
code_fim
hard
{ "lang": "python", "repo": "Penta0308/j-bot", "path": "/bb2cogs/talk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Marker stats print 'Markers:', markers for num, marker in enumerate(markers): # Last marker if num == len(markers) - 1: track_length = 0 else: track_length = round(markers[num + 1] - markers[num], -3) print 'Marker', num+1, '@', str(dat...
code_fim
hard
{ "lang": "python", "repo": "broxeph/ameryn", "path": "/old/2015-08-27/track_customers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make input filename list if config.input_orders and config.input_items: raise Exception("Orders or items. Can't have both. Sorry.") for f in os.listdir(config.clean_folder): if f.endswith('.wav'): input_filename_list.append(f) print 'Input filenames (folder) (...
code_fim
hard
{ "lang": "python", "repo": "broxeph/ameryn", "path": "/old/2015-08-27/track_customers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: broxeph/ameryn path: /old/2015-08-27/track_customers.py """ Add tracks to customer orders. (c) Ameryn Media LLC, 2015. All rights reserved. """ import wave import os import datetime import struct import multiprocessing import csv import shutil from ConfigParser import ConfigParser import sys im...
code_fim
hard
{ "lang": "python", "repo": "broxeph/ameryn", "path": "/old/2015-08-27/track_customers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: com-480-data-visualization/com-480-project-coronateam path: /scripts/geocoding_trends_regions.py #geocoding_trends_regions.py import pandas as pd import geopandas as gpd import geocoder from shapely.geometry import shape import json import time import numpy as np #Import Google Trends data data...
code_fim
hard
{ "lang": "python", "repo": "com-480-data-visualization/com-480-project-coronateam", "path": "/scripts/geocoding_trends_regions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Spatial join with regions geocoded=gpd.sjoin(regions[['id','geometry']],to_geocode,how='right',op='intersects') #Manual fixes geocoded.drop(geocoded[geocoded.country.isin(['SM','MD','AD','BY','BA','UA','RU'])].index, inplace=True) #Remove countries not in europe_regions.geojson geocoded.loc[geocoded.geo...
code_fim
hard
{ "lang": "python", "repo": "com-480-data-visualization/com-480-project-coronateam", "path": "/scripts/geocoding_trends_regions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Fill manually missing coordinates #Finland to_geocode.loc[to_geocode.geoName.isin(['Northern Savonia', 'Southern Ostrobothnia','Southern Savonia','Tavastia Proper']),'Lon']=26.247354 to_geocode.loc[to_geocode.geoName.isin(['Northern Savonia', 'Southern Ostrobothnia','Southern Savonia','Tavastia Proper'])...
code_fim
hard
{ "lang": "python", "repo": "com-480-data-visualization/com-480-project-coronateam", "path": "/scripts/geocoding_trends_regions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ntQEvent(abjad.Offset(100, 1)), nauert.PitchedQEvent( abjad.Offset(400, 1), (abjad.NamedPitch("cs'"), abjad.NamedPitch("e'")), (6,), ), nauert.SilentQEvent(abjad.Offset(700, 1)), nauert.PitchedQEvent( ...
code_fim
hard
{ "lang": "python", "repo": "Abjad/abjad-ext-nauert", "path": "/tests/test_QEventSequence_from_millisecond_pitch_attachment_tuples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> abjad.Offset(1050, 1), (abjad.NamedPitch("f'"),), ("foobar",) ), nauert.PitchedQEvent( abjad.Offset(1450, 1), (abjad.NamedPitch("g'"),), ("foo", "bar") ), nauert.TerminalQEvent(abjad.Offset(2050, 1)), ) ), repr(q_events)<...
code_fim
hard
{ "lang": "python", "repo": "Abjad/abjad-ext-nauert", "path": "/tests/test_QEventSequence_from_millisecond_pitch_attachment_tuples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Abjad/abjad-ext-nauert path: /tests/test_QEventSequence_from_millisecond_pitch_attachment_tuples.py import abjad from abjadext import nauert def test_QEventSequence_from_millisecond_pitch_attachment_tuples_01(): durations = [100, 200, 100, 300, 350, 400, 600] pitches = [0, None, None, [...
code_fim
hard
{ "lang": "python", "repo": "Abjad/abjad-ext-nauert", "path": "/tests/test_QEventSequence_from_millisecond_pitch_attachment_tuples.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='A', fields=[ ('id', models.AutoField(serialize=False, primary_key=True)), ('name', models.CharField(default=b'', max_length=16)), ], options={ }, ...
code_fim
hard
{ "lang": "python", "repo": "shmilyoo/ggxxBBS", "path": "/forum/migrations/0026_a_b.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shmilyoo/ggxxBBS path: /forum/migrations/0026_a_b.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion <|fim_suffix|> dependencies = [ ('forum', '0025_auto_20150507_1156'), ] operations...
code_fim
hard
{ "lang": "python", "repo": "shmilyoo/ggxxBBS", "path": "/forum/migrations/0026_a_b.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dwavesystems/dwavebinarycsp path: /tests/test_int_stitcher.py # encoding: utf-8 # Copyright 2018 D-Wave Systems Inc. # # 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 Licen...
code_fim
hard
{ "lang": "python", "repo": "dwavesystems/dwavebinarycsp", "path": "/tests/test_int_stitcher.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> csp = dwavebinarycsp.ConstraintSatisfactionProblem(dwavebinarycsp.BINARY) variables = ['a', 'b', 'c'] xor = dwavebinarycsp.factories.constraint.gates.xor_gate(variables) csp.add_constraint(xor) bqm = dwavebinarycsp.stitch(csp) resp = dimod.ExactSolver().s...
code_fim
hard
{ "lang": "python", "repo": "dwavesystems/dwavebinarycsp", "path": "/tests/test_int_stitcher.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GHAStVHenry/GUDMAP-RBK.rna-seq path: /workflow/tests/test_downsampleData.py #!/usr/bin/env python3 #test_downsampleData.py #* #* -------------------------------------------------------------------------- #* Licensed under MIT (https://git.biohpc.swmed.edu/gudmap_rbk/rna-seq/-/blob/14a1c222e53f593...
code_fim
medium
{ "lang": "python", "repo": "GHAStVHenry/GUDMAP-RBK.rna-seq", "path": "/workflow/tests/test_downsampleData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.downsampleData def test_downsampleData(): assert os.path.exists(os.path.join(test_output_path, 'sampled.1.fq'))<|fim_prefix|># repo: GHAStVHenry/GUDMAP-RBK.rna-seq path: /workflow/tests/test_downsampleData.py #!/usr/bin/env python3 #test_downsampleData.py #* #* -------------------------...
code_fim
medium
{ "lang": "python", "repo": "GHAStVHenry/GUDMAP-RBK.rna-seq", "path": "/workflow/tests/test_downsampleData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> application_parameters=None, enable_system_backup=None, file_paths=None, metadata_file_path=None, skip_nested_volumes_vec=None, uses_skip_nested_volumes_vec=None, volume_guid=None, ...
code_fim
hard
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/physical_special_parameters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/physical_special_parameters.py # -*- coding: utf-8 -*- # Copyright 2023 Cohesity Inc. import cohesity_management_sdk.models.application_parameters import cohesity_management_sdk.models.file_path_parameters import cohesity_manag...
code_fim
hard
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/physical_special_parameters.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.client = MockClient() def test_client_init(self): pebble.Client(socket_path='foo') # test that constructor runs with self.assertRaises(ValueError): pebble.Client() # socket_path arg required def test_get_system_info(self): self.client.responses....
code_fim
hard
{ "lang": "python", "repo": "iCodeIN/operator", "path": "/test/test_pebble.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.client.responses.append({ "result": [ { 'path': '/etc/hosts', 'name': 'hosts', 'type': 'file', 'size': 123, 'permissions': '644', 'last-modified'...
code_fim
hard
{ "lang": "python", "repo": "iCodeIN/operator", "path": "/test/test_pebble.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: iCodeIN/operator path: /test/test_pebble.py ces: foo: override: replace command: echo foo ''' plan = pebble.Plan(raw) reformed = yaml.safe_dump(yaml.safe_load(raw)) self.assertEqual(plan.to_yaml(), reformed) self.assertEqual(str(plan), reformed) def test_...
code_fim
hard
{ "lang": "python", "repo": "iCodeIN/operator", "path": "/test/test_pebble.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kjmrknsn/azkaban path: /azkaban/job.py #!/usr/bin/env python # encoding: utf-8 """Job definition module.""" from .util import flatten, write_properties class Job(object): """Base Azkaban job. :param options: tuple of dictionaries. The final job options are built from this tuple by k...
code_fim
hard
{ "lang": "python", "repo": "kjmrknsn/azkaban", "path": "/azkaban/job.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def join_option(self, option, sep, formatter='%s'): """Helper method to join iterable options into a string. :param key: Option key. If the option doesn't exist, this method does nothing. :param sep: Separator used to concatenate the string. :param formatter: Pattern used to forma...
code_fim
hard
{ "lang": "python", "repo": "kjmrknsn/azkaban", "path": "/azkaban/job.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 42B/budget-cli path: /budget.py #!/usr/bin/env python3 from googleapiclient.discovery import build from googleapiclient.errors import HttpError from httplib2 import Http from oauth2client import file, client, tools from pathlib import Path import sys import os import datetime APP_DIR = str(Path....
code_fim
hard
{ "lang": "python", "repo": "42B/budget-cli", "path": "/budget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # temporarily change working directory to read token.json & authorize initialDir = os.getcwd() os.chdir(APP_DIR) store = file.Storage('token.json') creds = store.get() service = build('sheets', 'v4', http=creds.authorize(Http())) print("Authorization successful.") os.chdir(...
code_fim
hard
{ "lang": "python", "repo": "42B/budget-cli", "path": "/budget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": server = ThreadedServer( Agent, hostname=str(params.listen_address), port=params.listen_port, ipv6=True, logger=logger, ) server.start()<|fim_prefix|># repo: 48ix/rsagent path: /rsagent/server.py """Agent Server Entrypoint.""...
code_fim
hard
{ "lang": "python", "repo": "48ix/rsagent", "path": "/rsagent/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 48ix/rsagent path: /rsagent/server.py """Agent Server Entrypoint.""" # Standard Library import logging # Third Party from rpyc.utils.server import ThreadedServer # Project from rsagent.config import params from rsagent.services.main import Agent <|fim_suffix|>if __name__ == "__main__": se...
code_fim
easy
{ "lang": "python", "repo": "48ix/rsagent", "path": "/rsagent/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Number of clusters: ", uf.count) @staticmethod def make_unions(uf, unions_zero): for node_from, node_to in unions_zero: if not uf.connected(node_from, node_to): uf.union(node_from, node_to) if __name__ == "__main__": msc = BigClustering("clu...
code_fim
hard
{ "lang": "python", "repo": "KailinTong/Algorithms-Design-and-Analysis", "path": "/Part_2/Homework_2/q2_max_spacing_clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for node_from, node_to in unions_zero: if not uf.connected(node_from, node_to): uf.union(node_from, node_to) if __name__ == "__main__": msc = BigClustering("clustering_big.txt") # msc = BigClustering("cluster_big_forum_2.txt") msc.run()<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "KailinTong/Algorithms-Design-and-Analysis", "path": "/Part_2/Homework_2/q2_max_spacing_clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KailinTong/Algorithms-Design-and-Analysis path: /Part_2/Homework_2/q2_max_spacing_clustering.py import numpy as np from util.app.union_find import UnionFind class BigClustering: def __init__(self, txt_name): self.nodes = np.array([]) self.n_nodes = 0 self.n_bits = 0 ...
code_fim
hard
{ "lang": "python", "repo": "KailinTong/Algorithms-Design-and-Analysis", "path": "/Part_2/Homework_2/q2_max_spacing_clustering.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RomainGehrig/bumblebee-status path: /bumblebee/modules/redshift.py # pylint: disable=C0111,R0903 """Displays the current color temperature of redshift Requires the following executable: * redshift Parameters: * redshift.location : location provider, either of "geoclue2" (default), \ "i...
code_fim
hard
{ "lang": "python", "repo": "RomainGehrig/bumblebee-status", "path": "/bumblebee/modules/redshift.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_redshift_value(widget, location, lat, lon): while True: if is_terminated(): return widget.get("condition").acquire() while True: try: widget.get("condition").wait(1) except RuntimeError: continue ...
code_fim
hard
{ "lang": "python", "repo": "RomainGehrig/bumblebee-status", "path": "/bumblebee/modules/redshift.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for line in sys.stdin: arr = line.strip().split(' ') result = calc_postfix(infix2postfix(arr)) if result is not None: print(math.floor(result)) else: print('err')<|fim_prefix|># repo: Vincent0700/XiaomiOJ-Solutions path: /s016.py import sys import math ops_rule = { '+...
code_fim
hard
{ "lang": "python", "repo": "Vincent0700/XiaomiOJ-Solutions", "path": "/s016.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for line in sys.stdin: arr = line.strip().split(' ') result = calc_postfix(infix2postfix(arr)) if result is not None: print(math.floor(result)) else: print('err')<|fim_prefix|># repo: Vincent0700/XiaomiOJ-Solutions path: /s016.py import sys import math ops_rule = { '...
code_fim
hard
{ "lang": "python", "repo": "Vincent0700/XiaomiOJ-Solutions", "path": "/s016.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vincent0700/XiaomiOJ-Solutions path: /s016.py import sys import math ops_rule = { '+': 1, '-': 1, '*': 2, '/': 2 } def infix2postfix(exp_arr): expression = [] ops = [] for item in exp_arr: if item in ['+', '-', '*', '/']: while len(ops) >= 0: ...
code_fim
hard
{ "lang": "python", "repo": "Vincent0700/XiaomiOJ-Solutions", "path": "/s016.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 第i天,卖了m次的情况 for i in range(1, l): # 这里k+1,因为有0~k,k+1种情况 for m in range(k+1): if m == 0: profits[i][0][0] = profits[i-1][0][0] profits[i][0][1] = max(profits[i-1][0][1], -prices[i]) e...
code_fim
hard
{ "lang": "python", "repo": "aliyoge/Leetcode_Python", "path": "/188.买卖股票的最佳时机-iv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aliyoge/Leetcode_Python path: /188.买卖股票的最佳时机-iv.py # # @lc app=leetcode.cn id=188 lang=python3 # # [188] 买卖股票的最佳时机 IV # # https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iv/description/ # # algorithms # Hard (29.17%) # Likes: 169 # Dislikes: 0 # Total Accepted: 12.8K # Tota...
code_fim
hard
{ "lang": "python", "repo": "aliyoge/Leetcode_Python", "path": "/188.买卖股票的最佳时机-iv.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: iPatso/PyGameProjs path: /PYex/Mario Shell Defense/test.py import random, os, time, pygame, time, sys from pygame.locals import * from gameUtils import loadSoundFile, loadImage from gameSprites import Mario, Fireball, Shell, PowBlock from config import * import psyco <|fim_suffix|>for x in range...
code_fim
hard
{ "lang": "python", "repo": "iPatso/PyGameProjs", "path": "/PYex/Mario Shell Defense/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }