text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: CodeReclaimers/neat-python path: /tests/test_xor_example.py import os import neat def test_xor_example_uniform_weights(): test_xor_example(uniform_weights=True) def test_xor_example(uniform_weights=False): # 2-input XOR inputs and expected outputs. xor_inputs = [(0.0, 0.0), (0.0,...
code_fim
hard
{ "lang": "python", "repo": "CodeReclaimers/neat-python", "path": "/tests/test_xor_example.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Add a stdout reporter to show progress in the terminal. p.add_reporter(neat.StdOutReporter(True)) stats = neat.StatisticsReporter() p.add_reporter(stats) checkpointer = neat.Checkpointer(25, 10, filename_prefix) p.add_reporter(checkpointer) # Run for up to 100 generations, a...
code_fim
hard
{ "lang": "python", "repo": "CodeReclaimers/neat-python", "path": "/tests/test_xor_example.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pandinosaurus/pytorch path: /test/fx2trt/converters/acc_op/test_split.py # Owner(s): ["oncall: fx"] import torch import torch.fx.experimental.fx_acc.acc_ops as acc_ops import torch.nn as nn from caffe2.torch.fb.fx2trt.tests.test_utils import AccTestCase from parameterized import parameterized ...
code_fim
medium
{ "lang": "python", "repo": "Pandinosaurus/pytorch", "path": "/test/fx2trt/converters/acc_op/test_split.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return x.split(split_size_or_sections, dim)[0] inputs = [torch.randn(1, 10)] self.run_test( Split(), inputs, expected_ops={ acc_ops.split if isinstance(split_size_or_sections, int) else acc...
code_fim
medium
{ "lang": "python", "repo": "Pandinosaurus/pytorch", "path": "/test/fx2trt/converters/acc_op/test_split.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> inputs = [torch.randn(1, 10)] self.run_test( Split(), inputs, expected_ops={ acc_ops.split if isinstance(split_size_or_sections, int) else acc_ops.slice_tensor }, test_explicit_batch...
code_fim
hard
{ "lang": "python", "repo": "Pandinosaurus/pytorch", "path": "/test/fx2trt/converters/acc_op/test_split.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def hello(event, context): r = requests.get(url=POE_URL) body = json.loads(r.text) matches = filter(lambda x: x["accountName"] == event["account"], body["stashes"]) count = sum(1 for _ in matches) return "Found " + str(count) + " matches for account name " + event["account"]<|fim_p...
code_fim
hard
{ "lang": "python", "repo": "ammarv23/poe-account-currency-scraper", "path": "/handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>POE_URL = "http://api.pathofexile.com/public-stash-tabs" def hello(event, context): r = requests.get(url=POE_URL) body = json.loads(r.text) matches = filter(lambda x: x["accountName"] == event["account"], body["stashes"]) count = sum(1 for _ in matches) return "Found " + str(count...
code_fim
medium
{ "lang": "python", "repo": "ammarv23/poe-account-currency-scraper", "path": "/handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ammarv23/poe-account-currency-scraper path: /handler.py """ Given an account name and a shard_id, make a request to the bulk stash tab API of Path of Exile http://api.pathofexile.com/public-stash-tabs <|fim_suffix|>def hello(event, context): r = requests.get(url=POE_URL) body = json.loa...
code_fim
hard
{ "lang": "python", "repo": "ammarv23/poe-account-currency-scraper", "path": "/handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> db = r.db("logcentral") if 'cursor_state' not in db.table_list().run(): r.db("logcentral").table_create("cursor_state").run() if 'log' not in db.table_list().run(): r.db("logcentral").table_create("log").run() cursor_table = r.db("logcentral").table('cursor_state') l...
code_fim
hard
{ "lang": "python", "repo": "teh/logcentral", "path": "/logshipper/logshipper-daemon.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: teh/logcentral path: /logshipper/logshipper-daemon.py #!/usr/bin/python import rethinkdb as r import argparse import json import subprocess import socket def yield_log_lines(cursor=None): cursor_args = [] if cursor is None else ['--after-cursor', cursor] p = subprocess.Popen(['journalct...
code_fim
medium
{ "lang": "python", "repo": "teh/logcentral", "path": "/logshipper/logshipper-daemon.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TOsborn/TrackML path: /helper_functions/.ipynb_checkpoints/file_utilities-checkpoint.py """Utilities for interacting with files. These methods are specific to our team's SageMaker environment. """ __authors__ = ['Trenton Osborn'] def file_url(category, event_id=None, train_or_test="train"): <|...
code_fim
medium
{ "lang": "python", "repo": "TOsborn/TrackML", "path": "/helper_functions/.ipynb_checkpoints/file_utilities-checkpoint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Arguments: category -- one of "cells", "hits", "particles", "truth", "detectors", "sample_submission" or "hit_orders". event_id -- the integer id of an event. Should be included unless category is "detectors" or "sample submission". Ensure that event_id and train_or_tes...
code_fim
medium
{ "lang": "python", "repo": "TOsborn/TrackML", "path": "/helper_functions/.ipynb_checkpoints/file_utilities-checkpoint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '/home/ec2-user/SageMaker/efs/{0}/event{1:09d}-{2}.csv'.format( folder, event_id, category)<|fim_prefix|># repo: TOsborn/TrackML path: /helper_functions/.ipynb_checkpoints/file_utilities-checkpoint.py """Utilities for interacting with files. These methods are specific to our team's Sa...
code_fim
hard
{ "lang": "python", "repo": "TOsborn/TrackML", "path": "/helper_functions/.ipynb_checkpoints/file_utilities-checkpoint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanaiela/num_fh path: /num_fh/identification/data/utils.py import io import json import nltk from nltk.tree import Tree def read_data(in_f): """ reading the imdb (parsed) corpus :param in_f: input file :return: yielding a tuple of (text, show-index, scene-index and text-sentence...
code_fim
hard
{ "lang": "python", "repo": "yanaiela/num_fh", "path": "/num_fh/identification/data/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ find boundaries of a number :param s: the nlp'ed sentence :param w: the nlp'ed word (number) of the sentence :return: start and end indices of the complete number """ ind = w.i # handling height if ind + 2 < len(s) and s[ind + 1].text == "'" and s[ind + 2].like_num:...
code_fim
hard
{ "lang": "python", "repo": "yanaiela/num_fh", "path": "/num_fh/identification/data/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._i def find_boundaries(s, w): """ find boundaries of a number :param s: the nlp'ed sentence :param w: the nlp'ed word (number) of the sentence :return: start and end indices of the complete number """ ind = w.i # handling height if ind + 2 < len(s)...
code_fim
hard
{ "lang": "python", "repo": "yanaiela/num_fh", "path": "/num_fh/identification/data/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>* ") print(" *o****o ") print(" ***o**$** ") print(" o*$*****o** ") print(" **o***o**o**o ") print(" o********o***$* ") print(" ** ") print(" AAA ** SsS ") p...
code_fim
medium
{ "lang": "python", "repo": "yamadathamine/300ideiasparaprogramarPython", "path": "/001 Saída Simples/pinheiro2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> o********o***$* ") print(" ** ") print(" AAA ** SsS ") print(" AAA****** sss ") print(" DDDD AAA****** SsS ")<|fim_prefix|># repo: yamadathamine/300ideiasparaprogramarPython path: /001 Saída Simples/pinheiro2.py # encodi...
code_fim
medium
{ "lang": "python", "repo": "yamadathamine/300ideiasparaprogramarPython", "path": "/001 Saída Simples/pinheiro2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yamadathamine/300ideiasparaprogramarPython path: /001 Saída Simples/pinheiro2.py # encoding: utf-8 # Pinheiro 2 -Elabore uma versão 2 do programa do item anterior # que desenhe o pinheiro com asteriscos (*). # [Dica: use o recurso de localização/substituição do editor para fazer a substitui...
code_fim
medium
{ "lang": "python", "repo": "yamadathamine/300ideiasparaprogramarPython", "path": "/001 Saída Simples/pinheiro2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ardydedase/couchbasekit path: /couchbasekit/viewsync.py #! /usr/bin/env python """ couchbasekit.viewsync ~~~~~~~~~~~~~~~~~~~~~ :website: http://github.com/kirpit/couchbasekit :copyright: Copyright 2013, Roy Enjoy <kirpit *at* gmail.com>, see AUTHORS.txt. :license: MIT, see LICENSE.txt for detail...
code_fim
hard
{ "lang": "python", "repo": "ardydedase/couchbasekit", "path": "/couchbasekit/viewsync.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def upload(cls): """Uploads all the local views from :attr:`VIEW_PATHS` directory to CouchBase server This method **over-writes** all the server-side views with the same named ones coming from :attr:`VIEW_PATHS` folder. """ cls._check_f...
code_fim
hard
{ "lang": "python", "repo": "ardydedase/couchbasekit", "path": "/couchbasekit/viewsync.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: avikde/controlutils path: /py/kinematics.py ''' Helpful utilities ''' import autograd.numpy as np from scipy.spatial.transform import Rotation Skew2 = np.array([[0, -1], [1, 0]]) def skew(a=[0,0]): # Skew of a vector if len(a) == 3: return np.array([ [0, -a[2], a[1]...
code_fim
hard
{ "lang": "python", "repo": "avikde/controlutils", "path": "/py/kinematics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def rot(phi, euler=False): '''Either planar, or rotation vector for 3D''' if len(phi) == 1: return rot2(phi[0]) else: if euler: return Rotation.from_euler('xyz',phi).as_dcm() else: return Rotation.from_rotvec(phi).as_dcm() def affineKinematics(q...
code_fim
medium
{ "lang": "python", "repo": "avikde/controlutils", "path": "/py/kinematics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Linearization of rotation (small angle)''' return np.eye(2) + phiz * Skew2 def rot(phi, euler=False): '''Either planar, or rotation vector for 3D''' if len(phi) == 1: return rot2(phi[0]) else: if euler: return Rotation.from_euler('xyz',phi).as_dcm() ...
code_fim
medium
{ "lang": "python", "repo": "avikde/controlutils", "path": "/py/kinematics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Mats(cat=default) \ .sent(es="En mi patio tengo animales salvajes.", en="In my yard I have wild animals.", zh="在我的院子里,我有野生动物。", ja="私の庭には野生動物がいます。", v0="Watashi no niwa ni wa yasei dōbutsu ga imasu.", ) \<|fim_prefix|># repo: samlet/stack path: /mats/...
code_fim
easy
{ "lang": "python", "repo": "samlet/stack", "path": "/mats/4_es/Basics.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: samlet/stack path: /mats/4_es/Basics.py from sagas.nlu.mats import Cats, Mats <|fim_suffix|>Mats(cat=default) \ .sent(es="En mi patio tengo animales salvajes.", en="In my yard I have wild animals.", zh="在我的院子里,我有野生动物。", ja="私の庭には野生動物がいます。", v0="Watashi...
code_fim
easy
{ "lang": "python", "repo": "samlet/stack", "path": "/mats/4_es/Basics.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Apache-Spark-in-7-Days path: /Section 2/2.5_code_SharedVariables.py # shared variables # broadcast variable is read-only on the worker nodes # broadcast example <|fim_suffix|># example of large configuration dictionary or lookup table config = sc.broadcast({"transformation": 1...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Apache-Spark-in-7-Days", "path": "/Section 2/2.5_code_SharedVariables.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># foreach is a transformation and it does not return a value, it only executes the function on each element sc.parallelize([1, 2, 3, 4]).foreach(lambda x: accum.add(x)) accum.value<|fim_prefix|># repo: PacktPublishing/Apache-Spark-in-7-Days path: /Section 2/2.5_code_SharedVariables.py # shared variables...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Apache-Spark-in-7-Days", "path": "/Section 2/2.5_code_SharedVariables.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # accumulator variable is write-only on the worker nodes # accumulator example accum = sc.accumulator(0) accum def test_accum(x): accum.add(x) # foreach is a transformation and it does not return a value, it only executes the function on each element sc.parallelize([1, 2, 3, 4]).foreach(lambda x: accu...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Apache-Spark-in-7-Days", "path": "/Section 2/2.5_code_SharedVariables.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShoueneKun/Machine-Learning-driven-analysis-of-Gaze-Error path: /ML/DeepModels/models.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 7 11:57:48 2019 @author: rakshit """ import torch import torch.nn.functional as F import numpy as np from ModelHelpers import linStack, ...
code_fim
hard
{ "lang": "python", "repo": "ShoueneKun/Machine-Learning-driven-analysis-of-Gaze-Error", "path": "/ML/DeepModels/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert not (torch.isnan(x).any() or torch.isinf(x).any()), "NaN or Inf found in input" assert not (torch.isnan(target).any() or torch.isinf(target).any()), "NaN or Inf found in target" assert not (torch.isnan(weight).any() or torch.isinf(weight).any()), "NaN or Inf found in weight"...
code_fim
hard
{ "lang": "python", "repo": "ShoueneKun/Machine-Learning-driven-analysis-of-Gaze-Error", "path": "/ML/DeepModels/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: somiyagawa/camphr path: /subpackages/camphr_core/tests/test_factories.py from pathlib import Path from camphr_test.utils import check_lang import pytest import spacy import toml with (Path(__file__).parent / "../pyproject.toml") as f: conf = toml.load(f) <|fim_suffix|> @pytest.fixture(para...
code_fim
medium
{ "lang": "python", "repo": "somiyagawa/camphr", "path": "/subpackages/camphr_core/tests/test_factories.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> name = request.param if not check_lang(name): pytest.skip(f"{name} is required") return name def test_blank(lang): spacy.blank(lang)<|fim_prefix|># repo: somiyagawa/camphr path: /subpackages/camphr_core/tests/test_factories.py from pathlib import Path from camphr_test.utils imp...
code_fim
medium
{ "lang": "python", "repo": "somiyagawa/camphr", "path": "/subpackages/camphr_core/tests/test_factories.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture(params=LANGS) def lang(request): name = request.param if not check_lang(name): pytest.skip(f"{name} is required") return name def test_blank(lang): spacy.blank(lang)<|fim_prefix|># repo: somiyagawa/camphr path: /subpackages/camphr_core/tests/test_factories.py fro...
code_fim
medium
{ "lang": "python", "repo": "somiyagawa/camphr", "path": "/subpackages/camphr_core/tests/test_factories.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anuparna/Gaussian_Process path: /plot_data.py from pylab import * def plot_marker(marker_id, frames, x_coordinates, coordinate='x'): plot(frames, x_coordinates) xlabel('Frames') ylabel(coordinate+'-coordinate of marker - '+marker_id) title(coordinate+' coordinate movement of mar...
code_fim
medium
{ "lang": "python", "repo": "anuparna/Gaussian_Process", "path": "/plot_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def plot_marker_test(frames, x_coordinates, mse, markers, labels, markersize=1): plot(frames, x_coordinates, markers,markersize=markersize, label=labels) if mse is not None: fill(np.concatenate([frames, frames[::-1]]), np.concatenate([x_coordinates - 1.9600 * mse, ...
code_fim
hard
{ "lang": "python", "repo": "anuparna/Gaussian_Process", "path": "/plot_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(time.asctime(), f'Load experimental results from {exp_dir}') exp_res = load_exp_res(exp_dir) print(time.asctime(), 'Merge last cumulative truths') exp_res = merge_last_cum_truth(exp_res, forecast_date) sel_exp_res = exp_res # transform to the cdc format per model and seed ...
code_fim
hard
{ "lang": "python", "repo": "Frankfanwei/HierST", "path": "/src/run_ensemble.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raw_pred = raw_pred[(raw_pred['target'] == target) & (raw_pred['target_end_date'] == pd.to_datetime(target_end_date))] if level == 'county': raw_pred = raw_pred[raw_pred['location'].map(lambda x: len(x) == 5)] else: raw_pred = raw_pred[raw_pred['location'].map(lambda x: len(x) ...
code_fim
hard
{ "lang": "python", "repo": "Frankfanwei/HierST", "path": "/src/run_ensemble.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Frankfanwei/HierST path: /src/run_ensemble.py on) if len(task_items) == 4: seed = int(seed.lstrip('seed')) else: seed = '_'.join([seed.lstrip('seed')] + task_items[4:]) if model == 'gbm': gbm_out = pd.read_csv(os.path.join(exp_dir, task...
code_fim
hard
{ "lang": "python", "repo": "Frankfanwei/HierST", "path": "/src/run_ensemble.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Get the high and low bounds on AK135 AK135_innercore['rho max'] = AK135_innercore['rho']*(1+rho_sigma) AK135_innercore['Ks max'] = AK135_innercore['Ks']*(1+Ks_sigma) AK135_innercore['vphi max'] = AK135_innercore['vphi']*(1+vphi_sigma) AK135_innercore['rho min'] = AK135_innercore['rho']*(1-rho_sigma)...
code_fim
hard
{ "lang": "python", "repo": "r-a-morrison/fe_alloy_sound_velocities", "path": "/150_HighTEOS/HighT_Compare_Fe.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: r-a-morrison/fe_alloy_sound_velocities path: /150_HighTEOS/HighT_Compare_Fe.py # Front matter import datetime import pandas as pd import numpy as np from scipy.interpolate import interp1d import matplotlib import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLocator from matplot...
code_fim
hard
{ "lang": "python", "repo": "r-a-morrison/fe_alloy_sound_velocities", "path": "/150_HighTEOS/HighT_Compare_Fe.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> ax1.plot(EOS_df['P'],EOS_df['Ks'],'-', label=labelchoice[study],color=colorchoice[study],lw=1, linestyle=linestylechoice[study]) # ax1.fill_between(EOS_df['P'], EOS_df['Ks']+17, # EOS_df['Ks']-17, facecolor=colorchoice[study], alpha=0.3) ax1.set_ylabel(r'$...
code_fim
hard
{ "lang": "python", "repo": "r-a-morrison/fe_alloy_sound_velocities", "path": "/150_HighTEOS/HighT_Compare_Fe.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> cls, *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Type[schemas.Schema], ) -> 'PropertyNamedRefThatIsNotAReference': ...
code_fim
hard
{ "lang": "python", "repo": "InfoSec812/openapi-generator", "path": "/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: InfoSec812/openapi-generator path: /samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py # coding: utf-8 """ openapi 3.0.3 sample spec sample spec for testing openapi functionality, built from json schema tests for...
code_fim
hard
{ "lang": "python", "repo": "InfoSec812/openapi-generator", "path": "/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Do not edit the class manually. """ ref = schemas.StrSchema locals()["$ref"] = ref del locals()['ref'] """ NOTE: openapi/json-schema allows properties to have invalid python names The above local assignment allows the code to keep those invalid python names This all...
code_fim
medium
{ "lang": "python", "repo": "InfoSec812/openapi-generator", "path": "/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scitao/machin path: /machin/model/nets/__init__.py from .base import NeuralNetworkModule, dynamic_module_wrapper, static_module_wrapper from .resnet import ResNet <|fim_suffix|>__all__ = [ "NeuralNetworkModule", "dynamic_module_wrapper", "static_module_wrapper", "ResNet", "b...
code_fim
easy
{ "lang": "python", "repo": "scitao/machin", "path": "/machin/model/nets/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ "NeuralNetworkModule", "dynamic_module_wrapper", "static_module_wrapper", "ResNet", "base", "resnet", ]<|fim_prefix|># repo: scitao/machin path: /machin/model/nets/__init__.py from .base import NeuralNetworkModule, dynamic_module_wrapper, static_module_wrapper <|fim_m...
code_fim
medium
{ "lang": "python", "repo": "scitao/machin", "path": "/machin/model/nets/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fslds/fpf path: /tests/test_fpf.py #!/usr/bin/env python """Tests for `fpf` filter function.""" <|fim_suffix|>def test_filter_file_paths_import_simple(): test_fnc = filter_file_paths assert test_fnc assert hasattr(fpf, '__call__')<|fim_middle|>from fpf import fpf, file_path_filter, ...
code_fim
hard
{ "lang": "python", "repo": "fslds/fpf", "path": "/tests/test_fpf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_fnc = fpf assert test_fnc assert hasattr(fpf, '__call__') def test_file_path_filter_import_simple(): test_fnc = file_path_filter assert test_fnc assert hasattr(fpf, '__call__') def test_filter_file_paths_import_simple(): test_fnc = filter_file_paths assert test_fnc...
code_fim
medium
{ "lang": "python", "repo": "fslds/fpf", "path": "/tests/test_fpf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/py-pyparsing/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.pa...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/py-pyparsing/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> version("3.0.9", sha256="2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb") version("3.0.6", sha256="d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81") version("2.4.7", sha256="c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1") version("2.4.2...
code_fim
medium
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/py-pyparsing/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> file_name = file_name if file_name is not None else f"{text}.mp3" voice = __voice_config(voice_language, voice_gender) return __text_to_speech(text, file_name, voice)<|fim_prefix|># repo: gthoma17/anki-assistant path: /anki_assistant/google_cloud_speech_client.py import os from google.cloud i...
code_fim
hard
{ "lang": "python", "repo": "gthoma17/anki-assistant", "path": "/anki_assistant/google_cloud_speech_client.py", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|># repo: gthoma17/anki-assistant path: /anki_assistant/google_cloud_speech_client.py import os from google.cloud import texttospeech def __set_credentials(): creds_folder = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) creds_file = os.path.join(creds_folder, "google_creds.secret.j...
code_fim
medium
{ "lang": "python", "repo": "gthoma17/anki-assistant", "path": "/anki_assistant/google_cloud_speech_client.py", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|># repo: JiajunRen33/N-queens path: /run.py ################################# # # NOTE: Do not edit this file. # import sys from nqueens import solve <|fim_suffix|>with open(in_file) as f: problems = map(int, f.readlines()) for p in problems: print(solve(p))<|fim_middle|>if len(sys.argv) != ...
code_fim
medium
{ "lang": "python", "repo": "JiajunRen33/N-queens", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>problems = [] with open(in_file) as f: problems = map(int, f.readlines()) for p in problems: print(solve(p))<|fim_prefix|># repo: JiajunRen33/N-queens path: /run.py ################################# # # NOTE: Do not edit this file. # <|fim_middle|>import sys from nqueens import solve if le...
code_fim
medium
{ "lang": "python", "repo": "JiajunRen33/N-queens", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='ticketcategory', name='allowed_users', field=models.ManyToManyField(to=settings.AUTH_USER_MODEL), ), ]<|fim_prefix|># repo: claudiobat/uniTicket path: /uni_ticket/migrations/0129_ticketcategory_all...
code_fim
medium
{ "lang": "python", "repo": "claudiobat/uniTicket", "path": "/uni_ticket/migrations/0129_ticketcategory_allowed_users.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: claudiobat/uniTicket path: /uni_ticket/migrations/0129_ticketcategory_allowed_users.py # Generated by Django 3.0.7 on 2020-06-23 07:01 from django.conf import settings from django.db import migrations, models <|fim_suffix|> dependencies = [ migrations.swappable_dependency(settings.A...
code_fim
medium
{ "lang": "python", "repo": "claudiobat/uniTicket", "path": "/uni_ticket/migrations/0129_ticketcategory_allowed_users.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulhtremblay/big-data path: /big_data/python_tools/big_data_tools/bokeh_tools/make_graph_instance.py from bokeh.plotting import figure def make_p(widt<|fim_suffix|>ght=height, x_axis_type=x_axis_type, title=title)<|fim_middle|>h = 400, height = 400, x_axis_type = None, title=""): return figu...
code_fim
medium
{ "lang": "python", "repo": "paulhtremblay/big-data", "path": "/big_data/python_tools/big_data_tools/bokeh_tools/make_graph_instance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ght=height, x_axis_type=x_axis_type, title=title)<|fim_prefix|># repo: paulhtremblay/big-data path: /big_data/python_tools/big_data_tools/bokeh_tools/make_graph_instance.py from bokeh.plotting import figure def make_p(widt<|fim_middle|>h = 400, height = 400, x_axis_type = None, title=""): return figu...
code_fim
medium
{ "lang": "python", "repo": "paulhtremblay/big-data", "path": "/big_data/python_tools/big_data_tools/bokeh_tools/make_graph_instance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andreylrr/HHAnalyticsDjango path: /hhmain/admin.py from django.contrib import admin from .models import Contacts <|fim_suffix|> list_display = ('id','name', 'email', 'content')<|fim_middle|># Register your models here. @admin.register(Contacts) class ContactsAdmin(admin.ModelAdmin):
code_fim
medium
{ "lang": "python", "repo": "andreylrr/HHAnalyticsDjango", "path": "/hhmain/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('id','name', 'email', 'content')<|fim_prefix|># repo: andreylrr/HHAnalyticsDjango path: /hhmain/admin.py from django.contrib import admin from .models import Contacts <|fim_middle|># Register your models here. @admin.register(Contacts) class ContactsAdmin(admin.ModelAdmin):
code_fim
medium
{ "lang": "python", "repo": "andreylrr/HHAnalyticsDjango", "path": "/hhmain/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kozea/WeasyPrint path: /weasyprint/formatting_structure/boxes.py t.element_tag, style, parent.element, *args, **kwargs) def copy(self): """Return shallow copy of the box.""" cls = type(self) # Create a new instance without calling __init__: parameters are # di...
code_fim
hard
{ "lang": "python", "repo": "Kozea/WeasyPrint", "path": "/weasyprint/formatting_structure/boxes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kozea/WeasyPrint path: /weasyprint/formatting_structure/boxes.py io, brry * ratio), (blrx * ratio, blry * ratio)) def rounded_box_ratio(self, ratio): return self.rounded_box( self.border_top_width * ratio, self.border_right_width * ratio, ...
code_fim
hard
{ "lang": "python", "repo": "Kozea/WeasyPrint", "path": "/weasyprint/formatting_structure/boxes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if self.children: return len(self.children) else: try: return max(int(self.element.get('span', '').strip()), 1) except ValueError: return 1 # Not really a parent box, but pretending to be removes some corner cases. class...
code_fim
hard
{ "lang": "python", "repo": "Kozea/WeasyPrint", "path": "/weasyprint/formatting_structure/boxes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ax = plt.gca() plt.scatter(X,Y,s=5, lw=0, alpha=0.8) ax.set_xscale('log') ax.set_yscale('log') plt.xlabel('|V|+|E|') plt.ylabel('Time') #plt.ylim(1.0,3.0) #plt.xlim(1.0,1000.0) plt.savefig(filename, format='eps', dpi=1000) # plt.show() def main(argv): X, Y =...
code_fim
hard
{ "lang": "python", "repo": "ShoYamanishi/wailea", "path": "/jgaa/plot_performance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShoYamanishi/wailea path: /jgaa/plot_performance.py import sys import fileinput import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.colors as colors <|fim_suffix|> def draw(X, Y, filename): ax = plt.gca() plt.scatter(X,Y,s=5, lw=0, alpha=0.8) ...
code_fim
hard
{ "lang": "python", "repo": "ShoYamanishi/wailea", "path": "/jgaa/plot_performance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>elist=os.listdir('C:\Users\Gianmarco\Desktop\obj') #for file in filelist[:]: # filelist[:] makes a copy of filelist. im = Image.open('tiger.jpg') im = add_corners(im, 50) im.save('tiger.png')<|fim_prefix|># repo: Bshowg/MemoryCardGame path: /Client/Assets/Sprites/round.py import Image, ImageDraw imp...
code_fim
hard
{ "lang": "python", "repo": "Bshowg/MemoryCardGame", "path": "/Client/Assets/Sprites/round.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>)) alpha.paste(circle.crop((rad, 0, rad * 2, rad)), (w - rad, 0)) alpha.paste(circle.crop((rad, rad, rad * 2, rad * 2)), (w - rad, h - rad)) im.putalpha(alpha) return im #filelist=os.listdir('C:\Users\Gianmarco\Desktop\obj') #for file in filelist[:]: # filelist[:] makes a copy of fil...
code_fim
medium
{ "lang": "python", "repo": "Bshowg/MemoryCardGame", "path": "/Client/Assets/Sprites/round.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bshowg/MemoryCardGame path: /Client/Assets/Sprites/round.py import Image, ImageDraw import os def add_corners(im, rad): circle = Image.new('L', (rad * 2, rad * 2), 0) draw = ImageDraw.Draw(circle) draw.ellipse((0, 0, rad * 2, rad * 2)<|fim_suffix|>elist=os.listdir('C:\Users\G...
code_fim
hard
{ "lang": "python", "repo": "Bshowg/MemoryCardGame", "path": "/Client/Assets/Sprites/round.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ # import install-specific settings from a separate file # that is easy to replace as part of the deployment process from SiteMain.settings_base import * # noqa # end of file<|fim_p...
code_fim
medium
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/SiteMain/settings.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_prefix|># repo: RamonvdW/nhb-apps path: /SiteMain/settings.py # -*- coding: utf-8 -*- # Copyright (c) 2019-2023 Ramon van der Winkel. # All rights reserved. # Licensed under BSD-3-Clause-Clear. See LICENSE file for details. <|fim_suffix|># import install-specific settings from a separate file # that is easy...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/SiteMain/settings.py", "mode": "psm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError("This is an Interface class") class Polygon(Obstacle): def __init__(self): super().__init__(ObstacleType.POLYGON) self.points = [] # expected [(x0, y0), (x1, y1), ...] def to_qobject(self, x_offset, y_offset, width, height, inflate_radius=None):...
code_fim
hard
{ "lang": "python", "repo": "ENACRobotique/pygargue", "path": "/obstacle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ENACRobotique/pygargue path: /obstacle.py from enum import Enum import pyclipper from PyQt5.QtCore import QPointF, QRectF from PyQt5.QtGui import QPolygonF TABLE_WIDTH = 3000 # obstacles coordinates will usually be 0<= x <= TABLE_WIDTH TABLE_HEIGHT = 2000 # obstacles coordinates will usually ...
code_fim
hard
{ "lang": "python", "repo": "ENACRobotique/pygargue", "path": "/obstacle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GaoJiah/slippy path: /slippy/core/abcs.py """ Minimal abstract base classes please don't add any code to these, they are strictly to avoid circular imports, this module should be as minimal as possible as it will be imported every time any sub package is imported """ import abc __all__ = ['_Sur...
code_fim
hard
{ "lang": "python", "repo": "GaoJiah/slippy", "path": "/slippy/core/abcs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abc.abstractmethod def dimensionalise_gap(self, nd_gap, un_dimensionalise: bool = False): pass @abc.abstractmethod def dimensionalise_length(self, nd_length, un_dimensionalise: bool = False): pass class _SubModelABC(abc.ABC): name: str requires: set provides...
code_fim
hard
{ "lang": "python", "repo": "GaoJiah/slippy", "path": "/slippy/core/abcs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def merge( self, streams: Dict[str, Generator[None, None, None]] ) -> Generator[None, None, None]: """Merge multiple streams in one stream_data. Args: streams: mapping of streams (generators) """ buffer_dtype_init_values = self.buffer_dtype_ini...
code_fim
hard
{ "lang": "python", "repo": "zggl/wax-ml", "path": "/wax/stream.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zggl/wax-ml path: /wax/stream.py e(verbose, time_dim): if isinstance(verbose, bool): return verbose if isinstance(verbose, (list, tuple)): if time_dim in verbose: return True return False class GeneratorState(NamedTuple): output_values: Any strea...
code_fim
hard
{ "lang": "python", "repo": "zggl/wax-ml", "path": "/wax/stream.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zggl/wax-ml path: /wax/stream.py ype is onp.datetime64 } assert len(time_coords) == 1 return time_coords.pop() def get_dataset_time_coords(dataset): time_coords = { dim for dim, vals in dataset.coords.items() if vals.dtype.type is onp.datetime64 } assert len(time...
code_fim
hard
{ "lang": "python", "repo": "zggl/wax-ml", "path": "/wax/stream.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert(len(array) == len(helper_array)) if start < end: middle = (end - start) // 2 + start if start < middle: sort_helper(array, helper_array, start, middle) if (middle + 1) < end: sort_helper(array, helper_array, middle + 1, end) merge_help...
code_fim
medium
{ "lang": "python", "repo": "isayapin/cracking-the-coding-interview", "path": "/python_solutions/chapter_10_sorting_and_searching/merge_sort.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: isayapin/cracking-the-coding-interview path: /python_solutions/chapter_10_sorting_and_searching/merge_sort.py import copy def merge_helper(array, helper_array, start, middle, end): assert(len(array) == len(helper_array)) left_idx = start right_idx = middle + 1 helper_idx = start...
code_fim
medium
{ "lang": "python", "repo": "isayapin/cracking-the-coding-interview", "path": "/python_solutions/chapter_10_sorting_and_searching/merge_sort.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def xpath_findall(xpath, xml_content): """ Search xml by xpath Returns: List of Element [Element...] """ if LXML: # print(xml_content) root = etree.fromstring(xml_content.encode('utf-8')) for node in root.xpath("//node"): node.tag = safe_xm...
code_fim
medium
{ "lang": "python", "repo": "xxhdxh/uiautomator2", "path": "/uiautomator2/simplexml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: List of Element [Element...] """ if LXML: # print(xml_content) root = etree.fromstring(xml_content.encode('utf-8')) for node in root.xpath("//node"): node.tag = safe_xmlstr(node.attrib.pop("class")) return root.xpath( xpa...
code_fim
medium
{ "lang": "python", "repo": "xxhdxh/uiautomator2", "path": "/uiautomator2/simplexml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xxhdxh/uiautomator2 path: /uiautomator2/simplexml.py # coding: utf-8 # try: from lxml import etree LXML = True except: import xml.etree.ElementTree as ET LXML = False def safe_xmlstr(s): <|fim_suffix|>def xpath_findall(xpath, xml_content): """ Search xml by xpath R...
code_fim
medium
{ "lang": "python", "repo": "xxhdxh/uiautomator2", "path": "/uiautomator2/simplexml.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(self): self.get_filenames() fnames = self.get_filenames() df = self.load_multiple_files_to_df(fnames) self.store_as_pickle(df) return True<|fim_prefix|># repo: morganpare/ecx_analytics path: /ecx_analytics/data_processor/raw_to_bronze.py import pandas a...
code_fim
hard
{ "lang": "python", "repo": "morganpare/ecx_analytics", "path": "/ecx_analytics/data_processor/raw_to_bronze.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def store_as_pickle(self, df, filename='ecx_bronze.pkl'): file_path = pathlib.Path.joinpath(self.bronze_path, filename) df.to_pickle(file_path) def get_filenames(self): file_list = os.listdir(self.raw_path) return file_list def run(self): self.get_file...
code_fim
hard
{ "lang": "python", "repo": "morganpare/ecx_analytics", "path": "/ecx_analytics/data_processor/raw_to_bronze.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: morganpare/ecx_analytics path: /ecx_analytics/data_processor/raw_to_bronze.py import pandas as pd import pathlib import os class RawToBronze: def __init__(self, data_path): self.data_path = data_path try: self.raw_path = pathlib.Path.joinpath(self.data_path, "raw"...
code_fim
medium
{ "lang": "python", "repo": "morganpare/ecx_analytics", "path": "/ecx_analytics/data_processor/raw_to_bronze.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def split_data(num_samples, num_splits): """ Yields a split of data into train and test indices. """ kf = sklearn.model_selection.KFold(n_splits=num_splits, random_state=0); return kf.split(range(num_samples)) def make_bar_plot(x, y, title): """ Makes a bar chart with a title. "...
code_fim
hard
{ "lang": "python", "repo": "andy-sweet/planet-amazon", "path": "/planet/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Resizes 2D image to new 2D size over all channels. """ return skimage.transform.resize(image, size, mode='reflect', preserve_range=True).astype(image.dtype) def resize_images(images, size): """ Resizes 2D images to new 2D size over all channels. """ num_images = images.shape[...
code_fim
hard
{ "lang": "python", "repo": "andy-sweet/planet-amazon", "path": "/planet/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andy-sweet/planet-amazon path: /planet/util.py """ Some utility functions for loading and exploring the data. Nomenclature ------------ tag : The name of a label to predict. E.g. "haze". label : The non-negative integer value associated with a tag. E.g. 3. sample : The name associated with a sam...
code_fim
hard
{ "lang": "python", "repo": "andy-sweet/planet-amazon", "path": "/planet/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NunoXu/UnbabelChallenge2016 path: /Feature/NGramFeature/ProbabilityFeature.py import kenlm import numpy import math from .NGramFeature import NGramFeature class Probability(NGramFeature): <|fim_suffix|> super(Probability, self).__init__(model_path) def evaluate(self, sentence): ...
code_fim
easy
{ "lang": "python", "repo": "NunoXu/UnbabelChallenge2016", "path": "/Feature/NGramFeature/ProbabilityFeature.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(Probability, self).__init__(model_path) def evaluate(self, sentence): return math.pow(10, self._model.score(sentence))<|fim_prefix|># repo: NunoXu/UnbabelChallenge2016 path: /Feature/NGramFeature/ProbabilityFeature.py import kenlm import numpy import math from .NGramFeature imp...
code_fim
medium
{ "lang": "python", "repo": "NunoXu/UnbabelChallenge2016", "path": "/Feature/NGramFeature/ProbabilityFeature.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shinenazeer/automating_excel_with_python path: /07_chart_types/area_chart_3d.py # area_chart_3d.py from openpyxl import Workbook from openpyxl.chart import AreaChart3D, Reference def main(filename): <|fim_suffix|> cats = Reference(sheet, min_col=1, min_row=1, max_row=7) data = Reference(...
code_fim
hard
{ "lang": "python", "repo": "shinenazeer/automating_excel_with_python", "path": "/07_chart_types/area_chart_3d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sheet.add_chart(chart, "E2") wb.save(filename) if __name__ == "__main__": main("area_chart_3d.xlsx")<|fim_prefix|># repo: shinenazeer/automating_excel_with_python path: /07_chart_types/area_chart_3d.py # area_chart_3d.py from openpyxl import Workbook from openpyxl.chart import AreaChart3D,...
code_fim
hard
{ "lang": "python", "repo": "shinenazeer/automating_excel_with_python", "path": "/07_chart_types/area_chart_3d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gwli/pyESN path: /Lorenz.py import numpy as np def lorenz(dt,sigma=10.0,beta=2.66667,ro=28.): def l(x,y,z): xn = y*dt*sigma + x*(1 - dt*sigma) yn = x*dt*(ro-z) + y*(1-dt) zn = x*y*dt + z*(1 - dt*beta) return (xn,yn,zn) return l <|fim_suffix|>def plot(trajectory): fig = plt.figure() a...
code_fim
hard
{ "lang": "python", "repo": "gwli/pyESN", "path": "/Lorenz.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>frequency_control = (frequency_control- frequency_control.min())/(frequency_control.max()-frequency_control.min()) frequency_output = (frequency_output- frequency_output.min())/(frequency_output.max()-frequency_output.min())<|fim_prefix|># repo: gwli/pyESN path: /Lorenz.py import numpy as np def lorenz(d...
code_fim
hard
{ "lang": "python", "repo": "gwli/pyESN", "path": "/Lorenz.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: lukasHD/adventOfCode2020 path: /day20/test_yield.py def rotflip(): yield "rot1" yield "rot2" yield "rot3" yield "rot4" <|fim_suffix|>ile True: a = a_gen.__next__() print(a) i += 1 if i == 6: break<|fim_middle|> yield "flip" yield "rot1" yield "ro...
code_fim
medium
{ "lang": "python", "repo": "lukasHD/adventOfCode2020", "path": "/day20/test_yield.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>aise ValueError("aaaaa") i = 0 #for i,a in enumerate(rotflip()): a_gen = rotflip() while True: a = a_gen.__next__() print(a) i += 1 if i == 6: break<|fim_prefix|># repo: lukasHD/adventOfCode2020 path: /day20/test_yield.py def rotflip(): yield "rot1" yield "rot2" yield...
code_fim
medium
{ "lang": "python", "repo": "lukasHD/adventOfCode2020", "path": "/day20/test_yield.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tfinnm/HotWired-Bot path: /cogs/urbandict_utils/urbandictpages.py import re import typing as t import discord from discord.ext.commands import Context from cogs.utils.paginator import Pages class UrbanDictionaryPages(Pages): BRACKETED = re.compile(r"(\[(.+?)\])") def __init__(self, c...
code_fim
hard
{ "lang": "python", "repo": "tfinnm/HotWired-Bot", "path": "/cogs/urbandict_utils/urbandictpages.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Prepare embeds for the paginator.""" if self.maximum_pages > 1: title = f'{entry["word"]}: {page} out of {self.maximum_pages}' else: title = entry["word"] self.embed = e = discord.Embed(colour=0xE86222, title=title, url=entry["permalink"]) ...
code_fim
hard
{ "lang": "python", "repo": "tfinnm/HotWired-Bot", "path": "/cogs/urbandict_utils/urbandictpages.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tongxindao/shiyanlou path: /shiyanlou_cs642-966a5463b4/ibot.py # _*_ coding: utf-8 _*_ # six # 导入模块 from distutils.log import warn as printf import sys from bosonnlp import BosonNLP from os.path import expanduser import os import collections import subprocess import datetime # 配置 API 密钥 bosonnl...
code_fim
hard
{ "lang": "python", "repo": "tongxindao/shiyanlou", "path": "/shiyanlou_cs642-966a5463b4/ibot.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }