text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: containers-kraken/heat path: /contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py
Mock(rsrc.clb, 'get')
rsrc.clb.get(mox.IgnoreArg()).MultipleTimes().AndReturn(
fake_lb)
self.m.StubOutWithMock(fake_lb, 'get_ssl_termination')
fake_lb.get_ssl_terminatio... | code_fim | hard | {
"lang": "python",
"repo": "containers-kraken/heat",
"path": "/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> template = copy.deepcopy(self.lb_template)
lb_name = list(six.iterkeys(template['Resources']))[0]
template['Resources'][lb_name]['Properties'][
'sessionPersistence'] = "SOURCE_IP"
expected_body = copy.deepcopy(self.expected_body)
expected_body['sessionPe... | code_fim | hard | {
"lang": "python",
"repo": "containers-kraken/heat",
"path": "/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: containers-kraken/heat path: /contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py
'type': 'DENY'}]
template = self._set_template(self.lb_template,
accessList=access_list)
rsrc, fake_lb = self._mock_loadbalancer(te... | code_fim | hard | {
"lang": "python",
"repo": "containers-kraken/heat",
"path": "/contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
renderer_classes = (JSONPRenderer,)
@staticmethod
def get(request):
try:
first_number = int(request.GET.get('a'))
second_number = int(request.GET.get('b'))
return Response({'result': first_number / second_number})
except Exception as e:
... | code_fim | hard | {
"lang": "python",
"repo": "vitohuanqui/calculator_django",
"path": "/calculator/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vitohuanqui/calculator_django path: /calculator/views.py
from django.http import HttpResponseRedirect
from django.shortcuts import render
__author__ = 'jhonjairoroa87'
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework_jsonp.renderers impor... | code_fim | medium | {
"lang": "python",
"repo": "vitohuanqui/calculator_django",
"path": "/calculator/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render(request, 'name.html', {'form': form})
@staticmethod
def post(request):
form = NameForm(request.POST)
if form.is_valid():
a = form.cleaned_data['one']
b = form.cleaned_data['second']
data = multiply(a, b)
return ... | code_fim | medium | {
"lang": "python",
"repo": "vitohuanqui/calculator_django",
"path": "/calculator/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#mod_lasso = Lasso()
#mod_lasso.fit(X_train, y_train)
#print(mod_lasso.coef_)
from joblib import dump, load
mod_lasso = load('mod_lasso.joblib')
X_test = test_lasso()
y_pred = mod_lasso.predict(X_test)
print(X_test.head())
sub = pd.DataFrame(np.maximum(0,y_pred), index = X_test.index, columns = ['met... | code_fim | hard | {
"lang": "python",
"repo": "brunocgf/ASHRAE-GreatEnergyPredictorIII",
"path": "/lasso2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brunocgf/ASHRAE-GreatEnergyPredictorIII path: /lasso2.py
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GroupKFold
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_log_error
... | code_fim | hard | {
"lang": "python",
"repo": "brunocgf/ASHRAE-GreatEnergyPredictorIII",
"path": "/lasso2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Eliminate problematic variables
test.drop(['timestamp','year_built','floor_count','cloud_coverage','site_id','primary_use','wind_direction','square_feet','dew_temperature','sea_level_pressure','wind_speed','precip_depth_1_hr'], inplace=True, axis = 1)
# Imputation
test = test.interpolate... | code_fim | hard | {
"lang": "python",
"repo": "brunocgf/ASHRAE-GreatEnergyPredictorIII",
"path": "/lasso2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: icorrs/python_learning path: /boq_code_unique.py
#公路工程工程量清单编码默认格式母节点为数字型式,子节点为-b字母形式,为使编码唯一便于数据处理,编制此脚本
import re
import pandas as pd
import os
def get_csv_path():#原编码保存为csv文件的一列,便于读取
<|fim_suffix|> path=get_csv_path()
path_dir=os.path.dirname(path)
frame1=pd.read_csv(path,encoding='ut... | code_fim | medium | {
"lang": "python",
"repo": "icorrs/python_learning",
"path": "/boq_code_unique.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> path=get_csv_path()
path_dir=os.path.dirname(path)
frame1=pd.read_csv(path,encoding='utf-8')
list1=list(frame1.iloc[:,0])
pat1=re.compile(r'\d+-\d+')#数字打头的母节点匹配符
pat2=re.compile(r'-\D{1}-\d+')#二级子节点,即-字母-数字形式匹配符
list2=[]
i=100
for code in list1:
if code=='':
... | code_fim | medium | {
"lang": "python",
"repo": "icorrs/python_learning",
"path": "/boq_code_unique.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # write your code here
if not root:
return 0
return max(self.maximum(root.left),self.maximum(root.right))+1<|fim_prefix|># repo: TMAC135/Pracrice path: /maximum_depth_of_binary_tree.py
# coding=utf-8
"""
Given a binary tree, find its maximum depth.
The maximum depth is t... | code_fim | medium | {
"lang": "python",
"repo": "TMAC135/Pracrice",
"path": "/maximum_depth_of_binary_tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TMAC135/Pracrice path: /maximum_depth_of_binary_tree.py
# coding=utf-8
"""
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example
Given a binary tree as follow:
1
/ \
2 3
/... | code_fim | hard | {
"lang": "python",
"repo": "TMAC135/Pracrice",
"path": "/maximum_depth_of_binary_tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_or_create_persisted_build(
project: Project, config: appconnect.AppStoreConnectConfig, build: appconnect.BuildInfo
) -> AppConnectBuild:
"""Fetches the sentry-internal :class:`AppConnectBuild`.
The build corresponds to the :class:`appconnect.BuildInfo` as returned by the
AppStore ... | code_fim | hard | {
"lang": "python",
"repo": "nagyist/sentry",
"path": "/src/sentry/tasks/app_store_connect.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nagyist/sentry path: /src/sentry/tasks/app_store_connect.py
"""Tasks for managing Debug Information Files from Apple App Store Connect.
Users can instruct Sentry to download dSYM from App Store Connect and put them into Sentry's
debug files. These tasks enable this functionality.
"""
import lo... | code_fim | hard | {
"lang": "python",
"repo": "nagyist/sentry",
"path": "/src/sentry/tasks/app_store_connect.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eharkins/cft path: /bin/raxml.py
#!/usr/bin/python
import argparse
import contextlib
import os.path
import shutil
import subprocess
import sys
import tempfile
from Bio import SeqIO
BOOTSTRAP_MODES = 'a',
# Some utilities
@contextlib.contextmanager
def sequences_in_format(sequences, fmt='fasta... | code_fim | hard | {
"lang": "python",
"repo": "eharkins/cft",
"path": "/bin/raxml.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> stdout = stderr = None
if quiet:
stdout = stderr = open(os.path.devnull)
cmd = map(str, cmd)
print >> sys.stderr, "Running:", ' '.join(cmd)
try:
subprocess.check_call(cmd, stdout=stdout, stderr=stderr, cwd=td)
... | code_fim | hard | {
"lang": "python",
"repo": "eharkins/cft",
"path": "/bin/raxml.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args()
if not args.executable:
args.executable = ('raxmlHPC-PTHREADS-SSE3' if args.threads else
'raxmlHPC-SSE3')
with args.alignment_file as fp:
sequences = SeqIO.parse(fp, args.input_format)
raxml(sequences, args.output_tree, execut... | code_fim | hard | {
"lang": "python",
"repo": "eharkins/cft",
"path": "/bin/raxml.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class PostFollower(MBase):
post_id = columns.TimeUUID(primary_key=True)
user_id = columns.Integer(primary_key=True)
class ChannelFollower(MBase):
channel_id = columns.Integer(primary_key=True)
user_id = columns.Integer(primary_key=True)
class ChannelTimeLine(MBase):
channel_id = c... | code_fim | hard | {
"lang": "python",
"repo": "python-hackers/pythonhackers",
"path": "/pyhackers/model/cassandra/hierachy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Projects that user follows
"""
user_id = columns.Integer(primary_key=True)
project_id = columns.Integer(primary_key=True)
class UserPost(MBase):
"""
All the POSTs of a user
"""
user_id = columns.Integer(primary_key=True)
post_id = columns.BigInt(primary_key=Tr... | code_fim | hard | {
"lang": "python",
"repo": "python-hackers/pythonhackers",
"path": "/pyhackers/model/cassandra/hierachy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-hackers/pythonhackers path: /pyhackers/model/cassandra/hierachy.py
import uuid
from cqlengine import columns
from cqlengine.models import Model
from datetime import datetime as dt
class MBase(Model):
__abstract__ = True
#__keyspace__ = model_keyspace
class Post(MBase):
id =... | code_fim | hard | {
"lang": "python",
"repo": "python-hackers/pythonhackers",
"path": "/pyhackers/model/cassandra/hierachy.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: icemac/icemac.install.addressbook path: /src/icemac/install/addressbook/install/update.py
from .. import CURRENT_NAME
from ..cmd import call_cmd
from .config import Configurator
from .config import USER_INI
from icemac.install.addressbook._compat import Path
import argparse
import os
import pdb ... | code_fim | hard | {
"lang": "python",
"repo": "icemac/icemac.install.addressbook",
"path": "/src/icemac/install/addressbook/install/update.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Entry point for `bin/change-addressbook-config`."""
parser = argparse.ArgumentParser(
description='Update the current address book installation.')
parser.add_argument(
'--debug', action="store_true",
help='Enter debugger on errors.')
args = parser.parse_args(arg... | code_fim | medium | {
"lang": "python",
"repo": "icemac/icemac.install.addressbook",
"path": "/src/icemac/install/addressbook/install/update.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: toohong5/algorithm path: /ad보충/03_백트래킹/retire.py
import sys
sys.stdin = open('retire.txt', 'r')
def counseling(pay, row):
<|fim_suffix|>N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
# visit = [0] * N
max_sum = 0
counseling(0, 0)
print(max_sum)<|fim_middle|> global... | code_fim | hard | {
"lang": "python",
"repo": "toohong5/algorithm",
"path": "/ad보충/03_백트래킹/retire.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
# visit = [0] * N
max_sum = 0
counseling(0, 0)
print(max_sum)<|fim_prefix|># repo: toohong5/algorithm path: /ad보충/03_백트래킹/retire.py
import sys
sys.stdin = open('retire.txt', 'r')
def counseling(pay, row):
<|fim_middle|> global... | code_fim | hard | {
"lang": "python",
"repo": "toohong5/algorithm",
"path": "/ad보충/03_백트래킹/retire.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ht1an/LAMOST_SSS path: /util/aitoff_projection.py
# aitoff projection
# see:
# https://en.wikipedia.org/wiki/Aitoff_projection
def aitoff_projec<|fim_suffix|>_phi * np.sin(theta/2) / denom
x = x + 180
y = 90 * np.sin(phi) / denom
return x,y<|fim_middle|>tion(theta, phi):
import nu... | code_fim | medium | {
"lang": "python",
"repo": "ht1an/LAMOST_SSS",
"path": "/util/aitoff_projection.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>_phi * np.sin(theta/2) / denom
x = x + 180
y = 90 * np.sin(phi) / denom
return x,y<|fim_prefix|># repo: ht1an/LAMOST_SSS path: /util/aitoff_projection.py
# aitoff projection
# see:
# https://en.wikipedia.org/wiki/Aitoff_projection
def aitoff_projec<|fim_middle|>tion(theta, phi):
import nu... | code_fim | medium | {
"lang": "python",
"repo": "ht1an/LAMOST_SSS",
"path": "/util/aitoff_projection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HCLY126/OpensourceHomework path: /schedule.py
# # -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
import urllib
import urllib2
import cookielib
from excel import *
from user import *
L<|fim_suffix|>l = 'http://zhjw.dlut.edu.cn/loginAction.do'
result = opener.open(lo... | code_fim | medium | {
"lang": "python",
"repo": "HCLY126/OpensourceHomework",
"path": "/schedule.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>adeUrl)
html = etree.HTML(result.read().decode('gbk'))
schedule = html.xpath('//td[@class="pageAlign"]/table[@border="1"]')
write_schedule(cut(get_son(schedule[0],List)))<|fim_prefix|># repo: HCLY126/OpensourceHomework path: /schedule.py
# # -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencod... | code_fim | hard | {
"lang": "python",
"repo": "HCLY126/OpensourceHomework",
"path": "/schedule.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return json.loads(my_str)<|fim_prefix|># repo: dgquintero/holbertonschool-higher_level_programming path: /0x0B-python-input_output/6-from_json_string.py
#!/usr/bin/python3
import json
def from_json_string(my_str):
<|fim_middle|> """Function returns a JSON file representation of an object (string... | code_fim | medium | {
"lang": "python",
"repo": "dgquintero/holbertonschool-higher_level_programming",
"path": "/0x0B-python-input_output/6-from_json_string.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgquintero/holbertonschool-higher_level_programming path: /0x0B-python-input_output/6-from_json_string.py
#!/usr/bin/python3
import json
<|fim_suffix|> return json.loads(my_str)<|fim_middle|>def from_json_string(my_str):
"""Function returns a JSON file representation of an object (string... | code_fim | medium | {
"lang": "python",
"repo": "dgquintero/holbertonschool-higher_level_programming",
"path": "/0x0B-python-input_output/6-from_json_string.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>url = "http://www.pythonscraping.com/pages/page3.html"
html = urlopen(url)
html_data = BeautifulSoup(html.read(), "lxml")
img_list = html_data.find_all("img", {"src": re.compile("\.\./img*\.jpg")})
for img in img_list:
print(img["src"])<|fim_prefix|># repo: SyedMiraj/DSFromScratch path: /WebScrappin... | code_fim | medium | {
"lang": "python",
"repo": "SyedMiraj/DSFromScratch",
"path": "/WebScrapping/TotallyNormalGifts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SyedMiraj/DSFromScratch path: /WebScrapping/TotallyNormalGifts.py
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 5 09:10:03 2018
<|fim_suffix|>url = "http://www.pythonscraping.com/pages/page3.html"
html = urlopen(url)
html_data = BeautifulSoup(html.read(), "lxml")
img_list = html_data.find_all(... | code_fim | medium | {
"lang": "python",
"repo": "SyedMiraj/DSFromScratch",
"path": "/WebScrapping/TotallyNormalGifts.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup
import re
url = "http://www.pythonscraping.com/pages/page3.html"
html = urlopen(url)
html_data = BeautifulSoup(html.read(), "lxml")
img_list = html_data.find_all("img", {"src": re.compile("\.\./img*\.jpg")... | code_fim | easy | {
"lang": "python",
"repo": "SyedMiraj/DSFromScratch",
"path": "/WebScrapping/TotallyNormalGifts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>total = 0
max = 4000000
for k in range(2, max):
x = fib(k)
if x > max:
break
if x % 2 == 0:
total += x
print total<|fim_prefix|># repo: muratgu/project-euler path: /p2.py
'''
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
By starting wi... | code_fim | hard | {
"lang": "python",
"repo": "muratgu/project-euler",
"path": "/p2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muratgu/project-euler path: /p2.py
'''
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
<|fim_suffix|> '''
Binet's formula for nth Fibonacci number
http... | code_fim | medium | {
"lang": "python",
"repo": "muratgu/project-euler",
"path": "/p2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Binet's formula for nth Fibonacci number
http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.html
((1+sqrt(5))**n-(1-sqrt(5))**n)/(2**n*sqrt(5))
'''
return int(0.4472135954999579392818347337462552470881236719223051448541*
(pow(1.61803398874989484820458683436563811... | code_fim | medium | {
"lang": "python",
"repo": "muratgu/project-euler",
"path": "/p2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitmedialab/Terra-Incognita path: /www/process_preinstall_history.py
# This script runs nightly to process users' preinstall history
# no it doesn't, you liar
from bson.objectid import ObjectId
import ConfigParser
import os
from text_processing.textprocessing import start_text_processing_queue
fr... | code_fim | hard | {
"lang": "python",
"repo": "mitmedialab/Terra-Incognita",
"path": "/www/process_preinstall_history.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#find users who have preinstall history
users = db_user_collection.find({ "history-pre-installation": {"$exists":1}, "history-pre-installation-processed": {"$exists":0} }, {"history-pre-installation":1, "_id":1, "username":1})
for user in users:
print "Processing browser history for " + user["username"]... | code_fim | hard | {
"lang": "python",
"repo": "mitmedialab/Terra-Incognita",
"path": "/www/process_preinstall_history.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for myfile in files:
if myfile[-4:] != 'xlsx':
continue
tg_xlsx = load_workbook(os.path.join(path, myfile), read_only=True)
tg_sheet = tg_xlsx.active
for row in tg_sheet.iter_rows():
row_data = []
for cell in row:
row_data.append(cell.value)
r... | code_fim | hard | {
"lang": "python",
"repo": "bhy304/python",
"path": "/examples/auto_excel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhy304/python path: /examples/auto_excel.py
import os
from os import listdir
from openpyxl import load_workbook, Workbook
<|fim_suffix|> for row in tg_sheet.iter_rows():
row_data = []
for cell in row:
row_data.append(cell.value)
result_sheet.append(row_dat... | code_fim | hard | {
"lang": "python",
"repo": "bhy304/python",
"path": "/examples/auto_excel.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> tg_xlsx = load_workbook(os.path.join(path, myfile), read_only=True)
tg_sheet = tg_xlsx.active
for row in tg_sheet.iter_rows():
row_data = []
for cell in row:
row_data.append(cell.value)
result_sheet.append(row_data)
result_xlsx.save(f'{CUR_PATH}/result.xl... | code_fim | medium | {
"lang": "python",
"repo": "bhy304/python",
"path": "/examples/auto_excel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5l1v3r1/sshsploit path: /sshsploit.py
#!/usr/bin/env python3
# ---------------------------------------------------
# SSHSploit Framework
# ---------------------------------------------------
# Copyright (C) <2020> ... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/sshsploit",
"path": "/sshsploit.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
ui = input('\033[4msshsploit\033[0m> ').strip(" ")
ui = ui.split()
while True:
if ui == []:
pass
elif ui[0] == "exit":
sys.exit()
elif ui[0] == "clear":
os.system("clear")
elif ui[0] == "update":
os.sys... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/sshsploit",
"path": "/sshsploit.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thqbop/kitchenrock path: /src/kitchenrock_api/models/food_category.py
from django.db import models
<|fim_suffix|> db_table = 'kitchenrock_category'
def __str__(self):
return self.name<|fim_middle|>class FoodCategory(models.Model):
id = models.AutoField(primary_key=True)
... | code_fim | medium | {
"lang": "python",
"repo": "thqbop/kitchenrock",
"path": "/src/kitchenrock_api/models/food_category.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return self.name<|fim_prefix|># repo: thqbop/kitchenrock path: /src/kitchenrock_api/models/food_category.py
from django.db import models
class FoodCategory(models.Model):
<|fim_middle|> id = models.AutoField(primary_key=True)
name = models.CharField(max_length=200,... | code_fim | medium | {
"lang": "python",
"repo": "thqbop/kitchenrock",
"path": "/src/kitchenrock_api/models/food_category.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dsnowb/neuralknight path: /neuralknight/models/board.py
"""
Chess state handling model.
"""
from concurrent.futures import ThreadPoolExecutor
from itertools import count
from json import dumps
from .base_board import BaseBoard, NoBoard
from .table_board import TableBoard
from .table_game import... | code_fim | hard | {
"lang": "python",
"repo": "dsnowb/neuralknight",
"path": "/neuralknight/models/board.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def slice_cursor_v1(self, cursor=None, lookahead=1, complete=False):
"""
Retrieve REST cursor slice.
"""
return self.cursor_delegate.slice_cursor_v1(self._board, cursor, int(lookahead), complete)
def update_state_v1(self, dbsession, state):
"""
Make... | code_fim | hard | {
"lang": "python",
"repo": "dsnowb/neuralknight",
"path": "/neuralknight/models/board.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """缩放点积注意力"""
def __init__(self, dropout, **kwargs):
super(DotProductAttention, self).__init__(**kwargs)
self.dropout = nn.Dropout(dropout)
# queries的形状:(batch_size,查询的个数,d)
# keys的形状:(batch_size,“键-值”对的个数,d)
# values的形状:(batch_size,“键-值”对的个数,值的维度)
# valid_lens的形状:... | code_fim | hard | {
"lang": "python",
"repo": "zuopieziyue/learn",
"path": "/pytorch/DongShouXue/attention/attention.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zuopieziyue/learn path: /pytorch/DongShouXue/attention/attention.py
import math
import torch
from torch import nn
from d2l import torch as d2l
def masked_softmax(X, valid_lens):
"""通过在最后一个轴上掩蔽元素来执行softmax操作"""
# X:3D张量,valid_lens:1D或2D张量
if valid_lens is None:
return nn.func... | code_fim | hard | {
"lang": "python",
"repo": "zuopieziyue/learn",
"path": "/pytorch/DongShouXue/attention/attention.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> d = queries.shape[-1]
# 设置transpose_b=True为了交换的keys的最后两个维度
scores = torch.bmm(queries, keys.transpose(1, 2)) / math.sqrt(d)
self.attention_weights = masked_softmax(scores, valid_lens)
return torch.bmm(self.dropout(self.attention_weights), values)
"""缩放点积注意力函数测试"""... | code_fim | hard | {
"lang": "python",
"repo": "zuopieziyue/learn",
"path": "/pytorch/DongShouXue/attention/attention.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsillin/plotting path: /gfs_hrly_h5.py
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import numpy as np
import matplotlib.pyplot as plt
import netCDF4
import xarray as xr
import metpy
from datetime import datetime
import datetime as dt
from metpy.units import units
impor... | code_fim | hard | {
"lang": "python",
"repo": "jsillin/plotting",
"path": "/gfs_hrly_h5.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> vertical, = data['temp'].metpy.coordinates('vertical')
time = data['temp'].metpy.time
zH5_crs = data['temp'].metpy.cartopy_crs
t5 = data['temp'].sel(lev=500.0,lat=lats,lon=lons)
u5 = data['u'].sel(lev=500.0,lat=lats,lon=lons).squeeze()*1.94384449
v5 = data['v'].sel(lev=500.0... | code_fim | hard | {
"lang": "python",
"repo": "jsillin/plotting",
"path": "/gfs_hrly_h5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #h_contour = ax1.contour(x, y, mslpc, colors='dimgray', levels=range(940,1040,4),linewidths=2)
#h_contour.clabel(fontsize=14, colors='dimgray', inline=1, inline_spacing=4, fmt='%i mb', rightside_up=True, use_clabeltext=True)
ax3.set_title('500mb Heights (m) and Absolute Vorticity ($s^{-1}$)'... | code_fim | hard | {
"lang": "python",
"repo": "jsillin/plotting",
"path": "/gfs_hrly_h5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: unicornis/pydsf path: /tests/test_service.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from unittest import TestCase
from pydsf.exceptions import DSFServiceError
from pydsf.service.response import parse_response
from pydsf.service.translations import translat... | code_fim | hard | {
"lang": "python",
"repo": "unicornis/pydsf",
"path": "/tests/test_service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_error_response(self):
pass
def tets_empty_response(self):
pass
def test_result(self):
pass
class ResponseTests(TestCase):
def test_has_result(self):
result = MockResponseOK()
parsed = parse_response((200, result))
self.assertEq... | code_fim | hard | {
"lang": "python",
"repo": "unicornis/pydsf",
"path": "/tests/test_service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def trace_cls(method):
def _trace_cls(cls):
# Get the original implementation
orig_getattribute = cls.__getattribute__
# Make a new definition
def new_getattribute(self, name):
if name in cls.__dict__:
f = getattr(cls, name)
arg... | code_fim | hard | {
"lang": "python",
"repo": "Qingluan/Mroylib-min",
"path": "/qlib/io/tracepoint.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if name in cls.__dict__:
f = getattr(cls, name)
args = "(%s)" % ', '.join(f.__code__.co_varnames)
t = str(time.time())
if "http://" in method:
requests.post("http://localhost:12222/", data={
... | code_fim | hard | {
"lang": "python",
"repo": "Qingluan/Mroylib-min",
"path": "/qlib/io/tracepoint.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Qingluan/Mroylib-min path: /qlib/io/tracepoint.py
import functools
import requests
import time
import argparse
class TracePoint:
classes = []
funcs = []
flow = []
@staticmethod
def clear():
TracePoint.classes = []
TracePoint.funcs = []
TracePoint.flo... | code_fim | hard | {
"lang": "python",
"repo": "Qingluan/Mroylib-min",
"path": "/qlib/io/tracepoint.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, logit, target):
target = target.float()
max_val = (-logit).clamp(min=0)
loss = logit - logit * target + max_val + ((-max_val).exp() + (-logit - max_val).exp()).log()
invprobs = F.logsigmoid(-logit * (target * 2.0 - 1.0))
loss = (invprobs * self... | code_fim | hard | {
"lang": "python",
"repo": "AutuanLiu/PyTorch-ML",
"path": "/CNN/FocalLoss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AutuanLiu/PyTorch-ML path: /CNN/FocalLoss.py
import torch
import torch.nn as nn
from torch.nn import functional as F
class FocalLoss1(nn.Module):
def __init__(self, alpha=0.25, gamma=2, reduction='mean', ignore_lb=255):
super().__init__()
self.alpha = alpha
self.gamm... | code_fim | hard | {
"lang": "python",
"repo": "AutuanLiu/PyTorch-ML",
"path": "/CNN/FocalLoss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: colincadams/attendance path: /test/test_member.py
from unittest import TestCase
from attendance import Member
<|fim_suffix|> def test_here(self):
member = Member("John", "Doe")
self.assertFalse(member.attended)
member.here()
self.assertTrue(member.attended)<|fi... | code_fim | easy | {
"lang": "python",
"repo": "colincadams/attendance",
"path": "/test/test_member.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> member = Member("John", "Doe")
self.assertFalse(member.attended)
member.here()
self.assertTrue(member.attended)<|fim_prefix|># repo: colincadams/attendance path: /test/test_member.py
from unittest import TestCase
from attendance import Member
__author__ = 'colin'
class ... | code_fim | easy | {
"lang": "python",
"repo": "colincadams/attendance",
"path": "/test/test_member.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>word = "".join(secrets.choice(alphabets) for i in range(10))
if(any(c.islower() for c in password) and
any(c.isupper() for c in password) and
sum(c.isdigit() for c in password) >= 3):
print(password)
break<|fim_prefix|># repo: VishwanathOnGit/Python-Projects p... | code_fim | medium | {
"lang": "python",
"repo": "VishwanathOnGit/Python-Projects",
"path": "/py_password/hard_password.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VishwanathOnGit/Python-Projects path: /py_password/hard_password.py
'''
Generate a ten-character alphanumeric password with at least one lowercase,
at least one uppercase character, and at least three digits
'''
import secrets
import string
alphabets = string.ascii_letters + string.digits
... | code_fim | medium | {
"lang": "python",
"repo": "VishwanathOnGit/Python-Projects",
"path": "/py_password/hard_password.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> albums = []
urls = [{'url': url} for url in albums_url]
threads = MultiRequest(urls=urls, name=url).run()
for thread in threads:
try:
album = self.album2photos(thread.url, thread.response)
if album is not None:
... | code_fim | hard | {
"lang": "python",
"repo": "ledudu/photo-dl",
"path": "/photo_dl/parsers/jav_ink.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def url2albums(self, url):
albums_url = []
if '/category/' in url or '/?s=' in url:
albums_url.extend(self.category2albums(url))
else:
albums_url.append(url)
albums = []
urls = [{'url': url} for url in albums_url]
threads = Multi... | code_fim | hard | {
"lang": "python",
"repo": "ledudu/photo-dl",
"path": "/photo_dl/parsers/jav_ink.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ledudu/photo-dl path: /photo_dl/parsers/jav_ink.py
import sys
from photo_dl.request import request
from photo_dl.request import MultiRequest
class Jav_ink:
def __init__(self):
self.parser_name = 'jav_ink'
self.domain = 'https://www.jav.ink'
self.album_flag = {}
... | code_fim | hard | {
"lang": "python",
"repo": "ledudu/photo-dl",
"path": "/photo_dl/parsers/jav_ink.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "Simulation will start when the time is 0, 25, 50 ,75"
to = 0
while 1:
toot = int(time.time())%100
if to == toot - 1:
print toot
to = toot
# print to
if to == 0 or to == 25 or to == 50 or to == 75:
break
a = anim.FuncAnimation(fig, update, frames=int(SIM_TIME/SIM... | code_fim | hard | {
"lang": "python",
"repo": "galileoye/ics-attack-detection",
"path": "/src/isa/ADS_PCA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def update(i):
#Read registers from the specific zone
l1 = float(opc1_client.read_holding_registers(L1, 1).registers[0])
l2 = float(opc2_client.read_holding_registers(L2, 1).registers[0])
t1 = float(opc1_client.read_holding_registers(T1, 1).registers[0])
t2 = float(opc2_client.read_hol... | code_fim | medium | {
"lang": "python",
"repo": "galileoye/ics-attack-detection",
"path": "/src/isa/ADS_PCA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: galileoye/ics-attack-detection path: /src/isa/ADS_PCA.py
#!/usr/bin/python
#MTU Server
from config import *
from pymodbus.client.sync import ModbusTcpClient
import time
import numpy as np
import logging
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import matplotlib.animat... | code_fim | hard | {
"lang": "python",
"repo": "galileoye/ics-attack-detection",
"path": "/src/isa/ADS_PCA.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_listen(self):
# TODO: Figure out how to mock this
pass
def test_recognise_command(self):
# TODO: Figure out how to mock this
pass<|fim_prefix|># repo: hacklabza/arnold path: /arnold/sensors/tests/test_microphone.py
from arnold import config
class TestMi... | code_fim | hard | {
"lang": "python",
"repo": "hacklabza/arnold",
"path": "/arnold/sensors/tests/test_microphone.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_recognise_command(self):
# TODO: Figure out how to mock this
pass<|fim_prefix|># repo: hacklabza/arnold path: /arnold/sensors/tests/test_microphone.py
from arnold import config
class TestMicrophone:
def setup_method(self, method):
self.config = config.SENSOR['m... | code_fim | medium | {
"lang": "python",
"repo": "hacklabza/arnold",
"path": "/arnold/sensors/tests/test_microphone.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hacklabza/arnold path: /arnold/sensors/tests/test_microphone.py
from arnold import config
class TestMicrophone:
def setup_method(self, method):
<|fim_suffix|> def test_recognise_command(self):
# TODO: Figure out how to mock this
pass<|fim_middle|> self.config = co... | code_fim | hard | {
"lang": "python",
"repo": "hacklabza/arnold",
"path": "/arnold/sensors/tests/test_microphone.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>:
plus = False
if plus:
# handle the case where we need one more digit
return [1] + digits
return digits<|fim_prefix|># repo: RuijieZ/leetcode path: /add_one/addOne.py
class Solution(object):
def plusOne(self, digits):
"""
:t... | code_fim | hard | {
"lang": "python",
"repo": "RuijieZ/leetcode",
"path": "/add_one/addOne.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RuijieZ/leetcode path: /add_one/addOne.py
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
plus = True # In the last digit, we should add one as the quesiton requries
indexList = range(len(digi... | code_fim | hard | {
"lang": "python",
"repo": "RuijieZ/leetcode",
"path": "/add_one/addOne.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pwnmeow/Basic-Python-Exercise-Files path: /basics/ifel.py
print(" whats your name boi ?")
name = input();
if name == "arrya":<|fim_suffix|>ob":
print("the king in the north")
else:
print("carry on")<|fim_middle|>
print("u are a boi");
elif name == "jon":
print("basterd")
... | code_fim | medium | {
"lang": "python",
"repo": "pwnmeow/Basic-Python-Exercise-Files",
"path": "/basics/ifel.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ob":
print("the king in the north")
else:
print("carry on")<|fim_prefix|># repo: pwnmeow/Basic-Python-Exercise-Files path: /basics/ifel.py
print(" whats your name boi ?")
name = input();
if name == "arrya":<|fim_middle|>
print("u are a boi");
elif name == "jon":
print("basterd")
... | code_fim | medium | {
"lang": "python",
"repo": "pwnmeow/Basic-Python-Exercise-Files",
"path": "/basics/ifel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nhomka/Chemical_Plant path: /ChemConstants.py
from FluidStream import *
# List of chemicals and their constant properties
CHEMICALS_KEY_GUIDE = ['MW' , 'Density']
CHEMICALS = {
'Bacteria' : ['NA' , 1.05 ],
'Calcium Carbonate' : [100.087 , 2.71 ],
'Calcium Lactate' : [218.22 , 1.494 ... | code_fim | hard | {
"lang": "python",
"repo": "nhomka/Chemical_Plant",
"path": "/ChemConstants.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>FERMENT_IN = {
'Bacteria Concentration' : C_BACT_INIT,
'Glucose Concentration' : C_GLUC_INIT,
'Lactic Acid Concentration' : C_LA_INIT,
'Tween 80 Concentration' : C_TWEEN_INIT
}
# HOLDING TANK SPECS
# Initial Fermentation Water Charge in Liters
FERMENT_WATER_VOL = 750000
# Number of Fermentation Vessels
... | code_fim | hard | {
"lang": "python",
"repo": "nhomka/Chemical_Plant",
"path": "/ChemConstants.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('trades', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='orderinfo',
name='nonce_str',
field=models.CharField(blank=True, max_length=50, null=True, unique=True, verbose_name='随机加密串'),
),
]<|f... | code_fim | easy | {
"lang": "python",
"repo": "xinsixiangyi/online",
"path": "/NewBegin/apps/trades/migrations/0002_orderinfo_nonce_str.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xinsixiangyi/online path: /NewBegin/apps/trades/migrations/0002_orderinfo_nonce_str.py
# Generated by Django 2.2.16 on 2020-10-27 14:55
<|fim_suffix|> operations = [
migrations.AddField(
model_name='orderinfo',
name='nonce_str',
field=models.CharFie... | code_fim | medium | {
"lang": "python",
"repo": "xinsixiangyi/online",
"path": "/NewBegin/apps/trades/migrations/0002_orderinfo_nonce_str.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='orderinfo',
name='nonce_str',
field=models.CharField(blank=True, max_length=50, null=True, unique=True, verbose_name='随机加密串'),
),
]<|fim_prefix|># repo: xinsixiangyi/online path: /NewBegin/apps/tra... | code_fim | medium | {
"lang": "python",
"repo": "xinsixiangyi/online",
"path": "/NewBegin/apps/trades/migrations/0002_orderinfo_nonce_str.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 加载模板文件
temp = loader.get_template('static_index.html')
# 定义模板上下文
# 模板渲染
statoc_index_html = temp.render(context)
save_path = os.path.join(settings.BASE_DIR, 'static/static_index/index.html')
with open(save_path,'w',encoding='utf-8') as f:
f.write(statoc_index_html)<|... | code_fim | hard | {
"lang": "python",
"repo": "Handahe/dailyfresh",
"path": "/celery_tasks/tasks.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Handahe/dailyfresh path: /celery_tasks/tasks.py
# 使用celery
from django.conf import settings
from django.core.mail import send_mail
from django.template import loader,RequestContext
from celery import Celery
import time
# 在任务处理者一
#
# 端加的代码
import os
import django
os.environ.setdefault("DJANGO_SETT... | code_fim | hard | {
"lang": "python",
"repo": "Handahe/dailyfresh",
"path": "/celery_tasks/tasks.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Anova07/Data-Science path: /MachineLearning/Reinforcement/ReinforcementLearner.py
import sklearn.metrics as metrics
import sklearn.cross_validation as cv
from sklearn.externals import joblib
import MachineLearning.Reinforcement.InternalSQLManager as sqlManager
class ReinforcementLearner:
de... | code_fim | hard | {
"lang": "python",
"repo": "Anova07/Data-Science",
"path": "/MachineLearning/Reinforcement/ReinforcementLearner.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> joblib.dump(self.clf, "model.pkl") # Store the CLF
print("Data Fit")
return True
else:
previousData = sqlManager.selectNewestRecord(self.name) # Check the last entry of CLF
if len(previousData) > 0:
oldSize = previousData[... | code_fim | hard | {
"lang": "python",
"repo": "Anova07/Data-Science",
"path": "/MachineLearning/Reinforcement/ReinforcementLearner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> score = cv.cross_val_score(self.clf, X, y, scoring, cv=crossval)
newAccScore = score.mean()
print("Old Accuracy Score : ", accScore)
print("New Accuracy Score : ", newAccScore)
if accScore <= newAccScore: # If new data is ben... | code_fim | hard | {
"lang": "python",
"repo": "Anova07/Data-Science",
"path": "/MachineLearning/Reinforcement/ReinforcementLearner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IrvingQuirozV/Ingenieria-del-conocimiento path: /ejercicios en python/30.py
30. Convertir P libras inglesas a D dólares y C centavos. Usar el tipo de cambio $2.80 = 1 libra
p=2.80
<|fim_suffix|>if x == 1:
d=float(input("¿Cuantas libras desea convertir a dólar?\n"))
conversion = (d/... | code_fim | medium | {
"lang": "python",
"repo": "IrvingQuirozV/Ingenieria-del-conocimiento",
"path": "/ejercicios en python/30.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if x == 1:
d=float(input("¿Cuantas libras desea convertir a dólar?\n"))
conversion = (d/p)
if x == 2:
c=float(input("¿Cuantas libras desea convertir a centavos?\n"))
conversion = c/100
print("El resultado es:")
print(float(conversion))<|fim_prefix|># repo: IrvingQuirozV/Ingenieria-d... | code_fim | medium | {
"lang": "python",
"repo": "IrvingQuirozV/Ingenieria-del-conocimiento",
"path": "/ejercicios en python/30.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for index in range(test_set.shape[0]):
print(index)<|fim_prefix|># repo: apitsaer/Deep-Artwork-Analysis path: /test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 22:05:12 2019
<|fim_middle|>@author: admin
"""
| code_fim | easy | {
"lang": "python",
"repo": "apitsaer/Deep-Artwork-Analysis",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apitsaer/Deep-Artwork-Analysis path: /test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 22:05:12 2019
<|fim_suffix|>for index in range(test_set.shape[0]):
print(index)<|fim_middle|>@author: admin
"""
| code_fim | easy | {
"lang": "python",
"repo": "apitsaer/Deep-Artwork-Analysis",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: echang97/passwd path: /passwd/__init__.py
__version__ = "1.2.0"
import hashlib
from collections import Counter
from re import findall
from secrets import choice
from string import ascii_letters, ascii_lowercase, ascii_uppercase
from string import digits as all_digits
from string import punctuati... | code_fim | hard | {
"lang": "python",
"repo": "echang97/passwd",
"path": "/passwd/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PasswordGenerator:
"""A random password generator
Args:
length (int): The length of the password
Keyword Args:
uppercase (bool): Whether to allow uppercase letters in the password
lowercase (bool): Whether to allow lowercase letters in the password
digit... | code_fim | hard | {
"lang": "python",
"repo": "echang97/passwd",
"path": "/passwd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self, length=None, uppercase=None, lowercase=None, digits=None, special=None
):
"""Generate a random password
Keyword Args:
length (int): The length of the password
uppercase (bool): Whether to allow uppercase letters in the password
lowerca... | code_fim | hard | {
"lang": "python",
"repo": "echang97/passwd",
"path": "/passwd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if value and isinstance(value, memoryview):
return value.tobytes()
return value<|fim_prefix|># repo: tsifrer/ark path: /chain/plugins/database/models/fields.py
from peewee import BlobField
class BytesField(BlobField):
"""This is a BlobField adapted to our needs
Defau... | code_fim | easy | {
"lang": "python",
"repo": "tsifrer/ark",
"path": "/chain/plugins/database/models/fields.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tsifrer/ark path: /chain/plugins/database/models/fields.py
from peewee import BlobField
class BytesField(BlobField):
"""This is a BlobField adapted to our needs
Default BlobField returns memoryview when getting data from the db. We want bytes.
"""
<|fim_suffix|> if value and... | code_fim | easy | {
"lang": "python",
"repo": "tsifrer/ark",
"path": "/chain/plugins/database/models/fields.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _attribute_map = {
"metadata": {"key": "metadata", "type": "[object]"},
"logical_operation": {"key": "logicalOperation", "type": "str"},
}
def __init__(
self, *, metadata: Optional[List[JSON]] = None, logical_operation: Optional[str] = None, **kwargs: Any
) -> None... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-sdk-for-python",
"path": "/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py",
"mode": "spm",
"license": "LicenseRef-scancode-generic-cla",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Azure/azure-sdk-for-python path: /sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py
anges from 0 to 1.
:vartype confidence_threshold: float
:ivar answer_context: Context object with previous QnA's information.
:vartype answ... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-sdk-for-python",
"path": "/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py",
"mode": "psm",
"license": "LicenseRef-scancode-generic-cla",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert c._entities == mock['entities']
assert c._synonimous == mock['synonimous']
assert c.templates == mock['templates']
assert c.get_value('synonimous', 'fizz') == mock['synonimous']['fizz']<|fim_prefix|># repo: guidiego/rasa-dataset-gen path: /tests/test_config.py
from src.config impo... | code_fim | medium | {
"lang": "python",
"repo": "guidiego/rasa-dataset-gen",
"path": "/tests/test_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.