text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: onespacemedia/cms-people path: /apps/people/admin.py
from cms.admin import PageBaseAdmin, SearchMetaBaseAdmin
from django.contrib import admin
from suit.admin import SortableModelAdmin
from .models import People, Person, Team
@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
<|fim_suffi... | code_fim | hard | {
"lang": "python",
"repo": "onespacemedia/cms-people",
"path": "/apps/people/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajputakhil/ludwig path: /ludwig/constants.py
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | code_fim | hard | {
"lang": "python",
"repo": "rajputakhil/ludwig",
"path": "/ludwig/constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>VERALL_PREDICTIONS = 'correct_overall_predictions'
CORRECT_ROWWISE_PREDICTIONS = 'correct_rowwise_predictions'
ROWWISE_ACCURACY = 'rowwise_accuracy'
LAST_ACCURACY = 'last_accuracy'
OVERALL_ACCURACY = 'overall_accuracy'
LAST_PROBABILTIES = 'last_probabilities'
LAST_PREDICTIONS = 'last_predictions'
L... | code_fim | hard | {
"lang": "python",
"repo": "rajputakhil/ludwig",
"path": "/ludwig/constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yelp/pgctl path: /tests/testing/__init__.py
import os.path
import shutil
TOP = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
<|fim_suffix|> template_dir = os.path.join(TOP, 'tests/examples', service_name)
destination = destination.join(service_name, abs=1)... | code_fim | easy | {
"lang": "python",
"repo": "Yelp/pgctl",
"path": "/tests/testing/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> template_dir = os.path.join(TOP, 'tests/examples', service_name)
destination = destination.join(service_name, abs=1)
shutil.copytree(template_dir, destination.strpath)
return destination<|fim_prefix|># repo: Yelp/pgctl path: /tests/testing/__init__.py
import os.path
import shutil
TOP = o... | code_fim | easy | {
"lang": "python",
"repo": "Yelp/pgctl",
"path": "/tests/testing/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /DQMOffline/L1Trigger/python/L1TJetDiff_cfi.py
import FWCore.ParameterSet.Config as cms
from DQMOffline.L1Trigger import L1TEtSumJetOffline_cfi as L1TStep1
variables = {
'jet': L1TStep1.jetEfficiencyThresholds,
}
plots = {
'jet': [
"efficiencyJetEt_HB", "effic... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQMOffline/L1Trigger/python/L1TJetDiff_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>allPlots = []
allPlots.extend(allEfficiencyPlots)
allPlots.extend(resolution_plots)
allPlots.extend(plots2D)
l1tJetEmuDiff = l1tDiffHarvesting.clone(
plotCfgs=cms.untracked.VPSet(
cms.untracked.PSet( # EMU comparison
dir1=cms.untracked.string("L1T/L1TObjects/L1TJet/L1TriggerVsRec... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQMOffline/L1Trigger/python/L1TJetDiff_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError
def delete_file(self, filename):
raise NotImplementedError<|fim_prefix|># repo: briandrawert/stochss path: /app/backend/storage/base_storage.py
class BaseStorageAgent(object):
<|fim_middle|> def upload_file(self, filename):
| code_fim | easy | {
"lang": "python",
"repo": "briandrawert/stochss",
"path": "/app/backend/storage/base_storage.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: briandrawert/stochss path: /app/backend/storage/base_storage.py
class BaseStorageAgent(object):
<|fim_suffix|> def delete_file(self, filename):
raise NotImplementedError<|fim_middle|> def upload_file(self, filename):
raise NotImplementedError
| code_fim | medium | {
"lang": "python",
"repo": "briandrawert/stochss",
"path": "/app/backend/storage/base_storage.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if result['error']:
return __response_handler(request, result['data'], url=None, status=result['data']['status'] if 'status' in result['data'] else 500)
else:
return __response_handler(request, {}, url=None, status=200)
def __response_handler(request, data_res, ur... | code_fim | hard | {
"lang": "python",
"repo": "5g-media/OIDC_ON_OSMr5",
"path": "/LW-UI_MODIFIED/netslicehandler/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5g-media/OIDC_ON_OSMr5 path: /LW-UI_MODIFIED/netslicehandler/views.py
# Copyright 2018 EveryUP Srl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | code_fim | hard | {
"lang": "python",
"repo": "5g-media/OIDC_ON_OSMr5",
"path": "/LW-UI_MODIFIED/netslicehandler/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-polymatrix-games/probatus path: /probatus/metric_volatility/utils.py
# Copyright (c) 2020 ING Bank N.V.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without... | code_fim | medium | {
"lang": "python",
"repo": "python-polymatrix-games/probatus",
"path": "/probatus/metric_volatility/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if sampling_type is not None:
if sampling_type == "bootstrap":
if fraction <= 0:
raise (
ValueError(
f"For bootstrapping {dataset_name} fraction needs to be above 0"
)
)
elif sam... | code_fim | medium | {
"lang": "python",
"repo": "python-polymatrix-games/probatus",
"path": "/probatus/metric_volatility/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.funcname = funcname
class Column:
def __init__(self, title, compiler, typename):
self.title = title
self.compiler = compiler
self.typename = typename
self.width = len(self.title)
class Table:
def __init__(self, bitwidth, caption, columns):
sel... | code_fim | hard | {
"lang": "python",
"repo": "Quuxplusone/WideIntProofOfConcept",
"path": "/generate_updated_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, funcname):
self.funcname = funcname
class Column:
def __init__(self, title, compiler, typename):
self.title = title
self.compiler = compiler
self.typename = typename
self.width = len(self.title)
class Table:
def __init__(self, bitwid... | code_fim | hard | {
"lang": "python",
"repo": "Quuxplusone/WideIntProofOfConcept",
"path": "/generate_updated_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Quuxplusone/WideIntProofOfConcept path: /generate_updated_tables.py
#!/usr/bin/env python
import argparse
import json
import re
import requests
with open('wider.h') as f:
original_source = f.readlines()
def process(compiler_name, function_name, type_name, bypass):
global original_sourc... | code_fim | hard | {
"lang": "python",
"repo": "Quuxplusone/WideIntProofOfConcept",
"path": "/generate_updated_tables.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if peso > 51:
excesso = peso - 50
multa = excesso * 4
print("O peso dos seus peixes é de {:.0f} Kilos " .format(peso))
print("Excederam {:.0f} Kilos " .format(excesso))
print("O valor da multa é de R$ {:.0f} " .format(multa))<|fim_prefix|># repo: claudiopmaia/DataScience path: /EstruturaSequencial... | code_fim | medium | {
"lang": "python",
"repo": "claudiopmaia/DataScience",
"path": "/EstruturaSequencial/Exercicio14.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: claudiopmaia/DataScience path: /EstruturaSequencial/Exercicio14.py
""" João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de seu trabalho.
Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do estado de Sã... | code_fim | medium | {
"lang": "python",
"repo": "claudiopmaia/DataScience",
"path": "/EstruturaSequencial/Exercicio14.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("O peso dos seus peixes é de {:.0f} Kilos " .format(peso))
print("Excederam {:.0f} Kilos " .format(excesso))
print("O valor da multa é de R$ {:.0f} " .format(multa))<|fim_prefix|># repo: claudiopmaia/DataScience path: /EstruturaSequencial/Exercicio14.py
""" João Papo-de-Pescador, homem de bem, ... | code_fim | medium | {
"lang": "python",
"repo": "claudiopmaia/DataScience",
"path": "/EstruturaSequencial/Exercicio14.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kousikmitra/pydo path: /pydo/pydo.py
import argparse
import sys
from os.path import dirname, abspath, join
from random import randrange
import json
class MyParser(argparse.ArgumentParser):
def error(self, message):
<|fim_suffix|> args = parser.parse_args()
if args.say:
pr... | code_fim | hard | {
"lang": "python",
"repo": "kousikmitra/pydo",
"path": "/pydo/pydo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args()
if args.say:
print("Echo: ", args.say)
elif args.inspire:
inspire()
elif args.save:
print("Saving task...")
else:
print("What? :|")
if __name__ == "__main__":
main()<|fim_prefix|># repo: kousikmitra/pydo path: /pydo... | code_fim | hard | {
"lang": "python",
"repo": "kousikmitra/pydo",
"path": "/pydo/pydo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bingo957/MyStudyProject path: /MyProjects/workspace/甲鱼Class/lect49/计算素数之和.py
#
# God Bless No Bugs!
#
# _ooOoo_
# o8888888o
# 88" . "88
# (| -_- |)
# O\ = /O
# ... | code_fim | medium | {
"lang": "python",
"repo": "bingo957/MyStudyProject",
"path": "/MyProjects/workspace/甲鱼Class/lect49/计算素数之和.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_prime(number):
while True:
if is_prime(number):
yield number
number += 1
def prime_sum():
total = 2
for next_prime in get_prime(3):
if next_prime < 2000000:
total += next_prime
else:
print(total)
return
... | code_fim | hard | {
"lang": "python",
"repo": "bingo957/MyStudyProject",
"path": "/MyProjects/workspace/甲鱼Class/lect49/计算素数之和.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def prime_sum():
total = 2
for next_prime in get_prime(3):
if next_prime < 2000000:
total += next_prime
else:
print(total)
return
if __name__ == '__main__':
prime_sum()<|fim_prefix|># repo: bingo957/MyStudyProject path: /MyProjects/worksp... | code_fim | hard | {
"lang": "python",
"repo": "bingo957/MyStudyProject",
"path": "/MyProjects/workspace/甲鱼Class/lect49/计算素数之和.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context = {
"available_configs": CONFIG_MAP,
"pinax_notifications_installed": "pinax.notifications" in settings.INSTALLED_APPS,
"pinax_stripe_installed": "pinax.stripe" in settings.INSTALLED_APPS
}
return context<|fim_prefix|># repo: pinax/pinax_theme_tester path: /pin... | code_fim | easy | {
"lang": "python",
"repo": "pinax/pinax_theme_tester",
"path": "/pinax_theme_tester/context_processors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pinax/pinax_theme_tester path: /pinax_theme_tester/context_processors.py
from django.conf import settings
from .configs import CONFIG_MAP
<|fim_suffix|> context = {
"available_configs": CONFIG_MAP,
"pinax_notifications_installed": "pinax.notifications" in settings.INSTALLED_A... | code_fim | easy | {
"lang": "python",
"repo": "pinax/pinax_theme_tester",
"path": "/pinax_theme_tester/context_processors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># import apis into api package
from baiduads.wordmaterial.api.word_material_service import WordMaterialService<|fim_prefix|># repo: baidu/baiduads-sdk path: /python/baiduads-sdk-auto/baiduads/wordmaterial/api/__init__.py
from __future__ import absolute_import
<|fim_middle|># flake8: noqa
| code_fim | easy | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/baiduads/wordmaterial/api/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baidu/baiduads-sdk path: /python/baiduads-sdk-auto/baiduads/wordmaterial/api/__init__.py
from __future__ import absolute_import
<|fim_suffix|># import apis into api package
from baiduads.wordmaterial.api.word_material_service import WordMaterialService<|fim_middle|># flake8: noqa
| code_fim | easy | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/baiduads/wordmaterial/api/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _solve_lambert(f, symbol, gens):
"""Return solution to ``f`` if it is a Lambert-type expression
else raise NotImplementedError.
The equality, ``f(x, a..f) = a*log(b*X + c) + d*X - f = 0`` has the
solution, `X = -c/b + (a/d)*W(d/(a*b)*exp(c*d/a/b)*exp(f/a))`. There
are a variety ... | code_fim | hard | {
"lang": "python",
"repo": "diofant/diofant",
"path": "/diofant/solvers/bivariate.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diofant/diofant path: /diofant/solvers/bivariate.py
from ..core import Add, Dummy, Pow, expand_log
from ..core.function import _mexpand
from ..functions import LambertW, exp, log, root
from ..polys.polytools import Poly, factor
from ..simplify import collect, separatevars
from ..utilities import ... | code_fim | hard | {
"lang": "python",
"repo": "diofant/diofant",
"path": "/diofant/solvers/bivariate.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Only positive values of ``u`` are considered.
Examples
========
>>> eq = (x**2 - 3).subs({x: x + y})
>>> bivariate_type(eq, x, y)
(x + y, _u**2 - 3, _u)
>>> uxy, pu, u = _
>>> usol = solve(pu, u)
>>> usol
[{_u: sqrt(3)}]
>>> [solve(uxy - s[u]) for s in solve(p... | code_fim | hard | {
"lang": "python",
"repo": "diofant/diofant",
"path": "/diofant/solvers/bivariate.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rahulrathnakumar/pytorch-nlugen path: /model/decoder.py
import torch
from . import rnn
from . import common
from . import nonlinear
class AbstractSequenceDecoder(common.Module):
def __init__(self, in_dim, hidden_dim, out_dim):
super(AbstractSequenceDecoder, self).__init__()
... | code_fim | hard | {
"lang": "python",
"repo": "rahulrathnakumar/pytorch-nlugen",
"path": "/model/decoder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch_size, seq_len, _ = x.size()
x = self.invoke(self.input_nonlinear, x)
z_exp = z.unsqueeze(1).expand(batch_size, seq_len, self.hidden_dim)
x = torch.cat([x, z_exp], 2)
o, _, _ = self.invoke(self.rnn, x, lens)
o = o.view(-1, self.hidden_dim)
o = s... | code_fim | hard | {
"lang": "python",
"repo": "rahulrathnakumar/pytorch-nlugen",
"path": "/model/decoder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fengxingxiang/intel-extension-for-pytorch path: /torch_ipex_py/quantization/quantization_utils.py
import torch
import functools
import warnings
import numpy as np
import intel_extension_for_pytorch._C as core
from .. import conf
def _get_default_recipe(configures):
# For int8 quantization, w... | code_fim | hard | {
"lang": "python",
"repo": "fengxingxiang/intel-extension-for-pytorch",
"path": "/torch_ipex_py/quantization/quantization_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.prev = torch.is_autocast_cpu_enabled()
self.pre_quantization_state = core.is_quantization_enabled()
self.pre_calibration_state = core.get_int8_calibration()
torch.set_autocast_cpu_enabled(True)
core.set_quantization_enabled(True)
core.disable_int8_cali... | code_fim | hard | {
"lang": "python",
"repo": "fengxingxiang/intel-extension-for-pytorch",
"path": "/torch_ipex_py/quantization/quantization_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skolchin/car-damage path: /annotate.py
as tk
import json
from pathlib import Path
from imutils.perspective import order_points
from skimage.measure import compare_ssim, find_contours
from skimage.draw import polygon
from copy import deepcopy
from tkinter import filedialog
from tkinter import t... | code_fim | hard | {
"lang": "python",
"repo": "skolchin/car-damage",
"path": "/annotate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def __init_window(self):
left_frame = tk.Frame(self.internalFrame, bd=1, relief=tk.GROOVE)
left_frame.pack(side = tk.LEFT, fill = tk.BOTH, expand = True, pady=2)
right_frame = tk.Frame(self.internalFrame, bd=1, relief=tk.GROOVE)
right_frame.pack(side = tk... | code_fim | hard | {
"lang": "python",
"repo": "skolchin/car-damage",
"path": "/annotate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.image_data is None:
event.cancel = True
return
if event.state:
self.imageSplit.show()
if not 'split' in self.meta_data[self.image_data.key]:
self.meta_data[self.image_data.key]['split'] = self.imageSplit.scaled_mask[2... | code_fim | hard | {
"lang": "python",
"repo": "skolchin/car-damage",
"path": "/annotate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kojino/GAN-Convergence path: /script/motif_gen.py
from os.path import join,exists,realpath,dirname
from os import makedirs,listdir
import numpy as np, sys
def readMotif(dfile):
with open(dfile) as f:
f.readline()
return [map(float,x.split()) for x in f]
def gen_motif_instanc... | code_fim | hard | {
"lang": "python",
"repo": "kojino/GAN-Convergence",
"path": "/script/motif_gen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return np.random.randint(_range[1] - _range[0] + 1 - _len + 1) + _range[0]
def grammar_spikein(seq,grammars):
_lrange, _rrange, t_pwm = grammars
t_motif = gen_motif_instance(t_pwm)
_left = sample_loc([_lrange,_rrange], len(t_motif))
_right = _left + len(t_motif)
seq[_left:_right]... | code_fim | medium | {
"lang": "python",
"repo": "kojino/GAN-Convergence",
"path": "/script/motif_gen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: octabytes/FireO path: /src/tests/v2.1.1/test_to_dict.py
from fireo.fields import TextField
from fireo.models import Model
class MyModel(Model):
field = TextField(column_name='my_field')
<|fim_suffix|> instance = MyModel()
instance.field = 'value'
assert instance.to_dict() == {
... | code_fim | easy | {
"lang": "python",
"repo": "octabytes/FireO",
"path": "/src/tests/v2.1.1/test_to_dict.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_to_dict_by_field_name_by_default():
instance = MyModel()
instance.field = 'value'
assert instance.to_dict() == {
'field': 'value',
'id': instance.id,
'key': instance.key,
}<|fim_prefix|># repo: octabytes/FireO path: /src/tests/v2.1.1/test_to_dict.py
from ... | code_fim | medium | {
"lang": "python",
"repo": "octabytes/FireO",
"path": "/src/tests/v2.1.1/test_to_dict.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def dbStatus(self):
return self.dsRepo().checkStatus()
def saveFiles(self, recipe, subName, *filepaths, **kwFilepaths):
fs = {}
for i, filepath in enumerate(filepaths):
fs[i] = filepath
for k, v in kwFilepaths.items():
fs[k] = v
wit... | code_fim | hard | {
"lang": "python",
"repo": "dcdanko/PackageMega",
"path": "/packagemega/repo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dcdanko/PackageMega path: /packagemega/repo.py
import os.path
import datasuper as ds
from os import listdir, symlink
from shutil import copyfile
import sys
import inspect
from subprocess import call
class RecipeNotFoundError(Exception):
pass
class Repo:
repoDirName = '.package_mega'
... | code_fim | hard | {
"lang": "python",
"repo": "dcdanko/PackageMega",
"path": "/packagemega/repo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def backwards(self, orm):
# Deleting field 'School.address'
db.delete_column('schools_school', 'address')
# Deleting field 'School.city'
db.delete_column('schools_school', 'city')
# Deleting field 'School.zip_code'
db.delete_column('schools_sc... | code_fim | hard | {
"lang": "python",
"repo": "skoczen/pdxschoolhack",
"path": "/project/apps/schools/migrations/0002_auto__add_field_school_address__add_field_school_city__add_field_schoo.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skoczen/pdxschoolhack path: /project/apps/schools/migrations/0002_auto__add_field_school_address__add_field_school_city__add_field_schoo.py
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration)... | code_fim | medium | {
"lang": "python",
"repo": "skoczen/pdxschoolhack",
"path": "/project/apps/schools/migrations/0002_auto__add_field_school_address__add_field_school_city__add_field_schoo.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/models path: /research/cv/resnet3d/src/loss.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/models",
"path": "/research/cv/resnet3d/src/loss.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CrossEntropySmooth(LossBase):
"""CrossEntropy"""
def __init__(self, sparse=True, reduction='mean', smooth_factor=0., num_classes=101):
super(CrossEntropySmooth, self).__init__()
self.onehot = P.OneHot()
self.sparse = sparse
self.on_value = Tensor(1.0 - smooth... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/models",
"path": "/research/cv/resnet3d/src/loss.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """CrossEntropy"""
def __init__(self, sparse=True, reduction='mean', smooth_factor=0., num_classes=101):
super(CrossEntropySmooth, self).__init__()
self.onehot = P.OneHot()
self.sparse = sparse
self.on_value = Tensor(1.0 - smooth_factor, mstype.float32)
sel... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/models",
"path": "/research/cv/resnet3d/src/loss.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ramkumarkrishnan/LearnPython path: /pcc_ch02/lists.py
bikes_full = ['buell','bullet','bmw','ducati','honda','indian','kawasaki','royal enfield','suzuki','triumph','yamaha']
print(f"We have {len(bikes_full)} bikes in stock")
bikes = bikes_full
print (bikes)
print ("Interesting - list = list is a p... | code_fim | hard | {
"lang": "python",
"repo": "ramkumarkrishnan/LearnPython",
"path": "/pcc_ch02/lists.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_unsorted:")
bikes_unsorted = ['indian','kawasaki','royal enfield','buell','honda','suzuki','bullet','bmw','ducati','triumph','yamaha']
print(sorted(bikes_unsorted))
print (bikes_unsorted)
bikes_sorted = sorted(bikes_unsorted)
print (bikes_sorted)
print (bikes_unsorted)
print ("bikes_sorted reversed:")
bi... | code_fim | hard | {
"lang": "python",
"repo": "ramkumarkrishnan/LearnPython",
"path": "/pcc_ch02/lists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Methode, mit der das Feature "person" bestimmt werden kann.
# Erlaubte Eingaben sind die Zahlen 1-3 als String.
# Per Default ist der Wert auf "3" gesetzt.
def setPerson(self,person="3"):
if person not in list("123"):
raise ValueError("Input has to be a String (1, 2 o... | code_fim | hard | {
"lang": "python",
"repo": "JBreuerPY/TurkoGen",
"path": "/transducers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JBreuerPY/TurkoGen path: /transducers.py
ature in einer Liste wiedergeben
return ["last_vowel_"+vowel]
# Wenn das Feature <NEG> (negiert) nicht in der Liste der Features ist, gibt diese Methode
# das Kontextattribut <POS> (positiv) wieder.
def positive(self):
if "... | code_fim | hard | {
"lang": "python",
"repo": "JBreuerPY/TurkoGen",
"path": "/transducers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JBreuerPY/TurkoGen path: /transducers.py
acceptCombinations(feature)
# Ausnahme: Kausativ mit Spezifikation, wie oft er vorkommen soll
elif len(feature) == 5 and feature[:-1] == "CAUS":
# Variable für Kausativvorkommen auf entsprechende zahl set... | code_fim | hard | {
"lang": "python",
"repo": "JBreuerPY/TurkoGen",
"path": "/transducers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>registration_patterns = ([
#@[p_models_seguridad_02]
path('registro/',RegistroView.as_view(), name='registro'),
path('profile/',ProfileUpdate.as_view(), name='profile'),
path('profile/email/',EmailUpdate.as_view(), name='profile_email'),
], 'registration')
#@[p_models_seguridad_03]<|fim_prefix|># repo... | code_fim | easy | {
"lang": "python",
"repo": "djangoinminutes/curso-genesis",
"path": "/genesis/core/static/core/textfiles/registration/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: djangoinminutes/curso-genesis path: /genesis/core/static/core/textfiles/registration/urls.py
from django.urls import path
from .views import RegistroView, ProfileUpdate,EmailUpdate
<|fim_suffix|>registration_patterns = ([
#@[p_models_seguridad_02]
path('registro/',RegistroView.as_view(), name='... | code_fim | easy | {
"lang": "python",
"repo": "djangoinminutes/curso-genesis",
"path": "/genesis/core/static/core/textfiles/registration/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(5000):
optimizer.zero_grad()
hn, cn = hn.detach(), cn.detach()
out, (hn, cn) = lstm(inputs, (hn, cn))
pred = out[-1]
loss = criterion(pred, target)
loss.backward()
optimizer.step()
if i % 50 == 0:
print(i, loss)<|fim_prefix|># repo: bonomali/NVSM_pyto... | code_fim | hard | {
"lang": "python",
"repo": "bonomali/NVSM_pytorch",
"path": "/src/models/lstm_model_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bonomali/NVSM_pytorch path: /src/models/lstm_model_test.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
<|fim_suffix|>for i in range(5000):
optimizer.zero_grad()
hn, cn = hn.detach(), cn.detach()
out, (hn, cn) = lstm(inputs, (hn, cn))... | code_fim | hard | {
"lang": "python",
"repo": "bonomali/NVSM_pytorch",
"path": "/src/models/lstm_model_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oinopion/davstorage path: /davstorage/storage.py
from __future__ import unicode_literals
import requests
from django.conf import settings
from django.core.files import File
from django.core.files.storage import Storage
from davstorage.utils import trim_trailing_slash
class DavStorage(Storage):
... | code_fim | hard | {
"lang": "python",
"repo": "oinopion/davstorage",
"path": "/davstorage/storage.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return '%s/%s' % (self._external_url, name)
def internal_url(self, name):
return '%s/%s' % (self._internal_url, name)
def _open(self, name, mode='rb'):
url = self.internal_url(name)
response = requests.get(url, stream=True)
response.raw.decode_content = Tr... | code_fim | medium | {
"lang": "python",
"repo": "oinopion/davstorage",
"path": "/davstorage/storage.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _open(self, name, mode='rb'):
url = self.internal_url(name)
response = requests.get(url, stream=True)
response.raw.decode_content = True
return File(response.raw, name)
def _save(self, name, content):
url = self.internal_url(name)
requests.put(u... | code_fim | hard | {
"lang": "python",
"repo": "oinopion/davstorage",
"path": "/davstorage/storage.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devanshshukla99/8085-Simulator path: /core/util.py
import re
def twos_complement(num: str, _base: int = 16) -> str:
"""
Helper function to compure 2's complement of a hex value.
Parameters
----------
num : `str`
_base : `int`, optional
Defaults to 16
"""
... | code_fim | hard | {
"lang": "python",
"repo": "devanshshukla99/8085-Simulator",
"path": "/core/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_bytes(data: str) -> int:
"""
Helper function to get the # of bytes in the hex.
Parameters
----------
data : `str`
"""
data = str(data)
return int(len(sanatize_hex(data)) / 2)
def construct_hex(hex1: str, hex2: str, _bytes: int = 2) -> str:
"""
Helper meth... | code_fim | hard | {
"lang": "python",
"repo": "devanshshukla99/8085-Simulator",
"path": "/core/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def decompose_byte(data: str, nibble: bool = False) -> list:
"""
Helper function to decompose hex into bytes/nibbles
Parameters
----------
data : `str`
nibble : `bool`, optional
Defaults to `False`
"""
_bytes = int(len(sanatize_hex(data)) / 2)
mem_size = 8
... | code_fim | hard | {
"lang": "python",
"repo": "devanshshukla99/8085-Simulator",
"path": "/core/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def truncated_normal_init(arr, mean, stddev, seed, stream=None):
# time consuming !!
assert isinstance(arr, _nd.NDArray)
_LIB.DLGpuTruncatedNormalInit(arr.handle, ctypes.c_float(mean), ctypes.c_float(
stddev), ctypes.c_ulonglong(seed), stream.handle if stream else None)<|fim_prefix|>#... | code_fim | medium | {
"lang": "python",
"repo": "initzhang/Hetu",
"path": "/python/hetu/gpu_links/InitializersLink.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # time consuming !!
assert isinstance(arr, _nd.NDArray)
_LIB.DLGpuTruncatedNormalInit(arr.handle, ctypes.c_float(mean), ctypes.c_float(
stddev), ctypes.c_ulonglong(seed), stream.handle if stream else None)<|fim_prefix|># repo: initzhang/Hetu path: /python/hetu/gpu_links/InitializersLi... | code_fim | hard | {
"lang": "python",
"repo": "initzhang/Hetu",
"path": "/python/hetu/gpu_links/InitializersLink.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: initzhang/Hetu path: /python/hetu/gpu_links/InitializersLink.py
from __future__ import absolute_import
import ctypes
from .._base import _LIB
from .. import ndarray as _nd
<|fim_suffix|>
def uniform_init(arr, lb, ub, seed, stream=None):
assert isinstance(arr, _nd.NDArray)
_LIB.DLGpuUni... | code_fim | hard | {
"lang": "python",
"repo": "initzhang/Hetu",
"path": "/python/hetu/gpu_links/InitializersLink.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abeja-inc/abeja-platform-cli path: /abejacli/run.py
Choice(['json']))
@click.option('--default', 'use_default', help="Display default credential", is_flag=True)
@click.argument('name', required=False)
def show_configuration(
ctx, user: bool, token: bool, organization: bool, output_format:... | code_fim | hard | {
"lang": "python",
"repo": "abeja-inc/abeja-platform-cli",
"path": "/abejacli/run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def __create_datalake_channel(name, description):
parameters = {
'name': name,
'description': description
}
parameters = {k: v for k, v in parameters.items() if v is not None}
json_data = json.dumps(parameters)
url = "{}/channels".format(ORGANIZATION_ENDPOINT)
retu... | code_fim | hard | {
"lang": "python",
"repo": "abeja-inc/abeja-platform-cli",
"path": "/abejacli/run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abeja-inc/abeja-platform-cli path: /abejacli/run.py
number', '--min_instance_number', 'min_instance_number', type=int,
help='Minimum number of instances of autoscaling. Default is same as instance-number',
default=None, required=False, hidden=True)
@click.option('--max... | code_fim | hard | {
"lang": "python",
"repo": "abeja-inc/abeja-platform-cli",
"path": "/abejacli/run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>fTemplate = open(args.template,'r')
sTemplate = fTemplate.read()
template = Template(sTemplate)
html = template.render(contacts = sJson, now = datetime.datetime.now().strftime('%d %b %Y %H:%M'))
file = open(args.output,'w')
file.write(html)
file.close()<|fim_prefix|># repo: ts... | code_fim | medium | {
"lang": "python",
"repo": "tstephen/cbc-gsuite",
"path": "/publish-directory/jsonprint.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tstephen/cbc-gsuite path: /publish-directory/jsonprint.py
#!/usr/bin/python3
###############################################################################
# Copyright 2015-2018 Tim Stephenson and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# us... | code_fim | medium | {
"lang": "python",
"repo": "tstephen/cbc-gsuite",
"path": "/publish-directory/jsonprint.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeCTAR-RC/networking-midonet path: /rally-jobs/plugins/midonet_rally_plugin/midonet_rally_plugin.py
#
# Copyright 2016 Midokura SARL
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of th... | code_fim | hard | {
"lang": "python",
"repo": "NeCTAR-RC/networking-midonet",
"path": "/rally-jobs/plugins/midonet_rally_plugin/midonet_rally_plugin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Deletes all available routers
:param api: api for MidoNet router
:param media_type: media type required for MidoNet router
"""
# to delete all the routers, retrieve IDs of router
col_media_type = media_type[:28] + 'collection.' + media_type[28:]
... | code_fim | hard | {
"lang": "python",
"repo": "NeCTAR-RC/networking-midonet",
"path": "/rally-jobs/plugins/midonet_rally_plugin/midonet_rally_plugin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # to delete all the routers, retrieve IDs of router
col_media_type = media_type[:28] + 'collection.' + media_type[28:]
# header for router GET command
header_get = {"Accept": col_media_type, "X-Auth-Token": "%s"
% AUTH_TOKEN}
router_details = ... | code_fim | hard | {
"lang": "python",
"repo": "NeCTAR-RC/networking-midonet",
"path": "/rally-jobs/plugins/midonet_rally_plugin/midonet_rally_plugin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def downgrade_data_broker():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('error_metadata', 'severity_id')
### end Alembic commands ###<|fim_prefix|># repo: fedspendingtransparency/data-act-broker-backend path: /dataactcore/migrations/versions/65ce5d505f12_add_e... | code_fim | hard | {
"lang": "python",
"repo": "fedspendingtransparency/data-act-broker-backend",
"path": "/dataactcore/migrations/versions/65ce5d505f12_add_error_severity.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fedspendingtransparency/data-act-broker-backend path: /dataactcore/migrations/versions/65ce5d505f12_add_error_severity.py
"""add_error_severity
Revision ID: 65ce5d505f12
Revises: ebe2d7673a81
Create Date: 2016-07-26 13:39:13.003391
<|fim_suffix|> globals()["upgrade_%s" % engine_name]()
def... | code_fim | hard | {
"lang": "python",
"repo": "fedspendingtransparency/data-act-broker-backend",
"path": "/dataactcore/migrations/versions/65ce5d505f12_add_error_severity.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> head = DEKRHead(
in_channels=32,
num_keypoints=17,
decoder=codec_cfg,
heatmap_loss=dict(type='KeypointMSELoss', use_target_weight=True),
displacement_loss=dict(
type='SoftWeightSmoothL1Loss',
use_target_wei... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmpose",
"path": "/tests/test_models/test_heads/test_hybrid_heads/test_dekr_head.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmpose path: /tests/test_models/test_heads/test_hybrid_heads/test_dekr_head.py
# Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Tuple
from unittest import TestCase
import torch
from mmengine.utils import is_tuple_of
from mmpose.models.heads import DEKRHead
fro... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmpose",
"path": "/tests/test_models/test_heads/test_hybrid_heads/test_dekr_head.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sqs = boto3.client('sqs')
for object_metada in objects_metadata:
sqs.send_message(
QueueUrl=QUEUE_URL,
MessageBody=json.dumps(
{
'Replay': object_metada
}
)
)
def lambda_handler(event, context... | code_fim | hard | {
"lang": "python",
"repo": "fernandogoncalves-me/serverless-datalake",
"path": "/src/event_replayer/lambda_function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def lambda_handler(event, context):
logger.info("Received event: {}".format(event))
replay = json.loads(event['body'])
objects_metadata = get_metadata_from_catalog(
replay['Source'], replay['IntervalStart'], replay['IntervalEnd'])
send_messages(objects_metadata)
return {
... | code_fim | hard | {
"lang": "python",
"repo": "fernandogoncalves-me/serverless-datalake",
"path": "/src/event_replayer/lambda_function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fernandogoncalves-me/serverless-datalake path: /src/event_replayer/lambda_function.py
import boto3
import datetime
import json
import logging
import os
TABLE_NAME = os.getenv('TABLE_NAME')
QUEUE_URL = os.getenv('QUEUE_URL')
logger = logging.getLogger()
logger.setLevel(os.getenv('LOGLEVEL') or ... | code_fim | hard | {
"lang": "python",
"repo": "fernandogoncalves-me/serverless-datalake",
"path": "/src/event_replayer/lambda_function.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # sequential = nn.Sequential(nn.Linear(256, 256, 256), \
# nn.ReLU(), \
# nn.Linear(2, 100, 256))
# sequential(rgb_hidden2)
rgb_hidden = self.rgb_seq(rgb)
_, hidden = self.gru(packed)
hidden = hidden[-1, .... | code_fim | hard | {
"lang": "python",
"repo": "cocolab-projects/reference-game-exploration",
"path": "/src/rge/models/ColorModel_Fat_3.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # forward RNN
# rgb_hidden2 = self.rgb_seq(rgb)
# sequential = nn.Sequential(nn.Linear(256, 256, 256), \
# nn.ReLU(), \
# nn.Linear(2, 100, 256))
# sequential(rgb_hidden2)
rgb_hidden = self.rgb_seq(rgb)
... | code_fim | hard | {
"lang": "python",
"repo": "cocolab-projects/reference-game-exploration",
"path": "/src/rge/models/ColorModel_Fat_3.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cocolab-projects/reference-game-exploration path: /src/rge/models/ColorModel_Fat_3.py
from __future__ import print_function
import numpy as np
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
import torch.nn.utils.rn... | code_fim | hard | {
"lang": "python",
"repo": "cocolab-projects/reference-game-exploration",
"path": "/src/rge/models/ColorModel_Fat_3.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gtrght/jtuples path: /gen/generate_zip.py
__author__ = 'vvlasov'
import generate_products as gp
package = "package com.othelle.jtuples;"
if __name__ == '__main__':
template = open('ZipUtils1.java', 'rb').read()
for arity in xrange(2, gp.max_products): #gp.max_products + 1):
cod... | code_fim | hard | {
"lang": "python",
"repo": "gtrght/jtuples",
"path": "/gen/generate_zip.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> gp.generate_types(arity), gp.generate_types(arity - 1), gp.generate_types(arity, 2),
gp.generate_join(arity, "keyValue._{0}()", ", ", 2),
gp.generate_join(arity, "Collection<T{0}> col{0}", ", "),
gp.generate_join(arity, "col{0}.size()", ", "),
... | code_fim | hard | {
"lang": "python",
"repo": "gtrght/jtuples",
"path": "/gen/generate_zip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pmutua/elite-schedule path: /elite_schedule/admin.py
from django.contrib import admin
from elite_schedule.models import *
<|fim_suffix|>@admin.register(Match)
class MatchAdmin(admin.ModelAdmin):
list_display = (
'division',
'date',
'time',
'home_team',
... | code_fim | medium | {
"lang": "python",
"repo": "pmutua/elite-schedule",
"path": "/elite_schedule/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_display = (
'division',
'date',
'time',
'home_team',
'away_team',
'fthg',
'ftag',
'ftr',
'hthg',
'htag',
'htr',
'HS',
'AvgCAHA'
)
search_fields = (
'division__code',
'h... | code_fim | medium | {
"lang": "python",
"repo": "pmutua/elite-schedule",
"path": "/elite_schedule/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class BlockBatch(Batch):
"""Contains the states changed by a block
key: Address
value: IconScoreBatch
"""
def __init__(self, block: Optional['Block'] = None):
"""Constructor
:param block: block info
"""
super().__init__()
self.block = block
... | code_fim | hard | {
"lang": "python",
"repo": "nanaones/icon-service",
"path": "/iconservice/database/batch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Constructor
:param tx_hash: tx_hash
"""
super().__init__()
self.hash = tx_hash
def clear(self):
self.hash = None
super().clear()
class BlockBatch(Batch):
"""Contains the states changed by a block
key: Address
value: IconScoreB... | code_fim | hard | {
"lang": "python",
"repo": "nanaones/icon-service",
"path": "/iconservice/database/batch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nanaones/icon-service path: /iconservice/database/batch.py
# -*- coding: utf-8 -*-
# Copyright 2018 ICON Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | code_fim | hard | {
"lang": "python",
"repo": "nanaones/icon-service",
"path": "/iconservice/database/batch.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> z_L1 = np.matmul(self.W_L1, x) + self.B_L1
a_L1 = self.activation(z_L1[0])
z_L2 = np.matmul(self.W_L2, a_L1) + self.B_L2
self.y = self.activation(z_L2[0])
'''
#test
this = NeuralNetwork([4, 10, 2])
this.forward(np.array([1, 2, 3, 4]))
print(this.y)
'''<|fim_prefix|># repo... | code_fim | medium | {
"lang": "python",
"repo": "ParsaSafaee/Evolutionary-Games",
"path": "/nn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ParsaSafaee/Evolutionary-Games path: /nn.py
import numpy as np
class NeuralNetwork:
def __init__(self, layer_sizes):
self.W_L1 = np.random.normal(size=(layer_sizes[1], layer_sizes[0]))
self.B_L1 = np.zeros((layer_sizes[1], 1))
self.W_L2 = np.random.normal(size=(lay... | code_fim | hard | {
"lang": "python",
"repo": "ParsaSafaee/Evolutionary-Games",
"path": "/nn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sumanthha/kannadaflix path: /loan/models.py
import datetime
from google.appengine.ext import db
from django.contrib.auth.models import User
from django.db import models
from django.contrib import admin
class Loan(models.Model):
APPLIED = 'A'
FUNDED = 'F'
FUNDING_IN_PROCESS = 'FIP'
... | code_fim | hard | {
"lang": "python",
"repo": "sumanthha/kannadaflix",
"path": "/loan/models.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class InvestorLoanMap(models.Model):
invester = models.ForeignKey(User)
amount_invested = models.FloatField()
loan = models.ForeignKey(Loan)
class Meta:
db_table = 'InvestorLoanMap'
class InvestorLoanMapAdmin(admin.ModelAdmin):
pass
admin.site.register(Investo... | code_fim | medium | {
"lang": "python",
"repo": "sumanthha/kannadaflix",
"path": "/loan/models.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTwAAAAAtX4lPLV+JTy1fiU8tX4lPLV+JTy1fi... | code_fim | hard | {
"lang": "python",
"repo": "IsaiahPressman/Kaggle_Santa_2020",
"path": "/rl_agents/a3c_agent_v5-final_999_deterministic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IsaiahPressman/Kaggle_Santa_2020 path: /rl_agents/a3c_agent_v5-final_999_deterministic.py
PLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4... | code_fim | hard | {
"lang": "python",
"repo": "IsaiahPressman/Kaggle_Santa_2020",
"path": "/rl_agents/a3c_agent_v5-final_999_deterministic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPLV+JTy1fiU8tX4lPAAAAAC1fiU8tX4lPLV+JTy1fiU8tX4lPLV+J... | code_fim | hard | {
"lang": "python",
"repo": "IsaiahPressman/Kaggle_Santa_2020",
"path": "/rl_agents/a3c_agent_v5-final_999_deterministic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: filintod/pyremotelogin path: /fdutils/selenium_util/__init__.py
return item
def get_if_visible(self, item):
e = self.get(item, no_highlight=True)
if e.is_displayed():
return e
else:
return None
def get_or_none(self, item):
try:
... | code_fim | hard | {
"lang": "python",
"repo": "filintod/pyremotelogin",
"path": "/fdutils/selenium_util/__init__.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.