text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ceylanMeric/firstRepository path: /_1_Idiomatic Python/Basic.py
# For loop indexli
z=range(5)
for i, data in enumerate(z):
print(i, data)
<|fim_suffix|># Text deki verileri parse edip dict e atma
d={}
for line in open("example.txt"):
val1, val2, val3 = line.split()
d[val2]= val1 + va... | code_fim | hard | {
"lang": "python",
"repo": "ceylanMeric/firstRepository",
"path": "/_1_Idiomatic Python/Basic.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Sorting
z=[("aaa",5), ("ccc",4), ("bbb",3)]
z.sort()
print(z)
#Dictionary veri ekleme, iki yöntem var
d={}
d['a']=5
d['b']=6
d=dict(a=5, b=4, c=6)
print(d)
# Text deki verileri parse edip dict e atma
d={}
for line in open("example.txt"):
val1, val2, val3 = line.split()
d[val2]= val1 + val3
pri... | code_fim | medium | {
"lang": "python",
"repo": "ceylanMeric/firstRepository",
"path": "/_1_Idiomatic Python/Basic.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(Oid_or_Code) > 20:
code = GSECCode.query.filter_by(Oid=Oid_or_Code).first_or_404()
else:
code = GSECCode.query.filter_by(Code=Oid_or_Code).first_or_404()
return jsonify(code.to_json()), 200
@api.route('/gseccodes', methods=['POST'])
def create_gseccode():
json_gcod... | code_fim | medium | {
"lang": "python",
"repo": "BoyangDong/BillingSystem",
"path": "/sumo-billing-app/app/api_1_0/gseccode_routes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BoyangDong/BillingSystem path: /sumo-billing-app/app/api_1_0/gseccode_routes.py
from .errors import *
from flask import jsonify, send_file
from app import db
from . import api, get_query_string
from app.main.models import *
from app.main.controllers import GSECMonthlyRecon, GSECMonthlyReconReport... | code_fim | hard | {
"lang": "python",
"repo": "BoyangDong/BillingSystem",
"path": "/sumo-billing-app/app/api_1_0/gseccode_routes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jack2150/rivers path: /opinion/group/market/models.py
_cash = models.ImageField(
blank=True, null=True, default=None, help_text='Fund net cash',
upload_to=UploadRenameImage('market/week/fund'),
)
class MarketWeekCommitment(models.Model):
market_week = models.ForeignKey(M... | code_fim | hard | {
"lang": "python",
"repo": "jack2150/rivers",
"path": "/opinion/group/market/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jack2150/rivers path: /opinion/group/market/models.py
r domestic product'),
('bear', 'Bear - selling price decline for domestic product')
),
)
ipi = models.CharField(
max_length=20, help_text='Industry Production Index; PPIACO:FRED', default='neutral',
... | code_fim | hard | {
"lang": "python",
"repo": "jack2150/rivers",
"path": "/opinion/group/market/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># report research & article
class MarketWeekResearch(models.Model):
market_week = models.ForeignKey(MarketWeek, null=True, default=None)
source = models.CharField(
choices=(
('web', 'Web or Video'),
('schwab', 'Charles Schwab'),
('jpm', 'JP Morgan'),
... | code_fim | hard | {
"lang": "python",
"repo": "jack2150/rivers",
"path": "/opinion/group/market/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
print(4)<|fim_prefix|># repo: matheusmatos221/SASTest path: /SASTest_PythonFiles/ex8.py
x = True
y = False
z = False
if not x or y:
print(1)
elif not x or not y and z:
print(2)
<|fim_middle|>elif not x or y or not y and x:
print(3)
| code_fim | easy | {
"lang": "python",
"repo": "matheusmatos221/SASTest",
"path": "/SASTest_PythonFiles/ex8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>elif not x or not y and z:
print(2)
elif not x or y or not y and x:
print(3)
else:
print(4)<|fim_prefix|># repo: matheusmatos221/SASTest path: /SASTest_PythonFiles/ex8.py
x = True
y = False
z = False
<|fim_middle|>if not x or y:
print(1)
| code_fim | easy | {
"lang": "python",
"repo": "matheusmatos221/SASTest",
"path": "/SASTest_PythonFiles/ex8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matheusmatos221/SASTest path: /SASTest_PythonFiles/ex8.py
x = True
y = False
z = False
<|fim_suffix|>elif not x or y or not y and x:
print(3)
else:
print(4)<|fim_middle|>if not x or y:
print(1)
elif not x or not y and z:
print(2)
| code_fim | medium | {
"lang": "python",
"repo": "matheusmatos221/SASTest",
"path": "/SASTest_PythonFiles/ex8.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XYJ727/noma-simulations path: /simulation_test.py
from simulation import Simulation
<|fim_suffix|> pass
#print(parameters)
simulation = Simulation(parameters={
'SNR': [0, 10, 20, 30],
'τ': [0.6, 1]
}, function=simulator)
simulation.run()<|fim_middle|>
def simulator(parameters):
| code_fim | easy | {
"lang": "python",
"repo": "XYJ727/noma-simulations",
"path": "/simulation_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XYJ727/noma-simulations path: /simulation_test.py
from simulation import Simulation
<|fim_suffix|> pass
#print(parameters)
simulation = Simulation(parameters={
'SNR': [0, 10, 20, 30],
'τ': [0.6, 1]
}, function=simulator)
simulation.run()<|fim_middle|>def simulator(parameters):
| code_fim | easy | {
"lang": "python",
"repo": "XYJ727/noma-simulations",
"path": "/simulation_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>simulation = Simulation(parameters={
'SNR': [0, 10, 20, 30],
'τ': [0.6, 1]
}, function=simulator)
simulation.run()<|fim_prefix|># repo: XYJ727/noma-simulations path: /simulation_test.py
from simulation import Simulation
<|fim_middle|>def simulator(parameters):
pass
#print(parameters)
| code_fim | medium | {
"lang": "python",
"repo": "XYJ727/noma-simulations",
"path": "/simulation_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self, interface_name, changed_properties, invalidated_properties):
for name, value in changed_properties.items():
self.set_system_settings(name, value)
# Placeholder signal. Needed to register the settings interface.
@dbus.service.signal(DBUS_NAME, signature='s')
... | code_fim | hard | {
"lang": "python",
"repo": "williamli80/phosphor-settingsd",
"path": "/settings_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plopp/pycewe path: /testdecreaserate.py
import threading
import Queue
import time
addr_q = Queue.Queue()
reply_q = Queue.Queue()
i1 = 9
i2 = 9
data1_1 = None #192.168.1.3
data1_2 = None #192.168.1.4
def read_data(q,reply_q):
<|fim_suffix|>def main():
try:
while True:
t0 = time.time()
t... | code_fim | hard | {
"lang": "python",
"repo": "plopp/pycewe",
"path": "/testdecreaserate.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print reply_q.get(block=True)
print reply_q.get(block=True)
print "Done."
time.sleep(1)
except:
raise
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
raise<|fim_prefix|># repo: plopp/pycewe path: /testdecreaserate.py
import threading
import Queue
i... | code_fim | hard | {
"lang": "python",
"repo": "plopp/pycewe",
"path": "/testdecreaserate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlbudda/HackerRank path: /Problem_solving/time_conversion.py
# Time Conversion
def timeConversion(s):
<|fim_suffix|>
# Running some tests..
print(timeConversion('07:05:45PM') == '19:05:45')<|fim_middle|> """ Converts to military (24-hour) time """
new_s = ''
if s[-2:] == 'PM' and s[:2... | code_fim | hard | {
"lang": "python",
"repo": "mlbudda/HackerRank",
"path": "/Problem_solving/time_conversion.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Running some tests..
print(timeConversion('07:05:45PM') == '19:05:45')<|fim_prefix|># repo: mlbudda/HackerRank path: /Problem_solving/time_conversion.py
# Time Conversion
def timeConversion(s):
<|fim_middle|> """ Converts to military (24-hour) time """
new_s = ''
if s[-2:] == 'PM' and s[:2... | code_fim | hard | {
"lang": "python",
"repo": "mlbudda/HackerRank",
"path": "/Problem_solving/time_conversion.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if is_display:
presenter.show_compare_and_swap(
index=i,
target=target,
before_list=before,
after_list=l,
pause_sec=PAUSE_SEC,
)
if interval > 1:
... | code_fim | hard | {
"lang": "python",
"repo": "showwin/visible_sort_algorithm",
"path": "/comb_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if l[i] > l[target]:
l = _swap(l, i, target)
is_swapped = True
if is_display:
presenter.show_compare_and_swap(
index=i,
target=target,
before_list=before,
... | code_fim | hard | {
"lang": "python",
"repo": "showwin/visible_sort_algorithm",
"path": "/comb_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: showwin/visible_sort_algorithm path: /comb_sort.py
import copy
import random
from presenter import SortPresenter
SIZE = 10
PAUSE_SEC = 0.3
IS_DISPLAY = True
def _swap(lst, i, t):
v = lst[i]
lst[i] = lst[t]
lst[t] = v
return lst
<|fim_suffix|> if is_display:
... | code_fim | hard | {
"lang": "python",
"repo": "showwin/visible_sort_algorithm",
"path": "/comb_sort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @dataclass
class data_cls:
value: Union[str, Mapping] = ""
def init(self):
consul_host = self.url.netloc or cfg.consul_host
self.meta = Consul_KV.meta_cls(
key=self.url.path.lstrip("/"),
consul=Consul(host=consul_host),
)
def creat... | code_fim | medium | {
"lang": "python",
"repo": "bootstrap-it/resource-it",
"path": "/src/resource_it/consul.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bootstrap-it/resource-it path: /src/resource_it/consul.py
from consul import Consul
from typing import Any, Union, Mapping
from dataclasses import dataclass
from resource_it import Resource, ResourceNotFoundError
import cfg_it
import log_it
log = log_it.logger(__name__)
@cfg_it.props
class cfg... | code_fim | medium | {
"lang": "python",
"repo": "bootstrap-it/resource-it",
"path": "/src/resource_it/consul.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = serializers.SerializerMethodField('get_url_url')
engine = EnginesSerializer(read_only=True)
colour = ColoursSerializer(read_only=True)
interiors = InteriorsSerializer(read_only=True, many=True)
# model = ModelsSerializer(read_only=True)
transmission = TransmissionsSeriali... | code_fim | hard | {
"lang": "python",
"repo": "wheelstand/honda",
"path": "/honda/honda/wheelstand/api/serializers (copy).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wheelstand/honda path: /honda/honda/wheelstand/api/serializers (copy).py
from rest_framework import serializers
from ..models import Models, Trim, ModelsShown, Accessories, Location, Colours, Interiors, Engines, Gallery, Transmissions, Features, InteriorColour, ExteriorColour
class Transmission... | code_fim | hard | {
"lang": "python",
"repo": "wheelstand/honda",
"path": "/honda/honda/wheelstand/api/serializers (copy).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ModelsShownSerializer(serializers.ModelSerializer):
path = serializers.SerializerMethodField('get_url_url')
location = LocationSerializer(read_only=True, many=True)
vehicle = ModelsSerializer(read_only=True)
trim = TrimSerializer(read_only=True)
accessory = AccessoriesSerial... | code_fim | hard | {
"lang": "python",
"repo": "wheelstand/honda",
"path": "/honda/honda/wheelstand/api/serializers (copy).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Test Class attribute
"""
place = Place()
self.assertTrue(hasattr(place, "user_id"))
if models.storage_type == "db":
self.assertEqual(place.user_id, None)
else:
pass
def test_name(self):
"""
Tes... | code_fim | hard | {
"lang": "python",
"repo": "EtienneBrJ/AirBnB_clone_v2",
"path": "/tests/test_models/test_place.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EtienneBrJ/AirBnB_clone_v2 path: /tests/test_models/test_place.py
#!/usr/bin/python3
""" Mopdule for Place tests """
from tests.test_models.test_base_model import test_basemodel
from models.place import Place
import unittest
import inspect
import time
from datetime import datetime
from unittest i... | code_fim | hard | {
"lang": "python",
"repo": "EtienneBrJ/AirBnB_clone_v2",
"path": "/tests/test_models/test_place.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fs.close()
fd.close()
print("File copied successfully\nDestination data: ")
fp = open(f2, "r")
print(fp.read())
else:
if len(sys.argv) > 3:
print("Extra arguments entered")
else:
print("Insufficient data provided")<|fim_prefix|># repo: simeonnischith/simeon_m... | code_fim | medium | {
"lang": "python",
"repo": "simeonnischith/simeon_multiverse",
"path": "/College/sixteen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simeonnischith/simeon_multiverse path: /College/sixteen.py
# 16th program - copyfile
import sys
if len(sys.argv) == 3:
f1 = str(sys.argv[1])
f2 = str(sys.argv[2])
<|fim_suffix|> fs.close()
fd.close()
print("File copied successfully\nDestination data: ")
fp = open(f2, "r... | code_fim | medium | {
"lang": "python",
"repo": "simeonnischith/simeon_multiverse",
"path": "/College/sixteen.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fp = open(f2, "r")
print(fp.read())
else:
if len(sys.argv) > 3:
print("Extra arguments entered")
else:
print("Insufficient data provided")<|fim_prefix|># repo: simeonnischith/simeon_multiverse path: /College/sixteen.py
# 16th program - copyfile
import sys
if len(sys.argv)... | code_fim | medium | {
"lang": "python",
"repo": "simeonnischith/simeon_multiverse",
"path": "/College/sixteen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def post(self, request, *args, **kwargs):
obj = self.get_object()
if 'lodge-certificate' in request.POST:
if obj.status == Certificate.STATUS_COMPLETE:
obj.lodge()
messages.success(request, 'The certificate has been lodged')
r... | code_fim | hard | {
"lang": "python",
"repo": "roleyfoley/chambers-app",
"path": "/src/chambers_app/certificates/views/certs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roleyfoley/chambers-app path: /src/chambers_app/certificates/views/certs.py
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin as LoginRequired
from django.views.generic import (
DetailView, ListView, CreateView,
)
from django.core.exceptions import ... | code_fim | hard | {
"lang": "python",
"repo": "roleyfoley/chambers-app",
"path": "/src/chambers_app/certificates/views/certs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
pygame.init()
display_surf = pygame.display.set_mode((window_width,window_height), pygame.HWSURFACE)
pygame.display.set_caption('Pygame pythonspot.com example')
running = True
# image_surf = pygame.image.load("player44.png")
image_surf = pygame.image.load("player_10.png")
p2_surf = ... | code_fim | hard | {
"lang": "python",
"repo": "boesiii/maze_4player",
"path": "/maze4p1b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: boesiii/maze_4player path: /maze4p1b.py
display_surf.blit(p1st_surf,( bx * block_width , by * block_width))
# blocks.append([bx*block_width,by*block_width])
bx = bx + 1
if bx > M-1:
bx = 0
by = by + 1
def checkplayer(px, py):
... | code_fim | hard | {
"lang": "python",
"repo": "boesiii/maze_4player",
"path": "/maze4p1b.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajacheers/mltrain path: /Arthi/videos handson/video-1/Linear_regression.py
import pandas as pd
from sklearn import linear_model
import matplotlib.pyplot as plt
<|fim_suffix|>#visualize results
plt.scatter(x_values, y_values)
plt.scatter(x,y,color='red')
plt.plot(x_values, body_reg.predict(x_val... | code_fim | hard | {
"lang": "python",
"repo": "rajacheers/mltrain",
"path": "/Arthi/videos handson/video-1/Linear_regression.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#train model on data
body_reg = linear_model.LinearRegression()
body_reg.fit(x_values, y_values)
x = 11
y = body_reg.predict(x)
#visualize results
plt.scatter(x_values, y_values)
plt.scatter(x,y,color='red')
plt.plot(x_values, body_reg.predict(x_values) ,color='green')
plt.show()<|fim_prefix|># repo: raj... | code_fim | medium | {
"lang": "python",
"repo": "rajacheers/mltrain",
"path": "/Arthi/videos handson/video-1/Linear_regression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slee14/tennis-graphics-scene path: /display.py
import sys
'''Displays any image file that PIL can understand. Doesn't display
transparency well, so try showing that on a web browser.'''
try:
# This works on the Linux machines
from PIL import Image
except:
print "Couldn't import PIL... | code_fim | medium | {
"lang": "python",
"repo": "slee14/tennis-graphics-scene",
"path": "/display.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> img = Image.open(filename)
print "converting %s which is format %s (%s) and dimensions %s" % (
filename,
img.format_description,
img.format,
img.getbbox())
img.show()
if __name__ == '__main__':
showimage(sys.argv[1])<|fim_prefix|># repo: slee14/tennis-graph... | code_fim | medium | {
"lang": "python",
"repo": "slee14/tennis-graphics-scene",
"path": "/display.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hujianli94/Python-code path: /2.程序流程语句/循环语句/for循环/for循环.py
#!/usr/bin/env python
# -*- coding:utf8 -*-
"""
for 迭代对象 in 对象:
循环体
#基本应用,进行数值循环
range(start, stop[, step]) -> range object
start:开始数值
stop:结束数值
step:步长
"""
'''
for i in range(1, 11, 2):
print(i, end=" ")
<|fim_suffix|>'''... | code_fim | medium | {
"lang": "python",
"repo": "hujianli94/Python-code",
"path": "/2.程序流程语句/循环语句/for循环/for循环.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in list(range(101)):
result = result + i
print(result)
'''
print("今有物,不知其数,三三数之余2,五五数之余3,七七数之余2,问何物?")
for i in range(1001):
if i % 3 == 2 and i % 5 == 3 and i % 7 == 2:
print("答曰 这个数值是:{}".format(i))
# for循环依次迭代字符串
string1 = "不要再说我不能"
print(string1)
for ch in string1:
print(ch)... | code_fim | hard | {
"lang": "python",
"repo": "hujianli94/Python-code",
"path": "/2.程序流程语句/循环语句/for循环/for循环.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(result)
'''
print("今有物,不知其数,三三数之余2,五五数之余3,七七数之余2,问何物?")
for i in range(1001):
if i % 3 == 2 and i % 5 == 3 and i % 7 == 2:
print("答曰 这个数值是:{}".format(i))
# for循环依次迭代字符串
string1 = "不要再说我不能"
print(string1)
for ch in string1:
print(ch)<|fim_prefix|># repo: hujianli94/Python-code path: ... | code_fim | medium | {
"lang": "python",
"repo": "hujianli94/Python-code",
"path": "/2.程序流程语句/循环语句/for循环/for循环.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hellofafar/Leetcode path: /Medium/670.py
# ------------------------------
# 670. Maximum Swap
#
# Description:
# Given a non-negative integer, you could swap two digits at most once to get the
# maximum valued number. Return the maximum valued number you could get.
#
# Example 1:
# Input: 2736... | code_fim | hard | {
"lang": "python",
"repo": "Hellofafar/Leetcode",
"path": "/Medium/670.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for j in range(i):
# find the first digit in digitList[:i] that is smaller than maxDigit
if maxDigit > digitList[j]:
digitList[j], digitList[maxIndex] = maxDigit, digitList[j]
break
return int("".join(digitList))
# Used for ... | code_fim | hard | {
"lang": "python",
"repo": "Hellofafar/Leetcode",
"path": "/Medium/670.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param id: id of the CI to delete
:return: 200 on successful delete, 404 if not found
"""
# Does the ci to delete exist?
existing_ci = db.session.query(CI).filter(CI.id == id).one_or_none()
# if found?
if existing_ci is not None:
db.session.delete(existing_ci)
... | code_fim | hard | {
"lang": "python",
"repo": "andy12838729/tb-houston-service",
"path": "/tb_houston_service/ci.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andy12838729/tb-houston-service path: /tb_houston_service/ci.py
"""
This is the deployments module and supports all the ReST actions for the
ci collection
"""
from pprint import pformat
from flask import abort, make_response
from config import app, db
from models import CI, CISchema
def read_... | code_fim | hard | {
"lang": "python",
"repo": "andy12838729/tb-houston-service",
"path": "/tb_houston_service/ci.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = np.loadtxt(open(folder / 'data.csv', 'rb'), delimiter = ',')
time = np.loadtxt(open(folder / 'time.csv', 'rb'), delimiter = ',')
energy = np.loadtxt(open(folder / 'energy.csv', 'rb'), delimiter = ',')
raw_data.change_value(energy = energy, time = time, data_matrix = data)
... | code_fim | medium | {
"lang": "python",
"repo": "cliekhus/Khalil_Gr_Tutorial",
"path": "/big_data_plot/common/Load_Data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cliekhus/Khalil_Gr_Tutorial path: /big_data_plot/common/Load_Data.py
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 26 12:16:20 2020
@author: chelsea
"""
def load_raw_data(input_folder, save_folder):
import numpy as np
from pathlib import Path
import pickle
... | code_fim | hard | {
"lang": "python",
"repo": "cliekhus/Khalil_Gr_Tutorial",
"path": "/big_data_plot/common/Load_Data.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> raw_data = RDC()
folder = Path(input_folder)
data = np.loadtxt(open(folder / 'data.csv', 'rb'), delimiter = ',')
time = np.loadtxt(open(folder / 'time.csv', 'rb'), delimiter = ',')
energy = np.loadtxt(open(folder / 'energy.csv', 'rb'), delimiter = ',')
raw_da... | code_fim | hard | {
"lang": "python",
"repo": "cliekhus/Khalil_Gr_Tutorial",
"path": "/big_data_plot/common/Load_Data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: w4087165/Tenement_By_GaoDe path: /data_server/house/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2019-09-24 20:38
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|>
initial = True
dependencies = [
]... | code_fim | hard | {
"lang": "python",
"repo": "w4087165/Tenement_By_GaoDe",
"path": "/data_server/house/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='LianJiaTenementHouse',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('house_name', models.CharField(max_length=32, verbose_name='房... | code_fim | hard | {
"lang": "python",
"repo": "w4087165/Tenement_By_GaoDe",
"path": "/data_server/house/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> imei = None
try:
uid = int(self.get_argument("uid"))
pet_id = int(self.get_argument("pet_id", -1))
token = self.get_argument("token")
st = yield self.check_token("OnChoosePet", res, uid, token)
if not st:
return
... | code_fim | hard | {
"lang": "python",
"repo": "newguangzhou/now-hello",
"path": "/trunk/src/appserver/apps/user_srv_d/handlers/choose_pet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: newguangzhou/now-hello path: /trunk/src/appserver/apps/user_srv_d/handlers/choose_pet.py
# -*- coding: utf-8 -*-
#import json
#import urllib
import logging
import datetime
import traceback
from lib import error_codes
#from terminal_base import terminal_commands
import pymongo
#from tornado.web im... | code_fim | hard | {
"lang": "python",
"repo": "newguangzhou/now-hello",
"path": "/trunk/src/appserver/apps/user_srv_d/handlers/choose_pet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def fix_spaces():
# If the user put an option with spaces in it in their command
# then this will be included as a single argument to ARGV, but
# we won't be able to spot it later. We need to add in quotes
# if we find this.
for i in range(len(sys.argv)):
... | code_fim | hard | {
"lang": "python",
"repo": "FelixKrueger/GEO-submissions",
"path": "/launch_R1_R2_coverage_file_merging.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FelixKrueger/GEO-submissions path: /launch_R1_R2_coverage_file_merging.py
#!/usr/bin/env python
import os
import glob
from time import sleep as sleep
import gzip
import subprocess
import re
import argparse
def main():
print ("Parsing options")
options = parse_options()
sleep(1)... | code_fim | hard | {
"lang": "python",
"repo": "FelixKrueger/GEO-submissions",
"path": "/launch_R1_R2_coverage_file_merging.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ye-kyaw-thu/NPB_DAA path: /dahsmm/n_script/summary.py
import json
import os
from paver.easy import pushd
import numpy as np
import pickle
import csv
from sklearn import metrics
import argparse
import multiprocessing
import time
import matplotlib
matplotlib.use('Agg') #in the case of perform on se... | code_fim | hard | {
"lang": "python",
"repo": "ye-kyaw-thu/NPB_DAA",
"path": "/dahsmm/n_script/summary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> aioi=[]
aue=[]
ao=[]
ie=[]
uo=[]
for key,key2 in zip(self.sample_states,self.input_data2):
for key3,key4 in zip(key[self.maxlikelihood[1]],key2):
if key4 == 0:
aioi.append(key3)
elif key4 == 1:
... | code_fim | hard | {
"lang": "python",
"repo": "ye-kyaw-thu/NPB_DAA",
"path": "/dahsmm/n_script/summary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.points = [(3,5,0), (1,2,0), (2,7,0)]
def simulate(self):
nodes = []
edges=[]
counter=0
for point in self.points:
nodes.append(sphere(pos=point, radius = 0.5, color = color.red, ))
label(pos=point, text=str(counter))
count... | code_fim | medium | {
"lang": "python",
"repo": "deepti2310/Grade-Diffusion-Algorithm",
"path": "/simulations/vp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deepti2310/Grade-Diffusion-Algorithm path: /simulations/vp.py
from __future__ import division
from visual import *
"""
ball = sphere(pos=(-5,0,0), radius=0.5, color=color.cyan)
wallR = box(pos=(6,0,0), size=(0.2,12,12), color=color.green)
ball.velocity = vector(25,0,0)
deltat = 0.005
t = 0
impor... | code_fim | medium | {
"lang": "python",
"repo": "deepti2310/Grade-Diffusion-Algorithm",
"path": "/simulations/vp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
admin.site.register(tls_feature)
admin.site.register(flow_feature)
admin.site.register(image_feature)
# Register your models here.<|fim_prefix|># repo: axuhongboo/flow_system path: /flow_system/flow_system/feature_extract/admin.py
from django.contrib import admin
from .models import tls_feature
<|fim_mi... | code_fim | medium | {
"lang": "python",
"repo": "axuhongboo/flow_system",
"path": "/flow_system/flow_system/feature_extract/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: axuhongboo/flow_system path: /flow_system/flow_system/feature_extract/admin.py
from django.contrib import admin
from .models import tls_feature
<|fim_suffix|>
admin.site.register(tls_feature)
admin.site.register(flow_feature)
admin.site.register(image_feature)
# Register your models here.<|fim_mi... | code_fim | medium | {
"lang": "python",
"repo": "axuhongboo/flow_system",
"path": "/flow_system/flow_system/feature_extract/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prownie/day02_python path: /ex02/logger.py
import time
from random import randint
def log(function):
def add_log(*args, **kwargs):
f = open("machine.log", "a")
start_time = time.time()
test = function(*args)
f.write("(rpichon)Running: {}\t\t[ ".format(functi... | code_fim | hard | {
"lang": "python",
"repo": "prownie/day02_python",
"path": "/ex02/logger.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
machine = CoffeeMachine()
for i in range(0, 5):
machine.make_coffee()
machine.make_coffee()
machine.add_water(70)<|fim_prefix|># repo: prownie/day02_python path: /ex02/logger.py
import time
from random import randint
def log(function):
def add_lo... | code_fim | hard | {
"lang": "python",
"repo": "prownie/day02_python",
"path": "/ex02/logger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def distanceCal(cx,cy,x,y):
dist=math.sqrt((math.pow(x-cx,2)+math.pow(y-cy,2)))
return dist<|fim_prefix|># repo: 18801308557/versusGame20210401 path: /positionFunc.py
import math
#计算两点之间距离是否小于r
def distanceInR(cx,cy,r,x,y):
<|fim_middle|> dist=math.sqrt((math.pow(x-cx,2)+math.pow(y-cy,2)))
... | code_fim | medium | {
"lang": "python",
"repo": "18801308557/versusGame20210401",
"path": "/positionFunc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 18801308557/versusGame20210401 path: /positionFunc.py
import math
#计算两点之间距离是否小于r
def distanceInR(cx,cy,r,x,y):
<|fim_suffix|> dist=math.sqrt((math.pow(x-cx,2)+math.pow(y-cy,2)))
return dist<|fim_middle|> dist=math.sqrt((math.pow(x-cx,2)+math.pow(y-cy,2)))
if dist<r:
return T... | code_fim | medium | {
"lang": "python",
"repo": "18801308557/versusGame20210401",
"path": "/positionFunc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dist=math.sqrt((math.pow(x-cx,2)+math.pow(y-cy,2)))
return dist<|fim_prefix|># repo: 18801308557/versusGame20210401 path: /positionFunc.py
import math
#计算两点之间距离是否小于r
def distanceInR(cx,cy,r,x,y):
<|fim_middle|> dist=math.sqrt((math.pow(x-cx,2)+math.pow(y-cy,2)))
if dist<r:
return T... | code_fim | medium | {
"lang": "python",
"repo": "18801308557/versusGame20210401",
"path": "/positionFunc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>90 = math.tan(Radians90)
tan90Rounded = round(tan90,2)
print("Sin60:{}".format(sin60Rounded))
print("tan90:{}".format(tan90Rounded))<|fim_prefix|># repo: jagadeesh1414/assign5_note_M2.py path: /assign5_prog6_M2.py
import math
Radians60 = math.radians(60)
sin60 = math.sin(Radians<|fim_middle|>60)
sin60Rou... | code_fim | medium | {
"lang": "python",
"repo": "jagadeesh1414/assign5_note_M2.py",
"path": "/assign5_prog6_M2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jagadeesh1414/assign5_note_M2.py path: /assign5_prog6_M2.py
import math
Radians60 = math.radians(60)
sin60 = math.sin(Radians60)
sin60Rounded = round(sin60,2)
Radians90 = math.radians(90)
tan<|fim_suffix|>0:{}".format(sin60Rounded))
print("tan90:{}".format(tan90Rounded))<|fim_middle|>90 = math.ta... | code_fim | medium | {
"lang": "python",
"repo": "jagadeesh1414/assign5_note_M2.py",
"path": "/assign5_prog6_M2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bincrafters/conan-fluidsynth path: /conanfile.py
from conans import ConanFile, CMake, tools
import os
import shutil
class FluidSynthConan(ConanFile):
class CustomOption(object):
def __init__(self, name,
values=None,
default=None,
... | code_fim | hard | {
"lang": "python",
"repo": "bincrafters/conan-fluidsynth",
"path": "/conanfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def build(self):
self._patch_files()
with tools.environment_append({"PKG_CONFIG_PATH": self.source_folder}):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
... | code_fim | hard | {
"lang": "python",
"repo": "bincrafters/conan-fluidsynth",
"path": "/conanfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: menmob/speedruncom-yt-archival path: /getrunsfromgames.py
import json
import requests
import time
import os
import sys
import random
def getprox():
proxies = ['u2.p.webshare.io:10000',
'u3.p.webshare.io:10001',
'u2.p.webshare.io:10002',
'u2.p.webshare.io:10003',
'u2.p.webshare.io:10004',
'e... | code_fim | hard | {
"lang": "python",
"repo": "menmob/speedruncom-yt-archival",
"path": "/getrunsfromgames.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> offset += 200
if offset >= 9800:
with open('failedgames.txt', 'a') as f:
f.write(game + "\n")
f.close()
continue_game = False
continue
try:
if len(data['data']) < 1:
continue... | code_fim | hard | {
"lang": "python",
"repo": "menmob/speedruncom-yt-archival",
"path": "/getrunsfromgames.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/users/delete/<uid>")
def delete_users(uid):
cursor.execute("DELETE FROM USERDB.users WHERE ID="+str(uid))
db.commit()
return get_all_users()
@app.route('/users/all')
def get_all_users():
cursor.execute("select * from USERDB.users")
data = cursor.fetchall()
if data:
... | code_fim | hard | {
"lang": "python",
"repo": "manishjindal/Kubernetes-apps",
"path": "/Examples/MultiContainerExample/RegistrationApp/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = request.form['user']
contact = request.form['contact']
game_type = request.form['game_type']
cursor.execute("UPDATE USERDB.users SET USER='"+str(user)+"',CONTACT='"+str(contact)+"',GAME_TYPE='"+str(game_type)+"' WHERE ID="+str(uid))
db.commit()
return get_all_users()
@app.r... | code_fim | hard | {
"lang": "python",
"repo": "manishjindal/Kubernetes-apps",
"path": "/Examples/MultiContainerExample/RegistrationApp/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manishjindal/Kubernetes-apps path: /Examples/MultiContainerExample/RegistrationApp/app.py
from flask import Flask, render_template
from flask import Response
from flask import request
from datetime import datetime
import MySQLdb
import sys
import time
import hashlib
import os
import json
import r... | code_fim | hard | {
"lang": "python",
"repo": "manishjindal/Kubernetes-apps",
"path": "/Examples/MultiContainerExample/RegistrationApp/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tjmode/python path: /s03e08.py
import array
a=int(input())
arr = array.array('i', [])
for j in range(0,a):
n=int(in<|fim_suffix|>a):
print(arr[j], end =" ")
print(j)<|fim_middle|>put())
arr.append(n);
for j in range(0, | code_fim | easy | {
"lang": "python",
"repo": "tjmode/python",
"path": "/s03e08.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>a):
print(arr[j], end =" ")
print(j)<|fim_prefix|># repo: tjmode/python path: /s03e08.py
import array
a=int(input())
arr = array.arra<|fim_middle|>y('i', [])
for j in range(0,a):
n=int(input())
arr.append(n);
for j in range(0, | code_fim | medium | {
"lang": "python",
"repo": "tjmode/python",
"path": "/s03e08.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tjmode/python path: /s03e08.py
import array
a=int(input())
arr = array.arra<|fim_suffix|>a):
print(arr[j], end =" ")
print(j)<|fim_middle|>y('i', [])
for j in range(0,a):
n=int(input())
arr.append(n);
for j in range(0, | code_fim | medium | {
"lang": "python",
"repo": "tjmode/python",
"path": "/s03e08.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>hip)
admin.site.register(Container)
admin.site.register(Dock)
admin.site.register(Employee)
admin.site.register(DockHistory)<|fim_prefix|># repo: calindragomir/rdamport path: /main/admin.py
from django.contrib import admin
from main.models import Ship,<|fim_middle|> Container, Dock, Employee, DockHistory... | code_fim | medium | {
"lang": "python",
"repo": "calindragomir/rdamport",
"path": "/main/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: calindragomir/rdamport path: /main/admin.py
from django.contrib import admin
from main.models import Ship, Container, Dock, Employee, DockHistory
admin.site.register(S<|fim_suffix|>admin.site.register(Employee)
admin.site.register(DockHistory)<|fim_middle|>hip)
admin.site.register(Container)
adm... | code_fim | medium | {
"lang": "python",
"repo": "calindragomir/rdamport",
"path": "/main/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(Employee)
admin.site.register(DockHistory)<|fim_prefix|># repo: calindragomir/rdamport path: /main/admin.py
from django.contrib import admin
from main.models import Ship,<|fim_middle|> Container, Dock, Employee, DockHistory
admin.site.register(Ship)
admin.site.register(Container)
adm... | code_fim | medium | {
"lang": "python",
"repo": "calindragomir/rdamport",
"path": "/main/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtils/ems path: /ems/qt4/gui/completer/fuzzy.py
#coding=utf-8
'''
Created on 24.03.2013
@author: michi
'''
from PyQt4.QtCore import QObject, QAbstractItemModel, QRegExp, QStringList, \
pyqtSignal, QModelIndex, Qt
from PyQt4.QtGui import QCompleter, QSortFilterProxyModel
from ems.qt4.util im... | code_fim | hard | {
"lang": "python",
"repo": "mtils/ems",
"path": "/ems/qt4/gui/completer/fuzzy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''QStringList FuzzyCompleter.splitPath(QString path)'''
if self._filtering == FuzzyCompleter.StartsWith:
paths = QCompleter.splitPath(self, path)
elif self._filtering == FuzzyCompleter.Contains:
self._updateSortFilterProxyModel();
self._sortFilt... | code_fim | hard | {
"lang": "python",
"repo": "mtils/ems",
"path": "/ems/qt4/gui/completer/fuzzy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> outputs = {}
for bot in topological_sort(g):
low = min(g.nodes[bot]["vals"])
high = max(g.nodes[bot]["vals"])
if low == 17 and high == 61:
print("Part 1:", bot)
for n in g[bot]:
if g[bot][n]["x"] == "low":
... | code_fim | hard | {
"lang": "python",
"repo": "benediktwerner/AdventOfCode",
"path": "/2016/day10/sol.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for bot in topological_sort(g):
low = min(g.nodes[bot]["vals"])
high = max(g.nodes[bot]["vals"])
if low == 17 and high == 61:
print("Part 1:", bot)
for n in g[bot]:
if g[bot][n]["x"] == "low":
g.nod... | code_fim | hard | {
"lang": "python",
"repo": "benediktwerner/AdventOfCode",
"path": "/2016/day10/sol.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benediktwerner/AdventOfCode path: /2016/day10/sol.py
#!/usr/bin/env python3
from os import path
from networkx import DiGraph, topological_sort
def main():
with open(path.join(path.dirname(__file__), "input.txt")) as f:
g = DiGraph()
for line in f:
line = line.s... | code_fim | hard | {
"lang": "python",
"repo": "benediktwerner/AdventOfCode",
"path": "/2016/day10/sol.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ntent import MaitulContent,MaitulContentTag
from .tag import MaitulTag<|fim_prefix|># repo: xuannanxan/maitul-manage path: /service/app/models/maitul/__init__.py
#!/usr/bin/env python
# coding=utf-8
'''
@Description:
@Author: Xuan<|fim_middle|>nan
@Date: 2020-01-31 10:46:21
@LastEditTime : 2020-01-31 13... | code_fim | medium | {
"lang": "python",
"repo": "xuannanxan/maitul-manage",
"path": "/service/app/models/maitul/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xuannanxan/maitul-manage path: /service/app/models/maitul/__init__.py
#!/usr/bin/env python
# coding=utf-8
'''
@Description:
@Author: Xuan<|fim_suffix|>ntent import MaitulContent,MaitulContentTag
from .tag import MaitulTag<|fim_middle|>nan
@Date: 2020-01-31 10:46:21
@LastEditTime : 2020-01-31 13... | code_fim | medium | {
"lang": "python",
"repo": "xuannanxan/maitul-manage",
"path": "/service/app/models/maitul/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: N2OMatt/abandoned_ProjectEuler path: /problems/euler46/euler46.py
#!/usr/bin/python
# Imports #
import sys
sys.path.insert(0, "../../include/python/");
import eulersupport;
import eulermath;
def f(n):
#We treat prime as number that can be written.
if(eulermath.PrimesHelper().is_prime(n))... | code_fim | hard | {
"lang": "python",
"repo": "N2OMatt/abandoned_ProjectEuler",
"path": "/problems/euler46/euler46.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> eulersupport.name = "euler46";
run();
def run_test():
eulersupport.name = "euler46-Test";
eulersupport.write_output("I'd not test");
def main():
run_mode = eulersupport.get_run_mode();
if(run_mode == eulersupport.kRunModeFull):
run_full();
else:
run_test();
i... | code_fim | hard | {
"lang": "python",
"repo": "N2OMatt/abandoned_ProjectEuler",
"path": "/problems/euler46/euler46.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def insert(key, value, eventid):
default = ''
namer = shortnamer = tickerr = rid = default
cid = key+'_'+str(eventid)
eventid = eventid
category = value.get('category', default)
categoryName = value.get('categoryName', default)
detection = value.get('detection', default)
typeGroup ... | code_fim | hard | {
"lang": "python",
"repo": "bibiboot/panda",
"path": "/index/readCallis.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bibiboot/panda path: /index/readCallis.py
import urllib2
import random
import MySQLdb
import pprint
import pdb
from events.models import Event, Meta
from datetime import datetime
key="ne62f3m8swrsv2cvmf78rkx2"
def call(body):
url = "http://api.opencalais.com/tag/rs/enrich"
opener = urll... | code_fim | hard | {
"lang": "python",
"repo": "bibiboot/panda",
"path": "/index/readCallis.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for inst in instances:
cid = cid+' '+str(random.randint(1,10))
try:
Meta.objects.create(cid=cid,
eventid=eventid,
category=category,
categoryName=categoryName,
detection=... | code_fim | hard | {
"lang": "python",
"repo": "bibiboot/panda",
"path": "/index/readCallis.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SergeyVorobyov/a_ds_python path: /hw3/task_2.py
# 2. Во втором массиве сохранить индексы четных элементов первого массива.
# Например, если дан массив со значениями 8, 3, 15, 6, 4, 2, то во второй массив надо заполнить
# значениями 0, 3, 4, 5 , т.к. именно в этих позициях первого массива стоят ч... | code_fim | medium | {
"lang": "python",
"repo": "SergeyVorobyov/a_ds_python",
"path": "/hw3/task_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>output_array = [j for j in range(len(input_array)) if input_array[j]%2 == 0]
print('Массив индексов четных элементов:')
print(output_array)<|fim_prefix|># repo: SergeyVorobyov/a_ds_python path: /hw3/task_2.py
# 2. Во втором массиве сохранить индексы четных элементов первого массива.
# Например, если да... | code_fim | hard | {
"lang": "python",
"repo": "SergeyVorobyov/a_ds_python",
"path": "/hw3/task_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrsmith3/refmanage path: /refmanage/utils.py
# -*- coding: utf-8 -*-
"""
Utility functions (:mod:`refmanage.fs_utils`)
=============================================
.. currentmodule:: fs_utils
"""
import os
import glob
import pathlib2 as pathlib
from pybtex.database.input import bibtex
from pyb... | code_fim | hard | {
"lang": "python",
"repo": "jrsmith3/refmanage",
"path": "/refmanage/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Sublist of bibfile_data whos elements are val_type
This method examines each bib_dict element of a bibfile_data list and returns the subset which can be classified according to val_type.
:param list bibfile_data: List containing `RefFile`s.
:param type val_type:
:rtype: list
... | code_fim | hard | {
"lang": "python",
"repo": "jrsmith3/refmanage",
"path": "/refmanage/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Clarapuce/backup-vm path: /POO/point3D.py
from point2D import Point2D
class Point3D(Point2D):
_z:int
def __init__(self,x,y,z):
<|fim_suffix|> return(self._z)
def __setZ__(self,z):
self._z=z<|fim_middle|> super().__init__(x,y)
self._z = z
def __... | code_fim | medium | {
"lang": "python",
"repo": "Clarapuce/backup-vm",
"path": "/POO/point3D.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __setZ__(self,z):
self._z=z<|fim_prefix|># repo: Clarapuce/backup-vm path: /POO/point3D.py
from point2D import Point2D
class Point3D(Point2D):
_z:int
def __init__(self,x,y,z):
super().__init__(x,y)
self._z = z
<|fim_middle|> def __getZ__(self) -> int:
... | code_fim | easy | {
"lang": "python",
"repo": "Clarapuce/backup-vm",
"path": "/POO/point3D.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return(self._z)
def __setZ__(self,z):
self._z=z<|fim_prefix|># repo: Clarapuce/backup-vm path: /POO/point3D.py
from point2D import Point2D
class Point3D(Point2D):
_z:int
<|fim_middle|> def __init__(self,x,y,z):
super().__init__(x,y)
self._z = z
def __... | code_fim | medium | {
"lang": "python",
"repo": "Clarapuce/backup-vm",
"path": "/POO/point3D.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.