text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> return user.is_authenticated and (user.is_superuser or TicketbutlerTicket.objects.filter(user=user, refunded=False).exists())
actual_decorator = user_passes_test(
test_user,
login_url=login_url,
redirect_field_name=redirect_field_name
)
if function:
ret... | code_fim | medium | {
"lang": "python",
"repo": "djangocon/2019.djangocon.eu",
"path": "/dceu2019/src/dceu2019/apps/ticketholders/decorators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: econbernardo/WS_Dividendos path: /brFinance/scraper/cvm/search.py
import re
import time
from abc import ABC, abstractmethod
from datetime import datetime
from typing import Tuple, Any
import lxml.html as LH
import pandas as pd
from selenium import webdriver
from brFinance.utils.browser import B... | code_fim | hard | {
"lang": "python",
"repo": "econbernardo/WS_Dividendos",
"path": "/brFinance/scraper/cvm/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Search.cvm_code_df = df
if self.driver is None: driver.quit()
return Search.cvm_code_df
@abstractmethod
def search(self, cvm_code: int, initial_date: str, final_date: str) -> pd.DataFrame:
"""
Returns dataframe of search results including cod_cvm, report'... | code_fim | hard | {
"lang": "python",
"repo": "econbernardo/WS_Dividendos",
"path": "/brFinance/scraper/cvm/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name: str
annotation = StrawberryAnnotation(Union[User, Error])
resolved = annotation.resolve()
assert isinstance(resolved, StrawberryUnion)
assert resolved.types == (User, Error)
assert resolved == StrawberryUnion(
name=None,
type_annotations=(StrawberryAnno... | code_fim | hard | {
"lang": "python",
"repo": "strawberry-graphql/strawberry",
"path": "/tests/types/resolving/test_unions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: strawberry-graphql/strawberry path: /tests/types/resolving/test_unions.py
import sys
from typing import Generic, TypeVar, Union
from typing_extensions import Annotated
import pytest
import strawberry
from strawberry.annotation import StrawberryAnnotation
from strawberry.exceptions import Invali... | code_fim | hard | {
"lang": "python",
"repo": "strawberry-graphql/strawberry",
"path": "/tests/types/resolving/test_unions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Result = Annotated[Union[Error, Edge[str]], strawberry.union("Result")]
strawberry_union = StrawberryAnnotation(Result).resolve()
assert isinstance(strawberry_union, StrawberryUnion)
assert strawberry_union.graphql_name == "Result"
assert strawberry_union.types[0] == Error
asser... | code_fim | hard | {
"lang": "python",
"repo": "strawberry-graphql/strawberry",
"path": "/tests/types/resolving/test_unions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>find_external('sfml-all'))
print(find_external('wx'))
print(find_external('x11', version < 12))
print(find_external('xt'))<|fim_prefix|># repo: gitter-badger/pyrate-build path: /examples/example09.py
#!/usr/bin/env pyrate
print(create_external('xml2', build_helper = 'xml2-config',
version_query = '--ve... | code_fim | hard | {
"lang": "python",
"repo": "gitter-badger/pyrate-build",
"path": "/examples/example09.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gitter-badger/pyrate-build path: /examples/example09.py
#!/usr/bin/env pyrate
print(create_external('xml2', build_helper = 'xml2-config',
version_query = '--version', version_parser = lambda x: x,
link = '--libs', compile_cpp = '--cflags'))
print(create_external('xml2_nover', build_helper = 'x... | code_fim | medium | {
"lang": "python",
"repo": "gitter-badger/pyrate-build",
"path": "/examples/example09.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ilumb/tortuga path: /src/installer/bin/run-post-install
#!/usr/bin/python
# Copyright 2008-2018 Univa Corporation
#
# 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": "ilumb/tortuga",
"path": "/src/installer/bin/run-post-install",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> kitNameAndVersion, kitIteration = kitDescriptor.rsplit('-', 1)
kitName, kitVersion = kitNameAndVersion.split('-', 1)
compDescriptor = options[2]
compName, _ = compDescriptor.split('-', 2)
flagFile = ('/opt/tortuga/var/run/actions/%s'
'/component_%s_%s_post_install') %... | code_fim | hard | {
"lang": "python",
"repo": "ilumb/tortuga",
"path": "/src/installer/bin/run-post-install",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.debug(
'post_install component action run for [%s] from kit [%s]' % (
compDescriptor, kitDescriptor))
# Ensure destination directory exists
if not os.path.exists(os.path.dirname(flagFile)):
os.makedirs(os.path.dirname(flagFile))
# touch flagFile
ope... | code_fim | hard | {
"lang": "python",
"repo": "ilumb/tortuga",
"path": "/src/installer/bin/run-post-install",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tjsavage/sfcsdatabase path: /sfcs/database/views.py
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from models import Author, Paper, Partner, Topic, Update, Comment, PartialCommentForm, SubmitPa... | code_fim | hard | {
"lang": "python",
"repo": "tjsavage/sfcsdatabase",
"path": "/sfcs/database/views.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> updates = updates[(int(page) - 1)*UPDATES_PER_PAGE:UPDATES_PER_PAGE*int(page)]
recent_comments = Comment.objects.order_by('-date_added')[:5]
return render_to_response('updates.html', {
'updates' : updates,
'pages' : pages,
'page' : int(page),
'next_pag... | code_fim | hard | {
"lang": "python",
"repo": "tjsavage/sfcsdatabase",
"path": "/sfcs/database/views.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aashishdugar/LeetCodeSolutions path: /LeetCodeSolutions/014 - Longest Common Prefix(easy) - Python3.py
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
val = ''
for args in zip(*strs):
<|fim_suffix|>rgs[0]
else:
br... | code_fim | hard | {
"lang": "python",
"repo": "aashishdugar/LeetCodeSolutions",
"path": "/LeetCodeSolutions/014 - Longest Common Prefix(easy) - Python3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rgs[0]
else:
break
return val<|fim_prefix|># repo: aashishdugar/LeetCodeSolutions path: /LeetCodeSolutions/014 - Longest Common Prefix(easy) - Python3.py
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
val = ''
for args ... | code_fim | hard | {
"lang": "python",
"repo": "aashishdugar/LeetCodeSolutions",
"path": "/LeetCodeSolutions/014 - Longest Common Prefix(easy) - Python3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Run gradient descent on the data one more time
final_gd_data = np.loadtxt(filename)
for i in range(len(PA_list)):
try:
gd_update = final_gd(final_gd_data,PA_list[i][-1])
PA.add(Point(x=gd_update[1],y=gd_update[0],data=gd_update[2]))
except:
... | code_fim | hard | {
"lang": "python",
"repo": "alexliberzonlab/AI_Feynman_edit",
"path": "/feynman/S_run_aifeynman.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif idx_min == 2:
new_ new_filename = do_translational_symmetry_multiply(filename,symmetry_multiply_result[1],symmetry_multiply_result[2])
PA1_ = ParetoSet()
PA1 = run_AI_all(new_new_filename,BF_try_time,BF_ops_file_type, polyfit_deg, NN_epochs, PA1_)
PA = add_sym_... | code_fim | hard | {
"lang": "python",
"repo": "alexliberzonlab/AI_Feynman_edit",
"path": "/feynman/S_run_aifeynman.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexliberzonlab/AI_Feynman_edit path: /feynman/S_run_aifeynman.py
import numpy as np
import matplotlib.pyplot as plt
import os
from os import path
from get_pareto import Point, ParetoSet
from RPN_to_pytorch import RPN_to_pytorch
from RPN_to_eq import RPN_to_eq
from S_NN_train import NN_tra... | code_fim | hard | {
"lang": "python",
"repo": "alexliberzonlab/AI_Feynman_edit",
"path": "/feynman/S_run_aifeynman.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if save_interval and n_iter % save_interval == 0:
torch.save([qnet.state_dict(), optimizer.state_dict()],
os.path.join(save_path, '{}.checkpoint'.format(n_iter)))
def _generate(device, env, qnet, ob_scale,
number_timesteps, param_noise,
... | code_fim | hard | {
"lang": "python",
"repo": "Officium/RL-Experiments",
"path": "/src/baselines/dqn/dqn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> number_timesteps, param_noise,
exploration_fraction, exploration_final_eps,
atom_num, min_value, max_value):
""" Generate training batch sample """
noise_scale = 1e-2
action_dim = env.action_space.n
explore_steps = number_timesteps * exploration_fr... | code_fim | hard | {
"lang": "python",
"repo": "Officium/RL-Experiments",
"path": "/src/baselines/dqn/dqn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Officium/RL-Experiments path: /src/baselines/dqn/dqn.py
import math
import os
import random
import time
from collections import deque
from copy import deepcopy
import numpy as np
import torch
import torch.distributions
import torch.nn as nn
from torch.nn.functional import softmax, log_softmax
f... | code_fim | hard | {
"lang": "python",
"repo": "Officium/RL-Experiments",
"path": "/src/baselines/dqn/dqn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Team',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128, verbose_name='Team Name')),
... | code_fim | hard | {
"lang": "python",
"repo": "RohanIRathi/Cricstarz",
"path": "/teams/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RohanIRathi/Cricstarz path: /teams/migrations/0001_initial.py
# Generated by Django 3.1.1 on 2020-10-01 14:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> dependencies = [
('tournament', '00... | code_fim | hard | {
"lang": "python",
"repo": "RohanIRathi/Cricstarz",
"path": "/teams/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('tournament', '0002_auto_20200926_2052'),
]
operations = [
migrations.CreateModel(
name='Team',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
... | code_fim | hard | {
"lang": "python",
"repo": "RohanIRathi/Cricstarz",
"path": "/teams/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(Update, UpdateAdmin)<|fim_prefix|># repo: Kami/sgrstats.com path: /sgrstats/updates/admin.py
from django.contrib import admin
from django.contrib.contenttypes import generic
<|fim_middle|>from models import Update
class UpdateAdmin(admin.ModelAdmin):
list_display = ('title... | code_fim | medium | {
"lang": "python",
"repo": "Kami/sgrstats.com",
"path": "/sgrstats/updates/admin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kami/sgrstats.com path: /sgrstats/updates/admin.py
from django.contrib import admin
from django.contrib.contenttypes import generic
from models import Update
<|fim_suffix|> list_display = ('title', 'date_fetched')
search_fields = ['title']
admin.site.register(Update, UpdateAdmin... | code_fim | easy | {
"lang": "python",
"repo": "Kami/sgrstats.com",
"path": "/sgrstats/updates/admin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># the following are only available if face.scalable
if font.scalable:
# the face global bounding box (xmin, ymin, xmax, ymax)
print('Bbox :', font.bbox)
# number of font units covered by the EM
print('EM :', font.units_per_EM)
# the ascender in 26.6 unit... | code_fim | hard | {
"lang": "python",
"repo": "gottaegbert/penter",
"path": "/matplotlib/gallery_python/misc/ftface_props.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gottaegbert/penter path: /matplotlib/gallery_python/misc/ftface_props.py
"""
===============
Font properties
===============
This example lists the attributes of an `.FT2Font` object, which describe
global font properties. For individual character metrics, use the `.Glyph`
object, as returned b... | code_fim | hard | {
"lang": "python",
"repo": "gottaegbert/penter",
"path": "/matplotlib/gallery_python/misc/ftface_props.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for style in ('Italic',
'Bold',
'Scalable',
'Fixed sizes',
'Fixed width',
'SFNT',
'Horizontal',
'Vertical',
'Kerning',
'Fast glyphs',
'Multiple masters',
... | code_fim | hard | {
"lang": "python",
"repo": "gottaegbert/penter",
"path": "/matplotlib/gallery_python/misc/ftface_props.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dorugeber/gusto path: /gusto/configuration.py
"""
Some simple tools for making model configuration nicer.
"""
from abc import ABCMeta, abstractproperty
import logging
from logging import DEBUG, INFO, WARNING
from firedrake import sqrt
__all__ = ["WARNING", "INFO", "DEBUG", "TimesteppingParamete... | code_fim | hard | {
"lang": "python",
"repo": "dorugeber/gusto",
"path": "/gusto/configuration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Physical parameters for 3d Compressible Euler
"""
g = 9.80616
Omega = 7.292e-5 # rotation rate
H = None # mean depth
class EadyParameters(Configuration):
"""
Physical parameters for Incompressible Eady
"""
Nsq = 2.5e-05 # squared Brunt-Vaisala frequency (1... | code_fim | hard | {
"lang": "python",
"repo": "dorugeber/gusto",
"path": "/gusto/configuration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bycxw/mathmodel-A path: /main.py
# coding: utf-8
from model import MLPModel
from data import load_data, feat_extract
import os, logging
from sklearn.model_selection import KFold,train_test_split
from sklearn.metrics import mean_absolute_error, mean_squared_error
import numpy as np
logging.basicC... | code_fim | hard | {
"lang": "python",
"repo": "bycxw/mathmodel-A",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def train_eval(train, targets):
features=train.columns
folds = KFold(n_splits=5, shuffle=True, random_state=1420)
oof = np.zeros(len(train))
for fold_, (trn_idx, val_idx) in enumerate(folds.split(train.values, targets.values)):
if fold_ > 0:
break
print("Fold {... | code_fim | hard | {
"lang": "python",
"repo": "bycxw/mathmodel-A",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbohlkeschneider/gluon-ts path: /src/gluonts/env.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located a... | code_fim | medium | {
"lang": "python",
"repo": "mbohlkeschneider/gluon-ts",
"path": "/src/gluonts/env.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Environment(Settings):
# Maximum number of times a transformation can receive an input without
# returning an output. This parameter is intended to catch infinite loops
# or inefficiencies, when transformations never or rarely return
# something.
max_idle_transforms: int = os.env... | code_fim | medium | {
"lang": "python",
"repo": "mbohlkeschneider/gluon-ts",
"path": "/src/gluonts/env.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # we want to be able to disable TQDM, for example when running in sagemaker
use_tqdm: bool = True
env = Environment()<|fim_prefix|># repo: mbohlkeschneider/gluon-ts path: /src/gluonts/env.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache ... | code_fim | hard | {
"lang": "python",
"repo": "mbohlkeschneider/gluon-ts",
"path": "/src/gluonts/env.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dave-shawley/imbi path: /imbi/endpoints/project/links.py
"""
Request Handler for the project links
"""
from imbi.endpoints import base
SQL = """\
SELECT project_id, link_type, url
FROM v1.project_links
WHERE project_id=%(project_id)s
ORDER BY link_type;"""
<|fim_suffix|>
NAME = '... | code_fim | medium | {
"lang": "python",
"repo": "dave-shawley/imbi",
"path": "/imbi/endpoints/project/links.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
NAME = 'project-links'
async def get(self, *args, **kwargs):
if self._respond_with_html:
return self.render('index.html')
result = await self.postgres_execute(
SQL, kwargs, metric_name='project-links')
self.send_response(result.rows)<|fim_prefix|>#... | code_fim | medium | {
"lang": "python",
"repo": "dave-shawley/imbi",
"path": "/imbi/endpoints/project/links.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return float(self.in_range_unpopulated) / float(self.total_count)
def out_of_range_fraction(self, parameter=None):
if parameter is None:
return float(self.out_of_range_count) / float(self.total_count)
else:
return float(self.out_of_range_count_by_dimens... | code_fim | hard | {
"lang": "python",
"repo": "lcameron05/PCWG",
"path": "/pcwg/configuration/power_deviation_matrix_configuration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lcameron05/PCWG path: /pcwg/configuration/power_deviation_matrix_configuration.py
import base_configuration
import numpy as np
class PowerDeviationMatrixConfiguration(base_configuration.XmlBase):
def __init__(self, path=None):
self.out_of_range_count = 0
self.total_count =... | code_fim | hard | {
"lang": "python",
"repo": "lcameron05/PCWG",
"path": "/pcwg/configuration/power_deviation_matrix_configuration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, parameter='Normalised Hub Wind Speed', index=1, centerOfFirstBin=None, binWidth=None, numberOfBins=None):
self.calculate_last_bin = False
self.parameter = parameter
self.index = index
self.centerOfFirstBin = centerOfFirstBin
self.binWidth = ... | code_fim | hard | {
"lang": "python",
"repo": "lcameron05/PCWG",
"path": "/pcwg/configuration/power_deviation_matrix_configuration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: compas-Workshops/WS_compas_fea path: /examples/example_truss.py
# 45 mins
from compas_fea.cad import rhino
from compas_fea.structure import Structure
from compas_fea.structure import Steel
from compas_fea.structure import TrussSection
from compas_fea.structure import ElementProperties
f... | code_fim | hard | {
"lang": "python",
"repo": "compas-Workshops/WS_compas_fea",
"path": "/examples/example_truss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># print(mdl.steps['bc'])
# print(mdl.steps['loads'])
mdl.summary()
mdl.analyse_and_extract(software='abaqus', fields=['u', 's', 'cf', 'rf'])
print(mdl.get_nodal_results(step='loads', field='rfm', nodes='supports'))
# load / show .inp and .odb files
# show raw data, discuss methods to extract... | code_fim | hard | {
"lang": "python",
"repo": "compas-Workshops/WS_compas_fea",
"path": "/examples/example_truss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duner/django-bluebox path: /bluebox/__init__.py
from django.apps import AppConfig
__title__ = 'django-bluebox'
__version__ = '0.0.1'
__license__ = 'MIT'
<|fim_suffix|> name = __title__
label = 'bluebox'
verbose_name = 'Django Bluebox'
default_app_config = 'BlueboxAppConfig'<|fim_mid... | code_fim | easy | {
"lang": "python",
"repo": "duner/django-bluebox",
"path": "/bluebox/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = __title__
label = 'bluebox'
verbose_name = 'Django Bluebox'
default_app_config = 'BlueboxAppConfig'<|fim_prefix|># repo: duner/django-bluebox path: /bluebox/__init__.py
from django.apps import AppConfig
__title__ = 'django-bluebox'
__version__ = '0.0.1'
__license__ = 'MIT'
<|fim_mid... | code_fim | easy | {
"lang": "python",
"repo": "duner/django-bluebox",
"path": "/bluebox/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def reference_solution(x, y, z, vx, vy, vz, q, m, ax, ay, az):
for i in range(x.size):
for j in range(x.size):
prefactor = 1.0 / 3.0 * q[i] * q[j]
r = np.sqrt(
(x[i] - x[j]) * (x[i] - x[j]) +
(y[i] - y[j]) * (y[i] - y[j]) +
... | code_fim | hard | {
"lang": "python",
"repo": "nistpenning/ultracold-ions",
"path": "/test/test_CoulombAccScaled.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def reference_solution(x, y, z, vx, vy, vz, q, m, ax, ay, az):
for i in range(x.size):
for j in range(x.size):
prefactor = 1.0 / 3.0 * q[i] * q[j]
r = np.sqrt(
(x[i] - x[j]) * (x[i] - x[j]) +
(y[i] - y[j]) * (y[i] - y[j]) +
... | code_fim | hard | {
"lang": "python",
"repo": "nistpenning/ultracold-ions",
"path": "/test/test_CoulombAccScaled.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nistpenning/ultracold-ions path: /test/test_CoulombAccScaled.py
import uci.CoulombAccScaled as uci
import numpy as np
import pyopencl as cl
import pyopencl.array as cl_array
testCtx = cl.create_some_context(interactive = True)
testQueue = cl.CommandQueue(testCtx)
def test_Constructor():
cou... | code_fim | hard | {
"lang": "python",
"repo": "nistpenning/ultracold-ions",
"path": "/test/test_CoulombAccScaled.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leonjaime1983/PYTHON_GUI path: /TKINTER/3. TKINTER POO/05_tkinter_styles_organizado.py
nedor y a su vez, los frames)
self.configure(background = COLOR_MARCO_PRINCIPAL)
#Esto es para la organizacion del espacio y que se pueda expandir
self.columnconfigure(0, weight = 1... | code_fim | hard | {
"lang": "python",
"repo": "leonjaime1983/PYTHON_GUI",
"path": "/TKINTER/3. TKINTER POO/05_tkinter_styles_organizado.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.columnconfigure( 0, weight = 1 )
self.rowconfigure(0, weight = 1)
#Agregamos Widgets, con la ventaja de poder agregarlos en "self"(Frame_1)-->tk.Frame , que a su vez, estara en root(APP)-->tk.Tk
#Variable para texto del usuario, el objetivo es poder obtener la i... | code_fim | hard | {
"lang": "python",
"repo": "leonjaime1983/PYTHON_GUI",
"path": "/TKINTER/3. TKINTER POO/05_tkinter_styles_organizado.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leonjaime1983/PYTHON_GUI path: /TKINTER/3. TKINTER POO/05_tkinter_styles_organizado.py
#Se crea clase principal (tk.Tk), la cual es la encargada de manejar los Frames
class APP(tk.Tk):
#OJO: Notar que pasamos "*args" y "**kwargs", porque podrian ser necesarios (recordar pasarlos a inici... | code_fim | hard | {
"lang": "python",
"repo": "leonjaime1983/PYTHON_GUI",
"path": "/TKINTER/3. TKINTER POO/05_tkinter_styles_organizado.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tiagovla/fdtd.py path: /fdtd/__init__.py
__version__ = "0.0.1"
import logging
from fdtd.boundaries import PeriodicBlochBoundary, PeriodicBoundary
from fdtd.detectors import EFie<|fim_suffix|>r
from fdtd.materials import Material
from fdtd.objects import Brick, Sphere
from fdtd.sources import (
... | code_fim | medium | {
"lang": "python",
"repo": "tiagovla/fdtd.py",
"path": "/fdtd/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>r
from fdtd.materials import Material
from fdtd.objects import Brick, Sphere
from fdtd.sources import (
EFieldSource,
ImpressedElectricCurrentSource,
ImpressedMagneticCurrentSource,
VoltageSource,
)
logging.getLogger(__name__).addHandler(logging.NullHandler())<|fim_prefix|># repo: tiagovl... | code_fim | medium | {
"lang": "python",
"repo": "tiagovla/fdtd.py",
"path": "/fdtd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_ACCOUNTMIGRATETX = _descriptor.Descriptor(
name='AccountMigrateTx',
full_name='forge_abi.AccountMigrateTx',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='pk', full_name='forge_abi.AccountMigrateTx.pk', index=0,
number=1, t... | code_fim | hard | {
"lang": "python",
"repo": "ArcBlock/forge-python-sdk",
"path": "/forge_sdk/protos/protos/account_migrate_pb2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ArcBlock/forge-python-sdk path: /forge_sdk/protos/protos/account_migrate_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: account_migrate.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor ... | code_fim | hard | {
"lang": "python",
"repo": "ArcBlock/forge-python-sdk",
"path": "/forge_sdk/protos/protos/account_migrate_pb2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: calazans10/django-mobile-helper path: /django_mobile/middleware.py
# -*- coding: utf-8 -*-
import re
from django.conf import settings
from constants import AGENT, VERSION
class MobileMiddleware(object):
ORIG_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
def is_mobile_useragent(self, request)... | code_fim | hard | {
"lang": "python",
"repo": "calazans10/django-mobile-helper",
"path": "/django_mobile/middleware.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def process_request(self, request):
request.is_mobile = False
domain = request.META.get('HTTP_HOST', '').split('.')
if 'm' in domain or 'mobile' in domain:
request.is_mobile = True
elif self.is_mobile_useragent(request):
request.is_mobile = True... | code_fim | hard | {
"lang": "python",
"repo": "calazans10/django-mobile-helper",
"path": "/django_mobile/middleware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rk2ea/django path: /lokahi/catalog/migrations/0051_auto_20171205_1800.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-05 23:00
from __future__ import unicode_literals
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('catalog', '0050_merge_20... | code_fim | easy | {
"lang": "python",
"repo": "rk2ea/django",
"path": "/lokahi/catalog/migrations/0051_auto_20171205_1800.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='report',
name='report_name',
field=models.CharField(max_length=200, unique=True),
),
]<|fim_prefix|># repo: rk2ea/django path: /lokahi/catalog/migrations/0051_auto_20171205_1800.py
# -*- coding: ... | code_fim | medium | {
"lang": "python",
"repo": "rk2ea/django",
"path": "/lokahi/catalog/migrations/0051_auto_20171205_1800.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>port squeezenet1_0, squeezenet1_1
from torchvision.models.vgg import vgg11, vgg13, vgg16, vgg19, vgg11_bn, vgg13_bn, vgg16_bn, vgg19_bn<|fim_prefix|># repo: YoussefBenCheikh/TorchvisionObjectDetection path: /vision/hubconf.py
# Optional list of dependencies required by the package
dependencies = ['torc... | code_fim | medium | {
"lang": "python",
"repo": "YoussefBenCheikh/TorchvisionObjectDetection",
"path": "/vision/hubconf.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YoussefBenCheikh/TorchvisionObjectDetection path: /vision/hubconf.py
# Optional list of dependencies required by the package
dependencies = ['torch']
from torchvision.models.alexnet import alexnet
fr<|fim_suffix|>tion_v3
from torchvision.models.resnet import resnet18, resnet34, resnet50, re... | code_fim | medium | {
"lang": "python",
"repo": "YoussefBenCheikh/TorchvisionObjectDetection",
"path": "/vision/hubconf.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dianjulyanaputri/CodeAbbeySolutions path: /BrainfuckInterpreter.py
#input
# ;>;<>;<>-<>;<[->++<][->+<]>:<:>;<;[->+>+<<]>>[-<<+>>]<<[->+<];>++++<>;<>;<>;<>;<+:>-:<;[->+>+<<]>>[-<<+>>]<<>-<>;<>:<>;<>:<[->+>++<<];+:>-:<:[>+<-]>++++<>:<>:<[->+>++<<]>-<[->++<][->+<]>-<:[->+<]+:>-:<:>:
# 7 14 11 4 2 7 ... | code_fim | medium | {
"lang": "python",
"repo": "dianjulyanaputri/CodeAbbeySolutions",
"path": "/BrainfuckInterpreter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.inp = inp.split()
def interpret_token(self,t):
if t == '+':
self.stack[self.pointer] += 1
elif t == '-':
self.stack[self.pointer] -= 1
elif t == ':':
print(self.stack[self.pointer], end=' ')
elif t == ';':
self.stack[self.pointer] = int(self.inp.pop(0))
... | code_fim | hard | {
"lang": "python",
"repo": "dianjulyanaputri/CodeAbbeySolutions",
"path": "/BrainfuckInterpreter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Transforms direction from local space to world space.
def TransformDirection(self, direction:Vector3)->Vector3:
assert(False)
# TransformDirection(x, y, z)
# Transforms a direction from world space to local space. The opposite of Transform.TransformDirection.
def InverseTra... | code_fim | hard | {
"lang": "python",
"repo": "sjb8100/FishEngine-Experiment",
"path": "/Script/FishEngine/Transform.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sjb8100/FishEngine-Experiment path: /Script/FishEngine/Transform.py
from . import Component, Vector3, Quaternion, Matrix4x4
# from . import FishEngineInternal
import FishEngineInternal
from enum import Enum, auto
# Transform = FishEngineInternal.Transform
# class RotationOrder(Enum):
# Orde... | code_fim | hard | {
"lang": "python",
"repo": "sjb8100/FishEngine-Experiment",
"path": "/Script/FishEngine/Transform.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TransformDirection(x, y, z)
# Transforms a direction from world space to local space. The opposite of Transform.TransformDirection.
def InverseTransformDirection(self, direction:Vector3)->Vector3:
assert(False)
def RotateAround(self, point:Vector3, axis:Vector3, angle:float):
... | code_fim | hard | {
"lang": "python",
"repo": "sjb8100/FishEngine-Experiment",
"path": "/Script/FishEngine/Transform.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getHTML(self):
self.reader = ByteArrayInputStream(self.data)
return str(self.extractor.Extract(self.reader, JString(self.language), JString(self.options), self.debug).toString())<|fim_prefix|># repo: subhasree/python-pdfextract path: /src/pdfextract/extract/__init__.py
from jpype ... | code_fim | medium | {
"lang": "python",
"repo": "subhasree/python-pdfextract",
"path": "/src/pdfextract/extract/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: subhasree/python-pdfextract path: /src/pdfextract/extract/__init__.py
from jpype import *
import chardet
import threading
lock = threading.Lock()
ByteArrayInputStream = JClass('java.io.ByteArrayInputStream')
ByteArrayOutputStream = JClass('java.io.ByteArrayOutputStream')
<|fim_suf... | code_fim | hard | {
"lang": "python",
"repo": "subhasree/python-pdfextract",
"path": "/src/pdfextract/extract/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gregory-kyro/HAC-Net path: /src/CNN/CNN_train.py
import torch
from torch.utils.data import DataLoader
from torch.optim import RMSprop, lr_scheduler
import numpy as np
from scipy import stats
from sklearn.metrics import *
import matplotlib.pyplot as plt
def train_3dcnn(train_hdf, val_hdf, checkpo... | code_fim | hard | {
"lang": "python",
"repo": "gregory-kyro/HAC-Net",
"path": "/src/CNN/CNN_train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # compute loss
loss = loss_func(ypred_batch.cpu().float(), y_batch_cpu.float())
optimizer.zero_grad()
loss.backward()
optimizer.step()
scheduler.step()
step += 1
print("[%d/%d-%d/%d] training loss: %.3f" % (epoch_... | code_fim | hard | {
"lang": "python",
"repo": "gregory-kyro/HAC-Net",
"path": "/src/CNN/CNN_train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_Bmode():
pure_E = np.zeros((512,257),dtype=np.complex128)
pure_B = np.zeros((512,257),dtype=np.complex128)
pure_B[0,250] = 2.0 + 0.0j
pure_B[250,0] = 2.0 + 0.0j
pure_B[250,250] = 2.0 + 0.0j
new_shear_map = ShearMap.fromEBmodes(pure_E,pure_B,angle=1.95*deg)
fig,ax = plt.subplots(1,3,fig... | code_fim | hard | {
"lang": "python",
"repo": "apetri/LensTools",
"path": "/lenstools/tests/test_shear.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apetri/LensTools path: /lenstools/tests/test_shear.py
import os
from .. import ConvergenceMap,ShearMap
from ..image.shear import Spin2
from .. import dataExtern
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.units import deg,arcmin,arcsec
def two_... | code_fim | hard | {
"lang": "python",
"repo": "apetri/LensTools",
"path": "/lenstools/tests/test_shear.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig,ax = plt.subplots()
ax.plot(l,np.abs(EB)/np.sqrt(EE*BB))
ax.set_xlabel(r"$l$")
ax.set_ylabel(r"$P_{EB}/\sqrt{P_{EE}P_{BB}}$")
plt.savefig("EB_corr.png")
plt.clf()
def test_visualize2():
fig,ax = plt.subplots()
test_map_conv.visualize(fig,ax,cmap="Reds")
test_map.sticks(fig=fig,ax=ax,pixe... | code_fim | hard | {
"lang": "python",
"repo": "apetri/LensTools",
"path": "/lenstools/tests/test_shear.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> There are currently no available types.
as_<_type_converters>: Convert entry to a type listed in `_type_converters`.
"""
ENTRY_RESOURCE: Type[ReferenceResource] = ReferenceResource<|fim_prefix|># repo: Materials-Consortia/optimade-python-tools path: /optimade/adapters/refere... | code_fim | hard | {
"lang": "python",
"repo": "Materials-Consortia/optimade-python-tools",
"path": "/optimade/adapters/references/adapter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Materials-Consortia/optimade-python-tools path: /optimade/adapters/references/adapter.py
from typing import Type
from optimade.adapters.base import EntryAdapter
from optimade.models import ReferenceResource
<|fim_suffix|> Go to [`EntryAdapter`][optimade.adapters.base.EntryAdapter] to see th... | code_fim | medium | {
"lang": "python",
"repo": "Materials-Consortia/optimade-python-tools",
"path": "/optimade/adapters/references/adapter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._object_id
@classmethod
def tile(cls, op):
if vineyard is None:
raise RuntimeError('vineyard is not available')
client = vineyard.connect(op.vineyard_socket)
ctx = get_context()
if ctx.running_mode == RunningMode.distributed:
... | code_fim | hard | {
"lang": "python",
"repo": "songroger/mars",
"path": "/mars/tensor/datasource/from_vineyard.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: songroger/mars path: /mars/tensor/datasource/from_vineyard.py
# Copyright 1999-2020 Alibaba Group Holding 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
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "songroger/mars",
"path": "/mars/tensor/datasource/from_vineyard.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # For each of the files, we load it as a dataframe and add it as a
# table in the BigQuery dataset. We expect that all aggregation and
# standardization of the data has been done by this point.
int_cols = [std_col.COVID_CASES, std_col.COVID_HOSP_Y,
std_c... | code_fim | hard | {
"lang": "python",
"repo": "kkatzen/health-equity-tracker",
"path": "/python/datasources/cdc_restricted.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kkatzen/health-equity-tracker path: /python/datasources/cdc_restricted.py
import ingestion.standardized_columns as std_col
from datasources.data_source import DataSource
from ingestion import gcs_to_bq_util
class CDCRestrictedData(DataSource):
@staticmethod
def get_id():
retur... | code_fim | hard | {
"lang": "python",
"repo": "kkatzen/health-equity-tracker",
"path": "/python/datasources/cdc_restricted.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nptit/checkio-3 path: /AreaOfAConvexPolygon.py
#!/usr/bin/python
def checkio(data):
x, y = [r[0] for r in data], [r[1] for r in data]
return abs(sum(i * j for i, j in zip(x, y[1:] + [y[0]])) - sum(i * j for i, j in zip(y, x[1:] + [x[0]]))) * 0.5
#<|fim_suffix|>0], [7, 1], [1, 4]]) == 22.... | code_fim | hard | {
"lang": "python",
"repo": "nptit/checkio-3",
"path": "/AreaOfAConvexPolygon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>eckio([[7, 2], [3, 2], [1, 5],
[3, 9], [7, 9], [9, 6]]) == 42, "Hexagon"
assert checkio([[4, 1], [3, 4], [3, 7], [4, 8],
[7, 9], [9, 6], [7, 1]]) == 35.5, "Heptagon"<|fim_prefix|># repo: nptit/checkio-3 path: /AreaOfAConvexPolygon.py
#!/usr/bin/python
def check... | code_fim | hard | {
"lang": "python",
"repo": "nptit/checkio-3",
"path": "/AreaOfAConvexPolygon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pricevolume/gaurabda-calendar path: /gaurabda/GCDayData.py
ow correct succession of rasis
else:
# adhika masa not found
# there will be some break in masa queue
ksaya_to = 0
current_rasi = R[ksaya_from + 1] + 1
f... | code_fim | hard | {
"lang": "python",
"repo": "pricevolume/gaurabda-calendar",
"path": "/gaurabda/GCDayData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>2089287, 2089300, 2089317,
2089331, 2089349, 2089363, 2090019, 2090034, 2090049, 2090064, 2090083, 2089085, 2089100, 0, 0,
#Gaurabda Year = 555
2090129, 2090145, 2090160, 2090174, 2090191, 2090205, 2090222, 2090236, 2090252, 2090267, 2090283, 2090298, 2090314, 2090329,
2090344, 2090360, 2090376, 2... | code_fim | hard | {
"lang": "python",
"repo": "pricevolume/gaurabda-calendar",
"path": "/gaurabda/GCDayData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pricevolume/gaurabda-calendar path: /gaurabda/GCDayData.py
, R[3])
# TRACE("FOUND CONJ Date: %d %d %d rasi: %d\n", C[4].day, C[4].month, C[4].year, R[4])
# TRACE("---\n")
# look for ksaya month
ksaya_from = -1
for n in range(PREV_MONTHS - 2,0,-1):
... | code_fim | hard | {
"lang": "python",
"repo": "pricevolume/gaurabda-calendar",
"path": "/gaurabda/GCDayData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> proc.softirq_stolen_duration.begin(timestamp)
cpu.current_softirq = state.SoftIrq(vec)
cpu.current_softirq.duration = state.Duration(timestamp)
def process_irq_softirq_exit(self, event):
timestamp = event.timestamp
cpu_id = event['cpu_id']
vec = ev... | code_fim | hard | {
"lang": "python",
"repo": "hryu/cpu_usage_analyser",
"path": "/core/irq_analyser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hryu/cpu_usage_analyser path: /core/irq_analyser.py
from .analyser import Analyser
from . import state
class IrqAnalyser(Analyser):
def __init__(self, notifiers, state):
callbacks = {
'irq_handler_entry' : self.process_irq_handler_entry,
'irq_handler_exit' : s... | code_fim | hard | {
"lang": "python",
"repo": "hryu/cpu_usage_analyser",
"path": "/core/irq_analyser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EPFLMachineLearningTeamYoor/Project1 path: /src/run_tests.py
from scripts import implementation
from scripts import feature_processing
from scripts import model_logistic
<|fim_suffix|>if model_logistic.test_all():
print("Logistic regression OK")<|fim_middle|>if feature_processing.test_all():... | code_fim | medium | {
"lang": "python",
"repo": "EPFLMachineLearningTeamYoor/Project1",
"path": "/src/run_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if model_logistic.test_all():
print("Logistic regression OK")<|fim_prefix|># repo: EPFLMachineLearningTeamYoor/Project1 path: /src/run_tests.py
from scripts import implementation
from scripts import feature_processing
from scripts import model_logistic
if feature_processing.test_all():
print("Fe... | code_fim | medium | {
"lang": "python",
"repo": "EPFLMachineLearningTeamYoor/Project1",
"path": "/src/run_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> iters = state['iters']
if self.log_every != -1 and iters % self.log_every == 0:
self.log(state['metrics'], state['epoch'], state['epoch_batch'])
def on_epoch_end(self, state):
self.log(state['metrics'], state['epoch'], state['epoch_batch'])
def log(self, xs, e... | code_fim | hard | {
"lang": "python",
"repo": "swagat25/Torchelie",
"path": "/torchelie/metrics/callbacks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, post_each_batch=True):
self.post_each_batch = post_each_batch
def on_epoch_start(self, state):
if 'table' in state['metrics']:
del state['metrics']['table']
def make_html(self, state):
html = '''
<style>
table {
... | code_fim | hard | {
"lang": "python",
"repo": "swagat25/Torchelie",
"path": "/torchelie/metrics/callbacks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swagat25/Torchelie path: /torchelie/metrics/callbacks.py
import os
from pathlib import Path
import torch
from visdom import Visdom
from torchelie.utils import dict_by_key, recursive_state_dict
from torchelie.utils import load_recursive_state_dict
from torchelie.metrics.inspector import Classific... | code_fim | hard | {
"lang": "python",
"repo": "swagat25/Torchelie",
"path": "/torchelie/metrics/callbacks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: THeinemann/wikidata-toolkit path: /external_identifier.py
def imdb_id(title):
"""IMDB identifier
>>> imdb_id("Inception")
"tt1375666"
>>> imdb_id("Interstellar")
"tt0816692"
"""
pass
def tv_tropes_id(title):
<|fim_suffix|>def eidr_identifier(title):
"""Entertain... | code_fim | hard | {
"lang": "python",
"repo": "THeinemann/wikidata-toolkit",
"path": "/external_identifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def fandom_wiki_id(title):
"""Fandom Wiki identifier"""
pass
def the_tvdb_dot_com_id(title):
"""thetvdb.com identifier
>>> the_tvdb_dot_com_id("Inception")
"movies/inception"
>>> the_tvdb_dot_com_id("Interstellar")
"movies/interstellar"
>>> the_tvdb_dot_com_id("Harry Pot... | code_fim | hard | {
"lang": "python",
"repo": "THeinemann/wikidata-toolkit",
"path": "/external_identifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def fandom_wiki_id(title):
"""Fandom Wiki identifier"""
pass
def the_tvdb_dot_com_id(title):
"""thetvdb.com identifier
>>> the_tvdb_dot_com_id("Inception")
"movies/inception"
>>> the_tvdb_dot_com_id("Interstellar")
"movies/interstellar"
>>> the_tvdb_dot_com_id("Harry Po... | code_fim | hard | {
"lang": "python",
"repo": "THeinemann/wikidata-toolkit",
"path": "/external_identifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Industrepreneur/criticalpathmapping path: /mapping/accounts/migrations/0016_auto_20150508_1648.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='workshift',
name='day_of_week',
... | code_fim | medium | {
"lang": "python",
"repo": "Industrepreneur/criticalpathmapping",
"path": "/mapping/accounts/migrations/0016_auto_20150508_1648.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='workshift',
name='day_of_week',
field=models.PositiveSmallIntegerField(help_text='Day of week shift starts on.', choices=[(0, 'Sunday'), (1, 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5, '... | code_fim | medium | {
"lang": "python",
"repo": "Industrepreneur/criticalpathmapping",
"path": "/mapping/accounts/migrations/0016_auto_20150508_1648.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arnaudlimbourg/django-fakery path: /django_fakery/tests/runtests.py
#!/usr/bin/env python
import os, sys, warnings
warnings.simplefilter('error', RuntimeWarning)
if hasattr(sys, 'pypy_version_info'):
from psycopg2cffi import compat
compat.register()
from django.conf import settings
t... | code_fim | medium | {
"lang": "python",
"repo": "arnaudlimbourg/django-fakery",
"path": "/django_fakery/tests/runtests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if django.VERSION[0:2] >= (1, 7):
django.setup()
runner_class = django.test.utils.get_runner(settings)
test_runner = runner_class(verbosity=1, interactive=True, failfast=False)
failures = test_runner.run_tests(['django_fakery'])
sys.exit(failures)
if __name__ == '__main__':
... | code_fim | hard | {
"lang": "python",
"repo": "arnaudlimbourg/django-fakery",
"path": "/django_fakery/tests/runtests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>SETTINGS = {
'DATABASES': {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis' if HAS_GEOS else 'django.db.backends.postgresql_psycopg2',
'NAME': 'travis_postgis',
'USER': 'postgres',
'DISABLE_SERVER_SIDE_CURSORS': DISABLE_SERVER_SID... | code_fim | medium | {
"lang": "python",
"repo": "arnaudlimbourg/django-fakery",
"path": "/django_fakery/tests/runtests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_CONFIG_LOGGER_SECTION_ = "Logger"
_CONFIG_TYPE_OPTION_ = "type"
_CONFIG_CONSOLE_VALUE_ = "console"
_CONFIG_TELEGRAM_VALUE_ = "telegram"
_CONFIG_TELEGRAM_TOKEN_OPTION_ = "token"
_CONFIG_TELEGRAM_CHATID_OPTION_ = "chatId"
_CONFIG_INPUT_SECTION_ = "Input"
_CONFIG_HOST_SECTION_ = "host"
_JSON_FUNCTION_ = "... | code_fim | hard | {
"lang": "python",
"repo": "ChrisChV/Binance-Manager",
"path": "/src/Utils/sad.py",
"mode": "spm",
"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.