text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> # @param A : list of integers # @return a list of integers def subUnsort(self, A): n = len(A) left_index = -1 right_index = -1 B = sorted(A) if A == B: return [-1] for i in range(n): if A[i] != B[i]: left_index = i break ...
code_fim
medium
{ "lang": "python", "repo": "arnabs542/Data-Structures-And-Algorithms", "path": "/Sorting/Maximum Unsorted Subarray.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: arnabs542/Data-Structures-And-Algorithms path: /Sorting/Maximum Unsorted Subarray.py """ Maximum Unsorted Subarray Problem Description Given an array A of non-negative integers of size N. Find the minimum sub-array Al, Al+1 ,..., Ar such that if we sort(in ascending order) that sub-array, then t...
code_fim
hard
{ "lang": "python", "repo": "arnabs542/Data-Structures-And-Algorithms", "path": "/Sorting/Maximum Unsorted Subarray.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, img): self.img = img def _notch_kernel(self, d0=1000): """ 理想陷波带阻滤波器 """ r, c = self.img.shape u0, v0 = 0, c/8 h = np.empty((r, c, )) for u in range(r): for v in range(c): ...
code_fim
hard
{ "lang": "python", "repo": "Stareven233/fzu_homework", "path": "/cv_homework/3/3_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Stareven233/fzu_homework path: /cv_homework/3/3_1.py import numpy as np import matplotlib.pyplot as plt from utils import draw_picture """ 作业3: 在网上寻找一张福州大学校园图像,并将之转换为灰度图像,完成以下题目: 1编程实现陷波滤波器,对该图进行频率域滤波。 2编程实现巴特沃思低通滤波器,对该图进行图像滤波。 3编程实现理想低通滤波器,对该图进行图像滤波,并分析一下振铃现象。 ...
code_fim
hard
{ "lang": "python", "repo": "Stareven233/fzu_homework", "path": "/cv_homework/3/3_1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(): img = plt.imread('boy_L.jpg') # 对带噪声的图片滤波效果更加明显,有针对性 # img = plt.imread('Fzu_shutong_L.jpg') filters = Filter(img) # draw = draw_picture(2, 2) # plt.figure(figsize=(10, 6)) # f_shift, f_shift_h, img_h = filters.run('notch') # draw(1, img, '原图') # ...
code_fim
hard
{ "lang": "python", "repo": "Stareven233/fzu_homework", "path": "/cv_homework/3/3_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Persifer/Machine_Learning_Training path: /classification_algorithm/classification_algorithm.py from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score def training_class...
code_fim
medium
{ "lang": "python", "repo": "Persifer/Machine_Learning_Training", "path": "/classification_algorithm/classification_algorithm.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = DecisionTreeClassifier() model.fit(X_train, y_train) prediction_train = model.predict(X_train) prediction_test = model.predict(X_test) # calculate the accuracy of the model for the training accuracy_train = accuracy_score(y_train, prediction_train) # calculate the acc...
code_fim
medium
{ "lang": "python", "repo": "Persifer/Machine_Learning_Training", "path": "/classification_algorithm/classification_algorithm.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='attachments', name='content', field=models.FileField(default=None, help_text='Add important documents or pictures', upload_to=ToDo.models.get_attachment_dir), preserve_default=False, ), ...
code_fim
medium
{ "lang": "python", "repo": "arafat-ar13/Regular-ToDoList", "path": "/ToDo/migrations/0022_auto_20200525_1444.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: arafat-ar13/Regular-ToDoList path: /ToDo/migrations/0022_auto_20200525_1444.py # Generated by Django 3.0.3 on 2020-05-25 08:44 import ToDo.models from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name='attachments', ...
code_fim
medium
{ "lang": "python", "repo": "arafat-ar13/Regular-ToDoList", "path": "/ToDo/migrations/0022_auto_20200525_1444.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: haamis/wisdom-tree path: /pull_tournament.py import json, multiprocessing.pool, sys import requests ids = [] def make_request(id): return requests.get("https://fftbg.com/api/tournament/" + str(id)) <|fim_suffix|>for t in tournaments: print(json.dumps(t.json()))<|fim_middle|>with open(s...
code_fim
medium
{ "lang": "python", "repo": "haamis/wisdom-tree", "path": "/pull_tournament.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>with multiprocessing.pool.ThreadPool(12) as p: tournaments = p.map(make_request, ids) for t in tournaments: print(json.dumps(t.json()))<|fim_prefix|># repo: haamis/wisdom-tree path: /pull_tournament.py import json, multiprocessing.pool, sys import requests ids = [] def make_request(id): re...
code_fim
medium
{ "lang": "python", "repo": "haamis/wisdom-tree", "path": "/pull_tournament.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cls.optimizer_params = {'func': optimizer.ClipOptimizer, 'optimizer_class': tf.train.MomentumOptimizer, 'clip': True, 'optimizer_kwargs':{'momentum': 0.9}} cls.learning_rate_params = {'learning...
code_fim
hard
{ "lang": "python", "repo": "apvadaparty/tfutils", "path": "/tfutils/tests/test_dbinterface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def load_test_checkpoint(self, save_path): reader = tf.train.NewCheckpointReader(save_path) saved_shapes = reader.get_variable_to_shape_map() self.log.info('Saved Vars:\n' + str(saved_shapes.keys())) for name in saved_shapes.keys(): self.log.info( ...
code_fim
hard
{ "lang": "python", "repo": "apvadaparty/tfutils", "path": "/tfutils/tests/test_dbinterface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apvadaparty/tfutils path: /tfutils/tests/test_dbinterface.py """Test DBInterface.""" import os import re import sys import time import errno import shutil import logging import pymongo import unittest import pdb import tensorflow as tf import mnist_data as data sys.path.insert(0, "..") import...
code_fim
hard
{ "lang": "python", "repo": "apvadaparty/tfutils", "path": "/tfutils/tests/test_dbinterface.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif choice == '9': op = ROp.SEARCH_TAG.value tag = get_tag() request = (op, tag) error, result = self.send_request(request) if error: response = result else: ...
code_fim
hard
{ "lang": "python", "repo": "d-nagy/distributed-systems", "path": "/client.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print() print(' --- Movie Database ---') print() [print(option) for option in self.menu_options] print() print(f' {len(self.menu_options) + 1}. Exit') print() print('Enter option: ', end='') def main(self): ''' Main loop ...
code_fim
hard
{ "lang": "python", "repo": "d-nagy/distributed-systems", "path": "/client.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: d-nagy/distributed-systems path: /client.py import Pyro4 from enums import ROp def get_user_id(): uid = input('Enter a user ID (number): ') while not uid.isdigit(): print('- ' * 32) print(f'Invalid user ID [ {uid} ]. User ID must be a number.') print('- ' * 32) ...
code_fim
hard
{ "lang": "python", "repo": "d-nagy/distributed-systems", "path": "/client.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_feeds(self): sections = json.load(urllib2.urlopen(self.server + '/today/sections.json')) feeds = [] for section in sections: feeds.append((section, self.server + '/today/feed-' + section.replace(" ", "_").replace("&", "und") + '.xml')) return fe...
code_fim
hard
{ "lang": "python", "repo": "jhbruhn/nwz-rss", "path": "/nwz_calibre.recipe", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhbruhn/nwz-rss path: /nwz_calibre.recipe #!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import unicode_literals, division, absolute_import, print_function from calibre.web.feeds.news import BasicNewsRecipe from datetime import date import json import urllib2 class Advan...
code_fim
hard
{ "lang": "python", "repo": "jhbruhn/nwz-rss", "path": "/nwz_calibre.recipe", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init_capsule_begin_end(self): pass # capsule BEGIN .. END def __init_param_converters(self): self.M3param_converters = {'p1.b' : (),'p1.a' : (),} self.M3port_converters = {'a': 'p1.a', 'b': 'p1.b'} def runcap(): import Simulator Simulator.run(createCapsule(1,'top')) def createCapsule(level,h...
code_fim
hard
{ "lang": "python", "repo": "sofayam/m3", "path": "/doc/m3lib/ConjC2CapMod.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.runtimeName = runtimeName self.__level = level RTSTypes.M3CapsuleRuntimeType.__init__(self,level) self.__init_capsule_connect() self.__init_capsule_begin_end() self.__init_param_converters() def __init_capsule_connect(self): pass def __init_capsule_begin_end(self): pass # capsule BEGIN ...
code_fim
medium
{ "lang": "python", "repo": "sofayam/m3", "path": "/doc/m3lib/ConjC2CapMod.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sofayam/m3 path: /doc/m3lib/ConjC2CapMod.py import M3Objects import M3Types import RTSTypes import M3Predefined import ConjTypesInt as CT import TimerInt as Timer import M3TypeLib import M3ProcLib import CapsuleMap from Statistics import M3incStat M3TL=M3TypeLib.internaliseTypes(r'm3lib/ConjC2Cap...
code_fim
medium
{ "lang": "python", "repo": "sofayam/m3", "path": "/doc/m3lib/ConjC2CapMod.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return ans def main(): mat = [None] * 3 mat[0] = [1, 1, 2, 9] mat[1] = [2, 4, -3, 1] mat[2] = [3, 6, -5, 0] X = GaussianElimination(3, mat) print('X = %.1lf, Y = %.1lf, Z = %.1lf' % (X[0], X[1], X[2])) main()<|fim_prefix|># repo: stevenhalim/cpbook-code path: /ch9/GaussianElimination.p...
code_fim
medium
{ "lang": "python", "repo": "stevenhalim/cpbook-code", "path": "/ch9/GaussianElimination.py", "mode": "spm", "license": "UPL-1.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(): mat = [None] * 3 mat[0] = [1, 1, 2, 9] mat[1] = [2, 4, -3, 1] mat[2] = [3, 6, -5, 0] X = GaussianElimination(3, mat) print('X = %.1lf, Y = %.1lf, Z = %.1lf' % (X[0], X[1], X[2])) main()<|fim_prefix|># repo: stevenhalim/cpbook-code path: /ch9/GaussianElimination.py def GaussianE...
code_fim
medium
{ "lang": "python", "repo": "stevenhalim/cpbook-code", "path": "/ch9/GaussianElimination.py", "mode": "spm", "license": "UPL-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevenhalim/cpbook-code path: /ch9/GaussianElimination.py def GaussianElimination(N, mat): for i in range(N-1): l = i for j in range(i+1, N): if abs(mat[j][i]) > abs(mat[l][i]): l = j for k in range(i, N+1): mat[i][k], mat[l][k] = mat[l][k], mat[i][k] for j i...
code_fim
medium
{ "lang": "python", "repo": "stevenhalim/cpbook-code", "path": "/ch9/GaussianElimination.py", "mode": "psm", "license": "UPL-1.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": filepath = "demo_airhistory" lines = get_lines(filepath) new_csv(lines, filepath)<|fim_prefix|># repo: tianchen2215/txt-to-csv path: /run.py #-*- coding: utf-8 -*- def get_lines(filepath): with open(filepath + '.txt') as file_object: lines = list(file_ob...
code_fim
hard
{ "lang": "python", "repo": "tianchen2215/txt-to-csv", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tianchen2215/txt-to-csv path: /run.py #-*- coding: utf-8 -*- def get_lines(filepath): with open(filepath + '.txt') as file_object: lines = list(file_object.readlines()) return lines def new_csv(lines, filepath): <|fim_suffix|>if __name__ == "__main__": filepath = "demo_ai...
code_fim
hard
{ "lang": "python", "repo": "tianchen2215/txt-to-csv", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fileindex = 0 fp = open(filepath + '.csv', 'w') count = len(lines) print("总行数:" + str(count)) for index, line in enumerate(lines): index += 1 # print(str(index)+' : '+line) oneline = line.strip() # 逐行读取,剔除空白 fp.write(oneline) # 写文件 fp.writ...
code_fim
medium
{ "lang": "python", "repo": "tianchen2215/txt-to-csv", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>name = 'testing'), path('search/', views.searchfunc, name = 'searchfunc'), path('contactus/', views.contactuss, name = 'contactus'), path('testimonials/', views.testimonial, name = 'testimonial'), path('sellcar/', views.sellcar, name = 'sellcar'), path('buycar/', views.buycar, name = '...
code_fim
hard
{ "lang": "python", "repo": "carinfinity/testing", "path": "/myapp/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: carinfinity/testing path: /myapp/urls.py from django.contrib import admin from django.urls import include, path from django.conf import settings from django.conf.urls.static import static from . import views from myapp.views import newcarpage urlpatterns = [ path('admin/', admin.site.urls), ...
code_fim
hard
{ "lang": "python", "repo": "carinfinity/testing", "path": "/myapp/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jk983294/morph path: /book/tensorflow/core/variables.py import tensorflow as tf import os import cProfile def variable_turn_off_gradient(): step_counter = tf.Variable(1, trainable=False) print(step_counter) def variable_placing(): with tf.device('CPU:0'): # Create some ten...
code_fim
medium
{ "lang": "python", "repo": "jk983294/morph", "path": "/book/tensorflow/core/variables.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # This creates a new tensor; it does not reshape the variable. print("\nCopying and reshaping: ", tf.reshape(my_variable, [1, 4])) # Variables can be all kinds of types, just like tensors bool_variable = tf.Variable([False, False, False, True]) complex_variable = tf.Variable([5 + 4j, ...
code_fim
hard
{ "lang": "python", "repo": "jk983294/morph", "path": "/book/tensorflow/core/variables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # copy, two variables will not share the same memory a = tf.Variable([2.0, 3.0]) b = tf.Variable(a) # Create b based on the value of a a.assign([5, 6]) print(a.numpy()) # [5. 6.] print(b.numpy()) # [2. 3.] print(a.assign_add([2, 3]).numpy()) # [7. 9.] print(a.assign_sub...
code_fim
hard
{ "lang": "python", "repo": "jk983294/morph", "path": "/book/tensorflow/core/variables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>treatments_names = ['text_blob', 'vader', 'naive_bayes', 'neural_network'] graphics = ["ROC", "visualize_data"]<|fim_prefix|># repo: Mattross45/RottenTomatoes2.0 path: /tweet_analyser/main.py import pandas as pd import numpy as np from get_data import * from clean_text import * from tweet_analyser...
code_fim
medium
{ "lang": "python", "repo": "Mattross45/RottenTomatoes2.0", "path": "/tweet_analyser/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mattross45/RottenTomatoes2.0 path: /tweet_analyser/main.py import pandas as pd import numpy as np from get_data import * from clean_text import * from tweet_analyser.treatment_algorithms.text_blob_treatement import text_blob_treatement from tweet_analyser.treatment_algorithms.vader_treatment...
code_fim
hard
{ "lang": "python", "repo": "Mattross45/RottenTomatoes2.0", "path": "/tweet_analyser/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42, stratify=y) y_train = y_train.values.ravel() y_test = y_test.values.ravel() print('Data cleaning and train-test split is done') print ('Train set shape:', X_train.shape, y_train.shape) print ('Test set shape: ', ...
code_fim
hard
{ "lang": "python", "repo": "AIMPED/ML_Classification_Kickstarter", "path": "/train_save_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Start year and month of the projects df['start_month']= df['launched_at'].dt.month df['start_year']= df['launched_at'].dt.year # Splitting the text in column category, keeping only the left part of the string --> main category df.category = df.category.apply(lambda x: x.split('/')[0]) # change to lowe...
code_fim
hard
{ "lang": "python", "repo": "AIMPED/ML_Classification_Kickstarter", "path": "/train_save_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AIMPED/ML_Classification_Kickstarter path: /train_save_model.py import numpy as np import pandas as pd import pickle # Scikit Learn from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from datetime import datetime RSEED = 42 df = pd.read_cs...
code_fim
hard
{ "lang": "python", "repo": "AIMPED/ML_Classification_Kickstarter", "path": "/train_save_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Himmalay-Devulapalli/Speech-to-Text-Bot path: /speech_to_text_bot.py from telegram.ext import Updater, CommandHandler, MessageHandler, Filters import speech_recognition as sr from pydub import AudioSegment import pydub from gtts import gTTS #default commands handlers def start(update,cont...
code_fim
hard
{ "lang": "python", "repo": "Himmalay-Devulapalli/Speech-to-Text-Bot", "path": "/speech_to_text_bot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ telegram bots have a default command '/start', when you try to make a conversation with the bot for the first time, you can use the /start command You can add your custom commands using add_handler method. CommandHandler is responsible for handling the comm...
code_fim
hard
{ "lang": "python", "repo": "Himmalay-Devulapalli/Speech-to-Text-Bot", "path": "/speech_to_text_bot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Transforms function signatures with line continuations to a function on a single line with () appended. Required because pygments cannot handle this situation correctly. :param code: :type code: str :return: Code string with functions on single line """ pat = r"""^...
code_fim
hard
{ "lang": "python", "repo": "sphinx-contrib/matlabdomain", "path": "/sphinxcontrib/mat_parser.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def fix_function_signatures(code): """ Transforms function signatures with line continuations to a function on a single line with () appended. Required because pygments cannot handle this situation correctly. :param code: :type code: str :return: Code string with functions on ...
code_fim
hard
{ "lang": "python", "repo": "sphinx-contrib/matlabdomain", "path": "/sphinxcontrib/mat_parser.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sphinx-contrib/matlabdomain path: /sphinxcontrib/mat_parser.py # -*- coding: utf-8 -*- """ Functions for parsing MatlabLexer output. :copyright: Copyright 2023 Jørgen Cederberg :license: BSD, see LICENSE for details. """ import re import sphinx.util logger = sphinx.util.logging.getLogger("matl...
code_fim
hard
{ "lang": "python", "repo": "sphinx-contrib/matlabdomain", "path": "/sphinxcontrib/mat_parser.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: guideontoshar/piaskownica path: /lecture2/instructions/assignements.py name = 'Euzebiusz' a, b = 1,2 # przypisanie rozpakowujące krotkę c, d = [1,2] # przypisanie rozpakowujące listę a,b,c,d = [1,2,3,4] <|fim_suffix|>first,*other,last = [1,2,3,4] print(first, other, last) a +...
code_fim
medium
{ "lang": "python", "repo": "guideontoshar/piaskownica", "path": "/lecture2/instructions/assignements.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> a += 42 # przypisanie rozszerzone<|fim_prefix|># repo: guideontoshar/piaskownica path: /lecture2/instructions/assignements.py name = 'Euzebiusz' a, b = 1,2 # przypisanie rozpakowujące krotkę c, d = [1,2] # przypisanie rozpakowujące listę a,b,c,d = [1,2,3,4] first, *other = [1, 2, 3, ...
code_fim
easy
{ "lang": "python", "repo": "guideontoshar/piaskownica", "path": "/lecture2/instructions/assignements.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> get_flavors: Callable[[], List[int]], get_player_count: Callable[[], int], get_served: Callable[[], List[Dict[int, int]]], get_turns_received: Callable[[], List[int]] ) -> Dict[str, Union[Tuple[int, int], int]]: remain = 24 - self.state[-1] choices...
code_fim
hard
{ "lang": "python", "repo": "jueerEcho/icecream", "path": "/players/g1_player.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jueerEcho/icecream path: /players/g1_player.py import logging import math from typing import Callable, Dict, List, Tuple, Union, NamedTuple import numpy as np from collections import defaultdict class Choice(NamedTuple): flavors: List[int] max_depth: int index: Tuple[int, int] de...
code_fim
hard
{ "lang": "python", "repo": "jueerEcho/icecream", "path": "/players/g1_player.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # events seem to be on their own. for category in ['_trackEvent']: for i in self.data_struct[category]: if single_push: single_pushes.append(i) else: script.append(u"""_gaq.push(%s);""" % i) return ...
code_fim
hard
{ "lang": "python", "repo": "rprots/gaq_hub", "path": "/gaq_hub/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rprots/gaq_hub path: /gaq_hub/__init__.py import types def escape_text(text=''): text = str(text) return text.replace("\'", "\\'") class GaqHub(object): data_struct = None def __init__(self, account_id, single_push=False): """Sets up self.data_struct dict which we use...
code_fim
hard
{ "lang": "python", "repo": "rprots/gaq_hub", "path": "/gaq_hub/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GISer18/UCMerced_LandUse path: /classification2.py import keras from keras.models import Model from keras import backend as K import matplotlib.pyplot as plt import h5py from keras.callbacks import ModelCheckpoint,ReduceLROnPlateau,TensorBoard from sklearn.model_selection import train_test_split ...
code_fim
hard
{ "lang": "python", "repo": "GISer18/UCMerced_LandUse", "path": "/classification2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>net = keras.layers.Dense(units=num_classes,activation="sigmoid")(net) model = keras.Model(inputs=images,outputs=net) model.summary() #%% optimizer = keras.optimizers.Adadelta() class_weights= calculating_class_weights(y_train) model.compile(optimizer= optimizer, loss = get_weighted_loss...
code_fim
hard
{ "lang": "python", "repo": "GISer18/UCMerced_LandUse", "path": "/classification2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>net = keras.layers.Conv2DTranspose(filters=256, kernel_size=(3, 3),strides=(2,2), padding="same")(net) net = keras.layers.concatenate([net,shortcut1], axis=-1) net = keras.layers.BatchNormalization()(net) net = keras.layers.Activation("relu")(net) net = keras.layers.Conv2D(filters=512, kernel_size=(3, 3)...
code_fim
hard
{ "lang": "python", "repo": "GISer18/UCMerced_LandUse", "path": "/classification2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pirateWorley/UnDomainer path: /src/undomainer.py import requests import sys from optparse import OptionParser def scanDomains(domain, port): sub_list = open("Wordlists/subdomains-10000.txt").read() subs = sub_list.splitlines() <|fim_suffix|>if __name__ == '__main__': # Set up option...
code_fim
hard
{ "lang": "python", "repo": "pirateWorley/UnDomainer", "path": "/src/undomainer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': # Set up options from the commandline usage = "usage: %prog [options] filename" parser = OptionParser(usage=usage) parser.add_option("-p", "--port", dest="port",help="set target port to PORT", metavar="PORT", default="80") parser.add_option("-s", "--secure", ...
code_fim
hard
{ "lang": "python", "repo": "pirateWorley/UnDomainer", "path": "/src/undomainer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#capture all the option and print the items all_option=drop.options for option in all_option: print(option.text) time.sleep(5) a.quit()<|fim_prefix|># repo: kandeepanveera/Selenium path: /DropDown.py """ Select Any drop down from option Find out how many options exist in drop down count how...
code_fim
medium
{ "lang": "python", "repo": "kandeepanveera/Selenium", "path": "/DropDown.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kandeepanveera/Selenium path: /DropDown.py """ Select Any drop down from option Find out how many options exist in drop down count how many option present capture option from drop down and print them """ from selenium import webdriver import time #select class need to import from seleniu...
code_fim
hard
{ "lang": "python", "repo": "kandeepanveera/Selenium", "path": "/DropDown.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cheatm/fxdayu_sinta path: /fxdayu_sinta/adjust/env.py from fxdayu_sinta.IO.config import root import json import os config_path = os.path.join(root, "adjust.json") def read_config(): try: return json.load(open(config_path)) except IOError: from fxdayu_sinta.adjust.conf...
code_fim
medium
{ "lang": "python", "repo": "cheatm/fxdayu_sinta", "path": "/fxdayu_sinta/adjust/env.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> from fxdayu_sinta.adjust import CLIENT, DB from fxdayu_sinta.utils.mongo import create_client config = read_config() return create_client(**config.get(CLIENT, {}))[config.get(DB, "adjust")] def get_home(): from fxdayu_sinta.adjust import HOME return read_config().get(HOME, "/rqa...
code_fim
medium
{ "lang": "python", "repo": "cheatm/fxdayu_sinta", "path": "/fxdayu_sinta/adjust/env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def generate(): import click return {'create': click.Command("create", callback=create, help="Create adjust config file with rqalpha bundle adjust data path.", params=[click.Argument(["path"], nargs=1)])}<|fim_prefix|># repo:...
code_fim
hard
{ "lang": "python", "repo": "cheatm/fxdayu_sinta", "path": "/fxdayu_sinta/adjust/env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if grade_points > 92.4: # A return 4 elif grade_points > 89.9: # A- return 3.7 elif grade_points > 87.4: # B+ return 3.33 elif grade_points > 82.4: # B return 3 elif grade_points > 79.9: # B- return 2....
code_fim
hard
{ "lang": "python", "repo": "tik26/gpaAnalyzer", "path": "/src/analyzeGPA_us.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tik26/gpaAnalyzer path: /src/analyzeGPA_us.py class AnalyzeGPA_US: def __init__(self, cource_list): self.cource_list = cource_list def get_gpa(self): sum_gp_by_credits = 0.0 sum_credits = 0.0 for cource_dict in self.cource_list: gp_us = self.g...
code_fim
hard
{ "lang": "python", "repo": "tik26/gpaAnalyzer", "path": "/src/analyzeGPA_us.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> gpa_us = sum_gp_by_credits / sum_credits return gpa_us def grade_points_to_gp(self, grade_points): if grade_points > 92.4: # A return 4 elif grade_points > 89.9: # A- return 3.7 elif grade_points > 87.4: # B+ return 3.33 ...
code_fim
hard
{ "lang": "python", "repo": "tik26/gpaAnalyzer", "path": "/src/analyzeGPA_us.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ganzourii/SE2018G10 path: /CareHub/Staff/migrations/0008_auto_20190207_2254.py # Generated by Django 2.1.5 on 2019-02-07 21:54 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('Staff', '0007_auto_20190206_1854'), ] operations = [ migrations....
code_fim
medium
{ "lang": "python", "repo": "ganzourii/SE2018G10", "path": "/CareHub/Staff/migrations/0008_auto_20190207_2254.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='doctor', name='email', field=models.EmailField(max_length=70, unique=True), ), migrations.AlterField( model_name='doctor', name='image', field=models.ImageF...
code_fim
medium
{ "lang": "python", "repo": "ganzourii/SE2018G10", "path": "/CareHub/Staff/migrations/0008_auto_20190207_2254.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print('O total de terminais comuns encontrados foi') print(Total) print('') print('ANГЃLISE CONCLUГЌDA COM SUCESSO!')<|fim_prefix|># repo: gustavoalecrim/python path: /comparar DF.py # coding: utf-8 from datetime import datetime now = datetime.now() print('INICIANDO A ANГЃLISE DE DADOS...') print('Este ...
code_fim
hard
{ "lang": "python", "repo": "gustavoalecrim/python", "path": "/comparar DF.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gustavoalecrim/python path: /comparar DF.py # coding: utf-8 from datetime import datetime now = datetime.now() print('INICIANDO A ANГЃLISE DE DADOS...') print('Este procedimento requer alguns minutos, por favor aguarde!') print('') print('') <|fim_suffix|>data = open('testlist.txt','r') for...
code_fim
medium
{ "lang": "python", "repo": "gustavoalecrim/python", "path": "/comparar DF.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loss_meter.reset() train_acc_meter.reset() test_acc_meter.reset() if (epoch % 5 == 0) or (epoch == args.final_eval_epoch): torch.save({ 'model_state_dict': model.state_dict(), 'optimizer_state_dict': optimizer.state_dict(), ...
code_fim
hard
{ "lang": "python", "repo": "ekitanidis/SimSiam", "path": "/classifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data, labels = data.to(device), labels.to(device) output = model(data) loss = criterion(output, labels) loss.backward() optimizer.step() loss_meter.update(loss.item()) model.zero_grad() if batch_id % 10 == 0:...
code_fim
hard
{ "lang": "python", "repo": "ekitanidis/SimSiam", "path": "/classifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ekitanidis/SimSiam path: /classifier.py from config import load_args from transforms import baseline from models import Encoder, Predictor, SimSiam, LinearClassifier from schedulers import SimpleCosineDecayLR from utils import accuracy, AverageMeter import time import os import torch from to...
code_fim
hard
{ "lang": "python", "repo": "ekitanidis/SimSiam", "path": "/classifier.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>= 11 # about the optimization self.batch_size = 32 self.num_step = 300000 # about the saver self.save_period = 2000 self.save_dir = './models/' self.summary_dir = './logs/'<|fim_prefix|># repo: caoquanjie/SVHN-multi-digits-recogniton path: /config.p...
code_fim
medium
{ "lang": "python", "repo": "caoquanjie/SVHN-multi-digits-recogniton", "path": "/config.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: caoquanjie/SVHN-multi-digits-recogniton path: /config.py class Config(object): """ Wrapper class for various (hyper)parameters. """ def __init__(self): # about the model architecture self.image_size = 64 self.label_length = 6 self.num_classes <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "caoquanjie/SVHN-multi-digits-recogniton", "path": "/config.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>the saver self.save_period = 2000 self.save_dir = './models/' self.summary_dir = './logs/'<|fim_prefix|># repo: caoquanjie/SVHN-multi-digits-recogniton path: /config.py class Config(object): """ Wrapper class for various (hyper)parameters. """ def __init__(self): ...
code_fim
medium
{ "lang": "python", "repo": "caoquanjie/SVHN-multi-digits-recogniton", "path": "/config.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('simulations', '0005_useraction_simulation'), ] operations = [ migrations.AddField( model_name='useraction', name='time', field=models.DateTimeField(null=True), preserve_default=False, ), migrati...
code_fim
medium
{ "lang": "python", "repo": "mdivband/arcade_swarm", "path": "/web_interface/simulations/migrations/0006_auto_20210103_1812.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoardFruit/leetcode path: /oddEvenList.py # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None <|fim_suffix|> def oddEvenList(self, head): """ :type head: ListNode :rtype:...
code_fim
medium
{ "lang": "python", "repo": "RoardFruit/leetcode", "path": "/oddEvenList.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ :type head: ListNode :rtype: ListNode """ if head is None or head.next is None or head.next.next is None: return head pre=head prenode=head.next node=prenode.next while node: prenode.next=node.nex...
code_fim
medium
{ "lang": "python", "repo": "RoardFruit/leetcode", "path": "/oddEvenList.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuhonghai123/Flok_muitimodal_operators path: /Batch_AudioLogMel.py import pandas as pd from FlokAlgorithmLocal import FlokDataFrame, FlokAlgorithmLocal import json import sys, os import numpy as np import librosa # import cv2 from pandas import Series, DataFrame class Batch_AudioLogMe...
code_fim
hard
{ "lang": "python", "repo": "yuhonghai123/Flok_muitimodal_operators", "path": "/Batch_AudioLogMel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> params = all_info["parameters"] inputPaths = all_info["input"] inputTypes = all_info["inputFormat"] inputLocation = all_info["inputLocation"] outputPaths = all_info["output"] outputTypes = all_info["outputFormat"] outputLocation = all_info["outputLocation"] algorithm...
code_fim
hard
{ "lang": "python", "repo": "yuhonghai123/Flok_muitimodal_operators", "path": "/Batch_AudioLogMel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": all_info = json.loads(sys.argv[1]) # f = open("test.json", encoding = 'utf-8') # all_info = json.loads(f) # all_info = { # "input": ["in.mp3"], # "inputFormat": ["mp3"], # "inputLocation":["local_fs"], # "ou...
code_fim
hard
{ "lang": "python", "repo": "yuhonghai123/Flok_muitimodal_operators", "path": "/Batch_AudioLogMel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SyedMaazHassan/math-practice path: /application/models.py from hashlib import new from django.db import models from datetime import datetime from django.contrib.auth.models import User, auth from django.forms.models import ModelFormOptions, model_to_dict import random # Create your models here. ...
code_fim
hard
{ "lang": "python", "repo": "SyedMaazHassan/math-practice", "path": "/application/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> condition_list = self.conditions.all() new_list = [] for i in condition_list: single_string = f'NUMBER {i.key} {i.limit}' new_list.append(single_string) condition_string = " and ".join(new_list) return condition_string class question(model...
code_fim
hard
{ "lang": "python", "repo": "SyedMaazHassan/math-practice", "path": "/application/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(correct_signs("13 > 44 > 33 > 1")) #➞ False print(correct_signs("1 < 2 < 6 < 9 > 3")) #➞ True<|fim_prefix|># repo: ravalrupalj/BrainTeasers path: /Edabit/Correct_Inequality_Signs.py #Correct Inequality Signs #Create a function that returns true if a given inequality expression is correct and false...
code_fim
easy
{ "lang": "python", "repo": "ravalrupalj/BrainTeasers", "path": "/Edabit/Correct_Inequality_Signs.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ravalrupalj/BrainTeasers path: /Edabit/Correct_Inequality_Signs.py #Correct Inequality Signs #Create a function that returns true if a given inequality expression is correct and false otherwise. def correct_signs(string): <|fim_suffix|>print(correct_signs("13 > 44 > 33 > 1")) #➞ False print(corr...
code_fim
medium
{ "lang": "python", "repo": "ravalrupalj/BrainTeasers", "path": "/Edabit/Correct_Inequality_Signs.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ r3 = RBM(num_visible = 220, num_hidden = 200) train_data3 = output_train2 test_data3 = output_test2 r3.train(train_data3, max_epochs = 5000) output_train3,prob_train3=r3.run_visible(train_data3) output_test3,prob_test3=r3.run_visible(test_data3) print output_test3 """<|fim_prefix|># repo: vishals...
code_fim
hard
{ "lang": "python", "repo": "vishalsubbiah/Kernel-Methods-for-Pattern-Analysis", "path": "/Assignment 2/task5/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>r2.train(train_data2, max_epochs = 5000) output_train2,prob_train2=r2.run_visible(train_data2) output_test2,prob_test2=r2.run_visible(test_data2) X_train = output_train2 X_test=output_test2 Y_train=train_label Y_test=test_label logistic = linear_model.LogisticRegression() rbm = BernoulliRBM(random_stat...
code_fim
hard
{ "lang": "python", "repo": "vishalsubbiah/Kernel-Methods-for-Pattern-Analysis", "path": "/Assignment 2/task5/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vishalsubbiah/Kernel-Methods-for-Pattern-Analysis path: /Assignment 2/task5/test.py import numpy as np import matplotlib.pyplot as plt from scipy.ndimage import convolve from sklearn import linear_model, datasets, metrics from sklearn.cross_validation import train_test_split from sklearn.neural_...
code_fim
hard
{ "lang": "python", "repo": "vishalsubbiah/Kernel-Methods-for-Pattern-Analysis", "path": "/Assignment 2/task5/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gama79530/DesignPattern path: /AbstractFactoryPattern/python/PizzaStore/Pizza.py from enum import Enum import abc from .Ingredient import * class PizzaType(Enum): CHEESE_PIZZA = 0 class Pizza(metaclass=abc.ABCMeta): def __init__(self, ingredients:list[Ingredient]) -> None: self...
code_fim
hard
{ "lang": "python", "repo": "gama79530/DesignPattern", "path": "/AbstractFactoryPattern/python/PizzaStore/Pizza.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, cheese:Cheese, ingredients:list[Ingredient]) -> None: super().__init__(cheese, ingredients) def getName(self) -> str: return "store A cheese pizze" def showIngredients(self) -> str: ingredientsStr = self.cheese.getInfo() for ingr...
code_fim
hard
{ "lang": "python", "repo": "gama79530/DesignPattern", "path": "/AbstractFactoryPattern/python/PizzaStore/Pizza.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def showIngredients(self) -> str: ingredientsStr = self.cheese.getInfo() for ingredient in self.ingredients: ingredientsStr += (", " + ingredient.getInfo()) return ingredientsStr class CheesePizzeOfStoreB(CheesePizza): def __init__(self, cheese:Cheese, ingred...
code_fim
medium
{ "lang": "python", "repo": "gama79530/DesignPattern", "path": "/AbstractFactoryPattern/python/PizzaStore/Pizza.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevin510610/Book_AGuideToPython_Kaiching-Chang path: /unit05/exercise0502.py a = int(input("Please input the first number: ")) b = int<|fim_suffix|>名: exercise0502.py # 作者: Kaiching Chang # 時間: July, 2014<|fim_middle|>(input("Please input the second number: ")) print(a + b) print(a - b) print(a...
code_fim
medium
{ "lang": "python", "repo": "kevin510610/Book_AGuideToPython_Kaiching-Chang", "path": "/unit05/exercise0502.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>名: exercise0502.py # 作者: Kaiching Chang # 時間: July, 2014<|fim_prefix|># repo: kevin510610/Book_AGuideToPython_Kaiching-Chang path: /unit05/exercise0502.py a = int(input("Please input the first number: ")) b = int(input("Please input the second number: ")) print(a + b) p<|fim_middle|>rint(a - b) print(a...
code_fim
easy
{ "lang": "python", "repo": "kevin510610/Book_AGuideToPython_Kaiching-Chang", "path": "/unit05/exercise0502.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif field.one_to_one: if model_cls: related_obj_data = model_cls.construct( **{_field: getattr(related_obj, _field) for _field in model_cls.get_fields()} ) ...
code_fim
hard
{ "lang": "python", "repo": "julyzergcn/pydantic-django", "path": "/pydantic_django/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if model_cls: related_fields = [field for field in model_cls.get_fields() if field != "content_object"] related_obj_data = [ model_cls.construct(**obj_vals) for obj_vals in related_qs.values(*re...
code_fim
hard
{ "lang": "python", "repo": "julyzergcn/pydantic-django", "path": "/pydantic_django/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: julyzergcn/pydantic-django path: /pydantic_django/main.py from inspect import isclass from itertools import chain from typing import Type, Optional, Union, Any from pydantic import BaseModel, create_model, validate_model, Field, ConfigError from pydantic.main import ModelMetaclass import django...
code_fim
hard
{ "lang": "python", "repo": "julyzergcn/pydantic-django", "path": "/pydantic_django/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass class ParenthesesAdmin(admin.ModelAdmin): pass class ScreenplayElementTypeAdmin(admin.ModelAdmin): pass admin.site.register(Slug, SlugAdmin) admin.site.register(Action, ActionAdmin) admin.site.register(Dialogue, DialogueAdmin) admin.site.register(Character, CharacterAdmin) admin.site.reg...
code_fim
hard
{ "lang": "python", "repo": "chemcnabb/django_ultimate_screenwriter", "path": "/ultimate_screenwriter/ultimate_screenwriter/common/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chemcnabb/django_ultimate_screenwriter path: /ultimate_screenwriter/ultimate_screenwriter/common/admin.py __author__ = 'Che' from django.contrib import admin from screenwriter.models import Slug, Action, Dialogue, Character, Screenplay, ScreenplayElements, Parentheses, ScreenplayElementType clas...
code_fim
medium
{ "lang": "python", "repo": "chemcnabb/django_ultimate_screenwriter", "path": "/ultimate_screenwriter/ultimate_screenwriter/common/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pass admin.site.register(Slug, SlugAdmin) admin.site.register(Action, ActionAdmin) admin.site.register(Dialogue, DialogueAdmin) admin.site.register(Character, CharacterAdmin) admin.site.register(Screenplay, ScreenplayAdmin) admin.site.register(ScreenplayElements, ScreenplayElementsAdmin) admin.site.r...
code_fim
hard
{ "lang": "python", "repo": "chemcnabb/django_ultimate_screenwriter", "path": "/ultimate_screenwriter/ultimate_screenwriter/common/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jakestaab/online_calculators path: /calculators.py from flask import request from nec_lib import NECTables as NEC from nec_lib import ConduitFill as CF from nec_lib import WireDerate as WD def get_voltage_drop(material, phase, size, length, current, voltage): form = VD_Form() if form.is_...
code_fim
hard
{ "lang": "python", "repo": "jakestaab/online_calculators", "path": "/calculators.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> centripetal_force = (mass_kg * (velocity_in_meters ** 2)) / radius_meters centrifugal_force = centripetal_force * .224809 horsepower = centripetal_force * .00134102209 output_list = [velocity_in_inch, velocity_in_meters, centripetal_force, centrifuga...
code_fim
hard
{ "lang": "python", "repo": "jakestaab/online_calculators", "path": "/calculators.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for y in WD.temp_lst: if tmp > y: continue elif tmp < y: temp_factor = WD.temp_dict_90[y] break required_ampacity = (crnt / fill_factor / temp_factor) * cntns for z in WD.cu_ampacity_90: if requir...
code_fim
hard
{ "lang": "python", "repo": "jakestaab/online_calculators", "path": "/calculators.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> args = get_args() loader = jinja2.FileSystemLoader([ os.path.join(SCRIPT_PATH, 'user', 'templates'), os.path.join(SCRIPT_PATH, 'templates') ]) env = jinja2.Environment(loader=loader) template = loader.load(env, 'index.md') rendered = template.render({ 'da...
code_fim
hard
{ "lang": "python", "repo": "ihadgraft/lighthouse-reporter", "path": "/lighthouse2md.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }