text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> super().__init__()
self.rommon_prompt = r'(.*)switch:\s?$'
self.tcpdump = ".*listening on lfts.*$"<|fim_prefix|># repo: CiscoTestAutomation/unicon.plugins path: /src/unicon/plugins/iosxe/stack/patterns.py
""" IOS-XE Stack Patterns """
from unicon.plugins.iosxe.patterns import IosX... | code_fim | medium | {
"lang": "python",
"repo": "CiscoTestAutomation/unicon.plugins",
"path": "/src/unicon/plugins/iosxe/stack/patterns.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ecified in the
# contents of the file.<|fim_prefix|># repo: zooba/esec path: /esec/plugins/__init__.py
# Files contained in this directory (es<|fim_middle|>ec/plugins) are not licenced
# under the Apache License, Version 2.0, unless sp | code_fim | medium | {
"lang": "python",
"repo": "zooba/esec",
"path": "/esec/plugins/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zooba/esec path: /esec/plugins/__init__.py
# Files contained in this directory (esec/plugins) are not licenced
# under t<|fim_suffix|>ecified in the
# contents of the file.<|fim_middle|>he Apache License, Version 2.0, unless sp | code_fim | easy | {
"lang": "python",
"repo": "zooba/esec",
"path": "/esec/plugins/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pos_order.get("returned_order"):
prec_acc = self.env["decimal.precision"].precision_get("Account")
pos_session = self.env["pos.session"].browse(pos_order["pos_session_id"])
if pos_session.state == "closing_control" or pos_session.state == "closed":
... | code_fim | hard | {
"lang": "python",
"repo": "ShaheenHossain/itpp-labs_pos-addons",
"path": "/pos_orders_history_return/models/pos_order.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShaheenHossain/itpp-labs_pos-addons path: /pos_orders_history_return/models/pos_order.py
# -*- coding: utf-8 -*-
# Copyright 2018 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>
# License MIT (https://opensource.org/licenses/MIT).
import logging
import psycopg2
from odoo import _,... | code_fim | hard | {
"lang": "python",
"repo": "ShaheenHossain/itpp-labs_pos-addons",
"path": "/pos_orders_history_return/models/pos_order.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> clinet = pymongo.MongoClient("localhost", 27017)
db = clinet["PornHub"]
self.PhRes = db["PhRes"]
idx = IndexModel([('link_url', ASCENDING)], unique=True)
self.PhRes.create_indexes([idx])
# if your existing DB has duplicate records, refer to:
# https:... | code_fim | medium | {
"lang": "python",
"repo": "leelovejava/Python-Learning",
"path": "/pornhubbot/PornHub/PornHub/pipelines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PornhubMongoDBPipeline(object):
def __init__(self):
clinet = pymongo.MongoClient("localhost", 27017)
db = clinet["PornHub"]
self.PhRes = db["PhRes"]
idx = IndexModel([('link_url', ASCENDING)], unique=True)
self.PhRes.create_indexes([idx])
# if your... | code_fim | medium | {
"lang": "python",
"repo": "leelovejava/Python-Learning",
"path": "/pornhubbot/PornHub/PornHub/pipelines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leelovejava/Python-Learning path: /pornhubbot/PornHub/PornHub/pipelines.py
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
<|fim_suffix|> print('... | code_fim | hard | {
"lang": "python",
"repo": "leelovejava/Python-Learning",
"path": "/pornhubbot/PornHub/PornHub/pipelines.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: callsSolve/core path: /tests/components/roku/test_config_flow.py
"""Test the Roku config flow."""
from socket import gaierror as SocketGIAError
from requests.exceptions import RequestException
from requests_mock import Mocker
from roku import RokuException
from homeassistant.components.roku.con... | code_fim | hard | {
"lang": "python",
"repo": "callsSolve/core",
"path": "/tests/components/roku/test_config_flow.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def test_form_unknown_error(hass: HomeAssistantType) -> None:
"""Test we handle unknown error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_USER}
)
user_input = {CONF_HOST: HOST}
with patch(
"homeassistant.components... | code_fim | hard | {
"lang": "python",
"repo": "callsSolve/core",
"path": "/tests/components/roku/test_config_flow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def test_import(hass: HomeAssistantType, requests_mock: Mocker) -> None:
"""Test the import step."""
mock_connection(requests_mock)
user_input = {CONF_HOST: HOST}
with patch(
"homeassistant.components.roku.async_setup", return_value=True
) as mock_setup, patch(
"... | code_fim | hard | {
"lang": "python",
"repo": "callsSolve/core",
"path": "/tests/components/roku/test_config_flow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __makeHasDependencyRole(self, res):
triples = []
for path in res['path']:
path_tokens = path.split('|')
if len(path_tokens) == 3:
triples.append((res['lhs'] , 'HAS_DEP_ROLE' , path_tokens[0]))
triples.append((res['rhs'] , 'HAS... | code_fim | hard | {
"lang": "python",
"repo": "ehsankddm/thesis",
"path": "/thesis-codes/riedel_data_reader/re/src/riedel_util/tripleMaker.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ehsankddm/thesis path: /thesis-codes/riedel_data_reader/re/src/riedel_util/tripleMaker.py
'''
Created on Sep 29, 2013
@author: ehsan
'''
class tripleMaker(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
pass
def __makeF... | code_fim | hard | {
"lang": "python",
"repo": "ehsankddm/thesis",
"path": "/thesis-codes/riedel_data_reader/re/src/riedel_util/tripleMaker.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_unit(self, unit_comp225):
assert unit_comp225.name == 'Algorithms and Data Structures'
assert unit_comp225.code == 'COMP225'
assert unit_comp225.period == '2019 Session 1'
assert unit_comp225.summary == ('One Weekly 115-Minutes Practical_1, '
'O... | code_fim | medium | {
"lang": "python",
"repo": "mqu45434344/mq-timetable-export",
"path": "/tests/test_integration.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mqu45434344/mq-timetable-export path: /tests/test_integration.py
import datetime
class TestTimetableIntegration:
def test_timetable_resources(self, timetable_resources):
assert timetable_resources.study_period_filters == {
'All': '0--Feb 26, 2019',
'2019 All ... | code_fim | hard | {
"lang": "python",
"repo": "mqu45434344/mq-timetable-export",
"path": "/tests/test_integration.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suyundukov/LIFAP1 path: /TD/TD2/Code/Python/6.py
#!/usr/bin/python
# Calculer la somme des chiffres qui composent un nombre
somme = 0
<|fim_suffix|>print('La somme des chiffres est égal à', somme)<|fim_middle|>print('Donne moi une valeur : ', end='')
a = int(input())
while a != 0:
somme += ... | code_fim | medium | {
"lang": "python",
"repo": "suyundukov/LIFAP1",
"path": "/TD/TD2/Code/Python/6.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('La somme des chiffres est égal à', somme)<|fim_prefix|># repo: suyundukov/LIFAP1 path: /TD/TD2/Code/Python/6.py
#!/usr/bin/python
# Calculer la somme des chiffres qui composent un nombre
somme = 0
<|fim_middle|>print('Donne moi une valeur : ', end='')
a = int(input())
while a != 0:
somme += ... | code_fim | medium | {
"lang": "python",
"repo": "suyundukov/LIFAP1",
"path": "/TD/TD2/Code/Python/6.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HAnNSharK/limix path: /limix/qc/_allele.py
from __future__ import division
def compute_maf(X):
r"""Compute minor allele frequencies.
It assumes that ``X`` encodes 0, 1, and 2 representing the number
of alleles (or dosage), or ``NaN`` to represent missing values.
Parameters
... | code_fim | medium | {
"lang": "python",
"repo": "HAnNSharK/limix",
"path": "/limix/qc/_allele.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(X, da.Array):
s0 = da.nansum(X, axis=0).compute()
denom = 2 * (X.shape[0] - da.isnan(X).sum(axis=0)).compute()
elif isinstance(X, DataFrame):
s0 = X.sum(axis=0, skipna=True)
denom = 2 * logical_not(X.isna()).sum(axis=0)
elif isinstance(X, xr.DataAr... | code_fim | hard | {
"lang": "python",
"repo": "HAnNSharK/limix",
"path": "/limix/qc/_allele.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = authentication.User.from_username('alice')
# participant in db should be updated
assert user.last_ach_result == ''
@mock.patch('gittip.billing.balanced.Account.find')
def test_associate_bank_account_invalid(self, find):
ex = balanced.exc.HTTPError('errrrrro... | code_fim | hard | {
"lang": "python",
"repo": "ChimeraCoder/www.gittip.com",
"path": "/tests/test_billing.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChimeraCoder/www.gittip.com path: /tests/test_billing.py
from __future__ import unicode_literals
import balanced
import mock
from nose.tools import assert_equals, assert_raises
import gittip
from gittip import authentication, billing
from gittip.testing import Harness
class TestBillingBase(Ha... | code_fim | hard | {
"lang": "python",
"repo": "ChimeraCoder/www.gittip.com",
"path": "/tests/test_billing.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ray-project/maze-raylit path: /rllib/utils/schedules/polynomial_schedule.py
from typing import Union
from ray.rllib.utils.annotations import override
from ray.rllib.utils.framework import try_import_tf, try_import_torch
from ray.rllib.utils.schedules.schedule import Schedule
from ray.rllib.utils... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/maze-raylit",
"path": "/rllib/utils/schedules/polynomial_schedule.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @override(Schedule)
def _tf_value_op(self, t: Union[int, TensorType]):
t = tf.math.minimum(t, self.schedule_timesteps)
return self.final_p + (self.initial_p - self.final_p) * (
1.0 - (t / self.schedule_timesteps))**self.power<|fim_prefix|># repo: ray-project/maze-raylit... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/maze-raylit",
"path": "/rllib/utils/schedules/polynomial_schedule.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> schedule_timesteps,
final_p,
framework,
initial_p=1.0,
power=2.0):
"""
Polynomial interpolation between initial_p and final_p over
schedule_timesteps. After this many time steps, always `final_p` i... | code_fim | medium | {
"lang": "python",
"repo": "ray-project/maze-raylit",
"path": "/rllib/utils/schedules/polynomial_schedule.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iitis/bmw_vehicle_opt path: /bmw_solver_qprogmods/helpers.py
from collections import defaultdict
import itertools as it
import logging
def check_group_features(sample, nv, problem, log):
fl = [ev.vars for ev in problem.exclusion_vars]
violate = []
for feat in fl:
for i in ra... | code_fim | hard | {
"lang": "python",
"repo": "iitis/bmw_vehicle_opt",
"path": "/bmw_solver_qprogmods/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for l in vars:
if sample[f"b_{i}_{l[1]}"] == 0:
return False
return True
# Returns True if all 0
def check_all_0(vars, i, sample):
for l in vars:
if sample[f"b_{i}_{l[1]}"] == 1:
return False
return True
def check_type_features(sample, nv, proble... | code_fim | hard | {
"lang": "python",
"repo": "iitis/bmw_vehicle_opt",
"path": "/bmw_solver_qprogmods/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> <Value active="True" name="sssd25-08"/>
<Value active="True" name="st_cqpf"/>
<Value active="True" name="st_cqpjk1"/>
<Value active="True" name="st_cqpjk2"/>
<Value active="True" name="st_e14"/>
<Value active="True" name="st_e17"/>
... | code_fim | hard | {
"lang": "python",
"repo": "ambros-gleixner/rubberband",
"path": "/rubberband/handlers/fe/evaluation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ambros-gleixner/rubberband path: /rubberband/handlers/fe/evaluation.py
<Value active="True" name="ex14_1_3"/>
<Value active="True" name="ex14_1_4"/>
<Value active="True" name="ex14_1_5"/>
<Value active="True" name="ex14_1_6"/>
<Value active="True" ... | code_fim | hard | {
"lang": "python",
"repo": "ambros-gleixner/rubberband",
"path": "/rubberband/handlers/fe/evaluation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> <Value active="True" name="waternd_fosspoly1"/>
<Value active="True" name="waternd_hanoi"/>
<Value active="True" name="waternd_modena"/>
<Value active="True" name="waternd_pescara"/>
<Value active="True" name="waternd_shamir"/>
<Value a... | code_fim | hard | {
"lang": "python",
"repo": "ambros-gleixner/rubberband",
"path": "/rubberband/handlers/fe/evaluation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: R2333333/VirturalCreature path: /geneticAlgorithm/robot.py
from math import tau
import constants as C
from random import random
class ROBOT:
def __init__(self, sim, wts=[[-1 for i in range(8)] for j in range(4)]):
self.send_objects(sim)
self.send_joints(sim)
self.send... | code_fim | hard | {
"lang": "python",
"repo": "R2333333/VirturalCreature",
"path": "/geneticAlgorithm/robot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #add sensor neurons
[setattr(self, f'SN{i}', sim.send_sensor_neuron( sensor_id = getattr(self, f'T{i}'))) for i in range(4)]
#add motor neuron
[setattr(self, f'MN{i + 4}', sim.send_motor_neuron( joint_id = getattr(self,f'J{i}'), tau=0.3)) for i in range(8)]
def send_sy... | code_fim | hard | {
"lang": "python",
"repo": "R2333333/VirturalCreature",
"path": "/geneticAlgorithm/robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: otcshare/chromium-src path: /components/policy/tools/template_writers/writers/ios_app_config_writer_unittest.py
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
... | code_fim | hard | {
"lang": "python",
"repo": "otcshare/chromium-src",
"path": "/components/policy/tools/template_writers/writers/ios_app_config_writer_unittest.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> policy_json = self._GetTestPolicyTemplate('ListPolicy', 'list')
expected = self._GetExpectedOutput('83.0.4089.0',
'<stringArray keyName="ListPolicy"/>')
output = self.GetOutput(policy_json, {
'_google_chrome': '1',
'version': '83.0.4089.0'... | code_fim | hard | {
"lang": "python",
"repo": "otcshare/chromium-src",
"path": "/components/policy/tools/template_writers/writers/ios_app_config_writer_unittest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for f in self.list_objects('LCIAMethod'):
u = uuid_regex.search(f).groups()[0]
try:
self._get_entity(u)
except KeyError:
self.load_lcia_method(u, **kwargs)
def generate_factors(self, quantity):
o = self._get_objectifi... | code_fim | hard | {
"lang": "python",
"repo": "msm-sardar/core",
"path": "/antelope_core/providers/ilcd/ilcd_lcia.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msm-sardar/core path: /antelope_core/providers/ilcd/ilcd_lcia.py
from .ilcd import IlcdArchive, typeDirs, get_flow_ref, uuid_regex, dtype_from_nsmap
from ..xml_widgets import *
from ...entities import LcEntity, LcQuantity, LcUnit
from .quantity import IlcdQuantityImplementation
from .index import... | code_fim | hard | {
"lang": "python",
"repo": "msm-sardar/core",
"path": "/antelope_core/providers/ilcd/ilcd_lcia.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GavinGuoWind/mongo-connector-2 path: /mongo_connector/gridfs_file.py
import gridfs
from mongo_connector import errors, util
wrap_exceptions = util.exception_wrapper({
gridfs.errors.CorruptGridFile: errors.OperationFailed
})
<|fim_suffix|> self._id = doc['_id']
self.f = gridf... | code_fim | medium | {
"lang": "python",
"repo": "GavinGuoWind/mongo-connector-2",
"path": "/mongo_connector/gridfs_file.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.length
@wrap_exceptions
def read(self, n=-1):
return self.f.read(n)<|fim_prefix|># repo: GavinGuoWind/mongo-connector-2 path: /mongo_connector/gridfs_file.py
import gridfs
from mongo_connector import errors, util
wrap_exceptions = util.exception_wrapper({
gridfs... | code_fim | hard | {
"lang": "python",
"repo": "GavinGuoWind/mongo-connector-2",
"path": "/mongo_connector/gridfs_file.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bcgov/sbc-pay path: /pay-api/tests/unit/api/test_statement_settings.py
# Copyright © 2019 Province of British Columbia
#
# 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": "bcgov/sbc-pay",
"path": "/pay-api/tests/unit/api/test_statement_settings.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> invoice: Invoice = Invoice.find_by_id(rv.json.get('id'))
pay_account: PaymentAccount = PaymentAccount.find_by_id(invoice.payment_account_id)
rv = client.get(f'/api/v1/accounts/{pay_account.auth_account_id}/statements/settings', data=json.dumps({}),
headers=headers)
ass... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/sbc-pay",
"path": "/pay-api/tests/unit/api/test_statement_settings.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == 'POST':
if request.is_json:
data = request.get_json()
redis_client.getset(data['redkey'], data['redval'])
return {"message": f"Key {data['redkey']} has been created successfully."}
else:
return {"error": "The request ... | code_fim | hard | {
"lang": "python",
"repo": "zeppertrek/my-python-sandpit",
"path": "/flask/flask_redis_exploration_001.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zeppertrek/my-python-sandpit path: /flask/flask_redis_exploration_001.py
#flask_redis_exploration_001.py
# set FLASK_APP=flask_redis_exploration_001.py
# set FLASK_DEBUG=1
# python -m flask run
# This will run a development server that is NOT meant to be used for production purposes
#
# Using... | code_fim | medium | {
"lang": "python",
"repo": "zeppertrek/my-python-sandpit",
"path": "/flask/flask_redis_exploration_001.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manjitullal/spatiotemporal path: /src/Transformer-hawkes-process/Main.py
import argparse
import numpy as np
import pickle
import time
import torch
import torch.nn as nn
import torch.optim as optim
import transformer.Constants as Constants
import Utils
from preprocess.Dataset import get_dataload... | code_fim | hard | {
"lang": "python",
"repo": "manjitullal/spatiotemporal",
"path": "/src/Transformer-hawkes-process/Main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('[Info] parameters: {}'.format(opt))
dataobj = foursquare()
#dataobj = Earthquakes()
#dataobj = NycTaxi()
""" prepare dataloader """
trainloader, validationloader, testloader, num_types = prepare_dataloader(opt, dataobj)
""" prepare model """
model = Transformer(
... | code_fim | hard | {
"lang": "python",
"repo": "manjitullal/spatiotemporal",
"path": "/src/Transformer-hawkes-process/Main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mval = args[0]
i = 0
while i < len(args):
if mval < args[i]:
mval = args[i]
i = i+1
return mval
p = maximum(1,3,4,5,7)
print p
q = mv(3,4,6,8)
print q<|fim_prefix|># repo: srikanteswartalluri/pyutils path: /pythontraining/maximum.py
__author__ = 'talluri'
def ... | code_fim | medium | {
"lang": "python",
"repo": "srikanteswartalluri/pyutils",
"path": "/pythontraining/maximum.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srikanteswartalluri/pyutils path: /pythontraining/maximum.py
__author__ = 'talluri'
def maximum(*args):
<|fim_suffix|> mval = args[0]
i = 0
while i < len(args):
if mval < args[i]:
mval = args[i]
i = i+1
return mval
p = maximum(1,3,4,5,7)
print p
q = mv(... | code_fim | medium | {
"lang": "python",
"repo": "srikanteswartalluri/pyutils",
"path": "/pythontraining/maximum.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>def assign_selective_pressure(df):
'''
Takes a datafame with hyphy results and assign a column displaying
the type of selective pressure in each residue.
'''
episodic_selection = []
for index, row in df.iterrows():
if row['p-value'] <= 0.05:
episodic_selection.a... | code_fim | medium | {
"lang": "python",
"repo": "tomasMasson/sfmnpv_genomics",
"path": "/molecular_evolution/parse_hyphy_meme.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
'''Command line argument parser.'''
parser = argparse.ArgumentParser()
parser.add_argument('hyphy',
help='File with hyphy results in .json format')
parser.add_argument('Alignment',
help='Sequence alignment used to filter codons c... | code_fim | hard | {
"lang": "python",
"repo": "tomasMasson/sfmnpv_genomics",
"path": "/molecular_evolution/parse_hyphy_meme.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomasMasson/sfmnpv_genomics path: /molecular_evolution/parse_hyphy_meme.py
#!/usr/bin/env python3
from Bio import AlignIO
import csv
import json
import pandas as pd
import argparse
def parse_hyphy(hyphy_file):
'''
Takes an hyphy output file and returns two lists, for the data and heade... | code_fim | hard | {
"lang": "python",
"repo": "tomasMasson/sfmnpv_genomics",
"path": "/molecular_evolution/parse_hyphy_meme.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SHIVJITH/Odoo_Machine_Test path: /addons/mrp_subcontracting/models/__init__.py
# -*- coding: utf-8 -*-
from . import mrp_bom
from . import product
fr<|fim_suffix|>ve
from . import stock_move_line
from . import stock_picking
from . import stock_rule
from . import stock_warehouse
from . import mrp... | code_fim | medium | {
"lang": "python",
"repo": "SHIVJITH/Odoo_Machine_Test",
"path": "/addons/mrp_subcontracting/models/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rt stock_rule
from . import stock_warehouse
from . import mrp_production<|fim_prefix|># repo: SHIVJITH/Odoo_Machine_Test path: /addons/mrp_subcontracting/models/__init__.py
# -*- coding: utf-8 -*-
from . import mrp_bom
from . import product
from . import res_company
from . import res_partner
from . impo... | code_fim | medium | {
"lang": "python",
"repo": "SHIVJITH/Odoo_Machine_Test",
"path": "/addons/mrp_subcontracting/models/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__=="__main__":
main()<|fim_prefix|># repo: DSE512/twelve path: /examples/module_04_measure/viztracer/serial_images.py
from twelve.data import Images
from viztracer import VizTracer
def main():
tracer = VizTracer()
tracer.start()
images = Images("img")
<|fim_middle|> trace... | code_fim | medium | {
"lang": "python",
"repo": "DSE512/twelve",
"path": "/examples/module_04_measure/viztracer/serial_images.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DSE512/twelve path: /examples/module_04_measure/viztracer/serial_images.py
from twelve.data import Images
from viztracer import VizTracer
<|fim_suffix|> tracer = VizTracer()
tracer.start()
images = Images("img")
tracer.stop()
tracer.save("viztrace_results.html")
if __name... | code_fim | easy | {
"lang": "python",
"repo": "DSE512/twelve",
"path": "/examples/module_04_measure/viztracer/serial_images.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: talhakoylu/SummerInternshipBackend path: /bookorbooks/country/api/views/country_views.py
from rest_framework.generics import ListAPIView, RetrieveAPIView
from country.models import Country
from country.api.serializers import CountrySerializer, CountryDetailWithCitySerializer
<|fim_suffix|> q... | code_fim | medium | {
"lang": "python",
"repo": "talhakoylu/SummerInternshipBackend",
"path": "/bookorbooks/country/api/views/country_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = Country.objects.all()
serializer_class = CountrySerializer
class CountryDetailAPIView(RetrieveAPIView):
queryset = Country.objects.all()
serializer_class = CountryDetailWithCitySerializer
lookup_url_kwarg = 'code'
lookup_field = 'code__iexact'<|fim_prefix|># repo: talha... | code_fim | medium | {
"lang": "python",
"repo": "talhakoylu/SummerInternshipBackend",
"path": "/bookorbooks/country/api/views/country_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = Country.objects.all()
serializer_class = CountryDetailWithCitySerializer
lookup_url_kwarg = 'code'
lookup_field = 'code__iexact'<|fim_prefix|># repo: talhakoylu/SummerInternshipBackend path: /bookorbooks/country/api/views/country_views.py
from rest_framework.generics import Lis... | code_fim | medium | {
"lang": "python",
"repo": "talhakoylu/SummerInternshipBackend",
"path": "/bookorbooks/country/api/views/country_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(isinstance(
self.mocked_object.get_customers({"page": "2"}), dict))
def test_get_customer(self) -> None:
self.assertTrue(isinstance(self.mocked_object.get_customer("3"), dict))
def test_create_customer(self) -> None:
self.assertTrue(isinstance(... | code_fim | medium | {
"lang": "python",
"repo": "BolZer/py-ebrest",
"path": "/easybill_rest/tests/test_customers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(isinstance(
self.mocked_object.create_customer({"last_name": "test"}), dict))
def test_update_customer(self) -> None:
self.assertTrue(
isinstance(
self.mocked_object.update_customer(
"3", {
... | code_fim | hard | {
"lang": "python",
"repo": "BolZer/py-ebrest",
"path": "/easybill_rest/tests/test_customers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BolZer/py-ebrest path: /easybill_rest/tests/test_customers.py
import unittest
from unittest import mock
from easybill_rest import Client
from easybill_rest.resources.resource_customers import ResourceCustomers
from easybill_rest.tests.test_case_abstract import EasybillRestTestCaseAbstract
clas... | code_fim | hard | {
"lang": "python",
"repo": "BolZer/py-ebrest",
"path": "/easybill_rest/tests/test_customers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc151-abc200/abc170/b.py
# -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
<|fim_suffix|> if crane >= 0 and turtle >= 0 and crane % 2 == 0 and turtle % 2 == 0:
print('Yes')
else:
print('No')
if ... | code_fim | medium | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/ABC/abc151-abc200/abc170/b.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if crane >= 0 and turtle >= 0 and crane % 2 == 0 and turtle % 2 == 0:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc151-abc200/abc170/b.py
# -*- coding: utf-8 -*-
def main():
import sys
... | code_fim | medium | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/ABC/abc151-abc200/abc170/b.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lemonad/tratten path: /tratten/issues/views.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from datetime import datetime
import simplejson
import time
import socket
from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpRe... | code_fim | hard | {
"lang": "python",
"repo": "lemonad/tratten",
"path": "/tratten/issues/views.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Issue creation done."""
description = get_flatcontent('issue-creation-done-text')
t = loader.get_template('done.html')
c = RequestContext(request,
{'description': description})
return HttpResponse(t.render(c))
def list(request):
"""List issues."""
... | code_fim | hard | {
"lang": "python",
"repo": "lemonad/tratten",
"path": "/tratten/issues/views.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anajulijapreseren/Programiranje_izpiti path: /stari_izpiti/zabica_2019.py
mocvara = [10]*50
from functools import lru_cache
def frog_escape(swamp):
<|fim_suffix|> if k >= len(swamp):
return 0
else:
e += swamp[k]
return 1 + min([escape(k + d, ... | code_fim | easy | {
"lang": "python",
"repo": "anajulijapreseren/Programiranje_izpiti",
"path": "/stari_izpiti/zabica_2019.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if k >= len(swamp):
return 0
else:
e += swamp[k]
return 1 + min([escape(k + d, e - d) for d in range(1, e + 1)])
return escape(0, 0)<|fim_prefix|># repo: anajulijapreseren/Programiranje_izpiti path: /stari_izpiti/zabica_2019.py
mocvara = [10]*50
... | code_fim | medium | {
"lang": "python",
"repo": "anajulijapreseren/Programiranje_izpiti",
"path": "/stari_izpiti/zabica_2019.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Deeplodocus/deeplodocus path: /deeplodocus/app/transforms/yolo/label.py
import numpy as np
from deeplodocus.utils.notification import Notification
from deeplodocus.flags.notif import DEEP_NOTIF_WARNING
def reformat(x, image_shape, n_obj=100):
# Initialize label array
label = np.empty((... | code_fim | hard | {
"lang": "python",
"repo": "Deeplodocus/deeplodocus",
"path": "/deeplodocus/app/transforms/yolo/label.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def scale(label, image_shape):
# Where label box is not all -1, multiple by (w, h, w, h)
label[~ np.all(label == -1, axis=1), 0:4] *= np.tile(np.array(image_shape), 2).reshape(1, -1)
return label, None<|fim_prefix|># repo: Deeplodocus/deeplodocus path: /deeplodocus/app/transforms/yolo/label.p... | code_fim | medium | {
"lang": "python",
"repo": "Deeplodocus/deeplodocus",
"path": "/deeplodocus/app/transforms/yolo/label.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shulyaka/zha-device-handlers path: /zhaquirks/xiaomi/aqara/sensor_ht_agl02.py
"""Quirk for LUMI lumi.sensor_ht.agl02."""
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration
from zigpy.zcl.clusters.measurement import (
PressureMeasure... | code_fim | hard | {
"lang": "python",
"repo": "Shulyaka/zha-device-handlers",
"path": "/zhaquirks/xiaomi/aqara/sensor_ht_agl02.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Init."""
self.temperature_bus = Bus()
self.humidity_bus = Bus()
self.pressure_bus = Bus()
super().__init__(*args, **kwargs)
signature = {
MODELS_INFO: [("LUMI", "lumi.sensor_ht.agl02")],
ENDPOINTS: {
1: {
PROFILE_I... | code_fim | hard | {
"lang": "python",
"repo": "Shulyaka/zha-device-handlers",
"path": "/zhaquirks/xiaomi/aqara/sensor_ht_agl02.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class LumiSensorHtAgl02(XiaomiCustomDevice):
"""Lumi lumi.sensor_ht.agl02 custom device implementation."""
def __init__(self, *args, **kwargs):
"""Init."""
self.temperature_bus = Bus()
self.humidity_bus = Bus()
self.pressure_bus = Bus()
super().__init__(*a... | code_fim | hard | {
"lang": "python",
"repo": "Shulyaka/zha-device-handlers",
"path": "/zhaquirks/xiaomi/aqara/sensor_ht_agl02.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miaozaiye/PythonLearning path: /miaozaiye/introcs-python/helloworld.py
#-----------------------------------------------------------------------
# helloworld.py
#-----------------------------------------------------------------------
import stdio
<|fim_suffix|># python helloworld.py
# Hello, Wor... | code_fim | medium | {
"lang": "python",
"repo": "miaozaiye/PythonLearning",
"path": "/miaozaiye/introcs-python/helloworld.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#-----------------------------------------------------------------------
# python helloworld.py
# Hello, World<|fim_prefix|># repo: miaozaiye/PythonLearning path: /miaozaiye/introcs-python/helloworld.py
#-----------------------------------------------------------------------
# helloworld.py
#-----------... | code_fim | medium | {
"lang": "python",
"repo": "miaozaiye/PythonLearning",
"path": "/miaozaiye/introcs-python/helloworld.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hoshizorak10/bilibli-danmu path: /blibli-danmu.py
import threading
import time
import tkinter.simpledialog # 使用Tkinter前需要先导入
from tkinter import END, messagebox
import requests
# 全局变量,用于标识线程是否退出
is_exit = True
# B站获取弹幕对象
class Danmu():
def __init__(self, room_id):
# 弹幕url
... | code_fim | hard | {
"lang": "python",
"repo": "hoshizorak10/bilibli-danmu",
"path": "/blibli-danmu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
room = e1.get()
room_int = int(room)
e1.configure(state=tkinter.DISABLED)
b1.configure(state=tkinter.DISABLED)
b2.configure(state=tkinter.NORMAL)
if room_int is not None:
global is_exit
is_exit = False
t = Bilibil... | code_fim | hard | {
"lang": "python",
"repo": "hoshizorak10/bilibli-danmu",
"path": "/blibli-danmu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# 停止
def end_point():
global is_exit
is_exit = True
e1.configure(state=tkinter.NORMAL)
b1.configure(state=tkinter.NORMAL)
b2.configure(state=tkinter.DISABLED)
# 创建并放置两个按钮分别触发两种情况
b1 = tkinter.Button(frame_t, text='开始', width=10, command=start_point, font=('Arial', 10))
b1.pack(side=... | code_fim | hard | {
"lang": "python",
"repo": "hoshizorak10/bilibli-danmu",
"path": "/blibli-danmu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: usc-ee250-spring2021/lab05-the-duo path: /ee250/lab05/rpi_pub_and_sub.py
"""EE 250L Lab 04 Starter Code
Jeffrey Liu
Aaron Sesay
https://github.com/usc-ee250-spring2021/lab05-the-duo.git
Run rpi_pub_and_sub.py on your Raspberry Pi."""
import paho.mqtt.client as mqtt
import time
import grovepi
#im... | code_fim | hard | {
"lang": "python",
"repo": "usc-ee250-spring2021/lab05-the-duo",
"path": "/ee250/lab05/rpi_pub_and_sub.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
#this section is covered in publisher_and_subscriber_example.py
client = mqtt.Client()
client.on_message = on_message
client.on_connect = on_connect
client.connect(host="eclipse.usc.edu", port=11000, keepalive=60)
client.loop_start()
while True:
... | code_fim | hard | {
"lang": "python",
"repo": "usc-ee250-spring2021/lab05-the-duo",
"path": "/ee250/lab05/rpi_pub_and_sub.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
#print("delete this line")
y = grovepi.ultrasonicRead(ultrasonicRanger)
#print(y)
z = str(y)
#print(z)
buttonpress = grovepi.digitalRead(button)
#print(buttonpress)
buttonstring = str(buttonpress)
c... | code_fim | hard | {
"lang": "python",
"repo": "usc-ee250-spring2021/lab05-the-duo",
"path": "/ee250/lab05/rpi_pub_and_sub.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_source_name_from_slice(slice_path):
if ".c." in slice_path:
source_path = slice_path.split(".c.")[0] + ".c"
else:
source_path = slice_path.split(".h.")[0] + ".h"
return source_path
def get_identifier_from_slice(slice_path):
if ".c." in slice_path:
source_p... | code_fim | hard | {
"lang": "python",
"repo": "walkerever/FixMorph",
"path": "/app/common/utilities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def extract_project_path(source_path):
logger.trace(__name__ + ":" + sys._getframe().f_code.co_name, locals())
if values.CONF_PATH_A + "/" in source_path:
return values.CONF_PATH_A
elif values.CONF_PATH_B in source_path:
return values.CONF_PATH_B
elif values.Project_D.path... | code_fim | hard | {
"lang": "python",
"repo": "walkerever/FixMorph",
"path": "/app/common/utilities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: walkerever/FixMorph path: /app/common/utilities.py
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
import pickle
import shutil
from app.tools import emitter, logger
from app.common import definitions, values
def id_from_string(simplestring):
return int(simplestring.split("("... | code_fim | hard | {
"lang": "python",
"repo": "walkerever/FixMorph",
"path": "/app/common/utilities.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ibis-project/ibis path: /ibis/expr/builders.py
from __future__ import annotations
import math
from typing import TYPE_CHECKING, Literal, Optional, Union
import ibis.expr.datashape as ds
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
import ibis.expr.rules as rlz
import ibis... | code_fim | hard | {
"lang": "python",
"repo": "ibis-project/ibis",
"path": "/ibis/expr/builders.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if start and not start.dtype.is_integer():
return self.range
elif end and not end.dtype.is_integer():
return self.range
else:
return self.rows
def _validate_boundaries(self, start, end):
start_, end_ = -math.inf, math.inf
if ... | code_fim | hard | {
"lang": "python",
"repo": "ibis-project/ibis",
"path": "/ibis/expr/builders.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohsinkhn/standford-covid-vaccine-kaggle path: /constants.py
from pathlib import Path
class FilePaths:
def __init__(self, input_path):
<|fim_suffix|>
class Mappings:
structure_token2int = {s: i + 1 for i, s in enumerate("(.)")}
sequence_token2int = {s: i + 1 for i, s in enumerate("A... | code_fim | hard | {
"lang": "python",
"repo": "mohsinkhn/standford-covid-vaccine-kaggle",
"path": "/constants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> structure_token2int = {s: i + 1 for i, s in enumerate("(.)")}
sequence_token2int = {s: i + 1 for i, s in enumerate("ACGU")}
pl_token2int = {s: i + 1 for i, s in enumerate("BEHIMSX")}
TGT_COLS = ["reactivity", "deg_Mg_pH10", "deg_Mg_50C"]<|fim_prefix|># repo: mohsinkhn/standford-covid-vaccine... | code_fim | medium | {
"lang": "python",
"repo": "mohsinkhn/standford-covid-vaccine-kaggle",
"path": "/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_deprecated_elf_values(self):
old_stuff = (
"Elf.X86_64",
"Elf.X86_32",
"Elf.ARM",
"Elf.MIPS",
"Elf.POWERPC",
"Elf.POWERPC64",
"Elf.SPARC",
"Elf.SPARC64",
"Elf.AARCH64",
... | code_fim | hard | {
"lang": "python",
"repo": "hugsy/gef",
"path": "/tests/api/deprecated.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> old_stuff = (
"Elf.X86_64",
"Elf.X86_32",
"Elf.ARM",
"Elf.MIPS",
"Elf.POWERPC",
"Elf.POWERPC64",
"Elf.SPARC",
"Elf.SPARC64",
"Elf.AARCH64",
"Elf.RISCV",
)
for it... | code_fim | hard | {
"lang": "python",
"repo": "hugsy/gef",
"path": "/tests/api/deprecated.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hugsy/gef path: /tests/api/deprecated.py
"""
test module for deprecated functions
"""
import pytest
from tests.utils import (
gdb_test_python_method,
GefUnitTestGeneric,
)
<|fim_suffix|> old_stuff = (
"Elf.X86_64",
"Elf.X86_32",
"Elf.ARM",
... | code_fim | hard | {
"lang": "python",
"repo": "hugsy/gef",
"path": "/tests/api/deprecated.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trdwll/imglnx path: /imglnx/urls.py
"""
BSD 3-Clause License
Copyright (c) 2016-2019 Russ 'trdwll' Treadwell. All rights reserved.
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth.views import logout
from django.views.generic import Template... | code_fim | hard | {
"lang": "python",
"repo": "trdwll/imglnx",
"path": "/imglnx/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # auth urls here, because they're just redirects
url(r'^auth/login/?$', accounts.views.LoginUser.as_view(), name='login'),
url(r'^auth/register/?$', accounts.views.RegisterUser.as_view(), name='register'),
#url(r'^auth/forgot/?$', accounts.views.forgot_user.as_view(), name='forgot'),
#url(r'^auth/for... | code_fim | medium | {
"lang": "python",
"repo": "trdwll/imglnx",
"path": "/imglnx/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: massenergize/api path: /src/database/migrations/0130_policyacceptancerecords.py
# Generated by Django 3.1.14 on 2023-04-17 00:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.... | code_fim | hard | {
"lang": "python",
"repo": "massenergize/api",
"path": "/src/database/migrations/0130_policyacceptancerecords.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='PolicyAcceptanceRecords',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('signed_at', models.DateTimeField(blank=True, null=True)),... | code_fim | hard | {
"lang": "python",
"repo": "massenergize/api",
"path": "/src/database/migrations/0130_policyacceptancerecords.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return self.title<|fim_prefix|># repo: E-M-Inc/Ecommerce-Shopping-App path: /backend/models/carrouselPromos.py
from django.db import models
from backend.utils import carrouselImages_path_and_rename
class carrouselPromo(models.Model):
<|fim_middle|> title = models.CharF... | code_fim | medium | {
"lang": "python",
"repo": "E-M-Inc/Ecommerce-Shopping-App",
"path": "/backend/models/carrouselPromos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: E-M-Inc/Ecommerce-Shopping-App path: /backend/models/carrouselPromos.py
from django.db import models
from backend.utils import carrouselImages_path_and_rename
<|fim_suffix|> def __str__(self):
return self.title<|fim_middle|>class carrouselPromo(models.Model):
title = models.CharF... | code_fim | hard | {
"lang": "python",
"repo": "E-M-Inc/Ecommerce-Shopping-App",
"path": "/backend/models/carrouselPromos.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dragorhast/server path: /server/views/__init__.py
"""
.. autoclasstree:: server.views
This package contains the server API for viewing,
renting, reserving, and manipulating bikes.
API Conventions
---------------
The API conforms as best as possible to the REST standard. For a quick primer, loo... | code_fim | hard | {
"lang": "python",
"repo": "dragorhast/server",
"path": "/server/views/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def register_views(app: Application, base: str):
"""
Registers all the API views onto the given router at a specific root url.
:param app: The app to register the views to.
:param base: The base URL.
"""
cors = aiohttp_cors.setup(app)
for view in views:
logger.info("R... | code_fim | hard | {
"lang": "python",
"repo": "dragorhast/server",
"path": "/server/views/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benjaminkomen/TWMigrationBot path: /items.py
from osutils import data_filepath
from twtemplate import TWTemplate
from objects import ObjectTemplate
from mwparserfromhell.nodes.extras import Parameter
class ItemTemplate(TWTemplate):
# Generate a list of item parameters from the data file.
... | code_fim | medium | {
"lang": "python",
"repo": "benjaminkomen/TWMigrationBot",
"path": "/items.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> PARAMETER_NORM_TO_OUTPUT = {
# TODO "lowercase_normalised": "actual_parameter_name"
}
def __init__(self):
super().__init__()
def get_valid_parameters(self):
return self.SUPPORTED_PARAMETERS
def is_valid(self):
valid = True
# TODO
... | code_fim | hard | {
"lang": "python",
"repo": "benjaminkomen/TWMigrationBot",
"path": "/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> MAP_EQUIVALENT_OBJECT_PARAMETER = {
'type': 'weapontype'
}
@staticmethod
def map_item2object_param_name(pname):
pname = str(pname)
if pname in ItemTemplate.MAP_EQUIVALENT_OBJECT_PARAMETER:
pname = ItemTemplate.MAP_EQUIVALENT_OBJECT_PARAMETER[str(pname)]
... | code_fim | medium | {
"lang": "python",
"repo": "benjaminkomen/TWMigrationBot",
"path": "/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bushubeke/python-compose path: /nginix+gunicorn+flask/gunirest/project/app/appsock/testsock.py
from . import *
current_num=[0]
<|fim_suffix|> emit('update', current_num[-1])
@socketio.on('plusone' )
def tell_add(msg):
current_num
result=current_num[-1]+1
current_num.append(result)
emit... | code_fim | easy | {
"lang": "python",
"repo": "bushubeke/python-compose",
"path": "/nginix+gunicorn+flask/gunirest/project/app/appsock/testsock.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> current_num
result=current_num[-1]+1
current_num.append(result)
emit('update', result,broadcast=True)<|fim_prefix|># repo: bushubeke/python-compose path: /nginix+gunicorn+flask/gunirest/project/app/appsock/testsock.py
from . import *
current_num=[0]
@socketio.on('connect')
def joinning_add():
... | code_fim | easy | {
"lang": "python",
"repo": "bushubeke/python-compose",
"path": "/nginix+gunicorn+flask/gunirest/project/app/appsock/testsock.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.