text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def _get_answer(context, context_words, answer_start, answer_end): """Get answer given context, context_words, and span. Args: context: A list of bytes, to be decoded with utf-8. context_words: A list of a list of bytes, to be decoded with utf-8. answer_start: An int for answer start. ...
code_fim
hard
{ "lang": "python", "repo": "sahn93/multilevel-skim-rnn", "path": "/squad_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _exact_match_score(prediction, ground_truths, has_answer, answer_mask): prediction = prediction.decode('utf-8') ground_truths = [ ground_truth.decode('utf-8') for ground_truth in ground_truths ] if not has_answer: return float(ground_truths[0] == squad_prepro.NO_ANSWER) elif groun...
code_fim
hard
{ "lang": "python", "repo": "sahn93/multilevel-skim-rnn", "path": "/squad_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sahn93/multilevel-skim-rnn path: /squad_data.py r 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
code_fim
hard
{ "lang": "python", "repo": "sahn93/multilevel-skim-rnn", "path": "/squad_data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bozzzzo/quark path: /quarkc/test/emit/expected/py/quark/quark_ws4py_fixup.py """ Carry a copy of ws4py fix [1] until it gets merged upstream [1] https://github.com/Lawouach/WebSocket-for-Python/pull/185 """ import logging import sys import itertools import operator from wsgiref.handlers import ...
code_fim
medium
{ "lang": "python", "repo": "bozzzzo/quark", "path": "/quarkc/test/emit/expected/py/quark/quark_ws4py_fixup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Completes the response and performs the following tasks: - Remove the `'ws4py.socket'` and `'ws4py.websocket'` environ keys. - Attach the returned websocket, if any, to the WSGI server using its ``link_websocket_to_server`` method. """ ...
code_fim
hard
{ "lang": "python", "repo": "bozzzzo/quark", "path": "/quarkc/test/emit/expected/py/quark/quark_ws4py_fixup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ [OCI.MySQLDatabaseService.3] MySQL Database Systems should have Crash Recovery enabled """ # ISO Time iso8601Time = datetime.datetime.now(datetime.timezone.utc).isoformat() for mysqldbs in get_mysql_db_systems(cache, ociTenancyId, ociUserId, ociRegionName, ociCompartments, ociU...
code_fim
hard
{ "lang": "python", "repo": "jonrau1/ElectricEye", "path": "/eeauditor/auditors/oci/OCI_MySQL_DatabaseService_Auditor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if mysqldbs["crash_recovery"] != "ENABLED": finding = { "SchemaVersion": "2018-10-08", "Id": f"{ociTenancyId}/{ociRegionName}/{compartmentId}/{mysqldbsId}/oci-mysql-dbs-crash-recovery-check", "ProductArn": f"arn:{awsPartition}:securityhub...
code_fim
hard
{ "lang": "python", "repo": "jonrau1/ElectricEye", "path": "/eeauditor/auditors/oci/OCI_MySQL_DatabaseService_Auditor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonrau1/ElectricEye path: /eeauditor/auditors/oci/OCI_MySQL_DatabaseService_Auditor.py "Id": mysqldbsId, "CreatedAt": createdAt, "LifecycleState": lbLifecycleState } } ...
code_fim
hard
{ "lang": "python", "repo": "jonrau1/ElectricEye", "path": "/eeauditor/auditors/oci/OCI_MySQL_DatabaseService_Auditor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: FSCM6/cdesf2 path: /cdesf2/utils/metrics.py from typing import List, Tuple import pandas as pd from datetime import datetime from os import makedirs import json import networkx as nx from ..data_structures import Case, Cluster from ..visualization import save_graphviz class Metrics: """ ...
code_fim
hard
{ "lang": "python", "repo": "FSCM6/cdesf2", "path": "/cdesf2/utils/metrics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def save_cluster_metrics_on_check_point(self) -> None: """ Saves the cluster metrics into a file according to a set path and name. Also releases the cluster_metrics attribute """ pd.read_csv(f'{self.path_to_cluster_metrics}/{self.file_name}.csv')\ .a...
code_fim
hard
{ "lang": "python", "repo": "FSCM6/cdesf2", "path": "/cdesf2/utils/metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Saves the Process Model Graph at all check points in a JSON file and plots Parameters -------------------------------------- process_model_graph: nx.DiGraph Process model graph on the current check point cp_count: int Current che...
code_fim
hard
{ "lang": "python", "repo": "FSCM6/cdesf2", "path": "/cdesf2/utils/metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if(key=='aZLDqiXzg9bWmBd1R7coAMKp9LL2'): for v in value: for key1,value1 in value.iteritems(): for key2,value2 in value1.iteritems(): print(key2) for key in value2: if(key=='update'): if(value2[key]==1): #appairage L1.append(value2['addr']) L2.appen...
code_fim
hard
{ "lang": "python", "repo": "Omaroid/IOT-Fireman", "path": "/Raspberry/firebase_update.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Omaroid/IOT-Fireman path: /Raspberry/firebase_update.py from firebase import firebase import time import subprocess import bluetooth firebase=firebase.FirebaseApplication('https://fireman-c4326.firebaseio.com/'); result = firebase.get('/users', None) <|fim_suffix|> print(L1) prin...
code_fim
hard
{ "lang": "python", "repo": "Omaroid/IOT-Fireman", "path": "/Raspberry/firebase_update.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> firebase.put('users/aZLDqiXzg9bWmBd1R7coAMKp9LL2/rooms/'+key2,"update",0) for i in range(len(L1)): subprocess.call("kill -9 `pidof bt-agent`",shell=True) ...
code_fim
hard
{ "lang": "python", "repo": "Omaroid/IOT-Fireman", "path": "/Raspberry/firebase_update.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: charutomo/SOC path: /DCEL/Room Allocation.py # -*- coding: utf-8 -*- """ Created on Mon Mar 15 22:00:23 2021 @author: Charissa """ from DCEL.DCEL import DCEL class Room(DCEL): def __init__(self,pathwaywidth): <|fim_suffix|> ''' gives the room allocation consider...
code_fim
medium
{ "lang": "python", "repo": "charutomo/SOC", "path": "/DCEL/Room Allocation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' gives the room allocation considering the pathway widths Returns ------- returns DCEL with the dimensions and division of the voronoi diagram ''' for i in self.edges: self.edges += self.width<|fim_prefix|># repo: charutomo/...
code_fim
medium
{ "lang": "python", "repo": "charutomo/SOC", "path": "/DCEL/Room Allocation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: culqi/culqi-python path: /tests/test_refund.py import os import unittest from copy import deepcopy import pytest from dotenv import load_dotenv from culqi import __version__ from culqi.client import Culqi from culqi.resources import Refund from .data import Data class RefundTest(unittest.Tes...
code_fim
hard
{ "lang": "python", "repo": "culqi/culqi-python", "path": "/tests/test_refund.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> created_refund = self.refund.create(data=self.refund_data) retrieved_refund = self.refund.read(created_refund["data"]["id"]) assert created_refund["data"]["id"] == retrieved_refund["data"]["id"] @pytest.mark.vcr() def test_refund_list(self): retrieved_refund_list ...
code_fim
hard
{ "lang": "python", "repo": "culqi/culqi-python", "path": "/tests/test_refund.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hosts['bob'].add_connection('00000011') hosts['eve'].add_connection('00000001') hosts['alice'].start() hosts['bob'].start() hosts['eve'].start() for h in hosts.values(): self.network.add_host(h) q = Qubi...
code_fim
hard
{ "lang": "python", "repo": "h-oll/QuNetSim", "path": "/old_tests/test_multi_hop.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: h-oll/QuNetSim path: /old_tests/test_multi_hop.py import unittest import time import sys import os from cqc.pythonLib import CQCConnection from simulaqron.network import Network as SimulaNetwork from simulaqron.settings import simulaqron_settings sys.path.append("../..") from components.host im...
code_fim
hard
{ "lang": "python", "repo": "h-oll/QuNetSim", "path": "/old_tests/test_multi_hop.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> messages = hosts['bob'].classical i = 0 while i < TestTwoHop.MAX_WAIT and len(messages) == 0: messages = hosts['bob'].classical i += 1 time.sleep(1) self.assertTrue(len(messages) > 0) self.assertEq...
code_fim
hard
{ "lang": "python", "repo": "h-oll/QuNetSim", "path": "/old_tests/test_multi_hop.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def compute_metrics(data, target, pred_transforms): """Compute metrics required in the paper """ def square_distance(src, dst): return torch.sum((src[:, :, None, :] - dst[:, None, :, :]) ** 2, dim=-1) with torch.no_grad(): pred_transforms = pred_transforms gt_tra...
code_fim
hard
{ "lang": "python", "repo": "VCLMW-Pose/torchlearning-benchmark", "path": "/engine/data/datasets/evaluation/modelnet_eval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Compute metrics required in the paper """ def square_distance(src, dst): return torch.sum((src[:, :, None, :] - dst[:, None, :, :]) ** 2, dim=-1) with torch.no_grad(): pred_transforms = pred_transforms gt_transforms = target points_src = data['points_sr...
code_fim
hard
{ "lang": "python", "repo": "VCLMW-Pose/torchlearning-benchmark", "path": "/engine/data/datasets/evaluation/modelnet_eval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VCLMW-Pose/torchlearning-benchmark path: /engine/data/datasets/evaluation/modelnet_eval.py # Copyright (c) MW-Pose Group, 2020 from engine.utils.miscellaneous import to_numpy from engine.math.so3 import dcm2euler from engine.math import se3 import numpy as np import logging import torch def do...
code_fim
hard
{ "lang": "python", "repo": "VCLMW-Pose/torchlearning-benchmark", "path": "/engine/data/datasets/evaluation/modelnet_eval.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> email_regex = re.compile(email_requirement) if email_regex.match(email) is None: return 0 else: return 1 # check username format # # returns # 1 - username matches format # 0 - usernmae doesn't match format def constraint_username_format(username): username_regex =...
code_fim
medium
{ "lang": "python", "repo": "fiifikrampah/cs4400", "path": "/constraints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># check password format # # returns # 1 - password matches format # 0 - password doesn't match format def constraint_password_format(password): password_regex = re.compile(password_requirement) if password_regex.match(password) is None: return 0 else: return 1<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "fiifikrampah/cs4400", "path": "/constraints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fiifikrampah/cs4400 path: /constraints.py # This file checks user registration entries on the front end. import re ''' Globals: ''' email_requirement = "(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" username_requirement = "(^[a-zA-Z0-9_.-]{3,50}$)" password_requirement = "(^[a-zA-Z0-9_.-...
code_fim
hard
{ "lang": "python", "repo": "fiifikrampah/cs4400", "path": "/constraints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PankeshGupta/polyaxon path: /polyaxon/sso/migrations/0001_initial.py # Generated by Django 2.0.3 on 2018-05-21 14:37 from django.conf import settings import django.contrib.postgres.fields import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models...
code_fim
hard
{ "lang": "python", "repo": "PankeshGupta/polyaxon", "path": "/polyaxon/sso/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def jaccard_dist_fun(score1, score2) -> Optional[int]: return 1 - jaccard_score(score1, score2) def get_measure_fun(mf: MeasureFunction) -> Callable: if mf == MeasureFunction.ABS_DIFF: return abs_diff elif mf == MeasureFunction.RATIO_LEFT: return partial(ratio, left=True) ...
code_fim
hard
{ "lang": "python", "repo": "pczarnowska/generalized-fairness-metrics", "path": "/checklist_fork/checklist/tests/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pczarnowska/generalized-fairness-metrics path: /checklist_fork/checklist/tests/helpers.py from enum import Enum from typing import Callable, Tuple, Optional import itertools from scipy import stats from functools import partial import numpy as np from ..utils import is_1d_list, is_2d_list from s...
code_fim
hard
{ "lang": "python", "repo": "pczarnowska/generalized-fairness-metrics", "path": "/checklist_fork/checklist/tests/helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for cat in popup_cats_lst: if cat._active is True: test = Cache.get('menu_cats_box', 'cats_box_obj') for child in test.children: child._active = False if child.name == 'categories': child....
code_fim
hard
{ "lang": "python", "repo": "mkbeh/CRyptoLab", "path": "/libs/customwidgets/popupcm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mkbeh/CRyptoLab path: /libs/customwidgets/popupcm.py # -*- coding: utf-8 -*- from kivy.uix.popup import Popup from kivy.properties import ObjectProperty from kivy.cache import Cache from kivy.uix.scrollview import ScrollView from kivy.lang.builder import Builder from libs.applibs.kivymd.theming ...
code_fim
hard
{ "lang": "python", "repo": "mkbeh/CRyptoLab", "path": "/libs/customwidgets/popupcm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' iff = pba1.adc6 iff_amp.par = iff iff.amp = iff_amp ir = pba2.adc6 ir_amp.par = ir ir.amp = ir_amp '''<|fim_prefix|># repo: NSLS-II-QAS/profile_collection path: /startup/84-aliases.py print(__file__) #these aliases are used to connect pizza boxes and amplifiers i0 = pba1.adc3 i0_amp.par = i0 i0.a...
code_fim
medium
{ "lang": "python", "repo": "NSLS-II-QAS/profile_collection", "path": "/startup/84-aliases.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NSLS-II-QAS/profile_collection path: /startup/84-aliases.py print(__file__) #these aliases are used to connect pizza boxes and amplifiers i0 = pba1.adc3 i0_amp.par = i0 i0.amp = i0_amp it = pba1.adc4 it_amp.par = it it.amp = it_amp ir = pba1.adc5 ir_amp.par = ir ir.amp = ir_amp <|fim_suffix...
code_fim
easy
{ "lang": "python", "repo": "NSLS-II-QAS/profile_collection", "path": "/startup/84-aliases.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcdale/project-resources path: /core/migrations/0001_initial.py # Generated by Django 2.0.7 on 2018-07-24 12:30 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> dependencies = [ ] operations = [ mig...
code_fim
hard
{ "lang": "python", "repo": "mcdale/project-resources", "path": "/core/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='StructureNode', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('path', models.CharField(max_length=255,...
code_fim
hard
{ "lang": "python", "repo": "mcdale/project-resources", "path": "/core/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if key in master: master[key] += 1 else: master[key] = 1 for t in tunes: t = tunes[t] inc(t['type'], self.tune_styles) inc(t['meter'], self.tune_meters) inc(t['mode'], self.tune_modes) ...
code_fim
hard
{ "lang": "python", "repo": "kprabesh/GANs-n-reels", "path": "/src/Generation/Cleaning/Stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kprabesh/GANs-n-reels path: /src/Generation/Cleaning/Stats.py from datetime import datetime import numpy as np import importlib.util as ih FOLDER_NAME = '../../Data' ABC_DIR = '/Clean/' STATS_DIR = '/Statistics/' NPY_DIR = '/Vectors/' class StatsHandler: def __init__(self, filename, base_k...
code_fim
hard
{ "lang": "python", "repo": "kprabesh/GANs-n-reels", "path": "/src/Generation/Cleaning/Stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CHUXUEZHE153/bitbots_motion path: /bitbots_quintic_walk/cfg/bitbots_quintic_walk_params.cfg #! /usr/bin/env python PACKAGE = 'bitbots_quintic_walk' import roslib roslib.load_manifest(PACKAGE) from dynamic_reconfigure.parameter_generator_catkin import * gen = ParameterGenerator() group_limits ...
code_fim
hard
{ "lang": "python", "repo": "CHUXUEZHE153/bitbots_motion", "path": "/bitbots_quintic_walk/cfg/bitbots_quintic_walk_params.cfg", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>group_limits.add("max_step_x", double_t, 1, "Maximal step length in X [m])", min=0, max=1) group_limits.add("max_step_y", double_t, 1, "Maximal step length in Y [m])", min=0, max=1) group_limits.add("max_step_xy", double_t, 1, "Maximal step length in X an...
code_fim
hard
{ "lang": "python", "repo": "CHUXUEZHE153/bitbots_motion", "path": "/bitbots_quintic_walk/cfg/bitbots_quintic_walk_params.cfg", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chjdev/euler path: /python/problem10.py # Summation of primes # Problem 10 # The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. # # Find the sum of all the primes below two million. import math MAX = 2000000 def gen_primes_elegant(max): # apparently elegant and slow... def init(max): ...
code_fim
medium
{ "lang": "python", "repo": "chjdev/euler", "path": "/python/problem10.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def gen_primes(max): lst = list(range(2, max + 1)) for i in range(0, math.ceil(len(lst) / 2)): prime = lst[i] if prime == 0: continue for j in range(i + prime, len(lst), prime): lst[j] = 0 return filter(lambda p: p != 0, lst) print(sum(gen_pri...
code_fim
hard
{ "lang": "python", "repo": "chjdev/euler", "path": "/python/problem10.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def init(max): yield 2 for i in range(3, max + 1, 2): yield i border = math.ceil(max / 2) primes = init(max) v = next(primes, None) num_generated = 1 cumulated_generated = 0 while not v is None: yield v if num_generated == 1000: ...
code_fim
medium
{ "lang": "python", "repo": "chjdev/euler", "path": "/python/problem10.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: VSChina/azure-cli-extensions path: /src/databricks/azext_databricks/__init__.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the pro...
code_fim
hard
{ "lang": "python", "repo": "VSChina/azure-cli-extensions", "path": "/src/databricks/azext_databricks/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from azext_databricks.commands import load_command_table load_command_table(self, args) return self.command_table def load_arguments(self, command): from azext_databricks._params import load_arguments load_arguments(self, command) COMMAND_LOADER_CLS ...
code_fim
hard
{ "lang": "python", "repo": "VSChina/azure-cli-extensions", "path": "/src/databricks/azext_databricks/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from azext_databricks._params import load_arguments load_arguments(self, command) COMMAND_LOADER_CLS = DatabricksClientCommandsLoader<|fim_prefix|># repo: VSChina/azure-cli-extensions path: /src/databricks/azext_databricks/__init__.py # ----------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "VSChina/azure-cli-extensions", "path": "/src/databricks/azext_databricks/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "Analysis -START- ") def RunSolutionLoop(self): '''Break Solution Loop when Buckling Analysis is converged, or maximum step number is reached ''' while self.KeepAdvancingSolutionLoop(): ...
code_fim
hard
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/StructuralMechanicsApplication/python_scripts/structural_mechanics_prebuckling_analysis.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: KratosMultiphysics/Kratos path: /applications/StructuralMechanicsApplication/python_scripts/structural_mechanics_prebuckling_analysis.py # Importing Kratos import KratosMultiphysics # Importing the base class from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis imp...
code_fim
hard
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/StructuralMechanicsApplication/python_scripts/structural_mechanics_prebuckling_analysis.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return stream + '_' + timestamp def _ts_from_message_uid(self, msg_uid): try: return float(msg_uid.split('_')[-1]) except ValueError: # failed on parsing float self.log.exception('Failed on parsing timestamp') return 0 def _import_peop...
code_fim
hard
{ "lang": "python", "repo": "n8v-guy/slag", "path": "/slack_archive.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: n8v-guy/slag path: /slack_archive.py [n for n in archive.namelist() if not n.endswith(os.path.sep)] bulk = self.mongo.db.messages.initialize_ordered_bulk_op() for channel in channels: last_msg_ts = '0' for fname in [n for n in files ...
code_fim
hard
{ "lang": "python", "repo": "n8v-guy/slag", "path": "/slack_archive.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: n8v-guy/slag path: /slack_archive.py ame', # useless 'bot_add', 'bot_remove', 'channel_join', 'channel_leave', 'channel_archive', 'channel_unarchive'} # format is not supported yet types_ignore = {'pinned_item', 'file_comment', ...
code_fim
hard
{ "lang": "python", "repo": "n8v-guy/slag", "path": "/slack_archive.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skazhy/101-lieta path: /src/info.py from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import models, views class Info(webapp.RequestHandler): def get(self): text = models.get_tt('info') t_path = 'templates/public-in...
code_fim
medium
{ "lang": "python", "repo": "skazhy/101-lieta", "path": "/src/info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> text = models.get_tt('info') t_path = 'templates/public-info.html' info_page = views.render_view(t_path, 'info', text) self.response.out.write(info_page) application = webapp.WSGIApplication([('/info', Info)], debug=True) def main(): run_wsgi_app(application) if __na...
code_fim
medium
{ "lang": "python", "repo": "skazhy/101-lieta", "path": "/src/info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> type: Int8 = field(default=0, repr=False, init=False) # unknown1: Int32 = field(default=1, repr=False, init=False) is_valid: Int8 xor_key: Bytes unknown2: Int32 = field(default=16777216, repr=False, init=False) unknown3: Int32 = field(default=16777216, repr=False, init=False) #...
code_fim
medium
{ "lang": "python", "repo": "teris1994/L2py", "path": "/game/game/packets/crypt_init.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: teris1994/L2py path: /game/game/packets/crypt_init.py from dataclasses import dataclass, field from game.packets.base import GameServerPacket <|fim_suffix|> type: Int8 = field(default=0, repr=False, init=False) # unknown1: Int32 = field(default=1, repr=False, init=False) is_valid: In...
code_fim
medium
{ "lang": "python", "repo": "teris1994/L2py", "path": "/game/game/packets/crypt_init.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> authors = revision.rev.get_apparent_authors() to_file.write('%s %s\n\n' % (date_str, ", ".join(authors))) if revision.delta is not None and revision.delta.has_changed(): for c in revision.delta.added + revision.delta.removed + \ revision.delta.mod...
code_fim
hard
{ "lang": "python", "repo": "armaan/nova", "path": "/bzrplugins/novalog/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: armaan/nova path: /bzrplugins/novalog/__init__.py # Copyright 2010 OpenStack 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.apac...
code_fim
hard
{ "lang": "python", "repo": "armaan/nova", "path": "/bzrplugins/novalog/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LotannaEzenwa/AbstractAlgebra path: /AbstractAlgebra/axiom.py from abc import ABCMeta, abstractmethod from types import { FunctionType, LambdaType, GeneratorType, } class Axiom(metaclass=ABCMeta): <|fim_suffix|> """ Classes should implement this as a static method """ raise NotImplemen...
code_fim
hard
{ "lang": "python", "repo": "LotannaEzenwa/AbstractAlgebra", "path": "/AbstractAlgebra/axiom.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def confirm(): """ Classes should implement this as a static method """ raise NotImplementedError<|fim_prefix|># repo: LotannaEzenwa/AbstractAlgebra path: /AbstractAlgebra/axiom.py from abc import ABCMeta, abstractmethod from types import { FunctionType, LambdaType, Generator...
code_fim
hard
{ "lang": "python", "repo": "LotannaEzenwa/AbstractAlgebra", "path": "/AbstractAlgebra/axiom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Classes should implement this as a static method """ raise NotImplementedError<|fim_prefix|># repo: LotannaEzenwa/AbstractAlgebra path: /AbstractAlgebra/axiom.py from abc import ABCMeta, abstractmethod from types import { FunctionType, LambdaType, GeneratorType, } class Axiom(metaclass=AB...
code_fim
medium
{ "lang": "python", "repo": "LotannaEzenwa/AbstractAlgebra", "path": "/AbstractAlgebra/axiom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_array1(self): self.assertEqual(final, output1) def test_array2(self): self.assertEqual(final, output2) if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: dynamoh/Interview-solved path: /LeetCode/832.py """ Flipping an Image Given a binary matrix A, we...
code_fim
hard
{ "lang": "python", "repo": "dynamoh/Interview-solved", "path": "/LeetCode/832.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dynamoh/Interview-solved path: /LeetCode/832.py """ Flipping an Image Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means that each row of the image is reversed. For example, flipping [1, 1, 0] hor...
code_fim
hard
{ "lang": "python", "repo": "dynamoh/Interview-solved", "path": "/LeetCode/832.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tential as potential symbols = ['Si'] pot = potential.TersoffPotential(symbols=symbols)<|fim_prefix|># repo: eragasa/pypospack path: /tests/potential/TersoffPotential/dev__TersoffPotential.py import pytest from collections import Ordere<|fim_middle|>dDict import numpy as np import pypospack.po
code_fim
easy
{ "lang": "python", "repo": "eragasa/pypospack", "path": "/tests/potential/TersoffPotential/dev__TersoffPotential.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eragasa/pypospack path: /tests/potential/TersoffPotential/dev__TersoffPotential.py import pytest from collections import Ordere<|fim_suffix|> potential.TersoffPotential(symbols=symbols)<|fim_middle|>dDict import numpy as np import pypospack.potential as potential symbols = ['Si'] pot =
code_fim
medium
{ "lang": "python", "repo": "eragasa/pypospack", "path": "/tests/potential/TersoffPotential/dev__TersoffPotential.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> potential.TersoffPotential(symbols=symbols)<|fim_prefix|># repo: eragasa/pypospack path: /tests/potential/TersoffPotential/dev__TersoffPotential.py import pytest from collections import Ordere<|fim_middle|>dDict import numpy as np import pypospack.potential as potential symbols = ['Si'] pot =
code_fim
medium
{ "lang": "python", "repo": "eragasa/pypospack", "path": "/tests/potential/TersoffPotential/dev__TersoffPotential.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: komunikator1984/Python_RTU_08_20 path: /Diena_6_lists/lists_g1.py # # # # a1 = 3 # # # # a2 = 5 # # # # a3 = 8 # # # # There has to be a better way # # # # # # What is a list after all? # # # # # # * ordered # # # # # # * collection of arbitrary objects (anything goes in) # # # # # # * nested (o...
code_fim
hard
{ "lang": "python", "repo": "komunikator1984/Python_RTU_08_20", "path": "/Diena_6_lists/lists_g1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>beer_list.reverse() # in place reversal print(beer_list) new_beer_list = beer_list[::-1] # so i save the reversed list but keep the original print(new_beer_list) # # # # # # so if we have comparable data types inside (so same types) new_beer_list.sort() # in place sort, modifies existing print(new_beer_...
code_fim
hard
{ "lang": "python", "repo": "komunikator1984/Python_RTU_08_20", "path": "/Diena_6_lists/lists_g1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nbush257/oprm1 path: /oprm1/oprm1_analyse.py import os from tqdm import tqdm import click import glob import sys import seaborn as sns from brian2 import * import brian_utils.postproc as bup import pandas as pd import pickle import scipy.signal from spykes.plot import NeuroVis,PopVis import glob ...
code_fim
hard
{ "lang": "python", "repo": "nbush257/oprm1", "path": "/oprm1/oprm1_analyse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> df_burst = pd.DataFrame(burst_fr.T) df_burst.index = IDX df_burst['Condition'] = df['Condition'] df_burst = df_burst.groupby('Condition').mean().T df_burst = df_burst.melt(value_name = 'Burst Firing Rate') df_IBI.set_index(cell_class,append=True,inplace=True) n_inh = dat['n_in...
code_fim
hard
{ "lang": "python", "repo": "nbush257/oprm1", "path": "/oprm1/oprm1_analyse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: avesus/hail path: /memory/memory/memory.py import aioredis import asyncio import base64 import concurrent import json import logging import os import uvloop import signal from aiohttp import web import kubernetes_asyncio as kube from prometheus_async.aio.web import server_stats # type: ignore fr...
code_fim
hard
{ "lang": "python", "repo": "avesus/hail", "path": "/memory/memory/memory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>async def on_startup(app): app['thread_pool'] = concurrent.futures.ThreadPoolExecutor() app['worker_pool'] = AsyncWorkerPool(parallelism=100, queue_size=10) app['files_in_progress'] = set() app['users'] = {} kube.config.load_incluster_config() k8s_client = kube.client.CoreV1Api() ...
code_fim
hard
{ "lang": "python", "repo": "avesus/hail", "path": "/memory/memory/memory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return render_template("404.html") @app.errorhandler(500) def internal_error(e): return render_template("500.html")<|fim_prefix|># repo: zkstewart/personal_projects path: /masters/N8942188_557_Ass2/adsmachinery/__init__.py from flask import Flask, render_template from flask_bootstrap import Boot...
code_fim
hard
{ "lang": "python", "repo": "zkstewart/personal_projects", "path": "/masters/N8942188_557_Ass2/adsmachinery/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Register app routes app.register_blueprint(views.bp) # Link SQLite database to Flask app db.init_app(app) # Provide bootstrap styling to Flask app bootstrap = Bootstrap(app) return app def seed_app(app): from . import admin app.register_blueprint(admin.bp) # Erro...
code_fim
hard
{ "lang": "python", "repo": "zkstewart/personal_projects", "path": "/masters/N8942188_557_Ass2/adsmachinery/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zkstewart/personal_projects path: /masters/N8942188_557_Ass2/adsmachinery/__init__.py from flask import Flask, render_template from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy # Initialise model and controller db=SQLAlchemy() app=Flask(__name__) # Primary web app fu...
code_fim
hard
{ "lang": "python", "repo": "zkstewart/personal_projects", "path": "/masters/N8942188_557_Ass2/adsmachinery/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>end = datetime.now() duration = (end - start).total_seconds() / 60 print('Duration: %s min' % duration) # Total: 2,000,000,001 # Matched: 300,014,400 # Duration: 75 min<|fim_prefix|># repo: hotmit/django-sandbox path: /django_sandbox/apps/billion_match/py_crunch.py from datetime import datetime start =...
code_fim
medium
{ "lang": "python", "repo": "hotmit/django-sandbox", "path": "/django_sandbox/apps/billion_match/py_crunch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hotmit/django-sandbox path: /django_sandbox/apps/billion_match/py_crunch.py from datetime import datetime start = datetime.now() with open('needles.tmp', 'r') as f: needles = f.readlines() needles = dict.fromkeys([n.strip() for n in needles]) <|fim_suffix|> if parts and len(part...
code_fim
hard
{ "lang": "python", "repo": "hotmit/django-sandbox", "path": "/django_sandbox/apps/billion_match/py_crunch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fft = np.abs(np.fft.rfft(dataFiltered)) freq = np.fft.rfftfreq(dataFiltered.size,1./num_samples) # [:fft.size] plt.plot(freq, fft) if swShow: plt.show() else: plt.savefig("signal_filtered_800-900_fft.png",dpi=200) plt.clf() if swSound: sd.play(dataFiltered, RATE, blocking=Tru...
code_fim
hard
{ "lang": "python", "repo": "mthfrr/tpe2017", "path": "/filtres/demo_filtre.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>num_samples = 1*RATE FREQ = 440 cutoff = FREQ*4.5 cutoff = FREQ*6.5 t = np.linspace(0, 1, num_samples, endpoint=False) samples = .5*square(2 * np.pi * FREQ * t) if swNoise: mean = 0 std = 1 samples += .2*np.random.normal(mean, std, size=num_samples) if swSinus: print 'to...
code_fim
hard
{ "lang": "python", "repo": "mthfrr/tpe2017", "path": "/filtres/demo_filtre.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: mthfrr/tpe2017 path: /filtres/demo_filtre.py # vim:set encoding=latin1 import numpy as np import matplotlib.pyplot as plt from scipy.signal import butter, square from scipy.signal import filtfilt swSound = False swShow = True swShow = False swNoise = False swSinus = False RATE...
code_fim
hard
{ "lang": "python", "repo": "mthfrr/tpe2017", "path": "/filtres/demo_filtre.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> # Can use a pathlib.Path use_fs(with_fs) client = get_fs_client() assert isinstance(client, BucketClientFS) assert client.root == with_fs use_fs(False) @pytest.mark.parametrize("adapter", TEST_ADAPTERS) def test_api_use_fs_cache(with_adapter, with_fs: str, bucket: str): path...
code_fim
hard
{ "lang": "python", "repo": "jmonts/pathy", "path": "/tests/test_clients.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmonts/pathy path: /tests/test_clients.py import time from pathlib import Path import pytest from pathy import Pathy, get_client from pathy.clients import get_fs_client, use_fs, use_fs_cache from pathy.file import BucketClientFS from pathy.gcs import BucketClientGCS from .conftest import TEST_...
code_fim
hard
{ "lang": "python", "repo": "jmonts/pathy", "path": "/tests/test_clients.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pblankenau2/open-et-test path: /interp-ee/scripts/interpolate_ard_export.py , landsat7_flag=ini['INPUTS']['landsat7_flag'], landsat8_flag=ini['INPUTS']['landsat8_flag'], landsat_type='RAD') # Compute ETf for each Landsat scene ...
code_fim
hard
{ "lang": "python", "repo": "pblankenau2/open-et-test", "path": "/interp-ee/scripts/interpolate_ard_export.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pblankenau2/open-et-test path: /interp-ee/scripts/interpolate_ard_export.py # elif ini['EXPORT']['export_dest'] == 'CLOUD': # logging.debug('\nGetting cloud storage file list') # cloud_list = utils.get_bucket_files( # ini['EXPORT']['project_name'], ini['EXPORT']['ou...
code_fim
hard
{ "lang": "python", "repo": "pblankenau2/open-et-test", "path": "/interp-ee/scripts/interpolate_ard_export.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Compute target product # if product == 'scene_id': # def scene_id_extract(image): # return ee.Feature(None).setMulti({ # 'SCENE_ID': ee.String(image.get('SCENE_ID'))}) # scene_id_coll = ee.FeatureCollection( # sc...
code_fim
hard
{ "lang": "python", "repo": "pblankenau2/open-et-test", "path": "/interp-ee/scripts/interpolate_ard_export.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: innogames/serveradmin path: /serveradmin/servershell/merged_query_iterator.py class MergedQuery: """ Holds an arbitrary amount of serveradmin queries that can be used as a single iteratable object. """ queries = [] def __init__(self, queries): self.queries = queri...
code_fim
hard
{ "lang": "python", "repo": "innogames/serveradmin", "path": "/serveradmin/servershell/merged_query_iterator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, queries): self.queries = [iter(i) for i in queries] self.served_ids = [] def next(self): try: if len(self.queries) > self.current_query: return self.queries[self.current_query].__next__() except StopIteration: ...
code_fim
hard
{ "lang": "python", "repo": "innogames/serveradmin", "path": "/serveradmin/servershell/merged_query_iterator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.queries = [iter(i) for i in queries] self.served_ids = [] def next(self): try: if len(self.queries) > self.current_query: return self.queries[self.current_query].__next__() except StopIteration: self.current_query += 1 ...
code_fim
hard
{ "lang": "python", "repo": "innogames/serveradmin", "path": "/serveradmin/servershell/merged_query_iterator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JakuJ/fb-messages-database path: /create_db.py import sqlite3 import json import os DB_NAME = './database.db' DB_SCRIPT_PATH = './create_tables.sql' DATA_DIR = './messages' TARGET_DIRS = [os.path.join(DATA_DIR, folder) for folder in ['inbox', 'archived_threads', 'message_requests']] def main()...
code_fim
hard
{ "lang": "python", "repo": "JakuJ/fb-messages-database", "path": "/create_db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # * insert data into Users already_in = c.execute('SELECT Name from Users where Name = ?;', [name]).fetchone() if not already_in: conn.execute('INSERT INTO USERS (Name) VALUES (?);', [name])...
code_fim
hard
{ "lang": "python", "repo": "JakuJ/fb-messages-database", "path": "/create_db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msemikin/embrec path: /nnrecsys/data/amazon/embeddings.py import math import numpy as np import os from glob import glob from itertools import chain import tensorflow as tf import tensorflow_hub as hub from tqdm import tqdm def extract_elmo_embeddings(start_batch, texts, batch_size): g = tf...
code_fim
hard
{ "lang": "python", "repo": "msemikin/embrec", "path": "/nnrecsys/data/amazon/embeddings.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> embeddings = session.run(embedding, feed_dict={text_input: chunk.values}) yield i, embeddings def gather_batches_from_dir(batches_dir): files = glob(os.path.join(batches_dir, '*.npy')) batches = [] for i in tqdm(range(len(files))): fname = os.path.join(batches_dir, '...
code_fim
hard
{ "lang": "python", "repo": "msemikin/embrec", "path": "/nnrecsys/data/amazon/embeddings.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SalishSeaCast/SalishSeaNowcast path: /nowcast/workers/watch_fvcom.py # Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
code_fim
hard
{ "lang": "python", "repo": "SalishSeaCast/SalishSeaNowcast", "path": "/nowcast/workers/watch_fvcom.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :return: Nowcast system checklist items :rtype: dict """ host_name = parsed_args.host_name model_config = parsed_args.model_config run_type = parsed_args.run_type run_info = tell_manager("need", "FVCOM run").payload pid = _find_run_pid(run_info[f"{model_config} {run_type}"]...
code_fim
hard
{ "lang": "python", "repo": "SalishSeaCast/SalishSeaNowcast", "path": "/nowcast/workers/watch_fvcom.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Check whether pid exists in the current process table. From: http://stackoverflow.com/a/6940314 """ if pid < 0: return False if pid == 0: # According to "man 2 kill" PID 0 refers to every process # in the process group of the calling process. # On ce...
code_fim
hard
{ "lang": "python", "repo": "SalishSeaCast/SalishSeaNowcast", "path": "/nowcast/workers/watch_fvcom.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ue + split else: returned_value = returned_value + " " + split return returned_value<|fim_prefix|># repo: caripeng30/RandomPythonStuff path: /file_reader.py class file_reader(Exception): def file_reader(filename): with open(filename + ".dat") ...
code_fim
hard
{ "lang": "python", "repo": "caripeng30/RandomPythonStuff", "path": "/file_reader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if split == '': pass else: if returned_value == "": returned_value = returned_value + split else: returned_value = returned_value + " " + split return returned_value<|fim_prefix|># repo: caripeng30/RandomPyt...
code_fim
hard
{ "lang": "python", "repo": "caripeng30/RandomPythonStuff", "path": "/file_reader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: caripeng30/RandomPythonStuff path: /file_reader.py class file_reader(Exception): def file_reader(filename): with open(filename + ".dat") as f: data = f.read<|fim_suffix|>ue + split else: returned_value = returned_value + " " + spli...
code_fim
hard
{ "lang": "python", "repo": "caripeng30/RandomPythonStuff", "path": "/file_reader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ankuraxz/pyowm path: /tests/test_readme.py from pyowm import OWM from pyowm.utils import config from pyowm.utils import timestamps # ---------- FREE API KEY --------------------- owm = OWM('your-API-key') # You MUST provide a valid API key <|fim_suffix|># Will it be clear tomorrow at this tim...
code_fim
hard
{ "lang": "python", "repo": "Ankuraxz/pyowm", "path": "/tests/test_readme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Will it be clear tomorrow at this time in Milan (Italy) ? mgr = owm.weather_manager() forecast = mgr.forecast_at_place('Milan,IT', 'daily') forecast.will_be_clear_at(timestamps.tomorrow()) # The sun always shines on Italy, right? ;)<|fim_prefix|># repo: Ankuraxz/pyowm path: /tests/test_readme.py from ...
code_fim
medium
{ "lang": "python", "repo": "Ankuraxz/pyowm", "path": "/tests/test_readme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyiron/pyiron_atomistics path: /tests/test_toolkit.py # coding: utf-8 # Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department # Distributed under the terms of "New BSD License", see the LICENSE file. from pyiron_base._tests import TestWithProj...
code_fim
medium
{ "lang": "python", "repo": "pyiron/pyiron_atomistics", "path": "/tests/test_toolkit.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }