text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: jaredpeterson/pyhandy path: /pyhandy/txt_utils.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Utility functions for handling basic text IO. """ import io def remove_multiple_newlines_in_txt(txt: str) -> str: """ This function will remove multiple, sequential newlines in text (str) da...
code_fim
hard
{ "lang": "python", "repo": "jaredpeterson/pyhandy", "path": "/pyhandy/txt_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertIsInstance(CoreServices.kMDItemParticipants, unicode) self.assertIsInstance(CoreServices.kMDItemPixelCount, unicode) self.assertIsInstance(CoreServices.kMDItemNamedLocation, unicode) self.assertIsInstance(CoreServices.kMDItemAuthorAddresses, unicode) self...
code_fim
hard
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-CoreServices/PyObjCTest/test_mditem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreatFruitOmsk/pyobjc-mirror path: /pyobjc-framework-CoreServices/PyObjCTest/test_mditem.py from PyObjCTools.TestSupport import * import CoreServices class TestMDImport (TestCase): @expectedFailure def test_types(self): self.assertIsCFType(CoreServices.MDItemRef) def test_f...
code_fim
hard
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-CoreServices/PyObjCTest/test_mditem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertIsInstance(CoreServices.kMDItemDownloadedDate, unicode) self.assertIsInstance(CoreServices.kMDItemDateAdded, unicode) self.assertIsInstance(CoreServices.kMDItemCameraOwner, unicode) self.assertIsInstance(CoreServices.kMDItemFocalLength35mm, unicode) self....
code_fim
hard
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-CoreServices/PyObjCTest/test_mditem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>eworks for electronic voting.' __version__ = '2.0.4-dev' default_app_config = 'openslides_votecollector.apps.VoteCollectorAppConfig'<|fim_prefix|># repo: emanuelschuetze/openslides-votecollector path: /openslides_votecollector/__init__.py __verbose_name__ = 'OpenSlides VoteCollector Plugin' __descriptio...
code_fim
medium
{ "lang": "python", "repo": "emanuelschuetze/openslides-votecollector", "path": "/openslides_votecollector/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emanuelschuetze/openslides-votecollector path: /openslides_votecollector/__init__.py __verbose_name__ = 'OpenSlides VoteCollector Plugin' __description<|fim_suffix|>eworks for electronic voting.' __version__ = '2.0.4-dev' default_app_config = 'openslides_votecollector.apps.VoteCollectorAppConfig...
code_fim
medium
{ "lang": "python", "repo": "emanuelschuetze/openslides-votecollector", "path": "/openslides_votecollector/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>app_config = 'openslides_votecollector.apps.VoteCollectorAppConfig'<|fim_prefix|># repo: emanuelschuetze/openslides-votecollector path: /openslides_votecollector/__init__.py __verbose_name__ = 'OpenSlides VoteCollector Plugin' __description<|fim_middle|>__ = 'This plugin connects OpenSlides with the Vote...
code_fim
medium
{ "lang": "python", "repo": "emanuelschuetze/openslides-votecollector", "path": "/openslides_votecollector/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x = wx + ww + 8 pos = (x, y) pin.set_position(pos) return pos def end_output(self): if imgui.begin_drag_drop_source(): imgui.set_drag_drop_payload('itemtype', b'payload') self.page.start_dnd(self.output) imgui.button('dragged...
code_fim
hard
{ "lang": "python", "repo": "KangWeon/arcade-imgui", "path": "/imflo/imflo/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KangWeon/arcade-imgui path: /imflo/imflo/node.py import arcade import imgui class Node: def __init__(self, page): self.page = page self.pins = {} def reset(self): pass <|fim_suffix|> if imgui.begin_drag_drop_source(): imgui.set_drag_drop_paylo...
code_fim
hard
{ "lang": "python", "repo": "KangWeon/arcade-imgui", "path": "/imflo/imflo/node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x, y = imgui.get_cursor_screen_pos() wx, wy = imgui.get_window_position() ww, wh = imgui.get_window_size() x = wx + ww + 8 pos = (x, y) pin.set_position(pos) return pos def end_output(self): if imgui.begin_drag_drop_source(): ...
code_fim
hard
{ "lang": "python", "repo": "KangWeon/arcade-imgui", "path": "/imflo/imflo/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bcgov/ligo-lib path: /linker/core/chunked_link_base.py import os import csv import pandas as pd import numpy as np from linker.core.base import (CHUNK_SIZE) from linker.core.link_base import LinkBase from linker.core.files import LinkFiles import logging logger = logging.getLogger(__name__) ...
code_fim
hard
{ "lang": "python", "repo": "bcgov/ligo-lib", "path": "/linker/core/chunked_link_base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def import_data(self, src_filename, columns, dest_filename, front_cols=None, data_types=None): """ Reads and imports the selected columns of a csv file into a new csv file. The copied files is used during linking process to leave the source file unchanged. :param src_fi...
code_fim
hard
{ "lang": "python", "repo": "bcgov/ligo-lib", "path": "/linker/core/chunked_link_base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("-i", "--input-dir", help="Log directory.") parser.add_argument( "-l", "--loss", action="store_true", help="Whether to plot loss stats in trainer.", ) p...
code_fim
hard
{ "lang": "python", "repo": "weiqiao/risk_sac", "path": "/utils/plot_learning_stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # See possible Headers in utils/stats_examples.txt if args.loss: plot_stats = ["trainer/RF1 Loss", "trainer/RF2 Loss"] plot_loss(logdir, plot_stats) else: plot_stats = ["Distance", "Risks", "path length"] for stat in plot_stats: vis_headers_y_mean = ...
code_fim
hard
{ "lang": "python", "repo": "weiqiao/risk_sac", "path": "/utils/plot_learning_stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: weiqiao/risk_sac path: /utils/plot_learning_stats.py import argparse import matplotlib matplotlib.use("TkAgg") import csv import os import matplotlib.pyplot as plt import numpy as np def plot_mean_std(ax, x, y_mean, y_std, color="darkorange", alpha=0.2, label=None): ax.fill_between( ...
code_fim
hard
{ "lang": "python", "repo": "weiqiao/risk_sac", "path": "/utils/plot_learning_stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> object_names = [] for tree in trees: if tree: for node in ast.walk(tree): if 'functions' in object_types and isinstance(node, ast.FunctionDef) \ and not is_magic_function(node.name): object_names.append(node.name.lowe...
code_fim
hard
{ "lang": "python", "repo": "ravique/words-finder", "path": "/wordsfinder/words_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ravique/words-finder path: /wordsfinder/words_parser.py import ast import os import collections from typing import Tuple, Union from git import Repo, GitCommandError from nltk import pos_tag import giturlparse TOP_WORDS_AMOUNT = 10 def make_flat(list_of_lists: list) -> list: """ [(1,2), (...
code_fim
hard
{ "lang": "python", "repo": "ravique/words-finder", "path": "/wordsfinder/words_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_all_projects_paths(local_paths: set, git_repositories_urls: set) -> set: projects_paths = set() if local_paths: for folder in local_paths: projects_paths.add(os.path.join('.', folder)) if git_repositories_urls: for repo_uri in git_repositories_urls: ...
code_fim
hard
{ "lang": "python", "repo": "ravique/words-finder", "path": "/wordsfinder/words_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: harryrs/student_explorer path: /student_explorer/urls.py """student_explorer URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app imp...
code_fim
hard
{ "lang": "python", "repo": "harryrs/student_explorer", "path": "/student_explorer/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Override auth_logout from djangosaml2 and registration for consistant # behavior urlpatterns.append(url(r'^accounts/logout', views.logout, name='auth_logout')) urlpatterns.append(url(r'^about', views.about, name='about')) # Configure Django Debug Toolbar if settings.DEBUG: import debug_toolbar ...
code_fim
hard
{ "lang": "python", "repo": "harryrs/student_explorer", "path": "/student_explorer/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/jump-game-vii.py # Time: O(n) # Space: O(n) # dp with line sweep solution class Solution(object): def canReach(self, s, minJump, maxJump): <|fim_suffix|># Time: O(n) # Space: O(n) import collections # bfs solution class Solution2(object): def...
code_fim
hard
{ "lang": "python", "repo": "kamyu104/LeetCode-Solutions", "path": "/Python/jump-game-vii.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># bfs solution class Solution2(object): def canReach(self, s, minJump, maxJump): """ :type s: str :type minJump: int :type maxJump: int :rtype: bool """ q = collections.deque([0]) reachable = 0 while q: i = q.popleft()...
code_fim
medium
{ "lang": "python", "repo": "kamyu104/LeetCode-Solutions", "path": "/Python/jump-game-vii.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tag = tags.DICT[tag_name] tag_type = tags.type_of_tag(tag) jsonName = "" if isElement (tag_name): jsonName = "elements" else: jsonName = tag_name.lower() if ((tag_type != types.NODATA and tag_nam...
code_fim
hard
{ "lang": "python", "repo": "mabrains/ALIGN-public", "path": "/align/gdsconv/txt2json.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mabrains/ALIGN-public path: /align/gdsconv/txt2json.py #! /usr/bin/env python # -*- coding: utf-8 -*- """TXT to JSON.""" from gdsii import tags, types import json import sys import re def print_data (tag_type, data): if tag_type == types.ASCII: return "%s" % data[1:-1] elif tag_t...
code_fim
hard
{ "lang": "python", "repo": "mabrains/ALIGN-public", "path": "/align/gdsconv/txt2json.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if tag_type != types.NODATA and tag_name[0:3] != "BGN": cursors[level][jsonName] = print_data(tag_type, rest) elif tag_name[0:3] == "END": if isinstance(cursors[level - 1], dict): level = level - 1 level = level - 1 json.dump (to...
code_fim
hard
{ "lang": "python", "repo": "mabrains/ALIGN-public", "path": "/align/gdsconv/txt2json.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> simple_test_data = np.zeros((4, 4, 4), dtype=np.float64) simple_test_data[0] = -1 simple_test_data[1] = 1 simple_test_data[2] = 2 simple_test_data[3] = 3 glcm = TextureAnalysis.GLCM_3D(simple_test_data, d=1, level_min=0, level_max=2, threshold=1...
code_fim
hard
{ "lang": "python", "repo": "thanapeace/senior-project", "path": "/texture_analysis/tests/test_core.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: thanapeace/senior-project path: /texture_analysis/tests/test_core.py # -*- coding: utf-8 -*- from nose.tools import with_setup, raises, ok_, timed import os import copy import numpy as np from .context import TextureAnalysis class TestCore: <|fim_suffix|> pass def test_glcm(self): ...
code_fim
hard
{ "lang": "python", "repo": "thanapeace/senior-project", "path": "/texture_analysis/tests/test_core.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> a[0] for aa in a[1:]: if idx + 2 >= n: if idx + 1 < n: ans += aa break idx += 2 ans += aa * 2 print(ans) if __name__ == '__main__': main()<|fim_prefix|># repo: m-star18/atcoder path: /submissions/abc173/d def main(): impor...
code_fim
medium
{ "lang": "python", "repo": "m-star18/atcoder", "path": "/submissions/abc173/d", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-star18/atcoder path: /submissions/abc173/d def main(): import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) <|fim_suffix|> break idx += 2 ans += aa * 2 print(ans) if __name__ == '__main__': main()<|fim_middle|>n = int...
code_fim
hard
{ "lang": "python", "repo": "m-star18/atcoder", "path": "/submissions/abc173/d", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: hrb518/EssentialMC2 path: /papers/pytorch-video-understanding/models/base/builder.py #!/usr/bin/env python3 # Copyright (C) Alibaba Group Holding Limited. """ Builder for video models. """ import sys import torch import torch.nn as nn import traceback import utils.logging as logging from mo...
code_fim
hard
{ "lang": "python", "repo": "hrb518/EssentialMC2", "path": "/papers/pytorch-video-understanding/models/base/builder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model_ema = None if cfg.MODEL.EMA.ENABLE: model_ema = ModelEmaV2(model, decay=cfg.MODEL.EMA.DECAY) try: # convert batchnorm to be synchronized across # different GPUs if needed sync_bn = cfg.BN.SYNC_BN if sync_bn == True and cfg.NUM_GPUS * cfg.NUM_SHAR...
code_fim
hard
{ "lang": "python", "repo": "hrb518/EssentialMC2", "path": "/papers/pytorch-video-understanding/models/base/builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tudor-berariu/lifelong-learning path: /tasks.py from typing import Optional, Tuple from functools import reduce from operator import mul # Torch imports import numpy as np import torch from torch.utils.data import DataLoader from torchvision import datasets, transforms # Types used across modul...
code_fim
hard
{ "lang": "python", "repo": "tudor-berariu/lifelong-learning", "path": "/tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def permute(data, target, i_perm: LongVector, t_perm: Optional[LongVector]): in_size = data.size() data = data.view(in_size[0], -1).index_select(1, i_perm).view(in_size) if t_perm is not None: target = t_perm.index_select(0, target) return data, target def random_permute(data, ta...
code_fim
hard
{ "lang": "python", "repo": "tudor-berariu/lifelong-learning", "path": "/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> in_size = data.size() data = data.view(in_size[0], -1).index_select(1, i_perm).view(in_size) if t_perm is not None: target = t_perm.index_select(0, target) return data, target def random_permute(data, target, perms: Permutations): i_perms, t_perms = perms in_size = data.s...
code_fim
hard
{ "lang": "python", "repo": "tudor-berariu/lifelong-learning", "path": "/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for yr in range(gleam_et.shape[0]): data = gleam_et[yr, :, :] amazon_mean = get_area_weighted_avg(data, mask, pixel_size_grid) gleam_vals.append(amazon_mean) for yr in range(ntsg_et.shape[0]): data = ntsg_et[yr, :, :] amazon_mean = get_area_weighted_avg(dat...
code_fim
hard
{ "lang": "python", "repo": "jcabaker/amazon_et", "path": "/get_satellite_et_all_basins_interannual.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcabaker/amazon_et path: /get_satellite_et_all_basins_interannual.py import numpy as np import iris import iris.coord_categorisation import pandas as pd import matplotlib.pyplot as plt from jpros.cube_funcs import * from jpros import extract from math import pi, sin import warnings warnings.filte...
code_fim
hard
{ "lang": "python", "repo": "jcabaker/amazon_et", "path": "/get_satellite_et_all_basins_interannual.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DavidsDvm/Dev_Exercises path: /Console/Python/MisionTic/Excercises/test22.py """ Creacion de factorial de un numero """ <|fim_suffix|>for i in range(1, n+1): num *= i if n == 0 or n == 1: num = 1 print("El factorial de {} es igual a {}".format(n, num))<|fim_middle|>num = 1 n = int(i...
code_fim
medium
{ "lang": "python", "repo": "DavidsDvm/Dev_Exercises", "path": "/Console/Python/MisionTic/Excercises/test22.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(1, n+1): num *= i if n == 0 or n == 1: num = 1 print("El factorial de {} es igual a {}".format(n, num))<|fim_prefix|># repo: DavidsDvm/Dev_Exercises path: /Console/Python/MisionTic/Excercises/test22.py """ Creacion de factorial de un numero """ <|fim_middle|>num = 1 n = int(i...
code_fim
medium
{ "lang": "python", "repo": "DavidsDvm/Dev_Exercises", "path": "/Console/Python/MisionTic/Excercises/test22.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcgreevy/chromium-build path: /masters/master.chromium.gatekeeper/slaves.cfg # -*- python -*- # ex: set syntax=python: # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Thi...
code_fim
hard
{ "lang": "python", "repo": "mcgreevy/chromium-build", "path": "/masters/master.chromium.gatekeeper/slaves.cfg", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # (Optional) Random notes. #'notes': string, #}, ### Experimental { 'master': 'Gatekeeper', 'builder': 'Chromium Gatekeeper', 'hostname': 'vm182-m1', }, { 'master': 'Gatekeeper', 'builder': 'Chromium Gatekeeper Failure', 'hostname': 'vm183-m1', }, ]<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "mcgreevy/chromium-build", "path": "/masters/master.chromium.gatekeeper/slaves.cfg", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xuenew/2c path: /src/utils/tools.py #!/usr/bin/env python """ Created by howie.hu at 2021/4/7. Description:通用函数 Changelog: all notable changes to this file will be documented """ import hashlib <|fim_suffix|> """ 对字符串进行md5加密 :param string: 加密目标字符串 :return: """ ...
code_fim
easy
{ "lang": "python", "repo": "Xuenew/2c", "path": "/src/utils/tools.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def md5_encryption(string: str) -> str: """ 对字符串进行md5加密 :param string: 加密目标字符串 :return: """ m = hashlib.md5() m.update(string.encode("utf-8")) return m.hexdigest()<|fim_prefix|># repo: Xuenew/2c path: /src/utils/tools.py #!/usr/bin/env python """ Created by howie.hu at...
code_fim
easy
{ "lang": "python", "repo": "Xuenew/2c", "path": "/src/utils/tools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: erelsgl/fair-family-allocation path: /line_protocol.py #!python3 """ The line-allocation protocol: * 1/2-democratic EF1 for two families with general monotone agents; * 1/k-democratic fair for k families with additive agents. See: https://arxiv.org/abs/1709.02564 Theorems 4.2 and 5.8. """ from...
code_fim
hard
{ "lang": "python", "repo": "erelsgl/fair-family-allocation", "path": "/line_protocol.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> goods=list(goods) # order the goods on a line left_sequence = list() right_sequence = list(goods) for good in goods: logger.info("\nCurrent partition: {} | {}:".format(left_sequence,right_sequence)) left_bundle = set(left_sequence) right_bundle = set(right_sequenc...
code_fim
hard
{ "lang": "python", "repo": "erelsgl/fair-family-allocation", "path": "/line_protocol.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/IPS-Vagrant path: /ips_vagrant/common/__init__.py from distutils.version import StrictVersion, LooseVersion import os import click import logging import http.cookiejar import requests import ips_vagrant from urllib.parse import urlparse from configparser import ConfigParser def confi...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/IPS-Vagrant", "path": "/ips_vagrant/common/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return version def unparse_version(vtuple): """ Return the textual representation of a version tuple @type vtuple: tuple @rtype: str """ return '.'.join(map(str, vtuple)) def byteify(input): if isinstance(input, dict): return {byteify(key):byteify(value) for k...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/IPS-Vagrant", "path": "/ips_vagrant/common/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.steps + other def __mul__(self, other): return self.steps * other def __repr__(self): return repr(self.steps) def __str__(self): stringified = [str(step) for step in self.steps] return '[{}]'.format(', '.join(stringified)) def __len__...
code_fim
hard
{ "lang": "python", "repo": "kuc2477/dom-ged-genetic-approximator", "path": "/dgg/types.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.steps * other def __repr__(self): return repr(self.steps) def __str__(self): stringified = [str(step) for step in self.steps] return '[{}]'.format(', '.join(stringified)) def __len__(self): return len(self.steps) class DOMTree(object): ...
code_fim
hard
{ "lang": "python", "repo": "kuc2477/dom-ged-genetic-approximator", "path": "/dgg/types.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuc2477/dom-ged-genetic-approximator path: /dgg/types.py import random import copy from bs4 import BeautifulSoup, NavigableString, Tag from .utils import clean_soup class Step(object): W = WRAP = 'W' A = APPEND = 'A' D = DELETE = 'D' M = MODIFY = 'M' TYPES = (W, A, D, M) ...
code_fim
hard
{ "lang": "python", "repo": "kuc2477/dom-ged-genetic-approximator", "path": "/dgg/types.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: javicodema/tensorflow_course path: /forecasting.py import numpy as np import matplotlib.pyplot as plt import tensorflow as tf keras = tf.keras def plot_series(time, series, format="-", start=0, end=None, label=None): plt.plot(time[start:end], series[start:end], format, label=label) plt...
code_fim
hard
{ "lang": "python", "repo": "javicodema/tensorflow_course", "path": "/forecasting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>window_size = 30 train_set = window_dataset(x_train, window_size) model = keras.models.Sequential([ keras.layers.Dense(1, input_shape=[window_size]) ]) lr_schedule = keras.callbacks.LearningRateScheduler( lambda epoch: 1e-6 * 10**(epoch / 30)) optimizer = keras.optimizers.SGD(lr=1e-6, momentum=0.9...
code_fim
hard
{ "lang": "python", "repo": "javicodema/tensorflow_course", "path": "/forecasting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='CopyForm', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('shelfmark', models.CharField(blank=True, default='', max_length=500, nul...
code_fim
hard
{ "lang": "python", "repo": "senderle/bookcensus", "path": "/census/migrations/0033_copyform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: senderle/bookcensus path: /census/migrations/0033_copyform.py # Generated by Django 2.0.9 on 2020-05-11 15:35 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.CreateModel( ...
code_fim
hard
{ "lang": "python", "repo": "senderle/bookcensus", "path": "/census/migrations/0033_copyform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Caro-app/calamari path: /calamari_ocr/ocr/datasets/abbyy_dataset/dataset.py import os import numpy as np from typing import List from PIL import Image from .reader import XMLReader from .writer import XMLWriter from tqdm import tqdm from calamari_ocr.ocr.datasets import DataSet, DataSetMode, Dat...
code_fim
hard
{ "lang": "python", "repo": "Caro-app/calamari", "path": "/calamari_ocr/ocr/datasets/abbyy_dataset/dataset.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__( mode, skip_invalid, remove_invalid) self.xmlfiles = xmlfiles if xmlfiles else [] self.files = files if files else [] self._non_existing_as_empty = non_existing_as_empty if len(self.xmlfiles) == 0: from calamari...
code_fim
hard
{ "lang": "python", "repo": "Caro-app/calamari", "path": "/calamari_ocr/ocr/datasets/abbyy_dataset/dataset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> log = self.__test_log_aux('Fatal Message - 致命错误', self.logger.fatal, logging.FATAL) self.assertEqual(self.status_log_admin.colored_msg(log), '<span style="color: red;">Fatal Message - 致命错误</span>') self.assertEqual(self.status_log_admin.traceback(log), '<pr...
code_fim
hard
{ "lang": "python", "repo": "CiCiUi/django-db-logger", "path": "/django_db_logger/tests.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> exception_message = 'Exception Message' try: raise Exception(exception_message) except Exception as e: self.logger.exception(e) log_queryset = StatusLog.objects.filter(msg=exception_message) self.assertEqual(log_queryset.count(), 1) ...
code_fim
hard
{ "lang": "python", "repo": "CiCiUi/django-db-logger", "path": "/django_db_logger/tests.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: CiCiUi/django-db-logger path: /django_db_logger/tests.py # encoding: utf-8 from __future__ import unicode_literals import logging from django.contrib.admin import AdminSite from django.test import TestCase from django_db_logger.admin import StatusLogAdmin from .models import StatusLog class Tes...
code_fim
hard
{ "lang": "python", "repo": "CiCiUi/django-db-logger", "path": "/django_db_logger/tests.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> pi=0 for k in range(cnt): re=(4/(8*k+1)+2/(8*k+4)+1/(8*k+5)+1/(8*k+6)) re=re/pow(16,k) pi+=re print(f'{k}/{cnt}',end='\r') print('form',pi,end='\n\n') for i in range(3,6): cnt=10**i print(cnt,end='\n') mtkl(cnt) form(cnt)<|fim_prefix|># repo: An...
code_fim
medium
{ "lang": "python", "repo": "AndrewLauu/CodeLib", "path": "/calcuPi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndrewLauu/CodeLib path: /calcuPi.py import random def mtkl(cnt): inCir=0 for j in range(cnt): x=random.random() y=random.random() print(f'{j}/{cnt}',end='\r') if (x**2+y**2)**0.5<=1: inCir+=1 pi=4*inCir/cnt print('mtkl',pi,end='\n\n')...
code_fim
hard
{ "lang": "python", "repo": "AndrewLauu/CodeLib", "path": "/calcuPi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Retrieve JSON data from Canvas we'll need to download student artifacts.""" # Download the JSON files to a working directory. if not os.path.exists(JSON_FOLDER): os.makedirs(JSON_FOLDER) make_time_stamp_file() dump_all_json() # Report counts of what we got ba...
code_fim
hard
{ "lang": "python", "repo": "calstateteach/canvas_artifacts_download", "path": "/json_artifacts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: calstateteach/canvas_artifacts_download path: /json_artifacts.py """Retrieve all the JSON data sets from Canvas API we'll need to archive all student artifacts for all courses. Store the JSON data in external files for retrieval without having to hit Canvas API. 11.22.2016 tps 11.25.2016 tps Bu...
code_fim
hard
{ "lang": "python", "repo": "calstateteach/canvas_artifacts_download", "path": "/json_artifacts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrlathome/saam_body_gesture_detection path: /scripts/person_detection.py import rospy import cv_bridge from saam_object_detection.srv import WhatAmILookingAt import json import numpy as np class PersonDetection: def __init__(self, service_name='what_am_i_looking_at'): rospy.wait_for...
code_fim
hard
{ "lang": "python", "repo": "mrlathome/saam_body_gesture_detection", "path": "/scripts/person_detection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image_h, image_w = image.shape[:2] encoded_image = self.bridge.cv2_to_imgmsg(image, encoding="passthrough") resp = self.service(input_image=encoded_image) resp = resp.objects_json resp = self.json_str_to_dict(resp.data) persons = [] for i in range(r...
code_fim
hard
{ "lang": "python", "repo": "mrlathome/saam_body_gesture_detection", "path": "/scripts/person_detection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def json_str_to_dict(json_str): data = json.loads(json_str) objects_dict = dict() # based on saam-object-detection document objects_dict['num_detections'] = int(data['num_detections']) objects_dict['detection_boxes'] = np.array(data['detection_...
code_fim
medium
{ "lang": "python", "repo": "mrlathome/saam_body_gesture_detection", "path": "/scripts/person_detection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c0710204/python-socketio-cluster path: /src/libs/storage/file_obj.py class file_obj(object): <|fim_suffix|> raise NotImplementedError def force_ready(self): raise NotImplementedError<|fim_middle|> path="" ready=False def get_path(self): raise NotImp...
code_fim
medium
{ "lang": "python", "repo": "c0710204/python-socketio-cluster", "path": "/src/libs/storage/file_obj.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError<|fim_prefix|># repo: c0710204/python-socketio-cluster path: /src/libs/storage/file_obj.py class file_obj(object): path="" ready=False def get_path(self): <|fim_middle|> raise NotImplementedError def update_ready(self): raise NotIm...
code_fim
medium
{ "lang": "python", "repo": "c0710204/python-socketio-cluster", "path": "/src/libs/storage/file_obj.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c0710204/python-socketio-cluster path: /src/libs/storage/file_obj.py class file_obj(object): path="" ready=False def get_path(self): raise NotImplementedError def update_ready(self): <|fim_suffix|> raise NotImplementedError<|fim_middle|> raise NotIm...
code_fim
medium
{ "lang": "python", "repo": "c0710204/python-socketio-cluster", "path": "/src/libs/storage/file_obj.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UncleEngineer/TkinterTrick path: /000-testtkcalendar.py try: import tkinter as tk from tkinter import ttk except ImportError: import Tkinter as tk import ttk from tkcalendar import Calendar, DateEntry def example1(): def print_sel(): <|fim_suffix|> def gettext(...
code_fim
hard
{ "lang": "python", "repo": "UncleEngineer/TkinterTrick", "path": "/000-testtkcalendar.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def example2(): def gettext(): print(cal.get()) top = tk.Toplevel(root) #texttest = StringVar() ttk.Label(top, text='Choose date').pack(padx=10, pady=10) cal = DateEntry(top, width=12, background='darkblue', foreground='white', borderwidth...
code_fim
hard
{ "lang": "python", "repo": "UncleEngineer/TkinterTrick", "path": "/000-testtkcalendar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_elder.py #calss header class _ELDER(): def __init__(self,): self.name = "ELDER" self.definitions = [u'an older person, especially one with a respected position in society: ', u'an official of a religious group: ', u'\u2192\xa0 elderberry '] ...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_elder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' Color detection ''' detection_radius_def = 2<|fim_prefix|># repo: aaron837/py-rubik_solver path: /src/cubes/configs.py from vpython import color, vector ''' Colors ''' bg_color = color.black base_color = color.gray(0.4) colors_dict_def = { "U": color.white, "F": color.red, "R": c...
code_fim
medium
{ "lang": "python", "repo": "aaron837/py-rubik_solver", "path": "/src/cubes/configs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>move_time_def /= speed wait_time_def /= speed ''' Color detection ''' detection_radius_def = 2<|fim_prefix|># repo: aaron837/py-rubik_solver path: /src/cubes/configs.py from vpython import color, vector ''' Colors ''' bg_color = color.black base_color = color.gray(0.4) colors_dict_def = { "...
code_fim
medium
{ "lang": "python", "repo": "aaron837/py-rubik_solver", "path": "/src/cubes/configs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aaron837/py-rubik_solver path: /src/cubes/configs.py from vpython import color, vector ''' Colors ''' bg_color = color.black base_color = color.gray(0.4) colors_dict_def = { "U": color.white, "F": color.red, "R": color.blue, "B": color.orange, "L": color.green, "D": c...
code_fim
easy
{ "lang": "python", "repo": "aaron837/py-rubik_solver", "path": "/src/cubes/configs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: emmertex/openpilot path: /selfdrive/car/modules/UIEV_module.py from cereal import ui from common import realtime import selfdrive.messaging as messaging from selfdrive.services import service_list import zmq class UIEvents(object): def __init__(self,carstate): self.CS = carst...
code_fim
hard
{ "lang": "python", "repo": "emmertex/openpilot", "path": "/selfdrive/car/modules/UIEV_module.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def custom_alert_message(self,status,message,duration,sound=-1): if (status > -1) and (self.prev_cstm_status > status) and \ (self.CS.custom_alert_counter > 55): #dont change lessage to a lower importance one if we still have more than half second of display time ...
code_fim
hard
{ "lang": "python", "repo": "emmertex/openpilot", "path": "/selfdrive/car/modules/UIEV_module.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cnluzon/advent2016 path: /scripts/04_security_through_obscurity.py import argparse """ --- Day 4: Security Through Obscurity --- Finally, you come across an information kiosk with a list of rooms. Of course, the list is encrypted and full of decoy data, but the instructions to decode the list ar...
code_fim
hard
{ "lang": "python", "repo": "cnluzon/advent2016", "path": "/scripts/04_security_through_obscurity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def extract_shifted_name(code): sector_id = extract_sector_id(code) letters = extract_letters(code) new_name = shift_name(letters, sector_id) return new_name def sum_sector_values(code_list): acum = 0 for code in code_list: acum += extract_sector_value(code) return ...
code_fim
hard
{ "lang": "python", "repo": "cnluzon/advent2016", "path": "/scripts/04_security_through_obscurity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>input().split()) print(np.max(np.min(arr, axis = 1)))<|fim_prefix|># repo: nikhilchaudhary0126/hackerrank-python3-solutions path: /Numpy/Min and Max.py #!/bin/python3 import numpy as np if __name__ == '__main__': n,m=map(int,input().split()) arr=np.zeros((<|fim_middle|>n,m),int) for i in...
code_fim
easy
{ "lang": "python", "repo": "nikhilchaudhary0126/hackerrank-python3-solutions", "path": "/Numpy/Min and Max.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikhilchaudhary0126/hackerrank-python3-solutions path: /Numpy/Min and Max.py #!/bin/python3 import numpy as np if __name__ == '__main__': n,m=map(int,input().split()) arr=np.zeros((<|fim_suffix|>input().split()) print(np.max(np.min(arr, axis = 1)))<|fim_middle|>n,m),int) for i in...
code_fim
easy
{ "lang": "python", "repo": "nikhilchaudhary0126/hackerrank-python3-solutions", "path": "/Numpy/Min and Max.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>n,m),int) for i in range(n): arr[i]=np.array(input().split()) print(np.max(np.min(arr, axis = 1)))<|fim_prefix|># repo: nikhilchaudhary0126/hackerrank-python3-solutions path: /Numpy/Min and Max.py #!/bin/python3 import numpy as np if __name__ == '__mai<|fim_middle|>n__': n,m=map(int,...
code_fim
easy
{ "lang": "python", "repo": "nikhilchaudhary0126/hackerrank-python3-solutions", "path": "/Numpy/Min and Max.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>itlebar": "bg:#333333 #ffffff", # Messages "message": "bg:#bbee88 #222222", "loading": "#888888", # Help "title": "bold #44aaff", "subtitle": "bold #8800ff", "line": "#888888", "keys": "#44aaff", "version": "#8800ff", }<|fim_prefix|># repo: prompt-toolkit/pypager path:...
code_fim
hard
{ "lang": "python", "repo": "prompt-toolkit/pypager", "path": "/pypager/style.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: prompt-toolkit/pypager path: /pypager/style.py __all__ = [ "ui_style", ] ui_style = { # Standout is caused by man pages that insert a x\b in the output. "standout": "bold #44aaff", "standout2": "underline #aa8844", # Show current search term. (The cursor is not visible). ...
code_fim
hard
{ "lang": "python", "repo": "prompt-toolkit/pypager", "path": "/pypager/style.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>: 0.0, 'H': 0.0, 'K': 0.0, 'M': 0.0, 'L': 0.0, 'N': 0.0, 'Q': -0.0, 'P': 0.0, 'S': -0.0, 'R': 0.0, 'T': 0.0, 'W': -0.0, 'V': -0.0, 'Y': 0.0}, 9: {'A': -0.041, 'C': 0.0, 'E': 0.019, 'D': 0.0, 'G': 0.011, 'F': 0.0, 'I': 0.029, 'H': 0.0, 'K': 0.003, 'M': 0.007, 'L': -0.093, 'N': 0.089, 'Q': 0.056, 'P': 0.009...
code_fim
hard
{ "lang": "python", "repo": "FRED-2/Fred2", "path": "/Fred2/Data/pssms/smm/mat/B_08_01_11.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: FRED-2/Fred2 path: /Fred2/Data/pssms/smm/mat/B_08_01_11.py B_08_01_11 = {0: {'A': 0.0, 'C': 0.0, 'E': -0.0, 'D': 0.0, 'G': 0.0, 'F': 0.0, 'I': 0.0, 'H': 0.0, 'K': -0.0, 'M': 0.0, 'L': -0.0, 'N': 0.0, 'Q': -0.0, 'P': 0.0, 'S': 0.0, 'R': -0.0, 'T': -0.0, 'W': 0.0, 'V': -0.0, 'Y': 0.0}, 1: {'A': 0.0...
code_fim
hard
{ "lang": "python", "repo": "FRED-2/Fred2", "path": "/Fred2/Data/pssms/smm/mat/B_08_01_11.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert not captured_post(date(2019, 1, 2), date(2019, 1, 3), False) assert captured_post(date(2019, 1, 2), date(2019, 1, 3), True) assert not captured_post(date(2019, 1, 3), date(2019, 1, 3), False) assert captured_post(date(2019, 1, 3), date(2019, 1, 3), True)<|fim_prefix...
code_fim
hard
{ "lang": "python", "repo": "john5f35/abcli", "path": "/abcli/commands/test/test_transaction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert not captured_post(date(2019, 1, 1), date(2019, 1, 3), False) assert captured_post(date(2019, 1, 1), date(2019, 1, 3), True) assert not captured_post(date(2019, 1, 2), date(2019, 1, 3), False) assert captured_post(date(2019, 1, 2), date(2019, 1, 3), True) as...
code_fim
hard
{ "lang": "python", "repo": "john5f35/abcli", "path": "/abcli/commands/test/test_transaction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: john5f35/abcli path: /abcli/commands/test/test_transaction.py from datetime import date from pony import orm from abcli.commands.transaction import get_posts_between_period from abcli.model import init_orm def test_get_posts_between_period(): <|fim_suffix|> def captured_post(date_from,...
code_fim
hard
{ "lang": "python", "repo": "john5f35/abcli", "path": "/abcli/commands/test/test_transaction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> line_stats_test : list or None, optional Statistics for sampling from the ``size x dims`` elements for the testing data. Returns ------- train_data : tuple, (X, y) Training data with ``X`` and ``y``. val_data : tuple, (X, y) Validation data with ``X`` and ``y``. ...
code_fim
hard
{ "lang": "python", "repo": "APRashedAhmed/combinatorial-generalization", "path": "/combinatorial_generalization/make_datasets.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: APRashedAhmed/combinatorial-generalization path: /combinatorial_generalization/make_datasets.py """Script to hold the functions for making combigen datasets.""" import logging import combinatorial_generalization.default_configuration as config import combinatorial_generalization.combigen as cg ...
code_fim
hard
{ "lang": "python", "repo": "APRashedAhmed/combinatorial-generalization", "path": "/combinatorial_generalization/make_datasets.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> if tree.root is None: return 0 low, high = sum_range return get_sum_over_range_helper(tree.root, low, high) if __name__ == "__main__": tree = BinarySearchTree() tree.add(5) tree.add(3) tree.add(8) tree.add(2) tree.add(4) tree.add(6) tree.add(10) ...
code_fim
hard
{ "lang": "python", "repo": "All3yp/Daily-Coding-Problem-Solutions", "path": "/Solutions/343.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: All3yp/Daily-Coding-Problem-Solutions path: /Solutions/343.py """ Problem: Given a binary search tree and a range [a, b] (inclusive), return the sum of the elements of the binary search tree within the range. For example, given the following tree: <|fim_suffix|>from DataStructures.Tree import ...
code_fim
medium
{ "lang": "python", "repo": "All3yp/Daily-Coding-Problem-Solutions", "path": "/Solutions/343.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_sum_over_range_helper(node: Node, low: int, high: int) -> int: if node is None: return 0 if low <= node.val <= high: return ( node.val + get_sum_over_range_helper(node.left, low, high) + get_sum_over_range_helper(node.right, low, high) ...
code_fim
medium
{ "lang": "python", "repo": "All3yp/Daily-Coding-Problem-Solutions", "path": "/Solutions/343.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class User(Base): __tablename__ = "USERS" id = Column(String(36), primary_key=True, default=uuid4) email = Column(String(128), unique=True) active = Column(Boolean) updated_at = Column(DateTime) created_at = Column(DateTime) class Punch(Base): __tablename__ = "WORKING_PUNCHE...
code_fim
hard
{ "lang": "python", "repo": "g-sponda/pontomaisoumenos", "path": "/app/database/models.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: g-sponda/pontomaisoumenos path: /app/database/models.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from sqlalchemy import ( Boolean, Column, create_engine, DateTime, ForeignKey, MetaData, String, ) from sqlalchemy.ext.declarative import declarative_base from sqlalc...
code_fim
medium
{ "lang": "python", "repo": "g-sponda/pontomaisoumenos", "path": "/app/database/models.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> for input, expected_output in data: # print(input, expected_output, fct(input)) actual_output = fct(input) if actual_output != expected_output: print("input: {} expected: {} got: {}".format(input, expected_output, actual_output)) assert actual_output == expe...
code_fim
hard
{ "lang": "python", "repo": "jannikmi/timezonefinder", "path": "/tests/auxiliaries.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jannikmi/timezonefinder path: /tests/auxiliaries.py import random import timeit from math import log10 from typing import Callable, Tuple import numpy as np from timezonefinder import TimezoneFinder, utils from timezonefinder.configs import ( DTYPE_FORMAT_SIGNED_I_NUMPY, MAX_ALLOWED_COO...
code_fim
hard
{ "lang": "python", "repo": "jannikmi/timezonefinder", "path": "/tests/auxiliaries.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: williballenthin/synapse path: /synapse/cores/sqlite.py ) q = self._q_getrows_by_le rows = self.select(q, prop=prop, valu=valu, limit=limit) return self._foldTypeCols(rows) def _sizeByRange(self, prop, valu, limit=None): limit = self._getDbLimit(limit) ...
code_fim
hard
{ "lang": "python", "repo": "williballenthin/synapse", "path": "/synapse/cores/sqlite.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _sizeByLe(self, prop, valu, limit=None): limit = self._getDbLimit(limit) q = self._q_getsize_by_le args = [ prop, valu, limit ] return self.select(q,prop=prop,valu=valu,limit=limit)[0][0] def _initDbConn(self): dbinfo = self._initDbInfo() dbname...
code_fim
hard
{ "lang": "python", "repo": "williballenthin/synapse", "path": "/synapse/cores/sqlite.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._q_istable = self._prepQuery(self._t_istable) self._q_inittable = self._prepQuery(self._t_inittable) self._q_init_iden_idx = self._prepQuery(self._t_init_iden_idx) self._q_init_prop_idx = self._prepQuery(self._t_init_prop_idx) self._q_init_strval_idx = self._pr...
code_fim
hard
{ "lang": "python", "repo": "williballenthin/synapse", "path": "/synapse/cores/sqlite.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }