text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: raghavkishan/Bio-informatics---python path: /q51.py
from Bio.Seq import Seq #Using Biopython to find the reverse complement.
f = open("rosalind_dbru.txt","r") #extracting the input from a file.
inputv = f.readlines()
s = []
for i in inputv:
s.append(i.strip())
s... | code_fim | medium | {
"lang": "python",
"repo": "raghavkishan/Bio-informatics---python",
"path": "/q51.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for (a,b) in sorted(result): #displaying the result.
print '(%s, %s)' %(a,b)<|fim_prefix|># repo: raghavkishan/Bio-informatics---python path: /q51.py
from Bio.Seq import Seq #Using Biopython to find the reverse complement.
f = open("rosalind_dbru.txt","r") #ex... | code_fim | hard | {
"lang": "python",
"repo": "raghavkishan/Bio-informatics---python",
"path": "/q51.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ret = {}
for key, url_name in api_root_dict.items():
ret[key] = reverse(url_name, request=request, format=format)
return Response(ret)
return APIRoot.as_view()<|fim_prefix|># repo: MouvementY/y-engine path: /yengine/apps/api/rou... | code_fim | medium | {
"lang": "python",
"repo": "MouvementY/y-engine",
"path": "/yengine/apps/api/routers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MouvementY/y-engine path: /yengine/apps/api/routers.py
from rest_framework import views
from rest_framework.routers import DefaultRouter
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.u... | code_fim | hard | {
"lang": "python",
"repo": "MouvementY/y-engine",
"path": "/yengine/apps/api/routers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.__size = size
def get_lockerno(self):
return self.__lockerno
def set_lockerno(self, lockerno):
self.__lockerno = lockerno<|fim_prefix|># repo: StevenZwe/Organizer-Ting path: /Locker.py
class Locker:
def __init__(self, adminno, date, location, size, lockerno):
... | code_fim | hard | {
"lang": "python",
"repo": "StevenZwe/Organizer-Ting",
"path": "/Locker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.__lockerno
def set_lockerno(self, lockerno):
self.__lockerno = lockerno<|fim_prefix|># repo: StevenZwe/Organizer-Ting path: /Locker.py
class Locker:
def __init__(self, adminno, date, location, size, lockerno):
self.__id = ''
self.__adminno = adminno
... | code_fim | hard | {
"lang": "python",
"repo": "StevenZwe/Organizer-Ting",
"path": "/Locker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StevenZwe/Organizer-Ting path: /Locker.py
class Locker:
def __init__(self, adminno, date, location, size, lockerno):
self.__id = ''
self.__adminno = adminno
self.__date = date
self.__location = location
self.__size = size
self.__lockerno = locke... | code_fim | medium | {
"lang": "python",
"repo": "StevenZwe/Organizer-Ting",
"path": "/Locker.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class CeleryErrorRecord(Document):
"""celery执行的错误记录"""
task_id = fields.StringField(verbose_name='celery任务id', require=True, primary_key=True)
full_func = fields.StringField(verbose_name='带路径的方法名,eg: tasks.task_1.test_1')
func_params = fields.DictField(verbose_name='方法参数 {args:(), kwargs:... | code_fim | hard | {
"lang": "python",
"repo": "AIF333/T_celery",
"path": "/hdy_celery/celery_models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AIF333/T_celery path: /hdy_celery/celery_models.py
from mongoengine import Document, fields, connect
from utils import get_timestamp, now_yyyymmddhhmmss
class ControlTypeEnum:
queue = 'queue'
func = 'func'
class ControlValidEnum:
invalid = 0 # 无效
valid = 1 # 有效
class Cont... | code_fim | hard | {
"lang": "python",
"repo": "AIF333/T_celery",
"path": "/hdy_celery/celery_models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """celery的控制模型"""
queue = fields.StringField(verbose_name='任务队列名, eg: inner_quick', require=True)
control_type = fields.StringField(verbose_name='控制类别', require=True, default=ControlTypeEnum.func)
func = fields.StringField(verbose_name='方法名: test_1, 当控制类别为func时必填')
start_time = fields.... | code_fim | hard | {
"lang": "python",
"repo": "AIF333/T_celery",
"path": "/hdy_celery/celery_models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_name_title_text(self):
return self.get_text(self.name_title)<|fim_prefix|># repo: youlijiajiawen/sy1_tongxunlu path: /page/saved_contact_page.py
from selenium.webdriver.common.by import By
<|fim_middle|>from base.base_action import BaseAction
class SavedContactPage(BaseAction):
... | code_fim | medium | {
"lang": "python",
"repo": "youlijiajiawen/sy1_tongxunlu",
"path": "/page/saved_contact_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: youlijiajiawen/sy1_tongxunlu path: /page/saved_contact_page.py
from selenium.webdriver.common.by import By
from base.base_action import BaseAction
class SavedContactPage(BaseAction):
<|fim_suffix|> return self.get_text(self.name_title)<|fim_middle|> name_title = By.ID, "com.android.... | code_fim | medium | {
"lang": "python",
"repo": "youlijiajiawen/sy1_tongxunlu",
"path": "/page/saved_contact_page.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># loop over the AMI values and see which fraction you have in the derivation
# but if you have others that are not in AMI it will be flagged below
nomatch_arr=[] # to avoid listing twice
for daod in daod_arr:
# print '', daod[0]
match=False
for yields in yields_arr:
... | code_fim | hard | {
"lang": "python",
"repo": "yqqxyy/VHbb",
"path": "/CxAODOperations_VHbb/scripts/checkForExtensions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print ""
print "None AMI :"
# if you have others that are not in AMI it will be studied here
# loop over the CxAOD yields
for yields in yields_arr:
match=False
for daod in daod_arr:
if debug:
print "compare",yields[0],"with",daod[0],"and",yie... | code_fim | hard | {
"lang": "python",
"repo": "yqqxyy/VHbb",
"path": "/CxAODOperations_VHbb/scripts/checkForExtensions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yqqxyy/VHbb path: /CxAODOperations_VHbb/scripts/checkForExtensions.py
#!/usr/bin/env python
#
# check percentage of available DAOD events that were used in a production by comparing DxAOD yields (from CxAOD files)
# with the AMI DxAOD yields
# Note on yields files format:
# yields file where 3r... | code_fim | hard | {
"lang": "python",
"repo": "yqqxyy/VHbb",
"path": "/CxAODOperations_VHbb/scripts/checkForExtensions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DurinKhampa/Python-FizzBuzz path: /FizzBuzz.py
# -*- coding: utf-8 -*-
n = 101
for i in range(1,n):
if i%3 == 0 and i%5 != 0:
i = "Fizz"
print(i)
elif i%3 != 0 and i<|fim_suffix|>== 0:
i = "FizzBuzz"
print(i)
else:
print(i)<|fim_middle|>%5 == 0:... | code_fim | medium | {
"lang": "python",
"repo": "DurinKhampa/Python-FizzBuzz",
"path": "/FizzBuzz.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>== 0:
i = "FizzBuzz"
print(i)
else:
print(i)<|fim_prefix|># repo: DurinKhampa/Python-FizzBuzz path: /FizzBuzz.py
# -*- coding: utf-8 -*-
n = 101
for i in range(1,n):
if i%3 == 0 and i%5 != 0:
i = "Fizz"
print(i)
elif i%3 != 0 and i<|fim_middle|>%5 == 0:... | code_fim | medium | {
"lang": "python",
"repo": "DurinKhampa/Python-FizzBuzz",
"path": "/FizzBuzz.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
try:
config = "../../../configures/image_conf/image.conf"
cf = ConfigParser.ConfigParser()
cf.read(config)
if method[1] == "baidu":
url["url"] = cf.get("baidu", "url")
elif method[1] == "sougou... | code_fim | hard | {
"lang": "python",
"repo": "liqing233/spider",
"path": "/lib/core/image/get_conf.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liqing233/spider path: /lib/core/image/get_conf.py
#!user/bin/env python
"""
Created on 2015/7/21
Author:LiQing
QQ:626924971
Tel:*********
Function:get spider conf
"""
import os
import ConfigParser
import xml.dom.minidom
from logger import logger
class get_conf():
@classmethod
def fin... | code_fim | hard | {
"lang": "python",
"repo": "liqing233/spider",
"path": "/lib/core/image/get_conf.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>= "common":
for http_header in http_headers:
if http_header.getAttribute("name") == "common":
header["Accept"] = http_header.getElementsByTagName('Accept')[0].childNodes[0].data.encode("utf-8")
header["Acce... | code_fim | hard | {
"lang": "python",
"repo": "liqing233/spider",
"path": "/lib/core/image/get_conf.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _shuffle_bin_counts(
MAX_N_POSITION_BINS, position_unsynced, position_synced,
frames_to_include, im_period, behav_period, true_starts,
true_ends, transient_responses, n_bootstraps, n_processes,
initial_counts):
"""Create shuffled versions of transient and obs... | code_fim | hard | {
"lang": "python",
"repo": "tgeiller/Zaremba_NatNeurosci_2017",
"path": "/losonczy_analysis_bundle/lab/analysis/identify_place_fields.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tgeiller/Zaremba_NatNeurosci_2017 path: /losonczy_analysis_bundle/lab/analysis/identify_place_fields.py
.round(frame * framePeriod / behav_period))
end = int(np.round((frame + 1) * framePeriod / behav_period))
position_array = position_unsynced[idx][start:end]
... | code_fim | hard | {
"lang": "python",
"repo": "tgeiller/Zaremba_NatNeurosci_2017",
"path": "/losonczy_analysis_bundle/lab/analysis/identify_place_fields.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> A = initial_matrix(grammar, "((()())())")
#print A
P = A
n = int(math.sqrt(len(A.item)))
for i in range(int(math.sqrt(len(A.item)))):
P = P + P*P
#print P.item[P.idx(0,n-1)]
for tree in P.item[P.idx(0,n-1)].item:
print XSemiring.dot(tree)<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "leegao/MatrixParser",
"path": "/Parser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leegao/MatrixParser path: /Parser.py
__author__ = 'Lee'
import Semiring, XSemiring, MatrixRing
def initial_matrix(cnf, words):
X = XSemiring.XSemiringFactory.constructor(cnf)
n = len(words) + 1
f = lambda i,j: X.lift(set([])) if i != j + 1 else X.lift({(cnf.term_of(words[j]),)})
... | code_fim | hard | {
"lang": "python",
"repo": "leegao/MatrixParser",
"path": "/Parser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> old = ax.scatter3D(p.timestep, p.identifier, p.temperature, marker='o', edgecolor='black',
color=cmap_c[0])
return old
oparticles = particles[['timestep','x','y','z_meters', 'identifier', 'image']]
particles = particles[['timestep','identifier','temperature']]
# --- func... | code_fim | hard | {
"lang": "python",
"repo": "sourceryinstitute/coarray_icar",
"path": "/data/temperature_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ax.scatter(particles.timestep, particles.identifier, particles.temperature,
cmap=discrete_cmap, c=particles.identifier)
# marker='.', edgecolor='black')
# color=cmap_c[0])
i = 0
# print(len(ax.get_yticklabels()))
# ax.get_xaxis().set_visible(False)
# ax.get_y... | code_fim | hard | {
"lang": "python",
"repo": "sourceryinstitute/coarray_icar",
"path": "/data/temperature_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jacky195/demo_feeds_reader path: /server/api/admin/urls_feed.py
from django.urls import include
from django.conf.ur<|fim_suffix|>rl(r'^getAllSources$', views_feed.get_all_sources)
]<|fim_middle|>ls import url
from api.admin import views_feed
urlpatterns = [
url(r'^$', views_feed.main),
u | code_fim | medium | {
"lang": "python",
"repo": "Jacky195/demo_feeds_reader",
"path": "/server/api/admin/urls_feed.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>rl(r'^getAllSources$', views_feed.get_all_sources)
]<|fim_prefix|># repo: Jacky195/demo_feeds_reader path: /server/api/admin/urls_feed.py
from django.urls import include
from django.conf.ur<|fim_middle|>ls import url
from api.admin import views_feed
urlpatterns = [
url(r'^$', views_feed.main),
u | code_fim | medium | {
"lang": "python",
"repo": "Jacky195/demo_feeds_reader",
"path": "/server/api/admin/urls_feed.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>patterns = [
url(r'^$', views_feed.main),
url(r'^getAllSources$', views_feed.get_all_sources)
]<|fim_prefix|># repo: Jacky195/demo_feeds_reader path: /server/api/admin/urls_feed.py
from django.urls import include
from django.conf.ur<|fim_middle|>ls import url
from api.admin import views_feed
url | code_fim | easy | {
"lang": "python",
"repo": "Jacky195/demo_feeds_reader",
"path": "/server/api/admin/urls_feed.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> exp_vote=exp_vote,
want_vote=want_vote,
))
resp.set_cookie('voter_id', voter_id)
return resp
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80, debug=True, threaded=True)<|fim_prefix|># repo: mjbright/example-voting-app path: /vote/app.py
from flask import Flask... | code_fim | medium | {
"lang": "python",
"repo": "mjbright/example-voting-app",
"path": "/vote/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HYonlin-e/scrapy-bloomfilter path: /scrapy_bloomfilter/scrapy_bloomfilter/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
<|fim_suffix|> # define the fields for you... | code_fim | medium | {
"lang": "python",
"repo": "HYonlin-e/scrapy-bloomfilter",
"path": "/scrapy_bloomfilter/scrapy_bloomfilter/items.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
source_url = scrapy.Field()
thumb = scrapy.Field()
title = scrapy.Field()
author = scrapy.Field()
release_time = scrapy.Field()
content = scrapy.Field()
inner_imgs = scrapy.Field()<|fim_prefix|># repo: HYonlin-e/scrapy-bloomfilter path: /scrapy_bloomfilter/scrapy_bloomfilter/... | code_fim | medium | {
"lang": "python",
"repo": "HYonlin-e/scrapy-bloomfilter",
"path": "/scrapy_bloomfilter/scrapy_bloomfilter/items.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sounak1407/Games-Website path: /quiz/migrations/0006_alter_home_url.py
# Generated by Django 3.2 on 2021-05-02 04:49
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='home',
name='url',
field=models.URLField(default='https://adoring-h... | code_fim | medium | {
"lang": "python",
"repo": "sounak1407/Games-Website",
"path": "/quiz/migrations/0006_alter_home_url.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='home',
name='url',
field=models.URLField(default='https://adoring-hawking-6d5afd.netlify.app/', max_length=210),
),
]<|fim_prefix|># repo: sounak1407/Games-Website path: /quiz/migrations/0006_alt... | code_fim | medium | {
"lang": "python",
"repo": "sounak1407/Games-Website",
"path": "/quiz/migrations/0006_alter_home_url.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('quiz', '0005_auto_20210501_1348'),
]
operations = [
migrations.AlterField(
model_name='home',
name='url',
field=models.URLField(default='https://adoring-hawking-6d5afd.netlify.app/', max_length=210),
),
]<|fim... | code_fim | medium | {
"lang": "python",
"repo": "sounak1407/Games-Website",
"path": "/quiz/migrations/0006_alter_home_url.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>bot = Bot(command_prefix="!")
@bot.event
async def on_ready():
logger.info(f"bot is ready ----------")
await bot.load_extension("cogs.Manager")
bot.run(DISCORD_TOKEN)<|fim_prefix|># repo: Mio-coder/DiscordBot path: /main.py
import logging
from logging import Formatter, FileHandler, StreamHand... | code_fim | hard | {
"lang": "python",
"repo": "Mio-coder/DiscordBot",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mio-coder/DiscordBot path: /main.py
import logging
from logging import Formatter, FileHandler, StreamHandler
from os import environ
from sys import stdout
from discord.ext.commands import Bot
from dotenv import load_dotenv
load_dotenv()
DISCORD_TOKEN = environ["DISCORD_TOKEN"]
logger = logging... | code_fim | medium | {
"lang": "python",
"repo": "Mio-coder/DiscordBot",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> answer = 0
for index in range(length):
if digits_list[index] == digits_list[index+step]:
answer += int(digits_list[index])
return answer
if __name__ == "__main__":
import doctest
doctest.testmod()<|fim_prefix|># repo: f1sty/aoc2017_python path: /day1.py
# -*- c... | code_fim | hard | {
"lang": "python",
"repo": "f1sty/aoc2017_python",
"path": "/day1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: f1sty/aoc2017_python path: /day1.py
# -*- coding: utf-8 -*-
"""
URL: http://adventofcode.com/2017/day/1
Part 1:
The captcha requires you to review a sequence of digits (your puzzle input)
and find the sum of all digits that match the next digit in the list.
The list is circular, so the digit aft... | code_fim | hard | {
"lang": "python",
"repo": "f1sty/aoc2017_python",
"path": "/day1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> digits_list = []
for _ in range(length + step):
digits_list.append(next(digits))
answer = 0
for index in range(length):
if digits_list[index] == digits_list[index+step]:
answer += int(digits_list[index])
return answer
if __name__ == "__main__":
imp... | code_fim | medium | {
"lang": "python",
"repo": "f1sty/aoc2017_python",
"path": "/day1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AustinZhu/cscelab-chatroom path: /server/server.py
#ZHU Yiming; ZHENG Nianzhao; MAO Zhenyu
import asyncio
import logging
import socket
from router import Router
class Session:
<|fim_suffix|>
class HttpServer:
HTTP_HOST = "127.0.0.1"
HTTP_PORT = 8080
@classmethod
async def ser... | code_fim | medium | {
"lang": "python",
"repo": "AustinZhu/cscelab-chatroom",
"path": "/server/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class HttpServer:
HTTP_HOST = "127.0.0.1"
HTTP_PORT = 8080
@classmethod
async def serve(cls):
http_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
http_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
http_socket.bind((cls.HTTP_HOST, cls.HTT... | code_fim | medium | {
"lang": "python",
"repo": "AustinZhu/cscelab-chatroom",
"path": "/server/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hydroo/coding-and-math-exercises path: /project-euler/27.py
#! /usr/bin/python
from math import sqrt
def prime(n) :
<|fim_suffix|> for b in range(-999,1000,2) :
c = 0
for n in range(0,1000) :
if prime(n*n+a*n+b) == True :
c = c + 1
if c > cc :
aa = a
bb = b
cc = c
pr... | code_fim | medium | {
"lang": "python",
"repo": "hydroo/coding-and-math-exercises",
"path": "/project-euler/27.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> c = 0
for n in range(0,1000) :
if prime(n*n+a*n+b) == True :
c = c + 1
if c > cc :
aa = a
bb = b
cc = c
print aa,bb,cc
print a<|fim_prefix|># repo: hydroo/coding-and-math-exercises path: /project-euler/27.py
#! /usr/bin/python
from math import sqrt
def prime(n) :
if n < ... | code_fim | medium | {
"lang": "python",
"repo": "hydroo/coding-and-math-exercises",
"path": "/project-euler/27.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>stu1 = Student('Jack')
stu2 = Student('李四')
s = stu1 + stu2 #实现了两个对象的加法运算(因为在Student类中编写__add__()特殊的方法)
print(s)
s = stu1.__add__(stu2)
print(s)
print('---------------------------')
lst = [1, 2, 3, 4]
print(len(lst)) #len是内容函数len
print(lst.__len__())
print(len(stu1))<|fim_prefix|># repo... | code_fim | medium | {
"lang": "python",
"repo": "huwanping001/Python",
"path": "/chapter13/demo9.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huwanping001/Python path: /chapter13/demo9.py
# 学校:四川轻化工大学
# 学院:自信学院
# 学生:胡万平
# 开发时间:2021/10/7 14:23
'''add () 通过重写 add ()方法,可使用自定义对象具有“+”功能
通过重写 len ()方法,让内置函数len()的参数可以是白定义类型
'''
a = 20
b = 100
c =a + b #两个整数类型的对象的相加操作
d = a.__add__(b)
print(c)
print(d)
<|fim_suffix|> ... | code_fim | medium | {
"lang": "python",
"repo": "huwanping001/Python",
"path": "/chapter13/demo9.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aemxander/scientific-computing-course path: /Assignment 1/assignment 1.py
import math
import cv2
import numpy
def multiply_matrices(array1, array2):
if (array1.shape[1] == array2.shape[0]):
rows = array1.shape[0]
columns = array2.shape[1]
product = numpy.zeros((rows... | code_fim | hard | {
"lang": "python",
"repo": "Aemxander/scientific-computing-course",
"path": "/Assignment 1/assignment 1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return color_error_value
def rounding_error(border_image, rotated_image, theta_degrees):
new_columns = border_image.shape[1] # gets width from image
new_rows = border_image.shape[0] # gets height from image
error_sum = float(0)
theta_radians = theta_degrees * (math.pi / 180)
... | code_fim | hard | {
"lang": "python",
"repo": "Aemxander/scientific-computing-course",
"path": "/Assignment 1/assignment 1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RocketMirror/AtCoder_Practice path: /collin.py
import itertools
import math
l = []
n = int(input())
for i in range (n):
xy = list(map (int,input().split()))
l.append(xy)
com = list(itertools.combinations(l, 3))
for j in range (n*(n-1)*(n-2)//6):
if com[j][0][0] - com[j][1][0] == 0... | code_fim | hard | {
"lang": "python",
"repo": "RocketMirror/AtCoder_Practice",
"path": "/collin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if ys[l] == round(a*xs[l] + b, 10):
point += 1
if point == 3:
print('Yes')
exit()
if point != 3 :
print('No')<|fim_prefix|># repo: RocketMirror/AtCoder_Practice path: /collin.py
import itertools
import math
l = []
n = int(input())
... | code_fim | hard | {
"lang": "python",
"repo": "RocketMirror/AtCoder_Practice",
"path": "/collin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrishna1/text_classification-on-yelp-review-dataset path: /classify.py
import json as j
import pandas as pd
import re
import numpy as np
import nltk
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.sv... | code_fim | hard | {
"lang": "python",
"repo": "chrishna1/text_classification-on-yelp-review-dataset",
"path": "/classify.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pipeline = Pipeline([('vect',TfidfVectorizer(ngram_range = (1,2), stop_words = "english", sublinear_tf = True)),
('chi',SelectKBest(chi2, k = 10000)),
('clf',LinearSVC(C = 1.0, penalty = 'l1', max_iter = 3000, dual = False))])
model = pipeline.fit(X_train,y_train... | code_fim | hard | {
"lang": "python",
"repo": "chrishna1/text_classification-on-yelp-review-dataset",
"path": "/classify.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asheek87/DeepLearning path: /TIPP_DLF_Q2.py
#%%
from ImgManager import ImgManager
from CNNModel import CNNModel
from Analyser import Analyser
import warnings
import pandas as pd
import time
import numpy as np
output2='output_Q2/'
warnings.filterwarnings('ignore')
#%%
imgMan=ImgManager(testSize=0.... | code_fim | hard | {
"lang": "python",
"repo": "asheek87/DeepLearning",
"path": "/TIPP_DLF_Q2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> actual = np.argmax(y_Val[index])
actualStr=imgMan.getStrKeyFromVal(actual)
prob = network.predict(np.expand_dims(anImage, axis=0))
predictIndx = np.argmax(prob)
predictStr=imgMan.getStrKeyFromVal(predictIndx)
if actualStr !=predictStr:
# print(actual)
# print(pred... | code_fim | hard | {
"lang": "python",
"repo": "asheek87/DeepLearning",
"path": "/TIPP_DLF_Q2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: monasaad/CAPEsFinal path: /Website/env/Lib/site-packages/spacy/lang/et/stop_words.py
# coding: utf8
from __future__ import unicode_literals
<|fim_suffix|>STOP_WORDS = set(
"""
aga
ei
et
ja
jah
kas
kui
kõik
ma
me
mida
midagi
mind
minu
mis
mu
mul
mulle
nad
nii
oled
ol... | code_fim | medium | {
"lang": "python",
"repo": "monasaad/CAPEsFinal",
"path": "/Website/env/Lib/site-packages/spacy/lang/et/stop_words.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>STOP_WORDS = set(
"""
aga
ei
et
ja
jah
kas
kui
kõik
ma
me
mida
midagi
mind
minu
mis
mu
mul
mulle
nad
nii
oled
olen
oli
oma
on
pole
sa
seda
see
selle
siin
siis
ta
te
ära
""".split()
)<|fim_prefix|># repo: monasaad/CAPEsFinal path: /Website/env/Lib/site-packages/sp... | code_fim | medium | {
"lang": "python",
"repo": "monasaad/CAPEsFinal",
"path": "/Website/env/Lib/site-packages/spacy/lang/et/stop_words.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SamanthaChia/PythonTutorial path: /exercise_dictionary3.py
#6-8
dog = {
'name': 'pugmaw',
'owner': 'ahri'
}
cat = {
'name': 'neeko',
'owner': 'khazix'
}
hamster = {
'name': 'bard',
'owner': 'lucian'
}
#6-9
pets = []
<|fim_suffix|>for city_name,city_info in cities.items()... | code_fim | hard | {
"lang": "python",
"repo": "SamanthaChia/PythonTutorial",
"path": "/exercise_dictionary3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for city_name,city_info in cities.items():
print(city_name + " is a city in " + city_info['country'] +
" with a population of " + str(city_info['population']) +
" and heres one fact : " + city_info['fact'] )<|fim_prefix|># repo: SamanthaChia/PythonTutorial path: /exercise_dictionary3.py
#6-... | code_fim | hard | {
"lang": "python",
"repo": "SamanthaChia/PythonTutorial",
"path": "/exercise_dictionary3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pets.append(dog)
pets.append(cat)
pets.append(hamster)
# for pet in pets:
# print(pet)
favorite_places = {
'sam': 'japan',
'amumu': 'egypt',
'owen': 'home'
}
# for name,favorite_place in favorite_places.items():
# print(name + "'s favorite place is : " + favorite_place)
#6-11
citie... | code_fim | medium | {
"lang": "python",
"repo": "SamanthaChia/PythonTutorial",
"path": "/exercise_dictionary3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def generate_input() -> Iterator[list[list[int]]]:
with open("d8/input.txt", "r") as f:
for chunk in _split(f.read(), 25 * 6):
yield _create_layer(chunk, 25, 6)
def count(layer: list[list[int]], pixel: int) -> int:
total = 0
for row in layer:
for cell in row:
... | code_fim | hard | {
"lang": "python",
"repo": "Jamie-Chang/advent2019",
"path": "/d8/p1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def count(layer: list[list[int]], pixel: int) -> int:
total = 0
for row in layer:
for cell in row:
if cell == pixel:
total += 1
return total
if __name__ == "__main__":
layer, _ = min(
((layer, count(layer, 0)) for layer in generate_input()), k... | code_fim | hard | {
"lang": "python",
"repo": "Jamie-Chang/advent2019",
"path": "/d8/p1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jamie-Chang/advent2019 path: /d8/p1.py
from __future__ import annotations
from typing import Iterator
def _split(string: str, split_size: int) -> Iterator[str]:
for i in range(0, len(string), split_size):
yield string[i : i + split_size]
def _create_layer(string: str, width: int,... | code_fim | medium | {
"lang": "python",
"repo": "Jamie-Chang/advent2019",
"path": "/d8/p1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:param comb:
:param ns:
:param lock:
:return:
"""
nb_batch = int(len(ns.X_manu_train) / comb['batch_size'])
if len(ns.X_manu_train) % comb['batch_size'] == 0:
nb_batch = nb_batch
else:
nb_batch = nb_batch + 1
cursor = 0
print("Nb batch:", nb_bat... | code_fim | hard | {
"lang": "python",
"repo": "EdNADAUD/NCMForest",
"path": "/src/NCMGridSearch.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EdNADAUD/NCMForest path: /src/NCMGridSearch.py
y_score(y_test, y_test_pred)
if bool_cross:
cross_val = cross_val_score(clf, X_train, y_train, cv=5, n_jobs=-1)
else:
cross_val = False
if print_f:
print("Score en train : ", round(score_train, 3))
print("S... | code_fim | hard | {
"lang": "python",
"repo": "EdNADAUD/NCMForest",
"path": "/src/NCMGridSearch.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> css code
if col_codes:
print(*col_codes,sep="\n")<|fim_prefix|># repo: StefaniaSferragatta/HackerRankChallenges-ADM_HW1 path: /HACKERRANK_Regrex&Parsing/Hex_colorCode.py
import re
N = int(input())
if N > 0 and N < 50:
for _ in range(N)<|fim_middle|>:
css = input()
... | code_fim | medium | {
"lang": "python",
"repo": "StefaniaSferragatta/HackerRankChallenges-ADM_HW1",
"path": "/HACKERRANK_Regrex&Parsing/Hex_colorCode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StefaniaSferragatta/HackerRankChallenges-ADM_HW1 path: /HACKERRANK_Regrex&Parsing/Hex_colorCode.py
import re
N = int(input())
if N > 0 and N < 50:
for _ in range(N):
css = input()
col_codes = re.findall(r".(#[0-9A-Fa-f<|fim_suffix|> css code
if col_codes:
p... | code_fim | medium | {
"lang": "python",
"repo": "StefaniaSferragatta/HackerRankChallenges-ADM_HW1",
"path": "/HACKERRANK_Regrex&Parsing/Hex_colorCode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gonzalo77-hub/Django_Exam_coding_dojo path: /app_examen/migrations/0001_initial.py
# Generated by Django 3.2.5 on 2021-09-07 22:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
<|fim_suffix|> operations ... | code_fim | hard | {
"lang": "python",
"repo": "Gonzalo77-hub/Django_Exam_coding_dojo",
"path": "/app_examen/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Alex92rus/funkyBlue path: /funky_blue.py
import arcade
from arcade import Sprite, Texture, SpriteList
import math
from bounce_dot_sprite import BounceDotSprite
SCREEN_WIDTH = 600
DOT_SIDE_LENGTH = 20
SCREEN_HEIGHT = 600
SPRITE_SCALING_FUNKY = 0.9
MOVEMENT_SPEED = 5
class MyGame(arcade.Window):
... | code_fim | hard | {
"lang": "python",
"repo": "Alex92rus/funkyBlue",
"path": "/funky_blue.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if symbol == arcade.key.RETURN and self.lives == 0:
self.setup()
if symbol == arcade.key.LEFT and self.current_Funky.left > 0:
self.current_Funky.change_x = -MOVEMENT_SPEED if self.current_Funky.left > MOVEMENT_SPEED else - self.current_Funky.left
elif symbo... | code_fim | hard | {
"lang": "python",
"repo": "Alex92rus/funkyBlue",
"path": "/funky_blue.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='profile',
name='notifications',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='feedpage.Notification'),
preserve_default=False,
),
]<|fim_prefix|># r... | code_fim | medium | {
"lang": "python",
"repo": "zigsong/lovecast",
"path": "/feedpage/migrations/0055_profile_notifications.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zigsong/lovecast path: /feedpage/migrations/0055_profile_notifications.py
# Generated by Django 2.2.3 on 2019-08-17 11:18
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> operations = [
migrations.AddField(
model_name='profile',
... | code_fim | medium | {
"lang": "python",
"repo": "zigsong/lovecast",
"path": "/feedpage/migrations/0055_profile_notifications.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> = something * number
# something *= number<|fim_prefix|># repo: mollywood/may_3 path: /factorial.py
test_num = int(input("Input a number: "))
result = 1
for number in range(test_num, 0,-1):
<|fim_middle|> result *= number
print(result)
#something | code_fim | easy | {
"lang": "python",
"repo": "mollywood/may_3",
"path": "/factorial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mollywood/may_3 path: /factorial.py
test_num = int(input("Input a number: "))
resu<|fim_suffix|> = something * number
# something *= number<|fim_middle|>lt = 1
for number in range(test_num, 0,-1):
result *= number
print(result)
#something | code_fim | medium | {
"lang": "python",
"repo": "mollywood/may_3",
"path": "/factorial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erickramer/recoapp path: /create_db.py
from recoapp import app, db
import recoapp.models
import pandas as pd
import re
import urllib
import zipfile
def extract_year(x):
year = re.search("[12][0-9][0-9][0-9]", x)
if year:
title = re.sub("[ \t]+\(.+\)", "", x)
return title... | code_fim | medium | {
"lang": "python",
"repo": "erickramer/recoapp",
"path": "/create_db.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>db.drop_all()
db.create_all()
for movie_id, x, liked in movies.itertuples():
title, year = extract_year(x)
movie = recoapp.models.Movie(movie_id, title, year, liked)
try:
db.session.add(movie)
db.session.commit()
except:
print "A problem with: ",
print m... | code_fim | hard | {
"lang": "python",
"repo": "erickramer/recoapp",
"path": "/create_db.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LydiaMF/dc2019 path: /scripts/M100_combine2.py
# Use the new CASA5 QAC smaller bench data to run the M100 combination
# Takes about 18-20' to run. Fills about 3.3GB but needs quite a bit more scratch space to run.
#
# curl http://admit.astro.umd.edu/~teuben/QAC/qac_bench5.tar.gz | tar zxf -
#
... | code_fim | hard | {
"lang": "python",
"repo": "LydiaMF/dc2019",
"path": "/scripts/M100_combine2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>os.system('rm -rf M100_combine_CO_cube.pb.1ch.subim')
imsubimage(imagename='M100_combine_CO_cube.pb.subim',
outfile='M100_combine_CO_cube.pb.1ch.subim',
chans='35')
os.system('rm -rf M100_Feather_CO.image.mom0.pbcor')
immath(imagename=['M100_Feather_CO.image.mom0',
... | code_fim | hard | {
"lang": "python",
"repo": "LydiaMF/dc2019",
"path": "/scripts/M100_combine2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def start(self):
self.socketConnect()
thread_receive=threading.Thread(target=self.socketReceive)
thread_receive.start()
self.socketSend()
def closeSocket(self):
self.client_socket.close()
if __name__=='__main__':
address='www.fyc.pub'
port=5004
print 'Please input your nickna... | code_fim | hard | {
"lang": "python",
"repo": "FrankYanCheng/Python-Socket",
"path": "/sync/tcp_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.client_socket.close()
if __name__=='__main__':
address='www.fyc.pub'
port=5004
print 'Please input your nickname.......'
nickname=raw_input()
client=Client(address,port,nickname)
try:
client.start()
except:
client.closeSocket()<|fim_prefix|># repo: FrankYanCheng/Python-Socket... | code_fim | hard | {
"lang": "python",
"repo": "FrankYanCheng/Python-Socket",
"path": "/sync/tcp_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FrankYanCheng/Python-Socket path: /sync/tcp_client.py
#coding:utf8
import socket
import time
import threading
class Client:
def __init__(self,address,port,nickname):
self.address=address
self.port=port
self.client_socket=None
self.nickname=nickname
def socketConnect(sel... | code_fim | medium | {
"lang": "python",
"repo": "FrankYanCheng/Python-Socket",
"path": "/sync/tcp_client.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def import_data(self):
f = open(os.path.abspath('export') + "/" + self.__filename, "a")
for k, v in self.__data.items():
f.write(str(k) + ": " + str(v) + "\n")
return 'ok'<|fim_prefix|># repo: vumanskyi/scan_page path: /scanpages/export.py
import os
class Export... | code_fim | easy | {
"lang": "python",
"repo": "vumanskyi/scan_page",
"path": "/scanpages/export.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.__filename
def get_data(self):
return self.__data
def import_data(self):
f = open(os.path.abspath('export') + "/" + self.__filename, "a")
for k, v in self.__data.items():
f.write(str(k) + ": " + str(v) + "\n")
return 'ok'<|fim_pre... | code_fim | medium | {
"lang": "python",
"repo": "vumanskyi/scan_page",
"path": "/scanpages/export.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vumanskyi/scan_page path: /scanpages/export.py
import os
class Export:
def __init__(self, filename, data):
self.__filename = filename
self.__data = data
def get_filename(self):
return self.__filename
def get_data(self):
<|fim_suffix|> def import_data(sel... | code_fim | easy | {
"lang": "python",
"repo": "vumanskyi/scan_page",
"path": "/scanpages/export.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gititsan/codingame-1 path: /puzzles/medium/dwarfs_standing_on_the_shoulders_of_giants/solution.py
import sys
import math
graph = {}
n = int(input())
for i in range(n):
x, y = [int(j) for j in input().split()]
graph.setdefault(x,[]).append(y)
<|fim_suffix|>longest = 1
for node in graph:... | code_fim | hard | {
"lang": "python",
"repo": "gititsan/codingame-1",
"path": "/puzzles/medium/dwarfs_standing_on_the_shoulders_of_giants/solution.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>longest = 1
for node in graph:
l = find_length(node)
if longest <= l:
longest = l
print(longest)<|fim_prefix|># repo: gititsan/codingame-1 path: /puzzles/medium/dwarfs_standing_on_the_shoulders_of_giants/solution.py
import sys
import math
graph = {}
n = int(input())
for i in range(n):
... | code_fim | medium | {
"lang": "python",
"repo": "gititsan/codingame-1",
"path": "/puzzles/medium/dwarfs_standing_on_the_shoulders_of_giants/solution.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: szymonszoldra/www path: /blog/models.py
from django.db import models
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel
from wagtail.core.fields import ... | code_fim | hard | {
"lang": "python",
"repo": "szymonszoldra/www",
"path": "/blog/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> settings_panels = SFIPage.settings_panels + [
PageChooserPanel('redirect_to'),
]
parent_page_types = ['PostIndex']
subpage_types = []
def serve(self, request, *args, **kwargs):
if self.redirect_to:
return redirect(self.redirect_to.url)
return super... | code_fim | hard | {
"lang": "python",
"repo": "szymonszoldra/www",
"path": "/blog/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> content = RichTextField(verbose_name=_('content'))
date = models.DateTimeField(default=timezone.now, verbose_name=_('post date'))
redirect_to = models.ForeignKey(
"wagtailcore.Page",
null=True,
blank=True,
related_name="+",
on_delete=models.PROTECT,
... | code_fim | hard | {
"lang": "python",
"repo": "szymonszoldra/www",
"path": "/blog/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dattas1234/demo path: /datta.py
for a in range(1,4,2):
print(a)
else:
print("datta")
for x in range(2): #hii this datta
pass
print("its working")
def fun(*args):
for a in args:
print(a)
fun("datta","kakkad")
def fun4(*kwargs):
print(kwargs[0:2])
print(kwargs[1])
... | code_fim | hard | {
"lang": "python",
"repo": "dattas1234/demo",
"path": "/datta.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("heiiii!!!!! it's working")
objc=child("kedar","Tandle",2022)
print(objc.fname)
print(objc.graduationyear)
objd=child("datta","soat",2022)
print(objd.fname)
print(objd.graduationyear)
objd.welcome()
mytup=(23,32,44,45,5)
myit=iter(mytup)
print(next(myit))
print(next(myit))
print(next(m... | code_fim | hard | {
"lang": "python",
"repo": "dattas1234/demo",
"path": "/datta.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def print_card(self):
if self.value==14:
return f'[A{self.symbol}]'
elif self.value==13:
return f'[K{self.symbol}]'
elif self.value==12:
return f'[Q{self.symbol}]'
elif self.value==11:
return f'[J{self.symbol}]'
el... | code_fim | easy | {
"lang": "python",
"repo": "omrimeshulami/poker_game",
"path": "/TableSys/CardsSys/Card.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.value==14:
return f'[A{self.symbol}]'
elif self.value==13:
return f'[K{self.symbol}]'
elif self.value==12:
return f'[Q{self.symbol}]'
elif self.value==11:
return f'[J{self.symbol}]'
else:
return f'[... | code_fim | hard | {
"lang": "python",
"repo": "omrimeshulami/poker_game",
"path": "/TableSys/CardsSys/Card.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: omrimeshulami/poker_game path: /TableSys/CardsSys/Card.py
class Card:
def __init__(self, value, symbol):
self.symbol = symbol
self.value = value
<|fim_suffix|> if self.value==14:
return f'[A{self.symbol}]'
elif self.value==13:
return f'[... | code_fim | easy | {
"lang": "python",
"repo": "omrimeshulami/poker_game",
"path": "/TableSys/CardsSys/Card.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wavegeng/monkey path: /Server/ServerManager.py
#!usr/bin/python
# -*- coding:utf-8 -*-
from common.Log import *
from Server import *
from common.DeviceManager import *
import threading
class ServerManager:
def __init__(self):
<|fim_suffix|> for server in self.serverobjects:
... | code_fim | hard | {
"lang": "python",
"repo": "wavegeng/monkey",
"path": "/Server/ServerManager.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def list_devices(self):
for deviceid,device in self.testdevices.iteritems():
server = Server(device)
server.list_connect_devices()<|fim_prefix|># repo: wavegeng/monkey path: /Server/ServerManager.py
#!usr/bin/python
# -*- coding:utf-8 -*-
from common.Log import *
from... | code_fim | medium | {
"lang": "python",
"repo": "wavegeng/monkey",
"path": "/Server/ServerManager.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luptior/pyDcop path: /pydcop/utils/graphs.py
# BSD-3-Clause License
#
# Copyright 2017 Orange
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the ... | code_fim | hard | {
"lang": "python",
"repo": "luptior/pyDcop",
"path": "/pydcop/utils/graphs.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Build a networkx graph object from variables and relations.
Parameters
----------
variables: list
a list of Variable objets
relations: list
a list of Relation objects
Returns
-------
a networkx graph object
"""
graph = nx.Graph()
# One... | code_fim | hard | {
"lang": "python",
"repo": "luptior/pyDcop",
"path": "/pydcop/utils/graphs.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaiwenT/ksci_bdc path: /models/feature111_cnn.py
import tensorflow as tf
import numpy as np
import pandas as pd
tf.logging.set_verbosity(tf.logging.INFO)
# 模型定义
def cnn_model_fn(features, labels, mode):
# 输入层 3x23 ,通道1
input_layer = tf.reshape(features['x'], [-1, 111, 1])
# input_la... | code_fim | hard | {
"lang": "python",
"repo": "kaiwenT/ksci_bdc",
"path": "/models/feature111_cnn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# 模型训练
def train():
train_xy = pd.read_csv('G:/dataset/a3d6_chusai_a_train/dealt_data/train_test/train.csv')
# print(train_xy.columns)
train_data = train_xy.drop(['user_id', 'label'], axis=1)
train_xy['label'].fillna(1, inplace=True)
train_labels = train_xy['label']
print(len(trai... | code_fim | hard | {
"lang": "python",
"repo": "kaiwenT/ksci_bdc",
"path": "/models/feature111_cnn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arc-arnob/Healthe-master path: /backend/core/MlDiagnosis/django_api/diabetesEnv/diabetesApi/models.py
from django.db import models
<|fim_suffix|> return self.glucose<|fim_middle|># Create your models here.
class diagnosis(models.Model):
glucose = models.FloatField()
insulin = mode... | code_fim | hard | {
"lang": "python",
"repo": "arc-arnob/Healthe-master",
"path": "/backend/core/MlDiagnosis/django_api/diabetesEnv/diabetesApi/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.