text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: encorehu/hublog path: /blog/views.py # -*- coding: utf-8 -*- # python. # ------------------------------------------------------------ # django. from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.template import RequestContext from...
code_fim
hard
{ "lang": "python", "repo": "encorehu/hublog", "path": "/blog/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return html.Div(id="ddbox", children=[ dcc.Dropdown( id='dropdown', options=[{"label": x, "value": x} for x in data], placeholder=ph, ) ]) def BarSpecific(): """Returns Bar Chart for common/similar persons for specific page """ retu...
code_fim
hard
{ "lang": "python", "repo": "50sven/HistorEx", "path": "/dashboard/components.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 50sven/HistorEx path: /dashboard/components.py import dash_html_components as html import dash_core_components as dcc import plotly.graph_objs as go import dash_table from app import app def Header(page): """Returns header for all end points """ style = { "background-color":...
code_fim
hard
{ "lang": "python", "repo": "50sven/HistorEx", "path": "/dashboard/components.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fudster/python-pastebin path: /makedb.py import sqlite3 conn = sqlite3.connect('paste.db') print("Connected <|fim_suffix|> table to database") conn.commit conn.close() print("Saved database")<|fim_middle|>to database") cursor = conn.cursor() cursor.execute("CREATE TABLE pastes(id TEXT unique, co...
code_fim
medium
{ "lang": "python", "repo": "Fudster/python-pastebin", "path": "/makedb.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> table to database") conn.commit conn.close() print("Saved database")<|fim_prefix|># repo: Fudster/python-pastebin path: /makedb.py import sqlite3 conn = sqlite3.connect('paste.db') print("Connected to database") cursor = conn.cursor() cursor.execute("CREATE TABLE pa<|fim_middle|>stes(id TEXT unique, co...
code_fim
medium
{ "lang": "python", "repo": "Fudster/python-pastebin", "path": "/makedb.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def response(self): return self.choice<|fim_prefix|># repo: shravani-dev/MyPyBuilder path: /MyPyWidgets/FileDialogClass.py from tkinter import filedialog class FileDialog(object): <|fim_middle|> def __init__(self, initialdir, file_type): if file_type == 'dir': self.c...
code_fim
medium
{ "lang": "python", "repo": "shravani-dev/MyPyBuilder", "path": "/MyPyWidgets/FileDialogClass.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shravani-dev/MyPyBuilder path: /MyPyWidgets/FileDialogClass.py from tkinter import filedialog <|fim_suffix|> def __init__(self, initialdir, file_type): if file_type == 'dir': self.choice = filedialog.askdirectory(initialdir=initialdir) def response(self): ret...
code_fim
easy
{ "lang": "python", "repo": "shravani-dev/MyPyBuilder", "path": "/MyPyWidgets/FileDialogClass.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if file_type == 'dir': self.choice = filedialog.askdirectory(initialdir=initialdir) def response(self): return self.choice<|fim_prefix|># repo: shravani-dev/MyPyBuilder path: /MyPyWidgets/FileDialogClass.py from tkinter import filedialog <|fim_middle|>class FileDialog(o...
code_fim
medium
{ "lang": "python", "repo": "shravani-dev/MyPyBuilder", "path": "/MyPyWidgets/FileDialogClass.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rexissimus/BatchQ-PBS path: /batchq/contrib/examples/tutorial2_basestructure.py class SubmissionModel(batch.BatchQ): param1 = Property("default value 1") param2 = Property("default value 2") # ... terminal1 = Controller(Class1, arg1, arg2, ...) t1_fnc1 = Function().a().b...
code_fim
medium
{ "lang": "python", "repo": "rexissimus/BatchQ-PBS", "path": "/batchq/contrib/examples/tutorial2_basestructure.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t1_fnc1 = Function().a().b() t1_fnc2 = Function().c().d() # ... terminal2 = Controller(Class2, arg1, arg2, ...) t2_fnc1 = Function().e(param1).f(param2) t2_fnc2 = Function().g().h() # ... def userdef1(self): # ... pass def userdef2(self): # ....
code_fim
medium
{ "lang": "python", "repo": "rexissimus/BatchQ-PBS", "path": "/batchq/contrib/examples/tutorial2_basestructure.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def dbinsert(db,table,**assignments): """Insert a database row with the columns and values as keyword arguments.""" cols = "" vals = "" values = [] for k,v in assignments.items(): if cols!="": cols += "," cols += k if vals!="": vals += "," vals += "?...
code_fim
hard
{ "lang": "python", "repo": "CDH-SC/paragon", "path": "/preproc/build/lib/ocrolib/dbhelper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def charcolumns(con,table): """Set up the columns for a character or cluster table. It is safe to call this on existing tables; it will simply add any missing columns and indexes.""" dbcolumns(con,table, # basic classification image="blob", cls="text"...
code_fim
hard
{ "lang": "python", "repo": "CDH-SC/paragon", "path": "/preproc/build/lib/ocrolib/dbhelper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CDH-SC/paragon path: /preproc/build/lib/ocrolib/dbhelper.py ################################################################ ### simple database utilities ################################################################ import sys,os,re,glob,math,glob,signal,numpy from pylab import * fro...
code_fim
hard
{ "lang": "python", "repo": "CDH-SC/paragon", "path": "/preproc/build/lib/ocrolib/dbhelper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def remote_origin_remove(path): print("Attempting to remote remove origin") if os.system(f"git -C \"{path}\" remote remove origin") == 0: print("Removed") return True else: print("Removal error") return False def push(path): print("Attempting to push") ...
code_fim
hard
{ "lang": "python", "repo": "DBC201/git-pull", "path": "/git_pull.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: files = os.listdir(path) files = [os.path.join(path, f) for f in files] except Exception as e: print(e) sys.exit(-1) for f in files: if os.path.isdir(f): if args.reset: reset_origin(f) if not pull(f): ...
code_fim
hard
{ "lang": "python", "repo": "DBC201/git-pull", "path": "/git_pull.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DBC201/git-pull path: /git_pull.py import os import argparse, sys def pull(path): print(f"Pulling \"{path}\"") if os.system(f"git -C \"{path}\" pull origin master") == 0: return True else: return False def initialize_repo(path): print("Initializing git") if...
code_fim
hard
{ "lang": "python", "repo": "DBC201/git-pull", "path": "/git_pull.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: naturalis/nbclassify path: /nbclassify/scripts/nbc-feature-extraction #!/usr/bin/env python """ Feature extractor with the use of the SURF-algorithm. Features are extracted from all the images in a given path. All processed image filenames are saved in a .txt file. A dictionary with all descrip...
code_fim
hard
{ "lang": "python", "repo": "naturalis/nbclassify", "path": "/nbclassify/scripts/nbc-feature-extraction", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># XXX move to imgpheno def surf_keypoint_detection(img): """ The function takes an image in grayscale of type nd.nparray. Features are extracted from the image by the SURF-algorithm and keypoints and descriptors are calculated. The descriptors are returned. """ surf = cv2.x...
code_fim
hard
{ "lang": "python", "repo": "naturalis/nbclassify", "path": "/nbclassify/scripts/nbc-feature-extraction", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def verify(did, msg): try: utils.checkValidDeviceId(did) except ValueError as e: self.assertEqual(msg, str(e)) verify(None, "deviceId must be a string") verify(1, "deviceId must be a string") verify("", "deviceId must...
code_fim
hard
{ "lang": "python", "repo": "iobeam/iobeam-client-python", "path": "/tests/utils/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_checkValidProjectId(self): def verify(pid, msg): try: utils.checkValidProjectId(pid) except ValueError as e: self.assertEqual(msg, str(e)) verify(None, "projectId must be an int") verify("50", "projectId must be ...
code_fim
hard
{ "lang": "python", "repo": "iobeam/iobeam-client-python", "path": "/tests/utils/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: iobeam/iobeam-client-python path: /tests/utils/test_utils.py import sys import unittest if sys.version_info > (3, 2): from unittest.mock import patch else: from mock import patch from iobeam.utils import utils _PROJECT_ID = 1 _DEVICE_ID = "py_test_id" _DEVICE_NAME = "py_test_device" c...
code_fim
hard
{ "lang": "python", "repo": "iobeam/iobeam-client-python", "path": "/tests/utils/test_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CONABIO-audio/irekua-rest-api path: /irekua_rest_api/views/object_types/sampling_events/sampling_event_types.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import get_object_or_404 from rest_framework import mixins from rest_framework.decorators import a...
code_fim
hard
{ "lang": "python", "repo": "CONABIO-audio/irekua-rest-api", "path": "/irekua_rest_api/views/object_types/sampling_events/sampling_event_types.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> context['sampling_event_type'] = sampling_event_type return context def get_queryset(self): if self.action == 'device_types': sampling_event_type_id = self.kwargs['pk'] queryset = ( models.SamplingEventTypeDeviceTypeViewSet # pylint: di...
code_fim
hard
{ "lang": "python", "repo": "CONABIO-audio/irekua-rest-api", "path": "/irekua_rest_api/views/object_types/sampling_events/sampling_event_types.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> mime_text = r.headers.get('Content-Type') mime = mimeparse.parse_mime_type(mime_text) # If we're already given an image... if mime[0] == 'image': # Use the already given URL image_url = submission.url else: ...
code_fim
hard
{ "lang": "python", "repo": "spiral6/VelvetBot", "path": "/plugins/gyazo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spiral6/VelvetBot path: /plugins/gyazo.py __author__ = 'kevin' import re import logging import traceback from urllib.parse import urlsplit import requests import mimeparse import praw class GyazoPlugin: """A gyazo.com import plugin. gyazo.com is a site for quickly uploading screen sh...
code_fim
hard
{ "lang": "python", "repo": "spiral6/VelvetBot", "path": "/plugins/gyazo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> This function will define the following values in its return data: - author: simply "a gyazo.com user" - source: The url of the submission - importer_display/header - import_urls :param submission: A reddit submission to parse. """ try: ...
code_fim
hard
{ "lang": "python", "repo": "spiral6/VelvetBot", "path": "/plugins/gyazo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path, size, done, depth, res, = [], len(nums), {}, 0, [] dfs(path, size, done, depth, res) return res if __name__ == '__main__': s = Solution() a = s.permute([1,2,3]) print(a)<|fim_prefix|># repo: EricLi404/nb path: /leetcode/tencent-hot50/46_permutations.py # https:...
code_fim
hard
{ "lang": "python", "repo": "EricLi404/nb", "path": "/leetcode/tencent-hot50/46_permutations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': s = Solution() a = s.permute([1,2,3]) print(a)<|fim_prefix|># repo: EricLi404/nb path: /leetcode/tencent-hot50/46_permutations.py # https://leetcode-cn.com/problems/permutations/ from typing import List class Solution: def permute(self, nums: List[int]) -> Li...
code_fim
hard
{ "lang": "python", "repo": "EricLi404/nb", "path": "/leetcode/tencent-hot50/46_permutations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EricLi404/nb path: /leetcode/tencent-hot50/46_permutations.py # https://leetcode-cn.com/problems/permutations/ from typing import List <|fim_suffix|> if depth == size: res.append(path[:]) return for i in nums: if i not in d...
code_fim
hard
{ "lang": "python", "repo": "EricLi404/nb", "path": "/leetcode/tencent-hot50/46_permutations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>in_suite("test") # start the suite except RuntimeError, e: print "Failed: " + str(e)<|fim_prefix|># repo: XiaoLinhong/ecflow path: /Doc/sphinx-examples/tutorial/going_further/src/add-another-task-client.py #!/usr/bin/env python2.7 import ecflow print "Client -> Server: delete, then load a new...
code_fim
medium
{ "lang": "python", "repo": "XiaoLinhong/ecflow", "path": "/Doc/sphinx-examples/tutorial/going_further/src/add-another-task-client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> the server ci.load("test.def") # load the definition into the server ci.begin_suite("test") # start the suite except RuntimeError, e: print "Failed: " + str(e)<|fim_prefix|># repo: XiaoLinhong/ecflow path: /Doc/sphinx-examples/tutorial/going_further/src/add-another-task-client.py #!...
code_fim
medium
{ "lang": "python", "repo": "XiaoLinhong/ecflow", "path": "/Doc/sphinx-examples/tutorial/going_further/src/add-another-task-client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: XiaoLinhong/ecflow path: /Doc/sphinx-examples/tutorial/going_further/src/add-another-task-client.py #!/usr/bin/env python2.7 import ecflow print "Client -> Server: delete, then load a n<|fim_suffix|>in_suite("test") # start the suite except RuntimeError, e: print "Failed: " + str(e)<|...
code_fim
medium
{ "lang": "python", "repo": "XiaoLinhong/ecflow", "path": "/Doc/sphinx-examples/tutorial/going_further/src/add-another-task-client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jluech/PGAcloud_Client path: /utilities/docker_utils.py import os import docker __docker_client = None __management_network = None def get_docker_client(cert_path, host_addr, host_port): global __docker_client if __docker_client: return __docker_client tls_config = docker...
code_fim
medium
{ "lang": "python", "repo": "jluech/PGAcloud_Client", "path": "/utilities/docker_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Creates a new docker network to bridge the manager to the runners. __management_network = __docker_client.networks.create( name="pga-management", driver="overlay", check_duplicate=True, attachable=True, scope="swarm", labels={"PGAcloud": "PGA-Manag...
code_fim
hard
{ "lang": "python", "repo": "jluech/PGAcloud_Client", "path": "/utilities/docker_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: philpraxis/group-based-policy path: /gbpservice/neutron/tests/unit/services/servicechain/test_servicechain_plugin.py # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
code_fim
hard
{ "lang": "python", "repo": "philpraxis/group-based-policy", "path": "/gbpservice/neutron/tests/unit/services/servicechain/test_servicechain_plugin.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from gbpservice.neutron.tests.unit.db.grouppolicy import ( test_servicechain_db as test_servicechain_db) cfg.CONF.import_opt('servicechain_drivers', 'gbpservice.neutron.services.servicechain.config', group='servicechain') SC_PLUGIN_KLASS = ( "gbpservice.neu...
code_fim
medium
{ "lang": "python", "repo": "philpraxis/group-based-policy", "path": "/gbpservice/neutron/tests/unit/services/servicechain/test_servicechain_plugin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super(Simulator, self).__init__(default_beam_energy=default_beam_energy, num_samples=num_samples) memory = '4GB' ngpus = 0<|fim_prefix|># repo: montefiore-ai/balanced-nre path: /workflows/nre/weinberg/setting.py from hypothesis.benchmark.weinberg import Prior from hypothesis.benchmark.weinberg i...
code_fim
medium
{ "lang": "python", "repo": "montefiore-ai/balanced-nre", "path": "/workflows/nre/weinberg/setting.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: montefiore-ai/balanced-nre path: /workflows/nre/weinberg/setting.py from hypothesis.benchmark.weinberg import Prior from hypothesis.benchmark.weinberg import Simulator as WeinbergSimulator <|fim_suffix|> super(Simulator, self).__init__(default_beam_energy=default_beam_energy, num_samples=...
code_fim
medium
{ "lang": "python", "repo": "montefiore-ai/balanced-nre", "path": "/workflows/nre/weinberg/setting.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ranea/CASCADA path: /cascada/abstractproperty/opmodel.py math.isclose(w, math.ceil(w)): warnings.warn(f"using {name} = {w} that might get approx. to {math.ceil(w)-1} instead of {math.ceil(w)}") if 0 != w != math.inf and int(w * (2 ** cls.precision)) == 0: ...
code_fim
hard
{ "lang": "python", "repo": "ranea/CASCADA", "path": "/cascada/abstractproperty/opmodel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def bv_weight(self, output_prop): return core.Constant(0, width=1) def max_weight(self): return 0 # as an integer def weight_width(self): return 1 def decimal_weight(self, output_prop): self._assert_preconditions_decimal_weight(output_prop) dw = ...
code_fim
hard
{ "lang": "python", "repo": "ranea/CASCADA", "path": "/cascada/abstractproperty/opmodel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ranea/CASCADA path: /cascada/abstractproperty/opmodel.py def bv_weight(self, output_prop): return core.Constant(0, width=1) def max_weight(self): return 0 # as an integer def weight_width(self): return 1 def decimal_weight(self, output_prop): sel...
code_fim
hard
{ "lang": "python", "repo": "ranea/CASCADA", "path": "/cascada/abstractproperty/opmodel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: carlos-jenkins/autoapi path: /examples/apinode.py # -*- coding: utf-8 -*- # # Copyright (C) 2015-2020 KuraLabs S.R.L # # 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 # #...
code_fim
medium
{ "lang": "python", "repo": "carlos-jenkins/autoapi", "path": "/examples/apinode.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> basicConfig(level=DEBUG) m = APINode('sphinx') for node, leaves in m.walk(): print( '{} node has leaves: {}'.format( node.name, ', '.join([l.name for l in leaves]) ) ) InteractiveConsole(globals()).interact()<|fim_prefix|># repo: ca...
code_fim
medium
{ "lang": "python", "repo": "carlos-jenkins/autoapi", "path": "/examples/apinode.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output = model(batch_image) loss = loss_func(output, batch_label) pred = output.argmax(dim=1) correct_pred = (pred == batch_label).sum(dim=0) eval_loss.append(loss.item()) num_correct_pred += correct_pred ...
code_fim
hard
{ "lang": "python", "repo": "JayChanHoi/adaptive_gradient_clipping", "path": "/exp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayChanHoi/adaptive_gradient_clipping path: /exp.py from models.nfnet import nfnet_f0, dm_nfnet_f0, nfnet_f1 from efficient_net.efficient_net_model import ENClassifier, model_dict import torchvision from tensorboardX import SummaryWriter from torch.utils.data import DataLoader from itertools im...
code_fim
hard
{ "lang": "python", "repo": "JayChanHoi/adaptive_gradient_clipping", "path": "/exp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-google-native path: /sdk/python/pulumi_google_native/networkservices/v1/mesh.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/networkservices/v1/mesh.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> resource_name: str, args: MeshArgs, opts: Optional[pulumi.ResourceOptions] = None): """ Creates a new Mesh in a given project and location. :param str resource_name: The name of the resource. :param MeshArgs args: The argu...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/networkservices/v1/mesh.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_publicSellCompleteSets_failure(contractsFixture, universe, cash, market): completeSets = contractsFixture.contracts['CompleteSets'] orders = contractsFixture.contracts['Orders'] cost = 10 * market.getNumTicks() cash.depositEther(sender=tester.k1, value=cost) completeSets.publ...
code_fim
hard
{ "lang": "python", "repo": "zackster/augur", "path": "/packages/augur-core/tests/trading/test_completeSets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zackster/augur path: /packages/augur-core/tests/trading/test_completeSets.py #!/usr/bin/env python from ethereum.tools import tester from ethereum.tools.tester import TransactionFailed from pytest import raises from utils import bytesToHexString, fix, AssertLog from constants import YES, NO def...
code_fim
hard
{ "lang": "python", "repo": "zackster/augur", "path": "/packages/augur-core/tests/trading/test_completeSets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ecmwf/pyeccodes path: /pyeccodes/defs/grib2/tables/18/3_0_table.py def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Specified in Code table 3.1'}, <|fim_suffix|>on', 'units': 'Defined by originating centre'}, {'abbr': None, 'code': 255, ...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/pyeccodes", "path": "/pyeccodes/defs/grib2/tables/18/3_0_table.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>on', 'units': 'Defined by originating centre'}, {'abbr': None, 'code': 255, 'title': 'A grid definition does not apply to this product'})<|fim_prefix|># repo: ecmwf/pyeccodes path: /pyeccodes/defs/grib2/tables/18/3_0_table.py def load(h): return ({'a...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/pyeccodes", "path": "/pyeccodes/defs/grib2/tables/18/3_0_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Unfreeze single partition from backup1. node.query( "ALTER TABLE s3_test UNFREEZE PARTITION '2020-01-03' WITH NAME 'backup1'" ) # Unfreeze all partitions from backup2. node.query("ALTER TABLE s3_test UNFREEZE WITH NAME 'backup2'") # Data should be removed from S3. wa...
code_fim
hard
{ "lang": "python", "repo": "ClickHouse/ClickHouse", "path": "/tests/integration/test_merge_tree_s3/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> node.query("ALTER TABLE s3_test DETACH PARTITION '2020-01-03'") wait_for_delete_empty_parts(node, "s3_test") wait_for_delete_inactive_parts(node, "s3_test") assert node.query("SELECT count(*) FROM s3_test FORMAT Values") == "(4096)" assert ( len(list_objects(cluster, "data/")) ...
code_fim
hard
{ "lang": "python", "repo": "ClickHouse/ClickHouse", "path": "/tests/integration/test_merge_tree_s3/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ClickHouse/ClickHouse path: /tests/integration/test_merge_tree_s3/test.py ) # Unfreeze all partitions from backup2. node.query("ALTER TABLE s3_test UNFREEZE WITH NAME 'backup2'") # Data should be removed from S3. wait_for_delete_s3_objects(cluster, FILES_OVERHEAD) check_n...
code_fim
hard
{ "lang": "python", "repo": "ClickHouse/ClickHouse", "path": "/tests/integration/test_merge_tree_s3/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for filename in images: _, image = os.path.split(filename) image = image.strip() item_id, _ = os.path.splitext(image) dest_image = os.path.join('static', image) same_image = os.path.exists(dest_image) and filecmp.cmp(filename, dest_image) shutil.copyfile...
code_fim
hard
{ "lang": "python", "repo": "sipsop/qdserver", "path": "/loadImages.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sipsop/qdserver path: /loadImages.py import os import sys import glob import shutil import filecmp import subprocess from qdserver import model try: os.mkdir('images') except FileExistsError as e: pass def process_images(resize=False): images = ( glob.glob('images/*.jpg') ...
code_fim
hard
{ "lang": "python", "repo": "sipsop/qdserver", "path": "/loadImages.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> u"nicken", u"Niere", u"Nilpferd", u"nisten", u"Nocke", u"Nomade", u"Nordmeer", u"Notdurft", u"Notstand", u"Notwehr", u"Nudismus", u"Nuss", u"Nutzhanf", u"Oase", u"Obdach", u"Oberarzt"...
code_fim
hard
{ "lang": "python", "repo": "python-monero/monero-python", "path": "/monero/wordlists/german.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> u"eröffnen", u"Erosion", u"Erotik", u"Erpel", u"erraten", u"Erreger", u"erröten", u"Ersatz", u"Erstflug", u"Ertrag", u"Eruption", u"erwarten", u"erwidern", u"Erzbau", u"Erzeuger", u"erz...
code_fim
hard
{ "lang": "python", "repo": "python-monero/monero-python", "path": "/monero/wordlists/german.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: python-monero/monero-python path: /monero/wordlists/german.py u"Brunnen", u"Brüste", u"Brutofen", u"Buch", u"Büffel", u"Bugwelle", u"Bühne", u"Buletten", u"Bullauge", u"Bumerang", u"bummeln", u"Buntglas"...
code_fim
hard
{ "lang": "python", "repo": "python-monero/monero-python", "path": "/monero/wordlists/german.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: F5Networks/f5-common-python path: /f5/iworkflow/shared/authz/test/functional/test_user.py # Copyright 2015-2106 F5 Networks Inc. # # 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 Li...
code_fim
hard
{ "lang": "python", "repo": "F5Networks/f5-common-python", "path": "/f5/iworkflow/shared/authz/test/functional/test_user.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # There may be 2 users (like when running in vagrant) # or only 1 user (like if running in openstack) assert len(users) >= 1 def test_create_user(self, user): assert user.name == 'foo1' assert user.displayName == "Foo user" assert user.shell == "/usr/bi...
code_fim
hard
{ "lang": "python", "repo": "F5Networks/f5-common-python", "path": "/f5/iworkflow/shared/authz/test/functional/test_user.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mysnyldz/Tez-Analizi path: /main.py from PyQt5.QtCore import QDir from PyQt5.QtGui import QIntValidator, QDoubleValidator from PyQt5.QtWidgets import QMainWindow, QApplication, QFileDialog, QMessageBox from ui_arayuz import Ui_MainWindow import time class MainWindow(QMainWindow): def __ini...
code_fim
hard
{ "lang": "python", "repo": "mysnyldz/Tez-Analizi", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(self.ui.txt_no_tablolar.text()) > 0: for i in self.ui.txt_no_tablolar.text().split(","): self.tablolar_listesi_sayfa_numaralari.append(int(i)) if len(self.ui.txt_no_sekiller.text()) > 0: for i in self.ui.txt_no_sekiller.text().split(","): ...
code_fim
hard
{ "lang": "python", "repo": "mysnyldz/Tez-Analizi", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(self.ui.txt_no_cizelge.text()) > 0: for i in self.ui.txt_no_cizelge.text().split(","): self.cizelgeler_listesi_sayfa_numaralari.append(int(i)) if len(self.ui.txt_no_icindekiler.text()) > 0: for i in self.ui.txt_no_icindekiler.text().split(","...
code_fim
hard
{ "lang": "python", "repo": "mysnyldz/Tez-Analizi", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> colours = dict() for i, section in enumerate(session.testdict['sections']): for j, subsection in enumerate(section['subsections']): colours[subsection['id']] = subsection['colour'] return dict(colours=colours)<|fim_prefix|># repo: shikasta-net/LabBook path: /controllers/pageview.py import random ...
code_fim
medium
{ "lang": "python", "repo": "shikasta-net/LabBook", "path": "/controllers/pageview.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shikasta-net/LabBook path: /controllers/pageview.py import random def index(): if not session.testdict: session.testdict = dict() session.testdict['sections'] = [dict() for a in range(random.randint(2,5))] for i, section in enumerate(session.testdict['sections']): section['title'] = 'S...
code_fim
medium
{ "lang": "python", "repo": "shikasta-net/LabBook", "path": "/controllers/pageview.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def css(): colours = dict() for i, section in enumerate(session.testdict['sections']): for j, subsection in enumerate(section['subsections']): colours[subsection['id']] = subsection['colour'] return dict(colours=colours)<|fim_prefix|># repo: shikasta-net/LabBook path: /controllers/pageview.py imp...
code_fim
medium
{ "lang": "python", "repo": "shikasta-net/LabBook", "path": "/controllers/pageview.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>try: with open(SECRET_PATH / 'globus.json') as f: globus_secrets = json.load(f) SOCIAL_AUTH_GLOBUS_KEY = globus_secrets['key'] SOCIAL_AUTH_GLOBUS_SECRET = globus_secrets['secret'] except FileNotFoundError: # TODO: decide how critical this should be, and log this instead of ...
code_fim
medium
{ "lang": "python", "repo": "hubmapconsortium/hubmap-data-portal", "path": "/hubmap/hubmap/production_settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hubmapconsortium/hubmap-data-portal path: /hubmap/hubmap/production_settings.py import json from pathlib import Path print('Loading production settings') SECRET_PATH = Path('/opt/secret') DEBUG = False <|fim_suffix|>ALLOWED_HOSTS = [ 'data.dev.hubmapconsortium.org', 'data.test.hubmapc...
code_fim
hard
{ "lang": "python", "repo": "hubmapconsortium/hubmap-data-portal", "path": "/hubmap/hubmap/production_settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: glasst/CS491-Research-Survey-Tool path: /proj/surveys/junk.py # For dead code ######################################################################################################################## # FROM views.py ''' def surveycompletion(request): survey_Id = request.session.get('survey_Id...
code_fim
hard
{ "lang": "python", "repo": "glasst/CS491-Research-Survey-Tool", "path": "/proj/surveys/junk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> survey = get_object_or_404(Survey, survey_Id=survey_Id) survey.delete() user_surveys = Survey.objects.filter(creator_Id=request.user) return render(request, 'surveys/index.html', {'user_surveys': user_surveys}) ''' ''' def multiplechoice(request, survey_Id): #return render(request('mu...
code_fim
hard
{ "lang": "python", "repo": "glasst/CS491-Research-Survey-Tool", "path": "/proj/surveys/junk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): super().__init__() self.model = model optimizer = flow.optim.SGD(self.model.parameters()) self.add_optimizer(optimizer) def build(self, x, y): x.retain_grad() y.reta...
code_fim
hard
{ "lang": "python", "repo": "Oneflow-Inc/oneflow", "path": "/python/oneflow/test/modules/test_autograd_function.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> np_arr0 = np.random.randn(4, 5).astype(np.float32) np_arr1 = np.random.randn(4, 5).astype(np.float32) np_arr2 = np.random.randn(4, 5).astype(np.float32) a = flow.tensor(np_arr0).requires_grad_() b = flow.tensor(np_arr1).requires_grad_() model.weight.copy_(np...
code_fim
hard
{ "lang": "python", "repo": "Oneflow-Inc/oneflow", "path": "/python/oneflow/test/modules/test_autograd_function.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Oneflow-Inc/oneflow path: /python/oneflow/test/modules/test_autograd_function.py """ Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of ...
code_fim
hard
{ "lang": "python", "repo": "Oneflow-Inc/oneflow", "path": "/python/oneflow/test/modules/test_autograd_function.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.gr.tearSolver = self.tearSolverBox.currentText() self.gr.tearTol = float(self.tearTolEdit.text()) self.gr.tearMaxIt = int(float(self.tearItLimitEdit.text())) self.gr.wegAccMin = float(self.wegAccMinEdit.text()) self.gr.wegAccMax = float(self.wegAccMaxEdit.text(...
code_fim
hard
{ "lang": "python", "repo": "ou3llnl/foqus_backup", "path": "/foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ou3llnl/foqus_backup path: /foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py ''' flowsheetSettingsDialog.py * Dialog to change flowsheet solver settings. John Eslick, Carnegie Mellon University, 2014 This Material was produced under the DOE Carbon Capture Simulation Initi...
code_fim
hard
{ "lang": "python", "repo": "ou3llnl/foqus_backup", "path": "/foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> taskType = self.taskParams.taskTypeMap[self.taskParams.taskIdNameMap[taskId]] if taskType == TaskType.NER: sequenceOutput = self.allDropouts[taskName](sequenceOutput) #task specific header. In NER case, sequence output is 3-D, also has maxSeqLen. # but ...
code_fim
hard
{ "lang": "python", "repo": "Soumi7/multi-task-NLP", "path": "/models/model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Soumi7/multi-task-NLP path: /models/model.py s import ModelType, NLP_MODELS, TaskType, LOSSES from transformers import AdamW, get_linear_schedule_with_warmup logger = logging.getLogger("multi_task") class multiTaskNetwork(nn.Module): def __init__(self, params): super(multiTaskNetwork...
code_fim
hard
{ "lang": "python", "repo": "Soumi7/multi-task-NLP", "path": "/models/model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # taking out output from shared encoder. if typeIds is not None and attentionMasks is not None: outputs = self.sharedModel(input_ids = tokenIds, token_type_ids = typeIds, attention_mask = attentionMasks) ...
code_fim
hard
{ "lang": "python", "repo": "Soumi7/multi-task-NLP", "path": "/models/model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: praveern/AlgorithmsPractice path: /main.py """ This is the main file which will be called to execute any data structure or algorithm implemented. """ <|fim_suffix|>sys.path.append(os.getcwd()) def arg_parser(system_arguments): arguments = list() return arguments if __name__ == '__mai...
code_fim
easy
{ "lang": "python", "repo": "praveern/AlgorithmsPractice", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': if len(arg_parser(sys.argv)) > 0: arguments_passed = arg_parser(sys.argv[1:])<|fim_prefix|># repo: praveern/AlgorithmsPractice path: /main.py """ This is the main file which will be called to execute any data structure or algorithm implemented. """ import argparse ...
code_fim
medium
{ "lang": "python", "repo": "praveern/AlgorithmsPractice", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Reload VRP data and process config objects.""" if self.get_vrps(): self.process_vrps() def get_vrps(self): """Receive VRP set from agent process.""" self.info("Trying to get new VRP data from agent") for i in range(3): time.sleep(1) ...
code_fim
hard
{ "lang": "python", "repo": "wolcomm/eos-rpki-agent", "path": "/rpki_agent/listener.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wolcomm/eos-rpki-agent path: /rpki_agent/listener.py # Copyright (c) 2019 Ben Maddison. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law...
code_fim
hard
{ "lang": "python", "repo": "wolcomm/eos-rpki-agent", "path": "/rpki_agent/listener.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Configure logging using structlog, stdlib logging, and custom FloatRounder to round to spec numb digits""" logging.basicConfig(level=logging.INFO) logging.getLogger('deepcomp').setLevel(logging.WARNING) logging.getLogger('deepcomp.main').setLevel(logging.INFO) logging.getLogger('dee...
code_fim
medium
{ "lang": "python", "repo": "CN-UPB/DeepCoMP", "path": "/deepcomp/util/logs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CN-UPB/DeepCoMP path: /deepcomp/util/logs.py import logging import gym import structlog from structlog.stdlib import LoggerFactory from structlog_round import FloatRounder <|fim_suffix|> def config_logging(): """Configure logging using structlog, stdlib logging, and custom FloatRounder to r...
code_fim
medium
{ "lang": "python", "repo": "CN-UPB/DeepCoMP", "path": "/deepcomp/util/logs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def build_model(cfg, **kwargs): model = _MODELS[cfg.MODEL.NET](_DATASETS[cfg.DATA.DATASET].NUM_CLASS, backbone=cfg.MODEL.BACKBONE, **kwargs) return model<|fim_prefix|># repo: anotherTK/segmentation.pytorch path: /segm_benchmark/models/__init__.py from .fcn import FCN from .encnet import EncNet ...
code_fim
easy
{ "lang": "python", "repo": "anotherTK/segmentation.pytorch", "path": "/segm_benchmark/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anotherTK/segmentation.pytorch path: /segm_benchmark/models/__init__.py from .fcn import FCN from .encnet import EncNet <|fim_suffix|> model = _MODELS[cfg.MODEL.NET](_DATASETS[cfg.DATA.DATASET].NUM_CLASS, backbone=cfg.MODEL.BACKBONE, **kwargs) return model<|fim_middle|>from segm_benchma...
code_fim
medium
{ "lang": "python", "repo": "anotherTK/segmentation.pytorch", "path": "/segm_benchmark/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>BFA_COLOURS.BLUE = RGBA_Colour('blue', 79, 169, 255, 1) BFA_COLOURS.GREY = RGBA_Colour('grey', 0, 0, 0, 0.7) BFA_COLOURS.GREEN = RGBA_Colour('green', 126, 187, 153, 1) BFA_COLOURS.MIDNIGHT_BLUE = RGB_Colour('midnight-blue', 32, 37, 89) BFA_COLOURS.RED = RGBA_Colour('red', 255, 121, 91, 1) BFA_COLOURS.SILV...
code_fim
medium
{ "lang": "python", "repo": "SanHime/bfassist", "path": "/bfassist/standalone/webclient/colourscheme.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass # noinspection PyUnusedLocal def __postload__(forClient: bool = True): pass BFA_COLOURS = ColourScheme("BFA Colour Scheme") BFA_COLOURS.BLUE = RGBA_Colour('blue', 79, 169, 255, 1) BFA_COLOURS.GREY = RGBA_Colour('grey', 0, 0, 0, 0.7) BFA_COLOURS.GREEN = RGBA_Colour('green', 126, 187, 153,...
code_fim
medium
{ "lang": "python", "repo": "SanHime/bfassist", "path": "/bfassist/standalone/webclient/colourscheme.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SanHime/bfassist path: /bfassist/standalone/webclient/colourscheme.py ############################################################################# # # # Webclient Colour Scheme Module to BFA c7 Standalone # # ############################################################################# """ Thi...
code_fim
hard
{ "lang": "python", "repo": "SanHime/bfassist", "path": "/bfassist/standalone/webclient/colourscheme.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hrishitchaudhuri/clarke path: /model_checker/kripke.py import formula class KripkeStructure: def __init__(self, S, IID, R, L, P): self._states = S self._init = IID self._nsr = R self._labelling = L self._proposition = P def __repr__(self): ...
code_fim
hard
{ "lang": "python", "repo": "hrishitchaudhuri/clarke", "path": "/model_checker/kripke.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while check: check = False for state in self._labelling._states: if state not in visited_states: if prop2 in self._labelling._labels[state]: self._labelling.addLabel(state, prop) check = Tru...
code_fim
hard
{ "lang": "python", "repo": "hrishitchaudhuri/clarke", "path": "/model_checker/kripke.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: puneetj2k/serverless-victoria path: /test.py from contextlib import redirect_stdout import json from io import StringIO import sys from typing import ContextManager, List from victoria.script import victoria from victoria import config <|fim_suffix|> cfg = config.load("victoria.yaml") v...
code_fim
medium
{ "lang": "python", "repo": "puneetj2k/serverless-victoria", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cfg = config.load("victoria.yaml") victoria.cli.main(prog_name="victoria", args=args, obj=cfg) if __name__ == "__main__": f = StringIO() try: with redirect_stdout(f): run_victoria(["config", "view"]) except SystemExit: pass print(f.getvalue())<|fim_pre...
code_fim
medium
{ "lang": "python", "repo": "puneetj2k/serverless-victoria", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> objects = {} for name, obj in self.objects.items(): # serialize all obj properties all_properties = inspect.getmembers(obj, predicate=is_property) local_properties = {"private": {}, "public": {}} for prop_name, prop in all_properties: ...
code_fim
hard
{ "lang": "python", "repo": "MasoniteFramework/masonite", "path": "/src/masonite/dumps/Dump.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MasoniteFramework/masonite path: /src/masonite/dumps/Dump.py import time import inspect from pprint import pformat def color(string): return f"\033[93m{string}\033[0m" def is_property(obj): return not inspect.ismethod(obj) def is_local(obj_name, obj): return ( not obj_na...
code_fim
hard
{ "lang": "python", "repo": "MasoniteFramework/masonite", "path": "/src/masonite/dumps/Dump.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, objects, method, filename, line): self.objects = objects self.method = method self.filename = filename self.line = line self.timestamp = time.time() def serialize(self): objects = {} for name, obj in self.objects.items(): ...
code_fim
hard
{ "lang": "python", "repo": "MasoniteFramework/masonite", "path": "/src/masonite/dumps/Dump.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def read(self,f): self.isPlaying = getBool(f) self.isLooping = getBool(f) self.currentFrame = getInt(f) self.progressTicks = getInt(f) self.scale = getInt(f) self.x = getInt(f) self.y = getInt(f) def write(self,f): writeBool(self.isPlaying, f) writeBool(self.isLoop...
code_fim
medium
{ "lang": "python", "repo": "Tsubashi/iOS-FTL-Save-Game-Editor", "path": "/animation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tsubashi/iOS-FTL-Save-Game-Editor path: /animation.py from fileUtils import * class Animation: isPlaying = False isLooping = False currentFrame = 0 progressTicks = 0 scale = 0 x = 0 y = 0 def __init__(self, *args, **kwargs): if len(args) > 1: raise Warning("Extra pos...
code_fim
hard
{ "lang": "python", "repo": "Tsubashi/iOS-FTL-Save-Game-Editor", "path": "/animation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: keven425/3D-R2N2 path: /models/gru_net.py # import numpy as np # # # Theano # import theano # import theano.tensor as tensor # # from models.Model import Net, tensor5 # from lib.layers import TensorProductLayer, ConvLayer, PoolLayer, Unpool3DLayer, \ # LeakyReLU, SoftmaxWithLoss3D, Conv3DLaye...
code_fim
hard
{ "lang": "python", "repo": "keven425/3D-R2N2", "path": "/models/gru_net.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }