text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: indigos33k3r/KivyMD path: /kivymd/card.py # -*- coding: utf-8 -*- from kivy.lang import Builder from kivy.properties import BoundedNumericProperty, ReferenceListProperty from kivy.uix.boxlayout import BoxLayout from kivymd.elevationbehaviour import ElevationBehaviour from kivymd.theming import Th...
code_fim
medium
{ "lang": "python", "repo": "indigos33k3r/KivyMD", "path": "/kivymd/card.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r = BoundedNumericProperty(1., min=0., max=1.) g = BoundedNumericProperty(1., min=0., max=1.) b = BoundedNumericProperty(1., min=0., max=1.) a = BoundedNumericProperty(0., min=0., max=1.) background_color = ReferenceListProperty(r, g, b, a)<|fim_prefix|># repo: indigos33k3r/KivyMD path: /kivymd/car...
code_fim
medium
{ "lang": "python", "repo": "indigos33k3r/KivyMD", "path": "/kivymd/card.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(self, fd): # pylint:disable=arguments-differ #additional code trace_data = ("close", {"fd": (fd, fd.symbolic)}) try: self.state.procedure_data.global_variables["trace"].append(trace_data) except KeyError: self.state.procedure_data.global_v...
code_fim
medium
{ "lang": "python", "repo": "Agnishom/SummerTrace", "path": "/libc___so___6/close.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Agnishom/SummerTrace path: /libc___so___6/close.py import simuvex ###################################### # close ###################################### class close(simuvex.SimProcedure): <|fim_suffix|> self.state.posix.close(fd) return self.state.se.BVV(0, self.state.arch.bits)<...
code_fim
hard
{ "lang": "python", "repo": "Agnishom/SummerTrace", "path": "/libc___so___6/close.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.state.posix.close(fd) return self.state.se.BVV(0, self.state.arch.bits)<|fim_prefix|># repo: Agnishom/SummerTrace path: /libc___so___6/close.py import simuvex ###################################### # close ###################################### <|fim_middle|>class close(simuvex.Si...
code_fim
hard
{ "lang": "python", "repo": "Agnishom/SummerTrace", "path": "/libc___so___6/close.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ipatrol/pineapple path: /plugins/Exhentai.py import requests import re import discord from util import Events import html # TODO: (feature) also get the Information about single pages # API-URL and type of headers sent by POST-request api_url = "https://api.e-hentai.org/api.php" json_request_he...
code_fim
hard
{ "lang": "python", "repo": "ipatrol/pineapple", "path": "/plugins/Exhentai.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '{"method": "gdata","gidlist": [[' + gallery_id + ',"' + gallery_token + '"]],"namespace": 1}' @staticmethod def build_title_string(json_data): return '**Title:** ' + (html.unescape(json_data['gmetadata'][0]['title'])) @staticmethod def build_title_jpn_string(json_...
code_fim
hard
{ "lang": "python", "repo": "ipatrol/pineapple", "path": "/plugins/Exhentai.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PedalPi/PluginsManager path: /pluginsmanager/observer/scope.py # Copyright 2017 SrMouraSilva # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.o...
code_fim
medium
{ "lang": "python", "repo": "PedalPi/PluginsManager", "path": "/pluginsmanager/observer/scope.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :param identifier: Identifier for instance that causes changes """ self.current.enter(identifier) def exit(self): """ Closes the last scope added """ self.current.exit() class Scope(object): def __init__(self): self._scope = colle...
code_fim
hard
{ "lang": "python", "repo": "PedalPi/PluginsManager", "path": "/pluginsmanager/observer/scope.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GarryGaller/nlp_toolkit path: /nlptk/patterns/patterns.py import string import re ''' Полный список граммем здесь: http://opencorpora.org/dict.php?act=gram NOUN имя существительное хомяк ADJF имя прилагательное (полное) хороший ADJS имя прилагательное (краткое) хорош COMP компара...
code_fim
hard
{ "lang": "python", "repo": "GarryGaller/nlp_toolkit", "path": "/nlptk/patterns/patterns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' 'POS', 'CC' 'UH' 'PRP','PRP$', 'NNP','NNPS', 'SYM', 'TO' , 'WP','WDT','WP$' 'WRB' 'NN','NNS', 'RB','RBR','RBS', 'JJ','JJR''JJS', 'VB','VBZ','VBP','VBD','VBN','VBG', 'FW' ''' ''' CC conjunction, coordinating and, or, but CD cardinal number five, three, 13% DT determine...
code_fim
hard
{ "lang": "python", "repo": "GarryGaller/nlp_toolkit", "path": "/nlptk/patterns/patterns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangzichao2018/PyTorch path: /official/net/densenet/densenet.py import os import argparse import random import time import torch.nn as nn import torch.optim as optim import torch.utils.data import torchvision.transforms as transforms import torchvision.datasets as dset import torchvision.models ...
code_fim
hard
{ "lang": "python", "repo": "wangzichao2018/PyTorch", "path": "/official/net/densenet/densenet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> batch_time = AverageMeter('Time', ':6.3f') losses = AverageMeter('Loss', ':6.3f') top1 = AverageMeter('Acc@1', ':6.2f') top5 = AverageMeter('Acc@5', ':6.2f') progress = ProgressMeter( len(dataloader), batch_time, losses, top1, top5, prefix='Test: ') with torch.no_grad(...
code_fim
hard
{ "lang": "python", "repo": "wangzichao2018/PyTorch", "path": "/official/net/densenet/densenet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model.eval() batch_time = AverageMeter('Time', ':6.3f') losses = AverageMeter('Loss', ':6.3f') top1 = AverageMeter('Acc@1', ':6.2f') top5 = AverageMeter('Acc@5', ':6.2f') progress = ProgressMeter( len(dataloader), batch_time, losses, top1, top5, prefix='Test: ') wit...
code_fim
hard
{ "lang": "python", "repo": "wangzichao2018/PyTorch", "path": "/official/net/densenet/densenet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ducha-aiki/affnet path: /augmentation.py import numpy as np from PIL import Image import sys from copy import deepcopy import argparse import math import torch.utils.data as data import torch import torch.nn.init import torch.nn as nn import torch.optim as optim import torch.nn.functional as F ...
code_fim
hard
{ "lang": "python", "repo": "ducha-aiki/affnet", "path": "/augmentation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_random_norm_affine_LAFs(patches, max_tilt = 1.0): assert max_tilt > 0 aff_LAFs = Variable(torch.FloatTensor([[0.5, 0, 0.5],[0, 0.5, 0.5]]).unsqueeze(0).repeat(patches.size(0),1,1)); tilt = Variable( 1/max_tilt + (max_tilt - 1./max_tilt)* torch.rand(patches.size(0), 1, 1)); phi = m...
code_fim
hard
{ "lang": "python", "repo": "ducha-aiki/affnet", "path": "/augmentation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SGNovice/Disease-detection-using-chest-xrays path: /commons.py import io import torch import torch.nn as nn from torchvision import models,transforms from PIL import Image import torch.nn.functional as F def mila(input, beta=-0.25): ''' Applies the Mila function element-wise...
code_fim
hard
{ "lang": "python", "repo": "SGNovice/Disease-detection-using-chest-xrays", "path": "/commons.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__() self.fc1 = nn.Linear(2208, 500) self.fc2 = nn.Linear(500, 256) self.fc3 = nn.Linear(256, 3) self.dropout = nn.Dropout(0.5) self.logsoftmax = nn.LogSoftmax(dim=1) self.acivation = mila def forward(self,x): x = x....
code_fim
hard
{ "lang": "python", "repo": "SGNovice/Disease-detection-using-chest-xrays", "path": "/commons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bigheiniu/FakeReviewAll path: /SeqModel/classifier/NormalClassfier.py from xgboost import XGBClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from sklearn.svm import SVC from sklearn.linear_model import LogisticRegression ''' Binary Class...
code_fim
hard
{ "lang": "python", "repo": "bigheiniu/FakeReviewAll", "path": "/SeqModel/classifier/NormalClassfier.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, config_dic): super(LogisticClassifier, self).__init__(config_dic) def build_model(self): self.model = LogisticRegression(**self.config_dic) def train(self, train_data): feature = train_data['feature'] label = train_data['label'] self...
code_fim
hard
{ "lang": "python", "repo": "bigheiniu/FakeReviewAll", "path": "/SeqModel/classifier/NormalClassfier.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> imageStream = io.BytesIO() with PiCameraWithoutIR() as camera: camera.awb_mode = 'greyworld' camera.resolution = (self.settings["CameraResolutionWidth"], self.settings["CameraResolutionHeight"]) camera.capture(imageStream, format='jpeg') imageSt...
code_fim
medium
{ "lang": "python", "repo": "FDSMPS/Security-Camera-App", "path": "/src/Camera.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: FDSMPS/Security-Camera-App path: /src/Camera.py ''' Creation Date: Feb 3, 2020 Author: Tymoore Jamal Content: This file contains the Camera class which handles reading in images. ''' import threading from os import listdir from os.path import join from PIL import Image from random im...
code_fim
medium
{ "lang": "python", "repo": "FDSMPS/Security-Camera-App", "path": "/src/Camera.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' This class allows us to capture images from the camera. It does this in a safe manner uses a mutex. ''' lock = threading.Lock() def __init__(self, settings): ''' Creates an instance of this class and initialzes its class variables. @param se...
code_fim
hard
{ "lang": "python", "repo": "FDSMPS/Security-Camera-App", "path": "/src/Camera.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pezLyfe/DatasheetCreator path: /nonExActuators.py dling and screening for correct inputs #look at mapping to simplify the iterations import pandas as pd import numpy as np import xlsxwriter as xls import datasheetFormat as form workbook = xls.Workbook('ava_Datasheets.xlsx') actDescrip...
code_fim
hard
{ "lang": "python", "repo": "pezLyfe/DatasheetCreator", "path": "/nonExActuators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>smart20Current['Signal'] = signals['signal'][0] #Add descriptors from the signals dictionary smart20Voltage['Signal'] = signals['signal'][1] smartMOD['Signal'] = signals['signal'][2] smart20 = pd.concat([smart20Current, smart20Voltage]) #Start zipping things back together smartMOD = pd.concat([smart...
code_fim
hard
{ "lang": "python", "repo": "pezLyfe/DatasheetCreator", "path": "/nonExActuators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in range (5, len(smart20['Index'])): #Drop the rows unrelated to the S20 actuators smart20.drop([i], axis = 0, inplace = True) smart20Current = smart20.copy() #Make copies of the smart20 dataframes to add stuff into it smart20Voltage = smart20.copy() smart20Current['Signal'] = signals['s...
code_fim
hard
{ "lang": "python", "repo": "pezLyfe/DatasheetCreator", "path": "/nonExActuators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lilidream/WeatherGirl path: /wg2.py # coding=utf-8 from demo_sms_send import send_sms import uuid import json import requests import time #短信发送记录 def log(contain): logfile = open("data/log.txt",'a') t = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) w = t+","+contain['location'...
code_fim
hard
{ "lang": "python", "repo": "lilidream/WeatherGirl", "path": "/wg2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#----------------预报设置--------------------- caiyunapi_key="彩云API_KEY" #彩云API_KEY small_rain = 0.05 #小雨阀值 middle_rain = 0.25 #中雨 heavy_rain = 0.32 #大雨 storm_rain = 0.4 #暴雨 delay_time = 14400 #预警间隔时间,单位秒 #----------------程序开始--------------------- #读取用户文件 userfile = open('data/user.json','r') user = json.l...
code_fim
hard
{ "lang": "python", "repo": "lilidream/WeatherGirl", "path": "/wg2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #当前只下小雨,稍后有大雨或暴雨 elif st==0: #暴雨 if stt>0: print("当前小雨,稍后有暴雨") sendmsg(user,key,"暴雨") #大雨 elif ht>0: print("当前小雨,稍后有大雨") sendmsg(user,key,"大雨") else: ...
code_fim
hard
{ "lang": "python", "repo": "lilidream/WeatherGirl", "path": "/wg2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dEbAR38/ITMO_ICT_WebDevelopment_2020-2021 path: /students/K33401/Tikhonova_Elena/Lr1/task_3/server.py import socket with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as conn: conn.bind(('localhost', 8080)) conn.listen(10) <|fim_suffix|> data = clientsocket.recv(1024) print(d...
code_fim
easy
{ "lang": "python", "repo": "dEbAR38/ITMO_ICT_WebDevelopment_2020-2021", "path": "/students/K33401/Tikhonova_Elena/Lr1/task_3/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> header = 'HTTP/1.1 200 OK\n' header += 'Content-Type: '+'text/html' + '\n\n' header = header.encode("utf-8") with open('index.html', 'rb') as index: response = index.read() clientsocket.sendall(header+response)<|fim_prefix|># repo: dEbAR38/ITMO_ICT_WebDevelopment_2020-2021 pa...
code_fim
medium
{ "lang": "python", "repo": "dEbAR38/ITMO_ICT_WebDevelopment_2020-2021", "path": "/students/K33401/Tikhonova_Elena/Lr1/task_3/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # # Grid for Time Propagation # time grid self.nt = 4000 // 40 # propagate for 150 fs t_max = 150.0 / units.autime_to_fs / 40.0 self.times = torch.linspace(0.0, t_max, self.nt) self.dt = self.times[1]-self.times[0] ...
code_fim
hard
{ "lang": "python", "repo": "humeniuka/semiclassical", "path": "/tests/test_propagators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: humeniuka/semiclassical path: /tests/test_propagators.py (8) # I think there is a mistake in Kluk & Herman's paper, the exponent of the Gaussian # should be alpha=1/2 so that the wavefunction is the HO ground state wavefunction # for the potential V(x) = 1/2 x^2 a...
code_fim
hard
{ "lang": "python", "repo": "humeniuka/semiclassical", "path": "/tests/test_propagators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: humeniuka/semiclassical path: /tests/test_propagators.py Time Propagation # time grid nt = 4000 // 40 # I believe in the HK paper time is measured in units of oscilla tau_max = 12.0 / 40 # frequency of oscillator omega = 1.0 t_max =...
code_fim
hard
{ "lang": "python", "repo": "humeniuka/semiclassical", "path": "/tests/test_propagators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>arguments = get_arguments() create_keylogger(arguments.out, arguments.interval, arguments.email, arguments.password) if arguments.windows: compile_for_windows(arguments.out) if arguments.linux: compile_for_linux(arguments.out) print("\n\n[***] Don't forget to allow less secure applications in y...
code_fim
medium
{ "lang": "python", "repo": "XPR1M3/XLogger", "path": "/xlogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: XPR1M3/XLogger path: /xlogger.py #!/usr/bin/env python import argparse import subprocess import os WINDOWS_PYTHON_INTERPRETER_PATH = os.path.expanduser("~/.wine/drive_c/Python27/Scripts/pyinstaller.exe") print(" ") print("\ \ / / | ...
code_fim
hard
{ "lang": "python", "repo": "XPR1M3/XLogger", "path": "/xlogger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if arguments.windows: compile_for_windows(arguments.out) if arguments.linux: compile_for_linux(arguments.out) print("\n\n[***] Don't forget to allow less secure applications in your Gmail account.") print("Use the following link to do so https://myaccount.google.com/lesssecureapps")<|fim_prefix|...
code_fim
hard
{ "lang": "python", "repo": "XPR1M3/XLogger", "path": "/xlogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _write_recursively(zipfile_to_save, system_path, zip_path): if not tf.io.gfile.isdir(system_path): zipfile_to_save.write(system_path, zip_path) else: for file_name in tf.io.gfile.listdir(system_path): system_file_path = tf.io.gfile.join(system_path, file_name) ...
code_fim
hard
{ "lang": "python", "repo": "mishc9/keras", "path": "/keras/saving/experimental/saving_lib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class DiskIOHandler: def __init__(self, base_directory): self.base_directory = base_directory def make(self, path): if not path: return self.base_directory path = tf.io.gfile.join(self.base_directory, path) if not tf.io.gfile.exists(path): ...
code_fim
hard
{ "lang": "python", "repo": "mishc9/keras", "path": "/keras/saving/experimental/saving_lib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mishc9/keras path: /keras/saving/experimental/saving_lib.py # Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License a...
code_fim
hard
{ "lang": "python", "repo": "mishc9/keras", "path": "/keras/saving/experimental/saving_lib.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bruinxiong/torchgpipe path: /torchgpipe/worker.py """Multithreading in pipeline parallelism.""" from contextlib import contextmanager from queue import Queue import sys from threading import Thread from types import TracebackType from typing import TYPE_CHECKING, Callable, Generator, List, Option...
code_fim
hard
{ "lang": "python", "repo": "bruinxiong/torchgpipe", "path": "/torchgpipe/worker.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self._finalize is None: return with use_device(self.device), use_stream(self.stream): self._finalize(batch) def worker(in_queue: InQueue, out_queue: OutQueue, grad_mode: bool, ) -> None: """The main loop of a worker thread."...
code_fim
hard
{ "lang": "python", "repo": "bruinxiong/torchgpipe", "path": "/torchgpipe/worker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @contextmanager def spawn_workers(count: int) -> Generator[Tuple[List[InQueue], List[OutQueue]], None, None]: """Spawns worker threads.""" in_queues: List[InQueue] = [] out_queues: List[OutQueue] = [] grad_mode = torch.is_grad_enabled() # Spawn workers. for _ in range(count): ...
code_fim
hard
{ "lang": "python", "repo": "bruinxiong/torchgpipe", "path": "/torchgpipe/worker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Creates DB in memory SQLALCHEMY_DATABASE_URI = r"sqlite:///" SQLALCHEMY_TRACK_MODIFICATIONS = True TESTING = True<|fim_prefix|># repo: 0Hughman0/Housenet path: /housenet/config/config.py class DefaultConfig: ### Database config ### # Where to find db file? SQLALCHEMY_DATABAS...
code_fim
easy
{ "lang": "python", "repo": "0Hughman0/Housenet", "path": "/housenet/config/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 0Hughman0/Housenet path: /housenet/config/config.py class DefaultConfig: ### Database config ### # Where to find db file? SQLALCHEMY_DATABASE_URI = r"sqlite:///housenet/database/database.db" # Produces lots of messages/ slows performance SQLALCHEMY_TRACK_MODIFICATIONS = False ...
code_fim
easy
{ "lang": "python", "repo": "0Hughman0/Housenet", "path": "/housenet/config/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muskanmahajan37/AMIP_Simu path: /Scripts/calc_SNA_Data_Eurasia_CDRSCE.py """ Script calculates Eurasian snow area index for October-November using data from the Rutgers Global Snow Lab data Notes ----- Author : Zachary Labe Date : 25 July 2019 """ ### Import modules import datetime im...
code_fim
hard
{ "lang": "python", "repo": "muskanmahajan37/AMIP_Simu", "path": "/Scripts/calc_SNA_Data_Eurasia_CDRSCE.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>### Calculate October-November index (1979-2015) octnov = np.nanmean(datasort[:years.shape[0],9:11],axis=1) octnovdt = SS.detrend(octnov,type='linear') ### Calculate October index (1979-2015) octonly = datasort[:years.shape[0],9:10].squeeze() octonlydt = SS.detrend(octonly,type='linear') ### Save both i...
code_fim
hard
{ "lang": "python", "repo": "muskanmahajan37/AMIP_Simu", "path": "/Scripts/calc_SNA_Data_Eurasia_CDRSCE.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>### Read in all months of data yearsdata,months,data = np.genfromtxt(directoryoutput + \ 'CDR_SCE_Eurasia_Monthly.txt',unpack=True, usecols=[0,1,2]) ### Reshape data into [] yearssort = np.reshape(yearsdata,(yearsdata.shape[0]//m,m)) mon...
code_fim
hard
{ "lang": "python", "repo": "muskanmahajan37/AMIP_Simu", "path": "/Scripts/calc_SNA_Data_Eurasia_CDRSCE.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>## get live price of Apple #print('aaple:',si.get_live_price("aapl")) # ## or Amazon #print('amazon',si.get_live_price("amzn")) # ## or any other ticker #for ticker in tickers: # print(ticker,si.get_live_price(ticker)) # #hist = [] while True: dr = si.get_live_price('tsla') hist += [dr] p...
code_fim
medium
{ "lang": "python", "repo": "am-3/StockWaves", "path": "/Initial source/SM v0.01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: am-3/StockWaves path: /Initial source/SM v0.01.py from pandas_datareader import data import matplotlib.pyplot as plt import pandas as pd im googlefinance import getQuotes import json # ## Define the instruments to download. We would like to see Apple, Microsoft and the S&P500 index. tickers = ['A...
code_fim
medium
{ "lang": "python", "repo": "am-3/StockWaves", "path": "/Initial source/SM v0.01.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Oriolus/GithubLoadScheduler path: /loading.py import json import uuid from main import transaction from typing import Dict, Optional def get_db_connection(): return transaction() class Loading: def __init__(self): self.id = 0 self.url = None self.req_params = ...
code_fim
hard
{ "lang": "python", "repo": "Oriolus/GithubLoadScheduler", "path": "/loading.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def finish_loading(obj: Loading) -> Loading: with get_db_connection() as conn: with conn.cursor() as cur: update_script = ''' update log.loading set resp_status = %s ,resp_headers = %s ,resp_text = %s ,resp_raw = %s ,end_timestamp = n...
code_fim
hard
{ "lang": "python", "repo": "Oriolus/GithubLoadScheduler", "path": "/loading.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with get_db_connection() as conn: with conn.cursor() as cur: update_script = ''' update log.loading set resp_status = %s ,resp_headers = %s ,resp_text = %s ,resp_raw = %s ,end_timestamp = now() ,error = %s where id...
code_fim
hard
{ "lang": "python", "repo": "Oriolus/GithubLoadScheduler", "path": "/loading.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: machine(mpf.core.machine.MachineController): the machine controller Returns: """ self.machine = machine<|fim_prefix|># repo: jrobert2/mpf path: /mpf/core/mpf_controller.py """Base class for MPF controllers.""" import abc class MpfController(metaclass=...
code_fim
medium
{ "lang": "python", "repo": "jrobert2/mpf", "path": "/mpf/core/mpf_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrobert2/mpf path: /mpf/core/mpf_controller.py """Base class for MPF controllers.""" import abc <|fim_suffix|> """Initialise controller. Args: machine(mpf.core.machine.MachineController): the machine controller Returns: """ self.machine = ma...
code_fim
medium
{ "lang": "python", "repo": "jrobert2/mpf", "path": "/mpf/core/mpf_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return render(request, 'testing/query_params.html', context)<|fim_prefix|># repo: Minkov/python-web-2020-09 path: /django101/testing/views/query_params.py from django.shortcuts import render def query_params_view(request): <|fim_middle|> q = request.GET.get('q') pages = request.GET.get(...
code_fim
hard
{ "lang": "python", "repo": "Minkov/python-web-2020-09", "path": "/django101/testing/views/query_params.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Minkov/python-web-2020-09 path: /django101/testing/views/query_params.py from django.shortcuts import render def query_params_view(request): <|fim_suffix|> context = { 'grid_params': { 'current_page': 0, 'pages_count': 15, 'filter': '', ...
code_fim
medium
{ "lang": "python", "repo": "Minkov/python-web-2020-09", "path": "/django101/testing/views/query_params.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Activate const input. Called during construction time. :param name: :param value: :return: """ name = sys.intern(name) if self.get_input_type(name) == IN_INVALID: raise KeyError(f"Invalid input {name}") if self.const_...
code_fim
hard
{ "lang": "python", "repo": "nocproject/noc", "path": "/core/cdag/node/base.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /core/cdag/node/base.py return self.__static[__name] v = self.__override.get(__name, config_proxy_sentinel) if v is config_proxy_sentinel: return getattr(self.__base, __name) return v class BaseCDAGNodeMetaclass(type): def __new__(mc...
code_fim
hard
{ "lang": "python", "repo": "nocproject/noc", "path": "/core/cdag/node/base.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /core/cdag/node/base.py --------- # BaseNode # ---------------------------------------------------------------------- # Copyright (C) 2007-2022 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Python modules...
code_fim
hard
{ "lang": "python", "repo": "nocproject/noc", "path": "/core/cdag/node/base.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> expected = { 'wavelength': np.array([1.89e6, 2e6]), 'throughput': np.array([0., 1.6]), 'linenumber': np.array([0, 1]) } data = hdf5_tree.Index('numbers.table.response[:][0]') self.assertEqual(set(data.keys()), set(expected.keys())) for key in data.keys(): ...
code_fim
hard
{ "lang": "python", "repo": "ghomsy/makani", "path": "/lib/python/struct_tree_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def testDictToD3Tree(self): data = { 'deep': {'x': {'y': None}}, 'format': {'array': (4,), 'list': (4,)}, 'numbers': [ {'pi': []}, {'sigma': []}, ], } expected = { 'path': '', 'leaf': False, 'name': 'root', ...
code_fim
hard
{ "lang": "python", "repo": "ghomsy/makani", "path": "/lib/python/struct_tree_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ghomsy/makani path: /lib/python/struct_tree_test.py # Copyright 2020 Makani Technologies LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache....
code_fim
hard
{ "lang": "python", "repo": "ghomsy/makani", "path": "/lib/python/struct_tree_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: luserx0/i3ipc-python path: /i3ipc/model.py class Rect: """Used by other classes to represent rectangular position and dimensions. :ivar x: The x coordinate. :vartype x: int :ivar y: The y coordinate. :vartype y: int :ivar height: The height of the rectangle. :vartype ...
code_fim
medium
{ "lang": "python", "repo": "luserx0/i3ipc-python", "path": "/i3ipc/model.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """For forks that have useless gaps, the dimension of the gaps. :ivar inner: The inner gaps. :vartype inner: int :ivar outer: The outer gaps. :vartype outer: int """ def __init__(self, data): self.inner = data['inner'] self.outer = data['outer']<|fim_prefix|>#...
code_fim
medium
{ "lang": "python", "repo": "luserx0/i3ipc-python", "path": "/i3ipc/model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Gaps: """For forks that have useless gaps, the dimension of the gaps. :ivar inner: The inner gaps. :vartype inner: int :ivar outer: The outer gaps. :vartype outer: int """ def __init__(self, data): self.inner = data['inner'] self.outer = data['outer']<|f...
code_fim
hard
{ "lang": "python", "repo": "luserx0/i3ipc-python", "path": "/i3ipc/model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: adi249/Image-Classifier path: /app.py import flask from flask import Flask,render_template,url_for,request import pickle import base64 import numpy as np import cv2 import tensorflow as tf #Initialize the useless part of the base64 encoded image. init_Base64 = 21; <|fim_suffix|> retu...
code_fim
hard
{ "lang": "python", "repo": "adi249/Image-Classifier", "path": "/app.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Use pickle to load in the pre-trained model. with open(f'model_cnn.pkl', 'rb') as f: model = pickle.load(f) #Initializing new Flask instance. Find the html template in "templates". app = flask.Flask(__name__, template_folder='templates') #First route : Render the initial drawing templat...
code_fim
hard
{ "lang": "python", "repo": "adi249/Image-Classifier", "path": "/app.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bdshieh/interaction3 path: /interaction3/bem/solvers/__init__.py from . transmit_crosstalk import TransmitCrosstalk from .<|fim_suffix|>crosstalk_bem_only import TransmitCrosstalkBemOnly # from . transmit_beamplot import # from . receive_beamplot import<|fim_middle|> receive_crosstalk import Rec...
code_fim
easy
{ "lang": "python", "repo": "bdshieh/interaction3", "path": "/interaction3/bem/solvers/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>. transmit_beamplot import # from . receive_beamplot import<|fim_prefix|># repo: bdshieh/interaction3 path: /interaction3/bem/solvers/__init__.py from . transmit_crosstalk import TransmitCrosstalk from . receive_crosstalk import ReceiveCrosstalk from . transmit_<|fim_middle|>crosstalk_bem_only import Tr...
code_fim
easy
{ "lang": "python", "repo": "bdshieh/interaction3", "path": "/interaction3/bem/solvers/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dell/python-powerstore path: /PyPowerStore/tests/unit_tests/test_host.py from PyPowerStore.utils import constants from PyPowerStore.tests.unit_tests.base_test import TestBase from PyPowerStore.utils.exception import PowerStoreException from unittest import mock class TestHost(TestBase): de...
code_fim
hard
{ "lang": "python", "repo": "dell/python-powerstore", "path": "/PyPowerStore/tests/unit_tests/test_host.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_modify_host(self): host = self.provisioning.modify_host(self.data.host_id1, description="modify host " "description") self.assertIsNone(host) def test_add_invalid_initiat...
code_fim
hard
{ "lang": "python", "repo": "dell/python-powerstore", "path": "/PyPowerStore/tests/unit_tests/test_host.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: koddsson/django-prometheus path: /tests/end2end/testapp/views.py from django.shortcuts import render from django.template.response import TemplateResponse from testapp.models import Lawn import time def index(request): return TemplateResponse(request, 'index.html', {}) def help(request): ...
code_fim
hard
{ "lang": "python", "repo": "koddsson/django-prometheus", "path": "/tests/end2end/testapp/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """This view creates a new Lawn instance in the database.""" l = Lawn() l.location = location l.save() return TemplateResponse(request, 'lawn.html', {'lawn': l}) class ObjectionException(Exception): pass def objection(request): raise ObjectionException('Objection!')<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "koddsson/django-prometheus", "path": "/tests/end2end/testapp/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: drx/Feel2 path: /compression/star.py import struct from array import array from compression.exceptions import * def decompress(compressed): input_ptr = {'value': 0} bit_count = {'value': 8} compressed_array = array('B', compressed) uncompressed = [] def get_byte(): v...
code_fim
hard
{ "lang": "python", "repo": "drx/Feel2", "path": "/compression/star.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ctrl_bit, ctrl_byte = get_ctrl_bit(ctrl_byte) if ctrl_bit: raw_copy_count += 1 raw_copy_count *= 2 ctrl_bit, ctrl_byte = get_ctrl_bit(ctrl_byte) if ctrl_bit: raw_copy_count += 1 repeat_offs...
code_fim
hard
{ "lang": "python", "repo": "drx/Feel2", "path": "/compression/star.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list_of_primes = [] #Make sure you add 1 to the range due to slice index. for i in range(max_number + 1): #Use our previous function. If true, append #the number to list_of_primes. if _is_prime(i): list_of_primes.append(i) return list_of_primes if __nam...
code_fim
medium
{ "lang": "python", "repo": "joeycoakley/itp-w1-list-of-prime-numbers", "path": "/list_of_prime_numbers/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joeycoakley/itp-w1-list-of-prime-numbers path: /list_of_prime_numbers/main.py """This is the entry point of the program.""" def _is_prime(number): #Account for 0, 1, and 2. These don't play nice with our logic. if number == 1 or number == 0: return False elif number == 2: return T...
code_fim
medium
{ "lang": "python", "repo": "joeycoakley/itp-w1-list-of-prime-numbers", "path": "/list_of_prime_numbers/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jialeiwang/mlpiper-tutorial path: /component-repository/XGBoostPredict/XGBoostPredict.py from __future__ import print_function import argparse import pickle import subprocess import sys import numpy as np import pandas as pd from scipy.stats import ks_2samp from sklearn.datasets import make_cl...
code_fim
hard
{ "lang": "python", "repo": "jialeiwang/mlpiper-tutorial", "path": "/component-repository/XGBoostPredict/XGBoostPredict.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Initialize MLOps Library mlops.init() # Load the model if self.input_model is not None: try: filename = self._params["input-model"] model_file_obj = open(filename, 'rb') mlops.set_stat("# Model Files Used", 1) ...
code_fim
hard
{ "lang": "python", "repo": "jialeiwang/mlpiper-tutorial", "path": "/component-repository/XGBoostPredict/XGBoostPredict.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: oetiker/osparc-simcore path: /services/director/src/simcore_service_director/exceptions.py """ Defines the different exceptions that may arise in the director TODO: Exceptions should provide all info to create Error instances of the API model For instance, assume there is a ficticious excep...
code_fim
medium
{ "lang": "python", "repo": "oetiker/osparc-simcore", "path": "/services/director/src/simcore_service_director/exceptions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> msg = "The service uuid %s is already in use" % (service_uuid) super(ServiceUUIDInUseError, self).__init__(msg) self.service_uuid = service_uuid class RegistryConnectionError(DirectorException): """Error while connecting to the docker regitry""" def __init__(self, ms...
code_fim
hard
{ "lang": "python", "repo": "oetiker/osparc-simcore", "path": "/services/director/src/simcore_service_director/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class PublisherViewSet(viewsets.ModelViewSet): """ API endpoint that allows publisher to be viewed or edited """ queryset = Publisher.objects.all() serializer_class = PublisherSerializer<|fim_prefix|># repo: fernandoMartinsB/python-challenge path: /books/views.py from rest_framework ...
code_fim
hard
{ "lang": "python", "repo": "fernandoMartinsB/python-challenge", "path": "/books/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fernandoMartinsB/python-challenge path: /books/views.py from rest_framework import viewsets from .serializers import BookSerializer, AuthorSerializer, PublisherSerializer from .models import Book, Author, Publisher <|fim_suffix|>class AuthorViewSet(viewsets.ModelViewSet): """ API endpoi...
code_fim
medium
{ "lang": "python", "repo": "fernandoMartinsB/python-challenge", "path": "/books/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class AuthorViewSet(viewsets.ModelViewSet): """ API endpoint that allows author to be viewed or edited """ queryset = Author.objects.all() serializer_class = AuthorSerializer class PublisherViewSet(viewsets.ModelViewSet): """ API endpoint that allows publisher to be viewe...
code_fim
medium
{ "lang": "python", "repo": "fernandoMartinsB/python-challenge", "path": "/books/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: izzatum/BoMb-OT path: /DeepDA/ALDA/train.py open(data_config["target"]["list_path"]).readlines()] dsets["source"] = ImageList(source_list, \ transform=prep_dict["source"]) if config['args'].stratify_source: source_labels = torch.zeros((len(dsets["s...
code_fim
hard
{ "lang": "python", "repo": "izzatum/BoMb-OT", "path": "/DeepDA/ALDA/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Forward if use_bomb: with torch.no_grad(): for i in range(k): xs_mb = xs_mb_all[inds_xs[i]].cuda() ys_mb = ys_mb_all[inds_xs[i]].cuda() g_xs_mb, f_g_xs_mb = base_network(xs_mb) for...
code_fim
hard
{ "lang": "python", "repo": "izzatum/BoMb-OT", "path": "/DeepDA/ALDA/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentTypeError('Unsupported value encountered.') parser = argparse.ArgumentParser(description='...
code_fim
hard
{ "lang": "python", "repo": "izzatum/BoMb-OT", "path": "/DeepDA/ALDA/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: justthetips/cecbr path: /cecbr/photos/utils/parsers.py import datetime from time import strptime, mktime from typing import List import attr from .cecbrsite import Page, IndexAlbumParser, unquote, FavoriteAlbumParser, ALBUM_URL ALBUM_TOKEN = "\\\"SessionIDList\\\":[]}}" @attr.s class ParsedS...
code_fim
hard
{ "lang": "python", "repo": "justthetips/cecbr", "path": "/cecbr/photos/utils/parsers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> favorite_tail = "seasonID={}&action=f".format(season) favorite_url = '?'.join([ALBUM_URL, favorite_tail]) parser = FavoriteAlbumParser(page, favorite_url) dicts = parser.parse() results = [] for k, d in dicts.items(): pa = ParsedAlbum(id=unquote(k), season=unquote(d['Season...
code_fim
hard
{ "lang": "python", "repo": "justthetips/cecbr", "path": "/cecbr/photos/utils/parsers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Annous87/schengen_customs path: /tests/test_customs.py import unittest import customs from customs import orchestrator from customs import validator import json class TestDates(unittest.TestCase): <|fim_suffix|> def test_invalid_date_json(self): # parse = customs.data_are_valid('test...
code_fim
hard
{ "lang": "python", "repo": "Annous87/schengen_customs", "path": "/tests/test_customs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open('tests/entriesexitsnotrespected.json', 'r') as outfile: data = json.load(outfile) transformed = orchestrator.transform_data( data['Reference Date'], data['Entries'], data['Exits']) flag = orchestrator.not_accurate_entries_exists(transformed['df']) ...
code_fim
medium
{ "lang": "python", "repo": "Annous87/schengen_customs", "path": "/tests/test_customs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'Brown-out detection at VCC=4.3 V'}}}, 'HWBE': {'mask': '0x08', 'caption': 'Hardware Boot Enable', 'values': {}}}, 'fuse_high': {'OCDEN': {'mask': '0x80', 'caption': 'On-Chip Debug Enabled', 'values': {}}, 'JTAGEN': {'mask': '0x40', 'caption': 'JTAG Interface Enabled', 'values': {}}, 'SPIEN': {'mask': '0...
code_fim
hard
{ "lang": "python", "repo": "immunIT/owfmodules.avrisp.device_id", "path": "/owfmodules/avrisp/avrisp_devices.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: immunIT/owfmodules.avrisp.device_id path: /owfmodules/avrisp/avrisp_devices.py ot Flash size=512 words Boot address=$3E00'}, '1024W_3C00': {'value': '0x01', 'caption': 'Boot Flash size=1024 words Boot address=$3C00'}, '2048W_3800': {'value': '0x00', 'caption': 'Boot Flash size=2048 words Boot add...
code_fim
hard
{ "lang": "python", "repo": "immunIT/owfmodules.avrisp.device_id", "path": "/owfmodules/avrisp/avrisp_devices.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>caption': 'Further programming and verification disabled'}, 'PROG_DISABLED': {'value': '0x02', 'caption': 'Further programming disabled'}, 'NO_LOCK': {'value': '0x03', 'caption': 'No memory lock features enabled'}}}}}, '1e9209': {'name': 'ATtiny48', 'flash_size': '0x1000', 'eeprom_size': '0x0040', 'flash_...
code_fim
hard
{ "lang": "python", "repo": "immunIT/owfmodules.avrisp.device_id", "path": "/owfmodules/avrisp/avrisp_devices.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: collincr/ini_team_13 path: /task_scripts/task4.py import geopandas as gpd import pandas as pd import numpy as np import matplotlib.pyplot as plt if __name__ == "__main__": <|fim_suffix|> gdf = gpd.read_file("../data/geojson/calif_nev_ncei_grav.geojson") gdf_subset = gdf[(gdf["l...
code_fim
hard
{ "lang": "python", "repo": "collincr/ini_team_13", "path": "/task_scripts/task4.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> ax.bar(x=np.arange(gdf_subset.shape[0]), width=0.9, height=gdf_subset_sorted["isostatic_anom"].values) fig.savefig("task4.png")<|fim_prefix|># repo: collincr/ini_team_13 path: /task_scripts/task4.py import geopandas as gpd import pandas as pd import numpy as np import matplotlib.p...
code_fim
hard
{ "lang": "python", "repo": "collincr/ini_team_13", "path": "/task_scripts/task4.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: syam-s/smlb path: /smlb/core/utility.py """Utilities. Scientific Machine Learning Benchmark: A benchmark of regression models in chem- and materials informatics. (c) Matthias Rupp 2019, Citrine Informatics. Auxiliary code. """ import numpy as np <|fim_suffix|> For default values, use 'whi...
code_fim
hard
{ "lang": "python", "repo": "syam-s/smlb", "path": "/smlb/core/utility.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """True if argument is a list, tuple, array or similar object, but not a string, dictionary, set or similar object. Parameters: arg: the object to test Returns: True or False """ # np.float{16,32,64} and np.int types have __getitem__ defined # this is a long-stan...
code_fim
medium
{ "lang": "python", "repo": "syam-s/smlb", "path": "/smlb/core/utility.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(args) == 0: raise InvalidParameterError( "conditions and cases", "nothing", explanation="'which' statement without arguments" ) if len(args) % 2 == 1: return which(*args[:-1], True, args[-1]) for i in range(0, len(args), 2): if args[i]: ...
code_fim
hard
{ "lang": "python", "repo": "syam-s/smlb", "path": "/smlb/core/utility.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }