text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: pawansharma01/recipe-app-api path: /app/app/skiptests.py from django.test import TestCase from app.calc import addNums, subtractNums <|fim_suffix|> class CalcTests(TestCase): def test_add_numbers(self): """ Test two numbers can be added together """ self.ass...
code_fim
medium
{ "lang": "python", "repo": "pawansharma01/recipe-app-api", "path": "/app/app/skiptests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_add_numbers(self): """ Test two numbers can be added together """ self.assertEqual(addNums(3, 8), 11) def test_subtract_numbers(self): """ TDD: test subtracting two numbers together """ self.assertEqual(subtractNums(5, 11), ...
code_fim
medium
{ "lang": "python", "repo": "pawansharma01/recipe-app-api", "path": "/app/app/skiptests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ TDD: test subtracting two numbers together """ self.assertEqual(subtractNums(5, 11), 6)<|fim_prefix|># repo: pawansharma01/recipe-app-api path: /app/app/skiptests.py from django.test import TestCase from app.calc import addNums, subtractNums <|fim_middle|>""" Added '...
code_fim
hard
{ "lang": "python", "repo": "pawansharma01/recipe-app-api", "path": "/app/app/skiptests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logger.debug("Stop request-response time measurement") now = datetime.now() delta = now - req.context["start_time"] session = self.Session() logger.debug("Assemble DB models") uag = get_or_create(session, UserAgent, text=req.user_agent) uri = get_or...
code_fim
hard
{ "lang": "python", "repo": "dmuhs/falcon-stats", "path": "/falconstats/middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmuhs/falcon-stats path: /falconstats/middleware.py import logging from datetime import datetime from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from .models import (IP, URI, Base, ContentType, Method, ReqRespInfo, Status, UserAgent, get_or_crea...
code_fim
hard
{ "lang": "python", "repo": "dmuhs/falcon-stats", "path": "/falconstats/middleware.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, debug=False, **kwargs): if not debug: logger.debug("Using MySQL connection at %s", kwargs["db_addr"]) DB = "mysql+pymysql://{}:{}@{}/{}".format( kwargs["db_user"], kwargs["db_pass"], kwargs["db_addr"], ...
code_fim
hard
{ "lang": "python", "repo": "dmuhs/falcon-stats", "path": "/falconstats/middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gpastor3/Google-ITAutomation-Python path: /Course_2/Week_2/lab_reading_and_writing_files.py """ This script is used for course notes. Author: Erick Marin Date: 11/28/2020 """ # Add guests to list guests = open("guests.txt", "w") initial_guests = ["Bob", "Andrea", "Manuel", "Polly", "Khalid"] f...
code_fim
medium
{ "lang": "python", "repo": "gpastor3/Google-ITAutomation-Python", "path": "/Course_2/Week_2/lab_reading_and_writing_files.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Check whether certain guests are still checked in. guests_to_check = ['Bob', 'Andrea'] checked_in = [] with open("guests.txt", "r") as guests: for g in guests: checked_in.append(g.strip()) for check in guests_to_check: if check in checked_in: print("{} is checked in"...
code_fim
hard
{ "lang": "python", "repo": "gpastor3/Google-ITAutomation-Python", "path": "/Course_2/Week_2/lab_reading_and_writing_files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(row, dict) and row: for idx in range(len(data.columns)): label = columns[idx]["label"] fieldname = columns[idx]["fieldname"] cell_value = row.get(fieldname, row.get(label, "")) row_data.append(cell_value) else: row_data = row result.append(row_data) return ...
code_fim
hard
{ "lang": "python", "repo": "neel-actual/erpx_hrm", "path": "/erpx_hrm/utils/query_report.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neel-actual/erpx_hrm path: /erpx_hrm/utils/query_report.py import frappe import json from erpnext.shopping_cart.cart import get_party from six import string_types, iteritems from frappe.desk.query_report import run, get_columns_dict @frappe.whitelist() def export_query(): """export from query ...
code_fim
hard
{ "lang": "python", "repo": "neel-actual/erpx_hrm", "path": "/erpx_hrm/utils/query_report.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # build table from result for i, row in enumerate(data.result): # only pick up rows that are visible in the report row_data = [] if isinstance(row, dict) and row: for idx in range(len(data.columns)): label = columns[idx]["label"] fieldname = columns[idx]["fieldname"] cell_value = r...
code_fim
hard
{ "lang": "python", "repo": "neel-actual/erpx_hrm", "path": "/erpx_hrm/utils/query_report.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_check_different_ipu_incompatibility(): session = create_session("ipu_model", 2) device = _to_device_info("ipu_model", 1) session._set_device(device) with pytest.raises(Exception): with session: pass<|fim_prefix|># repo: graphcore/popart path: /tests/integratio...
code_fim
hard
{ "lang": "python", "repo": "graphcore/popart", "path": "/tests/integration/popxl/test_session_set_device.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: graphcore/popart path: /tests/integration/popxl/test_session_set_device.py # Copyright (c) 2022 Graphcore Ltd. All rights reserved. import pytest import popxl from popxl import ops from popxl.utils import _to_device_info from popxl_test_device_helpers import get_test_device_with_timeout def cre...
code_fim
hard
{ "lang": "python", "repo": "graphcore/popart", "path": "/tests/integration/popxl/test_session_set_device.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> session = create_session("ipu_model", 2) device = _to_device_info("ipu_model", 1) session._set_device(device) with pytest.raises(Exception): with session: pass<|fim_prefix|># repo: graphcore/popart path: /tests/integration/popxl/test_session_set_device.py # Copyright (...
code_fim
hard
{ "lang": "python", "repo": "graphcore/popart", "path": "/tests/integration/popxl/test_session_set_device.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parent.ErrorCode = Lang.getLang("ErrorCode"); parent.ErrorInfo = Lang.getLang("LoadError"); actionResult.Result = False; return actionResult; # 更新属性加成 percent = 100.0; userSJTInfo = GameDataCacheSet[UserShengJiTa]().FindKey(userId); # 判断星星数是否足够兑换 if us...
code_fim
hard
{ "lang": "python", "repo": "sunyuping/Scut", "path": "/Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/PyScript/Action/action4408.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> if urlParam.propertyType == PropertyType.Life: userSJTInfo.LifeNum = userSJTInfo.LifeNum + (urlParam.starNum / percent); elif urlParam.propertyType == PropertyType.WuLi: userSJTInfo.WuLiNum = userSJTInfo.WuLiNum + (urlParam.starNum / percent); elif urlParam.propertyType == Prop...
code_fim
hard
{ "lang": "python", "repo": "sunyuping/Scut", "path": "/Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/PyScript/Action/action4408.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunyuping/Scut path: /Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/PyScript/Action/action4408.py import clr, sys import random import time import datetime clr.AddReference('ZyGames.Framework.Common'); clr.AddReference('ZyGames.Framework'); clr.AddReference('ZyGames.Framework.Game'); clr.A...
code_fim
hard
{ "lang": "python", "repo": "sunyuping/Scut", "path": "/Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/PyScript/Action/action4408.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: asamant/masters-thesis-sched-strat path: /strategy/strategy_parser.py #!/usr/bin/env python3 import strategy import os import re from itertools import islice import json # FIRST THE UTIL FUNCTION DEFINITIONS # https://stackoverflow.com/questions/22281059/set-object-is-not-json-serializable # T...
code_fim
hard
{ "lang": "python", "repo": "asamant/masters-thesis-sched-strat", "path": "/strategy/strategy_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # start with absolute limits cl1_low = cl1_min_abs cl1_high = cl1_max_abs cl2_low = cl2_min_abs cl2_high = cl2_max_abs # handle cases one by one clock_conditions = invariant.split('&&') clock_conditions = [condition.strip() ...
code_fim
hard
{ "lang": "python", "repo": "asamant/masters-thesis-sched-strat", "path": "/strategy/strategy_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_ackermann(a,b-1)) return ackermann_result print(recursive_ackermann(1,1)) # 3<|fim_prefix|># repo: hamidswer/recursive-ackermann path: /recursive-ackermann.py def recursive_ackermann(a,b): ackermann_result = 0 if( a==0 ): ackermann_result = b + 1 elif( b==0 ): ackermann_...
code_fim
medium
{ "lang": "python", "repo": "hamidswer/recursive-ackermann", "path": "/recursive-ackermann.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hamidswer/recursive-ackermann path: /recursive-ackermann.py def recursive_ackermann(a,b): ackermann_result = 0 if( a==0 ): ackermann_result = b + 1 elif( b==0 ): ackermann_result = recursive_acker<|fim_suffix|>_ackermann(a,b-1)) return ackermann_result print(recur...
code_fim
medium
{ "lang": "python", "repo": "hamidswer/recursive-ackermann", "path": "/recursive-ackermann.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> input_gt = tf.one_hot(input_gt, 2) print("shape: ", input_gt.shape) eps = 1e-5 inse = tf.reduce_sum(pred*input_gt) l = tf.reduce_sum(pred) r = tf.reduce_sum(input_gt) print(inse, l, r) dice = 2*inse/(l + r + eps) return -dice tf.enable_eager_execution() input_gt = np.o...
code_fim
hard
{ "lang": "python", "repo": "warmestwind/CV_Daily", "path": "/Segementaion/dice_loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: warmestwind/CV_Daily path: /Segementaion/dice_loss.py import numpy as np import tensorflow as tf pred = np.ones((1, 3, 3, 3, 2), dtype=np.float32) pred[..., 0] = 0 gt = np.ones((1, 3, 3, 3, 2), dtype=np.float32) gt[..., 0] = 0 <|fim_suffix|>def dice_loss_2(pred, input_gt): input_gt = tf.on...
code_fim
hard
{ "lang": "python", "repo": "warmestwind/CV_Daily", "path": "/Segementaion/dice_loss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ingest transformed features logger.info(f'Number of partitions = {df.rdd.getNumPartitions()}') # Rule of thumb heuristic - rely on the product of #executors by #executor.cores, and then multiply that by 3 or 4 df = df.repartition(total_cores * 3) logger.info(f'Number of partitions af...
code_fim
medium
{ "lang": "python", "repo": "sekR4/amazon-sagemaker-feature-store-end-to-end-workshop", "path": "/utilities/batch_ingest_sm_pyspark_bottom.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sekR4/amazon-sagemaker-feature-store-end-to-end-workshop path: /utilities/batch_ingest_sm_pyspark_bottom.py def apply_transforms(spark: SparkSession, df: DataFrame, fg_name: str) -> DataFrame: df.createOrReplaceTempView(fg_name) query = transform_query(fg_name) print(query) return...
code_fim
medium
{ "lang": "python", "repo": "sekR4/amazon-sagemaker-feature-store-end-to-end-workshop", "path": "/utilities/batch_ingest_sm_pyspark_bottom.py", "mode": "psm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagyist/deepx path: /deepx/nn/activations.py import six from abc import abstractmethod, ABCMeta from deepx.core import Op from deepx.nn.fc import FC from deepx.backend import T class Activation(Op): def __new__(cls, shape_in=None, shape_out=None, **kwargs): activation = super(Activ...
code_fim
hard
{ "lang": "python", "repo": "nagyist/deepx", "path": "/deepx/nn/activations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def activate(self, X): pass def __repr__(self): return "{}()".format(self.__class__.__name__) class Softmax(Activation): def __new__(cls, *args, **kwargs): return super(Softmax, cls).__new__(cls, *args, **kwargs) def __init__(self, temperatur...
code_fim
medium
{ "lang": "python", "repo": "nagyist/deepx", "path": "/deepx/nn/activations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcgreevy/chromium-infra path: /appengine/findit/waterfall/extract_signal_pipeline.py # Copyright 2015 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. import base64 import cStringIO import json import...
code_fim
hard
{ "lang": "python", "repo": "mcgreevy/chromium-infra", "path": "/appengine/findit/waterfall/extract_signal_pipeline.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not failed_test_log: return 'flaky' return failed_test_log class ExtractSignalPipeline(BasePipeline): """A pipeline to extract failure signals from each failed step.""" HTTP_CLIENT = HttpClientAppengine() # Limit stored log data to 1000 KB, because a datastore entity has a size # l...
code_fim
hard
{ "lang": "python", "repo": "mcgreevy/chromium-infra", "path": "/appengine/findit/waterfall/extract_signal_pipeline.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: OrBin/Smart_Bottle path: /src/outputs/main.py from json import load as json_load from gc import collect as gc_collect import time_utils from components import Components from network_wrapper import NetworkWrapper from utime import sleep def calculate_temperature_color(internal_temperature, ext...
code_fim
hard
{ "lang": "python", "repo": "OrBin/Smart_Bottle", "path": "/src/outputs/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Drinking notification if time_utils.check_drinking_notification_required(sensors_data['last-drinking-timestamp'] // 1000, last_notification_timestamp_sec, config['behavior']['required_drinking_frequency_minut...
code_fim
hard
{ "lang": "python", "repo": "OrBin/Smart_Bottle", "path": "/src/outputs/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VictorGrycuk/KeePassCommander path: /example/FromPython.py import inspect, os.path import sys import imp # get path of this file FromPython.py module_filename = inspect.getframeinfo(inspect.currentframe()).filename module_path = os.path.dirname(os.path.abspath(module_filename)) <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "VictorGrycuk/KeePassCommander", "path": "/example/FromPython.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># load KeePassEntry.py containing function KeePassEntry KeePassEntryModule = imp.load_source('KeePassEntryModule', KeePassEntry_py) # BEGIN example entry = KeePassEntryModule.KeePassEntry('Sample Entry') if (len(entry['title']) == 0): print "KeePass is not started" print "Has KeePassCommander.dll bee...
code_fim
hard
{ "lang": "python", "repo": "VictorGrycuk/KeePassCommander", "path": "/example/FromPython.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># BEGIN example entry = KeePassEntryModule.KeePassEntry('Sample Entry') if (len(entry['title']) == 0): print "KeePass is not started" print "Has KeePassCommander.dll been copied to the directory containing KeePass.exe ?" sys.exit(2) print "title : " + entry['title'] print "username : " + ent...
code_fim
medium
{ "lang": "python", "repo": "VictorGrycuk/KeePassCommander", "path": "/example/FromPython.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tubapala/peat path: /PEATDB/Ekin/Dataset.py #!/usr/bin/env python # # Protein Engineering Analysis Tool DataBase (PEATDB) # Copyright (C) 2010 Damien Farrell & Jens Erik Nielsen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public...
code_fim
hard
{ "lang": "python", "repo": "tubapala/peat", "path": "/PEATDB/Ekin/Dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Get average of x datapoints""" return min(self.getx()) def maxX(self): """Get average of x datapoints""" return max(self.getx()) def minY(self): """Get average of y datapoints""" return min(self.gety()) def maxY(self): """Get averag...
code_fim
hard
{ "lang": "python", "repo": "tubapala/peat", "path": "/PEATDB/Ekin/Dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thiagovas/Ultimate-Tic-Tac-Toe path: /tst/clash_of_titans.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Here be the CLASH OF TITANS!!! # Two AIs will face each other A HUNDRED TIMES! # And whoever beats the other more will be THE FUCKING WIIINNEEEERRR!!!! # # Play this before executing t...
code_fim
hard
{ "lang": "python", "repo": "thiagovas/Ultimate-Tic-Tac-Toe", "path": "/tst/clash_of_titans.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fight(big_board, small_boards, rev=False): p1AI = AlphaBetaAI() p1AI.set_payoff_table(PTable1()) p2AI = RandomAI() if rev: p1AI, p2AI = p2AI, p1AI player1 = Game(0, 0, small_boards, big_board, p1AI) player2 = Game(1, 0, small_boards, big_board, p2AI) last_move = [-1, -1, -1...
code_fim
hard
{ "lang": "python", "repo": "thiagovas/Ultimate-Tic-Tac-Toe", "path": "/tst/clash_of_titans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: malave/mason path: /mason/engines/metastore/models/database/__init__.py from typing import List from mason.clients.responsable import Responsable from mason.clients.response import Response from mason.engines.metastore.models.table.table import TableList class Database(Responsable): <|fim_suf...
code_fim
hard
{ "lang": "python", "repo": "malave/mason", "path": "/mason/engines/metastore/models/database/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, databases: List[Database], invalid_databases: List[InvalidDatabase]): self.databases = databases self.invalid_databases = invalid_databases def to_response(self, response: Response = Response()): for invalid in self.invalid_databases: ...
code_fim
medium
{ "lang": "python", "repo": "malave/mason", "path": "/mason/engines/metastore/models/database/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_CircuitPython_BMP280 path: /examples/bmp280_simpletest.py # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT """Simpletest Example that shows how to get temperature, pressure, and altitude readings from a BMP280""" import time impor...
code_fim
medium
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_BMP280", "path": "/examples/bmp280_simpletest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># change this to match the location's pressure (hPa) at sea level bmp280.sea_level_pressure = 1013.25 while True: print("\nTemperature: %0.1f C" % bmp280.temperature) print("Pressure: %0.1f hPa" % bmp280.pressure) print("Altitude = %0.2f meters" % bmp280.altitude) time.sleep(2)<|fim_prefi...
code_fim
medium
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_BMP280", "path": "/examples/bmp280_simpletest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pd.options.display.max_colwidth = 80 pd.options.display.max_rows = None pd.options.display.precision = 2 pd.options.display.float_format = (lambda x: __format_significant_digits(x, pd.options.display.precision))<|fim_prefix|># repo: CDLUC3/merritt-aws path: /src/config.py import matplotlib.pyplot as plt...
code_fim
medium
{ "lang": "python", "repo": "CDLUC3/merritt-aws", "path": "/src/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CDLUC3/merritt-aws path: /src/config.py import matplotlib.pyplot as plt import numpy as np import pandas as pd <|fim_suffix|>pd.options.display.latex.repr = True pd.options.display.max_colwidth = 80 pd.options.display.max_rows = None pd.options.display.precision = 2 pd.options.display.float_fo...
code_fim
hard
{ "lang": "python", "repo": "CDLUC3/merritt-aws", "path": "/src/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pd.options.display.precision = 2 pd.options.display.float_format = (lambda x: __format_significant_digits(x, pd.options.display.precision))<|fim_prefix|># repo: CDLUC3/merritt-aws path: /src/config.py import matplotlib.pyplot as plt import numpy as np import pandas as pd # ------------------------------...
code_fim
medium
{ "lang": "python", "repo": "CDLUC3/merritt-aws", "path": "/src/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def makePlist(self, destUrlPath): t = Template(PLIST_TEMPLATE) plist = t.render(ipaUrl=urljoin(destUrlPath, self.__ipaFileName + '.ipa'), adhocBundleVersion=self.__adhocShortVersion, adhocBundleIdentifier=self.__adhocBundleIdentifier, ...
code_fim
hard
{ "lang": "python", "repo": "hoiogi/pyipa_dist", "path": "/pyipa_dist/PlistMaker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hoiogi/pyipa_dist path: /pyipa_dist/PlistMaker.py # -*- coding: utf-8 -*- PLIST_TEMPLATE=''' <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>items</key> <array> <di...
code_fim
medium
{ "lang": "python", "repo": "hoiogi/pyipa_dist", "path": "/pyipa_dist/PlistMaker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.__adhocShortVersion = self.__ipaInfo['CFBundleShortVersionString'] self.__adhocBundleIdentifier = self.__ipaInfo['CFBundleIdentifier'] self.__adhocBundleName = self.__ipaInfo['CFBundleName'] self.__ipaFileName = os.path.splitext(ipaFilePath)[0] def makePlist(self,...
code_fim
hard
{ "lang": "python", "repo": "hoiogi/pyipa_dist", "path": "/pyipa_dist/PlistMaker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MissRitter/AirbnbSeattle_price_analysis path: /ExploreData.py #import numpy as np import pandas as pd def cols_nan_ratio(df, nan_ratio, bigger=True) : ''' Returns 'df's column names for columns with a ratio of more than 'nan_ratio' NaN values if 'bigger' = True, or if 'bigger' = Fal...
code_fim
hard
{ "lang": "python", "repo": "MissRitter/AirbnbSeattle_price_analysis", "path": "/ExploreData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> OUTPUT (pd.Index): search results ''' if col_bool == True: search_series = df.columns.to_series() bool_series = search_series.str.contains('|'.join(key_list),case=False) return df.columns[bool_series] else: search_series = df.index.to_series() bool...
code_fim
hard
{ "lang": "python", "repo": "MissRitter/AirbnbSeattle_price_analysis", "path": "/ExploreData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Selects two columns from 'df' 'column_group' and 'column' and groups by 'column_group' turning it into the index. It returns a sorted pd.Series. If 'sort_index' is True it sorts the index otherwise the data ('column'). INPUT: df (pd.DataFrame) columns_group (str) ...
code_fim
hard
{ "lang": "python", "repo": "MissRitter/AirbnbSeattle_price_analysis", "path": "/ExploreData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huyvuong/bamsurgeon path: /addsnv.py #!/usr/bin/env python import sys import pysam import argparse import random import subprocess import os import bs.replacereads as rr from collections import Counter def majorbase(basepile): """returns tuple: (major base, count) """ return Counter...
code_fim
hard
{ "lang": "python", "repo": "huyvuong/bamsurgeon", "path": "/addsnv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> log = open(args.outBamFile + ".log",'w') snvfrac = float(args.snvfrac) for bedline in bedfile: if len(tmpbams) < int(args.numsnvs) or int(args.numsnvs) == 0: c = bedline.strip().split() chrom = c[0] start = int(c[1]) end = int(c[2])...
code_fim
hard
{ "lang": "python", "repo": "huyvuong/bamsurgeon", "path": "/addsnv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ model = Tile conditions = [model.status == "raw"] groups = ["preprocess", "read"] production_procno = 1 def read_dat(self, fp): arr = np.genfromtxt( fp, skip_header=EPOCHS, dtype=SOURCE_DTYPE, usecols=USECOLS) flt = ( ...
code_fim
hard
{ "lang": "python", "repo": "carpyncho/carpyncho", "path": "/carpyncho/steps/read_tile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: carpyncho/carpyncho path: /carpyncho/steps/read_tile.py #!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= # IMPORTS # ============================================================================= from corral import run ...
code_fim
hard
{ "lang": "python", "repo": "carpyncho/carpyncho", "path": "/carpyncho/steps/read_tile.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def _apis_to_rules(apis): rules = '' for api in apis: rules += _api_to_rule(api['name'], api['functions']) return rules def find_api(binary, apis): '''Find crypto api names in binary Parameters ---------- binary: bytes Target binary to search for. apis: L...
code_fim
medium
{ "lang": "python", "repo": "oalieno/cryfind", "path": "/crylib/findapi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oalieno/cryfind path: /crylib/findapi.py from collections import defaultdict import yara def _api_to_rule(name, functions, _ctr=[0]): _ctr[0] += 1 rules = f'''rule api_{_ctr[0]} {{ meta: name = "{name}" strings: ''' for i, function in enumerate(functions): ...
code_fim
medium
{ "lang": "python", "repo": "oalieno/cryfind", "path": "/crylib/findapi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Examples -------- >>> results = find_api(b'......A_SHAFinal.....', [{'name': 'advapi32.dll', 'functions': ['A_SHAFinal', 'A_SHAInit']}]) >>> print(results[0]) {'name': 'advapi32.dll', 'functions': [{'name': 'A_SHAFinal', 'addresses': [6]}]} ''' rules = _apis_to_rules(apis) ...
code_fim
medium
{ "lang": "python", "repo": "oalieno/cryfind", "path": "/crylib/findapi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: unfoldingWord-dev/tools path: /usfm/integrateFootnotes.py # -*- coding: utf-8 -*- # This script merges the footnotes marked with \footnote into the appropriate location in the USFM text. # This script was originally written for Assamese books done in MS Word. # I enhanced it to handle Urdu books,...
code_fim
hard
{ "lang": "python", "repo": "unfoldingWord-dev/tools", "path": "/usfm/integrateFootnotes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>chapter_re = re.compile(r'\\c +([\d]+)') v_re = re.compile(r'\\v +([0-9]+)') vv_re = re.compile(r'\\v +([0-9]+)-([0-9]+)') # Returns a set of verse numbers that are included on the specified line # If the line does not start with a verse marker, prevn is included in the list. def listVerses(line, prevn):...
code_fim
hard
{ "lang": "python", "repo": "unfoldingWord-dev/tools", "path": "/usfm/integrateFootnotes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: drgriffis/ELMo-WSD-reimplementation path: /wsd/dataset.py ''' Data access wrappers for WSD datasets in Raganato et al WSD Evaluation Framework project ''' from lib import wsd_parser class WSDDataset: def __init__(self, config, name): self.config = config self.name = name ...
code_fim
hard
{ "lang": "python", "repo": "drgriffis/ELMo-WSD-reimplementation", "path": "/wsd/dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if test_only: lst = [] else: lst = [SemCor(config)] lst.extend([ SemEval2007(config), SemEval2013(config), SemEval2015(config), SensEval2(config), SensEval3(config) ]) return lst<|fim_prefix|># repo: drgriffis/ELMo-WSD-reimplement...
code_fim
hard
{ "lang": "python", "repo": "drgriffis/ELMo-WSD-reimplementation", "path": "/wsd/dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tilde-lab/yascheduler path: /yascheduler/daemon_systemd.py #!/usr/bin/env python """ Yascheduler systemd daemon """ <|fim_suffix|> daemonize(log_file=LOG_FILE)<|fim_middle|>if __name__ == "__main__": from yascheduler import LOG_FILE from yascheduler.utils import daemonize
code_fim
medium
{ "lang": "python", "repo": "tilde-lab/yascheduler", "path": "/yascheduler/daemon_systemd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> daemonize(log_file=LOG_FILE)<|fim_prefix|># repo: tilde-lab/yascheduler path: /yascheduler/daemon_systemd.py #!/usr/bin/env python """ Yascheduler systemd daemon """ <|fim_middle|>if __name__ == "__main__": from yascheduler import LOG_FILE from yascheduler.utils import daemonize
code_fim
medium
{ "lang": "python", "repo": "tilde-lab/yascheduler", "path": "/yascheduler/daemon_systemd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- output : tuple This structure contains the outputs of the jobs given """ if logger is None: logger = logging.getLogger() root_handlers = logging.root.handlers for handler in root_handlers: if "baseFilename" in handler.__dict__: ...
code_fim
hard
{ "lang": "python", "repo": "jaclark5/despasito", "path": "/despasito/utils/parallelization.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> logger.addHandler(handler) def pool_job(self, func, inputs): """ This function will setup and dispatch thermodynamic or parameter fitting jobs. Parameters ---------- func : function Function used in job inputs : list[tuple] ...
code_fim
hard
{ "lang": "python", "repo": "jaclark5/despasito", "path": "/despasito/utils/parallelization.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaclark5/despasito path: /despasito/utils/parallelization.py """ Parallelization class to handle processing threads and logging. """ import numpy as np import multiprocessing import logging import logging.handlers import os import glob logger = logging.getLogger(__name__) class Multiprocess...
code_fim
hard
{ "lang": "python", "repo": "jaclark5/despasito", "path": "/despasito/utils/parallelization.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>TARGET = "target" SLUSH = "slush" DATE = "date"<|fim_prefix|># repo: spaderthomas/tdbudget path: /tdbudget/keys.py CATEGORY_NAME = "name" LONG_TERM = "long_term" MONTH_START = "month_start" MONTHLY = "monthly<|fim_middle|>" NAME = "name" CONTRIBUTION = "contribution"
code_fim
easy
{ "lang": "python", "repo": "spaderthomas/tdbudget", "path": "/tdbudget/keys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spaderthomas/tdbudget path: /tdbudget/keys.py CATEGORY_NAME = "name" LONG_TERM = "long_term" MONTH_START = "month_start" MONTHLY = "monthly<|fim_suffix|>TARGET = "target" SLUSH = "slush" DATE = "date"<|fim_middle|>" NAME = "name" CONTRIBUTION = "contribution"
code_fim
easy
{ "lang": "python", "repo": "spaderthomas/tdbudget", "path": "/tdbudget/keys.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sudo-Kid/pyem7 path: /pyem7/discovery.py """Will need to update payload later to remove ip_address""" from urllib.parse import urljoin from .base_api import BaseAPI from .custom_errors import Exists class Discovery(BaseAPI): # A list of all arguments for a Discovery keyword_arguments =...
code_fim
medium
{ "lang": "python", "repo": "Sudo-Kid/pyem7", "path": "/pyem7/discovery.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> exists = cls.find(uri='/api/device', search_spec=search_spec, search_string=search_string, extended_fetch=False) if not exists.json(): return cls.post(cls.uri_active, payload) else: return exists @classmethod def check(cls...
code_fim
hard
{ "lang": "python", "repo": "Sudo-Kid/pyem7", "path": "/pyem7/discovery.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Moeinh77/pyERA path: /examples/ex_icub_trust_cognitive_architecture/reinforcement_learning.py (accept,reject) @param informant_vector: a list of list containing a binomial distribution which represents the reliability of the informant. For example: informant_vector...
code_fim
hard
{ "lang": "python", "repo": "Moeinh77/pyERA", "path": "/examples/ex_icub_trust_cognitive_architecture/reinforcement_learning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Moeinh77/pyERA path: /examples/ex_icub_trust_cognitive_architecture/reinforcement_learning.py ions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KI...
code_fim
hard
{ "lang": "python", "repo": "Moeinh77/pyERA", "path": "/examples/ex_icub_trust_cognitive_architecture/reinforcement_learning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 3- (External) New state and reward obtained from the environment # u_t = self.critic_vector[0, col] # previous state # New state is estimated, in this simple case nothing happen # because the next state is terminal # u_t1 =...
code_fim
hard
{ "lang": "python", "repo": "Moeinh77/pyERA", "path": "/examples/ex_icub_trust_cognitive_architecture/reinforcement_learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = ring.set_stats(area, size, box) assert result is None assert ring.area == area assert ring.size == size assert ring.box == box<|fim_prefix|># repo: vincentsarago/wagyu path: /tests/binding_tests/ring_tests/test_set_stats.py from _wagyu import (Box, Ring) ...
code_fim
medium
{ "lang": "python", "repo": "vincentsarago/wagyu", "path": "/tests/binding_tests/ring_tests/test_set_stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vincentsarago/wagyu path: /tests/binding_tests/ring_tests/test_set_stats.py from _wagyu import (Box, Ring) from hypothesis import given from . import strategies <|fim_suffix|> assert result is None assert ring.area == area assert ring.size == size assert ring....
code_fim
medium
{ "lang": "python", "repo": "vincentsarago/wagyu", "path": "/tests/binding_tests/ring_tests/test_set_stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert result is None assert ring.area == area assert ring.size == size assert ring.box == box<|fim_prefix|># repo: vincentsarago/wagyu path: /tests/binding_tests/ring_tests/test_set_stats.py from _wagyu import (Box, Ring) from hypothesis import given from . import st...
code_fim
medium
{ "lang": "python", "repo": "vincentsarago/wagyu", "path": "/tests/binding_tests/ring_tests/test_set_stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def remove_graph(self, graph) -> None: ... def query(self, query, initNs, initBindings, queryGraph, **kwargs) -> None: ... def update(self, update, initNs, initBindings, queryGraph, **kwargs) -> None: ...<|fim_prefix|># repo: common-workflow-language/cwlprov-py path: /typeshed/rdflib/plugins/...
code_fim
hard
{ "lang": "python", "repo": "common-workflow-language/cwlprov-py", "path": "/typeshed/rdflib/plugins/stores/memory.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: common-workflow-language/cwlprov-py path: /typeshed/rdflib/plugins/stores/memory.pyi from collections.abc import Generator from rdflib.store import Store from typing import Any class SimpleMemory(Store): identifier: Any def __init__(self, configuration: Any | None = ..., identifier: Any ...
code_fim
hard
{ "lang": "python", "repo": "common-workflow-language/cwlprov-py", "path": "/typeshed/rdflib/plugins/stores/memory.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def namespaces(self) -> Generator[Any, None, None]: ... def contexts(self, triple: Any | None = ...): ... def __len__(self, context: Any | None = ...): ... def add_graph(self, graph) -> None: ... def remove_graph(self, graph) -> None: ... def query(self, query, initNs, initBindings...
code_fim
hard
{ "lang": "python", "repo": "common-workflow-language/cwlprov-py", "path": "/typeshed/rdflib/plugins/stores/memory.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: johnlwhiteman/CoCoScatS path: /clean.py import argparse import glob import os from Core.Cfg import Cfg from Core.Directory import Directory from Core.Error import Error from Core.File import File def deleteSafe(): try: for path in [ "./", "./Core", ...
code_fim
hard
{ "lang": "python", "repo": "johnlwhiteman/CoCoScatS", "path": "/clean.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: cfg = Cfg(cfgPath) cfg.load() for path in [ "./Database/{0}.db".format(cfg.cfg["Database"]["Name"]), "./Database/CocoscatsTest.db", "./Vault/Certificate.pem", "./Vault/Password.json", "./Vault/PrivateKey.pem", ...
code_fim
hard
{ "lang": "python", "repo": "johnlwhiteman/CoCoScatS", "path": "/clean.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": cfgPath = "cfg.json" parser = argparse.ArgumentParser( \ prog=os.path.basename(__file__), description="Cocoscats directory cleanup script", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("-c", "--cfg", metavar="'cf...
code_fim
hard
{ "lang": "python", "repo": "johnlwhiteman/CoCoScatS", "path": "/clean.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Deep-Spark/DeepSparkHub path: /cv/detection/autoassign/pytorch/mmdet/core/export/__init__.py # Copyright (c) OpenMMLab. All rights reserved. from .onnx_helper import (add_dummy_nms_for_onnx, dynamic_clip_for_onnx, <|fim_suffix|>uts_and_wrap_model', 'preprocess_example_input', 'get_k_f...
code_fim
hard
{ "lang": "python", "repo": "Deep-Spark/DeepSparkHub", "path": "/cv/detection/autoassign/pytorch/mmdet/core/export/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>s_and_wrap_model, preprocess_example_input) __all__ = [ 'build_model_from_cfg', 'generate_inputs_and_wrap_model', 'preprocess_example_input', 'get_k_for_topk', 'add_dummy_nms_for_onnx', 'dynamic_clip_for_onnx' ]<|fim_prefix|># repo: Deep-Spark/DeepSparkHub p...
code_fim
hard
{ "lang": "python", "repo": "Deep-Spark/DeepSparkHub", "path": "/cv/detection/autoassign/pytorch/mmdet/core/export/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>uts_and_wrap_model', 'preprocess_example_input', 'get_k_for_topk', 'add_dummy_nms_for_onnx', 'dynamic_clip_for_onnx' ]<|fim_prefix|># repo: Deep-Spark/DeepSparkHub path: /cv/detection/autoassign/pytorch/mmdet/core/export/__init__.py # Copyright (c) OpenMMLab. All rights reserved. from .onnx_h...
code_fim
hard
{ "lang": "python", "repo": "Deep-Spark/DeepSparkHub", "path": "/cv/detection/autoassign/pytorch/mmdet/core/export/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#ax.set_xlabel('years' ) #ax.set_ylabel('number of institutions') ax.set_title('number of institutions involved in AWE', pad=20) plt.tight_layout() plt.savefig("awe-emergence.svg") plt.show()<|fim_prefix|># repo: rschmehl/awesco.eu path: /content/awe-explained/awe-emergence.py # -*- coding: utf-8 -*- "...
code_fim
hard
{ "lang": "python", "repo": "rschmehl/awesco.eu", "path": "/content/awe-explained/awe-emergence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rschmehl/awesco.eu path: /content/awe-explained/awe-emergence.py # -*- coding: utf-8 -*- """ Created on Tue Sep 27 07:09:55 2016 @author: rschmehl """ import matplotlib as mpl import matplotlib.pyplot as plt from pylab import np mpl.rcParams['font.family'] = "Open Sans" mpl.rcParams.update({'fon...
code_fim
hard
{ "lang": "python", "repo": "rschmehl/awesco.eu", "path": "/content/awe-explained/awe-emergence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EomAA/pfibs path: /test/demos/test_undocumented.py import pytest from os.path import abspath, basename, dirname, join import subprocess, glob, sys <|fim_suffix|>def test_demo_runs(demo_file): subprocess.check_call([sys.executable,demo_file])<|fim_middle|>cwd = abspath(dirname(__file__)) demo...
code_fim
hard
{ "lang": "python", "repo": "EomAA/pfibs", "path": "/test/demos/test_undocumented.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture(params=glob.glob("%s/*/*.py" % demo_dir), ids=lambda x: basename(dirname(x)) + "/" + basename(x)) def demo_file(request): return abspath(request.param) def test_demo_runs(demo_file): subprocess.check_call([sys.executable,demo_file])<|fim_prefix|># repo: EomAA/pfibs...
code_fim
medium
{ "lang": "python", "repo": "EomAA/pfibs", "path": "/test/demos/test_undocumented.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: henryneu/Python path: /sample/fun.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import sqrt from math import sin # 函数作为参数传入 # 使用可变参数 def same(x, *fs): f = [f(x) for f in fs] return f def do_fun(x=[], *fu): <|fim_suffix|>print(same(3, abs, sqrt, sin)) print(do_fun([1, 2, 4, 9], ...
code_fim
easy
{ "lang": "python", "repo": "henryneu/Python", "path": "/sample/fun.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> f = [f(x) for f in fs] return f def do_fun(x=[], *fu): fx = [f(x_i) for x_i in x for f in fu] return fx print(same(3, abs, sqrt, sin)) print(do_fun([1, 2, 4, 9], abs, sqrt, sin))<|fim_prefix|># repo: henryneu/Python path: /sample/fun.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from math impo...
code_fim
easy
{ "lang": "python", "repo": "henryneu/Python", "path": "/sample/fun.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: henryneu/Python path: /sample/fun.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- <|fim_suffix|>def do_fun(x=[], *fu): fx = [f(x_i) for x_i in x for f in fu] return fx print(same(3, abs, sqrt, sin)) print(do_fun([1, 2, 4, 9], abs, sqrt, sin))<|fim_middle|>from math import sqrt from math imp...
code_fim
medium
{ "lang": "python", "repo": "henryneu/Python", "path": "/sample/fun.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ecmwf-projects/dasi path: /pydasi/src/dasi/retrieve.py # Copyright 2023 European Centre for Medium-Range Weather Forecasts (ECMWF) # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "ecmwf-projects/dasi", "path": "/pydasi/src/dasi/retrieve.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._cdata = new_retrieve(dasi, query) self._log.debug("- retrieve count: %d", len(self)) def __iter__(self): return self def __next__(self): stat = lib.dasi_retrieve_next(self._cdata) if stat == lib.DASI_ITERATION_COMPLETE: raise StopIterati...
code_fim
hard
{ "lang": "python", "repo": "ecmwf-projects/dasi", "path": "/pydasi/src/dasi/retrieve.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.__key = Key(ckey) self.__data = data self.__timestamp = ctime[0] self.__offset = coffset[0] self.__length = clength[0] @property def key(self): return self.__key @property def data(self): return self.__data @property d...
code_fim
hard
{ "lang": "python", "repo": "ecmwf-projects/dasi", "path": "/pydasi/src/dasi/retrieve.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for annotation in annotations: x, y, w, h = annotation.get('bbox', []) g.write('{},{},{},{},{},{}\n'.format( join(image_paths.get(annotation.get('image_id'))), int(float(x)), int(float(y)), int(x + w), int(y + h), category...
code_fim
hard
{ "lang": "python", "repo": "tanmay-dhasade/ffhs-bachelor-thesis-wound-detection", "path": "/suite/utils/convert_to_csv.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: tanmay-dhasade/ffhs-bachelor-thesis-wound-detection path: /suite/utils/convert_to_csv.py import json from os.path import join if __name__ == '__main__': base = 'data/vanilla_datasets/puppet_measure_bands/' image_paths = {} category_names = {} with open(join(base, 'annotations.j...
code_fim
hard
{ "lang": "python", "repo": "tanmay-dhasade/ffhs-bachelor-thesis-wound-detection", "path": "/suite/utils/convert_to_csv.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> # for i in params: # item = i.split('=') # o[item[0]] = item[1] o = dict(item.split("=", 1) for item in params) return o<|fim_prefix|># repo: ViaQ/watches-cli path: /tests/commands/secure_support.py import os from unittest import TestCase class TestSecu...
code_fim
hard
{ "lang": "python", "repo": "ViaQ/watches-cli", "path": "/tests/commands/secure_support.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ViaQ/watches-cli path: /tests/commands/secure_support.py import os from unittest import TestCase class TestSecureSupport(TestCase): """ Support for tests running in secured context. """ # Values compatible with setup script _sec = { '--url': 'https://localhost:920...
code_fim
medium
{ "lang": "python", "repo": "ViaQ/watches-cli", "path": "/tests/commands/secure_support.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }