text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def __str__(self): return self.name<|fim_prefix|># repo: tykling/tlsscout path: /src/group/models.py from django.db import models ### configuration groups class Group(models.Model): <|fim_middle|> name = models.CharField(max_length=50) interval_hours = models.PositiveIntegerField(defa...
code_fim
hard
{ "lang": "python", "repo": "tykling/tlsscout", "path": "/src/group/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: while True: current_scan = lidar.pop_recent_scan if current_scan is not None: for i in range(current_scan.__len__()): rads = current_scan[i].theta * pi / 180.0 x = current_scan[i].radius/25 * cos(rads) ...
code_fim
hard
{ "lang": "python", "repo": "GabeCasciano/Capstone20", "path": "/AutonomousPkg/build/lib/Autonomous/Sensors/LIDAR/LIDAR_Vis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GabeCasciano/Capstone20 path: /AutonomousPkg/build/lib/Autonomous/Sensors/LIDAR/LIDAR_Vis.py from Sensors.LIDAR.LIDAR_Interface import LIDAR_Interface from Sensors.LIDAR.Utils import Ray, Stack from math import cos, sin, pi, floor import pygame import time screen_x = 400 screen_y = 400 lidar = L...
code_fim
hard
{ "lang": "python", "repo": "GabeCasciano/Capstone20", "path": "/AutonomousPkg/build/lib/Autonomous/Sensors/LIDAR/LIDAR_Vis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zejn/sigeo path: /sigeo/obcine/management/commands/sigeo_export_obcine.py from django.core.management.base import BaseCommand from optparse import make_option class Command(BaseCommand): help = "Izvozi bazo za v Google Fusion tables" option_list = BaseCommand.option_list <|fim_...
code_fim
hard
{ "lang": "python", "repo": "zejn/sigeo", "path": "/sigeo/obcine/management/commands/sigeo_export_obcine.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> row = [ ob.ob_id, ob.ob_ime, ob.ob_uime, ob.ob_tip, ob.ob_pov, pt.kml, ob.the_geom.kml, ] w.writerow([unicode(i).encode('utf-8') for i in row]) print...
code_fim
hard
{ "lang": "python", "repo": "zejn/sigeo", "path": "/sigeo/obcine/management/commands/sigeo_export_obcine.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> textdocs = [] for line in lines: text = line.value facs = str(line.attribute_by_name('facs').value) zone = findbyID(zones, facs) ulx = int(zone.ulx) uly = int(zone.uly) lrx = int(zone.lrx) lry = int(zone.lry) textdocs.append({'id...
code_fim
hard
{ "lang": "python", "repo": "DDMAL/liberusualis", "path": "/ingest/MEIText2Solr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ For each line of text in the list "lines", this function gets the corresponding box coordinates and saves the line as a doc in the "text" database. """ print '\nProcessing ' + str(ffile) + '...' try: meifile = convert(str(ffile)) except Exception, e: lg.debug("...
code_fim
hard
{ "lang": "python", "repo": "DDMAL/liberusualis", "path": "/ingest/MEIText2Solr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DDMAL/liberusualis path: /ingest/MEIText2Solr.py import pymei import sys import os import solr import uuid from pymei.Import import convert solrconn = solr.SolrConnection("http://132.206.14.42:8080/liber-search") idcache = {} def findbyID(llist, mid): """ Returns the object in llist that ...
code_fim
hard
{ "lang": "python", "repo": "DDMAL/liberusualis", "path": "/ingest/MEIText2Solr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lord-Haji/PokemonShowdownBot path: /commands.py oreboard = {} with open('plugins/scoreboard.yaml', 'a+') as yf: yf.seek(0, 0) Scoreboard = yaml.load(yf) if not Scoreboard: # Empty yaml file set Scoreboard to None, but an empty dict is better Scoreboard = {} def Command(self, ...
code_fim
hard
{ "lang": "python", "repo": "Lord-Haji/PokemonShowdownBot", "path": "/commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Chat games go here # Anagrams of Pokemon names elif cmd == 'anagram': if msg == 'new': if canStartGame(self, user): if room.game: return 'A game is already running somewhere', False room.game = Anagram() ...
code_fim
hard
{ "lang": "python", "repo": "Lord-Haji/PokemonShowdownBot", "path": "/commands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lord-Haji/PokemonShowdownBot path: /commands.py return '{user} is already whitelisted'.format(user = msg), True self.details['whitelist'].append(msg) return 'User {usr} added to whitelist.'.format(usr = msg), True elif cmd == 'removewl': if canAddUser...
code_fim
hard
{ "lang": "python", "repo": "Lord-Haji/PokemonShowdownBot", "path": "/commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class MultiProcessSafeDailyRotatingFileHandler(BaseRotatingHandler): """ Similar with `logging.TimedRotatingFileHandler`, while this one is - Multi process safe - Rotate at midnight only - Utc not supported - This log will create day by day. """ def __init__(self, filename...
code_fim
hard
{ "lang": "python", "repo": "liuxiaokaiA/truck_scheduling", "path": "/log.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): # 1.The configuration below has no file to output. self.LOGGING_CONFIG = LOGGING # 2. To get the absolute path of the log file. # Log file is stored under the 'log' folder. If it not existed, # create it auto. dir_path = os.path.join(...
code_fim
hard
{ "lang": "python", "repo": "liuxiaokaiA/truck_scheduling", "path": "/log.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuxiaokaiA/truck_scheduling path: /log.py # coding: utf-8 """ The name of the log file changes automatically based on time. LOGGING_CONFIG: the config file about the logging. <logging.config.dictConfig>: such like next, logger --> handler --> formatter --> output # Create log...
code_fim
hard
{ "lang": "python", "repo": "liuxiaokaiA/truck_scheduling", "path": "/log.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NicoRio42/mapant-scripts path: /lidar_delete_overlap/lidar_delete_overlap.py import os import json from shutil import copyfile # List of png files in in folder try: png_files = [f for f in os.listdir("in") if f.endswith(".png")] pgw_files = [f for f in os.listdir("in") if f.endswith(".pg...
code_fim
hard
{ "lang": "python", "repo": "NicoRio42/mapant-scripts", "path": "/lidar_delete_overlap/lidar_delete_overlap.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if tile: copyfile(("in\\" + f), ("out_overlap\\" + f)) else: copyfile(("in\\" + f), ("out\\" + f)) done_files += 1 print(str(done_files) + " files done under a total of " + str(total_files)) done_files = 0 total_files = len(pgw_files) for f in pgw_files: tile_number = ...
code_fim
hard
{ "lang": "python", "repo": "NicoRio42/mapant-scripts", "path": "/lidar_delete_overlap/lidar_delete_overlap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Building Window window = sg.Window('Prep Fasta Data', layout, size=(600, 150)) while True: event, values = window.read() if event == sg.WIN_CLOSED or event == "Exit": break elif event == "Create New Database": createNewDatabase(values["-IN-"],...
code_fim
hard
{ "lang": "python", "repo": "annhientran/CysChemopedia", "path": "/src/processData/prepareFastaData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: annhientran/CysChemopedia path: /src/processData/prepareFastaData.py """ This file is to prep Fasta csv files to generate a new one with added processed data columns """ import PySimpleGUI as sg import csv from datetime import datetime humanFasta = 'assets/data/HumanFasta' mouseFasta =...
code_fim
hard
{ "lang": "python", "repo": "annhientran/CysChemopedia", "path": "/src/processData/prepareFastaData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ def __init__(self, **kwargs): '''An object to hold a Kubernete Pod. Arg: Labels: DesiredState: CurrentState: ''' param_defaults = { 'Labels': None, 'DesiredState': None, 'CurrentState': None} for (param, default) in param_defaults.iteritems...
code_fim
hard
{ "lang": "python", "repo": "pkilambi/python-kubernetes", "path": "/kubernetes/pod.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pkilambi/python-kubernetes path: /kubernetes/pod.py r """ def __init__(self, **kwargs): '''An object to hold a Kubernete RestartPolicy. Arg: Always: OnFailure: Never: Only one of the following restart policies may be specified. If none of the following policies is sp...
code_fim
hard
{ "lang": "python", "repo": "pkilambi/python-kubernetes", "path": "/kubernetes/pod.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pkilambi/python-kubernetes path: /kubernetes/pod.py ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): ''' A dic representation of this kubernetes.RestartPolicyAlways instance. The return values uses the same key names as the JSON representation. Returns: ...
code_fim
hard
{ "lang": "python", "repo": "pkilambi/python-kubernetes", "path": "/kubernetes/pod.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: satyamroy001/Magnum path: /app/textToManim.py import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from api import GPT, Example, UIConfig from api import demo_web_app from glob import glob def read_file(path_to_file): retval = "" file = open(path_t...
code_fim
hard
{ "lang": "python", "repo": "satyamroy001/Magnum", "path": "/app/textToManim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># reade file and convert it to source string and target string tuples #source_folder = "./Training_Samples/source/" #target_folder = "./Training_Samples/target/" source_names = [item for item in sorted(glob("./Training_Example/sources/*"))] target_names = source_names = [item for item in sorted(glob("./Tr...
code_fim
hard
{ "lang": "python", "repo": "satyamroy001/Magnum", "path": "/app/textToManim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuangyh/chord path: /src/solo/lisp_loop.py # -*- coding: utf-8 -*- import lisp import proc import pycode import context def prim_loop(compiler, src): if src[2] != lisp.Symbol('<-'): raise SyntaxError, src[:3] loop_binding = src[1] loop_init = src[3] loop_body = src[4:] ...
code_fim
hard
{ "lang": "python", "repo": "kuangyh/chord", "path": "/src/solo/lisp_loop.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if len(src) == 1: return pycode.create('continue\nNone') loop_name = context.curr()['LOOP_STACK'][-1] return pycode.create( '%s = $#\ncontinue\n%s' % (loop_name, loop_name), compiler.compile(src[1])) def prim_break(compiler, src): if len(src) == 1: return pycode.create('break\...
code_fim
medium
{ "lang": "python", "repo": "kuangyh/chord", "path": "/src/solo/lisp_loop.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def prim_break(compiler, src): if len(src) == 1: return pycode.create('break\nNone') loop_name = context.curr()['LOOP_STACK'][-1] return pycode.create( '%s = $#\nbreak\n%s' % (loop_name, loop_name), compiler.compile(src[1])) PRIMS = { 'loop' : prim_loop, 'cont' : prim_cont, 'b...
code_fim
hard
{ "lang": "python", "repo": "kuangyh/chord", "path": "/src/solo/lisp_loop.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> un = autocreate_username('.+') # this shouldn't happen but it could! assert len(un) and not un.startswith('.+'), 'Unexpected: %s' % un @mock.patch.object(settings, 'MAX_GEN_USERNAME_TRIES', 3) @fudge.patch('mkt.users.utils.UserProfile.objects.filter') def test_too_many_tries(...
code_fim
medium
{ "lang": "python", "repo": "petercpg/zamboni", "path": "/mkt/users/tests/test_user_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: petercpg/zamboni path: /mkt/users/tests/test_user_utils.py import fudge import mock from nose.tools import eq_ from django.conf import settings import amo.tests from mkt.users.utils import autocreate_username class TestAutoCreateUsername(amo.tests.TestCase): <|fim_suffix|> un = autocr...
code_fim
medium
{ "lang": "python", "repo": "petercpg/zamboni", "path": "/mkt/users/tests/test_user_utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_invalid_characters(self): eq_(autocreate_username('testaccount+slug'), 'testaccountslug') def test_empty_username_is_a_random_hash(self): un = autocreate_username('.+') # this shouldn't happen but it could! assert len(un) and not un.startswith('.+'), 'Unexpected:...
code_fim
medium
{ "lang": "python", "repo": "petercpg/zamboni", "path": "/mkt/users/tests/test_user_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @property def model(self) -> Model: return self._task.model @property def dataset(self) -> Dataset: return self._task.model.dataset @abstractmethod def run(self) -> None: raise NotImplementedError @abstractmethod def get_trajectory(self, sort_by: ...
code_fim
medium
{ "lang": "python", "repo": "automl/SMAC3", "path": "/benchmark/src/wrappers/wrapper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """List of x and y values of the incumbents over time. x depends on ``sort_by``.""" raise NotImplementedError @abstractmethod def get_samples(self) -> tuple[list["Configuration"]]: raise NotImplementedError<|fim_prefix|># repo: automl/SMAC3 path: /benchmark/src/wrappers/w...
code_fim
medium
{ "lang": "python", "repo": "automl/SMAC3", "path": "/benchmark/src/wrappers/wrapper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: automl/SMAC3 path: /benchmark/src/wrappers/wrapper.py from __future__ import annotations from abc import abstractmethod from src.datasets.dataset import Dataset from src.models.model import Model from src.tasks.task import Task class Wrapper: supported_versions: list[str] = [] def __...
code_fim
hard
{ "lang": "python", "repo": "automl/SMAC3", "path": "/benchmark/src/wrappers/wrapper.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> list = [] for i in range(1,11): list.append(get_A_score_by_pos(i)) print(list) # with two players, the second player always wins, i guess plt.scatter(x=range(1,11), y=list) plt.show()<|fim_prefix|># repo: StewSchrieff/riddlerHoopGame path: /PreviousRiddler/gameTheory.py import math import random ...
code_fim
hard
{ "lang": "python", "repo": "StewSchrieff/riddlerHoopGame", "path": "/PreviousRiddler/gameTheory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StewSchrieff/riddlerHoopGame path: /PreviousRiddler/gameTheory.py import math import random import seaborn import matplotlib.pyplot as plt def get_A_score_by_pos(playerApick): # playerApick = 0 playerBpick = 0 playerCpick = 0 playerAscore = 0 playerBscore = 0 playerCsc...
code_fim
hard
{ "lang": "python", "repo": "StewSchrieff/riddlerHoopGame", "path": "/PreviousRiddler/gameTheory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.kernel = cv2.getStructuringElement( cv2.MORPH_ELLIPSE, (2 * self.erosion_size + 1, 2 * self.erosion_size + 1) ) # LOOP ================================================================= rospy.spin() def process_map_img(self, map, height, wi...
code_fim
hard
{ "lang": "python", "repo": "methylDragon/map_postprocess", "path": "/map_postprocess/src/map_postprocess", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: methylDragon/map_postprocess path: /map_postprocess/src/map_postprocess #!/usr/bin/env python import rospy import cv2 import numpy as np from nav_msgs.msg import OccupancyGrid # UTILITY FUNCTIONS ============================================================ def make_img(shape, color, dtype=np....
code_fim
hard
{ "lang": "python", "repo": "methylDragon/map_postprocess", "path": "/map_postprocess/src/map_postprocess", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: 17891691876/HupuTest path: /businessView/login_View.py import logging from common.common_fun import Common,By from common.desired_caps import appium_desired from selenium.common.exceptions import NoSuchElementException import time class LoginView(Common): <|fim_suffix|> logging.info(...
code_fim
hard
{ "lang": "python", "repo": "17891691876/HupuTest", "path": "/businessView/login_View.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> logging.info(">>>>>>>>start login<<<<<<<<<") time.sleep(5) self.driver.find_element(*self.usermore).click() try: self.driver.find_element(*self.mobile_login_new).click() except NoSuchElementException: pass else: se...
code_fim
hard
{ "lang": "python", "repo": "17891691876/HupuTest", "path": "/businessView/login_View.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.driver.find_element(*self.mobile_login_new).click() self.driver.find_element(*self.acount_login).click() #self.driver.find_element(*self.login_button).click() self.driver.find_element(*self.username_type).send_keys(username) self.driver.find_element(*self.p...
code_fim
hard
{ "lang": "python", "repo": "17891691876/HupuTest", "path": "/businessView/login_View.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: VetoProjects/AudioPython path: /test/test_minimal.py #!/usr/bin/env python # That's some obfuscated shit, I know import math from AudioPython import * from AudioPython import util s = math.sin <|fim_suffix|>def test_minimal(): channels = ((minimal(),),) samples = compute_samples(channel...
code_fim
hard
{ "lang": "python", "repo": "VetoProjects/AudioPython", "path": "/test/test_minimal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_minimal(): channels = ((minimal(),),) samples = compute_samples(channels) for i in range(1000): yield_raw(samples) if __name__ == "__main__": test_minimal()<|fim_prefix|># repo: VetoProjects/AudioPython path: /test/test_minimal.py #!/usr/bin/env python # That's some obfu...
code_fim
hard
{ "lang": "python", "repo": "VetoProjects/AudioPython", "path": "/test/test_minimal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def minimal(): t = 0 while 1: t += 0.000013 q = 1 - (t * 2.15 % 1) yield clamp(s(27*q**24)*0.9+3*s(((q*4) % 1)**5*3) * min(0.1, max(-0.1, 9*s(60*(1+q)*s(690+q*3)))), -1, 1) def test_minimal(): channels = ((minimal(),),) samples = compute_sampl...
code_fim
medium
{ "lang": "python", "repo": "VetoProjects/AudioPython", "path": "/test/test_minimal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class UserGroupMemberFilter(filters.FilterSet): account = IcontainsFilter(name='username') # 一级部门领导直接部门就是一级部门 departmentLevel2 = django_filters.CharFilter(method='filter_by_l2_dep') departmentLevel1 = django_filters.CharFilter(method='filter_by_l1_dep') def filter_by_l2_dep(self, qs,...
code_fim
hard
{ "lang": "python", "repo": "ycheng-aa/gated_launch_backend", "path": "/apps/user_group/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ycheng-aa/gated_launch_backend path: /apps/user_group/filters.py import django_filters from django.contrib.auth import get_user_model from django_filters import rest_framework as filters from apps.auth.models import Department from apps.common.filters import IcontainsFilter from .models import Us...
code_fim
medium
{ "lang": "python", "repo": "ycheng-aa/gated_launch_backend", "path": "/apps/user_group/filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vintagexav/DeepPavlov path: /deeppavlov/dataset_readers/line_reader.py # Copyright 2017 Neural Networks and Deep Learning lab, MIPT # # 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...
code_fim
medium
{ "lang": "python", "repo": "vintagexav/DeepPavlov", "path": "/deeppavlov/dataset_readers/line_reader.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from deeppavlov.core.common.registry import register from deeppavlov.core.data.dataset_reader import DatasetReader @register('line_reader') class LineReader(DatasetReader): """Read txt file by lines""" def read(self, data_path: str = None, *args, **kwargs) -> Dict: """Read lines from tx...
code_fim
medium
{ "lang": "python", "repo": "vintagexav/DeepPavlov", "path": "/deeppavlov/dataset_readers/line_reader.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def plot_box(ax, p1, p2, *args, **kwargs): """Plots a cube that spans between p1 and p2 on the given axis. Args: ax (matplolib axis): matplolib axis object p1 (tuple, list, np.ndarray): First cube point p1 is of length 3 (xmin, ymin, zmax). p2 (tuple, list, np.ndarray):...
code_fim
hard
{ "lang": "python", "repo": "gamdow/discretisedfield", "path": "/discretisedfield/util/util.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> info["slice"] = axesdict[sliceaxis] axes = tuple(filter(lambda val: val != info["slice"], (0, 1, 2))) info["haxis"], info["vaxis"] = axes return info def plot_line(ax, p1, p2, *args, **kwargs): """Plot a line between points p1 and p2 on axis ax.""" ax.plot(*zip(p1, p2), *args, *...
code_fim
hard
{ "lang": "python", "repo": "gamdow/discretisedfield", "path": "/discretisedfield/util/util.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gamdow/discretisedfield path: /discretisedfield/util/util.py import collections import numpy as np import itertools as it import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable axesdict = collections.OrderedDict([("x", 0), ("y", 1), ("z", 2)]) def as_array(mes...
code_fim
hard
{ "lang": "python", "repo": "gamdow/discretisedfield", "path": "/discretisedfield/util/util.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> theta_div = math.pi/3 triangle_length = a/math.sqrt(3) pts = [] for i in range(0,4): pts.append(Point.from_dpoint(pya.DPoint(triangle_length*math.cos(i*theta_div-math.pi/2), triangle_length*math.sin(i*theta_div-math.pi/2)))) return pts #create the right...
code_fim
hard
{ "lang": "python", "repo": "lukasc-ubc/SiEPIC_EBeam_PDK", "path": "/klayout_dot_config/tech/EBeam/pymacros/pcells_EBeam_Beta/phc_H0c_new.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lukasc-ubc/SiEPIC_EBeam_PDK path: /klayout_dot_config/tech/EBeam/pymacros/pcells_EBeam_Beta/phc_H0c_new.py import pya from pya import * from SiEPIC.utils import get_technology, get_technology_by_name from SiEPIC.utils import arc, arc_wg, arc_to_waveguide, points_per_circle#,layout import math c...
code_fim
hard
{ "lang": "python", "repo": "lukasc-ubc/SiEPIC_EBeam_PDK", "path": "/klayout_dot_config/tech/EBeam/pymacros/pcells_EBeam_Beta/phc_H0c_new.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def equivilency(self, app_name): # cmd(f'notify-send "equivilancy" "{app_name}"') aliases = self.get_aliases(self.settings.get("aliases")) # print("aliases : ", aliases) if app_name in {"web browser", "browser", "google", "google machine", "internet", "internet program"...
code_fim
hard
{ "lang": "python", "repo": "calacuda/mycroft-app-launcher", "path": "/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: calacuda/mycroft-app-launcher path: /__init__.py from mycroft import MycroftSkill, intent_handler from os import system as cmd from os.path import join class Launcher(MycroftSkill): def __init__(self): super().__init__() #self.initialize() def initialize(self): ...
code_fim
hard
{ "lang": "python", "repo": "calacuda/mycroft-app-launcher", "path": "/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return f"{self.SQL_TYPE}({self.DEFAULT_LENGTH})" class ForeignKey: field = Integer SQL_TYPE = field.SQL_TYPE PYTHON_TYPE = field.PYTHON_TYPE def __init__(self, table, field=None, **kwargs): self.table = table self.field = (field or self.field)(None) @proper...
code_fim
hard
{ "lang": "python", "repo": "zahessi/towel-orm", "path": "/towel/columns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zahessi/towel-orm path: /towel/columns.py import abc import datetime from . import TowelValueError class Field(abc.ABC): def __init__(self, value=None, **kwargs): self.value = value @classmethod @abc.abstractmethod def sql(cls): pass @property def val...
code_fim
hard
{ "lang": "python", "repo": "zahessi/towel-orm", "path": "/towel/columns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.conv1 = nn.Sequential( nn.Conv1d(alphabet_size, 256, kernel_size=7, stride=1), nn.ReLU(), nn.MaxPool1d(kernel_size=3, stride=3) ) self.conv2 = nn.Sequential( nn.Conv1d(256, 256, kernel_size=7, stride=1), nn.ReLU(), ...
code_fim
hard
{ "lang": "python", "repo": "hyunminch/source-code-lang-classification", "path": "/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hyunminch/source-code-lang-classification path: /model.py from torch import nn from torch.nn import functional as F import numpy as np class TextCNN(nn.Module): ''' TextCNN is the CNN module of this neural network. It receives text tensors and sends them through 3 layers of con...
code_fim
hard
{ "lang": "python", "repo": "hyunminch/source-code-lang-classification", "path": "/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fields = distribution["field"] params = {} # hoja de la Distribucion params["worksheet"] = distribution["scrapingFileSheet"] # coordenadas de los headers de las series params["headers_coord"] = [ field["scrapingIdentifierCell"] for ...
code_fim
hard
{ "lang": "python", "repo": "datosgobar/series-tiempo-ar-scraping", "path": "/series_tiempo_ar_scraping/processors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datosgobar/series-tiempo-ar-scraping path: /series_tiempo_ar_scraping/processors.py import logging import os import pandas as pd import re from copy import deepcopy from series_tiempo_ar.readers.csv_reader import CSVReader from series_tiempo_ar.validations import validate_distribution from serie...
code_fim
hard
{ "lang": "python", "repo": "datosgobar/series-tiempo-ar-scraping", "path": "/series_tiempo_ar_scraping/processors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> validate_distribution_scraping(xl, worksheet, headers_coord, headers_value, distrib_meta) validate_distribution(df, self.catalog_metadata, dataset_meta, distrib_meta, self.distribution_metadata.get('identi...
code_fim
hard
{ "lang": "python", "repo": "datosgobar/series-tiempo-ar-scraping", "path": "/series_tiempo_ar_scraping/processors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mirca/gammapy path: /gammapy/stats/tests/test_poisson.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 numpy.testing import assert_allclose from astropy.tests.helper import...
code_fim
hard
{ "lang": "python", "repo": "mirca/gammapy", "path": "/gammapy/stats/tests/test_poisson.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Check that the Li & Ma limit formula is correct actual = significance(n_on=1300, mu_bkg=1100, method='lima') assert_allclose(actual, 5.8600870406703329) actual = significance_on_off(n_on=1300, n_off=1100 / 1.e-8, alpha=1e-8, method='lima') assert_allclose(actual, 5.8600864348078519) ...
code_fim
hard
{ "lang": "python", "repo": "mirca/gammapy", "path": "/gammapy/stats/tests/test_poisson.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: junyaoshi/iGibson path: /igibson/utils/data_utils/ext_scene/scripts/utils/svg_utils.py er/floortrans/loaders/svg_utils.py ##### import math import numpy as np from xml.dom import minidom from skimage.draw import polygon from svgpathtools import parse_path from logging import warning def get_ico...
code_fim
hard
{ "lang": "python", "repo": "junyaoshi/iGibson", "path": "/igibson/utils/data_utils/ext_scene/scripts/utils/svg_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if point1[0] != point2[0] or point1[1] != point2[1]: if abs(point1[0] - point2[0]) > abs(point1[1] - point2[1]): # horizontal point1[1] = point1[1] + point2[1] / 2.0 point2[1] = point1[1] # point1[1] = int(np.round(point1[...
code_fim
hard
{ "lang": "python", "repo": "junyaoshi/iGibson", "path": "/igibson/utils/data_utils/ext_scene/scripts/utils/svg_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def change_end_points(self): if self.direction == 'V': self.end_points[0][0] = np.mean(np.array(self.min_coord)) self.end_points[1][0] = self.end_points[0][0] elif self.direction == 'H': self.end_points[0][1] = np.mean(np.array(self.min_coord)) ...
code_fim
hard
{ "lang": "python", "repo": "junyaoshi/iGibson", "path": "/igibson/utils/data_utils/ext_scene/scripts/utils/svg_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BestDeary666/Wisdom-Shaders path: /shaders/data/convert.py import cv2 import numpy as np img = np.array(cv2<|fim_suffix|>loat16').tofile('noise_256.dat') print(img.shape)<|fim_middle|>.imread('HDR_RGBA_0.png', cv2.IMREAD_UNCHANGED)) img = img.astype('float') / 65536.0 img.astype('f
code_fim
medium
{ "lang": "python", "repo": "BestDeary666/Wisdom-Shaders", "path": "/shaders/data/convert.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>loat16').tofile('noise_256.dat') print(img.shape)<|fim_prefix|># repo: BestDeary666/Wisdom-Shaders path: /shaders/data/convert.py import cv2 import numpy as np img = np.array(cv2.imread('HDR_RGBA_0.png', cv2.IMREAD_UNCHANGED)) <|fim_middle|>img = img.astype('float') / 65536.0 img.astype('f
code_fim
easy
{ "lang": "python", "repo": "BestDeary666/Wisdom-Shaders", "path": "/shaders/data/convert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def v(self, x): x = F.relu(self.fc1(x)) v = self.fc_v(x) return v def put_data(self, transition): self.data.append(transition) s, a, r, s_prime, prob_a, done = transition with torch.no_grad(): s_t = F.normalize(torch.from_...
code_fim
hard
{ "lang": "python", "repo": "insublee/mem_PPO", "path": "/mem_ppo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: insublee/mem_PPO path: /mem_ppo.py import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable class MEM_PPO(nn.Module): def __init__(self): super(MEM_PPO, self).__init__() self.data = [] self.le...
code_fim
hard
{ "lang": "python", "repo": "insublee/mem_PPO", "path": "/mem_ppo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: YufengLii/hmr_openpose_zhj path: /code/hmr_0720/hmr8.py import sys import cv2 import os import time import json import subprocess from sys import platform from absl import flags import numpy as np import skimage.io as io import tensorflow as tf from src.util import renderer as vis_util from src.u...
code_fim
hard
{ "lang": "python", "repo": "YufengLii/hmr_openpose_zhj", "path": "/code/hmr_0720/hmr8.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stream = cv2.VideoCapture(0) stream.set(cv2.CAP_PROP_FRAME_WIDTH,960) stream.set(cv2.CAP_PROP_FRAME_HEIGHT,720) capture_count = 0 capture_time = time.time() while True: ret,img = stream.read() if img is None : continue pipe_img.send(img) cap...
code_fim
hard
{ "lang": "python", "repo": "YufengLii/hmr_openpose_zhj", "path": "/code/hmr_0720/hmr8.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_params(): params = dict() params["num_gpu"] = 1 params["num_gpu_start"] = 1 params["net_resolution"] = "320x176" params["model_pose"] = "BODY_25" params["model_folder"] = "/home/feng/openpose/models/" params["write_json"] = "/media/ramdisk/output_op/" return params...
code_fim
hard
{ "lang": "python", "repo": "YufengLii/hmr_openpose_zhj", "path": "/code/hmr_0720/hmr8.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># compute embedding with Diffusion Maps method embedding = converter.embed(features) # compute custom distance matrix distance_matrix = np.exp(-np.dot(feature_matrix.T,feature_matrix)) # create Custom Kernel instance custom_distance = sg.CustomDistance(distance_matrix) # construct embedding based on crea...
code_fim
medium
{ "lang": "python", "repo": "shogun-toolbox/shogun", "path": "/applications/tapkee/samples/dm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: shogun-toolbox/shogun path: /applications/tapkee/samples/dm.py import shogun as sg import data import numpy as np # load data feature_matrix = data.swissroll() # create features instance features = sg.RealFeatures(feature_matrix) <|fim_suffix|># set target dimensionality converter.set_target_di...
code_fim
medium
{ "lang": "python", "repo": "shogun-toolbox/shogun", "path": "/applications/tapkee/samples/dm.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def parse_status_task(self, data: InputData) -> iter: """解析采集端任务状态数据,返回StatusTask数据迭代器""" try: for dicseg in self._convert(data): dicseg: DataSeg = dicseg status: StatusTask = StatusTask(dicseg._fields) yield status e...
code_fim
hard
{ "lang": "python", "repo": "cbbbbbbbb/sspywork", "path": "/savecode/threeyears/idownserver/statusmantainer/statusparser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbbbbbbbb/sspywork path: /savecode/threeyears/idownserver/statusmantainer/statusparser.py """status parser""" # -*- coding:utf-8 -*- import traceback from commonbaby.helpers import helper_str from commonbaby.mslog import MsLogger, MsLogManager from datacontract import (DataSeg, InputData, Sta...
code_fim
hard
{ "lang": "python", "repo": "cbbbbbbbb/sspywork", "path": "/savecode/threeyears/idownserver/statusmantainer/statusparser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """解析采集端单个任务详情数据,返回StatusTaskInfo迭代器""" try: for dicseg in self._convert(data): dicseg: DataSeg = dicseg status: StatusTaskInfo = StatusTaskInfo(dicseg._fields) yield status except Exception: self._logger.erro...
code_fim
hard
{ "lang": "python", "repo": "cbbbbbbbb/sspywork", "path": "/savecode/threeyears/idownserver/statusmantainer/statusparser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HExSA-Lab/nautilus path: /scripts/gen_grub.py #!/usr/bin/python import os import sys def gen_line_str(entry_type, img_path, cmdline=""): print "\t" + entry_type + " " + img_path + " " + cmdline def gen_menuentry(timeout, img_path, mod_paths, cmdline): <|fim_suffix|>cmdline = ' '.join(sys....
code_fim
hard
{ "lang": "python", "repo": "HExSA-Lab/nautilus", "path": "/scripts/gen_grub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cmdline = ' '.join(sys.argv[1:]) image = "/boot/nautilus.bin" modules = ["/boot/nautilus.syms", "/boot/nautilus.secs"] gen_menuentry("0", image, modules, cmdline)<|fim_prefix|># repo: HExSA-Lab/nautilus path: /scripts/gen_grub.py #!/usr/bin/python import os import sys def gen_line_str(entry_type, img_...
code_fim
medium
{ "lang": "python", "repo": "HExSA-Lab/nautilus", "path": "/scripts/gen_grub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> got, exp = compare_props(io, exp_filename) assert got == exp @pytest.mark.django_db def test_write_properties3(): exp_filename = get_target_xls('with_properties3.xlsx') io = get_io(exp_filename) with XlsTemplate(io) as xls: xls.process_model(DemoModel) got, exp = compar...
code_fim
hard
{ "lang": "python", "repo": "saxix/django-excel-data-sync", "path": "/tests/test_properties.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saxix/django-excel-data-sync path: /tests/test_properties.py # -*- coding: utf-8 -*- from __future__ import absolute_import import logging import pytest from example.models import DemoModel from excel_data_sync.xls import XlsTemplate from helperfunctions import _compare_xlsx_files, get_io, get_...
code_fim
hard
{ "lang": "python", "repo": "saxix/django-excel-data-sync", "path": "/tests/test_properties.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DriftShell(Cmd): intro = 'Drift alignment shell! Type ? for help or `exit` to leave drift alignment.' prompt = 'POCS:DriftAlign > ' pocs = None base_dir = '{}/images/drift_align'.format(os.getenv('PANDIR')) num_pics = 40 exptime = 30 # Coordinates for different tests ...
code_fim
hard
{ "lang": "python", "repo": "SMe12435/POCS", "path": "/bin/pocs_shell", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.ready is False: return args, kwargs = string_to_params(*arg) try: direction = kwargs['direction'] num_pics = int(kwargs['num_pics']) exptime = float(kwargs['exptime']) except Exception: print_warning( ...
code_fim
hard
{ "lang": "python", "repo": "SMe12435/POCS", "path": "/bin/pocs_shell", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SMe12435/POCS path: /bin/pocs_shell d on port {}".format( self.cmd_pub_port)) except Exception as e: print_warning("Can't start command publisher: {}".format(e)) try: self.cmd_subscriber = PanMessaging.create_subscriber( sel...
code_fim
hard
{ "lang": "python", "repo": "SMe12435/POCS", "path": "/bin/pocs_shell", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> wants the output to be formatted. """ from __future__ import absolute_import, unicode_literals from .context import Context from .fieldspec import Fieldspec from .serializer import serialize from .serializers import * # pylint: disable=wildcard-import __version__ = '0.12.2' __all__ = [ 'Context...
code_fim
hard
{ "lang": "python", "repo": "novopl/serafin", "path": "/src/serafin/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: novopl/serafin path: /src/serafin/__init__.py # -*- coding: utf-8 -*- # Copyright 2016-2019 Mateusz Klos # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www....
code_fim
hard
{ "lang": "python", "repo": "novopl/serafin", "path": "/src/serafin/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mezoreth/sis325_eval path: /eval/views.py from django.shortcuts import render, redirect from django.urls import reverse_lazy from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from .forms import * from .models import Cuestionario, Pregunta, Respuesta, Pre...
code_fim
hard
{ "lang": "python", "repo": "Mezoreth/sis325_eval", "path": "/eval/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>################################################################################ Respuesta class CrearRespuesta(CreateView): model = Respuesta fields = ['texto', 'correcto'] template_name = 'respuesta_crear_mr.html' success_url = reverse_lazy('listar_preguntas') def get_context_dat...
code_fim
hard
{ "lang": "python", "repo": "Mezoreth/sis325_eval", "path": "/eval/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Respuesta form_class = RespuestaVForm fields = ['respuesta','correcto'] prefix = 'respv' factory_kwargs = {'extra': 1, 'max_num': 1, 'can_order': False, 'can_delete': False} class RespuestaMRUF(InlineFormSetFactory): model = Respuesta form_class =...
code_fim
hard
{ "lang": "python", "repo": "Mezoreth/sis325_eval", "path": "/eval/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: intoli/dysco path: /docs/add_doctest_imports.py #! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys def add_doctest_imports(directory): """Prepends all of the rst files in a directory with doctest imports.""" for filename in os.listdir(directory): module_name, e...
code_fim
hard
{ "lang": "python", "repo": "intoli/dysco", "path": "/docs/add_doctest_imports.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> # Read in the current content. full_filename = os.path.join(directory, filename) with open(full_filename, 'r') as f: content = f.read() # Prepend it with the doctest imports. content = ( '.. testsetup::\n\n' ' from %s import *...
code_fim
hard
{ "lang": "python", "repo": "intoli/dysco", "path": "/docs/add_doctest_imports.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': assert len(sys.argv) == 2, 'The directory must be passed as an argument.' add_doctest_imports(sys.argv[1])<|fim_prefix|># repo: intoli/dysco path: /docs/add_doctest_imports.py #! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys def add_doctest_import...
code_fim
medium
{ "lang": "python", "repo": "intoli/dysco", "path": "/docs/add_doctest_imports.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: romack77/vp-toolbox path: /vp/line_detector.py import math import cv2 import numpy as np from vp import geom_tools def enhance_edges(image): """Pre-processing step to enhance edges. Args: image: OpenCV image. Returns: Image, filtered for edge detection. """ ...
code_fim
hard
{ "lang": "python", "repo": "romack77/vp-toolbox", "path": "/vp/line_detector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def hough_lines(source_image, min_points=0.075, min_line_length=0.2, max_line_gap=0.2): """Hough line detection. Args: source_image: An OpenCV Image. min_points: Float, minimum number of points that must be detected on a line. Specified as a percentage of the source im...
code_fim
hard
{ "lang": "python", "repo": "romack77/vp-toolbox", "path": "/vp/line_detector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for word in wordList: wordLower = word.lower() wordCap = word.capitalize() if pdfReader.decrypt(word): return word elif pdfReader.decrypt(wordCap): return wordCap elif pdfReader.decrypt(wordLower): return wordLower retur...
code_fim
hard
{ "lang": "python", "repo": "kudeh/automate-the-boring-stuff-projects", "path": "/pdf-password-breaker/passwordBreaker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kudeh/automate-the-boring-stuff-projects path: /pdf-password-breaker/passwordBreaker.py #! python3 # passwordBreaker.py # Author: Kene Udeh # Source: Automate the Boring stuff with python Ch. 13 Project <|fim_suffix|> with open('dictionary.txt') as words: wordList = words.read().split...
code_fim
hard
{ "lang": "python", "repo": "kudeh/automate-the-boring-stuff-projects", "path": "/pdf-password-breaker/passwordBreaker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pdfWriter = PyPDF2.PdfFileWriter() pdfWriter.encrypt('ASPIRE') encryptedPdf = open('pdf_encrypted.pdf', 'wb') pdfWriter.write(encryptedPdf) encryptedPdf.close() print(breakPassword('pdf_encrypted.pdf'))<|fim_prefix|># repo: kudeh/automate-the-boring-stuff-projects path: /pdf-pass...
code_fim
medium
{ "lang": "python", "repo": "kudeh/automate-the-boring-stuff-projects", "path": "/pdf-password-breaker/passwordBreaker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sub = subprocess.Popen(cmd_string, cwd=cwd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=shell, bufsize=4096) stdout_str = '' while sub.poll() is None: stdout_str += str(sub.stdout.read(), encoding="UTF-8") time.sleep(0.1) return stdout_...
code_fim
medium
{ "lang": "python", "repo": "dh-04/sdk-index", "path": "/tools/csp_check/check_tools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dh-04/sdk-index path: /tools/csp_check/check_tools.py import time import subprocess def execute_command(cmd_string, cwd=None, shell=True): <|fim_suffix|> sub = subprocess.Popen(cmd_string, cwd=cwd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=shell, bufsize...
code_fim
medium
{ "lang": "python", "repo": "dh-04/sdk-index", "path": "/tools/csp_check/check_tools.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> stdout_str = '' while sub.poll() is None: stdout_str += str(sub.stdout.read(), encoding="UTF-8") time.sleep(0.1) return stdout_str<|fim_prefix|># repo: dh-04/sdk-index path: /tools/csp_check/check_tools.py import time import subprocess def execute_command(cmd_string, cwd=No...
code_fim
medium
{ "lang": "python", "repo": "dh-04/sdk-index", "path": "/tools/csp_check/check_tools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }