text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> handle_fig.set_size_inches(paper_width, paper_height)
# left / right / top / bottom : margins, in % of w/h paper
# wspace, hspace = blank space between subplot, in % of w/h paper
pyplot.subplots_adjust(left= left, bottom= bottom, right= right, top= top,
... | code_fim | hard | {
"lang": "python",
"repo": "adlenafane/ML",
"path": "/Code/Data representation/plot_shorthands.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spencejax21/do-your-homework path: /do_homework.py
import tweepy
import requests
import json
#authenticates to twitter and returns
auth = tweepy.OAuthHandler("[API_TOKEN]","[API_TOKEN_SECRET]")
auth.set_access_token("[ACCESS_TOKEN]","[ACCESS_TOKEN_SECRET]")
api = tweepy.API(auth)
#makes sure a... | code_fim | hard | {
"lang": "python",
"repo": "spencejax21/do-your-homework",
"path": "/do_homework.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if(quote[1]):
quote[1] = " -" + quote[1]
last = quote[0][len(quote[0])-1:]
if(last == " "):
quote[0] = quote[0][:len(quote[0])-1]
#tweets the tweet
def tweet(quote):
try:
api.update_status("do your homework." + '\n\n"' + quote[0] + '"' + quote[1])
print("Success")
except:... | code_fim | medium | {
"lang": "python",
"repo": "spencejax21/do-your-homework",
"path": "/do_homework.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(self.file)
def __getitem__(self, index):
out = cv.imread(self.orfile + '/' + self.file[index])
# out = cv.GaussianBlur(out, ksize=(25, 25), sigmaX=0)
out = Image.fromarray(out)
if self.transform:
out = self.transform(out)
retu... | code_fim | medium | {
"lang": "python",
"repo": "guome/SSIM_AE-in-pytorch",
"path": "/dataset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = cv.imread(self.orfile + '/' + self.file[index])
# out = cv.GaussianBlur(out, ksize=(25, 25), sigmaX=0)
out = Image.fromarray(out)
if self.transform:
out = self.transform(out)
return out<|fim_prefix|># repo: guome/SSIM_AE-in-pytorch path: /data... | code_fim | hard | {
"lang": "python",
"repo": "guome/SSIM_AE-in-pytorch",
"path": "/dataset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guome/SSIM_AE-in-pytorch path: /dataset.py
from torch.utils.data import Dataset
import os
import cv2 as cv
from PIL import Image
class Dataset(Dataset):
def __init__(self, orfile, transform = None):
<|fim_suffix|> return len(self.file)
def __getitem__(self, index):
out = ... | code_fim | medium | {
"lang": "python",
"repo": "guome/SSIM_AE-in-pytorch",
"path": "/dataset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrjohansson/version_information path: /version_information/__init__.py
from __future__ import absolute_import
from version_information.version impor<|fim_suffix|>nformation.version_information import *<|fim_middle|>t version as __version__
from version_i | code_fim | easy | {
"lang": "python",
"repo": "jrjohansson/version_information",
"path": "/version_information/__init__.py",
"mode": "psm",
"license": "CC-BY-3.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>nformation.version_information import *<|fim_prefix|># repo: jrjohansson/version_information path: /version_information/__init__.py
from __future__ import absolute_import
from version_information.version impor<|fim_middle|>t version as __version__
from version_i | code_fim | easy | {
"lang": "python",
"repo": "jrjohansson/version_information",
"path": "/version_information/__init__.py",
"mode": "spm",
"license": "CC-BY-3.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Springo/RLAdventure path: /TemporalDifferenceLearning/connect_four/connect_four_nets.py
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
class Connect4Network(torch.nn.Module):
def __init__(... | code_fim | hard | {
"lang": "python",
"repo": "Springo/RLAdventure",
"path": "/TemporalDifferenceLearning/connect_four/connect_four_nets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Training network...")
criterion, optimizer = self.create_loss_and_optimizer(learning_rate=learning_rate)
for epoch in range(num_epochs):
for i in range((len(X) - 1) // batch_size + 1):
if i * batch_size + batch_size < len(X):
... | code_fim | hard | {
"lang": "python",
"repo": "Springo/RLAdventure",
"path": "/TemporalDifferenceLearning/connect_four/connect_four_nets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for epoch in range(num_epochs):
for i in range((len(X) - 1) // batch_size + 1):
if i * batch_size + batch_size < len(X):
X_var = Variable(X[i * batch_size: (i + 1) * batch_size])
y_var = Variable(y[i * batch_size: (i + 1) * batch_... | code_fim | hard | {
"lang": "python",
"repo": "Springo/RLAdventure",
"path": "/TemporalDifferenceLearning/connect_four/connect_four_nets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>DEFAULT_METHOD = {"get": "get", "post": "post"}
urlpatterns = [
path('hec', api_root),
path('hec/health/', HealthInfoViewSet.as_view(DEFAULT_METHOD), name='health-info'),
]<|fim_prefix|># repo: xufana7/health_encyclopedia_code_service-master path: /health_service/urls.py
from django.urls import ... | code_fim | medium | {
"lang": "python",
"repo": "xufana7/health_encyclopedia_code_service-master",
"path": "/health_service/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xufana7/health_encyclopedia_code_service-master path: /health_service/urls.py
from django.urls import path, include
from health_service.views import api_root, HealthInfoViewSet
<|fim_suffix|>urlpatterns = [
path('hec', api_root),
path('hec/health/', HealthInfoViewSet.as_view(DEFAULT_MET... | code_fim | easy | {
"lang": "python",
"repo": "xufana7/health_encyclopedia_code_service-master",
"path": "/health_service/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def group_atoms(coo, cb):
n = coo[3::4]
c = coo[1::4]
o = coo[2::4]
min_bb = np.concatenate([n, c])
ext_bb = np.concatenate([n, c, o, cb])
return n, c, o, cb, min_bb, ext_bb
def strip_tgt(coo, cb, seq):
if seq[0] != 'G':
cb = cb[1:]
if seq[-1] != 'G'... | code_fim | medium | {
"lang": "python",
"repo": "EricZhangSCUT/DeepPSC",
"path": "/code/criteria/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EricZhangSCUT/DeepPSC path: /code/criteria/__init__.py
# -*- coding: utf-8 -*
import numpy as np
from .backbonerebuild import BackboneRebuild
from .criteria import cal_RMSD, cal_GDT, cal_rama
bbrebuild = BackboneRebuild().rebuild
<|fim_suffix|> if seq[0] != 'G':
cb = cb[1... | code_fim | hard | {
"lang": "python",
"repo": "EricZhangSCUT/DeepPSC",
"path": "/code/criteria/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 学習
history = model.fit(X_train, y_train, batch_size=100, epochs=50, verbose=1, validation_data=(X_test, y_test))
# モデルを保存
model.save("vgg_all.h5")
model_json = model.to_json()
open('vgg.json', 'w').write(model_json)
model.save_weights("Model_vgg.h5")
# 汎化制度の評価・表示
score = model.evaluate(X_tes... | code_fim | hard | {
"lang": "python",
"repo": "yutoshouda/graduation-research",
"path": "/transer_learning.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yutoshouda/graduation-research path: /transer_learning.py
# 転移学習ファイル
import cv2
import numpy as np
import os
import re
import matplotlib.pyplot as plt
from keras.utils.np_utils import to_categorical
from keras.layers import Activation, Dense, Dropout, Flatten, Input
from keras.models im... | code_fim | hard | {
"lang": "python",
"repo": "yutoshouda/graduation-research",
"path": "/transer_learning.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># acc, val_accのプロット
plt.plot(history.history["accuracy"], label="acc", ls="-", marker="o")
plt.plot(history.history["val_accuracy"], label="val_acc", ls="-", marker="x")
plt.plot(history.history["loss"], label="loss", ls="-", marker="o")
plt.plot(history.history["val_loss"], label="val_loss", ls="-", ... | code_fim | hard | {
"lang": "python",
"repo": "yutoshouda/graduation-research",
"path": "/transer_learning.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sander777/paradigm_lab1 path: /nist.py
import math
def test1(input, n):
ones = input.count('1') #number of ones
zeroes = input.count('0') #number of zeros
s = abs(ones - zeroes)
p = math.erfc(float(s)/(math.sqrt(float(n)) * math.sqrt(2.0))) #p-value
success ... | code_fim | hard | {
"lang": "python",
"repo": "sander777/paradigm_lab1",
"path": "/nist.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ones = input.count('1') #number of ones
zeroes = input.count('0') #number of zeros
prop = float(ones)/float(n)
tau = 2.0/math.sqrt(n)
vobs = 0.0
if abs(prop-0.5) > tau:
p = 0
else:
vobs = 1.0
for i in range(n-1):
if input[i] != input... | code_fim | hard | {
"lang": "python",
"repo": "sander777/paradigm_lab1",
"path": "/nist.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dandelionlxj/Myblog path: /Myblog/comments/models.py
#coding=utf-8
from django.db import models
# Create your models here.
class Comment(models.Model):
name=models.CharField(max_length=100,verbose_name='名称')
email=models.EmailField(max_length=255,verbose_name='邮箱')
url=models.URLFiel... | code_fim | medium | {
"lang": "python",
"repo": "dandelionlxj/Myblog",
"path": "/Myblog/comments/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.text[:20]
class Meta:
verbose_name_plural='评论表'<|fim_prefix|># repo: dandelionlxj/Myblog path: /Myblog/comments/models.py
#coding=utf-8
from django.db import models
# Create your models here.
class Comment(models.Model):
name=models.CharField(max_length=100,verbose_n... | code_fim | medium | {
"lang": "python",
"repo": "dandelionlxj/Myblog",
"path": "/Myblog/comments/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return self.text[:20]
class Meta:
verbose_name_plural='评论表'<|fim_prefix|># repo: dandelionlxj/Myblog path: /Myblog/comments/models.py
#coding=utf-8
from django.db import models
# Create your models here.
class Comment(models.Model):
<|fim_middle|> name=mode... | code_fim | hard | {
"lang": "python",
"repo": "dandelionlxj/Myblog",
"path": "/Myblog/comments/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Himhith/djangoporfolio path: /projects/migrations/0018_auto_20210216_1402.py
# Generated by Django 3.1.5 on 2021-02-16 13:02
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='project',
old_name='website... | code_fim | medium | {
"lang": "python",
"repo": "Himhith/djangoporfolio",
"path": "/projects/migrations/0018_auto_20210216_1402.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('projects', '0017_project_website'),
]
operations = [
migrations.RenameField(
model_name='project',
old_name='website',
new_name='repoGitLink',
),
migrations.AddField(
model_name='project',
... | code_fim | medium | {
"lang": "python",
"repo": "Himhith/djangoporfolio",
"path": "/projects/migrations/0018_auto_20210216_1402.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='project',
old_name='website',
new_name='repoGitLink',
),
migrations.AddField(
model_name='project',
name='runningProgramLink',
field=models.CharField(blank... | code_fim | medium | {
"lang": "python",
"repo": "Himhith/djangoporfolio",
"path": "/projects/migrations/0018_auto_20210216_1402.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def sort_rows_and_cols(mtx, dataset, type_of_sort="mean", print_debug = False):
# plan:
# add column which is the average
# sort by that column
# remove that column
# transpose, do it again
# transpose back
mtx = np.array(mtx)
data_indices = sort_diff_ways(mtx, data... | code_fim | hard | {
"lang": "python",
"repo": "dodgejesse/bert_on_stilts",
"path": "/analysis/plot_init_vs_data_order.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dodgejesse/bert_on_stilts path: /analysis/plot_init_vs_data_order.py
import loading_data
import numpy as np
import scipy.stats
import itertools
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
dataset_to_metric = {"sst": "acc", "mrpc": "acc_and_f1", "cola": "mcc", "rte"... | code_fim | hard | {
"lang": "python",
"repo": "dodgejesse/bert_on_stilts",
"path": "/analysis/plot_init_vs_data_order.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PoojaBorhade06/Project_task path: /Dept_stu_lect_pro/Pro/LoginApp/urls.py
from django.urls import path
from .views import loginView,lo<|fim_suffix|>iew,name='login'),
path('logout/', logoutView, name='logout'),
path('register/', registerView, name='register')
]<|fim_middle|>goutView,regi... | code_fim | medium | {
"lang": "python",
"repo": "PoojaBorhade06/Project_task",
"path": "/Dept_stu_lect_pro/Pro/LoginApp/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>iew,name='login'),
path('logout/', logoutView, name='logout'),
path('register/', registerView, name='register')
]<|fim_prefix|># repo: PoojaBorhade06/Project_task path: /Dept_stu_lect_pro/Pro/LoginApp/urls.py
from django.urls import path
from .views import loginView,lo<|fim_middle|>goutView,regi... | code_fim | medium | {
"lang": "python",
"repo": "PoojaBorhade06/Project_task",
"path": "/Dept_stu_lect_pro/Pro/LoginApp/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = 1
for i in range(self.w):
x1, self.bits1 = self.__gen_bit(self.bits1, self.p1)
x2, self.bits2 = self.__gen_bit(self.bits2, self.p2)
x3, self.bits3 = self.__gen_bit(self.bits3, self.p3)
x = (x1 * x2) ^ (x2 * x3) ^ x3
resul... | code_fim | medium | {
"lang": "python",
"repo": "Tevronis/SSU.4course",
"path": "/generators_random_digits/task_1/generators/nfsr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tevronis/SSU.4course path: /generators_random_digits/task_1/generators/nfsr.py
from generators import *
import utils
class NFSR(Generator):
PARAMS = ['p1', 'l1', 'p2', 'l2', 'p3', 'l3', 'w']
# 5 5 5 101 201 991
def __init__(self, params):
self.p1 = utils.getParam(params.p1... | code_fim | hard | {
"lang": "python",
"repo": "Tevronis/SSU.4course",
"path": "/generators_random_digits/task_1/generators/nfsr.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zikribayraktar/Udacity_Deep_Learning path: /python_scripts/simple_NN.py
# Simple NN script
import numpy as np
#-------------------------------------------------
# Defining the sigmoid activation function
# f(x) = 1/(1+exp(x))
def sigmoid(x):
return 1/(1+np.exp(-x))
#-----------------------... | code_fim | hard | {
"lang": "python",
"repo": "zikribayraktar/Udacity_Deep_Learning",
"path": "/python_scripts/simple_NN.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># dE/dw = (y-h) * f'(h) * x
# but
# error gradient = (y-h) * f'(h)
error_grad = error * sigmoid_prime(h)
# Gradient descent step
# del_w = eta * error_grad
del_w = learnrate * error_grad * x<|fim_prefix|># repo: zikribayraktar/Udacity_Deep_Learning path: /python_scripts/simple_NN.py
# Simple NN script
... | code_fim | hard | {
"lang": "python",
"repo": "zikribayraktar/Udacity_Deep_Learning",
"path": "/python_scripts/simple_NN.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># output error
error = y - nn_output
# dE/dw = (y-h) * f'(h) * x
# but
# error gradient = (y-h) * f'(h)
error_grad = error * sigmoid_prime(h)
# Gradient descent step
# del_w = eta * error_grad
del_w = learnrate * error_grad * x<|fim_prefix|># repo: zikribayraktar/Udacity_Deep_Learning path: /python_sc... | code_fim | hard | {
"lang": "python",
"repo": "zikribayraktar/Udacity_Deep_Learning",
"path": "/python_scripts/simple_NN.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""Operadores de asignaciones
Se utilizan para asignar el valor a una variable, parecido a “=”.
= es el más simple y asignas a la variable izquierda el valor derecho
+= suma a la variable izquierda el valor derecho
-= restas a la variable izquierda el valor derecho
\*= multiplicas a la ... | code_fim | hard | {
"lang": "python",
"repo": "mecomontes/Python",
"path": "/Desde0/Variables.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>## Diccionarios: Define los datos uno a uno entre un campo y un valor, ejemplo:
datos_basicos = {"nombres":"Fran","apellidos":"Pardo Garcia","numero":"145548","fecha_nacimiento":"03111980",
"lugar_nacimiento":"Madrid, España","nacionalidad":"Portuguesa","estado_civil":"Casado"}
print ("... | code_fim | hard | {
"lang": "python",
"repo": "mecomontes/Python",
"path": "/Desde0/Variables.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mecomontes/Python path: /Desde0/Variables.py
### DATOS CADENA
cadena1 = ('comillas simples')
print (cadena1)
cadena2 = ("comillas dobles")
print (cadena2)
n = "Aprender"
a = "Python"
n_a = n + " " + a
print (n_a)
### DATOS BOOLEANOS: Este es el tipo de variable que solo puede tener Verdadero o ... | code_fim | hard | {
"lang": "python",
"repo": "mecomontes/Python",
"path": "/Desde0/Variables.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def insert(self, val):
def helper(root, val):
if (not root):
return self.Node(val)
elif (val < root.val):
root.left = helper(root.left, val)
elif (val > root.val):
root.right = helper(root.right, val)
... | code_fim | hard | {
"lang": "python",
"repo": "ovifrisch/Python-Data-Structures",
"path": "/trees/bst.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ovifrisch/Python-Data-Structures path: /trees/bst.py
import random
class BST:
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
def __init__(self, data=[]):
self.root = None
... | code_fim | hard | {
"lang": "python",
"repo": "ovifrisch/Python-Data-Structures",
"path": "/trees/bst.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
count_rs_list.append(count_rs)
misc.pickle_save([count_rs_list,data], save_result_at)
else:
count_rs_list, data=misc.pickle_load(save_result_at)
ff=misc.fano_factor(data[2])
a=numpy.ones((2,2))
b=numpy.ones((3,3))
c=numpy.array([[1,2,3],[2,1,3],[3,2,1]])
d=numpy.a... | code_fim | hard | {
"lang": "python",
"repo": "mickelindahl/dynsyn",
"path": "/model/scripts/main_mutual_information_MSN.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mickelindahl/dynsyn path: /model/scripts/main_mutual_information_MSN.py
import numpy
import pylab
import os
import sys
import time as ttime
# Get directory where model and code resides
model_dir= '/'.join(os.getcwd().split('/')[0:-1])
code_dir= '/'.join(os.getcwd().split('/')[0:-2])
#... | code_fim | hard | {
"lang": "python",
"repo": "mickelindahl/dynsyn",
"path": "/model/scripts/main_mutual_information_MSN.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
ff=misc.fano_factor(data[2])
a=numpy.ones((2,2))
b=numpy.ones((3,3))
c=numpy.array([[1,2,3],[2,1,3],[3,2,1]])
d=numpy.array([[2,1],[2,2]])
mi_test=misc.mutual_information([d,c, a,b])
mi=misc.mutual_information(count_rs_list)
max_data=[]
for i in range(3):
data.append(numpy.arr... | code_fim | hard | {
"lang": "python",
"repo": "mickelindahl/dynsyn",
"path": "/model/scripts/main_mutual_information_MSN.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: szf2020/ml4iiot path: /ml4iiot/output/plot.py
from pandas import DataFrame
from ml4iiot.output.abstractoutput import AbstractOutput
import matplotlib.pyplot as plt
import pandas as pd
import pickle
from pandas.plotting import register_matplotlib_converters
from ml4iiot.utility import str2bool, ge... | code_fim | hard | {
"lang": "python",
"repo": "szf2020/ml4iiot",
"path": "/ml4iiot/output/plot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.accumulated_data_frame = self.accumulated_data_frame.combine_first(data_frame_copy)
def destroy(self) -> None:
super().destroy()
register_matplotlib_converters()
for figure_config in self.get_config('figures'):
plt.rcParams.update({'font.size': get_re... | code_fim | hard | {
"lang": "python",
"repo": "szf2020/ml4iiot",
"path": "/ml4iiot/output/plot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xogur6889/ml-agents path: /ml-agents/mlagents/trainers/tests/torch/test_layers.py
from mlagents.torch_utils import torch
from mlagents.trainers.torch.layers import (
Swish,
linear_layer,
lstm_layer,
Initialization,
LSTM,
LayerNorm,
)
def test_swish():
layer = Swish(... | code_fim | hard | {
"lang": "python",
"repo": "xogur6889/ml-agents",
"path": "/ml-agents/mlagents/trainers/tests/torch/test_layers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_layer_norm():
torch.manual_seed(0)
torch_ln = torch.nn.LayerNorm(10, elementwise_affine=False)
cust_ln = LayerNorm()
sample_input = torch.rand(10)
assert torch.all(
torch.isclose(
torch_ln(sample_input), cust_ln(sample_input), atol=1e-5, rtol=0.0
)... | code_fim | hard | {
"lang": "python",
"repo": "xogur6889/ml-agents",
"path": "/ml-agents/mlagents/trainers/tests/torch/test_layers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sample_input = torch.rand(10)
assert torch.all(
torch.isclose(
torch_ln(sample_input), cust_ln(sample_input), atol=1e-5, rtol=0.0
)
)
sample_input = torch.rand((4, 10))
assert torch.all(
torch.isclose(
torch_ln(sample_input), cust_ln(samp... | code_fim | hard | {
"lang": "python",
"repo": "xogur6889/ml-agents",
"path": "/ml-agents/mlagents/trainers/tests/torch/test_layers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
# Send the html message
output = 'v1 - This is Adrian'
self.wfile.write(output.encode('utf-8'))
return<|fim_prefix|># repo: ablazleon/python... | code_fim | easy | {
"lang": "python",
"repo": "ablazleon/pythonjx",
"path": "/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ablazleon/pythonjx path: /app.py
#!/usr/bin/python
from http.server import BaseHTTPRequestHandler
<|fim_suffix|>class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
... | code_fim | easy | {
"lang": "python",
"repo": "ablazleon/pythonjx",
"path": "/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> study_results_table = StudyResultsTable(request.school)
frontend.table.RequestConfig(request).configure(study_results_table)
return django.shortcuts.render(
request, 'study_results/staff/study_results.html',
{'study_results_table': study_results_table})
@groups.decorators.onl... | code_fim | hard | {
"lang": "python",
"repo": "fossabot/SIStema",
"path": "/src/web/modules/study_results/staff/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drhaz/banzai path: /banzai/photcalibration.py
talog to index-match the reference catalog.
# There is probably as smarter way of doing this!
instCatalogT = np.transpose(instCatalog)[idx]
instCatalog = np.transpose(instCatalogT)
# Measure the distance between matche... | code_fim | hard | {
"lang": "python",
"repo": "drhaz/banzai",
"path": "/banzai/photcalibration.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drhaz/banzai path: /banzai/photcalibration.py
tCatalog['refmag'] - retCatalog['instmag']
refmag = retCatalog['refmag']
refcol = retCatalog['refcol']
# Calculate the photometric zeropoint.
# TODO: Robust median w/ rejection, error propagation.
cleandata = ... | code_fim | hard | {
"lang": "python",
"repo": "drhaz/banzai",
"path": "/banzai/photcalibration.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> _logger.debug("Querying catalog: Ra=%f...%f Dec=%f...%f" % (min_ra, max_ra, min_dec, max_dec))
if (max_ra > 360.):
# This wraps around the high end, shift all ra values by -180
# Now all search RAs are ok and around the 180, next also move the catalog values
... | code_fim | hard | {
"lang": "python",
"repo": "drhaz/banzai",
"path": "/banzai/photcalibration.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> file = open(file_path, 'r')
formatted_data = format_data(file)
# get station code
station_code = file_path.split('.')[0].split('-')[-1]
# 1 - get device id from station code
current_device_id = ""
while True:
try:
# get device id
api_response = d... | code_fim | hard | {
"lang": "python",
"repo": "jualabs/tb-inmet",
"path": "/crawl_stations_data_and_update_tb.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jualabs/tb-inmet path: /crawl_stations_data_and_update_tb.py
port swagger_client
from swagger_client.rest import ApiException
from tb_inmet_utils import renew_token
from tb_inmet_utils import get_tb_api_configuration
import json
import requests
import urllib
import yaml
import ast
import sys
impo... | code_fim | hard | {
"lang": "python",
"repo": "jualabs/tb-inmet",
"path": "/crawl_stations_data_and_update_tb.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># function that iterates over all folders
def iterate_over_all_files(root_path):
# compute the total number of files
file_counter = 0
for file_path in walkdir(root_path):
file_counter += 1
# iterates over all files
with tqdm(total=file_counter, unit='files') as pbar:
fo... | code_fim | hard | {
"lang": "python",
"repo": "jualabs/tb-inmet",
"path": "/crawl_stations_data_and_update_tb.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.plot(history['accuracy'])
plt.plot(history['val_accuracy'])
plt.title('Model Accuracy')
plt.ylabel('Accuracy')
plt.xlabel('Epoch')
plt.legend(['Train_accuracy', 'Val_accuracy'], loc='upper left')
plt.grid()
plt.show()
def plot_hist_loss(history):
plt.plot(history['... | code_fim | hard | {
"lang": "python",
"repo": "rtgunti/LesionSegmentation",
"path": "/history_plots.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.plot(history['recall'])
plt.plot(history['val_recall'])
plt.title('Model recall')
plt.ylabel('recall')
plt.xlabel('Epoch')
plt.legend(['Train', 'Val'], loc='upper left')
plt.grid()
plt.show()
def plot_hist_tversky(history):
plt.plot(history['tversky'])
plt.plot... | code_fim | hard | {
"lang": "python",
"repo": "rtgunti/LesionSegmentation",
"path": "/history_plots.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rtgunti/LesionSegmentation path: /history_plots.py
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 22 18:45:16 2020
History Plots
@author: rtgun
"""
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import seaborn as sns
def plot_hist_dice_coef(history):
plt.plot(history['d... | code_fim | hard | {
"lang": "python",
"repo": "rtgunti/LesionSegmentation",
"path": "/history_plots.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fainle/code path: /python/weather_data/sample/model/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import DateTime, Column, func
app = Flask(__name__)
app.config.from_object('config.DevelopmentConfig')
<|... | code_fim | medium | {
"lang": "python",
"repo": "fainle/code",
"path": "/python/weather_data/sample/model/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Model column: timestamp mixin decorator.
"""
cls.created_at = Column(DateTime, default=func.now(), nullable=False)
cls.updated_at = Column(DateTime, default=func.now(), nullable=False)
return cls<|fim_prefix|># repo: fainle/code path: /python/weather_data/sample/model/__init... | code_fim | medium | {
"lang": "python",
"repo": "fainle/code",
"path": "/python/weather_data/sample/model/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> cls.created_at = Column(DateTime, default=func.now(), nullable=False)
cls.updated_at = Column(DateTime, default=func.now(), nullable=False)
return cls<|fim_prefix|># repo: fainle/code path: /python/weather_data/sample/model/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask... | code_fim | medium | {
"lang": "python",
"repo": "fainle/code",
"path": "/python/weather_data/sample/model/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('restorani', '0012_notification'),
]
operations = [
migrations.AddField(
model_name='notification',
name='type',
field=models.CharField(max_length=10, null=True),
),
]<|fim_prefix|># repo: Gambit88/RestoraniTP4... | code_fim | easy | {
"lang": "python",
"repo": "Gambit88/RestoraniTP4",
"path": "/Restorani/Restorani/restoranii/restorani/migrations/0013_notification_type.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gambit88/RestoraniTP4 path: /Restorani/Restorani/restoranii/restorani/migrations/0013_notification_type.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-29 19:38
from __future__ import unicode_literals
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
... | code_fim | easy | {
"lang": "python",
"repo": "Gambit88/RestoraniTP4",
"path": "/Restorani/Restorani/restoranii/restorani/migrations/0013_notification_type.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cr2uchile/Pacific-Ocean-Biomass path: /O3_main.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 28 19:49:00 2020
@author: menares
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from netCDF4 import Dataset
import netCDF4 as netCDF4
from matplo... | code_fim | hard | {
"lang": "python",
"repo": "cr2uchile/Pacific-Ocean-Biomass",
"path": "/O3_main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def pd_o3_obs(stn,lvl):
o3_lv = o3[stn,:,lvl]
a = o3_lv.data.astype(float)
a[np.where(o3_lv.mask!=0)] = np.nan
a[a>350] = np.nan
t = time.data.astype(float)
t[np.where(time.mask!=0)] = np.nan
fechas = pd.date_range('1994-01-01-00','2014-12-23-23',freq='H')
p... | code_fim | hard | {
"lang": "python",
"repo": "cr2uchile/Pacific-Ocean-Biomass",
"path": "/O3_main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phwestfall/python-challenge path: /PyBoss/main.py
###### only had time to figure out how to split the first name and last name
###### into separate rows
import os
import csv
# set path for file
budgetCSV = os.path.join("employee_data.csv")
firstlastname = []
# open CSV
with open(budgetCSV, ... | code_fim | hard | {
"lang": "python",
"repo": "phwestfall/python-challenge",
"path": "/PyBoss/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open(output_file, "w", newline="") as datafile:
writer = csv.writer(datafile, delimiter=',')
# add the headers
writer.writerow(["First Name", "Last Name"])
# add the rest of the rows using the newBudget variable
writer.writerows(split)
# =============================... | code_fim | hard | {
"lang": "python",
"repo": "phwestfall/python-challenge",
"path": "/PyBoss/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> xml_save_root = "F:/serve_data/202101-03formodel/exrtact_file/Annotations/nouse"
if not os.path.exists(xml_save_root): os.mkdir(xml_save_root)
for c in os.listdir(img_root):
img_dir = img_root + "/" + c
xml_dir = xml_root + "/" + c
xml_save_dir = xml_save_root + "/" + ... | code_fim | hard | {
"lang": "python",
"repo": "sunyihuan326/kx_detection",
"path": "/data_script/copy_xml_from_img.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> xml_save_dir = xml_save_root + "/" + c
if not os.path.exists(xml_save_dir): os.mkdir(xml_save_dir)
copy_xml(img_dir, xml_dir, xml_save_dir)<|fim_prefix|># repo: sunyihuan326/kx_detection path: /data_script/copy_xml_from_img.py
# -*- encoding: utf-8 -*-
"""
根据img文件移动xml文件
@File ... | code_fim | hard | {
"lang": "python",
"repo": "sunyihuan326/kx_detection",
"path": "/data_script/copy_xml_from_img.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunyihuan326/kx_detection path: /data_script/copy_xml_from_img.py
# -*- encoding: utf-8 -*-
"""
根据img文件移动xml文件
@File : copy_xml_from_img.py
@Time : 2019/12/3 8:45
@Author : sunyihuan
"""
import os
import shutil
<|fim_suffix|> xml_save_root = "F:/serve_data/202101-03formodel/exrtact_fi... | code_fim | hard | {
"lang": "python",
"repo": "sunyihuan326/kx_detection",
"path": "/data_script/copy_xml_from_img.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "Creating inputs..."
x = theano.tensor.tensor3("x")
y = theano.tensor.tensor3("y")
print "Computing LSTM's unfold expression..."
expression = lstm.unfold_train_apply(x, unfold)
print "Computing MSE cost expression..."
cost = theano.tensor.mean((expression[0] - y)**2)
print "Constructing params...... | code_fim | hard | {
"lang": "python",
"repo": "duchesneaumathieu/IFT6266",
"path": "/LSTM-MSE/make_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>lstm = LSTM(inputs_size, depth)
print "Creating inputs..."
x = theano.tensor.tensor3("x")
y = theano.tensor.tensor3("y")
print "Computing LSTM's unfold expression..."
expression = lstm.unfold_train_apply(x, unfold)
print "Computing MSE cost expression..."
cost = theano.tensor.mean((expression[0] - y)**... | code_fim | hard | {
"lang": "python",
"repo": "duchesneaumathieu/IFT6266",
"path": "/LSTM-MSE/make_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duchesneaumathieu/IFT6266 path: /LSTM-MSE/make_model.py
import numpy as np
import pickle
import theano
import sys
from Utilities.Sound import *
from Functionals import *
argv = sys.argv
if len(argv)!=5:
print "python model.py <pickle name> <inputs size> <LSTM depth> <unfold number>"
sy... | code_fim | medium | {
"lang": "python",
"repo": "duchesneaumathieu/IFT6266",
"path": "/LSTM-MSE/make_model.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_minDepth():
s = Solution()
for case in test_cases:
assert s.minDepth(buildTreeFromList(case[0])) == case[1], case<|fim_prefix|># repo: 0x0400/LeetCode path: /p111_test.py
from p111 import Solution
from common.tree import buildTreeFromList
<|fim_middle|>test_cases = [
([3,9,2... | code_fim | medium | {
"lang": "python",
"repo": "0x0400/LeetCode",
"path": "/p111_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = Solution()
for case in test_cases:
assert s.minDepth(buildTreeFromList(case[0])) == case[1], case<|fim_prefix|># repo: 0x0400/LeetCode path: /p111_test.py
from p111 import Solution
from common.tree import buildTreeFromList
test_cases = [
([3,9,20,None,None,15,7], 2),
([2,None... | code_fim | easy | {
"lang": "python",
"repo": "0x0400/LeetCode",
"path": "/p111_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0x0400/LeetCode path: /p111_test.py
from p111 import Solution
from common.tree import buildTreeFromList
<|fim_suffix|>def test_minDepth():
s = Solution()
for case in test_cases:
assert s.minDepth(buildTreeFromList(case[0])) == case[1], case<|fim_middle|>test_cases = [
([3,9,2... | code_fim | medium | {
"lang": "python",
"repo": "0x0400/LeetCode",
"path": "/p111_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matthewdbray/create_airfields path: /createbcHeader.py
#!/usr/bin/env python
import sys, os, glob
import xlrd
import numpy as np
def print_usage():
print "Usage: run this in the folder where you have your excel material files."
print "Search for ??? to see the fields that you will nee... | code_fim | hard | {
"lang": "python",
"repo": "matthewdbray/create_airfields",
"path": "/createbcHeader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>outfile.write("MP MID bc 3dm\n")
outfile.write("MP MID ???\n")
footer = '''MP G 1.27202e+08 ! Gravity, (m)/(hr^2)
MP SHW .001172 ! Specific heat of water, Units = (W-hr)/(g K)
MP SHG .000347 ! Specific heat of gas, Units = (W-hr)/(g K)
MP SGW 1 ! Specific gravity of water
MP SGG 0.001 ! Specific g... | code_fim | hard | {
"lang": "python",
"repo": "matthewdbray/create_airfields",
"path": "/createbcHeader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jesscsam/DataProcessing path: /Homework/Week_2/eda.py
import pandas
import numpy as np
import matplotlib.pyplot as plt
import json
def clean_data(alldata):
# Remove whitespace from Region column
alldata['Region'] = alldata['Region'].str.strip()
# Remove columns unnecessary for this... | code_fim | hard | {
"lang": "python",
"repo": "jesscsam/DataProcessing",
"path": "/Homework/Week_2/eda.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def plot_hist_GDP(data):
# Print mean, median, mode and std values for GDP data
print("GDP data:")
print(f"Mean: {data['GDP ($ per capita)'].mean()}")
print(f"Median: {data['GDP ($ per capita)'].median()}")
mode = data['GDP ($ per capita)'].mode()
print(f"Mode: {mode.iloc[0]}")
... | code_fim | hard | {
"lang": "python",
"repo": "jesscsam/DataProcessing",
"path": "/Homework/Week_2/eda.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ver228/classify_strains path: /src/data/count_trajectory_length.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 09:52:44 2017
@author: ajaver
"""
import os
import sys
import glob
import numpy as np
import pandas as pd
import tables
import multiprocessing as mp
from t... | code_fim | hard | {
"lang": "python",
"repo": "ver228/classify_strains",
"path": "/src/data/count_trajectory_length.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f_ext = '_{}.hdf5'.format(set_type)
features_files = glob.glob(os.path.join(feats_dir, '**/*{}'.format(f_ext)), recursive=True)
features_files = [x.replace(f_ext, '') for x in features_files]
experiments_df = get_rig_experiments_df(features_files, csv_files)
experiments_df = exper... | code_fim | hard | {
"lang": "python",
"repo": "ver228/classify_strains",
"path": "/src/data/count_trajectory_length.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asbalderson/amtfront path: /amtfront/amtfront.py
exam = "none"
return render_template('error.html', exam=str(exam), error=str(error)), 500
@app.errorhandler(500)
def ise(error):
if session['exam']:
exam = session.get('exam')
else:
exam = "none"
return render... | code_fim | hard | {
"lang": "python",
"repo": "asbalderson/amtfront",
"path": "/amtfront/amtfront.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif request.form.get('delete') == 'delete':
url = (baseurl + '/question/' + question_id)
r = requests.delete(url, headers=headers)
else:
question = request.form.get('question')
url = (baseurl + '/question/' + question_id)
head... | code_fim | hard | {
"lang": "python",
"repo": "asbalderson/amtfront",
"path": "/amtfront/amtfront.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asbalderson/amtfront path: /amtfront/amtfront.py
certdict and cert['passed']:
certdict[cert['examid']] = cert
return render_template('home.html', admin=admin, user=user, exams=exams, certs=certdict)
@app.errorhandler(Exception)
def global_error(error):
if session['exam']:
... | code_fim | hard | {
"lang": "python",
"repo": "asbalderson/amtfront",
"path": "/amtfront/amtfront.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>name = "kobi"
logging.info(f"Hello log from {name}")
logging.info("Hello log from %s", name)
logging.info({"name": "kobi"})
import json
dict_name = {"name1": "kobi1"}
logging.info(json.dumps(dict_name))<|fim_prefix|># repo: kobimic/logging_demo path: /root_logger_4_formats_and_variables.py
# import l... | code_fim | medium | {
"lang": "python",
"repo": "kobimic/logging_demo",
"path": "/root_logger_4_formats_and_variables.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kobimic/logging_demo path: /root_logger_4_formats_and_variables.py
# import logging
#
# logging.basicConfig(format='%(name)s - %(levelname)s - %(message)s', level=logging.INFO)
# logging.info("this will start the file...")
# logging.warning("This will get logged to a file")
import logging
logg... | code_fim | medium | {
"lang": "python",
"repo": "kobimic/logging_demo",
"path": "/root_logger_4_formats_and_variables.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def j_pousy2spell_list(cls, j_pousy):
text = cls.j_pousy2text(j_pousy)
return lfilter(bool, text.splitlines())<|fim_prefix|># repo: yerihyo/henrique path: /henrique/main/command/pousy.py
from future.utils import lfilter
class Pousy:
class Field:
TEXT = "... | code_fim | easy | {
"lang": "python",
"repo": "yerihyo/henrique",
"path": "/henrique/main/command/pousy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> text = cls.j_pousy2text(j_pousy)
return lfilter(bool, text.splitlines())<|fim_prefix|># repo: yerihyo/henrique path: /henrique/main/command/pousy.py
from future.utils import lfilter
class Pousy:
class Field:
TEXT = "text"
LANG = "lang"
F = Field
@classmethod... | code_fim | easy | {
"lang": "python",
"repo": "yerihyo/henrique",
"path": "/henrique/main/command/pousy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yerihyo/henrique path: /henrique/main/command/pousy.py
from future.utils import lfilter
class Pousy:
class Field:
TEXT = "text"
LANG = "lang"
F = Field
@classmethod
def j_pousy2text(cls, j_pousy):
return j_pousy[cls.F.TEXT]
<|fim_suffix|> text = ... | code_fim | easy | {
"lang": "python",
"repo": "yerihyo/henrique",
"path": "/henrique/main/command/pousy.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rodrigolusa/8-puzzle path: /src/nodo.py
from direcao import Direcao
import sys
class Nodo:
def __init__(self, estado: str, estado_pai=None, acao=None, custo_caminho=0):
self.estado = estado
self.estado_pai = estado_pai
self.acao = acao
self.custo_caminho = cu... | code_fim | hard | {
"lang": "python",
"repo": "rodrigolusa/8-puzzle",
"path": "/src/nodo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> nodo = Nodo(estado, custo_caminho=custo)
sucessores = nodo.get_sucessores()
for sucessor in sucessores:
print(f"({sucessor.acao},{sucessor.estado},{sucessor.custo_caminho},{sucessor.estado_pai.estado})", end=" ")
if __name__ == "__main__":
funcao = sys.argv[1]
estado = sys.ar... | code_fim | hard | {
"lang": "python",
"repo": "rodrigolusa/8-puzzle",
"path": "/src/nodo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def avalia_expande(estado, custo):
nodo = Nodo(estado, custo_caminho=custo)
sucessores = nodo.get_sucessores()
for sucessor in sucessores:
print(f"({sucessor.acao},{sucessor.estado},{sucessor.custo_caminho},{sucessor.estado_pai.estado})", end=" ")
if __name__ == "__main__":
func... | code_fim | hard | {
"lang": "python",
"repo": "rodrigolusa/8-puzzle",
"path": "/src/nodo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Municipio
fields = [
'c_mnpio',
'd_mnpio',
'c_estado',
]<|fim_prefix|># repo: Mick-tz/curadeuda path: /sepomex/codigos_postales/serializers/serializador_municipio.py
from rest_framework import serializers
from codigos_postales.serialize... | code_fim | medium | {
"lang": "python",
"repo": "Mick-tz/curadeuda",
"path": "/sepomex/codigos_postales/serializers/serializador_municipio.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mick-tz/curadeuda path: /sepomex/codigos_postales/serializers/serializador_municipio.py
from rest_framework import serializers
from codigos_postales.serializers.serializador_estado import SerializadorEstado
from codigos_postales.models.municipio import Municipio
class SerializadorMunicipio(ser... | code_fim | easy | {
"lang": "python",
"repo": "Mick-tz/curadeuda",
"path": "/sepomex/codigos_postales/serializers/serializador_municipio.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>## lets make a class for the person to store all their info in the same place
class person:
name = " "
adress = " "
email = " "
gender = " "
mortgage = " "
## this function will ask the user if they want to send their information to real estate agents.
## If they select yes it will a... | code_fim | hard | {
"lang": "python",
"repo": "natehaus12/pythonProject",
"path": "/calculator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = " "
adress = " "
email = " "
gender = " "
mortgage = " "
## this function will ask the user if they want to send their information to real estate agents.
## If they select yes it will ask for their info/ put it into a class and write it to a file
## This file could hypothetica... | code_fim | hard | {
"lang": "python",
"repo": "natehaus12/pythonProject",
"path": "/calculator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: natehaus12/pythonProject path: /calculator.py
## this function will get the variables needed to calculate the monthly mortgage
def get_info():
print("Welcome to the home mortgage calculator.")
print("This program will calculate your monthly payment on a loan for a house.")
print("It w... | code_fim | hard | {
"lang": "python",
"repo": "natehaus12/pythonProject",
"path": "/calculator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.