text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>YBLUE colors['lightslateblue'] = LIGHTSLATEBLUE colors['lightslategray'] = LIGHTSLATEGRAY colors['lightsteelblue'] = LIGHTSTEELBLUE colors['lightyellow'] = LIGHTYELLOW colors['limegreen'] = LIMEGREEN colors['linen'] = LINEN colors['magenta'] = MAGENTA colors['manganeseblue'] = MANGANESEBLUE colors['maroon...
code_fim
hard
{ "lang": "python", "repo": "jdrew1303/pyBusylight", "path": "/pybusylight/color_constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> template = config.env.get_template( "launch_role_constraints.template.yaml.j2" ).render( portfolio={"DisplayName": self.portfolio,}, portfolio_id=portfolio_id, launch_constraints=new_launch_constraints, ...
code_fim
hard
{ "lang": "python", "repo": "jordan-evans/aws-service-catalog-puppet", "path": "/servicecatalog_puppet/workflow/portfolio/constraints_management/create_launch_role_constraints_for_spoke_local_portfolio_task.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jordan-evans/aws-service-catalog-puppet path: /servicecatalog_puppet/workflow/portfolio/constraints_management/create_launch_role_constraints_for_spoke_local_portfolio_task.py # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import...
code_fim
hard
{ "lang": "python", "repo": "jordan-evans/aws-service-catalog-puppet", "path": "/servicecatalog_puppet/workflow/portfolio/constraints_management/create_launch_role_constraints_for_spoke_local_portfolio_task.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abdelrahmanhosny/DL-Cerevesiae path: /data/occurences.py from Bio import SeqIO import os ''' 2. Find approximate occurrences of "likely" and "dubious" replication of origins in the resulting samples ''' def occurences(origin, chromosome, distance): count = 0 for i in range(0, len(chromo...
code_fim
hard
{ "lang": "python", "repo": "abdelrahmanhosny/DL-Cerevesiae", "path": "/data/occurences.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d = len(origin) / 2 # try to find an origin with at most half of its length mismatched # test against RNN number_of_candidates = 0 for sample in rnn_samples: number_of_candidates += occurences(origin, sample, d) print 'The dubious origin ' + name + '...
code_fim
hard
{ "lang": "python", "repo": "abdelrahmanhosny/DL-Cerevesiae", "path": "/data/occurences.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for ip in ips: print(reader.get(ip))<|fim_prefix|># repo: alikopasa/geoacumen-country path: /read.py import maxminddb reader = maxminddb.open_database("Geoacumen-Country.mmdb") <|fim_middle|> ips = [ "1.1.1.1", "216.244.66.248", "3.15.9.167", "2a02:587:a12:f000:e9bf:9b70:4fd:c66", ...
code_fim
medium
{ "lang": "python", "repo": "alikopasa/geoacumen-country", "path": "/read.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alikopasa/geoacumen-country path: /read.py import maxminddb reader = maxminddb.open_database("Geoacumen-Country.mmdb") <|fim_suffix|>for ip in ips: print(reader.get(ip))<|fim_middle|>ips = [ "1.1.1.1", "216.244.66.248", "3.15.9.167", "2a02:587:a12:f000:e9bf:9b70:4fd:c66", ...
code_fim
medium
{ "lang": "python", "repo": "alikopasa/geoacumen-country", "path": "/read.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: compeit-open-source/dashboard path: /manage.py #!/usr/bin/env python # Copyright 2016 The COMPEIT Consortium # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:/...
code_fim
hard
{ "lang": "python", "repo": "compeit-open-source/dashboard", "path": "/manage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @manager.command def test(): import unittest tests = unittest.TestLoader().discover('tests') unittest.TextTestRunner(verbosity=2).run(tests) @manager.command def sample_db(): create_sample_db() @manager.command def server(): socketio.run(app, host='0.0.0.0', port=16000, policy_ser...
code_fim
hard
{ "lang": "python", "repo": "compeit-open-source/dashboard", "path": "/manage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MIT-LCP/physionet-build path: /physionet-django/user/migrations/0024_associatedemail_verification_token.py # Generated by Django 2.2.10 on 2020-03-06 18:09 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AddField( model_name='associatedem...
code_fim
medium
{ "lang": "python", "repo": "MIT-LCP/physionet-build", "path": "/physionet-django/user/migrations/0024_associatedemail_verification_token.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('user', '0023_auto_20191125_1500'), ] operations = [ migrations.AddField( model_name='associatedemail', name='verification_token', field=models.CharField(blank=True, max_length=32, n...
code_fim
easy
{ "lang": "python", "repo": "MIT-LCP/physionet-build", "path": "/physionet-django/user/migrations/0024_associatedemail_verification_token.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='associatedemail', name='verification_token', field=models.CharField(blank=True, max_length=32, null=True), ), ]<|fim_prefix|># repo: MIT-LCP/physionet-build path: /physionet-django/user/migrations/...
code_fim
medium
{ "lang": "python", "repo": "MIT-LCP/physionet-build", "path": "/physionet-django/user/migrations/0024_associatedemail_verification_token.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jstoebel/python path: /exercises/concept/black-jack/black_jack_test.py import unittest import pytest from black_jack import ( number_of_card, number_of_ace, blackjack ) class TestComparisons(unittest.TestCase): @pytest.mark.task(taskno=1) def test_number_of_card(self): ...
code_fim
hard
{ "lang": "python", "repo": "jstoebel/python", "path": "/exercises/concept/black-jack/black_jack_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> input_data = [['A', 'J'], [10, 9]] output_data = [True, False] number_of_variants = range(1, len(input_data) + 1) for variant, input, output in zip(number_of_variants, input_data, output_data): with self.subTest(f"variation #{variant}", input=input, output=outp...
code_fim
hard
{ "lang": "python", "repo": "jstoebel/python", "path": "/exercises/concept/black-jack/black_jack_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.task(taskno=3) def test_blackjack(self): input_data = [['A', 'J'], [10, 9]] output_data = [True, False] number_of_variants = range(1, len(input_data) + 1) for variant, input, output in zip(number_of_variants, input_data, output_data): with ...
code_fim
hard
{ "lang": "python", "repo": "jstoebel/python", "path": "/exercises/concept/black-jack/black_jack_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iridium-browser/iridium-browser path: /native_client/src/untrusted/pnacl_dynloader/nacl.scons # -*- python -*- # Copyright (c) 2014 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. Import('env') ...
code_fim
hard
{ "lang": "python", "repo": "iridium-browser/iridium-browser", "path": "/native_client/src/untrusted/pnacl_dynloader/nacl.scons", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if not env.Bit('bitcode'): Return() # TODO(mseaborn): Add support for x86-64 relocation types. if env.Bit('build_x86_64'): Return() # TODO(sbc): Add support for mips relocation types. if env.Bit('build_mips32'): Return() env.AddBiasForPNaCl() env.ComponentLibrary('pnacl_dynloader', ['dynloader.c'])...
code_fim
medium
{ "lang": "python", "repo": "iridium-browser/iridium-browser", "path": "/native_client/src/untrusted/pnacl_dynloader/nacl.scons", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """No need to poll. Coordinator notifies entity of updates.""" return False @property def available(self): """Return if entity is available.""" return self.coordinator.last_update_success @property def unique_id(self): """Return a unique ID to use ...
code_fim
hard
{ "lang": "python", "repo": "MattyRoy/ha-coct-loadshedding", "path": "/custom_components/coct_loadshedding/entity.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MattyRoy/ha-coct-loadshedding path: /custom_components/coct_loadshedding/entity.py """CoCTEntity class""" from homeassistant.helpers import entity from .const import DOMAIN, NAME, VERSION class CoCTEntity(entity.Entity): def __init__(self, coordinator, config_entry): self.coordinat...
code_fim
hard
{ "lang": "python", "repo": "MattyRoy/ha-coct-loadshedding", "path": "/custom_components/coct_loadshedding/entity.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return { "identifiers": {(DOMAIN, self.unique_id)}, "name": NAME, "model": VERSION, "manufacturer": "tinuva", } @property def device_state_attributes(self): """Return the state attributes.""" return { "loa...
code_fim
hard
{ "lang": "python", "repo": "MattyRoy/ha-coct-loadshedding", "path": "/custom_components/coct_loadshedding/entity.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NamPNQ/rwrapper path: /rwrapper/fields.py """ @fileoverview rWrapper Fields @author David Parlevliet @version 20130730 @preserve Copyright 2013 David Parlevliet. """ import math from . import rwrapper def negative_field_check(should_check, value): if not should_check: return value ...
code_fim
hard
{ "lang": "python", "repo": "NamPNQ/rwrapper", "path": "/rwrapper/fields.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.ensure_max_decimals(value) class ObjectField(Field): def validate(self, value): if type(value) is not dict and type(value) is not list: raise ValueError('%s field is not dict or list type. Found type: %s' % ( self._name(), type(...
code_fim
hard
{ "lang": "python", "repo": "NamPNQ/rwrapper", "path": "/rwrapper/fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>requisites = models.TextField() workload = models.TextField() topic_covered = models.TextField()<|fim_prefix|># repo: dinganthony/hknweb path: /hknweb/courses/models.py from django.db import models # Create your models here. class Course(models.Model): course_numb<|fim_middle|>er = models.CharField(m...
code_fim
medium
{ "lang": "python", "repo": "dinganthony/hknweb", "path": "/hknweb/courses/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>True) name = models.CharField(max_length=255, null=False) description = models.TextField() prerequisites = models.TextField() workload = models.TextField() topic_covered = models.TextField()<|fim_prefix|># repo: dinganthony/hknweb path: /hknweb/courses/models.py from django.db import models # Creat...
code_fim
medium
{ "lang": "python", "repo": "dinganthony/hknweb", "path": "/hknweb/courses/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dinganthony/hknweb path: /hknweb/courses/models.py from django.db import models # Create your models here. class Course(models.Model): course_numb<|fim_suffix|>True) name = models.CharField(max_length=255, null=False) description = models.TextField() prerequisites = models.TextField() workl...
code_fim
medium
{ "lang": "python", "repo": "dinganthony/hknweb", "path": "/hknweb/courses/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: voletiv/DeepLearningImplementations path: /BEGAN/src/utils/visualization_utils.py import os import numpy as np import tensorflow as tf import matplotlib.pylab as plt import matplotlib as mp FLAGS = tf.app.flags.FLAGS def format_plot(X, epoch=None, title=None, figsize=(15, 10)): <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "voletiv/DeepLearningImplementations", "path": "/BEGAN/src/utils/visualization_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if FLAGS.data_format == "NCHW": X1 = X1.transpose((0, 2, 3, 1)) X2 = X2.transpose((0, 2, 3, 1)) Xup = X1[:32] Xdown = X2[:32] n_cols = 8 list_rows_f = [] for i in range(Xup.shape[0] // n_cols): Xrow = np.concatenate([Xup[k] for k in range(n_cols * i, n_c...
code_fim
hard
{ "lang": "python", "repo": "voletiv/DeepLearningImplementations", "path": "/BEGAN/src/utils/visualization_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: drat/Drat-Computer-Vision-AI path: /inference/loader/tf_model.py import copy import cv2 import logging import numpy as np import os import signal import tensorflow as tf import time from benchmark.usage import Timer, get_cpu_usage, get_mem_usuage, print_cpu_usage, print_mem_usage, show_usage fro...
code_fim
hard
{ "lang": "python", "repo": "drat/Drat-Computer-Vision-AI", "path": "/inference/loader/tf_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Expand dimensions since the model expects images to have shape: [1, None, None, 3] curr_frame_expanded = np.expand_dims(input, axis=0) if self.score is None and self.expand is None: output_dict = self.sess.run(self.tensor_dict, feed_dict={sel...
code_fim
hard
{ "lang": "python", "repo": "drat/Drat-Computer-Vision-AI", "path": "/inference/loader/tf_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> msg = [_('You *will receive* notifications from\n')] for sub in included_subs: msg.append(self._build_subscription_info(sub)) if excluded_subs: msg.append(_('\n*excluding*\n')) for sub in excluded_subs: msg.append(self._build_s...
code_fim
hard
{ "lang": "python", "repo": "vitaliyp/tkgbot", "path": "/tkgbot/tkgbot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vitaliyp/tkgbot path: /tkgbot/tkgbot.py import sys import re from .bot import BotError, BotCommand, Bot from .models import Subscription, Node, NodeType from .settings import translation _ = translation.gettext MSG_INCORRECT_COMMAND=_('Incorrect command. Use /help for the list of commands.') ...
code_fim
hard
{ "lang": "python", "repo": "vitaliyp/tkgbot", "path": "/tkgbot/tkgbot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> subparser = subparsers.add_parser("generate_buffet") subparser.set_defaults(function=generate_buffet.main) subparser = subparsers.add_parser("test") subparser.set_defaults(function=test.main) subparser.add_argument("--dishes", default="", type=re.compile) subparser = subparsers.a...
code_fim
medium
{ "lang": "python", "repo": "pombredanne/code-cleaner-buffet", "path": "/maintenance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> arguments = parser.parse_args() arguments.function(arguments) if __name__ == "__main__": main()<|fim_prefix|># repo: pombredanne/code-cleaner-buffet path: /maintenance.py #!/usr/bin/env python3 import argparse import re from maintenance import generate_buffet from maintenance import test ...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/code-cleaner-buffet", "path": "/maintenance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/code-cleaner-buffet path: /maintenance.py #!/usr/bin/env python3 import argparse import re from maintenance import generate_buffet from maintenance import test from maintenance import update_helpers <|fim_suffix|> parser = argparse.ArgumentParser() subparsers = parser.add_su...
code_fim
medium
{ "lang": "python", "repo": "pombredanne/code-cleaner-buffet", "path": "/maintenance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): parser = argparse.ArgumentParser(description='Train a model on TriviaQA web') parser.add_argument('mode', choices=["paragraph-level", "confidence", "merge", "shared-norm", "sigmoid", "shared-norm-600"]) parser.add_argument("name", help="Whe...
code_fim
hard
{ "lang": "python", "repo": "alphaf52/document-qa", "path": "/docqa/scripts/ablate_triviaqa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alphaf52/document-qa path: /docqa/scripts/ablate_triviaqa.py import argparse from datetime import datetime from typing import Optional from tensorflow.contrib.keras.python.keras.initializers import TruncatedNormal from docqa import model_dir from docqa import trainer from docqa.data_processing....
code_fim
hard
{ "lang": "python", "repo": "alphaf52/document-qa", "path": "/docqa/scripts/ablate_triviaqa.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Create done directory where processed files and files with errors will be moved to. if not os.path.exists(SOURCE_ROOT + 'done/'): os.makedirs(SOURCE_ROOT + 'done/') if not os.path.exists(SOURCE_ROOT + 'error/'): os.makedirs(SOURCE_ROOT + 'error/') if not os.path...
code_fim
hard
{ "lang": "python", "repo": "sosajohn/ApplePhotoOrganizer", "path": "/edited.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sosajohn/ApplePhotoOrganizer path: /edited.py import exifread import os import shutil from subprocess import call SOURCE_ROOT = '/Volumes/Pictures/Elein - 2021 01 07/edited/' DESTINATION_ROOT = '/Volumes/Pictures/Pictures/' PHOTOGRAPHER = 'Elein' def moveAndUpdate(name, extension, year...
code_fim
hard
{ "lang": "python", "repo": "sosajohn/ApplePhotoOrganizer", "path": "/edited.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # make sure length is 11 or less if len(className) >= 12: logging.debug("User entered a class name that was longer than 11 characters.") print("Class Name is too long. Max length is 11 characters.") else: logging.debug("User entered valid class n...
code_fim
hard
{ "lang": "python", "repo": "sethjwhitaker/INF360-projects", "path": "/SethWhitakerFinalProject/SethWhitakerFinalProject.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sethjwhitaker/INF360-projects path: /SethWhitakerFinalProject/SethWhitakerFinalProject.py # INF360 - Programming in Python # Seth Whitaker # Final Project # Transcript Manager # 07/18/2020 # Goals of this project: # 1. Get course information as input from user # 2. Store info in nested dictionar...
code_fim
hard
{ "lang": "python", "repo": "sethjwhitaker/INF360-projects", "path": "/SethWhitakerFinalProject/SethWhitakerFinalProject.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># ---- menuPrompt function ------------------------------------------------------------------------------------- # displays menu prompt and returns user's choice def menuPrompt(): print("-"*27) print(" "*11 + "MENU") print("-"*27) print("1. Enter Transcript Grades") print("2. View Full...
code_fim
hard
{ "lang": "python", "repo": "sethjwhitaker/INF360-projects", "path": "/SethWhitakerFinalProject/SethWhitakerFinalProject.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_Learning_System_Guides path: /Starduino_8bit_Super_Mario_Tree_Topper/code.py # SPDX-FileCopyrightText: 2018 Mikey Sklar for Adafruit Industries # # SPDX-License-Identifier: MIT import board import neopixel import adafruit_fancyled.adafruit_fancyled as fancy <|fim_suffix|># Ins...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_Learning_System_Guides", "path": "/Starduino_8bit_Super_Mario_Tree_Topper/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # heat colors palette = [0x330000, 0x660000, 0x990000, 0xCC0000, 0xFF0000, 0xFF3300, 0xFF6600, 0xFF9900, 0xFFCC00, 0xFFFF00, 0xFFFF33, 0xFFFF66, 0xFFFF99, 0xFFFFCC] for i in range(num_leds): # FancyLED can handle the gamma adjustment, brightness and RGB s...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_Learning_System_Guides", "path": "/Starduino_8bit_Super_Mario_Tree_Topper/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return weighting_matrix, x_coords, y_coords def main(): file = '/media/veritas/D/FastMRI/multicoil_val/file1001689.h5' # with h5py.File(file, mode='r') as hf: # kspace = hf['kspace'][18, 7] original = np.ones((320, 320)) kspace = np.fft.ifftshift(np.fft.fft2(np.fft.fftshift...
code_fim
hard
{ "lang": "python", "repo": "n644t031/fastMRI-kspace", "path": "/scratch/scratch11.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: n644t031/fastMRI-kspace path: /scratch/scratch11.py import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import h5py def make_weighting_matrix(array, squared_weighting=False): *_, height, width = array.shape assert (height % 2 == 0) and (width % 2 ...
code_fim
hard
{ "lang": "python", "repo": "n644t031/fastMRI-kspace", "path": "/scratch/scratch11.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> original = np.ones((320, 320)) kspace = np.fft.ifftshift(np.fft.fft2(np.fft.fftshift(original, axes=(-2, -1)), axes=(-2, -1)), axes=(-2, -1)) semi = np.fft.ifftshift(np.fft.ifft(np.fft.fftshift(kspace, axes=-2), axis=-2), axes=-2) # absolute = np.abs(semi) absolute = semi.imag we...
code_fim
hard
{ "lang": "python", "repo": "n644t031/fastMRI-kspace", "path": "/scratch/scratch11.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antmont/wmda-stuff path: /wmdadict/urls.py from django.conf.urls import url from . import views app_name = 'wmdadict' urlpatterns = [ # # / # url(r'^$', views.index, name='index'), # /dict/ url(r'^dict/$', views.dictionary_list, name='dictionary_list'), # /dict/5/ url(r'...
code_fim
hard
{ "lang": "python", "repo": "antmont/wmda-stuff", "path": "/wmdadict/urls.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>w_list'), # /bmdw/5/ url(r'^bmdw/(?P<field_id>[0-9]+)/$', views.bmdw_detail, name='bmdw_detail'), # /form/ url(r'^form/$', views.form_list, name='form_list'), # /form/5/ url(r'^form/(?P<field_id>[0-9]+)/$', views.form_detail, name='form_detail'), ]<|fim_prefix|># repo: antmont/wmda...
code_fim
hard
{ "lang": "python", "repo": "antmont/wmda-stuff", "path": "/wmdadict/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Returns: pyvsapm.partition: a APM partition. """ return self._vsapm_partition def GetParentFileEntry(self): """Retrieves the parent file entry. Returns: APMFileEntry: parent file entry or None if not available. """ entry_index = apm_helper.APMPathSpecGetEntryInd...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/dfvfs", "path": "/dfvfs/vfs/apm_file_entry.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Retrieves the directory. Returns: APMDirectory: a directory. """ if self.entry_type != definitions.FILE_ENTRY_TYPE_DIRECTORY: return None return apm_directory.APMDirectory(self._file_system, self.path_spec) def _GetSubFileEntries(self): """Retrieves sub file ent...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/dfvfs", "path": "/dfvfs/vfs/apm_file_entry.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: log2timeline/dfvfs path: /dfvfs/vfs/apm_file_entry.py # -*- coding: utf-8 -*- """The Apple Partition Map (APM) file entry implementation.""" from dfvfs.lib import definitions from dfvfs.lib import errors from dfvfs.lib import apm_helper from dfvfs.vfs import file_entry from dfvfs.vfs import apm_...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/dfvfs", "path": "/dfvfs/vfs/apm_file_entry.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PyWaves/PyWaves path: /protobuf/waves/node/grpc/accounts_api_pb2.py _insertion_point(imports) _sym_db = _symbol_database.Default() from waves import amount_pb2 as waves_dot_amount__pb2 from waves import transaction_pb2 as waves_dot_transaction__pb2 from waves import recipient_pb2 as waves_dot_...
code_fim
hard
{ "lang": "python", "repo": "PyWaves/PyWaves", "path": "/protobuf/waves/node/grpc/accounts_api_pb2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_SCRIPTDATA = _descriptor.Descriptor( name='ScriptData', full_name='waves.node.grpc.ScriptData', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='script_bytes', full_name='waves.node.grpc....
code_fim
hard
{ "lang": "python", "repo": "PyWaves/PyWaves", "path": "/protobuf/waves/node/grpc/accounts_api_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _LEASERESPONSE = _descriptor.Descriptor( name='LeaseResponse', full_name='waves.node.grpc.LeaseResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='leaseId', full_name='waves.node....
code_fim
hard
{ "lang": "python", "repo": "PyWaves/PyWaves", "path": "/protobuf/waves/node/grpc/accounts_api_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> error = 0 if loss in available_losses.keys(): error = available_losses[loss](y, yhat) deviation_from_mean = available_losses[loss](y, [np.mean(y)] * y.shape[0]) r2 = (deviation_from_mean - error) / deviation_from_mean else: message ...
code_fim
hard
{ "lang": "python", "repo": "shreeviknesh/ScratchML", "path": "/scratchml/regression/SimpleLinearRegression.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shreeviknesh/ScratchML path: /scratchml/regression/SimpleLinearRegression.py import numpy as np from ..utils import mean_squared_error, mean_absolute_error, root_mean_squared_error from ..utils import InvalidValueException, ModelNotTrainedException class SimpleLinearRegression: """Simple Li...
code_fim
hard
{ "lang": "python", "repo": "shreeviknesh/ScratchML", "path": "/scratchml/regression/SimpleLinearRegression.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: yhat (array): Predicted output values of shape (k,) """ if(self.__trained == False): raise ModelNotTrainedException(self.predict.__name__) x = np.array(x, 'float64') return (self.coef_[1] * x) + self.coef_[0] def evalua...
code_fim
hard
{ "lang": "python", "repo": "shreeviknesh/ScratchML", "path": "/scratchml/regression/SimpleLinearRegression.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@router.get("", name="Health check", response_model=str) async def runGetHealthCheck(): return healthcheck.getHealthCheck()<|fim_prefix|># repo: rbipin/cidr-ip-calculator path: /api/src/routes/healthcheck.py from fastapi import APIRouter from src.controllers import healthcheck <|fim_middle|>router =...
code_fim
medium
{ "lang": "python", "repo": "rbipin/cidr-ip-calculator", "path": "/api/src/routes/healthcheck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @router.get("", name="Health check", response_model=str) async def runGetHealthCheck(): return healthcheck.getHealthCheck()<|fim_prefix|># repo: rbipin/cidr-ip-calculator path: /api/src/routes/healthcheck.py from fastapi import APIRouter from src.controllers import healthcheck <|fim_middle|>router ...
code_fim
medium
{ "lang": "python", "repo": "rbipin/cidr-ip-calculator", "path": "/api/src/routes/healthcheck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rbipin/cidr-ip-calculator path: /api/src/routes/healthcheck.py from fastapi import APIRouter from src.controllers import healthcheck <|fim_suffix|>@router.get("", name="Health check", response_model=str) async def runGetHealthCheck(): return healthcheck.getHealthCheck()<|fim_middle|>router =...
code_fim
medium
{ "lang": "python", "repo": "rbipin/cidr-ip-calculator", "path": "/api/src/routes/healthcheck.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.values.append(value) self.sum += value self.count += 1 def __init__(self): self.reward_terms = dict() # {str: RewardTerm} def init(self, reward_term_names): for item in reward_term_names: self.reward_terms[item] = self.RewardT...
code_fim
hard
{ "lang": "python", "repo": "alexpostnikov/raisimpy", "path": "/examples/raisimpy_gym/envs/reward_logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexpostnikov/raisimpy path: /examples/raisimpy_gym/envs/reward_logger.py #!/usr/bin/env python """Reward Logger This is the Python version of the reward logger class as described in [1]. References: - [1] https://github.com/leggedrobotics/raisimGym/blob/master/raisim_gym/env/RewardLogger.h...
code_fim
hard
{ "lang": "python", "repo": "alexpostnikov/raisimpy", "path": "/examples/raisimpy_gym/envs/reward_logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.reward_terms def clean(self): for item in self.reward_terms.values(): item.clean() # global reward logger raisim.gui.reward_logger = RewardLogger()<|fim_prefix|># repo: alexpostnikov/raisimpy path: /examples/raisimpy_gym/envs/reward_logger.py #!/usr/bin/env ...
code_fim
hard
{ "lang": "python", "repo": "alexpostnikov/raisimpy", "path": "/examples/raisimpy_gym/envs/reward_logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl: info = ydl.extract_info(url, download=False) url2 = info['formats'][0]['url'] source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS) vc.play(source) except:...
code_fim
hard
{ "lang": "python", "repo": "Menorzinxz/MusicBot", "path": "/cogs/music.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Menorzinxz/MusicBot path: /cogs/music.py import discord import random import json import os import asyncio import youtube_dl from discord.ext import commands from discord.ext.commands import has_permissions from discord.utils import get from discord import FFmpegPCMAudio from async_timeout import...
code_fim
hard
{ "lang": "python", "repo": "Menorzinxz/MusicBot", "path": "/cogs/music.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oporadokrl/skull-painel path: /data/cep.py import requests,time from data import ui def consultar(lang): cep_input = ui.input_dialog() if len(cep_input) != 8: msg = lang[61] else: request = requests.get('https://viacep.com.br/ws/{}/json/'.format(ce<|fim_suffix|>'' ...
code_fim
hard
{ "lang": "python", "repo": "oporadokrl/skull-painel", "path": "/data/cep.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ta['bairro']} {lang[68]}: {adress_data["localidade"]} {lang[69]}: {adress_data['uf']} IBGE: {adress_data['ibge']} GIA: {adress_data['gia']} SIAFI: {adress_data['siafi']} DDD: {adress_data['ddd']} ''' except: msg = lang[12] choice = ui.dialog_choi...
code_fim
hard
{ "lang": "python", "repo": "oporadokrl/skull-painel", "path": "/data/cep.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tjlee/poptimizer path: /poptimizer/evolve/chromosomes/__init__.py """Хромосомы и гены для мутации параметров модели, данных и политики обучения.""" from poptimizer<|fim_suffix|>romosomes.optimizer import Optimizer from poptimizer.evolve.chromosomes.scheduler import Scheduler<|fim_middle|>.evolve....
code_fim
medium
{ "lang": "python", "repo": "tjlee/poptimizer", "path": "/poptimizer/evolve/chromosomes/__init__.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>s.data import Data from poptimizer.evolve.chromosomes.model import Model from poptimizer.evolve.chromosomes.optimizer import Optimizer from poptimizer.evolve.chromosomes.scheduler import Scheduler<|fim_prefix|># repo: tjlee/poptimizer path: /poptimizer/evolve/chromosomes/__init__.py """Хромосомы и гены д...
code_fim
medium
{ "lang": "python", "repo": "tjlee/poptimizer", "path": "/poptimizer/evolve/chromosomes/__init__.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: ihaaae/universal_adversarial_perturbation_generative_network_for_speaker_recognition path: /train_generator.py all[k]['factor_grow'] def __call__(self, pred, labels): loss_dict_grad = {} loss_dict = {} pred_dict = {} label_dict = {} for key, loss in se...
code_fim
hard
{ "lang": "python", "repo": "ihaaae/universal_adversarial_perturbation_generative_network_for_speaker_recognition", "path": "/train_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> eval_rtn:dict, test_rtn:dict, logger:logging.Logger, writer:SummaryWriter): # save model acc = eval_rtn.get('err_spk', 0)-eval_rtn.get('err_sph', 1) is_best = acc > self.best_accu self.best_accu = acc if is_best else self.best_accu model_filename = "epoch_{}...
code_fim
hard
{ "lang": "python", "repo": "ihaaae/universal_adversarial_perturbation_generative_network_for_speaker_recognition", "path": "/train_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = model.cuda() if args.eval: assert args.pt_file != 'none', "no pretrained model is provided!" print('only eval the model') evaluate(model, test_dataset, cost, args.target, args.noise_scale) return if args.test: assert args.pt_file != 'none', "no p...
code_fim
hard
{ "lang": "python", "repo": "ihaaae/universal_adversarial_perturbation_generative_network_for_speaker_recognition", "path": "/train_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UKTV/django-cas-consumer path: /cas_consumer/backends.py # -*- coding: utf-8 -*- """cas_consumer.backends -- authentication backend for CAS v1.0 """ import logging logger = logging.getLogger('cas.consumer') import urllib2 import urllib import gzip try: from xml.etree import ElementTree exce...
code_fim
hard
{ "lang": "python", "repo": "UKTV/django-cas-consumer", "path": "/cas_consumer/backends.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if users: changed = False if (self.set_email and 'email' in valid.attributes and valid.attributes['email'] != user.email ): user.email = valid.attributes['email'] changed = True if ...
code_fim
hard
{ "lang": "python", "repo": "UKTV/django-cas-consumer", "path": "/cas_consumer/backends.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ai-ku/uwsd path: /run/fetch-aw-tw.py #! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "Osman Baskaya" """ Fetching target words and their ids for all-words task """ from uwsd_utils import get_dataset_path import sys from bs4 import BeautifulSoup import re if len(sys.argv) != 2: msg...
code_fim
medium
{ "lang": "python", "repo": "ai-ku/uwsd", "path": "/run/fetch-aw-tw.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dataset = sys.argv[1] dataset_path = get_dataset_path(dataset) if dataset == "s07aw": line_add = 2 else: line_add = 1 soup = BeautifulSoup(open(dataset_path), 'xml') regex = re.compile('(\w+)\.s(\d+)\.t(\d+)') if dataset == 's10aw': sentences = soup.find_all('s') c = 0 for sentence i...
code_fim
medium
{ "lang": "python", "repo": "ai-ku/uwsd", "path": "/run/fetch-aw-tw.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdecleir/spex_nir_extinction path: /calc_fit_plot_ext.py # This script is intended to automate the calculation, fitting and plotting of the extinction curves of all stars in the sample. import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocato...
code_fim
hard
{ "lang": "python", "repo": "mdecleir/spex_nir_extinction", "path": "/calc_fit_plot_ext.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Fit and plot the extinction features separately Parameters ---------- starpair : string Name of the star pair for which to fit the extinction features, in the format "reddenedstarname_comparisonstarname" (no spaces) path : string Path to the data files Re...
code_fim
hard
{ "lang": "python", "repo": "mdecleir/spex_nir_extinction", "path": "/calc_fit_plot_ext.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>bind_layers(Ether, CPUMetadata1, type=TYPE_CPU_METADATA) bind_layers(CPUMetadata1, IP, origEtherType=0x0800) bind_layers(CPUMetadata1, ARP, origEtherType=0x0806)<|fim_prefix|># repo: fno2010/pwospf-p4 path: /cpu_metadata.py from scapy.fields import BitField, ByteField, ShortField from scapy.packet import...
code_fim
hard
{ "lang": "python", "repo": "fno2010/pwospf-p4", "path": "/cpu_metadata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fno2010/pwospf-p4 path: /cpu_metadata.py from scapy.fields import BitField, ByteField, ShortField from scapy.packet import Packet, bind_layers from scapy.layers.inet import IP from scapy.layers.l2 import Ether, ARP <|fim_suffix|>class CPUMetadata1(Packet): """ header cpu_metadata_t { ...
code_fim
medium
{ "lang": "python", "repo": "fno2010/pwospf-p4", "path": "/cpu_metadata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: modin-project/modin path: /stress_tests/kaggle/kaggle13.py #!/usr/bin/env python import matplotlib matplotlib.use("PS") import modin.pandas as pd import warnings # current version of seaborn generates a bunch of warnings that we'll ignore <|fim_suffix|>andrews_curves(iris.drop("Id", axis=1), "...
code_fim
hard
{ "lang": "python", "repo": "modin-project/modin", "path": "/stress_tests/kaggle/kaggle13.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>andrews_curves(iris.drop("Id", axis=1), "Species") from pandas.tools.plotting import parallel_coordinates parallel_coordinates(iris.drop("Id", axis=1), "Species") from pandas.tools.plotting import radviz radviz(iris.drop("Id", axis=1), "Species")<|fim_prefix|># repo: modin-project/modin path: /stress_t...
code_fim
hard
{ "lang": "python", "repo": "modin-project/modin", "path": "/stress_tests/kaggle/kaggle13.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WHU-SoftwareSecurity/final path: /src/callback/__init__.py from .dangsan import dangsan_callback heap_expo_callba<|fim_suffix|>rom .address_sanitizer import address_sanitizer_callback from .heap_detective import heap_detective_callback<|fim_middle|>ck = dangsan_callback from .ufo import ufo_call...
code_fim
easy
{ "lang": "python", "repo": "WHU-SoftwareSecurity/final", "path": "/src/callback/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ck from .heap_detective import heap_detective_callback<|fim_prefix|># repo: WHU-SoftwareSecurity/final path: /src/callback/__init__.py from .dangsan import dangsan_callback heap_expo_callba<|fim_middle|>ck = dangsan_callback from .ufo import ufo_callback from .address_sanitizer import address_sanitizer_...
code_fim
medium
{ "lang": "python", "repo": "WHU-SoftwareSecurity/final", "path": "/src/callback/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rom .address_sanitizer import address_sanitizer_callback from .heap_detective import heap_detective_callback<|fim_prefix|># repo: WHU-SoftwareSecurity/final path: /src/callback/__init__.py from .dangsan import dangsan_callback heap_expo_callba<|fim_middle|>ck = dangsan_callback from .ufo import ufo_call...
code_fim
easy
{ "lang": "python", "repo": "WHU-SoftwareSecurity/final", "path": "/src/callback/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.options = self.load_options(True) def setup_view(self): self.options_window = tk.Toplevel(self.root, width=560, height=200) self.frame = tk.Frame(self.options_window) self.options_label = tk.Label(self.frame, text="Options", ...
code_fim
hard
{ "lang": "python", "repo": "jailukanna/PicCollector", "path": "/gui/options_view.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_viewer(self): self.options['viewer'] = self.options['viewer_alts'][self.viewer_selector.current()] self.options['viewerOptions']['width'] = self.options['viewerOptions']['alt_widths'][self.image_viewer_width.current()] self.options['viewerOptions']['height'] = self.opti...
code_fim
hard
{ "lang": "python", "repo": "jailukanna/PicCollector", "path": "/gui/options_view.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jailukanna/PicCollector path: /gui/options_view.py import os import json import traceback import _tkinter import tkinter as tk import tkinter.ttk as ttk from tkinter import filedialog class OptionsView: options_file = 'options.json' default_options_file = 'default_options.json' opt...
code_fim
hard
{ "lang": "python", "repo": "jailukanna/PicCollector", "path": "/gui/options_view.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ComponentGroup(object): """A grouping of components with dependencies that can be executed.""" def __init__(self): self.components = [] def add_component(self, component): self.components.append(component) def execute(self, action, subcomponents=None): remaining = subcomponent...
code_fim
hard
{ "lang": "python", "repo": "HubSpot/vitess", "path": "/test/cluster/sandbox/sandlet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HubSpot/vitess path: /test/cluster/sandbox/sandlet.py # Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
code_fim
hard
{ "lang": "python", "repo": "HubSpot/vitess", "path": "/test/cluster/sandbox/sandlet.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def is_up(self): """Whether the component has finished being started.""" return True def is_down(self): """Whether the component has finished being stopped.""" return True class SandletComponent(object): """Entity of a sandlet that encapsulates a process or job.""" def __init__...
code_fim
hard
{ "lang": "python", "repo": "HubSpot/vitess", "path": "/test/cluster/sandbox/sandlet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cycle13/ekman path: /ekman/conf.py import os def createFolders(directory): try: if not os.path.exists(directory): os.makedirs(directory) <|fim_suffix|>: print ('Error: Creating project folder: ' + directory)<|fim_middle|> os.makedirs(directory+'/') ...
code_fim
medium
{ "lang": "python", "repo": "cycle13/ekman", "path": "/ekman/conf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>: print ('Error: Creating project folder: ' + directory)<|fim_prefix|># repo: cycle13/ekman path: /ekman/conf.py import os def createFolders(directory): try: if not os.path.exists(directory): os.makedirs(directory) <|fim_middle|> os.makedirs(directory+'/') ...
code_fim
medium
{ "lang": "python", "repo": "cycle13/ekman", "path": "/ekman/conf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.makedirs(directory+'/') except OSError: print ('Error: Creating project folder: ' + directory)<|fim_prefix|># repo: cycle13/ekman path: /ekman/conf.py import os def createFolders(directory): try: if no<|fim_middle|>t os.path.exists(directory): os...
code_fim
medium
{ "lang": "python", "repo": "cycle13/ekman", "path": "/ekman/conf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertRaises(ValueError, Bytes.decode, b'') def test_decode_underflow(self): self.assertRaises(ValueError, Bytes.decode, b'\x00\x04\x874\x9d') def test_encode(self): val = Bytes(b'\x87\x34\x9d\xbc') print(repr(val.encode())) assert val.encode() == b'\...
code_fim
hard
{ "lang": "python", "repo": "AppDirectory/kafka-tools", "path": "/tests/tools/protocol/types/test_bytes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_encode(self): val = Bytes(b'\x87\x34\x9d\xbc') print(repr(val.encode())) assert val.encode() == b'\x00\x04\x87\x34\x9d\xbc' def test_encode_null(self): val = Bytes(None) assert val.encode() == b'\xff\xff' def test_str(self): val = Byte...
code_fim
hard
{ "lang": "python", "repo": "AppDirectory/kafka-tools", "path": "/tests/tools/protocol/types/test_bytes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AppDirectory/kafka-tools path: /tests/tools/protocol/types/test_bytes.py import unittest from kafka.tools.protocol.types.bytes import Bytes class BytesTests(unittest.TestCase): def test_from_string(self): val = Bytes.from_string("87349DBC") assert val.value() == b'\x87\x34\...
code_fim
hard
{ "lang": "python", "repo": "AppDirectory/kafka-tools", "path": "/tests/tools/protocol/types/test_bytes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def set_modifier_data(self, rating, tags): self._rating = rating self._tags = list(tags) def into_c(self): return (self.id, self.distance, self.modifier, self.poison, self.to)<|fim_prefix|># repo: oSoc17/lopeningent_backend path: /server/server/model/edge.py class Edge: ...
code_fim
hard
{ "lang": "python", "repo": "oSoc17/lopeningent_backend", "path": "/server/server/model/edge.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oSoc17/lopeningent_backend path: /server/server/model/edge.py class Edge: def __init__(self, id, distance, modifier, poison, to): # Data used in Rust struct self.id = int(id) self.distance = float(distance) self.modifier = float(modifier) self.poison =...
code_fim
hard
{ "lang": "python", "repo": "oSoc17/lopeningent_backend", "path": "/server/server/model/edge.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('AlphaChats', '0006_auto_20210430_1248'), ] operations = [ migrations.AlterField( model_name='chat', name='person', field=models.CharField(max_length=30), ), ]<|fim_prefi...
code_fim
easy
{ "lang": "python", "repo": "chinmoykalita/alphachats", "path": "/AlphaChats/migrations/0007_alter_chat_person.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }