text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> grad_term1 = 1.0/nSamples * np.dot((np.dot(weightMatrix, X)/aux1), np.transpose(X)); grad_term2 = 2.0/nSamples * ( np.dot(np.dot(weightMatrix, aux2), np.transpose(X)) + np.dot(np.dot(weightMatrix, X), np.transpose(aux2)) ); grad = grad_term1 + grad_term2; else: 'ERROR:ICA:computeCost...
code_fim
hard
{ "lang": "python", "repo": "cemkaraoguz/UFLDLTutorial", "path": "/ICA/ICA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cemkaraoguz/UFLDLTutorial path: /ICA/ICA.py ''' ICA.py Implementation of Independent Component Analysis Author: Cem Karaoguz Date: 13.03.2015 Version: 1.0 ''' import sys import numpy as np import pylab as pl import scipy.io import scipy.linalg from UFL.common import DataInputOutput, Dat...
code_fim
hard
{ "lang": "python", "repo": "cemkaraoguz/UFLDLTutorial", "path": "/ICA/ICA.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.debug: # Verify that the projection is correct temp = np.dot(considerWeightMatrix, np.transpose(considerWeightMatrix)); temp = temp - np.eye(self.featureDim); if not np.sum(temp**2) < 1e-23: print ('WARNING:ICA:optimizeParameters: considerWeightMatrix does not s...
code_fim
hard
{ "lang": "python", "repo": "cemkaraoguz/UFLDLTutorial", "path": "/ICA/ICA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, phonemes=None, rules=None): self.phonemes = phonemes or Phoneme() # patterns in phoneme -> grapheme conversion if not rules: rules = self.generate_rules() for rule in rules: self.rules.add_rule(rule[0], rule[1]) # one...
code_fim
medium
{ "lang": "python", "repo": "widderslainte/langmaker", "path": "/langmaker/grapheme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: widderslainte/langmaker path: /langmaker/grapheme.py ''' Translate phonemes into graphemes ''' from langmaker.phoneme import Phoneme from langmaker.transcriptionrule import TranscriptionRules class Grapheme(object): ''' produce graphemes for words ''' rules = TranscriptionRules() de...
code_fim
hard
{ "lang": "python", "repo": "widderslainte/langmaker", "path": "/langmaker/grapheme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KitsuneNoctus/makeschool path: /site/public/courses/CS-1.2/Code/Simplified_Starter_Code/test_dictogram.py #to run type: pytest test_dictogram.py from dictogram import Dictogram # known inputs and their expected results fish_words = ['one', 'fish', 'two', 'fish', 'red', 'fish', 'blue', 'fish'...
code_fim
hard
{ "lang": "python", "repo": "KitsuneNoctus/makeschool", "path": "/site/public/courses/CS-1.2/Code/Simplified_Starter_Code/test_dictogram.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dictogram = Dictogram(fish_words) # Create a list of 10,000 word samples from histogram samples_list = [dictogram.sample() for _ in range(10000)] # Create a histogram to count frequency of each word samples_hist = Dictogram(samples_list) # Check each word in original histogram...
code_fim
hard
{ "lang": "python", "repo": "KitsuneNoctus/makeschool", "path": "/site/public/courses/CS-1.2/Code/Simplified_Starter_Code/test_dictogram.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: patrickmaslen/pbs path: /pbs/prescription/templatetags/texify.py from django.template.defaultfilters import stringfilter, register from django.utils.safestring import mark_safe REPLACEMENTS = { '&': r'\&', '%': r'\%', '$': r'\$', '#': r'\#', '_': r'\_', '<': r'\textless{}...
code_fim
hard
{ "lang": "python", "repo": "patrickmaslen/pbs", "path": "/pbs/prescription/templatetags/texify.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@register.filter @stringfilter def colourise(value, background=False): """ Colours standard words. If no color, defaults to Fuchsia. Background = true doesn't work outside of cells. """ if background: return mark_safe("".join((r"\cellcolor{", COLOURUPS.get(value, "white"), ...
code_fim
hard
{ "lang": "python", "repo": "patrickmaslen/pbs", "path": "/pbs/prescription/templatetags/texify.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @register.filter @stringfilter def colourise(value, background=False): """ Colours standard words. If no color, defaults to Fuchsia. Background = true doesn't work outside of cells. """ if background: return mark_safe("".join((r"\cellcolor{", COLOURUPS.get(value, "white"), ...
code_fim
hard
{ "lang": "python", "repo": "patrickmaslen/pbs", "path": "/pbs/prescription/templatetags/texify.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ubccapico/python-canvasapi-base path: /quizzes/questions.py from CanvasAPI.util import callhelper from CanvasAPI import instance __all__ = ["get", "get_question", "put_question", "post_question", "delete_question"] def get(course_id, quiz_id, *args): '''List questions in a quiz or a...
code_fim
hard
{ "lang": "python", "repo": "ubccapico/python-canvasapi-base", "path": "/quizzes/questions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def post_question(course_id, quiz_id, post_fields): '''Create a single quiz question question[question_name] : string question[question_text] : string question[quiz_group_id] : integer question[question_type] : string question[position]...
code_fim
hard
{ "lang": "python", "repo": "ubccapico/python-canvasapi-base", "path": "/quizzes/questions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kosyachniy/dev path: /db/mongodb/lib/-.py from pymongo import MongoClient # Глобальный сервер import json <|fim_suffix|># MLab from keys import DB link = 'mongodb://{}:{}@ds018839.mlab.com:18839/user'.format(DB['login'], DB['password']) db = MongoClient(link)['user']<|fim_middle|>with open...
code_fim
hard
{ "lang": "python", "repo": "kosyachniy/dev", "path": "/db/mongodb/lib/-.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>link = 'mongodb://{}:{}@ds018839.mlab.com:18839/user'.format(DB['login'], DB['password']) db = MongoClient(link)['user']<|fim_prefix|># repo: kosyachniy/dev path: /db/mongodb/lib/-.py from pymongo import MongoClient # Глобальный сервер import json with open('keys.json', 'r') as file: keys = json.lo...
code_fim
medium
{ "lang": "python", "repo": "kosyachniy/dev", "path": "/db/mongodb/lib/-.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> file_name_sans_extension = base_path + "views/" + view_file_path found = False for ext in self.extensions: file_path = file_name_sans_extension + ext if os.path.exists(file_path): found = True break if found: self.window.open_file(file_path) else: ...
code_fim
hard
{ "lang": "python", "repo": "joseramonc/dotfiles", "path": "/sublime.symlink/rails_open_view_command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joseramonc/dotfiles path: /sublime.symlink/rails_open_view_command.py import sublime import sublime_plugin import os import re class RailsOpenViewCommand(sublime_plugin.WindowCommand): extensions = ( '.html.erb', '.erb', '.html.haml', '.haml', '.js.erb', '.js.haml' )...
code_fim
hard
{ "lang": "python", "repo": "joseramonc/dotfiles", "path": "/sublime.symlink/rails_open_view_command.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('idgo_admin', '0041_auto_20180227_1637'), ] operations = [ migrations.RenameField( model_name='dataset', old_name='broadcast_email', new_name='broadcaster_email', ), migrations.RenameField( mode...
code_fim
medium
{ "lang": "python", "repo": "jerbou/idgo", "path": "/idgo_admin/migrations/0042_auto_20180227_1649.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jerbou/idgo path: /idgo_admin/migrations/0042_auto_20180227_1649.py # -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-27 15:49 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): <|fim_suffix|> operations = [ ...
code_fim
medium
{ "lang": "python", "repo": "jerbou/idgo", "path": "/idgo_admin/migrations/0042_auto_20180227_1649.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def read_input(self): self.s = input() self.t = input() def process_task(self): dp = [[0 for x in range(5005)] for y in range(5005)] l1 = len(self.s) l2 = len(self.t) mod = 1_000_000_007 for x in range(l1): for y in range(l2): ...
code_fim
medium
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/163A/cdf_163A.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/163A/cdf_163A.py import math def newton(n, k): return math.factorial(n) // (math.factorial(k) * math.factorial(n - k)) class CodeforcesTask163ASolution: def __init__(self): self.result = '' self.s = '' self.t = '' ...
code_fim
hard
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/163A/cdf_163A.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>01: chrom, bounds = line[0].strip("\"").split(":") start, end = bounds.split("-") outfile.write("\t".join((chrom, start, end))) outfile.write("\n") infile.close() outfile.close()<|fim_prefix|># repo: seqcode/multimds path: /scripts/process_edger_results.py with open("nup60_si...
code_fim
medium
{ "lang": "python", "repo": "seqcode/multimds", "path": "/scripts/process_edger_results.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: seqcode/multimds path: /scripts/process_edger_results.py with open("nup60_sig.bed", "w") as outfile: with open("nup60_edgeR_results.tsv") as infile: for li<|fim_suffix|>file.write("\t".join((chrom, start, end))) outfile.write("\n") infile.close() outfile.close()<|fim_middle|>ne in...
code_fim
hard
{ "lang": "python", "repo": "seqcode/multimds", "path": "/scripts/process_edger_results.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ds = vtkDataSet.SafeDownCast(dataInput) if ds: dsw = vtkDataSetWriter() dsw.SetFileName(vtkFile) dsw.SetInputData(ds) dsw.Write() if not DoFilesExist(xdmfFile, None, None, False): message = "Writer did not create " + xdmfFile raiseErrorAndExit(message) xReader = vtkXdmf3R...
code_fim
hard
{ "lang": "python", "repo": "Kitware/VTK", "path": "/IO/Xdmf3/Testing/Python/VToXLoop.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> xReader = vtkXdmf3Reader() xReader.SetFileName(xdmfFile) timer.StartTimer() xReader.Update() timer.StopTimer() print("vtkXdmf3Reader took %f seconds to read %s" % (timer.GetElapsedTime(), xdmfFile)) rOutput = xReader.GetOutputDataObject(0) fail = DoDataObjectsDiffer(dataInput, rOutput) ...
code_fim
hard
{ "lang": "python", "repo": "Kitware/VTK", "path": "/IO/Xdmf3/Testing/Python/VToXLoop.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kitware/VTK path: /IO/Xdmf3/Testing/Python/VToXLoop.py """ This test verifies that vtk's Xdmf reader and writer work in general. It generates a variety of small data sets, writing each one to and reading it from an xdmf file and compares the read in generated result with the read in result and pa...
code_fim
hard
{ "lang": "python", "repo": "Kitware/VTK", "path": "/IO/Xdmf3/Testing/Python/VToXLoop.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(n): for j in range(i + 1, n): for k in range(j + 1, n): if arr[i] < arr[j] < arr[k]: if arr[j] not in data: data.append(arr[j]) count += 1 # count += 1 # arr[j] = 0 print(count)<...
code_fim
easy
{ "lang": "python", "repo": "yuthreestone/LanQiao-Learning", "path": "/Python解答蓝桥杯省赛真题之从入门到真题/递增三元组.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuthreestone/LanQiao-Learning path: /Python解答蓝桥杯省赛真题之从入门到真题/递增三元组.py n = int(input()) arr = list(map(int, input().split())) <|fim_suffix|>for i in range(n): for j in range(i + 1, n): for k in range(j + 1, n): if arr[i] < arr[j] < arr[k]: if arr[j] not in ...
code_fim
easy
{ "lang": "python", "repo": "yuthreestone/LanQiao-Learning", "path": "/Python解答蓝桥杯省赛真题之从入门到真题/递增三元组.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(req: func.HttpRequest) -> func.HttpResponse: logging.info( 'sosi_func0003_crawler_stock_listing_details function processed a request.') try: stock_obj: stock = stock() det_crawler: stock_code_details_crawler = stock_code_details_crawler() config_obj = read...
code_fim
medium
{ "lang": "python", "repo": "leonidasnascimento/sosi_func0003_crawler_stock_listing_details", "path": "/func/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leonidasnascimento/sosi_func0003_crawler_stock_listing_details path: /func/__init__.py import logging import azure.functions as func import json import requests import pathlib import threading from .models.stock import stock from .crawler import stock_code_details_crawler from configuration_mana...
code_fim
hard
{ "lang": "python", "repo": "leonidasnascimento/sosi_func0003_crawler_stock_listing_details", "path": "/func/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: megajanlott/cbor-decoder path: /tests/test_Stack.py import pytest from cbor.Stack import Stack def test_init(): stack = Stack() assert stack.items == [] <|fim_suffix|> stack = Stack() stack.push([1, 3, 4]) assert stack.pop() == 4 assert stack.items == [1, 3] stack =...
code_fim
hard
{ "lang": "python", "repo": "megajanlott/cbor-decoder", "path": "/tests/test_Stack.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stack = Stack() assert stack.isEmpty() is True stack = Stack() stack.push(10) assert stack.isEmpty() is False def test_push(): stack = Stack() stack.push(5) assert stack.items == [5] stack.push('test') assert stack.items == [5, 'test'] def test_push_array(): ...
code_fim
medium
{ "lang": "python", "repo": "megajanlott/cbor-decoder", "path": "/tests/test_Stack.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: carlfin/herbie path: /herbieapp/services/__init__.py from .message_publisher import * from .business_entity_manager <|fim_suffix|>r import * from .utils import * from .message_publisher import *<|fim_middle|>import * from .schema_package import * from .schema_registry import * from .json_schema_v...
code_fim
medium
{ "lang": "python", "repo": "carlfin/herbie", "path": "/herbieapp/services/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ort * from .json_schema_validator import * from .schema_importer import * from .utils import * from .message_publisher import *<|fim_prefix|># repo: carlfin/herbie path: /herbieapp/services/__init__.py from .message_publisher import * from .business_entity_manager <|fim_middle|>import * from .schema_pack...
code_fim
medium
{ "lang": "python", "repo": "carlfin/herbie", "path": "/herbieapp/services/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parse_ouput(self, data, context, response): ''' Parse the output from Invoke-BloodHound ''' parsedData = data.split("!-!") nameList = ['user_sessions', 'group_membership.csv', 'acls.csv', 'local_admins.csv', 'trusts.csv'] for x in range(0, len(parse...
code_fim
hard
{ "lang": "python", "repo": "network23/CrackMapExec", "path": "/cme/modules/bloodhound.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: network23/CrackMapExec path: /cme/modules/bloodhound.py from cme.helpers.powershell import * from cme.helpers.misc import validate_ntlm from cme.helpers.logger import write_log from sys import exit class CMEModule: ''' Executes the BloodHound recon script on the target and retrieves ...
code_fim
hard
{ "lang": "python", "repo": "network23/CrackMapExec", "path": "/cme/modules/bloodhound.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: medwig/pythonchallenge-solutions path: /p4.py import urllib.request import re import operator OPERATORS = { "divide": operator.floordiv } NUMBERS = { "one": 1, "two": 2 } def replace_path_end(url, newEnd): newUrl = url.split('/') newUrl[-1] = newEnd return '/'.join(newU...
code_fim
hard
{ "lang": "python", "repo": "medwig/pythonchallenge-solutions", "path": "/p4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># The problem input data is a url - follow it newUrl = replace_path_end(URL, data) with urllib.request.urlopen(newUrl) as response: html = response.read().decode('utf-8') print(f'Input data link reads:\n{html}\n') # Hint suggests following resulting next 'nothing' numbers in the fashion of linked list...
code_fim
hard
{ "lang": "python", "repo": "medwig/pythonchallenge-solutions", "path": "/p4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nothing = nextNothing url = nextUrl html = nextHtml print(f'\nTarget found in linked list:\n{target}\n') # Build the solution url by replacing the path end with the anagram solution = replace_path_end(URL, target) print(f'Url solution page:\n{solution}\n')<|fim_prefix|># repo: medwig/python...
code_fim
hard
{ "lang": "python", "repo": "medwig/pythonchallenge-solutions", "path": "/p4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> index = data['data']['fingers'][1] middle = data['data']['fingers'][2] third = data['data']['fingers'][3] little = data['data']['fingers'][4] self.data = data['data']['fingers'] self.thumb = Thumb(data) self.index = Rotation(pitch=index['ang'][0], ya...
code_fim
medium
{ "lang": "python", "repo": "t-mdo/haptic-recognition", "path": "/Source_Code/version_1.0_CORPUS/sensoglove/sensoglove/fingers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: t-mdo/haptic-recognition path: /Source_Code/version_1.0_CORPUS/sensoglove/sensoglove/fingers.py from .rotation import Rotation class Thumb: def __init__(self, data): thumb = data['data']['fingers'][0] self.rotation = Rotation(pitch=thumb['ang'][0], yaw=thumb['ang'][1]) ...
code_fim
medium
{ "lang": "python", "repo": "t-mdo/haptic-recognition", "path": "/Source_Code/version_1.0_CORPUS/sensoglove/sensoglove/fingers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ret0 = _clean_response('html') ret1 = _clean_response('.html') assert ret0 == ret1 @pytest.mark.web def test__urlopen(): url = 'http://erddap.sensors.ioos.us/erddap/tabledap/' ret = _urlopen(url) isinstance(ret, io.BytesIO)<|fim_prefix|># repo: rsignell-usgs/erddapy path: /tests...
code_fim
hard
{ "lang": "python", "repo": "rsignell-usgs/erddapy", "path": "/tests/test_utilities.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rsignell-usgs/erddapy path: /tests/test_utilities.py import io from erddapy.utilities import _check_url_response, _clean_response from erddapy.extras import _urlopen import pytest <|fim_suffix|>def test__clean_response(): ret0 = _clean_response('html') ret1 = _clean_response('.html') ...
code_fim
hard
{ "lang": "python", "repo": "rsignell-usgs/erddapy", "path": "/tests/test_utilities.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gazzar/tmm_model path: /acsemble/mlem_reconstruction.py #!/usr/bin/python3 """mlem algorithm Implements the iterative mlem algorithm, performing projection and backprojection in a loop. My advice for learning about MLEM is to look at two books: [1] G. L. Zeng, Medical image reconstruction: A Co...
code_fim
hard
{ "lang": "python", "repo": "gazzar/tmm_model", "path": "/acsemble/mlem_reconstruction.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if config.mlem_save_similarity_metrics: self._save_similarity_metrics() self.i += 1 def _save_similarity_metrics(self): im = self.g im_ref = self.reference_image mse = helpers.mse(im, im_ref) helpers.append_to_running_log(filename=config.ml...
code_fim
hard
{ "lang": "python", "repo": "gazzar/tmm_model", "path": "/acsemble/mlem_reconstruction.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DioExtreme/TT-CL-Edition path: /toontown/ai/NewsManagerAI.py avatars entering the district. self.accept('avatarEntered', self.handleAvatarEntered) def delete(self): DistributedObjectAI.delete(self) taskMgr.remove(self.uniqueName('silly-saturday-task')) taskMg...
code_fim
hard
{ "lang": "python", "repo": "DioExtreme/TT-CL-Edition", "path": "/toontown/ai/NewsManagerAI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.setWeeklyCalendarHolidays(weeklyCalendarHolidays) self.d_setWeeklyCalendarHolidays(weeklyCalendarHolidays) def getWeeklyCalendarHolidays(self): return self.weeklyCalendarHolidays def setYearlyCalendarHolidays(self, yearlyCalendarHolidays): self.yearlyCalendar...
code_fim
hard
{ "lang": "python", "repo": "DioExtreme/TT-CL-Edition", "path": "/toontown/ai/NewsManagerAI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # If needed, these will hold the holiday IDs for holidays that we want to start and/or end. holidaysToStart = [] holidaysToEnd = [] # Get our current list of weekly calendar holidays. weeklyCalendarHolidays = self.getWeeklyCalendarHolidays()[:] # Get our c...
code_fim
hard
{ "lang": "python", "repo": "DioExtreme/TT-CL-Edition", "path": "/toontown/ai/NewsManagerAI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for d, index in zip(new_dtype, self._s_cols): # print("old metadata : ", outputs.metadata.query((mbase.ALL_ELEMENTS, index))) old_metadata = dict(outputs.metadata.query((mbase.ALL_ELEMENTS, index))) if d == np.dtype(np.float16) or d == np.dtype(np.float32) or...
code_fim
hard
{ "lang": "python", "repo": "usc-isi-i2/dsbox-cleaning", "path": "/dsbox/datapreprocessing/cleaner/IQRScaler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: usc-isi-i2/dsbox-cleaning path: /dsbox/datapreprocessing/cleaner/IQRScaler.py import typing import pandas as pd import d3m.metadata.base as mbase from . import config # from d3m.primitive_interfaces.featurization import FeaturizationLearnerPrimitiveBase, FeaturizationTransformerPrimitiveBase ...
code_fim
hard
{ "lang": "python", "repo": "usc-isi-i2/dsbox-cleaning", "path": "/dsbox/datapreprocessing/cleaner/IQRScaler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> inputs_metadata = inputs.metadata def can_produce_column(column_index: int) -> bool: return cls._can_produce_column(inputs_metadata, column_index, hyperparams) columns_to_produce, columns_not_to_produce = common_utils.get_columns_to_use(inputs_metadata, ...
code_fim
hard
{ "lang": "python", "repo": "usc-isi-i2/dsbox-cleaning", "path": "/dsbox/datapreprocessing/cleaner/IQRScaler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: erasedbird/Code-Busters path: /Affinecipher.py import random values_of_a = [3,5,7,9,11,15,17,19,21,25] a = values_of_a[random.randint(0,9)] b = random.randint(1,20) alphabet = "abcdefghijklmnopqrstuvwxyz" <|fim_suffix|> final_str = "" something = something.lower() for letter in someth...
code_fim
medium
{ "lang": "python", "repo": "erasedbird/Code-Busters", "path": "/Affinecipher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> final_str = "" something = something.lower() for letter in something: if letter not in alphabet: final_str = final_str + letter else: og_number = alphabet.find(letter) cipher_letter = (og_number*a)+b final_str = final_str + alphab...
code_fim
medium
{ "lang": "python", "repo": "erasedbird/Code-Busters", "path": "/Affinecipher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_attribute_key(si, attribute_name, rh): """ Get the attribute key from the VM object :param vm: pyvmomi Virtual Machine object :param attribute_name: name of the attribute to get the key for :return: key of the attribute """ content = si.RetrieveContent() cfm = cont...
code_fim
hard
{ "lang": "python", "repo": "CloudBoltSoftware/cloudbolt-forge", "path": "/how_do_i_videos/run_a_post_sync_vms_hook/post_synch_vms_expiration_date.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_attribute_key(si, attribute_name, rh): """ Get the attribute key from the VM object :param vm: pyvmomi Virtual Machine object :param attribute_name: name of the attribute to get the key for :return: key of the attribute """ content = si.RetrieveContent() cfm = conte...
code_fim
hard
{ "lang": "python", "repo": "CloudBoltSoftware/cloudbolt-forge", "path": "/how_do_i_videos/run_a_post_sync_vms_hook/post_synch_vms_expiration_date.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CloudBoltSoftware/cloudbolt-forge path: /how_do_i_videos/run_a_post_sync_vms_hook/post_synch_vms_expiration_date.py from datetime import datetime from infrastructure.models import Server from resourcehandlers.vmware.models import VsphereResourceHandler from pyVmomi import vim from utilities.logge...
code_fim
hard
{ "lang": "python", "repo": "CloudBoltSoftware/cloudbolt-forge", "path": "/how_do_i_videos/run_a_post_sync_vms_hook/post_synch_vms_expiration_date.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RomainGUIGNARD/connectors path: /malpedia/src/malpedia.py import os import yaml import time import requests import re from datetime import datetime from pycti import OpenCTIConnectorHelper, get_config_variable class Malpedia: def __init__(self): # Instantiate the connector helper f...
code_fim
hard
{ "lang": "python", "repo": "RomainGUIGNARD/connectors", "path": "/malpedia/src/malpedia.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> malpedia_organization = self.helper.api.identity.create( type="Organization", name="Malpedia", description="Malpedia is a free service offered by Fraunhofer FKIE.", ) # for ...
code_fim
hard
{ "lang": "python", "repo": "RomainGUIGNARD/connectors", "path": "/malpedia/src/malpedia.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # for family in families: # print(json.dumps(list_of_families_json, indent=4, sort_keys=True)) for name in list_of_families_json: # we create the malware(family) malware = self.helper.api.malware.cr...
code_fim
hard
{ "lang": "python", "repo": "RomainGUIGNARD/connectors", "path": "/malpedia/src/malpedia.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return a * np.sin(2.0 * np.pi * tt * fs / f).astype(np.float32) def main(): fs = 44100.0 my_file = 'output.wav' tt = np.arange(0.0, 2.0, 1.0 / fs) signal = np.zeros(tt.shape, dtype=np.float32) for f in np.random.uniform(low=100.0, high=1500.0, size=(100)): samples = mksi...
code_fim
medium
{ "lang": "python", "repo": "jpanikulam/experiments", "path": "/sounds/make_thruster_sound.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpanikulam/experiments path: /sounds/make_thruster_sound.py '''This is an experiment inspired by Matt Vernacchia Experiments with generating thruster-like sounds by generating largely uniform noise over the frequency domain. TODO: Empirically calibrate ''' from scipy.io import wavfile import os...
code_fim
medium
{ "lang": "python", "repo": "jpanikulam/experiments", "path": "/sounds/make_thruster_sound.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tylern4/physics_code path: /current/python/h10_ana.py from matplotlib import pyplot as plt from build.h10 import h10_data from build.physics_vectors import LorentzVector from python.reaction import reaction from python.histograms import Hist1D, Hist2D from tqdm import tqdm import numpy as np <|...
code_fim
medium
{ "lang": "python", "repo": "tylern4/physics_code", "path": "/current/python/h10_ana.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for e in tqdm(range(0, data.num_entries)): data.get_entry(e) event = reaction(data) event.run() if event.PROT_EVENT: h1d.fill(event.W) plt.step(*h1d.data) plt.show()<|fim_prefix|># repo: tylern4/physics_code path: /current/python/h10_ana.py from matplotlib import pyplot as plt fr...
code_fim
medium
{ "lang": "python", "repo": "tylern4/physics_code", "path": "/current/python/h10_ana.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>h1d = Hist1D(500, 0.5, 2) data = h10_data() data.add("~/Data/e1d/data/h10_r23501*.root") for e in tqdm(range(0, data.num_entries)): data.get_entry(e) event = reaction(data) event.run() if event.PROT_EVENT: h1d.fill(event.W) plt.step(*h1d.data) plt.show()<|fim_prefix|># repo: ty...
code_fim
medium
{ "lang": "python", "repo": "tylern4/physics_code", "path": "/current/python/h10_ana.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Import all models from htsohm.db.base import Base from htsohm.db.atom_sites import AtomSite from htsohm.db.atom_types import AtomTypes from htsohm.db.gas_loading import GasLoading from htsohm.db.surface_area import SurfaceArea from htsohm.db.void_fraction import VoidFraction from htsohm.db.material impo...
code_fim
hard
{ "lang": "python", "repo": "WilmerLab/htsohm", "path": "/htsohm/db/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WilmerLab/htsohm path: /htsohm/db/__init__.py from datetime import datetime from glob import glob import os from shutil import copy2 import sys from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import yaml __engi...
code_fim
hard
{ "lang": "python", "repo": "WilmerLab/htsohm", "path": "/htsohm/db/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def delete_extra_materials(delete_after_id): __engine__.execute("delete from materials where id > %d" % delete_after_id) __engine__.execute("delete from gas_loadings where material_id > %d" % delete_after_id) __engine__.execute("delete from surface_areas where material_id > %d" % delete_after_...
code_fim
hard
{ "lang": "python", "repo": "WilmerLab/htsohm", "path": "/htsohm/db/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>SinaWeiBo_Settings = \ { "AndroidManifest": { "permissions" : [ u"android.permission.WRITE_EXTERNAL_STORAGE", u"android.permission.ACCESS_WIFI_STATE", u"android.permission.ACCESS_NETWORK_STATE", ...
code_fim
hard
{ "lang": "python", "repo": "moongame/game_sdk", "path": "/NativeLib/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: moongame/game_sdk path: /NativeLib/main.py ns"): self._permissionList = self._settings["AndroidManifest"]["permissions"] if self._settings["AndroidManifest"].has_key("activities"): self._manifestElementActivities = self._settings["AndroidManifest"]["act...
code_fim
hard
{ "lang": "python", "repo": "moongame/game_sdk", "path": "/NativeLib/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: moongame/game_sdk path: /NativeLib/main.py ctivities = self._settings["AndroidManifest"]["activities"] self._filterLibs = [] if self._settings.has_key(self._libsFolderName): self._filterLibs = self._settings[self._libsFolderName] def _copyManifestFile(self): ...
code_fim
hard
{ "lang": "python", "repo": "moongame/game_sdk", "path": "/NativeLib/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ResultsView(BaseView): template = "eyedetector/results.html" form_class = GenerateResultsForm def get_context(self, request): context = {} context['experiments'] = Experiment.objects.all().order_by("-pk") context['form'] = self.form_class(experiment = Experiment.objects.all()) context['e...
code_fim
hard
{ "lang": "python", "repo": "AriRodriguezCruz/mcfgpr", "path": "/gazepattern/eyedetector/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AriRodriguezCruz/mcfgpr path: /gazepattern/eyedetector/views.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render, get_object_or_404, reverse, redirect from django.db import transaction #python # - - - #gazepattern from utils.views import BaseVie...
code_fim
hard
{ "lang": "python", "repo": "AriRodriguezCruz/mcfgpr", "path": "/gazepattern/eyedetector/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tetocode/zaifexport path: /zaifexport/exporter.py from collections import OrderedDict import csv from datetime import datetime import sys import time from typing import Generator, Callable, Iterator, Union, List, Optional import pytz from zaifapi import ZaifPublicApi, ZaifFuturesPublicApi, ZaifL...
code_fim
hard
{ "lang": "python", "repo": "tetocode/zaifexport", "path": "/zaifexport/exporter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> yield from self.get_history(self.futures_trade_api.get_positions, parse, **kwargs) def export_margin(self) -> Generator[dict, None, None]: yield from self._export_margin_or_future(type='margin') def export_future(self) -> Generator[dict, None, None]: groups = self.futures...
code_fim
hard
{ "lang": "python", "repo": "tetocode/zaifexport", "path": "/zaifexport/exporter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return { 'schema': schema }<|fim_prefix|># repo: falso-de-verdade/api path: /backend/domain/availability.py schema = { 'fromDay': { 'required': True, 'type': 'integer', }, 'toDay': { 'required': True, 'type': 'integer', }, 'fromHour': { ...
code_fim
easy
{ "lang": "python", "repo": "falso-de-verdade/api", "path": "/backend/domain/availability.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: falso-de-verdade/api path: /backend/domain/availability.py schema = { 'fromDay': { 'required': True, 'type': 'integer', }, 'toDay': { 'required': True, 'type': 'integer', }, 'fromHour': { 'required': True, 'type': 'string', }...
code_fim
easy
{ "lang": "python", "repo": "falso-de-verdade/api", "path": "/backend/domain/availability.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_p1_manifest_ingestion(self): for num in range(1, 4): participant_summary = self.data_generator.create_database_participant_summary( consentForGenomicsROR=QuestionnaireStatus.SUBMITTED, consentForStudyEnrollment=QuestionnaireStatus.SUBMITTED...
code_fim
hard
{ "lang": "python", "repo": "all-of-us/raw-data-repository", "path": "/tests/genomics_tests/test_genomic_pr_pipeline.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: all-of-us/raw-data-repository path: /tests/genomics_tests/test_genomic_pr_pipeline.py service import config, clock from rdr_service.api_util import open_cloud_file from rdr_service.dao.genomics_dao import GenomicDefaultBaseDao, GenomicManifestFileDao, \ GenomicFileProcessedDao, GenomicJobRunD...
code_fim
hard
{ "lang": "python", "repo": "all-of-us/raw-data-repository", "path": "/tests/genomics_tests/test_genomic_pr_pipeline.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # 1 for PR and 1 for P0 self.assertEqual(len(pr_files_processed), 2) # check job run record p0_job_runs = list(filter(lambda x: x.jobId == GenomicJob.PR_P0_WORKFLOW, self.job_run_dao.get_all())) self.assertIsNotNone(p0_job_runs) self.assertEqual(len(p0_job...
code_fim
hard
{ "lang": "python", "repo": "all-of-us/raw-data-repository", "path": "/tests/genomics_tests/test_genomic_pr_pipeline.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> word = self.word_row.string_value() if word in self.words_remaining: fl = self.found_area.add_word(word) self.words_found[word] = fl self.words_found_n += 1 self.words_remaining.remove(word) self.score += self.score_word(word) ...
code_fim
hard
{ "lang": "python", "repo": "aweraw/kivy-word-game", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aweraw/kivy-word-game path: /main.py from random import shuffle from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.properties import ( NumericProperty, ObjectProperty, BooleanProperty, DictProperty, StringProperty) from kivy.clock import Clock from kivy.core....
code_fim
hard
{ "lang": "python", "repo": "aweraw/kivy-word-game", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return None def score_word(self, word): score = 0 ln = len(word) for c in word: score += letter_vals[c] * ln return score class WordApp(App): def build(self): game = WordGame() game.init() game.word_row.bind(pos=game.wo...
code_fim
hard
{ "lang": "python", "repo": "aweraw/kivy-word-game", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paudelsagar/nepali-date path: /nepali_date/date.py ष्ठ', 'Ashar': 'आषाढ', 'Shrawan': 'श्रावन', 'Bhadra': 'भाद्र', 'Asoj': 'असोज', 'Kartik': 'कार्तिक', 'Mangsir': 'मंसिर', 'Poush': 'पौष', 'Magh': 'माघ', 'Falgun': 'फागुन', 'Chait': 'चैत्र', 'Bai': 'बैशाख', 'Jes': 'जेष्ठ'...
code_fim
hard
{ "lang": "python", "repo": "paudelsagar/nepali-date", "path": "/nepali_date/date.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def weekday(self): return WEEKDAYS[self.to_english_date().weekday()][0] @property def weekday_translated(self): return NepaliDate.translate(self.lang, self.weekday, to_translate='day') if self.lang == 'nep' else self.weekday @property def year(self): ...
code_fim
hard
{ "lang": "python", "repo": "paudelsagar/nepali-date", "path": "/nepali_date/date.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paudelsagar/nepali-date path: /nepali_date/date.py un': 'फागुन', 'Chait': 'चैत्र', 'Bai': 'बैशाख', 'Jes': 'जेष्ठ', 'Ash': 'आषाढ', 'Shr': 'श्रावन', 'Bha': 'भाद्र', 'Aso': 'असोज', 'Kar': 'कार्तिक', 'Man': 'मंसिर', 'Pou': 'पौष', 'Mag': 'माघ', 'Fal': 'फागुन', ...
code_fim
hard
{ "lang": "python", "repo": "paudelsagar/nepali-date", "path": "/nepali_date/date.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinlong01/electrum-sw path: /plugins/sw/__init__.py from electrum.i18n import _ fullname = 'Smart Wallet' description<|fim_suffix|>, 'github.com/ledgerhq/btchip-python')] registers_keystore = ('hardware', 'sw', _("Smart Wallet")) available_for = ['qt', 'cmdline']<|fim_middle|> = 'Provides suppor...
code_fim
medium
{ "lang": "python", "repo": "jinlong01/electrum-sw", "path": "/plugins/sw/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>, 'github.com/ledgerhq/btchip-python')] registers_keystore = ('hardware', 'sw', _("Smart Wallet")) available_for = ['qt', 'cmdline']<|fim_prefix|># repo: jinlong01/electrum-sw path: /plugins/sw/__init__.py from electrum.i18n import _ fullname = 'Smart Wallet' description<|fim_middle|> = 'Provides suppor...
code_fim
medium
{ "lang": "python", "repo": "jinlong01/electrum-sw", "path": "/plugins/sw/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 425776024/Learn path: /pythonlearn/Database/lib/DBTool.py # -*- coding: utf-8 -*- # import sys import traceback import time import redis import psycopg2 import MySQLdb import pymongo from DBUtils.PooledDB import PooledDB from . import settings ##################################...
code_fim
hard
{ "lang": "python", "repo": "425776024/Learn", "path": "/pythonlearn/Database/lib/DBTool.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> __redis_pool = redis.ConnectionPool( host=settings.REDIS_SET['host'], port=settings.REDIS_SET['port'], db=0 ) self.db.Redis = redis.StrictRedis(connection_pool=__redis_pool) def get_redis_connection(self): self.__init_redis() return self.db.R...
code_fim
hard
{ "lang": "python", "repo": "425776024/Learn", "path": "/pythonlearn/Database/lib/DBTool.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_redis_connection(self): self.__init_redis() return self.db.Redis ############################################################ # MongoDB 操作 # 初始化 MongoDB 连接 def init_mongo(self, outerr=True): try: self.db.MongoConn = pymongo.Connecti...
code_fim
hard
{ "lang": "python", "repo": "425776024/Learn", "path": "/pythonlearn/Database/lib/DBTool.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-aws-native path: /sdk/python/pulumi_aws_native/sagemaker/domain.py default_space_settings: Optional[pulumi.Input['DomainDefaultSpaceSettingsArgs']] = None, domain_name: Optional[pulumi.Input[str]] = None, domain_settings: Optional[pulumi.In...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-aws-native", "path": "/sdk/python/pulumi_aws_native/sagemaker/domain.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ The entity that creates and manages the required security groups for inter-app communication in VPCOnly mode. Required when CreateDomain.AppNetworkAccessType is VPCOnly and DomainSettings.RStudioServerProDomainSettings.DomainExecutionRoleArn is provided. """ return pulu...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-aws-native", "path": "/sdk/python/pulumi_aws_native/sagemaker/domain.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Domain(pulumi.CustomResource): @overload def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, app_network_access_type: Optional[pulumi.Input['DomainAppNetworkAccessType']] = None, app_sec...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-aws-native", "path": "/sdk/python/pulumi_aws_native/sagemaker/domain.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Set numpy print options to "legacy" for new versions of numpy If imported into a file, nosetest will run this before any doctests. References ----------- https://github.com/numpy/numpy/commit/710e0327687b9f7653e5ac02d222ba62c657a718 https://github.com/numpy/numpy/commit/734b907...
code_fim
hard
{ "lang": "python", "repo": "fury-gl/fury", "path": "/fury/testing.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fury-gl/fury path: /fury/testing.py """Utilities for testing.""" import io import json import operator import sys import warnings from contextlib import contextmanager from distutils.version import LooseVersion from functools import partial import numpy as np import scipy # type: ignore from n...
code_fim
hard
{ "lang": "python", "repo": "fury-gl/fury", "path": "/fury/testing.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for mod in self.modules: if hasattr(mod, '__warningregistry__'): mod_reg = mod.__warningregistry__ self._warnreg_copies[mod] = mod_reg.copy() mod_reg.clear() return super(clear_and_catch_warnings, self).__enter__() def __exit...
code_fim
hard
{ "lang": "python", "repo": "fury-gl/fury", "path": "/fury/testing.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fileName = os.path.normpath(f'{configDir}/{name}.cfg') if not os.path.isfile(fileName): log.info(f'Config file {fileName} not existing') return defaultConfig() try: with open(fileName, 'r') as configFile: configData = json.load(configFile) except Excep...
code_fim
hard
{ "lang": "python", "repo": "mworion/MountWizzard4", "path": "/mw4/logic/profiles/profile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ :param profile: :return: """ newDict = {} for key in profile.keys(): if key.startswith('order'): continue if isinstance(profile[key], dict): newDict[key] = checkResetTabOrder(profile[key]) else: newDict[key] = profile[...
code_fim
hard
{ "lang": "python", "repo": "mworion/MountWizzard4", "path": "/mw4/logic/profiles/profile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mworion/MountWizzard4 path: /mw4/logic/profiles/profile.py ############################################################ # -*- coding: utf-8 -*- # # # # # # # # # ## ## # ## # # # # # # # # # # # # # # # ## # ## ## ###### # # # # # # # ...
code_fim
hard
{ "lang": "python", "repo": "mworion/MountWizzard4", "path": "/mw4/logic/profiles/profile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: accessibleapps/logger_setup path: /logger_setup/crashlogger.py import logging import faulthandler CRASHLOGGER_NAME = "APPCRASH" <|fim_suffix|>def enable_crashlogger(error_handler): stream = StreamToLogger(error_handler) faulthandler.enable(stream)<|fim_middle|>class StreamToLog...
code_fim
hard
{ "lang": "python", "repo": "accessibleapps/logger_setup", "path": "/logger_setup/crashlogger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Fake file-like stream object that redirects writes to a logger instance. """ def __init__(self, handler): self.handler = handler def fileno(self): return self.handler.stream.fileno() def enable_crashlogger(error_handler): stream = StreamToLogger(error_...
code_fim
easy
{ "lang": "python", "repo": "accessibleapps/logger_setup", "path": "/logger_setup/crashlogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }