text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: dev-saem/algorism path: /algorism/4day/01.py
# 01. 세금징수(그리디)
t = int(input())
for i in range(t):
n = int(input())
coins = [50000, 10000, 5000, 1000, <|fim_suffix|>coinnum += n // coin
n %= coin
print(coinnum)<|fim_middle|>500, 100]
coinnum = 0
for coin in coins:
... | code_fim | easy | {
"lang": "python",
"repo": "dev-saem/algorism",
"path": "/algorism/4day/01.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
return multiples_of(1, 999, 3, 5)<|fim_prefix|># repo: nataliedurgin/pe_scratch path: /solved/p1.py
def multiples_of(start, end, *multiples):
<|fim_middle|> return sum(j for j in xrange(start, end + 1) if any(j % multiple == 0 for multiple in multiples))
| code_fim | medium | {
"lang": "python",
"repo": "nataliedurgin/pe_scratch",
"path": "/solved/p1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nataliedurgin/pe_scratch path: /solved/p1.py
def multiples_of(start, end, *multiples):
<|fim_suffix|> return multiples_of(1, 999, 3, 5)<|fim_middle|> return sum(j for j in xrange(start, end + 1) if any(j % multiple == 0 for multiple in multiples))
def main():
| code_fim | medium | {
"lang": "python",
"repo": "nataliedurgin/pe_scratch",
"path": "/solved/p1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nataliedurgin/pe_scratch path: /solved/p1.py
def multiples_of(start, end, *multiples):
return sum(j for j in xrange(start, end + 1) if any(j % multiple == 0 for multiple in multiples))
<|fim_suffix|> return multiples_of(1, 999, 3, 5)<|fim_middle|>def main():
| code_fim | easy | {
"lang": "python",
"repo": "nataliedurgin/pe_scratch",
"path": "/solved/p1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bincat99/h2thereum path: /test_sha256.py
import hashlib
i = 0
<|fim_suffix|> if h[:3] == "000":
print "sha256 (\"H2thereum\" + \"{}\") == 0x{}".format (i, h)<|fim_middle|>for i in xrange (10000000):
s = "H2thereum" + str (i)
h = hashlib.sha256 (s).hexdigest()
| code_fim | medium | {
"lang": "python",
"repo": "bincat99/h2thereum",
"path": "/test_sha256.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if h[:3] == "000":
print "sha256 (\"H2thereum\" + \"{}\") == 0x{}".format (i, h)<|fim_prefix|># repo: bincat99/h2thereum path: /test_sha256.py
import hashlib
i = 0
<|fim_middle|>for i in xrange (10000000):
s = "H2thereum" + str (i)
h = hashlib.sha256 (s).hexdigest()
| code_fim | medium | {
"lang": "python",
"repo": "bincat99/h2thereum",
"path": "/test_sha256.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_head = Snake((0,0,255),[head_x,head_y])
snake_list = [new_head]+snake_list
return snake_list
up = lambda x:(x[0]-1,x[1])
down = lambda x:(x[0]+1,x[1])
left = lambda x:(x[0],x[1]-1)
right = lambda x:(x[0],x[1]+1)
move = lambda x,y:[y(x[0])]+x[:-1] #移动一格,list拼接,舍弃原来list的最后一个元素
grow = lambda x,y:... | code_fim | hard | {
"lang": "python",
"repo": "skywalkerlk/python_personal-snake",
"path": "/pygame_snakeV02_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>food = Food((0,255,0),food_position)
food_group = pygame.sprite.Group()
food_group.add(food)
FPSCLOCK = pygame.time.Clock()
pygame.init()
pygame.display.set_mode((800,600))
pygame.mouse.set_visible(0)
screen = pygame.display.get_surface()
screen.fill((255,255,255))
times = 0.0
#游戏标志
is_over = False
is_... | code_fim | hard | {
"lang": "python",
"repo": "skywalkerlk/python_personal-snake",
"path": "/pygame_snakeV02_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skywalkerlk/python_personal-snake path: /pygame_snakeV02_2.py
#!/usr/bin/python
#coding:utf-8
#2016年9月9日
#用sprite的知识来改写snake游戏,注意有关snake的坐标都是y在前,x在后
#修改了初始界面,点击可变色按钮再进入游戏
#修改了点击按钮Restart游戏的界面,删除了is_over标志
#由于pygame的sprite group add方法是类似于字典的add,无法像list一样便捷操作
#仅仅是将每个snake方块变成class snake的实例,再统一放到s... | code_fim | hard | {
"lang": "python",
"repo": "skywalkerlk/python_personal-snake",
"path": "/pygame_snakeV02_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
with open(filepath) as f:
toml.load(f)
except toml.TomlDecodeError as err:
logging.error(filepath, extra=dict(status=err.msg))
return False
logging.info(filepath, extra=dict(status="ok"))
return True
def main(args: Namespace) -> int:
return 0... | code_fim | hard | {
"lang": "python",
"repo": "sayanarijit/tomlcheck",
"path": "/tomlcheck/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sayanarijit/tomlcheck path: /tomlcheck/main.py
import logging
from argparse import Namespace
from enum import Enum
import toml
class LogLevels(Enum):
debug = "DEBUG"
info = "INFO"
warning = "WARNING"
error = "ERROR"
critical = "CRITICAL"
def check(filepath: str) -> bool:
... | code_fim | hard | {
"lang": "python",
"repo": "sayanarijit/tomlcheck",
"path": "/tomlcheck/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>裾랜𬝃𡼸𩣲𢓧騬ټ𓌈𬗣𤗐𡘆𠵴𥹞痒Ѯ𨐺𮞌𣾽艛𩼓𧈂𤔄乨𡱤䒌𪐄槏𣸀𣁸𗌨𫠡ඟ𬌕𝛔𠱭황𪬲𐎪仸𛇫༏𝄒𮞧𠊌뫼뀲鯠kᔃ㭺𭻖𧉚椃𪯖𮗲𥼱𭧮䯵柺𬬳业𡀐𪟟혁玝ྯ鍪𮫧鱍𤾁忢𑒮濾𪻌𨢵닎𠚾ᤛ𮠖𫎖骓🈛𭶑ꌨس𝃁𪕵脼𥶕𬭲芿慚𤕲𘨭棍ǵ𫹟𦤪𨭸途𡞜𗠬꽝𣉺鍚𑌿𗚘𫿩‥𗉌𗺠뛓𢇍𫊀𠘑倣𢈦𣆯𓌞紇谱𨃄𭛅𭽆𨫱庁𫹖𣦏𛂾𢔜𡞃㗣𦴭𧼘𥨩𖹥𠓤让𤍲䑘𣟓𤭉𗈯椀𫀭𨩼𨎭𬽥𡣩𣶺𥨃𡯽𡉾𭴓𐰺𞤃솷飂㨐𡺋爫𗰉𞠀廯쁳𗓽넡𮥯𣌒𨱧ᠫ放Ꙙ𫵧𬦍껸𣦂𫒁𡥛Ḵ깽林🌖𬩐𦻙�... | code_fim | hard | {
"lang": "python",
"repo": "urlib/i1OB8Mxh",
"path": "/vWltdHzuXB790KZ5/wehCTxRBzKUiHyaM.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: urlib/i1OB8Mxh path: /vWltdHzuXB790KZ5/wehCTxRBzKUiHyaM.py
痘𡔰𗋒𘔳𓍀𗽤𠤭譸𛂡𡉀鼻𖫬🤳🍇觊𣌘𦑷𝞖𩩥𨈓𐢞緅𭙚𨘨𥐺뻠𨼸𣱺𥇔𡌗𭢾蠈𧇲𨎘𫸅蟡玹𤉜𥹝𥺻ᕇ턍𨚵𛂏𭞛𣵎뜸厠𭩷𠟗꒜𢲙⫠𪤤𪵕𥅳𫜋惐𗦯樔𪌽𩫣橑𫕹𡀇建䗶볉𭫓𦴮깟既𑩝훏𥧔횞猬뮋𡣚陵𩀩𧏟ᑨ𗲩𣻿𦸹桙鶕𗴻誣𩢬𨠡𠗗𤘂㔳𭊫𦽷諫㘿翕𪐯𡩔봵𗫶쵄彝𥀮ꍢ䚰𣊌𬞞뵩𭟶𨏬𘇆𭗼챝𭀟채⁵쁜𘥚ᐢ噶ⳤ𤱉𗋒𘀹끛𔖩舕镬𗏙폀𧭼𥌗𠗗𝤉𠪣𨛽𖨞ᶗ𗖀𪑰⯻�... | code_fim | hard | {
"lang": "python",
"repo": "urlib/i1OB8Mxh",
"path": "/vWltdHzuXB790KZ5/wehCTxRBzKUiHyaM.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RonnyPfannschmidt/gumby_elf path: /src/_packing.py
import os.path
import pkgutil
from pathlib import Path
from ._metadata import Specification
from ._mksdist import sdist_path
from ._mksdist import SdistBuilder
from ._mkwheel import wheel_name
from ._mkwheel import WheelBuilder
from ._mkwheel im... | code_fim | medium | {
"lang": "python",
"repo": "RonnyPfannschmidt/gumby_elf",
"path": "/src/_packing.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn = os.path.abspath(spec.source_file)
srcdir = os.path.join(os.path.dirname(fn), "src")
template = pkgutil.get_data(__name__, "bootstrap_template.py.txt")
template = template.decode("utf-8")
return template.format(srcfolder=srcdir).encode("utf-8")
def build_editable(spec, distdir):
... | code_fim | hard | {
"lang": "python",
"repo": "RonnyPfannschmidt/gumby_elf",
"path": "/src/_packing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> target = sdist_path(sdist_dir, spec)
with SdistBuilder.for_target(target, spec) as sdist:
# todo: better config
from setuptools_scm.integration import find_files
for name in find_files(""):
with open(name, "rb") as fp:
sdist.add_file(name, fp.r... | code_fim | hard | {
"lang": "python",
"repo": "RonnyPfannschmidt/gumby_elf",
"path": "/src/_packing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: artpssp1994/KnowledgeBase path: /populate_knowledge.py
in:0;
padding: 0;
zoom: 1;
float: left;
clear: left;
width: 100%;
}
.tagit-autocomplete.ui-menu .ui-menu-item a {
text-decoration:none;
display:block;
padding:.2em .4em;
line-height:1.5;
zoom:1;
}
.tagit-autocomplete .ui-menu .ui-menu-ite... | code_fim | hard | {
"lang": "python",
"repo": "artpssp1994/KnowledgeBase",
"path": "/populate_knowledge.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>removeTag: function(tag, animate) {
animate = typeof animate === 'undefined' ? this.options.animate : animate;
tag = $(tag);
// DEPRECATED. \
this._trigger('onTagRemoved', null, tag);
if (this._trigger('beforeTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)}) === false) {
return;
}
i... | code_fim | hard | {
"lang": "python",
"repo": "artpssp1994/KnowledgeBase",
"path": "/populate_knowledge.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: artpssp1994/KnowledgeBase path: /populate_knowledge.py
b(this).text(b(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove());return this},_cleanedInput:function(){return b.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:funct... | code_fim | hard | {
"lang": "python",
"repo": "artpssp1994/KnowledgeBase",
"path": "/populate_knowledge.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>meCart.as_view()),
path('theme/category/',views.CategoryView.as_view()),
]<|fim_prefix|># repo: Swiftkind/market path: /themes/urls.py
from django.urls import path, include
from . import views
urlpatterns = [
path('theme/', views.ThemeFeed.as_view()),
path('theme/details/<int:id>/'<|fim_middle|>, vie... | code_fim | medium | {
"lang": "python",
"repo": "Swiftkind/market",
"path": "/themes/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Swiftkind/market path: /themes/urls.py
from django.urls import path, include
from . import views
urlpatterns = [
<|fim_suffix|>, views.ThemeNameFilter.as_view()),
path('theme/cart/<int:id>/', views.ThemeCart.as_view()),
path('theme/category/',views.CategoryView.as_view()),
]<|fim_middle|> path... | code_fim | medium | {
"lang": "python",
"repo": "Swiftkind/market",
"path": "/themes/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jxavie/web-scraping-challenge path: /scrape_mars.py
# import dependencies
from bs4 import BeautifulSoup as bs
from splinter import Browser
from splinter.exceptions import ElementDoesNotExist
import time
import pandas as pd
def init_browser():
executable_path = {"executable_path": "chromedri... | code_fim | hard | {
"lang": "python",
"repo": "jxavie/web-scraping-challenge",
"path": "/scrape_mars.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # find image titles and urls
hemispheres = soup_hemisphere.find_all('div', class_='description')
hemisphere_image_urls = []
hemispheres
for hemisphere in hemispheres:
hemisphere_dict = {}
title = hemisphere.find('a').text
print(title)
... | code_fim | hard | {
"lang": "python",
"repo": "jxavie/web-scraping-challenge",
"path": "/scrape_mars.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Used to calculate fps
start_time = datetime.datetime.now()
num_frames = 0
im_height, im_width = (None, None)
cv2.namedWindow('Detection', cv2.WINDOW_NORMAL)
def count_no_of_times(lst):
x = y = cnt = 0
for i in lst:
x = y
y = i
... | code_fim | hard | {
"lang": "python",
"repo": "FormulateAI/baby-monitoring-system",
"path": "/hand_detection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FormulateAI/baby-monitoring-system path: /hand_detection.py
import cv2
import argparse
import orien_lines
import datetime
from imutils.video import VideoStream
from utils import detector_utils as detector_utils
import pandas as pd
from datetime import date
import xlrd
from xlwt import Workbook
fr... | code_fim | hard | {
"lang": "python",
"repo": "FormulateAI/baby-monitoring-system",
"path": "/hand_detection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: passdacom/SJVA3 path: /lib/framework/common/share/__init__.py
from framework import logger
class Vars:
<|fim_suffix|>from .rclone_tool import RcloneTool
from .rclone_tool2 import RcloneTool2<|fim_middle|> key = 'ldlofb5egsg5h22gj3zn77dhs4gdh5ss'
| code_fim | easy | {
"lang": "python",
"repo": "passdacom/SJVA3",
"path": "/lib/framework/common/share/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .rclone_tool import RcloneTool
from .rclone_tool2 import RcloneTool2<|fim_prefix|># repo: passdacom/SJVA3 path: /lib/framework/common/share/__init__.py
from framework import logger
<|fim_middle|>class Vars:
key = 'ldlofb5egsg5h22gj3zn77dhs4gdh5ss'
| code_fim | easy | {
"lang": "python",
"repo": "passdacom/SJVA3",
"path": "/lib/framework/common/share/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> key = 'ldlofb5egsg5h22gj3zn77dhs4gdh5ss'
from .rclone_tool import RcloneTool
from .rclone_tool2 import RcloneTool2<|fim_prefix|># repo: passdacom/SJVA3 path: /lib/framework/common/share/__init__.py
from framework import logger
<|fim_middle|>class Vars:
| code_fim | easy | {
"lang": "python",
"repo": "passdacom/SJVA3",
"path": "/lib/framework/common/share/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ukwa/ukwa-manage path: /prototype/ukwa/tasks/report/crawl_summary.py
import luigi
from tasks.process.log_analysis import GenerateCrawlLogReports
from tasks.common import logger
<|fim_suffix|> #def requires(self):
# return GenerateCrawlLogReports(self.job, self.launch)
if __name__ == ... | code_fim | medium | {
"lang": "python",
"repo": "ukwa/ukwa-manage",
"path": "/prototype/ukwa/tasks/report/crawl_summary.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
luigi.run(['report.GenerateCrawlReport', '--local-scheduler'])
#luigi.run(['GenerateCrawlReport', '--date-interval', "2017-01-13-2017-01-18", '--local-scheduler'])<|fim_prefix|># repo: ukwa/ukwa-manage path: /prototype/ukwa/tasks/report/crawl_summary.py
import luigi
fr... | code_fim | medium | {
"lang": "python",
"repo": "ukwa/ukwa-manage",
"path": "/prototype/ukwa/tasks/report/crawl_summary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>cutoff = 0.
floatcond = np.zeros(len(xf))
floatcond[:] = float('nan')
for i in range(0,len(xf)):
if np.min(zabovefloat[i,:]) > cutoff:
floatcond[i] = 1 #grounded
elif np.max(zabovefloat[i,:]) < -1*cutoff:
floatcond[i] = -1 #floating
elif (np.max(zabovefloat[i,:]) > -1*cutoff) or (np.min(zab... | code_fim | hard | {
"lang": "python",
"repo": "kehrl/big3",
"path": "/observations/elevation/plot_seasonal_thinning.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kehrl/big3 path: /observations/elevation/plot_seasonal_thinning.py
import os
import sys
import numpy as np
import zslib, geotifflib, datelib, masklib, floatlib
import matplotlib.pyplot as plt
import matplotlib
# Get arguments
args = sys.argv
glacier = args[1][:] # Options: Kanger, Helheim
####... | code_fim | hard | {
"lang": "python",
"repo": "kehrl/big3",
"path": "/observations/elevation/plot_seasonal_thinning.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheDataStation/relational-embedding path: /token_dict.py
import pickle
class TokenDict:
def __init__(self, path=None):
# token -> numerical id:
# string -> string
if path is None:
self.token2id = dict()
self.id2token = dict()
self... | code_fim | hard | {
"lang": "python",
"repo": "TheDataStation/relational-embedding",
"path": "/token_dict.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getTokenForNums(self, lst):
return [self.getTokenForNum(x) for x in lst]
def getAllTokensWith(self, token):
lst = []
token = str(token)
lst = [key for key in self.token2id.keys() if token in key]
return lst<|fim_prefix|># repo: TheDataStation/relational... | code_fim | hard | {
"lang": "python",
"repo": "TheDataStation/relational-embedding",
"path": "/token_dict.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> num = str(num)
if num not in self.id2token.keys():
import pdb; pdb.set_trace()
return None
else:
return self.id2token[num]
def getTokenForNums(self, lst):
return [self.getTokenForNum(x) for x in lst]
def getAllTokensWith(self, t... | code_fim | hard | {
"lang": "python",
"repo": "TheDataStation/relational-embedding",
"path": "/token_dict.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> arg_parser = reqparse.RequestParser()
arg_parser.add_argument(
"file", type=werkzeug.datastructures.FileStorage, location="files"
)
args = arg_parser.parse_args()
content_type = args.file.mimetype
image = args.file.read()
# stripped_image... | code_fim | hard | {
"lang": "python",
"repo": "V01D0/colloquium",
"path": "/app/api/blogs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: V01D0/colloquium path: /app/api/blogs.py
# SELECT username FROM users WHERE username LIKE 'r%';
from flask_restful import Resource, reqparse
from flask import jsonify
from flask_login import current_user
from . import api
from flask_jwt_extended import jwt_required
from flask_jwt_extended import ... | code_fim | hard | {
"lang": "python",
"repo": "V01D0/colloquium",
"path": "/app/api/blogs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
api.add_resource(BlogList, "/blogs/like")
class UploadFile(Resource):
"""Upload a file to to storage"""
@jwt_required()
def post(self):
arg_parser = reqparse.RequestParser()
arg_parser.add_argument(
"file", type=werkzeug.datastructures.FileStorage, location="fil... | code_fim | hard | {
"lang": "python",
"repo": "V01D0/colloquium",
"path": "/app/api/blogs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeeInHaeng/Django_ORM_pratice_project path: /orm_practice_app/views.py
efetch
from orm_practice_app.models import Company, Product, Order, OrderedProduct
def asdf():
Product.objects.filter(name='product_name3', product_owned_company__name='company_name20').select_related(
'product... | code_fim | hard | {
"lang": "python",
"repo": "LeeInHaeng/Django_ORM_pratice_project",
"path": "/orm_practice_app/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
SELECT "orm_practice_app_orderedproduct"."id", "orm_practice_app_orderedproduct"."product_cnt", "orm_practice_app_orderedproduct"."amount_of_credited_mileage", "orm_practice_app_orderedproduct"."related_product_id", "orm_practice_app_orderedproduct"."related_order_id"
FROM "orm_practice_a... | code_fim | hard | {
"lang": "python",
"repo": "LeeInHaeng/Django_ORM_pratice_project",
"path": "/orm_practice_app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeeInHaeng/Django_ORM_pratice_project path: /orm_practice_app/views.py
'product_owned_company')
Company.objects.prefetch_related('company_set').filter(product__name='product_anme8')
Product.objects.filter(product_owned_company__name='company_name133')
Order.objects.filter(order_... | code_fim | hard | {
"lang": "python",
"repo": "LeeInHaeng/Django_ORM_pratice_project",
"path": "/orm_practice_app/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: km1031kim/pythonInSchool path: /Session07 - 유형별로 실습하는 머신러닝/.ipynb_checkpoints/20210602 - ML_분류-checkpoint.py
": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical... | code_fim | hard | {
"lang": "python",
"repo": "km1031kim/pythonInSchool",
"path": "/Session07 - 유형별로 실습하는 머신러닝/.ipynb_checkpoints/20210602 - ML_분류-checkpoint.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|></td>\n",
" </tr>\n",
" <tr>\n",
" <th>19995</th>\n",
" <td>628000000</td>\n",
" <td>44666666</td>\n",
" <td>diamond</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19996</th>\n",
" <td>276000000</td>\n",... | code_fim | hard | {
"lang": "python",
"repo": "km1031kim/pythonInSchool",
"path": "/Session07 - 유형별로 실습하는 머신러닝/.ipynb_checkpoints/20210602 - ML_분류-checkpoint.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZXQYC/random-shooter-game path: /src/leaderboard.py
"""This module contains utilities for accessing and modifying the game leaderboard"""
import os
import pymongo
import pymongo.errors
import dotenv
from utils import difficulties, MAX_LEADERS
dotenv.load_dotenv()
<|fim_suffix|> def get_to... | code_fim | hard | {
"lang": "python",
"repo": "ZXQYC/random-shooter-game",
"path": "/src/leaderboard.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_score(self, difficulty, time, name):
"""Add a score to the database"""
self.database[difficulty].insert_one({'time': time, 'name': name})
def clear_database(self):
"""Clears the database"""
for diff in difficulties:
self.database[diff].delete_ma... | code_fim | hard | {
"lang": "python",
"repo": "ZXQYC/random-shooter-game",
"path": "/src/leaderboard.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DunwoodyME/meng2110 path: /10_lists/pyplot_line.py
# -*- coding: utf-8 -*-
"""
pyplot_line.py
Simple line plot using matplotlib.pyplot
Daniel Thomas
October 9, 2017
"""
<|fim_suffix|>x = [1,2,3,4]
y = [1,4,9,16]
plt.plot(x, y, 'r')
plt.show()<|fim_middle|>import matplotlib.pyplot as ... | code_fim | easy | {
"lang": "python",
"repo": "DunwoodyME/meng2110",
"path": "/10_lists/pyplot_line.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = [1,2,3,4]
y = [1,4,9,16]
plt.plot(x, y, 'r')
plt.show()<|fim_prefix|># repo: DunwoodyME/meng2110 path: /10_lists/pyplot_line.py
# -*- coding: utf-8 -*-
"""
pyplot_line.py
Simple line plot using matplotlib.pyplot
Daniel Thomas
October 9, 2017
"""
<|fim_middle|>import matplotlib.pyplot as ... | code_fim | easy | {
"lang": "python",
"repo": "DunwoodyME/meng2110",
"path": "/10_lists/pyplot_line.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #2.5 Train and test creation
Full_DF_kagl = Full_DF[pd.isna(Full_DF['target'])] #These are cases from the kaggle test test, they have no target labels
Train_Test = Full_DF[~pd.isna(Full_DF['target'])]
Train_Test['target'] = Train_Test['target'].astype(int).copy()
#2.5.1 The train... | code_fim | hard | {
"lang": "python",
"repo": "i-am-yohan/explainable_credit_scoring",
"path": "/Scripts/02_Sampling.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#2.6 Outlier Detection and removal
OD_Model = IsolationForest(random_state=198666).fit(Train.drop('target',axis=1))
Outlier_array = OD_Model.predict(Train.drop('target',axis=1))
Train = Train[Outlier_array == 1].copy()
#2.7 Push to database
print('Pushing Kaggle submissi... | code_fim | hard | {
"lang": "python",
"repo": "i-am-yohan/explainable_credit_scoring",
"path": "/Scripts/02_Sampling.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: i-am-yohan/explainable_credit_scoring path: /Scripts/02_Sampling.py
import psycopg2
import argparse
import sys
import pandas as pd
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from sqlalchemy import create_engine
from sklearn.model_selection import train_test_split
from sklea... | code_fim | hard | {
"lang": "python",
"repo": "i-am-yohan/explainable_credit_scoring",
"path": "/Scripts/02_Sampling.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>except:
print "Unexpected error:", sys.exc_info()[0]
print doc<|fim_prefix|># repo: dgapitts/mongo_m101p_vagrant path: /m101p/hw2/pymongo_findone.py
import pymongo
import sys
<|fim_middle|>connection = pymongo.Connection("mongodb://localhost", safe=True)
db=connection.students
grades = db.grade... | code_fim | medium | {
"lang": "python",
"repo": "dgapitts/mongo_m101p_vagrant",
"path": "/m101p/hw2/pymongo_findone.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgapitts/mongo_m101p_vagrant path: /m101p/hw2/pymongo_findone.py
import pymongo
import sys
connection = pymongo.Connection("mongodb://localhost", safe=True)
db=connection.students
grades = db.grades
<|fim_suffix|>except:
print "Unexpected error:", sys.exc_info()[0]
print doc<|fim_middl... | code_fim | easy | {
"lang": "python",
"repo": "dgapitts/mongo_m101p_vagrant",
"path": "/m101p/hw2/pymongo_findone.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeadLekar/2gis path: /serviceFunctions.py
from enum import Enum
import time
import math
rus_letters = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя"
lat_letters = "abcdefghijklmnopqrstuvwxyz"
digits = "1234567890"
puncts = ".,-:;?!()[]{}"
class html_level:
level_type = "" #class, tag...
level_name... | code_fim | hard | {
"lang": "python",
"repo": "DeadLekar/2gis",
"path": "/serviceFunctions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = 0
new_str = ""
while i <= len(str_to_clear)-1:
cr_symb = str(str_to_clear[i].lower())
if legitimate_symbols.find(cr_symb) != -1:
#if puncts.find(cr_symb) == -1 or i < len(str_to_clear)-1:
new_str += str_to_clear[i]
i += 1
return new_s... | code_fim | hard | {
"lang": "python",
"repo": "DeadLekar/2gis",
"path": "/serviceFunctions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not done:
reward = self.alpha * math.exp(z) * L - self.beta1 * P - self.beta2 * P ** 2
elif self.steps_beyond_done is None:
# Pole just fell!
self.steps_beyond_done = 0
reward = self.alpha * math.exp(z) * L - self.beta1 * P - self.bet... | code_fim | hard | {
"lang": "python",
"repo": "ExTee/EutrophicLake",
"path": "/lake2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ExTee/EutrophicLake path: /lake2.py
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 15 14:02:59 2018
@author: Robert
"""
import math
import gym
from gym import spaces, logger
from gym.utils import seeding
import numpy as np
class LakeLoadEnv(gym.Env):
metadata = {
'... | code_fim | hard | {
"lang": "python",
"repo": "ExTee/EutrophicLake",
"path": "/lake2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Detao-Zhang/svtools path: /svtools/lmerge_ins.py
r(c_i)+"\t"+str(a_L[c_i][i])+"\n")
p_L[i] += a_L[c_i][i]
for i in range(len(a_R[c_i])):
#sys.stderr.write("R\t"+str(i)+"\t"+str(c_i)+"\t"+str(a_R[c_i][i])+"\n")
p_R[i] += a_R[c_i][i]
ALG = 'SUM'
... | code_fim | hard | {
"lang": "python",
"repo": "Detao-Zhang/svtools",
"path": "/svtools/lmerge_ins.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Detao-Zhang/svtools path: /svtools/lmerge_ins.py
'SNAME', sname + ':' + var.var_id)
except KeyError:
pass
var.var_id=str(v_id)
if use_product:
var.set_info('ALG', 'PROD')
else:
var.set_info('ALG', 'SUM')
GTS = None
if include_genotypes:
nu... | code_fim | hard | {
"lang": "python",
"repo": "Detao-Zhang/svtools",
"path": "/svtools/lmerge_ins.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ls_p in ls_p_R:
ls_sum_R = ls.ls_add(ls_sum_R, ls_p)
p_L = []
for ls_p in ls_p_L:
p_L.append(ls.get_p(ls.ls_divide(ls_p, ls_sum_L)))
p_R = []
for ls_p in ls_p_R:
p_R.append(ls.get_p(ls.ls_divi... | code_fim | hard | {
"lang": "python",
"repo": "Detao-Zhang/svtools",
"path": "/svtools/lmerge_ins.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> c.getElementsByTagName("gml:coordinates")
if co:
coordinate = co[0].childNodes[0].nodeValue
if coordinate:
st = coordinate.split(",")
logitude = st[1]
lattitude = st[0]
t = (logitude,lattitude)
return t
print coordinates(x... | code_fim | hard | {
"lang": "python",
"repo": "rohitkhatana/python_toy_scripts",
"path": "/coordinate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rohitkhatana/python_toy_scripts path: /coordinate.py
from xml.dom import minidom
xml="""<HostipLookupResultSet xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.1" xsi:noNamespaceSchemaLocation="http://www.hostip.info/api/hostip-1.0.1.xsd">
... | code_fim | hard | {
"lang": "python",
"repo": "rohitkhatana/python_toy_scripts",
"path": "/coordinate.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __iter__(self):
return self._get_value("__iter__")
def __matmul__(self):
return self._get_value("__matmul__")
def __ne__(self):
return self._get_value("__ne__")
def __or__(self):
return self._get_value("__or__")
def __rand__(self):
return self._get_value("__rand__")
def ... | code_fim | hard | {
"lang": "python",
"repo": "python-graphblas/python-graphblas",
"path": "/graphblas/core/automethods.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise TypeError(f"'__ipow__' not supported for {type(self).__name__}")
def __isub__(self, other):
raise TypeError(f"'__isub__' not supported for {type(self).__name__}")
def __itruediv__(self, other):
raise TypeError(f"'__itruediv__' not supported for {type(self).__name__}")
def __ixor__(... | code_fim | hard | {
"lang": "python",
"repo": "python-graphblas/python-graphblas",
"path": "/graphblas/core/automethods.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: happyeric1120/IntroML path: /poi_id_pca.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 8 00:14:10 2015
@author: ericwu
"""
import matplotlib.pyplot as plt
import sys
import pickle
sys.path.append("./tools/")
from feature_format import featureFormat
from feature_format import targetFeature... | code_fim | hard | {
"lang": "python",
"repo": "happyeric1120/IntroML",
"path": "/poi_id_pca.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># parameter = {'base_estimator':[None, DecisionTreeClassifier(),
# RandomForestClassifier()],
# 'n_estimators':[20, 50]}
# Here comes weird part
# parameter = {'base_estimator':[None, RandomFo... | code_fim | hard | {
"lang": "python",
"repo": "happyeric1120/IntroML",
"path": "/poi_id_pca.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: palani-ai/Diabetic-Retinopathy-Detection path: /scripts/InceptionV3.py
import numpy as np
import os
import time
from keras.applications.inception_v3 import InceptionV3
from keras.preprocessing import image
from keras.layers import GlobalAveragePooling2D, Dense, Dropout,Activation,Flatten
fr... | code_fim | hard | {
"lang": "python",
"repo": "palani-ai/Diabetic-Retinopathy-Detection",
"path": "/scripts/InceptionV3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
custom_resnet_model.layers[-1].trainable
custom_resnet_model.compile(loss='categorical_crossentropy',optimizer='adam',metrics=['accuracy'])
t=time.time()
hist = custom_resnet_model.fit(X_train, y_train, batch_size=32, epochs=20, verbose=1, validation_data=(X_test, y_test))
#custom_resnet_model.s... | code_fim | hard | {
"lang": "python",
"repo": "palani-ai/Diabetic-Retinopathy-Detection",
"path": "/scripts/InceptionV3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def estimate_distance_helper(obj_a, obj_b, options=routing.EstimatePathDistance_DefaultOptions):
floor_a = obj_a.intended_routing_surface.secondary_id
floor_b = obj_b.intended_routing_surface.secondary_id
floor_difference = abs(floor_a - floor_b)
floor_cost = floor_difference * DistanceEst... | code_fim | hard | {
"lang": "python",
"repo": "velocist/TS4CheatsInfo",
"path": "/Scripts/simulation/primitives/routing_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def estimate_distance_between_multiple_points(sources, dests, routing_context=None, allow_permissive_connections=False):
min_distance = routing.estimate_distance_between_multiple_points(sources, dests, routing_context, allow_permissive_connections)
if min_distance is not None:
return min_d... | code_fim | hard | {
"lang": "python",
"repo": "velocist/TS4CheatsInfo",
"path": "/Scripts/simulation/primitives/routing_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: velocist/TS4CheatsInfo path: /Scripts/simulation/primitives/routing_utils.py
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\... | code_fim | hard | {
"lang": "python",
"repo": "velocist/TS4CheatsInfo",
"path": "/Scripts/simulation/primitives/routing_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robin-mi89/Week20-Django path: /codesnippets/models.py
from django.db import models
from django.utils import timezone
# Create your models here.
class CodeSnippet(models.Model):
created = models.DateTimeField(default=timezone.now())
modified = models.DateTimeField(default=timezone.now()... | code_fim | hard | {
"lang": "python",
"repo": "robin-mi89/Week20-Django",
"path": "/codesnippets/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Add created_at and updated_at timestamps. """
if not self.id:
self.created = timezone.now()
self.modified = timezone.now()
return super(CodeSnippet, self).save(*args, **kwargs)<|fim_prefix|># repo: robin-mi89/Week20-Django path: /codesnippets/models.py
fr... | code_fim | hard | {
"lang": "python",
"repo": "robin-mi89/Week20-Django",
"path": "/codesnippets/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def about_view(request):
return render_to_response('about.html', {})
def nav_vew(request):
return render_to_response('nav.html', {})<|fim_prefix|># repo: Cuddlemuffin007/trees path: /trees_app/views.py
from django.shortcuts import render, render_to_response
from trees_app.models import Tree
... | code_fim | medium | {
"lang": "python",
"repo": "Cuddlemuffin007/trees",
"path": "/trees_app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> captured_tree = Tree.objects.get(name=capture)
return render_to_response('data.html', {'tree': captured_tree})
def about_view(request):
return render_to_response('about.html', {})
def nav_vew(request):
return render_to_response('nav.html', {})<|fim_prefix|># repo: Cuddlemuffin007/trees ... | code_fim | medium | {
"lang": "python",
"repo": "Cuddlemuffin007/trees",
"path": "/trees_app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cuddlemuffin007/trees path: /trees_app/views.py
from django.shortcuts import render, render_to_response
from trees_app.models import Tree
<|fim_suffix|> all_trees = Tree.objects.all()
return render_to_response('index.html', {'trees': list(all_trees)})
def data_view(request, capture):
... | code_fim | medium | {
"lang": "python",
"repo": "Cuddlemuffin007/trees",
"path": "/trees_app/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # scale: 1 ~ 15
def one_f(beta=-1):
dim = im.shape[:2]
u1 = np.arange(np.floor(dim[0]/2)+1)
u2 = -1 * np.arange(np.ceil(dim[0]/2)-1, 0, -1)
u = np.concatenate([u1, u2]) / dim[0]
u = np.tile(u, (dim[1], 1))
u = np.swapaxes(u, 0, 1)
v1 = np.a... | code_fim | hard | {
"lang": "python",
"repo": "nmhkahn/distortion",
"path": "/distortion.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nmhkahn/distortion path: /distortion.py
import os
import skimage.io
import skimage.util
import skimage.filters
import skimage.transform
import numpy as np
from PIL import Image
def gaussian_noise(im, var=0.01):
# var: 0 ~ 0.1
noisy = skimage.util.random_noise(im, mode="gaussian", var=var... | code_fim | hard | {
"lang": "python",
"repo": "nmhkahn/distortion",
"path": "/distortion.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arturo-sh/simuladores_GUI path: /Simulador dado/simulador_dado.py
from tkinter import *
from PIL import ImageTk, Image
from random import randint
def cambia_img():
numero1 = str(randint(1, 6))
nombreImagen1 = "dado" + numero1 + ".png"
imagen1 = Image.open(nombreImagen1)
n... | code_fim | medium | {
"lang": "python",
"repo": "Arturo-sh/simuladores_GUI",
"path": "/Simulador dado/simulador_dado.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>imagenDefault2 = ImageTk.PhotoImage(Image.open("default.jpg").resize((100, 100)))
label2 = Label(ventana, image=imagenDefault2)
label2.place(x=130, y=40)
btn = Button(ventana, command=cambia_img, width=6, height=1)
btn.config(text='lanzar')
btn.place(x=105, y=170)
ventana.mainloop()<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "Arturo-sh/simuladores_GUI",
"path": "/Simulador dado/simulador_dado.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thiagomfl/python-studies path: /control-structures/while.py
from random import randint
# while True:
# print('It\'s to long...')
<|fim_suffix|>while informed_number != secret_number:
informed_number = int(input('Number: '))
print('Secret number {} was matched!'.format(secret_number))... | code_fim | easy | {
"lang": "python",
"repo": "thiagomfl/python-studies",
"path": "/control-structures/while.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thiagomfl/python-studies path: /control-structures/while.py
from random import randint
<|fim_suffix|>while informed_number != secret_number:
informed_number = int(input('Number: '))
print('Secret number {} was matched!'.format(secret_number))<|fim_middle|># while True:
# print('It\'s ... | code_fim | medium | {
"lang": "python",
"repo": "thiagomfl/python-studies",
"path": "/control-structures/while.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('Secret number {} was matched!'.format(secret_number))<|fim_prefix|># repo: thiagomfl/python-studies path: /control-structures/while.py
from random import randint
# while True:
# print('It\'s to long...')
<|fim_middle|>informed_number = -1
secret_number = randint(0, 9)
while informed_number ... | code_fim | medium | {
"lang": "python",
"repo": "thiagomfl/python-studies",
"path": "/control-structures/while.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # decrease alpha / e per 100 moves
if self.gameCounter % 100 == 0:
self.alpha = self.alpha * self.alphaD
if self.e > self.emin:
self.e = self.e / self.ed
self.gameCounter += 1
def onScore(self, state):
estReward = self.Q[state]
... | code_fim | hard | {
"lang": "python",
"repo": "bonellon/SnakeAI",
"path": "/QLearning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Salary'))
print('Employee Name:%s'%Ename)
print('Employee ID:%i'%EID)
print('Employee Salary:%f'%ESal)<|fim_prefix|># repo: simranmahadik1199/python-basics path: /emp info using format (modifier).py
Ename=input('Enter Employee Name')
EID=int(input('E<|fim_middle|>nter Employee ID'))
ESal=float(input('E... | code_fim | easy | {
"lang": "python",
"repo": "simranmahadik1199/python-basics",
"path": "/emp info using format (modifier).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simranmahadik1199/python-basics path: /emp info using format (modifier).py
Ename=input('Enter Employee Name')
EID=int(input('E<|fim_suffix|> Salary'))
print('Employee Name:%s'%Ename)
print('Employee ID:%i'%EID)
print('Employee Salary:%f'%ESal)<|fim_middle|>nter Employee ID'))
ESal=float(input('E... | code_fim | easy | {
"lang": "python",
"repo": "simranmahadik1199/python-basics",
"path": "/emp info using format (modifier).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>tion[0] + 1][position[1] - 1].getName() != ' ' and board[position[0] + 1][position[1] - 1].getColor() != tile.getColor():
LegalMovesListDestroyable.append(board[position[0] + 1][position[1] - 1])
else:
if position[0] - 1 > -1 and bo... | code_fim | hard | {
"lang": "python",
"repo": "zv100558snv/Chess",
"path": "/pawn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zv100558snv/Chess path: /pawn.py
from piece import Piece
class Pawn(Piece):
def __init__(self, color):
Piece.__init__(self, color)
self.name = color + '_' + 'P'
self.count = 0
def getLegalMoves(self, board):
position = self.getPosition()
LegalMov... | code_fim | hard | {
"lang": "python",
"repo": "zv100558snv/Chess",
"path": "/pawn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chornuy/djangomigrationshowcase path: /showcase/management/commands/test_creation.py
from django.core.management import BaseCommand
from showcase.models import Post, Category
class Command(BaseCommand):
<|fim_suffix|> Category.objects.bulk_create([
Category(name="Funny cats"... | code_fim | easy | {
"lang": "python",
"repo": "Chornuy/djangomigrationshowcase",
"path": "/showcase/management/commands/test_creation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Category.objects.bulk_create([
Category(name="Funny cats"),
Category(name="Very funny cats"),
Category(name="More very funny cats")
])<|fim_prefix|># repo: Chornuy/djangomigrationshowcase path: /showcase/management/commands/test_creation.py
from django.... | code_fim | medium | {
"lang": "python",
"repo": "Chornuy/djangomigrationshowcase",
"path": "/showcase/management/commands/test_creation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
urlpatterns = [
path("", include(deblur_patterns)),
]<|fim_prefix|># repo: polyedr/drfx-deblur path: /deblur/urls.py
from django.urls import path, include
from deblur.views import DeblurDataList, DeblurDataDetail
<|fim_middle|>app_name = "deblur"
deblur_patterns = [
path("deblur/", DeblurData... | code_fim | medium | {
"lang": "python",
"repo": "polyedr/drfx-deblur",
"path": "/deblur/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: polyedr/drfx-deblur path: /deblur/urls.py
from django.urls import path, include
<|fim_suffix|>
urlpatterns = [
path("", include(deblur_patterns)),
]<|fim_middle|>from deblur.views import DeblurDataList, DeblurDataDetail
app_name = "deblur"
deblur_patterns = [
path("deblur/", DeblurData... | code_fim | hard | {
"lang": "python",
"repo": "polyedr/drfx-deblur",
"path": "/deblur/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: polyedr/drfx-deblur path: /deblur/urls.py
from django.urls import path, include
from deblur.views import DeblurDataList, DeblurDataDetail
<|fim_suffix|>deblur_patterns = [
path("deblur/", DeblurDataList.as_view(), name="deblur_list",),
path("deblur/<int:pk>/", DeblurDataDetail.as_view()... | code_fim | easy | {
"lang": "python",
"repo": "polyedr/drfx-deblur",
"path": "/deblur/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamiepg1/dynamic-dynamodb path: /dynamic_dynamodb/__init__.py
# -*- coding: utf-8 -*-
"""
Dynamic DynamoDB
Auto provisioning functionality for Amazon Web Service DynamoDB tables.
APACHE LICENSE 2.0
Copyright 2013 Sebastian Dahlgren
Licensed under the Apache License, Version 2.0 (the "License"... | code_fim | hard | {
"lang": "python",
"repo": "jamiepg1/dynamic-dynamodb",
"path": "/dynamic_dynamodb/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
""" Main function called from dynamic-dynamodb """
if configuration['global']['daemon']:
pid_file = '/tmp/dynamic-dynamodb.{0}.pid'.format(
configuration['global']['instance'])
daemon = DynamicDynamoDBDaemon(pid_file)
if configuration['global']['dae... | code_fim | hard | {
"lang": "python",
"repo": "jamiepg1/dynamic-dynamodb",
"path": "/dynamic_dynamodb/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vipliujunjie/HouseCore path: /Python_Study/2课堂练习/Python就业班/08-先绑定端口然后再循环发送.py
import socket
def main():
#创建一个udp套接字
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# 绑定本地信息
udp_socket.bind(("", 7890))
while True:
# 从键盘获取数据
send_data = input("请输入要发送的数据:")
a = "\n"
<|fi... | code_fim | hard | {
"lang": "python",
"repo": "vipliujunjie/HouseCore",
"path": "/Python_Study/2课堂练习/Python就业班/08-先绑定端口然后再循环发送.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 5.关闭套接字
udp_socket.close()
if __name__ == '__main__':
main()<|fim_prefix|># repo: vipliujunjie/HouseCore path: /Python_Study/2课堂练习/Python就业班/08-先绑定端口然后再循环发送.py
import socket
def main():
#创建一个udp套接字
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
<|fim_middle|> # 绑定本地信息
udp_sock... | code_fim | hard | {
"lang": "python",
"repo": "vipliujunjie/HouseCore",
"path": "/Python_Study/2课堂练习/Python就业班/08-先绑定端口然后再循环发送.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PSY31170CCNY/PSY31170Python path: /blackjack.py
#blackjack.py
from random import shuffle
#import random
# WARNING: THIS PROGRAM CONTAINS MANY ERRORS
# AND MAY NOT SATISFY THE ASSIGNMENT REQUIREMENTS!!
# make a function that counts up the cards in a hand
def countup(hand=[]):
ace=False
t... | code_fim | hard | {
"lang": "python",
"repo": "PSY31170CCNY/PSY31170Python",
"path": "/blackjack.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># initialize variables
playerwins=0
playerloses =0
cards=[]
suits=["hearts","spades","diamonds","clubs"]
numbers=["Ace","King","Queen","Jack","10","9","8","7","6","5","4","3","2"]
for suit in range(len(suits)):
for num in range(len(numbers)):
cards.append((numbers[num]," of ", suits[suit]))
... | code_fim | hard | {
"lang": "python",
"repo": "PSY31170CCNY/PSY31170Python",
"path": "/blackjack.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>sns.boxplot(x="size", y="qe", hue="algo", data=data)
plt.ylabel("Mean quantization error")
plt.xlabel("Grid size of SOM")
plt.savefig("output/4-flowsom-cmp/quantization_error_boxplot.png")
plt.close()<|fim_prefix|># repo: xiamaz/flowCat path: /scripts/46_som_comparison_boxplots.py
import matplotlib as mp... | code_fim | hard | {
"lang": "python",
"repo": "xiamaz/flowCat",
"path": "/scripts/46_som_comparison_boxplots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # multi = 10
# while n // 26 != 0:
# multi *= 10
while True:
div, mod = divmod(n, 26)
if mod == 0:
d, m = 26, 26
else:
d, m = div, mod
print(d, m, div)
if div == 0:
... | code_fim | hard | {
"lang": "python",
"repo": "hotheat/LeetCode",
"path": "/168. Excel Sheet Column Title/168.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.