text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def main(): cohorts = list(get_authorized_service('')) pprint.pprint(cohorts) cohort_id = None for item in cohorts['items']: if 'All TCGA Data' == item['name']: cohort_id = item['id'] if not cohort_id: raise ValueError('didn\'t find the ALL TCGA Data...
code_fim
hard
{ "lang": "python", "repo": "pumpikano/examples-Python", "path": "/python/isb_cgc_api_v3_images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pumpikano/examples-Python path: /python/isb_cgc_api_v3_images.py ''' Created on Jun 20, 2017 Copyright 2017, Institute for Systems Biology. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a co...
code_fim
hard
{ "lang": "python", "repo": "pumpikano/examples-Python", "path": "/python/isb_cgc_api_v3_images.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> err4[i]= err1[i] + err2[i] + err3[i] + err4[i] elif (x1[i]<0 and x2[i]>=0 and x3[i]<0 and x4[i]<0): # - + - - x2[i]=x2[i]+abs(x1[i])+abs(x3[i])+ abs(x4[i]) x1[i]=1E-20 x3[i]=1E-20 x4[i]=1E-20 er...
code_fim
hard
{ "lang": "python", "repo": "pluflou/BeamCenteringMonitor", "path": "/negativecurrents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pluflou/BeamCenteringMonitor path: /negativecurrents.py #Function to remove negative current from BCM plates to neighboring positive plates def negativePlates( x1, x2, x3, x4, err1, err2, err3, err4): for i in range(len(x1)): if ((len(x1) != len(x2)) or (len(x1) != len(x3)) or (le...
code_fim
hard
{ "lang": "python", "repo": "pluflou/BeamCenteringMonitor", "path": "/negativecurrents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RitvikDayal/The-Stone-Shop path: /shop/migrations/0008_product_tag.py # Generated by Django 3.0.8 on 2020-07-28 21:20 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('shop', '0007_auto_20200729_0240'), ] operations = [ migrations.AddField( ...
code_fim
easy
{ "lang": "python", "repo": "RitvikDayal/The-Stone-Shop", "path": "/shop/migrations/0008_product_tag.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('shop', '0007_auto_20200729_0240'), ] operations = [ migrations.AddField( model_name='product', name='tag', field=models.CharField(blank=True, choices=[('new', 'New'), ('hot', 'hot'),...
code_fim
easy
{ "lang": "python", "repo": "RitvikDayal/The-Stone-Shop", "path": "/shop/migrations/0008_product_tag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nkiryanov/bbbs path: /bbbs/entertainment/urls.py from django.urls import path from django.urls.conf import include from rest_framework.routers import DefaultRouter <|fim_suffix|>entertainment_urls = [ path("entertainment/", include(router.urls)), ] urlpatterns = [ path("v1/", include(en...
code_fim
hard
{ "lang": "python", "repo": "nkiryanov/bbbs", "path": "/bbbs/entertainment/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>entertainment_urls = [ path("entertainment/", include(router.urls)), ] urlpatterns = [ path("v1/", include(entertainment_urls)), ]<|fim_prefix|># repo: nkiryanov/bbbs path: /bbbs/entertainment/urls.py from django.urls import path from django.urls.conf import include from rest_framework.routers i...
code_fim
hard
{ "lang": "python", "repo": "nkiryanov/bbbs", "path": "/bbbs/entertainment/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bar values(?,?);select * from bar;", (1,2,3,4,5,6,7,8,9,10)): print(row)<|fim_prefix|># repo: sqlite-mpi/sqlite-mpi-rust path: /sh/dtrace/d/del/apsw/open.py #!/usr/local/bin/python3 import apsw con=apsw.Connection(":memory:") cur=con.cursor() for row i...
code_fim
hard
{ "lang": "python", "repo": "sqlite-mpi/sqlite-mpi-rust", "path": "/sh/dtrace/d/del/apsw/open.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sqlite-mpi/sqlite-mpi-rust path: /sh/dtrace/d/del/apsw/open.py #!/usr/local/bin/python3 import apsw con=apsw.Connection(":memory:") cur=con.cursor() for row in cur.execute("create tabl<|fim_suffix|>table foo;" "create table bar(x,y);insert into bar values(?,?);" ...
code_fim
hard
{ "lang": "python", "repo": "sqlite-mpi/sqlite-mpi-rust", "path": "/sh/dtrace/d/del/apsw/open.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Generate data X1, X2, y = self.__data_generation__(ids_list_temp) # if generate additional data for RNN to run # RNN doesn't take the full length for computational efficiency purpose # if return data for RNN, the two alleles are returned separately if se...
code_fim
hard
{ "lang": "python", "repo": "tuantrieu/DeepMILO", "path": "/program/data_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> le = int(np.floor(len(self.ids_list) / self.batch_size)) # taking care of the case when number of samples < batch_size: randomly add samples to make a full batch size if self.nbr_batch == 0 and le * self.batch_size < len(self.ids_list): shortage = (le + 1) * self.batc...
code_fim
hard
{ "lang": "python", "repo": "tuantrieu/DeepMILO", "path": "/program/data_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tuantrieu/DeepMILO path: /program/data_generator.py ''' Data generation for input as sequences and output as boundaries ''' import numpy as np import keras import h5py import re import random class DataGenerator(keras.utils.Sequence): 'Generates data for Boundary prediction' def __init...
code_fim
hard
{ "lang": "python", "repo": "tuantrieu/DeepMILO", "path": "/program/data_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: niefy/LeetCodeExam path: /weekly_contest/128/NumPairsDivisibleBy60.py """ https://leetcode-cn.com/contest/weekly-contest-128/problems/pairs-of-songs-with-total-durations-divisible-by-60/ 题目:1013. 总持续时间可被 60 整除的歌曲 在歌曲列表中,第 i 首歌曲的持续时间为 time[i] 秒。 返回其总持续时间(以秒为单位)可被 60 整除的歌曲对的数量。形式上,我们希望索引的数字 i < j...
code_fim
hard
{ "lang": "python", "repo": "niefy/LeetCodeExam", "path": "/weekly_contest/128/NumPairsDivisibleBy60.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>输入:[60,60,60] 输出:3 解释:所有三对的总持续时间都是 120,可以被 60 整数。 提示: 1 <= time.length <= 60000 1 <= time[i] <= 500 @author Niefy @date 2019-03-18 """ class Solution: def numPairsDivisibleBy60(self, time) -> int: #两两计算方式,超出时间限制 length=len(time) count=0 for i in range(0,length): ...
code_fim
hard
{ "lang": "python", "repo": "niefy/LeetCodeExam", "path": "/weekly_contest/128/NumPairsDivisibleBy60.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def numPairsDivisibleBy60_1(self, time) -> int: #全部除以60,将余数分为等于0、小于30、等于30、大于30 的3组,超出时间限制 r1,r2=[],[] #分别为小于30的余数和大于30的余数 countR0,countR30=0,0 #余数等于30的个数 for i in range(0,len(time)): remain=time[i]%60 if(remain==0): countR0+=1 ...
code_fim
hard
{ "lang": "python", "repo": "niefy/LeetCodeExam", "path": "/weekly_contest/128/NumPairsDivisibleBy60.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: elkhound/elkhound path: /elkhound/logger.py import abc import datetime import logging.config import os from typing import Dict, List class Logger(abc.ABC): @abc.abstractmethod def report_start(self, timestamp: int, targets: List[int], params: Dict[str, str]): pass @abc.abst...
code_fim
hard
{ "lang": "python", "repo": "elkhound/elkhound", "path": "/elkhound/logger.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with open(self.runs_log, 'at') as f: f.write('%d|%s|%s|%s|%s\n' % ( timestamp, datetime.datetime.strptime(str(timestamp), '%Y%m%d%H%M%S').strftime('%Y-%m-%d %H:%M:%S'), 'START', ' '.join(map(str, targets)), ...
code_fim
hard
{ "lang": "python", "repo": "elkhound/elkhound", "path": "/elkhound/logger.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return process.returncode def get_test_summary(self): """Get summary from catkin_test_results""" last_line = 'None' cmd = ['catkin_test_results', 'build/%s' % self.name ] try: process = subprocess.Popen(cmd, stdout=subp...
code_fim
hard
{ "lang": "python", "repo": "gdesouza/py-catkin-test", "path": "/catkin_unit_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gdesouza/py-catkin-test path: /catkin_unit_test.py #!/usr/bin/env python3 import os import sys import subprocess import argparse from glob import glob import xml.etree.ElementTree as ET import json import shlex class TestSummary: """Class for storing the test summary""" def __init__(...
code_fim
hard
{ "lang": "python", "repo": "gdesouza/py-catkin-test", "path": "/catkin_unit_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Return True if the stack is empty, False otherwise. >>> s = Stack() >>> s.is_empty() True >>> s.push(1) >>> s.is_empty() False """ return len(self._data) == 0 def __len__(self) -> int: return len(self._data) def ...
code_fim
hard
{ "lang": "python", "repo": "lpozo/pyadt", "path": "/pyadt/stack.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lpozo/pyadt path: /pyadt/stack.py """Stack abstract data type.""" from collections import deque from typing import Any, Iterator, Optional class Stack: def __init__(self, iterable: Optional[Any] = None, /) -> None: self._data: deque = deque() if iterable is not None: ...
code_fim
hard
{ "lang": "python", "repo": "lpozo/pyadt", "path": "/pyadt/stack.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: robin-vjc/pytetris path: /Setup.py __author__ = 'Robin' """ Settings file, for the GUI of pyTetris """ import pygame, sys from pygame.locals import * from tetris import * from collections import namedtuple # Instantiate pyTetris engine # --------------------------- model = Model() viewer = View...
code_fim
hard
{ "lang": "python", "repo": "robin-vjc/pytetris", "path": "/Setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def draw_score(score, level): if model.game_mode == 'game over': text = myfont.render("Game Over!", 1, (255,255,255)) else: text = myfont.render("".join(["Score: ", str(score), " Level: ", str(level)]), 1, (255,255,255)) screen.blit(text, (1, 1))<|fi...
code_fim
hard
{ "lang": "python", "repo": "robin-vjc/pytetris", "path": "/Setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Draws a rectangle of the given color in the grid :param position: Position in the grid where the block should be placed :param color: Color of the block :return: None """ x = position.col*DX+DX+2 y = position.row*DY+DY+2 width = DX-4 height = DY-4 pygame.draw.re...
code_fim
hard
{ "lang": "python", "repo": "robin-vjc/pytetris", "path": "/Setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agalea91/docker-airflow path: /dags/airflow_test_dag.py # -*- coding: utf-8 -*- """ airflow_page_monitor.py Test Airflow pipeline for Page Monitor app. Author: Alex Galea """ from airflow import DAG from airflow.operators.bash_operator import BashOperator import os import datetime import sys ...
code_fim
medium
{ "lang": "python", "repo": "agalea91/docker-airflow", "path": "/dags/airflow_test_dag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Step 2: process for errors file_task_bash_command = ( '{{ params.python_path }} {{ params.file_path }}' ) file_task = BashOperator( task_id='file_task', bash_command=file_task_bash_command, params={ 'python_path': config.PYTHON_PATH, 'file_path': os.path.join(project_hom...
code_fim
hard
{ "lang": "python", "repo": "agalea91/docker-airflow", "path": "/dags/airflow_test_dag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: levelupai/short_text_clustering path: /code/Testing_research/class_cluster_tdfif.py import warnings from sklearn import cluster, mixture from sklearn.neighbors import kneighbors_graph from sklearn.preprocessing import StandardScaler from itertools import cycle, islice from sklearn import metrics...
code_fim
hard
{ "lang": "python", "repo": "levelupai/short_text_clustering", "path": "/code/Testing_research/class_cluster_tdfif.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: levelupai/short_text_clustering path: /code/Testing_research/class_cluster_tdfif.py s from sklearn import cluster, mixture from sklearn.neighbors import kneighbors_graph from sklearn.preprocessing import StandardScaler from itertools import cycle, islice from sklearn import metrics from sklearn i...
code_fim
hard
{ "lang": "python", "repo": "levelupai/short_text_clustering", "path": "/code/Testing_research/class_cluster_tdfif.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># evaluation curves plotting def uniform_labelings_scores(score_func, n_samples, n_clusters_range, fixed_n_classes=None, n_runs=5, seed=42): random_labels = np.random.RandomState(seed).randint scores = np.zeros((len(n_clusters_range), n_runs)) if fixed_n_classes...
code_fim
hard
{ "lang": "python", "repo": "levelupai/short_text_clustering", "path": "/code/Testing_research/class_cluster_tdfif.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>url = 'https://curso-python-selenium.netlify.app/exercicio_01.html' bs = Chrome() bs.get(url) sleep(3) val = bs.find_elements_by_tag_name('p') print(val) for i in val: print(i.text, i.tag_name) dicio = { 'h1': {i.get_attribute('atributo'): i.text for i in val} } bs.quit()<|fim_prefix|># repo: ma...
code_fim
medium
{ "lang": "python", "repo": "matheussmachado/sel_aprend", "path": "/aula_03/ex01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matheussmachado/sel_aprend path: /aula_03/ex01.py """ GERE UM DICIONÁRIO EM QUE A CHAVE É A TAG H1: - o valor deve ser um novo dicionário - cada chave do valor deverá ser o valor de atributo - cada valor deve ser o texto contido no elemento <|fim_suffix|>url = 'https://curso-python-...
code_fim
medium
{ "lang": "python", "repo": "matheussmachado/sel_aprend", "path": "/aula_03/ex01.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def canPermutePalindrome(self, s: str) -> bool: m = collections.defaultdict(int) for x in s: m[x] += 1 return sum([(m[x] & 1) for x in m]) < 2<|fim_prefix|># repo: windniw/just-for-fun path: /leetcode/266.py """ link: https://leetcode-cn.com/problems/palindrome-pe...
code_fim
medium
{ "lang": "python", "repo": "windniw/just-for-fun", "path": "/leetcode/266.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: windniw/just-for-fun path: /leetcode/266.py """ link: https://leetcode-cn.com/problems/palindrome-permutation <|fim_suffix|>""" class Solution: def canPermutePalindrome(self, s: str) -> bool: m = collections.defaultdict(int) for x in s: m[x] += 1 return s...
code_fim
medium
{ "lang": "python", "repo": "windniw/just-for-fun", "path": "/leetcode/266.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: msftsettiy/CCF path: /tests/content_types.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the Apache 2.0 License. import tempfile import http import infra.network import infra.path import infra.proc import infra.net import infra.e2e_args import suite.test_requireme...
code_fim
hard
{ "lang": "python", "repo": "msftsettiy/CCF", "path": "/tests/content_types.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def run(args): hosts = ["localhost"] * (3 if args.consensus == "pbft" else 2) with infra.network.network( hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb ) as network: network.start_and_join(args) network = test_content_types(network, args) i...
code_fim
hard
{ "lang": "python", "repo": "msftsettiy/CCF", "path": "/tests/content_types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def credits(): # this is also just for fun print('') print("######################################################") print("# #") print("# END OF PROGRAM #") print("# ...
code_fim
hard
{ "lang": "python", "repo": "tmolitor002/tax-brackets", "path": "/Federal/python/tax_brackets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Various metrics calculated to return to user top_rate = top_bracket.iloc[0]['rate'] top_rate_percent = (top_rate * 100) top_tax = to_tax * top_rate lower_tax = top_bracket.iloc[0]['add_tax'] tax_liability = top_tax + lower_tax income_kept = tax_income - tax_liability effective_tax_rate = ((tax_liability...
code_fim
hard
{ "lang": "python", "repo": "tmolitor002/tax-brackets", "path": "/Federal/python/tax_brackets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmolitor002/tax-brackets path: /Federal/python/tax_brackets.py def opening_message(): # This is just for fun name = input('Enter your name: ').upper() print("######################################################") print("# #") print("# ...
code_fim
hard
{ "lang": "python", "repo": "tmolitor002/tax-brackets", "path": "/Federal/python/tax_brackets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.cached @get_cached.setter def set_cached(self, cached): self.cached = cached @property def get_slab(self): return self.slab @get_slab.setter def set_slab(self, slab): self.slab = slab<|fim_prefix|># repo: harshithsr93/System_Performanc...
code_fim
hard
{ "lang": "python", "repo": "harshithsr93/System_Performance_Monitoring", "path": "/System_monitor/src/Model/VirtualMemory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.inactive = inactive @property def get_buffer(self): return self.buffers @get_buffer.setter def set_buffer(self, buffer): self.buffers = buffer @property def get_cached(self): return self.cached @get_cached.setter def set_cached(self,...
code_fim
hard
{ "lang": "python", "repo": "harshithsr93/System_Performance_Monitoring", "path": "/System_monitor/src/Model/VirtualMemory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: harshithsr93/System_Performance_Monitoring path: /System_monitor/src/Model/VirtualMemory.py # Author : Harshith S R # Date : 22/08/2018 class Virtual: def __init__(self): self.total = 0 self.used = 0 self.available = 0 self.free = 0 self.activ...
code_fim
hard
{ "lang": "python", "repo": "harshithsr93/System_Performance_Monitoring", "path": "/System_monitor/src/Model/VirtualMemory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sand-ci/ps-collector path: /src/ps_collector/rabbitmquploader.py from .uploader import Uploader # Need to push to Rabbit mq import pika from ps_collector.sharedrabbitmq import SharedRabbitMQ import ps_collector import time import json import tempfile import os import errno class Rabbi...
code_fim
hard
{ "lang": "python", "repo": "sand-ci/ps-collector", "path": "/src/ps_collector/rabbitmquploader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Now that we know we have data to send, actually connect upstream. if self.channel is None: self.channel = ps_collector.get_rabbitmq_connection(self.config).createChannel() if summaries_data: self.log.info("posting new summaries") self.pu...
code_fim
hard
{ "lang": "python", "repo": "sand-ci/ps-collector", "path": "/src/ps_collector/rabbitmquploader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fellfalla/baselines path: /baselines/ppo2/defaults.py def mujoco(): return dict( nsteps=2048, nminibatches=32, lam=0.95, gamma=0.99, noptepochs=10, log_interval=1, ent_coef=0.0, lr=lambda f: 3e-4 * f, cliprange=0.2, ...
code_fim
hard
{ "lang": "python", "repo": "Fellfalla/baselines", "path": "/baselines/ppo2/defaults.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return dict( nsteps=2048, nminibatches=256, lam=0.5**(1./8), gamma=0.5**(1./16), # half value after 16 steps noptepochs=10, log_interval=1, ent_coef=0.0, lr=lambda f: 7e-4 * f, cliprange=lambda f: f * 0.15 + 0.05, value_ne...
code_fim
hard
{ "lang": "python", "repo": "Fellfalla/baselines", "path": "/baselines/ppo2/defaults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pennyarcade/TPPP path: /tpp/FileParser.py """Open a TPP source file and returns a list of page objects.""" import sys from tpp.Page import Page class FileParser: """Open a TPP source file and returns a list of page objects.""" <|fim_suffix|> def get_pages(self): """ Par...
code_fim
hard
{ "lang": "python", "repo": "pennyarcade/TPPP", "path": "/tpp/FileParser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cur_page = Page(name) else: cur_page.add_line(line) self.pages.append(cur_page) return self.pages<|fim_prefix|># repo: pennyarcade/TPPP path: /tpp/FileParser.py """Open a TPP source file and returns a list of page objects.""" import sys from t...
code_fim
hard
{ "lang": "python", "repo": "pennyarcade/TPPP", "path": "/tpp/FileParser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Fit a rectangle at best to match the polygone (polyline) of an object The resulting rectangle has same area and center of mass as the polygon Return x1,y1, x2,y2 of the rectangle (int values) (top-left, bottom-right) """ #TO...
code_fim
hard
{ "lang": "python", "repo": "leofn/TranskribusDU", "path": "/src/util/Polygon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: leofn/TranskribusDU path: /src/util/Polygon.py # -*- coding: utf-8 -*- """ Utilities to deal with the PageXMl polygon Copyright Xerox(C) 2016 H. Déjean, JL. Meunier This program is free software: you can redistribute it and/or modify it under the terms of the GNU General P...
code_fim
hard
{ "lang": "python", "repo": "leofn/TranskribusDU", "path": "/src/util/Polygon.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Polygon: def __init__(self, lXY): assert lXY, "ERROR: empty list of points" self.lXY = [(x,y) for x,y in lXY] def lX(self): return [x for x,y in self.lXY] def lY(self): return [y for x,y in self.lXY] def getBoundingBox(self): """ return...
code_fim
hard
{ "lang": "python", "repo": "leofn/TranskribusDU", "path": "/src/util/Polygon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: leamas/ddupdate path: /plugins/changeip.py """ ddupdate plugin updating data on changeip.com. See: ddupdate(8) See: http://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34 """ from ddupdate.ddplugin import ServicePlugin, ServiceError from ddupdate.ddplugin import http_ba...
code_fim
hard
{ "lang": "python", "repo": "leamas/ddupdate", "path": "/plugins/changeip.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Free accounts has limitations both to number of hosts and that unused host are expired. See the website for more. netrc: Use a line like machine nic.ChangeIP.com login <username> password <password> Options: none """ _name = 'changeip.com' _oneliner = 'Updat...
code_fim
hard
{ "lang": "python", "repo": "leamas/ddupdate", "path": "/plugins/changeip.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linshaoyong/leetcode path: /python/string/0482_license_key_formatting.py class Solution(object): def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ res, j = [], 0 for i in range(len(S) - 1, -1, -1): ...
code_fim
medium
{ "lang": "python", "repo": "linshaoyong/leetcode", "path": "/python/string/0482_license_key_formatting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s = Solution() assert "5F3Z-2E9W" == s.licenseKeyFormatting("5F3Z-2e-9-w", 4) assert "2-5G-3J" == s.licenseKeyFormatting("2-5g-3-J", 2) assert "" == s.licenseKeyFormatting("---", 3)<|fim_prefix|># repo: linshaoyong/leetcode path: /python/string/0482_license_key_formatting.py class Solutio...
code_fim
medium
{ "lang": "python", "repo": "linshaoyong/leetcode", "path": "/python/string/0482_license_key_formatting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> DiagramMultiContainer.__init__(self, "g", items) allButLast = self.items[:-1] middles = self.items[1:-1] first = self.items[0] last = self.items[-1] self.needsSpace = False self.width = ( AR # starting track + AR * 2 * (len(...
code_fim
hard
{ "lang": "python", "repo": "tabatkins/railroad-diagrams", "path": "/railroad.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tabatkins/railroad-diagrams path: /railroad.py lternatingSequence: arc = AR gaps = determineGaps(width, self.width) Path(x, y).right(gaps[0]).addTo(self) x += gaps[0] Path(x + self.width, y).right(gaps[1]).addTo(self) # bounding box # Path(x...
code_fim
hard
{ "lang": "python", "repo": "tabatkins/railroad-diagrams", "path": "/railroad.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tabatkins/railroad-diagrams path: /railroad.py x += 10 return self class Stack(DiagramMultiContainer): def __init__(self, *items: Node): DiagramMultiContainer.__init__(self, "g", items) self.needsSpace = True self.width = max( item.width + (20...
code_fim
hard
{ "lang": "python", "repo": "tabatkins/railroad-diagrams", "path": "/railroad.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vmuthuk2/py_dss_interface path: /examples/21_Example_Monitors.py # -*- encoding: utf-8 -*- """ Created by Ênio Viana at 15/05/2021 """ from py_dss_interface.models.Example.ExampleBase import ExampleBase dss = ExampleBase("13").dss # Integer methods print(45 * '=' + ' Integer Methods' + 45 * '=...
code_fim
hard
{ "lang": "python", "repo": "vmuthuk2/py_dss_interface", "path": "/examples/21_Example_Monitors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(f'dss.monitors_sample_all(): {dss.monitors_sample_all()}') print(f'dss.monitors_save_all(): {dss.monitors_save_all()}') print(f'dss.monitors_count(): {dss.monitors_count()}') print(f'dss.monitors_process(): {dss.monitors_process()}') print(f'dss.monitors_process_all(): {dss.monitors_process_all()}')...
code_fim
medium
{ "lang": "python", "repo": "vmuthuk2/py_dss_interface", "path": "/examples/21_Example_Monitors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pizza/', views.pizza, name='pizza'), path('burgery/', views.burgery, name='burgery'), path('kebab/', views.kebab, name='kebab'), path('tajskie/', views.tajskie, name='tajskie'), path('wege/', views.wege, name='wege'), path('sushi/', views.sushi, name='sushi'), ]<|fim_prefix|># repo: na...
code_fim
hard
{ "lang": "python", "repo": "nataliadoczekalska/projekt", "path": "/uploads/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nataliadoczekalska/projekt path: /uploads/urls.py """jedzonko URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2...
code_fim
hard
{ "lang": "python", "repo": "nataliadoczekalska/projekt", "path": "/uploads/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #get note raw content content = noteStore.getNoteContent(authToken, n.guid) #add title to content content = addTitle2Content(content, n.title) # try: # for tag in n.tagNames: # print("tag name is: ", tag) # except Exception as e...
code_fim
hard
{ "lang": "python", "repo": "Alexcn/kindle-evernote", "path": "/Evernote2Blog_Python33/Evernote/sample/EDAMTest2.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Alexcn/kindle-evernote path: /Evernote2Blog_Python33/Evernote/sample/EDAMTest2.py # # A simple Evernote API demo script that lists all notebooks in the user's # account and creates a simple test note in the default notebook. # # Before running this sample, you must fill in your Evernote developer...
code_fim
hard
{ "lang": "python", "repo": "Alexcn/kindle-evernote", "path": "/Evernote2Blog_Python33/Evernote/sample/EDAMTest2.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: wenh81/vlc_simulator path: /VLC_devel/build/lib/vlcPhy/Channel.py ss Channel(object): def __init__(self, tx_data, tx_data_time, time_step, IM_DD, channel_SNR, sync_obj): """Constructor.""" # Create sync object, and set debug and simulation path self.sync_obj = syn...
code_fim
hard
{ "lang": "python", "repo": "wenh81/vlc_simulator", "path": "/VLC_devel/build/lib/vlcPhy/Channel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Apply noise to a signal noisy_signal = self.applyChannelNoise(convolved) # TODO -- IS THAT CORRECT? APPLY CIR AND THEN ABS (or clip to zero) if self.IM_DD and False: noisy_signal = lib.zeroClip(noisy_signal) pr...
code_fim
hard
{ "lang": "python", "repo": "wenh81/vlc_simulator", "path": "/VLC_devel/build/lib/vlcPhy/Channel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wenh81/vlc_simulator path: /VLC_devel/build/lib/vlcPhy/Channel.py mon_imports import * class Channel(object): def __init__(self, tx_data, tx_data_time, time_step, IM_DD, channel_SNR, sync_obj): """Constructor.""" # Create sync object, and set debug and simulation path ...
code_fim
hard
{ "lang": "python", "repo": "wenh81/vlc_simulator", "path": "/VLC_devel/build/lib/vlcPhy/Channel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # superimpose inlet snapshot u[:,:] += Uinput[itime,:,:,0] v[:,:] += Uinput[itime,:,:,1] w[:,:] += Uinput[itime,:,:,2] T[:,:] += Tinput[itime,:,:] # write out U fname = os.path.join(prefix,'U') print('Writing ...
code_fim
hard
{ "lang": "python", "repo": "NREL/windtools", "path": "/windtools/inflow/general.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NREL/windtools path: /windtools/inflow/general.py rage of <u\'u\'>, <v\'v\'>, <w\'w\'> : {} {} {}\n'.format(self.uu_mean,self.vv_mean,self.ww_mean)) f.write('\n Height Standard deviation at grid points for the u component:\n') for i,zi in enumerate(self.z): ...
code_fim
hard
{ "lang": "python", "repo": "NREL/windtools", "path": "/windtools/inflow/general.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not dryrun: print('Resetting scaling function') self.scaling = np.ones((3,newNZ)) # # Boundary output # def write_sowfa_mapped_BC(self, outputdir='boundaryData', time_varying_input=None, ...
code_fim
hard
{ "lang": "python", "repo": "NREL/windtools", "path": "/windtools/inflow/general.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: landrs-toolkit/PySOSA path: /tests/test_Sampler.py import unittest from PySOSA import config as cfg from PySOSA.Actuator import Actuator from PySOSA.ObservableProperty import ObservableProperty from PySOSA.Platform import Platform from PySOSA.Procedure import Procedure from PySOSA.Sensor import ...
code_fim
medium
{ "lang": "python", "repo": "landrs-toolkit/PySOSA", "path": "/tests/test_Sampler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ creates platform, procedure, sensor, Acturator , observable property objects tests adding these to the platform and printing the graph shows actuators and sensors attached to the platform on the rdf graph """ # procedure object proc1 = Procedure(...
code_fim
medium
{ "lang": "python", "repo": "landrs-toolkit/PySOSA", "path": "/tests/test_Sampler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apdavison/fairgraph path: /fairgraph/openminds/sands/miscellaneous/quantitative_relation_assessment.py """ """ # this file was auto-generated from datetime import date, datetime from fairgraph import EmbeddedMetadata, IRI from fairgraph.fields import Field class QuantitativeRelationAssessmen...
code_fim
hard
{ "lang": "python", "repo": "apdavison/fairgraph", "path": "/fairgraph/openminds/sands/miscellaneous/quantitative_relation_assessment.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self, criteria=None, in_relation_to=None, quantitative_overlap=None, id=None, data=None, space=None, scope=None ): return super().__init__( data=data, criteria=criteria, in_relation_to=in_relation_to, quantitative_overlap=quantitative_overlap )<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "apdavison/fairgraph", "path": "/fairgraph/openminds/sands/miscellaneous/quantitative_relation_assessment.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def build_wheel_cache(): """ Build pip wheel cache """ pkg_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) pyvers = ['2.6', '2.7', '3.3', '3.4', '3.5'] old_python_path = os.environ['PYTHONPATH'] for pyver in pyvers: pycmd = which('python{0}'.format(pyver)) ...
code_fim
hard
{ "lang": "python", "repo": "mtiid/putil", "path": "/sbin/build_wheel_cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtiid/putil path: /sbin/build_wheel_cache.py #!/usr/bin/env python # build_wheel_cache.py # Copyright (c) 2013-2016 Pablo Acosta-Serafini # See LICENSE for details # pylint: disable=C0111 # Standard library imports from __future__ import print_function import os import subprocess ### # Functio...
code_fim
hard
{ "lang": "python", "repo": "mtiid/putil", "path": "/sbin/build_wheel_cache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def GenTests(api): yield api.test('ci') + api.properties( manifest='magenta', remote='https://fuchsia.googlesource.com/manifest', target='magenta-pc-x86-64', toolchain='clang', ) yield api.test('cq_try') + api.properties.tryserver( gerrit_project='magen...
code_fim
hard
{ "lang": "python", "repo": "xdje42/fuchsia-magenta", "path": "/infra/recipes/magenta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xdje42/fuchsia-magenta path: /infra/recipes/magenta.py # Copyright 2016 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Recipe for building Magenta.""" import multiprocessing from recipe_engine.r...
code_fim
hard
{ "lang": "python", "repo": "xdje42/fuchsia-magenta", "path": "/infra/recipes/magenta.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with api.step.nest('build'): api.step('cleanup', ['make', 'spotless'], cwd=api.path['checkout']) build_args = ['make', '-j%s' % multiprocessing.cpu_count(), target] if toolchain == 'clang': build_args.append('USE_CLANG=true') api.step('build', build_args, cw...
code_fim
hard
{ "lang": "python", "repo": "xdje42/fuchsia-magenta", "path": "/infra/recipes/magenta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 5610110083/Safety-in-residential-project path: /cgi-bin/loginHistory.py #!/usr/bin/python # -*- coding: utf-8 -*-f #Import modules for CGI handling import cgi, cgitb import Cookie, os, time cookie = Cookie.SimpleCookie() cookie_string = os.environ.get('HTTP_COOKIE') def getCookies(): if...
code_fim
hard
{ "lang": "python", "repo": "5610110083/Safety-in-residential-project", "path": "/cgi-bin/loginHistory.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> <!-- ============== Footer ============ --> <br/><br/><div class="navbar navbar-default navbar-fixed-bottom"> <div class="container"> <p class="navbar-text pull-left">Copyright &copy; 2016-2017 Siczones.</p> <!-- a id="back-to-top" href="#" class="navbar-btn btn-danger btn pull...
code_fim
hard
{ "lang": "python", "repo": "5610110083/Safety-in-residential-project", "path": "/cgi-bin/loginHistory.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_lurched.py from xai.brain.wordbase.verbs._lurch import _LURCH <|fim_suffix|> _LURCH.__init__(self) self.name = "LURCHED" self.specie = 'verbs' self.basic = "lurch" self.jsondata = {}<|fim_middle|>#calss header class _LURCHED(_LURCH, ): de...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_lurched.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _LURCH.__init__(self) self.name = "LURCHED" self.specie = 'verbs' self.basic = "lurch" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_lurched.py from xai.brain.wordbase.verbs._lurch import _LURCH <|fim_middle|>#calss header class _LURCHED(_LURCH, ): de...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_lurched.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SuadeLabs/clickhouse_orm path: /tests/test_utils.py # -*- coding: utf-8 -*- from clickhouse_orm.utils import escape, unescape SPECIAL_CHARS = { "\b": "\\x08", "\f": "\\x0c", "\r": "\\r", "\n": "\\n", "\t": "\\t", "\0": "\\x00", "\\": "\\\\", "'": "\\'", } <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "SuadeLabs/clickhouse_orm", "path": "/tests/test_utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_escape_special_chars(): initial = "".join(SPECIAL_CHARS.keys()) expected = "".join(SPECIAL_CHARS.values()) assert escape(initial, quote=False) == expected assert escape(initial) == "'" + expected + "'" def test_escape_unescape_parity(): for initial in ("π\t", "\new", "che...
code_fim
medium
{ "lang": "python", "repo": "SuadeLabs/clickhouse_orm", "path": "/tests/test_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_escape_unescape_parity(): for initial in ("π\t", "\new", "cheeky 🐵", "back \\ slash", "\\\\n"): assert unescape(escape(initial, quote=False)) == initial<|fim_prefix|># repo: SuadeLabs/clickhouse_orm path: /tests/test_utils.py # -*- coding: utf-8 -*- from clickhouse_orm.utils impor...
code_fim
medium
{ "lang": "python", "repo": "SuadeLabs/clickhouse_orm", "path": "/tests/test_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for request in requests: status_dict = result[request.allocation_id.id] status_dict['virtual_remaining_leaves'] -= (request.number_of_hours_display if request.leave_type_request_unit == 'hour' ...
code_fim
hard
{ "lang": "python", "repo": "alexhong121/odoo_model", "path": "/hr_holidays_ex/models/hr_laeve_allocation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexhong121/odoo_model path: /hr_holidays_ex/models/hr_laeve_allocation.py _round class HolidaysAllocation(models.Model): _inherit = 'hr.leave.allocation' _order = 'validity_start asc' def _default_validity_start_year(self): results = [] currentYear = int(datetime.d...
code_fim
hard
{ "lang": "python", "repo": "alexhong121/odoo_model", "path": "/hr_holidays_ex/models/hr_laeve_allocation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n_shift = int(program.Program.prog.options.ring) - l bits = BitDecRing(to_shift, l, l) rev = types.sint.bit_compose(reversed(bits)) rev <<= n_shift rev *= pow2m r_bits = [types.sint.get_random_bit() for i in range(l)] r = types.sint.bit_compose(r_bits) shifted = (rev...
code_fim
hard
{ "lang": "python", "repo": "data61/MP-SPDZ", "path": "/Compiler/floatingpoint.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> theta = int(ceil(log(l / 3.5) / log(2))) alpha = two_power(2*l) w = types.cint(int(2.9142 * two_power(l))) - 2 * b x = alpha - b * w y = a * w y = TruncPr(y, 2 * l + 1, l + 1, kappa) for i in range(theta-1): y = y * (alpha + x) # keep y with l bits ...
code_fim
hard
{ "lang": "python", "repo": "data61/MP-SPDZ", "path": "/Compiler/floatingpoint.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: data61/MP-SPDZ path: /Compiler/floatingpoint.py (n, int) and n < 31: return 2**n else: max = types.cint(1) << 31 res = 2**(n%31) for i in range(n // 31): res *= max return res def shift_two(n, pos): return n >> pos def ma...
code_fim
hard
{ "lang": "python", "repo": "data61/MP-SPDZ", "path": "/Compiler/floatingpoint.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># вычисление количества часов hours = time_in_seconds // 3600 # вычисление количества минут minutes = time_in_seconds % 3600 // 60 # вычисление количества секунд seconds = time_in_seconds % 3600 % 60 # вывод print(f'{hours:02d}:{minutes:02d}:{seconds:02d}')<|fim_prefix|># repo: ai-nikolaev/repo-pybasic...
code_fim
hard
{ "lang": "python", "repo": "ai-nikolaev/repo-pybasics", "path": "/homework/lesson-1/exercise-2/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ai-nikolaev/repo-pybasics path: /homework/lesson-1/exercise-2/main.py # 2. Пользователь вводит время в секундах. Переведите время в часы, минуты и # секунды и выведите в формате чч:мм:сс. Используйте форматирование строк. <|fim_suffix|># вычисление количества минут minutes = time_in_seconds % 36...
code_fim
hard
{ "lang": "python", "repo": "ai-nikolaev/repo-pybasics", "path": "/homework/lesson-1/exercise-2/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NotANormalNerd/imagine path: /tests/test_imagine.py ''' This basic test module uses live websites for checks. For better independence mockup websites should be used. This would be overkill for this exercise. (In my opinion) ''' import imagine import pytest import requests import os import reques...
code_fim
hard
{ "lang": "python", "repo": "NotANormalNerd/imagine", "path": "/tests/test_imagine.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with requests.Session() as s: dest = tmpdir.mkdir('test') imagine.download_file(s, 'http://i.imgur.com/7Xkl7ec.gif', destination=str(dest)) assert len(dest.listdir()) == 1 assert os.path.getsize(str(dest.listdir()[0])) == 2052216<|fim_prefix|># repo: NotANormalNerd/imag...
code_fim
hard
{ "lang": "python", "repo": "NotANormalNerd/imagine", "path": "/tests/test_imagine.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># ----- WIDGET FUNCTIONS ----- def add_widget(widget, order=None, grab_focus=False): """ Add widget to screen. Used by the base widget. Args: order: Integer representing the order widget should receive focus when user presses TAB. The widget with the lowest order will ...
code_fim
hard
{ "lang": "python", "repo": "furas/python-examples", "path": "/pygame/GUI- widgets-SGC/sgc3/widgets/_locals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def set_fonts(cls, fonts={}): """ Set fonts to a specific font. If a font exists, it will be replaced, otherwise it will be newly created. Args: fonts: Dictionary containing fonts to use. Key should be name of font. Value should...
code_fim
hard
{ "lang": "python", "repo": "furas/python-examples", "path": "/pygame/GUI- widgets-SGC/sgc3/widgets/_locals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: furas/python-examples path: /pygame/GUI- widgets-SGC/sgc3/widgets/_locals.py # Copyright 2010-2012 the SGC project developers. # See the LICENSE file at the top-level directory of this distribution # and at http://program.sambull.org/sgc/license.html. """ A collection of things for widgets to us...
code_fim
hard
{ "lang": "python", "repo": "furas/python-examples", "path": "/pygame/GUI- widgets-SGC/sgc3/widgets/_locals.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, config=None, config_file_path=None, **config_kwargs): self.model = None self.dtype = 'uint8' if config_file_path is not None: import json with open(config_file_path, 'r') as configFile: config = configFile.read() ...
code_fim
hard
{ "lang": "python", "repo": "ClashLuke/iDAF", "path": "/src/model_creator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def train(self, dataset=None, epochs=2, verbose=1, workers=1): """ Basic training API that wraps keras training api with the previously created config. While easier to use, it's also much more simple. :param dataset: Path to dataset or numpy array :param epochs:...
code_fim
hard
{ "lang": "python", "repo": "ClashLuke/iDAF", "path": "/src/model_creator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }