text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> name = UnicodeParam('name',required=True,description='The name to post.')
def execute(self,request,data,params):
posted_name = params['name']
return 'Posted %s' % posted_name
class PutMe(Descriptor):
"""
Puts a hello world message.
"""
visible = False
name = ... | code_fim | medium | {
"lang": "python",
"repo": "Axilent/sharrock",
"path": "/sharrock_resource_example/descriptors.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
A resource that you can get,post,put and delete.
"""
get = GetMe()
post = PostMe()
put = PutMe()
delete = DeleteMe()
class PartialResource(Resource):
"""
A resource with only one method implemented.
"""
get = GetMe()<|fim_prefix|># repo: Axilent/sharrock p... | code_fim | hard | {
"lang": "python",
"repo": "Axilent/sharrock",
"path": "/sharrock_resource_example/descriptors.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "KNNClassifier({!s})".format(self.k)
def predict(self, data):
size = self.x.shape[0]
diff_matrix = np.tile(data, (size, 1)) - self.x
sq_matrix = diff_matrix ** 2
sum_matrix = sq_matrix.sum(axis=1)
distances = sum_matrix ** 0.5
sorted_... | code_fim | medium | {
"lang": "python",
"repo": "ryanxjhan/mlkit-learn",
"path": "/mklearn/knn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryanxjhan/mlkit-learn path: /mklearn/knn.py
import sys
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
class KNNBase:
def __init__(self, k):
self.k = k
def fit(self, x, y):
self.... | code_fim | hard | {
"lang": "python",
"repo": "ryanxjhan/mlkit-learn",
"path": "/mklearn/knn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Queens-Hacks/tweetmatch path: /.scratch/o.py
from math import log, exp
# size of inputs
I = lambda T, Uu, Uf: T * ((Uu + Uf) ** 2 - (Uu + Uf))
# max probability of positive for one iteration
P_one = lambda R, Pt: Pt ** (1.0 / R)
# probability of positive
P_r = lambda n, s: (n - 1.0) / s
# max... | code_fim | medium | {
"lang": "python",
"repo": "Queens-Hacks/tweetmatch",
"path": "/.scratch/o.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>m_k = lambda n, k, P: -(k * n) / log(1 - P ** (1 / float(k)))<|fim_prefix|># repo: Queens-Hacks/tweetmatch path: /.scratch/o.py
from math import log, exp
# size of inputs
I = lambda T, Uu, Uf: T * ((Uu + Uf) ** 2 - (Uu + Uf))
# max probability of positive for one iteration
P_one = lambda R, Pt: Pt ** (... | code_fim | hard | {
"lang": "python",
"repo": "Queens-Hacks/tweetmatch",
"path": "/.scratch/o.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = j = 0
while j < m:
if pat[i] == txt[j]:
i += 1
j += 1
if i == n:
return j-i
i = lps[i-1]
elif j < m and pat[i] != txt[j]:
if i != 0:
i = lps[i-1]
else:
j += 1
ret... | code_fim | medium | {
"lang": "python",
"repo": "sacsachin/programing",
"path": "/strstr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sacsachin/programing path: /strstr.py
# !/usr/bin/python3
"""
KMP Algoritgm.
"""
def find_lps(s, n, lps):
l = 0
i = 1
while i < n:
if s[i] == s[l]:
l += 1
lps[i] = l
i += 1
else:
if l != 0:
l = lps[l-1]
... | code_fim | medium | {
"lang": "python",
"repo": "sacsachin/programing",
"path": "/strstr.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> n = len(p)
m = len(t)
lps = [0]*n
find_lps(p, n, lps)
ans = kmp(p, n, t, m, lps)
return ans
if __name__ == "__main__":
t = input()
p = input()
print(solve(p, t))<|fim_prefix|># repo: sacsachin/programing path: /strstr.py
# !/usr/bin/python3
"""
KMP Algoritgm.
"""
de... | code_fim | medium | {
"lang": "python",
"repo": "sacsachin/programing",
"path": "/strstr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta(ContactSerializerBase.Meta):
fields = ContactSerializerBase.Meta.fields + ('home', 'company_set')<|fim_prefix|># repo: mahuntington/companies_contacts_locations path: /contacts_api/serializers.py
from .serializers_base import ContactSerializerBase
from locations_api.serializers_bas... | code_fim | hard | {
"lang": "python",
"repo": "mahuntington/companies_contacts_locations",
"path": "/contacts_api/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahuntington/companies_contacts_locations path: /contacts_api/serializers.py
from .serializers_base import ContactSerializerBase
from locations_api.serializers_base import LocationSerializerBase
from companies_api.serializers_base import CompanySerializerWithHeadquarters
class ContactSerializer(... | code_fim | medium | {
"lang": "python",
"repo": "mahuntington/companies_contacts_locations",
"path": "/contacts_api/serializers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> events_information = "These are upcoming events that I have organized."
context = {'events_information': events_information}
return render(request, 'events.html', context=context)<|fim_prefix|># repo: futurefalon/djangolesson path: /source/views.py
from django.shortcuts import render
from .models imp... | code_fim | hard | {
"lang": "python",
"repo": "futurefalon/djangolesson",
"path": "/source/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: futurefalon/djangolesson path: /source/views.py
from django.shortcuts import render
from .models import Person, Sign
def home(request):
homeText = "Welcome to the home page."
context = {'homeText':homeText}
return render(request, 'home.html', context=context)
def about(request):
#person = P... | code_fim | hard | {
"lang": "python",
"repo": "futurefalon/djangolesson",
"path": "/source/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebfest/homepage path: /apps/blog/tests.py
import datetime
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from blog.factories import PostFactory
from blog.models import Post
class PostTestCase(TestCase):
post: Post = None
@classmetho... | code_fim | hard | {
"lang": "python",
"repo": "sebfest/homepage",
"path": "/apps/blog/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_post_tag_content(self):
"""Test post content presented."""
url = reverse(
'blog:post_tag_list',
kwargs={'slug': self.post.slug}
)
response = self.client.get(url)
self.assertEqual(200, response.status_code)
self.assertTemp... | code_fim | hard | {
"lang": "python",
"repo": "sebfest/homepage",
"path": "/apps/blog/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rendellc/thesis-code path: /ws/launch/all.launch.py
from threading import Condition
from launch import LaunchDescription
import launch
from launch.substitution import Substitution
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launc... | code_fim | hard | {
"lang": "python",
"repo": "rendellc/thesis-code",
"path": "/ws/launch/all.launch.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # operation_manual = include_launch_file(
# "operation", "launch/manual.launch.py")
# operation = include_launch_file(
operations = [
ExecuteProcess(
cmd=["ros2", "launch", "operation", "manual.launch.py"],
condition=IfCondition(LaunchConfiguration("use_m... | code_fim | hard | {
"lang": "python",
"repo": "rendellc/thesis-code",
"path": "/ws/launch/all.launch.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(), color='red', linestyle='--', linewidth=4, label='mean')
plt.legend()
plt.show()<|fim_prefix|># repo: tleonhardt/CodingPlayground path: /python/matplotlib/vertical_line.py
#!/usr/bin/env python
"""
Example of using plt.axvline() to plot a a vertical line<|fim_middle|> on a Matplotlib plot.
"""
import ... | code_fim | medium | {
"lang": "python",
"repo": "tleonhardt/CodingPlayground",
"path": "/python/matplotlib/vertical_line.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChengChiongWah/Erp_Develop path: /sale_extend/models/res_partner.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
from odoo.addons.base.res.res_partner import WARNING_MESSAGE, WARNING_HELP
<|fim_suffix|> sa... | code_fim | medium | {
"lang": "python",
"repo": "ChengChiongWah/Erp_Develop",
"path": "/sale_extend/models/res_partner.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sale_order_ids = fields.One2many('sale.reject', 'partner_id')<|fim_prefix|># repo: ChengChiongWah/Erp_Develop path: /sale_extend/models/res_partner.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
from odoo.addons.b... | code_fim | medium | {
"lang": "python",
"repo": "ChengChiongWah/Erp_Develop",
"path": "/sale_extend/models/res_partner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # work on
path('mainPage', views.mainPage, name='mainPage'),
path('member1', views.member1, name='member1'),
path('member2', views.member2, name='member2'),
path('member3', views.member3, name='member3'),
path('equipManage', views.equipManage, name='equipManage'),
path('systemM... | code_fim | hard | {
"lang": "python",
"repo": "FengyuWang123/backEndWeb",
"path": "/backEndWeb/public/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FengyuWang123/backEndWeb path: /backEndWeb/public/urls.py
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from . import views
app_name = 'public'
<|fim_suffix|> # work on
path('mainPage', views.mainPage, name='mainPage'),
path('member1', vie... | code_fim | hard | {
"lang": "python",
"repo": "FengyuWang123/backEndWeb",
"path": "/backEndWeb/public/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('Game', '0007_auto_20210425_1443'),
]
operations = [
migrations.AddField(
model_name='game',
name='Start',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False... | code_fim | medium | {
"lang": "python",
"repo": "geetnsh2k1/TECH-BINGO",
"path": "/Game/migrations/0008_game_start.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geetnsh2k1/TECH-BINGO path: /Game/migrations/0008_game_start.py
# Generated by Django 3.1.3 on 2021-04-25 09:53
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "geetnsh2k1/TECH-BINGO",
"path": "/Game/migrations/0008_game_start.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('Game', '0007_auto_20210425_1443'),
]
operations = [
migrations.AddField(
model_name='game',
name='Start',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone... | code_fim | medium | {
"lang": "python",
"repo": "geetnsh2k1/TECH-BINGO",
"path": "/Game/migrations/0008_game_start.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HTML-as-programming-language/project-software path: /client/gui/widgets/module_actions.py
from tkinter import Frame, Button
BG = "#d6d0ed"
<|fim_suffix|> super().__init__(master, borderwidth="2", relief="ridge", bg=BG)
actions = module.get_actions()
row = 0
for ke... | code_fim | medium | {
"lang": "python",
"repo": "HTML-as-programming-language/project-software",
"path": "/client/gui/widgets/module_actions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, master, module):
super().__init__(master, borderwidth="2", relief="ridge", bg=BG)
actions = module.get_actions()
row = 0
for key in actions.keys():
btn = Button(self, text=key, command=actions[key])
btn.grid(column=0, row=row, ... | code_fim | easy | {
"lang": "python",
"repo": "HTML-as-programming-language/project-software",
"path": "/client/gui/widgets/module_actions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def bfs_words(begin, end, dict_words):
queue, visited = deque([(begin, 1)]), set()
while queue:
word, steps = queue.popleft()
if word not in visited:
visited.add(word)
if word == end:
... | code_fim | hard | {
"lang": "python",
"repo": "jcp0578/practise-Python",
"path": "/leecode/单词接龙/ladderLength.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def construct_dict(word_list):
d = {}
for word in word_list:
for i in range(len(word)):
s = word[:i] + "_" + word[i+1:]
d[s] = d.get(s, []) + [word]
return d
def bfs_words(begin, end, d... | code_fim | hard | {
"lang": "python",
"repo": "jcp0578/practise-Python",
"path": "/leecode/单词接龙/ladderLength.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jcp0578/practise-Python path: /leecode/单词接龙/ladderLength.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
AC
'''
import sys
import time
import collections
import string
class Solution:
def ladderLength(self, beginWord, endWord, wordList):
queue = collections.deque([(beginWord, 1)])
... | code_fim | hard | {
"lang": "python",
"repo": "jcp0578/practise-Python",
"path": "/leecode/单词接龙/ladderLength.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hakansgit/satPassAPI path: /satPassLambda/tle.py
import urllib.request
from skyfield.api import EarthSatellite
from settings import TLE_SETTINGS
from utils import chunker
TLEs = []
TLEs_byID = {}
satellites = []
satellites_byID = {}
def prep_data():
<|fim_suffix|> TLEs_byID = {sat['id']: s... | code_fim | hard | {
"lang": "python",
"repo": "hakansgit/satPassAPI",
"path": "/satPassLambda/tle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = TLE_SETTINGS['url']
req = urllib.request.Request(url, method='GET')
retrieved_lines = []
with urllib.request.urlopen(req) as f:
if f.status == 200:
retrieved_lines = [line.decode().replace('\r\n', '').strip()
for line in list(f.read... | code_fim | medium | {
"lang": "python",
"repo": "hakansgit/satPassAPI",
"path": "/satPassLambda/tle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CarlosDaniel0/vacinacao-pi path: /app/scraping/terminal.py
def progress():
pass
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERL... | code_fim | medium | {
"lang": "python",
"repo": "CarlosDaniel0/vacinacao-pi",
"path": "/app/scraping/terminal.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return '{}{}{}'.format(bcolors.OKGREEN, text, bcolors.ENDC)
@staticmethod
def warning(text):
return '{}{}{}'.format(bcolors.WARNING, text, bcolors.ENDC)
@staticmethod
def header(text):
return '{}{}{}'.format(bcolors.HEADER, text, bcolors.ENDC)
@staticmethod
... | code_fim | hard | {
"lang": "python",
"repo": "CarlosDaniel0/vacinacao-pi",
"path": "/app/scraping/terminal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return '{}{}{}'.format(bcolors.HEADER, text, bcolors.ENDC)
@staticmethod
def bold(text):
return '{}{}{}'.format(bcolors.Bold, text, bcolors.ENDC)
@staticmethod
def underline(text):
return '{}{}{}'.format(bcolors.UNDERLINE, text, bcolors.ENDC)<|fim_prefix|># repo: ... | code_fim | hard | {
"lang": "python",
"repo": "CarlosDaniel0/vacinacao-pi",
"path": "/app/scraping/terminal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #https://docs.astropy.org/en/stable/coordinates/transforming.html
#https://docs.astropy.org/en/stable/api/astropy.coordinates.AltAz.html
#Transform target to a SkyCoord object with Altitude/Azimuth coordinate system
target_altaz = self.target.transform_to(AltAz(obstime=t... | code_fim | hard | {
"lang": "python",
"repo": "mattleung10/GoTo_Telescope_Mount",
"path": "/coordinates_manager.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattleung10/GoTo_Telescope_Mount path: /coordinates_manager.py
#https://keflavich-astropy.readthedocs.io/en/latest/coordinates/observing-example.html
#https://docs.astropy.org/en/stable/coordinates/
import astropy as ast
from astropy.coordinates import SkyCoord, EarthLocation, AltAz, get_bod... | code_fim | medium | {
"lang": "python",
"repo": "mattleung10/GoTo_Telescope_Mount",
"path": "/coordinates_manager.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> c = socket.socket()
'''
portBrojToConnectTo = int(input("Na koji port da se spojim? "))
'''
portBrojToConnectTo = 40103
time.sleep(5)
c.connect(('localhost', portBrojToConnectTo))
c.send(bytes(zaPoslati, "utf-8"))<|fim_prefix|># repo: Damjan987/vjezba1_programiranje_internet path: /vjezba1.py
imp... | code_fim | hard | {
"lang": "python",
"repo": "Damjan987/vjezba1_programiranje_internet",
"path": "/vjezba1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Damjan987/vjezba1_programiranje_internet path: /vjezba1.py
import socket
import threading
import time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Socket Created")
<|fim_suffix|>if (portBroj == 40101):
c = socket.socket()
portBrojToConnectTo = int(input("Na koji port da se sp... | code_fim | medium | {
"lang": "python",
"repo": "Damjan987/vjezba1_programiranje_internet",
"path": "/vjezba1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kuben/RPi-robot path: /testing/read_test.py
import RPi.GPIO as GPIO # import RPi.GPIO module
import time
last_edge = time.perf_counter()
read_freq = 0
def handle(pin):
global last_edge
global read_freq
now = time.perf_counter()
read_freq = 1/(now-last_edge)
last... | code_fim | hard | {
"lang": "python",
"repo": "kuben/RPi-robot",
"path": "/testing/read_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
GPIO.setmode(GPIO.BCM) # choose BCM or BOARD
#GPIO.setup(port_or_pin, GPIO.IN) # set a port/pin as an input
#GPIO.setup(22, GPIO.OUT) # set a port/pin as an output
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
#GPIO.output(22, 1)
GPIO.add_event_detect(4, GPIO.RISING, han... | code_fim | medium | {
"lang": "python",
"repo": "kuben/RPi-robot",
"path": "/testing/read_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sachsbl/poky path: /file_processing/process_file.py
import os
import uuid
import boto3
if 'SOURCE_BUCKET' in os.environ:
source_bucket = os.environ['SOURCE_BUCKET']
else:
source_bucket = 'test-poky-input'
<|fim_suffix|>s3 = boto3.resource('s3')
copy_source = {
'Bucket': source_b... | code_fim | hard | {
"lang": "python",
"repo": "sachsbl/poky",
"path": "/file_processing/process_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>copy_source = {
'Bucket': source_bucket,
'Key': source_key
}
bucket = s3.Bucket(output_bucket)
print(f"Copying {source_key} from s3 bucket {source_bucket} to s3 bucket {output_bucket}. "
f"New name: {output_key}")
bucket.copy(copy_source, output_key)
print("Completed")<|fim_prefix|... | code_fim | medium | {
"lang": "python",
"repo": "sachsbl/poky",
"path": "/file_processing/process_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s3 = boto3.resource('s3')
copy_source = {
'Bucket': source_bucket,
'Key': source_key
}
bucket = s3.Bucket(output_bucket)
print(f"Copying {source_key} from s3 bucket {source_bucket} to s3 bucket {output_bucket}. "
f"New name: {output_key}")
bucket.copy(copy_source, output_key)
prin... | code_fim | hard | {
"lang": "python",
"repo": "sachsbl/poky",
"path": "/file_processing/process_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open('datareport/燕瘦小程序测试报告.html', 'wb') as file:
runner = HTMLTestRunnerNew.HTMLTestRunner(stream=file, verbosity=2,title="燕瘦小程序测试报告",
description="接口自动化测试",tester="秋")
runner.run(suit)<|fim_prefix|># repo: 1442808785/python_manage path: /testRep... | code_fim | medium | {
"lang": "python",
"repo": "1442808785/python_manage",
"path": "/testReport.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1442808785/python_manage path: /testReport.py
import unittest
import HTMLTestRunnerNew
from common.testHttpRequest import TestHttpRequest
<|fim_suffix|>with open('datareport/燕瘦小程序测试报告.html', 'wb') as file:
runner = HTMLTestRunnerNew.HTMLTestRunner(stream=file, verbosity=2,title="燕瘦小程序测试报告",
... | code_fim | medium | {
"lang": "python",
"repo": "1442808785/python_manage",
"path": "/testReport.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def bug_menu(self):
self.click(self.bug_menu_click)
def user_info_click(self):
self.click(self.user_info)
def quit_login_click(self):
self.click(self.quit_login)
if __name__=='__main__':
driver = Browser().get_driver()
driver.get(Config.get_config_url)
ma... | code_fim | hard | {
"lang": "python",
"repo": "dengdaxin/Zentao_framework",
"path": "/element_infos/main_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dengdaxin/Zentao_framework path: /element_infos/main_page.py
from common.element_info_utils import ElementUtils
from common.basepage import BasePage
from common.browser import Browser
from common.login_base import LoginBase
from common.read_config_utils import Config
class MainPage(BasePage):
... | code_fim | medium | {
"lang": "python",
"repo": "dengdaxin/Zentao_framework",
"path": "/element_infos/main_page.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__=='__main__':
driver = Browser().get_driver()
driver.get(Config.get_config_url)
main = LoginBase(driver).default_login()
m = MainPage(driver)
m.timeout(2)
m.user_info_click()
m.quit_login_click()<|fim_prefix|># repo: dengdaxin/Zentao_framework path: /element_infos/m... | code_fim | medium | {
"lang": "python",
"repo": "dengdaxin/Zentao_framework",
"path": "/element_infos/main_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert list(Circle(iterable, maxtimes)) == list(output)<|fim_prefix|># repo: reachtarunhere/python-workout path: /ch10-iterators/test_e47_circle.py
from e47_circle import Circle
import pytest
<|fim_middle|>
@pytest.mark.parametrize('iterable, maxtimes, output', [
('abcd', 7, 'abcdabc'),
([10... | code_fim | hard | {
"lang": "python",
"repo": "reachtarunhere/python-workout",
"path": "/ch10-iterators/test_e47_circle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reachtarunhere/python-workout path: /ch10-iterators/test_e47_circle.py
from e47_circle import Circle
import pytest
<|fim_suffix|> assert list(Circle(iterable, maxtimes)) == list(output)<|fim_middle|>
@pytest.mark.parametrize('iterable, maxtimes, output', [
('abcd', 7, 'abcdabc'),
([10... | code_fim | hard | {
"lang": "python",
"repo": "reachtarunhere/python-workout",
"path": "/ch10-iterators/test_e47_circle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ojh/trackmybmi path: /trackmybmi/api/serializers.py
from rest_framework import serializers
from measurements.models import Measurement
from users.models import User
class UserSerializer(serializers.HyperlinkedModelSerializer):
measurements = serializers.HyperlinkedRelatedField(
que... | code_fim | medium | {
"lang": "python",
"repo": "ojh/trackmybmi",
"path": "/trackmybmi/api/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> measurements = serializers.HyperlinkedRelatedField(
queryset=Measurement.objects.all(),
view_name='measurement-detail',
many=True)
class Meta:
model = User
fields = ('url', 'email', 'measurements')
class MeasurementSerializer(serializers.HyperlinkedModelS... | code_fim | medium | {
"lang": "python",
"repo": "ojh/trackmybmi",
"path": "/trackmybmi/api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = lcm_list(A) - 1
print(sum(x % a for a in A))<|fim_prefix|># repo: wkwkgg/atcoder path: /abc/problems110/103/c.py
from fractions import gcd
from functools import reduce
def lcm(x, y):
return (x * y) // gcd(x, y)
def lcm_list(nums):
<|fim_middle|> return reduce(lcm, nums, 1)
N = int(input(... | code_fim | medium | {
"lang": "python",
"repo": "wkwkgg/atcoder",
"path": "/abc/problems110/103/c.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wkwkgg/atcoder path: /abc/problems110/103/c.py
from fractions import gcd
from functools import reduce
<|fim_suffix|>
def lcm_list(nums):
return reduce(lcm, nums, 1)
N = int(input())
A = list(map(int, input().split()))
x = lcm_list(A) - 1
print(sum(x % a for a in A))<|fim_middle|>def lcm(... | code_fim | easy | {
"lang": "python",
"repo": "wkwkgg/atcoder",
"path": "/abc/problems110/103/c.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmenini/nst-for-us-imaging path: /eval_score.py
from PIL import Image
import tensorflow as tf
def mse(result, true):
result = tf.image.rgb_to_grayscale(result) * 255.0
true = tf.image.rgb_to_grayscale(true) * 255.0
return tf.reduce_mean((result - true)**2)
psnr_score, ssim_s... | code_fim | hard | {
"lang": "python",
"repo": "dmenini/nst-for-us-imaging",
"path": "/eval_score.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #style = tf.image.crop_to_bounding_box(style, 0, 193, 1000, 1000)
#mask = tf.image.crop_to_bounding_box(mask, 0, 193, 1000, 1000)
stylized = tf.multiply(mask, stylized)
style = tf.multiply(mask, style)
mse_score = mse(stylized, style)
psnr_score.append(tf.image.psnr(stylized, style, max_val... | code_fim | medium | {
"lang": "python",
"repo": "dmenini/nst-for-us-imaging",
"path": "/eval_score.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Robin8342/RobinHood path: /Tensorflow/TensorflowWide.py
#Deep Models : 정보의 일반화 -> 참새는 날 수 있다. -> 비둘기는 날 수 있다 -> 날개를 가진 동물은 날 수 있다.
#Wide Models : 정보의 암기
#Wide & Deep Learning : 추천 시스템, 검색 및 순위 문제 같은 많은 양의 범주형 특징이 있는 데이터를 사용할 때 사용된다.
#복잡한 패턴과 간단한 규칙 모두 학습할 수 있다.
#단 wide Deep Learning은 keras 함수형 ap... | code_fim | hard | {
"lang": "python",
"repo": "Robin8342/RobinHood",
"path": "/Tensorflow/TensorflowWide.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>scaler = StandardScaler()
#StandardScaler() : 표준 정규분포, MinMaxScaler(): 최소,최대 스케일 변환
#MaxAbsScaler() : 최대 절댓값 1로 변환 (이상치 영향이 큼), RobustScaler() : StandardScaler보다 표준화 후 동일한 값을 넓게 분포
X_train = scaler.fit_transform(X_train)
#fit_transform : 데이터셋 표준 정규분포화. 단 dataset의 평균과 표준편차를 기준으로 저장하게 됨.
X_valid = scaler.t... | code_fim | hard | {
"lang": "python",
"repo": "Robin8342/RobinHood",
"path": "/Tensorflow/TensorflowWide.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import callbacks
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.layers import (Input, Dense, Concatenate)
Rawdict = fetch_california_housing()
#DataFrame으로 Rawdict의 데이터를 가져온다.
Cal_DF = pd.DataFrame(Rawdict.d... | code_fim | medium | {
"lang": "python",
"repo": "Robin8342/RobinHood",
"path": "/Tensorflow/TensorflowWide.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: macphilips/mydiary-backend-django path: /modules/account/serializer.py
from django.contrib.auth.models import User
from rest_framework import serializers
class OwnerSerializer(serializers.ModelSerializer):
class Meta:
fields = (
'id',
'username',
... | code_fim | medium | {
"lang": "python",
"repo": "macphilips/mydiary-backend-django",
"path": "/modules/account/serializer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserSerializer(serializers.ModelSerializer):
entry = EntrySerializer(read_only=True, source="entries")
reminder = serializers.ReadOnlyField()
class Meta:
model = User
fields = ('id', 'username', 'entry', 'reminder')<|fim_prefix|># repo: macphilips/mydiary-backend-django ... | code_fim | medium | {
"lang": "python",
"repo": "macphilips/mydiary-backend-django",
"path": "/modules/account/serializer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='todo',
name='completed',
field=models.BooleanField(blank=True, default=None, null=True),
),
migrations.AlterField(
model_name='todo',
name='order',
field=mo... | code_fim | medium | {
"lang": "python",
"repo": "prateekthakkar/Todo-API",
"path": "/todo/todo_api/migrations/0002_auto_20200627_1344.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prateekthakkar/Todo-API path: /todo/todo_api/migrations/0002_auto_20200627_1344.py
# Generated by Django 3.0.1 on 2020-06-27 13:44
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('todo_api', '0001_initial'),
]
operations = [
migrations.Alter... | code_fim | medium | {
"lang": "python",
"repo": "prateekthakkar/Todo-API",
"path": "/todo/todo_api/migrations/0002_auto_20200627_1344.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('todo_api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='todo',
name='completed',
field=models.BooleanField(blank=True, default=None, null=True),
),
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "prateekthakkar/Todo-API",
"path": "/todo/todo_api/migrations/0002_auto_20200627_1344.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phi1010/decorated-paho-mqtt path: /src/decorated_paho_mqtt/mqtt_framework.py
from functools import wraps
from logging import getLogger
# Read the docs at https://github.com/eclipse/paho.mqtt.python
# because eclipse.org has outdated information, which does not include MQTTv5
from paho.mqtt.clie... | code_fim | hard | {
"lang": "python",
"repo": "phi1010/decorated-paho-mqtt",
"path": "/src/decorated_paho_mqtt/mqtt_framework.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def unpack_topic(pattern, topic):
"""
returns one string for each "+", followed by a list of strings when a trailing "#" is present
"""
pattern_parts = iter(pattern.split("/"))
topic_parts = iter(topic.split("/"))
while True:
try:
cur_pattern = next(pattern_part... | code_fim | hard | {
"lang": "python",
"repo": "phi1010/decorated-paho-mqtt",
"path": "/src/decorated_paho_mqtt/mqtt_framework.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roshk99/pipebot path: /archive/alg_stage1.py
#!/usr/bin/env python
# This is a Python script that implements the first stage of classification: junction detection.
# Input:
# data: list of tuples with the first element in each tuple as an angle and the second a distance
# radians: boolean that i... | code_fim | hard | {
"lang": "python",
"repo": "roshk99/pipebot",
"path": "/archive/alg_stage1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Compute the absolute difference between the measured value and the expected
diff = abs(data[i][1] - abs(compare))
#print 'i:', i, ', theta:', data[i][0]*180/math.pi, flag1, ', diff:', diff
#If the difference is greater than the tolerance or if the angle is close to the vertical
#We only care ... | code_fim | hard | {
"lang": "python",
"repo": "roshk99/pipebot",
"path": "/archive/alg_stage1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Calculate the tolerance value based on the horizontal distances and the angle increment
deltheta = data[1][0] - data[0][0]
tol = deltheta*(r_L0 + r_R0);
#print 'tol:', tol
#Sets the initial booleans
junction = [False, False]
#For each angle
for i in range(numPoints):
#If on the right side of ... | code_fim | hard | {
"lang": "python",
"repo": "roshk99/pipebot",
"path": "/archive/alg_stage1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(len(c))
for item in c:
print(item)<|fim_prefix|># repo: Algo-nklcb/Algorithm path: /donggun/week3/Baekjoon1764(듣보잡).py
n, m = map(int, input().split())
<|fim_middle|>a = []
b = []
for _ in range(n):
a.append(input())
for _ in range(m):
b.append(input())
c = sorted(list(set(a) & set(... | code_fim | medium | {
"lang": "python",
"repo": "Algo-nklcb/Algorithm",
"path": "/donggun/week3/Baekjoon1764(듣보잡).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Algo-nklcb/Algorithm path: /donggun/week3/Baekjoon1764(듣보잡).py
n, m = map(int, input().split())
<|fim_suffix|>for _ in range(m):
b.append(input())
c = sorted(list(set(a) & set(b)))
print(len(c))
for item in c:
print(item)<|fim_middle|>a = []
b = []
for _ in range(n):
a.append(inpu... | code_fim | easy | {
"lang": "python",
"repo": "Algo-nklcb/Algorithm",
"path": "/donggun/week3/Baekjoon1764(듣보잡).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "--- %s ---" % alg
final_accuracy = 0
params_final = [0.0, 0.0]
skf = StratifiedKFold(n_splits=5)
for train_index, test_index in skf.split(data, labels):
new_data_train = data[train_index]
new_data_test = data[test_index]
new_labels_train = labels[train_in... | code_fim | hard | {
"lang": "python",
"repo": "merjildo/weekend_projects",
"path": "/ic_courses/ml_course_2016/exercises/exercise_03/ml_ex_03.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: merjildo/weekend_projects path: /ic_courses/ml_course_2016/exercises/exercise_03/ml_ex_03.py
#!/usr/bin/python
import sys,os,csv
import pandas
import numpy as np
import math
from sklearn.model_selection import StratifiedKFold
from sklearn import svm as SVM
from sklearn.decomposition import PCA
f... | code_fim | hard | {
"lang": "python",
"repo": "merjildo/weekend_projects",
"path": "/ic_courses/ml_course_2016/exercises/exercise_03/ml_ex_03.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhojnikhil/LeetCodeProblems path: /increasingbst.py
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
<|fim_suffix|> def increasingBST(self, root):
"""
:type... | code_fim | medium | {
"lang": "python",
"repo": "bhojnikhil/LeetCodeProblems",
"path": "/increasingbst.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> L=[]
ios(root,L)
newtree=TreeNode(L[0])
dummy=newtree
for i in range(1,len(L)):
newtree.right=TreeNode(L[i])
newtree=newtree.right
return dummy<|fim_prefix|># repo: bhojnikhil/LeetCodeProblems path: /increasingbst.py
# Definition for... | code_fim | hard | {
"lang": "python",
"repo": "bhojnikhil/LeetCodeProblems",
"path": "/increasingbst.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if root is not None:
ios(root.left,L)
L.append(root.val)
ios(root.right,L)
L=[]
ios(root,L)
newtree=TreeNode(L[0])
dummy=newtree
for i in range(1,len(L)):
newtree.right=TreeNode(L[i... | code_fim | medium | {
"lang": "python",
"repo": "bhojnikhil/LeetCodeProblems",
"path": "/increasingbst.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philterphactory/skypebot path: /commands/glitchcommand.py
# coding=UTF-8
from string import Template
import random
from commandbase import BaseCommand
<|fim_suffix|>
def __init__(self):
BaseCommand.__init__( self )
self.command_mappings = [ "glitch" ]
self.templates =... | code_fim | hard | {
"lang": "python",
"repo": "philterphactory/skypebot",
"path": "/commands/glitchcommand.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def generate( self, name ):
template = random.choice( self.templates )
message_out = template.substitute(name=name)
return "/me %s" % message_out<|fim_prefix|># repo: philterphactory/skypebot path: /commands/glitchcommand.py
# coding=UTF-8
from string import Template
import ra... | code_fim | hard | {
"lang": "python",
"repo": "philterphactory/skypebot",
"path": "/commands/glitchcommand.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(s <= 0 or s%2 == 0):
print("Second")
else:
print("First")<|fim_prefix|># repo: RuntimeTerror-404/march_2021_long_challenge path: /spacearr.py
T = int(input())
for i in range(T):
N = int(input())
temp = (N * (N+1))/2
a = list(m<|fim_middle|>ap(int,input(... | code_fim | medium | {
"lang": "python",
"repo": "RuntimeTerror-404/march_2021_long_challenge",
"path": "/spacearr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RuntimeTerror-404/march_2021_long_challenge path: /spacearr.py
T = int(input())
for i in range(T):
N = int(input())
temp = (N * (N+1))/2
a = list(map(int,input().split()))
a.sort()
s = sum(a)
s = temp-s
j = 1
for item in a:<|fim_suffix|> if(s <= 0 or s%2 == 0):... | code_fim | medium | {
"lang": "python",
"repo": "RuntimeTerror-404/march_2021_long_challenge",
"path": "/spacearr.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bulesxz/algorithm017 path: /Week_02/stack.py
#!/usr/bin/env python
class Stack(object):
def __init__(self):
self.stack = []
def push(self ,item):
self.stack.append(item)
def pop(self):
<|fim_suffix|>if __name__ == "__main__":
stack = Stack()
stack.push(1)... | code_fim | hard | {
"lang": "python",
"repo": "Bulesxz/algorithm017",
"path": "/Week_02/stack.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
stack = Stack()
stack.push(1)
print (stack.pop())
stack.push(2)
print (stack.is_empty())
stack.push(3)
print (stack.pop())
print (stack.pop())
print (stack.is_empty())<|fim_prefix|># repo: Bulesxz/algorithm017 path: /Week_02/stack.py
#!/usr/b... | code_fim | medium | {
"lang": "python",
"repo": "Bulesxz/algorithm017",
"path": "/Week_02/stack.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def pop(self):
return self.stack.pop()
def top(self):
return self.stack[len(self.stack)-1]
def is_empty(self):
if len(self.stack) == 0:
return True
else:
return False
if __name__ == "__main__":
stack = Stack()
stack.push(1)
... | code_fim | medium | {
"lang": "python",
"repo": "Bulesxz/algorithm017",
"path": "/Week_02/stack.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mblawat/flask-students path: /flaskr/db.py
import click
from flask.cli import with_appcontext
from flask_sqlalchemy import SQLAlchemy
from flask_sqlalchemy import inspect
students_db = SQLAlchemy()
<|fim_suffix|> def update_with(self, update_dict):
self.fname = update_dict['fname']
... | code_fim | hard | {
"lang": "python",
"repo": "mblawat/flask-students",
"path": "/flaskr/db.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def init_app(app):
students_db.init_app(app)
app.cli.add_command(init_db_command)
@click.command('init-db')
@with_appcontext
def init_db_command():
"""Clear the existing data and create new tables."""
students_db.create_all()
click.echo('Initialized the database.')
class Student(st... | code_fim | medium | {
"lang": "python",
"repo": "mblawat/flask-students",
"path": "/flaskr/db.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Rocket-Scientists Only:
- Place your logic inside of a try/except block and account for ValueErrors
- Add another csv file with more data. Combine the data from both files.
- Instead of printing items to the screen, sort them, and print them out in groups<|fim_prefix|># repo: sgriffith3/python_basics_9-14... | code_fim | hard | {
"lang": "python",
"repo": "sgriffith3/python_basics_9-14-2020",
"path": "/thursday_challenge.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sgriffith3/python_basics_9-14-2020 path: /thursday_challenge.py
Using the custom if/elif/else logic you have already created for
lab #18, it is your job to improve the code in the following ways:
<|fim_suffix|>
Rocket-Scientists Only:
- Place your logic inside of a try/except block and account f... | code_fim | hard | {
"lang": "python",
"repo": "sgriffith3/python_basics_9-14-2020",
"path": "/thursday_challenge.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """当terminal退出时,直接重新产生一个terminal,并clear初始化"""
self.terminal.fork_command()
self.terminal.feed_child("clear\n")
def vte_message(self):
pass<|fim_prefix|># repo: meiyuan524/Linux-Server-Management path: /terminal.py
#-*- coding=utf-8 -*-
import vte
import gtk
class My... | code_fim | easy | {
"lang": "python",
"repo": "meiyuan524/Linux-Server-Management",
"path": "/terminal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meiyuan524/Linux-Server-Management path: /terminal.py
#-*- coding=utf-8 -*-
import vte
import gtk
class MyTerm():
def __init__(self):
<|fim_suffix|> def vte_exit(self):
"""当terminal退出时,直接重新产生一个terminal,并clear初始化"""
self.terminal.fork_command()
self.terminal.feed_c... | code_fim | hard | {
"lang": "python",
"repo": "meiyuan524/Linux-Server-Management",
"path": "/terminal.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.endTime = datetime.datetime.now().timestamp()
logger.info(self.initTime - self.endTime)<|fim_prefix|># repo: asysc2020/Engine path: /centrifuge/actions/preprocess/Extractor.py
# -*- coding: utf-8 -*-
"""
The Extractor receives a URL and tries to estimate its type
(HTML, PDF, XML...)
... | code_fim | medium | {
"lang": "python",
"repo": "asysc2020/Engine",
"path": "/centrifuge/actions/preprocess/Extractor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.log_file = None
#
# def _print(self,msg):
# info = '%s : %s' %(self.getTimeDes(),msg)
#
#
#
#
#
# if __name__ == "__main__":
#
# test = utils_py3()
# # sec = int(time.mktime(time.strptime(time.time(),'%Y%m%d')))
# sec = '2017-11-02 20:23:37'
# sec2 = ''
# sec3... | code_fim | hard | {
"lang": "python",
"repo": "zdYng/python",
"path": "/sparktest/task_mysql/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zdYng/python path: /sparktest/task_mysql/test.py
# # -*- coding: UTF-8 -*-
import utils
t1 = utils.getTimeSec("2017-11-17 16:40:00")
t2 = utils.getTimeSec("2016-07-04 00:00:00")
print(t1, t2, t1-t2)
# import time
# import sys
# import binascii
# import uuid
# import socket
# import struct
# impor... | code_fim | hard | {
"lang": "python",
"repo": "zdYng/python",
"path": "/sparktest/task_mysql/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>,desc):
# if isinstance(desc,int):
# desc = str(desc)
# if len(desc) == 0:
# return self.getNow()
# if len(desc) <= 10:
# return self.getDateSec(desc)
# if desc.count('-') == 1:
# time_local = time.strptime(desc,'%Y%m%d-%H:%M:%S')
# eli... | code_fim | hard | {
"lang": "python",
"repo": "zdYng/python",
"path": "/sparktest/task_mysql/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range (len(size)):
print ("MONTH {0}".format(a))
size[i] += 50
print ("One month has passed, now here is my flock ")
print (size)
input()
max_size = (max(size))
print("Now my biggest sheep has size {0} le... | code_fim | medium | {
"lang": "python",
"repo": "kimdieu/nguyenkimdieu-fundamental-c4e19",
"path": "/Fundamental/Session3/homework_3/sheep.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = size.index(max_size)
size[x] = 8
print ("After shearing, here is my flock: ")
print (size)
input()
a += 1
size[i] += 50
break
# total = sum(size)
# price = total * 2
# print("My flock h... | code_fim | hard | {
"lang": "python",
"repo": "kimdieu/nguyenkimdieu-fundamental-c4e19",
"path": "/Fundamental/Session3/homework_3/sheep.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimdieu/nguyenkimdieu-fundamental-c4e19 path: /Fundamental/Session3/homework_3/sheep.py
size = [5, 7, 300, 90, 24, 50, 75]
print("Hello, my name is Dieu and these are my sheep sizes: ")
print(size)
input()
# max_size = (max(size))
# print("Now my biggest sheep has size {0} let's shear it. ". for... | code_fim | medium | {
"lang": "python",
"repo": "kimdieu/nguyenkimdieu-fundamental-c4e19",
"path": "/Fundamental/Session3/homework_3/sheep.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
yield scrapy.Request(placelink[j], callback=self.parse_item)
def parse_item(self, response):
item = lianjia_ershoufangrentItem()
item['sell_date'] = response.xpath('//*[@class="content__subtitle"]/text()').extract()[1].replace('房源上架时间','').strip()
... | code_fim | hard | {
"lang": "python",
"repo": "axiom-technology-group/project_jes",
"path": "/project2(8.19)/1.0 scraping the data and simple data cleaning/scrapy/project_AUG19/project_AUG19/spiders/lianjia_ershou_gz_rent.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: axiom-technology-group/project_jes path: /project2(8.19)/1.0 scraping the data and simple data cleaning/scrapy/project_AUG19/project_AUG19/spiders/lianjia_ershou_gz_rent.py
# -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from sc... | code_fim | hard | {
"lang": "python",
"repo": "axiom-technology-group/project_jes",
"path": "/project2(8.19)/1.0 scraping the data and simple data cleaning/scrapy/project_AUG19/project_AUG19/spiders/lianjia_ershou_gz_rent.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def dre(request):
queryset = Posts.objects.all()
query = request.GET.get('mes','')
contrato_nomes = Contratos.objects.all().values_list('nome') #Obter nome dos contratos na tabela contratos
contrato_valor_entrada = {} #dict com o nome do contrato + o valor de entrada resultante no periodo
contrato_v... | code_fim | hard | {
"lang": "python",
"repo": "pedromaia02/ls_deploy",
"path": "/financeiro/src/posts/views.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.