text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: maxkrivich/SlowLoris path: /pyslowloris/attack.py """ MIT License Copyright (c) 2020 Maxim Krivich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, incl...
code_fim
hard
{ "lang": "python", "repo": "maxkrivich/SlowLoris", "path": "/pyslowloris/attack.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> internal_dict = {key: getattr(self, key) for key in self.__slots__} args = ",".join([f"{k}={repr(v)}" for (k, v) in internal_dict.items()]) return f"{self.__class__.__name__}({args.rstrip(',')})" async def _atack_coroutine(self) -> None: while True: try: ...
code_fim
hard
{ "lang": "python", "repo": "maxkrivich/SlowLoris", "path": "/pyslowloris/attack.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestMultiLabelClassificationTask: num_classes = 10 @pytest.fixture(scope="class") def datamodule(self, request: SubRequest) -> DummyDataModule: dm = DummyDataModule( num_channels=3, num_classes=self.num_classes, multilabel=True, b...
code_fim
hard
{ "lang": "python", "repo": "sxjscience/torchgeo", "path": "/tests/trainers/test_classification.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sxjscience/torchgeo path: /tests/trainers/test_classification.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os from typing import Any, Dict, Generator, Optional, cast import pytest import pytorch_lightning as pl import torch import torch...
code_fim
hard
{ "lang": "python", "repo": "sxjscience/torchgeo", "path": "/tests/trainers/test_classification.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, datamodule: DummyDataModule, task: ClassificationTask ) -> None: batch = next(iter(datamodule.val_dataloader())) task.validation_step(batch, 0) task.validation_epoch_end(0) def test_test(self, datamodule: DummyDataModule, task: ClassificationTask) -> None: ...
code_fim
hard
{ "lang": "python", "repo": "sxjscience/torchgeo", "path": "/tests/trainers/test_classification.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> reorganized = {} for p in places: photos = p.get("photos", []) if "types" not in p or len(p["types"]) == 0: p["types"] = ["others"] for key in p["types"]: obj = { "name": p["name"], "photos": photos, "...
code_fim
hard
{ "lang": "python", "repo": "Hasan-Jawaheri/traveller", "path": "/server/webapi/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hasan-Jawaheri/traveller path: /server/webapi/api.py from django.shortcuts import HttpResponse, HttpResponseRedirect from django.conf import settings import requests, json, time def get_nearby(r): try: airport = r.GET["airport"] duration = r.GET["duration"] except: pass #...
code_fim
hard
{ "lang": "python", "repo": "Hasan-Jawaheri/traveller", "path": "/server/webapi/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = s.get(url).json() if response["status"] == "ZERO_RESULTS": break elif response["status"] == "OVER_QUERY_LIMIT": return HttpResponse(json.dumps({"result": "Query limit"}), content_type="application/json") elif response["status"] == "INVALID...
code_fim
hard
{ "lang": "python", "repo": "Hasan-Jawaheri/traveller", "path": "/server/webapi/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>params = {'name': 'public'} group.create(params) params = {'id': '1234', 'name': 'new'} group.create(params) params = {'id': 'abcd', 'name': 'old'} group.create(params) params = {'id': '1234'} group.find(params) params = {'ids': ['1234', 'tt']} group.find(params) params = {} group.find(params)<|fim_pre...
code_fim
medium
{ "lang": "python", "repo": "SungardAS/porper-core", "path": "/tests/models/test_group.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>params = {'id': '1234'} group.find(params) params = {'ids': ['1234', 'tt']} group.find(params) params = {} group.find(params)<|fim_prefix|># repo: SungardAS/porper-core path: /tests/models/test_group.py import sys sys.path.append('../../porper') import os region = os.environ.get('AWS_DEFAULT_REGION')...
code_fim
hard
{ "lang": "python", "repo": "SungardAS/porper-core", "path": "/tests/models/test_group.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SungardAS/porper-core path: /tests/models/test_group.py import sys sys.path.append('../../porper') import os region = os.environ.get('AWS_DEFAULT_REGION') import boto3 dynamodb = boto3.resource('dynamodb',region_name=region) <|fim_suffix|>params = {'id': '1234'} group.find(params) params = {...
code_fim
hard
{ "lang": "python", "repo": "SungardAS/porper-core", "path": "/tests/models/test_group.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashudeep/ranking-fairness-uncertainty path: /evaluation.py import numpy as np from sample_rankings_util import (get_posteriors, get_mean_merits, sample_rankings, optimal_ranking, get_mean_merits, compute_marginal_rank_probabiliti...
code_fim
hard
{ "lang": "python", "repo": "ashudeep/ranking-fairness-uncertainty", "path": "/evaluation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_mean_dcg(sampled_rankings, means, v_vec): num_docs = len(means) dcgs = [] for ranking in sampled_rankings: dcgs.append(get_dcg(ranking, means, v_vec)) return np.mean(dcgs) def compute_unfairness(movieids, matrix, v, num_samples=10000, constraint_probabilities=None): ...
code_fim
hard
{ "lang": "python", "repo": "ashudeep/ranking-fairness-uncertainty", "path": "/evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kesia-barros/exercicios-python path: /ex001 a ex114/ex034.py sal = float(input("Qaul é o seu salário?")) if sa<|fim_suffix|> aumento = (sal * 0.10) + sal print("Seu salario aumentou para R$ {:.3f} reais!".format(aumento))<|fim_middle|>l <= 1250: aumento = (sal * 0.15) + sal else:
code_fim
easy
{ "lang": "python", "repo": "kesia-barros/exercicios-python", "path": "/ex001 a ex114/ex034.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> aumento = (sal * 0.10) + sal print("Seu salario aumentou para R$ {:.3f} reais!".format(aumento))<|fim_prefix|># repo: kesia-barros/exercicios-python path: /ex001 a ex114/ex034.py sal = float(input("Qaul é o seu salário?")) if sa<|fim_middle|>l <= 1250: aumento = (sal * 0.15) + sal else:
code_fim
easy
{ "lang": "python", "repo": "kesia-barros/exercicios-python", "path": "/ex001 a ex114/ex034.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danasaur/wf-process-pose-data path: /process_pose_data/honeycomb_io.py device_id') for datum in result] logger.info('Found {} camera IDs that match specified properties'.format(len(camera_ids))) return camera_ids return None def fetch_pose_model_id( pose_model_id=None, ...
code_fim
hard
{ "lang": "python", "repo": "danasaur/wf-process-pose-data", "path": "/process_pose_data/honeycomb_io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> camera_ids, start=None, end=None, chunk_size=100, uri=None, token_uri=None, audience=None, client_id=None, client_secret=None ): client = minimal_honeycomb.MinimalHoneycombClient( uri=uri, token_uri=token_uri, audience=audience, clien...
code_fim
hard
{ "lang": "python", "repo": "danasaur/wf-process-pose-data", "path": "/process_pose_data/honeycomb_io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danasaur/wf-process-pose-data path: /process_pose_data/honeycomb_io.py ch_3d_pose_tracks( query_list, return_data, chunk_size=100, uri=None, token_uri=None, audience=None, client_id=None, client_secret=None ): logger.info('Searching for 3D pose tracks that matc...
code_fim
hard
{ "lang": "python", "repo": "danasaur/wf-process-pose-data", "path": "/process_pose_data/honeycomb_io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._image_id = value def parse_response_content(self, response_content): response = super(AlipayOpenIotmbsImageUploadResponse, self).parse_response_content(response_content) if 'audit_status' in response: self.audit_status = response['audit_status'] if 'i...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayOpenIotmbsImageUploadResponse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @image_id.setter def image_id(self, value): self._image_id = value def parse_response_content(self, response_content): response = super(AlipayOpenIotmbsImageUploadResponse, self).parse_response_content(response_content) if 'audit_status' in response: self.a...
code_fim
medium
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayOpenIotmbsImageUploadResponse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/response/AlipayOpenIotmbsImageUploadResponse.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayOpenIotmbsImageUploadResponse(AlipayResponse): def __i...
code_fim
medium
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayOpenIotmbsImageUploadResponse.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Select all data from database c.execute("SELECT * FROM data") cdata = c.fetchall() conn.close() return cdata def get_salary_month(): # Create set to store month name, when a salary was written to set_salary = set() conn = sqlite3.connect(r"database\database.db") ...
code_fim
hard
{ "lang": "python", "repo": "optionalg/Xlsx-Account-Book", "path": "/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> conn.commit() conn.close() def get_data_sql(): conn = sqlite3.connect(r"database\database.db") c = conn.cursor() # Select all data from database c.execute("SELECT * FROM data") cdata = c.fetchall() conn.close() return cdata def get_salary_month(): # Create s...
code_fim
hard
{ "lang": "python", "repo": "optionalg/Xlsx-Account-Book", "path": "/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: optionalg/Xlsx-Account-Book path: /functions.py import sqlite3 def show_classes(chosen_month_number): # At first let the user chose a month to make entries if chosen_month_number == "": print("At first a month has to be chosen:") print("") select_class = "3" ...
code_fim
hard
{ "lang": "python", "repo": "optionalg/Xlsx-Account-Book", "path": "/functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return str(key).lower() def __and__(self, other): """ join version specifiers, consuming a mapping object. """ for k, v in other.items(): if k in self._values: self._values[k] = str(SpecifierSet(self._values[k]) & v) else...
code_fim
hard
{ "lang": "python", "repo": "toumorokoshi/uranium", "path": "/uranium/packages/versions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: toumorokoshi/uranium path: /uranium/packages/versions.py from collections import MutableMapping from packaging.specifiers import SpecifierSet class Versions(MutableMapping): """ a dictionary containing version specs. """ def __init__(self): self._values = {} def __setitem_...
code_fim
hard
{ "lang": "python", "repo": "toumorokoshi/uranium", "path": "/uranium/packages/versions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Define variables for later g_input_shape = 100 d_input_shape = (28,28) hidden_1_num_units = 500 hidden_2_num_units = 500 g_output_num_units = 784 d_output_num_units = 1 epochs = 25 batch_size = 128 #Generator network model_1 = Sequential() model_1.add(Dense(hidden_1_num_units, input_dim=g_in...
code_fim
hard
{ "lang": "python", "repo": "GreensboroAI/GANBasicMnist", "path": "/GANtest1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>history = model.fit(x=train_x, y=gan_targets(train_x.shape[0]), epochs=epochs, batch_size=batch_size) plt.plot(history.history['player_0_loss']) plt.plot(history.history['player_1_loss']) plt.plot(history.history['loss']) plt.show() zsamples = np.random.normal(size=(10,100)) pred = model_1.predi...
code_fim
hard
{ "lang": "python", "repo": "GreensboroAI/GANBasicMnist", "path": "/GANtest1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreensboroAI/GANBasicMnist path: /GANtest1.py import os import numpy as np import pandas as pd from scipy.misc import imread import pylab as pyl import matplotlib.pyplot as plt import keras from keras.models import Sequential from keras.layers import Dense, Flatten, Reshape, InputLayer ...
code_fim
hard
{ "lang": "python", "repo": "GreensboroAI/GANBasicMnist", "path": "/GANtest1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: miriad/nanoleaf-aurora-python path: /aurora.py # aurora.py - Nanoleaf Aurora python library # # Copyright 2017 Zachary Cornelius # # 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 o...
code_fim
hard
{ "lang": "python", "repo": "miriad/nanoleaf-aurora-python", "path": "/aurora.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_hue_min(self): return self._get_json("/state/hue")["min"] def set_hue(self, new_hue): self._put_json("/state/hue", {"hue": {"value": int(new_hue)}}) return self.get_hue() def increment_hue(self, hue_increment): self._put_json("/state/hue", {"hue": {"in...
code_fim
hard
{ "lang": "python", "repo": "miriad/nanoleaf-aurora-python", "path": "/aurora.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahmadchatha/Scalable-PaQL-Queries path: /src/paql_eval/ilp_direct/ilp_interface/ilp_solver.py ####################### # MIN linear formulation ###################################################### # MIN(Y) >= (ti.y)xi - Y_diff*(1-mj) ==> # (ti.y)xi - r*my + (Y_diff)mj <= Y_diff+r-1 ...
code_fim
hard
{ "lang": "python", "repo": "ahmadchatha/Scalable-PaQL-Queries", "path": "/src/paql_eval/ilp_direct/ilp_interface/ilp_solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Add base constraints self.add_base_constraints() # Add global constraints self.add_global_constraints() print "TODO: YOU SHOULD PROBABLY CLEAN DATA HERE, BUT FOR NOW I'M DISABLING IT" self.clear_data() # Problem must be a (M)ILP ((Mixed) Integer Linear Program) if self.problem...
code_fim
hard
{ "lang": "python", "repo": "ahmadchatha/Scalable-PaQL-Queries", "path": "/src/paql_eval/ilp_direct/ilp_interface/ilp_solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: with _active_limbo_lock: del _active[self._Thread__ident] except KeyError: if 'dummy_threading' not in _sys.modules: raise threading.Thread._Thread__delete = _delete else: def _delete(...
code_fim
hard
{ "lang": "python", "repo": "circus-tent/circus", "path": "/circus/_patch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: with _active_limbo_lock: del _active[self._ident] except KeyError: if 'dummy_threading' not in _sys.modules: raise threading.Thread._delete = _delete<|fim_prefix|># repo: circus-tent/circus path:...
code_fim
hard
{ "lang": "python", "repo": "circus-tent/circus", "path": "/circus/_patch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: circus-tent/circus path: /circus/_patch.py import threading from threading import _active_limbo_lock, _active, _sys debugger = False try: # noinspection PyUnresolvedReferences import pydevd debugger = pydevd.GetGlobalDebugger() except ImportError: pass <|fim_suffix|> thr...
code_fim
hard
{ "lang": "python", "repo": "circus-tent/circus", "path": "/circus/_patch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stjordanis/flor path: /examples/deprecated/fib/clean_fib.py import flor log = flor.log @flor.track def fib(idx): <|fim_suffix|> with flor.Context('fib'): fib(5)<|fim_middle|> fib = {} fib[log.param(0)] = log.metric(0) fib[log.param(1)] = log.metric(1) fib[log.param(2)] = log.m...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/flor", "path": "/examples/deprecated/fib/clean_fib.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with flor.Context('fib'): fib(5)<|fim_prefix|># repo: stjordanis/flor path: /examples/deprecated/fib/clean_fib.py import flor log = flor.log @flor.track def fib(idx): fib = {} fib[log.param(0)] = log.metric(0) fib[log.param(1)] = log.metric(1) fib[log.param(2)] = log.metric(2) <|fim...
code_fim
medium
{ "lang": "python", "repo": "stjordanis/flor", "path": "/examples/deprecated/fib/clean_fib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterModelOptions( name='order', options={'verbose_name_plural': '订单管理'}, ), migrations.AlterField( model_name='order', name='state', field=models.CharField(choices=[(0, '未完成'), (1, '已完成')], d...
code_fim
medium
{ "lang": "python", "repo": "fangduozhi/LearnGit", "path": "/bishe/order/migrations/0008_auto_20190521_1221.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fangduozhi/LearnGit path: /bishe/order/migrations/0008_auto_20190521_1221.py # Generated by Django 2.1.7 on 2019-05-21 04:21 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterModelOptions( name='...
code_fim
medium
{ "lang": "python", "repo": "fangduozhi/LearnGit", "path": "/bishe/order/migrations/0008_auto_20190521_1221.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> code_end = start + dt.timedelta(seconds=code) pause_start = code_end pause_end = pause_start + dt.timedelta(seconds=pause) return (code_start, code_end), (pause_start, pause_end) pass def run_as_events_n(self, start, n): array = [] for _ in rang...
code_fim
hard
{ "lang": "python", "repo": "timolesterhuis/diagnostics", "path": "/src/diagnostics/demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timolesterhuis/diagnostics path: /src/diagnostics/demo.py import datetime as dt import random from .classes import Report class TimeGenerator(object): min = 0 max = None mean = 0 stdev = 1 def __init__(self): pass def run(self): value = random.gauss(se...
code_fim
hard
{ "lang": "python", "repo": "timolesterhuis/diagnostics", "path": "/src/diagnostics/demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> array = self.run_as_events_n(*args, **kwargs) reports = [Report(t0=s, te=e, name=self.name) for s, e in array] return reports def run_as_events_for_t(self, start, t, start_mu=0): array = [] if start_mu: offset = random.gauss(0, start_mu) ...
code_fim
hard
{ "lang": "python", "repo": "timolesterhuis/diagnostics", "path": "/src/diagnostics/demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: delcypher/klee-runner path: /kleeanalysis/rank.py f one tools has no false positives and # the other has one of more false positives are the tools ranked differently. # # The motivation behind doing this is that ranking based on the number of false # positives implicitly assumes t...
code_fim
hard
{ "lang": "python", "repo": "delcypher/klee-runner", "path": "/kleeanalysis/rank.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: delcypher/klee-runner path: /kleeanalysis/rank.py available_indices = [] else: # Retrieve coverage information index_to_coverage_info = _get_index_to_coverage_infos( native_program_name, index_to_number_of_repeat_runs_map, ...
code_fim
hard
{ "lang": "python", "repo": "delcypher/klee-runner", "path": "/kleeanalysis/rank.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert isinstance(values, list) lower_bound = min(values) upper_bound = max(values) median = statistics.median(values) return (lower_bound, median, upper_bound) def get_arithmetic_mean_and_confidence_intervals(values, confidence_interval_factor): assert isinstance(values, list) ...
code_fim
hard
{ "lang": "python", "repo": "delcypher/klee-runner", "path": "/kleeanalysis/rank.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if cv2.waitKey(2) & 0xFF == ord('d'): print(dir) try: shutil.rmtree(dir) except OSError as e: print("Error: %s : %s" % (dir, e.strerror)) break # Press Q on keyboard to exit ...
code_fim
hard
{ "lang": "python", "repo": "brycekroencke/workout_tracker", "path": "/AutoWorkoutTracker/generator/show_full_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brycekroencke/workout_tracker path: /AutoWorkoutTracker/generator/show_full_dataset.py import cv2 import os import shutil import glob import re def split_num(s): return list(filter(None, re.split(r'(\d+)', s))) def show_dataset(img_dir): <|fim_suffix|> if cv2.waitKey(2) & 0xFF =...
code_fim
hard
{ "lang": "python", "repo": "brycekroencke/workout_tracker", "path": "/AutoWorkoutTracker/generator/show_full_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> profile_dir = temp_dir_path/"profile" profile_dir.mkdir() profile_result_dir = temp_dir_path/"result_profile" profile_result_dir.mkdir() # Convert sequence-to-sequence results to profile convert_mmseqs_result_to_profile( query_dir, serch_dir, re...
code_fim
hard
{ "lang": "python", "repo": "sacdallago/bio_embeddings", "path": "/tests/test_mmseqs2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sacdallago/bio_embeddings path: /tests/test_mmseqs2.py import os from pathlib import Path from tempfile import TemporaryDirectory import pytest from bio_embeddings.align import ( check_mmseqs, convert_mmseqs_result_to_profile, create_mmseqs_database, mmseqs_search, MMseqsSearchOptions, ...
code_fim
hard
{ "lang": "python", "repo": "sacdallago/bio_embeddings", "path": "/tests/test_mmseqs2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huizhi-li/swarmlib path: /swarmlib/util/problem_base.py # ------------------------------------------------------------------------------------------------------ # Copyright (c) Leo Hanisch. All rights reserved. # Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for l...
code_fim
medium
{ "lang": "python", "repo": "huizhi-li/swarmlib", "path": "/swarmlib/util/problem_base.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def replay(self) -> None: """ Start the problems visualization. """ self._visualizer.replay()<|fim_prefix|># repo: huizhi-li/swarmlib path: /swarmlib/util/problem_base.py # ------------------------------------------------------------------------------------------------...
code_fim
medium
{ "lang": "python", "repo": "huizhi-li/swarmlib", "path": "/swarmlib/util/problem_base.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: softsys4ai/unicorn path: /causallearn/utils/ChoiceGenerator.py class ChoiceGenerator: ''' Generates (nonrecursively) all of the combinations of a choose b, where a, b are nonnegative integers and a >= b. The values of a and b are given in the constructor, and the sequence of choi...
code_fim
hard
{ "lang": "python", "repo": "softsys4ai/unicorn", "path": "/causallearn/utils/ChoiceGenerator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def next(self): i = self.b while i > 0: i -= 1 if self.choiceLocal[i] < (i + self.diff): self.fill(i) self.begun = True for j in range(self.b): self.choiceReturned[j] = self.choiceLocal[j] ...
code_fim
hard
{ "lang": "python", "repo": "softsys4ai/unicorn", "path": "/causallearn/utils/ChoiceGenerator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agenteAND/jeito path: /members/serializers.py from rest_framework import serializers from members.models import Adhesion, Nomination, Structure class NominationSerializer(serializers.ModelSerializer): structure = serializers.CharField(source='structure.name') structure_type = serializer...
code_fim
medium
{ "lang": "python", "repo": "agenteAND/jeito", "path": "/members/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Adhesion fields = ( 'number', 'first_name', 'last_name', 'gender', 'email', 'structure', 'structure_type', 'region', 'rate', 'nominations', 'adhesions_resp_email', 'structure_resp_email', ) class StructureSerializer(seri...
code_fim
hard
{ "lang": "python", "repo": "agenteAND/jeito", "path": "/members/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class AdhesionSerializer(serializers.ModelSerializer): number = serializers.CharField(source='person.number') first_name = serializers.CharField(source='person.first_name') last_name = serializers.CharField(source='person.last_name') gender = serializers.IntegerField(source='person.gender'...
code_fim
medium
{ "lang": "python", "repo": "agenteAND/jeito", "path": "/members/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>les.fix_imports() except ImportError: pass<|fim_prefix|># repo: statusz/pygrow path: /grow/__init__.py import os import sys sys.path.extend([os.pa<|fim_middle|>th.join(os.path.dirname(__file__), '..')]) try: from grow import submodules submodu
code_fim
medium
{ "lang": "python", "repo": "statusz/pygrow", "path": "/grow/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: statusz/pygrow path: /grow/__init__.py import os import sys sys.path.extend([os.pa<|fim_suffix|>try: from grow import submodules submodules.fix_imports() except ImportError: pass<|fim_middle|>th.join(os.path.dirname(__file__), '..')])
code_fim
easy
{ "lang": "python", "repo": "statusz/pygrow", "path": "/grow/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>try: from grow import submodules submodules.fix_imports() except ImportError: pass<|fim_prefix|># repo: statusz/pygrow path: /grow/__init__.py import os import sys sys.path.extend([os.pa<|fim_middle|>th.join(os.path.dirname(__file__), '..')])
code_fim
easy
{ "lang": "python", "repo": "statusz/pygrow", "path": "/grow/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cs-fullstack-2019-spring/django-formclassv2-cw-DB225-1 path: /frmProject/frmApp/forms.py from django import forms <|fim_suffix|> name = forms.CharField() birthday = forms.DateField() applyingTo = forms.CharField() salary = forms.IntegerField()<|fim_middle|>class EmpApplication(for...
code_fim
easy
{ "lang": "python", "repo": "cs-fullstack-2019-spring/django-formclassv2-cw-DB225-1", "path": "/frmProject/frmApp/forms.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> name = forms.CharField() birthday = forms.DateField() applyingTo = forms.CharField() salary = forms.IntegerField()<|fim_prefix|># repo: cs-fullstack-2019-spring/django-formclassv2-cw-DB225-1 path: /frmProject/frmApp/forms.py from django import forms <|fim_middle|>class EmpApplication(for...
code_fim
easy
{ "lang": "python", "repo": "cs-fullstack-2019-spring/django-formclassv2-cw-DB225-1", "path": "/frmProject/frmApp/forms.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.input = self.input.lower().split() self.run = True def run_cmd(self): if self.input[0] in self.commands.list: return getattr(self.commands, self.input[0])() else: print 'Command not found. Use "help"\n'<|fim_prefix|># repo: michaelti...
code_fim
hard
{ "lang": "python", "repo": "michaeltintiuc/pygame-demo", "path": "/terminal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaeltintiuc/pygame-demo path: /terminal.py from commands import * class Terminal: def __init__(self, engine=None): <|fim_suffix|> if self.input[0] in self.commands.list: return getattr(self.commands, self.input[0])() else: print 'Command not...
code_fim
hard
{ "lang": "python", "repo": "michaeltintiuc/pygame-demo", "path": "/terminal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while not self.input: self.input = raw_input('>> ') self.input = self.input.lower().split() self.run = True def run_cmd(self): if self.input[0] in self.commands.list: return getattr(self.commands, self.input[0])() else: ...
code_fim
medium
{ "lang": "python", "repo": "michaeltintiuc/pygame-demo", "path": "/terminal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: r4k0nb4k0n/CTF-Writeups path: /2020/utctf_2020/Cryptography/Random_ECB/get_flag.py from pwn import * r = remote('ecb.utctf.live', 9003) #r = process(['python', 'server.py']) def get_hash_block(plaintext, block_idx): r.sendlineafter("Input a string to encrypt (input 'q' to quit):",plaintext) ...
code_fim
hard
{ "lang": "python", "repo": "r4k0nb4k0n/CTF-Writeups", "path": "/2020/utctf_2020/Cryptography/Random_ECB/get_flag.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def guess(): plaintext = 'A'*16 block_idx = 0 FLAG = '' dummy_block = get_hash_block(plaintext, block_idx) while True: part = '' for i in range(1,16): target_block = find_block(plaintext[i:16+block_idx], dummy_block, block_idx) ch = brute_force(plaintext[i:] + part, target_block, dummy_bloc...
code_fim
medium
{ "lang": "python", "repo": "r4k0nb4k0n/CTF-Writeups", "path": "/2020/utctf_2020/Cryptography/Random_ECB/get_flag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def guess(): plaintext = 'A'*16 block_idx = 0 FLAG = '' dummy_block = get_hash_block(plaintext, block_idx) while True: part = '' for i in range(1,16): target_block = find_block(plaintext[i:16+block_idx], dummy_block, block_idx) ch = brute_force(plaintext[i:] + part, target_block, dummy_blo...
code_fim
medium
{ "lang": "python", "repo": "r4k0nb4k0n/CTF-Writeups", "path": "/2020/utctf_2020/Cryptography/Random_ECB/get_flag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if question_num == scrap_questions_num: to_stop = True break question_num += 1 page_num += 1 if to_stop ==True: break<|fim_prefix|># repo: xiaodongzi/pytohon_teach_material path: /11/homework11/zhihu_top100.py # coding: utf-8 import requests from p...
code_fim
medium
{ "lang": "python", "repo": "xiaodongzi/pytohon_teach_material", "path": "/11/homework11/zhihu_top100.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaodongzi/pytohon_teach_material path: /11/homework11/zhihu_top100.py # coding: utf-8 import requests from pyquery import PyQuery as pq question_num = 1 page_num = 1 to_stop = False scrap_questions_num = 100 while True: url = "http://www.zhihu.com/topic/19776749/top-answers?page=%d" % (pag...
code_fim
medium
{ "lang": "python", "repo": "xiaodongzi/pytohon_teach_material", "path": "/11/homework11/zhihu_top100.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def load_image_into_numpy_array(image): (im_width, im_height) = image.size return np.array(image.getdata()).reshape( (im_height, im_width, 3)).astype(np.uint8) def api(self, image): if self.sess is None: self.sess = tf.Session(grap...
code_fim
hard
{ "lang": "python", "repo": "fengrk/docker-practice", "path": "/tensorflow/tensorflow-object-detection-server/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fengrk/docker-practice path: /tensorflow/tensorflow-object-detection-server/server.py # coding:utf-8 from io import BytesIO import numpy as np import requests import tensorflow as tf from PIL import Image from flask import Flask, request, make_response from ml_tools.object_detection.utils impor...
code_fim
hard
{ "lang": "python", "repo": "fengrk/docker-practice", "path": "/tensorflow/tensorflow-object-detection-server/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amadev/open4k path: /open4k/controllers/instance.py import kopf import pykube from open4k import utils from open4k import kube from open4k import client from open4k import settings from open4k import hooks LOG = utils.get_logger(__name__) kopf_on_args = ["open4k.amadev.ru", "v1alpha1", "instanc...
code_fim
hard
{ "lang": "python", "repo": "amadev/open4k", "path": "/open4k/controllers/instance.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not body.get("status", {}).get("applied"): LOG.info(f"{name} was not applied successfully") return klass = Instance os_obj_id = body["status"].get("object", {}).get("id") if not os_obj_id: LOG.info(f"Cannot get id for {name}") return c = client.get...
code_fim
hard
{ "lang": "python", "repo": "amadev/open4k", "path": "/open4k/controllers/instance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Wrapper class for all mpi4py communication variables. """ comm = MPI.COMM_WORLD size = MPI.COMM_WORLD.Get_size() uid = MPI.COMM_WORLD.Get_rank() name = MPI.Get_processor_name() # Attach buffer BUFF_SISE = 32064000 * (1 + MPI.BSEND_OVERHEAD) buff = empty(BUFF_SISE, dty...
code_fim
medium
{ "lang": "python", "repo": "jiaqi61/AsySPA", "path": "/asyspa/gossip_comm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiaqi61/AsySPA path: /asyspa/gossip_comm.py """ Wrapper for MPI communication variables to improve process timing. """ from numpy import empty <|fim_suffix|>class GossipComm(object): """ Wrapper class for all mpi4py communication variables. """ comm = MPI.COMM_WORLD size = MPI.COMM...
code_fim
easy
{ "lang": "python", "repo": "jiaqi61/AsySPA", "path": "/asyspa/gossip_comm.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def create_row(self, well=None, artifact=None): header = collections.OrderedDict() header["Well"] = well.alpha_num_key if well else None header["Sample Name"] = artifact.name if artifact else None header["Target Name"] = artifact.name if artifact else None heade...
code_fim
hard
{ "lang": "python", "repo": "ctmrbio/claritylims", "path": "/clarity-ext-scripts/clarity_ext_scripts/covid/pcr/example_result_file_rt_pcr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ctmrbio/claritylims path: /clarity-ext-scripts/clarity_ext_scripts/covid/pcr/example_result_file_rt_pcr.py import xlwt import collections import datetime import random from clarity_ext.extensions import GeneralExtension from clarity_ext_scripts.covid.parse_pcr import CT_HEADER class Extension(G...
code_fim
hard
{ "lang": "python", "repo": "ctmrbio/claritylims", "path": "/clarity-ext-scripts/clarity_ext_scripts/covid/pcr/example_result_file_rt_pcr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> inputs = inspect.getcallargs(function, *args, **kwargs) # pylint: disable=deprecated-method self = inputs.pop('self', function) # We test whether function is a method by looking for a `self` argument. If not we store the cache in the function itself. if not hasattr(self, '_cache'): ...
code_fim
medium
{ "lang": "python", "repo": "MarkCBell/flipper", "path": "/flipper/kernel/decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarkCBell/flipper path: /flipper/kernel/decorators.py ''' A module for decorators. ''' import inspect from decorator import decorator @decorator def memoize(function, *args, **kwargs): ''' A decorator that memoizes a function. ''' <|fim_suffix|> result = self._cache[key] if isi...
code_fim
hard
{ "lang": "python", "repo": "MarkCBell/flipper", "path": "/flipper/kernel/decorators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = self._cache[key] if isinstance(result, Exception): raise result else: return result<|fim_prefix|># repo: MarkCBell/flipper path: /flipper/kernel/decorators.py ''' A module for decorators. ''' import inspect from decorator import decorator @decorator def memoize(fun...
code_fim
hard
{ "lang": "python", "repo": "MarkCBell/flipper", "path": "/flipper/kernel/decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> overlay = Curve(range(10), label='A') * Curve(range(10), label='B') plot = mpl_renderer.get_plot(overlay) legend = plot.handles['legend'] legend_labels = [l.get_text() for l in legend.texts] self.assertEqual(legend_labels, ['A', 'B']) def test_overlay_legend_wi...
code_fim
hard
{ "lang": "python", "repo": "holoviz/holoviews", "path": "/holoviews/tests/plotting/matplotlib/test_overlayplot.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: holoviz/holoviews path: /holoviews/tests/plotting/matplotlib/test_overlayplot.py import numpy as np from holoviews.core import Overlay, NdOverlay, DynamicMap, HoloMap from holoviews.element import Curve, Scatter from ...utils import LoggingComparisonTestCase from .test_plot import TestMPLPlot, ...
code_fim
hard
{ "lang": "python", "repo": "holoviz/holoviews", "path": "/holoviews/tests/plotting/matplotlib/test_overlayplot.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def cb(X): return NdOverlay({i: Curve(np.arange(10)+i) for i in range(X)}) dmap = DynamicMap(cb, kdims=['X']).redim.range(X=(1, 10)) plot = mpl_renderer.get_plot(dmap) self.assertEqual(len(plot.subplots), 1) plot.update((3,)) self.assertEqual(len...
code_fim
hard
{ "lang": "python", "repo": "holoviz/holoviews", "path": "/holoviews/tests/plotting/matplotlib/test_overlayplot.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> uri=input("uri of the remote i/o server, or enter for local i/o:").strip() print(repr(uri)) if uri: try: remoteIO = Pyro4.Proxy(uri) remote_stdout, remote_stdin = remoteIO.getInputOutput() print("Replacing sys.stdin and sys.stdout. Read and typ...
code_fim
medium
{ "lang": "python", "repo": "delmic/Pyro4", "path": "/examples/stdinstdout/program.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: delmic/Pyro4 path: /examples/stdinstdout/program.py # this is the program whose input/output you can redirect from __future__ import print_function import sys import Pyro4 if sys.version_info<(3,0): input=raw_input sys.excepthook=Pyro4.util.excepthook def interaction(): <|fim_...
code_fim
hard
{ "lang": "python", "repo": "delmic/Pyro4", "path": "/examples/stdinstdout/program.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class CommandsTest(TestCase): def test_relay_events(self): cmd = relay_events.Command() cmd.stdout = StringIO() cmd.handle() self.assertEqual( cmd.stdout.getvalue(), 'Relaying 0 events in batches of %s.\nDone.\n' % ( settings.GAR...
code_fim
medium
{ "lang": "python", "repo": "smn/garelay", "path": "/garelay/tests/test_commands.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: smn/garelay path: /garelay/tests/test_commands.py from StringIO import StringIO from django.test import TestCase from django.conf import settings from garelay.management.commands import relay_events, register_events <|fim_suffix|> cmd = register_events.Command() cmd.stdout = Str...
code_fim
hard
{ "lang": "python", "repo": "smn/garelay", "path": "/garelay/tests/test_commands.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> cmd = register_events.Command() cmd.stdout = StringIO() cmd.handle() self.assertEqual( cmd.stdout.getvalue(), 'Registering 0 events in batches of %s.\nDone.\n' % ( settings.GARELAY_REGISTER_BATCH_SIZE,))<|fim_prefix|># repo: smn/garel...
code_fim
hard
{ "lang": "python", "repo": "smn/garelay", "path": "/garelay/tests/test_commands.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Return authorization view object using corp type and business identifier. Mainly used for service accounts.Sorted using the membership since service accounts gets all access """ return cls.query.filter_by(product_code=product_code, business_identifier=business_identifi...
code_fim
hard
{ "lang": "python", "repo": "bcgov/sbc-auth", "path": "/auth-api/src/auth_api/models/views/authorization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def find_authorization_for_admin_by_org_id(cls, org_id: int): """Return authorization view object for staff.""" # staff gets ADMIN level access return cls.query.filter_by(org_id=org_id, org_membership=ADMIN).first() @classmethod def find_account_author...
code_fim
hard
{ "lang": "python", "repo": "bcgov/sbc-auth", "path": "/auth-api/src/auth_api/models/views/authorization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bcgov/sbc-auth path: /auth-api/src/auth_api/models/views/authorization.py # Copyright © 2019 Province of British Columbia # # 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 a...
code_fim
hard
{ "lang": "python", "repo": "bcgov/sbc-auth", "path": "/auth-api/src/auth_api/models/views/authorization.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: willettk/SpaceWarps path: /analysis/SWAPSHOP.py import os import subprocess import pdb import swap from optparse import OptionParser ''' Need to run SWAP.py multiple times -- once for every "day" in GZ2 Take that output and feed it into my machine classifiers Take that output and determine reti...
code_fim
hard
{ "lang": "python", "repo": "willettk/SpaceWarps", "path": "/analysis/SWAPSHOP.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check if SWAP.py set the "keep going" cookie to False #more = os.system("grep 'running' .swap.cookie | wc -l") more = subprocess.check_output("grep 'running' .swap.cookie | wc -l", shell=True) # Read the results of that call -- they're goofy ...
code_fim
hard
{ "lang": "python", "repo": "willettk/SpaceWarps", "path": "/analysis/SWAPSHOP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Define "today's" logfile name -- the count specifies which day logfile = "%s/GZ2_%i.log"%(log_dir,count) # run SWAP.py with the chosen configfile (and specific logfile?) #os.system("python SWAP.py %s > %s"%(config,logfile)) os.system("python SWAP.py %s"%(config)) # ALWAYS run M...
code_fim
hard
{ "lang": "python", "repo": "willettk/SpaceWarps", "path": "/analysis/SWAPSHOP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> velocities_list = [] distances_list = [] for param in params_to_change: velocities_dict = {} distances_dict = {} dists = [] velocity_limits = [] for motor_name, motor_obj in motors.items(): velocity_limits.append(tuple(motor_obj.velocity.limi...
code_fim
hard
{ "lang": "python", "repo": "NSLS-II-TES/profile_collection", "path": "/startup/.test_calc_velocity.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NSLS-II-TES/profile_collection path: /startup/.test_calc_velocity.py import pytest def calc_velocity(motors, dists, velocity_limits): ret_vels = [] # find max distance to move max_dist = np.max(dists) max_dist_index = dists.index(max_dist) max_dist_vel = velocity_limits[max_...
code_fim
hard
{ "lang": "python", "repo": "NSLS-II-TES/profile_collection", "path": "/startup/.test_calc_velocity.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for pair in gradients: gradient, variable = pair summary_name = ('%s_gradient' % variable.name).replace(':', '_') tf.summary.histogram(summary_name, gradient) return tf.estimator.EstimatorSpec( mode, loss=loss, train_...
code_fim
hard
{ "lang": "python", "repo": "williamwhe/char-cnn", "path": "/charcnn/cnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: williamwhe/char-cnn path: /charcnn/cnn.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ An implementation of Character-level Convolutional Networks for Text Classification Zhang and LeCun, 2015 (See https://arxiv.org/abs/1509.01626) """ import numpy as np import json import tenso...
code_fim
hard
{ "lang": "python", "repo": "williamwhe/char-cnn", "path": "/charcnn/cnn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # add ground truth to the output if it's there if 'ground_truth' in features: predictions['ground_truth'] = features['ground_truth'] return tf.estimator.EstimatorSpec( mode, predictions=predictions, export_outputs={ '...
code_fim
hard
{ "lang": "python", "repo": "williamwhe/char-cnn", "path": "/charcnn/cnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }