text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: zsyc/LeetAlgo path: /0013_Roman2Int.py
class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
<|fim_suffix|>('L') * 50 + s.count('C') * 100\
+ s.count('D') * 500 + s.count('M') * 1000 - s.count('IV') * 2 - s.count('IX') * 2 - s.count('... | code_fim | medium | {
"lang": "python",
"repo": "zsyc/LeetAlgo",
"path": "/0013_Roman2Int.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>('L') * 50 + s.count('C') * 100\
+ s.count('D') * 500 + s.count('M') * 1000 - s.count('IV') * 2 - s.count('IX') * 2 - s.count('XL') * 20\
- s.count('XC') * 20 - s.count('CD') * 200 - s.co<|fim_prefix|># repo: zsyc/LeetAlgo path: /0013_Roman2Int.py
class Solution:
def romanToIn... | code_fim | medium | {
"lang": "python",
"repo": "zsyc/LeetAlgo",
"path": "/0013_Roman2Int.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: safehammad/simpleapi path: /example_project/server/django_server5/api/models.py
# -*- coding: utf-8 -*-
import datetime
from django.db import models
<|fim_suffix|> name = models.CharField(max_length=150)
phone = models.CharField(blank=True, null=True, max_length=50)
fax = models.Cha... | code_fim | easy | {
"lang": "python",
"repo": "safehammad/simpleapi",
"path": "/example_project/server/django_server5/api/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = models.CharField(max_length=150)
phone = models.CharField(blank=True, null=True, max_length=50)
fax = models.CharField(blank=True, null=True, max_length=50)
datetime_added = models.DateTimeField(default=datetime.datetime.now)
time_changed = models.TimeField(auto_now=True, auto_... | code_fim | easy | {
"lang": "python",
"repo": "safehammad/simpleapi",
"path": "/example_project/server/django_server5/api/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> time_changed = models.TimeField(auto_now=True, auto_now_add=True)
date_changed = models.DateField(auto_now=True, auto_now_add=True)<|fim_prefix|># repo: safehammad/simpleapi path: /example_project/server/django_server5/api/models.py
# -*- coding: utf-8 -*-
import datetime
from django.db import ... | code_fim | hard | {
"lang": "python",
"repo": "safehammad/simpleapi",
"path": "/example_project/server/django_server5/api/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamesfulford/fulford.data path: /fulforddata/constants.py
#
# These constants define what types
# invoke what type of behavior in all
# recursive functionality in this package
#
<|fim_suffix|># string functionalities
STRINGS = (
str,
unicode,
)<|fim_middle|># list functionalities
ITERAB... | code_fim | medium | {
"lang": "python",
"repo": "jamesfulford/fulford.data",
"path": "/fulforddata/constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># string functionalities
STRINGS = (
str,
unicode,
)<|fim_prefix|># repo: jamesfulford/fulford.data path: /fulforddata/constants.py
#
# These constants define what types
# invoke what type of behavior in all
# recursive functionality in this package
#
<|fim_middle|># list functionalities
ITERAB... | code_fim | medium | {
"lang": "python",
"repo": "jamesfulford/fulford.data",
"path": "/fulforddata/constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def gen_args(expected):
return ["concolic", "-i", str(expected)]
def my_fail_pred(case,out):
return not ("{}.js passed".format(case) in out)
success = testrunner.run_tests_with_expected(tests,gen_args,fail_pred=my_fail_pred)
if not success:
exit(1)<|fim_prefix|># repo: SoftwareEngineeringToo... | code_fim | hard | {
"lang": "python",
"repo": "SoftwareEngineeringToolDemos/FSE-2013-Jalangi",
"path": "/scripts/sym.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
tests = [
("tests/unit/bool_symbolic", 3),
("tests/unit/or", 3),
("tests/unit/and", 3),
("tests/unit/path_inputs", 4),
("tests/unit/summary1", 3),
("tests/unit/integer1", 5),
("tests/unit/integer2", 2),
("tests/unit/integer3", 3),
("tests/unit/integer4", 3),
("test... | code_fim | medium | {
"lang": "python",
"repo": "SoftwareEngineeringToolDemos/FSE-2013-Jalangi",
"path": "/scripts/sym.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SoftwareEngineeringToolDemos/FSE-2013-Jalangi path: /scripts/sym.py
# Copyright 2013 Samsung Information Systems America, 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 the Lice... | code_fim | medium | {
"lang": "python",
"repo": "SoftwareEngineeringToolDemos/FSE-2013-Jalangi",
"path": "/scripts/sym.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tinogomes/imob_mob path: /simob.py
import random
class Propriedade:
def __init__(self, preco=300, aluguel=100):
self.preco = preco
self.aluguel = aluguel
self.proprietario = None
def impulsivo(jogador, propriedade):
<|fim_suffix|> return impulsivo(jogador, proprie... | code_fim | hard | {
"lang": "python",
"repo": "tinogomes/imob_mob",
"path": "/simob.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def aleatorio(jogador, propriedade):
return impulsivo(jogador, propriedade) and random.choice([True, False])
class Jogador:
def __init__(self, estrategia, saldo=300):
self.saldo = saldo
self.estrategia = estrategia
def paga(self, propriedade):
if self.estrategia(self,... | code_fim | medium | {
"lang": "python",
"repo": "tinogomes/imob_mob",
"path": "/simob.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liyongsheng-tech/AnyNet path: /utils/logger.py
import logging
import os
def setup_logger(filepath):
file_formatter = logging.Formatter(
"[%(asctime)s %(filename)s:%(lineno)s] %(levelname)-8s %(message)s",
datefmt='%Y-%m-%d %H:%M:%S',
)
<|fim_suffix|>g.FileHandler(filen... | code_fim | hard | {
"lang": "python",
"repo": "liyongsheng-tech/AnyNet",
"path": "/utils/logger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>g.FileHandler(filename=filepath, mode="a")
file_handle.set_name(file_handle_name)
file_handle.setFormatter(file_formatter)
logger.addHandler(file_handle)
logger.setLevel(logging.DEBUG)
return logger<|fim_prefix|># repo: liyongsheng-tech/AnyNet path: /utils/logger.py
import logging
imp... | code_fim | hard | {
"lang": "python",
"repo": "liyongsheng-tech/AnyNet",
"path": "/utils/logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> discounts = fields.Nested(DiscountSchema, required=True, many=True)
sessions = fields.Nested(SessionSchema, required=True, many=True)
brands = fields.Nested(BrandSchema, required=True, many=True)
kinds = fields.Nested(KindSchema, required=True, many=True)<|fim_prefix|># repo: willrp/willbu... | code_fim | medium | {
"lang": "python",
"repo": "willrp/willbuyer",
"path": "/backend/util/response/store/gender_results/gender_results_schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willrp/willbuyer path: /backend/util/response/store/gender_results/gender_results_schema.py
from marshmallow import Schema, fields
from ..models.brand import BrandSchema
from ..models.discount import DiscountSchema
from ..models.kind import KindSchema
from ..models.session import SessionSchema
... | code_fim | medium | {
"lang": "python",
"repo": "willrp/willbuyer",
"path": "/backend/util/response/store/gender_results/gender_results_schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gzvulon/airlab path: /airlab/loss/pairwise.py
# Copyright 2018 University of Basel, Center for medical Image Analysis and Navigation
#
# 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": "gzvulon/airlab",
"path": "/airlab/loss/pairwise.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.warped_moving_image = th.empty_like(self._moving_image.image, dtype=self._dtype, device=self._device)
def forward(self, displacement):
# compute displacement field
displacement = self._grid + displacement
# compute current mask
mask = super(NCC, self).Ge... | code_fim | hard | {
"lang": "python",
"repo": "gzvulon/airlab",
"path": "/airlab/loss/pairwise.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class NCC(_PairwiseImageLoss):
r""" The normalized cross correlation loss is a measure for image pairs with a linear
intensity relation.
.. math::
\mathcal{S}_{\text{NCC}} := \frac{\sum I_F\cdot (I_M\circ f)
- \sum\text{E}(I_F)\text{E}(I_M\circ f)}
... | code_fim | hard | {
"lang": "python",
"repo": "gzvulon/airlab",
"path": "/airlab/loss/pairwise.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Input
common_input_options = {'delimiter': ',', 'index_col': 0, 'parse_dates': True}
train_dataset = pd.read_csv('data/train.csv', **common_input_options)
test_dataset = pd.read_csv('data/test.csv', usecols=(0,1,2,3,4,5,6,7,8),
**common_input_options)
... | code_fim | hard | {
"lang": "python",
"repo": "LeartS/kaggle-competitions",
"path": "/bike-sharing/2-decision-tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Data preprocessing
X_train, y_train = preprocessing(train_dataset.iloc[:,:-3],
train_dataset.iloc[:,-3:-1])
X_test, y_test = preprocessing(test_dataset, None)
# The interesting part
estimator = tree.DecisionTreeRegressor(max_depth=args.depth)
... | code_fim | hard | {
"lang": "python",
"repo": "LeartS/kaggle-competitions",
"path": "/bike-sharing/2-decision-tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeartS/kaggle-competitions path: /bike-sharing/2-decision-tree.py
import math
import argparse
from datetime import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import cross_validation
from sklearn import tree
from sklearn import metrics
# plt.styl... | code_fim | hard | {
"lang": "python",
"repo": "LeartS/kaggle-competitions",
"path": "/bike-sharing/2-decision-tree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amichoi/Cat_to_Obs_K1000_P1 path: /PSF_systests/PSF_plots/average_delta_estar_x_y.py
#
import numpy as np
import ldac
import matplotlib.pyplot as plt
#import pylab as plt
import sys
from scipy.stats import binned_statistic_2d
from mpl_toolkits.axes_grid1 import ImageGrid
from matplotlib import rc... | code_fim | hard | {
"lang": "python",
"repo": "amichoi/Cat_to_Obs_K1000_P1",
"path": "/PSF_systests/PSF_plots/average_delta_estar_x_y.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>size_mod= np.sqrt(Q11*Q22-Q12**2)
#============================================================
#Now make different sub plots
# count the grid square that I want to plot in
gridpos=-1
for j in range (1,nrows+1): # what do we want to bin? And we may want to fix the colour scale limits (cmin,cmax)
... | code_fim | hard | {
"lang": "python",
"repo": "amichoi/Cat_to_Obs_K1000_P1",
"path": "/PSF_systests/PSF_plots/average_delta_estar_x_y.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for j in range (1,nrows+1): # what do we want to bin? And we may want to fix the colour scale limits (cmin,cmax)
if(j==1): # <ePSF>
de1 = pe1_data
de2 = pe2_data
cmin=-0.015
cmax= 0.015
labinfo = r'$\overline{ \epsilon^{\rm PSF} }$'
stat='mean'
... | code_fim | hard | {
"lang": "python",
"repo": "amichoi/Cat_to_Obs_K1000_P1",
"path": "/PSF_systests/PSF_plots/average_delta_estar_x_y.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> continue
c = c+1
print(c)<|fim_prefix|># repo: NehaAgarwal2598/Codeforces path: /Magnets.py
n = int(input())
l = []
for _ in range<|fim_middle|>(n):
l.append(input())
c = 1
for i in range(n-1):
if l[i] == l[i+1]:
| code_fim | medium | {
"lang": "python",
"repo": "NehaAgarwal2598/Codeforces",
"path": "/Magnets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NehaAgarwal2598/Codeforces path: /Magnets.py
n = int(input())
l = []
for _ in range<|fim_suffix|> in range(n-1):
if l[i] == l[i+1]:
continue
c = c+1
print(c)<|fim_middle|>(n):
l.append(input())
c = 1
for i | code_fim | easy | {
"lang": "python",
"repo": "NehaAgarwal2598/Codeforces",
"path": "/Magnets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> gn.mastodon = self.original_mastodon
def test_read_csv(self) -> None:
df = gn.read_csv("/../tests/resources/test.csv")
expect = pd.DataFrame(
{
"name": [
"博麗 靈夢 (旧作)",
"霧雨 魔理沙 (旧作)",
"十六夜 咲... | code_fim | hard | {
"lang": "python",
"repo": "kelvin27315/mastodon-gensokyo-night",
"path": "/tests/test_gensokyo_night.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kelvin27315/mastodon-gensokyo-night path: /tests/test_gensokyo_night.py
import unittest
from datetime import date, timedelta
from unittest.mock import Mock
import mastodon
import pandas as pd
from gensokyo_night import gensokyo_night as gn
from pandas.util.testing import assert_frame_equal
TOMO... | code_fim | hard | {
"lang": "python",
"repo": "kelvin27315/mastodon-gensokyo-night",
"path": "/tests/test_gensokyo_night.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tatsh/mychevy path: /mychevy/debug.py
# -*- coding: utf-8 -*-
"""Console script for mychevy."""
import configparser
import logging
import click
from mychevy.mychevy import MyChevy, ServerError
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.command(context_settings=CONTE... | code_fim | medium | {
"lang": "python",
"repo": "Tatsh/mychevy",
"path": "/mychevy/debug.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Console script for mychevy"""
cfile = configparser.ConfigParser()
cfile.read_file(config)
if verbose:
logging.basicConfig(level=logging.DEBUG)
page = MyChevy(cfile["default"]["user"], cfile["default"]["passwd"])
click.echo("Logging in... this takes a bit")
page.log... | code_fim | hard | {
"lang": "python",
"repo": "Tatsh/mychevy",
"path": "/mychevy/debug.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: w3-3w/trash-py path: /zjuwlan/zjuwlan_logout.py
# Python 3.4.0
#######################################################################
# Auto connect ZJUWLAN #
# by w3_3w #
#################... | code_fim | hard | {
"lang": "python",
"repo": "w3-3w/trash-py",
"path": "/zjuwlan/zjuwlan_logout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>**Log out success.******************")
else:
print("Log out failed!")
except:
print("Failed!")
print("Check if ZJUWLAN is connected or file 'config.ini' exists!")
print("Did you input the correct password in 'config.ini' ?\n")
time.sleep(4)
finally:
print("Program terminate... | code_fim | hard | {
"lang": "python",
"repo": "w3-3w/trash-py",
"path": "/zjuwlan/zjuwlan_logout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_context_data(self, **kwargs):
eduhub_top_filter = self.request.COOKIES.get("eduhub_top_filter", "")
eduhub_top_filter = ""
search_filter = self.request.GET.get("filter", "")
context_data = super().get_context_data(**kwargs)
if search_filter == "labels"... | code_fim | hard | {
"lang": "python",
"repo": "larryw3i/fun",
"path": "/fun/eduhub/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: larryw3i/fun path: /fun/eduhub/views.py
aginator.page(page_number)
return (paginator, page, page.object_list, page.has_other_pages())
except InvalidPage as e:
page = paginator.page(1)
return (paginator, page, page.object_list, page.has_other_pages())
... | code_fim | hard | {
"lang": "python",
"repo": "larryw3i/fun",
"path": "/fun/eduhub/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = ASharingGroupMember
template_name = asgmember_update_template
form_class = ASGMemberModelForm
context_object_name = "asgmember"
def post(self, request, *args, **kwargs):
if not ASharingGroupMember.objects.filter(
pk=self.pk, cfrom=request.user
).exi... | code_fim | hard | {
"lang": "python",
"repo": "larryw3i/fun",
"path": "/fun/eduhub/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>p = h.acquire_component_interface('Photoresistor')
for i in range(1000):
print(p.read(), p.read_millivolts(), p.read_ohms())
time.sleep(0.1)<|fim_prefix|># repo: AlfredMadere/libauto path: /cio/examples/photoresistor.py
############################################################################... | code_fim | medium | {
"lang": "python",
"repo": "AlfredMadere/libauto",
"path": "/cio/examples/photoresistor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlfredMadere/libauto path: /cio/examples/photoresistor.py
###############################################################################
#
# Copyright (c) 2017-2018 AutoAuto, LLC
# ALL RIGHTS RESERVED
#
# Use of this library, in source or binary form, is prohibited without written
# approval fro... | code_fim | medium | {
"lang": "python",
"repo": "AlfredMadere/libauto",
"path": "/cio/examples/photoresistor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chromium/chromium path: /tools/binary_size/libsupersize/models.py
ize_path',
'is_sparse',
)
def __init__(self,
build_config,
containers,
raw_symbols,
symbols=None,
size_path=None,
is_sparse=False)... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/tools/binary_size/libsupersize/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def SortedByAddress(self, reverse=False):
return self.Sorted(key=(lambda s:(s.address, s.object_path, s.name)),
reverse=reverse)
def SortedByCount(self, reverse=False):
return self.Sorted(key=(lambda s:len(s) if s.IsGroup() else 1),
reverse=not re... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/tools/binary_size/libsupersize/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.Filter(lambda s: s.size >= min_size)
def WherePssBiggerThan(self, min_pss):
return self.Filter(lambda s: s.pss >= min_pss)
def WhereIsOnDemand(self, value=True):
ret = self.Filter(lambda s: s.container_name.endswith('?'))
if not value:
ret = ret.Inverted()
retur... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/tools/binary_size/libsupersize/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('core', '0028_covid19queryreplies'),
]
operations = [
migrations.RenameField(
model_name='covid19query',
old_name='reply',
new_name='admin_reply',
),
migrations.AlterField(
model_name='covid19qu... | code_fim | medium | {
"lang": "python",
"repo": "mzs9540/covid19",
"path": "/app/core/migrations/0029_auto_20200514_1929.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mzs9540/covid19 path: /app/core/migrations/0029_auto_20200514_1929.py
# Generated by Django 3.0.6 on 2020-05-14 19:29
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='covid19query'... | code_fim | medium | {
"lang": "python",
"repo": "mzs9540/covid19",
"path": "/app/core/migrations/0029_auto_20200514_1929.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_json_data(self):
return {
'database': self.database,
'query': self.query,
'resultFormat': self.resultFormat,
'alias': self.alias,
'refId': self.refId
}<|fim_prefix|># repo: weaveworks/grafanalib path: /grafanalib/azure... | code_fim | medium | {
"lang": "python",
"repo": "weaveworks/grafanalib",
"path": "/grafanalib/azuredataexplorer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: weaveworks/grafanalib path: /grafanalib/azuredataexplorer.py
"""Helpers to create Azure Data Explorer specific Grafana queries."""
import attr
TIME_SERIES_RESULT_FORMAT = 'time_series'
TABLE_RESULT_FORMAT = 'table'
ADX_TIME_SERIES_RESULT_FORMAT = 'time_series_adx_series'
@attr.s
class AzureDa... | code_fim | hard | {
"lang": "python",
"repo": "weaveworks/grafanalib",
"path": "/grafanalib/azuredataexplorer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> auth_path = os.path.dirname(os.path.abspath(__file__)) + '/db.csv' if auth_path is None else auth_path
csv_path=util.format_path(auth_path)
t_db=pd.read_csv(csv_path)
t_db.fillna('', inplace=True)
t_db=t_db[t_db['ID']==s_name]
if len(t_db)==0:
util.error_msg('Database %s is... | code_fim | hard | {
"lang": "python",
"repo": "data2code/Metascape",
"path": "/mylib/db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __exit__(self,exc_type, exc_value, traceback):
if self._con is not None:
self._con.close()
def from_sql(self, sql, params=(), index_col=None, coerce_float=True, l_select=None):
db_src=db_type(self.con())
t=None
if db_src=='MYSQL':
n_try=... | code_fim | hard | {
"lang": "python",
"repo": "data2code/Metascape",
"path": "/mylib/db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: data2code/Metascape path: /mylib/db.py
elif str(con.__class__).find('pgdb')>=0:
return 'POSTGRES'
elif str(con.__class__).find('sqlite')>=0:
return 'SQLITE'
def from_sql(con, sql, params=(), index_col=None, coerce_float=True, l_select=None):
"""
Same as Pandas.io.... | code_fim | hard | {
"lang": "python",
"repo": "data2code/Metascape",
"path": "/mylib/db.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Showmax/arista-eos-exporter path: /handler.py
import logging
import re
import socket
import falcon
from collector import AristaMetricsCollector
from prometheus_client.exposition import CONTENT_TYPE_LATEST
from prometheus_client.exposition import generate_latest
<|fim_suffix|> resp.set_... | code_fim | hard | {
"lang": "python",
"repo": "Showmax/arista-eos-exporter",
"path": "/handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not modules:
return False
module_functions = []
modules = modules.split(",")
for module in modules:
if module == "all":
return False
elif module == "memory":
module.functions
def on_get(self, req, r... | code_fim | hard | {
"lang": "python",
"repo": "Showmax/arista-eos-exporter",
"path": "/handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Normalized X Residuals, native coordinates (Strip)
TH1NormXprimeResStripModules = cms.PSet(
Nbinx = cms.int32(100), xmin = cms.double(-5.0), xmax = cms.double(5.0)
),
# X Residuals, native coordinates (Strip)
TH1XprimeResStripModules = cms.PSet(
Nbinx = cms.int32(100... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Alignment/OfflineValidation/python/TrackerOfflineValidation_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /Alignment/OfflineValidation/python/TrackerOfflineValidation_cfi.py
import FWCore.ParameterSet.Config as cms
TrackerOfflineValidation = cms.EDAnalyzer("TrackerOfflineValidation",
compressionSettings = cms.untracked.int32(-1),
useInDqmMode = cms.bool(... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Alignment/OfflineValidation/python/TrackerOfflineValidation_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Normalized X residuals normal local coordinates (Pixel)
TH1NormXResPixelModules = cms.PSet(
Nbinx = cms.int32(100), xmin = cms.double(-5.0), xmax = cms.double(5.0)
),
# X residuals normal local coordinates (Pixel)
TH1XResPixelModules = cms.PSet(
Nbinx = cms.int32(100)... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Alignment/OfflineValidation/python/TrackerOfflineValidation_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global _bnn_object
"call rospy.init_node() before build_ros_bbn() and call rospy.spin() after that"
_bnn_object = build_bbn(*args, **kwds)
rospy.Service('~query', Query, service_query)
return _bnn_object<|fim_prefix|># repo: jsk-ros-pkg/jsk_3rdparty path: /bayesian_belief_networks/src... | code_fim | hard | {
"lang": "python",
"repo": "jsk-ros-pkg/jsk_3rdparty",
"path": "/bayesian_belief_networks/src/bayesian_belief_networks/ros_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def ros_build_bbn(*args, **kwds):
global _bnn_object
"call rospy.init_node() before build_ros_bbn() and call rospy.spin() after that"
_bnn_object = build_bbn(*args, **kwds)
rospy.Service('~query', Query, service_query)
return _bnn_object<|fim_prefix|># repo: jsk-ros-pkg/jsk_3rdparty p... | code_fim | hard | {
"lang": "python",
"repo": "jsk-ros-pkg/jsk_3rdparty",
"path": "/bayesian_belief_networks/src/bayesian_belief_networks/ros_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsk-ros-pkg/jsk_3rdparty path: /bayesian_belief_networks/src/bayesian_belief_networks/ros_utils.py
#!/usr/bin/env python
from bayesian_belief_networks.srv import Query, QueryResponse
from bayesian_belief_networks.msg import Result, Observation
from bayesian.bbn import *
<|fim_suffix|>def ros_bu... | code_fim | hard | {
"lang": "python",
"repo": "jsk-ros-pkg/jsk_3rdparty",
"path": "/bayesian_belief_networks/src/bayesian_belief_networks/ros_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == 'POST':
query = request.POST.get('q', None)
return HttpResponseRedirect(reverse("search:search-results",
kwargs={'query': query}))<|fim_prefix|># repo: Bouncy-Bullfrogs/summer-code-jam-2020 path: /bouncy-bullfrogs/bouncy... | code_fim | hard | {
"lang": "python",
"repo": "Bouncy-Bullfrogs/summer-code-jam-2020",
"path": "/bouncy-bullfrogs/bouncy/search/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bouncy-Bullfrogs/summer-code-jam-2020 path: /bouncy-bullfrogs/bouncy/search/views.py
from django.shortcuts import render, reverse
from django.shortcuts import HttpResponseRedirect
from django.views.generic import ListView
from .models import Result
from django.db.models import Q
# Create your vie... | code_fim | medium | {
"lang": "python",
"repo": "Bouncy-Bullfrogs/summer-code-jam-2020",
"path": "/bouncy-bullfrogs/bouncy/search/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j1z0/tibanna path: /core/check_export_sbg/service.py
# -*- coding: utf-8 -*-
import logging
from core import utils, sbg_utils, ff_utils
import boto3
from collections import defaultdict
from core.fastqc_utils import parse_fastqc
LOG = logging.getLogger(__name__)
s3 = boto3.resource('s3')
def do... | code_fim | hard | {
"lang": "python",
"repo": "j1z0/tibanna",
"path": "/core/check_export_sbg/service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_inputfile_accession(sbg, input_file_name='input_file'):
return sbg.task_input.inputs[input_file_name]['name'].split('.')[0].strip('/')
# check the status and other details of import
def handler(event, context):
'''
this is to check if the task run is done:
http://docs.sevenbr... | code_fim | hard | {
"lang": "python",
"repo": "j1z0/tibanna",
"path": "/core/check_export_sbg/service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if we got all the exports let's go ahead and update our ff_metadata object
ff_meta.run_status = "output_file_transfer_finished"
# allow for a simple way for updater to add appropriate meta_data
if patch_meta:
ff_meta.__dict__.update(patch_meta)
# make all the file export me... | code_fim | hard | {
"lang": "python",
"repo": "j1z0/tibanna",
"path": "/core/check_export_sbg/service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MobileCloudNetworking/slaaas path: /bundle/wsgi/slaaas/template_generator.py
# Copyright (c) 2013-2015, Mobile Cloud Networking (MCN) project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | code_fim | hard | {
"lang": "python",
"repo": "MobileCloudNetworking/slaaas",
"path": "/bundle/wsgi/slaaas/template_generator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def generate(self, provisioning=False):
template = '---\n'
template += 'description: "YAML MCN DNSaaS Template"\n'
template += 'heat_template_version: 2013-05-23\n'
template += 'outputs: \n'
template += ' mcn.endpoint.slaaas: \n'
template += ' desc... | code_fim | hard | {
"lang": "python",
"repo": "MobileCloudNetworking/slaaas",
"path": "/bundle/wsgi/slaaas/template_generator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>e = None
try:
algorithm_parameters = custom_algorithms[custom_algorithm]['algorithm_parameters']
except:
algorithm_parameters = {}
try:
max_execution_time = custom_algorithms[custom_algorithm]['max_execution_time']
... | code_fim | hard | {
"lang": "python",
"repo": "greitzmann/skyline",
"path": "/skyline/custom_algorithms_to_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greitzmann/skyline path: /skyline/custom_algorithms_to_run.py
import logging
import traceback
from matched_or_regexed_in_list import matched_or_regexed_in_list
# @added 20200603 - Feature #3566: custom_algorithms
def get_custom_algorithms_to_run(current_skyline_app, base_name, custom_algorithms... | code_fim | hard | {
"lang": "python",
"repo": "greitzmann/skyline",
"path": "/skyline/custom_algorithms_to_run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if run_custom_algorithm and algorithm_source:
try:
custom_algorithms_to_run[custom_algorithm] = {
'namespaces': namespaces,
'algorithm_source': algorithm_source,
'algorithm_parameters': algorithm_parameters,
... | code_fim | hard | {
"lang": "python",
"repo": "greitzmann/skyline",
"path": "/skyline/custom_algorithms_to_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # fill remaining space with nops
while decoderlen < maxdecoderlen:
if shuffle:
pos = random.randint(0, len(decoder))
else:
pos = len(encoder)
decoder.insert(pos, "\x90")
de... | code_fim | hard | {
"lang": "python",
"repo": "Trietptm-on-Coding-Algorithms/tools",
"path": "/tctools/tctools.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Trietptm-on-Coding-Algorithms/tools path: /tctools/tctools.py
import sys, os, hashlib, struct, random
class tcinfo:
def __init__(self, \
verstring, \
brdecoderarea, \
brencode, \
tcusercfgflags, \
):
... | code_fim | hard | {
"lang": "python",
"repo": "Trietptm-on-Coding-Algorithms/tools",
"path": "/tctools/tctools.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif opc == "add":
if op == "cl":
# add al, cl
algo += "\x00\xC8"
else:
# add al, num
algo += "\x04" + chr(int(op, 0x10))
... | code_fim | hard | {
"lang": "python",
"repo": "Trietptm-on-Coding-Algorithms/tools",
"path": "/tctools/tctools.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
# Parsing Command Line here
options, args = doc_optparse.parse( __doc__ )
try:
inp_file, out_file, column, features = args
except:
stop_err( "One or more arguments is missing or invalid.\nUsage: prog input output column features" )
try:
column = int... | code_fim | medium | {
"lang": "python",
"repo": "pseudoPixels/SciWorCS",
"path": "/app_collaborative_sci_workflow/GalaxyToolBase/filters/gff/extract_GFF_Features.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pseudoPixels/SciWorCS path: /app_collaborative_sci_workflow/GalaxyToolBase/filters/gff/extract_GFF_Features.py
#!/usr/bin/env python
# Guruprasad Ananda
"""
Extract features from GFF file.
usage: %prog input1 out_file1 column features
"""
from __future__ import print_function
import sys
from b... | code_fim | medium | {
"lang": "python",
"repo": "pseudoPixels/SciWorCS",
"path": "/app_collaborative_sci_workflow/GalaxyToolBase/filters/gff/extract_GFF_Features.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if action == "N":
ywp = ywp + value
elif action == "S":
ywp = ywp - value
elif action == "E":
xwp = xwp + value
elif action == "W":
xwp = xwp - value
elif action == "L":
value = math.radians(value)
temp = xwp
xwp = xwp*math.cos(va... | code_fim | medium | {
"lang": "python",
"repo": "RJPlog/aoc-2020",
"path": "/day12/python/JojoAK/Day_12_2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RJPlog/aoc-2020 path: /day12/python/JojoAK/Day_12_2.py
import math
PuzzleInput = "PuzzleInput.txt"
f = open(PuzzleInput)
txt = f.readlines()
xcoord = 0
ycoord = 0
xwp = 10
ywp = 1
quad = 0
<|fim_suffix|> if action == "N":
ywp = ywp + value
elif action == "S":
ywp = ywp -... | code_fim | medium | {
"lang": "python",
"repo": "RJPlog/aoc-2020",
"path": "/day12/python/JojoAK/Day_12_2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def ATMHistogram(ATM):
X = ATM.inputs["X"]
y = ATM.inputs["y"]
data = pd.concat([X, y], axis=1, sort=False)
plt.hist(data[ATM.props["feature"]], bins=ATM.props["bins"])
plt.xlabel(ATM.props["xlabel"])
ATM.reportPlot(plt)
ATM.output(ATM.inputs);<|fim_prefix|># repo: automatic-dot-ai/automatic... | code_fim | hard | {
"lang": "python",
"repo": "automatic-dot-ai/automatic",
"path": "/viz/ATMHistogram.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: automatic-dot-ai/automatic path: /viz/ATMHistogram.py
# @component {
# "kind" : "viz",
# "language" : "py",
# "description" : "Histogram of target feature's values",
# "permissions": "public",
# "properties": [
# { "name": "Feature" , "field": "feature", "kind": "string", "minlen": 1, "m... | code_fim | hard | {
"lang": "python",
"repo": "automatic-dot-ai/automatic",
"path": "/viz/ATMHistogram.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onepercentclub/bluebottle path: /bluebottle/funding_lipisha/tests/test_utils.py
from mock import patch
from bluebottle.funding.exception import PaymentException
from bluebottle.funding_lipisha.models import LipishaPaymentProvider
from bluebottle.funding_lipisha.tests.factories import LipishaPaym... | code_fim | hard | {
"lang": "python",
"repo": "onepercentclub/bluebottle",
"path": "/bluebottle/funding_lipisha/tests/test_utils.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @patch('lipisha.Lipisha._make_api_call', return_value=lipisha_failed_response)
def test_failed(self, mock_client):
payment = LipishaPaymentFactory.create()
check_payment_status(payment)
payment.refresh_from_db()
self.assertEqual(payment.status, 'failed')
@patch... | code_fim | hard | {
"lang": "python",
"repo": "onepercentclub/bluebottle",
"path": "/bluebottle/funding_lipisha/tests/test_utils.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Version {VERSION} ({cur_time} +0800)
"""
print(text)<|fim_prefix|># repo: lizhihao6/DoraemonPocket path: /DoraemonPocket/shell/usage.py
from time import ctime
# change package_name to your package name.
from DoraemonPocket.version import VERSION
<|fim_middle|>def run():
cur_time = ctim... | code_fim | medium | {
"lang": "python",
"repo": "lizhihao6/DoraemonPocket",
"path": "/DoraemonPocket/shell/usage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lizhihao6/DoraemonPocket path: /DoraemonPocket/shell/usage.py
from time import ctime
# change package_name to your package name.
from DoraemonPocket.version import VERSION
<|fim_suffix|> cur_time = ctime()
# change package_name to your package name.
text = f"""
# DoraemonPocket
... | code_fim | easy | {
"lang": "python",
"repo": "lizhihao6/DoraemonPocket",
"path": "/DoraemonPocket/shell/usage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print '####### sigmav radus mass density virial alfvenic virial_B'
print '50kms_c1p1 %.2f %.2f %.2f %.2e %.2f %.2f %.2f' % coreprop(224.9,50,0.143/2,8.1,0.899,5.14,100,4.3,3.1,29.)
print '50kms_c1p2 %.2f %.2f %.2f %.2e %.2f %.2f %.2f' % coreprop(224.9,50,0.093/2,8.1,0.899,5.18,100,4.2,2.2,29.)
print '... | code_fim | hard | {
"lang": "python",
"repo": "foisliu/CMZclouds",
"path": "/DenseCores/coremass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print '####### sigmav radus mass density virial alfvenic virial_B'
print '50kms_c1p1 %.2f %.2f %.2f %.2e %.2f %.2f %.2f' % coreprop(224.9,50,0.143/2,8.1,0.899,5.14,100,4.3,3.1,29.)
print '50kms_c1p2 %.2f %.2f %.2f %.2e %.2f %.2f %.2f' % coreprop(224.9,50,0.093/2,8.1,0.899,5.18,100,4.2,2.2,29.)
print '5... | code_fim | hard | {
"lang": "python",
"repo": "foisliu/CMZclouds",
"path": "/DenseCores/coremass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: foisliu/CMZclouds path: /DenseCores/coremass.py
import astropy.constants as const
import astropy.units as u
from astropy.modeling.blackbody import blackbody_nu
import numpy as np
c = const.c.cgs.value
h = const.h.cgs.value
kb = const.k_B.cgs.value
msun = const.M_sun.cgs.value
pc = const.pc.cgs.v... | code_fim | hard | {
"lang": "python",
"repo": "foisliu/CMZclouds",
"path": "/DenseCores/coremass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from plotting import *<|fim_prefix|># repo: Sahar-kh/Westeros path: /tools.py
import sys
import os
here = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
<|fim_middle|>path = os.path.join(here, '..', 'utils')
sys.path.append(path)
| code_fim | medium | {
"lang": "python",
"repo": "Sahar-kh/Westeros",
"path": "/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sahar-kh/Westeros path: /tools.py
import sys
import os
<|fim_suffix|>from plotting import *<|fim_middle|>here = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
path = os.path.join(here, '..', 'utils')
sys.path.append(path)
| code_fim | medium | {
"lang": "python",
"repo": "Sahar-kh/Westeros",
"path": "/tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgrantdev/kala-app path: /django_kala/projects/views/projects/settings/transfer_ownership.py
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.views.generic.base import TemplateView
from ... | code_fim | medium | {
"lang": "python",
"repo": "bgrantdev/kala-app",
"path": "/django_kala/projects/views/projects/settings/transfer_ownership.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_context_data(self, **kwargs):
return {
'form': self.form,
'project': self.project,
}
def dispatch(self, request, pk, *args, **kwargs):
self.project = get_object_or_404(Project.objects.active(), pk=pk)
self.form = TransferOwnershipFor... | code_fim | medium | {
"lang": "python",
"repo": "bgrantdev/kala-app",
"path": "/django_kala/projects/views/projects/settings/transfer_ownership.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse_store(self, response):
ref = "_".join(re.search(r".+/(.+?)/(.+?)/(.+?)/?(?:\.html|$)", response.url).groups())
properties = {
'name': response.xpath('//h1[@class="store-details__store-name"]/text()').extract_first(),
'ref': ref,
'addr_full... | code_fim | hard | {
"lang": "python",
"repo": "thomas536/alltheplaces",
"path": "/locations/spiders/heb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> urls = xml.xpath('//loc/text()').extract()
for url in urls:
yield scrapy.Request(url=url, callback=self.parse_store, meta={"url": url})
def parse_store(self, response):
ref = "_".join(re.search(r".+/(.+?)/(.+?)/(.+?)/?(?:\.html|$)", response.url).groups())
... | code_fim | medium | {
"lang": "python",
"repo": "thomas536/alltheplaces",
"path": "/locations/spiders/heb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomas536/alltheplaces path: /locations/spiders/heb.py
# -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class HEBSpider(scrapy.Spider):
name = "heb"
item_attributes = { 'brand': "H-E-B", 'brand_wikidata': "Q830621" }
allowed_domains = ["w... | code_fim | hard | {
"lang": "python",
"repo": "thomas536/alltheplaces",
"path": "/locations/spiders/heb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paylogic/halogen path: /tests/unit/schema/attr/test_attr.py
"""Test the basic functionality of the Attr."""
from halogen.schema import Attr
<|fim_suffix|> """Test Attr repr."""
attr = Attr()
attr.name = "some"
assert repr(attr) == "<Attr 'some'>"<|fim_middle|>def test_attr_repr()... | code_fim | easy | {
"lang": "python",
"repo": "paylogic/halogen",
"path": "/tests/unit/schema/attr/test_attr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test Attr repr."""
attr = Attr()
attr.name = "some"
assert repr(attr) == "<Attr 'some'>"<|fim_prefix|># repo: paylogic/halogen path: /tests/unit/schema/attr/test_attr.py
"""Test the basic functionality of the Attr."""
from halogen.schema import Attr
<|fim_middle|>
def test_attr_repr()... | code_fim | easy | {
"lang": "python",
"repo": "paylogic/halogen",
"path": "/tests/unit/schema/attr/test_attr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='pending',
old_name='admin_token',
new_name='admin_token_1',
),
migrations.AddField(
model_name='pending',
name='admin_1_validated',
field=models.BooleanFie... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/registrations/migrations/0002_auto_20180626_1808.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IFRCGo/go-api path: /registrations/migrations/0002_auto_20180626_1808.py
# Generated by Django 2.0.5 on 2018-06-26 18:08
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='pen... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/registrations/migrations/0002_auto_20180626_1808.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: toshihikoyanase/xfeat path: /tests/xfeat/optuna_selector/test_group_combination_explorer.py
from functools import partial
import optuna
from optuna.samplers import GridSampler
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegres... | code_fim | hard | {
"lang": "python",
"repo": "toshihikoyanase/xfeat",
"path": "/tests/xfeat/optuna_selector/test_group_combination_explorer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> selector.set_trial(trial)
# NOTE: Use validation set for practical usage.
df_trn, df_tst = train_test_split(df, test_size=0.5)
X = selector.fit_transform(df).values
X_tst = selector.transform(df_tst).values
print(X.shape)
model = LogisticRegression(solver="lbfgs", max_iter=10... | code_fim | medium | {
"lang": "python",
"repo": "toshihikoyanase/xfeat",
"path": "/tests/xfeat/optuna_selector/test_group_combination_explorer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = LogisticRegression(solver="lbfgs", max_iter=10000)
model.fit(X, df["target"])
y_pred = model.predict_proba(X_tst)[:, 1]
score = (df_tst["target"].values == y_pred).mean()
return score
def main():
selector = GroupCombinationExplorer(
base_cols=["v1", "v2"], list_g... | code_fim | hard | {
"lang": "python",
"repo": "toshihikoyanase/xfeat",
"path": "/tests/xfeat/optuna_selector/test_group_combination_explorer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yzkim9501/Baekjoon path: /4344.py
# 대학생 새내기들의 90%는 자신이 반에서 평균은 넘는다고 생각한다. 당신은 그들에게 슬픈 진실을 알려줘야 한다.
# 첫째 줄에는 테스트 케이스의 개수 C가 주어진다.
<|fim_suffix|># 각 케이스마다 한 줄씩 평균을 넘는 학생들의 비율을 반올림하여 소수점 셋째 자리까지 출력한다.
def avg(l):
s=0
for i in l:
s+=i
return((s-l[0])/l[0])
t=int(input())
for _ i... | code_fim | medium | {
"lang": "python",
"repo": "yzkim9501/Baekjoon",
"path": "/4344.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># 둘째 줄부터 각 테스트 케이스마다 학생의 수 N(1 ≤ N ≤ 1000, N은 정수)이 첫 수로 주어지고, 이어서 N명의 점수가 주어진다. 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다.
# 각 케이스마다 한 줄씩 평균을 넘는 학생들의 비율을 반올림하여 소수점 셋째 자리까지 출력한다.
def avg(l):
s=0
for i in l:
s+=i
return((s-l[0])/l[0])
t=int(input())
for _ in range(t):
a=list(map(int,input()... | code_fim | medium | {
"lang": "python",
"repo": "yzkim9501/Baekjoon",
"path": "/4344.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lgbouma/cdips path: /cdips/catalogbuild/construct_unique_cluster_name_column.py
return np.nan
new_cluster_groups = ['Gulliver', 'RSG']
for _n in new_cluster_groups:
if _n in mdfr['cluster']:
cluster = str(mdfr['cluster'])
for c in cluster.split(',... | code_fim | hard | {
"lang": "python",
"repo": "lgbouma/cdips",
"path": "/cdips/catalogbuild/construct_unique_cluster_name_column.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> is_gaia_member = False
if 'Gulliver' in cluster and 'CantatGaudin_2018' in reference:
is_gaia_member = True
not_in_k13 = True
why_not_in_k13 = 'is_gaia_member'
return (np.nan, how_match, have_name_match, have_mwsc_id_match,
is_known_asterism, not_in_... | code_fim | hard | {
"lang": "python",
"repo": "lgbouma/cdips",
"path": "/cdips/catalogbuild/construct_unique_cluster_name_column.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.