text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: SamyMe/django-markdown-newsletter path: /build/django-markdown-newsletter/build/lib.linux-i686-2.7/django-markdown-newsletter/models.py from django.db import models class Subscribe(models.Model): email = models.EmailField(unique=True) newsletter = models.CharField(max_length=20,default='newsle...
code_fim
medium
{ "lang": "python", "repo": "SamyMe/django-markdown-newsletter", "path": "/build/django-markdown-newsletter/build/lib.linux-i686-2.7/django-markdown-newsletter/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Theosakamg/PiCar_ROS path: /picar_bringup/scripts/twist2ackermann.py #!/usr/bin/env python3 import rospy, math from geometry_msgs.msg import Twist from ackermann_msgs.msg import AckermannDriveStamped from ackermann_msgs.msg import AckermannDrive from dynamic_reconfigure.server import Server as D...
code_fim
hard
{ "lang": "python", "repo": "Theosakamg/PiCar_ROS", "path": "/picar_bringup/scripts/twist2ackermann.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def convert_trans_rot_vel_to_steering_angle(self, speed, omega): steering_angle = 0 if not (omega == 0 or speed == 0): radius = speed / omega steering_angle = math.atan(self.wheelbase / radius) return steering_angle def cmd_callback(self, data): ...
code_fim
hard
{ "lang": "python", "repo": "Theosakamg/PiCar_ROS", "path": "/picar_bringup/scripts/twist2ackermann.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TorchSpatiotemporal/tsl path: /tests/test_example_forecasting.py import os import shutil import numpy as np import pytest import torch from hydra import compose, initialize from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from tsl.data...
code_fim
hard
{ "lang": "python", "repo": "TorchSpatiotemporal/tsl", "path": "/tests/test_example_forecasting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dm = SpatioTemporalDataModule( dataset=torch_dataset, scalers=transform, splitter=dataset.get_splitter(**cfg.dataset.splitting), batch_size=cfg.batch_size) dm.setup() ######################################## # predictor # ####...
code_fim
hard
{ "lang": "python", "repo": "TorchSpatiotemporal/tsl", "path": "/tests/test_example_forecasting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> checkpoint_callback = ModelCheckpoint( dirpath=log_dir, save_top_k=1, monitor='val_mae', mode='min', ) trainer = Trainer( max_epochs=cfg.epochs, default_root_dir=log_dir, logger=None, accelerator='gpu' if torch.cuda.is_available(...
code_fim
hard
{ "lang": "python", "repo": "TorchSpatiotemporal/tsl", "path": "/tests/test_example_forecasting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: liupei101/libsurv path: /libsurv/ciboost/_ci_core.py """ L2 term of objective function in BecCox. CI approximated by convex function F and its gradients. Convex function F = [-(y_hat[i] - y_hat[j] - _GAMMA)] ** 2 """ import numpy as np _GAMMA = 0.01 def ci_loss(preds, dtrain): """ Com...
code_fim
hard
{ "lang": "python", "repo": "liupei101/libsurv", "path": "/libsurv/ciboost/_ci_core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # firstly, compute gradients of numerator(\alpha) and denominator(\beta) in L2 for k in np.arange(n): ## gradients of denominator (\beta) # For set s1 (i.e. \omega 1 in the paper) # s1 = (k, i): E_k = 1 and T_k < T_i s1 = E[k] * np.sum(T > T[k]) # For set s2...
code_fim
hard
{ "lang": "python", "repo": "liupei101/libsurv", "path": "/libsurv/ciboost/_ci_core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "ci_loss", loss def _ci_grads(preds, dtrain): """ Gradient computation of custom objective function. Parameters ---------- preds: numpy.array An array with shape of (N, ), where N = #data. dtrain: xgboost.DMatrix Training data with type of `xgboost....
code_fim
hard
{ "lang": "python", "repo": "liupei101/libsurv", "path": "/libsurv/ciboost/_ci_core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = "ALLEGES" self.definitions = allege self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['allege']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_alleges.py #calss header class _ALLEGES(): <|fim_middle|> def __in...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_alleges.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_alleges.py #calss header class _ALLEGES(): <|fim_suffix|> self.basic = ['allege']<|fim_middle|> def __init__(self,): self.name = "ALLEGES" self.definitions = allege self.parents = [] self.childen = [] self.properties = [] self.js...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_alleges.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['allege']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_alleges.py #calss header class _ALLEGES(): def __init__(self,): <|fim_middle|> self.name = "ALLEGES" self.definitions = allege self.parents = [] self.childen = [] self.properties = [] self.js...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_alleges.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bbarney213/PyLendingClub path: /tests/wrapper/wrapper_test.py import requests from pylendingclub.wrapper.session import LendingClubSession if __name__ == '__main__': import sys from os.path import dirname, abspath, join package_path = join(dirname(dirname(dirname(abspath(__file__)))...
code_fim
hard
{ "lang": "python", "repo": "bbarney213/PyLendingClub", "path": "/tests/wrapper/wrapper_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>""" Tests Missing: Session: create_portfolio - No way to delete portfolio, so portfolios would become croweded over time submit_orders submit_order AccountSummary: - Extends the account_summary response. Allows a persisted summary that refreshes ...
code_fim
hard
{ "lang": "python", "repo": "bbarney213/PyLendingClub", "path": "/tests/wrapper/wrapper_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> source = """ flow "send_slack_message" { task "slack_api_call" "this" { client = { token = "ANY" } channel = "#random" text = "hello world" } task "file_write" "output" { filename = "/dev/stdout" content = tojson(eval(str(task.sla...
code_fim
hard
{ "lang": "python", "repo": "soasme/runflow", "path": "/tests/community/test_slack.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: soasme/runflow path: /tests/community/test_slack.py import pytest from slack_sdk.errors import SlackApiError from runflow import runflow pytest.importorskip('slack_sdk') def test_slack_api_call_invalid_token(mocker, capsys): async def chat_postMessage(**kwargs): raise SlackApiErr...
code_fim
hard
{ "lang": "python", "repo": "soasme/runflow", "path": "/tests/community/test_slack.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> runflow(source=""" flow "send_slack_message" { task "slack_api_call" "this" { client = { token = "ANY" some_random_argument = 1 } api_method = "chat.postMessage" channel = "#random" text = "hello world" } task "file_write" "ou...
code_fim
hard
{ "lang": "python", "repo": "soasme/runflow", "path": "/tests/community/test_slack.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sichkar-valentyn/Collatz_conjecture path: /Collatz_conjecture.py # File: Collatz_conjecture.py # Description: Implementing Collatz conjecture by recursive function # Environment: PyCharm and Anaconda environment # # MIT License # Copyright (c) 2018 Valentyn N Sichkar # github.com/sichkar-valentyn...
code_fim
hard
{ "lang": "python", "repo": "sichkar-valentyn/Collatz_conjecture", "path": "/Collatz_conjecture.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(number, end=' ') # Printing the number # Checking if the current calculated number is still more then 1 if number > 1: # Checking if the current number is even if number % 2 == 0: # Calling the recursive function and printing the integer division of current n...
code_fim
medium
{ "lang": "python", "repo": "sichkar-valentyn/Collatz_conjecture", "path": "/Collatz_conjecture.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Recursive function for calculating Collatz' sequence of numbers def Collatz(number): print(number, end=' ') # Printing the number # Checking if the current calculated number is still more then 1 if number > 1: # Checking if the current number is even if number % 2 == 0: ...
code_fim
medium
{ "lang": "python", "repo": "sichkar-valentyn/Collatz_conjecture", "path": "/Collatz_conjecture.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ErinClaudio/log-my-exercise path: /app/services/strava.py import os from datetime import datetime import requests from authlib.integrations.requests_client import OAuth2Session from flask import current_app from app import db from app.main import routes from app.models import StravaAthlete, Act...
code_fim
hard
{ "lang": "python", "repo": "ErinClaudio/log-my-exercise", "path": "/app/services/strava.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def tell_strava_deauth(strava_athlete): """ sends a command to strava informing them of the deauthorisation of this user :param strava_athlete: the strava athlete :type strava_athlete: :return: True if Strava acknowledged success, False otherwise :rtype: boolean """ access_...
code_fim
hard
{ "lang": "python", "repo": "ErinClaudio/log-my-exercise", "path": "/app/services/strava.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.add_column('parent', sa.Column('about_me', sa.String(length=300), nullable=True)) op.add_column('parent', sa.Column('last_seen', sa.DateTime(), nullable=True)) # ### end Alembic commands ### def downgrade(): # ### comma...
code_fim
hard
{ "lang": "python", "repo": "majidshirazi13666/somasoma-eLearning-app", "path": "/version1/migrations/versions/b63b46d48623_new_fields_in_parent_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: majidshirazi13666/somasoma-eLearning-app path: /version1/migrations/versions/b63b46d48623_new_fields_in_parent_model.py """new fields in parent model Revision ID: b63b46d48623 Revises: b53db8b2f9b9 Create Date: 2021-04-26 05:14:40.769477 """ from alembic import op import sqlalchemy as sa <|fi...
code_fim
hard
{ "lang": "python", "repo": "majidshirazi13666/somasoma-eLearning-app", "path": "/version1/migrations/versions/b63b46d48623_new_fields_in_parent_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.drop_column('parent', 'last_seen') op.drop_column('parent', 'about_me') # ### end Alembic commands ###<|fim_prefix|># repo: majidshirazi13666/somasoma-eLearning-app path: /version1/migrations/versions/b63b46d48623_new_fields...
code_fim
hard
{ "lang": "python", "repo": "majidshirazi13666/somasoma-eLearning-app", "path": "/version1/migrations/versions/b63b46d48623_new_fields_in_parent_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _post_zip_file(config, app_slug, in_file): boundary = '----------ThIs_Is_tHe_bouNdaRY_$' body = '\r\n'.join([ '--' + boundary, 'Content-Disposition: form-data; name="archive"; filename="archive.zip"', 'Content-Type: application/zip', '', in_file.getvalue...
code_fim
hard
{ "lang": "python", "repo": "abhimir/clutchclient", "path": "/clutchclient/commands/upload.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> namespace = APP_PARSER.parse_args() config = get_config(namespace) dirname = os.path.abspath(os.path.expanduser(namespace.directory)) app_slug = get_app_slug(namespace) if not os.path.isdir(dirname): error_msg = 'Sorry, but %s is not a directory' % (dirname,) print ...
code_fim
hard
{ "lang": "python", "repo": "abhimir/clutchclient", "path": "/clutchclient/commands/upload.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhimir/clutchclient path: /clutchclient/commands/upload.py # Copyright 2012 Twitter # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
code_fim
hard
{ "lang": "python", "repo": "abhimir/clutchclient", "path": "/clutchclient/commands/upload.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def spec_write_tab_file(scenario_directory, subproblem, stage, spec_project_params): spec_params_filepath = os.path.join( scenario_directory, str(subproblem), str(stage), "inputs", "spec_capacity_period_params.tab", ) # If spec_capacity_period_params.ta...
code_fim
hard
{ "lang": "python", "repo": "blue-marble/gridpath", "path": "/gridpath/project/capacity/capacity_types/common_methods.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: blue-marble/gridpath path: /gridpath/project/capacity/capacity_types/common_methods.py r the License. import csv import os.path import pandas as pd from db.common_functions import spin_on_database_lock from gridpath.project.common_functions import get_column_row_value def relevant_periods_by_...
code_fim
hard
{ "lang": "python", "repo": "blue-marble/gridpath", "path": "/gridpath/project/capacity/capacity_types/common_methods.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Helper function for writing the spec project param inputs to avoid redundant code in spec_write_tab_file(). """ for row in spec_project_params: [ project, period, specified_capacity_mw, hyb_gen_specified_capacity_mw, ...
code_fim
hard
{ "lang": "python", "repo": "blue-marble/gridpath", "path": "/gridpath/project/capacity/capacity_types/common_methods.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openwsn-berkeley/coap path: /bin/test_client.py import os import sys here = sys.path[0] sys.path.insert(0, os.path.join(here,'..')) import time import binascii from coap import coap from coap import coapOption as o from coap import coapObjectSecurity as oscore <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "openwsn-berkeley/coap", "path": "/bin/test_client.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>try: # retrieve value of 'test' resource p = c.GET('coap://[{0}]/test'.format(SERVER_IP), confirmable=True, options=[objectSecurity]) print('=====') print(''.join([chr(b) for b in p])) print('=====') except Exception as err: print(err) # cl...
code_fim
hard
{ "lang": "python", "repo": "openwsn-berkeley/coap", "path": "/bin/test_client.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #check if the ip is already in some port, if on port - delete, add to new port self.check_time() dp = self.cache.get(dpid) if dp is not None: ip_adr = ip_interface(ip) record = self.cache[dpid].get(ip_adr) if record is not None: ...
code_fim
hard
{ "lang": "python", "repo": "Konstantin-Minachkin/Ryu_SDN_Controller", "path": "/arp_cache.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Konstantin-Minachkin/Ryu_SDN_Controller path: /arp_cache.py # -*- coding: utf-8 -*- import time from helper_methods import props from collections import defaultdict from ipaddress import ip_interface DEFAULT_DEAD_TIME = 3600 #сколько помнить хост в секундах (dead time) class ArpCache:...
code_fim
hard
{ "lang": "python", "repo": "Konstantin-Minachkin/Ryu_SDN_Controller", "path": "/arp_cache.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_host(self, dp_id, ip): dp = self.cache.get(dp_id) record = None if dp is not None: record = self.cache[dp_id].get(mac) return record def get_all_dps(self, ip): #возвращает все {dp_id:port}, в которых есть этот ip dps = {...
code_fim
hard
{ "lang": "python", "repo": "Konstantin-Minachkin/Ryu_SDN_Controller", "path": "/arp_cache.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aiqm/torchani path: /tools/generate-unit-test-expect/tripeptide-md.py import ase import ase.io import ase.optimize import ase.md.velocitydistribution import ase.md.verlet import os from neurochem_calculator import NeuroChem, path import torchani import pickle <|fim_suffix|>ase.md.velocitydistrib...
code_fim
hard
{ "lang": "python", "repo": "aiqm/torchani", "path": "/tools/generate-unit-test-expect/tripeptide-md.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ase.md.velocitydistribution.MaxwellBoltzmannDistribution(molecule, temp, force_temp=True) ase.md.velocitydistribution.Stationary(molecule) ase.md.velocitydistribution.ZeroRotation(molecule) print("Initial temperature from velocities %.2f" % molecule.get_temperature()) molecule.set_calculator(torchani.mo...
code_fim
hard
{ "lang": "python", "repo": "aiqm/torchani", "path": "/tools/generate-unit-test-expect/tripeptide-md.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import tpClusterProducer from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import quickTrackAssociatorByHits from SimTracker.TrackAssociation.trackTimeValueMapProducer_cfi import trackTimeValueMapProducer from RecoMTD.Timing...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py import FWCore.ParameterSet.Config as cms from RecoVertex.Configuration.RecoVertex_cff import unsortedOfflinePrimaryVertices, trackWithVertexRefSelector, trackRefsForJets, sortedPrimaryVertices, offlinePrimaryVerti...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Set Button 動作 def get_user_input(): area = user_input_area.get() x = user_input_x.get() y = user_input_y.get() # 轉換輸入值(str -> float) new_area = converter.area_proportion(ast.literal_eval(area), area_array[2]) new_x = float(x) new_y = float(y) # 建立設定參數 x_coor = area_array...
code_fim
hard
{ "lang": "python", "repo": "vuncrychen/osu-wacom-linux-gui", "path": "/owl_gui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vuncrychen/osu-wacom-linux-gui path: /owl_gui.py import tkinter as tk import owl_lib import converter import ast # 視窗設定 root = tk.Tk() root.title("osu-wacom-linux-gui") root.geometry("600x400+700+200") # 實體化 Entry Box <|fim_suffix|> x_coor = area_array[2] * (float(new_area/100)) y_coor...
code_fim
hard
{ "lang": "python", "repo": "vuncrychen/osu-wacom-linux-gui", "path": "/owl_gui.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># 設定 owl_lib.set_area(0 + x_off, 0 + y_off, x_coor + x_off, y_coor + y_off) owl_lib.no_smoothing() # 實體化 Set Button set_button = tk.Button( root, text="Set", command=get_user_input ) # rotate 設定 def rotate_y(): owl_lib.rotate("y") def rotate_n(): owl_lib.rotate("n") select...
code_fim
hard
{ "lang": "python", "repo": "vuncrychen/osu-wacom-linux-gui", "path": "/owl_gui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .troc import troctoken_middleware from .jwt import jwt_middleware __all__ = ["troctoken_middleware", "jwt_middleware"]<|fim_prefix|># repo: kiniamogh/navigator-api path: /navigator/auth/middlewares/__init__.py """Nav Middleware. <|fim_middle|>Navigator Authorization Middlewares. """
code_fim
easy
{ "lang": "python", "repo": "kiniamogh/navigator-api", "path": "/navigator/auth/middlewares/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ["troctoken_middleware", "jwt_middleware"]<|fim_prefix|># repo: kiniamogh/navigator-api path: /navigator/auth/middlewares/__init__.py """Nav Middleware. Navigator Authorization Middlewares. """ <|fim_middle|>from .troc import troctoken_middleware from .jwt import jwt_middleware
code_fim
medium
{ "lang": "python", "repo": "kiniamogh/navigator-api", "path": "/navigator/auth/middlewares/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kiniamogh/navigator-api path: /navigator/auth/middlewares/__init__.py """Nav Middleware. <|fim_suffix|>__all__ = ["troctoken_middleware", "jwt_middleware"]<|fim_middle|>Navigator Authorization Middlewares. """ from .troc import troctoken_middleware from .jwt import jwt_middleware
code_fim
medium
{ "lang": "python", "repo": "kiniamogh/navigator-api", "path": "/navigator/auth/middlewares/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # input image dimensions self.img_rows, self.img_cols, self.img_chns = self.img_rows, self.img_cols, 1 if K.image_dim_ordering() == 'th': original_img_size = (self.img_chns, self.img_rows, self.img_cols) input_shape = (1, self.img_rows, self.img_cols) ...
code_fim
hard
{ "lang": "python", "repo": "WN1695173791/molecules-deprecated", "path": "/molecules/models/supervised/layer_output/layer_output.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WN1695173791/molecules-deprecated path: /molecules/models/supervised/layer_output/layer_output.py #%matplotlib inline from __future__ import print_function import numpy as np import gzip from six.moves import cPickle import sys from keras import backend as K from keras.utils import np_utils...
code_fim
hard
{ "lang": "python", "repo": "WN1695173791/molecules-deprecated", "path": "/molecules/models/supervised/layer_output/layer_output.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> arr = np.array([1.86644691e-05, 3.86592014e-03, 1.35335283e-01, 8.00737403e-01, 8.00737403e-01, 1.35335283e-01, 3.86592014e-03, 1.86644691e-05, 1.52299797e-08, 2.10040929e-12, 4.89586526e-17]) assert(np.allclose(w, arr)) assert (np.allclose(w, w2)) return None def test_cl...
code_fim
hard
{ "lang": "python", "repo": "msc-acse/acse-9-independent-research-project-dekape", "path": "/tests/test_siganalysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_dataspec(): dir_path = os.path.abspath(os.path.dirname(__file__)) OBS_PATH = os.path.join(dir_path, "test_data/ucalc_shot_1.sgy") OBS = tools.load(OBS_PATH, model=False, verbose=1) OBS.dt = [4] # fix sampling rate and number of samples OBS.samples = [1501] dataspec1 ...
code_fim
hard
{ "lang": "python", "repo": "msc-acse/acse-9-independent-research-project-dekape", "path": "/tests/test_siganalysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msc-acse/acse-9-independent-research-project-dekape path: /tests/test_siganalysis.py #!/usr/bin/env python # Deborah Pelacani Cruz # https://github.com/dekape import context import fullwaveqc.siganalysis as sig import os import fullwaveqc.tools as tools import copy import numpy as np def test_t...
code_fim
hard
{ "lang": "python", "repo": "msc-acse/acse-9-independent-research-project-dekape", "path": "/tests/test_siganalysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: log2timeline/plaso path: /plaso/multi_process/engine.py # -*- coding: utf-8 -*- """The multi-process processing engine.""" import abc import ctypes import os import signal import sys import threading import time from plaso.engine import engine from plaso.engine import process_info from plaso.li...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/plaso", "path": "/plaso/multi_process/engine.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Starts the status update thread.""" self._status_update_active = True self._status_update_thread = threading.Thread( name='Status update', target=self._StatusUpdateThreadMain) self._status_update_thread.start() def _StatusUpdateThreadMain(self): """Main function of the st...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/plaso", "path": "/plaso/multi_process/engine.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> logger.debug('Stopped monitoring process: {0:s} (PID: {1:d})'.format( process.name, pid)) def _StopMonitoringProcesses(self): """Stops monitoring all processes.""" # We need to make a copy of the list of pids since we are changing # the dict in the loop. for pid in list(self...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/plaso", "path": "/plaso/multi_process/engine.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _get_sql_create_table(self, table_attr): """ Generate create database statement :param table_attr: table attrs :return: SQL statement for creating """ template = 'CREATE TABLE IF NOT EXISTS "%s" (\n %s );' columns_pri, columns_ref, columns, c...
code_fim
hard
{ "lang": "python", "repo": "ggarri/mysql2psql", "path": "/libs/PsqlParser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ggarri/mysql2psql path: /libs/PsqlParser.py code, mysql_parser) output.write(users_sql) output.close() def generate_sql_schema(self, schema, schema_name, psql_tables_path): """ Generate sql queries from given schema :param schema: Psql schema ...
code_fim
hard
{ "lang": "python", "repo": "ggarri/mysql2psql", "path": "/libs/PsqlParser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> GRANT USAGE ON SCHEMA %s TO %s; GRANT ALL ON ALL SEQUENCES IN SCHEMA %s TO %s; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA %s TO %s; GRANT USAGE ON SCHEMA %s TO %s; GRANT ALL ON ALL SEQUENCES IN SCHEMA %s TO %s; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA ...
code_fim
hard
{ "lang": "python", "repo": "ggarri/mysql2psql", "path": "/libs/PsqlParser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: przor3n/kodownik path: /tests/test_result_screen.py import unittest # ResultScreenTestCase # test_if_is from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from kodownik.widget.screen.ResultScreen import ResultScreen class ResultScreenTestCase(unittest.TestCase): ...
code_fim
hard
{ "lang": "python", "repo": "przor3n/kodownik", "path": "/tests/test_result_screen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertIsInstance( self.result_screen.result_buttons.back_button, Button ) if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: przor3n/kodownik path: /tests/test_result_screen.py import unittest # ResultScreenTestCase # test_if_is from kivy.u...
code_fim
medium
{ "lang": "python", "repo": "przor3n/kodownik", "path": "/tests/test_result_screen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def test_if_is(self): self.assertTrue(self.result_screen) def test_if_has_test_results(self): self.assertTrue(self.result_screen.test_result) self.assertIsInstance( self.result_screen.test_result, GridLayout ) def test_if_...
code_fim
medium
{ "lang": "python", "repo": "przor3n/kodownik", "path": "/tests/test_result_screen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def hide_editor_ui(): from .main_editor import MainEditorWindow MainEditorWindow.hideWindow() def is_editor_ui_showing() -> bool: from .main_editor import MainEditorWindow return MainEditorWindow.isRaised() def tear_down_ui(): """ Hide and delete UI elements and registered ca...
code_fim
medium
{ "lang": "python", "repo": "bohdon/maya-pulse", "path": "/src/pulse/scripts/pulse/ui/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def destroy_all_pulse_windows(): """ Destroy all PulseWindows and their workspace controls. Intended for development reloading purposes. """ from .core import PulseWindow for cls in PulseWindow.__subclasses__(): cls.destroyWindow() def destroy_ui_model_instances(): "...
code_fim
hard
{ "lang": "python", "repo": "bohdon/maya-pulse", "path": "/src/pulse/scripts/pulse/ui/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bohdon/maya-pulse path: /src/pulse/scripts/pulse/ui/__init__.py """ The main package containing all UI and menu functionality. """ def toggle_editor_ui(): from .main_editor import MainEditorWindow MainEditorWindow.toggleWindow() def show_editor_ui(enable_context_menus=True): from...
code_fim
hard
{ "lang": "python", "repo": "bohdon/maya-pulse", "path": "/src/pulse/scripts/pulse/ui/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def normalise(norm): def _normalise(v): # Numba linear algebra operations are only supported on # contiguous arrays v = np.ascontiguousarray(v) return normalise_vector(v, order) if norm == 'l1': order = 1 if norm == 'l...
code_fim
hard
{ "lang": "python", "repo": "topher-lo/automl-rdatasets", "path": "/src/search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: topher-lo/automl-rdatasets path: /src/search.py """Functions for spaCy language processing pipeline and computing cosine similarity on spacy `Doc`s' word embeddings. """ import numpy as np from tqdm import tqdm from typing import List from typing import Mapping from typing import Union from .ut...
code_fim
hard
{ "lang": "python", "repo": "topher-lo/automl-rdatasets", "path": "/src/search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShreeshaN/VConvNet path: /vconv/visualiser/conv_visualiser.py # -*- coding: utf-8 -*- """ @created on: 11/27/19, @author: Shreesha N, @version: v0.0.1 @system name: badgod Description: ..todo:: """ import torch from vconv.networks.conv_network import SmallConvNet, VariableConvNet from vconv.ut...
code_fim
hard
{ "lang": "python", "repo": "ShreeshaN/VConvNet", "path": "/vconv/visualiser/conv_visualiser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(self): with torch.no_grad(): print(self.images_to_visualise + "/*") print(glob.glob(self.images_to_visualise + "/*")) for file in glob.glob(self.images_to_visualise + "/*"): print('Reading image ', file) image = cv2.im...
code_fim
hard
{ "lang": "python", "repo": "ShreeshaN/VConvNet", "path": "/vconv/visualiser/conv_visualiser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def plot_kernals(self): convs = ['conv1.weight', 'conv2.weight', 'conv3.weight'] for conv in convs: print('Plotting ', conv) kernal = self.network.state_dict()[conv] if conv != 'conv1.weight': print(kernal.numpy().shape) ...
code_fim
hard
{ "lang": "python", "repo": "ShreeshaN/VConvNet", "path": "/vconv/visualiser/conv_visualiser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mdl.save_plot_latent_space(model, directory, prefix="final") mdl.save_plot_latent_vs_generated(model, directory, prefix="final") mdl.save_plot_training_vs_generated(model, directory, prefix="final") filename = directory + "/final_generated.bvh" nframes = 200 x_path = model.run_ge...
code_fim
hard
{ "lang": "python", "repo": "dmytrov/gaussianprocess", "path": "/code/ml/gptheano/vecgpdm/paper_walk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmytrov/gaussianprocess path: /code/ml/gptheano/vecgpdm/paper_walk.py import numpy as np import matplotlibex as plx import ml.gptheano.vecgpdm.model as mdl import numerical.numpytheano.theanopool as tp import numerical.numpytheano as nt import matplotlibex.mlplot as plx import bvhrwroutines.bvhr...
code_fim
hard
{ "lang": "python", "repo": "dmytrov/gaussianprocess", "path": "/code/ml/gptheano/vecgpdm/paper_walk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: diamanto/pypore path: /src/pyporegui/graphicsItems/path_item.py from PySide import QtGui, QtCore import pyqtgraph as pg <|fim_suffix|> def __init__(self, x, y, conn='all'): xr = x.min(), x.max() yr = y.min(), y.max() self._bounds = QtCore.QRectF(xr[0], yr[0], xr[1] - ...
code_fim
easy
{ "lang": "python", "repo": "diamanto/pypore", "path": "/src/pyporegui/graphicsItems/path_item.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def boundingRect(self): return self._bounds<|fim_prefix|># repo: diamanto/pypore path: /src/pyporegui/graphicsItems/path_item.py from PySide import QtGui, QtCore import pyqtgraph as pg class PathItem(QtGui.QGraphicsPathItem): def __init__(self, x, y, conn='all'): <|fim_middle|> x...
code_fim
hard
{ "lang": "python", "repo": "diamanto/pypore", "path": "/src/pyporegui/graphicsItems/path_item.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __call__(self): value = self._rejection_sampling() out = np.round(value, n_decimals) if self._positive_definite: out = abs(out) return out def _rejection_sampling(self): param_min, param_max = self.parameter_values[0], self.parameter_value...
code_fim
hard
{ "lang": "python", "repo": "dangilman/LenstronomyWrapper", "path": "/lenstronomywrapper/Sampler/probability_distributions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dangilman/LenstronomyWrapper path: /lenstronomywrapper/Sampler/probability_distributions.py import numpy as np from scipy.interpolate import interp1d n_decimals = 6 class Uniform(object): def __init__(self, low, high, positive_definite=False): self._low, self._high = low, high ...
code_fim
hard
{ "lang": "python", "repo": "dangilman/LenstronomyWrapper", "path": "/lenstronomywrapper/Sampler/probability_distributions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leo566491/csci-homework path: /4155/assignments/a4/q1.py """ @author Alex Moriarty CSCI 4155 Machine Learning: Assignment 4. Gradient decent to learn regression of X,Y data. """ import numpy as np from sklearn.svm import SVR import matplotlib.pyplot as plt # Input Data DATA_FILE = 'A4Q1_data.n...
code_fim
hard
{ "lang": "python", "repo": "leo566491/csci-homework", "path": "/4155/assignments/a4/q1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>X = Data[0,:] Y = Data[1,:] myX = np.random.randn(10,1) myY = np.random.randn(10) print X.shape print Y.shape clf = SVR() clf.fit(myX,myY) print "the guess by SVR for x=20 is", clf.predict(20) fig1 = plt.figure() ax1 = fig1.add_subplot(111) p1a, = ax1.plot(X,Y,'o') m = float(Y.size) # add a column o...
code_fim
medium
{ "lang": "python", "repo": "leo566491/csci-homework", "path": "/4155/assignments/a4/q1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aguilerapy/kingfisher-process path: /docs/conf.py master_doc = 'index' <|fim_suffix|>html_static_path = ['database-tables.png']<|fim_middle|>project = 'OCDS Kingfisher Process Tool' copyright = '2018, Open Contracting Data Standard'
code_fim
medium
{ "lang": "python", "repo": "aguilerapy/kingfisher-process", "path": "/docs/conf.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>html_static_path = ['database-tables.png']<|fim_prefix|># repo: aguilerapy/kingfisher-process path: /docs/conf.py master_doc = 'index' <|fim_middle|>project = 'OCDS Kingfisher Process Tool' copyright = '2018, Open Contracting Data Standard'
code_fim
medium
{ "lang": "python", "repo": "aguilerapy/kingfisher-process", "path": "/docs/conf.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tylertrimble/viswaternet path: /tests/test_viswaternet.py #!/usr/bin/env python """Tests for `viswaternet` package.""" import unittest import viswaternet import os import matplotlib.pyplot as plt import numpy as np model = viswaternet.VisWNModel("tests/net1.inp") class TestViswaternet(unittes...
code_fim
hard
{ "lang": "python", "repo": "tylertrimble/viswaternet", "path": "/tests/test_viswaternet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestParameterBinning(unittest.TestCase): """Tests data binning.""" def test_interval_naming(self): self.model = {} self.model['node_names'] = ['E1','E2','E3','E4','E5','E6'] dummy_data=[1,2,3,5,6,7] interval_results, interval_names = viswaternet....
code_fim
hard
{ "lang": "python", "repo": "tylertrimble/viswaternet", "path": "/tests/test_viswaternet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hideo55/node-murmurhash3 path: /binding.gyp { 'targets': [ { 'target_name': 'murmurhash3', 'sources': ['src/MurmurHash3.cpp', 'src/node_murmurhash3.cc'], 'cflags': ['-fexceptions'], 'cflags_cc': [<|fim_suffix|>ditions': [ ['OS=="win"', { 'msvs_set...
code_fim
medium
{ "lang": "python", "repo": "hideo55/node-murmurhash3", "path": "/binding.gyp", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> } ], ['OS=="mac"', { 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' } } ] ] } ] }<|fim_prefix|># repo: hideo55/node-murmurhash3 path: /binding.gyp { 'targets': [ { 'target_name': 'murmurhash3...
code_fim
medium
{ "lang": "python", "repo": "hideo55/node-murmurhash3", "path": "/binding.gyp", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertResultIsBlock( CloudKit.CKDiscoverUserIdentitiesOperation.discoverUserIdentitiesCompletionBlock, # noqa: B950 b"v@", ) self.assertArgIsBlock( CloudKit.CKDiscoverUserIdentitiesOperation.setDiscoverUserIdentitie...
code_fim
hard
{ "lang": "python", "repo": "5l1v3r1/pyobjc", "path": "/pyobjc-framework-CloudKit/PyObjCTest/test_ckdiscoveruseridentitiesoperation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 5l1v3r1/pyobjc path: /pyobjc-framework-CloudKit/PyObjCTest/test_ckdiscoveruseridentitiesoperation.py import sys if sys.maxsize > 2 ** 32: from PyObjCTools.TestSupport import TestCase, min_os_level import CloudKit class TestCKDiscoverUserIdentitiesOperation(TestCase): <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "5l1v3r1/pyobjc", "path": "/pyobjc-framework-CloudKit/PyObjCTest/test_ckdiscoveruseridentitiesoperation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertResultIsBlock( CloudKit.CKDiscoverUserIdentitiesOperation.userIdentityDiscoveredBlock, b"v@@", ) self.assertArgIsBlock( CloudKit.CKDiscoverUserIdentitiesOperation.setUserIdentityDiscoveredBlock_, ...
code_fim
hard
{ "lang": "python", "repo": "5l1v3r1/pyobjc", "path": "/pyobjc-framework-CloudKit/PyObjCTest/test_ckdiscoveruseridentitiesoperation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_generated_data(self, sample_size, label): num_batches = sample_size // self.config.batch_size result = [] for idx in xrange(num_batches): z_sample = np.random.uniform(-1, 1, size=[int(self.config.batch_size), self.model.z_dim]) y_one_hot = np.ze...
code_fim
hard
{ "lang": "python", "repo": "rparrapy/DCGAN-tensorflow", "path": "/discriminator_evaluator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rparrapy/DCGAN-tensorflow path: /discriminator_evaluator.py from nideep.datasets.celeba.celeba import CelebA from utils import * import os class DiscriminatorEvaluator(object): def __init__(self, sess, model, config, cache_dir='/mnt/raid/data/ni/dnn/rparra/cache/'): self.sess = ses...
code_fim
hard
{ "lang": "python", "repo": "rparrapy/DCGAN-tensorflow", "path": "/discriminator_evaluator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for idx in xrange(0, batch_idxs): batch_labels = data_y[idx * self.config.batch_size:(idx + 1) * self.config.batch_size] batch_files = data[idx * self.config.batch_size:(idx + 1) * self.config.batch_size] batch = [ get_image(batch_file, ...
code_fim
hard
{ "lang": "python", "repo": "rparrapy/DCGAN-tensorflow", "path": "/discriminator_evaluator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NomadXD/covid19-tracker path: /cases.py ation':{'lat':8.087345,'lng': 81.177059,'value':'Kandakadu'}, 'status':'Hospitalized' }, '6':{ 'case_no':6, 'detected_date':'2020-03-14', 'age':4...
code_fim
hard
{ "lang": "python", "repo": "NomadXD/covid19-tracker", "path": "/cases.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'status':'Hospitalized' }, '39':{ 'case_no':39, 'detected_date':'2020-03-17', 'detected':'Kandakadu', 'detected_prefecture':'Polonnaruwa', 'origin':'Italy', ...
code_fim
hard
{ "lang": "python", "repo": "NomadXD/covid19-tracker", "path": "/cases.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NomadXD/covid19-tracker path: /cases.py 'detected_date':'2020-03-14', 'age':17, 'gender':'F', 'detected':'Mattegoda', 'detected_prefecture':'Colombo', 'origin':'Italy', ...
code_fim
hard
{ "lang": "python", "repo": "NomadXD/covid19-tracker", "path": "/cases.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Confirm the resize run("nova resize-confirm %s" % server_name) return True def test_migrate(context): count, args = context server_name = "server%d" % count cleanup = args.cleanup with server_built(server_name, args.image, cleanup=cleanup): # Migrate A -> B ...
code_fim
hard
{ "lang": "python", "repo": "starlingx-staging/stx-nova", "path": "/tools/xenserver/stress_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: starlingx-staging/stx-nova path: /tools/xenserver/stress_test.py # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
code_fim
hard
{ "lang": "python", "repo": "starlingx-staging/stx-nova", "path": "/tools/xenserver/stress_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument('-i', '--image', help="image to build from", required=True) parser.add_argument('-n', '--num-runs', type=int, help="number of runs", default=1) parser.add_argument('-c', '--concurrency', type=int, default=5, ...
code_fim
hard
{ "lang": "python", "repo": "starlingx-staging/stx-nova", "path": "/tools/xenserver/stress_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TeamRoquette/PyRat path: /lib/travelHeuristics.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import lib.shortestPaths as sp def generateMetaGraph (mazeMap, playerLocation, coins): """ Generate a metaGraph from mazeMap, containing all coins and the player. This function is built...
code_fim
hard
{ "lang": "python", "repo": "TeamRoquette/PyRat", "path": "/lib/travelHeuristics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> TSM_auxi(nodeStart, nodes, distance, path) return bestDistance, bestPaths def backTrack(metaGraph, startNode, path, deep): """ Implementation of the backTracking algorithm. """ global bestDistance global bestPaths bestDistance = float('inf') bestPaths = [] ...
code_fim
hard
{ "lang": "python", "repo": "TeamRoquette/PyRat", "path": "/lib/travelHeuristics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frangiz/AdventOfCode2017 path: /test/test_day15.py from days import day15 from ddt import ddt, data, unpack import unittest import util @ddt class MyTestCase(unittest.TestCase): @data( [['Generator A starts with 65', 'Generator B starts with 8921'], '588']) @unpack ...
code_fim
hard
{ "lang": "python", "repo": "frangiz/AdventOfCode2017", "path": "/test/test_day15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_answer_part_a(self): result = day15.part_a(util.get_file_contents('day15.txt')) self.assertEqual(result, '567') @data( [['Generator A starts with 65', 'Generator B starts with 8921'], '309']) @unpack def test_example_b(self, test_input, expected): ...
code_fim
hard
{ "lang": "python", "repo": "frangiz/AdventOfCode2017", "path": "/test/test_day15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /RecoMuon/L3MuonProducer/python/L3TkMuonProducer_cfi.py import FWCore.ParameterSet.Config as cm<|fim_suffix|>InputTag( "hltL3TkTracksFromL2NoVtx" ) )<|fim_middle|>s hltL3MuonsNoVtx = cms.EDProducer( "L3TkMuonProducer", InputObjects = cms.
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoMuon/L3MuonProducer/python/L3TkMuonProducer_cfi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>InputTag( "hltL3TkTracksFromL2NoVtx" ) )<|fim_prefix|># repo: cms-sw/cmssw path: /RecoMuon/L3MuonProducer/python/L3TkMuonProducer_cfi.py import FWCore.ParameterSet.Config as cm<|fim_middle|>s hltL3MuonsNoVtx = cms.EDProducer( "L3TkMuonProducer", InputObjects = cms.
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoMuon/L3MuonProducer/python/L3TkMuonProducer_cfi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }