text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: PereverzevIvan/Project-PixelO path: /data/parsers/news_reqparse.py
# Парсер для ресурсов отзывов
from flask_restful import reqparse
parser = reqparse.RequestParser()
pa<|fim_suffix|>d_argument('content', required=True)
parser.add_argument('user_id', required=True, type=int)
parser.add_argument('... | code_fim | medium | {
"lang": "python",
"repo": "PereverzevIvan/Project-PixelO",
"path": "/data/parsers/news_reqparse.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: piglaker/bingling path: /spider/ScrapySpider/myspider/myspider/spiders/pixiv.py
import scrapy
class PixivSpider(scrapy.Spider):
name = 'pixiv'
allowed_domains = ['alibabacloud.com']
start_urls = ['https://www.alibabacloud.com/help/zh/doc-detail/31883.htm']
<|fim_suffix|> fil... | code_fim | easy | {
"lang": "python",
"repo": "piglaker/bingling",
"path": "/spider/ScrapySpider/myspider/myspider/spiders/pixiv.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse(self, response):
filename = "31883.html"
print(response)
open(filename, 'w').write(str(response.body, encoding="utf-8"))
pass<|fim_prefix|># repo: piglaker/bingling path: /spider/ScrapySpider/myspider/myspider/spiders/pixiv.py
import scrapy
class PixivSpide... | code_fim | medium | {
"lang": "python",
"repo": "piglaker/bingling",
"path": "/spider/ScrapySpider/myspider/myspider/spiders/pixiv.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> filename = "31883.html"
print(response)
open(filename, 'w').write(str(response.body, encoding="utf-8"))
pass<|fim_prefix|># repo: piglaker/bingling path: /spider/ScrapySpider/myspider/myspider/spiders/pixiv.py
import scrapy
class PixivSpider(scrapy.Spider):
name = 'p... | code_fim | easy | {
"lang": "python",
"repo": "piglaker/bingling",
"path": "/spider/ScrapySpider/myspider/myspider/spiders/pixiv.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(" [x] Received %r" % body)
if __name__ == '__main__':
mq_obj = mq_consumer()
mq_obj.init_consumer(test_callback)<|fim_prefix|># repo: wuxie2015/raspberrypi_live path: /server/monitor_receiver/controll_agent/service/consumer.py
# !/usr/bin/env python
import pika
class mq_consumer:
... | code_fim | hard | {
"lang": "python",
"repo": "wuxie2015/raspberrypi_live",
"path": "/server/monitor_receiver/controll_agent/service/consumer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wuxie2015/raspberrypi_live path: /server/monitor_receiver/controll_agent/service/consumer.py
# !/usr/bin/env python
import pika
class mq_consumer:
def __init__(self):
credentials = pika.PlainCredentials('admin', '123456')
self.connection = pika.BlockingConnection(pika.Connect... | code_fim | hard | {
"lang": "python",
"repo": "wuxie2015/raspberrypi_live",
"path": "/server/monitor_receiver/controll_agent/service/consumer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __logger_setup(self, log_level):
log_format = logging.Formatter(
"[%(levelname)s]:%(filename)s:%(lineno)d - %(message)s"
)
ch = logging.StreamHandler()
# ch.setLevel(log_level)
ch.setFormatter(log_format)
self.__logger = logging.getLogger... | code_fim | hard | {
"lang": "python",
"repo": "drob0009/affix_searching",
"path": "/Items.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Filter out non-affix tags.
self.tags = list(set(self.tags) & ia_tags)
for affix in all_affix:
for tag in self.tags:
if tag in affix.item_affix_tags:
self.affixes.append(affix)
def __logger_setup(self, log_level):
log_fo... | code_fim | medium | {
"lang": "python",
"repo": "drob0009/affix_searching",
"path": "/Items.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drob0009/affix_searching path: /Items.py
import logging
import json
import os
from Affix import Affix
from dataclasses import dataclass, field, InitVar
from typing import List
<|fim_suffix|> def __logger_setup(self, log_level):
log_format = logging.Formatter(
"[%(levelnam... | code_fim | hard | {
"lang": "python",
"repo": "drob0009/affix_searching",
"path": "/Items.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>nore_index=True)
df.to_csv('test.csv', index=False)
print (df)<|fim_prefix|># repo: QHman/CSE2431_Project1 path: /test_PY.py
import pandas as pd
columns = ['bird', 'cow', 'pig']
df = pd.DataFrame(columns = columns)
print (df)
testdf = pd.DataFrame<|fim_middle|>([[1,1,1]], columns = columns)
df = pd.conc... | code_fim | medium | {
"lang": "python",
"repo": "QHman/CSE2431_Project1",
"path": "/test_PY.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QHman/CSE2431_Project1 path: /test_PY.py
import pandas as pd
columns = ['bird', 'cow', 'pig']
df = pd<|fim_suffix|>([[1,1,1]], columns = columns)
df = pd.concat([df, testdf], ignore_index=True)
df.to_csv('test.csv', index=False)
print (df)<|fim_middle|>.DataFrame(columns = columns)
print (df)
te... | code_fim | medium | {
"lang": "python",
"repo": "QHman/CSE2431_Project1",
"path": "/test_PY.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>([[1,1,1]], columns = columns)
df = pd.concat([df, testdf], ignore_index=True)
df.to_csv('test.csv', index=False)
print (df)<|fim_prefix|># repo: QHman/CSE2431_Project1 path: /test_PY.py
import pandas as pd
columns = ['bird', 'cow', 'pig']
df = pd<|fim_middle|>.DataFrame(columns = columns)
print (df)
te... | code_fim | medium | {
"lang": "python",
"repo": "QHman/CSE2431_Project1",
"path": "/test_PY.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask = (gt_image >= 0) & (gt_image < self.num_class)
label = self.num_class * gt_image[mask].astype('int') + pre_image[mask]
count = np.bincount(label, minlength=self.num_class ** 2)
confusion_matrix = count.reshape(self.num_class, self.num_class)
return confusion_m... | code_fim | hard | {
"lang": "python",
"repo": "Olikelys/Lane_Segmentation_torch",
"path": "/utils/metric.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Olikelys/Lane_Segmentation_torch path: /utils/metric.py
#!usr/bin/python
# -*- encoding: utf-8 -*-
"""
@Time : 2020/4/17 上午8:51
@User : kang
@Author : BiKang Peng
@ProjectName : Lane_Segmentation_torch
@FileName : metric.py
@Software : PyCharm
"""
<... | code_fim | medium | {
"lang": "python",
"repo": "Olikelys/Lane_Segmentation_torch",
"path": "/utils/metric.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f"Part 1: {highestSeatId}")
for number in range(highestSeatId):
number += 1
if number not in seenBoardingPassNums.keys():
aheadNum = number + 1
behindNum = number - 1
if (aheadNum in seenBoardingPassNums.keys()) and (behindNum in seenBoardingPassNums.keys()):
... | code_fim | medium | {
"lang": "python",
"repo": "Meiko42/advent-of-code",
"path": "/2020/Day5/day5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Meiko42/advent-of-code path: /2020/Day5/day5.py
import re
inputRawMatch = re.compile('^([B|F]{7})([R|L]{3})')
passesDict = {}
passesCount = 1
with open('Input.txt') as inputFile:
for line in inputFile:
inputMatched = inputRawMatch.match(line)
passesDict[passesCount] = {}
... | code_fim | hard | {
"lang": "python",
"repo": "Meiko42/advent-of-code",
"path": "/2020/Day5/day5.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for number in range(highestSeatId):
number += 1
if number not in seenBoardingPassNums.keys():
aheadNum = number + 1
behindNum = number - 1
if (aheadNum in seenBoardingPassNums.keys()) and (behindNum in seenBoardingPassNums.keys()):
print(f"Part 2: {number}")<|fi... | code_fim | hard | {
"lang": "python",
"repo": "Meiko42/advent-of-code",
"path": "/2020/Day5/day5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlarac/control_rrhh path: /rrhh/apps/justificaciones/migrations/0003_auto_20170628_1359.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
<|fim_suffix|>
dependencies = [
('justificaciones', '0002_auto_20170614_1446'),
]
... | code_fim | medium | {
"lang": "python",
"repo": "mlarac/control_rrhh",
"path": "/rrhh/apps/justificaciones/migrations/0003_auto_20170628_1359.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='justificacion',
old_name='motivo_marcacion',
new_name='motivo_justificacion',
),
migrations.AlterField(
model_name='motivojustificacion',
name='descripcion',
... | code_fim | medium | {
"lang": "python",
"repo": "mlarac/control_rrhh",
"path": "/rrhh/apps/justificaciones/migrations/0003_auto_20170628_1359.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('justificaciones', '0002_auto_20170614_1446'),
]
operations = [
migrations.RenameField(
model_name='justificacion',
old_name='motivo_marcacion',
new_name='motivo_justificacion',
),
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "mlarac/control_rrhh",
"path": "/rrhh/apps/justificaciones/migrations/0003_auto_20170628_1359.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># %%
# Rich HTML representation
# ------------------------
# In notebooks estimators and pipelines will use a rich HTML representation.
# This is particularly useful to summarise the
# structure of pipelines and other composite estimators, with interactivity to
# provide detail. Click on the example imag... | code_fim | hard | {
"lang": "python",
"repo": "scikit-learn/scikit-learn",
"path": "/examples/miscellaneous/plot_estimator_representation.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scikit-learn/scikit-learn path: /examples/miscellaneous/plot_estimator_representation.py
"""
===========================================
Displaying estimators and complex pipelines
===========================================
This example illustrates different ways estimators and pipelines can be... | code_fim | hard | {
"lang": "python",
"repo": "scikit-learn/scikit-learn",
"path": "/examples/miscellaneous/plot_estimator_representation.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@celery.task(queue="images")
def cache_images(page_num):
# TODO: add lock
cli = ImageClient(Config.AGILEENGINE_API_KEY)
msg = "Starting images caching.." if page_num == 1 else "Continuing images caching.."
log.info(msg)
images_data = cli.get_images(page_num)
image_ids = [img["id"... | code_fim | medium | {
"lang": "python",
"repo": "cpwr/agileengine_test",
"path": "/src/agileengine/tasks/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if images_data.get("hasMore"):
log.debug("Fetching data from the next page")
next_page_num = images_data.get("page", 0) + 1
if page_num < next_page_num:
cache_images.delay(page_num=next_page_num)
else:
log.error("Error getting data: incorrect pag... | code_fim | hard | {
"lang": "python",
"repo": "cpwr/agileengine_test",
"path": "/src/agileengine/tasks/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BioGeek/vispy path: /vispy/visuals/filters/mesh.py
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from vispy.gloo import Texture2D, VertexBuffer
from vispy.visuals.sh... | code_fim | hard | {
"lang": "python",
"repo": "BioGeek/vispy",
"path": "/vispy/visuals/filters/mesh.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """The texture coordinates as an (N, 2) array of floats."""
return self._texcoords
@texcoords.setter
def texcoords(self, texcoords):
self._texcoords = texcoords
self._update_texcoords_buffer(texcoords)
def _update_texcoords_buffer(self, texcoords):
if ... | code_fim | hard | {
"lang": "python",
"repo": "BioGeek/vispy",
"path": "/vispy/visuals/filters/mesh.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> set_default = forms.BooleanField(label='Set as default', required=False,
initial=True)
class Media(object):
# Also requires jQuery
js = ['https://js.stripe.com/v2/', 'stripe/cardForm.js']
def __init__(self, stripe_publishable_key, **kwargs... | code_fim | hard | {
"lang": "python",
"repo": "thecut/thecut-stripe",
"path": "/thecut/stripe/forms.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thecut/thecut-stripe path: /thecut/stripe/forms.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from .models import Account, Application
from .widgets import NamelessTextInput
from django import forms
from django.core.exceptions import ImproperlyConfigured
de... | code_fim | hard | {
"lang": "python",
"repo": "thecut/thecut-stripe",
"path": "/thecut/stripe/forms.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Akash-Yadav1/webscrape path: /table_scrapping.py
import requests
from bs4 import BeautifulSoup
r = requests.get('https://www.skysports.com/premier-league-table')
soup = BeautifulSoup(r.text, 'html.parser')
league_table = soup.find('table', class_='standing-table__table callfn')
# print(l... | code_fim | medium | {
"lang": "python",
"repo": "Akash-Yadav1/webscrape",
"path": "/table_scrapping.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for team in league_table.find_all('tbody'):
rows = team.find_all('tr')
for row in rows:
pl_team = row.find(
'td', class_='standing-table__cell standing-table__cell--name').text.strip()
n += 1
print(pl_team)
print(n)<|fim_prefix|># repo: Akash-Yadav1/web... | code_fim | medium | {
"lang": "python",
"repo": "Akash-Yadav1/webscrape",
"path": "/table_scrapping.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'td', class_='standing-table__cell standing-table__cell--name').text.strip()
n += 1
print(pl_team)
print(n)<|fim_prefix|># repo: Akash-Yadav1/webscrape path: /table_scrapping.py
import requests
from bs4 import BeautifulSoup
r = requests.get('https://www.skysports.com/premie... | code_fim | hard | {
"lang": "python",
"repo": "Akash-Yadav1/webscrape",
"path": "/table_scrapping.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rrees/hunt-the-wumpus path: /hunt.py
from maze_maker import make_maze, directions
import random
import os
class Hunt:
def __init__(self):
self.maze = make_maze()
#print(self.maze)
self.hunter = random.choice(list(self.maze))
self.wumpus = random.choice(list(self.maze))
def has_hunter... | code_fim | hard | {
"lang": "python",
"repo": "rrees/hunt-the-wumpus",
"path": "/hunt.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_position = (self.hunter[0] + dx, self.hunter[1] + dy)
if new_position in self.maze:
self.hunter = new_position
else:
print "You can't go in that direction!"
if self.has_hunter_found_wumpus():
print "FOUND WUMPUS"
return
print "not yet with the wumpus"
self.move_w... | code_fim | hard | {
"lang": "python",
"repo": "rrees/hunt-the-wumpus",
"path": "/hunt.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WhiteLab/ATACseq path: /utility/multitest.py
from time import time
import multiprocessing as mp
import subprocess
<|fim_suffix|>pool = mp.Pool()
for x in range(0,1000):
pool.apply_async(f)
pool.close()
pool.join()
print 'elapsed time: ' + str(time() - begin) + ' seconds'<|fim_middle|>def f()... | code_fim | medium | {
"lang": "python",
"repo": "WhiteLab/ATACseq",
"path": "/utility/multitest.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pool = mp.Pool()
for x in range(0,1000):
pool.apply_async(f)
pool.close()
pool.join()
print 'elapsed time: ' + str(time() - begin) + ' seconds'<|fim_prefix|># repo: WhiteLab/ATACseq path: /utility/multitest.py
from time import time
import multiprocessing as mp
import subprocess
def f():
subproce... | code_fim | easy | {
"lang": "python",
"repo": "WhiteLab/ATACseq",
"path": "/utility/multitest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> r_negative.write(negative)
r_positive.write(positive)
f.close()
r_negative.close()
r_positive.close()
makeOperation = AlifTask(input("File Name: "), input("Operation Type: "))<|fim_prefix|># repo: iambiggsharaf/alifJuniorPythonDeveloperTask path: /app.py
class Al... | code_fim | hard | {
"lang": "python",
"repo": "iambiggsharaf/alifJuniorPythonDeveloperTask",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iambiggsharaf/alifJuniorPythonDeveloperTask path: /app.py
class AlifTask:
def __init__(self, fileName, operationType):
self.fileName = fileName
self.operationType = operationType
f = open(self.fileName)
r_negative = open("negative_results.txt", "w")
r... | code_fim | hard | {
"lang": "python",
"repo": "iambiggsharaf/alifJuniorPythonDeveloperTask",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sotirios-skarpalezos/amsre path: /mmdb/Collocate_amsr2_L1R_TB_to_insitu_sst_partA.py
#!/usr/bin/env python
# coding: utf-8
# # This is the in situ and SSS collocation code.
# # this is the part A of the program that searches for L1R files that have any data where cruise is
import sys
import n... | code_fim | hard | {
"lang": "python",
"repo": "sotirios-skarpalezos/amsre",
"path": "/mmdb/Collocate_amsr2_L1R_TB_to_insitu_sst_partA.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#while looping through USV data, look at data +-1 day
ds_day = ds_usv.sel(time=slice(usv_day-np.timedelta64(1,'D'),usv_day+np.timedelta64(1,'D')))
ilen = ds_day.time.size
if ilen<1: #don't run on days without any data
continue
minlon,maxlon,minlat,maxlat = ds_... | code_fim | hard | {
"lang": "python",
"repo": "sotirios-skarpalezos/amsre",
"path": "/mmdb/Collocate_amsr2_L1R_TB_to_insitu_sst_partA.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># List indices of each column
cols = [[0, 9, 18, 27, 36, 45, 54, 63, 72],
[1, 10, 19, 28, 37, 46, 55, 64, 73],
[2, 11, 20, 29, 38, 47, 56, 65, 74],
[3, 12, 21, 30, 39, 48, 57, 66, 75],
[4, 13, 22, 31, 40, 49, 58, 67, 76],
[5, 14, 23, 32, 41, 50, 59, 68, 77],
... | code_fim | hard | {
"lang": "python",
"repo": "tomsoroski/sudoku",
"path": "/new-sukodu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomsoroski/sudoku path: /new-sukodu.py
# Brute force Sudoku solver
import time
start_time = time.time()
B = " "
# Represents a blank square
BD1 = [B, B, B, B, B, B, B, B, B,
B, B, B, B, B, B, B, B, B,
B, B, B, B, B, B, B, B, B,
B, B, B, B, B, B, B, B, B,
B, B, B, B,... | code_fim | hard | {
"lang": "python",
"repo": "tomsoroski/sudoku",
"path": "/new-sukodu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Produce True if all the rows in board are valid"""
for row in rows:
seen = []
for num in nums:
if bd[row[num]] == " ":
continue
elif bd[row[num]] not in seen:
seen += [bd[row[num]]]
else:
return ... | code_fim | hard | {
"lang": "python",
"repo": "tomsoroski/sudoku",
"path": "/new-sukodu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jonnystv/Multiple-Classes-Lab path: /src/bus.py
class Bus:
def __init__(self, route_number, destination):
self.route_number = route_number
self.destination = destination
self.passengers = []
<|fim_suffix|> bus_stop.queue.clear()
def pick_up_from_stop(sel... | code_fim | hard | {
"lang": "python",
"repo": "jonnystv/Multiple-Classes-Lab",
"path": "/src/bus.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def pick_up_from_stop(self, bus_stop):
bus_stop.queue.clear()
def pick_up_from_stop(self, bus_stop_to_pick_up_from) :
for passenger in bus_stop_to_pick_up_from.queue:
self.pick_up(passenger)<|fim_prefix|># repo: jonnystv/Multiple-Classes-Lab path: /src/bus.py
class Bu... | code_fim | hard | {
"lang": "python",
"repo": "jonnystv/Multiple-Classes-Lab",
"path": "/src/bus.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_RESULT = _descriptor.Descriptor(
name='Result',
full_name='org.qsn.protobuf.Result',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='respCode', full_name='org.qsn.protobuf.Result.respCo... | code_fim | hard | {
"lang": "python",
"repo": "stratosnet/GRPCProto",
"path": "/src/main/python/qsn/entity/common/Result_pb2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
DESCRIPTOR = _descriptor.FileDescriptor(
name='qsn/entity/common/Result.proto',
package='org.qsn.protobuf',
syntax='proto3',
serialized_options=b'\n(org.qsn.api.rpc.grpc.proto.entity.commonP\001',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x1eqsn/entity/common/Result.pr... | code_fim | hard | {
"lang": "python",
"repo": "stratosnet/GRPCProto",
"path": "/src/main/python/qsn/entity/common/Result_pb2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stratosnet/GRPCProto path: /src/main/python/qsn/entity/common/Result_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: qsn/entity/common/Result.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from ... | code_fim | hard | {
"lang": "python",
"repo": "stratosnet/GRPCProto",
"path": "/src/main/python/qsn/entity/common/Result_pb2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self):
self.camera = self.Camera(camera_port = 0)
def execute(self, take_save_snapshot, display_last_picture, cmd_command):
"""
Execute whatever commands the user asked for and return their completion status
"""
# set null values in case ... | code_fim | hard | {
"lang": "python",
"repo": "AChillFeeder/home_monitoring",
"path": "/modules.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AChillFeeder/home_monitoring path: /modules.py
import cv2
from datetime import datetime
import os
class Computer:
class Camera:
def __init__(self, camera_port = 0, snapshots_directory = 'snapshots'):
self.camera_port = camera_port
self.snapshots_directory =... | code_fim | hard | {
"lang": "python",
"repo": "AChillFeeder/home_monitoring",
"path": "/modules.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Phumlie/python-turtle path: /colour.py
from turtle import Turtle, Screen
from time import sleep
turtle = Turtle()
screen = Screen()
screen.colormode(255)
R = 255
G = 0
B = 0
<|fim_suffix|>side = 100
angle = 90
sleep(0.5)
turtle.color((R, G, B))
turtle.forward(side)
turtle.backward(side)
tur... | code_fim | medium | {
"lang": "python",
"repo": "Phumlie/python-turtle",
"path": "/colour.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
sleep(0.5)
turtle.color((R, G, B))
turtle.forward(side)
turtle.backward(side)
turtle.right(angle)
turtle.color((R2, G2, B2))
turtle.forward(side)
turtle.backward(side)
turtle.right(angle)
turtle.color((R3, G3, B3))
turtle.forward(side)
turtle.backward(side)
turtle.right(angle)
turtle.color((R4, G4, B4))... | code_fim | medium | {
"lang": "python",
"repo": "Phumlie/python-turtle",
"path": "/colour.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pashatick/Python_lessons_basic path: /lesson03/home_work/hw03_hard.py
# Задание-1:
# Написать программу, выполняющую операции (сложение и вычитание) с простыми дробями.
# Дроби вводятся и выводятся в формате:
# n x/y ,где n - целая часть, x - числитель, у - знаменатель.
# Дроби могут быть отрицат... | code_fim | hard | {
"lang": "python",
"repo": "pashatick/Python_lessons_basic",
"path": "/lesson03/home_work/hw03_hard.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for line in f:
st = line.split(' ')
print(st)
f.close()
'''
# Задание-3:
# Дан файл ("data/fruits") со списком фруктов.
# Записать в новые файлы все фрукты, начинающиеся с определенной буквы.
# Т.е. в одном файле будут все фрукты на букву “А”, во втором на “Б” и т.д.
# Файлы назвать соответственно.... | code_fim | hard | {
"lang": "python",
"repo": "pashatick/Python_lessons_basic",
"path": "/lesson03/home_work/hw03_hard.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for line in f:
st = line.split(' ')
print(st)
f.close()
'''
# Задание-3:
# Дан файл ("data/fruits") со списком фруктов.
# Записать в новые файлы все фрукты, начинающиеся с определенной буквы.
# Т.е. в одном файле будут все фрукты на букву “А”, во втором на “Б” и т.д.
# Файлы назвать соответственно.
... | code_fim | hard | {
"lang": "python",
"repo": "pashatick/Python_lessons_basic",
"path": "/lesson03/home_work/hw03_hard.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/books')
def get_books():
return jsonify({'books':books})
@app.route('/books',methods=['POST'])
def add_book():
return jsonify(request.get_json())
@app.route('/books/<int:isbn>')
def get_book_by_isbn(isbn):
return_value = {}
for book in books:
if book["isbn"] == isbn:... | code_fim | medium | {
"lang": "python",
"repo": "gouseferoz/sampleflask",
"path": "/app/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return_value = {}
for book in books:
if book["isbn"] == isbn:
return_value = {
'name': book["name"],
'price': book["price"]
}
return jsonify(return_value)<|fim_prefix|># repo: gouseferoz/sampleflask path: /app/__init__.py
from fl... | code_fim | medium | {
"lang": "python",
"repo": "gouseferoz/sampleflask",
"path": "/app/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gouseferoz/sampleflask path: /app/__init__.py
from flask import Flask,jsonify,request
app = Flask(__name__)
books = [
{
'name': 'Green Eggs and Ham',
'price': 7.99,
'isbn': 97506512356
},
{
'name': 'The cat in the hat',
'price': 6.99,
'... | code_fim | medium | {
"lang": "python",
"repo": "gouseferoz/sampleflask",
"path": "/app/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
>>> # unclear phrasing in the text
>>> data.shape == (120, 30, 100, 100) or data.shape == (100, 100, 30, 120)
True
""",
'hidden': True,
'locked': False
},
... | code_fim | hard | {
"lang": "python",
"repo": "praveer08/cogneuro-connector",
"path": "/weekly_materials/Lecture02_Intro_fMRI_Data_And_DataTypes_Python/tests/q1_5_full.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: praveer08/cogneuro-connector path: /weekly_materials/Lecture02_Intro_fMRI_Data_And_DataTypes_Python/tests/q1_5_full.py
test = {
'name': '5_full',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> # dat... | code_fim | hard | {
"lang": "python",
"repo": "praveer08/cogneuro-connector",
"path": "/weekly_materials/Lecture02_Intro_fMRI_Data_And_DataTypes_Python/tests/q1_5_full.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Y-usuf-18/python-code path: /BTK ilk ders.py
website = "http://www.sadikturan.com"
course <|fim_suffix|>22:26])
print(course[:15])
print(course[-16:])<|fim_middle|>="Python Kursu : Baştan Sona Kurs"
print(len(course))
print(website[7:10])
print(website[ | code_fim | medium | {
"lang": "python",
"repo": "Y-usuf-18/python-code",
"path": "/BTK ilk ders.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>22:26])
print(course[:15])
print(course[-16:])<|fim_prefix|># repo: Y-usuf-18/python-code path: /BTK ilk ders.py
website = "http://www.sadikturan.com"
course ="Python Kursu : Baştan Sona Kurs"
print(len<|fim_middle|>(course))
print(website[7:10])
print(website[ | code_fim | easy | {
"lang": "python",
"repo": "Y-usuf-18/python-code",
"path": "/BTK ilk ders.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_prefix|># repo: chinkurgp/python path: /catfile.py
#!/usr/bin/python
import os, sys
def Cat(filename):
f = open(filename)
text = f.read()
print "------", filename
print text
def main():
<|fim_middle|> args = sys.argv[1:]
for arg in args:
Cat(arg... | code_fim | easy | {
"lang": "python",
"repo": "chinkurgp/python",
"path": "/catfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chinkurgp/python path: /catfile.py
#!/usr/bin/python
import os, sys
def Cat(filename):
f = open(filename)
text = f.read()
print "------", filename
print text
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_middle|>def main():
args = sys.argv[1:]
for arg in args:
Cat(arg... | code_fim | medium | {
"lang": "python",
"repo": "chinkurgp/python",
"path": "/catfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chinkurgp/python path: /catfile.py
#!/usr/bin/python
import os, sys
def Cat(filename):
<|fim_suffix|> args = sys.argv[1:]
for arg in args:
Cat(arg)
if __name__ == '__main__':
main()<|fim_middle|> f = open(filename)
text = f.read()
print "------", filename
print text
def main... | code_fim | medium | {
"lang": "python",
"repo": "chinkurgp/python",
"path": "/catfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(array) <= 1:
return array
array, pivot = partition(array)
array[:pivot] = quicksort(array[:pivot])
array[pivot+1:] = quicksort(array[pivot+1:])
return array
test = [21, 4, 1, 3, 9, 20, 25, 6, 21, 14]
print(quicksort(test))<|fim_prefix|># repo: SadiqUltra/ud513-Data-... | code_fim | medium | {
"lang": "python",
"repo": "SadiqUltra/ud513-Data-Structures-Algorithms-in-Python",
"path": "/Lesson_3_searching_and_sorting/15_quick_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def quicksort(array):
if len(array) <= 1:
return array
array, pivot = partition(array)
array[:pivot] = quicksort(array[:pivot])
array[pivot+1:] = quicksort(array[pivot+1:])
return array
test = [21, 4, 1, 3, 9, 20, 25, 6, 21, 14]
print(quicksort(test))<|fim_prefix|># repo:... | code_fim | hard | {
"lang": "python",
"repo": "SadiqUltra/ud513-Data-Structures-Algorithms-in-Python",
"path": "/Lesson_3_searching_and_sorting/15_quick_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SadiqUltra/ud513-Data-Structures-Algorithms-in-Python path: /Lesson_3_searching_and_sorting/15_quick_sort.py
"""Implement quick sort in Python.
Input a list.
Output a sorted list."""
def partition(array):
length = len(array)
pivot = length - 1
low = 0
while pivot - low > 0:
... | code_fim | medium | {
"lang": "python",
"repo": "SadiqUltra/ud513-Data-Structures-Algorithms-in-Python",
"path": "/Lesson_3_searching_and_sorting/15_quick_sort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class LocalServiceClientFixture(LocalServiceFixture):
def start(self):
self.client = self.make_client()
self.client.connect()
self.empty()
def empty(self):
self.client.empty()
class IndexerFixture(LocalServiceClientFixture):
def make_client(self):
... | code_fim | hard | {
"lang": "python",
"repo": "MickaelBergem/cosr-back",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MickaelBergem/cosr-back path: /tests/conftest.py
import pytest
import os
import sys
import logging
import platform
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("elasticsearch").setLevel(logging.WARNING)
logging.basicConfig(level=logging.DEBUG)
sys.path.append(os.path... | code_fim | hard | {
"lang": "python",
"repo": "MickaelBergem/cosr-back",
"path": "/tests/conftest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='AccessUsers',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Userid', models.TextField()),
('password', models.Tex... | code_fim | hard | {
"lang": "python",
"repo": "mjrooney7/E-Commerce-Condiments-shop",
"path": "/core/migrations/0007_accessusers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mjrooney7/E-Commerce-Condiments-shop path: /core/migrations/0007_accessusers.py
# Generated by Django 2.2.4 on 2020-04-24 07:55
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('core', '0006_contacted'),
]
operations = [
migrations.CreateMode... | code_fim | hard | {
"lang": "python",
"repo": "mjrooney7/E-Commerce-Condiments-shop",
"path": "/core/migrations/0007_accessusers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ax in fig.axes:
plt.sca(ax)
plt.xticks(rotation=45)
plt.show()
def plot_clear_dataset(self, ds):
plt.figure(figsize=(18, 6))
plt.plot(ds)
plt.plot(ds.shift(18))
plt.xlabel('Date', fontsize=14)
plt.show()
def subplots_acf_pacf(self, series):
fig = plt.figure(figsize=(12, 8))
... | code_fim | hard | {
"lang": "python",
"repo": "ZCHILLAXY/Birmingham-Parking-Prediction",
"path": "/data_processing/data_plot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.figure(figsize=(18, 6))
plt.plot(ds)
plt.plot(ds.shift(18))
plt.xlabel('Date', fontsize=14)
plt.show()
def subplots_acf_pacf(self, series):
fig = plt.figure(figsize=(12, 8))
ax1 = fig.add_subplot(211)
fig = plot_acf(series, lags=40, ax=ax1)
ax2 = fig.add_subplot(212)
fig = plot_p... | code_fim | hard | {
"lang": "python",
"repo": "ZCHILLAXY/Birmingham-Parking-Prediction",
"path": "/data_processing/data_plot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZCHILLAXY/Birmingham-Parking-Prediction path: /data_processing/data_plot.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File :Birmingham_Parking_Prediction -> data_plot
@Author :Zhuang Yi
@Date :2019/10/9 15:54
===============... | code_fim | hard | {
"lang": "python",
"repo": "ZCHILLAXY/Birmingham-Parking-Prediction",
"path": "/data_processing/data_plot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daring2/own-agent-open path: /utils/logger.py
# please, pay attention to 'current_level'
# messages with level that is lower than 'current_level' will not be logged
# messages with level that is lower that 'console_level' will not be written to console
# usage:
#
# from agents_platform import log... | code_fim | hard | {
"lang": "python",
"repo": "daring2/own-agent-open",
"path": "/utils/logger.py",
"mode": "psm",
"license": "LicenseRef-scancode-other-permissive",
"source": "the-stack-v2"
} |
<|fim_suffix|>def info(logger_name, message, response=None):
return __log_message(logger_name, message, INFO_LEVEL, response)
def warning(logger_name, message, response=None):
return __log_message(logger_name, message, WARNING_LEVEL, response)
def error(logger_name: object, message: object, response: object... | code_fim | hard | {
"lang": "python",
"repo": "daring2/own-agent-open",
"path": "/utils/logger.py",
"mode": "spm",
"license": "LicenseRef-scancode-other-permissive",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 12yuens2/ai_chatbot path: /parse.py
import os
i = 0
with open("corpus.data", "w") as corpus:
for fname in<|fim_suffix|> for line in filename:
writeline = ' '.join(line.split()[3:])
corpus.write(writeline + "\n")
i = i + 1<|fim_middle|> os.listdi... | code_fim | medium | {
"lang": "python",
"repo": "12yuens2/ai_chatbot",
"path": "/parse.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for line in filename:
writeline = ' '.join(line.split()[3:])
corpus.write(writeline + "\n")
i = i + 1<|fim_prefix|># repo: 12yuens2/ai_chatbot path: /parse.py
import os
i = 0
with open("corpus.data", "w") as corpus:
for fname in<|fim_middle|> os.listdi... | code_fim | medium | {
"lang": "python",
"repo": "12yuens2/ai_chatbot",
"path": "/parse.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _generate_cell_initialization(outputFile,inputLine,fieldNames):
print("_generate_cell_initialization")
outputFile.write("\n")
outputFile.write("rule : { \n")
port_idx =0
for fieldName in fieldNames[1:]:
port_idx=port_idx+1
print("Writ... | code_fim | hard | {
"lang": "python",
"repo": "digarcia/AgroDevsDSL",
"path": "/Python/inputParsing/AgroDevsInputParse.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
f_input.close()
f_output.close()
def generate_inicialization_file(id_test,lines,columns):
"""
generate event file (inicializacion.inc) based on cell content csv input
Allows dinamic definitions of input variables(ports)
(but must be supported by the ma model)
... | code_fim | hard | {
"lang": "python",
"repo": "digarcia/AgroDevsDSL",
"path": "/Python/inputParsing/AgroDevsInputParse.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: digarcia/AgroDevsDSL path: /Python/inputParsing/AgroDevsInputParse.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 1 16:34:03 2020
@author: Diego.Garcia
"""
import os
import io
import csv
#from io import StringIO
#import csv
import pandas as pd
AGRODEVS_INPUT_DIR='./inputFiles/'
INPUT_PARSE... | code_fim | hard | {
"lang": "python",
"repo": "digarcia/AgroDevsDSL",
"path": "/Python/inputParsing/AgroDevsInputParse.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> hstack = hud.HStack()
hstack.add_view(left_pane)
hstack.add_view(right_pane)
window.set_view(hstack)
while window.update():
time.sleep(0.1)
window.wait_events()
if __name__ == "__main__":
main()
hud.shutdown()<|fim_prefix|># repo: XanxusCrypto/hud path: /exa... | code_fim | hard | {
"lang": "python",
"repo": "XanxusCrypto/hud",
"path": "/examples/python/stereo_image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XanxusCrypto/hud path: /examples/python/stereo_image.py
import os
import hud
import time
import numpy as np
from PIL import Image
hud.set_data_directory(os.path.dirname(hud.__file__))
POINT_COLOR = np.array([1.0, 0.6, 0.5, 1.0])
<|fim_suffix|> while window.update():
time.sleep(0.1)
... | code_fim | hard | {
"lang": "python",
"repo": "XanxusCrypto/hud",
"path": "/examples/python/stereo_image.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: even0a/blender_1_click_rig path: /one_click_rig/bone_functions.py
import math
import bpy
import re
oops = bpy.ops.object
pops = bpy.ops.pose
def set_array_indices(array, indices):
for i in range(len(array)):
array[i] = True if i in indices else False
def switch_to_layer(arm, index)... | code_fim | hard | {
"lang": "python",
"repo": "even0a/blender_1_click_rig",
"path": "/one_click_rig/bone_functions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> oops.mode_set(mode = 'POSE')
for n in ik_controls:
fk_bone_name = n.replace('ik', 'fk')
rig.pose.bones[n].matrix = rig.pose.bones[fk_bone_name].matrix.copy()
select_bones(rig, ['foot_ik.L','foot_ik.R'])
pops.rot_clear()
pops.scale_clear()
def snap_fk_to_ik(rig):
... | code_fim | hard | {
"lang": "python",
"repo": "even0a/blender_1_click_rig",
"path": "/one_click_rig/bone_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='device',
name='position',
field=geoposition.fields.GeopositionField(help_text='Enter Lattitude and Longitude Here, Please Select from Map', max_length=42),
),
]<|fim_prefix|># repo: mnpappo/secuct... | code_fim | medium | {
"lang": "python",
"repo": "mnpappo/secuctrlserver",
"path": "/dashboard/migrations/0012_auto_20180908_2028.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mnpappo/secuctrlserver path: /dashboard/migrations/0012_auto_20180908_2028.py
# Generated by Django 2.1.1 on 2018-09-08 20:28
from django.db import migrations
import geoposition.fields
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='device',
... | code_fim | medium | {
"lang": "python",
"repo": "mnpappo/secuctrlserver",
"path": "/dashboard/migrations/0012_auto_20180908_2028.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
defs.delete_variable("ZFRED");assert len(list(defs.user_variables)) == 6, "Expected 6 variables since we just delete ZFRED"
defs.delete_variable(""); assert len(list(defs.user_variables)) == 0, "Expected 0 variables since we should have deleted all"
a_dict = { "name":"value"... | code_fim | hard | {
"lang": "python",
"repo": "XiaoLinhong/ecflow",
"path": "/Pyext/test/py_u_TestAddDelete.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> f3 = ecflow.Family("f3")
f3.add_autoarchive(20, 10, True) # hour,minutes,relative
print(str(f3.get_autoarchive()))
f3_1 = ecflow.Family("f3_1")
f3_1.add_autoarchive(20, 10, True,True) # hour,minutes,relative,idle
print(str(f3_1.get_autoarchive()))
f4... | code_fim | hard | {
"lang": "python",
"repo": "XiaoLinhong/ecflow",
"path": "/Pyext/test/py_u_TestAddDelete.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XiaoLinhong/ecflow path: /Pyext/test/py_u_TestAddDelete.py
ls"
#===========================================================================
# add delete Repeat
#===========================================================================
task.add_repeat(ecflow.RepeatInteger("integ... | code_fim | hard | {
"lang": "python",
"repo": "XiaoLinhong/ecflow",
"path": "/Pyext/test/py_u_TestAddDelete.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prr21/qgis-plugin path: /convert_to_graduses.py
# Импорт матемаческой функции
from math import trunc
class convertToGraduses:
"""Класс выполняющий конвертацию """
def __init__(self, valX, valY, toMs, withWays):
"""Конструктор"""
# Присвоить полученные значения
s... | code_fim | hard | {
"lang": "python",
"repo": "prr21/qgis-plugin",
"path": "/convert_to_graduses.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Формула перевода в градусную систему координат
dd = trunc(ddd) # Граудсы = TRUNC(DDD)
mm = trunc( (ddd - dd) * 60 ) # Минуты = TRUNC((DDD − DD) * 60)
ssms = ( (ddd-dd) * 60 - mm ) * 60 # Сек, мс = ((DDD − DD) * 60 − MM) * 60
# Скор... | code_fim | hard | {
"lang": "python",
"repo": "prr21/qgis-plugin",
"path": "/convert_to_graduses.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yipenghuang0302/Cirq path: /kc_examples/kc_bell_inequality.py
"""Creates and simulates a circuit equivalent to a Bell inequality test.
=== EXAMPLE OUTPUT ===
Circuit:
(0, 0): ───H───@───X^-0.25───────X^0.5───M───
│ │
(0, 1): ───────┼─────────────H───@───────M───
... | code_fim | hard | {
"lang": "python",
"repo": "yipenghuang0302/Cirq",
"path": "/kc_examples/kc_bell_inequality.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Referees flip coins.
circuit.append([
cirq.H(alice_referee),
cirq.H(bob_referee),
])
# Players do a sqrt(X) based on their referee's coin.
circuit.append([
cirq.decompose(cirq.CNOT(alice_referee, alice)**0.5),
cirq.decompose(cirq.CNOT(bob_referee, bob... | code_fim | hard | {
"lang": "python",
"repo": "yipenghuang0302/Cirq",
"path": "/kc_examples/kc_bell_inequality.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Prepare shared entangled state.
circuit.append([
cirq.H(alice),
cirq.CNOT(alice, bob),
cirq.X(alice)**-0.25,
])
# Referees flip coins.
circuit.append([
cirq.H(alice_referee),
cirq.H(bob_referee),
])
# Players do a sqrt(X) based on the... | code_fim | hard | {
"lang": "python",
"repo": "yipenghuang0302/Cirq",
"path": "/kc_examples/kc_bell_inequality.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PegasusWang/collection_python path: /z42/z42/web/memcache/mc_connection.py
import os
import marshal as msgpack
class SimpleCached:
' cache obj in local process, wrapper for memcache '
def __init__(self, mc):
self.mc = mc
def set_msgpack(self, key, val, time=0, dumps=msgpack.... | code_fim | hard | {
"lang": "python",
"repo": "PegasusWang/collection_python",
"path": "/z42/z42/web/memcache/mc_connection.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> from collections import defaultdict
d = defaultdict(int)
nd = defaultdict(lambda: [0, 0])
for call, ncall, cost in self.mc.log:
d[call] += 1
x = nd[ncall]
x[0] += 1
x[1] += cost
result = 'memcache access (%s/%s calls):... | code_fim | hard | {
"lang": "python",
"repo": "PegasusWang/collection_python",
"path": "/z42/z42/web/memcache/mc_connection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> rs = [(k, self.dataset_msgpack.get(k)) for k in map(str,keys)]
r = dict((k, v) for k, v in rs if v is not None)
rs = self.mc.get_multi([k for k, v in rs if v is None])
rs = dict((k, loads(v)) for k, v in rs.iteritems())
r.update(rs)
self.dataset_msgpack.upda... | code_fim | hard | {
"lang": "python",
"repo": "PegasusWang/collection_python",
"path": "/z42/z42/web/memcache/mc_connection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aravindsr/synthetic_generation path: /src/mammographic_starter.py
import pandas as pd
from sklearn.model_selection import train_test_split
import os
import core2
import math
import numpy as np
#min_max scaler(-1,1)
RUN_NUMBER = 10
BATCH_SIZE = 10
K = 3
DATA_FILE_NAME = "mammographic"
MAIN_PATH... | code_fim | medium | {
"lang": "python",
"repo": "aravindsr/synthetic_generation",
"path": "/src/mammographic_starter.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.hidden_layer_size1 = 16
self.hidden_layer_size2 = 8
self.keep_probability = 0.7
self.clip_constant = 4.0
self.learning_rate = 0.01
self.batch_size = 10
for step in parameter_dict:
evalParameter = parameter_dict.get(step)
... | code_fim | medium | {
"lang": "python",
"repo": "aravindsr/synthetic_generation",
"path": "/src/mammographic_starter.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.