text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> with self.driver.session("smoke/test_guid") as session: answer = session.execute_fetch("guid (%(rnd_name.0)s)") self.assertEqual(["fail", 404], answer[0][0:2]) def test_guid_with_recently_created_guid(self): with self.driver.session("smoke/test_guid") as sessio...
code_fim
medium
{ "lang": "python", "repo": "locaweb/leela", "path": "/try/src/try_leela/suites/smoke/test_guid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): self.driver = env.driver() def test_guid_without_know_name_must_produce_404(self): with self.driver.session("smoke/test_guid") as session: answer = session.execute_fetch("guid (%(rnd_name.0)s)") self.assertEqual(["fail", 404], answer[0][0:...
code_fim
medium
{ "lang": "python", "repo": "locaweb/leela", "path": "/try/src/try_leela/suites/smoke/test_guid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: locaweb/leela path: /try/src/try_leela/suites/smoke/test_guid.py # -*- coding: utf-8 -*- import uuid import unittest from try_leela import env from try_leela import helpers class TestGUID(unittest.TestCase): <|fim_suffix|> def test_guid_with_recently_created_guid(self): with self.dr...
code_fim
hard
{ "lang": "python", "repo": "locaweb/leela", "path": "/try/src/try_leela/suites/smoke/test_guid.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jdix531/stelligent-nu path: /04-vpcs/lab-4.1.8/cfn_generator.py import os # prevents bools showing up as strings os.environ['TROPO_REAL_BOOL']='true' from troposphere import Export, GetAtt, Ref, Template, Tags, Sub, Select, GetAZs, Parameter, Output, ImportValue import troposphere.ec2 as ec2 re...
code_fim
hard
{ "lang": "python", "repo": "jdix531/stelligent-nu", "path": "/04-vpcs/lab-4.1.8/cfn_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nat_gateway = template.add_resource( ec2.NatGateway( "MyNatGateway", AllocationId=GetAtt(ngw_elastic_ip, "AllocationId"), SubnetId=Ref(subnet), ) ) private_out_route=template.add_resource( ec2.Route( "privateOutRoute", ...
code_fim
hard
{ "lang": "python", "repo": "jdix531/stelligent-nu", "path": "/04-vpcs/lab-4.1.8/cfn_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Return True if the device is part of the given subsystem parent.""" udev_device: pyudev.Device = pyudev.Devices.from_sys_path( self._udev, str(device.sysfs) ) return udev_device.find_parent(subsystem.value) is not None def _import_devices(self) -> None: ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/supervisor", "path": "/supervisor/hardware/manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/supervisor path: /supervisor/hardware/manager.py """Hardware Manager of Supervisor.""" import logging from pathlib import Path import pyudev from ..coresys import CoreSys, CoreSysAttributes from ..exceptions import HardwareNotFound from .const import UdevSubsystem from .data impo...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/supervisor", "path": "/supervisor/hardware/manager.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def devices(self) -> list[Device]: """Return List of devices.""" return list(self._devices.values()) def get_by_path(self, device_node: Path) -> Device: """Get Device by path.""" for device in self.devices: if device_node in (device.path, ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/supervisor", "path": "/supervisor/hardware/manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update(self, state, action, next_state, reward): # print("reward %d" % reward) features = self.get_features(state, action) # for feature, value in features.items(): # print(feature + " " + str(self.weights[feature])) # print(value) # print("=...
code_fim
hard
{ "lang": "python", "repo": "Candlend/TetrisAI", "path": "/ai.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Candlend/TetrisAI path: /ai.py import random import util import pygame import copy import numpy as np import helper import math tetrominoes = ['s', 'z', 'j', 'l', 't', 'o', 'i', 'garbage', 'black'] test_flag = False # test or train L4_flag = True class Action: def __init__(self, tet): ...
code_fim
hard
{ "lang": "python", "repo": "Candlend/TetrisAI", "path": "/ai.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>IB", "ponIfIndex")) if mibBuilder.loadTexts: nmsIfAppPolicyEntry.setStatus('mandatory') nmsIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 9, 65, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nmsIfIndex.setStatus('mandatory') nmsIfDescr = MibTableColumn((1, 3, 6, 1, 4, 1,...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/NMS-IF-APP-POLICY-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/NMS-IF-APP-POLICY-MIB.py # # PySNMP MIB module NMS-IF-APP-POLICY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NMS-IF-APP-POLICY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:12:24 2019 # On host DAVW...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/NMS-IF-APP-POLICY-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NKPmedia/delira path: /delira/training/experiment.py ents. Implements: * Setup-Behavior for Models, Trainers and Predictors (depending on train and test case) * The K-Fold logic (including stratified and random splitting) * Argument Handling """ def __init__(...
code_fim
hard
{ "lang": "python", "repo": "NKPmedia/delira", "path": "/delira/training/experiment.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NKPmedia/delira path: /delira/training/experiment.py s given kwargs with ``self.kwargs`` If same argument is present in both kwargs, the one from the given kwargs will be used here Parameters ---------- kwargs : dict the given kwargs to merge w...
code_fim
hard
{ "lang": "python", "repo": "NKPmedia/delira", "path": "/delira/training/experiment.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> * :meth:`BaseExperiment.test` for the testing Notes ----- using stratified splits may be slow during split-calculation, since each item must be loaded once to obtain the labels necessary for stratification. """ ...
code_fim
hard
{ "lang": "python", "repo": "NKPmedia/delira", "path": "/delira/training/experiment.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: perrying/spinningup_in_pytorch path: /algos/ppo/core.py import torch import torch.nn as nn import torch.nn.functional as F import scipy.signal def discount_cumsum(x, discount): """ magic from rllab for computing discounted cumulative sums of vectors. input: vector x, ...
code_fim
hard
{ "lang": "python", "repo": "perrying/spinningup_in_pytorch", "path": "/algos/ppo/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def sampling_action(self, obs, with_likelihood=True): logits = self.policy(obs) action = torch.multinomial(logits.softmax(1), 1) if with_likelihood: logp_all = F.log_softmax(logits, 1) logp = (onehot(action[0], logp_all.shape[1]) * logp_all[0]).sum() ...
code_fim
hard
{ "lang": "python", "repo": "perrying/spinningup_in_pytorch", "path": "/algos/ppo/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bruno-gelb/coop_station path: /src/config.py import yaml class _Config(object): <|fim_suffix|> with open(r'config.yml') as file: config = yaml.load(file, Loader=yaml.FullLoader) self.games = config['games'] config = _Config()<|fim_middle|> def __init__(self):...
code_fim
easy
{ "lang": "python", "repo": "bruno-gelb/coop_station", "path": "/src/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(r'config.yml') as file: config = yaml.load(file, Loader=yaml.FullLoader) self.games = config['games'] config = _Config()<|fim_prefix|># repo: bruno-gelb/coop_station path: /src/config.py import yaml class _Config(object): <|fim_middle|> def __init__(self):...
code_fim
easy
{ "lang": "python", "repo": "bruno-gelb/coop_station", "path": "/src/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Loads the train test split indicators for a training run. """ with open(path) as f: train_test_split = json.load(f) return train_test_split<|fim_prefix|># repo: bombrake/neural_rock_typing path: /neural_rock/utils.py import json MEAN_TRAIN = [0.485, 0.456, 0.406] STD_TRA...
code_fim
medium
{ "lang": "python", "repo": "bombrake/neural_rock_typing", "path": "/neural_rock/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bombrake/neural_rock_typing path: /neural_rock/utils.py import json MEAN_TRAIN = [0.485, 0.456, 0.406] STD_TRAIN = [0.229, 0.224, 0.225] <|fim_suffix|> """ Loads the train test split indicators for a training run. """ with open(path) as f: train_test_split = json.load(f...
code_fim
medium
{ "lang": "python", "repo": "bombrake/neural_rock_typing", "path": "/neural_rock/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KellenNjoroge/keller-awards path: /awards/serializer.py from rest_framework import serializers from .models import * <|fim_suffix|> model = Profile exclude = [] class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ['username', ...
code_fim
medium
{ "lang": "python", "repo": "KellenNjoroge/keller-awards", "path": "/awards/serializer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ['username', 'email', ] class ProjectSerializer(serializers.ModelSerializer): class Meta: model = Project # exclude = ['image1','image2','image3','profile',] fields = ['pr...
code_fim
medium
{ "lang": "python", "repo": "KellenNjoroge/keller-awards", "path": "/awards/serializer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data: List[BarData] = [] if df is not None: for ix, row in df.iterrows(): date = datetime.strptime(row.trade_date, '%Y%m%d') date = CHINA_TZ.localize(date) if pd.isnull(row['open']): log.info(symbol + '.' + E...
code_fim
hard
{ "lang": "python", "repo": "hybliu/quant_share", "path": "/AShareDailyDataManager/TuShare.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cnt += 1 start = (simulate_end_date + timedelta(days=1)).strftime(TS_DATE_FORMATE) data: List[BarData] = [] if df is not None: for ix, row in df.iterrows(): date = datetime.strptime(row.trade_date, '%Y%m%d') date = CHINA...
code_fim
hard
{ "lang": "python", "repo": "hybliu/quant_share", "path": "/AShareDailyDataManager/TuShare.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hybliu/quant_share path: /AShareDailyDataManager/TuShare.py import requests import tushare as ts from tushare.pro import client from pytz import timezone from typing import List, Optional, Dict import pandas as pd from datetime import datetime, timedelta import time import traceback from vnpy.tr...
code_fim
hard
{ "lang": "python", "repo": "hybliu/quant_share", "path": "/AShareDailyDataManager/TuShare.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>efault_runtime.py' ] work_dir = './work_dirs/plant_mrcnn'<|fim_prefix|># repo: jireh-father/mmdetection_210507 path: /configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_custom.py _base_ = [ '../_base_/models/mask_rcnn_r50_fpn_custo<|fim_middle|>m.py', '../_base_/datasets/coco_detection_custom.py', '...
code_fim
medium
{ "lang": "python", "repo": "jireh-father/mmdetection_210507", "path": "/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_custom.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jireh-father/mmdetection_210507 path: /configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_custom.py _base_ = [ '../_base_/models/mask_rcnn_r50_fpn_custom.py', '../_base_/datasets/coco_detection_custom.py'<|fim_suffix|>efault_runtime.py' ] work_dir = './work_dirs/plant_mrcnn'<|fim_middle|>, '...
code_fim
easy
{ "lang": "python", "repo": "jireh-father/mmdetection_210507", "path": "/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_custom.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.api_token = api_token def get_entries(self, start_date: datetime, end_date: datetime = datetime.now()): start_date_str = start_date.strftime(TOGGL_TIME_FORMAT) end_date_str = end_date.strftime(TOGGL_TIME_FORMAT) response = requests.get(TOGGL_...
code_fim
hard
{ "lang": "python", "repo": "oshev/focus-balancer", "path": "/focus_balancer/toggl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oshev/focus-balancer path: /focus_balancer/toggl.py import json from datetime import datetime import requests TOGGL_URL_TEMPLATE = "https://www.toggl.com/api/v8/time_entries?start_date={}&end_date={}" TOGGL_TIME_FORMAT = "%Y-%m-%dT%H:%M:00Z" TOGGL_ENTRY_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S+00:00" ...
code_fim
hard
{ "lang": "python", "repo": "oshev/focus-balancer", "path": "/focus_balancer/toggl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> start_date_str = start_date.strftime(TOGGL_TIME_FORMAT) end_date_str = end_date.strftime(TOGGL_TIME_FORMAT) response = requests.get(TOGGL_URL_TEMPLATE.format(start_date_str, end_date_str), auth=(self.api_token, 'api_token')) if response.sta...
code_fim
hard
{ "lang": "python", "repo": "oshev/focus-balancer", "path": "/focus_balancer/toggl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #print(existing_reverse) #print(needed_reverse) #print(module_signatures) split_name = file_name.split(".") new_file_name = ".".join(split_name[:-3] + [split_name[-2]+"_reverse_insert"] + split_name[-1:]) new_file_obj = open(new_file_name, "w+") for module in needed_reverse: new_name = s...
code_fim
hard
{ "lang": "python", "repo": "AndrewLitteken/ScaffCC", "path": "/scaffold/insert_reverse.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndrewLitteken/ScaffCC path: /scaffold/insert_reverse.py import sys import re import mmap if __name__ == "__main__": if len(sys.argv) < 2: print("Must provide a filename as an argument") exit(1) file_name = sys.argv[1] <|fim_suffix|> #print(existing_reverse) #print(needed_reverse...
code_fim
hard
{ "lang": "python", "repo": "AndrewLitteken/ScaffCC", "path": "/scaffold/insert_reverse.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: XKNX/xknx path: /xknx/remote_value/remote_value_climate_mode.py """ Module for managing an climate mode remote values. DPT . """ from __future__ import annotations from abc import abstractmethod from enum import Enum from typing import TYPE_CHECKING, Any, Optional from xknx.dpt import ( DP...
code_fim
hard
{ "lang": "python", "repo": "XKNX/xknx", "path": "/xknx/remote_value/remote_value_climate_mode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Convert value to payload.""" return self._climate_mode_transcoder.to_knx(value) def from_knx(self, payload: DPTArray | DPTBinary) -> HVACOperationMode | None: """Convert current payload to value.""" return self._climate_mode_transcoder.from_knx(payload) class Remo...
code_fim
hard
{ "lang": "python", "repo": "XKNX/xknx", "path": "/xknx/remote_value/remote_value_climate_mode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': # 公告按照时间段分类,有些为隐藏公告 urlbase = "http://www.zjtobacco.com/np_file/files/release/content/" '''urllist:用于存放构造的所有需要测试的链接 monthlist:用于存放构造链接时使用的时间 rangelist:用于存放构造链接时每个时间内的文章上下限''' urllist = [] monthlist = [201904, 201905] rangelist = [107101, 107681, ...
code_fim
hard
{ "lang": "python", "repo": "jklf5/Spider", "path": "/getzjtobaccoSpecifiedNews/test(多线程测试).py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # str1 = "http://www.zjtobacco.com/np_file/files/release/content/202003/113228.html" # print(str1[-18:-12]) # p = Pool(4) for month_list in urllist: # func_var = [(month_list, None)] # f_error = open('./error_test.txt', 'a+', encoding='utf-8') # print(argslist) ...
code_fim
hard
{ "lang": "python", "repo": "jklf5/Spider", "path": "/getzjtobaccoSpecifiedNews/test(多线程测试).py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jklf5/Spider path: /getzjtobaccoSpecifiedNews/test(多线程测试).py import requests from pyquery import PyQuery as pq import threading import threadpool from multiprocessing import Pool from multiprocessing import Process def get_proxies(): '''代理服务器,动态版''' proxyHost = "http-dyn.abuyun.com" ...
code_fim
hard
{ "lang": "python", "repo": "jklf5/Spider", "path": "/getzjtobaccoSpecifiedNews/test(多线程测试).py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c1 = 0 c2 = 0 for line in open(sys.argv[1]).readlines(): if nice1(line): c1 += 1 if nice2(line): c2 += 1 print(c1) print(c2)<|fim_prefix|># repo: rboulton/adventofcode path: /2015/day5.py import sys import re def nice1(s): if not re.search(r'[aeiou].*[aeiou].*[aeiou]', s): ...
code_fim
medium
{ "lang": "python", "repo": "rboulton/adventofcode", "path": "/2015/day5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rboulton/adventofcode path: /2015/day5.py import sys import re def nice1(s): if not re.search(r'[aeiou].*[aeiou].*[aeiou]', s): return False if not re.search(r'([a-z])\1', s): return False if re.search(r'ab|cd|pq|xy', s): return False return True def nice...
code_fim
medium
{ "lang": "python", "repo": "rboulton/adventofcode", "path": "/2015/day5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zabir-nabil/fast-wavenet-mel2wav path: /wavenet/layers.py import numpy as np import tensorflow as tf def time_to_batch(inputs, rate): '''If necessary zero-pads inputs and reshape by rate. Used to perform 1D dilated convolution. Args: inputs: (tensor) rate: (in...
code_fim
hard
{ "lang": "python", "repo": "zabir-nabil/fast-wavenet-mel2wav", "path": "/wavenet/layers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def conv1d(inputs, out_channels, filter_width=2, stride=1, padding='VALID', data_format='NHWC', gain=np.sqrt(2), activation=tf.nn.relu, bias=False): '''One dimension convolution helper function. Sets varia...
code_fim
hard
{ "lang": "python", "repo": "zabir-nabil/fast-wavenet-mel2wav", "path": "/wavenet/layers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hanifgunawan/pyproc path: /tests/test_lpse.py import unittest import re import csv import os import pyproc.utils from pyproc import Lpse from pyproc.exceptions import LpseHostExceptions, LpseServerExceptions class TestLpse(unittest.TestCase): def setUp(self): self.lpse = Lpse('lpse...
code_fim
hard
{ "lang": "python", "repo": "hanifgunawan/pyproc", "path": "/tests/test_lpse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_paket_non_tender(self): paket = self.lpse.get_paket_non_tender(length=5) self.assertEqual(len(paket['data']), 5) def test_get_detil_pengumuman_non_tender(self): detil = self.lpse.detil_paket_non_tender(self.id_non_tender_for_testing) detil.get_pengumu...
code_fim
hard
{ "lang": "python", "repo": "hanifgunawan/pyproc", "path": "/tests/test_lpse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_hasil_evaluasi_npwp_nama_split(self): with open( os.path.join( os.path.dirname(os.path.realpath(__file__)), 'supporting_files', 'hasil_evaluasi_nama_npwp_test.txt' ) ) as f: f.readline() ...
code_fim
hard
{ "lang": "python", "repo": "hanifgunawan/pyproc", "path": "/tests/test_lpse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#this loops through each legislator one by one, scraping her data and importing it to her tab of the google sheet for sheet in allsheets: #get the name of the tab, assign that as the legislator's name legislator = sheetnames[x] chamber = sheet.get_value('E2') if sheet.get_value('E2'): scrape_i...
code_fim
hard
{ "lang": "python", "repo": "cdkirsch/Emerge-Alumnae-Scrapers", "path": "/arizona-scraper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdkirsch/Emerge-Alumnae-Scrapers path: /arizona-scraper.py #this code scrapes bill data for Arizona alumnae using Python, Selenium, and BeautifulSoup #then imports it to Google Sheets using Pygsheets #last updated 07/30/2019 by Camille Kirsch, communications intern from selenium import webdr...
code_fim
hard
{ "lang": "python", "repo": "cdkirsch/Emerge-Alumnae-Scrapers", "path": "/arizona-scraper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #update the Google sheet with df, starting at first row of latest session (existing session) #or at the first empty cell (new session). row = next_available_row(sheet) allsessions = sheet.get_values('A1','A'+str(row), returnas='cell', include_tailing_empty_rows = False) latestsession = allsessio...
code_fim
hard
{ "lang": "python", "repo": "cdkirsch/Emerge-Alumnae-Scrapers", "path": "/arizona-scraper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pulumi.set(self, "module_name", value) class EndpointAclPolicy(pulumi.CustomResource): @overload def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, description: Optional[pulumi.Input[str]] = None, ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/cr/endpoint_acl_policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-alicloud path: /sdk/python/pulumi_alicloud/cr/endpoint_acl_policy.py __self__, *, endpoint_type: pulumi.Input[str], entry: pulumi.Input[str], instance_id: pulumi.Input[str], description: Optional[pulumi.Input[str]] ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/cr/endpoint_acl_policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-alicloud path: /sdk/python/pulumi_alicloud/cr/endpoint_acl_policy.py ['EndpointAclPolicyArgs', 'EndpointAclPolicy'] @pulumi.input_type class EndpointAclPolicyArgs: def __init__(__self__, *, endpoint_type: pulumi.Input[str], entry: pulumi.Input[...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/cr/endpoint_acl_policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Faisalsouz/PAN_OCR path: /Test_perd/model_run.py from wand.image import Image as wi import os from pprint import pprint from typing import Tuple,List,Type,TypeVar from Test_perd.recog_main import * import psycopg2 from Test_perd.config import * import pandas as pd from postal.parser import parse...
code_fim
hard
{ "lang": "python", "repo": "Faisalsouz/PAN_OCR", "path": "/Test_perd/model_run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.rename('./predictions.jpg', './predictions' + str(index) + '.jpg') supper_dict.append(m1) # supper_dict['pageNo'].append(index) # for k,v in dict.items(): # supper_dict[k].append(v) # print('combining page data into json') #json_dic=json.dump...
code_fim
hard
{ "lang": "python", "repo": "Faisalsouz/PAN_OCR", "path": "/Test_perd/model_run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ```sh $ pulumi import alicloud:ga/customRoutingEndpointTrafficPolicy:CustomRoutingEndpointTrafficPolicy example <endpoint_id>:<custom_routing_endpoint_traffic_policy_id> ``` :param str resource_name: The name of the resource. :param CustomRoutingEndpointTrafficPol...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/ga/custom_routing_endpoint_traffic_policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resource_name: str, args: CustomRoutingEndpointTrafficPolicyArgs, opts: Optional[pulumi.ResourceOptions] = None): """ Provides a Global Accelerator (GA) Custom Routing Endpoint Traffic Policy resource. For information about Global...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/ga/custom_routing_endpoint_traffic_policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-alicloud path: /sdk/python/pulumi_alicloud/ga/custom_routing_endpoint_traffic_policy.py y. """ if accelerator_id is not None: pulumi.set(__self__, "accelerator_id", accelerator_id) if address is not None: pulumi.set(__self__, "address"...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/ga/custom_routing_endpoint_traffic_policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: junjun-zhang/workflow-execution-service-schemas path: /python/ga4gh/wes/controllers.py """ Controllers for the workflow execution service """ DEFAULT_PAGE_SIZE = 100 <|fim_suffix|> def GetWorkflowStatus(**kwargs): return {}<|fim_middle|> def GetWorkflowLog(**kwargs): return {} def Can...
code_fim
hard
{ "lang": "python", "repo": "junjun-zhang/workflow-execution-service-schemas", "path": "/python/ga4gh/wes/controllers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def RunWorkflow(**kwargs): return {} def GetWorkflowStatus(**kwargs): return {}<|fim_prefix|># repo: junjun-zhang/workflow-execution-service-schemas path: /python/ga4gh/wes/controllers.py """ Controllers for the workflow execution service """ DEFAULT_PAGE_SIZE = 100 def GetWorkflowLog(**kwa...
code_fim
medium
{ "lang": "python", "repo": "junjun-zhang/workflow-execution-service-schemas", "path": "/python/ga4gh/wes/controllers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>v("RDS_HOSTNAME") + ":" + os.getenv("RDS_PORT") + "/" + os.getenv("RDS_DB_NAME") ) DATABASE_URL = rds_db_string else: DATABASE_URL = os.getenv("DATABASE_URL")<|fim_prefix|># repo: SeaWar741/ITC path: /MLH/CursoAWS/config.py import os from dotenv import...
code_fim
hard
{ "lang": "python", "repo": "SeaWar741/ITC", "path": "/MLH/CursoAWS/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SeaWar741/ITC path: /MLH/CursoAWS/config.py import os from dotenv import load_dotenv load_dotenv() FLASK_APP_SECRET_KEY = os.getenv("FLASK_APP_SECRET_KEY") EVENTBRITE_AUTH_TOKEN = os.getenv("EVENTBRITE_AUTH_TOKEN") # Reads the database config injected by AWS Elastic Beanstalk if "RDS_...
code_fim
hard
{ "lang": "python", "repo": "SeaWar741/ITC", "path": "/MLH/CursoAWS/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiaming-wang/N_SR path: /data/data.py #!/usr/bin/env python # coding=utf-8 ''' @Author: wjm @Date: 2020-02-16 19:22:41 LastEditTime: 2021-11-29 11:13:35 @Description: file content ''' from os.path import join from torchvision.transforms import Compose, ToTensor from .dataset import Data, Data_tes...
code_fim
hard
{ "lang": "python", "repo": "jiaming-wang/N_SR", "path": "/data/data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super(DatasetFromHdf5, self).__init__() hf = h5py.File(file_path) self.data = numpy.array(hf.get('data')) self.target = numpy.array(hf.get('label')) # self.data = numpy.transpose(self.data, (0, 3, 1, 2)) # self.target = numpy.transpose(self.target, (0, 3, 1,...
code_fim
medium
{ "lang": "python", "repo": "jiaming-wang/N_SR", "path": "/data/data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if stream == False: sys.stdout.write(lines) sys.stdout.flush() startdt = datetime.strptime(start[0:10], '%Y-%m-%d') stopdt = datetime.strptime(stop[0:10], '%Y-%m-%d') date = startdt while date <= stopdt: file_date = date.strftime('%Y-%m-%d') file_url = ROOT + f'log/{args["dataset"]}/log/{fi...
code_fim
hard
{ "lang": "python", "repo": "hapi-server/server-nodejs", "path": "/bin/URLWatcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hapi-server/server-nodejs path: /bin/URLWatcher.py import re import os import sys import urllib3 import argparse from datetime import datetime, timedelta http = urllib3.PoolManager() # If stream = True, each line is written as processed. # If False, lines from each file are accumulated then # w...
code_fim
hard
{ "lang": "python", "repo": "hapi-server/server-nodejs", "path": "/bin/URLWatcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iridium-soda/Searchable-Encryption-Demos path: /Source/Server.py ''' Author: I-Hsien Date: 2021-01-27 21:55:57 LastEditTime: 2021-05-09 12:23:12 LastEditors: I-Hsien Description: Another Isolated Program, act as server. FilePath: \Searchable-Encryption-Demos\SWP Solution\Server.py Comments: Also ...
code_fim
hard
{ "lang": "python", "repo": "iridium-soda/Searchable-Encryption-Demos", "path": "/Source/Server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' description: 服务器端的事务分发接口 param {Sock,data:dict} return {*} data: { "type":"upload/query/test", "filename":"filename", "content":"....",//用空格分词 "query":".....",//(x,k) "test":1+2//使用eval()检验 } ''' log.log.debug("Received reques...
code_fim
hard
{ "lang": "python", "repo": "iridium-soda/Searchable-Encryption-Demos", "path": "/Source/Server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@staticmethod def __formatRegisterFormat( arg1, arg2 ) : if isinstance( arg1, GafferImage.Format ) : # Old ordering of arguments. format = arg1 name = arg2 else : name = arg1 format = arg2 return GafferImage.Format.__originalRegisterFormat( name, __convertFormat( format ) ) def __scriptNod...
code_fim
hard
{ "lang": "python", "repo": "mcanthony/gaffer", "path": "/startup/GafferImage/formatCompatibility.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcanthony/gaffer path: /startup/GafferImage/formatCompatibility.py ########################################################################## # # Copyright (c) 2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modificat...
code_fim
hard
{ "lang": "python", "repo": "mcanthony/gaffer", "path": "/startup/GafferImage/formatCompatibility.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> :param data_dir: Location of the CORD pre-processed data :return: True """ print("Hello world, goodbye COVID") print("Input data_dir: {}".format(data_dir)) return True<|fim_prefix|># repo: itsmemala/task-vt path: /utils/data_utils.py # import os def load_preprocessed_cord_from_dir(data_dir): <|f...
code_fim
medium
{ "lang": "python", "repo": "itsmemala/task-vt", "path": "/utils/data_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: itsmemala/task-vt path: /utils/data_utils.py # import os def load_preprocessed_cord_from_dir(data_dir): """ This function currently isn't useful and serves as a template. Eventually this function will load CORD data from the data_dir. This serves as an example of good docstrings. <|fim_suff...
code_fim
medium
{ "lang": "python", "repo": "itsmemala/task-vt", "path": "/utils/data_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not c_mgr: # For now we treat a eval timeout the same way as e.g. NaN exceptions. fitness_values = (-float("inf"), start_datetime, timeout, pipeline_length) logger.info('Timeout encountered while evaluating pipeline.') single_line_pipeline = ''.join(str(pl).split('\...
code_fim
hard
{ "lang": "python", "repo": "joaquinvanschoren/gama", "path": "/gama/ea/evaluation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def object_is_valid_pipeline(o): """ Determines if object behaves like a valid scikit-learn pipeline (it must have `fit`, `predict` and `steps`). """ return (o is not None and hasattr(o, 'fit') and hasattr(o, 'predict') and hasattr(o, 'steps')) def evaluate_pi...
code_fim
hard
{ "lang": "python", "repo": "joaquinvanschoren/gama", "path": "/gama/ea/evaluation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: joaquinvanschoren/gama path: /gama/ea/evaluation.py from datetime import datetime import os import pickle import time import uuid import stopit from sklearn.model_selection import cross_val_predict from gama.ea.automl_gp import log from gama.ea.metrics import Metric from gama.utilities.logging_...
code_fim
hard
{ "lang": "python", "repo": "joaquinvanschoren/gama", "path": "/gama/ea/evaluation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: simon-zozol/Anti-Viral-Protocol path: /anti_viral_protocol/guns.py import os import pygame from . import shells from .items import Weapons # Setting up the mixer for sounds pygame.mixer.init() # Working file paths BASE_PATH = os.path.dirname(__file__) RES_PATH = os.path.join(BASE_PATH, 'resourc...
code_fim
hard
{ "lang": "python", "repo": "simon-zozol/Anti-Viral-Protocol", "path": "/anti_viral_protocol/guns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # rocket-Launcher class RocketLauncher(Weapons): ammo_limit = 50 ammo_count = 50 hold_limit = 5 on_load = 5 cooldown_max = 60 ammo = shells.RPGShells explode_img = pygame.image.load(RES_PATH + "/Images/Projectiles/explosion.png") explode_sound = pygame.mixer.Sound(RES_PATH...
code_fim
hard
{ "lang": "python", "repo": "simon-zozol/Anti-Viral-Protocol", "path": "/anti_viral_protocol/guns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smartheating/FieldGateway path: /tests/test_data/test_sensor_1.py from module import Sensor from statistics import mean from random import random <|fim_suffix|> self.param_1 = params['param_1'] self.param_2 = params['param_2'] def get_data(self) -> dict: self.count +...
code_fim
medium
{ "lang": "python", "repo": "smartheating/FieldGateway", "path": "/tests/test_data/test_sensor_1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.param_1 = params['param_1'] self.param_2 = params['param_2'] def get_data(self) -> dict: self.count += 1 print('get data was called {} times'.format(self.count)) val1 = [] val2 = [] for _ in range(self.get_number_of_reads_per_send_interval(...
code_fim
medium
{ "lang": "python", "repo": "smartheating/FieldGateway", "path": "/tests/test_data/test_sensor_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif direction == "D": t.right(45) t.color("dark blue") t.width(3) t.forward(17) #try changing this<|fim_prefix|># repo: KevinBoxuGao/ICS3UI path: /Unit 3/Lesson2-3/lesson 3/ring.py import turtle t = turtle.Pen() t.speed(0) t.width(4) for y in ran...
code_fim
hard
{ "lang": "python", "repo": "KevinBoxuGao/ICS3UI", "path": "/Unit 3/Lesson2-3/lesson 3/ring.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KevinBoxuGao/ICS3UI path: /Unit 3/Lesson2-3/lesson 3/ring.py import turtle t = turtle.Pen() t.speed(0) t.width(4) for y in range(100): for direction in "LRDDRLDRLDRLDL": #try changing this <|fim_suffix|> elif direction == "D": t.right(45) t.color("dar...
code_fim
hard
{ "lang": "python", "repo": "KevinBoxuGao/ICS3UI", "path": "/Unit 3/Lesson2-3/lesson 3/ring.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: darikg/robust-laplacians-py path: /src/robust_laplacian/core.py import numpy as np import robust_laplacian_bindings as rlb def mesh_laplacian(verts, faces, mollify_factor=1e-5): ## Validate input if type(verts) is not np.ndarray: raise ValueError("`verts` should be a numpy arra...
code_fim
hard
{ "lang": "python", "repo": "darikg/robust-laplacians-py", "path": "/src/robust_laplacian/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ## Return the result return L, M def point_cloud_laplacian(points, mollify_factor=1e-5, n_neighbors=30): ## Validate input if type(points) is not np.ndarray: raise ValueError("`points` should be a numpy array") if (len(points.shape) != 2) or (points.shape[1] != 3): ra...
code_fim
medium
{ "lang": "python", "repo": "darikg/robust-laplacians-py", "path": "/src/robust_laplacian/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: violet-love/quake-ds path: /QuakeAPI/app.py from flask import Flask, jsonify from .USGSetl import * def create_app(): app = Flask(__name__) @app.route('/') def home(): return jsonify({'status_code': 200, 'message': 'success, the flask API is running'...
code_fim
hard
{ "lang": "python", "repo": "violet-love/quake-ds", "path": "/QuakeAPI/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/test') def testRoute(): response = query_one('SELECT * FROM USGS where time=1582252014390') return jsonify(response) @app.route('/history/<lat>,<lon>,<dist>') def history(lat, lon, dist): # oof I just googled it and this is gonna be rough pass ...
code_fim
hard
{ "lang": "python", "repo": "violet-love/quake-ds", "path": "/QuakeAPI/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fast = signal['params']['fastperiod'] slow = signal['params']['slowperiod'] mavg = signal['params']['signalperiod'] macd, macdsignal, _ = talib.MACD(prices['close'], fast, slow, mavg) signal['data'] = np.hstack( [macd.to_numpy()[:, None], macdsignal.to_numpy()[:, Non...
code_fim
hard
{ "lang": "python", "repo": "machar94/stockprediction", "path": "/indicators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: machar94/stockprediction path: /indicators.py import os import talib import warnings import pmdarima as pm import numpy as np import pandas as pd from matplotlib import pyplot as plt from pmdarima import auto_arima from functools import wraps from os.path import isfile, join from tqdm.notebook i...
code_fim
hard
{ "lang": "python", "repo": "machar94/stockprediction", "path": "/indicators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @plotSignal @useFile def arima_sma(prices, signal, name): """ ARIMA on Simple Moving Average """ sma_window = signal['params']['sma_window'] sma_close = talib.SMA(prices['close'], sma_window).to_numpy()[:, None] signal['data'] = arima(sma_close, signal['params']['arima_window'], ...
code_fim
hard
{ "lang": "python", "repo": "machar94/stockprediction", "path": "/indicators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for ent in self.TimeSeries: if ent['Time'] == ti: return ent return None @property def Observations(self): dat = pd.DataFrame(self.TimeSeries) dat = dat.set_index('Time') dat = dat.fillna(0) return dat @property ...
code_fim
hard
{ "lang": "python", "repo": "CxModelling/PyComplexism", "path": "/complexism/mcore/observer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CxModelling/PyComplexism path: /complexism/mcore/observer.py import pandas as pd from abc import ABCMeta, abstractmethod from collections import OrderedDict __author__ = 'TimeWz667' class Observer(metaclass=ABCMeta): def __init__(self, ext=True): self.Last = OrderedDict() se...
code_fim
hard
{ "lang": "python", "repo": "CxModelling/PyComplexism", "path": "/complexism/mcore/observer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def observe_routinely(self, model, ti): self.read_statics(model, self.Last, ti) self.update_dynamic_observations(model, self.Flow, ti) def update_at_mid_term(self, model, ti): if self.ExtMid: self.read_statics(model, self.Mid, ti) def push_observations(sel...
code_fim
hard
{ "lang": "python", "repo": "CxModelling/PyComplexism", "path": "/complexism/mcore/observer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: user = mySession.query(User).filter_by(email=email).one() return user.id except: return None<|fim_prefix|># repo: kingdivine/planet-food path: /catalog/helpers.py from database_setup import Base, User from sqlalchemy import create_engine from sqlalchemy.orm import ses...
code_fim
medium
{ "lang": "python", "repo": "kingdivine/planet-food", "path": "/catalog/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kingdivine/planet-food path: /catalog/helpers.py from database_setup import Base, User from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker myEngine = create_engine('sqlite:///restaurant.db') Base.metadata.bind = myEngine <|fim_suffix|> def getUserID(email): try: ...
code_fim
hard
{ "lang": "python", "repo": "kingdivine/planet-food", "path": "/catalog/helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def getUserID(email): try: user = mySession.query(User).filter_by(email=email).one() return user.id except: return None<|fim_prefix|># repo: kingdivine/planet-food path: /catalog/helpers.py from database_setup import Base, User from sqlalchemy import create_engine from sq...
code_fim
medium
{ "lang": "python", "repo": "kingdivine/planet-food", "path": "/catalog/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ertancan/django-coinbase path: /coinbase/urls.py from django.conf.urls import url from view<|fim_suffix|>ack, name="coinbase_order_callback") ]<|fim_middle|>s import handle_order_callback urlpatterns = [ url(r"^cb/$", handle_order_callb
code_fim
medium
{ "lang": "python", "repo": "ertancan/django-coinbase", "path": "/coinbase/urls.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ack, name="coinbase_order_callback") ]<|fim_prefix|># repo: ertancan/django-coinbase path: /coinbase/urls.py from django.conf.urls import url from views import handle_order_callback urlpattern<|fim_middle|>s = [ url(r"^cb/$", handle_order_callb
code_fim
easy
{ "lang": "python", "repo": "ertancan/django-coinbase", "path": "/coinbase/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>s = [ url(r"^cb/$", handle_order_callback, name="coinbase_order_callback") ]<|fim_prefix|># repo: ertancan/django-coinbase path: /coinbase/urls.py from django.conf.urls import url from view<|fim_middle|>s import handle_order_callback urlpattern
code_fim
easy
{ "lang": "python", "repo": "ertancan/django-coinbase", "path": "/coinbase/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nzlosh/st2-rbac-backend path: /tests/unit/controllers/api/v1/test_actions_rbac.py # Copyright 2020 The StackStorm Authors. # Copyright (C) 2020 Extreme Networks, Inc - All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in com...
code_fim
hard
{ "lang": "python", "repo": "nzlosh/st2-rbac-backend", "path": "/tests/unit/controllers/api/v1/test_actions_rbac.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Role assignments user_db = self.users['action_create'] role_assignment_db = UserRoleAssignmentDB( user=user_db.name, role=self.roles['action_create'].name, source='assignments/%s.yaml' % user_db.name) UserRoleAssignment.add_or_update(ro...
code_fim
hard
{ "lang": "python", "repo": "nzlosh/st2-rbac-backend", "path": "/tests/unit/controllers/api/v1/test_actions_rbac.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # non-admin user, should return permission error user_db = self.users['observer'] self.use_user(user_db) resp = self.app.get('/v1/actions?limit=-1', expect_errors=True) expected_msg = ('Administrator access required to be able to specify limit=-1 and ' ...
code_fim
hard
{ "lang": "python", "repo": "nzlosh/st2-rbac-backend", "path": "/tests/unit/controllers/api/v1/test_actions_rbac.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>else: with open(outpath, 'w') as f: f.write('There was at least one failure.') f.write('\n') v.to_frame().to_csv(outpath) if os.path.exists(outpath): print('Written %s successfully.' % outpath) sys.exit(0) else: print('Failed to write %s.' % outpath, file=sys.stder...
code_fim
medium
{ "lang": "python", "repo": "c74p/Capstone-SalesForecasting", "path": "/tests/constraints/verify_constraints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c74p/Capstone-SalesForecasting path: /tests/constraints/verify_constraints.py import os import pandas as pd import sys from tdda.constraints.pd.constraints import verify_df inpath = '../data/processed/wrangled_dataframe.csv' constraint_path = ''.join(['../data/interim/constraints_initial_csvs/'...
code_fim
hard
{ "lang": "python", "repo": "c74p/Capstone-SalesForecasting", "path": "/tests/constraints/verify_constraints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }