text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: ClashLuke/iDAF path: /src/model_creator.py import os import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.callbacks import ModelCheckpoint from tensorflow.keras.initializers import orthogonal as initializer from tensorflow.keras.layers import (Add, BatchNormalization,...
code_fim
hard
{ "lang": "python", "repo": "ClashLuke/iDAF", "path": "/src/model_creator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: roksikonja/pyproject path: /src/pypackage/module.py """A module for computing geometric distances between vectors. """ import numpy as np <|fim_suffix|> def euclidean_distance(x: np.ndarray, y: np.ndarray) -> float: """Computes the Euclidean distance between points x and y given in Cartesia...
code_fim
medium
{ "lang": "python", "repo": "roksikonja/pyproject", "path": "/src/pypackage/module.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Computes the Euclidean distance between points x and y given in Cartesian coordinates. Args: x: A vector. y: A vector. Returns: A float representing the Euclidean distance between x and y. """ distance_vector: np.ndarray = x - y distance = compute_norm(...
code_fim
medium
{ "lang": "python", "repo": "roksikonja/pyproject", "path": "/src/pypackage/module.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: A float representing the Euclidean distance between x and y. """ distance_vector: np.ndarray = x - y distance = compute_norm(distance_vector) return distance<|fim_prefix|># repo: roksikonja/pyproject path: /src/pypackage/module.py """A module for computing geometric d...
code_fim
hard
{ "lang": "python", "repo": "roksikonja/pyproject", "path": "/src/pypackage/module.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' get the thing name from topic assuming topic: status/<DeviceType>/<MAC>/<AppName>/<AppId>/<type> thing name: <AppName><AppId><MAC> ''' def get_thing_name(topic): if topic.count('/') != 5: return None topic = topic.split('/') return "{name}{id}{mac}".format(name=topic[3], id=topic[...
code_fim
hard
{ "lang": "python", "repo": "iotap-center/mqtt-transformer", "path": "/mosquitto_awsiot_datashipper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Message received: ") if msg.topic.startswith("status/camera/"): return # This is, currently, of no use for CoSIS name = get_thing_name(msg.topic) if name is None: print("Unknown status topic: {}".format(msg.topic)) return status = msg....
code_fim
hard
{ "lang": "python", "repo": "iotap-center/mqtt-transformer", "path": "/mosquitto_awsiot_datashipper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iotap-center/mqtt-transformer path: /mosquitto_awsiot_datashipper.py from __future__ import print_function import paho.mqtt.client as paho_mqtt from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient import time, argparse, re, json import mosquitto_awsiot_config import socket # arguments parser = ...
code_fim
hard
{ "lang": "python", "repo": "iotap-center/mqtt-transformer", "path": "/mosquitto_awsiot_datashipper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: knightelvis/Mturk-Tracker path: /app/mturk/main/management/commands/diffs.py import time import logging from utils.sql import execute_sql, query_to_tuples log = logging.getLogger(__name__) def hitgroups(cid): r = execute_sql("select distinct group_id from hits_mv where crawl_id = %s", cid...
code_fim
hard
{ "lang": "python", "repo": "knightelvis/Mturk-Tracker", "path": "/app/mturk/main/management/commands/diffs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> prev = execute_sql("""select hits_available from hits_mv where crawl_id between %s and %s and group_id = '%s' order by crawl_id desc limit 1;""" % (cid - 100, cid - 1, g)).fetchall() prev = prev[0][0] if prev e...
code_fim
medium
{ "lang": "python", "repo": "knightelvis/Mturk-Tracker", "path": "/app/mturk/main/management/commands/diffs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = callback(*args, **kwargs) loop.call_soon_threadsafe(set_result, fut, result) fut = loop.create_future() return fut, func_wrapper<|fim_prefix|># repo: AlexCovizzi/torrenttv path: /torrenttv/utils/async_utils/futurize.py import asyncio def futurize(func, args=None, kwar...
code_fim
medium
{ "lang": "python", "repo": "AlexCovizzi/torrenttv", "path": "/torrenttv/utils/async_utils/futurize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexCovizzi/torrenttv path: /torrenttv/utils/async_utils/futurize.py import asyncio def futurize(func, args=None, kwargs=None, loop=None, executor=None): loop = loop or asyncio.get_event_loop() args = args or () kwargs = kwargs or {} awaitable = loop.run_in_executor(executor, fu...
code_fim
hard
{ "lang": "python", "repo": "AlexCovizzi/torrenttv", "path": "/torrenttv/utils/async_utils/futurize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AmrReda/Algorithms path: /src/Algorithm Implementation/Geometry/Convex hull/convex_hull.py """Computes the convex hull of a set of 2D points. Input: an iterable sequence of (x, y) pairs representing the points. Output: a list of vertices of the convex hull in counter-clockwise order, ...
code_fim
hard
{ "lang": "python", "repo": "AmrReda/Algorithms", "path": "/src/Algorithm Implementation/Geometry/Convex hull/convex_hull.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def add(self, point): self._points.append(point) def _get_orientation(self, origin, p1, p2): difference = ((p2.x - origin.x) * (p1.y - origin.y)) - ((p1.x - origin.x) - (p2.y - origin.y)) return difference<|fim_prefix|># repo: AmrReda/Algorithms path: /src/Algorithm ...
code_fim
medium
{ "lang": "python", "repo": "AmrReda/Algorithms", "path": "/src/Algorithm Implementation/Geometry/Convex hull/convex_hull.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not new_name.endswith(".pdf"): new_name += ".pdf" return new_name def extract_from_title(filename): with open(filename, "rb") as f: try: pdf = pdftotext.PDF(f) except: return try: text = pdf[0][:64].splitlines()[0] new_n...
code_fim
hard
{ "lang": "python", "repo": "morfismo/pdfs-rename", "path": "/rename/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: morfismo/pdfs-rename path: /rename/utils.py #!/usr/bin/env python3 from PyPDF2 import PdfFileReader from slugify import slugify import pdftotext <|fim_suffix|> new_name = slugify(name) if not new_name: return if not new_name.endswith(".pdf"): new_name += ".pdf" ...
code_fim
hard
{ "lang": "python", "repo": "morfismo/pdfs-rename", "path": "/rename/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> b,c=nx.intersection_array(nx.cycle_graph(5)) assert_equal(b,[2, 1]) assert_equal(c,[1, 1]) b,c=nx.intersection_array(nx.dodecahedral_graph()) assert_equal(b,[3, 2, 1, 1, 1]) assert_equal(c,[1, 1, 1, 2, 3]) b,c=nx.intersection_array(nx.icosahedral_gra...
code_fim
medium
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/lib/python2.7/site-packages/networkx/algorithms/tests/test_distance_regular.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_intersection_array(self): b,c=nx.intersection_array(nx.cycle_graph(5)) assert_equal(b,[2, 1]) assert_equal(c,[1, 1]) b,c=nx.intersection_array(nx.dodecahedral_graph()) assert_equal(b,[3, 2, 1, 1, 1]) assert_equal(c,[1, 1, 1, 2, 3]) b,c=n...
code_fim
hard
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/lib/python2.7/site-packages/networkx/algorithms/tests/test_distance_regular.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangyum/Anaconda path: /lib/python2.7/site-packages/networkx/algorithms/tests/test_distance_regular.py #!/usr/bin/env python from nose.tools import * import networkx as nx class TestDistanceRegular: def test_is_distance_regular(self): assert_true(nx.is_distance_regular(nx.icosahedra...
code_fim
hard
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/lib/python2.7/site-packages/networkx/algorithms/tests/test_distance_regular.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if prefix: if target_group_name.startswith(prefix): if not target_group_load_balancers: punt = True else: if not target_group_load_balancers: punt = True if punt: ...
code_fim
hard
{ "lang": "python", "repo": "Signiant/aws-target-group-cleanup", "path": "/src/aws-target-group-cleanup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Signiant/aws-target-group-cleanup path: /src/aws-target-group-cleanup.py import sys import boto3 import argparse import pprint from time import sleep def remove_target_group(arn, elb_client): request_id = None response = None try: response = elb_client.delete_target_group( ...
code_fim
hard
{ "lang": "python", "repo": "Signiant/aws-target-group-cleanup", "path": "/src/aws-target-group-cleanup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(argv): plugin_results = dict() groups_removed_count = 0 prefix = "" parser = argparse.ArgumentParser(description='Remove ALB target groups not assigned to load balancers') parser.add_argument('-f','--force', help='Perform the actual deletes (will run in dryrun mode by defaul...
code_fim
hard
{ "lang": "python", "repo": "Signiant/aws-target-group-cleanup", "path": "/src/aws-target-group-cleanup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return value1 + value2<|fim_prefix|># repo: jashburn8020/circleci-tutorial path: /src/maths.py class Maths: def addition(value1, value2): <|fim_middle|> """Add 2 integer values. Raises `TypeError` if arguments are non-integer.""" if not isinstance(value1, int) or not isinstance...
code_fim
hard
{ "lang": "python", "repo": "jashburn8020/circleci-tutorial", "path": "/src/maths.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jashburn8020/circleci-tutorial path: /src/maths.py class Maths: def addition(value1, value2): <|fim_suffix|> return value1 + value2<|fim_middle|> """Add 2 integer values. Raises `TypeError` if arguments are non-integer.""" if not isinstance(value1, int) or not isinstance...
code_fim
hard
{ "lang": "python", "repo": "jashburn8020/circleci-tutorial", "path": "/src/maths.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_conll_ner_datasets(vocab, char_vocab, tag_vocab, data_dir, lang): print(f'Loading CoNLL NER data for {lang} Language..') train_set = ConllDataset(os.path.join(data_dir, f'{lang}.train'), vocab, char_vocab, tag_vocab, update_vocab=True, remove_empty=opt.remove_emp...
code_fim
hard
{ "lang": "python", "repo": "microsoft/Multilingual-Model-Transfer", "path": "/data_prep/bio_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/Multilingual-Model-Transfer path: /data_prep/bio_dataset.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import copy import os import random import torch from torch.utils.data import Dataset from options import opt from utils import re...
code_fim
hard
{ "lang": "python", "repo": "microsoft/Multilingual-Model-Transfer", "path": "/data_prep/bio_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with instance_for_test() as instance: run_config = load_yaml_from_globs( file_relative_path(__file__, "../../docs_snippets/deploying/dask_hello_world.yaml") ) result = execute_pipeline( reconstructable(dask_pipeline), run_config=run_config, ...
code_fim
medium
{ "lang": "python", "repo": "JBrVJxsc/dagster", "path": "/examples/docs_snippets/docs_snippets_tests/deploying_tests/test_dask.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JBrVJxsc/dagster path: /examples/docs_snippets/docs_snippets_tests/deploying_tests/test_dask.py from dagster import execute_pipeline, file_relative_path, reconstructable from dagster.core.test_utils import instance_for_test from dagster.utils.yaml_utils import load_yaml_from_globs from docs_snipp...
code_fim
medium
{ "lang": "python", "repo": "JBrVJxsc/dagster", "path": "/examples/docs_snippets/docs_snippets_tests/deploying_tests/test_dask.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> devices = device_list.split(",") devices = [int(x) for x in devices] devices.sort() process_device_map = dict() for process_id, device_id in enumerate(devices): process_device_map[process_id] = device_id return process_device_map d...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/ACL_PyTorch/contrib/cv/gan/CycleGAN/parse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /ACL_PyTorch/contrib/cv/gan/CycleGAN/parse.py # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # Redistribution and use in source and binary forms, with or without # modification, are per...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/ACL_PyTorch/contrib/cv/gan/CycleGAN/parse.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bcgov/mds path: /services/core-api/app/api/now_applications/models/activity_summary/underground_exploration.py from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.schema import FetchedValue from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.hybrid import...
code_fim
hard
{ "lang": "python", "repo": "bcgov/mds", "path": "/services/core-api/app/api/now_applications/models/activity_summary/underground_exploration.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> __tablename__ = "underground_exploration" __mapper_args__ = { 'polymorphic_identity': 'underground_exploration', ## type code } activity_summary_id = db.Column( db.Integer, db.ForeignKey('activity_summary.activity_summary_id'), primary_key=True) total_ore_amount = db.C...
code_fim
medium
{ "lang": "python", "repo": "bcgov/mds", "path": "/services/core-api/app/api/now_applications/models/activity_summary/underground_exploration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("%d %d %d" % (len(l), neg_count, pos_count)) outp = open("train.json", 'w', encoding="utf-8") outp.write(json.dumps(l[ : int(len(l) / 5 * 4)], indent=4, ensure_ascii=False)) outp.close() outp = open("test.json", 'w', encoding="utf-8") outp.write(json.dumps(l[int(len(l) / 5 * 4) : ], indent=4, ensu...
code_fim
hard
{ "lang": "python", "repo": "UglyDogIsDog/VectorizeBlockchainNews", "path": "/scripts/split.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UglyDogIsDog/VectorizeBlockchainNews path: /scripts/split.py import json import random inp = open("data.json", "rb") passages = json.load(inp) inp.close() <|fim_suffix|>outp = open("train.json", 'w', encoding="utf-8") outp.write(json.dumps(l[ : int(len(l) / 5 * 4)], indent=4, ensure_ascii=False...
code_fim
hard
{ "lang": "python", "repo": "UglyDogIsDog/VectorizeBlockchainNews", "path": "/scripts/split.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lypnol/adventofcode-2017 path: /day-22/part-2/silvestre.py from collections import deque from submission import Submission class SilvestreSubmission(Submission): def run(self, s): current_grid = self.read_input(s) virus_pos = [len(current_grid)//2 for i in range(2)] ...
code_fim
hard
{ "lang": "python", "repo": "lypnol/adventofcode-2017", "path": "/day-22/part-2/silvestre.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> State : 0 - Clean 1 - Weakened 2 - Infected 3 - Flagged """ # Step 1 & 2 curr_x = virus_pos[0] curr_y = virus_pos[1] assert 0 <= curr_x < len(current_grid) and 0 <= curr_y < len(current_grid) if current_grid[curr_x][cu...
code_fim
hard
{ "lang": "python", "repo": "lypnol/adventofcode-2017", "path": "/day-22/part-2/silvestre.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def read_input(self, s): """ On crée une grid. Une list de list (une deque de deque) """ grid = deque() for str_row in s.split("\n"): grid.append(deque(list(map(int,str_row.replace('.','0').replace('#','2'))))) return grid<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "lypnol/adventofcode-2017", "path": "/day-22/part-2/silvestre.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ self.new_credential.credential_create() test_credentials = Credentials("MySpace", "Ghostke99", "daimaMkenya001") test_credentials.credential_create() search_duplicate = Credentials.search_duplicate("MySpace") self.assertTrue(search_duplicate) if __name_...
code_fim
hard
{ "lang": "python", "repo": "k-wayne/PasswordVault", "path": "/test_credential.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: k-wayne/PasswordVault path: /test_credential.py import unittest from credential import Credentials import pyperclip class TestUser(unittest.TestCase): def setUp(self): """ #method to run before each test """ # instantiate an object by populating with dummy va...
code_fim
hard
{ "lang": "python", "repo": "k-wayne/PasswordVault", "path": "/test_credential.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: open-toontown/open-toontown path: /toontown/ai/CrashedLeaderBoardDecorator.py from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from . import HolidayDecorator from toontown.toonbase import ToontownGlobals fr...
code_fim
hard
{ "lang": "python", "repo": "open-toontown/open-toontown", "path": "/toontown/ai/CrashedLeaderBoardDecorator.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(base.cr.playGame.getPlace().loader.hood, GSHood.GSHood): base.cr.playGame.getPlace().loader.stopSmokeEffect() def undecorate(self): if base.config.GetBool('want-crashedLeaderBoard-Smoke', 1): self.stopSmokeEffect() holidayIds = base.cr.new...
code_fim
medium
{ "lang": "python", "repo": "open-toontown/open-toontown", "path": "/toontown/ai/CrashedLeaderBoardDecorator.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: shurrey/ask-an-expert path: /slackmodule/SlackService.py import Config import slack class SlackService(): def __init__(self): print(str(slack)) self.client = slack.WebClient(token=Config.config['slack_token']) def sendExpertMessage(self, channel, fname, gname, expert_u...
code_fim
hard
{ "lang": "python", "repo": "shurrey/ask-an-expert", "path": "/slackmodule/SlackService.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print("Response: " + str(response)) def composeMessage(self, fname, gname, expert_url, institution, product, question): return(f"We have a question!\r\n" \ f"\r\n" \ f"User: {fname} {gname}\r\n" \ f"Institution: {institution}\r\n" \ ...
code_fim
hard
{ "lang": "python", "repo": "shurrey/ask-an-expert", "path": "/slackmodule/SlackService.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: milenpenev/Python_Advanced path: /Exam preparation/Python Advanced Retake Exam - 14 April 2021/01-pizza-orders.py from collections import deque pizza_orders = [int(el) for el in input().split(", ")] employees = [int(el) for el in input().split(", ")] completed_orders = [] pizza_orders = deque(pi...
code_fim
hard
{ "lang": "python", "repo": "milenpenev/Python_Advanced", "path": "/Exam preparation/Python Advanced Retake Exam - 14 April 2021/01-pizza-orders.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if employees: print("All orders are successfully completed!") print(f"Total pizzas made: {sum(completed_orders)}") print("Employees: ", end="") print(*employees, sep=", ") else: print("Not all orders are completed.") print("Orders left: ", end="") print(*pizza_orders, sep=", "...
code_fim
hard
{ "lang": "python", "repo": "milenpenev/Python_Advanced", "path": "/Exam preparation/Python Advanced Retake Exam - 14 April 2021/01-pizza-orders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> conv21 = tf.layers.conv2d(conv20, 1024, (3, 3), (1, 1), padding='same', activation=leaky_relu) pad2 = tf.keras.layers.ZeroPadding2D((1,1))(conv21) conv22 = tf.layers.conv2d(pad2, 1024, (3, 3), (2, 2), padding='valid', activation=leaky_relu) conv23 = tf.layers.conv2d(conv22,...
code_fim
hard
{ "lang": "python", "repo": "cersar/BasicNetwork", "path": "/network/YoloV1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def compute_loss(y_true,y_hat,lambd_coord=5,lambd_nonObj=.5): probes_hat, confs_hat, boxes_cord_hat = y_hat obj_mask = y_true[..., 0] confs_true = tf.expand_dims(obj_mask,axis=2) boxes_cord_true = tf.expand_dims(y_true[...,1:5],axis=2) probes_true = y_true[...,5:] IOU = compute_I...
code_fim
hard
{ "lang": "python", "repo": "cersar/BasicNetwork", "path": "/network/YoloV1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cersar/BasicNetwork path: /network/YoloV1.py import tensorflow as tf from util.process_box import compute_IOU import numpy as np def YoloV1(input_shape,class_num=20,box_num=2): iw, ih, c = input_shape net = tf.Graph() with net.as_default(): x = tf.placeholder(tf.float32, sha...
code_fim
hard
{ "lang": "python", "repo": "cersar/BasicNetwork", "path": "/network/YoloV1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/framework/type_utils.py # Copyright 2022 The TensorFlow 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 th...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tensorflow", "path": "/tensorflow/python/framework/type_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># LINT.IfChange(_specs_for_flat_tensors) def _specs_for_flat_tensors(element_spec): """Return a flat list of type specs for element_spec. Note that "flat" in this function and in `_flat_tensor_specs` is a nickname for the "batchable tensor list" encoding used by datasets and map_fn internally (in...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tensorflow", "path": "/tensorflow/python/framework/type_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def generate_chunk_pairs(self, pair: SamplePair) -> Iterable[Tuple[str, str]]: len_a = len(pair.chunks_a) len_b = len(pair.chunks_b) sampled_items = [] if len_b < len_a: for b in pair.chunks_b: while True: ...
code_fim
hard
{ "lang": "python", "repo": "av-pt/unmasking", "path": "/authorship_unmasking/features/sampling.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: av-pt/unmasking path: /authorship_unmasking/features/sampling.py # Copyright (C) 2017-2019 Janek Bevendorff, Webis Group # # 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": "av-pt/unmasking", "path": "/authorship_unmasking/features/sampling.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vfdev-5/ignite-examples path: /classification/imaterialist_challenge_furniture_2018/models/inceptionresnetv2_ssd_like.py import torch import torch.nn as nn from torch.nn import Module, Linear, ModuleList, AdaptiveAvgPool2d, ReLU, Dropout from torch.nn.init import normal_, constant_ from pretraine...
code_fim
hard
{ "lang": "python", "repo": "vfdev-5/ignite-examples", "path": "/classification/imaterialist_challenge_furniture_2018/models/inceptionresnetv2_ssd_like.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ) self.smooth2 = nn.Sequential( nn.Conv2d(1088, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1), nn.ReLU() ) self.smooth3 = nn.Sequential( nn.Conv2d(2080...
code_fim
hard
{ "lang": "python", "repo": "vfdev-5/ignite-examples", "path": "/classification/imaterialist_challenge_furniture_2018/models/inceptionresnetv2_ssd_like.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert type(coord) is tuple, "expected a tuple as coordinate" assert len(coord) == 3, "expected 3 elements in coordinate" for v in coord: assert type(v) is float or type(v) is np.float64, "expected type float in elements of coordinate" point = np.array([co...
code_fim
hard
{ "lang": "python", "repo": "Natasja1992/ifc-citygml-2-envi", "path": "/conversion_tool/georeferencing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> point = np.array([coord[0], coord[1], coord[2], 1]) transformed_point = self._T_inv.dot(point) return transformed_point[0], transformed_point[1], transformed_point[2] def transform_point_reverse(self, coord): assert type(coord) is tuple, "expected a tuple as coord...
code_fim
hard
{ "lang": "python", "repo": "Natasja1992/ifc-citygml-2-envi", "path": "/conversion_tool/georeferencing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Natasja1992/ifc-citygml-2-envi path: /conversion_tool/georeferencing.py from osgeo.osr import SpatialReference, CoordinateTransformation import numpy as np class Transform(object): def __init__(self): pass def transform_point(self, coord): raise NotImplementedE...
code_fim
hard
{ "lang": "python", "repo": "Natasja1992/ifc-citygml-2-envi", "path": "/conversion_tool/georeferencing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangyum/Anaconda path: /lib/python2.7/site-packages/binstar_client/commands/logout.py ''' Log out from binstar ''' import getpass from binstar_client.utils import get_server_api, remove_token import logging from binstar_client import errors log = logging.getLogger('binstar.logout') def main(ar...
code_fim
medium
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/lib/python2.7/site-packages/binstar_client/commands/logout.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def add_parser(subparsers): subparser = subparsers.add_parser('logout', help='Log out from Anaconda Cloud', description=__doc__) subparser.set_defaults(main=main)<|fim_prefix|># repo: wangyum/Anaconda path: /lib/python2...
code_fim
hard
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/lib/python2.7/site-packages/binstar_client/commands/logout.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: period: Period in milliseconds for running the work periodically. action: Action to be executed. state: [Optional] Initial state passed to the action upon the first iteration. Returns: The disposable obj...
code_fim
hard
{ "lang": "python", "repo": "markusj1201/RxPY", "path": "/rx/concurrency/mainloopscheduler/wxscheduler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: markusj1201/RxPY path: /rx/concurrency/mainloopscheduler/wxscheduler.py import logging from typing import Any from rx.disposable import Disposable from rx.core import typing from rx.disposable import SingleAssignmentDisposable, CompositeDisposable from rx.concurrency.schedulerbase import Schedul...
code_fim
hard
{ "lang": "python", "repo": "markusj1201/RxPY", "path": "/rx/concurrency/mainloopscheduler/wxscheduler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_config(self, budget): # pylint: disable=unused-argument return self.configspace.sample_configuration().get_dictionary(), {} class RandomSearch(hp_transfer_optimizers.core.master.Master): def __init__( self, **kwargs, ): super().__init__(**kwargs) sel...
code_fim
hard
{ "lang": "python", "repo": "hp-transfer/ht_optimizers", "path": "/hp_transfer_optimizers/random_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hp-transfer/ht_optimizers path: /hp_transfer_optimizers/random_search.py import numpy as np import hp_transfer_optimizers.core.master from hp_transfer_optimizers.core.successivehalving import SuccessiveHalving class _RandomSampler: """ class to implement random sampling from a Con...
code_fim
hard
{ "lang": "python", "repo": "hp-transfer/ht_optimizers", "path": "/hp_transfer_optimizers/random_search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, **kwargs, ): super().__init__(**kwargs) self.config_generator = None # Hyperband related stuff from original hpbandster code, we keep this as we might # support multi fidelity in the future. self.eta = eta = 3 self.min_budget = min_budget...
code_fim
hard
{ "lang": "python", "repo": "hp-transfer/ht_optimizers", "path": "/hp_transfer_optimizers/random_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iskandr/msmhc path: /tests/test_extract_peptides.py from msmhc.sequence import Sequence from msmhc.peptides import extract_peptides from nose.tools import eq_ <|fim_suffix|> seq = Sequence(name="test-seq", amino_acids="SIINFEKL") peptide_dict = extract_peptides([seq], min_length=7, max_le...
code_fim
easy
{ "lang": "python", "repo": "iskandr/msmhc", "path": "/tests/test_extract_peptides.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> seq = Sequence(name="test-seq", amino_acids="SIINFEKL") peptide_dict = extract_peptides([seq], min_length=7, max_length=8) eq_(set(peptide_dict.keys()), { "SIINFEKL", "SIINFEK", "IINFEKL" })<|fim_prefix|># repo: iskandr/msmhc path: /tests/test_extract_peptides.py f...
code_fim
easy
{ "lang": "python", "repo": "iskandr/msmhc", "path": "/tests/test_extract_peptides.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def output(monkeypatch, terminal_size, testdata, explicit_pager, expect_pager): global clickoutput clickoutput = "" m = LiteCli(liteclirc=default_config_file) class TestOutput: def get_size(self): size = namedtuple("Size", "rows columns") size.columns, size...
code_fim
hard
{ "lang": "python", "repo": "dbcli/litecli", "path": "/tests/test_main.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbcli/litecli path: /tests/test_main.py import os from collections import namedtuple from textwrap import dedent from tempfile import NamedTemporaryFile import shutil import click from click.testing import CliRunner from litecli.main import cli, LiteCli from litecli.packages.special.main import...
code_fim
hard
{ "lang": "python", "repo": "dbcli/litecli", "path": "/tests/test_main.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: WaruiAlfred/instagram-clone path: /authentication/views.py from django.shortcuts import render,redirect from . forms import UserRegistrationForm,UserUpdateForm,ProfileUpdateForm from django.contrib import messages from django.contrib.auth.decorators import login_required from app_activities.model...
code_fim
hard
{ "lang": "python", "repo": "WaruiAlfred/instagram-clone", "path": "/authentication/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: message = "That user doesn't exist" return render(request, 'search.html',{"message":message}) def follow(request): if request.method == 'POST': value = request.POST['value'] user = request.POST['user'] follower = request.POST['follower'] if value == 'follow': ...
code_fim
hard
{ "lang": "python", "repo": "WaruiAlfred/instagram-clone", "path": "/authentication/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kshitijgoel007/ros_utils path: /src/ros_utils/util.py import numpy as np import rospy from scipy.spatial.transform import Rotation as R from geometry_msgs.msg import Vector3 from quadrotor_msgs.msg import RPMCommand def tonp(obj): if type(obj) == list: return np.array([tonp(x) for x in ...
code_fim
medium
{ "lang": "python", "repo": "kshitijgoel007/ros_utils", "path": "/src/ros_utils/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return np.hstack(( tonp(imu.orientation).as_euler('ZYX')[::-1], tonp(imu.angular_velocity), tonp(imu.linear_acceleration))) def rpmstoros(rpms): rpm_msg = RPMCommand() for i in range(0, len(rpms)): rpm_msg.motor_rpm[i] = int(rpms[i]) return rpm_msg<|fim_prefix|># repo: k...
code_fim
medium
{ "lang": "python", "repo": "kshitijgoel007/ros_utils", "path": "/src/ros_utils/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rpm_msg = RPMCommand() for i in range(0, len(rpms)): rpm_msg.motor_rpm[i] = int(rpms[i]) return rpm_msg<|fim_prefix|># repo: kshitijgoel007/ros_utils path: /src/ros_utils/util.py import numpy as np import rospy from scipy.spatial.transform import Rotation as R from geometry_msgs.ms...
code_fim
medium
{ "lang": "python", "repo": "kshitijgoel007/ros_utils", "path": "/src/ros_utils/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dchudz/bokeh-maps path: /code_examples/map_example.py from bokeh.plotting import * from PIL import Image import numpy as np import pandas as pd import pyproj from MapArea import rgba_to_array2d, get_stamen_maptile, add_maparea_to_plot def get_world_capitals(): world_capitals = pd.read_html("...
code_fim
hard
{ "lang": "python", "repo": "dchudz/bokeh-maps", "path": "/code_examples/map_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def convert_lat_lon_to_x_y(lon, lat): #output is currently in meters. Need to convert it to the right units (adjusted degrees?) #tiles.mapbox.com uses EPSG:3857 web_mercator=pyproj.Proj("+init=EPSG:3857") return(web_mercator(lon, lat)) world_capitals = get_world_capitals() world_capital...
code_fim
medium
{ "lang": "python", "repo": "dchudz/bokeh-maps", "path": "/code_examples/map_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ReyesDeJong/CC5114 path: /Ex1/perceptron.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Aug 6 23:19:22 2017 class Perceptron as AND, OR & NAND gates @author: Esteban Reyes de Jong """ class Perceptron: <|fim_suffix|>class AND(Perceptron): def __init__(self): ...
code_fim
hard
{ "lang": "python", "repo": "ReyesDeJong/CC5114", "path": "/Ex1/perceptron.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): super().__init__(-0.5, -0.5, 0.75) #small tests if __name__ == "__main__": # main() p_AND = AND() out_AND = p_AND.act([1,1]) p_OR = OR() out_OR = p_OR.act([0,0]) p_NAND = NAND() out_NAND = p_NAND.act([0,0])<|fim_prefix|># repo: ReyesDeJong/...
code_fim
medium
{ "lang": "python", "repo": "ReyesDeJong/CC5114", "path": "/Ex1/perceptron.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cfhamlet/os-qdb-protocal path: /src/os_qdb_protocal/__init__.py import pkgutil import inspect import sys from .protocal import Protocal from importlib import import_module _PROTOCALS = {} <|fim_suffix|> __all__ = ['__version__', 'version_info', 'create_protocal'] __version__ = pkgutil.get_dat...
code_fim
hard
{ "lang": "python", "repo": "cfhamlet/os-qdb-protocal", "path": "/src/os_qdb_protocal/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ['__version__', 'version_info', 'create_protocal'] __version__ = pkgutil.get_data(__package__, 'VERSION').decode('ascii').strip() version_info = tuple(int(v) if v.isdigit() else v for v in __version__.split('.')) del pkgutil del Protocal del import_module del inspect del in...
code_fim
medium
{ "lang": "python", "repo": "cfhamlet/os-qdb-protocal", "path": "/src/os_qdb_protocal/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OptimusPrimus/dcase2019_task1b path: /utils/training/lr_scheduler.py from torch.optim.lr_scheduler import _LRScheduler class LinearLR(_LRScheduler): <|fim_suffix|> self.initial_hold = initial_hold self.step_size = (-initial_lr) / (nr_epochs - initial_hold) super(LinearLR,...
code_fim
medium
{ "lang": "python", "repo": "OptimusPrimus/dcase2019_task1b", "path": "/utils/training/lr_scheduler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.last_epoch <= self.initial_hold: return self.base_lrs return [group['lr'] + self.step_size for group in self.optimizer.param_groups]<|fim_prefix|># repo: OptimusPrimus/dcase2019_task1b path: /utils/training/lr_scheduler.py from torch.optim.lr_scheduler import _LRSchedu...
code_fim
medium
{ "lang": "python", "repo": "OptimusPrimus/dcase2019_task1b", "path": "/utils/training/lr_scheduler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>042836, 7.885294, 0.260368, 3.042539, 0.000000], ], "Be2+": [ [3.055430, -2.372617, 1.044914, 0.544233, 0.381737, -0.653773], [0.001226, 0.001227, 1.542106, 0.456279, 4.047479, 0.000000], ], "Cval": [ [1.258489, 0.728215, 1.119856, 2.168133, 0.705239, 0.019722], ...
code_fim
hard
{ "lang": "python", "repo": "ExcitedStates/qfit-3.0", "path": "/src/qfit/atomsf.py", "mode": "spm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_suffix|>, 1.086542], [2.025174, 0.176650, 3.573822, 7.685848, 16.677574, 0.000000], ], "Br1-": [ [17.714310, 6.466926, 6.947385, 4.402674, -0.697279, 1.152674], [2.122554, 19.050768, 0.152708, 58.690361, 58.690372, 0.000000], ], "Rb1+": [ [17.684320, 7.761588, 6.680...
code_fim
hard
{ "lang": "python", "repo": "ExcitedStates/qfit-3.0", "path": "/src/qfit/atomsf.py", "mode": "spm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: antoinemadec/coc-fzf path: /script/get_workspace_symbols.py #!/usr/bin/env python3 import argparse import re from urllib.parse import unquote from pynvim import attach # -------------------------------------------------------------- # functions # ----------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "antoinemadec/coc-fzf", "path": "/script/get_workspace_symbols.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def file_is_excluded(filename, exclude_re_patterns): for pattern in exclude_re_patterns: if re.match(pattern, filename): return True return False # -------------------------------------------------------------- # execution # ---------------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "antoinemadec/coc-fzf", "path": "/script/get_workspace_symbols.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> state = { 'job_counts': { 'pending': 0, 'running': 0, 'complete': 0 }, 'jobs': {} } job_ids = list(self._jobs.keys()) for job_id in job_ids: job = self._jobs[job_id] ...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/hither", "path": "/hither2/scriptdir_runner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> import yaml self._directory = directory self._jobs: Dict[str, ScriptDirRunnerJob] = {} config_path = f'{directory}/config.yaml' with open(config_path, 'r') as f: config = yaml.safe_load(f) def iterate(self): jobs_path = f'{self._directory}/j...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/hither", "path": "/hither2/scriptdir_runner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stjordanis/hither path: /hither2/scriptdir_runner.py import os import shutil from typing import Dict, Union import json class ScriptDirRunnerJob: def __init__(self, directory): import kachery_client as kc self._directory = directory self._status = '' self._sc...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/hither", "path": "/hither2/scriptdir_runner.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brazil-data-cube/forest-monitor path: /forest_monitor/models/base_sql.py # pylint: disable=E0239 from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from forest_monitor.config import getCurrentConfig def getDatabase(): database = create_e...
code_fim
hard
{ "lang": "python", "repo": "brazil-data-cube/forest-monitor", "path": "/forest_monitor/models/base_sql.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class BaseModel(declarative_base(metadata=MetaData()), DBO): """ Abstract class for ORM model. Injects both `created_at` and `updated_at` fields in table """ __abstract__ = True def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key,...
code_fim
hard
{ "lang": "python", "repo": "brazil-data-cube/forest-monitor", "path": "/forest_monitor/models/base_sql.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># In [72]: env.action_space. # env.action_space.contains env.action_space.n env.action_space.to_jsonable # env.action_space.from_jsonable env.action_space.sample # pick an action action = env.action_space.sample() # do an action observation, reward, done, info = env.step(action) # ...
code_fim
hard
{ "lang": "python", "repo": "vicb1/deep-learning", "path": "/1-notebook-examples/keras-udemy-course/rl2/gym_tutorial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vicb1/deep-learning path: /1-notebook-examples/keras-udemy-course/rl2/gym_tutorial.py # https://deeplearningcourses.com/c/deep-reinforcement-learning-in-python # https://www.udemy.com/deep-reinforcement-learning-in-python import gym # Wiki: # https://github.com/openai/gym/wiki/CartPole-v0 # Envir...
code_fim
medium
{ "lang": "python", "repo": "vicb1/deep-learning", "path": "/1-notebook-examples/keras-udemy-course/rl2/gym_tutorial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># do an action observation, reward, done, info = env.step(action) # run through an episode done = False while not done: observation, reward, done, _ = env.step(env.action_space.sample())<|fim_prefix|># repo: vicb1/deep-learning path: /1-notebook-examples/keras-udemy-course/rl2/gym_tutorial.py # https...
code_fim
hard
{ "lang": "python", "repo": "vicb1/deep-learning", "path": "/1-notebook-examples/keras-udemy-course/rl2/gym_tutorial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: materialsproject/dash-mp-components path: /dash_mp_components/test_api/utils.py from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys def resize_browser_window(width, height, drive...
code_fim
hard
{ "lang": "python", "repo": "materialsproject/dash-mp-components", "path": "/dash_mp_components/test_api/utils.py", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|> action = ActionChains(driver) action.move_to_element_with_offset(el, x, y) action.perform() # move to dedicated file class element_has_css_class(object): """An expectation for checking that an element has a particular css class. locator - used to find the element returns the Web...
code_fim
hard
{ "lang": "python", "repo": "materialsproject/dash-mp-components", "path": "/dash_mp_components/test_api/utils.py", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|># repo: koolhead17/subsample path: /subsample/main.py ''' Sample lines from text files (for example, rows of a .csv or .tsv file) from the command line. ''' from __future__ import print_function import argparse from sys import stderr from itertools import chain import logging import random from .algor...
code_fim
hard
{ "lang": "python", "repo": "koolhead17/subsample", "path": "/subsample/main.py", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> if args.seed is not None: random.seed(args.seed) if args.approximate: if args.fraction is None: args.fraction = DEFAULT_FRACTION sample = approximate_sample(fi, args.fraction) elif args.two_pass: if args.fraction: sample = two_pass_samp...
code_fim
hard
{ "lang": "python", "repo": "koolhead17/subsample", "path": "/subsample/main.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> def test_time_classes_max_inline(): # test support for 64bit literals dti = pd.DatetimeIndex(["2020-01-01", "2020-01-02", "2020-01-04", "2020-01-05"]) write_buffer( {"root": dti}, write_kwargs={"all_array_storage": "inline"}, )<|fim_prefix|># repo: BAMWelDX/weldx path: /w...
code_fim
hard
{ "lang": "python", "repo": "BAMWelDX/weldx", "path": "/weldx/tests/asdf_tests/test_asdf_time.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: BAMWelDX/weldx path: /weldx/tests/asdf_tests/test_asdf_time.py """Test time schema implementation.""" import numpy as np import pandas as pd import pytest from weldx.asdf.util import write_buffer, write_read_buffer_context from weldx.time import Time @pytest.mark.parametrize( "inputs", ...
code_fim
hard
{ "lang": "python", "repo": "BAMWelDX/weldx", "path": "/weldx/tests/asdf_tests/test_asdf_time.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> t1 = Time(inputs, time_ref) with write_read_buffer_context({"root": t1}) as data: t2 = data["root"] assert t1.equals(t2) def test_time_classes_max_inline(): # test support for 64bit literals dti = pd.DatetimeIndex(["2020-01-01", "2020-01-02", "2020-01-04", "2020-01-05"]) ...
code_fim
hard
{ "lang": "python", "repo": "BAMWelDX/weldx", "path": "/weldx/tests/asdf_tests/test_asdf_time.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: arewellborn/s2cnn path: /examples/molecules/run_experiment.py # pylint: disable=E1101,R,C import argparse import torch import torch.nn as nn from torch.autograd import Variable from s2cnn_model import S2CNNRegressor from baseline_model import BaselineRegressor from utils import load_data, IndexBa...
code_fim
hard
{ "lang": "python", "repo": "arewellborn/s2cnn", "path": "/examples/molecules/run_experiment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }