text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>mensions[1]*dimensions[2] totalpaper += 2*(f1+f2+f3)+extra totalribbon += wraplenght+bow print(totalpaper) print(totalribbon)<|fim_prefix|># repo: KoxAlen/adventofcode path: /day02/script.py #Written for Python 3.4.2 data = [line.rstrip('\n') for line in open("input.txt")] totalpaper = 0 t...
code_fim
hard
{ "lang": "python", "repo": "KoxAlen/adventofcode", "path": "/day02/script.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: cppisgood/FriendRatingRPC path: /service/contest_service.py from logging import debug from proto import contest_pb2 from proto import contest_pb2_grpc from util.data import contest_cache <|fim_suffix|> data = contest_cache[request.platform].get(request.handle) return contest_pb2.C...
code_fim
medium
{ "lang": "python", "repo": "cppisgood/FriendRatingRPC", "path": "/service/contest_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = contest_cache[request.platform].get(request.handle) return contest_pb2.ContestData( handle = data['handle'], profile_url = data['profile_url'], rating = data['rating'], length = data['length'], data = data['data'] )...
code_fim
medium
{ "lang": "python", "repo": "cppisgood/FriendRatingRPC", "path": "/service/contest_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jstasiak/log_temp path: /log_temp.py #!/usr/bin/python #-*- coding: utf-8 -*- import os import json import rrdtool import sys from errno import EEXIST from itertools import product from math import ceil from os import makedirs, remove from os.path import abspath, dirname, expanduser, isdir, isf...
code_fim
hard
{ "lang": "python", "repo": "jstasiak/log_temp", "path": "/log_temp.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> result = rrdtool.graph(str(graph), '--imgformat', 'PNG', '--font', 'DEFAULT:0:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf', '--color', 'BACK#FFFFFFFF', '--color', 'CANVAS#FFFFFF00', '--border', '0', '--width', '775', '--height', '279', '--slope-mode', '--start', str(st...
code_fim
hard
{ "lang": "python", "repo": "jstasiak/log_temp", "path": "/log_temp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for _ in range(k): temp_next = p2.next p2.next = p3 p3 = p2 p2 = temp_next p1.next = p3 for _ in range(k): p1 = p1.next p2 = p1.next p3 = p1.next return dum...
code_fim
hard
{ "lang": "python", "repo": "BigEggStudy/LeetCode-Py", "path": "/LeetCode/_0001_0050/_025_ReverseNodesInKGroup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BigEggStudy/LeetCode-Py path: /LeetCode/_0001_0050/_025_ReverseNodesInKGroup.py #----------------------------------------------------------------------------- # Runtime: 48ms # Memory Usage: # Link: #----------------------------------------------------------------------------- <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "BigEggStudy/LeetCode-Py", "path": "/LeetCode/_0001_0050/_025_ReverseNodesInKGroup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for _ in range(k): p1 = p1.next p2 = p1.next p3 = p1.next return dummy_head.next<|fim_prefix|># repo: BigEggStudy/LeetCode-Py path: /LeetCode/_0001_0050/_025_ReverseNodesInKGroup.py #-------------------------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "BigEggStudy/LeetCode-Py", "path": "/LeetCode/_0001_0050/_025_ReverseNodesInKGroup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: coldmax88/PyGUI path: /GUI/Generic/GButtons.py # # Python GUI - Buttons - Generic # from GUI.Properties import overridable_property from GUI.Actions import Action from GUI import Control class Button(Control, Action): """ A pushbutton control.""" <|fim_suffix|> """Highlight the button mom...
code_fim
hard
{ "lang": "python", "repo": "coldmax88/PyGUI", "path": "/GUI/Generic/GButtons.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Highlight the button momentarily as though it had been clicked, without performing the action.""" raise NotImplementedError<|fim_prefix|># repo: coldmax88/PyGUI path: /GUI/Generic/GButtons.py # # Python GUI - Buttons - Generic # from GUI.Properties import overridable_property from GUI.Actions...
code_fim
hard
{ "lang": "python", "repo": "coldmax88/PyGUI", "path": "/GUI/Generic/GButtons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mayfield/plexcli path: /plexcli/api.py """ Some API handling code. """ import requests import syndicate import syndicate.data from syndicate.adapters.sync import HeaderAuth from syndicate.client import ResponseError xmldecode = syndicate.data.serializers['xml'].decode # CRAZY DEBUG XXX def de...
code_fim
hard
{ "lang": "python", "repo": "mayfield/plexcli", "path": "/plexcli/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def multi_connect(self, *args, **kwargs): """ Try connecting with a list of urls. If none work we abort but return to our original state first. """ uri_save = self.uri auth_save = self.adapter.auth try: self._multi_connect(*args, **kwargs) e...
code_fim
hard
{ "lang": "python", "repo": "mayfield/plexcli", "path": "/plexcli/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def signin(self, auth): signin = requests.post('%s/users/sign_in.xml' % self.api.uri, auth=auth, headers=self.headers) signin_xml = xmldecode(signin.content) if signin.status_code != 201: errors = [x.text for x in signin_xml.iter('erro...
code_fim
hard
{ "lang": "python", "repo": "mayfield/plexcli", "path": "/plexcli/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def defaultLocations(): Location.create(name="YogaFlowSouth", longname="Yoga Flow South Hills", address="250 Mount Lebanon Boulevard, Pittsburgh, PA 15234") Location.create(name="HIP", longname="Himalayan Institute, Pittsburgh", address="300 Beverly Rd, Pittsburgh, PA 15216") Location.create(n...
code_fim
hard
{ "lang": "python", "repo": "awynne/scripts", "path": "/activity/init.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: awynne/scripts path: /activity/init.py from activitylog import * from datetime import datetime from datetime import date def createDB(): db.create_tables([Person, ActivityType, Activity, MeasurementType, Measurement, Location]) def defaultActivities(): root = ActivityType.create(name="B...
code_fim
hard
{ "lang": "python", "repo": "awynne/scripts", "path": "/activity/init.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> adam=Person.select().where(Person.name =="adam") hiking=ActivityType.select().where(ActivityType.name == "Hiking") gilfilan=Location.select().where(Location.name == "Gilfilan") #Activity.create(start=datetime(2016,1,2,10,00,00), end=datetime.now(), person=adam, activityType=hiking, locati...
code_fim
hard
{ "lang": "python", "repo": "awynne/scripts", "path": "/activity/init.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: plachta11b/lead2gold path: /src/lead2gold/tools/tool.py """ Abstract class module for unified """ from abc import abstractmethod from lead2gold.motif.motif import Motif class Tool(): <|fim_suffix|> Args: motif: object Motif for file_path: file where motif would be saved. Returns: ...
code_fim
hard
{ "lang": "python", "repo": "plachta11b/lead2gold", "path": "/src/lead2gold/tools/tool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def print(self, motif, file_path): """Performs motif search. Args: motif: object Motif for file_path: file where motif would be saved. Returns: Returns None """ return None<|fim_prefix|># repo: plachta11b/lead2gold path: /src/lead2gold/tools/tool.py """ Abstract cla...
code_fim
hard
{ "lang": "python", "repo": "plachta11b/lead2gold", "path": "/src/lead2gold/tools/tool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if taskmanager.tasks.all().count() >= max_tasks: print("maximum number of tasks reached") break title=fake.text(max_nb_chars=max_task_title, ext_word_list=None) description=fake.text(max_nb_chars=max_task_description, ext_word_list=None) expected_date=f...
code_fim
hard
{ "lang": "python", "repo": "HerlanAssis/simple-project-manager", "path": "/backend/apps/tasks/management/commands/generate_fake.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HerlanAssis/simple-project-manager path: /backend/apps/tasks/management/commands/generate_fake.py from django.core.management.base import BaseCommand, CommandError from apps.tasks.models import TaskManager, Task from faker import Factory import random class Command(BaseCommand): help = 'Gener...
code_fim
hard
{ "lang": "python", "repo": "HerlanAssis/simple-project-manager", "path": "/backend/apps/tasks/management/commands/generate_fake.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Search width for finding Auger peaks (typically varies by element) Si1searchwidth =6 Ssearchwidth =6 Clsearchwidth =6 Csearchwidth =6 Casearchwidth =6 Osearchwidth =6 Fe1searchwidth =6 Fe2searchwidth =6 Fesearchwidth =6 Mgsearchwidth =6 Alsearchwidth =6 Sisearchwidth =8 Nsearchwidth =6 Tis...
code_fim
hard
{ "lang": "python", "repo": "tkcroat/Augerquant", "path": "/Params/AESquantparams.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkcroat/Augerquant path: /Params/AESquantparams.py ''' AESquantparams needed for Auger quant on smooth-differentiated peaks This file contains AES peak centers and positions of desired background regions for typical Auger semi-quantitative analyses. Input ROIs are cut and pasted from the exce...
code_fim
hard
{ "lang": "python", "repo": "tkcroat/Augerquant", "path": "/Params/AESquantparams.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: great-expectations/great_expectations path: /contrib/time_series_expectations/time_series_expectations/generator/hourly_time_series_generator.py from math import ceil from typing import List, Optional, Tuple import numpy as np import pandas as pd from time_series_expectations.generator.daily_ti...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/contrib/time_series_expectations/time_series_expectations/generator/hourly_time_series_generator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> hourly_seasonality_series = ( self._generate_hourly_seasonality( time_range=time_range, hourly_seasonality_params=hourly_seasonality_params, ) * hourly_seasonality ) hourly_outliers = self._generate_posneg_pareto(...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/contrib/time_series_expectations/time_series_expectations/generator/hourly_time_series_generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Notes: * Holiday and outlier effects are generated using a pareto distribution. The alpha parameter controls the shape of the distribution. A higher alpha value will result in more extreme holiday and outlier effects. * Holidays don't correspond to actual holidays. Instead,...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/contrib/time_series_expectations/time_series_expectations/generator/hourly_time_series_generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """CartoonganPt Shinkai 引擎子进程 """ def __init__(self, daemon=True): super(CartoonganPtShinkaiFuncWorker, self).__init__(daemon) # 引擎功能函数注册信息 self._func_info_list = [{ "func_group": "__art_cartoon", # 必须在预定义类型中,否则将被拒绝注册 "func_list": [{ ...
code_fim
hard
{ "lang": "python", "repo": "LPX55/FaceMagi", "path": "/backend/app/app/engine_v1/workers/cartoongan_pt.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super(CartoonganPtHosodaFuncWorker, self).__init__(daemon) # 引擎功能函数注册信息 self._func_info_list = [{ "func_group": "__art_cartoon", # 必须在预定义类型中,否则将被拒绝注册 "func_list": [{ "name": "hsd", "vip": 1, "icon": "/static/ui_data/modules/c...
code_fim
hard
{ "lang": "python", "repo": "LPX55/FaceMagi", "path": "/backend/app/app/engine_v1/workers/cartoongan_pt.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LPX55/FaceMagi path: /backend/app/app/engine_v1/workers/cartoongan_pt.py # -*- coding: utf-8 -*- from app.engine_v1 import app_config, logger, image_process_wrap from app.engine_v1.worker import BaseFuncWorker from app.engine_v1.ai_modules.cartoongan_pt import adapter as cartoongan_pt_adapter ...
code_fim
hard
{ "lang": "python", "repo": "LPX55/FaceMagi", "path": "/backend/app/app/engine_v1/workers/cartoongan_pt.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/bonsai-common path: /bonsai_common/simulator_session.py """ Simulator session base class for bonsai3 library """ __copyright__ = "Copyright 2020, Microsoft Corp." # pyright: strict import abc import logging import sys import numpy as np import signal import time from functools import...
code_fim
hard
{ "lang": "python", "repo": "microsoft/bonsai-common", "path": "/bonsai_common/simulator_session.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Runs simulator. Returns false when the simulator should exit. Example usage: ... mySim = MySimulator(config) while mySim.run(): continue ... returns True if the simulator should continue. returns Fa...
code_fim
hard
{ "lang": "python", "repo": "microsoft/bonsai-common", "path": "/bonsai_common/simulator_session.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abc.abstractmethod def episode_start(self, config: Schema) -> None: """Called at the start of each episode. """ raise NotImplementedError("episode_start not implemented.") @abc.abstractmethod def episode_step(self, action: Schema) -> None: """Called for each step ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/bonsai-common", "path": "/bonsai_common/simulator_session.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Try to generate an open connected blob of points in the maze. Args: maze: Instance of .maze.Maze. num_points: Int. Number of connected points to have in the blob. Returns: blob_matrix: False or binary matrix of same size as maze. Ones correspond to ...
code_fim
hard
{ "lang": "python", "repo": "hokysung/moog.github.io", "path": "/moog/maze_lib/maze_generators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Remove dead ends _remove_dead_ends(maze) # If maze has no open points, recurse to generate a new one if np.sum(1 - maze) == 0: return generate_random_maze_matrix(size, ambient_size=ambient_size) # Add wall border if necessary if ambient_size is not None and ambient_...
code_fim
hard
{ "lang": "python", "repo": "hokysung/moog.github.io", "path": "/moog/maze_lib/maze_generators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hokysung/moog.github.io path: /moog/maze_lib/maze_generators.py """This file contains functions to randomly generate mazes. The main function in this file is generate_random_maze_matrix(), which generates a maze with no dead ends and no open squares. """ import numpy as np # Maximum iteration ...
code_fim
hard
{ "lang": "python", "repo": "hokysung/moog.github.io", "path": "/moog/maze_lib/maze_generators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: interscript/khmer-diacritics path: /python/spell_check_processing.py ''' Here we train spell checker model which is Seq2Seq model based on different operations in 2 Levenstein len ''' from zipfile import ZipFile, ZIP_DEFLATED from io import BytesIO import torch import time import numpy as np im...
code_fim
hard
{ "lang": "python", "repo": "interscript/khmer-diacritics", "path": "/python/spell_check_processing.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>f = open(args.data_input) data_input = f.read().split('\n')[:-1] f.close() data = [] punct = string.punctuation for d in data_input: d = ''.join([c for c in d if not c in punct]) data += d.split() X = [] y = [] for d in tqdm(data): cand = list(candidates(d)) X += [d]*len(cand) y += c...
code_fim
hard
{ "lang": "python", "repo": "interscript/khmer-diacritics", "path": "/python/spell_check_processing.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: shaunramsey/FractalExploration path: /Iterations/x2pcwithcomplex.py # -*- coding: utf-8 -*- """ Created on Mon May 21 15:22:39 2018 @author: Ramsey """ import numpy as np import matplotlib.pyplot as plt # get a bifurcation plot of x^2+c # start with x = whatever, maybe 0? def func(...
code_fim
medium
{ "lang": "python", "repo": "shaunramsey/FractalExploration", "path": "/Iterations/x2pcwithcomplex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#c = 0.4 - 0.325j c = 0 + 0j plt.plot([-1,0,1],[0,0,0],c="r") plt.plot([0,0,0],[-1,0,1],c="r") # let things settle to a steady state num_points = 360 for xs in range(num_points): yp = [ pow(2,0.5)/2 ] xp = [] x = xs/5 - 1 + 1j*yp[0] x = -pow(2,0.5)/2 +1j*yp[0] x = np.cos...
code_fim
medium
{ "lang": "python", "repo": "shaunramsey/FractalExploration", "path": "/Iterations/x2pcwithcomplex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: send2cloud/opencult.com path: /main/migrations/0013_auto_20180131_0105.py # Generated by Django 2.0.1 on 2018-01-31 01:05 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( model_name='even...
code_fim
medium
{ "lang": "python", "repo": "send2cloud/opencult.com", "path": "/main/migrations/0013_auto_20180131_0105.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('main', '0012_auto_20180130_1922'), ] operations = [ migrations.AlterField( model_name='event', name='maps_url', field=models.URLField(blank=True, null=True), ), migrations.AlterField( model_name...
code_fim
medium
{ "lang": "python", "repo": "send2cloud/opencult.com", "path": "/main/migrations/0013_auto_20180131_0105.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shelcia/InterviewQuestionPython path: /Patterns/rowNumberInvertedPyramid.py # Write a code to generate a half pyramid pattern using numbers. # Sampl<|fim_suffix|>33 # 22 # 1 N = int(input('')) for index in range(0, N): for secondIndex in range(0, N-index): print(N-index, end='') ...
code_fim
medium
{ "lang": "python", "repo": "shelcia/InterviewQuestionPython", "path": "/Patterns/rowNumberInvertedPyramid.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>Index in range(0, N-index): print(N-index, end='') print('')<|fim_prefix|># repo: shelcia/InterviewQuestionPython path: /Patterns/rowNumberInvertedPyramid.py # Write a code to generate a half pyramid pattern using numbers. # Sample Input : # 5 # Sample Output : # 5 # Sample Output : # 55555 #...
code_fim
medium
{ "lang": "python", "repo": "shelcia/InterviewQuestionPython", "path": "/Patterns/rowNumberInvertedPyramid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ibmresilient/resilient-community-apps path: /rc_data_feed/rc_data_feed/util/config.py # -*- coding: utf-8 -*- """Generate a default configuration-file section for rc_data_feed""" from __future__ import print_function def config_section_data(): <|fim_suffix|># set to true if attachment data sh...
code_fim
hard
{ "lang": "python", "repo": "ibmresilient/resilient-community-apps", "path": "/rc_data_feed/rc_data_feed/util/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># feed_data is the default message destination that will be listened to queue=feed_data # set to true if attachment data should be part of payload send to plugins include_attachment_data=false # if necessary, specify the supported workspace (by label, case sensitive) and the list of feeds associated with...
code_fim
hard
{ "lang": "python", "repo": "ibmresilient/resilient-community-apps", "path": "/rc_data_feed/rc_data_feed/util/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: njvrzm/git-credential-shell path: /git-credential-shell #!/usr/bin/env python import base64 from Crypto.Cipher import AES import os import secrets import shelve import tempfile import sys key_var = 'GIT_SHELL_CREDENTIALS_KEY' path_var = 'GIT_SHELL_CREDENTIALS_PATH' iv456 = 'sixteencharacter' <...
code_fim
medium
{ "lang": "python", "repo": "njvrzm/git-credential-shell", "path": "/git-credential-shell", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> padded = crypter().decrypt(encrypted) return padded.rstrip(b'\0').decode('utf-8') if __name__ == '__main__': command = sys.argv[1] if command not in ('setup', 'get', 'store', 'erase'): raise ValueError("Unknown command {}".format(command)) if command == 'setup': pat...
code_fim
hard
{ "lang": "python", "repo": "njvrzm/git-credential-shell", "path": "/git-credential-shell", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class EventFeedback(models.Model): id = models.IntegerField(db_column='ID', primary_key=True) rate = models.FloatField(db_column='Rate') note = models.TextField(db_column='Note') approved = models.BooleanField(db_column='Approved') event = models.ForeignKey( SummitEvent, relat...
code_fim
medium
{ "lang": "python", "repo": "OpenStackweb/summit-reports-api", "path": "/reports_api/reports/models/event_feedback.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> event = models.ForeignKey( SummitEvent, related_name='feedback', db_column='EventID', on_delete=models.CASCADE) owner = models.ForeignKey( Member, related_name='feedback', db_column='OwnerID', on_delete=models.CASCADE) def __str__(self): return self.id class Meta...
code_fim
hard
{ "lang": "python", "repo": "OpenStackweb/summit-reports-api", "path": "/reports_api/reports/models/event_feedback.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenStackweb/summit-reports-api path: /reports_api/reports/models/event_feedback.py """ * Copyright 2019 OpenStack Foundation * 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 Lic...
code_fim
hard
{ "lang": "python", "repo": "OpenStackweb/summit-reports-api", "path": "/reports_api/reports/models/event_feedback.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: joeyism/cloud-storage-tui path: /tests/snapshots/snap_test_filesystem.py # -*- coding: utf-8 -*- # snapshottest: v1 - https://goo.gl/zC4yUc from __future__ import unicode_literals <|fim_suffix|>snapshots = Snapshot()<|fim_middle|>from snapshottest import GenericRepr, Snapshot
code_fim
easy
{ "lang": "python", "repo": "joeyism/cloud-storage-tui", "path": "/tests/snapshots/snap_test_filesystem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> snapshots = Snapshot()<|fim_prefix|># repo: joeyism/cloud-storage-tui path: /tests/snapshots/snap_test_filesystem.py # -*- coding: utf-8 -*- # snapshottest: v1 - https://goo.gl/zC4yUc from __future__ import unicode_literals <|fim_middle|>from snapshottest import GenericRepr, Snapshot
code_fim
easy
{ "lang": "python", "repo": "joeyism/cloud-storage-tui", "path": "/tests/snapshots/snap_test_filesystem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chadduffey/Slack-Events-Analysis path: /example/example.py from slackeventsapi import SlackEventAdapter from slackclient import SlackClient import json import os import pprint # Our app's Slack Event Adapter for receiving actions via the Events API SLACK_VERIFICATION_TOKEN = os.environ["SLACK_VE...
code_fim
hard
{ "lang": "python", "repo": "chadduffey/Slack-Events-Analysis", "path": "/example/example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Example responder to greetings # @slack_events_adapter.on("message") # def handle_message(event_data): # message = event_data["event"] # # If the incoming message contains "hi", then respond with a "Hello" message # if message.get("subtype") is None and "hi" in message.get('text'): # ...
code_fim
medium
{ "lang": "python", "repo": "chadduffey/Slack-Events-Analysis", "path": "/example/example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #event = event_data["event"] #emoji = event["reaction"] #channel = event["item"]["channel"] #text = ":%s:" % emoji #CLIENT.api_call("chat.postMessage", channel=channel, text=event_data) # Once we have our event listeners configured, we can start the # Flask server with the default `/e...
code_fim
hard
{ "lang": "python", "repo": "chadduffey/Slack-Events-Analysis", "path": "/example/example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for character in inputString: try: character.encode("ascii") returnString += character lastAdded = character except UnicodeEncodeError: replaced = unidecode(str(character)) if replaced != '': returnString += re...
code_fim
hard
{ "lang": "python", "repo": "r00li/Roli-Tweet-Printer", "path": "/roliPrinter/TextTools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: r00li/Roli-Tweet-Printer path: /roliPrinter/TextTools.py # # Roli Tweet printer # Written by Andrej Rolih, www.r00li.com # import html import unicodedata from unidecode import unidecode <|fim_suffix|> for character in inputString: try: character.encode("ascii") ...
code_fim
hard
{ "lang": "python", "repo": "r00li/Roli-Tweet-Printer", "path": "/roliPrinter/TextTools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (train_data, train_y), (val_data, val_y), (test_data, test_y) def transform_tuple(X_train, X_val, X_test, vectorizer:CountVectorizer): vectorizer.fit(X_train['k_doc'].append(X_train['u_doc'])) train = X_train.apply(vectorizer.transform) val = X_val.apply(vectorizer.transform) ...
code_fim
hard
{ "lang": "python", "repo": "dainis-boumber/amamda", "path": "/baselines/prepare_ml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dainis-boumber/amamda path: /baselines/prepare_ml.py from pathlib import Path import pickle import logging import numpy as np from scipy import sparse import pandas as pd from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer impor...
code_fim
hard
{ "lang": "python", "repo": "dainis-boumber/amamda", "path": "/baselines/prepare_ml.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mgd020/django-admin-select2 path: /test_app/app/test_model/models.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models <|fim_suffix|> foreign_key = models.ForeignKey('auth.User', null=True, blank=True, related_name='+') many_to_many = models.Man...
code_fim
easy
{ "lang": "python", "repo": "mgd020/django-admin-select2", "path": "/test_app/app/test_model/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> foreign_key = models.ForeignKey('auth.User', null=True, blank=True, related_name='+') many_to_many = models.ManyToManyField('auth.User', blank=True, related_name='+')<|fim_prefix|># repo: mgd020/django-admin-select2 path: /test_app/app/test_model/models.py # -*- coding: utf-8 -*- from __future__ ...
code_fim
easy
{ "lang": "python", "repo": "mgd020/django-admin-select2", "path": "/test_app/app/test_model/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nextBillyonair/Attention path: /src/utils.py import torch from torch.utils.data import DataLoader, TensorDataset import tensorflow as tf from sklearn.model_selection import train_test_split import math import unicodedata import re import matplotlib.pyplot as plt import matplotlib.ticker as ticker...
code_fim
hard
{ "lang": "python", "repo": "nextBillyonair/Attention", "path": "/src/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> loss.backward() torch.nn.utils.clip_grad_norm_(model.parameters(), clip) optimizer.step() epoch_loss += loss.item() return epoch_loss / len(iterator) def evaluate(model, iterator, criterion, pad_tok=0): model.eval() epoch_loss = 0 with torch.no_grad(): ...
code_fim
hard
{ "lang": "python", "repo": "nextBillyonair/Attention", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with torch.no_grad(): for i, (src, tgt) in enumerate(tqdm(iterator, file=sys.stdout)): # src.shape = (batch_size, src_seq_len) # tgt.shape = (batch_size, tgt_seq_len) src_mask = create_padding_mask(src, pad_tok) src_mask, look_ahead_mask, dec_pad...
code_fim
hard
{ "lang": "python", "repo": "nextBillyonair/Attention", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_page_doc(self, **kw): fp = self.encode_filename(**kw) assert(os.path.isfile(fp)) self.update_cursor(**kw) text = [] with open(fp, "r") as fl: r = fl.read() doc = ET.fromstring(r) return doc def get_page_text(self, **kw): doc = self.get_pa...
code_fim
hard
{ "lang": "python", "repo": "BL-Labs/poetryhunt", "path": "/blnewspaper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BL-Labs/poetryhunt path: /blnewspaper.py from xml.etree import ElementTree as ET import os from collections import defaultdict NEWSPAPERS = ["ANJO", "BDPO", "BLMY", "BNER", "BNWL", "BRPT", "CHPN", "CHTR", "CHTT", "CNMR", "CTCR", "CWPR", "DNLN", "DYMR", "ERLN", "EXLN", "FRJO", "GCLN", "GLAD",...
code_fim
hard
{ "lang": "python", "repo": "BL-Labs/poetryhunt", "path": "/blnewspaper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_debiasing_unknown_method(test_df_year): """Check computing bias weights counting the number of scenarios by scenario name""" msg = "Unknown method foo for computing bias weights!" with pytest.raises(ValueError, match=msg): test_df_year.compute.bias(method="foo", name="bias", a...
code_fim
hard
{ "lang": "python", "repo": "IAMconsortium/pyam", "path": "/tests/test_feature_debiasing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_debiasing_unknown_method(test_df_year): """Check computing bias weights counting the number of scenarios by scenario name""" msg = "Unknown method foo for computing bias weights!" with pytest.raises(ValueError, match=msg): test_df_year.compute.bias(method="foo", name="bias", ...
code_fim
medium
{ "lang": "python", "repo": "IAMconsortium/pyam", "path": "/tests/test_feature_debiasing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IAMconsortium/pyam path: /tests/test_feature_debiasing.py from pyam import IamDataFrame import pytest from numpy.testing import assert_array_equal @pytest.mark.parametrize( "axis, exp", (["scenario", [0.5, 0.5, 1]], [["model", "scenario"], [1, 1, 1]]), ) def test_debiasing_count(test_pd...
code_fim
hard
{ "lang": "python", "repo": "IAMconsortium/pyam", "path": "/tests/test_feature_debiasing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": arg_parser = argparse.ArgumentParser(description="Client controller") arg_parser.add_argument("-f", "--wait-signal-freq", type=float, default=5, help="Frequency in seconds after which the WAIT command is send to a connected client.") args...
code_fim
hard
{ "lang": "python", "repo": "smartarch/qoscloud", "path": "/cloud_controller/client_controller/client_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> external_server = start_grpc_server( servicer=ClientControllerExternal(client_model), adder=mw_servicers.add_ClientControllerExternalServicer_to_server, host=CLIENT_CONTROLLER_EXTERNAL_HOST, port=CLIENT_CONTROLLER_EXTERNAL_PORT, threads=MAX_CLIENTS ) tr...
code_fim
hard
{ "lang": "python", "repo": "smartarch/qoscloud", "path": "/cloud_controller/client_controller/client_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smartarch/qoscloud path: /cloud_controller/client_controller/client_controller.py """ Client controller module. Consists of internal and external interfaces to the Client Controller, as well as ClientModel - the data structure that is shared between these interfaces. Both interfaces of the Clie...
code_fim
hard
{ "lang": "python", "repo": "smartarch/qoscloud", "path": "/cloud_controller/client_controller/client_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mwilliamson/wordbridge path: /tests/openxml/numbering_test.py from nose.tools import istest, assert_equal from wordbridge.openxml import numbering from wordbridge import openxml @istest def numbering_instance_is_read_from_num_element_with_abstract_num_base(): numbering_xml = _create_numberi...
code_fim
hard
{ "lang": "python", "repo": "mwilliamson/wordbridge", "path": "/tests/openxml/numbering_test.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|>_NUMBERING_TEMPLATE = """<?xml version="1.0" ?> <w:numbering mc:Ignorable="w14 wp14" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxml...
code_fim
medium
{ "lang": "python", "repo": "mwilliamson/wordbridge", "path": "/tests/openxml/numbering_test.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> a, b = map(Symbol, 'ab') assert python( conjugate(a + b*I) ) == '_ _\na - I*b' assert python( conjugate(exp(a + b*I)) ) == ' _ _\n a - I*b\ne ' def test_python_derivatives(): # Simple f_1 = Derivative(log(x), x, evaluate=False) assert python(f_1) == "x = Symbol('x')...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/printing/tests/test_python.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sympy/sympy path: /sympy/printing/tests/test_python.py from sympy.core.function import (Derivative, Function) from sympy.core.numbers import (I, Rational, oo, pi) from sympy.core.relational import (Eq, Ge, Gt, Le, Lt, Ne) from sympy.core.symbol import (Symbol, symbols) from sympy.functions.elemen...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/printing/tests/test_python.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: saltstack/salt path: /salt/states/influxdb08_user.py """ Management of InfluxDB 0.8 users ================================ (compatible with InfluxDB version 0.5-0.8) .. versionadded:: 2014.7.0 """ def __virtual__(): """ Only load if the influxdb08 module is available """ if "...
code_fim
hard
{ "lang": "python", "repo": "saltstack/salt", "path": "/salt/states/influxdb08_user.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> host The host to connect to port The port to connect to """ ret = {"name": name, "changes": {}, "result": True, "comment": ""} # check if user exists and remove it if __salt__["influxdb08.user_exists"](name, database, user, password, host, port): if __opt...
code_fim
hard
{ "lang": "python", "repo": "saltstack/salt", "path": "/salt/states/influxdb08_user.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> name The name of the user to remove database The database to remove the user from user The user to connect as (must be able to remove the user) password The password of the user host The host to connect to port The port to connec...
code_fim
hard
{ "lang": "python", "repo": "saltstack/salt", "path": "/salt/states/influxdb08_user.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def delete_legacy_authorizations_id_async(self, auth_id, **kwargs): ... def get_legacy_authorizations(self, **kwargs): ... def get_legacy_authorizations_with_http_info(self, **kwargs): ... async def get_legacy_authorizations_async(self, **kwargs): ... def get_legacy_authorization...
code_fim
medium
{ "lang": "python", "repo": "facebook/pyre-check", "path": "/stubs/typeshed/typeshed/stubs/influxdb-client/influxdb_client/service/legacy_authorizations_service.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreenBankObservatory/nrqz_admin path: /importers/access_prelim_technical/formmaps.py """Field mappings for Access Preliminary Technical Data""" from cases.forms import ( AttachmentImportForm, PersonImportForm, PreliminaryCaseImportForm, PreliminaryFacilityImportForm, ) from djang...
code_fim
hard
{ "lang": "python", "repo": "GreenBankObservatory/nrqz_admin", "path": "/importers/access_prelim_technical/formmaps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> field_maps = [ OneToOneFieldMap(to_field="name", converter=None, from_field="APPLICANT") ] form_class = PersonImportForm form_defaults = {"data_source": ACCESS_PRELIM_TECHNICAL} class PCaseImportFormMap(FormMap): field_maps = [ OneToOneFieldMap( to_field="...
code_fim
hard
{ "lang": "python", "repo": "GreenBankObservatory/nrqz_admin", "path": "/importers/access_prelim_technical/formmaps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>return () print("WELCOME LETS PLAY:") print("R:Rock") print("P:Paper") print("S:Scissors") name = input("What's your choice?\n ") if(name in l): game(name) else: print("Invalid Choice")<|fim_prefix|># repo: Python-aryan/Hacktoberfest2020 path: /RockPaperScissors.py from random import * l=['R','P','S'] ...
code_fim
hard
{ "lang": "python", "repo": "Python-aryan/Hacktoberfest2020", "path": "/RockPaperScissors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python-aryan/Hacktoberfest2020 path: /RockPaperScissors.py from random import * l=['R','P','S'] def game(n): x = randint(1,3) if (x==1): k='Rock' if (x==2): k='Paper' if (x==3): k='Scissors' if(n==l[0] and (x==3)): print("You Wi<|fim_suffix|> return () if(n==l[0] and x==1) or (...
code_fim
medium
{ "lang": "python", "repo": "Python-aryan/Hacktoberfest2020", "path": "/RockPaperScissors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taotao/jsonlibconfig path: /jsonlibconfig/lex.py import ply.lex as lex _hextoint = False tokens = ( "COLON", "EQUAL", "SEMICOLON", "COMMA", "LBRACE", "RBRACE", "LPAREN", "RPAREN", "LSQUARE", "RSQUARE", "COMMENT", "INTEGER", "INTEGER64", "...
code_fim
hard
{ "lang": "python", "repo": "taotao/jsonlibconfig", "path": "/jsonlibconfig/lex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r'\#.*|\/\/.*' pass def t_newline(t): r'\n+' t.lexer.lineno += len(t.value) def t_error(t): raise TypeError("Unknown text '%s'" % (t.value,)) def hextoint(b=True): global _hextoint _hextoint = b lex.lex(debug=0)<|fim_prefix|># repo: taotao/jsonlibconfig path: /jsonlibc...
code_fim
hard
{ "lang": "python", "repo": "taotao/jsonlibconfig", "path": "/jsonlibconfig/lex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yshaath/pyzkaccess path: /pyzkaccess/__init__.py from .aux_input import * from .common import * from .ctypes_ import * from .device<|fim_suffix|>from .reader import * from .relay import * from .sdk import * from .tables import *<|fim_middle|> import * from .device_data import * from .door import ...
code_fim
medium
{ "lang": "python", "repo": "yshaath/pyzkaccess", "path": "/pyzkaccess/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from .reader import * from .relay import * from .sdk import * from .tables import *<|fim_prefix|># repo: yshaath/pyzkaccess path: /pyzkaccess/__init__.py from .aux_input import * from .common import * from .ctypes_ import * from .device import * from .device_data import * from .door import * from .enums ...
code_fim
medium
{ "lang": "python", "repo": "yshaath/pyzkaccess", "path": "/pyzkaccess/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: s3prl/s3prl path: /s3prl/problem/common/superb_ic.py """ The setting of Superb IC Authors * Wei-Cheng Tseng 2021 * Leo 2021 * Leo 2022 """ import logging import pickle from pathlib import Path import pandas as pd import torch from omegaconf import MISSING from torch.utils.data import Dat...
code_fim
hard
{ "lang": "python", "repo": "s3prl/s3prl", "path": "/s3prl/problem/common/superb_ic.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: build_encoder (dict): same in :obj:`default_config`, no argument supported for now target_dir (str): Save your encoder into this directory cache_dir (str): If the preprocessing takes too long time, you can save the temporary files into this...
code_fim
hard
{ "lang": "python", "repo": "s3prl/s3prl", "path": "/s3prl/problem/common/superb_ic.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _build_batch_sampler( train: dict = None, valid: dict = None, test: dict = None ): if mode == "train": return FixedBatchSizeBatchSampler(dataset, **train) elif mode == "valid": return FixedBatchSizeBatchSampler(dataset...
code_fim
hard
{ "lang": "python", "repo": "s3prl/s3prl", "path": "/s3prl/problem/common/superb_ic.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> set_state(lambda old_state: not old_state) return state, toggle_state idom.run(AndGate)<|fim_prefix|># repo: StefanBrand/idom path: /docs/source/examples/simple_and_gate.py import idom @idom.component def AndGate(): input_1, toggle_1 = use_toggle() input_2, toggle_2 = use_toggle(...
code_fim
medium
{ "lang": "python", "repo": "StefanBrand/idom", "path": "/docs/source/examples/simple_and_gate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> state, set_state = idom.hooks.use_state(False) def toggle_state(): set_state(lambda old_state: not old_state) return state, toggle_state idom.run(AndGate)<|fim_prefix|># repo: StefanBrand/idom path: /docs/source/examples/simple_and_gate.py import idom @idom.component def AndGate...
code_fim
medium
{ "lang": "python", "repo": "StefanBrand/idom", "path": "/docs/source/examples/simple_and_gate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StefanBrand/idom path: /docs/source/examples/simple_and_gate.py import idom @idom.component def AndGate(): input_1, toggle_1 = use_toggle() input_2, toggle_2 = use_toggle() return idom.html.div( idom.html.input({"type": "checkbox", "onClick": lambda event: toggle_1()}), ...
code_fim
medium
{ "lang": "python", "repo": "StefanBrand/idom", "path": "/docs/source/examples/simple_and_gate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> res = [] self._analyse_word(word, is_case_sensitive, _collect_parses) return res def _analyse_word(self, word: str, is_case_sensitive: bool, callback: Callable[[str, int, int, float], None]): if not is_case_sensitive: word = word.lower() self._analy...
code_fim
hard
{ "lang": "python", "repo": "DanAnastasyev/neuromorphy", "path": "/neuromorphy/dictionary/dictionary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DanAnastasyev/neuromorphy path: /neuromorphy/dictionary/dictionary.py # -*- coding: utf-8 -*- import os from zipfile import ZipFile from tempfile import TemporaryDirectory from typing import Tuple, List, Callable, Sequence import pickle import dawg import numpy as np def _lazy_property(fn): ...
code_fim
hard
{ "lang": "python", "repo": "DanAnastasyev/neuromorphy", "path": "/neuromorphy/dictionary/dictionary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _collect_parses(word, grammar_val_index, lemmatize_rule_index, freq): res.append(self._get_parse(word, grammar_val_index, lemmatize_rule_index, freq)) res = [] self._analyse_word(word, is_case_sensitive, _collect_parses) return res def _analyse_word(se...
code_fim
hard
{ "lang": "python", "repo": "DanAnastasyev/neuromorphy", "path": "/neuromorphy/dictionary/dictionary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amberneil/evenarray path: /evenarray/evenarray.py import math def evenarray(*args, **kwargs): if len(args) == 2: lower = 0 upper = args[0] length = args[1] <|fim_suffix|> if length < 1: return [lower] if not include_lower: length = length + 1 if include_upper: divider = lengt...
code_fim
hard
{ "lang": "python", "repo": "amberneil/evenarray", "path": "/evenarray/evenarray.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if length < 1: return [lower] if not include_lower: length = length + 1 if include_upper: divider = length -1 if length > 1 else 1 else: divider = length arr = [lower + float(x*(upper-lower))/float(divider) for x in range(length)] if rounded: arr = [int(math.floor(n)) for n in arr] i...
code_fim
medium
{ "lang": "python", "repo": "amberneil/evenarray", "path": "/evenarray/evenarray.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if length < 1: return [lower] if not include_lower: length = length + 1 if include_upper: divider = length -1 if length > 1 else 1 else: divider = length arr = [lower + float(x*(upper-lower))/float(divider) for x in range(length)] if rounded: arr = [int(math.floor(n)) for n in arr] if...
code_fim
hard
{ "lang": "python", "repo": "amberneil/evenarray", "path": "/evenarray/evenarray.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: winfred958/athena-operation path: /athena-operation/connector/connector.py # encoding: utf-8 import boto3 from config import auth_config from config import config class AthenaConnector(object): """ """ def __init__(self): self.region_name = config.region_name se...
code_fim
hard
{ "lang": "python", "repo": "winfred958/athena-operation", "path": "/athena-operation/connector/connector.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }