text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ 获取天气信息。网址:https://www.sojson.com/blog/305.html :return: """ try: with open( os.path.join(os.path.dirname(__file__), "city.json"), "r", encoding="utf-8", ) as city_file: city_...
code_fim
hard
{ "lang": "python", "repo": "New-Sina/Oreomeow_checkinpanel", "path": "/api_weather.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.parse(data) if self.output_to_console: print(self.print_DMM()) async def run(self): logger.warning(f"{self.model} running as {self.__class__.__name__}.") loop = asyncio.get_event_loop() # If a MAC was not specified, run autoscan until we find...
code_fim
hard
{ "lang": "python", "repo": "baldengineer/dmm-ble-mp730026", "path": "/meters/MP730026/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: baldengineer/dmm-ble-mp730026 path: /meters/MP730026/__init__.py # Original Author James Lewis 2020-01, Heavily modified into a Class and module by # Tim 'Geekboy1011" Keller - 2020-06 # Additional major contributions by TisBoyo - 2020-06 # MIT License # MP730026 # Module to decode and manages in...
code_fim
hard
{ "lang": "python", "repo": "baldengineer/dmm-ble-mp730026", "path": "/meters/MP730026/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> except TypeError: logger.error("Invalid data type passed for MAC") break except ValueError: logger.error("Invalid MAC address") break try: while not await client.connect(): ...
code_fim
hard
{ "lang": "python", "repo": "baldengineer/dmm-ble-mp730026", "path": "/meters/MP730026/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> csv_dir = os.path.join(os.getcwd(), 'out', 'moments_info.csv') info_arr = [] info_lines = csv.reader(codecs.open(csv_dir, 'r', 'utf-8')) info_lines_dereplicated = dereplicate(list(info_lines)) info_arr = rebuild_moment_info(info_lines_dereplicated) print('\n*** all info are read. *...
code_fim
hard
{ "lang": "python", "repo": "Hungrated/net-spider-ease", "path": "/src/qzone/parse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> timestamp = int(time.mktime(time_obj)) date_str = time.strftime('%Y-%m-%d', time_obj) time_str = time.strftime('%H:%M', time_obj) return timestamp, date_str, time_str """ 再加工说说信息 """ def rebuild_moment_info(info_lines): parsed_info_arr = [ ['moment_id', 'date', 'time', '...
code_fim
hard
{ "lang": "python", "repo": "Hungrated/net-spider-ease", "path": "/src/qzone/parse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hungrated/net-spider-ease path: /src/qzone/parse.py import os import codecs import xlwt import csv import re import time from itertools import islice from .account import USER_NAME from .encrypt import * """ 二维数组去重 """ def dereplicate(arr_2d): arr_1d = [] arr_dereplicated = [] fo...
code_fim
hard
{ "lang": "python", "repo": "Hungrated/net-spider-ease", "path": "/src/qzone/parse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: priyansh19/struct2tensor path: /struct2tensor/prensor_util.py # Copyright 2019 Google LLC # # 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 copy of the License at # # http://www.apache.org...
code_fim
hard
{ "lang": "python", "repo": "priyansh19/struct2tensor", "path": "/struct2tensor/prensor_util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#################### Code for get_ragged_tensors(...) ########################## def from_value_rowids_bridge(values, value_rowids=None, nrows=None, validate=True): """validate option is only available internally fo...
code_fim
hard
{ "lang": "python", "repo": "priyansh19/struct2tensor", "path": "/struct2tensor/prensor_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _get_leaf_node_path_suffix(p): """Get the suffix of a LeafNodePath.""" return _LeafNodePath(_as_root_node_tensor(p.middle[0]), p.middle[1:], p.tail) def _get_node_path_parent(p ): return _ChildNodePath(p.head, p.middle[:-1], p.middle[-1]) def _get_leaf_node_paths(t ...
code_fim
hard
{ "lang": "python", "repo": "priyansh19/struct2tensor", "path": "/struct2tensor/prensor_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: atyenoria/vitess path: /py/cbson/test_cbson_bad_data.py #!/usr/bin/python2.4 import base64 import binascii import random import sys import unittest import cbson # These values were generated by test_random_segfaults and used to # crash the decoder, before we fixed the issues. # Only base64 enc...
code_fim
hard
{ "lang": "python", "repo": "atyenoria/vitess", "path": "/py/cbson/test_cbson_bad_data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_short_string_segfaults(self): a = cbson.dumps({"A": [1, 2, 3, 4, 5, "6", u"7", {"C": u"DS"}]}) for i in range(len(a))[1:]: try: cbson.loads(a[:-i] + (" " * i)) except Exception: pass def test_known_bad(self): for s in KNOWN_BAD: try: d =...
code_fim
medium
{ "lang": "python", "repo": "atyenoria/vitess", "path": "/py/cbson/test_cbson_bad_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_short_string_segfaults(self): a = cbson.dumps({"A": [1, 2, 3, 4, 5, "6", u"7", {"C": u"DS"}]}) for i in range(len(a))[1:]: try: cbson.loads(a[:-i] + (" " * i)) except Exception: pass def test_known_bad(self): for s in KNOWN_BAD: try: d = ...
code_fim
medium
{ "lang": "python", "repo": "atyenoria/vitess", "path": "/py/cbson/test_cbson_bad_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Stranger6667/pytest-click path: /src/pytest_click/fixtures.py # pylint: disable=redefined-outer-name from typing import Generator import pytest from _pytest.fixtures import SubRequest from click.testing import CliRunner @pytest.fixture def cli_runner(request: SubRequest) -> CliRunner: """I...
code_fim
medium
{ "lang": "python", "repo": "Stranger6667/pytest-click", "path": "/src/pytest_click/fixtures.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ... """ init_kwargs = {} marker = request.node.get_closest_marker("runner_setup") if marker: init_kwargs = marker.kwargs return CliRunner(**init_kwargs) @pytest.fixture def isolated_cli_runner(cli_runner: CliRunner) -> Generator[CliRunner, None, None]: """Instance...
code_fim
hard
{ "lang": "python", "repo": "Stranger6667/pytest-click", "path": "/src/pytest_click/fixtures.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: We should move to a role-based model where we allow # certain users to see some data read-only and some just their # own data. @staticmethod def CanUserSeeData(request): # Sanity check, admins should always be allowed. if users.is_current_user_admin(): return True ...
code_fim
hard
{ "lang": "python", "repo": "jchaffraix/guild-membership-app", "path": "/authentication.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jchaffraix/guild-membership-app path: /authentication.py # This file contains all the authentication related backend functions. import hashlib import logging from google.appengine.api import users import google.oauth2.id_token #import requests_toolbelt.adapters.appengine import google.auth.tra...
code_fim
hard
{ "lang": "python", "repo": "jchaffraix/guild-membership-app", "path": "/authentication.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> e = get_object_or_404(Entry, pub_date__year=year, pk=object_id, slug=slug) return render(request, "news/entry.html", {"entry": e})<|fim_prefix|># repo: okffi/decisions path: /web/decisions/news/views.py from django.shortcuts import render, get_object_or_404 <|fim_middle|>from decisions.news.mod...
code_fim
medium
{ "lang": "python", "repo": "okffi/decisions", "path": "/web/decisions/news/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: okffi/decisions path: /web/decisions/news/views.py from django.shortcuts import render, get_object_or_404 from decisions.news.models import Entry <|fim_suffix|> return render(request, "news/entry.html", {"entry": e})<|fim_middle|> def entry(request, year, object_id, slug): e = get_object...
code_fim
medium
{ "lang": "python", "repo": "okffi/decisions", "path": "/web/decisions/news/views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return render(request, "news/entry.html", {"entry": e})<|fim_prefix|># repo: okffi/decisions path: /web/decisions/news/views.py from django.shortcuts import render, get_object_or_404 from decisions.news.models import Entry def entry(request, year, object_id, slug): <|fim_middle|> e = get_object...
code_fim
medium
{ "lang": "python", "repo": "okffi/decisions", "path": "/web/decisions/news/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kaiserpreusse/lipidhandler path: /lipidhandler/lipidlist.py import logging from typing import List from lipidhandler.lipid import Lipid log = logging.getLogger(__name__) class LipidList: <|fim_suffix|> return iter(self.lipids) def __len__(self): return len(self.lipids) ...
code_fim
hard
{ "lang": "python", "repo": "kaiserpreusse/lipidhandler", "path": "/lipidhandler/lipidlist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Various aggregation methods and summaries seem to be on the roadmap. """ def __init__(self, lipids: List[Lipid] = None): if lipids: self.lipids = lipids else: self.lipids = [] def __iter__(self): return iter(self.lipids) def __len__(se...
code_fim
medium
{ "lang": "python", "repo": "kaiserpreusse/lipidhandler", "path": "/lipidhandler/lipidlist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> The first argument is the path to the JSON dictionary file containing keys: "commands": an array of strings that represents the command line to run "cwd": A string specifying which directory to run in "env": a dictionary of strings containing the environment variables to set "s...
code_fim
hard
{ "lang": "python", "repo": "common-workflow-language/cwltool", "path": "/cwltool/run_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(argv: List[str]) -> int: """ Read in the configuration JSON and execute the commands. The first argument is the path to the JSON dictionary file containing keys: "commands": an array of strings that represents the command line to run "cwd": A string specifying which direc...
code_fim
hard
{ "lang": "python", "repo": "common-workflow-language/cwltool", "path": "/cwltool/run_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: common-workflow-language/cwltool path: /cwltool/run_job.py """Only used when there is a job script or CWLTOOL_FORCE_SHELL_POPEN=1.""" import json import os import subprocess # nosec import sys from typing import BinaryIO, Dict, List, Optional, TextIO, Union def handle_software_environment(cwl_...
code_fim
hard
{ "lang": "python", "repo": "common-workflow-language/cwltool", "path": "/cwltool/run_job.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ninapavlich/disciplinereport path: /disciplinereport/apps/data/migrations/0010_auto_20160724_2348.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('data', '0009_tool...
code_fim
hard
{ "lang": "python", "repo": "ninapavlich/disciplinereport", "path": "/disciplinereport/apps/data/migrations/0010_auto_20160724_2348.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>, name='expulsions', field=models.FloatField(help_text=b'Expulsions per 100 students.', null=True, verbose_name='Expulsions', blank=True), ), migrations.AlterField( model_name='statedatum', name='school_arrests', field=models.Floa...
code_fim
hard
{ "lang": "python", "repo": "ninapavlich/disciplinereport", "path": "/disciplinereport/apps/data/migrations/0010_auto_20160724_2348.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for orange in orange_fell_position: if orange in range(source_house, destination_house + 1): count_oranges += 1 print(count_oranges) countApplesAndOranges(2, 3, 1, 5, [2], [-2])<|fim_prefix|># repo: theeksha101/ProblemSolving path: /SolvedByMe/Apple and Oranges.py def countA...
code_fim
medium
{ "lang": "python", "repo": "theeksha101/ProblemSolving", "path": "/SolvedByMe/Apple and Oranges.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: theeksha101/ProblemSolving path: /SolvedByMe/Apple and Oranges.py def countApplesAndOranges(source_house, destination_house, location_apple_tree, location_orange_tree, dist_apple_fall, dist_oranges_fall): count_apples = 0 count_oranges =...
code_fim
medium
{ "lang": "python", "repo": "theeksha101/ProblemSolving", "path": "/SolvedByMe/Apple and Oranges.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aho1go/pyslcan path: /pyslcan.py # MIT License # # Copyright(c) 2018 aho1go # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files(the "Software"), to deal # in the Software without restriction, including without limi...
code_fim
hard
{ "lang": "python", "repo": "aho1go/pyslcan", "path": "/pyslcan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cmd = args[1] dev = args[2] bps = 115200 delay = 10 if len(args) >= 4: bps = int(args[3]) if len(args) >= 5: delay = int(args[4]) cmds = cmd.split(",") s = serial.Serial(dev, bps) for c in cmds: if c == "-": rcv = "" wh...
code_fim
medium
{ "lang": "python", "repo": "aho1go/pyslcan", "path": "/pyslcan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws/sagemaker-python-sdk path: /tests/integ/test_sklearn.py # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is locate...
code_fim
hard
{ "lang": "python", "repo": "aws/sagemaker-python-sdk", "path": "/tests/integ/test_sklearn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.skip( reason="This test has always failed, but the failure was masked by a bug. " "This test should be fixed. Details in https://github.com/aws/sagemaker-python-sdk/pull/968" ) def test_async_fit( sagemaker_session, cpu_instance_type, sklearn_latest_version, sklearn_la...
code_fim
hard
{ "lang": "python", "repo": "aws/sagemaker-python-sdk", "path": "/tests/integ/test_sklearn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> processor = SKLearnProcessor( framework_version=sklearn_version, py_version=py_version, role=ROLE, instance_count=1, instance_type=instance_type, sagemaker_session=sagemaker_session, base_job_name="test-sklearn", ...
code_fim
hard
{ "lang": "python", "repo": "aws/sagemaker-python-sdk", "path": "/tests/integ/test_sklearn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='pokemon', name='evolution', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='pokemon_entities.pokemon'), ), ]<|fim_prefix|># repo: delphython/pokemon_map-master p...
code_fim
medium
{ "lang": "python", "repo": "delphython/pokemon_map-master", "path": "/pokemon_entities/migrations/0009_pokemon_evolution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: delphython/pokemon_map-master path: /pokemon_entities/migrations/0009_pokemon_evolution.py # Generated by Django 3.1.13 on 2021-09-20 12:45 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> operations = [ migrations.AddField( model_...
code_fim
medium
{ "lang": "python", "repo": "delphython/pokemon_map-master", "path": "/pokemon_entities/migrations/0009_pokemon_evolution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> width = len(image[0]) height = len(image) hor = np.zeros(height) for i in range(height): for j in range(width): if(image[i][j] == ConstValue.BLACK): hor[i] = hor[i] + 1 return hor def VerticalProjection(image): width = len(image[0]) height =...
code_fim
medium
{ "lang": "python", "repo": "Yi-Rabbit/h2l", "path": "/src/evaluator/LineSegment/Projection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def VerticalProjection(image): width = len(image[0]) height = len(image) ver = np.zeros(width) for j in range(width): for i in range(height): if(image[i][j] == ConstValue.BLACK): ver[j] = ver[j] + 1 return ver<|fim_prefix|># repo: Yi-Rabbit/h2l path...
code_fim
hard
{ "lang": "python", "repo": "Yi-Rabbit/h2l", "path": "/src/evaluator/LineSegment/Projection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yi-Rabbit/h2l path: /src/evaluator/LineSegment/Projection.py from evaluator.LineSegment import ConstValue import numpy as np from skimage import filters def HorizontalProjection(image): width = len(image[0]) height = len(image) hor = np.zeros(height) for i in range(height): ...
code_fim
medium
{ "lang": "python", "repo": "Yi-Rabbit/h2l", "path": "/src/evaluator/LineSegment/Projection.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>1 if x%2 == 0: y = m else: y = 2 else: if x%2 == 1: y = m-k+1 else: y = 1+k print(x, y)<|fim_prefix|># repo: freedomDR/coding path: /codeforces/976B.py # coding=utf-8 import math n, m, k = map(int, input().split()) ...
code_fim
medium
{ "lang": "python", "repo": "freedomDR/coding", "path": "/codeforces/976B.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: freedomDR/coding path: /codeforces/976B.py # coding=utf-8 import math n, m, k = map(int, input().split()) if k < n: print(k+<|fim_suffix|> if x%2 == 1: y = m-k+1 else: y = 1+k print(x, y)<|fim_middle|>1, 1) else: k -= n-1 x = n - k//(m-1) k...
code_fim
medium
{ "lang": "python", "repo": "freedomDR/coding", "path": "/codeforces/976B.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if x%2 == 1: y = m-k+1 else: y = 1+k print(x, y)<|fim_prefix|># repo: freedomDR/coding path: /codeforces/976B.py # coding=utf-8 import math n, m, k = map(int, input().split()) if k < n: print(k+1, 1) else: k -= n-1 x = n - k//(m-1) k %= m-1 if...
code_fim
medium
{ "lang": "python", "repo": "freedomDR/coding", "path": "/codeforces/976B.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: janewen134/fyp path: /rcab_tf.py import matplotlib import os import tensorflow.compat.v1 as tf tf.disable_v2_behavior() # import tensorflow as tf from keras.layers import BatchNormalization from keras.engine.topology import get_source_inputs from keras.layers import Input,multiply,Lambda,add fro...
code_fim
hard
{ "lang": "python", "repo": "janewen134/fyp", "path": "/rcab_tf.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> up_h=Conv2D(filters=c,kernel_size=1,activation='sigmoid')(ds_h) up_w=Conv2D(filters=c,kernel_size=1,activation='sigmoid')(ds_w) y=multiply([identity,up_h,up_w]) x=add([x,y]) out = ReLU()(x) return out<|fim_prefix|># repo: janewen134/fyp path: /rcab_tf.py import matplotlib import ...
code_fim
hard
{ "lang": "python", "repo": "janewen134/fyp", "path": "/rcab_tf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # downsample->upsample mip=c//reduction ds_h=Conv2D(filters=mip,kernel_size=1,activation='relu')(x_h) ds_w=Conv2D(filters=mip,kernel_size=1,activation='relu')(x_w) up_h=Conv2D(filters=c,kernel_size=1,activation='sigmoid')(ds_h) up_w=Conv2D(filters=c,kernel_size=1,activation='s...
code_fim
medium
{ "lang": "python", "repo": "janewen134/fyp", "path": "/rcab_tf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def assertImage(self, img, colors, alpha=True): check = image_factory(colors, alpha) self.assertEqual(img.pixels, check.pixels)<|fim_prefix|># repo: smillaedler/pymaging path: /pymaging/test_utils.py # -*- coding: utf-8 -*- import unittest import array from pymaging.colors import Colo...
code_fim
medium
{ "lang": "python", "repo": "smillaedler/pymaging", "path": "/pymaging/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smillaedler/pymaging path: /pymaging/test_utils.py # -*- coding: utf-8 -*- import unittest import array from pymaging.colors import ColorType from pymaging.image import Image from pymaging.pixelarray import get_pixel_array def image_factory(colors, alpha=True): <|fim_suffix|> def assertImage...
code_fim
hard
{ "lang": "python", "repo": "smillaedler/pymaging", "path": "/pymaging/test_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class PymagingBaseTestCase(unittest.TestCase): def assertImage(self, img, colors, alpha=True): check = image_factory(colors, alpha) self.assertEqual(img.pixels, check.pixels)<|fim_prefix|># repo: smillaedler/pymaging path: /pymaging/test_utils.py # -*- coding: utf-8 -*- import unittes...
code_fim
hard
{ "lang": "python", "repo": "smillaedler/pymaging", "path": "/pymaging/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: royqh1979/PyEasyGraphics path: /examples/turtle/for_all/fish.py from easygraphics import * from easygraphics.turtle import * def main(): create_world() set_speed(10) set_fill_color("yellow") begin_fill() gotoxy(200, 200) gotoxy(200, -200) home() end_fill() <|fim_...
code_fim
medium
{ "lang": "python", "repo": "royqh1979/PyEasyGraphics", "path": "/examples/turtle/for_all/fish.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> setxy(50, -10) move_arc(10, 360) hide() pause() close_graph() easy_run(main)<|fim_prefix|># repo: royqh1979/PyEasyGraphics path: /examples/turtle/for_all/fish.py from easygraphics import * from easygraphics.turtle import * def main(): create_world() set_speed(10) set_f...
code_fim
medium
{ "lang": "python", "repo": "royqh1979/PyEasyGraphics", "path": "/examples/turtle/for_all/fish.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DedMemez/ODS-August-2017 path: /shtiker/EventsPage.py nfo in base.localAvatar.invites: if partyInfo.partyId == inviteInfo.partyId: break if inviteInfo is None: EventsPage.notify.error('No invitation info for party id %d' % part...
code_fim
hard
{ "lang": "python", "repo": "DedMemez/ODS-August-2017", "path": "/shtiker/EventsPage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.hostingGuestList.removeAndDestroyAllItems() def unloadActivities(self): self.hostingActivityList.removeAndDestroyAllItems() def unloadDecorations(self): self.hostingDecorationList.removeAndDestroyAllItems() def unload(self): self.scrollButtonGui...
code_fim
hard
{ "lang": "python", "repo": "DedMemez/ODS-August-2017", "path": "/shtiker/EventsPage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def getActivityItem(self, activityBase, count = 1): activityName = TTLocalizer.PartyActivityNameDict[activityBase.activityId]['generic'] if count == 1: textForActivity = activityName else: textForActivity = '%s x %d' % (activityName, count) ...
code_fim
hard
{ "lang": "python", "repo": "DedMemez/ODS-August-2017", "path": "/shtiker/EventsPage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dharmab/webtop path: /webtop/__init__.py #!/usr/bin/env python3 from collections import deque from typing import Dict, Collection, Optional, Deque, List, Any, Callable from yarl import URL import aiohttp import argparse import asyncio import datetime import durationpy # type: ignore import json...
code_fim
hard
{ "lang": "python", "repo": "dharmab/webtop", "path": "/webtop/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.duration is not None: duration = durationpy.from_str(args.duration) async def stop_test(): await asyncio.wait([shutdown_event.wait()], timeout=duration) shutdown_event.set() tasks.append(stop_test()) async def renderer() -> None: w...
code_fim
hard
{ "lang": "python", "repo": "dharmab/webtop", "path": "/webtop/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> title = f"Our Story | We All Code"<|fim_prefix|># repo: gregoriofs/website path: /weallcode/views/our_story.py from django.urls import reverse_lazy from django.views.generic import TemplateView from .common import DefaultMetaTags class OurStoryView(DefaultMetaTags, TemplateView): <|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "gregoriofs/website", "path": "/weallcode/views/our_story.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gregoriofs/website path: /weallcode/views/our_story.py from django.urls import reverse_lazy from django.views.generic import TemplateView from .common import DefaultMetaTags class OurStoryView(DefaultMetaTags, TemplateView): <|fim_suffix|> title = f"Our Story | We All Code"<|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "gregoriofs/website", "path": "/weallcode/views/our_story.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> template_name = "weallcode/our_story.html" url = reverse_lazy("weallcode-our-story") title = f"Our Story | We All Code"<|fim_prefix|># repo: gregoriofs/website path: /weallcode/views/our_story.py from django.urls import reverse_lazy from django.views.generic import TemplateView from .common...
code_fim
easy
{ "lang": "python", "repo": "gregoriofs/website", "path": "/weallcode/views/our_story.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (cipher_cls, mode_cls) in self._cipher_registry: raise ValueError("Duplicate registration for: {0} {1}".format( cipher_cls, mode_cls) ) self._cipher_registry[cipher_cls, mode_cls] = adapter def _register_default_ciphers(self): for cip...
code_fim
hard
{ "lang": "python", "repo": "dlitz/cryptography", "path": "/cryptography/hazmat/bindings/openssl/backend.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dlitz/cryptography path: /cryptography/hazmat/bindings/openssl/backend.py # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
code_fim
hard
{ "lang": "python", "repo": "dlitz/cryptography", "path": "/cryptography/hazmat/bindings/openssl/backend.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Hashes(object): def __init__(self, backend): super(Hashes, self).__init__() self._backend = backend def supported(self, hash_cls): return (self._backend.ffi.NULL != self._backend.lib.EVP_get_digestbyname( hash_cls.name.encode("asc...
code_fim
hard
{ "lang": "python", "repo": "dlitz/cryptography", "path": "/cryptography/hazmat/bindings/openssl/backend.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='activeproject', name='project_home_page', field=models.URLField(blank=True, default=''), ), migrations.AlterField( model_name='activeproject', name='version', ...
code_fim
hard
{ "lang": "python", "repo": "MIT-LCP/physionet-build", "path": "/physionet-django/project/migrations/0006_auto_20190306_1418.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MIT-LCP/physionet-build path: /physionet-django/project/migrations/0006_auto_20190306_1418.py # Generated by Django 2.1.7 on 2019-03-06 19:18 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( ...
code_fim
hard
{ "lang": "python", "repo": "MIT-LCP/physionet-build", "path": "/physionet-django/project/migrations/0006_auto_20190306_1418.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> index: ip:port [mac]; flags, timeout """ return '{:d}: {:s}:{:d} [{:s}]; {:x}, {:.02f}'.format (self.index, self.ip, self.port, self.mac, self.flags, self.timeout)<|fim_prefix|># repo: SpiNNakerManchester/SpiNNakerManchester.github.io path: /2015.005.Arbitrary/st...
code_fim
medium
{ "lang": "python", "repo": "SpiNNakerManchester/SpiNNakerManchester.github.io", "path": "/2015.005.Arbitrary/stand_alone_microcircuit_demo_10_percent/pacman103/core/spinnman/interfaces/iptag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __str__ (self): """ Pretty print method to help in interactive mode. Print format: index: ip:port [mac]; flags, timeout """ return '{:d}: {:s}:{:d} [{:s}]; {:x}, {:.02f}'.format (self.index, self.ip, self.port, self.mac, self.flag...
code_fim
hard
{ "lang": "python", "repo": "SpiNNakerManchester/SpiNNakerManchester.github.io", "path": "/2015.005.Arbitrary/stand_alone_microcircuit_demo_10_percent/pacman103/core/spinnman/interfaces/iptag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SpiNNakerManchester/SpiNNakerManchester.github.io path: /2015.005.Arbitrary/stand_alone_microcircuit_demo_10_percent/pacman103/core/spinnman/interfaces/iptag.py __author__ = 'stokesa6' class IPTag(object): #a class used for holding data that is contained within a IPTag def __init__(self...
code_fim
medium
{ "lang": "python", "repo": "SpiNNakerManchester/SpiNNakerManchester.github.io", "path": "/2015.005.Arbitrary/stand_alone_microcircuit_demo_10_percent/pacman103/core/spinnman/interfaces/iptag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lijufeng2016/incubator-dolphinscheduler path: /ambari_plugin/common-services/DOLPHIN/1.3.0/package/scripts/params.py """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information re...
code_fim
hard
{ "lang": "python", "repo": "lijufeng2016/incubator-dolphinscheduler", "path": "/ambari_plugin/common-services/DOLPHIN/1.3.0/package/scripts/params.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># zookeeper.properties dolphin_zookeeper_map={} zookeeperHosts = default("/clusterHostInfo/zookeeper_hosts", []) if len(zookeeperHosts) > 0 and "clientPort" in config['configurations']['zoo.cfg']: clientPort = config['configurations']['zoo.cfg']['clientPort'] zookeeperPort = ":" + clientPort + ","...
code_fim
hard
{ "lang": "python", "repo": "lijufeng2016/incubator-dolphinscheduler", "path": "/ambari_plugin/common-services/DOLPHIN/1.3.0/package/scripts/params.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#iterates over list, running statements for each item in the list count = 0 for cmd in cmds: count+=1 print "Running Command Number %s" % count subprocess.call(cmd, shell=True)<|fim_prefix|># repo: frankcash/Misc path: /Python/sequenceOfBash.py import subprocess #define cmds to run here MESSA...
code_fim
easy
{ "lang": "python", "repo": "frankcash/Misc", "path": "/Python/sequenceOfBash.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frankcash/Misc path: /Python/sequenceOfBash.py import subprocess #define cmds to run here MESSAGES= "tail /var/log/messages" SPACE = "df -h" <|fim_suffix|>#iterates over list, running statements for each item in the list count = 0 for cmd in cmds: count+=1 print "Running Command Number %...
code_fim
easy
{ "lang": "python", "repo": "frankcash/Misc", "path": "/Python/sequenceOfBash.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_commit(char, var_attribute): char.unit.xp = int(1e10) before = get_attrib_by_enum(char.unit, var_attribute) char.increase_attrib(var_attribute) assert get_attrib_by_enum(char.unit, var_attribute) > before char.commit() char.reset() assert get_attrib_by_enum(char....
code_fim
medium
{ "lang": "python", "repo": "ikamensh/pydolons", "path": "/tests/character/test_char_attrs.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: ikamensh/pydolons path: /tests/character/test_char_attrs.py from game_objects.battlefield_objects.CharAttributes import get_attrib_by_enum import pytest from exceptions import PydolonsError def test_can_up_attribs(char, var_attribute): <|fim_suffix|> assert get_attrib_by_enum(char.unit, var_...
code_fim
medium
{ "lang": "python", "repo": "ikamensh/pydolons", "path": "/tests/character/test_char_attrs.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: danyfang/SourceCode path: /py/leetcode/RemoveParentheses.py ''' Leetcode problem No 301 Remove Invalid Parentheses Solution written by Xuqiang Fang on 5 July, 2018 ''' class Solution(object): def removeInvalidParentheses(self, s): """ :type s: str :rtype: List[str] ...
code_fim
hard
{ "lang": "python", "repo": "danyfang/SourceCode", "path": "/py/leetcode/RemoveParentheses.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def combination(self, l, c):#select c from l ''' l is a list, we have to select c elements from l ''' ans = set() self.dfs_(ans, l, c, []) return ans def dfs_(self, ans, l, c, t): if len(t) > c: return if len(t) == c: ...
code_fim
hard
{ "lang": "python", "repo": "danyfang/SourceCode", "path": "/py/leetcode/RemoveParentheses.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Iteration: ' + str(i)) data_list.append(df) res = pd.concat(data_list) res = res.reset_index().drop_duplicates('user_id').set_index('user_id') res = res['age'].value_counts().to_frame() res.to_csv("age_freq.csv")<|fim_prefix|># repo: zhoudaxia233/SmarTrip path: /age_freq.py #! /usr/bin/env p...
code_fim
medium
{ "lang": "python", "repo": "zhoudaxia233/SmarTrip", "path": "/age_freq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_duplicates('user_id').set_index('user_id') res = res['age'].value_counts().to_frame() res.to_csv("age_freq.csv")<|fim_prefix|># repo: zhoudaxia233/SmarTrip path: /age_freq.py #! /usr/bin/env python3 # coding: utf-8 import pandas as pd data_list = [] for i in range(500+1): df = pd.r<|fim_middle|>ead...
code_fim
hard
{ "lang": "python", "repo": "zhoudaxia233/SmarTrip", "path": "/age_freq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhoudaxia233/SmarTrip path: /age_freq.py #! /usr/bin/env python3 # coding: utf-8 import pandas as pd data_list = [] for i in range(500+1): df = pd.r<|fim_suffix|>_duplicates('user_id').set_index('user_id') res = res['age'].value_counts().to_frame() res.to_csv("age_freq.csv")<|fim_middle|>ead...
code_fim
hard
{ "lang": "python", "repo": "zhoudaxia233/SmarTrip", "path": "/age_freq.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if confirm: val = input("Are you sure [y/N]? ") if val.lower() != 'y': raise GenericError("Cancelled by user", 100) def main(): """Main entry point to tag_release.py.""" parser = build_parser() args = parser.parse_args() retval = 0 try: comp ...
code_fim
hard
{ "lang": "python", "repo": "iotile/multipackage", "path": "/.multipackage/scripts/tag_release.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iotile/multipackage path: /.multipackage/scripts/tag_release.py """Helper script to tag a release by name.""" from __future__ import print_function import os import sys import argparse import subprocess if sys.version_info.major < 3: from builtins import raw_input as input from components ...
code_fim
hard
{ "lang": "python", "repo": "iotile/multipackage", "path": "/.multipackage/scripts/tag_release.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def validate_env_variables(): env_vars = { "GH_USER": GH_USER, "GH_USER_TOKEN": GH_USER_TOKEN, "API_BASE_URL": API_BASE_URL, "GH_APP_ID": GH_APP_ID, "GH_APP_CLIENT_ID": GH_APP_CLIENT_ID, "GH_APP_CLIENT_SECRET": GH_APP_CLIENT_SECRET, "GH_APP_PRIV...
code_fim
hard
{ "lang": "python", "repo": "zac-li/gh-app-starter-python", "path": "/bot_config.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zac-li/gh-app-starter-python path: /bot_config.py import os import sys import logging from functools import reduce logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='[%(levelname)8s] %(process)s:%(name)s\t%(message)s') log = logging.getLogger(__name__) """ S...
code_fim
hard
{ "lang": "python", "repo": "zac-li/gh-app-starter-python", "path": "/bot_config.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> df = rc.DataFrame({'a': [1, 2, 3, 4], 'b': [4, 5, 6, 7], 'c': [7, 8, 9, None]}, index=[10, 11, 12, 99], columns=['a', 'b', 'c'], index_name='start_10', sort=False) # test that then using .index returns a view res = df.index res.append(100) assert res == [10, 11, ...
code_fim
hard
{ "lang": "python", "repo": "rsheftel/raccoon", "path": "/tests/test_dataframe/test_getters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rsheftel/raccoon path: /tests/test_dataframe/test_getters.py import pytest import raccoon as rc def test_columns(): actual = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 'c'], columns=['b', 'a']) names = actual.columns assert names == ['b', 'a'] assert isinst...
code_fim
hard
{ "lang": "python", "repo": "rsheftel/raccoon", "path": "/tests/test_dataframe/test_getters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # test that then using .index returns a view res = df.index res.append(100) assert res == [10, 11, 12, 99, 100] assert df.index == [10, 11, 12, 99, 100] def test_data(): actual = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 'c'], columns=['b', 'a']) assert ...
code_fim
hard
{ "lang": "python", "repo": "rsheftel/raccoon", "path": "/tests/test_dataframe/test_getters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pylab.subplot(212) pylab.plot(r,v,'x') pylab.xlabel('Radius') pylab.ylabel('Velocity') pylab.show()<|fim_prefix|># repo: bolverk/fujin path: /tests/srhd_sim/isentropic_flow_2nd_ord/plotit_rs.py #! /usr/bin/python import matplotlib matplotlib.use('Qt4Agg') import pylab import numpy import sys <|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "bolverk/fujin", "path": "/tests/srhd_sim/isentropic_flow_2nd_ord/plotit_rs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bolverk/fujin path: /tests/srhd_sim/isentropic_flow_2nd_ord/plotit_rs.py #! /usr/bin/python import matplotlib matplotlib.use('Qt4Agg') import pylab import numpy import sys <|fim_suffix|>pylab.subplot(211) pylab.plot(r,p,'x') pylab.xlabel('Radius') pylab.ylabel('Pressure') pylab.subplot(212) py...
code_fim
medium
{ "lang": "python", "repo": "bolverk/fujin", "path": "/tests/srhd_sim/isentropic_flow_2nd_ord/plotit_rs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Returns a string representation of the color conversion :param cv_code: :return: """ strs = {cv2.COLOR_BGR2GRAY:"bgr to gray", cv2.COLOR_BGR2HSV:"bgr to hsv", cv2.COLOR_BGR2Luv:"bgr to Luv", cv2.COLOR_BGR2XYZ:"bgr to xyz", cv2.COL...
code_fim
medium
{ "lang": "python", "repo": "blackzafiro/SmallDemos", "path": "/PyCretu/CvUtil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blackzafiro/SmallDemos path: /PyCretu/CvUtil.py import cv2 import sys def showChannels(img, ypos = 0, wait=False): """ Shows a window with the values in every channel of img. """ num_channels = img.shape[2] if len(img.shape) == 3 else 1 if num_channels == 1: label = 'One cha...
code_fim
medium
{ "lang": "python", "repo": "blackzafiro/SmallDemos", "path": "/PyCretu/CvUtil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("\n[INFO] deployment `nginx-deployment` created\n") # Listing deployment `nginx-deployment` in the `default` namespace deployment_created = api.get(name=name, namespace="default") print("%s\t%s\t\t\t%s\t%s" % ("NAMESPACE", "NAME", "REVISION", "RESTARTED-AT")) print( "%...
code_fim
hard
{ "lang": "python", "repo": "kubernetes-client/python", "path": "/examples/dynamic-client/deployment_rolling_restart.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("%s\t%s\t\t\t%s\t%s" % ("NAMESPACE", "NAME", "REVISION", "RESTARTED-AT")) print( "%s\t\t%s\t%s\t\t%s\n" % ( deployment_created.metadata.namespace, deployment_created.metadata.name, deployment_created.metadata.annotations, deploy...
code_fim
hard
{ "lang": "python", "repo": "kubernetes-client/python", "path": "/examples/dynamic-client/deployment_rolling_restart.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kubernetes-client/python path: /examples/dynamic-client/deployment_rolling_restart.py # Copyright 2021 The Kubernetes Authors. # # 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 copy of the Lice...
code_fim
hard
{ "lang": "python", "repo": "kubernetes-client/python", "path": "/examples/dynamic-client/deployment_rolling_restart.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print players[0] if __name__ == '__main__': main(sys.argv[1])<|fim_prefix|># repo: tdsymonds/codeeval path: /python/easy/(222) black-card.py import sys def main(filepath): with open(filepath, 'r') as f: for line in f.readlines(): if line: ...
code_fim
hard
{ "lang": "python", "repo": "tdsymonds/codeeval", "path": "/python/easy/(222) black-card.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdsymonds/codeeval path: /python/easy/(222) black-card.py import sys def main(filepath): with open(filepath, 'r') as f: for line in f.readlines(): if line: line = line.strip() line = line.split(' | ') <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "tdsymonds/codeeval", "path": "/python/easy/(222) black-card.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> i = 0 while number_of_players > 1: if (i+1) % number == 0: del players[i % number_of_players] number_of_players -= 1 i = 0 i += 1 print p...
code_fim
hard
{ "lang": "python", "repo": "tdsymonds/codeeval", "path": "/python/easy/(222) black-card.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FreddieWitherden/PyFR path: /pyfr/backends/metal/types.py from collections import defaultdict from functools import cached_property import numpy as np import pyfr.backends.base as base class MetalMatrixBase(base.MatrixBase): def onalloc(self, basedata, offset): self.basedata = bas...
code_fim
hard
{ "lang": "python", "repo": "FreddieWitherden/PyFR", "path": "/pyfr/backends/metal/types.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class MetalGraph(base.Graph): def __init__(self, backend): super().__init__(backend) self.klist = [] self.mpi_idxs = defaultdict(list) def add_mpi_req(self, req, deps=[]): super().add_mpi_req(req, deps) if deps: ix = max(self.knodes[d] for d...
code_fim
hard
{ "lang": "python", "repo": "FreddieWitherden/PyFR", "path": "/pyfr/backends/metal/types.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hugovk/warehouse path: /tests/unit/utils/test_security_policy.py # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
code_fim
hard
{ "lang": "python", "repo": "hugovk/warehouse", "path": "/tests/unit/utils/test_security_policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_reset(self): identity1 = pretend.stub() identity2 = pretend.stub() identities = iter([identity1, identity2]) subpolicies = [pretend.stub(identity=lambda r: next(identities))] policy = security_policy.MultiSecurityPolicy(subpolicies) request = ...
code_fim
hard
{ "lang": "python", "repo": "hugovk/warehouse", "path": "/tests/unit/utils/test_security_policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> total_new_messages += len(messages) logging.info("DOWNLOADED {} NEW MESSAGES IN ALL CHANNELS".format(total_new_messages)) def backfill_files(slack_token, save_folder): """Goes through all the referenced files in the history and attempt to download them if they aren't already downloaded."...
code_fim
hard
{ "lang": "python", "repo": "teshomegit/botty-bot-bot-bot", "path": "/utils/download-history.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Goes through all the referenced files in the history and attempt to download them if they aren't already downloaded.""" def get_history_files(save_folder): """Returns a mapping from channel IDs to absolute file paths of their history entries""" for dirpath, _, filenames in os.wa...
code_fim
hard
{ "lang": "python", "repo": "teshomegit/botty-bot-bot-bot", "path": "/utils/download-history.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }