text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: fagan2888/Python path: /src/bloombox/schema/structs/Shelf_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: structs/Shelf.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper f...
code_fim
hard
{ "lang": "python", "repo": "fagan2888/Python", "path": "/src/bloombox/schema/structs/Shelf_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def odczytaj_stan_plywakow(self): # TODO pigpio nie ma byc uzywane do odczytu plywakow tylko mcp_wejscia self.plywak_studnia = self.gpio_pigpio.read(self.plywak_studnia_pin) self.plywak_szambo = self.gpio_pigpio.read(self.plywak_szambo_pin) self.aktualizuj_biezacy_stan(...
code_fim
hard
{ "lang": "python", "repo": "TomaszHorak/Proszkowska10", "path": "/podlewanie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TomaszHorak/Proszkowska10 path: /podlewanie.py import THutils import wejsciawyjscia import petlaczasowa import pigpio import constants from Obszar import Obszar from MojLogger import MojLogger NAZWA_SEKCJA1 = 'Sekcja1' NAZWA_SEKCJA2 = 'Sekcja2' NAZWA_SEKCJA3 = 'Sekcja3' NAZWA_SEKCJA4 = 'Sekcja4'...
code_fim
hard
{ "lang": "python", "repo": "TomaszHorak/Proszkowska10", "path": "/podlewanie.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hackmycontrolsystem/minicps path: /examples/swat-s1/init.py #!/usr/bin/env python """ swat-s1 init.py Run this script just once to create and init the sqlite table. """ <|fim_suffix|> SQLiteState._create(PATH, SCHEMA) SQLiteState._init(PATH, SCHEMA_INIT)<|fim_middle|>from minicps.states...
code_fim
medium
{ "lang": "python", "repo": "hackmycontrolsystem/minicps", "path": "/examples/swat-s1/init.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from minicps.states import SQLiteState from utils import PATH, SCHEMA, SCHEMA_INIT if __name__ == "__main__": SQLiteState._create(PATH, SCHEMA) SQLiteState._init(PATH, SCHEMA_INIT)<|fim_prefix|># repo: hackmycontrolsystem/minicps path: /examples/swat-s1/init.py #!/usr/bin/env python """ swat-...
code_fim
medium
{ "lang": "python", "repo": "hackmycontrolsystem/minicps", "path": "/examples/swat-s1/init.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: salaniz/pycocoevalcap path: /spice/get_stanford_models.py #!/usr/bin/python # This script downloads the Stanford CoreNLP models. import os from urllib.request import urlretrieve from zipfile import ZipFile CORENLP = 'stanford-corenlp-full-2015-12-09' SPICELIB = 'lib' JAR = 'stanford-corenlp-3.6....
code_fim
hard
{ "lang": "python", "repo": "salaniz/pycocoevalcap", "path": "/spice/get_stanford_models.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> jar_name = os.path.join(SPICEDIR, SPICELIB, '{}.jar'.format(JAR)) # Only download file if file does not yet exist. Else: do nothing if not os.path.exists(jar_name): print('Downloading {} for SPICE ...'.format(JAR)) url = 'http://nlp.stanford.edu/software/{}.zip'.format(CORENLP)...
code_fim
hard
{ "lang": "python", "repo": "salaniz/pycocoevalcap", "path": "/spice/get_stanford_models.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: thalium/icebox path: /third_party/virtualbox/src/libs/libxml2-2.9.4/python/tests/push.py #!/usr/bin/python -u import sys import libxml2 # Memory debug specific libxml2.debugMemory(1) <|fim_suffix|># Memory debug specific libxml2.cleanupParser() if libxml2.debugMemory(1) == 0: print("OK") el...
code_fim
hard
{ "lang": "python", "repo": "thalium/icebox", "path": "/third_party/virtualbox/src/libs/libxml2-2.9.4/python/tests/push.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Memory debug specific libxml2.cleanupParser() if libxml2.debugMemory(1) == 0: print("OK") else: print("Memory leak %d bytes" % (libxml2.debugMemory(1))) libxml2.dumpMemory()<|fim_prefix|># repo: thalium/icebox path: /third_party/virtualbox/src/libs/libxml2-2.9.4/python/tests/push.py #!/usr/...
code_fim
hard
{ "lang": "python", "repo": "thalium/icebox", "path": "/third_party/virtualbox/src/libs/libxml2-2.9.4/python/tests/push.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def Vel_Reg(self, Z_T, Slope, Intercept): vel_reg = Slope * Z_T + Intercept return vel_reg vel_reg = Vel_Reg(0, Z_T_, Slope, Intercept) plt.figure(1) plt.plot(Z_T, vel, '|', label='Points from Iteration') plt.plot(Z_T_, vel_reg, label="Linear Regression") plt.titl...
code_fim
hard
{ "lang": "python", "repo": "Daz-Riza-Seriog/Transport_Phenomena", "path": "/Movement-Transfer/E.C.4_Friction_Loss_Build_4_floor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Daz-Riza-Seriog/Transport_Phenomena path: /Movement-Transfer/E.C.4_Friction_Loss_Build_4_floor.py # Code made for Sergio Andrés Díaz Ariza # 04 August 2021 # License MIT # Transport Phenomena: Python Case of Study Friction Loss in Build from scipy.optimize import minimize import matplotlib.pypl...
code_fim
hard
{ "lang": "python", "repo": "Daz-Riza-Seriog/Transport_Phenomena", "path": "/Movement-Transfer/E.C.4_Friction_Loss_Build_4_floor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bnd_f_u = sol.x[1] bnd_f_ = (1, bnd_f_u) bnd = [bnd_f, bnd_f_] x0 = [sol.x[0] - 0.00133, sol.x[1] - 0.0133] vel.append(sol.x[1]) f_c.append(sol.x[0]) z_t_x_axe = Z_T.reshape((-1, 1)) vel_y_axe = vel model = LinearRegression(n_jobs=-1).fit(z_t_...
code_fim
hard
{ "lang": "python", "repo": "Daz-Riza-Seriog/Transport_Phenomena", "path": "/Movement-Transfer/E.C.4_Friction_Loss_Build_4_floor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def print_node(x, y): return str(x) + ' ' + str(y) + ' ' def process_nodes(x1, y1): x2, y2 = find_next_free_node(x1, y1, True) x3, y3 = find_next_free_node(x1, y1, False) result = print_node(x1, y1) + print_node(x2, y2) + print_node(x3, y3) print result for y in xrange(height...
code_fim
hard
{ "lang": "python", "repo": "jraximus/codingame-solutions", "path": "/medium/there-is-no-spoon-episode-1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jraximus/codingame-solutions path: /medium/there-is-no-spoon-episode-1.py #https://www.codingame.com/training/medium/there-is-no-spoon-episode-1 import sys import math # Don't let the machines win. You are humanity's last hope... <|fim_suffix|> return str(x) + ' ' + str(y) + ' ' def pr...
code_fim
hard
{ "lang": "python", "repo": "jraximus/codingame-solutions", "path": "/medium/there-is-no-spoon-episode-1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: googleapis/python-spanner-django path: /tests/system/django_spanner/models.py # Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd """ Different models use...
code_fim
medium
{ "lang": "python", "repo": "googleapis/python-spanner-django", "path": "/tests/system/django_spanner/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Event(models.Model): start_date = models.DateTimeField() end_date = models.DateTimeField() class Meta: constraints = [ models.CheckConstraint( check=models.Q(end_date__gt=models.F("start_date")), name="check_start_date", ),...
code_fim
hard
{ "lang": "python", "repo": "googleapis/python-spanner-django", "path": "/tests/system/django_spanner/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return str(self.num) class Event(models.Model): start_date = models.DateTimeField() end_date = models.DateTimeField() class Meta: constraints = [ models.CheckConstraint( check=models.Q(end_date__gt=models.F("start_date")), name="ch...
code_fim
medium
{ "lang": "python", "repo": "googleapis/python-spanner-django", "path": "/tests/system/django_spanner/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> repo_template = WorkflowRepositoryTemplate.new_instance(workflow_type, local_path=workflow_path, data={ 'workflow_name': workflow_name, 'workflow_description': workflow_description, 'workflow_version': repo.default_branch, 'repo_url': repo.html_url, 'repo_full_name': repo.full_...
code_fim
hard
{ "lang": "python", "repo": "crs4/life_monitor", "path": "/lifemonitor/api/models/wizards/repository_template.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> workflow_type = QuestionStep("Which type of workflow are we going to host on this repository?", description="", options=valid_workflow_types) workflow_title = QuestionStep("Choose a name for your workflow", ...
code_fim
hard
{ "lang": "python", "repo": "crs4/life_monitor", "path": "/lifemonitor/api/models/wizards/repository_template.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: crs4/life_monitor path: /lifemonitor/api/models/wizards/repository_template.py # Copyright (c) 2020-2022 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without ...
code_fim
hard
{ "lang": "python", "repo": "crs4/life_monitor", "path": "/lifemonitor/api/models/wizards/repository_template.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dell/python-powerstore path: /PyPowerStore/tests/unit_tests/entity/cluster.py from PyPowerStore.tests.unit_tests.entity.base_abstract import Entity from PyPowerStore.tests.unit_tests.data.common_data import CommonData class ClusterResponse(Entity): def __init__(self, method, url, **kwargs)...
code_fim
hard
{ "lang": "python", "repo": "dell/python-powerstore", "path": "/PyPowerStore/tests/unit_tests/entity/cluster.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.status_code, [self.data.cluster_details_1] def modify_cluster(self): return 204, self.data.cluster_details_1 def cluster_create(self): return 201, self.data.cluster_id_1 def cluster_create_validate(self): return 204, None<|fim_prefix|># repo: dell...
code_fim
hard
{ "lang": "python", "repo": "dell/python-powerstore", "path": "/PyPowerStore/tests/unit_tests/entity/cluster.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RCayre/mirage path: /mirage/libs/bt_utils/ubertooth.py from mirage.libs.bt_utils.scapy_ubertooth_layers import * from mirage.libs import io,wireless,utils from threading import Lock import usb.core,usb.util,struct,array from fcntl import ioctl class BtUbertoothDevice(wireless.Device): ''' This...
code_fim
hard
{ "lang": "python", "repo": "RCayre/mirage", "path": "/mirage/libs/bt_utils/ubertooth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> >>> device.getFirmwareVersion() '1.6' ''' return self.version def getDeviceIndex(self): ''' This method returns the index of the current Ubertooth device. :return: device's index :rtype: int :Example: >>> device.getDeviceIndex() 0 ''' return self.index def _initBT...
code_fim
hard
{ "lang": "python", "repo": "RCayre/mirage", "path": "/mirage/libs/bt_utils/ubertooth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' This method returns the firmware version in use in the current Ubertooth device. :return: firmware version :rtype: str :Example: >>> device.getFirmwareVersion() '1.6' ''' return self.version def getDeviceIndex(self): ''' This method returns the index of the current Ube...
code_fim
hard
{ "lang": "python", "repo": "RCayre/mirage", "path": "/mirage/libs/bt_utils/ubertooth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chris-wood/CCNSink path: /src/IPInputStage.py import sys import time import BaseHTTPServer import threading import multiprocessing from PendingMessageTable import * from BaseHTTPServer import * from PipelineStage import * from OutgoingMessage import * # Public reference to the stage instance for...
code_fim
hard
{ "lang": "python", "repo": "chris-wood/CCNSink", "path": "/src/IPInputStage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setPath(self, pathBytes): raise RuntimeError("not yet implemented") def buildInterest(self, chunk): path = self.path targetInterestName = (stage.paramMap["NDN_URI_PREFIX"] + str(path)).replace("//", "/") return targetInterestName class IPInputStage(PipelineStage, threading.Thread): def __...
code_fim
hard
{ "lang": "python", "repo": "chris-wood/CCNSink", "path": "/src/IPInputStage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tanmaykm/JuliaBox path: /engine/src/juliabox/plugins/user_admin/user_admin.py __author__ = 'tan' import os from juliabox.handlers import JBPluginHandler, JBPluginUI from juliabox.jbox_util import JBoxCfg from juliabox.db import JBoxUserV2, JBoxDBItemNotFound class UserAdminUIModule(JBPluginUI)...
code_fim
hard
{ "lang": "python", "repo": "tanmaykm/JuliaBox", "path": "/engine/src/juliabox/plugins/user_admin/user_admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> courses = ','.join(fetch_user.get_courses_offered()) resp = { 'user_id': fetch_user.get_user_id(), 'role': fetch_user.get_role(), 'resprof': fetch_user.get_resource_profile(), 'cores': fetch_user.get_max_cluster_cores(), 'courses...
code_fim
hard
{ "lang": "python", "repo": "tanmaykm/JuliaBox", "path": "/engine/src/juliabox/plugins/user_admin/user_admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class UserAdminHandler(JBPluginHandler): provides = [JBPluginHandler.JBP_HANDLER, JBPluginHandler.JBP_JS_TOP] @staticmethod def get_js(): return "/assets/plugins/user_admin/user_admin.js" @staticmethod def register(app): app.add_handlers(".*$", [(r"/jboxplugin/user_a...
code_fim
hard
{ "lang": "python", "repo": "tanmaykm/JuliaBox", "path": "/engine/src/juliabox/plugins/user_admin/user_admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(_NUM_LEDS): pixel = view[i * 4:i * 4 + 4] pixel[0] = _BRIGHTNESS if mode == 1: # Rainbow demo rainbow((i + t) % 240, pixel) elif mode == 2: # Night-time warm white? pixel[1] = 40 pixel[2] = 120 pixel[3] = 255 ...
code_fim
hard
{ "lang": "python", "repo": "jimmo/stair-lights", "path": "/pyboard/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Gamma pixel[1] = pixel[1] * pixel[1] * pixel[1] // 65535 pixel[2] = pixel[2] * pixel[2] * pixel[2] // 65535 _STRIP.send(pixeldata) utime.sleep_ms(delay) last_mode = mode t += 1<|fim_prefix|># repo: jimmo/stair-lights path: /pyboard/main.py import pyb import utime _BRIGH...
code_fim
hard
{ "lang": "python", "repo": "jimmo/stair-lights", "path": "/pyboard/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimmo/stair-lights path: /pyboard/main.py import pyb import utime _BRIGHTNESS = const(0b11100100) _STRIP = pyb.SPI('X', pyb.SPI.MASTER, baudrate=1000000, crc=None, bits=8, firstbit=pyb.SPI.MSB, phase=1) _BUTTON = pyb.Switch() _NUM_LEDS = 170 pixeldata = bytearray([0x00] * 4 + [0x00] * 4 * _N...
code_fim
hard
{ "lang": "python", "repo": "jimmo/stair-lights", "path": "/pyboard/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iTecAI/YeetYoink path: /server.py from json.decoder import JSONDecodeError from peerbase import Node import json import argparse from cryptography.fernet import Fernet, InvalidToken from socket import * import os import shutil import sys import logging import collections.abc, collections import r...
code_fim
hard
{ "lang": "python", "repo": "iTecAI/YeetYoink", "path": "/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'path' in kwargs.keys(): fpath = os.path.join(pformat(CONFIG.transfer.root), pformat(kwargs['path'])) if os.path.exists(fpath): if os.path.isdir(fpath): return [[f, os.path.isfile(os.path.join(fpath, f))] for f in os.listdir(fpath)] else: ...
code_fim
hard
{ "lang": "python", "repo": "iTecAI/YeetYoink", "path": "/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.yeets = {} self.yoinks = {} STATE = State() def check_timeouts_loop(): global STATE while True: for yeet in list(STATE.yeets.keys()): if STATE.yeets[yeet]['timeout_time'] < time.time(): [x.close() for x in STATE.yeets[yeet]['data'].values(...
code_fim
hard
{ "lang": "python", "repo": "iTecAI/YeetYoink", "path": "/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from application import UserMethod @login_manager.user_loader # def load_user(user_id): def load_user(session_token): # print('load_user - user_id - session_token: ', session_token) print('loading auth...') user_id = UserMethod.get_id_by_session_token(session_token)...
code_fim
hard
{ "lang": "python", "repo": "or73/Catalog", "path": "/application/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> db.init_app(app) login_manager = LoginManager(app) # Init LoginManager """ Initialize plugins """ login_manager.login_message = 'You must be logged in to access this page' login_manager.login_message_category = 'info' login_manager.session_protection = 'strong' login_manager....
code_fim
medium
{ "lang": "python", "repo": "or73/Catalog", "path": "/application/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: or73/Catalog path: /application/setup.py """ File Path: application/setup.py Description: setup the App This will have the function to create the App which will initialize the database and register all blueprints. Copyright (c) 2019. This Application has been developed by OR73. """ from flask imp...
code_fim
medium
{ "lang": "python", "repo": "or73/Catalog", "path": "/application/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyhackertarget/hackertarget path: /tests/hackertarget_test.py #!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from unittest.mock import Mock from source import hackertarget_api class hackertarget_test(unittest.TestCase): def test_traceroute_script(self): hackertarget_...
code_fim
hard
{ "lang": "python", "repo": "pyhackertarget/hackertarget", "path": "/tests/hackertarget_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hackertarget_api.hackertarget_api = Mock() hackertarget_api.hackertarget_api(9, "facebook.com") hackertarget_api.hackertarget_api.assert_called_once_with(9, "facebook.com") def test_reverse_ip_lookup_script(self): hackertarget_api.hackertarget_api = Mock() hack...
code_fim
hard
{ "lang": "python", "repo": "pyhackertarget/hackertarget", "path": "/tests/hackertarget_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: szhu3210/LeetCode_Solutions path: /LC/486.py class Solution(object): def PredictTheWinner(self, nums): """ :type nums: List[int] :rtype: bool """ ## 49ms Solution. def dfs(nums, start, end, cache): if (start, end) not in cac...
code_fim
hard
{ "lang": "python", "repo": "szhu3210/LeetCode_Solutions", "path": "/LC/486.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def win(self, player, adv, i, j): # i, j indicates the border of current nums (save mem.) # player indicates current player # adv indicate current player's advantage to the counterpart if i==j: dif = adv + self.nums[i] if player==1: ...
code_fim
hard
{ "lang": "python", "repo": "szhu3210/LeetCode_Solutions", "path": "/LC/486.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # i, j indicates the border of current nums (save mem.) # player indicates current player # adv indicate current player's advantage to the counterpart if i==j: dif = adv + self.nums[i] if player==1: res = dif>=0 else: ...
code_fim
hard
{ "lang": "python", "repo": "szhu3210/LeetCode_Solutions", "path": "/LC/486.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output[y1:y1+h1, x1:x1+w1] = roi2[0:h1, 0:w1] output[y2:y2+h2, x2:x2+w2] = roi1[0:h2, 0:w2] else: txt = 'Face swap requires exactly 2 faces!' cv2.putText(output, txt, (20, 200), font, 0.5, ui_shadow, 1, cv2.LINE_AA) cv2.putText(output, txt, (21, 201), font, 0.5,...
code_fim
hard
{ "lang": "python", "repo": "rekha-balan/MachineLearningTutorials", "path": "/Computer Vision/Facial Recognition/webcam_facedetect_cv2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rekha-balan/MachineLearningTutorials path: /Computer Vision/Facial Recognition/webcam_facedetect_cv2.py # -*- coding: utf-8 -*- """ Simple example of using haar cascades to detect faces with OpenCV @author: Jason Ioffe """ import numpy as np import cv2 FRAME_CAPTION = 'OpenCV - Haar Cascades f...
code_fim
hard
{ "lang": "python", "repo": "rekha-balan/MachineLearningTutorials", "path": "/Computer Vision/Facial Recognition/webcam_facedetect_cv2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoleplayingIsMagic/roleplayingismagic.github.io path: /_postbuild.py #!/usr/bin/env python3 # Roleplaying is Magic S4E Website Postbuild Script # This removes unneeded directories, based on what our config script did and didn't build import os import os.path import shutil print('Running Postbui...
code_fim
hard
{ "lang": "python", "repo": "RoleplayingIsMagic/roleplayingismagic.github.io", "path": "/_postbuild.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # rewrite new file line-by-line with open(original_filename, 'r') as original: with open(full_filename, 'w') as new: for line in original: # we really, /really/ don't wanna screw up webfonts, do this check if 'webfont' in line: new.write(line) else: ...
code_fim
hard
{ "lang": "python", "repo": "RoleplayingIsMagic/roleplayingismagic.github.io", "path": "/_postbuild.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bizcafe-synapse/CoffeeStats path: /CoffeeStats/CoffeeStats.py from openpyxl import load_workbook from SalesCalculator import SalesCalculator import matplotlib.pyplot as plt def main(): sc = SalesCalculator(4.75) # Open an Excel Workbook -> Sales sheet has data about cups sold wb...
code_fim
medium
{ "lang": "python", "repo": "bizcafe-synapse/CoffeeStats", "path": "/CoffeeStats/CoffeeStats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i, rate in enumerate(rates): # Add plot points for each week's sales plt.plot([i + 1], [rate], 'ro') plt.annotate(str(rate), (i + 1, rate)) projectedValue = rates[len(rates) - 1] + sc.projectSales() # projection for next week's sale plt.plot([len(rates) + 1], [projectedVal...
code_fim
medium
{ "lang": "python", "repo": "bizcafe-synapse/CoffeeStats", "path": "/CoffeeStats/CoffeeStats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Project num cups sold for upcoming week projectedHours = eval(input("How many hours will the cafe be open next week? ")) print("Projected Cup Sales: {:.2f}".format(sc.projectSalesGivenRate(projectedValue, projectedHours))) main()<|fim_prefix|># repo: bizcafe-synapse/CoffeeStats path: /Coff...
code_fim
hard
{ "lang": "python", "repo": "bizcafe-synapse/CoffeeStats", "path": "/CoffeeStats/CoffeeStats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_noEntries(self): self.assertEqual(len(self.db.getDatasets()), 0, "No table entries for datasets should exist") self.assertEqual(len(self.db.getRasterLayerGroups()), 0, "No table entries for layers should exist") def test_dbInsert(self): '''Test insert val...
code_fim
hard
{ "lang": "python", "repo": "liviajakob/data-sharing-platform", "path": "/data_sharing/tests/test_database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: liviajakob/data-sharing-platform path: /data_sharing/tests/test_database.py ''' Unittests for the Database class File: test_database.py @author: livia ''' import unittest from display_data import Database import sys, os from datetime import datetime class DatabaseTest(unittest.TestCase): '...
code_fim
hard
{ "lang": "python", "repo": "liviajakob/data-sharing-platform", "path": "/data_sharing/tests/test_database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(len(self.db.getDatasets()), 0, "No table entries for datasets should exist") self.assertEqual(len(self.db.getRasterLayerGroups()), 0, "No table entries for layers should exist") def test_dbInsert(self): '''Test insert values into database''' s...
code_fim
medium
{ "lang": "python", "repo": "liviajakob/data-sharing-platform", "path": "/data_sharing/tests/test_database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: r9y9/nlp100 path: /34.py d = {} doc = [] with open("neko.txt.mecab") as f: lines = f.readlines() sentense = [] for line in lines: line = line[:-1] if line == "EOS": if len(sentense) > 0: doc.append(sentense) sentense = [] ...
code_fim
medium
{ "lang": "python", "repo": "r9y9/nlp100", "path": "/34.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for sentense in doc: for idx in range(1, len(sentense) - 1): curr_word = sentense[idx] prev_word = sentense[idx - 1] next_word = sentense[idx + 1] if curr_word[0] == "の" and prev_word[2] == "名詞" \ and next_word[2] == "名詞": print(prev_word[0], curr...
code_fim
medium
{ "lang": "python", "repo": "r9y9/nlp100", "path": "/34.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(self, params={}): self.connection.client.takedown_request(params.get(Input.ALERT_ID), params.get(Input.TARGET)) return {Output.STATUS: True}<|fim_prefix|># repo: rapid7/insightconnect-plugins path: /plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/action...
code_fim
hard
{ "lang": "python", "repo": "rapid7/insightconnect-plugins", "path": "/plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/action.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rapid7/insightconnect-plugins path: /plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/action.py import insightconnect_plugin_runtime from .schema import TakedownRequestInput, TakedownRequestOutput, Input, Output, Component <|fim_suffix|> def run(self, params={}): ...
code_fim
hard
{ "lang": "python", "repo": "rapid7/insightconnect-plugins", "path": "/plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/action.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not smiles in self.src_cooked: self.src_cooked[smiles] = rdchiralReactants(smiles) return self.src_cooked[smiles] def run_reaction(self, src, template): key = (src, template) if key in self.cached_results: return self.cached_results[key] ...
code_fim
hard
{ "lang": "python", "repo": "Hanjun-Dai/GLN", "path": "/gln/common/reactor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hanjun-Dai/GLN path: /gln/common/reactor.py from __future__ import print_function from __future__ import absolute_import from __future__ import division import rdkit from rdkit import Chem from gln.common.cmd_args import rdchiralReaction, rdchiralReactants, rdchiralRun class _Reactor(object): ...
code_fim
hard
{ "lang": "python", "repo": "Hanjun-Dai/GLN", "path": "/gln/common/reactor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setup_model(num_chars, num_speakers, c, enable_tflite=False): print(" > Using model: {}".format(c.model)) MyModel = importlib.import_module('TTS.tts.tf.models.' + c.model.lower()) MyModel = getattr(MyModel, c.model) if c.model.lower() in "tacotron": raise NotImplementedError('...
code_fim
hard
{ "lang": "python", "repo": "ysujiang/Tacotron-2", "path": "/TTS/tts/tf/utils/generic_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if max_len is None: max_len = sequence_length.max() batch_size = sequence_length.size(0) seq_range = np.empty([0, max_len], dtype=np.int8) seq_range_expand = seq_range.unsqueeze(0).expand(batch_size, max_len) if sequence_length.is_cuda: seq_range_expand = seq_range_expa...
code_fim
hard
{ "lang": "python", "repo": "ysujiang/Tacotron-2", "path": "/TTS/tts/tf/utils/generic_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ysujiang/Tacotron-2 path: /TTS/tts/tf/utils/generic_utils.py import os import datetime import importlib import pickle import numpy as np import tensorflow as tf def save_checkpoint(model, optimizer, current_step, epoch, r, output_path, **kwargs): state = { 'model': model.weights, ...
code_fim
hard
{ "lang": "python", "repo": "ysujiang/Tacotron-2", "path": "/TTS/tts/tf/utils/generic_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @click.command(name='delete', short_help=help.DELETE_SHORT_HELP) @click.option('-r', '--region', type=str, help=help.REGION) @click.option('-ns', '--namespace', default="default", help=help.NAMESPACE) @click.option('-n', '--name', help=help.DELETE_NAME) @click.option('-f', '--force', is_flag=True, help=h...
code_fim
hard
{ "lang": "python", "repo": "tencentyun/scfcli", "path": "/tcfcli/cmds/function/delete/cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tencentyun/scfcli path: /tcfcli/cmds/function/delete/cli.py # -*- coding: utf-8 -*- from tcfcli.common.user_config import UserConfig from tcfcli.common.operation_msg import Operation from tcfcli.common.user_exceptions import * import tcfcli.common.base_infor as infor from tcfcli.help.message imp...
code_fim
hard
{ "lang": "python", "repo": "tencentyun/scfcli", "path": "/tcfcli/cmds/function/delete/cli.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jlaumonier/mlsurvey path: /test/test_sl/test_model/test_data_pandas.py import unittest import numpy as np import pandas as pd import mlsurvey as mls class TestDataPanda(unittest.TestCase): def test_init_data_all_empty_pandas(self): """ :test : mlsurvey.model.DataPandas() ...
code_fim
hard
{ "lang": "python", "repo": "jlaumonier/mlsurvey", "path": "/test/test_sl/test_model/test_data_pandas.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_merge_all_should_merge_pandas(self): """ :test : mlsurvey.modles.Data.merge_all() :condition : data contains x, y and y_pred. Dataframe is pandas :main_result : data are merge into one array """ x = np.array([[1, 2], [3, 4]]) y = np.arra...
code_fim
hard
{ "lang": "python", "repo": "jlaumonier/mlsurvey", "path": "/test/test_sl/test_model/test_data_pandas.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(argv=None): args = argument_parser().parse_args(argv) print(args) df = pd.read_csv( args.filename, parse_dates=[args.timestamp] ) df = df.rename( columns={ args.timestamp: 'timestamp', args.value: 'value' })[['timestamp'...
code_fim
hard
{ "lang": "python", "repo": "cliffxuan/puzzle", "path": "/energy_consumption/process_time_series.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cliffxuan/puzzle path: /energy_consumption/process_time_series.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ """ import argparse import datetime as dt import pandas as pd import matplotlib.pyplot as plt def valid_date(date: str) -> pd.Timestamp: """ validate date """ try...
code_fim
hard
{ "lang": "python", "repo": "cliffxuan/puzzle", "path": "/energy_consumption/process_time_series.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def test_b_pick_value_from_field(self): value, error = mel.rotomap.relate.pick_value_from_field( numpy.array([0, 0]), [(numpy.array([0, 0]), [1, 2])]) self.assertEqual(0.0, error) self.assertTrue(([1.0, 2.0] == value).all(), True)<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "littleboss/mel", "path": "/py/mel/rotomap/relate__t.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: littleboss/mel path: /py/mel/rotomap/relate__t.py """Test suite for mel.rotomap.relate.""" # ============================================================================= # TEST PLAN # ----------------------------------------------------------------------------- ...
code_fim
medium
{ "lang": "python", "repo": "littleboss/mel", "path": "/py/mel/rotomap/relate__t.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KevinHock/checkov path: /checkov/cloudformation/context_parser.py import logging import operator from functools import reduce import re COMMENT_REGEX = re.compile(r'(checkov:skip=) *([A-Z_\d]+)(:[^\n]+)?') class ContextParser(object): """ CloudFormation template context parser """ ...
code_fim
hard
{ "lang": "python", "repo": "KevinHock/checkov", "path": "/checkov/cloudformation/context_parser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Search deep for keys and get their values""" keys = [] if isinstance(cfn_dict, dict): for key in cfn_dict: pathprop = path[:] pathprop.append(key) if key == search_text: pathprop.append(cfn_dict[key]...
code_fim
hard
{ "lang": "python", "repo": "KevinHock/checkov", "path": "/checkov/cloudformation/context_parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Function to integrate. xmin : `~astropy.units.Quantity` or array-like Integration range minimum xmax : `~astropy.units.Quantity` or array-like Integration range minimum ndecade : int, optional Number of grid points per decade used for the integration. De...
code_fim
hard
{ "lang": "python", "repo": "mirca/gammapy", "path": "/gammapy/spectrum/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mirca/gammapy path: /gammapy/spectrum/utils.py # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from astropy.units import Quantity from .. utils.energy import EnergyBounds __all__...
code_fim
hard
{ "lang": "python", "repo": "mirca/gammapy", "path": "/gammapy/spectrum/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: snkellner/ontap-rest-python path: /examples/rest_api/snapshot_operations.py #! /usr/bin/env python3 """ ONTAP REST API Python Sample Scripts This script was developed by NetApp to help demonstrate NetApp technologies. This script is not officially supported as a standard NetApp product. Purpos...
code_fim
hard
{ "lang": "python", "repo": "snkellner/ontap-rest-python", "path": "/examples/rest_api/snapshot_operations.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ snapshot delete""" print("=============================================") print() show_snapshot(cluster, headers_inc) print() vol_uuid = input("Enter the UUID of the Volume to be updated [UUID]:-") snapshot_uuid = input( "Enter the UUID of the snapshot to be Delete...
code_fim
hard
{ "lang": "python", "repo": "snkellner/ontap-rest-python", "path": "/examples/rest_api/snapshot_operations.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def show_snapshot(cluster: str, headers_inc: str): """ list snapshot""" show_volume(cluster, headers_inc) print() vol_name = input( "Enter the Volume from which the Snapshot need to be listed:-") vol_uuid = get_key_volumes(vol_name, cluster, headers_inc) print() print("...
code_fim
hard
{ "lang": "python", "repo": "snkellner/ontap-rest-python", "path": "/examples/rest_api/snapshot_operations.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Amplify audio by a rate (e.g., louder or lower) class Amplify(object): def __init__(self, rate=(0.2, 2)): assert is_list_or_tuple(rate) self.rate = to_tuple(rate) ''' Test result: For an audio with a median voice, if rate=0.2, I...
code_fim
hard
{ "lang": "python", "repo": "felixchenfy/Speech-Commands-Classification-by-LSTM-PyTorch", "path": "/utils/lib_augment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Add padding if self.keep_size: z = np.zeros(n) if time>0: # pad at left data = np.concatenate((z, data)) else: data = np.concatenate((data, z)) # return audio.data = d...
code_fim
hard
{ "lang": "python", "repo": "felixchenfy/Speech-Commands-Classification-by-LSTM-PyTorch", "path": "/utils/lib_augment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: felixchenfy/Speech-Commands-Classification-by-LSTM-PyTorch path: /utils/lib_augment.py ''' Data augmentation on audio. Written in the form of a set of Classes. ''' if 1: # Set path import sys, os ROOT = os.path.dirname(os.path.abspath(__file__))+"/../" # root of the project sys.path...
code_fim
hard
{ "lang": "python", "repo": "felixchenfy/Speech-Commands-Classification-by-LSTM-PyTorch", "path": "/utils/lib_augment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: codeforamerica/intake path: /intake/views/applicant_form_view_base.py from django.views.generic.edit import FormView from django.utils.translation import ugettext as _ from intake import models, utils import intake.services.events_service as EventsService import intake.services.messages_service a...
code_fim
hard
{ "lang": "python", "repo": "codeforamerica/intake", "path": "/intake/views/applicant_form_view_base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> EventsService.form_page_complete(self) utils.save_form_data_to_session( self.request, self.session_key, form.data) def form_valid(self, form): self.log_page_completion_and_save_data(form) return super().form_valid(form) def form_invalid(self, form): ...
code_fim
hard
{ "lang": "python", "repo": "codeforamerica/intake", "path": "/intake/views/applicant_form_view_base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cosmos-Break/leetcode path: /653.两数之和-iv-输入-bst.py # # @lc app=leetcode.cn id=653 lang=python3 # # [653] 两数之和 IV - 输入 BST # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left...
code_fim
medium
{ "lang": "python", "repo": "Cosmos-Break/leetcode", "path": "/653.两数之和-iv-输入-bst.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def findTarget(self, root: TreeNode, k: int) -> bool: val_set = set() def dfs(node): if node is None: return False if k - node.val in val_set: return True else: val_set.add(node.val) ret...
code_fim
hard
{ "lang": "python", "repo": "Cosmos-Break/leetcode", "path": "/653.两数之和-iv-输入-bst.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_success_logging(self) -> None: """Test success logging.""" self.logger.setLevel(LogLevels.SUCCESS) with self.assertLogs(self.logger, LogLevels.SUCCESS) as context: self.logger.success(self.msg) self.assertEqual(context.output, ...
code_fim
hard
{ "lang": "python", "repo": "ITProKyle/f-cli", "path": "/tests/test_logging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ITProKyle/f-cli path: /tests/test_logging.py """Tests for src/f_cli/logging.py.""" import logging from unittest import TestCase from f_cli import __version__ from f_cli.logging import FLogger, LogLevels, setup_logging logging.setLoggerClass(FLogger) class TestLogLevels(TestCase): """Tests...
code_fim
hard
{ "lang": "python", "repo": "ITProKyle/f-cli", "path": "/tests/test_logging.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class TestSetupLoggingFunction(TestCase): """Test the setup_logging function.""" f_logger: logging.Logger = logging.getLogger('f-cli') boto3_logger: logging.Logger = logging.getLogger('boto3') botocore_logger: logging.Logger = logging.getLogger('botocore') def test_setup_logging_inf...
code_fim
hard
{ "lang": "python", "repo": "ITProKyle/f-cli", "path": "/tests/test_logging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: frosenwind/dnn-quant path: /scripts/train_net.py #!/bin/sh ''''exec python3 -u -- "$0" ${1+"$@"} # ''' # #! /usr/bin/env python3 # Copyright 2016 Euclidean Technologies Management LLC All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this ...
code_fim
hard
{ "lang": "python", "repo": "frosenwind/dnn-quant", "path": "/scripts/train_net.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("Constructing model ...") model = model_utils.get_training_model(session, config, verbose=True) if config.early_stop is not None: print("Training will early stop without " "improvement after %d epochs."%config.early_stop) train_history = list() valid_history...
code_fim
hard
{ "lang": "python", "repo": "frosenwind/dnn-quant", "path": "/scripts/train_net.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Open-EO/openeo-python-client path: /tests/rest/datacube/test_mlmodel.py import pytest from openeo import BatchJob from openeo.rest.mlmodel import MlModel from .conftest import API_URL FEATURE_COLLECTION_1 = { "type": "FeatureCollection", "features": [ { "type": "Feat...
code_fim
hard
{ "lang": "python", "repo": "Open-EO/openeo-python-client", "path": "/tests/rest/datacube/test_mlmodel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("model_factory", [ (lambda con100: con100.load_ml_model("my-j08")), (lambda con100: "my-j08"), (lambda con100: BatchJob("my-j08", con100)), ]) def test_predict_random_forest(con100, model_factory): ml_model = model_factory(con100) cube = con100.load_collection...
code_fim
hard
{ "lang": "python", "repo": "Open-EO/openeo-python-client", "path": "/tests/rest/datacube/test_mlmodel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> git-replace-patch abcd1234 --affectedbranches < abcd1234.patch # prints: # mycurrentbranch # origin/mycurrentbranch # master # origin/master # you can now ask the user which branches are safe to rebase (or figure # it out automaticall...
code_fim
hard
{ "lang": "python", "repo": "phodge/dotfiles", "path": "/bin/experimental/git-edit-patch", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> If you want to use git-replace-patch in a non-interactive context, you will need to use --rewritebranches=... to tell it which branches it's allowed to rebase safely (other than the current branch, which is assumed). To do this in a programmatic way, you can use --affectedbranches to get a...
code_fim
hard
{ "lang": "python", "repo": "phodge/dotfiles", "path": "/bin/experimental/git-edit-patch", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: phodge/dotfiles path: /bin/experimental/git-edit-patch #!/usr/bin/env python3 import click @click.command() def main(): """ This abomination allows you to modify the changes included in commit COMMIT by supplying an entirely new patch (diff). EXAMPLES Replace whatever nons...
code_fim
medium
{ "lang": "python", "repo": "phodge/dotfiles", "path": "/bin/experimental/git-edit-patch", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> io.write("<div class='figure-div'>\n") io.write("<div class='figure-title'><a name='summary'>1, AfterQC summary</a></div>\n") io.write("<table class='summary-table'>\n") self.outputRow(io, "AfterQC Version:", self.version) self.outputRow(io, "sequencing:", self.getS...
code_fim
hard
{ "lang": "python", "repo": "vinsilico/prokseq", "path": "/depend/afterqc/AfterQC-master/qcreporter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vinsilico/prokseq path: /depend/afterqc/AfterQC-master/qcreporter.py import os,sys def formatDivID(str): str = str.replace(" ", "-") str = str.replace(".", "-") str = str.replace("/", "-") return str def formatNumber(num): num = float(num) unit = ["", "K", "M", "G", "T",...
code_fim
hard
{ "lang": "python", "repo": "vinsilico/prokseq", "path": "/depend/afterqc/AfterQC-master/qcreporter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alishakiba/galois path: /galois/poly.py import numpy as np from .conversion import decimal_to_poly, poly_to_decimal, poly_to_str from .gf import GF from .gf2 import GF2 class Poly: """ A polynomial class with coefficients in any Galois field. Parameters ---------- coeffs :...
code_fim
hard
{ "lang": "python", "repo": "alishakiba/galois", "path": "/galois/poly.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # c(x) = a(x) * b(x) a, b = Poly._verify_inputs(self, other) a_degree = a.size - 1 b_degree = b.size - 1 c = self.field.Zeros(a_degree + b_degree + 1) for i in np.nonzero(b)[0]: c[i:i + a.size] += a*b[i] return Poly(c, field=self.field) ...
code_fim
hard
{ "lang": "python", "repo": "alishakiba/galois", "path": "/galois/poly.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __sub__(self, other): # c(x) = a(x) - b(x) a, b = Poly._verify_inputs(self, other) c = self.field.Zeros(max(a.size, b.size)) c[-a.size:] = a c[-b.size:] -= b return Poly(c, field=self.field) def __mul__(self, other): # c(x) = a(x) * b(x)...
code_fim
hard
{ "lang": "python", "repo": "alishakiba/galois", "path": "/galois/poly.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }