text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>#gets all the dates in the given range (returns a list of datetimes)
def getDateRange(begDate,endDate):
testDate=datetime.date(begDate.year,begDate.month,begDate.day)
dates=[]
while(testDate <=endDate):
dates.append(testDate)
testDate+=datetime.timedelta(days=1)
return dates
... | code_fim | hard | {
"lang": "python",
"repo": "vishal929/meetingPlannerImproved",
"path": "/meetingPlanner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Lists of PropertyClassData.
- self._property_classes_by_id = map(self.get_class, properties)
- self._alias_classes_by_id = map(self.get_class, aliases)
+ self._property_classes_by_id = list(map(self.get_class, properties))
+ self._alias_classes_by_id = list(map(self.... | code_fim | hard | {
"lang": "python",
"repo": "NetBSD/pkgsrc",
"path": "/x11/qt5-qtwebengine/patches/patch-src_3rdparty_chromium_third__party_blink_renderer_build_scripts_core_css_properties_make__css__property__instances.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NetBSD/pkgsrc path: /x11/qt5-qtwebengine/patches/patch-src_3rdparty_chromium_third__party_blink_renderer_build_scripts_core_css_properties_make__css__property__instances.py
$NetBSD: patch-src_3rdparty_chromium_third__party_blink_renderer_build_scripts_core_css_properties_make__css__property__inst... | code_fim | hard | {
"lang": "python",
"repo": "NetBSD/pkgsrc",
"path": "/x11/qt5-qtwebengine/patches/patch-src_3rdparty_chromium_third__party_blink_renderer_build_scripts_core_css_properties_make__css__property__instances.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vulgarman/Python path: /小杨/socket编程/TCP-server.py
# -*- coding: utf-8-*-
from socket import *
import os
host = '192.168.1.85'
port = 12345
bufsiz = 1024
addr = (host, port)
tcpSerSock = socket(AF_INET, SOCK_STREAM)
tcpSerSock.bind(addr)
tcpSerSoc<|fim_suffix|>n ...."
tcpCliscock, addr1 = tcpS... | code_fim | medium | {
"lang": "python",
"repo": "vulgarman/Python",
"path": "/小杨/socket编程/TCP-server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>n ...."
tcpCliscock, addr1 = tcpSerSock.accept()
print '...connected from:', addr1
while True:
data = tcpCliscock.recv(bufsiz)
if not data:
break
text,status = getstatusoutput(data.strip())
if not status:
tcpCliscock.send(text)
el... | code_fim | medium | {
"lang": "python",
"repo": "vulgarman/Python",
"path": "/小杨/socket编程/TCP-server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t,status = getstatusoutput(data.strip())
if not status:
tcpCliscock.send(text)
else:
tcpCliscock.send("error cmd")
tcpCliscock.close()
tcpSerSock.close()<|fim_prefix|># repo: vulgarman/Python path: /小杨/socket编程/TCP-server.py
# -*- coding: utf-8-*-
from socket i... | code_fim | hard | {
"lang": "python",
"repo": "vulgarman/Python",
"path": "/小杨/socket编程/TCP-server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daniel-reich/ubiquitous-fiesta path: /4me7LifXBwj5rhL4n_16.py
import math
def circle_or_square(rad, area):
perimeter = 4*math.sqrt(area)
circumferen<|fim_suffix|>eter:
return True
else:
return False<|fim_middle|>ce = 2 * 3.14 * rad
if circumference > perim | code_fim | easy | {
"lang": "python",
"repo": "daniel-reich/ubiquitous-fiesta",
"path": "/4me7LifXBwj5rhL4n_16.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>eter:
return True
else:
return False<|fim_prefix|># repo: daniel-reich/ubiquitous-fiesta path: /4me7LifXBwj5rhL4n_16.py
import math
def circle_or_square(rad, area):
perimeter = 4*math.sqrt(area)
circumferen<|fim_middle|>ce = 2 * 3.14 * rad
if circumference > perim | code_fim | easy | {
"lang": "python",
"repo": "daniel-reich/ubiquitous-fiesta",
"path": "/4me7LifXBwj5rhL4n_16.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vali7394/python-examples path: /python-examples/day-11.py
"""
With a given tuple (1,2,3,4,5,6,7,8,9,10), write a program to print the first half values in one line and the last half values in one line.
"""
tup_val = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(tup_val[:5])
print(tup_val[5:])
"""Write ... | code_fim | hard | {
"lang": "python",
"repo": "vali7394/python-examples",
"path": "/python-examples/day-11.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""Write a program which can map() to make a list whose elements are square of elements in [1,2,3,4,5,6,7,8,9,10]."""
num_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(list(map(lambda a: a ** 2, num_list)))
"""Write a program which can map() and filter() to make a list whose elements are square of even nu... | code_fim | hard | {
"lang": "python",
"repo": "vali7394/python-examples",
"path": "/python-examples/day-11.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def main():
tasks = [
asyncio.create_task(f1(), name="f1"),
asyncio.create_task(f2(), name="f2"),
asyncio.ensure_future(f1()),
]
done, _ = await asyncio.wait(tasks)
for d in done:
print(d.get_name())
print(d)
asyncio.run(main())<|fim_prefix|>... | code_fim | medium | {
"lang": "python",
"repo": "copdips/myPython",
"path": "/asyncio/youtuoo/async_demos/s1/s14.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: copdips/myPython path: /asyncio/youtuoo/async_demos/s1/s14.py
import asyncio
async def f1():
await asyncio.sleep(2)
return "f1"
<|fim_suffix|>
async def main():
tasks = [
asyncio.create_task(f1(), name="f1"),
asyncio.create_task(f2(), name="f2"),
asyncio.en... | code_fim | medium | {
"lang": "python",
"repo": "copdips/myPython",
"path": "/asyncio/youtuoo/async_demos/s1/s14.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_io_manager_per_output(mock_s3_bucket):
my_job.execute_in_process(
run_config={
"resources": {"s3_io": {"config": {"s3_bucket": mock_s3_bucket.name}}}
},
)<|fim_prefix|># repo: dagster-io/dagster path: /examples/docs_snippets/docs_snippets_tests/concepts_tests/... | code_fim | medium | {
"lang": "python",
"repo": "dagster-io/dagster",
"path": "/examples/docs_snippets/docs_snippets_tests/concepts_tests/io_management_tests/test_io_manager_per_output.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> my_job.execute_in_process(
run_config={
"resources": {"s3_io": {"config": {"s3_bucket": mock_s3_bucket.name}}}
},
)<|fim_prefix|># repo: dagster-io/dagster path: /examples/docs_snippets/docs_snippets_tests/concepts_tests/io_management_tests/test_io_manager_per_output.p... | code_fim | easy | {
"lang": "python",
"repo": "dagster-io/dagster",
"path": "/examples/docs_snippets/docs_snippets_tests/concepts_tests/io_management_tests/test_io_manager_per_output.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dagster-io/dagster path: /examples/docs_snippets/docs_snippets_tests/concepts_tests/io_management_tests/test_io_manager_per_output.py
from dagster_aws_tests.conftest import mock_s3_bucket, mock_s3_resource
<|fim_suffix|>def test_io_manager_per_output(mock_s3_bucket):
my_job.execute_in_proces... | code_fim | medium | {
"lang": "python",
"repo": "dagster-io/dagster",
"path": "/examples/docs_snippets/docs_snippets_tests/concepts_tests/io_management_tests/test_io_manager_per_output.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imagexd/2019-tutorial-skimage path: /supplementary_code.py
import matplotlib.pyplot as plt
import numpy as np
from ipywidgets import interact
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from skimage import exposure, io, measure
def show_plane(axis, plane, cmap="gray", title=None):
... | code_fim | hard | {
"lang": "python",
"repo": "imagexd/2019-tutorial-skimage",
"path": "/supplementary_code.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax.set_xlabel('col')
ax.set_ylabel('row')
ax.set_zlabel('plane')
min_pln, min_row, min_col, max_pln, max_row, max_col = properties[region].bbox
ax.set_xlim(min_row, max_row)
ax.set_ylim(min_col, max_col)
ax.set_zlim(min_pln, max_pln)
plt.tight_layout()
plt.show()
... | code_fim | hard | {
"lang": "python",
"repo": "imagexd/2019-tutorial-skimage",
"path": "/supplementary_code.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zengl96/tra-slate-and-weather-and-parsercalories path: /API/API.py
import requests
from pprint import pprint
import datetime
token = 'e9f9014a96de0057bf3dbb84759baa98'
def get(city,token):
to = {
"Clear": "ясно",
"Clouds": "облачно",
"Rain": "идет дождь ",
"Dri... | code_fim | hard | {
"lang": "python",
"repo": "zengl96/tra-slate-and-weather-and-parsercalories",
"path": "/API/API.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ажность: {humidity}%\nДавление: {pressure} мм.рт.ст\nВетер: {wind} м/с\n"
#f"Восход солнца: {sunrise}\nЗакат солнца: {sunset}\nПродолжительность дня: {l}\n"
f"Хорошего дня!"
)
except :
print(f'похоже города {city} нет в моей базе или город написан не п... | code_fim | hard | {
"lang": "python",
"repo": "zengl96/tra-slate-and-weather-and-parsercalories",
"path": "/API/API.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(FloatPage, self).__init__(parent)
self.setObjectName("FloatWidget")
self.isShowed = False<|fim_prefix|># repo: dragondjf/PFramer path: /gui/functionpages/floatpage.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PySide2.QtCore import *
from PySide2.QtGui import *
from PyS... | code_fim | easy | {
"lang": "python",
"repo": "dragondjf/PFramer",
"path": "/gui/functionpages/floatpage.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, parent=None):
super(FloatPage, self).__init__(parent)
self.setObjectName("FloatWidget")
self.isShowed = False<|fim_prefix|># repo: dragondjf/PFramer path: /gui/functionpages/floatpage.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PySide2.QtCore import *... | code_fim | easy | {
"lang": "python",
"repo": "dragondjf/PFramer",
"path": "/gui/functionpages/floatpage.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dragondjf/PFramer path: /gui/functionpages/floatpage.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from qframer import FFloatWidget
<|fim_suffix|>
def __init__(self, parent=None):
super(FloatPag... | code_fim | easy | {
"lang": "python",
"repo": "dragondjf/PFramer",
"path": "/gui/functionpages/floatpage.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lunyiliu/College-Entrance-Application-Helper- path: /高考志愿程序_后端/前期数据爬取(往年分数线等)/高考网学校ID.py
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 13:25:13 2018
@author: lenovvo
"""
import pymysql
import requests
import time
from lxml import etree
import re
shcoolID_set=[]
for i in range(1,1601):
sh... | code_fim | hard | {
"lang": "python",
"repo": "lunyiliu/College-Entrance-Application-Helper-",
"path": "/高考志愿程序_后端/前期数据爬取(往年分数线等)/高考网学校ID.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t='39.107.97.123', user='root', passwd='123456', db='gaokao', charset='utf8')
cursor=conn.cursor(cursor=pymysql.cursors.DictCursor)
'''
for key in shcool_dict:
print(key)
sql="insert into gaokaowang_shcoolname values('"+key+"',"+str(shcool_dict[key])+")"
cursor.execute(sql)
conn.commit()
... | code_fim | hard | {
"lang": "python",
"repo": "lunyiliu/College-Entrance-Application-Helper-",
"path": "/高考志愿程序_后端/前期数据爬取(往年分数线等)/高考网学校ID.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: masterbulla/CoCParser path: /generate_type3.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Extract type 3 particles from images
"""
from models.engine import get_engine
from models.models import War, Src
from sqlalchemy.orm import Session
from slit_utils import cutfront2
import numpy as np... | code_fim | hard | {
"lang": "python",
"repo": "masterbulla/CoCParser",
"path": "/generate_type3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> date = war.date
def save_img(arr):
"""saves image into src"""
png = BytesIO()
io.imsave(png, arr)
png_url = blobs.createBlob(date, png.getvalue())
row = Src(data_url = png_url,\
type = 3)
session.add(row)
session.commit()
... | code_fim | medium | {
"lang": "python",
"repo": "masterbulla/CoCParser",
"path": "/generate_type3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save_img(arr):
"""saves image into src"""
png = BytesIO()
io.imsave(png, arr)
png_url = blobs.createBlob(date, png.getvalue())
row = Src(data_url = png_url,\
type = 3)
session.add(row)
session.commit()
return row.id
... | code_fim | medium | {
"lang": "python",
"repo": "masterbulla/CoCParser",
"path": "/generate_type3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 3Nakajugo/challenge2_4 path: /test_list_items.py
import unittest
from add_list_items import add_items
class test_items(unittest.TestCase):
<|fim_suffix|> def test_list(self):
self.assertRaises(TypeError,add_items,True)
@unittest.skip('test for value')
def test_int(s... | code_fim | medium | {
"lang": "python",
"repo": "3Nakajugo/challenge2_4",
"path": "/test_list_items.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(add_items([1,2,3,4]),10)
def test_list(self):
self.assertRaises(TypeError,add_items,True)
@unittest.skip('test for value')
def test_int(self):
self.assertRaises(ValueError,add_items,'a')<|fim_prefix|># repo: 3Nakajugo/challenge2_4 path: /test... | code_fim | medium | {
"lang": "python",
"repo": "3Nakajugo/challenge2_4",
"path": "/test_list_items.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JackTattersall/PythonLambdaTest path: /risk_handler.py
import jwt
import json
from services import soap_client
def handler(event, context):
<|fim_suffix|> return {
'statusCode': 200,
'body': json.dumps({
'person': data,
'jwt': decoded_jwt or ""
... | code_fim | medium | {
"lang": "python",
"repo": "JackTattersall/PythonLambdaTest",
"path": "/risk_handler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
'statusCode': 200,
'body': json.dumps({
'person': data,
'jwt': decoded_jwt or ""
}),
'headers': {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'www.dave.com',
'Access-Control-Allo... | code_fim | medium | {
"lang": "python",
"repo": "JackTattersall/PythonLambdaTest",
"path": "/risk_handler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_bills_for_edit_keyboard(user_id):
markup = telebot.types.InlineKeyboardMarkup()
bills = bill.get_bills_for_edit(user_id)
if bills:
for b in bills:
btn = telebot.types.InlineKeyboardButton(text=b[0], callback_data='eb_' + b[1])
markup.row(btn)
ret... | code_fim | hard | {
"lang": "python",
"repo": "MakFrogz/FinanceBot",
"path": "/FinanceBot/keyboard.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_r_users_keyboard(users_id):
markup = telebot.types.InlineKeyboardMarkup()
for _id in users_id:
btn = telebot.types.InlineKeyboardButton(text=user.get_user_fullname(_id), callback_data='r_' + str(_id))
markup.row(btn)
return markup
def get_new_markup(old_markup, callba... | code_fim | hard | {
"lang": "python",
"repo": "MakFrogz/FinanceBot",
"path": "/FinanceBot/keyboard.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MakFrogz/FinanceBot path: /FinanceBot/keyboard.py
import telebot
import group
import user
import bill
def get_create_and_connection_keyboard():
markup = telebot.types.ReplyKeyboardMarkup()
markup.row('Создать группу')
markup.row('Присоединиться к существующей')
markup.row('Присое... | code_fim | hard | {
"lang": "python",
"repo": "MakFrogz/FinanceBot",
"path": "/FinanceBot/keyboard.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def dayOfTheWeek(self, day, month, year):
if (calendar.weekday(year, month, day)) == 0:
return "Monday"
elif (calendar.weekday(year, month, day)) == 1:
return "Tuesday"
elif (calendar.weekday(year, month, day)) == 2:
return "Wednesday"
... | code_fim | hard | {
"lang": "python",
"repo": "olaruandreea/LeetCodeProblems",
"path": "/day-of-the-week.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olaruandreea/LeetCodeProblems path: /day-of-the-week.py
'''
Given a date, return the corresponding day of the week for that date.
The input is given as three integers representing the day, month and year respectively.
Return the answer as one of the following values {"Sunday", "Monday", "Tuesda... | code_fim | medium | {
"lang": "python",
"repo": "olaruandreea/LeetCodeProblems",
"path": "/day-of-the-week.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Input: day = 18, month = 7, year = 1999
Output: "Sunday"
'''
import calendar
class Solution(object):
def dayOfTheWeek(self, day, month, year):
if (calendar.weekday(year, month, day)) == 0:
return "Monday"
elif (calendar.weekday(year, month, day)) == 1:
return "T... | code_fim | hard | {
"lang": "python",
"repo": "olaruandreea/LeetCodeProblems",
"path": "/day-of-the-week.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def restart(self):
chaos_stdout.info("(re)starting a cluster")
self.teardown()
self._mount()
for node_id in self.nodes:
node = self.nodes[node_id]
chaos_event_log.info(m(f"preparing dirs {node_id}").with_time())
node.prep_dirs... | code_fim | hard | {
"lang": "python",
"repo": "kitaisreal/redpanda",
"path": "/src/consistency-testing/chaostest/chaostest/kafka_cluster.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kitaisreal/redpanda path: /src/consistency-testing/chaostest/chaostest/kafka_cluster.py
# Copyright 2020 Vectorized, Inc.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.md
#
# As of the Change Date specified in that file, in accordance with... | code_fim | hard | {
"lang": "python",
"repo": "kitaisreal/redpanda",
"path": "/src/consistency-testing/chaostest/chaostest/kafka_cluster.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run_iter(n):
outer(n, 10000)<|fim_prefix|># repo: softdevteam/pyhyp_experiments path: /benchmarks/pb_l1a1r/mono.py
def sum_up_to_n(n):
result = 0
while n > 0:
result += n
n -= 1
return result
<|fim_middle|>def outer(outer, inner):
correct = sum_up_to_n(inner)
... | code_fim | medium | {
"lang": "python",
"repo": "softdevteam/pyhyp_experiments",
"path": "/benchmarks/pb_l1a1r/mono.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: softdevteam/pyhyp_experiments path: /benchmarks/pb_l1a1r/mono.py
def sum_up_to_n(n):
result = 0
while n > 0:
result += n
n -= 1
return result
<|fim_suffix|> correct = sum_up_to_n(inner)
i = 0
while i < outer:
res = sum_up_to_n(inner)
assert... | code_fim | easy | {
"lang": "python",
"repo": "softdevteam/pyhyp_experiments",
"path": "/benchmarks/pb_l1a1r/mono.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skhu101/SNAS-Series path: /DSNAS/devkit/ops/syncsn_layer.py
import torch
from torch.autograd import Function
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.distributed as dist
import torch.nn as nn
class SyncSNFunc(Function):
@staticmethod
... | code_fim | hard | {
"lang": "python",
"repo": "skhu101/SNAS-Series",
"path": "/DSNAS/devkit/ops/syncsn_layer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
raise RuntimeError('SyncBNFunc only support CUDA computation!')
return inDiff, scaleDiff, shiftDiff, mean_weight_Diff, var_weight_Diff, None, None, None, None, None
class SyncSwitchableNorm2d(Module):
def __init__(self, num_features, eps=1e-5, momentum=0.9,last_gamm... | code_fim | hard | {
"lang": "python",
"repo": "skhu101/SNAS-Series",
"path": "/DSNAS/devkit/ops/syncsn_layer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def save_as_mp4(path, array, fps=50):
if platform.linux_distribution()[0]:
# Linux
skvideo.io.vwrite(path, array, inputdict={'-r': str(fps)})
else:
# other OS
dim = array[0].ndim
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(path, f... | code_fim | hard | {
"lang": "python",
"repo": "Kkun84/MyPythonLibrary",
"path": "/mylib/image.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kkun84/MyPythonLibrary path: /mylib/image.py
import platform
import cv2
import skvideo.io
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
import PIL
def show_images(images, title=None, *, cols=1, rows=1, size=[1, 1], verbose=0):
# 複数画像表示関数
figsize =... | code_fim | medium | {
"lang": "python",
"repo": "Kkun84/MyPythonLibrary",
"path": "/mylib/image.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zizi001/mobile_gui_test path: /danglaoshi/TestCase/LoginCase.py
from danglaoshi.Common import BaseMethod
import unittest
from danglaoshi.TestAction.Login_Test import LoginAction
from danglaoshi.Data.Elements import PositionLogin
from ddt import ddt, data, unpack
@ddt
class LoginCase(unittest.Te... | code_fim | medium | {
"lang": "python",
"repo": "zizi001/mobile_gui_test",
"path": "/danglaoshi/TestCase/LoginCase.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> LoginAction.login_out()
BaseMethod.driver_close()
@data(("13100000121", "123456", False), ("", "", True), ("13100000121", "111222333", True),
("13100000", "", True), ("aaa", "123456", True))
@unpack
def test_login(self, username, password, expect):
LoginActio... | code_fim | medium | {
"lang": "python",
"repo": "zizi001/mobile_gui_test",
"path": "/danglaoshi/TestCase/LoginCase.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ment_sentiment = models.FloatField()
published_at = models.DateTimeField()
duration = models.BigIntegerField()
def __str__(self):
return self.title<|fim_prefix|># repo: Space0726/tublotapi path: /dbagent/models.py
from django.db import models
class Video(models.Model):
id = mode... | code_fim | medium | {
"lang": "python",
"repo": "Space0726/tublotapi",
"path": "/dbagent/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>models.BigIntegerField()
dislike_count = models.BigIntegerField()
favorite_count = models.BigIntegerField()
comment_count = models.BigIntegerField()
comment_sentiment = models.FloatField()
published_at = models.DateTimeField()
duration = models.BigIntegerField()
def __str__(se... | code_fim | medium | {
"lang": "python",
"repo": "Space0726/tublotapi",
"path": "/dbagent/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Space0726/tublotapi path: /dbagent/models.py
from django.db import models
class Video(models.Model):
id = models.CharField(max_length=11, primary_key=True)
title = models.TextField()
description = models.TextField()
channel = models.CharField(max_length=50)
category = models.... | code_fim | medium | {
"lang": "python",
"repo": "Space0726/tublotapi",
"path": "/dbagent/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'192.168.4.163', # 8: box13
'192.168.4.164' # 9: box14
)
length = len(IP_LIST)
PORT = 49552<|fim_prefix|># repo: irvs/ros_tms path: /tms_ss/tms_ss_kinect_v2/scripts/NETWORK_SETTING.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
IP_LIST = (
'192.168.4.155', # 1: box05
'192.168.4.156', ... | code_fim | medium | {
"lang": "python",
"repo": "irvs/ros_tms",
"path": "/tms_ss/tms_ss_kinect_v2/scripts/NETWORK_SETTING.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wqrydqk/SI507_Final_Proj path: /proj_flask/app_main.py
he phone of the hotel
'''
def __init__(self, hotel_name, hotel_price, hotel_rating, hotel_url,
hotel_reviews, hotel_phone):
self.name = hotel_name
self.price = hotel_price
self.rating = hotel_... | code_fim | hard | {
"lang": "python",
"repo": "wqrydqk/SI507_Final_Proj",
"path": "/proj_flask/app_main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wqrydqk/SI507_Final_Proj path: /proj_flask/app_main.py
'city_location.json'
cache_dict = open_cache(file_name)
if city_to_search in cache_dict:
#print('using cache to get the city location!')
return cache_dict[city_to_search]
else:
#print('getting the data fro... | code_fim | hard | {
"lang": "python",
"repo": "wqrydqk/SI507_Final_Proj",
"path": "/proj_flask/app_main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/')
def my_index():
return render_template('index.html')
@app.route('/buying_air_tickets', methods=['POST'])
def get_air_tickets():
place_of_departure = request.form['dep_city_name']
place_of_destination = request.form["des_city_name"]
date_of_flight = request.form['day']
... | code_fim | hard | {
"lang": "python",
"repo": "wqrydqk/SI507_Final_Proj",
"path": "/proj_flask/app_main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ArbiAI.AIserialWrite("1_Msg for serial write_ACM0\r\n")
time.sleep(3)
ArbiAI.AIserialReceive()
print globalvariables.handshakes
print globalvariables.machineState
ArbiAI.AIserialWrite("1_Hi again_ACM0\r\n")
time.sleep(3)
ArbiAI.AIserialReceive()
print globalvariables.handshakes
print globalvar... | code_fim | hard | {
"lang": "python",
"repo": "AnthonyWalton1/ARBI",
"path": "/Raspberry Pi/Raspberry Pi Code/ARBI/Development ARBIs/ARBI6/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ArbiAI.AIserialWrite("1_Hi again3_ACM0\r\n")
time.sleep(3)
ArbiAI.AIserialReceive()
print globalvariables.handshakes
print globalvariables.machineState
while True:
time.sleep(1)
measurements = ArbiAI.status()
ArbiAI.decide(measurements)
if __name__ == '__main__':
main()<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "AnthonyWalton1/ARBI",
"path": "/Raspberry Pi/Raspberry Pi Code/ARBI/Development ARBIs/ARBI6/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AnthonyWalton1/ARBI path: /Raspberry Pi/Raspberry Pi Code/ARBI/Development ARBIs/ARBI6/main.py
#!/usr/bin/env python
# Import headers/modules
import time
import AI
import globalvariables
def main():
time.sleep(2)
globalvariables.init()
ArbiAI = AI.AIclass("1")
print globalvariables.ha... | code_fim | hard | {
"lang": "python",
"repo": "AnthonyWalton1/ARBI",
"path": "/Raspberry Pi/Raspberry Pi Code/ARBI/Development ARBIs/ARBI6/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Convert single line in Instruction instance."""
register, op, value, _, base, check, limit = line.split()
return Instruction(register, op, int(value), base, check, int(limit))
def process_data(data: str) -> list[Instruction]:
"""Convert raw data in the easy-to-use list of Instruction ... | code_fim | medium | {
"lang": "python",
"repo": "lancelote/advent_of_code",
"path": "/src/year2017/day08a.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def unserialize(self,byteStream):
size=byteStream.popUint32_t()
for i in range(0, size):
k = byteStream.popObject(self.key_type)
#print k
v = byteStream.popObject(self.value_type)
self[k] = v
return s... | code_fim | hard | {
"lang": "python",
"repo": "quentin-xu/python",
"path": "/extensions/c2cplatform_python/bbcplatform/lang_util.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># def getClassLen(self):
# len_bs = byte_stream.ByteStream()
# len_bs.setRealWrite(False)
# len_bs.m_iOffset += 4
# len_bs.m_iOffset += self.size
# return len_bs.m_iOffset;
def unserialize(self,byteStream):
self.size=byteStream.p... | code_fim | hard | {
"lang": "python",
"repo": "quentin-xu/python",
"path": "/extensions/c2cplatform_python/bbcplatform/lang_util.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quentin-xu/python path: /extensions/c2cplatform_python/bbcplatform/lang_util.py
def getBytes(self):
return pack('B',self.value)
@staticmethod
def s_getBytes(value):
return pack('B', value)
def setBytes(self,buffer):
self.value=unpack('B',buffer... | code_fim | hard | {
"lang": "python",
"repo": "quentin-xu/python",
"path": "/extensions/c2cplatform_python/bbcplatform/lang_util.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print(calcula_valor_devido(x,y,z))<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_311/ch1_2019_04_01_12_59_47_016798.py
def calcula_valor_devido (valor_emprestado , n_meses , taxa_juros):
<|fim_middle|>
juros_compostos = valor_emprestado*(1+(taxa_juros/100))**n_mes... | code_fim | medium | {
"lang": "python",
"repo": "gabriellaec/desoft-analise-exercicios",
"path": "/backup/user_311/ch1_2019_04_01_12_59_47_016798.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_311/ch1_2019_04_01_12_59_47_016798.py
def calcula_valor_devido (valor_emprestado , n_meses , taxa_juros):
juros_compostos = valor_emprestado*(1+(taxa_juros/100))**n_meses
return juros_compostos
<|fim_suffix|>print(calcula... | code_fim | easy | {
"lang": "python",
"repo": "gabriellaec/desoft-analise-exercicios",
"path": "/backup/user_311/ch1_2019_04_01_12_59_47_016798.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return juros_compostos
x = 1500
y = 10
z = 1
print(calcula_valor_devido(x,y,z))<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_311/ch1_2019_04_01_12_59_47_016798.py
def calcula_valor_devido (valor_emprestado , n_meses , taxa_juros):
<|fim_middle|>
juros_compo... | code_fim | medium | {
"lang": "python",
"repo": "gabriellaec/desoft-analise-exercicios",
"path": "/backup/user_311/ch1_2019_04_01_12_59_47_016798.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # detect sunrise and sunset
if light_average >= sunrise_threshold and last_light < sunrise_threshold:
# guess morning on first sunrise
if sunrise is None:
midnight = running_time() - (6 * 60 * 60 * 1000)
sunrise = running_time()
... | code_fim | hard | {
"lang": "python",
"repo": "faludi/sun-set-clock",
"path": "/sun_set_clock.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faludi/sun-set-clock path: /sun_set_clock.py
# Uses a BBC micro:Bit with Grove shield and light sensor to
# create a clock that sets itself using the sun.
# Rob Faludi, faludi.com, June 2018
from microbit import display, sleep, running_time, button_a, button_b, Image, pin0
from math import trun... | code_fim | hard | {
"lang": "python",
"repo": "faludi/sun-set-clock",
"path": "/sun_set_clock.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>PIPE = subprocess.PIPE
p=subprocess.Popen(['/home/sid/R2012a/bin/matlab',''])
p.wait()
print "process finished"<|fim_prefix|># repo: sobetsky/nemo path: /mysite/scripts/lab.py
#!/usr/bin/python
#-*- coding:utf-8 -*-
<|fim_middle|>import subprocess
| code_fim | easy | {
"lang": "python",
"repo": "sobetsky/nemo",
"path": "/mysite/scripts/lab.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sobetsky/nemo path: /mysite/scripts/lab.py
#!/usr/bin/python
#-*- coding:utf-8 -*-
<|fim_suffix|>PIPE = subprocess.PIPE
p=subprocess.Popen(['/home/sid/R2012a/bin/matlab',''])
p.wait()
print "process finished"<|fim_middle|>import subprocess
| code_fim | easy | {
"lang": "python",
"repo": "sobetsky/nemo",
"path": "/mysite/scripts/lab.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>nbackup/mathilda.dragonfear/mathilda/ROOT/os@zfs-auto-snap_monthly-2013-08-01-1000\t1375351247\nbackup/mathilda.dragonfear/mathilda/ROOT/os@zfs-auto-snap_daily-2013-08-21-1000\t1377079253\nbackup/mathilda.dragonfear/mathilda/ROOT/os@zfs-auto-snap_daily-2013-08-22-1000\t1377165654\nbackup/mathilda.dragonfe... | code_fim | hard | {
"lang": "python",
"repo": "Rudd-O/zfs-tools",
"path": "/src/zfstools/test_sync.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ckup/paola.dragonfear/chest/shared/Entertainment/Jokes@zfs-auto-snap_daily-2013-08-25-1000\t1377424817\nbackup/paola.dragonfear/chest/shared/Entertainment/Jokes@zfs-auto-snap_daily-2013-08-26-1000\t1377511204\nbackup/paola.dragonfear/chest/shared/Entertainment/Jokes@zfs-auto-snap_daily-2013-08-27-1000\t13... | code_fim | hard | {
"lang": "python",
"repo": "Rudd-O/zfs-tools",
"path": "/src/zfstools/test_sync.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rudd-O/zfs-tools path: /src/zfstools/test_sync.py
up/mathilda.dragonfear/mathilda/ROOT@zfs-auto-snap_daily-2013-08-21-1000\t1377079253\nbackup/mathilda.dragonfear/mathilda/ROOT@zfs-auto-snap_daily-2013-08-22-1000\t1377165654\nbackup/mathilda.dragonfear/mathilda/ROOT@zfs-auto-snap_daily-2013-08-25... | code_fim | hard | {
"lang": "python",
"repo": "Rudd-O/zfs-tools",
"path": "/src/zfstools/test_sync.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nekromoth/cpu path: /asm/old/asm.py
#!/usr/bin/env python3
import sys
import re
from enum import Enum
###############################################################################
# REGEX FUCTIONS
#################################################################... | code_fim | hard | {
"lang": "python",
"repo": "nekromoth/cpu",
"path": "/asm/old/asm.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return lines
def datadirlexer(lnn, line):
i = 0
words = []
word = ""
string = False
while i < len(line):
if line[i] == "$": # ignore data-directive
words.append("$")
i += 1
elif match(WHITESPACE, line[i]): # ignore whitespace
... | code_fim | hard | {
"lang": "python",
"repo": "nekromoth/cpu",
"path": "/asm/old/asm.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(sys.argv) == 1:
error("! Provide file as argument.")
exit()
try:
title("> Opening: [%s]" %sys.argv[1])
with open(sys.argv[1], "r") as file:
rawlines = file.readlines()
except FileNotFoundError:
error("! File [%s] not found." %sys.arg... | code_fim | hard | {
"lang": "python",
"repo": "nekromoth/cpu",
"path": "/asm/old/asm.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# [-inf, inf] <- [a,b]
def to_inf(param, bounds):
a, b = bounds
# print(f"a,b: {a,b}")
x = (2.0 * param - a) / (b - a) - 1.0
return jnp.arcsin(x)<|fim_prefix|># repo: phinate/diet-neos path: /dietneos/transforms.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03_transforms.ipynb (unle... | code_fim | hard | {
"lang": "python",
"repo": "phinate/diet-neos",
"path": "/dietneos/transforms.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UPCnet/upc.genweb.meetings path: /upc/genweb/meetings/browser/Meetings.py
# -*- coding: utf-8 -*-
from Products.Five.browser import BrowserView
from Products.CMFCore.utils import getToolByName
from Acquisition import aq_parent
class Atendees(BrowserView):
""" Atendees List """
def __ini... | code_fim | hard | {
"lang": "python",
"repo": "UPCnet/upc.genweb.meetings",
"path": "/upc/genweb/meetings/browser/Meetings.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
"""
from Products.CMFCore.utils import getToolByName
filter=self.request.get('filter','')
au = getToolByName(self, 'acl_users')
ldap_plugins = [item[1] for item in au.items() if item[1].meta_type=="Plone LDAP plugin"]
ldap_plugins2 = [item[1] for... | code_fim | hard | {
"lang": "python",
"repo": "UPCnet/upc.genweb.meetings",
"path": "/upc/genweb/meetings/browser/Meetings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: angelworm/bots path: /bots/common/Filter.py
from multiprocessing import Process, Queue
from queue import Empty, Full
import collections
import traceback
import faulthandler
from .Status import Status
class Pusher:
def __init__(self):
self.targets = dict()
def put(self, status)... | code_fim | hard | {
"lang": "python",
"repo": "angelworm/bots",
"path": "/bots/common/Filter.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> faulthandler.dump_traceback_later(60 * 1)
try:
self.onmessage(message)
finally:
faulthandler.cancel_dump_traceback_later()
def onmessage(self, message):
pass
def subscribe(self, statustype, f):
if not isinstance... | code_fim | hard | {
"lang": "python",
"repo": "angelworm/bots",
"path": "/bots/common/Filter.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.check_horizontal_rows() and self.check_vertical_rows() and self.check_box():
return True
else:
return False
def print_matrix(self): #para visualizar matriz
print("\n\n\n\n\n")
for i in range(len(self.matrix)):
line = ""
... | code_fim | hard | {
"lang": "python",
"repo": "soundgarden134/depth-search-sudoku",
"path": "/venv/classes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: soundgarden134/depth-search-sudoku path: /venv/classes.py
import numpy as np
import copy
class Sudoku:
matrix = [[]]
def __init__(self, mat):
self.matrix = mat
def is_final_state(self):
for i in range(9):
for j in range(9):
if self.matr... | code_fim | hard | {
"lang": "python",
"repo": "soundgarden134/depth-search-sudoku",
"path": "/venv/classes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: senichimaro/fyyur path: /models.py
from flask import Flask, render_template, request, Response, flash, redirect, url_for, abort
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_moment import Moment
from datetime import datetime
#-----------------------------... | code_fim | hard | {
"lang": "python",
"repo": "senichimaro/fyyur",
"path": "/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f'''||| >>> Artist :
ID-> {self.id}
name -> {self.name}
city -> {self.city}
state -> {self.state}
phone -> {self.phone}
genres -> {self.genres}
facebook_link -> {self.facebook_link}
image_link -> {self.image_link}
websi... | code_fim | hard | {
"lang": "python",
"repo": "senichimaro/fyyur",
"path": "/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def receive_value(self, value):
super(SlaveButtonElement, self).receive_value(value)
self._master_button.receive_value(value)
def script_wants_forwarding(self):
return True
# okay decompiling /home/deniz/data/projects/midiremote/Live 10.1.18/_NKFW2/MultiButtonElement.pyc<|... | code_fim | hard | {
"lang": "python",
"repo": "notelba/midi-remote-scripts",
"path": "/Live 10.1.18/_NKFW2/MultiButtonElement.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reset(self):
super(MultiButtonElement, self).reset()
for button in self._slave_buttons:
button.reset()
def set_light(self, value):
super(MultiButtonElement, self).set_light(value)
for button in self._slave_buttons:
button.set_light(value... | code_fim | hard | {
"lang": "python",
"repo": "notelba/midi-remote-scripts",
"path": "/Live 10.1.18/_NKFW2/MultiButtonElement.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: notelba/midi-remote-scripts path: /Live 10.1.18/_NKFW2/MultiButtonElement.py
# uncompyle6 version 3.7.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.8.5 (default, Aug 12 2020, 00:00:00)
# [GCC 10.2.1 20200723 (Red Hat 10.2.1-1)]
# Embedded file name: C:\ProgramData\Ableton\Live 9.7 ... | code_fim | hard | {
"lang": "python",
"repo": "notelba/midi-remote-scripts",
"path": "/Live 10.1.18/_NKFW2/MultiButtonElement.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kingssafy/til path: /trash/pcc/tiy/8-6.py
def city_country(city, country):
<|fim_suffix|>a = city_country('seoul', 'korea')
b = city_country('new york','usa')
c = city_country('berlin', 'deutchland')
print(a)
print(b)
print(c)<|fim_middle|> return city.title() + ", " + country.title()
| code_fim | easy | {
"lang": "python",
"repo": "kingssafy/til",
"path": "/trash/pcc/tiy/8-6.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>a = city_country('seoul', 'korea')
b = city_country('new york','usa')
c = city_country('berlin', 'deutchland')
print(a)
print(b)
print(c)<|fim_prefix|># repo: kingssafy/til path: /trash/pcc/tiy/8-6.py
def city_country(city, country):
<|fim_middle|> return city.title() + ", " + country.title()
| code_fim | easy | {
"lang": "python",
"repo": "kingssafy/til",
"path": "/trash/pcc/tiy/8-6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sa.Column('country_id', sa.Integer,),
sa.Column('name', sa.String(256),),
# indices
sa.PrimaryKeyConstraint('id', name='product_pkey',),
sa.ForeignKeyConstraint(['entity_id'], [entities.c.id],
name='entity_permission_fkey',
ondel... | code_fim | hard | {
"lang": "python",
"repo": "el-just/market",
"path": "/backend/db.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>label_types = sa.Table(
'label_types', metadata,
sa.Column('id', sa.Integer, nullable=False,),
sa.Column('name', sa.String(256), nullable=False,),
sa.Column('description', sa.String(256), nullable=False,),
# indices
sa.PrimaryKeyConstraint('id', name='label-type_pkey',),
)
label... | code_fim | hard | {
"lang": "python",
"repo": "el-just/market",
"path": "/backend/db.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: el-just/market path: /backend/db.py
import sqlalchemy as sa
import enum
metadata = sa.MetaData()
settings = sa.Table(
'settings', metadata,
sa.Column('id', sa.Integer, nullable=False,),
sa.Column('name', sa.String(256),),
sa.Column('value', sa.String(256),),
# indices
... | code_fim | hard | {
"lang": "python",
"repo": "el-just/market",
"path": "/backend/db.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>glazing_system_u_environment = pywincalc.GlazingSystem(optical_standard=optical_standard,
solid_layers=[slim_white_pella_venetian_blind,
generic_clear_3mm_glass],
... | code_fim | hard | {
"lang": "python",
"repo": "sariths/pyWinCalc",
"path": "/examples/igsdb_exterior_venetian_shade_on_clear_glass.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Download some product data from the IGSDB. This example gets a generic single clear 3mm glazing (NFRC 102),
# a venetian blind manufactured by Pella (CGDB ID 3000) and a perforated screen manufacturerd by Solar Comfort
# (CGDB ID 18000)
generic_clear_3mm_glass_igsdb_id = 363
slim_white_pella_venetian_b... | code_fim | hard | {
"lang": "python",
"repo": "sariths/pyWinCalc",
"path": "/examples/igsdb_exterior_venetian_shade_on_clear_glass.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Among003/CS179J-Team05 path: /testing/test_object_detection.py
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 19:16:06 2020
@author: tyler
"""
import os, cv2, sys, json, re, pytest
import numpy as np
import tensorflow as tf
import datetime as t
cwd = os.path.dirname(os.path.abspath(__file__)... | code_fim | hard | {
"lang": "python",
"repo": "Among003/CS179J-Team05",
"path": "/testing/test_object_detection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return
# print('started testing object detection')
# report = TestVideoOnObjectDetectionHarness()
# for test in report:
# print(test, " Report returned: ", report[test]["correct"])
# print(report)
# with open(os.path.join(os.path.abspath('testing/logs'), TEST_DUMP_FILE), 'w... | code_fim | hard | {
"lang": "python",
"repo": "Among003/CS179J-Team05",
"path": "/testing/test_object_detection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from wincertstore import CertSystemStore
from OpenSSL.crypto import Error as OpenSSLError
store = context.get_cert_store()
certificates = chain.from_iterable(
CertSystemStore(name).itercerts()
for name in ('ROOT', 'CA', 'MY')
)
# use... | code_fim | hard | {
"lang": "python",
"repo": "account-login/dnsagent",
"path": "/dnsagent/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> endpoint = get_client_endpoint(reactor, addr, timeout=timeout)
protocol = Protocol()
try:
yield connectProtocol(endpoint, protocol)
except:
plogger.debug('server is down. retries left: %d', retries)
if retries <= 0:
raise ... | code_fim | hard | {
"lang": "python",
"repo": "account-login/dnsagent",
"path": "/dnsagent/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: account-login/dnsagent path: /dnsagent/utils.py
from ipaddress import IPv4Address, IPv6Address, ip_address
from itertools import chain
import logging
import os
import re
import socket
import sys
from typing import NamedTuple, Tuple, Sequence, Callable
from twisted.internet._sslverify import IOpe... | code_fim | hard | {
"lang": "python",
"repo": "account-login/dnsagent",
"path": "/dnsagent/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liubolif/fatsiievych_project path: /app/task/models.py
from app import db
import enum
from datetime import datetime
class EnumPriority(enum.Enum):
low = 1
medium = 2
high = 3
many_to_many = db.Table('Task_Employee',
db.Column('task_id', db.Integer, db.Forei... | code_fim | medium | {
"lang": "python",
"repo": "liubolif/fatsiievych_project",
"path": "/app/task/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> tasks_todo = db.relationship('Task', secondary=many_to_many, backref=db.backref('for_empl'))
def __repr__(self):
return f"Employee('{self.id}', '{self.name}', '{self.count_of_compltd_task}')\n"<|fim_prefix|># repo: liubolif/fatsiievych_project path: /app/task/models.py
from app import db... | code_fim | hard | {
"lang": "python",
"repo": "liubolif/fatsiievych_project",
"path": "/app/task/models.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.