text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def test_rule_ignores_where_auth_not_mentioned(neutral_template): rule = CloudFormationAuthenticationRule(None) result = rule.invoke(neutral_template) assert result.valid assert len(result.failed_rules) == 0 assert len(result.failed_monitored_rules) == 0<|fim_prefix|># repo: chuckbnor...
code_fim
hard
{ "lang": "python", "repo": "chuckbnorris/Canivete", "path": "/cfripper/tests/rules/test_CloudFormationAuthenticationRule.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> T(10) is 2329. What is T(1012) modulo 108? ''' # Solution # Solution Approach ''' '''<|fim_prefix|># repo: Ved005/project-euler-solutions path: /code/tours_on_a_4_x_n_playing_board/sol_237.py # -*- coding: utf-8 -*- ''' File name: code\tours_on_a_4_x_n_playing_board\sol_237.py Author: Vai...
code_fim
hard
{ "lang": "python", "repo": "Ved005/project-euler-solutions", "path": "/code/tours_on_a_4_x_n_playing_board/sol_237.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ved005/project-euler-solutions path: /code/tours_on_a_4_x_n_playing_board/sol_237.py # -*- coding: utf-8 -*- ''' File name: code\tours_on_a_4_x_n_playing_board\sol_237.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' <|fim_suffix|> T(10) is 2329. What...
code_fim
hard
{ "lang": "python", "repo": "Ved005/project-euler-solutions", "path": "/code/tours_on_a_4_x_n_playing_board/sol_237.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Add tick mark for month start line = lines.Line2D([0, month_start_slope * DATE_SCALE_TICK_X], [month_start_y, month_start_y]) ax1.add_line(line) # Add text for month name, in the middle of the month if month_start_slope == month_end_slope: text_y = (m...
code_fim
hard
{ "lang": "python", "repo": "cmcqueen/sundials", "path": "/analemmatic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmcqueen/sundials path: /analemmatic.py #!/usr/bin/env python3 """ Calculation and generation of analemmatic sundial. References: Plus Magazine http://pass.maths.org.uk/issue11/features/sundials/index.html Wikipedia http://en.wikipedia.org/wiki/Analemmatic_sundial Calculations have ...
code_fim
hard
{ "lang": "python", "repo": "cmcqueen/sundials", "path": "/analemmatic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ax1.plot(analemmatic_positions_x, analemmatic_positions_y, '.') # Draw date scale datescale_logger = logging.getLogger("datescale") # Max and min lines dates_y = [] for sun_angle in [-sun_declination.SUN_OBLIQUITY, sun_declination.SUN_OBLIQUITY]: date_y = np.tan(sun_angle)...
code_fim
hard
{ "lang": "python", "repo": "cmcqueen/sundials", "path": "/analemmatic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeMyst/ConferenceCorpus path: /corpus/datasources/webscrape.py ''' Created on 2020-08-20 @author: wf ''' import urllib.request from urllib.request import build_opener, HTTPCookieProcessor from bs4 import BeautifulSoup import re class WebScrape(object): ''' WebScraper with a rudiment...
code_fim
hard
{ "lang": "python", "repo": "LeMyst/ConferenceCorpus", "path": "/corpus/datasources/webscrape.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def findLinkForRegexp(self,regex:str): ''' find a link for the given regular expression Args: regex(str): the regular expression to find a link for Return: m(object),text(str): the match/text tuple or None,None ''' ...
code_fim
hard
{ "lang": "python", "repo": "LeMyst/ConferenceCorpus", "path": "/corpus/datasources/webscrape.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: larsleyendecker/gym path: /gym/envs/robotics/old_versions/ur10_static_pd_env_nocfg.py import numpy import pandas import mujoco_py import json from gym.envs.robotics import rotations, robot_custom_env, utils import os from gym.envs.robotics.ur10 import randomize from scipy.signal import lfilter, l...
code_fim
hard
{ "lang": "python", "repo": "larsleyendecker/gym", "path": "/gym/envs/robotics/old_versions/ur10_static_pd_env_nocfg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Checking if there are contacts in simulation and returning false if so if self.sim.data.ncon == 0: for i in range(100): self.sim.data.ctrl[:] = self.sim.data.qfrc_bias.copy() self.sim.forward() #self.sim.step() self....
code_fim
hard
{ "lang": "python", "repo": "larsleyendecker/gym", "path": "/gym/envs/robotics/old_versions/ur10_static_pd_env_nocfg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _sample_goal(self): home_path = os.getenv("HOME") goal_path = os.path.join(*[home_path, "DRL_AI4RoMoCo","code", "environment", "experiment_configs", "goal_ur10_simpheg_conf2.json"]) with open(goal_path, encoding='utf-8') as file: goal = json.load(file) ...
code_fim
hard
{ "lang": "python", "repo": "larsleyendecker/gym", "path": "/gym/envs/robotics/old_versions/ur10_static_pd_env_nocfg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user_data = { 'firstname': data.get('firstname'), 'lastname': data.get('lastname'), 'email': data.get('email'), 'password': data.get('password'), 'othername': data.get('othername'), 'phone_number': data.get('phone_number'), 'is_admin': data.get('...
code_fim
hard
{ "lang": "python", "repo": "luqee/politico-api", "path": "/app/api/v1/blueprints/auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = {} if result == 'Invalid credentials': # notify the user that there was an error. response['status'] = 401 response['error'] = 'Invalid credentials' elif isinstance(result, bytes): # return a response notifying the user that they logged in successfull...
code_fim
hard
{ "lang": "python", "repo": "luqee/politico-api", "path": "/app/api/v1/blueprints/auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luqee/politico-api path: /app/api/v1/blueprints/auth.py from flask import Blueprint, request, jsonify, make_response from app import politico from app.api.v1.blueprints.validator import Validator auth_blueprint = Blueprint('auth', __name__, url_prefix='/api/v1/auth') @auth_blueprint.route('/use...
code_fim
hard
{ "lang": "python", "repo": "luqee/politico-api", "path": "/app/api/v1/blueprints/auth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hanfeisun/footprint-recognition path: /3-preprocess.py import numpy as np import skimage import skimage.transform import skimage.feature import skimage.io import os from os.path import join <|fim_suffix|># train_dir = "valid" # items = sorted([x for x in os.listdir(train_dir) if x.endswith(".png...
code_fim
hard
{ "lang": "python", "repo": "hanfeisun/footprint-recognition", "path": "/3-preprocess.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># train_dir = "valid" # items = sorted([x for x in os.listdir(train_dir) if x.endswith(".png")], key=lambda x: int(x.split(".")[0])) # for name in items: # image = skimage.io.imread(join(train_dir, name), as_grey=True) # trans = np.where(skimage.filters.gaussian(image, 0.8) > 0.6, 255, 0) # sk...
code_fim
hard
{ "lang": "python", "repo": "hanfeisun/footprint-recognition", "path": "/3-preprocess.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fig17 = plt.figure() ax17_1 = fig17.add_subplot(111) ax17_1.set_xlabel("Depth (km)") ax17_1.set_ylabel("Concentration (moles/m$^3$)") ax17_1.set_title("Reacted Silicate Melt Concentrations in a Vesta Magma Ocean (Oxidizing Model, $\eta$=10$^{-3.5}$)") ax17_1.plot(depth_vesta_1, concs_mesh_vesta_1, linewid...
code_fim
hard
{ "lang": "python", "repo": "ScottHull/Masters-Thesis-Code", "path": "/Thesis_Code_3/thesis_models_concentration_recalcs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ScottHull/Masters-Thesis-Code path: /Thesis_Code_3/thesis_models_concentration_recalcs.py verify_D_vesta_8 = recalcConcentration(predicted_d=vesta_8['D'], original_moles_silicate=0.27950089725326804, original_moles_metal=0, volume_mesh=vesta_vol_mesh_5_thru_8, radiu...
code_fim
hard
{ "lang": "python", "repo": "ScottHull/Masters-Thesis-Code", "path": "/Thesis_Code_3/thesis_models_concentration_recalcs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig4 = plt.figure() ax4_1 = fig4.add_subplot(111) ax4_1.set_xlabel("Depth (km)") ax4_1.set_ylabel("Concentration (moles/m$^3$)") ax4_1.set_title("Reacted Silicate Melt Concentrations in a Vestian Magma Ocean (Reducing Model, $\eta$=10$^{-1.0}$)") ax4_1.plot(depth_vesta_7[1:], concs_mesh_vesta_7[1:], linew...
code_fim
hard
{ "lang": "python", "repo": "ScottHull/Masters-Thesis-Code", "path": "/Thesis_Code_3/thesis_models_concentration_recalcs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Euclidean distance of two points (x_0, y_0) and (x_1, y_1).""" return sqrt((x_1 - x_0)**2 + (y_1 - y_0)**2) def minimum_dist_to_obstacle(x_jnt0, y_jnt0, x_jnt1, y_jnt1, link_slope, x_obs, y_obs): """ Compute minimum distance of a link from a given obstacle...
code_fim
hard
{ "lang": "python", "repo": "nickgkan/redundant-dof-robot-control", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def derivative_of_dist_to_obstacle(min_dist, x_jnt0, y_jnt0, x_jnt1, y_jnt1, dx_jnt0, dy_jnt0, dx_jnt1, dy_jnt1, link_slope, x_obs, y_obs): """ Compute derivatives of distance to an obstacle w.r.t. joint angles. Inputs: ...
code_fim
hard
{ "lang": "python", "repo": "nickgkan/redundant-dof-robot-control", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nickgkan/redundant-dof-robot-control path: /src/utils.py """ A set of functions to support the robotic arm control. Mostly concerning the computation of the controller loss function. """ from math import sqrt import numpy as np def compute_link_loss(min_dist, dist_der, safety_dist): """ ...
code_fim
hard
{ "lang": "python", "repo": "nickgkan/redundant-dof-robot-control", "path": "/src/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hofsmo/SinFactory path: /sinfactory/pfresults.py """Module for handling power flow results.""" import pandas as pd class PFResults(object): """Class containing power flow results.""" def __init__(self, grid): """Initialise the result class for power flow results. Args:...
code_fim
hard
{ "lang": "python", "repo": "Hofsmo/SinFactory", "path": "/sinfactory/pfresults.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Get specified properties in a DF from a set of units, i.e. loads""" df = pd.DataFrame() for unit in units.items(): for prop in properties: df.at[unit[0], prop] = getattr(unit[1], prop) return df<|fim_prefix|># repo: Hofsmo/SinFactory ...
code_fim
hard
{ "lang": "python", "repo": "Hofsmo/SinFactory", "path": "/sinfactory/pfresults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: codeb2cc/noweibo path: /main.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # import traceback from tornado import options, ioloop, web, process from . import views from .conf import setting options.define('port', default=5000, type=int) options.define('process', default=1, type=int) opti...
code_fim
medium
{ "lang": "python", "repo": "codeb2cc/noweibo", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> process_port = _port + process.task_id() process_debug = _process_num <= 1 and _debug_level < 30 print('Service Running on %d ...' % process_port) app = web.Application(( (r'/', views.base.IndexHandler), (r'/home', views.base.HomeHandler), (r'/auth/redirect', view...
code_fim
hard
{ "lang": "python", "repo": "codeb2cc/noweibo", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: levabd/audio-search-engine path: /lib/helpers/files.py import numpy as np from pydub import AudioSegment from pydub.utils import audioop <|fim_suffix|> # pydub does not support 24-bit wav files, use wavio when this occurs try: audiofile = AudioSegment.from_file(filename) ...
code_fim
medium
{ "lang": "python", "repo": "levabd/audio-search-engine", "path": "/lib/helpers/files.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> audiofile = audiofile.T audiofile = audiofile.astype(np.int16) channels = [] for chn in audiofile: channels.append(chn) return channels, fs<|fim_prefix|># repo: levabd/audio-search-engine path: /lib/helpers/files.py import numpy as np from pydub impor...
code_fim
hard
{ "lang": "python", "repo": "levabd/audio-search-engine", "path": "/lib/helpers/files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> channels = [] for chn in audiofile: channels.append(chn) return channels, fs<|fim_prefix|># repo: levabd/audio-search-engine path: /lib/helpers/files.py import numpy as np from pydub import AudioSegment from pydub.utils import audioop def loadfile(filename): <|fim_m...
code_fim
hard
{ "lang": "python", "repo": "levabd/audio-search-engine", "path": "/lib/helpers/files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.runs.append(time() - self.t) def __call__(self, *args, **kwargs): t = time() ret_var = self.func(*args, **kwargs) self.runs.append(time() - t) return ret_var<|fim_prefix|># repo: SHYXIN/PythonMorsels path: /20-29/27. timer/timer.py from contextlib import ...
code_fim
medium
{ "lang": "python", "repo": "SHYXIN/PythonMorsels", "path": "/20-29/27. timer/timer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SHYXIN/PythonMorsels path: /20-29/27. timer/timer.py from contextlib import ContextDecorator from statistics import mean, median from time import time class Timer(ContextDecorator): def __init__(self, func=None): self.runs = [] self.func = func @property def elapsed...
code_fim
medium
{ "lang": "python", "repo": "SHYXIN/PythonMorsels", "path": "/20-29/27. timer/timer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: madsenmj/deployment-ready-data-science path: /utils/powermodel_utils.py import pandas as pd import sqlalchemy as sql import pyodbc import os from urllib.parse import quote_plus from utils.ml_templates import MLSource, MLData class SQLSource(MLSource): def __init__(self, sql_configurati...
code_fim
hard
{ "lang": "python", "repo": "madsenmj/deployment-ready-data-science", "path": "/utils/powermodel_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class CSVStoreData(MLData): def __init__(self,location): super().__init__() self._location = location def get(self): df = pd.read_csv(self._location, encoding='utf-8') return df def set(self, data): data.to_csv(self._location, encoding='utf-8', quoting=...
code_fim
hard
{ "lang": "python", "repo": "madsenmj/deployment-ready-data-science", "path": "/utils/powermodel_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarquesThiago/Manga_Downloader path: /src/Tools/Router/path.py import os, sys def abstract_path_now(file): <|fim_suffix|> full_path_dir = abstract_path_now(file) return os.path.join(full_path_dir, join)<|fim_middle|> full_path_file = os.path.abspath(file) return os.path.dirname(ful...
code_fim
medium
{ "lang": "python", "repo": "MarquesThiago/Manga_Downloader", "path": "/src/Tools/Router/path.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> full_path_dir = abstract_path_now(file) return os.path.join(full_path_dir, join)<|fim_prefix|># repo: MarquesThiago/Manga_Downloader path: /src/Tools/Router/path.py import os, sys def abstract_path_now(file): full_path_file = os.path.abspath(file) return os.path.dirname(full_path_file) ...
code_fim
easy
{ "lang": "python", "repo": "MarquesThiago/Manga_Downloader", "path": "/src/Tools/Router/path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hsd1503/UnsupervisedScalableRepresentationLearningTimeSeries path: /main1.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The AS...
code_fim
hard
{ "lang": "python", "repo": "hsd1503/UnsupervisedScalableRepresentationLearningTimeSeries", "path": "/main1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> save_memory=False): """ Creates a classifier from the given set of hyperparameters in the input file, fits it and return it. @param file Path of a file containing a set of hyperparemeters. @param train Training set. @param train_labels Labels for the traini...
code_fim
hard
{ "lang": "python", "repo": "hsd1503/UnsupervisedScalableRepresentationLearningTimeSeries", "path": "/main1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> elif choice==7: print(""" Name: Rectangle Area Operation : Finding Area Inputs : a->int/float b->float/int Outputs: c=>a*b ->float Author : varunpusarla \n """) a = float(input("Enter a >...
code_fim
hard
{ "lang": "python", "repo": "pccoeacm/all-calc", "path": "/functions/Area.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pccoeacm/all-calc path: /functions/Area.py def calc(should_print=False): print("1. Square Area") print("2. Square Perimeter") print("3. Circle Area") print("3. Circle Perimeter") print("5. Triangle Area") print("6. Triangle Perimeter") print("7. Rectangle Area") ...
code_fim
hard
{ "lang": "python", "repo": "pccoeacm/all-calc", "path": "/functions/Area.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = {} result['inputs'] = [a,b,c] result['outputs'] = [a*b] loop=False elif choice==8: print(""" Name: Rectangle Perimeter Operation : Finding Perimeter Inputs : a->int/float b->float/int ...
code_fim
hard
{ "lang": "python", "repo": "pccoeacm/all-calc", "path": "/functions/Area.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpoullet2000/det path: /det/app.py from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import logging from flask import request from pkg_resources import resource_filename from credential...
code_fim
hard
{ "lang": "python", "repo": "jpoullet2000/det", "path": "/det/app.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>APP.app.json_encoder = encoder.JSONEncoder APP.app.config.from_object(CONFIG_MODULE) conf = APP.app.config APP.add_api('swagger.yaml', host=conf['DET_WEBSERVER_ADDRESS'], resolver=RestyResolver('det'), arguments={'packageName': 'det', 'title': 'Data engineering toolkit API'}) cred_vars = ['ATLAS_LOGIN',...
code_fim
hard
{ "lang": "python", "repo": "jpoullet2000/det", "path": "/det/app.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: benitocm/practical-astronomy path: /src/myastro/cluegen.py # cluegen.py # # Classes generated from type clues. # # https://github.com/dabeaz/cluegen # # Author: David Beazley (@dabeaz). # http://www.dabeaz.com # # Copyright (C) 2018-2020. # # Permission is granted to use, copy, and...
code_fim
hard
{ "lang": "python", "repo": "benitocm/practical-astronomy", "path": "/src/myastro/cluegen.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> submethods = [] for name, val in cls._methods: if name not in cls.__dict__: setattr(cls, name, val) submethods.append((name, val)) elif val is cls.__dict__[name]: submethods.append((name, val)) if submethods !...
code_fim
hard
{ "lang": "python", "repo": "benitocm/practical-astronomy", "path": "/src/myastro/cluegen.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: viewthespace/mypy-stubs path: /src/airflow-stubs/contrib/hooks/gcp_translate_hook.pyi from airflow.contrib.hooks.gcp_api_base_hook import GoogleCloudBaseHook as GoogleCloudBaseHook from typing import Any class CloudTranslateHook(GoogleCloudBaseHook): <|fim_suffix|> def translate(self, values,...
code_fim
medium
{ "lang": "python", "repo": "viewthespace/mypy-stubs", "path": "/src/airflow-stubs/contrib/hooks/gcp_translate_hook.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def translate(self, values, target_language, format_: Any | None = ..., source_language: Any | None = ..., model: Any | None = ...): ...<|fim_prefix|># repo: viewthespace/mypy-stubs path: /src/airflow-stubs/contrib/hooks/gcp_translate_hook.pyi from airflow.contrib.hooks.gcp_api_base_hook import Googl...
code_fim
easy
{ "lang": "python", "repo": "viewthespace/mypy-stubs", "path": "/src/airflow-stubs/contrib/hooks/gcp_translate_hook.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s1 = s1 + A.T @ A s2 = s2 + A.T * dt # compliance #k = np.linalg.lstsq(s1,s2)[0] k = np.linalg.lstsq(s1, s2, rcond=-1) print(dt.shape)<|fim_prefix|># repo: mohamedsayed18/Calibration path: /main.py """the main code for calibration""" import numpy as np import random from deflection import def...
code_fim
hard
{ "lang": "python", "repo": "mohamedsayed18/Calibration", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mohamedsayed18/Calibration path: /main.py """the main code for calibration""" import numpy as np import random from deflection import deflection from mat_a import mat_a links = [1, 1, 1, 1] exp = 3 # No. of experiments forces = np.zeros((6, exp)) poses = np.zeros((3, exp)) defi = [] s1 = np....
code_fim
hard
{ "lang": "python", "repo": "mohamedsayed18/Calibration", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ("api", "0083_remove_all_null_strings"), ("api", "0081_scratchorg_currently_reassigning_user"), ] operations = []<|fim_prefix|># repo: anspaujd/Metecho path: /metecho/api/migrations/0084_merge_20200611_1311.py # Genera...
code_fim
easy
{ "lang": "python", "repo": "anspaujd/Metecho", "path": "/metecho/api/migrations/0084_merge_20200611_1311.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: anspaujd/Metecho path: /metecho/api/migrations/0084_merge_20200611_1311.py # Generated by Django 3.0.7 on 2020-06-11 13:11 from django.db import migrations <|fim_suffix|> dependencies = [ ("api", "0083_remove_all_null_strings"), ("api", "0081_scratchorg_currently_reassigning...
code_fim
easy
{ "lang": "python", "repo": "anspaujd/Metecho", "path": "/metecho/api/migrations/0084_merge_20200611_1311.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: alefteris/aiohttp-debugtoolbar path: /aiohttp_debugtoolbar/__init__.py from .middlewares import toolbar_middleware_factory, middleware from .main import setup, APP_KEY <|fim_suffix|>__all__ = ['setup', 'middleware', 'toolbar_middleware_factory', 'APP_KEY']<|fim_middle|>__version__ = '0.3.0'
code_fim
easy
{ "lang": "python", "repo": "alefteris/aiohttp-debugtoolbar", "path": "/aiohttp_debugtoolbar/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ['setup', 'middleware', 'toolbar_middleware_factory', 'APP_KEY']<|fim_prefix|># repo: alefteris/aiohttp-debugtoolbar path: /aiohttp_debugtoolbar/__init__.py from .middlewares import toolbar_middleware_factory, middleware from .main import setup, APP_KEY <|fim_middle|>__version__ = '0.3.0'
code_fim
easy
{ "lang": "python", "repo": "alefteris/aiohttp-debugtoolbar", "path": "/aiohttp_debugtoolbar/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/app/plugin/core/string/StringsAnalyzer.pyi from typing import List import ghidra.app.plugin.core.string import ghidra.app.services import ghidra.app.util.importer import ghidra.framework.options import ghidra.program.model.address import gh...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/app/plugin/core/string/StringsAnalyzer.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @overload def wait(self, __a0: long) -> None: ... @overload def wait(self, __a0: long, __a1: int) -> None: ... @property def alignment(self) -> int: ... def __init__(self): ... def added(self, __a0: ghidra.program.model.listing.Program, __a1: g...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/app/plugin/core/string/StringsAnalyzer.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" from alembic import op # revision identifiers, used by Alembic. revision = "e161acce7727" down_revision = "98e2968b63e4" branch_labels = None depends_on = None def upgrade() -> None: op.execute( "create index if not exists idx_mv_facility_all_trading_interval_day_aest on mv_facility_all...
code_fim
medium
{ "lang": "python", "repo": "zalihat/opennem", "path": "/opennem/db/migrations/versions/e161acce7727_create_index_mv_facility_all_trading_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zalihat/opennem path: /opennem/db/migrations/versions/e161acce7727_create_index_mv_facility_all_trading_.py # pylint: disable=no-member """ Create index mv_facility_all_trading_interval Revision ID: e161acce7727 Revises: 98e2968b63e4 Create Date: 2021-01-18 18:29:47.808544 """ from alembic impo...
code_fim
hard
{ "lang": "python", "repo": "zalihat/opennem", "path": "/opennem/db/migrations/versions/e161acce7727_create_index_mv_facility_all_trading_.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def downgrade() -> None: op.execute("drop index idx_mv_facility_all_trading_interval_day_aest;")<|fim_prefix|># repo: zalihat/opennem path: /opennem/db/migrations/versions/e161acce7727_create_index_mv_facility_all_trading_.py # pylint: disable=no-member """ Create index mv_facility_all_trading_interv...
code_fim
hard
{ "lang": "python", "repo": "zalihat/opennem", "path": "/opennem/db/migrations/versions/e161acce7727_create_index_mv_facility_all_trading_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>engine = create_engine(CONNECTION_STRING) Base.metadata.create_all(engine)<|fim_prefix|># repo: mostafa-saeed/Udacity-Catalog-Project path: /database_setup.py from sqlalchemy import create_engine from models.main import Base <|fim_middle|>from models.user import User from models.item import Item DB_SE...
code_fim
hard
{ "lang": "python", "repo": "mostafa-saeed/Udacity-Catalog-Project", "path": "/database_setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mostafa-saeed/Udacity-Catalog-Project path: /database_setup.py from sqlalchemy import create_engine from models.main import Base <|fim_suffix|>DB_SERVER = 'localhost' DB_USER = 'catalog' DB_NAME = 'catalog' DB_PASSWORD = '123' CONNECTION_STRING = 'postgresql+psycopg2://' + DB_USER + ':' + DB_PA...
code_fim
easy
{ "lang": "python", "repo": "mostafa-saeed/Udacity-Catalog-Project", "path": "/database_setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Compile the VPCurve into a display-list """ # This code is not OpenGL 3.1 compatible if self.pos.any(): dl = displaylist.DisplayList() #XXX should do sanity checks here... dl.start() try: pos = self.pos ...
code_fim
hard
{ "lang": "python", "repo": "alexus37/AugmentedRealityChess", "path": "/pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/browser/vpcurve.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> glEnable( GL_COLOR_MATERIAL ) try: glBegin( GL_LINE_STRIP ) try: lastColor = None for index in range(len(pos)): point = pos[index]...
code_fim
hard
{ "lang": "python", "repo": "alexus37/AugmentedRealityChess", "path": "/pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/browser/vpcurve.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>#Obtener tiempo del sistema strftime('%H:%M:%S') #Funciones que manipuen el tiempo def tic(): myClock['text'] = strftime('%H:%M:%S') tic() def tac(): tic() myClock.after(1000,tac) tac() root.mainloop()<|fim_prefix|># repo: jmongrio/DigitalClockpy path: /clock.py #!/usr/bin/env python3 # ...
code_fim
medium
{ "lang": "python", "repo": "jmongrio/DigitalClockpy", "path": "/clock.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmongrio/DigitalClockpy path: /clock.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- #Import essential modules from tkinter import * from time import strftime #Crear contenedor y titulo de ventana root = Tk() root.focus() root.resizable(0, 0) root.title("Digital Clock") root.iconbitmap("favic...
code_fim
hard
{ "lang": "python", "repo": "jmongrio/DigitalClockpy", "path": "/clock.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Mostrar algún texto ficticio en la pantalla myClock = Label(root, background='#fff', foreground="#808080") myClock['text'] = 'XX:XX:XX' myClock.grid(row=0, column=0) name = Label(root, background='#fff', foreground="#808080") name['text'] = 'By Jasón Mongrillo' name.place(relx = 1.0, rely = 0.0, anchor=...
code_fim
medium
{ "lang": "python", "repo": "jmongrio/DigitalClockpy", "path": "/clock.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for symbol in dir(target_scope): if symbol.startswith("_"): continue print(symbol)<|fim_prefix|># repo: notomo/dotfiles path: /vim/lua/thetto/handler/source/python/attribute.py import importlib import sys <|fim_middle|>target = sys.argv[1] if target == "": target_scope = globals()["_...
code_fim
medium
{ "lang": "python", "repo": "notomo/dotfiles", "path": "/vim/lua/thetto/handler/source/python/attribute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: notomo/dotfiles path: /vim/lua/thetto/handler/source/python/attribute.py import importlib import sys <|fim_suffix|>for symbol in dir(target_scope): if symbol.startswith("_"): continue print(symbol)<|fim_middle|>target = sys.argv[1] if target == "": target_scope = globals()["_...
code_fim
medium
{ "lang": "python", "repo": "notomo/dotfiles", "path": "/vim/lua/thetto/handler/source/python/attribute.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kobbyrythm/temperature_stories_django path: /.venv/lib/python3.7/site-packages/faker/providers/bank/ru_RU/__init__.py from .. import Provider as BankProvider class Provider(BankProvider): """Implement bank provider for ``ru_RU`` locale. Sources for region codes, currency codes, and ban...
code_fim
hard
{ "lang": "python", "repo": "kobbyrythm/temperature_stories_django", "path": "/.venv/lib/python3.7/site-packages/faker/providers/bank/ru_RU/__init__.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> BIC is a bank identification code that is used in Russia. See https://ru.wikipedia.org/wiki/Банковский_идентификационный_код. """ region = self.random_element(self.region_codes) department_code = self.numerify(self.random_element(self.department_code_formats)) ...
code_fim
hard
{ "lang": "python", "repo": "kobbyrythm/temperature_stories_django", "path": "/.venv/lib/python3.7/site-packages/faker/providers/bank/ru_RU/__init__.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: SundaresanN/psuite-upython path: /blynk-examples/p3_rlogger.py from Oled import oled from pblynk import Blynk import sntp, network b=Blynk() # rlogger rlctr = 0 def Tfunc(st): # write to (terminal style) rlogger at APP on vp 18 global rlctr rlctr = rlctr+1 b.virtual_...
code_fim
medium
{ "lang": "python", "repo": "SundaresanN/psuite-upython", "path": "/blynk-examples/p3_rlogger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>###################################################################################### # At APP: # make terminal widget on that V18, fill whole phone screen, # turn off its input box # now it is a live-time remote log display screen rpi->app with rlogger.write() # but server WONT indefinitely buffer m...
code_fim
medium
{ "lang": "python", "repo": "SundaresanN/psuite-upython", "path": "/blynk-examples/p3_rlogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def find(i, k, pre): # 当前为位数,当前找第几个数,前一个字符 letters = ['a', 'b', 'c'] if pre in letters: letters.remove(pre) # 从a,b,c 中移除,上一个字符。确保相邻元素不同 index = k // 2 ** (n - 1 - i) # 整除获得下标,依据下标取当前位的字符 k = k % 2 ** (n - 1 - i) # 余数,作为新的k...
code_fim
hard
{ "lang": "python", "repo": "yatengLG/leetcode-python", "path": "/question_bank/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> all a开头 b开头 c开头 1 3*2**(1-1) = 3*1 1 1 1 2 3*2**(2-1) = 3*2 2 2 2 3 3*2**(3-1) = 3*4 4 4 4 4 3*2**(4-1) = 3*8 8 8 8 10 3*...
code_fim
hard
{ "lang": "python", "repo": "yatengLG/leetcode-python", "path": "/question_bank/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yatengLG/leetcode-python path: /question_bank/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n.py # -*- coding: utf-8 -*- # @Author : LG """ 执行用时:224 ms, 在所有 Python3 提交中击败了19.92% 的用户 内存消耗:17 MB, 在所有 Python3 提交中击败了2...
code_fim
medium
{ "lang": "python", "repo": "yatengLG/leetcode-python", "path": "/question_bank/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: imankgoyal/cosypose path: /cosypose/datasets/wrappers/augmentation_wrapper.py from .base import SceneDatasetWrapper class AugmentationWrapper(SceneDatasetWrapper): def __init__(self, scene_ds, augmentation): <|fim_suffix|> rgb, mask, obs = data return self.augmentation(rgb, m...
code_fim
medium
{ "lang": "python", "repo": "imankgoyal/cosypose", "path": "/cosypose/datasets/wrappers/augmentation_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rgb, mask, obs = data return self.augmentation(rgb, mask, obs)<|fim_prefix|># repo: imankgoyal/cosypose path: /cosypose/datasets/wrappers/augmentation_wrapper.py from .base import SceneDatasetWrapper class AugmentationWrapper(SceneDatasetWrapper): <|fim_middle|> def __init__(self, sc...
code_fim
hard
{ "lang": "python", "repo": "imankgoyal/cosypose", "path": "/cosypose/datasets/wrappers/augmentation_wrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>region_of_image = image[ 500:700, 500:700 ] image[0:200, 0:200] = region_of_image cv2.imshow('Image', image) cv2.imshow('roi', region_of_image) cv2.waitKey(0) cv2.destroyAllWindows()<|fim_prefix|># repo: Golfyrs/ML.Study path: /IndirectlyRelated/OpenCV/image_operations.py import numpy as np import cv2 ...
code_fim
easy
{ "lang": "python", "repo": "Golfyrs/ML.Study", "path": "/IndirectlyRelated/OpenCV/image_operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Golfyrs/ML.Study path: /IndirectlyRelated/OpenCV/image_operations.py import numpy as np import cv2 image = cv2.imread('watch.jpg', cv2.IMREAD_COLOR) <|fim_suffix|>region_of_image = image[ 500:700, 500:700 ] image[0:200, 0:200] = region_of_image cv2.imshow('Image', image) cv2.imshow('roi', regi...
code_fim
medium
{ "lang": "python", "repo": "Golfyrs/ML.Study", "path": "/IndirectlyRelated/OpenCV/image_operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: petarmaric/friendly_name_mixin path: /tests.py from nose.tools import eq_ from friendly_name_mixin import FriendlyNameFromClassMixin <|fim_suffix|> eq_( IsHTML5BetterThanFlash11OrIsItMe().name, 'Is HTML5 Better Than Flash11 Or Is It Me' )<|fim_middle|>def test_frie...
code_fim
medium
{ "lang": "python", "repo": "petarmaric/friendly_name_mixin", "path": "/tests.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> answer = 'yes' eq_( IsHTML5BetterThanFlash11OrIsItMe().name, 'Is HTML5 Better Than Flash11 Or Is It Me' )<|fim_prefix|># repo: petarmaric/friendly_name_mixin path: /tests.py from nose.tools import eq_ from friendly_name_mixin import FriendlyNameFromClassMixin ...
code_fim
medium
{ "lang": "python", "repo": "petarmaric/friendly_name_mixin", "path": "/tests.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MartinBCN/CifarSolver path: /CifarClassifier/dashboard/tabs/tab_random_image.py import base64 import json import os from pathlib import Path import random import flask from PIL import Image import requests from dash.dependencies import Output, Input <|fim_suffix|> image_filename = f'{fn}' ...
code_fim
hard
{ "lang": "python", "repo": "MartinBCN/CifarSolver", "path": "/CifarClassifier/dashboard/tabs/tab_random_image.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image_filename = f'{fn}' encoded_image = base64.b64encode(open(image_filename, 'rb').read()) # Send image url = 'http://localhost:8000/predict' name_img = os.path.basename(fn) files = { 'file': (name_img, open(fn, 'rb').read(), "image/p...
code_fim
medium
{ "lang": "python", "repo": "MartinBCN/CifarSolver", "path": "/CifarClassifier/dashboard/tabs/tab_random_image.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Send image url = 'http://localhost:8000/predict' name_img = os.path.basename(fn) files = { 'file': (name_img, open(fn, 'rb').read(), "image/png") } with requests.Session() as s: r = s.post(url, files=files) likely_class...
code_fim
hard
{ "lang": "python", "repo": "MartinBCN/CifarSolver", "path": "/CifarClassifier/dashboard/tabs/tab_random_image.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aphearin/halotools path: /halotools/empirical_models/smhm_models/tests/test_zu_mandelbaum15.py """ """ from __future__ import division, print_function, absolute_import, unicode_literals import numpy as np from ...smhm_models import ZuMandelbaum15SmHm <|fim_suffix|> model = ZuMandelbaum15Sm...
code_fim
easy
{ "lang": "python", "repo": "aphearin/halotools", "path": "/halotools/empirical_models/smhm_models/tests/test_zu_mandelbaum15.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> __all__ = ('test_mc_scatter1', ) def test_mc_scatter1(): model = ZuMandelbaum15SmHm(redshift=0) sm = model.mc_stellar_mass(prim_haloprop=1e12)<|fim_prefix|># repo: aphearin/halotools path: /halotools/empirical_models/smhm_models/tests/test_zu_mandelbaum15.py """ """ from __future__ import divi...
code_fim
easy
{ "lang": "python", "repo": "aphearin/halotools", "path": "/halotools/empirical_models/smhm_models/tests/test_zu_mandelbaum15.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value<|fim_prefix|># repo: swederik/nipype path: /nipype/interfaces/mrtrix/tests/test_auto_FSL2MRTrix.py # AUTO-GENERATED by tools/checkspe...
code_fim
medium
{ "lang": "python", "repo": "swederik/nipype", "path": "/nipype/interfaces/mrtrix/tests/test_auto_FSL2MRTrix.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: swederik/nipype path: /nipype/interfaces/mrtrix/tests/test_auto_FSL2MRTrix.py # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from nipype.testing import assert_equal from nipype.interfaces.mrtrix.tensors import FSL2MRTrix def test_FSL2MRTrix_inputs(): input_map = dict(bval_file=dict(ma...
code_fim
medium
{ "lang": "python", "repo": "swederik/nipype", "path": "/nipype/interfaces/mrtrix/tests/test_auto_FSL2MRTrix.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> resp2 = requests.get( "{}/templates/get".format(notebook_server), params={"template": name} ) assert resp2.status_code == 200, resp.content data = resp2.json() assert data["name"] == name assert data["dirname"] == "/example-jupyter-notebooks.git" assert json.loads(data[...
code_fim
hard
{ "lang": "python", "repo": "AndersonReyes/jupyterlab_templates", "path": "/jupyterlab_templates/tests/test_git_repos.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dir = os.path.abspath( os.path.join(os.path.dirname(__file__), "..", "git-templates", name[1:]) ) assert data["path"] == dir<|fim_prefix|># repo: AndersonReyes/jupyterlab_templates path: /jupyterlab_templates/tests/test_git_repos.py import json import os import requests def test_se...
code_fim
hard
{ "lang": "python", "repo": "AndersonReyes/jupyterlab_templates", "path": "/jupyterlab_templates/tests/test_git_repos.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndersonReyes/jupyterlab_templates path: /jupyterlab_templates/tests/test_git_repos.py import json import os import requests def test_server_loaded_notebooks(notebook_server): name = "/example-jupyter-notebooks.git/01-MPI-monte-carlo-pi.ipynb" resp = requests.get( "{}/template...
code_fim
hard
{ "lang": "python", "repo": "AndersonReyes/jupyterlab_templates", "path": "/jupyterlab_templates/tests/test_git_repos.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbeckdorf/django-project-template-py3 path: /base/cron.py # django cron from django_cron import CronJobBase from django_cron import CronJobManager <|fim_suffix|> silent = False with CronJobManager(cls, silent) as manager: lock = manager.lock_class(cls, manager.silent)...
code_fim
medium
{ "lang": "python", "repo": "dbeckdorf/django-project-template-py3", "path": "/base/cron.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def release(cls): silent = False with CronJobManager(cls, silent) as manager: lock = manager.lock_class(cls, manager.silent) lock.release()<|fim_prefix|># repo: dbeckdorf/django-project-template-py3 path: /base/cron.py # django cron from djang...
code_fim
easy
{ "lang": "python", "repo": "dbeckdorf/django-project-template-py3", "path": "/base/cron.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def negedge(): global cycles cycles += 1 veri.force('tb.cycles',str(cycles)) if (cycles>1000): veri.finish() rst_n = veri.peek('tb.rst_n') if (rst_n!='1'): return if (cycles==30): veri.listing('tb','100','deep.list') if (cycles>30): for Mo...
code_fim
hard
{ "lang": "python", "repo": "greenblat/vlsistuff", "path": "/python-verilog/examples/firewall/tb/verilog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: greenblat/vlsistuff path: /python-verilog/examples/firewall/tb/verilog.py import os,sys,string,random import veri NewName = os.path.expanduser('~') sys.path.append('%s/verification_libs'%NewName) import logs Monitors=[] cycles=0 class driverMonitor: def __init__(self,Path,Monitors): ...
code_fim
hard
{ "lang": "python", "repo": "greenblat/vlsistuff", "path": "/python-verilog/examples/firewall/tb/verilog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hichamjanati/debiased-ot-barycenters path: /otbar/otbar/tests/test_barycenter.py import torch # import pytest from otbar import Distribution, Barycenter torch.set_default_tensor_type(torch.DoubleTensor) def test_barycenter(): # generate a distribution with three points mu_support = ...
code_fim
hard
{ "lang": "python", "repo": "hichamjanati/debiased-ot-barycenters", "path": "/otbar/otbar/tests/test_barycenter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Barycenter(nus, init_bary, support_budget=init_size + 2) # try: # bary.performFrankWolfe(4) # except Exception as msg: # if msg.args[0] != "You are using a 'virtual' argminGradient method. # This is doing nothing": # raise Exception('Error in testFW')<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "hichamjanati/debiased-ot-barycenters", "path": "/otbar/otbar/tests/test_barycenter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> bary = Barycenter([mu0, mu1, mu2], bary=bary_init) bary._computeSinkhorn() def test_FW(): sizes = [10, 20, 14] nus = [Distribution(torch.randn(s, 2), torch.rand(s, 1)).normalize() for s in sizes] init_size = 3 init_bary = Distribution(torch.randn(init_size, 2), ...
code_fim
hard
{ "lang": "python", "repo": "hichamjanati/debiased-ot-barycenters", "path": "/otbar/otbar/tests/test_barycenter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># The master toctree document. master_doc = 'index' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sph...
code_fim
medium
{ "lang": "python", "repo": "OpenCMISS/manage", "path": "/docs/conf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenCMISS/manage path: /docs/conf.py # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import shlex <|fim_suffix|># -- General configuration ------------------------------------------------ #cmake_min_version = '3.3' #ex...
code_fim
hard
{ "lang": "python", "repo": "OpenCMISS/manage", "path": "/docs/conf.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: djangoUnUnSharded/django-sharded path: /sharded/db/models/fields.py """ Copyright 2016 Vimal Aravindashan 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.apach...
code_fim
hard
{ "lang": "python", "repo": "djangoUnUnSharded/django-sharded", "path": "/sharded/db/models/fields.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass class SingleRelatedObjectDescriptorReturnsNone(fields.related.SingleRelatedObjectDescriptor): def __get__(self, instance, instance_type=None): try: return super(SingleRelatedObjectDescriptorReturnsNone, self).__get__(instance, instance_type=instance_type) except O...
code_fim
hard
{ "lang": "python", "repo": "djangoUnUnSharded/django-sharded", "path": "/sharded/db/models/fields.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }