text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> assert Segment([0, 1 * U_.meter]).is_close(Segment([0, 1], U_.meter))
segment_3 = Segment(np.array([2.5, 6.5]) * U_.sec)
def test_from_center():
segment_1 = Segment(np.array([3, 5]) * U_.meter)
segment_2 = Segment.from_center(4, 1, U_.meter)
segment_3 = Segment.from_center(4, 2, U_.m... | code_fim | hard | {
"lang": "python",
"repo": "tromer/signal_processing",
"path": "/signal_processing/tests/test_segment.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> segment_1 = Segment(np.array([3, 5]) * U_.meter)
segment_2 = Segment.from_center(4, 1, U_.meter)
segment_3 = Segment.from_center(4, 2, U_.meter, mode='width')
segment_4 = Segment.from_center(4, 1, U_.meter, mode='width')
assert segment_1.is_close(segment_2)
assert segment_1.is_clos... | code_fim | medium | {
"lang": "python",
"repo": "tromer/signal_processing",
"path": "/signal_processing/tests/test_segment.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tromer/signal_processing path: /signal_processing/tests/test_segment.py
import numpy as np
from signal_processing import U_
from signal_processing.extensions import pint_extension
from signal_processing.segment import Segment
def test_Segment():
segment_1 = Segment(np.array([3, 5]) * U_.met... | code_fim | medium | {
"lang": "python",
"repo": "tromer/signal_processing",
"path": "/signal_processing/tests/test_segment.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Luky-Jing/OldBoyPython path: /OldBoyPython/urls.py
"""OldBoyPython URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
... | code_fim | hard | {
"lang": "python",
"repo": "Luky-Jing/OldBoyPython",
"path": "/OldBoyPython/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> path("ordered", views.ordered),
path("shopping_car", views.shopping_car),
path("students", views.Students.as_view()),
path("teachers", views.Teachers.as_view()),
path("orders", views.OrdersView.as_view()),
path("api/v1/auth", views.AuthView.as_view()),
path("api/v1/user", vi... | code_fim | medium | {
"lang": "python",
"repo": "Luky-Jing/OldBoyPython",
"path": "/OldBoyPython/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 命名变量
# re_path("^articles/(?P<year>[0-9]{4})/(?P<mouth>[0-9]{2})", views.year_mouth_archive_variable,
# {"year": 2022, "mouth": 20}),
# url别名
# url(r'^func_alias', views.func_alias, name="alias"),
path("ordered", views.ordered),
path("shopping_car", views.shopping_c... | code_fim | hard | {
"lang": "python",
"repo": "Luky-Jing/OldBoyPython",
"path": "/OldBoyPython/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KDjonev/SendEmail path: /EmailOptions.py
#!/usr/bin/python
from argparse import ArgumentParser
from bs4 import BeautifulSoup
import sys
class EmailOptions:
FromAddress = ''
FromAddressPassword = ''
ToAddresses = []
Subject = ''
Body = ''
Attatchments = []
def Load... | code_fim | hard | {
"lang": "python",
"repo": "KDjonev/SendEmail",
"path": "/EmailOptions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Options = Parser.parse_args()
if (not Options.ToAddresses and self.ToAddresses == []):
Parser.print_help()
sys.exit(1)
if (not Options.FromAddress and self.FromAddress == ''):
Parser.print_help()
sys.exit(1)
if (Options.From... | code_fim | hard | {
"lang": "python",
"repo": "KDjonev/SendEmail",
"path": "/EmailOptions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasper-dijkstra/bachelorthesis path: /utilities.py
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 11:12:14 2020
@author: Jasper Dijkstra + 2 functions from Bram Maasakkers
This script contains functions to:
1. Check if directory exists, if not create it
2. List all files in directory... | code_fim | hard | {
"lang": "python",
"repo": "jasper-dijkstra/bachelorthesis",
"path": "/utilities.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters:
mjd: time/date as modified Julian date 2000
Return value:
result: a dictionary with the entries "year", "month", "day", "hour", "minute", "second", "millisecond", "fractional_year"
"""
import calendar
import time
global t
global gmt
global t... | code_fim | hard | {
"lang": "python",
"repo": "jasper-dijkstra/bachelorthesis",
"path": "/utilities.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not source.isbigan:
if self.comboBox_2.currentText ()=="58同城":
t=Tnuls(0)
t.start()
source.isbigan=True
if self.comboBox_2.currentText ()=="中华英才网":
t=Tnuls(1)
t.start()
sourc... | code_fim | hard | {
"lang": "python",
"repo": "wuyubo/spider-Engineer",
"path": "/spider-engineer/note.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wuyubo/spider-Engineer path: /spider-engineer/note.py
import threading
import time
from DataBase import database
from source import source
from threadings import Tnuls
from threads import qthreadt
import threading
import crawler
ustr=""
strl=""
nustr=""
bool=True
urllist=""
... | code_fim | hard | {
"lang": "python",
"repo": "wuyubo/spider-Engineer",
"path": "/spider-engineer/note.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> MainWindow.getdata()
MainWindow.setUpdatesEnabled(False);
MainWindow.setUpdatesEnabled(True);
MainWindow.repaint();
if len(MainWindow.bestlist)>0:
bestlist=MainWindow.bestlist
antext=source.Eanalyze[self.comboBox.currentText ()]
a... | code_fim | hard | {
"lang": "python",
"repo": "wuyubo/spider-Engineer",
"path": "/spider-engineer/note.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> c1= consumer('weipeiqi')
c2= consumer('yuanyao')
c1.__next__()
c2.__next__()
for i in range(10):
time.sleep(1)
c1.send('肉包 %s' %i)
c2.send('肉包 %s' %i)
producer()<|fim_prefix|># repo: dknevermore/-day9---day20 path: /90.生产者消费者模型.py
import time
# def producer():
... | code_fim | medium | {
"lang": "python",
"repo": "dknevermore/-day9---day20",
"path": "/90.生产者消费者模型.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
def consumer(name):
print('我是[%s],我准备吃包子了' %name)
while True :
baozi = yield
time.sleep(1)
print('%s 很开心的把[%s]吃掉了' %(name,baozi))
def producer():
c1= consumer('weipeiqi')
c2= consumer('yuanyao')
c1.__next__()
c2.__next__()
for i in range(10):
... | code_fim | hard | {
"lang": "python",
"repo": "dknevermore/-day9---day20",
"path": "/90.生产者消费者模型.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dknevermore/-day9---day20 path: /90.生产者消费者模型.py
import time
# def producer():
# ret = []
# for i in range(100):
# time.sleep(0.1)
# ret.append(i)
# return ret
#
# def consumer(res):
# for index,baozi in enumerate(res):
# time.sleep(0.1)
# print('第%s... | code_fim | medium | {
"lang": "python",
"repo": "dknevermore/-day9---day20",
"path": "/90.生产者消费者模型.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TrellixVulnTeam/Python-Beginner_5PDW path: /Guess the number.py
import RAnd_num
def guess():
'''
This function is created to generate one random number.
Here we take input from user and compare it with random number
<|fim_suffix|>
while(True):
guess()
print("Press Y to play again\n... | code_fim | hard | {
"lang": "python",
"repo": "TrellixVulnTeam/Python-Beginner_5PDW",
"path": "/Guess the number.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
while(True):
guess()
print("Press Y to play again\nOR\nPress any key ")
k=input()
if k=='Y' or k=='y':
guess()
else:
break<|fim_prefix|># repo: TrellixVulnTeam/Python-Beginner_5PDW path: /Guess the number.py
import RAnd_num
def guess():
'''
This function is crea... | code_fim | hard | {
"lang": "python",
"repo": "TrellixVulnTeam/Python-Beginner_5PDW",
"path": "/Guess the number.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while(True):
guess()
print("Press Y to play again\nOR\nPress any key ")
k=input()
if k=='Y' or k=='y':
guess()
else:
break<|fim_prefix|># repo: TrellixVulnTeam/Python-Beginner_5PDW path: /Guess the number.py
import RAnd_num
def guess():
'''
This function is created... | code_fim | hard | {
"lang": "python",
"repo": "TrellixVulnTeam/Python-Beginner_5PDW",
"path": "/Guess the number.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#upper
x="Hello, My Friend"
print(x.upper())
#replace
x="Hello, My Friend"
print(x.replace("H","M"))
#slpit
x="Hello, My Friend"
print(x.split(","))<|fim_prefix|># repo: LuluwahA/100daysofcode path: /Day 8.py
#strip()
x=" Hello, My Friend "
print(x.strip())
#len()
x="Hello, My Frien... | code_fim | easy | {
"lang": "python",
"repo": "LuluwahA/100daysofcode",
"path": "/Day 8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LuluwahA/100daysofcode path: /Day 8.py
#strip()
x=" Hello, My Friend "
print(x.strip())
<|fim_suffix|>#upper
x="Hello, My Friend"
print(x.upper())
#replace
x="Hello, My Friend"
print(x.replace("H","M"))
#slpit
x="Hello, My Friend"
print(x.split(","))<|fim_middle|>#len()
x="H... | code_fim | medium | {
"lang": "python",
"repo": "LuluwahA/100daysofcode",
"path": "/Day 8.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>mean_dep_delay_df.to_csv(r'D:\<your-path>\Chapter08\mean_dep_delay_df.csv', index=False)<|fim_prefix|># repo: Micseb/Extending-Power-BI-with-Python-and-R path: /Chapter08/Python/02-load-large-dataset-in-power-bi.py
import os
import pandas as pd
import dask.dataframe as dd
main_path = r'D:\data\AirOnTi... | code_fim | medium | {
"lang": "python",
"repo": "Micseb/Extending-Power-BI-with-Python-and-R",
"path": "/Chapter08/Python/02-load-large-dataset-in-power-bi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Micseb/Extending-Power-BI-with-Python-and-R path: /Chapter08/Python/02-load-large-dataset-in-power-bi.py
import os
import pandas as pd
import dask.dataframe as dd
<|fim_suffix|>mean_dep_delay_df = mean_dep_delay_ddf.compute()
mean_dep_delay_df.to_csv(r'D:\<your-path>\Chapter08\mean_dep_delay_... | code_fim | hard | {
"lang": "python",
"repo": "Micseb/Extending-Power-BI-with-Python-and-R",
"path": "/Chapter08/Python/02-load-large-dataset-in-power-bi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangxiaoyuan/practice-python3 path: /3-digits.py
#/usr/bin/env python3.6
# -*- coding:utf-8 -*-
<|fim_suffix|>'''
有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
'''
def func():
r = []
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if (i != j) and j != k and i != k:
r +... | code_fim | easy | {
"lang": "python",
"repo": "zhangxiaoyuan/practice-python3",
"path": "/3-digits.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> r = []
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if (i != j) and j != k and i != k:
r += [i*100 + j*10 + k]
return r
if __name__ == '__main__' :
print("result: ")
print(func())<|fim_prefix|># repo: zhangxiaoyuan/practice-python3 path: /3-digits.py
#/usr/bin/env p... | code_fim | easy | {
"lang": "python",
"repo": "zhangxiaoyuan/practice-python3",
"path": "/3-digits.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def func():
r = []
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if (i != j) and j != k and i != k:
r += [i*100 + j*10 + k]
return r
if __name__ == '__main__' :
print("result: ")
print(func())<|fim_prefix|># repo: zhangxiaoyuan/practice-python3 path: /3-digits.py
#/... | code_fim | medium | {
"lang": "python",
"repo": "zhangxiaoyuan/practice-python3",
"path": "/3-digits.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ttsang529/python_class path: /EX09_08.py
import requests
from bs4 import BeautifulSoup
req = requests.get('http://invoice.etax.nat.gov.tw')
bs = B<|fim_suffix|>d_all('span',{'class':'t18Red'}):
print(i.string)<|fim_middle|>eautifulSoup(req.text,"html.parser")
for i in bs.fin | code_fim | easy | {
"lang": "python",
"repo": "ttsang529/python_class",
"path": "/EX09_08.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>d_all('span',{'class':'t18Red'}):
print(i.string)<|fim_prefix|># repo: ttsang529/python_class path: /EX09_08.py
import requests
from bs4 import BeautifulSoup
req = <|fim_middle|>requests.get('http://invoice.etax.nat.gov.tw')
bs = BeautifulSoup(req.text,"html.parser")
for i in bs.fin | code_fim | medium | {
"lang": "python",
"repo": "ttsang529/python_class",
"path": "/EX09_08.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChavanKarthik/Python path: /python_basics/class_objects01.py
class Computer:
def __init__(self, name, age, height):
self.name = name
self.age = age
self.height = height
print("Name : {}\nAge : {}\nHeight : {}".format(self.name, self.age, self.height))
o... | code_fim | hard | {
"lang": "python",
"repo": "ChavanKarthik/Python",
"path": "/python_basics/class_objects01.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.marks = 540
self.rank = 'First_rank'
sch1 = School()
sch2 = School()
# print(sch1.marks,sch1.rank)<|fim_prefix|># repo: ChavanKarthik/Python path: /python_basics/class_objects01.py
class Computer:
def __init__(self, name, age, height):
self.name = name
self.ag... | code_fim | medium | {
"lang": "python",
"repo": "ChavanKarthik/Python",
"path": "/python_basics/class_objects01.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luola63702168/leetcode path: /greedy_algorithm/ll_01_钞票支付问题.py
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
# Author : rusi_
# 案例描述:
# 这里有几种不同面额的钞票,1元、5元、10元、20元、100元、200元的钞票无穷多张,现在使用这些钞票去支付X元的面额,问最少需要多少张?
# 解决方案:
# 尽可能多的使用面值较大的钞票。
# 例如X=628,我们通常会尝试从面额最大的钞票(200元)开始尝试,此时发现200元的... | code_fim | medium | {
"lang": "python",
"repo": "luola63702168/leetcode",
"path": "/greedy_algorithm/ll_01_钞票支付问题.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
解决钞票支付问题
:return: 多少张钞票
"""
moy = 628
bank_node = [200, 100, 20, 10, 5, 1]
count = 0
for i in range(len(bank_node)):
use = int(moy / bank_node[i])
moy = moy - use * bank_node[i]
count += use
if moy == 0:
break
... | code_fim | medium | {
"lang": "python",
"repo": "luola63702168/leetcode",
"path": "/greedy_algorithm/ll_01_钞票支付问题.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AnupMahat/Schabu path: /back_end/python/test.py
# code
import sys
import azure.cognitiveservices.speech as speechsdk
from azure.cognitiveservices.speech import AudioDataStream, SpeechConfig, SpeechSynthesizer, SpeechSynthesisOutputFormat
from azure.cognitiveservices.speech.audio import AudioOutp... | code_fim | medium | {
"lang": "python",
"repo": "AnupMahat/Schabu",
"path": "/back_end/python/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> speech_config = speechsdk.SpeechConfig(subscription="b58d19e457574aa39bc0f8b9b763cd55", region="australiaeast")
audio_config = AudioOutputConfig(filename="C:/Users/Pranav Patel/Documents/schabu/back_end/python/welcome.wav")
synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=au... | code_fim | medium | {
"lang": "python",
"repo": "AnupMahat/Schabu",
"path": "/back_end/python/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
siamese_config = {
'EMBEDDING_DIM': EMBEDDING_DIM,
'MAX_SEQUENCE_LENGTH' : MAX_SEQUENCE_LENGTH,
'VALIDATION_SPLIT': VALIDATION_SPLIT,
'RATE_DROP_LSTM': RATE_DROP_LSTM,
'RATE_DROP_DENSE': RATE_DROP_DENSE,
'NUMBER_LSTM': NUMBER_LSTM,
'NUMBER_DENSE_UNITS': NUMBER_DENSE_UNITS,
'ACTIVATION_FUNCTION': ... | code_fim | medium | {
"lang": "python",
"repo": "lizaku/CONAN",
"path": "/lstm_siamese/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lizaku/CONAN path: /lstm_siamese/config.py
EMBEDDING_DIM = 100
MAX_SEQUENCE_LENGTH = 50 # 100 or 50
VALIDATION_SPLIT = 0.1
<|fim_suffix|>
siamese_config = {
'EMBEDDING_DIM': EMBEDDING_DIM,
'MAX_SEQUENCE_LENGTH' : MAX_SEQUENCE_LENGTH,
'VALIDATION_SPLIT': VALIDATION_SPLIT,
'RATE_DROP_LSTM':... | code_fim | medium | {
"lang": "python",
"repo": "lizaku/CONAN",
"path": "/lstm_siamese/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>siamese_config = {
'EMBEDDING_DIM': EMBEDDING_DIM,
'MAX_SEQUENCE_LENGTH' : MAX_SEQUENCE_LENGTH,
'VALIDATION_SPLIT': VALIDATION_SPLIT,
'RATE_DROP_LSTM': RATE_DROP_LSTM,
'RATE_DROP_DENSE': RATE_DROP_DENSE,
'NUMBER_LSTM': NUMBER_LSTM,
'NUMBER_DENSE_UNITS': NUMBER_DENSE_UNITS,
'ACTIVATION_FUNCTION': A... | code_fim | medium | {
"lang": "python",
"repo": "lizaku/CONAN",
"path": "/lstm_siamese/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pe_spec: integer | real
Term: factor([mul | div ] factor) *
Factor:
'''<|fim_prefix|># repo: yuzhou346694246/compilerimplement path: /node/simplepascal.py
#simple pascal grammar
'''
Program: program variable; Block
Block:Declarations Compound_statement
Declararations:(Variable_declaration ;)+
<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "yuzhou346694246/compilerimplement",
"path": "/node/simplepascal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuzhou346694246/compilerimplement path: /node/simplepascal.py
#simple pascal grammar
'''
Program: program variable; Block
Block:Dec<|fim_suffix|> | empty
Variable_declaration: id (, id)* : Type_spec
Type_spec: integer | real
Term: factor([mul | div ] factor) *
Factor:
'''<|fim_midd... | code_fim | medium | {
"lang": "python",
"repo": "yuzhou346694246/compilerimplement",
"path": "/node/simplepascal.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fallen-geko/QuickPYSER path: /example/theRoom/cgi-bin/room.py
#!/usr/bin/env python
'''
------------------------------------------------------------------------------------------
Copyright 2020 Romeo Dabok
Licensed under the Apache License, Version 2.0 (the "License");
you may not u... | code_fim | hard | {
"lang": "python",
"repo": "fallen-geko/QuickPYSER",
"path": "/example/theRoom/cgi-bin/room.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if not theroom.checkCookie():
print("Content-Type: text/html\r\n")
print("<h1>Something went wrong</h1>")
else:
#Is the user making a new post?
postmsg = form.getvalue('postm')
waitt = 0
if postmsg:
ido = theroom.getIdentification()
ford = theroom.getForumD... | code_fim | hard | {
"lang": "python",
"repo": "fallen-geko/QuickPYSER",
"path": "/example/theRoom/cgi-bin/room.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ksnabb/sinkthebattleship path: /pico/views.py
"""
The pico views is supposed to mimic a pico server
"""
from django.http import HttpResponse
from django.shortcuts import render_to_response
from xml.sax import parse
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
import... | code_fim | hard | {
"lang": "python",
"repo": "ksnabb/sinkthebattleship",
"path": "/pico/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_to_response('danceroom.xml', mimetype='text/xml')
def feed(request, room):
return HttpResponse(xml_feed(), mimetype="text/xml")
def xml_feed():
f = open(os.path.join(os.path.dirname(__file__), 'templates/test_feed.xml'))
for line in f:
yield line
if "</... | code_fim | medium | {
"lang": "python",
"repo": "ksnabb/sinkthebattleship",
"path": "/pico/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def find_by(search_params):
return handler_request.get(customer_routes.GET_CUSTOMER_BY, search_params)<|fim_prefix|># repo: alefhsousa/pagarme-python path: /pagarme/customer.py
from pagarme.resources import handler_request
from pagarme.resources.routes import customer_routes
<|fim_middle|>
def crea... | code_fim | medium | {
"lang": "python",
"repo": "alefhsousa/pagarme-python",
"path": "/pagarme/customer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return handler_request.get(customer_routes.GET_CUSTOMER_BY, search_params)<|fim_prefix|># repo: alefhsousa/pagarme-python path: /pagarme/customer.py
from pagarme.resources import handler_request
from pagarme.resources.routes import customer_routes
def create(dictionary):
return handler_request.... | code_fim | medium | {
"lang": "python",
"repo": "alefhsousa/pagarme-python",
"path": "/pagarme/customer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alefhsousa/pagarme-python path: /pagarme/customer.py
from pagarme.resources import handler_request
from pagarme.resources.routes import customer_routes
def create(dictionary):
return handler_request.post(customer_routes.BASE_URL, dictionary)
<|fim_suffix|> return handler_request.get(cus... | code_fim | medium | {
"lang": "python",
"repo": "alefhsousa/pagarme-python",
"path": "/pagarme/customer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"my_header", group_footer="my_footer")
]<|fim_prefix|># repo: NikolayLukyanov/python_pfqa path: /data/groups.py
from model.group import Group
testdata = [Group(group_name="", group_header="", group_footer=""),
<|fim_middle|> Group(group_name="my_group", group_header= | code_fim | easy | {
"lang": "python",
"repo": "NikolayLukyanov/python_pfqa",
"path": "/data/groups.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NikolayLukyanov/python_pfqa path: /data/groups.py
from model.group import Group
testdata = [Group(group_name="", group_header="", group_footer=""),
<|fim_suffix|>"my_header", group_footer="my_footer")
]<|fim_middle|> Group(group_name="my_group", group_header= | code_fim | easy | {
"lang": "python",
"repo": "NikolayLukyanov/python_pfqa",
"path": "/data/groups.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "GET":
session = request.args['session']
#session = str(3846)
return send_from_directory('buttons', session)
elif request.method == "POST":
session = os.path.splitext(request.files['image'].filename)[0]
im = Image.open(request.files['ima... | code_fim | hard | {
"lang": "python",
"repo": "CMUBigLab/vizmap",
"path": "/server/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CMUBigLab/vizmap path: /server/server.py
import sqlite3
import json
from flask import Flask, g, request, send_from_directory
from flask.ext.cors import CORS
import os
import time
import numpy as np
from PIL import Image
from collections import defaultdict
import util
import database
import hulo... | code_fim | hard | {
"lang": "python",
"repo": "CMUBigLab/vizmap",
"path": "/server/server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pramodmodepuk/practice path: /app.py
import os
import json
import pprint
from flask import Flask, request, url_for
from signalwire.voice_response import VoiceResponse, Gather
app = Flask(__name__)
with open('configure.json') as f:
ccConfig = json.load(f)
# Dump config to con... | code_fim | hard | {
"lang": "python",
"repo": "pramodmodepuk/practice",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/connect_dgf", methods=['POST', 'GET'])
def connect_dgf():
response = VoiceResponse()
farward_to = ccConfig['settings']['GDF_connection']
# print(farward_to)
response.dial(farward_to, action=url_for('quit_call'))
# print(farward_to)
return str(response)
@app... | code_fim | hard | {
"lang": "python",
"repo": "pramodmodepuk/practice",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mshumko/ac6_microburst_scale_sizes path: /rabbit_holes/validation_plots.py
# This script makes plots of the coincident micorbursts
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
import os
import sys
sys.path.insert(0, '/home/mike/research/mission-tools/ac6')
i... | code_fim | medium | {
"lang": "python",
"repo": "mshumko/ac6_microburst_scale_sizes",
"path": "/rabbit_holes/validation_plots.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Pick out only the valid data
validIdxA = np.where(dataA['dos1rate'] > 0)[0]
validIdxB = np.where(dataB['dos1rate'] > 0)[0]
# Plot the unshifted data
ax[0].plot(dataA['dateTime'][validIdxA], dataA['dos1rate'][validIdxA],
label='AC-6 A')
... | code_fim | hard | {
"lang": "python",
"repo": "mshumko/ac6_microburst_scale_sizes",
"path": "/rabbit_holes/validation_plots.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dulal13/python path: /chapter-7/13_pr_04.py
num = int(input("Enter a number : "))
<|fim_suffix|>if(prime):
print("The number is prime")
else:
print("The number is not prime")<|fim_middle|>prime = True
if(num<2):
prime = False
else:
for i in range(2 , num):
if (num%i == 0... | code_fim | medium | {
"lang": "python",
"repo": "Dulal13/python",
"path": "/chapter-7/13_pr_04.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if(prime):
print("The number is prime")
else:
print("The number is not prime")<|fim_prefix|># repo: Dulal13/python path: /chapter-7/13_pr_04.py
num = int(input("Enter a number : "))
prime = True
<|fim_middle|>if(num<2):
prime = False
else:
for i in range(2 , num):
if (num%i == 0... | code_fim | medium | {
"lang": "python",
"repo": "Dulal13/python",
"path": "/chapter-7/13_pr_04.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if(num<2):
prime = False
else:
for i in range(2 , num):
if (num%i == 0):
prime = False
break
if(prime):
print("The number is prime")
else:
print("The number is not prime")<|fim_prefix|># repo: Dulal13/python path: /chapter-7/13_pr_04.py
num = int(input("... | code_fim | easy | {
"lang": "python",
"repo": "Dulal13/python",
"path": "/chapter-7/13_pr_04.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
backtracing=recursive fn to check all possible combos until solution.
:param grid:
:return:
'''
global counter
for i in range(0, 81):
row = i // 9
col = i % 9
if grid[row][col] == 0:
shuffle(numberList)
for value in numberList:... | code_fim | hard | {
"lang": "python",
"repo": "antholuo/Sudoku-Generator",
"path": "/Generator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antholuo/Sudoku-Generator path: /Generator.py
import turtle
from random import randint, shuffle
from time import sleep
# initialize empty 9x9 grid
grid = []
grid.append([0, 0, 0, 0, 0, 0, 0, 0, 0])
grid.append([0, 0, 0, 0, 0, 0, 0, 0, 0])
grid.append([0, 0, 0, 0, 0, 0, 0, 0, 0])
grid.... | code_fim | hard | {
"lang": "python",
"repo": "antholuo/Sudoku-Generator",
"path": "/Generator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: INFO202GroupProject/202Project path: /beerRetrieval.py
import sys
sys.path.insert(0, '/anaconda/lib/python3.6/site-packages')
import pandas as pd
import numpy as np
from searchBeer import *
from InvertedIndexFoodsearch import *
from locationSearch import *
<|fim_suffix|> user_input = int(input... | code_fim | medium | {
"lang": "python",
"repo": "INFO202GroupProject/202Project",
"path": "/beerRetrieval.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
if user_input == 1:
runBeerSearch()
mainPrompt()
if user_input == 2:
searchBreweriesNearby()
mainPrompt()
if user_input == 3:
RunPairingSearch()
mainPrompt()
if user_input == 4:
print("Exiting...")
sys.exit()
else:
selection = input ("Error. Would you like... | code_fim | medium | {
"lang": "python",
"repo": "INFO202GroupProject/202Project",
"path": "/beerRetrieval.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def require_state(state=None, excp=True):
"""Decorator to check state of an object.
First argument of the decorated function should be
the object whose state needs to be checked.
:param state: valid set of states
:param excp: If True then raise an exception if in invalid state
""... | code_fim | hard | {
"lang": "python",
"repo": "Mirantis/vmware-dvs",
"path": "/networking_vsphere/common/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mirantis/vmware-dvs path: /networking_vsphere/common/utils.py
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may ... | code_fim | hard | {
"lang": "python",
"repo": "Mirantis/vmware-dvs",
"path": "/networking_vsphere/common/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chenxino/Urban-regional-representation path: /web/pictures/models.py
from django.db import models
from login.models import User
# Create your models here.
class RawImg(models.Model):
code = models.CharField(max_length=8,default='code')
author = models.ForeignKey(User, on_delete=m... | code_fim | medium | {
"lang": "python",
"repo": "chenxino/Urban-regional-representation",
"path": "/web/pictures/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Create your models here.
#
# class Post_img(models.Model):
# code = models.CharField(max_length=200, default='code')
#
# cover = models.ImageField(upload_to="images/", default=None, blank=True)
# def __str__(self):
# return self.code
#
# class Operation(models.Model):
# ... | code_fim | medium | {
"lang": "python",
"repo": "chenxino/Urban-regional-representation",
"path": "/web/pictures/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Burit-Chaisiri/sandslecture path: /Homepage/models.py
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
# Create your models here.
<|fim_suffix|> return self.user.username
class Lecture(models.Model):
title = models.CharField(m... | code_fim | hard | {
"lang": "python",
"repo": "Burit-Chaisiri/sandslecture",
"path": "/Homepage/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.title
class Lecture_img(models.Model):
LectureKey = models.ForeignKey(Lecture, related_name='Lecture_img',on_delete=models.CASCADE,blank=True,null=True)
image = models.ImageField(upload_to='lecture_image',blank=True)
def __str__(self):
return self.image.name<|fim_p... | code_fim | hard | {
"lang": "python",
"repo": "Burit-Chaisiri/sandslecture",
"path": "/Homepage/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FIDINGSARL/kzm_hr path: /l10n_ma_hr_payroll/models/cotisation.py
# encoding: utf-8
from odoo import models, fields, api, _
import odoo.addons.decimal_precision as dp
from odoo.addons.kzm_base.controllers.tools import remove_accent
class hr_cotisation(models.Model):
_name = 'hr.cotisation'... | code_fim | hard | {
"lang": "python",
"repo": "FIDINGSARL/kzm_hr",
"path": "/l10n_ma_hr_payroll/models/cotisation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for cotisation in self:
axes = self.env['hr.axe'].search(
[('cotisation_id', '=', cotisation.id)])
if axes:
for axe in axes:
axe.unlink()
return super(hr_cotisation, self).unlink()
class hr_cotisation_group(models... | code_fim | hard | {
"lang": "python",
"repo": "FIDINGSARL/kzm_hr",
"path": "/l10n_ma_hr_payroll/models/cotisation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Ultrasonic_Obstacle_Avoidance")
try:
while True:
Dist = Distance()
print("Distance = %0.2f cm"%Dist)
if Dist <= 20:
Ab.stop()
time.sleep(0.02)
Ab.left()
time.sleep(0.02)
Ab.stop()
#else:
... | code_fim | hard | {
"lang": "python",
"repo": "maroneal/SmartC",
"path": "/Sources/AlphaBot2/python/Ultrasonic_Obstacle_Avoidance.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lindycin/bmail path: /login.py
from flask import Flask, render_template
app = Flask(__name__)
<|fim_suffix|> return render_template('pw.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port = 3000, threaded = True, debug = True)<|fim_middle|>@app.route('/') #how to write the pat... | code_fim | easy | {
"lang": "python",
"repo": "lindycin/bmail",
"path": "/login.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_template('pw.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port = 3000, threaded = True, debug = True)<|fim_prefix|># repo: lindycin/bmail path: /login.py
from flask import Flask, render_template
app = Flask(__name__)
<|fim_middle|>
@app.route('/') #how to write the pat... | code_fim | medium | {
"lang": "python",
"repo": "lindycin/bmail",
"path": "/login.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lindycin/bmail path: /login.py
from flask import Flask, render_template
<|fim_suffix|>
if __name__ == '__main__':
app.run(host='0.0.0.0', port = 3000, threaded = True, debug = True)<|fim_middle|>app = Flask(__name__)
@app.route('/') #how to write the path..??
def password():
return render... | code_fim | medium | {
"lang": "python",
"repo": "lindycin/bmail",
"path": "/login.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CodeWithEhtisham/HackerRank_python path: /collections/collections.deque()/code.py
from collections import deque
d=deque()
n=int(input())
for i in range(n):
ls=list(input().split(" <|fim_suffix|>tion=="append":
d.append(int(value))
elif action=="appendleft":
d.appendleft(... | code_fim | medium | {
"lang": "python",
"repo": "CodeWithEhtisham/HackerRank_python",
"path": "/collections/collections.deque()/code.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ue))
elif action=='pop':
d.pop()
else:
d.popleft()
[print(i,end=" ") for i in d]<|fim_prefix|># repo: CodeWithEhtisham/HackerRank_python path: /collections/collections.deque()/code.py
from collections import deque
d=deque()
n=int(input())
for i in range(n):
ls=list(input().... | code_fim | medium | {
"lang": "python",
"repo": "CodeWithEhtisham/HackerRank_python",
"path": "/collections/collections.deque()/code.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = data.merge(data.groupby('ConstId')['Votes'].sum().reset_index().rename(
columns={'Votes': 'ValidVotes'}), on='ConstId').rename(
columns={'AllianceName': 'Party'})
parties = list(data['Party'].unique())
data = data[data['Rank'] < 3]
data['CandiStatus'] = data['Rank'].rep... | code_fim | hard | {
"lang": "python",
"repo": "tswaroop/polls",
"path": "/swing/swing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tswaroop/polls path: /swing/swing.py
"""Fetching Data from database."""
from tornado.escape import recursive_unicode
import gramex
import pandas as pd
import json as js
import numpy as np
import refresh_data as rd
<|fim_suffix|>
args = recursive_unicode(handler.request.arguments)
state ... | code_fim | medium | {
"lang": "python",
"repo": "tswaroop/polls",
"path": "/swing/swing.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> output = {
'data': data[['ConstId', 'ConstName', 'Party', 'CandiStatus', 'Votes',
'ValidVotes', 'Rank']].to_json(orient='records'),
'parties': parties,
'hindi_mapping': hindi_mapping
}
return output<|fim_prefix|># repo: tswaroop/polls path: /swing/swing.py
"""... | code_fim | hard | {
"lang": "python",
"repo": "tswaroop/polls",
"path": "/swing/swing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> answer = input("Generate getters and setters? (y/n) ")
self.has_get_set = True if answer.lower() == 'y' else False
def get_json_response(self):
input("Press enter if you already copied the json.")
try:
self.json_response = json.loads(clipboard.paste())
... | code_fim | hard | {
"lang": "python",
"repo": "butchpaolom/JSONToJavaPojo",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: butchpaolom/JSONToJavaPojo path: /main.py
import json
import clipboard
class JsonToBean:
bean_name = None
config = None
json_response = None
class_properties = str()
class_getters_setters = str()
java_class = str()
has_get_set = None
def __init__(self):
... | code_fim | hard | {
"lang": "python",
"repo": "butchpaolom/JSONToJavaPojo",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if category_id:
values["category"] = Category.objects.get(id=category_id)
if tag_ids:
tags = [models.Tag.objects.get(id=tag_id) for tag_id in tag_ids]
else:
tags = []
feature = models.Feature.objects.create_translatable_object(**values)... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Helsinki/ahti",
"path": "/features/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: City-of-Helsinki/ahti path: /features/schema.py
s
from django.db import transaction
from django.db.models import Q
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from graphene import ID, ObjectType, relay, String
from graphene_django import DjangoObjectTy... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Helsinki/ahti",
"path": "/features/schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Can be a single value (min and max are equal) or a range.
(Consider: harbor/lake/pool/mineshaft)."
"""
min = graphene.Float(
required=True,
description=_(
"An approximation of the minimum depth (or lower end of the range)"
),
)
max = graphene.Fl... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Helsinki/ahti",
"path": "/features/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prat1996/react-django path: /backend/api/migrations/0003_auto_20210718_0351.py
# Generated by Django 3.2.5 on 2021-07-18 03:51
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='insurance',
name='fuel',
... | code_fim | medium | {
"lang": "python",
"repo": "prat1996/react-django",
"path": "/backend/api/migrations/0003_auto_20210718_0351.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('api', '0002_insurance_date_of_purchase'),
]
operations = [
migrations.AlterField(
model_name='insurance',
name='fuel',
field=models.CharField(blank=True, default='', max_length=100, null=True),
),
migration... | code_fim | medium | {
"lang": "python",
"repo": "prat1996/react-django",
"path": "/backend/api/migrations/0003_auto_20210718_0351.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> verbose_name='Статья'
verbose_name_plural='Статьи'<|fim_prefix|># repo: Maydar/kursach_trpo path: /core/model/article/models.py
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
<|fim_middle|>
class Article(models.Model):
user ... | code_fim | hard | {
"lang": "python",
"repo": "Maydar/kursach_trpo",
"path": "/core/model/article/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Maydar/kursach_trpo path: /core/model/article/models.py
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
<|fim_suffix|> verbose_name='Статья'
verbose_name_plural='Статьи'<|fim_middle|>class Article(models.Model):
user ... | code_fim | hard | {
"lang": "python",
"repo": "Maydar/kursach_trpo",
"path": "/core/model/article/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Test if image of map overview properly represents generated map matrix. """
params = [10000, 5, 10, 15]
height = 100
width = 200
world_map = gen.generate_map(height=height, width=width, params=params)
image = img.get_map_overview(world_map)
pixel... | code_fim | medium | {
"lang": "python",
"repo": "GabrielWechta/age-of-divisiveness",
"path": "/map_generation/test_map_generation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GabrielWechta/age-of-divisiveness path: /map_generation/test_map_generation.py
import unittest
from start_screens import img_gen as img
from . import map_generator as gen
from . import spread_players as s
class MapCase(unittest.TestCase):
<|fim_suffix|> """ Test if players are properly ... | code_fim | hard | {
"lang": "python",
"repo": "GabrielWechta/age-of-divisiveness",
"path": "/map_generation/test_map_generation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ahundt/keras-contrib path: /keras_contrib/backend/cntk_backend.py
from keras.backend import cntk_backend as KCN
from keras.backend.cntk_backend import logsumexp
import cntk as C
import numpy as np
<|fim_suffix|> If min_value > max_value, clipping range is [min_value,min_value].
# Argumen... | code_fim | medium | {
"lang": "python",
"repo": "ahundt/keras-contrib",
"path": "/keras_contrib/backend/cntk_backend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def moments(x, axes, shift=None, keep_dims=False):
''' Calculates and returns the mean and variance of the input '''
mean, variant = KCN._moments(x, axes=axes, shift=shift, keep_dims=keep_dims)
return mean, variant<|fim_prefix|># repo: ahundt/keras-contrib path: /keras_contrib/backend/cntk_ba... | code_fim | hard | {
"lang": "python",
"repo": "ahundt/keras-contrib",
"path": "/keras_contrib/backend/cntk_backend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jorgevs/MyPythonTestProject path: /Tuples.py
# Tuples ===============================================<|fim_suffix|>ge a tuple once it has been created)
pi_tuple = (1, 2, 3, 4)
new_list = list(pi_tuple)
new_tuple = tuple(new_list)<|fim_middle|>=============================
# (you are not able to c... | code_fim | easy | {
"lang": "python",
"repo": "jorgevs/MyPythonTestProject",
"path": "/Tuples.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ge a tuple once it has been created)
pi_tuple = (1, 2, 3, 4)
new_list = list(pi_tuple)
new_tuple = tuple(new_list)<|fim_prefix|># repo: jorgevs/MyPythonTestProject path: /Tuples.py
# Tuples ===============================================<|fim_middle|>=============================
# (you are not able to c... | code_fim | easy | {
"lang": "python",
"repo": "jorgevs/MyPythonTestProject",
"path": "/Tuples.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 6en6ar/Advanced_Keylogger path: /venv/Lib/site-packages/pyscreenshot/childproc.py
import logging
import os
from pyscreenshot.imcodec import codec
from pyscreenshot.loader import FailedBackendError
from pyscreenshot.procutil import proc, run_in_childprocess
from pyscreenshot.tempdir import Tempor... | code_fim | medium | {
"lang": "python",
"repo": "6en6ar/Advanced_Keylogger",
"path": "/venv/Lib/site-packages/pyscreenshot/childproc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def childprocess_grab(_grab_simple, backend, bbox):
if POPEN:
return childprocess_grab_popen(backend, bbox)
else:
return run_in_childprocess(_grab_simple, codec, backend, bbox)
def childprocess_grab_popen(backend, bbox):
if not backend:
backend = ""
if not bbox:
... | code_fim | hard | {
"lang": "python",
"repo": "6en6ar/Advanced_Keylogger",
"path": "/venv/Lib/site-packages/pyscreenshot/childproc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># 0 = multiprocessing (fork)
# 1 = popen (spawn)
POPEN = 1
def childprocess_backend_version(_backend_version, backend):
if POPEN:
return childprocess_backend_version_popen(backend)
else:
return run_in_childprocess(_backend_version, None, backend)
def childprocess_backend_versio... | code_fim | medium | {
"lang": "python",
"repo": "6en6ar/Advanced_Keylogger",
"path": "/venv/Lib/site-packages/pyscreenshot/childproc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# noinspection PyPep8Naming
def get_split_cols_RDC_py(max_sampling_threshold_cols=10000, threshold=0.3, ohe=True, k=10, s=1 / 6,
non_linearity=np.sin,
n_jobs=-2, rand_gen=None):
from spn.algorithms.splitting.RDC import split_data_by_clusters
... | code_fim | hard | {
"lang": "python",
"repo": "TsinghuaDatabaseGroup/AI4DBCode",
"path": "/CardinalityEstimationTestbed/Synthetic/deepdb/deepdb_job_ranges/aqp_spn/custom_spflow/custom_learning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TsinghuaDatabaseGroup/AI4DBCode path: /CardinalityEstimationTestbed/Synthetic/deepdb/deepdb_job_ranges/aqp_spn/custom_spflow/custom_learning.py
import logging
import numpy as np
from aqp_spn.aqp_leaves import Categorical
from aqp_spn.aqp_leaves import IdentityNumericLeaf
from sklearn.cluste... | code_fim | hard | {
"lang": "python",
"repo": "TsinghuaDatabaseGroup/AI4DBCode",
"path": "/CardinalityEstimationTestbed/Synthetic/deepdb/deepdb_job_ranges/aqp_spn/custom_spflow/custom_learning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # for variance computation
square_mean = np.mean(np.square(data[not_null_indexes, 0]))
if zero_in_dataset:
inverted_square_mean = np.nan
else:
inverted_square_mean = np.mean(1 / np.square(data[not_null_indexes, 0]))
... | code_fim | hard | {
"lang": "python",
"repo": "TsinghuaDatabaseGroup/AI4DBCode",
"path": "/CardinalityEstimationTestbed/Synthetic/deepdb/deepdb_job_ranges/aqp_spn/custom_spflow/custom_learning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> total_price = 0
print(compra)
for objeto_personalizado in compra.purchased_objects.all():
object_total_seconds = 0
if objeto_personalizado.scale == 1:
object_total_seconds = objeto_personalizado.object_id.printing_time_default_total()
else:
#Usam... | code_fim | hard | {
"lang": "python",
"repo": "aguschanchu/dbcreame",
"path": "/db/tools/price_calculator.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.