text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> logger: logging.Logger,
session,
agent_action: numpy.ndarray) -> numpy.ndarray:
# Just return the agent action
return agent_action
def environment_action_to... | code_fim | hard | {
"lang": "python",
"repo": "InsaneMonster/USienaRL",
"path": "/usienarl/interfaces/pass_through.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for fs in fs_list:
func = res.get(fs, None)
if func:
print count_fs("%s @ %s" % (fs, func), [func])
else:
print "%s is missing" % fs
return
def test_rename():
funcs = ["ext2_rename",
"ext3_rename",
"ext4_rename2",
... | code_fim | hard | {
"lang": "python",
"repo": "oslab-swrc/juxta",
"path": "/analyzer/eval-count.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log_d = os.path.join(ROOT, "data", "sample-fss-output")
ct = Counter("test-rename")
ct.load_pathbin(log_d)
for func in funcs:
ct.update(func)
print ct.report()
return
if __name__ == '__main__':
utils.install_pdb()
# test_rename()
# main()
count_path_by_func... | code_fim | hard | {
"lang": "python",
"repo": "oslab-swrc/juxta",
"path": "/analyzer/eval-count.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oslab-swrc/juxta path: /analyzer/eval-count.py
#!/usr/bin/env python2
# SPDX-License-Identifier: MIT
import os
import pprint
import fsop
import utils
from checker import BaseChecker
import multiprocessing as mp
ROOT = os.path.abspath(os.path.dirname(__file__))
PKL_BASE_DIR = "/data/fss-data/out... | code_fim | hard | {
"lang": "python",
"repo": "oslab-swrc/juxta",
"path": "/analyzer/eval-count.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #
# min_classical_gap
#
if min_classical_gap <= 0:
raise ValueError("min_classical_gap must be a positive number")
self.min_classical_gap = min_classical_gap
#
# vartype
#
# check that our feasible configurations match
... | code_fim | hard | {
"lang": "python",
"repo": "JoelPasvolsky/penaltymodel",
"path": "/penaltymodel_core/penaltymodel/core/classes/specification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoelPasvolsky/penaltymodel path: /penaltymodel_core/penaltymodel/core/classes/specification.py
"
from numbers import Number
import itertools
import networkx as nx
import dimod
__all__ = ['Specification']
class Specification(object):
"""Specification for a PenaltyModel.
See :class:... | code_fim | hard | {
"lang": "python",
"repo": "JoelPasvolsky/penaltymodel",
"path": "/penaltymodel_core/penaltymodel/core/classes/specification.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #
# feasible_configurations
#
try:
if not isinstance(feasible_configurations, dict):
feasible_configurations = {config: 0.0 for config in feasible_configurations}
else:
if not all(isinstance(en, Number) for en in feasi... | code_fim | hard | {
"lang": "python",
"repo": "JoelPasvolsky/penaltymodel",
"path": "/penaltymodel_core/penaltymodel/core/classes/specification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohi7solanki/causalml path: /causalml/metrics/visualize.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
plt.style.use('fivethirtyeigh... | code_fim | hard | {
"lang": "python",
"repo": "mohi7solanki/causalml",
"path": "/causalml/metrics/visualize.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cumgain.plot(figsize=figsize)
plt.xlabel('Fraction of Population')
plt.ylabel('Cumulative Gain')
def plot_lift(df, outcome_col='y', treatment_col='w', treatment_effect_col='tau',
steps=100, random_seed=42, figsize=(8, 8)):
"""Plot the lift chart of model estimates in cumula... | code_fim | hard | {
"lang": "python",
"repo": "mohi7solanki/causalml",
"path": "/causalml/metrics/visualize.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glowingkitty/NeoPixelPlus path: /neopixel_plus/neopixel_plus.py
overwrite_line=True,
debug=False,
target='micropython' # or 'adafruit'
):
self.debug = debug
self.target = target
self.strip_length = n
... | code_fim | hard | {
"lang": "python",
"repo": "glowingkitty/NeoPixelPlus",
"path": "/neopixel_plus/neopixel_plus.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glowingkitty/NeoPixelPlus path: /neopixel_plus/neopixel_plus.py
else:
from neopixel import NeoPixel as NeoPixelOriginal
if self.target == 'micropython':
self.leds = NeoPixelOriginal(
self.get_pin(),
self.strip_... | code_fim | hard | {
"lang": "python",
"repo": "glowingkitty/NeoPixelPlus",
"path": "/neopixel_plus/neopixel_plus.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def color(self,
rgb_colors=[randint(0, 255), randint(0, 255), randint(0, 255)],
customization_json={}
):
try:
print('color:')
original_r = customization_json['rgb_colors'][0][
0] if customization_json and 'rgb_co... | code_fim | hard | {
"lang": "python",
"repo": "glowingkitty/NeoPixelPlus",
"path": "/neopixel_plus/neopixel_plus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> product_brand_query = f"select idproducts from products where brand='{brand}' order by RANDOM() limit 4;"
product_brand_data = get_data_query(product_brand_query)
product_brand_data.append((brand,))
product_brand_data.insert(0, (data[0][0],))
values = []
fo... | code_fim | hard | {
"lang": "python",
"repo": "StanHaakman/Business-rules-voor-RE",
"path": "/collabRules/_preference_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StanHaakman/Business-rules-voor-RE path: /collabRules/_preference_tables.py
import psycopg2
from configparser import ConfigParser
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from _functions._base_functions import create_table, get_data_query, store_data, empty_db_table, drop_tabl... | code_fim | hard | {
"lang": "python",
"repo": "StanHaakman/Business-rules-voor-RE",
"path": "/collabRules/_preference_tables.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Recieve requested data from database
for current_session in idsessions:
brandquery = f"select idsessions, preferences from sessions where preferences not like 'null' and idsessions={current_session};"
data = get_data_query(brandquery)
preference = data[0][1]
pref... | code_fim | hard | {
"lang": "python",
"repo": "StanHaakman/Business-rules-voor-RE",
"path": "/collabRules/_preference_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
transformer_layer = nn.TransformerEncoderLayer(d_model=feat_dim, nhead=n_head,
dim_feedforward=2048,
dropout=dropout, activation='relu')
self.transformer... | code_fim | hard | {
"lang": "python",
"repo": "suvrajeet01/TERN",
"path": "/models/visual.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suvrajeet01/TERN path: /models/visual.py
from collections import OrderedDict
import numpy as np
import torch
from torch import nn as nn
from torchvision import models as models
from models.utils import PositionalEncodingImageBoxes, l2norm
def EncoderImage(config):
# data_name, img_dim, em... | code_fim | hard | {
"lang": "python",
"repo": "suvrajeet01/TERN",
"path": "/models/visual.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, visual_feats, visual_feats_len=None, boxes=None):
"""
Takes an variable len batch of visual features and preprocess them through a transformer. Output a tensor
with the same shape as visual_feats passed in input.
:param visual_feats:
:param vis... | code_fim | hard | {
"lang": "python",
"repo": "suvrajeet01/TERN",
"path": "/models/visual.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def align_coords_Kabsch(p_cycle_coords, q_cycle_coords, p_mask, q_mask=None):
"""
align p_cycle_coords with q_cycle_coords
mask indicates which atoms to apply RMSD minimization over; these atoms are used to calculate the
final rotation and translation matrices, which are applied to ALL at... | code_fim | hard | {
"lang": "python",
"repo": "bbaillif/GeoMol",
"path": "/model/cycle_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbaillif/GeoMol path: /model/cycle_utils.py
import torch
import numpy as np
def get_cycle_values(cycle_list, start_at=None):
start_at = 0 if start_at is None else cycle_list.index(start_at)
while True:
yield cycle_list[start_at]
start_at = (start_at + 1) % len(cycle_list... | code_fim | hard | {
"lang": "python",
"repo": "bbaillif/GeoMol",
"path": "/model/cycle_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> N=trajectory_generator.NUM_STEPS
out=np.empty((num_traj,))
for i in range(num_traj):
min_speed=np.amin(new_traj_list[i*N:(i+1)*N,4])
if min_speed<0.01:
out[i]=np.inf
else:
out[i]=1/min_speed
return out
@njit(fastmath=False,cache=True)
def multiInterp2(x,xp,fp):
j=np.searchsorted(xp,x)-1
... | code_fim | hard | {
"lang": "python",
"repo": "travelbureau/f0_icml_code",
"path": "/Simulator/python/mpc/trajectory_generator_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: travelbureau/f0_icml_code path: /Simulator/python/mpc/trajectory_generator_utils.py
eta_range.shape[0]):
idx=i*goal_theta_range.shape[0]+j
grid[0,idx]=grid_homo_translated[0,i]
grid[1,idx]=grid_homo_translated[1,i]
grid[2,idx]=goal_theta_range[j]
return grid
@njit(fastmath=False,cac... | code_fim | hard | {
"lang": "python",
"repo": "travelbureau/f0_icml_code",
"path": "/Simulator/python/mpc/trajectory_generator_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@njit(fastmath=False,cache=True)
def min_sqr_dist_to_wpts(point,wpts):
diff=wpts-point
diff_squared=np.square(diff)
dists=np.sum(diff_squared,axis=1)
min_idx=np.argmin(dists)
min_dist=dists[min_idx]
return min_dist,min_idx
def get_lane_cost_traj_list_nonnumba(traj_list,num_traj,speed_lut,reso):
N=... | code_fim | hard | {
"lang": "python",
"repo": "travelbureau/f0_icml_code",
"path": "/Simulator/python/mpc/trajectory_generator_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Use python's csv reader to access the contents
# and create an object that represents the data
# Loop through each row of the csv...
# and print the row to the terminal<|fim_prefix|># repo: rnagle/pycar path: /project1/step_2.py
# Import built-in python modules we'll want to acces... | code_fim | hard | {
"lang": "python",
"repo": "rnagle/pycar",
"path": "/project1/step_2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rnagle/pycar path: /project1/step_2.py
# Import built-in python modules we'll want to access csv files and download files
# We're going to download a csv file...
# What should we name it?
file_name = ""
<|fim_suffix|># Open the csv file
# Use python's csv reader to access the contents
... | code_fim | medium | {
"lang": "python",
"repo": "rnagle/pycar",
"path": "/project1/step_2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args(mainargs)
start_time = time.monotonic()
total_retries = 0
for generation_number in range(args.count):
print("Loading: %s" % (args.input_filename))
rom = ROMWithTables(args.input_filename)
if args.exportmap:
import mapexport
... | code_fim | hard | {
"lang": "python",
"repo": "spicefather/LADXR",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Monkey bridge patch, always have the bridge there.
rom.patch(0x00, 0x333D, ASM("bit 4, e\njr Z, $05"), b"", fill_nop=True)
if args.seed is not None and args.seed.upper() == "DEFAULT":
seed = "DEFAULT"
my_logic = logic.Logic(args, None)
for i... | code_fim | hard | {
"lang": "python",
"repo": "spicefather/LADXR",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spicefather/LADXR path: /main.py
import binascii
from romTables import ROMWithTables
from assembler import ASM
import randomizer
import patches.core
import patches.phone
import patches.bowwow
import patches.desert
import patches.owl
import patches.shop
import patches.trendy
import patches.chest
i... | code_fim | hard | {
"lang": "python",
"repo": "spicefather/LADXR",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> filename = f"results/figures/errorband_sed_{dataset.name}.png"
log.info(f"Writing {filename}")
fig.savefig(filename)
filename = f"results/figures/errorband_sed_{dataset.name}.pdf"
log.info(f"Writing {filename}")
fig.savefig(filename)<|fim_prefix|># repo: open-gamma-ray-astro/joint... | code_fim | hard | {
"lang": "python",
"repo": "open-gamma-ray-astro/joint-crab",
"path": "/joint_crab/plot_errorbands.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-gamma-ray-astro/joint-crab path: /joint_crab/plot_errorbands.py
"""Plot SED error bands (Figure 3 in the paper)."""
import logging
import matplotlib.pyplot as plt
from astropy.table import Table
from .conf import config
log = logging.getLogger(__name__)
def main():
for dataset in conf... | code_fim | medium | {
"lang": "python",
"repo": "open-gamma-ray-astro/joint-crab",
"path": "/joint_crab/plot_errorbands.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Plot SED for sampled models
table = Table.read(f"results/errorbands/samples_{dataset.name}.fits.gz")
for idx in range(100):
energy = table["energy"].quantity[idx]
dnde = table["dnde"].quantity[idx]
e2dnde = ((energy ** 2) * dnde).to("erg cm-2 s-1")
mask = data... | code_fim | medium | {
"lang": "python",
"repo": "open-gamma-ray-astro/joint-crab",
"path": "/joint_crab/plot_errorbands.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main(argv=None):
arguments = parse_arguments(argv)
commands = {
'upload': upload.command,
'edit': edit.command,
'view': view.command,
}
return commands[arguments.command](arguments)<|fim_prefix|># repo: pyarmory/aumbry path: /aumbry/cli/app.py
import argparse... | code_fim | medium | {
"lang": "python",
"repo": "pyarmory/aumbry",
"path": "/aumbry/cli/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyarmory/aumbry path: /aumbry/cli/app.py
import argparse
from aumbry.cli import upload, edit, view
def parse_arguments(argv=None):
<|fim_suffix|>def main(argv=None):
arguments = parse_arguments(argv)
commands = {
'upload': upload.command,
'edit': edit.command,
'... | code_fim | hard | {
"lang": "python",
"repo": "pyarmory/aumbry",
"path": "/aumbry/cli/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spcl/dace path: /tests/numpy/npdot_test.py
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
import numpy as np
import pytest
from common import compare_numpy_output
<|fim_suffix|> return np.dot(A, B)
if __name__ == "__main__":
test_dot_simple()<|f... | code_fim | medium | {
"lang": "python",
"repo": "spcl/dace",
"path": "/tests/numpy/npdot_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
test_dot_simple()<|fim_prefix|># repo: spcl/dace path: /tests/numpy/npdot_test.py
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
import numpy as np
import pytest
from common import compare_numpy_output
<|fim_middle|>@compare_numpy... | code_fim | medium | {
"lang": "python",
"repo": "spcl/dace",
"path": "/tests/numpy/npdot_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.info("Device Count = %d", gpu_num)
model_dir = cfg.model_dir
if not os.path.isdir(model_dir):
os.makedirs(model_dir)
if gpu_num> 1:
mp.set_start_method("spawn")
processes = list()
for i in range(gpu_num):
process = mp.Process(target=work... | code_fim | hard | {
"lang": "python",
"repo": "sunshuofeng/myproject",
"path": "/peopele_detect/model/cascade_emd/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunshuofeng/myproject path: /peopele_detect/model/cascade_emd/train.py
import os
import bisect
import argparse
import multiprocessing as mp
import numpy as np
from tqdm import tqdm
import megengine as mge
from megengine import distributed as dist
from megengine import optimizer as optim
from meg... | code_fim | hard | {
"lang": "python",
"repo": "sunshuofeng/myproject",
"path": "/peopele_detect/model/cascade_emd/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_ext_tb(target, simulator):
class mytb(m.Circuit):
io = m.IO()
tester = fault.Tester(mytb)
tester.compile_and_run(
target=target,
simulator=simulator,
ext_srcs=[Path('tests/verilog/mytb.sv').resolve()],
ext_test_bench=True,
tmp_dir=True... | code_fim | medium | {
"lang": "python",
"repo": "leonardt/fault",
"path": "/tests/test_ext_tb.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leonardt/fault path: /tests/test_ext_tb.py
import fault
import magma as m
from pathlib import Path
from .common import pytest_sim_params
<|fim_suffix|> pytest_sim_params(metafunc, 'system-verilog')
def test_ext_tb(target, simulator):
class mytb(m.Circuit):
io = m.IO()
teste... | code_fim | easy | {
"lang": "python",
"repo": "leonardt/fault",
"path": "/tests/test_ext_tb.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> tester = fault.Tester(mytb)
tester.compile_and_run(
target=target,
simulator=simulator,
ext_srcs=[Path('tests/verilog/mytb.sv').resolve()],
ext_test_bench=True,
tmp_dir=True
)<|fim_prefix|># repo: leonardt/fault path: /tests/test_ext_tb.py
import fault
... | code_fim | medium | {
"lang": "python",
"repo": "leonardt/fault",
"path": "/tests/test_ext_tb.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gorov/zucc path: /code/run_comatch_bert_sas_jecc.py
tchBertForwardRanking(nn.Module):
def __init__(self, args, max_length, num_class, pretrain_path, blank_padding=True):
super().__init__()
args.hidden = args.hidden_dim
self.max_length = max_length
... | code_fim | hard | {
"lang": "python",
"repo": "Gorov/zucc",
"path": "/code/run_comatch_bert_sas_jecc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.hidden_dim = 200
self.mlstm_hidden_dim = 100
self.embedding_dim = 100
# self.embedding_dim = 300
self.num_classes = 1
self.kernel_size = 3
self.layer_num = 1
self.fine_tuning = False
self.cuda = True
... | code_fim | hard | {
"lang": "python",
"repo": "Gorov/zucc",
"path": "/code/run_comatch_bert_sas_jecc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># else:
# test_accs.append(dev_correct / dev_total)
# print('total: %d'%(dev_total))
# print('total wt: %d'%(dev_total_wt))
# print('test acc: %f' %(dev_correct/dev_total))
# print('wt test acc: %f' %(dev_correct_... | code_fim | hard | {
"lang": "python",
"repo": "Gorov/zucc",
"path": "/code/run_comatch_bert_sas_jecc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: farnasirim/zahlen path: /tests/ds/tree/test_order_statistics_tree.py
# -*- coding: utf-8 -*-
"""
Test case module for zahlen.ds.tree.order_statistics_tree
:copyright: (c) 2014 by Subhajit Ghosh.
:license: MIT, see LICENSE for more details.
"""
from zahlen.ds.tree.order_statistics_t... | code_fim | hard | {
"lang": "python",
"repo": "farnasirim/zahlen",
"path": "/tests/ds/tree/test_order_statistics_tree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(self.ost.kth_smallest_key(1), 2)
def test_smallest_element_from_non_root(self):
self.assertEqual(
self.ost.kth_smallest_key(4, root=self.ost.root.right), 10)
def test_largest_element_from_root(self):
self.assertEqual(self.ost.kth_smallest_key(... | code_fim | hard | {
"lang": "python",
"repo": "farnasirim/zahlen",
"path": "/tests/ds/tree/test_order_statistics_tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> newSentence = []
splitSentence = list(s)
for letter in splitSentence:
if letter != '!':
newSentence.append(letter)
return "".join(newSentence)
remove_exclamation_marks("Hello World!!!")<|fim_prefix|># repo: vinnyhoward/til path: /python/toy-problems/remove_exclamat... | code_fim | easy | {
"lang": "python",
"repo": "vinnyhoward/til",
"path": "/python/toy-problems/remove_exclamation_marks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vinnyhoward/til path: /python/toy-problems/remove_exclamation_marks.py
# Remove exclamation marks
# Write function RemoveExclamationMarks which removes all exclamation marks from a given string.
<|fim_suffix|>
remove_exclamation_marks("Hello World!!!")<|fim_middle|>def remove_exclamation_marks... | code_fim | hard | {
"lang": "python",
"repo": "vinnyhoward/til",
"path": "/python/toy-problems/remove_exclamation_marks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "".join(newSentence)
remove_exclamation_marks("Hello World!!!")<|fim_prefix|># repo: vinnyhoward/til path: /python/toy-problems/remove_exclamation_marks.py
# Remove exclamation marks
# Write function RemoveExclamationMarks which removes all exclamation marks from a given string.
def remov... | code_fim | medium | {
"lang": "python",
"repo": "vinnyhoward/til",
"path": "/python/toy-problems/remove_exclamation_marks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cankoloz/Top-10 path: /Website_Project/first_web_app/urls.py
from django.conf.urls import url
from first_web_app import views
<|fim_suffix|>urlpatterns = [
url(r'^user_login/$', views.user_login, name='user_login'),
url(r'^register/$', views.register, name='register'),
]<|fim_middl... | code_fim | easy | {
"lang": "python",
"repo": "cankoloz/Top-10",
"path": "/Website_Project/first_web_app/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^user_login/$', views.user_login, name='user_login'),
url(r'^register/$', views.register, name='register'),
]<|fim_prefix|># repo: cankoloz/Top-10 path: /Website_Project/first_web_app/urls.py
from django.conf.urls import url
from first_web_app import views
<|fim_middl... | code_fim | easy | {
"lang": "python",
"repo": "cankoloz/Top-10",
"path": "/Website_Project/first_web_app/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kupc25648/N_gram_One_row_keyboard path: /N_gram_1Row_main.py
'''
==============================================================================================================
Import
==============================================================================================================
'''... | code_fim | hard | {
"lang": "python",
"repo": "kupc25648/N_gram_One_row_keyboard",
"path": "/N_gram_1Row_main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>correct_short = 0
wrong_short = 0
correct_short_len = np.zeros((1,50))
wrong_short_len = np.zeros((1,50))
correct_zero = 0
wrong_zero = 0
correct_zero_len = np.zeros((1,50))
wrong_zero_len = np.zeros((1,50))
all_test = 0
for i in range(len(s_test)):
test_num = turn_to_num(s_test[i])
result_long... | code_fim | hard | {
"lang": "python",
"repo": "kupc25648/N_gram_One_row_keyboard",
"path": "/N_gram_1Row_main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>},
'Gd' :{'number': 64, 'name':'Gadolinium ', 'mass':157.25, 'abundance':'6.2 ', 'valence':10, 'CPKcolor':'#45FFC7', },
'Tb' :{'number': 65, 'name':'Terbium ', 'mass':158.92, 'abundance':'1.2 ', 'valence':11, 'CPKcolor':'#30FFC7', },
'Dy' :{'number': 66, 'name':'Dysprosium ', 'mas... | code_fim | hard | {
"lang": "python",
"repo": "ryokbys/nap",
"path": "/nappy/elements.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryokbys/nap path: /nappy/elements.py
#!/usr/bin/env python
"""
Elements and their attributes.
"""
elements = {
'H' :{'number': 1, 'name':'Hydrogen', 'mass':1.008 , 'abundance':'1400 ', 'valence':1, 'CPKcolor':'#FFFFFF', },
'He' :{'number': 2, 'name':'Hellium', 'mass':4.00... | code_fim | hard | {
"lang": "python",
"repo": "ryokbys/nap",
"path": "/nappy/elements.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@freeze_time("2012-01-14 12:00:00")
def test_import_localtime():
struct = fake_localtime_function()
assert struct.tm_year == 2012
assert struct.tm_mon == 1
assert struct.tm_mday >= 13 # eg. GMT+14
assert struct.tm_mday <= 15 # eg. GMT-14
@freeze_time("2012-01-14 12:00:00")
def test... | code_fim | hard | {
"lang": "python",
"repo": "spulec/freezegun",
"path": "/tests/test_class_import.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@freeze_time("2012-01-14 12:00:00")
def test_fake_gmtime_function():
struct = fake_gmtime_function()
assert struct.tm_year == 2012
assert struct.tm_mon == 1
assert struct.tm_mday == 14
@freeze_time("2012-01-14")
def test_fake_strftime_function():
assert fake_strftime_function() == '2... | code_fim | hard | {
"lang": "python",
"repo": "spulec/freezegun",
"path": "/tests/test_class_import.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spulec/freezegun path: /tests/test_class_import.py
import time
import sys
from .fake_module import (
fake_date_function,
fake_datetime_function,
fake_gmtime_function,
fake_localtime_function,
fake_strftime_function,
fake_time_function,
)
from . import fake_module
from free... | code_fim | hard | {
"lang": "python",
"repo": "spulec/freezegun",
"path": "/tests/test_class_import.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_process(flush):
cpid = os.getpid()
psu = psutil.Process(cpid)
psl = P.get_process(cpid)
assert psu.pid == psl.pid
assert psu.ppid() == psl.ppid
assert psu.name() == ffi.string(psl.name)
assert psu.exe() == ffi.string(psl.exe)
assert " ".join(psu.cmdline()) == ffi.s... | code_fim | medium | {
"lang": "python",
"repo": "dheera/ros-system-health",
"path": "/include/cpslib/tests/test_process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dheera/ros-system-health path: /include/cpslib/tests/test_process.py
import os
import psutil
from pycpslib import lib as P
from pycpslib import ffi
def test_pid_exists(flush):
cpid = os.getpid()
peu = psutil.pid_exists(cpid)
pel = P.pid_exists(cpid)
assert peu == pel
<|fim_suff... | code_fim | medium | {
"lang": "python",
"repo": "dheera/ros-system-health",
"path": "/include/cpslib/tests/test_process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Y_pred = np.round(self.model.predict(self.X_ts))
f1 = f1_score(self.Y_ts, Y_pred)
precision = precision_score(self.Y_ts, Y_pred)
recall = recall_score(self.Y_ts, Y_pred)
accuracy = accuracy_score(self.Y_ts, Y_pred)
return accuracy, precision, recall, f1<|fim... | code_fim | hard | {
"lang": "python",
"repo": "hcji/DeepEI",
"path": "/Fingerprint/xgb.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hcji/DeepEI path: /Fingerprint/xgb.py
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 4 15:32:10 2020
@author: hcji
"""
import numpy as np
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score
from sklearn.model_selection import train_test_split
from xgboost import... | code_fim | hard | {
"lang": "python",
"repo": "hcji/DeepEI",
"path": "/Fingerprint/xgb.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.model = XGBClassifier(max_depth=max_depth, learning_rate=learning_rate, n_estimators=n_estimators).fit(self.X_tr, self.Y_tr)
def test(self):
Y_pred = np.round(self.model.predict(self.X_ts))
f1 = f1_score(self.Y_ts, Y_pred)
precision = precision_score(self.Y_ts... | code_fim | hard | {
"lang": "python",
"repo": "hcji/DeepEI",
"path": "/Fingerprint/xgb.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> basis = tensor.basis
dim = tensor.dim
new_ct_dim = tensor.ct_dim - 1
new_c_dim = tensor.c_dim + 1
new_type = (new_ct_dim, new_c_dim)
contravariant_indices = get_all_multiindices(new_ct_dim, dim)
covariant_indices = get_all_multiindices(new_c_dim, dim)
new_tensor_dict = {}
... | code_fim | hard | {
"lang": "python",
"repo": "miguelgondu/generalrepytivity",
"path": "/generalrepytivity/index_manipulation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miguelgondu/generalrepytivity path: /generalrepytivity/index_manipulation.py
from .utils import get_all_multiindices
from .tensor import Tensor, get_matrix_from_tensor
def contract_indices(tensor, i, j):
"""
contract_indices formally contracts the i-th superindex and the jth-subindex
... | code_fim | hard | {
"lang": "python",
"repo": "miguelgondu/generalrepytivity",
"path": "/generalrepytivity/index_manipulation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Its arguments:
- tensor: any (p,q)-tensor, with q >= 1.
- metric: a (0,2)-tensor which represents a non-degenerate symmetric
bilinear function.
- j: an integer which represents the position of the subindex to
be raised (indexing in 0).
Returns:
- a (p+1,q-1)-tensor, th... | code_fim | hard | {
"lang": "python",
"repo": "miguelgondu/generalrepytivity",
"path": "/generalrepytivity/index_manipulation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FaHoLo/Pokemon_map path: /pogomap/urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from pokemon_entities import views
<|fim_suffix|>if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, d... | code_fim | medium | {
"lang": "python",
"repo": "FaHoLo/Pokemon_map",
"path": "/pogomap/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('admin/', admin.site.urls),
path('', views.show_all_pokemons, name="mainpage"),
path('pokemon/<pokemon_id>/', views.show_pokemon, name="pokemon"),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: F... | code_fim | easy | {
"lang": "python",
"repo": "FaHoLo/Pokemon_map",
"path": "/pogomap/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mldbai/mldb path: /testing/MLDB-696_uri_causes_crash.py
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
<|fim_suffix|>try:
mldb.create_dataset({
"type": "beh.mutable", "id": "y",
"params":{
"dataFileUrl": "/asbolute/path/... | code_fim | hard | {
"lang": "python",
"repo": "mldbai/mldb",
"path": "/testing/MLDB-696_uri_causes_crash.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> request.set_return("failure")
exit()
except:
pass
try:
mldb.create_dataset({
"type": "beh.mutable", "id": "y",
"params":{
"dataFileUrl": "/asbolute/path/without/protocol.beh"
}}).commit() #should complain about missing protocol!
... | code_fim | hard | {
"lang": "python",
"repo": "mldbai/mldb",
"path": "/testing/MLDB-696_uri_causes_crash.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
mldb.create_dataset({
"type": "beh.mutable", "id": "y",
"params":{
"dataFileUrl": "/asbolute/path/without/protocol.beh"
}}).commit() #should complain about missing protocol!
request.set_return("failure")
exit()
except:
pass
req... | code_fim | hard | {
"lang": "python",
"repo": "mldbai/mldb",
"path": "/testing/MLDB-696_uri_causes_crash.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baku89/sublime_transmit_docksend path: /TransmitDocksend.py
import sublime
import sublime_plugin
import subprocess
import os.path
class TransmitDocksendCommand(sublime_plugin.TextCommand):
def run(self, edit, connection=False):
if connection == 'active':
script = """
on run
tell appl... | code_fim | hard | {
"lang": "python",
"repo": "baku89/sublime_transmit_docksend",
"path": "/TransmitDocksend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = path.replace('scss', 'css')
proc = subprocess.Popen(
["osascript", "-e", script % path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)<|fim_prefix|># repo: baku89/sublime_transmit_docksend path: /TransmitDocksend.py
import sublime
import sublime_pl... | code_fim | medium | {
"lang": "python",
"repo": "baku89/sublime_transmit_docksend",
"path": "/TransmitDocksend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # scss
path = self.view.file_name()
root, ext = os.path.splitext(path)
basename = os.path.basename(path)
if ext == '.scss' :
if basename[0:1] == '_' :
path = path.replace(basename, '')
path = path.replace('scss', 'css')
proc = subprocess.Popen(
["osascript", "-e", script % ... | code_fim | hard | {
"lang": "python",
"repo": "baku89/sublime_transmit_docksend",
"path": "/TransmitDocksend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Savahi/tnn path: /tnn/data_handler/RTS_Ret_Vol_Mom_Sto_RSI_SMA_6.py
# -*- coding: utf-8 -*-
import taft
import numpy as np
import sys
indicators = {
"Return": lambda rates: ( rates['cl'][0] - rates['op'][0] ) / rates['op'][0] ,
"Volume": lambda rates: rates['vol'][0] ,
"Momentum": lambda rat... | code_fim | hard | {
"lang": "python",
"repo": "Savahi/tnn",
"path": "/tnn/data_handler/RTS_Ret_Vol_Mom_Sto_RSI_SMA_6.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> profit = clLessOp - trans_cost
# Print doneness
done = len(pastRates['cl'])
todo = len(futureRates['cl'])
sys.stdout.write ("\rProcessing inputs {}% done".format (int (100.0 * done / (done+todo))) )
sys.stdout.flush()
return inputs, output, profit
return _calc_data<|fim_prefix|># repo: S... | code_fim | hard | {
"lang": "python",
"repo": "Savahi/tnn",
"path": "/tnn/data_handler/RTS_Ret_Vol_Mom_Sto_RSI_SMA_6.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jer8856/acme-jer path: /tests/test_Payment.py
import acme
import unittest
class TestPayment(unittest.TestCase):
__test = {
'ceil' : {
'input' : [1.5, 2.7, 45.8, 400.01],
'output': [2,3,46,401]
},
'range' : {
'input' :... | code_fim | hard | {
"lang": "python",
"repo": "jer8856/acme-jer",
"path": "/tests/test_Payment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_checkRange(self, _input = "input", output = "output"):
for index, value in enumerate(self.__test["range"][_input]):
_range: str = acme.Payment.checkRange(acme.DayTime.strptime(value))
self.assertEqual(_range, self.__test["range"][output][index])
def t... | code_fim | hard | {
"lang": "python",
"repo": "jer8856/acme-jer",
"path": "/tests/test_Payment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_getSalary(self, _input = "input", output = "output"):
for index, (v1, v2) in enumerate(self.__test["salary"][_input]):
v1t = acme.DayTime.strptime(v1)
v2t = acme.DayTime.strptime(v2)
# print(f'range {v1t} - {v2t}')
_salaryWeekday: f... | code_fim | hard | {
"lang": "python",
"repo": "jer8856/acme-jer",
"path": "/tests/test_Payment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __get_count2num__(self):
return tuple(self.__count2num__)
count2num = property(__get_count2num__, doc=
"The count2num is an array of the number of the different counts.\n" +
"For example, key = \"333rR\", count2num = [0,2,0,1,0]. count2num[1] = 2 denotes that two cards (r and ... | code_fim | hard | {
"lang": "python",
"repo": "becky93/RoomAI",
"path": "/roomai/doudizhupoker/DouDiZhuPokerHandCards.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: becky93/RoomAI path: /roomai/doudizhupoker/DouDiZhuPokerHandCards.py
import os
import roomai.common
from roomai.doudizhupoker.DouDiZhuPokerAction import DouDiZhuActionElement
import copy
class DouDiZhuPokerHandCards:
'''
The hand cards in the DouDiZhuPoker game.
'''
def __init... | code_fim | hard | {
"lang": "python",
"repo": "becky93/RoomAI",
"path": "/roomai/doudizhupoker/DouDiZhuPokerHandCards.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __get_key__(self):
return self.__key__
key = property(__get_key__, doc="The key of HandCards. For example, key = \"33rR\". ")
def __get_count2num__(self):
return tuple(self.__count2num__)
count2num = property(__get_count2num__, doc=
"The count2num is an array of ... | code_fim | hard | {
"lang": "python",
"repo": "becky93/RoomAI",
"path": "/roomai/doudizhupoker/DouDiZhuPokerHandCards.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def is_same_minus(x):
d = x[1] - x[0]
for i in range(2, len(x)):
if x[i] - d != x[i - 1]:
return False
return True
for p in range(0, len(A) - 2):
for q in range(p + 2, len(A)):
if is_same_m... | code_fim | hard | {
"lang": "python",
"repo": "oneTaken/leetcode",
"path": "/easy/413.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> d = x[1] - x[0]
for i in range(2, len(x)):
if x[i] - d != x[i - 1]:
return False
return True
for p in range(0, len(A) - 2):
for q in range(p + 2, len(A)):
if is_same_minus(A[p:q + 1]):
... | code_fim | hard | {
"lang": "python",
"repo": "oneTaken/leetcode",
"path": "/easy/413.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oneTaken/leetcode path: /easy/413.py
# solution1
# exceed time 13/15
class Solution:
def numberOfArithmeticSlices(self, A):
"""
:type A: List[int]
:rtype: int
"""
count = 0
def is_same_minus(x):
d = x[1] - x[0]
for i in ... | code_fim | hard | {
"lang": "python",
"repo": "oneTaken/leetcode",
"path": "/easy/413.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> vgg16 = VGG16('data/checkpoints/vgg_16.ckpt')
inputs = tf.placeholder(tf.float32, [None, 224, 224, 3])
vgg16.build_model(inputs, is_train=False)
test_img_path = 'data/test_imgs/ILSVRC2012_val_00000003.JPEG'
test_img = utils.read_img(test_img_path, expand_dims=True)
sess = tf.Sess... | code_fim | hard | {
"lang": "python",
"repo": "xeyond/deep-cnn",
"path": "/vgg_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sess = tf.Session()
sess.run(tf.global_variables_initializer())
output = sess.run(vgg16.fc8, feed_dict={inputs: test_img})
prob_lable = int(np.argmax(output, axis=1))
print(prob_lable, utils.get_class_name_by_id(prob_lable))
if __name__ == "__main__":
# vgg19_test()
vgg16_te... | code_fim | hard | {
"lang": "python",
"repo": "xeyond/deep-cnn",
"path": "/vgg_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xeyond/deep-cnn path: /vgg_test.py
import tensorflow as tf
from nets.vgg19 import VGG19
from nets.vgg16 import VGG16
import utils
import numpy as np
def vgg19_test():
vgg19 = VGG19('data/checkpoints/vgg_19.ckpt')
inputs = tf.placeholder(tf.float32, [None, 224, 224, 3])
vgg19.build_m... | code_fim | hard | {
"lang": "python",
"repo": "xeyond/deep-cnn",
"path": "/vgg_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ian-gelman/multisnake path: /test.py
from collections import namedtuple
import unittest
from unittest.mock import patch
from server import Server
from client import Client
ClientInfo = namedtuple('ClientInfo', ['reader', 'writer'])
class ServerTest(unittest.TestCase):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "ian-gelman/multisnake",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
self.server = Server(host='0.0.0.0', port='6969')
self.client = Client()
def connect_client(self):
self.server.start()
self.client.connect(server_host='0.0.0.0', server_port='6969')
def test_open_connection(self):
prev_count = self.ser... | code_fim | medium | {
"lang": "python",
"repo": "ian-gelman/multisnake",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prev_count = self.server.get_client_count()
self.connect_client()
count = self.server.get_client_count()
self.assertGreater(prev_count, count)
pass
def test_handle_client_connect(self):
pass
if __name__ == '__main__':
unittest.main()<|fim_prefix|>#... | code_fim | hard | {
"lang": "python",
"repo": "ian-gelman/multisnake",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fabioeomedeiros/Python-Base path: /075_Analise_de_dados_em_uma_tupla.py
#075_Analise_de_dados_em_uma_tupla.py
num = (int(input("Digite o 1º número: ")), int(input("Digite o 1º número: ")), int(input("<|fim_suffix|>não foi digitado")
print("Os valores: ", end="")
for n in num:
if n % 2 == 0:... | code_fim | hard | {
"lang": "python",
"repo": "fabioeomedeiros/Python-Base",
"path": "/075_Analise_de_dados_em_uma_tupla.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>não foi digitado")
print("Os valores: ", end="")
for n in num:
if n % 2 == 0:
print(f"{n} ", end="")
print("São pares")<|fim_prefix|># repo: fabioeomedeiros/Python-Base path: /075_Analise_de_dados_em_uma_tupla.py
#075_Analise_de_dados_em_uma_tupla.py
num = (int(input("Digite o 1º número: ")... | code_fim | hard | {
"lang": "python",
"repo": "fabioeomedeiros/Python-Base",
"path": "/075_Analise_de_dados_em_uma_tupla.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ent')
if mibBuilder.loadTexts: hh3cDot11LICFeatureLicEntry.setDescription('Each entry contains wlan feature information of license.')
hh3cDot11LICKeyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 75, 14, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/HH3C-DOT11-LIC-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/HH3C-DOT11-LIC-MIB.py
#
# PySNMP MIB module HH3C-DOT11-LIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-DOT11-LIC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:26:14 2019
# On host DA... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/HH3C-DOT11-LIC-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> hra = hra/(3.14159/180)
time = str(hour)+' : '+str(min)
worksheet.write(row, column, n)
column += 1
worksheet.write(row, column, time)
column += 1
... | code_fim | hard | {
"lang": "python",
"repo": "SubhayanDas08/KlucherModelSimuator_Package",
"path": "/KlucherModelSDas/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> time = str(hour)+' : '+str(min)
worksheet.write(row, column, n)
column += 1
worksheet.write(row, column, time)
column += 1
worksheet.write(row, column, hra)
column ... | code_fim | hard | {
"lang": "python",
"repo": "SubhayanDas08/KlucherModelSimuator_Package",
"path": "/KlucherModelSDas/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SubhayanDas08/KlucherModelSimuator_Package path: /KlucherModelSDas/__init__.py
import xlsxwriter
import math
constants = [
[1202, 0.141, 0.103], [1187, 0.142, 0.104], [1164, 0.149, 0.109], [1130, 0.164, 0.120], [1106, 0.177, 0.130], [1092, 0.185, 0.137],
[1093, 0.186, 0.138], [1107, 0.18... | code_fim | hard | {
"lang": "python",
"repo": "SubhayanDas08/KlucherModelSimuator_Package",
"path": "/KlucherModelSDas/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bozhikovstanislav/UI-Pylinac path: /VMAT/Dmlc/main.py
#!-*-coding:utf-8-*-
import sys
# import PyQt4 QtCore and QtGui modules
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5 import QtCore
from pylinac import VMAT
from dmlc import Ui_MainWindow
class DirectoryPath(object):
... | code_fim | hard | {
"lang": "python",
"repo": "bozhikovstanislav/UI-Pylinac",
"path": "/VMAT/Dmlc/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if cal1:
leeds = VMAT(images=[DirectoryPath.fieldOpenPathfile, DirectoryPath.dmlcopenfilenamepath],
delivery_types=['open', 'dmlc'])
leeds.analyze(test='drmlc', tolerance=1.3, x_offset=0)
leeds.plot_analyzed_subimage('profile')
... | code_fim | hard | {
"lang": "python",
"repo": "bozhikovstanislav/UI-Pylinac",
"path": "/VMAT/Dmlc/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lfelipesv/speech2text path: /asr/lm/tokenizer.py
class BaseTokenizer:
reserved_tokens = {'<blank>': 0, '<unk>': 1}
def __init__(self, vocab_file, ignored_tokens=[]):
self.ignored_tokens = ignored_tokens
self._token2idx = {}.update(self.reserved_tokens)
with open... | code_fim | hard | {
"lang": "python",
"repo": "lfelipesv/speech2text",
"path": "/asr/lm/tokenizer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.