text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: itd/nportal path: /nportal/views/schemas.py
import deform
import deform.widget
from deform import (widget) # decorator, default_renderer, field, form,
import colander
# import htmllaundry
# from htmllaundry import sanitize
from validators import (cyber_validator,
phone_v... | code_fim | hard | {
"lang": "python",
"repo": "itd/nportal",
"path": "/nportal/views/schemas.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> cell = colander.SchemaNode(
colander.String(),
title='Cell phone number',
description='For contact and verification',
validator=phone_validator,
missing=unicode(''),
widget=widget.TextInputWidget(
placeholder='(Optional) example: +1-000-000-0000'... | code_fim | hard | {
"lang": "python",
"repo": "itd/nportal",
"path": "/nportal/views/schemas.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simhaonline/csp path: /cstasker/migrations/0002_auto_20180412_1237.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-04-12 12:37
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('cstasker', '0001_initial'... | code_fim | easy | {
"lang": "python",
"repo": "simhaonline/csp",
"path": "/cstasker/migrations/0002_auto_20180412_1237.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('cstasker', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='usertask',
name='ut_id',
field=models.BigIntegerField(primary_key=True, serialize=False),
),
]<|fim_prefix|># repo: simhaonline/cs... | code_fim | easy | {
"lang": "python",
"repo": "simhaonline/csp",
"path": "/cstasker/migrations/0002_auto_20180412_1237.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_permissions(self):
"""
Instantiates and returns the list of permissions that this view requires.
"""
from rest_framework.permissions import IsAuthenticated, IsAdminUser
if self.action =='retrieve' or self.action == 'update':
permission_class... | code_fim | hard | {
"lang": "python",
"repo": "live-wire/community",
"path": "/unchained/community/institution/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: live-wire/community path: /unchained/community/institution/views.py
from django.shortcuts import render
from rest_framework import generics
from rest_framework import mixins
from django.contrib.auth.models import User
from rest_framework import permissions
from rest_framework.decorators import a... | code_fim | medium | {
"lang": "python",
"repo": "live-wire/community",
"path": "/unchained/community/institution/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not belongsToInstitution(request, self.get_object()):
raise PermissionDenied(detail='User does not belong to the institution', code=None)
return super(InstitutionViewSet, self).retrieve(request, *args, **kwargs)
def update(self, request, *args, **kwargs):
if not... | code_fim | medium | {
"lang": "python",
"repo": "live-wire/community",
"path": "/unchained/community/institution/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='user',
name='my_resume',
field=models.CharField(choices=[('', ''), ('삼성전자', '삼성전자')], default=True, max_length=80),
),
]<|fim_prefix|># repo: seeheee/interview_chatbot_last path: /Clustering Resume... | code_fim | medium | {
"lang": "python",
"repo": "seeheee/interview_chatbot_last",
"path": "/Clustering Resume/Clustering Resume/user/migrations/0002_user_my_resume.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seeheee/interview_chatbot_last path: /Clustering Resume/Clustering Resume/user/migrations/0002_user_my_resume.py
# Generated by Django 2.2.5 on 2019-10-28 08:45
<|fim_suffix|>
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "seeheee/interview_chatbot_last",
"path": "/Clustering Resume/Clustering Resume/user/migrations/0002_user_my_resume.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_template('pools.html', pools=Pool.query.all())
@app.route('/pool/<pool>', methods=['GET'])
def pool(pool):
db_pool = Pool.query.get(pool)
if db_pool is None:
abort(404, description="Pool with ID {} could not be found.".format(pool))
return render_template('pool.html... | code_fim | hard | {
"lang": "python",
"repo": "technikamateur/dirkules",
"path": "/dirkules/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: technikamateur/dirkules path: /dirkules/views.py
import datetime
import subprocess
from time import sleep
from flask import render_template, redirect, request, url_for, flash, abort
from dirkules import app, db, scheduler, app_version
import dirkules.manager.serviceManager as servMan
import dirku... | code_fim | hard | {
"lang": "python",
"repo": "technikamateur/dirkules",
"path": "/dirkules/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fig = plt.figure()
for i in range(3):
ax = fig.add_subplot(1,3,i, projection='3d')
X = mnfa
xlen = len(X)
Y = nna
ylen = len(Y)
X, Y = np.meshgrid(X, Y)
Z = fraction_data[i]
colortuple = ('r', 'b')
colors = np.empty(X.shape, dtype=str)
for y in range(ylen):
... | code_fim | hard | {
"lang": "python",
"repo": "sksavant/analyze_pc",
"path": "/res/plot_tc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sksavant/analyze_pc path: /res/plot_tc.py
#!/usr/bin/python
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
occl_frac = 0.445188
result = [1-occl_frac, occl_frac, 0]
<|fim_suffix|>fraction_data=[[[0.0 for i in range(len(mnfa))... | code_fim | medium | {
"lang": "python",
"repo": "sksavant/analyze_pc",
"path": "/res/plot_tc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_urls(search_string, start):
temp = []
url = 'http://www.google.com/search'
payload = {'q': search_string, 'start': start}
my_headers = {'User-agent': 'Mozilla/11.0'}
r = requests.get(url, params=payload, headers=my_headers)
soup = BeautifulSoup(r.text, 'html.parser')
h3... | code_fim | medium | {
"lang": "python",
"repo": "dockerized89/hyper",
"path": "/excercises/11_web_scraper/web_scraper_mp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dockerized89/hyper path: /excercises/11_web_scraper/web_scraper_mp.py
"""Google Scraper
Usage:
web_scraper.py <search> <pages> <processes>
web_scraper.py (-h | --help)
Arguments:
<search> String to be Searched
<pages> Number of pages
<processes> Number of parallel... | code_fim | hard | {
"lang": "python",
"repo": "dockerized89/hyper",
"path": "/excercises/11_web_scraper/web_scraper_mp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> start = timer()
result = []
arguments = docopt(__doc__, version='MakMan Google Scrapper & Mass Exploiter')
search = arguments['<search>']
pages = arguments['<pages>']
processes = int(arguments['<processes>'])
####Changes for Multi-Processing####
make_request = partial(get_u... | code_fim | medium | {
"lang": "python",
"repo": "dockerized89/hyper",
"path": "/excercises/11_web_scraper/web_scraper_mp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> about_us = get_object_or_404(AboutSite,id=1)
context = {
'about': about_us
}
return render(request, 'hub/about.html', context)
def authors(request):
profiles = Profile.objects.all()
context = {
'profiles': profiles
}
return render(request, 'hub/authors.html', context)
def authorDetail(requ... | code_fim | hard | {
"lang": "python",
"repo": "HashimovH/django-practice-projects",
"path": "/bioinfohub/hub/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HashimovH/django-practice-projects path: /bioinfohub/hub/views.py
from django.shortcuts import render
from post.models import *
from .models import *
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from account.models import Profile
from django.contrib.auth.models import ... | code_fim | medium | {
"lang": "python",
"repo": "HashimovH/django-practice-projects",
"path": "/bioinfohub/hub/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.imshow(depth)
plt.show()
# convert from pfm file equation?
pfm = imageio.imread('images/Classroom1-perfect/disp0.pfm')
pfm = np.asarray(pfm)
plt.imshow(pfm)
plt.show()
depth = np.zeros(shape=imgL.shape).astype(float)
depth[pfm > 0] = (fx * baseline) / (doffs + pfm[pfm > 0])
#print(depth)
plt.imsho... | code_fim | hard | {
"lang": "python",
"repo": "f-wright/depth-estimation-exploration",
"path": "/stereo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: f-wright/depth-estimation-exploration path: /stereo.py
import numpy as np
import cv2
from matplotlib import pyplot as plt
from matplotlib import cm
import imageio
# # Backpack values
# fx = 7190.247 # lense focal length
# baseline = 174.945 # distance in mm between the tw... | code_fim | hard | {
"lang": "python",
"repo": "f-wright/depth-estimation-exploration",
"path": "/stereo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> "Read an expression from a sequence of tokens"
if len(tokens) == 0:
raise SyntaxError('unexpected EOF')
token = tokens.pop(0)
if token == '(':
L = []
while tokens[0] != ')':
L.append(read_from_tokens(tokens))
tokens.pop(0) # pop off ')'
r... | code_fim | hard | {
"lang": "python",
"repo": "thallysrc/lislav",
"path": "/lislav.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thallysrc/lislav path: /lislav.py
import math
import operator as op
Symbol = str
Number = (int, float)
Atom = (Symbol, Number)
List = list
Exp = (Atom, List)
Env = dict
def standard_env() -> Env:
"An environment with some scheme standard procedures"
env = Env()
env.update(... | code_fim | hard | {
"lang": "python",
"repo": "thallysrc/lislav",
"path": "/lislav.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> "Evaluate an expression in an environment."
if isinstance(x, Symbol): # variable reference
return env[x]
elif not isinstance(x, List): # constant number
return x
elif x[0] == 'if': # conditional
(_, test, conseq, alt) = x
exp = (conseq if eval(test, env) els... | code_fim | hard | {
"lang": "python",
"repo": "thallysrc/lislav",
"path": "/lislav.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mr-Robot-1216/Projects path: /Sudoku/sudoku.py
from pprint import pprint
from collections import Counter
from copy import deepcopy
class Sudoku():
def __init__(self, grid):
'''
Initializes the grid
'''
self.grid = grid
self.sub_gr... | code_fim | hard | {
"lang": "python",
"repo": "Mr-Robot-1216/Projects",
"path": "/Sudoku/sudoku.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def perform(self):
'''
Performs the step_1 and step_2 untill the Sub grid is solved
Returns None
'''
temp = []
while self.sub_grid != temp:
temp = deepcopy(self.sub_grid)
for i in range(len(grid)):
... | code_fim | hard | {
"lang": "python",
"repo": "Mr-Robot-1216/Projects",
"path": "/Sudoku/sudoku.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def perform(self):
'''
Performs the step_1 and step_2 untill the Sub grid is solved
Returns None
'''
temp = []
while self.sub_grid != temp:
temp = deepcopy(self.sub_grid)
for i in range(len(grid)):
... | code_fim | hard | {
"lang": "python",
"repo": "Mr-Robot-1216/Projects",
"path": "/Sudoku/sudoku.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.sharpies.append(sharpie)
def count_usable(self):
for i in self.sharpies:
if (i.ink_amount > 0):
self.usable_sharpies.append(i)
self.usable_sharpies_count += 1
def remove_unusable(self):
for i in self.sharpies:
i... | code_fim | medium | {
"lang": "python",
"repo": "green-fox-academy/yuuu1234",
"path": "/DSA-2019/week-02/day-1/sharpieSet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: green-fox-academy/yuuu1234 path: /DSA-2019/week-02/day-1/sharpieSet.py
from sharpie import Sharpie
class SharpieSet():
def __init__(self):
self.sharpies = []
self.usable_sharpies = []
self.usable_sharpies_count = 0
def add_sharpie(self, sharpie: Sharpie):
... | code_fim | medium | {
"lang": "python",
"repo": "green-fox-academy/yuuu1234",
"path": "/DSA-2019/week-02/day-1/sharpieSet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_sharpie(self, sharpie: Sharpie):
self.sharpies.append(sharpie)
def count_usable(self):
for i in self.sharpies:
if (i.ink_amount > 0):
self.usable_sharpies.append(i)
self.usable_sharpies_count += 1
def remove_unusable(self):
... | code_fim | medium | {
"lang": "python",
"repo": "green-fox-academy/yuuu1234",
"path": "/DSA-2019/week-02/day-1/sharpieSet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('submissions', '0004_auto_20190401_1834'),
]
operations = [
migrations.AlterField(
model_name='mainsubmission',
name='execution_time',
field=models.DecimalField(blank=True, decimal_places=3, default=0, max_digits=6, null=Tr... | code_fim | easy | {
"lang": "python",
"repo": "pranavraj219/turingoj",
"path": "/submissions/migrations/0005_auto_20190401_2007.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('submissions', '0004_auto_20190401_1834'),
]
operations = [
migrations.AlterField(
model_name='mainsubmission',
name='execution_time',
field=models.DecimalField(blank=True, decimal_p... | code_fim | easy | {
"lang": "python",
"repo": "pranavraj219/turingoj",
"path": "/submissions/migrations/0005_auto_20190401_2007.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pranavraj219/turingoj path: /submissions/migrations/0005_auto_20190401_2007.py
# Generated by Django 2.1.7 on 2019-04-01 14:37
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='mainsubmission',
name='execution_time',
field=models.Deci... | code_fim | medium | {
"lang": "python",
"repo": "pranavraj219/turingoj",
"path": "/submissions/migrations/0005_auto_20190401_2007.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for patient in self.patients:
print "Id Number:", patient.id_number
print "Name:", patient.name
print "Bed Number:", patient.bed_number
print "Allergies:", patient.allergies
return self
patientA = Patient(1235, "Helen Smith", 10, ("pe... | code_fim | hard | {
"lang": "python",
"repo": "cdw2003/CodingDojoProjects",
"path": "/Python/Object_Oriented_Programming/hospital.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cdw2003/CodingDojoProjects path: /Python/Object_Oriented_Programming/hospital.py
class Patient(object):
def __init__(self, id_number, name, bed_number, *allergies):
self.id_number = id_number
self.name = name
self.allergies = allergies
self.bed_number = be... | code_fim | medium | {
"lang": "python",
"repo": "cdw2003/CodingDojoProjects",
"path": "/Python/Object_Oriented_Programming/hospital.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>patientA = Patient(1235, "Helen Smith", 10, ("peanuts", "seafood"))
patientB = Patient(1594, "Robert Brown", 15, "eggs")
patientC = Patient(1587, "Amy Beard", 26, ("guinea pigs", "cats"))
patientD = Patient(1658, "Robin Meggs", 51, "coconut")
hospital1 = Hospital("Inova Fairfax", 2)
hospital1.addPati... | code_fim | hard | {
"lang": "python",
"repo": "cdw2003/CodingDojoProjects",
"path": "/Python/Object_Oriented_Programming/hospital.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Emanoel580/ifpi-ads-algoritmos2020 path: /lista condicionais 2b/fabio_2b_09_dia.py
def main():
num = int(input('dia: '))
dia(num)
<|fim_suffix|> if a == 1:
print('Domingo !')
elif a == 2:
print('Segunda !')
else:
print('valor invalido !')
main()<|fim_... | code_fim | easy | {
"lang": "python",
"repo": "Emanoel580/ifpi-ads-algoritmos2020",
"path": "/lista condicionais 2b/fabio_2b_09_dia.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if a == 1:
print('Domingo !')
elif a == 2:
print('Segunda !')
else:
print('valor invalido !')
main()<|fim_prefix|># repo: Emanoel580/ifpi-ads-algoritmos2020 path: /lista condicionais 2b/fabio_2b_09_dia.py
def main():
num = int(input('dia: '))
dia(num)
<|fim... | code_fim | easy | {
"lang": "python",
"repo": "Emanoel580/ifpi-ads-algoritmos2020",
"path": "/lista condicionais 2b/fabio_2b_09_dia.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return sol
def annealingOptimize(domain, costf = scheduleCost, T = 10000.0, cool = 0.95, step = 1):
sol = [random.randint(domain[i][0], domain[i][1]) for i in range(len(domain))]
while T > 0.1:
i = random.randint(0, len(domain) - 1)
dir = random.randint(-step, step)
v... | code_fim | hard | {
"lang": "python",
"repo": "sadaharu-gintama/SomeCode",
"path": "/ProgrammingCollectiveIntellegence/Chapter8/optimization.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sadaharu-gintama/SomeCode path: /ProgrammingCollectiveIntellegence/Chapter8/optimization.py
import time
import random
import math
people = [('Seymour', 'BOS'),
('Franny', 'DAL'),
('Zooey', 'CAK'),
('Walt', 'MIA'),
('Buddy', 'ORD'),
('Les', 'OMA')... | code_fim | hard | {
"lang": "python",
"repo": "sadaharu-gintama/SomeCode",
"path": "/ProgrammingCollectiveIntellegence/Chapter8/optimization.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sol = [random.randint(domain[i][0], domain[i][1]) for i in range(len(domain))]
while T > 0.1:
i = random.randint(0, len(domain) - 1)
dir = random.randint(-step, step)
vec = sol[:]
vec[i] += dir
if vec[i] < domain[i][0]: vec[i] = domain[i][0]
elif ve... | code_fim | hard | {
"lang": "python",
"repo": "sadaharu-gintama/SomeCode",
"path": "/ProgrammingCollectiveIntellegence/Chapter8/optimization.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> _, x, _ = self.encoder(x, lengths)
out = self.clf(x)
return out
def get_parser():
parser = ArgumentParser("MNIST classification example")
parser.add_argument(
"--hidden",
dest="model.hidden_size",
type=int,
help="Intermediate hidden layers... | code_fim | hard | {
"lang": "python",
"repo": "georgepar/slp",
"path": "/examples/mnist_rnn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> config = parse_config(parser, parser.parse_args().config)
if config.trainer.experiment_name == "experiment":
config.trainer.experiment_name = "mnist-rnn-classification"
configure_logging(f"logs/{config.trainer.experiment_name}")
if config.seed is not None:
logger.info("S... | code_fim | hard | {
"lang": "python",
"repo": "georgepar/slp",
"path": "/examples/mnist_rnn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Chi2 calculator
# observed_values, bins, _ = plt.hist(data[:, 2], bins=n_bins)
# plt.show()
# We normalize by multiplyting the length of the data with the binwidth
# expected_values = poisson.pmf(bins, data_0.x[0]) * len(data)
# print(observed_values[observed_values!=0])
# print(expected_values[expec... | code_fim | hard | {
"lang": "python",
"repo": "DanielRamyar/AdvancedMethodsInAppliedStatistics",
"path": "/Exam_prep/test_prob1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DanielRamyar/AdvancedMethodsInAppliedStatistics path: /Exam_prep/test_prob1.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.stats import chisquare, chi2, binom, poisson
def f_1(x, a):
return (1 / (x + 5)) * np.sin(a * x)
def f_2(x, a):
... | code_fim | hard | {
"lang": "python",
"repo": "DanielRamyar/AdvancedMethodsInAppliedStatistics",
"path": "/Exam_prep/test_prob1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def f_3(x, a):
return np.sin(a * (x ** 2))
def f_4(x, a):
return np.sin(a * x + 1) ** 2
def f_5(x):
return x * np.tan(x)
def f_6(x, a, b):
return (1 + a * x + b * (x ** 2)) / ((2/3) * (b + 3))
def f_7(x, a, b):
return a + b * x
def f_8(x, a, b, c):
return np.sin(a * x) +... | code_fim | hard | {
"lang": "python",
"repo": "DanielRamyar/AdvancedMethodsInAppliedStatistics",
"path": "/Exam_prep/test_prob1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sfm = SelectFromModel(model)
sfm = sfm.fit(X, y)
feature_idx = sfm.get_support()
feature_name = X.columns[feature_idx]
return list(feature_name)<|fim_prefix|># repo: geraldhood/feature_selection_project path: /q04_select_from_model/build.py
# Default imports
from sklearn.feature_sel... | code_fim | medium | {
"lang": "python",
"repo": "geraldhood/feature_selection_project",
"path": "/q04_select_from_model/build.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> X = dataframe.iloc[:, :-1]
y = dataframe.iloc[:, -1]
np.random.seed(9)
model = RandomForestClassifier()
sfm = SelectFromModel(model)
sfm = sfm.fit(X, y)
feature_idx = sfm.get_support()
feature_name = X.columns[feature_idx]
return list(feature_name)<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "geraldhood/feature_selection_project",
"path": "/q04_select_from_model/build.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geraldhood/feature_selection_project path: /q04_select_from_model/build.py
# Default imports
from sklearn.feature_selection import SelectFromModel
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
data = pd.read_csv('data/house_prices_multivariate.csv')
... | code_fim | medium | {
"lang": "python",
"repo": "geraldhood/feature_selection_project",
"path": "/q04_select_from_model/build.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> _name = "hr.cnps.cotisation.line.template"
_description = "hr cnps cotisation line template"
name = fields.Char("Designation", required=True)
company_id = fields.Many2one("res.company", "Société", required=True, default=lambda self: self.env.user.company_id.id)
taux = fields.Floa... | code_fim | hard | {
"lang": "python",
"repo": "soulbadguy00/modules",
"path": "/hr_cnps_mensuel/models/hr_cnps_settings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class HrCnpsCotisationLineTemplate(models.Model):
_name = "hr.cnps.cotisation.line.template"
_description = "hr cnps cotisation line template"
name = fields.Char("Designation", required=True)
company_id = fields.Many2one("res.company", "Société", required=True, default=lambda self:... | code_fim | hard | {
"lang": "python",
"repo": "soulbadguy00/modules",
"path": "/hr_cnps_mensuel/models/hr_cnps_settings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: soulbadguy00/modules path: /hr_cnps_mensuel/models/hr_cnps_settings.py
# -*- coding:utf-8 -*-
from odoo import api, fields, _, models
Type_employee = [('j', 'Journalier'), ('m', 'Mensuel')]
class HrCnpsSettings(models.Model):
_name = "hr.cnps.setting"
_description = "settings... | code_fim | hard | {
"lang": "python",
"repo": "soulbadguy00/modules",
"path": "/hr_cnps_mensuel/models/hr_cnps_settings.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>h discord.py',
install_requires=['discord.py>=1.2.5'],
python_requires='>=3.5.3'
)<|fim_prefix|># repo: KISHU445/Tea-Bot path: /cogs/utils/modules/discord-ext-menus/setup.py
from setuptools import setup
setup(name='discord-ext-menus',
author='TierGamerpy',
<|fim_middle|> url='https... | code_fim | medium | {
"lang": "python",
"repo": "KISHU445/Tea-Bot",
"path": "/cogs/utils/modules/discord-ext-menus/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>'discord.ext.menus'],
description='An extension module to make reaction based menus with discord.py',
install_requires=['discord.py>=1.2.5'],
python_requires='>=3.5.3'
)<|fim_prefix|># repo: KISHU445/Tea-Bot path: /cogs/utils/modules/discord-ext-menus/setup.py
from setuptools import set... | code_fim | medium | {
"lang": "python",
"repo": "KISHU445/Tea-Bot",
"path": "/cogs/utils/modules/discord-ext-menus/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KISHU445/Tea-Bot path: /cogs/utils/modules/discord-ext-menus/setup.py
from setuptools import setup
setup(name='discord-ext-menus',
author='TierGamerpy',
<|fim_suffix|>h discord.py',
install_requires=['discord.py>=1.2.5'],
python_requires='>=3.5.3'
)<|fim_middle|> url='https... | code_fim | medium | {
"lang": "python",
"repo": "KISHU445/Tea-Bot",
"path": "/cogs/utils/modules/discord-ext-menus/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for record in event['Records']:
# Extract bucket and key information from S3 PutObject event
bucket = record['s3']['bucket']['name']
key = record['s3']['object']['key']
output_key = '{}.html'.format(key[:key.rfind('.md')])
# Read Markdown file content from S3 b... | code_fim | medium | {
"lang": "python",
"repo": "shourabhmodak/aws-realtime-data-pipeline",
"path": "/lambda/python/md_to_html.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shourabhmodak/aws-realtime-data-pipeline path: /lambda/python/md_to_html.py
import boto3
import jinja2
import markdown
# Instantiate S3 client
s3_client = boto3.client('s3')
# HTML style template
TEMPLATE = """<!DOCTYPE html>
<html>
<head>
<link href="http://netdna.bootstrapcdn.com/twitter-... | code_fim | hard | {
"lang": "python",
"repo": "shourabhmodak/aws-realtime-data-pipeline",
"path": "/lambda/python/md_to_html.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Encode content before uploading
encoded_html = html_content_fmt.encode("utf-8")
# Upload HTML content to S3 bucket
s3_client.put_object(Bucket=bucket, Key=output_key, Body=encoded_html)<|fim_prefix|># repo: shourabhmodak/aws-realtime-data-pipeline path: /lambda/python/md... | code_fim | hard | {
"lang": "python",
"repo": "shourabhmodak/aws-realtime-data-pipeline",
"path": "/lambda/python/md_to_html.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return location.parseString(details)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("ERROR: pass in the filename as the second argument.")
print(" $ python {0} /path/to/file.txt".format(sys.argv[0]))
exit()
filepath = sys.argv[1]
with open(filep... | code_fim | hard | {
"lang": "python",
"repo": "DrDougPhD/Missouri-Caves",
"path": "/bretz2csv.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DrDougPhD/Missouri-Caves path: /bretz2csv.py
import sys
import os
from pyparsing import *
import csv
def parse_cave_details(details):
##########################################################################
# Define the Bretz Grammar.
# Sample cave description:
# Bor... | code_fim | hard | {
"lang": "python",
"repo": "DrDougPhD/Missouri-Caves",
"path": "/bretz2csv.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> filepath = sys.argv[1]
with open(filepath) as f:
raw_text = f.read()
raw_caves = raw_text.split("\n")
caves = []
for raw_cave_text in raw_caves:
raw_cave_text = raw_cave_text.strip()
if raw_cave_text:
try:
cave = parse_cave... | code_fim | hard | {
"lang": "python",
"repo": "DrDougPhD/Missouri-Caves",
"path": "/bretz2csv.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m0dusX/11_duplicates path: /duplicates.py
import os
import hashlib
import argparse
def hashfile(path, blocksize=65536):
afile = open(path, 'rb')
hasher = hashlib.md5()
buf = afile.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(blocksize)
... | code_fim | hard | {
"lang": "python",
"repo": "m0dusX/11_duplicates",
"path": "/duplicates.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser(description="duplicates detector")
parser.add_argument("path_to_folder",
help="path to folder containig duplicates")
args = parser.parse_args()
path = args.path_to_folder
duplicates = make_duplicate_lis... | code_fim | hard | {
"lang": "python",
"repo": "m0dusX/11_duplicates",
"path": "/duplicates.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Get number to be checked from user.
while True:
try:
NUMBER_TO_BE_CHECKED = int(input("Please enter the number to check: "))
# If it is not an integer throw an error and wait for another input.
except ValueError:
print("Your input is not an integer!")
continue
# ... | code_fim | hard | {
"lang": "python",
"repo": "ResearcherOne/EE393-Python",
"path": "/HW1/hw1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ResearcherOne/EE393-Python path: /HW1/hw1.py
# Umut Cakan Computer Science S006742
# Fibonacci list. First and second terms are static.
fib_list = [0, 1]
# Current index.
CURRENT_INDEX = 2
# Function for the checking input is a Fibonacci number or not.
def check_fibonacci_number():
<|fim_suffix... | code_fim | hard | {
"lang": "python",
"repo": "ResearcherOne/EE393-Python",
"path": "/HW1/hw1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxpkatz/Microphysics path: /networks/CNO_extras/CNO_extras.py
import pynucastro as pyna
rl = pyna.ReacLibLibrary()
h_burn = rl.linking_nuclei(["h1", "he4",
"c12", "c13",
"n13", "n14", "n15",
"o14", "o15", "o16"... | code_fim | hard | {
"lang": "python",
"repo": "maxpkatz/Microphysics",
"path": "/networks/CNO_extras/CNO_extras.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>comp = pyna.Composition(rc.get_nuclei())
comp.set_solar_like()
rc.plot(outfile="cno_extras.png", rho=1.e6, T=1.e8, comp=comp, Z_range=[1,13], N_range=[1,13])
rc.plot(outfile="cno_extras_hide_alpha.png", rho=1.e6, T=1.e8, comp=comp, Z_range=[1,13], N_range=[1,13],
rotated=True, highlig... | code_fim | hard | {
"lang": "python",
"repo": "maxpkatz/Microphysics",
"path": "/networks/CNO_extras/CNO_extras.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henrikemx/PycharmProjects path: /exercicios-cursoemvideo-python3-mundo1/Exercícios/Ex032.py
# Enunciado: faça um programa que leia um ano qualquer e mostre se ele é BISEXTO.
ano = int(input('\nInforme o ano: '))
<|fim_suffix|>if ano1 == 0 and ano2 != 0:
print('\nO ano de {} é Bissexto !!'.f... | code_fim | easy | {
"lang": "python",
"repo": "henrikemx/PycharmProjects",
"path": "/exercicios-cursoemvideo-python3-mundo1/Exercícios/Ex032.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if ano1 == 0 and ano2 != 0:
print('\nO ano de {} é Bissexto !!'.format(ano))
else:
print('\nO ano de {} não foi Bissexto !!'.format(ano))<|fim_prefix|># repo: henrikemx/PycharmProjects path: /exercicios-cursoemvideo-python3-mundo1/Exercícios/Ex032.py
# Enunciado: faça um programa que leia um ano ... | code_fim | medium | {
"lang": "python",
"repo": "henrikemx/PycharmProjects",
"path": "/exercicios-cursoemvideo-python3-mundo1/Exercícios/Ex032.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akshatkatre/100-days path: /pong_game_22/paddle.py
from turtle import Turtle
class Paddle(Turtle):
def __init__(self, x_position, y_position):
<|fim_suffix|> y_pos = self.ycor()
x_pos = self.xcor()
self.goto(y=y_pos + 20, x=x_pos)
def down(self):
y_pos = ... | code_fim | hard | {
"lang": "python",
"repo": "akshatkatre/100-days",
"path": "/pong_game_22/paddle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> y_pos = self.ycor()
x_pos = self.xcor()
self.goto(y=y_pos - 20, x=x_pos)
def increase_score(self):
self.score += 1<|fim_prefix|># repo: akshatkatre/100-days path: /pong_game_22/paddle.py
from turtle import Turtle
class Paddle(Turtle):
def __init__(self, x_positi... | code_fim | medium | {
"lang": "python",
"repo": "akshatkatre/100-days",
"path": "/pong_game_22/paddle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rowle1tj/nctta-save-the-trees path: /tournaments/utility_functions.py
import xlrd
def get_rosters_from_excel(django_file):
workbook = xlrd.open_workbook(file_contents=django_file.read())
worksheet = workbook.sheet_by_name('Match_Rosters')
num_rows = worksheet.nrows - 1
cur_row =... | code_fim | hard | {
"lang": "python",
"repo": "rowle1tj/nctta-save-the-trees",
"path": "/tournaments/utility_functions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ster["players"].append({
"player_label" : worksheet.cell_value(cur_row + 18, 0),
"player_name" : worksheet.cell_value(cur_row + 18, 1),
})
# The opponents
roster["opponents"].append({
"player_name" : worksheet.cell_value(c... | code_fim | hard | {
"lang": "python",
"repo": "rowle1tj/nctta-save-the-trees",
"path": "/tournaments/utility_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>, 9),
})
roster["opponents"].append({
"player_name" : worksheet.cell_value(cur_row + 16, 6),
"player_rating" : worksheet.cell_value(cur_row + 16, 9),
})
roster["opponents"].append({
"player_name" : worksheet.ce... | code_fim | hard | {
"lang": "python",
"repo": "rowle1tj/nctta-save-the-trees",
"path": "/tournaments/utility_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: economicmodeling/SublimeLinter-dscanner path: /linter.py
#
# linter.py
# Linter for SublimeLinter version 4.
#
# Written by Brian Schott (Hackerpilot)
# Copyright © 2014-2019 Economic Modeling Specialists, Intl.
#
# License: MIT
#
"""This module exports the D-Scanner plugin class."""
from Subli... | code_fim | medium | {
"lang": "python",
"repo": "economicmodeling/SublimeLinter-dscanner",
"path": "/linter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""Provides an interface to dscanner."""
cmd = ("dscanner", "-S", "${file}")
regex = r'^.+?\((?P<line>\d+):(?P<col>\d+)\)\[((?P<warning>warn)|(?P<error>error))\]: (?P<message>.+)$'
multiline = False
tempfile_suffix = "-"
word_re = None
defaults = {
"selector": "source... | code_fim | medium | {
"lang": "python",
"repo": "economicmodeling/SublimeLinter-dscanner",
"path": "/linter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Provides an interface to dscanner."""
cmd = ("dscanner", "-S", "${file}")
regex = r'^.+?\((?P<line>\d+):(?P<col>\d+)\)\[((?P<warning>warn)|(?P<error>error))\]: (?P<message>.+)$'
multiline = False
tempfile_suffix = "-"
word_re = None
defaults = {
"selector": "source.... | code_fim | medium | {
"lang": "python",
"repo": "economicmodeling/SublimeLinter-dscanner",
"path": "/linter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sokvy93/Python_Playground path: /Creating_Functions_(*args&**kwargs).py
#Creating function
def name_of_function():
'''
Docstring explains function.
'''
return "Hello" #use return instead of print since return can be stored as a variable.
<|fim_suffix|>
# **kwargs ... | code_fim | hard | {
"lang": "python",
"repo": "Sokvy93/Python_Playground",
"path": "/Creating_Functions_(*args&**kwargs).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
##BONUS Project
#Define a function called myfunc that takes in a string, and returns a matching string where every even letter is uppercase, n/
#and every odd letter is lowercase.
def myfunc(word):
result = ""
for index, letter in enumerate(word):
if index % 2 == 0:
result += letter.lowe... | code_fim | hard | {
"lang": "python",
"repo": "Sokvy93/Python_Playground",
"path": "/Creating_Functions_(*args&**kwargs).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DamLabResources/Neurocog_Tat-miRNA_binding_analysis path: /Utils/misc.py
from Bio import SeqIO
def flatten(l):
<|fim_suffix|> with open(file) as handle:
return [str(record.seq) for record in SeqIO.parse(handle, 'fasta') if len(record.seq) <= max_len]<|fim_middle|> return [j for i i... | code_fim | medium | {
"lang": "python",
"repo": "DamLabResources/Neurocog_Tat-miRNA_binding_analysis",
"path": "/Utils/misc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(file) as handle:
return [str(record.seq) for record in SeqIO.parse(handle, 'fasta') if len(record.seq) <= max_len]<|fim_prefix|># repo: DamLabResources/Neurocog_Tat-miRNA_binding_analysis path: /Utils/misc.py
from Bio import SeqIO
def flatten(l):
return [j for i in l for j in i... | code_fim | easy | {
"lang": "python",
"repo": "DamLabResources/Neurocog_Tat-miRNA_binding_analysis",
"path": "/Utils/misc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ddomenech/MyFirstDjango path: /Empleados/api/viewsets.py
from ..models import Empleado, Puesto, Tareas
from django.contrib.auth import login, logout
from django.contrib.auth.models import User, Group
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
... | code_fim | hard | {
"lang": "python",
"repo": "ddomenech/MyFirstDjango",
"path": "/Empleados/api/viewsets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def post(self, request, *args, **kwargs):
login(request, request.user)
return Response(serializers.UserSerializer(request.user).data)
def delete(self, request, *args, **kwargs):
logout(request)
return Response()<|fim_prefix|># repo: ddomenech/MyFirstDjango path: /Empleados/api/viewsets.p... | code_fim | hard | {
"lang": "python",
"repo": "ddomenech/MyFirstDjango",
"path": "/Empleados/api/viewsets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chiu-Te-Wang/PTTFansPredictor path: /src/extractFeatures.py
import json
import sys
import time
# boardName pageNum indexNewest
# Baseball 5000 5183
# Elephants 3500 3558
# Monkeys 3500 3672
# Lions 3300 3381
# Guardians 3500 3542
boardNameList = ["Baseball", "Elephants", "Monkeys", "Lions", "Gua... | code_fim | hard | {
"lang": "python",
"repo": "Chiu-Te-Wang/PTTFansPredictor",
"path": "/src/extractFeatures.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Extract user features...")
printFeature2File(userDict, featureFileOut)
print("Cost time : "+str(time.time()-_start)+" secs")
print("Total cost time : "+str(time.time()-total_start)+" secs")
_start = time.time()
# for dd in _data:
# print("=====================================")
# print(... | code_fim | hard | {
"lang": "python",
"repo": "Chiu-Te-Wang/PTTFansPredictor",
"path": "/src/extractFeatures.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> _file = open(filename, "w")
json.dump(userDict,_file)
_file.close()
if __name__ == "__main__":
# filename = str(sys.argv[1])
featureFileOut = str(sys.argv[1])
dataDir = "../data/"
filenameList = ['data-Baseball-5000-2017-06-29-03-25-05.json','data-Elephants-3500-2017-06-29-03-30-22.json',
'... | code_fim | hard | {
"lang": "python",
"repo": "Chiu-Te-Wang/PTTFansPredictor",
"path": "/src/extractFeatures.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for t in xrange(int(sys.stdin.readline())):
print "Case #%d:" % (t + 1),
print solve()<|fim_prefix|># repo: alexandraback/datacollection path: /solutions_5766201229705216_1/Python/nwin/b.py
import sys
from collections import defaultdict
sys.setrecursionlimit(1200)
def dfs(G, v, prev):
t = []... | code_fim | hard | {
"lang": "python",
"repo": "alexandraback/datacollection",
"path": "/solutions_5766201229705216_1/Python/nwin/b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexandraback/datacollection path: /solutions_5766201229705216_1/Python/nwin/b.py
import sys
from collections import defaultdict
sys.setrecursionlimit(1200)
def dfs(G, v, prev):
t = []
s = 0
for x in G[v]:
if x == prev: continue
tmp = dfs(G, x, v)
s += tmp[1]
... | code_fim | hard | {
"lang": "python",
"repo": "alexandraback/datacollection",
"path": "/solutions_5766201229705216_1/Python/nwin/b.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> read_ints = lambda: map(int, sys.stdin.readline().split())
n = int(sys.stdin.readline())
G = defaultdict(list)
for _ in xrange(n-1):
x, y = read_ints()
x, y = x-1, y-1
G[x].append(y)
G[y].append(x)
return min(dfs(G, i, -1)[0] for i in xrange(n))
for t i... | code_fim | medium | {
"lang": "python",
"repo": "alexandraback/datacollection",
"path": "/solutions_5766201229705216_1/Python/nwin/b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fagan2888/jsonsubschema path: /jsonsubschema/cli.py
'''
Created on June 24, 2019
@author: Andrew Habib
'''
import json
import jsonref
import sys
from jsonsubschema.api import isSubschema
def main():
<|fim_suffix|> s1_file = sys.argv[1]
s2_file = sys.argv[2]
with open(s1_file, 'r'... | code_fim | medium | {
"lang": "python",
"repo": "fagan2888/jsonsubschema",
"path": "/jsonsubschema/cli.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(s1_file, 'r') as f1:
s1 = json.load(f1)
# s1 = jsonref.load(f1)
with open(s2_file, 'r') as f2:
s2 = json.load(f2)
# s2 = jsonref.load(f2)
print("LHS <: RHS", isSubschema(s1, s2))
print("RHS <: LHS", isSubschema(s2, s1))
if __name__ == "__main__"... | code_fim | medium | {
"lang": "python",
"repo": "fagan2888/jsonsubschema",
"path": "/jsonsubschema/cli.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.driver.get(ticketInfoPage)
breadCrumbTicketInfoBasePage = BreadCrumbTicketInfoBasePage()
breadCrumbTicketInfoBasePage.driver = self.driver
return breadCrumbTicketInfoBasePage<|fim_prefix|># repo: Duskamo/ticketPOC path: /src/basepages/BreadCrumbHomeBasePage.py
from src.basepages.BreadCrumb... | code_fim | easy | {
"lang": "python",
"repo": "Duskamo/ticketPOC",
"path": "/src/basepages/BreadCrumbHomeBasePage.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Duskamo/ticketPOC path: /src/basepages/BreadCrumbHomeBasePage.py
from src.basepages.BreadCrumbTicketInfoBasePage import *
<|fim_suffix|> def gotoTicketInfoBasePage(self,ticketInfoPage):
self.driver.get(ticketInfoPage)
breadCrumbTicketInfoBasePage = BreadCrumbTicketInfoBasePage()
breadCru... | code_fim | easy | {
"lang": "python",
"repo": "Duskamo/ticketPOC",
"path": "/src/basepages/BreadCrumbHomeBasePage.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> breadCrumbTicketInfoBasePage = BreadCrumbTicketInfoBasePage()
breadCrumbTicketInfoBasePage.driver = self.driver
return breadCrumbTicketInfoBasePage<|fim_prefix|># repo: Duskamo/ticketPOC path: /src/basepages/BreadCrumbHomeBasePage.py
from src.basepages.BreadCrumbTicketInfoBasePage import *
class ... | code_fim | medium | {
"lang": "python",
"repo": "Duskamo/ticketPOC",
"path": "/src/basepages/BreadCrumbHomeBasePage.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ricbit/puzzles path: /util/unique.wordcross.py
import sys
def main():
lines = [line.strip() for line in sys.stdin.readlines()]
h = lines.index("")
<|fim_suffix|>t()[0] for x in lines[start:start + h])
if len(grid) == h:
grids.add(grid)
start += h + 1
print >> sys.stderr, le... | code_fim | medium | {
"lang": "python",
"repo": "ricbit/puzzles",
"path": "/util/unique.wordcross.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>rint >> sys.stderr, len(grids)
for grid in grids:
for line in grid:
print line
print
main()<|fim_prefix|># repo: ricbit/puzzles path: /util/unique.wordcross.py
import sys
def main():
lines = [line.strip() for line in sys.stdin.readlines()]
h = lines.index("")
w = len(lines[0].spli... | code_fim | medium | {
"lang": "python",
"repo": "ricbit/puzzles",
"path": "/util/unique.wordcross.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># import decision tree model
from sklearn.tree import DecisionTreeClassifier
dtc = DecisionTreeClassifier(criterion='entropy')
dtc.fit(x_train, y_train)
#y_predict = dtc.predict(x_test)
print(dtc.score(x_test, y_test))
from sklearn import feature_selection
fs = feature_selection.SelectPercentile(... | code_fim | hard | {
"lang": "python",
"repo": "liqima/Machine_Learning_books",
"path": "/kaggle竞赛之路/feature_extraction/feature_selection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liqima/Machine_Learning_books path: /kaggle竞赛之路/feature_extraction/feature_selection.py
# obtain the dataset
import pandas as pd
titanic = pd.read_csv('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic.txt')
#titanic.info()
print(titanic.head())
# preprocessing
x = titan... | code_fim | medium | {
"lang": "python",
"repo": "liqima/Machine_Learning_books",
"path": "/kaggle竞赛之路/feature_extraction/feature_selection.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kimgeunwook/Gait-Detection path: /silhouette_CNN.py
import sys
import os
import tensorflow as tf
import keras
from cv2 import *
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from PIL import Image
import numpy as np
import pickle
from sklearn.model_selection ... | code_fim | hard | {
"lang": "python",
"repo": "Kimgeunwook/Gait-Detection",
"path": "/silhouette_CNN.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>model = Sequential()
model.add(Conv2D(32, kernel_size=(5,5), strides=(1,1), padding='same', activation='relu', input_shape=input_shape))
model.add(MaxPooling2D(pool_size=(2,2), strides=(2,2)))
model.add(Conv2D(64, kernel_size=(2,2), strides=(1,1), padding='same', activation='relu'))
model.add(MaxPooling2D... | code_fim | hard | {
"lang": "python",
"repo": "Kimgeunwook/Gait-Detection",
"path": "/silhouette_CNN.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(argv):
for com in argv:
with open(com, 'rb') as f:
txt = f.read()
if 'tzvp tzvpfit' in txt:
parts = txt.split('tzvp tzvpfit',1)
new_txt = parts[0] + 'tzvp/tzvpfit' + parts[1]
with open(com, 'wb') as f:
f.write(new... | code_fim | medium | {
"lang": "python",
"repo": "MTS-Strathclyde/python-mm-scripts",
"path": "/scripts_old/mikro_scripts/PythonScripts/fit_fix.py",
"mode": "spm",
"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.