text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: by46/muggle path: /gallery/admin.py from django.contrib import admin from .models import Photo, Item <|fim_suffix|> admin.site.register(Item, ItemAdmin) admin.site.register(Photo)<|fim_middle|># Register your models here. class PhotoInline(admin.StackedInline): model = Photo class ItemA...
code_fim
medium
{ "lang": "python", "repo": "by46/muggle", "path": "/gallery/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: by46/muggle path: /gallery/admin.py from django.contrib import admin <|fim_suffix|># Register your models here. class PhotoInline(admin.StackedInline): model = Photo class ItemAdmin(admin.ModelAdmin): inlines = [PhotoInline] admin.site.register(Item, ItemAdmin) admin.site.register(P...
code_fim
easy
{ "lang": "python", "repo": "by46/muggle", "path": "/gallery/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: enthought/pyql path: /test/test_variance_swap.py import datetime import unittest import numpy as np from quantlib.settings import Settings from quantlib.instruments.option import EuropeanExercise, OptionType from quantlib.instruments.variance_swap import VarianceSwap, SwapType from quantlib.mat...
code_fim
hard
{ "lang": "python", "repo": "enthought/pyql", "path": "/test/test_variance_swap.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> engine = MCVarianceSwapEngine(stoch_process, time_steps_per_year=250, required_samples=1023, seed=42, ) variance_swap = VarianceSwap(sel...
code_fim
hard
{ "lang": "python", "repo": "enthought/pyql", "path": "/test/test_variance_swap.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @event.listens_for(Engine, 'connect') def set_sqlite_pragma(dbapi_connection, connection_record): cursor = dbapi_connection.cursor() cursor.execute('PRAGMA foreign_keys=ON') cursor.close() _engine = None _Session = None _session_store = threading.local()<|fim_prefix|># repo: AnnaKudriasheva...
code_fim
hard
{ "lang": "python", "repo": "AnnaKudriasheva/vgs-satellite", "path": "/satellite/db/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AnnaKudriasheva/vgs-satellite path: /satellite/db/__init__.py import threading from sqlalchemy import create_engine from sqlalchemy import event from sqlalchemy.engine import Engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from sqlalchemy.or...
code_fim
medium
{ "lang": "python", "repo": "AnnaKudriasheva/vgs-satellite", "path": "/satellite/db/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: project-koku/koku path: /koku/masu/api/status.py # # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """View for server status.""" import logging import platform import sys from django.conf import settings from django.db import connection from django.db import InterfaceError ...
code_fim
hard
{ "lang": "python", "repo": "project-koku/koku", "path": "/koku/masu/api/status.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@never_cache @api_view(http_method_names=["GET"]) @permission_classes((AllowAny,)) @renderer_classes(tuple(api_settings.DEFAULT_RENDERER_CLASSES)) def get_status(request): """Packages response for class-based view.""" if "liveness" in request.query_params: return Response({"alive": True}) ...
code_fim
hard
{ "lang": "python", "repo": "project-koku/koku", "path": "/koku/masu/api/status.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Collect the installed modules. :returns: A dictonary of module names and versions. """ return self._modules @modules.setter def modules(self, value): module_data = { str(name): str(module.__version__) for name, module in sorted(s...
code_fim
hard
{ "lang": "python", "repo": "project-koku/koku", "path": "/koku/masu/api/status.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MrDenexi/smb-flowers path: /app.py import sys from time import sleep from datetime import datetime, timedelta from random import randint, choice import asyncio import concurrent.futures import RPi.GPIO as GPIO import pyfirmata from sqlalchemy import func, text from sqlalchemy.orm import joine...
code_fim
hard
{ "lang": "python", "repo": "MrDenexi/smb-flowers", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # make currentState the loginstate using this user self.currentState = LoginState(self, user) # user register flow (existing user) def userRegister(self, card): # find the least popular flower # using least amount of accesses of the last 30 days leastPopula...
code_fim
hard
{ "lang": "python", "repo": "MrDenexi/smb-flowers", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yvonmu/2O8JbAWhoGk6CZk0 path: /view_web_app.py import pandas from flask import Flask, render_template <|fim_suffix|>if __name__ == "__main__": app.run()<|fim_middle|>app = Flask(__name__) @app.route("/", methods=['GET']) def index(): filename = 'request for startup.csv' data = pand...
code_fim
hard
{ "lang": "python", "repo": "Yvonmu/2O8JbAWhoGk6CZk0", "path": "/view_web_app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": app.run()<|fim_prefix|># repo: Yvonmu/2O8JbAWhoGk6CZk0 path: /view_web_app.py import pandas from flask import Flask, render_template <|fim_middle|>app = Flask(__name__) @app.route("/", methods=['GET']) def index(): filename = 'request for startup.csv' data = pan...
code_fim
hard
{ "lang": "python", "repo": "Yvonmu/2O8JbAWhoGk6CZk0", "path": "/view_web_app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yenchenlin/self-attention-gan path: /non_local.py # Copyright 2018 Google LLC # # 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 # # https://www.apache.org/licenses/LICE...
code_fim
hard
{ "lang": "python", "repo": "yenchenlin/self-attention-gan", "path": "/non_local.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # g path g = sn_conv1x1(x, num_channels // 2, update_collection, init, 'sn_conv_g') g = tf.layers.max_pooling2d(inputs=g, pool_size=[2, 2], strides=2) g = tf.reshape( g, [batch_size, downsampled_num, num_channels // 2]) attn_g = tf.matmul(attn, g) attn_g = tf.reshape(attn_g,...
code_fim
hard
{ "lang": "python", "repo": "yenchenlin/self-attention-gan", "path": "/non_local.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> series_data = pd.concat(series_list, axis = 1) return series_data def main(argv): countries = util.get_countries(argv) if len(countries) == 0: return db_connection = util.login() queries = get_queries(countries) series = get_series_from_queries(db_connection, queries, 1930, 2018) util.plot_t...
code_fim
hard
{ "lang": "python", "repo": "kzl/world-cup-analysis", "path": "/scripts/country_record.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kzl/world-cup-analysis path: /scripts/country_record.py from __future__ import print_function import datetime import sys import numpy as np import pandas as pd import mysql.connector import matplotlib.pyplot as plt import util def get_queries(countries): queries = [] for country in countries:...
code_fim
hard
{ "lang": "python", "repo": "kzl/world-cup-analysis", "path": "/scripts/country_record.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cursor = db_connection.cursor() series_list = [] for country, query in queries: cursor.execute(query) series = get_country_series(cursor, country, range_min, range_max) series_list.append(series) cursor.close() series_data = pd.concat(series_list, axis = 1) return series_data def main(arg...
code_fim
hard
{ "lang": "python", "repo": "kzl/world-cup-analysis", "path": "/scripts/country_record.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Paths # GT process.pGTPass = cms.Path( process.genericTriggerEventFlagGTPass ) process.pGTFail = cms.Path( process.genericTriggerEventFlagGTFail ) process.pGTTest = cms.Path( process.genericTriggerEventFlagGTTest ) process.pGTTestFail = cms.Path( process.genericTriggerEventFlagGTTestFail ) # L1 ...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CommonTools/TriggerUtils/test/genericTriggerEventFlagTest_cfg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /CommonTools/TriggerUtils/test/genericTriggerEventFlagTest_cfg.py import FWCore.ParameterSet.Config as cms process = cms.Process( "TEST" ) ## Logging process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.cerr.threshold = 'INFO' process.MessageLogger.ce...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CommonTools/TriggerUtils/test/genericTriggerEventFlagTest_cfg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheImaginaryOne/image_text_claim_detection path: /vilbert_code/extract_features.py from pytorch_transformers.tokenization_bert import BertTokenizer from vilbert.datasets._image_features_reader import ImageFeaturesH5Reader from helper_functions import * import argparse parser = argparse.Argument...
code_fim
hard
{ "lang": "python", "repo": "TheImaginaryOne/image_text_claim_detection", "path": "/vilbert_code/extract_features.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>##ImgNet Model for images where no objects detected img_model = models.resnet152(pretrained=True) img_model = nn.Sequential(*list(img_model.children())[:-1]) img_model.eval() img_model.to(device) ##-------------------------------------------------- ## Training, Validation and Test Text data_dict = json.l...
code_fim
hard
{ "lang": "python", "repo": "TheImaginaryOne/image_text_claim_detection", "path": "/vilbert_code/extract_features.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'ar' in dset: text = process_tweet(data_dict[txt_id]['text_en']) else: text = process_tweet(data_dict[txt_id]['full_text']) ## First get text tokens, ids and mask for bert tokens, segment_ids, input_mask = tokenize(text) ## Get image features and boxes try:...
code_fim
hard
{ "lang": "python", "repo": "TheImaginaryOne/image_text_claim_detection", "path": "/vilbert_code/extract_features.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZhangYaxu/gerrit_backup_tool path: /gerrit_backup_tool/tar/Tar.py """SSH Module.""" import os import shell class Tar(object): """Tar Class.""" def __init__(self, dry_run=False, verbose=False): """Init.""" super(Tar, self).__init__() self.dry_run = dry_run ...
code_fim
medium
{ "lang": "python", "repo": "ZhangYaxu/gerrit_backup_tool", "path": "/gerrit_backup_tool/tar/Tar.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def extract(self, file_path): """Extract TAR file.""" path = os.path.dirname(file_path) if path == '': path = '.' extra_tar_options = "" if self.verbose: extra_tar_options += "v" cmd = "tar -%sxzf %s" % (extra_tar_options, file...
code_fim
hard
{ "lang": "python", "repo": "ZhangYaxu/gerrit_backup_tool", "path": "/gerrit_backup_tool/tar/Tar.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: blackberry/UBCIS path: /Vagrant/plugins/clair.py ################################################################################ # Name : Clair - Clair plugin # Author : Alexander Parent # # Copyright 2020 BlackBerry Limited # # Licensed under the Apache License, Version 2.0 (the "License"); #...
code_fim
hard
{ "lang": "python", "repo": "blackberry/UBCIS", "path": "/Vagrant/plugins/clair.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> os.system("touch clair-whitelist.yml") subprocess.run("docker run -d -p 5432:5432 --name db arminc/clair-db:latest", shell=True) os.system("sleep 15") subprocess.run("docker run -d -p 6060:6060 --link db:postgres --name clair arminc/clair-local-scan:v2.0.1", shell=True) os.system("slee...
code_fim
hard
{ "lang": "python", "repo": "blackberry/UBCIS", "path": "/Vagrant/plugins/clair.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcpython4-coding/core path: /mcpython/common/entity/EntityManager.py """ mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/M...
code_fim
hard
{ "lang": "python", "repo": "mcpython4-coding/core", "path": "/mcpython/common/entity/EntityManager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if uuid is not None: entity.uuid = uuid self.entity_map[entity.uuid] = entity entity.teleport(entity.position, force_chunk_save_update=True) return entity async def tick(self, dt: float): # todo: move to dimensions # todo: move most of thi...
code_fim
hard
{ "lang": "python", "repo": "mcpython4-coding/core", "path": "/mcpython/common/entity/EntityManager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _plan_route(self, current_grid_pos): basic_plan = self.path_planner.calculate_path( current_grid_pos, tuple(self.dest_coords) ) rospy.logdebug( '{} created new path plan from {} to {}: {}'.format( self.swarmie_name, current_grid_pos, ...
code_fim
hard
{ "lang": "python", "repo": "rjnieves/SwarmiesRL", "path": "/src/rl_behavior/src/action/moveto.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rjnieves/SwarmiesRL path: /src/rl_behavior/src/action/moveto.py """Definition of the MoveToCellAction class. """ import math import numpy as np import rospy from utility import PathPlanning from action import TurnAction, DriveAction from swarmie_msgs.msg import Skid from utility import YawBearin...
code_fim
hard
{ "lang": "python", "repo": "rjnieves/SwarmiesRL", "path": "/src/rl_behavior/src/action/moveto.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Convert to json, removing zeros, and not segregated_nonzero = df_to_json(segregated) integrated_nonzero = df_to_json(integrated) seg_output = os.path.abspath(os.path.join(pwd,"../data/segregated_state.json")) write_json(segregated_nonzero,seg_output) int_output = os.path.abspath(os.path.join(pwd,"../dat...
code_fim
medium
{ "lang": "python", "repo": "vsoch/network-integration-vis", "path": "/prep/prep_transitional.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vsoch/network-integration-vis path: /prep/prep_transitional.py # prep_transitional.py will read in Matlab exported integrated and segreated state data matrices and parse into JSON objects for visualizations import igraph as ig import os import json import pandas import sys from utils import pwd...
code_fim
hard
{ "lang": "python", "repo": "vsoch/network-integration-vis", "path": "/prep/prep_transitional.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CICATA/TensorflowCertificationStudy path: /_21_CatsDogsAugmentation.py import os import zipfile import tensorflow as tf from tensorflow.keras.optimizers import RMSprop from tensorflow.keras.preprocessing.image import ImageDataGenerator from matplotlib import pyplot as plt import wget os.environ[...
code_fim
hard
{ "lang": "python", "repo": "CICATA/TensorflowCertificationStudy", "path": "/_21_CatsDogsAugmentation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Image augmentation and data generator train_datagen = ImageDataGenerator( rescale=1. / 255, rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2, horizontal_flip=True, fill_mode='nearest') # Normalize test dataset test_datagen...
code_fim
hard
{ "lang": "python", "repo": "CICATA/TensorflowCertificationStudy", "path": "/_21_CatsDogsAugmentation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Normalize test dataset test_datagen = ImageDataGenerator(rescale=1. / 255) # Flow training images in batches of 20 using train_datagen generator train_generator = train_datagen.flow_from_directory( train_dir, # This is the source directory for training images target_size=(150, 150), # All ima...
code_fim
hard
{ "lang": "python", "repo": "CICATA/TensorflowCertificationStudy", "path": "/_21_CatsDogsAugmentation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>) print(binascii.hexlify(lora.mac()).upper().decode('utf-8'))<|fim_prefix|># repo: bhargavbhat/lopy path: /src/ttn/lopy-dev-eui/main.py # Required to add device to TTN # Taken from: https://www.thethingsnetwork.org/forum/t/lopy-otaa-example/4471/6 from netw<|fim_middle|>ork import LoRa import binascii l...
code_fim
medium
{ "lang": "python", "repo": "bhargavbhat/lopy", "path": "/src/ttn/lopy-dev-eui/main.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhargavbhat/lopy path: /src/ttn/lopy-dev-eui/main.py # Required to add device to TTN # Taken from: https://www.the<|fim_suffix|>ork import LoRa import binascii lora = LoRa(mode=LoRa.LORAWAN) print(binascii.hexlify(lora.mac()).upper().decode('utf-8'))<|fim_middle|>thingsnetwork.org/forum/t/lopy-ot...
code_fim
medium
{ "lang": "python", "repo": "bhargavbhat/lopy", "path": "/src/ttn/lopy-dev-eui/main.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hykeegj/calculator path: /python/UI.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'untitled.ui' # # Created by: PyQt5 UI code generator 5.13.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog...
code_fim
hard
{ "lang": "python", "repo": "hykeegj/calculator", "path": "/python/UI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZichaoDi/Di_MATLABTool path: /numerical-tours/python/nt_toolbox/plot_vf.py import numpy as np import matplotlib.pyplot as plt from numpy import random <|fim_suffix|> """ velocities is supposed to be of shape nxnx2 """ n = np.shape(velocities)[0] u = velocities[:,:,0] v...
code_fim
easy
{ "lang": "python", "repo": "ZichaoDi/Di_MATLABTool", "path": "/numerical-tours/python/nt_toolbox/plot_vf.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ velocities is supposed to be of shape nxnx2 """ n = np.shape(velocities)[0] u = velocities[:,:,0] v = velocities[:,:,1] x,y = np.meshgrid(np.arange(n), np.arange(n)) plt.quiver(x,y,u,v,color="b") plt.xlim(0,n) plt.ylim(0,n) plt.axis("off") plt.show()...
code_fim
easy
{ "lang": "python", "repo": "ZichaoDi/Di_MATLABTool", "path": "/numerical-tours/python/nt_toolbox/plot_vf.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return def build(self, input_shape): self._head = dict() for key in self._key_list: scale = 2**int(key) self._head[key] = nn_blocks.ConvBN( bias_initializer=self.bias_init(scale, input_shape[key][-1]), **self._conv_config) def call(self, inputs): outp...
code_fim
hard
{ "lang": "python", "repo": "ananya-singhh/TensorFlowModels", "path": "/yolo/modeling/heads/yolo_head.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ananya-singhh/TensorFlowModels path: /yolo/modeling/heads/yolo_head.py import tensorflow as tf import math from yolo.modeling.layers import nn_blocks class YoloHead(tf.keras.layers.Layer): """YOLO Prediction Head""" def __init__(self, min_level, max_level, ...
code_fim
hard
{ "lang": "python", "repo": "ananya-singhh/TensorFlowModels", "path": "/yolo/modeling/heads/yolo_head.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shen3443/paramak path: /examples/example_parametric_reactors/make_all_parametric_reactors_images_for_docs.py """ This python script demonstrates the creation of all parametric shapes available in the paramak tool """ from make_all_parametric_reactors import main from cadquery import exporters ...
code_fim
medium
{ "lang": "python", "repo": "shen3443/paramak", "path": "/examples/example_parametric_reactors/make_all_parametric_reactors_images_for_docs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> all_reactors = main() for reactor in all_reactors: with open(reactor.name + ".svg", "w") as f: exporters.exportShape(reactor.solid, "SVG", f) reactor.export_stp(output_folder=reactor.name) if __name__ == "__main__": export_images()<|fim_prefix|># repo: shen3443...
code_fim
easy
{ "lang": "python", "repo": "shen3443/paramak", "path": "/examples/example_parametric_reactors/make_all_parametric_reactors_images_for_docs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Read / Write SPI bit justification SPI_IOC_RD_LSB_FIRST = _IOR(SPI_IOC_MAGIC, 2, c_uint8) SPI_IOC_WR_LSB_FIRST = _IOW(SPI_IOC_MAGIC, 2, c_uint8) # Read / Write SPI device word length (1..N) SPI_IOC_RD_BITS_PER_WORD = _IOR(SPI_IOC_MAGIC, 3, c_uint8) SPI_IOC_WR_BITS_PER_WORD = _IOW(SPI_IOC_MAGIC, 3, c_...
code_fim
hard
{ "lang": "python", "repo": "PotatoSpudowski/malnou", "path": "/L.I.S.A/quick2wire/spi_ctypes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PotatoSpudowski/malnou path: /L.I.S.A/quick2wire/spi_ctypes.py # Warning: not part of the published Quick2Wire API. # # User space versions of kernel symbols for SPI clocking modes, # matching <linux/spi/spi.h> # # Ported to Python ctypes from <linux/spi/spidev.h> from ctypes import * from quic...
code_fim
hard
{ "lang": "python", "repo": "PotatoSpudowski/malnou", "path": "/L.I.S.A/quick2wire/spi_ctypes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("%d eh o maior" %MAIOR)<|fim_prefix|># repo: antuniooh/uri-resolutions path: /1. Beginner/URI1013.py a,b,c = input().split(" ") A = int(a) B = int(b) C = int(c) <|fim_middle|>MAIORAB = (A + B + abs(A-B))/2 MAIOR = (MAIORAB + C + abs(MAIORAB - C))/2
code_fim
medium
{ "lang": "python", "repo": "antuniooh/uri-resolutions", "path": "/1. Beginner/URI1013.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antuniooh/uri-resolutions path: /1. Beginner/URI1013.py a,b,c = input().split(" ") <|fim_suffix|>print("%d eh o maior" %MAIOR)<|fim_middle|>A = int(a) B = int(b) C = int(c) MAIORAB = (A + B + abs(A-B))/2 MAIOR = (MAIORAB + C + abs(MAIORAB - C))/2
code_fim
medium
{ "lang": "python", "repo": "antuniooh/uri-resolutions", "path": "/1. Beginner/URI1013.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagyist/sentry path: /src/sentry/models/dashboard_widget.py from django.contrib.postgres.fields import ArrayField as DjangoArrayField from django.db import models from django.utils import timezone from sentry.db.models import ( ArrayField, BoundedPositiveIntegerField, FlexibleForeign...
code_fim
hard
{ "lang": "python", "repo": "nagyist/sentry", "path": "/src/sentry/models/dashboard_widget.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@region_silo_only_model class DashboardWidgetQuery(Model): """ A query in a dashboard widget. """ __include_in_export__ = True widget = FlexibleForeignKey("sentry.DashboardWidget") name = models.CharField(max_length=255) fields = ArrayField() conditions = models.TextField...
code_fim
hard
{ "lang": "python", "repo": "nagyist/sentry", "path": "/src/sentry/models/dashboard_widget.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class DashboardWidgetDisplayTypes(TypesClass): LINE_CHART = 0 AREA_CHART = 1 STACKED_AREA_CHART = 2 BAR_CHART = 3 TABLE = 4 WORLD_MAP = 5 BIG_NUMBER = 6 TOP_N = 7 TYPES = [ (LINE_CHART, "line"), (AREA_CHART, "area"), (STACKED_AREA_CHART, "stacke...
code_fim
hard
{ "lang": "python", "repo": "nagyist/sentry", "path": "/src/sentry/models/dashboard_widget.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: elifesciences/update-iam-human path: /src/tests/test_utils.py from src.utils import ensure import pytest <|fim_suffix|> ensure(1 == 1, "working") with pytest.raises(AssertionError): ensure(1 == 2, "not working")<|fim_middle|>def test_ensure():
code_fim
easy
{ "lang": "python", "repo": "elifesciences/update-iam-human", "path": "/src/tests/test_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ensure(1 == 1, "working") with pytest.raises(AssertionError): ensure(1 == 2, "not working")<|fim_prefix|># repo: elifesciences/update-iam-human path: /src/tests/test_utils.py from src.utils import ensure import pytest <|fim_middle|>def test_ensure():
code_fim
easy
{ "lang": "python", "repo": "elifesciences/update-iam-human", "path": "/src/tests/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): self.server.reset()<|fim_prefix|># repo: timgates42/grab path: /tests/misc.py from pprint import pprint # pylint: disable=unused-import <|fim_middle|>from test_server import Response # pylint: disable=unused-import from tests.util import build_grab # pylint: disable=unus...
code_fim
hard
{ "lang": "python", "repo": "timgates42/grab", "path": "/tests/misc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timgates42/grab path: /tests/misc.py from pprint import pprint # pylint: disable=unused-import from test_server import Response # pylint: disable=unused-import <|fim_suffix|>class TestMisc(BaseGrabTestCase): def setUp(self): self.server.reset()<|fim_middle|>from tests.util import ...
code_fim
medium
{ "lang": "python", "repo": "timgates42/grab", "path": "/tests/misc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self_pointing = pd.DataFrame(columns=["NODEA", "NODEB", "EDGE_WEIGHT"]) self_pointing["NODEA"] = nodes_left self_pointing["NODEB"] = nodes_left self_pointing["EDGE_WEIGHT"] = 0 partial_df = pd.concat([dataframe, self_pointing]) self.le = LabelEncoder() ...
code_fim
hard
{ "lang": "python", "repo": "trevorWieland/maxcutpy", "path": "/maxcutpy/solvers/abstractmaxcut.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trevorWieland/maxcutpy path: /maxcutpy/solvers/abstractmaxcut.py import numpy as np import pandas as pd import networkx as nx from typing import Optional, List from abc import ABC, abstractmethod from sklearn.preprocessing import LabelEncoder class AbstractMaxCut(ABC): def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "trevorWieland/maxcutpy", "path": "/maxcutpy/solvers/abstractmaxcut.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return cut_vectors @abstractmethod def batch_split(self) -> np.array: """A function to split the batches. This function is an abstract method in the class AbstractMaxCut. Should rely on internal attributes, and take no input parameters. Should return a si...
code_fim
hard
{ "lang": "python", "repo": "trevorWieland/maxcutpy", "path": "/maxcutpy/solvers/abstractmaxcut.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UcarLab/CoRE-ATAC path: /tensorloader/PEASUtil.py import pandas as pd import numpy as np from sklearn import preprocessing from sklearn.metrics import accuracy_score, roc_curve, auc, precision_recall_curve,average_precision_score, confusion_matrix import matplotlib matplotlib.use('agg') import ma...
code_fim
hard
{ "lang": "python", "repo": "UcarLab/CoRE-ATAC", "path": "/tensorloader/PEASUtil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fig = plt.figure(figsize=(10, 10)) plt.imshow(ncm, interpolation='nearest', cmap=cmap, vmin=0, vmax=1) plt.title(title+" Acc: "+str(accuracy)+")") plt.colorbar() for i in range(0,len(labels)): for j in range(0,len(labels)): plt.text(j,i,cm[i,j],va='center',ha='cente...
code_fim
hard
{ "lang": "python", "repo": "UcarLab/CoRE-ATAC", "path": "/tensorloader/PEASUtil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Platingamer42/DigitRecognition path: /Windows/AI_KERAS.py from keras import models import numpy as np class AI_KERAS: cnn = True def __init__(self): <|fim_suffix|> if self.cnn: x = x.reshape(1,28,28,1) output = self.model.predict(x) else: ...
code_fim
medium
{ "lang": "python", "repo": "Platingamer42/DigitRecognition", "path": "/Windows/AI_KERAS.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.model = models.load_model("data/saves/model_cnn (3).h5") def sendThrough(self, x): if self.cnn: x = x.reshape(1,28,28,1) output = self.model.predict(x) else: output = self.model.predict(x) return output<|fim_prefix|># repo: Plat...
code_fim
easy
{ "lang": "python", "repo": "Platingamer42/DigitRecognition", "path": "/Windows/AI_KERAS.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def sendThrough(self, x): if self.cnn: x = x.reshape(1,28,28,1) output = self.model.predict(x) else: output = self.model.predict(x) return output<|fim_prefix|># repo: Platingamer42/DigitRecognition path: /Windows/AI_KERAS.py from keras impor...
code_fim
medium
{ "lang": "python", "repo": "Platingamer42/DigitRecognition", "path": "/Windows/AI_KERAS.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xkortex/VIAME path: /plugins/flask/Python/gen_filelist.py from __future__ import division import itertools import os import random import numpy as np import sys import json _, label_file = sys.argv reader = open(os.path.join(os.environ['FS_ROOT'], label_file), 'rt') label = json.load(reader) re...
code_fim
hard
{ "lang": "python", "repo": "xkortex/VIAME", "path": "/plugins/flask/Python/gen_filelist.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>f = open(train_file, "w") for i in range(int(max_num*3/4)) : for element in pos_dics : label = pos_dics[element] imglist = pos_list[label] k = (i%len(imglist)) f.write("%s %d\n" % (imglist[k], label)) for element in neg_dics : label = neg_dics[eleme...
code_fim
medium
{ "lang": "python", "repo": "xkortex/VIAME", "path": "/plugins/flask/Python/gen_filelist.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: learnables/learn2learn path: /learn2learn/nn/metaoptnet.py #!/usr/bin/env python3 import torch try: from qpth.qp import QPFunction except ImportError: from learn2learn.utils import _ImportRaiser QPFunction = _ImportRaiser('qpth', 'pip install qpth') EPS = 1e-8 def kronecker(A, B):...
code_fim
hard
{ "lang": "python", "repo": "learnables/learn2learn", "path": "/learn2learn/nn/metaoptnet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": from learn2learn.utils import accuracy IMAGE_SHAPES = (1, 16, 16) NUM_CLASSES = 10 NUM_SHOTS = 5 NOISE = 0.0 for normalize in [True, False]: X = [] y = [] for i in range(NUM_CLASSES): images = torch.randn(1, *IMAGE_S...
code_fim
hard
{ "lang": "python", "repo": "learnables/learn2learn", "path": "/learn2learn/nn/metaoptnet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> flickr_ur = "https://farm%s.staticflickr.com/%s/%s_%s.%s" return flickr_ur % (row[5], row[6], row[0], row[7], row[8]) # COMMAND ---------- unclassified_images_df = spark.read.parquet('/mnt/group07/final_data_product/classification_result/unclassified_images.parquet').cache() unclassified_images_df.p...
code_fim
hard
{ "lang": "python", "repo": "LSDE-Flickr-ML-Classification/data-pipeline", "path": "/notebooks/group07/download_failed_images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LSDE-Flickr-ML-Classification/data-pipeline path: /notebooks/group07/download_failed_images.py # Databricks notebook source import json import os import urllib.parse from pyspark.sql.functions import desc, asc, monotonically_increasing_id, collect_list, col, dense_rank, row_number, lit, floor, c...
code_fim
medium
{ "lang": "python", "repo": "LSDE-Flickr-ML-Classification/data-pipeline", "path": "/notebooks/group07/download_failed_images.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Micro-sheep/PaddleOCR path: /ppstructure/predict_system.py # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "Micro-sheep/PaddleOCR", "path": "/ppstructure/predict_system.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not flag: img = cv2.imread(image_file) if img is None: logger.error("error in loading image:{}".format(image_file)) continue starttime = time.time() res = structure_sys(img) save_structure_res(res, save_folder, img_name) ...
code_fim
hard
{ "lang": "python", "repo": "Micro-sheep/PaddleOCR", "path": "/ppstructure/predict_system.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /Configuration/Generator/python/Pythia8CUEP8S1Herapdf15LOSettings_cfi.py import FWCore.ParameterSet.Config as cms pythia<|fim_suffix|>hia8CUEP8S1herapdfSettings = cms.vstring( 'Tune:pp 16', 'Tune:ee 3', ) )<|fim_middle|>8CUEP8S1herapdfSettingsBlock = c...
code_fim
easy
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/Configuration/Generator/python/Pythia8CUEP8S1Herapdf15LOSettings_cfi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 'Tune:pp 16', 'Tune:ee 3', ) )<|fim_prefix|># repo: cms-sw/cmssw path: /Configuration/Generator/python/Pythia8CUEP8S1Herapdf15LOSettings_cfi.py import FWCore.ParameterSet.Config as cms pythia<|fim_middle|>8CUEP8S1herapdfSettingsBlock = cms.PSet( pythia8CUEP8S1herapdfSettings = cms...
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/Configuration/Generator/python/Pythia8CUEP8S1Herapdf15LOSettings_cfi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: houseofmackee/BrightcovePY path: /brightcove/DynamicIngest.py """ Implements wrapper class and methods to work with Brightcove's Dynamic Ingest API. See: https://apis.support.brightcove.com/dynamic-ingest/references/reference.html """ from typing import Callable, Optional import functools from ...
code_fim
hard
{ "lang": "python", "repo": "houseofmackee/BrightcovePY", "path": "/brightcove/DynamicIngest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Submits an ingest request to the Dynamic Ingest API. Args: video_id (str): Video ID to ingest video to. source_url (str): URL of the source video asset to ingest. capture_images (bool, optional): [description]. Defaults to True. ...
code_fim
hard
{ "lang": "python", "repo": "houseofmackee/BrightcovePY", "path": "/brightcove/DynamicIngest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Args: oauth (OAuth): OAuth instance to use for the API calls. ingest_profile (str, optional): Default ingest profile to use for ingests. Defaults to ''. priority_queue (str, optional): Default priority queue to use for ingests. Defaults to 'normal'. ...
code_fim
hard
{ "lang": "python", "repo": "houseofmackee/BrightcovePY", "path": "/brightcove/DynamicIngest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lnadi17/lights-yes path: /projects/Game/Gameboard.py # import all necessary libraries import numpy as np import queue # final implementation of the Gameboard class class Gameboard: def __init__(self, shape): self.nrows, self.ncols = shape, shape self.col_labels, self.row_la...
code_fim
hard
{ "lang": "python", "repo": "lnadi17/lights-yes", "path": "/projects/Game/Gameboard.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: # make a recorded set of moves moves = q.get() if q.empty(): # print("answer not found") return None self.play_multiple(moves) # check for win if self.is_game_over(): ...
code_fim
hard
{ "lang": "python", "repo": "lnadi17/lights-yes", "path": "/projects/Game/Gameboard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> results = [] i, piv, col = 0, 0, 0 to_fix = [] while col < len(A): if A[i, i + piv] == 1: i += 1 else: to_fix.append(col) piv += 1 col += 1 no_fix = np.delete(np.arange(0, len(A), 1)...
code_fim
hard
{ "lang": "python", "repo": "lnadi17/lights-yes", "path": "/projects/Game/Gameboard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edelhirsch/brain-tumor-classification path: /main.py #!/usr/bin/python3 import argparse import keras from keras import layers import matplotlib.pyplot as plt import numpy as np import os import tensorflow as tf from tensorflow.keras.applications.xception import decode_predictions base_dir = "/h...
code_fim
hard
{ "lang": "python", "repo": "edelhirsch/brain-tumor-classification", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> train_ds, validation_ds, test_ds = create_datasets() for index, value in zip(train_ds.class_names, predictions): print(f'{index}: {value}') plt.figure(figsize=(5, 5)) plt.imshow(image) index = np.argmax(predictions) title = os.path.basename(image_path) + "\nprediction: " ...
code_fim
hard
{ "lang": "python", "repo": "edelhirsch/brain-tumor-classification", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cordenates=jsan_data_features[events]['geometry']['coordinates'] print("title :"+str(title)+" cordenadas :" + str(cordenates)) print("="*50)<|fim_prefix|># repo: jjgilces/Where-There-s-a-Link-There-s-a-Way path: /events_eonet.py import requests import json parameters={"limit":1000,...
code_fim
medium
{ "lang": "python", "repo": "jjgilces/Where-There-s-a-Link-There-s-a-Way", "path": "/events_eonet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jjgilces/Where-There-s-a-Link-There-s-a-Way path: /events_eonet.py import requests import json parameters={"limit":1000,"days":5000} response=requests.get('https://eonet.sci.gsfc.nasa.gov/api/v3/events/geojson') if response.stat<|fim_suffix|>xt) jsan_data_features=json_data['features'] date=[] f...
code_fim
medium
{ "lang": "python", "repo": "jjgilces/Where-There-s-a-Link-There-s-a-Way", "path": "/events_eonet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>+= str(a[max_index]) del a[max_index] return res if __name__ == '__main__': input = int(input()) # number of numbers in list a = [int(x) for x in input().split()] # input list of numbers print(largest_number(a))<|fim_prefix|># repo: VAR-solutions/Algorithms path: /Greedy Algorith...
code_fim
medium
{ "lang": "python", "repo": "VAR-solutions/Algorithms", "path": "/Greedy Algorithms/Largest Number/largest_number.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VAR-solutions/Algorithms path: /Greedy Algorithms/Largest Number/largest_number.py def largest_number(a): res = "" while a: max_index = 0 for i in range(1, len(a)): <|fim_suffix|>+= str(a[max_index]) del a[max_index] return res if __name__ == '__ma...
code_fim
medium
{ "lang": "python", "repo": "VAR-solutions/Algorithms", "path": "/Greedy Algorithms/Largest Number/largest_number.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert(self.history.shape == (self.steps, self.dim)) return rtn # need to override in derived classes def _step(self, whence): """ Perform one step of the algorithm, starting from the point "whence". This must be overridden by specific walk implementation...
code_fim
hard
{ "lang": "python", "repo": "dawsboss/convexgeometry", "path": "/convexgeometry/walks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dawsboss/convexgeometry path: /convexgeometry/walks.py import numpy as np import numpy.linalg as la def angle2vec(theta): return np.array([np.cos(theta), np.sin(theta)]) class RandomWalk: def __init__(self, memberfunc, start, space=1, *args, **kwargs): """ Create the wal...
code_fim
hard
{ "lang": "python", "repo": "dawsboss/convexgeometry", "path": "/convexgeometry/walks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brainma/ASRNet path: /run_test.py import argparse import os import sys import re import cv2 import pydicom as pyd import torch import torch.nn as nn import numpy as np from math import log10, sqrt from skimage.measure import compare_ssim parser = argparse.ArgumentParser() parser.add_argument("-...
code_fim
hard
{ "lang": "python", "repo": "brainma/ASRNet", "path": "/run_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> files = os.listdir(outPath) pre_num = 0 psnr_case = float(0) ssim_case = float(0) ie_case = float(0) print(outPath) for file in files: m = predictedFilePattern.match(file) if m: predicted_img_path = os.path.join(outPath, file) label_img_...
code_fim
hard
{ "lang": "python", "repo": "brainma/ASRNet", "path": "/run_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: continue print('Case Num: ' + folder) psnr_case = psnr_case/float(pre_num) ie_case = ie_case/float(pre_num) ssim_case = ssim_case/float(pre_num) print(str(folder) + '\t' + str(psnr_case) + '\t' + str(ie_case) + '\t' + str(ssim_case)) psnr_total += ps...
code_fim
hard
{ "lang": "python", "repo": "brainma/ASRNet", "path": "/run_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parent_frame = rcall("sys.frame", -1) things = [ "import", "import_builtins", "py_call", "py_copy", "py_eval", "py_get_attr", "py_get_item", "py_object", "py_set_attr", "...
code_fim
hard
{ "lang": "python", "repo": "randy3k/rchitect", "path": "/rchitect/py_tools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return robject("function", x, **kwargs) e = new_env(parent=lib.R_GlobalEnv) kwarg = {"rchitect.py_tools": e} rcall(("base", "options"), **kwarg) assign("import", _rfunction(py_import, convert=False), e) assign("import_builtins", _rfunction(py_import_builtins, convert=False), ...
code_fim
hard
{ "lang": "python", "repo": "randy3k/rchitect", "path": "/rchitect/py_tools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: randy3k/rchitect path: /rchitect/py_tools.py from __future__ import unicode_literals, absolute_import from rchitect._cffi import lib import operator import sys import importlib from six import text_type from types import ModuleType from .interface import rcopy, robject, rcall_p, rcall, sexp, se...
code_fim
hard
{ "lang": "python", "repo": "randy3k/rchitect", "path": "/rchitect/py_tools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> suite = unittest.TestSuite() if sys.version_info >= (2,4): suite.addTests([make_doctest('test_clean.txt')]) if LIBXML_VERSION >= (2,6,31): suite.addTests([make_doctest('test_clean_embed.txt')]) return suite<|fim_prefix|># repo: sarvex/hue path: /desktop/core/ext-py...
code_fim
easy
{ "lang": "python", "repo": "sarvex/hue", "path": "/desktop/core/ext-py/lxml/src/lxml/html/tests/test_clean.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarvex/hue path: /desktop/core/ext-py/lxml/src/lxml/html/tests/test_clean.py import unittest, sys from lxml.tests.common_imports import make_doctest from lxml.etree import LIBXML_VERSION <|fim_suffix|> suite = unittest.TestSuite() if sys.version_info >= (2,4): suite.addTests([make...
code_fim
easy
{ "lang": "python", "repo": "sarvex/hue", "path": "/desktop/core/ext-py/lxml/src/lxml/html/tests/test_clean.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gabbpuy/vindauga path: /vindauga/menus/menu_popup.py # -*- coding: utf-8 -*- import logging from vindauga.constants.event_codes import evKeyDown, evCommand from vindauga.misc.character_codes import getCtrlChar, getAltChar from .menu_box import MenuBox logger = logging.getLogger(__name__) cla...
code_fim
hard
{ "lang": "python", "repo": "gabbpuy/vindauga", "path": "/vindauga/menus/menu_popup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if item and self.commandEnabled(item.command): event.what = evCommand event.message.command = item.command event.message.infoPtr = None self.putEvent(event) self.clearEvent(event) elif getAltChar(event....
code_fim
hard
{ "lang": "python", "repo": "gabbpuy/vindauga", "path": "/vindauga/menus/menu_popup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> validator = DateRequired() class TestYearSpec: year = None mock_form = Mock(spec=TestYearSpec) mock_form.year.data = '' mock_field = Mock() with self.assertRaises(StopValidation) as ite: validator(mock_form, mock_field) se...
code_fim
hard
{ "lang": "python", "repo": "ONSdigital/eq-survey-runner", "path": "/tests/app/validation/test_date_required.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ONSdigital/eq-survey-runner path: /tests/app/validation/test_date_required.py import unittest from unittest.mock import Mock from wtforms.validators import StopValidation from app.validation.error_messages import error_messages from app.validation.validators import DateRequired class TestDateR...
code_fim
hard
{ "lang": "python", "repo": "ONSdigital/eq-survey-runner", "path": "/tests/app/validation/test_date_required.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }