text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: mayziyuhuang/bootcamp path: /ex4_3_sol.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
import bootcamp_utils
import numba
@numba.jit(nopython=True)
def backtrack_steps():
"""
Compute the number of steps it takes a 1d random walk... | code_fim | hard | {
"lang": "python",
"repo": "mayziyuhuang/bootcamp",
"path": "/ex4_3_sol.py",
"mode": "psm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return n_steps
# Stepping time
tau = 0.5 # seconds
# Specify number of samples
n_samples = 10000
# Array of backtrack times
t_bt = np.empty(n_samples)
# Generate the samples
for i in range(n_samples):
t_bt[i] = backtrack_steps()
# Convert to seconds
t_bt *= tau
plt.figure(1)
_ = plt.hist(t_... | code_fim | medium | {
"lang": "python",
"repo": "mayziyuhuang/bootcamp",
"path": "/ex4_3_sol.py",
"mode": "spm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shruti735/PythonA path: /7.py
def drive(carspeed):
if carspeed>200:
print("very fast")
elif carspeed>100:
print<|fim_suffix|>d?
def compare(a):
if a>11:
print("big")
elif a==10:
print("reallybig")
compare(10)<|fim_middle|>("toofast")
elif carspeed>70 and carspeed<80:
print("optima... | code_fim | medium | {
"lang": "python",
"repo": "shruti735/PythonA",
"path": "/7.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>d?
def compare(a):
if a>11:
print("big")
elif a==10:
print("reallybig")
compare(10)<|fim_prefix|># repo: shruti735/PythonA path: /7.py
def drive(carspeed):
if carspeed>200:
print("very fast")
elif carspeed>100:
print<|fim_middle|>("toofast")
elif carspeed>70 and carspeed<80:
print("optima... | code_fim | medium | {
"lang": "python",
"repo": "shruti735/PythonA",
"path": "/7.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darthmorf/pyrarria path: /tiles.py
import pygame
import utils
from random import randint
class TileSurface():
tileGroup = pygame.sprite.Group()
tileGrid = []
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.width = width
self.height = height
self.surface = pyga... | code_fim | hard | {
"lang": "python",
"repo": "darthmorf/pyrarria",
"path": "/tiles.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> spriteVariant = randint(1, 3)
super().__init__("./assets/dirt0" + str(spriteVariant) + ".png", x, y, surface)
class Air(Tile):
def __init__(self, x, y, surface):
super().__init__("./assets/air.png", x, y, surface)<|fim_prefix|># repo: darthmorf/pyrarria path: /tiles.py
import pygame
import utils
... | code_fim | hard | {
"lang": "python",
"repo": "darthmorf/pyrarria",
"path": "/tiles.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhubs-python/djpos path: /src/account/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-02-24 11:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
... | code_fim | hard | {
"lang": "python",
"repo": "bhubs-python/djpos",
"path": "/src/account/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>e_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='account.Employee')),
],
bases=('account.employee',),
),
migrations.CreateModel(
name='Supplier',
... | code_fim | hard | {
"lang": "python",
"repo": "bhubs-python/djpos",
"path": "/src/account/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lotrekagency/wc-xml-catalog path: /xmlcatalog/settings.py
import os
WOO_HOST = os.environ.get('WOO_HOST')
#WooCommerce key credentials
WOO_CONSUMER_KEY = os.environ.get('WOO_CONSUMER_KEY')
WOO_CONSUMER_SECRET = os.environ.get('WOO_CONSUMER_SECRET')
<|fim_suffix|>REDIS_HOST = os.environ.get('RE... | code_fim | hard | {
"lang": "python",
"repo": "lotrekagency/wc-xml-catalog",
"path": "/xmlcatalog/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
from local_settings import *
except ImportError:
pass
if SENTRY_URL:
import sentry_sdk
sentry_sdk.init(SENTRY_URL)<|fim_prefix|># repo: lotrekagency/wc-xml-catalog path: /xmlcatalog/settings.py
import os
WOO_HOST = os.environ.get('WOO_HOST')
#WooCommerce key credentials
WOO_CONSUM... | code_fim | hard | {
"lang": "python",
"repo": "lotrekagency/wc-xml-catalog",
"path": "/xmlcatalog/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Opens facebook's source html file
soup = BeautifulSoup(driver.page_source,'lxml')
print(soup.prettify())
# close webdriver object
driver.close()<|fim_prefix|># repo: Okroshiashvili/Data-Science-Lab path: /Web Scraping/Selenium/into_to_selenium.py
from selenium import webdriver
from time import s... | code_fim | hard | {
"lang": "python",
"repo": "Okroshiashvili/Data-Science-Lab",
"path": "/Web Scraping/Selenium/into_to_selenium.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Okroshiashvili/Data-Science-Lab path: /Web Scraping/Selenium/into_to_selenium.py
from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
"""
With selenium we need web driver for our browser.
If you use google chrome, you can download chrome driver from here:
... | code_fim | medium | {
"lang": "python",
"repo": "Okroshiashvili/Data-Science-Lab",
"path": "/Web Scraping/Selenium/into_to_selenium.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# driver.page_source
# Opens facebook's source html file
soup = BeautifulSoup(driver.page_source,'lxml')
print(soup.prettify())
# close webdriver object
driver.close()<|fim_prefix|># repo: Okroshiashvili/Data-Science-Lab path: /Web Scraping/Selenium/into_to_selenium.py
from selenium import webdr... | code_fim | hard | {
"lang": "python",
"repo": "Okroshiashvili/Data-Science-Lab",
"path": "/Web Scraping/Selenium/into_to_selenium.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('sepomex', '0006_auto_20151113_2154'),
]
operations = [
migrations.CreateModel(
name='MXCiudad',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=F... | code_fim | medium | {
"lang": "python",
"repo": "zodman/tastypie-sepomex",
"path": "/sepomex/migrations/0007_auto_20170623_1710.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zodman/tastypie-sepomex path: /sepomex/migrations/0007_auto_20170623_1710.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-23 17:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|>
dependencies... | code_fim | medium | {
"lang": "python",
"repo": "zodman/tastypie-sepomex",
"path": "/sepomex/migrations/0007_auto_20170623_1710.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
solutions = Solution('The iterator is just clutter')
# solutions = Solution('The')
print(solutions)<|fim_prefix|># repo: abdulnizam/Python path: /Programs/string_theory.py
#!/usr/bin/env python
import re
class Solution:
def __new__(self, p):
nr_counts, nr_consonants... | code_fim | medium | {
"lang": "python",
"repo": "abdulnizam/Python",
"path": "/Programs/string_theory.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> vowels_list = ['A', 'E', 'I', 'O', 'U']
consonants = 0
vowels = 0
string = ''
for character in text:
if character.isalpha():
if character.upper() in vowels_list:
vowels += 1
string += 'pv'
else:
consonants += 1
string += character
return (vowels, consonants,... | code_fim | medium | {
"lang": "python",
"repo": "abdulnizam/Python",
"path": "/Programs/string_theory.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abdulnizam/Python path: /Programs/string_theory.py
#!/usr/bin/env python
import re
class Solution:
def __new__(self, p):
nr_counts, nr_consonants, replaced = self.count_vowels_consonants(self, p)
inversed = ''.join(c.lower() if c.isupper() else c.upper() for c in p)
replaced_by_ = p.... | code_fim | hard | {
"lang": "python",
"repo": "abdulnizam/Python",
"path": "/Programs/string_theory.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CSimbulan/TemperatureSensor path: /plot.py
## Import modules
import matplotlib, sys, datetime, time
matplotlib.use('TkAgg')
from math import *
from numpy import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from mat... | code_fim | hard | {
"lang": "python",
"repo": "CSimbulan/TemperatureSensor",
"path": "/plot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> a.clear()
a.plot(fds,light, "g.--")
a.set_ylabel("Ambient Light", color = "g")
a.xaxis.set_major_formatter(hfmt)
a.grid(color = "g")
for tick in a.xaxis.get_major_ticks():
tick.label.set_fontsize(7)
tick.label.set_rotation(15)
tick.label.set_color("g")
... | code_fim | hard | {
"lang": "python",
"repo": "CSimbulan/TemperatureSensor",
"path": "/plot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def show_light():
a.clear()
a.plot(fds,light, "g.--")
a.set_ylabel("Ambient Light", color = "g")
a.xaxis.set_major_formatter(hfmt)
a.grid(color = "g")
for tick in a.xaxis.get_major_ticks():
tick.label.set_fontsize(7)
tick.label.set_rotation(15)
tick.label.s... | code_fim | hard | {
"lang": "python",
"repo": "CSimbulan/TemperatureSensor",
"path": "/plot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sonicrules1234/sonicbot path: /plugins/moneyreset.py
import shelve
arguments = ["self", "info", "args", "world"]
minlevel = 2
helpstring = "moneyreset"
<|fim_suffix|> """Resets a users money"""
money = shelve.open("money-%s.db" % (world.hostnicks[connection.host]), writeback=True)
mon... | code_fim | medium | {
"lang": "python",
"repo": "sonicrules1234/sonicbot",
"path": "/plugins/moneyreset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Resets a users money"""
money = shelve.open("money-%s.db" % (world.hostnicks[connection.host]), writeback=True)
money[info["sender"]] = {"money":100000, "maxmoney":100000, "items":[], "coinchance":[True for x in range(50)] + [False for x in range(50)]}
money.sync()
connection.ircsen... | code_fim | medium | {
"lang": "python",
"repo": "sonicrules1234/sonicbot",
"path": "/plugins/moneyreset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fkztw/moya path: /moya/tests/testproject/wsgi.py
# encoding=UTF-8
# This file serves the project in production
# See http://wsgi.readthedocs.org/en/latest/
<|fim_suffix|>application = Application(
"./", ["local.ini", "production.ini"], server="main", logging="prodlogging.ini"
)<|fim_middle|... | code_fim | medium | {
"lang": "python",
"repo": "fkztw/moya",
"path": "/moya/tests/testproject/wsgi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>application = Application(
"./", ["local.ini", "production.ini"], server="main", logging="prodlogging.ini"
)<|fim_prefix|># repo: fkztw/moya path: /moya/tests/testproject/wsgi.py
# encoding=UTF-8
# This file serves the project in production
# See http://wsgi.readthedocs.org/en/latest/
<|fim_middle|... | code_fim | medium | {
"lang": "python",
"repo": "fkztw/moya",
"path": "/moya/tests/testproject/wsgi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f'{emp_id},{emp_surname},{emp_name},{position},{dep_id},{dep_id},{dep_name},{num_of_emp},{head}')<|fim_prefix|># repo: VladaLukovskaya/HIVE-PIG path: /fifth_reducer.py
from sys import stdin
last_emp = emp_id = ''
for line in stdin:
data = line.strip().split(',')
if last_emp != '' and las... | code_fim | hard | {
"lang": "python",
"repo": "VladaLukovskaya/HIVE-PIG",
"path": "/fifth_reducer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VladaLukovskaya/HIVE-PIG path: /fifth_reducer.py
from sys import stdin
last_emp = emp_id = ''
for line in stdin:
data = line.strip().split(',')
if last_emp != '' and last_emp != emp_id:
print(f'{emp_id},{emp_surname},{emp_name},{position},{dep_id},{dep_id},{dep_name},{num_of_em... | code_fim | hard | {
"lang": "python",
"repo": "VladaLukovskaya/HIVE-PIG",
"path": "/fifth_reducer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def Peptide_Encoding(DNA,AA_input):
AA= DNA_To_AA(DNA)
print(AA)
l=len(AA_input)
return_DNA=[]
find_position=0
#print(DNA,AA,l,return_DNA,find_position)
while AA_input in AA[find_position:]:
#print(AA[find_position:])
AA_position = find_position + AA[find_posi... | code_fim | hard | {
"lang": "python",
"repo": "Hydebutterfy/learn-python",
"path": "/genome sequence/Peptide Encoding Problem for Bacillus brevis.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> AA= DNA_To_AA(DNA)
print(AA)
l=len(AA_input)
return_DNA=[]
find_position=0
#print(DNA,AA,l,return_DNA,find_position)
while AA_input in AA[find_position:]:
#print(AA[find_position:])
AA_position = find_position + AA[find_position:].find(AA_input)
DNA_po... | code_fim | hard | {
"lang": "python",
"repo": "Hydebutterfy/learn-python",
"path": "/genome sequence/Peptide Encoding Problem for Bacillus brevis.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hydebutterfy/learn-python path: /genome sequence/Peptide Encoding Problem for Bacillus brevis.py
#Peptide Encoding Problem: Find substrings of a genome encoding a given amino acid sequence.
# Input: A DNA string Text, an amino acid string Peptide, and the array GeneticCode.
# Output: All subs... | code_fim | hard | {
"lang": "python",
"repo": "Hydebutterfy/learn-python",
"path": "/genome sequence/Peptide Encoding Problem for Bacillus brevis.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nadrees/PSkills path: /trueskill_factorgraph/ts_factorgraph.py
from layers import TrueSkillFactorGraph
from math import e, sqrt
from numerics import atLeast, _Vector, _DiagonalMatrix, Matrix
from objects import SkillCalculator, SupportedOptions, argumentNotNone, \
getPartialPlayPercentage, sortB... | code_fim | hard | {
"lang": "python",
"repo": "nadrees/PSkills",
"path": "/trueskill_factorgraph/ts_factorgraph.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return _DiagonalMatrix(self._getPlayerRatingValues(teamAssignmentsList, lambda rating: rating.standardDeviation**2.0))
def _getPlayerRatingValues(self, teamAssigmentsList, playerRatingFunction):
playerRatingValues = list()
for currentTeam in teamAssigmentsList:
for currentRating in currentTea... | code_fim | hard | {
"lang": "python",
"repo": "nadrees/PSkills",
"path": "/trueskill_factorgraph/ts_factorgraph.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># PART TWO
def make_album_two(artist_name, album_title, number_of_songs= None):
"""Build a dictionary describing a music album"""
music_album = {'Artist': artist_name.title(),
'Album': album_title.title()}
if number_of_songs:
music_album['Number of Songs'] = number_of_songs... | code_fim | hard | {
"lang": "python",
"repo": "ariellewaller/Python-Crash-Course",
"path": "/Chapter 8/album.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ariellewaller/Python-Crash-Course path: /Chapter 8/album.py
# 8-7. Album: Write a function called make_album() that builds a dictionary
# describing a music album. The function should take in an artist name and an
# album title, and it should return a dictionary containing these two pieces
... | code_fim | medium | {
"lang": "python",
"repo": "ariellewaller/Python-Crash-Course",
"path": "/Chapter 8/album.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-gitlab path: /sdk/python/pulumi_gitlab/user_gpg_key.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
i... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-gitlab",
"path": "/sdk/python/pulumi_gitlab/user_gpg_key.py",
"mode": "psm",
"license": "MPL-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_tag(self):
self.re_tag=r"(<a [^>]+>)"
def set_attr(self):
self.re_attr_parser=r"href\=\"([^\"]+)\""
def extract_tags(self):
title=re.findall(r"<title>([^<]+)</title>",self.result.text)
if len(title)!=0:
print(title[0])
... | code_fim | hard | {
"lang": "python",
"repo": "shadyonfire/web-email-scrapper",
"path": "/web-crawler/webcrawler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def crawl(self):
for i in self.tag_attr:
link=list(i.keys())[0]
if(not i[link]):
print(link)
self.fetch_web(self.seed+link)
print("\t HELLO WELCOME TO EMAIL SCRAPPER")
... | code_fim | hard | {
"lang": "python",
"repo": "shadyonfire/web-email-scrapper",
"path": "/web-crawler/webcrawler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shadyonfire/web-email-scrapper path: /web-crawler/webcrawler.py
import requests as r
import re
class web_scrap:
seed=""
result=""
tag_attr=[]
def __init__(self,seed):
self.seed=seed
self.set_tag()
self.set_attr()
self.fetch_w... | code_fim | hard | {
"lang": "python",
"repo": "shadyonfire/web-email-scrapper",
"path": "/web-crawler/webcrawler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samuelvgv/122 path: /Ex_5_4.py
print("calificacion de los alumnos")
lista2_calificaciones=[]
for i in range (0,5):
lista2_calificaciones.append(int(input(f"ingrese la calificacion corresponfiente al alumno")))
print(lista2_calificaciones)
for<|fim_suffix|>a2_calificaciones[i]<=7:
... | code_fim | hard | {
"lang": "python",
"repo": "samuelvgv/122",
"path": "/Ex_5_4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if lista2_calificaciones[i] ==9 and lista2_calificaciones[i]==10:
print("el valor es notable")
else:
print("Valor muy alto vuelvalo a intentar")<|fim_prefix|># repo: samuelvgv/122 path: /Ex_5_4.py
print("calificacion de los... | code_fim | hard | {
"lang": "python",
"repo": "samuelvgv/122",
"path": "/Ex_5_4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('show', t.root.show())
print('sum', t.root.sum())
print('find 3', t.root.find(3) != False)
print('evens', t.root.evens())
print('min depth', t.root.min_depth())<|fim_prefix|># repo: kaedub/data-structures-and-algorithms path: /trees/sum_values_test.py
from tree import Tree, createIntTree
<|fim_mid... | code_fim | easy | {
"lang": "python",
"repo": "kaedub/data-structures-and-algorithms",
"path": "/trees/sum_values_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaedub/data-structures-and-algorithms path: /trees/sum_values_test.py
from tree import Tree, createIntTree
<|fim_suffix|>print('show', t.root.show())
print('sum', t.root.sum())
print('find 3', t.root.find(3) != False)
print('evens', t.root.evens())
print('min depth', t.root.min_depth())<|fim_mid... | code_fim | easy | {
"lang": "python",
"repo": "kaedub/data-structures-and-algorithms",
"path": "/trees/sum_values_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: laurelfarris/solar path: /new_python_codes/fourier_analysis/fourier_modules.py
import numpy as np
import math
import matplotlib.pyplot as plt
def signif_conf(ts, p):
''' Given a timeseries (ts), and desired probability (p),
compute the standard deviation of ts (s) and use the
number... | code_fim | hard | {
"lang": "python",
"repo": "laurelfarris/solar",
"path": "/new_python_codes/fourier_analysis/fourier_modules.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' Calculate the power and amplitude '''
Power = 2*(abs(V)**2)
Amplitude = 2*(abs(V))
''' Since we are taking the FFT of a real time series, (not complex), the
second half is a duplicate, so it can be removed.
Also do not use the zero-eth element becuase it will just be equal to ... | code_fim | hard | {
"lang": "python",
"repo": "laurelfarris/solar",
"path": "/new_python_codes/fourier_analysis/fourier_modules.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
r=sr.Recognizer()
with sr.Microphone() as source:
flag=True
print("BOT:Iam doctor bot and iam going to answeer your questions")
while(flag==True):
print("speak:")
audio=r.listen(source)
try:
text=r.recognize_google(audio)
print("yo... | code_fim | hard | {
"lang": "python",
"repo": "vaiisshnav/AI-virtual-assistant",
"path": "/speech recognition ai chat bot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vaiisshnav/AI-virtual-assistant path: /speech recognition ai chat bot.py
from newspaper import Article
import random
import string
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import nltk
import numpy as np
import warnin... | code_fim | hard | {
"lang": "python",
"repo": "vaiisshnav/AI-virtual-assistant",
"path": "/speech recognition ai chat bot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
r=sr.Recognizer()
with sr.Microphone() as source:
flag=True
print("BOT:Iam doctor bot and iam going to answeer your questions")
while(flag==True):
print("speak:")
audio=r.listen(source)
try:
text=r.recognize_google(audio)
print... | code_fim | hard | {
"lang": "python",
"repo": "vaiisshnav/AI-virtual-assistant",
"path": "/speech recognition ai chat bot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: genid/de-goulash path: /scripts/freebayes_clusters.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 4 15:21:29 2021
@author: diego
"""
import subprocess
import os
import numpy as np
<|fim_suffix|> path_clusters = snakemake.input[0]
path_clusters = "/".join(pa... | code_fim | medium | {
"lang": "python",
"repo": "genid/de-goulash",
"path": "/scripts/freebayes_clusters.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> path_clusters = snakemake.input[0]
path_clusters = "/".join(path_clusters.split("/")[:-1]) + "/"
merge_vcf = snakemake.output[0]
ref_genome = snakemake.params[0]
regions = snakemake.params[1]
threads = snakemake.params[2]
vcf_list = []
... | code_fim | medium | {
"lang": "python",
"repo": "genid/de-goulash",
"path": "/scripts/freebayes_clusters.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>tles[i]
# classes += [(item.text.replace('\xa0', ' '), tit.text.replace('\xa0', ' '))]
# return classes<|fim_prefix|># repo: aannadi/CourseHelper-API path: /utils.py
import sys
from bs4 import BeautifulSoup
def get_classes(html):
"""
returns a list of classes and titles, parsing thr... | code_fim | medium | {
"lang": "python",
"repo": "aannadi/CourseHelper-API",
"path": "/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aannadi/CourseHelper-API path: /utils.py
import sys
from bs4 import BeautifulSoup
def get_classes(html):
"""
returns a list of classes and titles<|fim_suffix|>tles[i]
# classes += [(item.text.replace('\xa0', ' '), tit.text.replace('\xa0', ' '))]
# return classes<|fim_middle|... | code_fim | hard | {
"lang": "python",
"repo": "aannadi/CourseHelper-API",
"path": "/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Schnell5/InfSec path: /Education/getattribute_using.py
class CardHolder:
acctlen = 8
retireage = 59.5
def __init__(self, acct, name, age, addr):
self.acct = acct
self.name = name
self.age = age
self.addr = addr
def __getattribute__(self, item): ... | code_fim | hard | {
"lang": "python",
"repo": "Schnell5/InfSec",
"path": "/Education/getattribute_using.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sue = CardHolder('5678-12-34', 'Sue Jones', 35, '124 main st')
print(sue.acct, sue.name, sue.remain, sue.addr, sep=' / ')
try:
sue.age = 200
except Exception:
print('Bad age for Sue')
try:
sue.remain = 5
except Exception:
print("Can't set sue.remai... | code_fim | hard | {
"lang": "python",
"repo": "Schnell5/InfSec",
"path": "/Education/getattribute_using.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FinnMcCoding/CodeWars_Python path: /Split_the_bill.py
group = {
'A': 20,
'B': 15,
'C': 10
}
<|fim_suffix|> owed_dict = {}
sum = 0
people = 0
for key in x:
sum = sum + x[key]
people = people + 1
price_pp = sum/people
for key in x:
... | code_fim | easy | {
"lang": "python",
"repo": "FinnMcCoding/CodeWars_Python",
"path": "/Split_the_bill.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> owed_dict = {}
sum = 0
people = 0
for key in x:
sum = sum + x[key]
people = people + 1
price_pp = sum/people
for key in x:
owed_value = x[key] - price_pp
owed_dict[key] = round(owed_value, 2)
return owed_dict
split_the_bill(group)<... | code_fim | easy | {
"lang": "python",
"repo": "FinnMcCoding/CodeWars_Python",
"path": "/Split_the_bill.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YouMustStudy/GJsearch path: /DataClass.py
class Coms:
def __init__(self, name, addr, coord):
self.name = name
self.addr = addr
self.coord = coord
<|fim_suffix|> self.name = name
self.type = type
self.experience = experience
self.educatio... | code_fim | hard | {
"lang": "python",
"repo": "YouMustStudy/GJsearch",
"path": "/DataClass.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.name = name
self.type = type
self.experience = experience
self.education = education
self.keyword = keyword
self.salary = salary
self.url=url
self.start = start
self.end = end
def getString(self):
return "공고명 : " + s... | code_fim | medium | {
"lang": "python",
"repo": "YouMustStudy/GJsearch",
"path": "/DataClass.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>== 0:
print(f"{number} is an even number.")
else:
print(f"{number} is an odd number.")<|fim_prefix|># repo: pzrsa/pcc2-work path: /even_or_odd.py
number = int(input("Enter a number, and I'll te<|fim_middle|>ll you if it's even or odd: "))
if number % 2 | code_fim | easy | {
"lang": "python",
"repo": "pzrsa/pcc2-work",
"path": "/even_or_odd.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pzrsa/pcc2-work path: /even_or_odd.py
number = int(input("Enter a number, and I'll te<|fim_suffix|>== 0:
print(f"{number} is an even number.")
else:
print(f"{number} is an odd number.")<|fim_middle|>ll you if it's even or odd: "))
if number % 2 | code_fim | easy | {
"lang": "python",
"repo": "pzrsa/pcc2-work",
"path": "/even_or_odd.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>e(52)] for _ in range(2)]
d[0][1],d[0][2],d[1][1],d[1][2] = 1,1,1,2
for i in range(3,index + 1):
d[0][i] = d[1][i-1] + d[1][i-3]
d[1][i] = d[0][i] + d[0][i-2]
for k in n:
if k % 2 == 1:
print(d[0][math.ceil(k/2)])
else:
print(d[1][math.ceil(k/2)])<|fim_prefix|># repo: DevJI... | code_fim | medium | {
"lang": "python",
"repo": "DevJIYUL/AlgorithmStudy",
"path": "/Codeup/DP/Padovan_sequence.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DevJIYUL/AlgorithmStudy path: /Codeup/DP/Padovan_sequence.py
g#https://www.acmicpc.net/problem/9461
'''
1. Divide 2 case △ and ▽
d[0] is △ sequence
d[1] is ▽ sequence
2. find a role between d[0] and d[1]
'''
import math
t = int(input())
n = []
for _ in range(t):
n.append(int(input()))
index =... | code_fim | medium | {
"lang": "python",
"repo": "DevJIYUL/AlgorithmStudy",
"path": "/Codeup/DP/Padovan_sequence.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: existenceE/into path: /videoLesson/day73/bin/mxn.py
# 只放置可执行文件
#
# from ..src import package
# data_dict = package.pack()
<|fim_suffix|>from ..src.script import run
if __name__ == '__main__':
run()<|fim_middle|># from ..src.plugins import * #解释一遍全放入内存
# from ..src import plugins #导入这个文件夹(包,... | code_fim | medium | {
"lang": "python",
"repo": "existenceE/into",
"path": "/videoLesson/day73/bin/mxn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from ..src.script import run
if __name__ == '__main__':
run()<|fim_prefix|># repo: existenceE/into path: /videoLesson/day73/bin/mxn.py
# 只放置可执行文件
#
# from ..src import package
# data_dict = package.pack()
<|fim_middle|># from ..src.plugins import * #解释一遍全放入内存
# from ..src import plugins #导入这个文件夹(包... | code_fim | medium | {
"lang": "python",
"repo": "existenceE/into",
"path": "/videoLesson/day73/bin/mxn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greenenergy/tasktoy path: /main.py
#!/usr/bin/env python3
import datetime, random
class State(object):
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
class State_New(State):
def __init__(self):
super(State_New, self).__init__... | code_fim | hard | {
"lang": "python",
"repo": "greenenergy/tasktoy",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # So, first, go through all the tasks and weight each resource with how many
# times they appear as available
for t in tasks:
for r in t.resource_group.resources:
r.available_count += 1
# -------------------
# As we lay out tasks, we are at a "current time" point.... | code_fim | hard | {
"lang": "python",
"repo": "greenenergy/tasktoy",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
input_data = ['1,10000,40', '1,10002,45', '1,11015,50', '2,10005,42', '2,11051,45', '2,12064,42', '2,13161,42']
ans = ['10000-10999: 42.33', '11000-11999: 47.5', '12000-12999: 42.0', '13000-13999: 42.0']
print(test(input_data, ans, 1))<|fim_prefix|># repo: venu2508/... | code_fim | hard | {
"lang": "python",
"repo": "venu2508/code_test",
"path": "/code1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> results = twoSensorAvg(input, duration)
print(results)
if len(results) != len(output):
return False
for i in range(len(output)):
if results[i] != output[i]:
return False
return True
if __name__ == '__main__':
input_data = ['1,10000,40', '1,10002,45', '... | code_fim | medium | {
"lang": "python",
"repo": "venu2508/code_test",
"path": "/code1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: venu2508/code_test path: /code1.py
def twoSensorAvg(input_data, duration=1):
times = {}
for i in input_data:
data = i.split(',')
time = int(int(data[1]) / (duration * 1000))
if time not in times:
times[time] = [0, 0]
times[time][0] += int(data[2... | code_fim | medium | {
"lang": "python",
"repo": "venu2508/code_test",
"path": "/code1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args[1] == "next":
boss.active_tab_manager.next_tab(1)
elif args[1] == "previous":
boss.active_tab_manager.next_tab(-1)
boss.active_tab.neighboring_window(args[1])
handle_result.no_ui = True<|fim_prefix|># repo: zmanji/dotfiles path: /.config/kitty/tab.py
#!/usr/bin/env p... | code_fim | easy | {
"lang": "python",
"repo": "zmanji/dotfiles",
"path": "/.config/kitty/tab.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zmanji/dotfiles path: /.config/kitty/tab.py
#!/usr/bin/env python3
def main():
pass
<|fim_suffix|> boss.active_tab.neighboring_window(args[1])
handle_result.no_ui = True<|fim_middle|>def handle_result(args, result, target_window_id, boss):
if args[1] == "next":
boss.active_... | code_fim | hard | {
"lang": "python",
"repo": "zmanji/dotfiles",
"path": "/.config/kitty/tab.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JosephUrciuoli/serverless-nlp path: /docker-resources/src/feature_extractor.py
"""
This module is used to extract features from the lines extracted from documents
using BERT encodings. This package leverages the bert-as-a-server package to create the
embeddings.
Example:
feature_extract... | code_fim | hard | {
"lang": "python",
"repo": "JosephUrciuoli/serverless-nlp",
"path": "/docker-resources/src/feature_extractor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class FeatureExtractor:
"""Uses Bert-as-a-Server to set up a BertClient and embed text in a Document.
Attributes:
document (Document): This object encompasses the extracted text from one of the
PDF documents. There is an encoding field on each Line which is where t... | code_fim | medium | {
"lang": "python",
"repo": "JosephUrciuoli/serverless-nlp",
"path": "/docker-resources/src/feature_extractor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ encodes the text in the Document object, and then adds it to the encoding attribute """
text_lines = [line.text for line in self._document.lines]
encodings = self._bc.encode(text_lines)
for (line, encoding) in zip(self._document.lines, encodings):
line.encod... | code_fim | hard | {
"lang": "python",
"repo": "JosephUrciuoli/serverless-nlp",
"path": "/docker-resources/src/feature_extractor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_role():
for role in get_roles():
if role.is_default:
return role
return None
def has_role(role_type):
def decorator(function):
@wraps(function)
def wrapper(*args, **kwargs):
role = get_role()
if role and role.type >= role_ty... | code_fim | hard | {
"lang": "python",
"repo": "Virusmater/togger",
"path": "/togger/auth/auth_dao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def prepare_email(address, subject, content):
thread = Thread(target=send_email,
args=(address, subject, content, current_app.config,))
thread.daemon = True
thread.start()
def send_email(username, subject, content, config):
msg = EmailMessage()
msg.set_content(co... | code_fim | hard | {
"lang": "python",
"repo": "Virusmater/togger",
"path": "/togger/auth/auth_dao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Virusmater/togger path: /togger/auth/auth_dao.py
import smtplib
from email.message import EmailMessage
from functools import wraps
from threading import Thread
import flask_login
from flask import flash, current_app
from togger import db
from togger.auth.models import User, Role
from togger.cal... | code_fim | hard | {
"lang": "python",
"repo": "Virusmater/togger",
"path": "/togger/auth/auth_dao.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhi204/ytfs-web path: /download_app/views.py
from django.shortcuts import render,redirect
from . import download_function
from django.http import HttpResponse
# Create your views here.
def download(request):
<|fim_suffix|> file_url = download_function.download_generator(session,download_q... | code_fim | medium | {
"lang": "python",
"repo": "abhi204/ytfs-web",
"path": "/download_app/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_url = download_function.download_generator(session,download_quality,title)
return HttpResponse(file_url)<|fim_prefix|># repo: abhi204/ytfs-web path: /download_app/views.py
from django.shortcuts import render,redirect
from . import download_function
from django.http import HttpRespons... | code_fim | medium | {
"lang": "python",
"repo": "abhi204/ytfs-web",
"path": "/download_app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joeburg/phd-research path: /Zr:GPTMS_bonds:angles/find_bonds_angles_ZrGPTMS_noZr.py
:
atoms = sorted([atom1,atom2])
indicies = sorted([index1,index2])
index_atom = indicies + atoms + [d]
if indicies not in bond_index:... | code_fim | hard | {
"lang": "python",
"repo": "joeburg/phd-research",
"path": "/Zr:GPTMS_bonds:angles/find_bonds_angles_ZrGPTMS_noZr.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.figure(4)
plt.plot(CCSi_hist_data[0],CCSi_hist_data[1],'g')
plt.ylabel('g($\\theta$)')
plt.xlabel('Angle, $\\theta$ (degrees)')
plt.title('C-Si-O Angle Distribution')
plt.savefig('CCSi_angles.png')
plt.figure(5)
plt.plot(CSiO_hist_data[0],CSiO_hist_data[1],'m')
plt.ylabel('g($\\theta$)')
plt.xlabel('... | code_fim | hard | {
"lang": "python",
"repo": "joeburg/phd-research",
"path": "/Zr:GPTMS_bonds:angles/find_bonds_angles_ZrGPTMS_noZr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
## d = distance(x1,x2,y1,y2,z1,z2)
## if d<=2.3:
## atoms = sorted([atom1,atom2])
## indicies = sorted([index1,index2])
## index_atom = indicies + atoms + [d]
## if index_atom not in C... | code_fim | hard | {
"lang": "python",
"repo": "joeburg/phd-research",
"path": "/Zr:GPTMS_bonds:angles/find_bonds_angles_ZrGPTMS_noZr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Ahora con la instruccion yield from
#Simplifica el código del generador en caso tengamos que usar bucles anidados.
#*el asterisoc en python significa que no se sabe cuantos argumentos se incluiran y que estos se entregaran en forma de tupla
def devuelveCiudades(*ciudades):
for e in ciudades:
... | code_fim | medium | {
"lang": "python",
"repo": "korderoman/pythonPracticas",
"path": "/clases/Generadores.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: korderoman/pythonPracticas path: /clases/Generadores.py
"""
Estructuras que extraen valores de una función y se almacenan en objetos iterables (que se pueden recorrer
Son mas eficientes que las funciones tradicionales
muy útiles con listas de valores infinitos
Bajos determinados escenarios, s... | code_fim | hard | {
"lang": "python",
"repo": "korderoman/pythonPracticas",
"path": "/clases/Generadores.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(next(ciudadesDevueltas2))
print(next(ciudadesDevueltas2))
def devuelveCiudades3(*ciudades):
for e in ciudades:
yield from e #devuelve lo mismo que la funcion 2
ciudadesDevueltas3=devuelveCiudades3("Madrid","Barcelona","Bilbao","Valencia")
print(next(ciudadesDevueltas3))... | code_fim | hard | {
"lang": "python",
"repo": "korderoman/pythonPracticas",
"path": "/clases/Generadores.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: innodatalabs/redstork-ui path: /ui/controller/annot_controller.py
from redstork import PageObject
<|fim_suffix|> yield from page.flat_iter()<|fim_middle|>class AnnotController:
def get_annotations(self, project, page_index):
page = project.doc[page_index]
| code_fim | medium | {
"lang": "python",
"repo": "innodatalabs/redstork-ui",
"path": "/ui/controller/annot_controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_annotations(self, project, page_index):
page = project.doc[page_index]
yield from page.flat_iter()<|fim_prefix|># repo: innodatalabs/redstork-ui path: /ui/controller/annot_controller.py
from redstork import PageObject
<|fim_middle|>
class AnnotController:
| code_fim | easy | {
"lang": "python",
"repo": "innodatalabs/redstork-ui",
"path": "/ui/controller/annot_controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield from page.flat_iter()<|fim_prefix|># repo: innodatalabs/redstork-ui path: /ui/controller/annot_controller.py
from redstork import PageObject
<|fim_middle|>
class AnnotController:
def get_annotations(self, project, page_index):
page = project.doc[page_index]
| code_fim | medium | {
"lang": "python",
"repo": "innodatalabs/redstork-ui",
"path": "/ui/controller/annot_controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> text = forms.CharField(
max_length=50,
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "Things to Buy"}
),
)<|fim_prefix|># repo: deboracornetta/shoppingList path: /listings/forms.py
from django import forms
<|fim_middle|>
class ListingF... | code_fim | easy | {
"lang": "python",
"repo": "deboracornetta/shoppingList",
"path": "/listings/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deboracornetta/shoppingList path: /listings/forms.py
from django import forms
<|fim_suffix|> text = forms.CharField(
max_length=50,
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "Things to Buy"}
),
)<|fim_middle|>
class ListingF... | code_fim | easy | {
"lang": "python",
"repo": "deboracornetta/shoppingList",
"path": "/listings/forms.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if delta < 0.0:
print("Impossivel calcular")
else:
raiz = delta ** 0.5
r1 = (-B+raiz)/(2*A)
r2 = (-B-raiz)/(2*A)
print("R1 = {:.5f}".format(r1))
print("R2 = {:.5f}".format(r2))<|fim_prefix|># repo: gutierrecunha/urionlinejudge_python path: /URI_1036... | code_fim | medium | {
"lang": "python",
"repo": "gutierrecunha/urionlinejudge_python",
"path": "/URI_1036 - (8586728) - Accepted.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gutierrecunha/urionlinejudge_python path: /URI_1036 - (8586728) - Accepted.py
# -*- coding: utf-8 -*-
num = input().split()
A = float(num[0])
B = float(num[1])
C = float(num[2])
<|fim_suffix|> if delta < 0.0:
print("Impossivel calcular")
else:
raiz = delta ** 0.5
... | code_fim | medium | {
"lang": "python",
"repo": "gutierrecunha/urionlinejudge_python",
"path": "/URI_1036 - (8586728) - Accepted.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabrieldtc/CursoEmVideoPython path: /PyCharm/Desafios/Mundo2/desafio44.py
# ELABORE UM PROGRAMA QUE CALCULE O A SER PAGO POR UM PRODUTO CONSIDERANDO O PRECO NORMAL E A FORMA DE PAGAM<|fim_suffix|>rtao: 5%
# 2x: preco normal
# 3x ou mais: 20% de juros<|fim_middle|>ENTO
# a vista dinehiro ou cheque... | code_fim | easy | {
"lang": "python",
"repo": "gabrieldtc/CursoEmVideoPython",
"path": "/PyCharm/Desafios/Mundo2/desafio44.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rtao: 5%
# 2x: preco normal
# 3x ou mais: 20% de juros<|fim_prefix|># repo: gabrieldtc/CursoEmVideoPython path: /PyCharm/Desafios/Mundo2/desafio44.py
# ELABORE UM PROGRAMA QUE CALCULE O A SER PAGO POR UM PRODUTO CONSIDERANDO O PRECO NORMAL E A FORMA DE PAGAM<|fim_middle|>ENTO
# a vista dinehiro ou cheque... | code_fim | easy | {
"lang": "python",
"repo": "gabrieldtc/CursoEmVideoPython",
"path": "/PyCharm/Desafios/Mundo2/desafio44.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 设置坐标轴刻度,刻度间隔,range不能设置步长
my_x_ticks = np.arange(0, 61, 5)
plt.xticks(my_x_ticks)
# 设置网格
plt.grid(axis='both', color='grey', linestyle='-.', alpha=0.5)
# 显示图形
plt.show()<|fim_prefix|># repo: FelixZFB/Python_data_analysis path: /001_Python_from_introduction_to_practice/001_plot_折线图_条形图(柱状图)_直方图_中文显示/00... | code_fim | hard | {
"lang": "python",
"repo": "FelixZFB/Python_data_analysis",
"path": "/001_Python_from_introduction_to_practice/001_plot_折线图_条形图(柱状图)_直方图_中文显示/004_横置条形图(柱状图)_电影票房数据图.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FelixZFB/Python_data_analysis path: /001_Python_from_introduction_to_practice/001_plot_折线图_条形图(柱状图)_直方图_中文显示/004_横置条形图(柱状图)_电影票房数据图.py
# -*- coding: utf-8 -*-
# 导入包
import matplotlib.pyplot as plt
import numpy as np
# 显示中文和显示负号
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.uni... | code_fim | hard | {
"lang": "python",
"repo": "FelixZFB/Python_data_analysis",
"path": "/001_Python_from_introduction_to_practice/001_plot_折线图_条形图(柱状图)_直方图_中文显示/004_横置条形图(柱状图)_电影票房数据图.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mandradepeixoto/RentalPricePrediction path: /Scripts/DecisionTree.py
"""
Author: Alan Danque
Date: 20210323
Purpose:Final Data Wrangling, strips html and punctuation.
"""
from sklearn.tree import export_graphviz
import pydot
import pickle
from pathlib import Path
import pandas as pd
import num... | code_fim | hard | {
"lang": "python",
"repo": "mandradepeixoto/RentalPricePrediction",
"path": "/Scripts/DecisionTree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Dataframe Loaded: --- %s seconds ---" % (time.time() - start_time))
# load model and predict
model_file = results_dir.joinpath('My3rdModel.pkl')
with open(model_file, 'rb') as f:
rf = pickle.load(f)
#rf.predict(X[0:1])
print("Model Loaded: --- %s seconds ---" % (time.time() - start_time))
... | code_fim | hard | {
"lang": "python",
"repo": "mandradepeixoto/RentalPricePrediction",
"path": "/Scripts/DecisionTree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> </div></div></div>
<div class="col-sm-12 main">
<div class="row">
<div class="col-sm-12 head">
<div class="row">
<div class="col-sm-12 head1">
<div class="text-center"><span class="fa fa-cutlery "></span> Add Cake Menu </div>
</div>
</div></div>
</div... | code_fim | hard | {
"lang": "python",
"repo": "rastogi9318/Bake-o-logy",
"path": "/admin/Addcakemenu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rastogi9318/Bake-o-logy path: /admin/Addcakemenu.py
#!C:\Python27\python
print('Content-Type:text/html\n\n')
print ("""
<html>
<head>
<link href="iconTech.png" rel="icon"/>
<meta name="viewport" content="width=device-width,intial-scale=1.0"/>
<link href="../css/bootstrap.min.css" rel="styl... | code_fim | hard | {
"lang": "python",
"repo": "rastogi9318/Bake-o-logy",
"path": "/admin/Addcakemenu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>n, m = input1.strip().split(' ')
n, m = [int(n), int(m)]
c = list(map(int, input2.strip().split(' ')))
# Print the number of ways of making change for 'n' units using coins having the values given by 'c'
ways = change_making(c, n)
print(ways)<|fim_prefix|># repo: tomasz-pankowski/hackerrank path: /the_co... | code_fim | hard | {
"lang": "python",
"repo": "tomasz-pankowski/hackerrank",
"path": "/the_coin_change_problem.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.