text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> glucose = models.FloatField()
insulin = models.FloatField()
bmi = models.FloatField()
age = models.IntegerField()
def __str__(self):
return self.glucose<|fim_prefix|># repo: arc-arnob/Healthe-master path: /backend/core/MlDiagnosis/django_api/diabetesEnv/diabetesApi/models.py
... | code_fim | easy | {
"lang": "python",
"repo": "arc-arnob/Healthe-master",
"path": "/backend/core/MlDiagnosis/django_api/diabetesEnv/diabetesApi/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.glucose<|fim_prefix|># repo: arc-arnob/Healthe-master path: /backend/core/MlDiagnosis/django_api/diabetesEnv/diabetesApi/models.py
from django.db import models
# Create your models here.
class diagnosis(models.Model):
glucose = models.FloatField()
insulin = models.FloatField(... | code_fim | easy | {
"lang": "python",
"repo": "arc-arnob/Healthe-master",
"path": "/backend/core/MlDiagnosis/django_api/diabetesEnv/diabetesApi/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>$', views.user_logout, name='logout'),
url(r'^special/', views.special, name='special'),
]<|fim_prefix|># repo: devbaggett/django_passwords path: /main/urls.py
from django.contrib import admin
from django.conf.urls import url, include
from apps.users_app import views
urlpatterns = [
url('admin/'... | code_fim | medium | {
"lang": "python",
"repo": "devbaggett/django_passwords",
"path": "/main/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devbaggett/django_passwords path: /main/urls.py
from django.contrib import admin
from django.conf.urls import url, include
from apps.users_ap<|fim_suffix|>$', views.user_logout, name='logout'),
url(r'^special/', views.special, name='special'),
]<|fim_middle|>p import views
urlpatterns = [
... | code_fim | medium | {
"lang": "python",
"repo": "devbaggett/django_passwords",
"path": "/main/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(denominations_array) - 1, -1, -1): # we want to start from the highest denomination possible
while change_to_give >= denominations_array[i] and change_to_give > 0: # we go from back to front while change is bigger
change_to_give -= denominations_arr... | code_fim | hard | {
"lang": "python",
"repo": "hulaba/GeeksForGeeksPython",
"path": "/Greedy/MinNumberOfCoins.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hulaba/GeeksForGeeksPython path: /Greedy/MinNumberOfCoins.py
class MinNumberOfCoins:
def run(self, denominations_array, change_to_give):
coins_used = []
<|fim_suffix|> for coin in coins_used: # we are just gonna print out the result here after we are done iterating
... | code_fim | hard | {
"lang": "python",
"repo": "hulaba/GeeksForGeeksPython",
"path": "/Greedy/MinNumberOfCoins.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iandennismiller/pmsp-torch path: /src/pmsp/__meta__.py
# PMSP Torch
# Ian Dennis Miller, Brian Lam, Blair Armstrong
__version__ = '0.2'
_<|fim_suffix|>g'
__email__ = 'CAP Lab'
__url__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'
__repo__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'... | code_fim | medium | {
"lang": "python",
"repo": "iandennismiller/pmsp-torch",
"path": "/src/pmsp/__meta__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
__repo__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'
__copyright__ = '2020'<|fim_prefix|># repo: iandennismiller/pmsp-torch path: /src/pmsp/__meta__.py
# PMSP Torch
# Ian Dennis Miller, Brian Lam, Blair Armstrong
__version__ = '0.2'
_<|fim_middle|>_project__ = 'pmsp-torch'
__author__ = 'Ian Den... | code_fim | medium | {
"lang": "python",
"repo": "iandennismiller/pmsp-torch",
"path": "/src/pmsp/__meta__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>g'
__email__ = 'CAP Lab'
__url__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'
__repo__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'
__copyright__ = '2020'<|fim_prefix|># repo: iandennismiller/pmsp-torch path: /src/pmsp/__meta__.py
# PMSP Torch
# Ian Dennis Miller, Brian Lam, Blair Armstrong... | code_fim | medium | {
"lang": "python",
"repo": "iandennismiller/pmsp-torch",
"path": "/src/pmsp/__meta__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_seq = ''
for aa in prot:
# print aa
# new_aa = vd_table_obj.weighting_dict[aa][0].get_opt()
new_aa = vd_table_obj.weighting_dict[aa][0].sorted_codons[-1]
new_seq = new_seq + new_aa
return(new_seq)
def optimise_worst(prot):
new_seq = ''
for aa in pro... | code_fim | hard | {
"lang": "python",
"repo": "harrisonlab/verticillium_clocks",
"path": "/codon_optimisation/score_codons.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>vd_table_obj = CodonTab_obj()
vd_table_obj.add_table(table)
# for k in vd_table_obj.weighting_dict.keys():
# print(vd_table_obj.weighting_dict[k][0].weightings)
# print(prot)
#-----------------------------------------------------
# Step X
# Optimise codons - random weightings
#--------------------... | code_fim | hard | {
"lang": "python",
"repo": "harrisonlab/verticillium_clocks",
"path": "/codon_optimisation/score_codons.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harrisonlab/verticillium_clocks path: /codon_optimisation/score_codons.py
#!/usr/bin/python
'''
This script generates a codon optimised protein based upon a fasta protein
sequence and a table of relative codon usage.
'''
from sets import Set
import sys,argparse
from collections import defaultdi... | code_fim | hard | {
"lang": "python",
"repo": "harrisonlab/verticillium_clocks",
"path": "/codon_optimisation/score_codons.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> spotifyconnect._session_instance.connection.login(
username, zeroconf=(blob, clientKey))
return jsonify({
'status': 101,
'spotifyError': 0,
'statusString': 'ERROR-OK'
})<|fim_prefix|># repo: chukysoria/pyspotify-connect path: /spotifyconnect/_zeroconfserver.py... | code_fim | hard | {
"lang": "python",
"repo": "chukysoria/pyspotify-connect",
"path": "/spotifyconnect/_zeroconfserver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_info():
zeroconf_vars = spotifyconnect._session_instance.get_zeroconf_vars()
return jsonify({
'status': 101,
'spotifyError': 0,
'activeUser': zeroconf_vars.active_user,
'brandDisplayName': spotifyconnect._session_instance.config.brand_name,
'accoun... | code_fim | hard | {
"lang": "python",
"repo": "chukysoria/pyspotify-connect",
"path": "/spotifyconnect/_zeroconfserver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chukysoria/pyspotify-connect path: /spotifyconnect/_zeroconfserver.py
from flask import Flask, jsonify, request
import spotifyconnect
app = Flask('SpotifyConnect')
# #API routes
# Login routes
@app.route('/login/_zeroconf', methods=['GET', 'POST'])
def login_zeroconf():
action = reques... | code_fim | medium | {
"lang": "python",
"repo": "chukysoria/pyspotify-connect",
"path": "/spotifyconnect/_zeroconfserver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heronrs/practice_design_patterns path: /patterns/creational/prototype.py
class Prototype(object):
value = 'default'
def clone(self, **attr):
obj = self.__class__()
obj.__dict__.update(attr)
return obj
class PrototypeDispatcher(object):
def __init__(self):
self._objects ... | code_fim | medium | {
"lang": "python",
"repo": "heronrs/practice_design_patterns",
"path": "/patterns/creational/prototype.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
dispatcher = PrototypeDispatcher()
prototype = Prototype()
proto1 = prototype.clone(value='origin', category='Double')
proto2 = prototype.clone(value='conn', is_valid=True)
dispatcher.setObject('proto1', proto1)
dispatcher.setObject('proto2', proto2)
print(dispatcher.getObject... | code_fim | medium | {
"lang": "python",
"repo": "heronrs/practice_design_patterns",
"path": "/patterns/creational/prototype.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._objects[name] = obj
def delObject(self, obj_name):
del self._objects[obj_name]
def main():
dispatcher = PrototypeDispatcher()
prototype = Prototype()
proto1 = prototype.clone(value='origin', category='Double')
proto2 = prototype.clone(value='conn', is_valid=True)
dispatcher.s... | code_fim | medium | {
"lang": "python",
"repo": "heronrs/practice_design_patterns",
"path": "/patterns/creational/prototype.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
count+=1
a.remove(min(a))
print(min(a))<|fim_prefix|># repo: JayapraveenS/GeneralProgramming path: /second minimum finder.py
a=[]
b=int(input("value of N"))
count=0
fo<|fim_middle|>r count in range(0,b):
i=int(input("Enter the number:"))
a.append(i)
del i
| code_fim | medium | {
"lang": "python",
"repo": "JayapraveenS/GeneralProgramming",
"path": "/second minimum finder.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayapraveenS/GeneralProgramming path: /second minimum finder.py
a=[]
b=int(input("value of N"))
count=0
fo<|fim_suffix|>
count+=1
a.remove(min(a))
print(min(a))<|fim_middle|>r count in range(0,b):
i=int(input("Enter the number:"))
a.append(i)
del i
| code_fim | medium | {
"lang": "python",
"repo": "JayapraveenS/GeneralProgramming",
"path": "/second minimum finder.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> config = Config.challenge_config
condition = config.get(next_level)
user_challenge.challenge_info = json.dumps(challenge_info)
await self.application.objects.update(user_challenge)
challenge_info_json = json.dumps(challenge_info)
self.redis_spare.hs... | code_fim | hard | {
"lang": "python",
"repo": "ColaZZ/qc_server",
"path": "/apps/api_v2/challenge_handler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ColaZZ/qc_server path: /apps/api_v2/challenge_handler.py
#!/usr/bin/python3
import json
from apps.found_handler_v2 import RedisHandler
from lib.routes import route
from lib.authenticated_async import authenticated_async
from apps.models.user import User_Challenge
from apps.models.conf... | code_fim | hard | {
"lang": "python",
"repo": "ColaZZ/qc_server",
"path": "/apps/api_v2/challenge_handler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: midemarc/Juridico path: /juridico_site/juridico/views.py
from django.http import HttpResponse, HttpResponseNotFound, JsonResponse
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework.parsers import JSONPa... | code_fim | hard | {
"lang": "python",
"repo": "midemarc/Juridico",
"path": "/juridico_site/juridico/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Populer les résultats
n_orgs = RessourceDeRequete.objects.filter(
type_classe="Organisation",
requete=req
).count()
n_docs =RessourceDeRequete.objects.filter(
type_classe="Documentation",
requete=req
... | code_fim | hard | {
"lang": "python",
"repo": "midemarc/Juridico",
"path": "/juridico_site/juridico/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if n_docs < compte_desire_docu:
v = req.get_desc_vector()
for d, o in met.get_top_educaloi(v,topn=compte_desire_docu-n_docs):
met.add_documentation(req, o.resid, poids=0.3)
# Les convertir en json pour les envoyer à angular
docu_objs = Doc... | code_fim | hard | {
"lang": "python",
"repo": "midemarc/Juridico",
"path": "/juridico_site/juridico/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def doParse(self, rule):
tree = rule()
builder = OPromptoBuilder(self)
walker = ParseTreeWalker()
walker.walk(builder, tree)
return builder.getNodeValue(tree)<|fim_prefix|># repo: prompto/prompto-python3 path: /Python3-Core/src/main/prompto/parser/OCleverParser... | code_fim | medium | {
"lang": "python",
"repo": "prompto/prompto-python3",
"path": "/Python3-Core/src/main/prompto/parser/OCleverParser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prompto/prompto-python3 path: /Python3-Core/src/main/prompto/parser/OCleverParser.py
import codecs
from antlr4 import *
from antlr4.InputStream import InputStream
from prompto.parser.OParser import OParser
from prompto.parser.ONamingLexer import ONamingLexer
from prompto.parser.OPromptoBuilder im... | code_fim | hard | {
"lang": "python",
"repo": "prompto/prompto-python3",
"path": "/Python3-Core/src/main/prompto/parser/OCleverParser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def equalToken(self):
return OParser.EQ
def doParse(self, rule):
tree = rule()
builder = OPromptoBuilder(self)
walker = ParseTreeWalker()
walker.walk(builder, tree)
return builder.getNodeValue(tree)<|fim_prefix|># repo: prompto/prompto-python3 pat... | code_fim | hard | {
"lang": "python",
"repo": "prompto/prompto-python3",
"path": "/Python3-Core/src/main/prompto/parser/OCleverParser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> tecnica = TecnicaModel.find_by_id(tecnica_id)
if tecnica:
return tecnica.json(), 200
return {"message":"Tecnica '{}' não encontrada.".format(tecnica_id)}, 404
class ItemsByTecnica(Resource):
def get (self, tecnica_id):
tecnica = TecnicaModel.find_by_id(tecn... | code_fim | hard | {
"lang": "python",
"repo": "Just-Cook/JustCookAPI",
"path": "/app_justcook/resources/tecnica.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Just-Cook/JustCookAPI path: /app_justcook/resources/tecnica.py
from app_justcook.models.tecnica import TecnicaModel
from flask_restful import Resource
class Tecnica(Resource):
def get(self):
<|fim_suffix|> tecnica = TecnicaModel.find_by_id(tecnica_id)
if tecnica:
... | code_fim | medium | {
"lang": "python",
"repo": "Just-Cook/JustCookAPI",
"path": "/app_justcook/resources/tecnica.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rongacmer/fMRI-deeping-learning path: /train_fcn.py
import math, datetime, os
from FCN import *
from voxnet import VoxNet
from fmri_data import fMRI_data
from config import cfg
import time
from evaluation import *
from sklearn import svm
def main(data_index=None,cut_shape=None,data_type=['MCIc'... | code_fim | hard | {
"lang": "python",
"repo": "rongacmer/fMRI-deeping-learning",
"path": "/train_fcn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
checkpoint_num = 0
learning_step = 0
min_loss = 1e308
if voxnet_point:
cfg.voxnet_checkpoint = voxnet_point
accuracy_filename = os.path.join(cfg.fcn_checkpoint_dir, 'accuracies.txt')
if not os.path.isdir(cfg.fcn_checkpoint_dir):
os.mkdir(cfg.fcn_checkpoint_dir)
... | code_fim | hard | {
"lang": "python",
"repo": "rongacmer/fMRI-deeping-learning",
"path": "/train_fcn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (batch_index and loss > 1.5 * min_loss and
learning_rate > learning_rate_decay_limit):
min_loss = loss
learning_step *= 1.2
print("decreasing learning rate...")
min_loss = min(loss, min_l... | code_fim | hard | {
"lang": "python",
"repo": "rongacmer/fMRI-deeping-learning",
"path": "/train_fcn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: selvi7/samplepyhon path: /a6.py
# Python 3 program to
# find maximum triplet sum
# Function to calculate
# maximum triplet sum
def maxTripletSum(arr, m) :
# Initialize the answer
ans = 0
for i in range(1, (m - 1)) :
max1 = 0
max2 = 0
# find... | code_fim | medium | {
"lang": "python",
"repo": "selvi7/samplepyhon",
"path": "/a6.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ans
# Driver code
arr = [ 2, 5, 3, 1, 4, 9 ]
m = len(arr)
print(maxTripletSum(arr, m))
# This code is contributed
# by Nikita Tiwari.<|fim_prefix|># repo: selvi7/samplepyhon path: /a6.py
# Python 3 program to
# find maximum triplet sum
# Function to calculate
# maxim... | code_fim | hard | {
"lang": "python",
"repo": "selvi7/samplepyhon",
"path": "/a6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def configure_logging(app):
"""
Configures logging.
"""
logs_folder = os.path.join(app.root_path, os.pardir, "logs")
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s ')
info_log = os.path.join(logs_folder, app.config['INFO_LOG'])
info_file_handler = lo... | code_fim | medium | {
"lang": "python",
"repo": "kulasama/gaia",
"path": "/gaia/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kulasama/gaia path: /gaia/app.py
from flask import Flask, request
from gaia.api.views import api
import os,logging
import logging.handlers
import gaia.demo.views
def create_app(config=None):
"""
Creates the app.
"""
# Initialize the app
app = Flask("gaia")
# config
... | code_fim | hard | {
"lang": "python",
"repo": "kulasama/gaia",
"path": "/gaia/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>n = list(range(1,N))
p = [math.log2(i)+1 for i in n]
plt.title("Performance busca linear x busca binária")
plt.xlabel("Quantidade de elementos")
plt.ylabel("Quantidade de verificações")
plt.plot(n,n,label="Busca linear")
plt.plot(n,p,label="Busca binária")
plt.legend()
plt.grid()
plt.show()<|fim_prefix|>... | code_fim | medium | {
"lang": "python",
"repo": "tadeuif/Exercicios-ACs",
"path": "/Matérias/Estrutura de Dados/Aula 5/buscas binaria e linear.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tadeuif/Exercicios-ACs path: /Matérias/Estrutura de Dados/Aula 5/buscas binaria e linear.py
import math
import matplotlib.pyplot as plt
N = 10
<|fim_suffix|>n = list(range(1,N))
p = [math.log2(i)+1 for i in n]
plt.title("Performance busca linear x busca binária")
plt.xlabel("Quantidade de eleme... | code_fim | medium | {
"lang": "python",
"repo": "tadeuif/Exercicios-ACs",
"path": "/Matérias/Estrutura de Dados/Aula 5/buscas binaria e linear.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_contract_line_onchange(self):
contract = self.env['contract.contract'].create({
'name': 'Test contract',
'partner_id': self.partner.id,
})
line_obj = self.env['contract.line']
line = line_obj.new({
'name': 'Test contract',
... | code_fim | hard | {
"lang": "python",
"repo": "treytux/trey-addons",
"path": "/contract_cumulative_discount/tests/test_contract_cumulative_discount.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: treytux/trey-addons path: /contract_cumulative_discount/tests/test_contract_cumulative_discount.py
###############################################################################
# For copyright and license notices, see __manifest__.py file in root directory
######################################... | code_fim | hard | {
"lang": "python",
"repo": "treytux/trey-addons",
"path": "/contract_cumulative_discount/tests/test_contract_cumulative_discount.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: innovatelogic/shop7 path: /src/common/db/group_category_mapping.py
from types.user_mapping import UserMapping
USER_GROUPS_MAPPING_NAME = "user_category_mapping"
#----------------------------------------------------------------------------------------------
class GroupCategoryMapping():
def ... | code_fim | hard | {
"lang": "python",
"repo": "innovatelogic/shop7",
"path": "/src/common/db/group_category_mapping.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> mapping.clear()
pass
#----------------------------------------------------------------------------------------------
def updateUserMapping(self, mapping):
self.cat.update_one({
'_id': mapping._id
},{
'$set': {
'mapping': mapping.mapp... | code_fim | hard | {
"lang": "python",
"repo": "innovatelogic/shop7",
"path": "/src/common/db/group_category_mapping.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wang264/JiuZhangLintcode path: /Algorithm/L7/require/494_implement-stack-by-two-queues.py
# 494. 双队列实现栈
# 中文English
# 利用两个队列来实现一个栈的功能
#
# 例1:
# 输入:
# push(1)
# pop()
# push(2)
# isEmpty() // return false
# top() // return 2
# pop()
# isEmpty() // return true
# 例2:
#
# 输入:
# isEmpty()
from collect... | code_fim | hard | {
"lang": "python",
"repo": "wang264/JiuZhangLintcode",
"path": "/Algorithm/L7/require/494_implement-stack-by-two-queues.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = Stack()
s.push(1)
s.push(2)
s.pop()
s.push(3)
s.isEmpty() #// return false
s.top() #// #return 2
s.pop()
s.isEmpty() #// return true
s = Stack()
s.push(1)
s.pop()
s.push(2)
s.isEmpty()
s.top()
s.pop()
s.isEmpty()<|fim_prefix|># repo: wang264/JiuZhangLintcode path: /Algorithm/L7/require/494_implement... | code_fim | hard | {
"lang": "python",
"repo": "wang264/JiuZhangLintcode",
"path": "/Algorithm/L7/require/494_implement-stack-by-two-queues.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> visited.add(instr_ptr)
op = instructions[instr_ptr][0]
if op in ('jmp', 'nop'):
_debug(f"{op} detected at {instr_ptr}")
if nop_jmp_counter == nop_jmp_switch:
op = 'jmp' if op == 'nop' else 'nop'
_debug(f"Op changed to {op}")
... | code_fim | hard | {
"lang": "python",
"repo": "RookieRick/AdventOfCode",
"path": "/AoC2020/day8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RookieRick/AdventOfCode path: /AoC2020/day8.py
import AdventOfCode.util.input_parser as parser
PART = 2
DEBUG = False
def _debug(msg):
if DEBUG:
print(msg)
if __name__=="__main__":
filename = f"./raw_inputs/day8{'_debug' if DEBUG else ''}.txt"
instructions = parser.parse(... | code_fim | hard | {
"lang": "python",
"repo": "RookieRick/AdventOfCode",
"path": "/AoC2020/day8.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangsunny/Markov-Chain-Monte-Carlo path: /main/Metropolis Hastings Sampling.py
"""
Metropolis-Hastings 采样算法解决了Metropolis要求变量分布对称性的问题
也可以将Metropolis看作是Metropolis-Hastings的特殊情况,即q_{ij} = q_{ji}
测试Metropolis-Hastings 算法对多变量分布采样
对多变量分布采样有两种方法:BlockWise和ComponentWise
BlockWise: 需要与样本属性数量相同的多变量分布,每次生成... | code_fim | hard | {
"lang": "python",
"repo": "zhangsunny/Markov-Chain-Monte-Carlo",
"path": "/main/Metropolis Hastings Sampling.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for t in range(1, T):
for i in range(theta.shape[-1]):
# 每次只产生一个属性的值
theta_hat = np.random.uniform(theta_min, theta_max, size=1)
theta_tmp = np.array(theta[t-1])
theta_tmp[i] = theta_hat
# 注意此时计算alpha,分子的参数只改变当前属性的值,其余值不变
... | code_fim | hard | {
"lang": "python",
"repo": "zhangsunny/Markov-Chain-Monte-Carlo",
"path": "/main/Metropolis Hastings Sampling.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Install all other files
target_dir = get_target_dir(defaults)
for source in listdir(directory):
if source in visited:
continue
dotfile = Dotfile(source, target_dir, **defaults)
try:
dotfile.install()
except (FileExistsError, FileNotF... | code_fim | hard | {
"lang": "python",
"repo": "valschneider/dotfiles",
"path": "/dotfiles.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: valschneider/dotfiles path: /dotfiles.py
#!/usr/bin/env python3
import os
import yaml
HOME = os.path.expanduser("~")
class Dotfile:
def __init__(self, source, target_dir, dotify=False, create_parent=False):
self.source = source
target_file = os.path.basename(self.source)
... | code_fim | hard | {
"lang": "python",
"repo": "valschneider/dotfiles",
"path": "/dotfiles.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if search_word in terms_only:
count_search.update(terms_only)
com_max = []
# For each term, look for the most common co-occurrent terms
for t1 in com:
t1_max_terms = sorted(com[t1].items(), key=operator.itemgetter(1), reverse=True)[:5]
for t2, t2_count in t... | code_fim | hard | {
"lang": "python",
"repo": "bijandhakal/twitter_analysis",
"path": "/co-occurrences.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bijandhakal/twitter_analysis path: /co-occurrences.py
import operator
import json
from text_preprocessing import preprocess
from collections import Counter
from nltk.corpus import stopwords
from nltk import bigrams,ngrams
from collections import defaultdict
import string
import sys
punctuatio... | code_fim | hard | {
"lang": "python",
"repo": "bijandhakal/twitter_analysis",
"path": "/co-occurrences.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>height_plot.set_xlabel('Image Height')
height_plot.set_ylabel('Fraction')
height_plot.set_title('Height Distribution')
height_plot.set_xlim(MIN_HEIGHT, MAX_HEIGHT)
height_plot.set_ylim(0, max(n))
height_plot.grid(True)
width_plot = fig.add_subplot(112)
l = width_plot.hist(HEIGHTS, 50, normed=1, facecolo... | code_fim | hard | {
"lang": "python",
"repo": "qpham01/udacity",
"path": "/mlnd/capstone/data_explore.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>width_plot = fig.add_subplot(112)
l = width_plot.hist(HEIGHTS, 50, normed=1, facecolor='green', alpha=0.75)
width_plot.set_xlabel('Image Height')
width_plot.set_ylabel('Fraction')
width_plot.set_title('Height Distribution')
width_plot.set_xlim(MIN_HEIGHT, MAX_HEIGHT)
width_plot.set_ylim(0, max(n))
width... | code_fim | hard | {
"lang": "python",
"repo": "qpham01/udacity",
"path": "/mlnd/capstone/data_explore.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qpham01/udacity path: /mlnd/capstone/data_explore.py
"""
Code loading and analyzing SVHN images and data
"""
import os
import numpy as np
from PIL import Image
print('All modules imported.')
# Wait until you see that all files have been downloaded.
print('All files downloaded.')
def load_svhn_... | code_fim | hard | {
"lang": "python",
"repo": "qpham01/udacity",
"path": "/mlnd/capstone/data_explore.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: numba/numba path: /numba/cuda/tests/cudapy/test_laplace.py
import numpy as np
from numba import cuda, float64, void
from numba.cuda.testing import unittest, CUDATestCase
from numba.core import config
# NOTE: CUDA kernel does not return any value
if config.ENABLE_CUDASIM:
tpb = 4
else:
t... | code_fim | hard | {
"lang": "python",
"repo": "numba/numba",
"path": "/numba/cuda/tests/cudapy/test_laplace.py",
"mode": "psm",
"license": "LicenseRef-scancode-secret-labs-2011",
"source": "the-stack-v2"
} |
<|fim_suffix|> while error > tol and iter < iter_max:
self.assertTrue(error_grid.dtype == np.float64)
jocabi_relax_core[griddim, blockdim, stream](dA, dAnew, derror_grid)
derror_grid.copy_to_host(error_grid, stream=stream)
# error_grid is available on host
... | code_fim | hard | {
"lang": "python",
"repo": "numba/numba",
"path": "/numba/cuda/tests/cudapy/test_laplace.py",
"mode": "spm",
"license": "LicenseRef-scancode-secret-labs-2011",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glennmacapinlac/Project3 path: /Project 3/app.py
# import necessary libraries
from models import create_classes
import os
from flask import (
Flask,
render_template,
jsonify,
request,
redirect)
#################################################
# Flask Setup
##################... | code_fim | hard | {
"lang": "python",
"repo": "glennmacapinlac/Project3",
"path": "/Project 3/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "POST":
Soccer_Match = request.form["Matchup_US_P"]
Visitor_Odd = request.form["Visitor_Odd"]
Draw_Odd = request.form["Draw_Odd"]
Home_Odd = request.form["Home_Odd"]
Soccer_Match_Result = request.form["True_Result"]
sportsbetting = ... | code_fim | hard | {
"lang": "python",
"repo": "glennmacapinlac/Project3",
"path": "/Project 3/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joshbaptiste/goswatch path: /processRRU.py
import re
import xml.etree.ElementTree as ET
from logwatch import log
from dbwatch import trends
from config import GROUPS
#processRRU.py
# Python based script watches redis queue for Sev3 or lower IR/RRU and RRU adds to GOS FU as soon as hits queue.
#... | code_fim | hard | {
"lang": "python",
"repo": "joshbaptiste/goswatch",
"path": "/processRRU.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def process_not_in_groups(aproach_fields, redis_handler):
cached_status = None
record_num, title, assignee_code, status, target, targetsystems, priority, planned_date, \
planned_time, risk, qatteststatus, frtteststatus, pptteststatus = aproach_fields
# record is being tracked, but assigned... | code_fim | hard | {
"lang": "python",
"repo": "joshbaptiste/goswatch",
"path": "/processRRU.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyfsi/Kratos path: /applications/ShallowWaterApplication/python_scripts/pfem2_primitive_var_solver.py
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# importing the Kratos Library
import KratosMultiphysics as ... | code_fim | hard | {
"lang": "python",
"repo": "pyfsi/Kratos",
"path": "/applications/ShallowWaterApplication/python_scripts/pfem2_primitive_var_solver.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Update particles
self.moveparticles.CalculateDeltaVariables()
self.moveparticles.CorrectParticlesWithoutMovingUsingDeltaVariables()
# Reseed empty elements
post_minimum_number_of_particles = self.main_model_part.ProcessInfo[KM.DOMAIN_SIZE]*2
... | code_fim | hard | {
"lang": "python",
"repo": "pyfsi/Kratos",
"path": "/applications/ShallowWaterApplication/python_scripts/pfem2_primitive_var_solver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> init_op = tf.global_variables_initializer()
trainingError = []
validationError = []
colors = []
epoch = 500
cluster1 = 0;
cluster2 = 0;
cluster3 = 0;
cluster4 = 0;
cluster5 = 0;
distanceMatrix = 0;
with tf.Session() as sess:
sess.run(init_op)
... | code_fim | hard | {
"lang": "python",
"repo": "zibo-wen/intro_to_machine_learning",
"path": "/A3 - Unsupervised Learning and Probabilistic Models/gmm.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zibo-wen/intro_to_machine_learning path: /A3 - Unsupervised Learning and Probabilistic Models/gmm.py
%tensorflow_version 1.x
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import helper as hlp
dataD = 2
# Loading data
if dataD == 100:
data = np.load('data100D.np... | code_fim | hard | {
"lang": "python",
"repo": "zibo-wen/intro_to_machine_learning",
"path": "/A3 - Unsupervised Learning and Probabilistic Models/gmm.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @abstractmethod
def parse(self, node, attrs, args, graph_converter):
'''aten::_linalg_qr_helper(Tensor self, str mode) -> (Tensor, Tensor)'''
pass
class ATenXorSchema(OperatorConverter):
@abstractmethod
def parse(self, node, attrs, args, graph_converter):
'''aten:... | code_fim | hard | {
"lang": "python",
"repo": "WenzheLiu-Speech/TinyNeuralNetwork",
"path": "/tinynn/converter/operators/torch/aten_schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WenzheLiu-Speech/TinyNeuralNetwork path: /tinynn/converter/operators/torch/aten_schema.py
nverter):
'''aten::fake_quantize_per_tensor_affine(Tensor self, float scale, int zero_point, int quant_min, int quant_max) -> (Tensor)'''
pass
class ATenCoalesceSchema(OperatorConverter):
... | code_fim | hard | {
"lang": "python",
"repo": "WenzheLiu-Speech/TinyNeuralNetwork",
"path": "/tinynn/converter/operators/torch/aten_schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WenzheLiu-Speech/TinyNeuralNetwork path: /tinynn/converter/operators/torch/aten_schema.py
)'''
pass
class ATenLeakyReluSchema(OperatorConverter):
@abstractmethod
def parse(self, node, attrs, args, graph_converter):
'''aten::leaky_relu(Tensor self, Scalar negative_slope=0... | code_fim | hard | {
"lang": "python",
"repo": "WenzheLiu-Speech/TinyNeuralNetwork",
"path": "/tinynn/converter/operators/torch/aten_schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aravindsriraj/machine-learning-python-datacamp path: /Machine Learning Scientist with Python Track/5. Extreme Gradient Boosting with XGBoost/ch4_exercises.py
# Exercise_1
# Import LabelEncoder
from sklearn.preprocessing import LabelEncoder
# Fill missing values with 0
df.LotFrontage = df.LotFro... | code_fim | hard | {
"lang": "python",
"repo": "aravindsriraj/machine-learning-python-datacamp",
"path": "/Machine Learning Scientist with Python Track/5. Extreme Gradient Boosting with XGBoost/ch4_exercises.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Apply numeric imputer
numeric_imputation_mapper = DataFrameMapper(
[([numeric_feature], Imputer(strategy="median")) for numeric_feature in non_categorical_columns],
input_df=True,
... | code_fim | hard | {
"lang": "python",
"repo": "aravindsriraj/machine-learning-python-datacamp",
"path": "/Machine Learning Scientist with Python Track/5. Extreme Gradient Boosting with XGBoost/ch4_exercises.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>alphabet = "abcdefghijklmnopqrstuvwxy"
letter_freq = "etaoins"
common_words = ['that', 'this', 'with', 'list', 'have', 'from', 'they', 'when',
'give', 'find', 'must', 'your', 'time', 'what', 'only', 'were',
'more', 'about', 'other', 'first', 'would', 'price',
... | code_fim | hard | {
"lang": "python",
"repo": "sebastianangermund/ciphers",
"path": "/multu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebastianangermund/ciphers path: /multu.py
import multiprocessing as mp
from itertools import permutations
from cipher_list import cipher_list_4lw as cipher_list
def get_sorted_word_frequency(cipher):
hist = {}
for word in cipher.split(' '):
if word in hist.keys():
... | code_fim | hard | {
"lang": "python",
"repo": "sebastianangermund/ciphers",
"path": "/multu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from kofi import rest
from kofi import graphql
def generate_app_routes(conf: T.Dict[T.Text, T.Any]) -> T.List[web.RouteDef]:
"""Generates the app routes using the configuration parameters."""
app_routes = [
web.get("/api/verify", rest.verify),
web.get("/api/interpolate", rest.int... | code_fim | hard | {
"lang": "python",
"repo": "torrefatto/kofi",
"path": "/kofi/routes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: torrefatto/kofi path: /kofi/routes.py
# -*- encoding: utf-8 -*-
"""The routes.
There is a REST API and a GraphQL API.
REST:
``/api/verify`` [GET]
query parameters:
- ``cf``: the Codice Fiscale string
returns:
- ``{"isCorrect": boolean, "isOmocode": boolean, "cf": str}``
``/api/interpolate`... | code_fim | medium | {
"lang": "python",
"repo": "torrefatto/kofi",
"path": "/kofi/routes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#As there is no Waiter class to leverage, just tossing an arbitrary Sleep loop in the code to give the ASG time to refresh the instances
#This is not an absolute guarantee that the instances will be completed with this 5 minute loop, but tests seem to indicate it will have plenty of time
print('Sleeping ... | code_fim | hard | {
"lang": "python",
"repo": "cgmowl/aws-scripts",
"path": "/update_asg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cgmowl/aws-scripts path: /update_asg.py
import boto3, os, time
print("The environment is ", os.environ['ENVIRONMENT'])
if os.environ['ENVIRONMENT'] == 'prod':
import prod as build
elif os.environ['ENVIRONMENT'] == 'nonprod':
import nonprod as build
elif os.environ['ENVIRONMENT'] == 'nonprodfa... | code_fim | hard | {
"lang": "python",
"repo": "cgmowl/aws-scripts",
"path": "/update_asg.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Calling the Start_Instance_Refresh method of AutoScalingGroup. There is no Waiter Class to guarantee when the ASG picks up and performs the refresh :(
response = autoscalingClient.start_instance_refresh(
AutoScalingGroupName=asg,
Strategy='Rolling',
DesiredConfiguration={
'LaunchTem... | code_fim | hard | {
"lang": "python",
"repo": "cgmowl/aws-scripts",
"path": "/update_asg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeeves833/Lost path: /Maze.py
import random
import turtle
class Maze(object):
"""docstring for Maze"""
class Cell(object):
"""docstring for Cell"""
def __init__(self):
self.edges = []
self.visited = False
def link(self, neighbor):
newedge = Maze.Edge(self, neighbor)
self.ed... | code_fim | hard | {
"lang": "python",
"repo": "jeeves833/Lost",
"path": "/Maze.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for x in range(self.size):
for y in range(self.size):
index = x * self.size + y
self.cells.append(Maze.Cell())
if x != 0:
self.cells[index].link(self.cells[index - self.size])
if y != 0:
self.cells[index].link(self.cells[index - 1])
def numberofcells(self):
return len(se... | code_fim | hard | {
"lang": "python",
"repo": "jeeves833/Lost",
"path": "/Maze.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mstrodl/litecord path: /litecord_start.py
#!/usr/bin/env python3
import logging
import asyncio
import json
import sys
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
import aiohttp
from aiohttp import web
import litecord
logging.basicConfig(level=logging.DEBUG, \
for... | code_fim | hard | {
"lang": "python",
"repo": "Mstrodl/litecord",
"path": "/litecord_start.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
loop.run_until_complete(litecord.start_all(app))
server = app.litecord_server
server.compliance()
log.debug('Running servers')
server.http_server = loop.run_until_complete(server.http_server)
server.ws_server = loop.run_until_complete(server.ws_ser... | code_fim | hard | {
"lang": "python",
"repo": "Mstrodl/litecord",
"path": "/litecord_start.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> shush_loggers()
loop = asyncio.get_event_loop()
flags = json.load(open(config_path, 'r'))
app.router.add_get('/', index)
litecord.init_server(app, flags, loop)
try:
loop.run_until_complete(litecord.start_all(app))
server = app.litecord_server
server.compli... | code_fim | hard | {
"lang": "python",
"repo": "Mstrodl/litecord",
"path": "/litecord_start.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for page in page_iterator:
for item in page['Contents']:
print ('deleting: ' + item['Key'] + ' from bucket: ' + bucketname)
s3.Object(bucketname, item['Key']).delete()<|fim_prefix|># repo: jimmyramia/aws_docker_cicd path: /remove_bucket_contents.py
'''
Delete contents of s3 bucket (so... | code_fim | hard | {
"lang": "python",
"repo": "jimmyramia/aws_docker_cicd",
"path": "/remove_bucket_contents.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jimmyramia/aws_docker_cicd path: /remove_bucket_contents.py
'''
Delete contents of s3 bucket (so that delete-stack call will work)
'''
import boto3, sys
if len(sys.argv) == 1:
print ("must pass the bucketname you want to delete contents from")
sys.exit()
else:
bucketname = sys.argv[1... | code_fim | medium | {
"lang": "python",
"repo": "jimmyramia/aws_docker_cicd",
"path": "/remove_bucket_contents.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhu733756/searchengine path: /search.py
import sys
import json
from scrapy import signals
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from searchengine.spiders.bing import BingSpider
from searchengine.spiders.sogou_wx import SogouWxSpider
from ... | code_fim | medium | {
"lang": "python",
"repo": "zhu733756/searchengine",
"path": "/search.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> process = CrawlerProcess(get_project_settings())
process.crawl(spider_class, keywords=keywords,
pagenum=pagenum, sorttype=sorttype)
process.start() # the script will block here until the crawling is finished
return json.dumps(results, ensure_ascii=False).encode('gbk', 'i... | code_fim | hard | {
"lang": "python",
"repo": "zhu733756/searchengine",
"path": "/search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elizabethgarza/nltk-Spanish-diacriticizer path: /src/evaluate.py
#!/usr/bin/env python3
"""Computes the proportions of mellizas and invariantly diacriticized tokens in a corpus."""
import argparse
import itertools
import os
from tqdm import tqdm
import unidecode
import diacriticize
if __nam... | code_fim | hard | {
"lang": "python",
"repo": "elizabethgarza/nltk-Spanish-diacriticizer",
"path": "/src/evaluate.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # computes percentage of invariantly diacriticized tokens that are correctly predicted
## unidecodes (i.e. strips tokens of diacritics) tokens from original toks and appends those tokens to a list
unidec_toks = []
for tok in original_toks:
unidec_tok = unidecode.unidecode(tok)
... | code_fim | hard | {
"lang": "python",
"repo": "elizabethgarza/nltk-Spanish-diacriticizer",
"path": "/src/evaluate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## computes the total number of mellizas that were correctly and incorrectly diacriticized
correct = 0
incorrect = 0
for original_tok, predicted_tok in tqdm(zip(original_toks, predicted_toks)):
if unidecode.unidecode(original_tok) in picks:
if original_tok == predicte... | code_fim | hard | {
"lang": "python",
"repo": "elizabethgarza/nltk-Spanish-diacriticizer",
"path": "/src/evaluate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
key = keyword
kl = list(keyword)
text = "".join(otext.split())
if len(text) != len(keyword):
for i in range(len(text) - len(keyword)):
key = key + kl[i]
kl.append(kl[i])
cipheredtext = ""
letters = ["... | code_fim | hard | {
"lang": "python",
"repo": "prantanir10/Encryption-with-Vigenere-Cipher-and-Caesar-Cipher-with-object-oriented-Programming",
"path": "/PROHEXT2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prantanir10/Encryption-with-Vigenere-Cipher-and-Caesar-Cipher-with-object-oriented-Programming path: /PROHEXT2.py
import pyttsx3
class encryption:
def __init__(self, otext, keyword, number):
self.otext = otext
self.keyword = keyword
self.number=number
def... | code_fim | hard | {
"lang": "python",
"repo": "prantanir10/Encryption-with-Vigenere-Cipher-and-Caesar-Cipher-with-object-oriented-Programming",
"path": "/PROHEXT2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(text)):
cipher = 0
ltpos = 0
lkpos = 0
if text[i].isalpha() == True:
if text[i].islower() == True:
for j in range(len(letters)):
if text[i] == letters[j]:
... | code_fim | hard | {
"lang": "python",
"repo": "prantanir10/Encryption-with-Vigenere-Cipher-and-Caesar-Cipher-with-object-oriented-Programming",
"path": "/PROHEXT2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(Funcionario, ListandoFuncionarios)<|fim_prefix|># repo: ollyvergithub/AppGestaoRHAdvDjangoDjangoRestDjangoForms path: /apps/funcionarios/admin.py
from django.contrib import admin
from .models import Funcionario
class ListandoFuncionarios(admin.ModelAdmin):
<|fim_middle|> list_dis... | code_fim | easy | {
"lang": "python",
"repo": "ollyvergithub/AppGestaoRHAdvDjangoDjangoRestDjangoForms",
"path": "/apps/funcionarios/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ollyvergithub/AppGestaoRHAdvDjangoDjangoRestDjangoForms path: /apps/funcionarios/admin.py
from django.contrib import admin
from .models import Funcionario
<|fim_suffix|>admin.site.register(Funcionario, ListandoFuncionarios)<|fim_middle|>class ListandoFuncionarios(admin.ModelAdmin):
list_dis... | code_fim | medium | {
"lang": "python",
"repo": "ollyvergithub/AppGestaoRHAdvDjangoDjangoRestDjangoForms",
"path": "/apps/funcionarios/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
print("user created")
else:
print("Enter valid username")<|fim_prefix|># repo: mohitagarwal1/summer19coding path: /prob4.py
#!/usr/bin/python3
import os
import crypt
var=input("enter username")
pswd="hello"+var
if var.isalpha():
code=crypt.cr<|fim_middle|>ypt(pswd,"22")
os.system("sud... | code_fim | medium | {
"lang": "python",
"repo": "mohitagarwal1/summer19coding",
"path": "/prob4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohitagarwal1/summer19coding path: /prob4.py
#!/usr/bin/python3
import os
import crypt
var=input("enter user<|fim_suffix|>ypt(pswd,"22")
os.system("sudo useradd -m -p "+code+" "+var)
print("user created")
else:
print("Enter valid username")<|fim_middle|>name")
pswd="hello"+var
if var.isa... | code_fim | medium | {
"lang": "python",
"repo": "mohitagarwal1/summer19coding",
"path": "/prob4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>T_TYPE_TCU_DEFENSE = 1
EVENT_TYPE_IHUB_DEFENSE = 2
EVENT_TYPE_STATION_DEFENSE = 3
EVENT_TYPE_STATION_FREEPORT = 4
STRUCTURE_SCORE_UPDATED = 0
STRUCTURES_UPDATED = 1
CHANGE_PRIMETIME_DELAY = 48 * HOUR<|fim_prefix|># repo: connoryang/dec-eve-serenity path: /client/entosis/entosisConst.py
#Embedded fi... | code_fim | hard | {
"lang": "python",
"repo": "connoryang/dec-eve-serenity",
"path": "/client/entosis/entosisConst.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: connoryang/dec-eve-serenity path: /client/entosis/entosisConst.py
#Embedded file name: e:\jenkins\workspace\client_SERENITY\branches\release\SERENITY\packages\entosis\entosisConst.py
from carbon.common.lib.const import HOUR
EVENT_TYPE_TCU_DEFENSE = 1
EVENT_TYPE_IHUB_<|fim_suffix|>NAMES_BY_TYPE... | code_fim | hard | {
"lang": "python",
"repo": "connoryang/dec-eve-serenity",
"path": "/client/entosis/entosisConst.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
input = sys.stdin.readline().strip()
if input == "repl":
led_ctrl.stop()
imac_ctrl.stop()
return
try:
brightness = int(input) / 100
led_ctrl.set_brightness(brightness)
imac_ctrl.set_brightness(b... | code_fim | medium | {
"lang": "python",
"repo": "NaanProphet/imac-esp32-pwm-brightness",
"path": "/micropy/src/shell.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.