text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: isovic/graphmap-reproduce path: /src/evaluate_events.py
#! /usr/bin/python
import os;
import sys;
import math;
import random;
class StructEvent:
def __init__(self, size=0, type='', position=0):
self.size = size;
self.type = type;
self.position = position;
self.position_final = position... | code_fim | hard | {
"lang": "python",
"repo": "isovic/graphmap-reproduce",
"path": "/src/evaluate_events.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return False;
def evaluate_event(event, truth_events, allowed_percent_variation):
event_distances = [];
allowed_distance = event.size * allowed_percent_variation;
for truth_event in truth_events:
event_start = event.position;
event_end = event.position + event.size;
truth_event_start = truth_... | code_fim | hard | {
"lang": "python",
"repo": "isovic/graphmap-reproduce",
"path": "/src/evaluate_events.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res[numCaw] += int(line,2)
for k in res: print(k)<|fim_prefix|># repo: LorranSutter/URI-Online-Judge path: /Beginner/1848.py
numCaw = 0
res = [0,0,0]
while numCaw < 3:
line = in<|fim_middle|>put()
if line == 'caw caw':
numCaw += 1
else:
line = line.replace('*','1').r... | code_fim | medium | {
"lang": "python",
"repo": "LorranSutter/URI-Online-Judge",
"path": "/Beginner/1848.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LorranSutter/URI-Online-Judge path: /Beginner/1848.py
numCaw = 0
res = [0,0,0]
while numCaw < 3:
line = in<|fim_suffix|>se:
line = line.replace('*','1').replace('-','0')
res[numCaw] += int(line,2)
for k in res: print(k)<|fim_middle|>put()
if line == 'caw caw':
nu... | code_fim | easy | {
"lang": "python",
"repo": "LorranSutter/URI-Online-Judge",
"path": "/Beginner/1848.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/mindspore path: /tests/st/ops/gpu/test_kl_div_op.py
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/st/ops/gpu/test_kl_div_op.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert np.allclose(dx[0].asnumpy(), dx1_expect)
@pytest.mark.level1
@pytest.mark.platform_x86_gpu_training
@pytest.mark.env_onecard
def test_kl_div_loss_grad_float64():
"""
Feature: Test KLDivLossGrad.
Description: Test KLDivLossGrad op with float inputs.
Expectation: The r... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/st/ops/gpu/test_kl_div_op.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = convert_to_output_format({"c": 1, "b": 2, "a": 3})
expected_out = "a_3__b_2__c_1"
self.assertEqual(out, expected_out)<|fim_prefix|># repo: blue-yonder/tsfresh path: /tests/units/utilities/test_string_manipilations.py
# -*- coding: utf-8 -*-
# This file as well as the whole t... | code_fim | hard | {
"lang": "python",
"repo": "blue-yonder/tsfresh",
"path": "/tests/units/utilities/test_string_manipilations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = convert_to_output_format({"list": [1, 2, 4]})
expected_out = "list_[1, 2, 4]"
self.assertEqual(out, expected_out)
out = convert_to_output_format({"list": ["a", "b", "c"]})
expected_out = "list_['a', 'b', 'c']"
self.assertEqual(out, expected_out)
... | code_fim | hard | {
"lang": "python",
"repo": "blue-yonder/tsfresh",
"path": "/tests/units/utilities/test_string_manipilations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blue-yonder/tsfresh path: /tests/units/utilities/test_string_manipilations.py
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
from unittest import ... | code_fim | hard | {
"lang": "python",
"repo": "blue-yonder/tsfresh",
"path": "/tests/units/utilities/test_string_manipilations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> serializer = self.serializer_class(
data=request.data, instance=request.user)
if serializer.is_valid():
serializer.save()
return Response(serializer.validated_data)
raise ParseError(serializer.errors)
class RegisterUserView(APIView):
""" Re... | code_fim | hard | {
"lang": "python",
"repo": "wcreis/Real-World-App-Django-Sapper",
"path": "/server/authentication/api/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wcreis/Real-World-App-Django-Sapper path: /server/authentication/api/views.py
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from rest_fram... | code_fim | hard | {
"lang": "python",
"repo": "wcreis/Real-World-App-Django-Sapper",
"path": "/server/authentication/api/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rafaspadilha/temporal-sorting-event path: /hierarchical/testing_singleBvAClassifier.py
##################################################
# Padilha et al., "Temporally sorting images from real-world events",
# Pattern Recognition Letters, 2021
#
# Code for testing a single BvA classifier on the b... | code_fim | medium | {
"lang": "python",
"repo": "rafaspadilha/temporal-sorting-event",
"path": "/hierarchical/testing_singleBvAClassifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for batch, labelList in tl.loadValBatch(setAorB, batchSize = 1):
predList = model.predict_on_batch(batch)
y_pred = np.argmax(predList)
y_true = np.argmax(labelList)
if y_true == 0:
nBefore += 1
if y_pred == 0:
cBefore += 1
elif y_true == 1:
nAfter +... | code_fim | medium | {
"lang": "python",
"repo": "rafaspadilha/temporal-sorting-event",
"path": "/hierarchical/testing_singleBvAClassifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f"{self.name}-{self.split}-image", f"{self.name}-{self.split}-segment"
def shapes(self):
return (3, 500, 500), (500, 500)
def dtypes(self):
return self.sample_img.dtype, self.sample_seg.dtype
def variability_status(self):
return True, True
@classm... | code_fim | hard | {
"lang": "python",
"repo": "TrendingTechnology/stockroom",
"path": "/stockroom/external/importer/torchvision_importers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TrendingTechnology/stockroom path: /stockroom/external/importer/torchvision_importers.py
import numpy as np
from stockroom.external.importer.base import BaseImporter
try:
from torchvision import datasets # type: ignore
except ModuleNotFoundError:
pass
class TorchvisionCommon(BaseImpor... | code_fim | hard | {
"lang": "python",
"repo": "TrendingTechnology/stockroom",
"path": "/stockroom/external/importer/torchvision_importers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert split in ["train", "trainval", "val"]
self.split = split
self.dataset = datasets.VOCSegmentation(root, image_set=split, download=True)
self.sample_img, self.sample_seg = self._process_data(*self.dataset[0])
def column_names(self):
return f"{self.name}-{s... | code_fim | hard | {
"lang": "python",
"repo": "TrendingTechnology/stockroom",
"path": "/stockroom/external/importer/torchvision_importers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Diogo-Felipe/Algoritmos-e-Estruturas-de-Dados path: /Python/arvore_binaria_de_busca.py
# Arvore Binaria de Busca em Python
# Kelvin Salton do Prado
# 2015
class Arvore:
def __init__(self, chave):
self.chave = chave
self.esquerda = None
self.direita = None
#########... | code_fim | hard | {
"lang": "python",
"repo": "Diogo-Felipe/Algoritmos-e-Estruturas-de-Dados",
"path": "/Python/arvore_binaria_de_busca.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> buscaRecursiva(arvore, 6) # Busca que imprime na propria funcao
if buscaLinear(arvore, 6) is not None: # Retorna o NO ou None se nao encontrou
print('Valor encontrado')
else:
print('Valor nao encontrado')
print(f'Altura: {altura(arvore)}')
# Exclui varios valores
... | code_fim | hard | {
"lang": "python",
"repo": "Diogo-Felipe/Algoritmos-e-Estruturas-de-Dados",
"path": "/Python/arvore_binaria_de_busca.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
arvore = Arvore(3) # Cria arvore (raiz)
# Insere varios valores na arvore
arvore = insere(arvore, 2)
arvore = insere(arvore, 1)
arvore = insere(arvore, 4)
arvore = insere(arvore, 6)
arvore = insere(arvore, 8)
arvore = insere(arvore, 5)
arvore ... | code_fim | hard | {
"lang": "python",
"repo": "Diogo-Felipe/Algoritmos-e-Estruturas-de-Dados",
"path": "/Python/arvore_binaria_de_busca.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elecun/pyface path: /R2Euler.py
# -*- coding:utf-8 -*-
'''
3 X 3 Rotation Matrix to Euler Angle
R = Rz * Ry * Rx
'''
import math
import numpy as np
from os import listdir
from os.path import isfile, join
import re
import matplotlib.pyplot as plt
'''
Convert Radian to Degree
'''
def Rad2Deg(val... | code_fim | hard | {
"lang": "python",
"repo": "elecun/pyface",
"path": "/R2Euler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 1. find files
path = "H:/Experiment/OFace Head pose accuracy/dataset/"
files = []
filelist = [f for f in listdir(path) if isfile(join(path, f))]
for file in filelist:
if file.endswith(".txt"):
files.append(join(path, file))
print("Found ", len(files), " Files... | code_fim | medium | {
"lang": "python",
"repo": "elecun/pyface",
"path": "/R2Euler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for image in images:
updater.bot.send_message(chat_id=config.q2tg[friend.id], text=image.url)
#TODO 不支持处理文件
if message.messageChain.hasComponent(XmlMessage):
xml=message.messageChain.getAllofComponent(XmlMessage)[0]
updater.bot.send_message(chat_... | code_fim | hard | {
"lang": "python",
"repo": "JulianDroske/Q2TG-PM",
"path": "/q2tg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if message.messageChain.hasComponent(JsonMessage):
xml=message.messageChain.getAllofComponent(JsonMessage)[0]
updater.bot.send_message(chat_id=config.q2tg[friend.id], text=xml)
if message.messageChain.hasComponent(LightApp):
updater.bot.send_message(chat_i... | code_fim | hard | {
"lang": "python",
"repo": "JulianDroske/Q2TG-PM",
"path": "/q2tg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JulianDroske/Q2TG-PM path: /q2tg.py
from mirai import FriendMessage, Friend, Plain, Image, XmlMessage, JsonMessage, LightApp
import config
from appmgr import updater
def msg(friend: Friend, message: FriendMessage):
if config.q2tg[friend.id]:
if message.messageChain.hasComponent(Plai... | code_fim | hard | {
"lang": "python",
"repo": "JulianDroske/Q2TG-PM",
"path": "/q2tg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
[{'a': 'A', 'c': 'C'}, {'b': 'B', 'c': 'D'}]
c = C
[{'b': 'B', 'c': 'D'}, {'a': 'A', 'c': 'C'}]
c = D
"""<|fim_prefix|># repo: Nobodylesszb/python_module path: /data_structures/collections/chainMap/collections_chainmap_reorder.py
import collections
a = {'a': 'A', 'c': 'C'}
b = {'b': 'B', 'c': 'D'}
... | code_fim | easy | {
"lang": "python",
"repo": "Nobodylesszb/python_module",
"path": "/data_structures/collections/chainMap/collections_chainmap_reorder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>[{'b': 'B', 'c': 'D'}, {'a': 'A', 'c': 'C'}]
c = D
"""<|fim_prefix|># repo: Nobodylesszb/python_module path: /data_structures/collections/chainMap/collections_chainmap_reorder.py
import collections
a = {'a': 'A', 'c': 'C'}
b = {'b': 'B', 'c': 'D'}
m = collections.ChainMap(a,b)
print(m)
"""
output:
Chain... | code_fim | medium | {
"lang": "python",
"repo": "Nobodylesszb/python_module",
"path": "/data_structures/collections/chainMap/collections_chainmap_reorder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nobodylesszb/python_module path: /data_structures/collections/chainMap/collections_chainmap_reorder.py
import collections
a = {'a': 'A', 'c': 'C'}
b = {'b': 'B', 'c': 'D'}
m = collections.ChainMap(a,b)
print(m)
"""
output:
ChainMap({'a': 'A', 'c': 'C'}, {'b': 'B', 'c': 'D'})
[{'a': 'A', 'c': 'C'... | code_fim | easy | {
"lang": "python",
"repo": "Nobodylesszb/python_module",
"path": "/data_structures/collections/chainMap/collections_chainmap_reorder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: br-g/pypsl path: /pypsl/model/rule.py
"""Base class for rules"""
from typing import TYPE_CHECKING, Dict, FrozenSet, List, Tuple
from pypsl.utils.representation import obj_to_repr
from .ground_rule import GroundRule
from .atom import Atom
from .ground_atom import GroundAtom
if TYPE_CHECKING:
... | code_fim | hard | {
"lang": "python",
"repo": "br-g/pypsl",
"path": "/pypsl/model/rule.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> -> 'GroundRule':
"""Creates a grounding if it doesn't exist and returns it."""
if ground_atoms in self.grounded:
return self.grounded[ground_atoms]
new_grounded = GroundRule(ground_atoms)
self.grounded[ground_atoms] = new_grounded
ret... | code_fim | hard | {
"lang": "python",
"repo": "br-g/pypsl",
"path": "/pypsl/model/rule.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Function to print the logs in a nice tabular format.
:param args: Parameters used for the model.
"""
args = vars(args)
keys = sorted(args.keys())
t = Texttable()
t.add_rows([["Parameter", "Value"]] + [[k.replace("_"," ").capitalize(),args[k]] for k in keys])
print... | code_fim | medium | {
"lang": "python",
"repo": "km6102/OrbitalFeatures",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: km6102/OrbitalFeatures path: /src/utils.py
import pandas as pd
import networkx as nx
from texttable import Texttable
<|fim_suffix|> """
Function to print the logs in a nice tabular format.
:param args: Parameters used for the model.
"""
args = vars(args)
keys = sorted(args... | code_fim | medium | {
"lang": "python",
"repo": "km6102/OrbitalFeatures",
"path": "/src/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Reading an egde list csv as an NX graph object.
:param graph_path: Path to the edgelist.
:return graph: Networkx Object.
"""
graph = nx.from_edgelist(pd.read_csv(graph_path).values.tolist())
graph.remove_edges_from(graph.selfloop_edges())
return graph<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "km6102/OrbitalFeatures",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Main script function."""
site = pywikibot.Site()
time = pywikibot.Timestamp.utcnow()
for (title, text, delay) in SANDBOXES:
page = pywikibot.Page(site, title)
delta = time - page.editTime()
if "--noclear" not in sys.argv and delta.total_seconds() >= 60 * delay:
... | code_fim | hard | {
"lang": "python",
"repo": "Facenapalm/NapalmBot",
"path": "/scripts/sandbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Facenapalm/NapalmBot path: /scripts/sandbox.py
"""
Sandbox cleaner for Russian Wikipedia.
Usage:
python sandbox.py [--noclear]
If --noclear is specified, script will restore deleted headers, but will not
clear sandboxes.
"""
<|fim_suffix|>SANDBOXES = [
("Википедия:Песочница", "{{тестир... | code_fim | medium | {
"lang": "python",
"repo": "Facenapalm/NapalmBot",
"path": "/scripts/sandbox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reportportal/agent-python-behave path: /behave_reportportal/config.py
"""Config is structure for configuration of behave Report Portal agent."""
# Copyright (c) 2023 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | code_fim | hard | {
"lang": "python",
"repo": "reportportal/agent-python-behave",
"path": "/behave_reportportal/config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(
self,
endpoint: Optional[str] = None,
project: Optional[str] = None,
api_key: Optional[str] = None,
launch_id: Optional[str] = None,
launch_name: Optional[str] = None,
launch_description: Optional[str] = ... | code_fim | hard | {
"lang": "python",
"repo": "reportportal/agent-python-behave",
"path": "/behave_reportportal/config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Class for configuration of behave Report Portal agent."""
endpoint: Optional[str]
project: Optional[str]
api_key: Optional[str]
enabled: bool
launch_id: Optional[str]
launch_name: str
launch_description: Optional[str]
launch_attributes: Optional[List[str]]
debug... | code_fim | hard | {
"lang": "python",
"repo": "reportportal/agent-python-behave",
"path": "/behave_reportportal/config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Test the overall product count
"""
number_of_test_run = 2 # Run the pipeline twice
for i in range(number_of_test_run):
dp = DataPipeline()
dp.run()
dp = DataPipeline()
assert dp.get_product_count() == (500000,)
assert dp.get_duplicate_count(from_table=... | code_fim | medium | {
"lang": "python",
"repo": "Joel-hanson/large-file-processor",
"path": "/test_main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Joel-hanson/large-file-processor path: /test_main.py
"""
Run the test using the command py.test
"""
import pytest # noqa
from main import DataPipeline
<|fim_suffix|> """
Test the overall product count
"""
number_of_test_run = 2 # Run the pipeline twice
for i in range(number_... | code_fim | medium | {
"lang": "python",
"repo": "Joel-hanson/large-file-processor",
"path": "/test_main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dp = DataPipeline()
assert dp.get_product_count() == (500000,)
assert dp.get_duplicate_count(from_table="products") == (0,)
assert dp.get_aggregate_table_result_count() == (222024, )
222024
dp.close()<|fim_prefix|># repo: Joel-hanson/large-file-processor path: /test_main.py
"""
Ru... | code_fim | hard | {
"lang": "python",
"repo": "Joel-hanson/large-file-processor",
"path": "/test_main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IdentityPython/SATOSA path: /src/satosa/logging_util.py
LOG_FMT = "[{id}] {message}"
def get_session_id(state):
session_id = getattr(state, "session_id", None) or "UNKNOWN"
return session_id
<|fim_suffix|> :param logger: Logger to use
:param level: Logger level (ex: logging.DEB... | code_fim | hard | {
"lang": "python",
"repo": "IdentityPython/SATOSA",
"path": "/src/satosa/logging_util.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Adds a session ID to the message.
:type logger: logging
:type level: int
:type message: str
:type state: satosa.state.State
:param logger: Logger to use
:param level: Logger level (ex: logging.DEBUG/logging.WARN/...)
:param message: Message
:param state: The c... | code_fim | medium | {
"lang": "python",
"repo": "IdentityPython/SATOSA",
"path": "/src/satosa/logging_util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dhutexas/nixtlats path: /nixtlats/data/utils.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/data__utils.ipynb (unless otherwise specified).
__all__ = ['create_synthetic_tsdata']
# Cell
from typing import Tuple
import numpy as np
import pandas as pd
# Cell
def create_synthetic_tsdata(n_ts:... | code_fim | hard | {
"lang": "python",
"repo": "dhutexas/nixtlats",
"path": "/nixtlats/data/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Y_df = df.filter(items=['unique_id', 'ds', 'y'])
X_df = df.filter(items=['unique_id', 'ds', 'day_of_week', 'future_1'])
S_df = df.filter(items=['unique_id', 'id_ts']).drop_duplicates()
return Y_df, X_df, S_df<|fim_prefix|># repo: dhutexas/nixtlats path: /nixtlats/data/utils.py
# AUTOGENE... | code_fim | hard | {
"lang": "python",
"repo": "dhutexas/nixtlats",
"path": "/nixtlats/data/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> system_electrical_power_rating: The total electrical power rating of the aircraft's electrical system [Watts].
Typical values:
* Transport airplane: 40,000 - 60,000 W
* Fighter/bomber airplane: 110,000 - 160,000 W
electrical_routing_distance: T... | code_fim | hard | {
"lang": "python",
"repo": "peterdsharpe/AeroSandbox",
"path": "/aerosandbox/library/weights/raymer_cargo_transport_weights.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peterdsharpe/AeroSandbox path: /aerosandbox/library/weights/raymer_cargo_transport_weights.py
imate load factor of the airplane.
wing_to_vstab_distance: Distance from the wing's root-quarter-chord-point to the vstab's
root-quarter-chord-point [m].
is_t_tail: Whether the ... | code_fim | hard | {
"lang": "python",
"repo": "peterdsharpe/AeroSandbox",
"path": "/aerosandbox/library/weights/raymer_cargo_transport_weights.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peterdsharpe/AeroSandbox path: /aerosandbox/library/weights/raymer_cargo_transport_weights.py
_t_over_c = np.min(airfoil_thicknesses)
return (
0.0051 *
(design_mass_TOGW / u.lbm * ultimate_load_factor) ** 0.557 *
(wing.area('planform') / u.foot ** 2) ** 0.... | code_fim | hard | {
"lang": "python",
"repo": "peterdsharpe/AeroSandbox",
"path": "/aerosandbox/library/weights/raymer_cargo_transport_weights.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lhz0707/meiduo path: /meiduo_mall/meiduo_mall/apps/meiduo_admin/urls.py
from django.conf.urls import url
from django.contrib import admin
from rest_framework_jwt.views import obtain_jwt_token
from .views import statistical
urlpatterns=[
url(r'^authorizations/$',<|fim_suffix|># 月增用户用户统计
ur... | code_fim | hard | {
"lang": "python",
"repo": "lhz0707/meiduo",
"path": "/meiduo_mall/meiduo_mall/apps/meiduo_admin/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>iew()),
# 日活用户统计
url(r'^statistical/day_active/$', statistical.UserDayActiveCount.as_view()),
# 下单用户用户统计
url(r'^statistical/day_orders/$', statistical.UserDayOrdersCount.as_view()),
# 月增用户用户统计
url(r'^statistical/month_increment/$', statistical.UserMonthCount.as_view()),
# 商品分类访问量统计
... | code_fim | medium | {
"lang": "python",
"repo": "lhz0707/meiduo",
"path": "/meiduo_mall/meiduo_mall/apps/meiduo_admin/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>point variable.
# Remember! type(variable_name) will return the data type of a variable
# Write code here<|fim_prefix|># repo: thestrawberryqueen/python path: /1_beginner/chapter2/practice/float.py
# Float
# Write a program that takes a float from the user
# and stores it in a variable. Cast the number ... | code_fim | medium | {
"lang": "python",
"repo": "thestrawberryqueen/python",
"path": "/1_beginner/chapter2/practice/float.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thestrawberryqueen/python path: /1_beginner/chapter2/practice/float.py
# Float
# Write a program that takes a float from the user
# and stores it in a variable. Cast the number<|fim_suffix|>point variable.
# Remember! type(variable_name) will return the data type of a variable
# Write code here<... | code_fim | hard | {
"lang": "python",
"repo": "thestrawberryqueen/python",
"path": "/1_beginner/chapter2/practice/float.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.app.application_id
@public_property
def identity(self) -> str:
""" Each instance has a unqiue identity formed out of the hostname and
the application id.
"""
digest = hashlib.sha256()
digest.update(self.fqdn.encode('utf-8'))
di... | code_fim | hard | {
"lang": "python",
"repo": "OneGov/onegov-cloud",
"path": "/src/onegov/core/metadata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@Framework.json(model=SecretMetadata, permission=Secret)
def view_secret_metadata(
self: PublicMetadata,
request: 'CoreRequest'
) -> morepath.Response:
return render_metadata(self, request)
def render_metadata(
self: PublicMetadata | SecretMetadata,
request: 'CoreRequest'
) -> morepa... | code_fim | hard | {
"lang": "python",
"repo": "OneGov/onegov-cloud",
"path": "/src/onegov/core/metadata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OneGov/onegov-cloud path: /src/onegov/core/metadata.py
""" Metadata about the instance, available through HTTP. """
import hashlib
import inspect
import morepath
import socket
from onegov.core.framework import Framework
from onegov.core.security import Public, Secret
from onegov.core.utils impo... | code_fim | hard | {
"lang": "python",
"repo": "OneGov/onegov-cloud",
"path": "/src/onegov/core/metadata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: victormartinez/ferret path: /ferret/main.py
import json
from langdetect import detect
from toolz import dicttoolz
from .cleaner.text import normalize_text
from .extractors.content_extractor import extract_body_text_from_html
from .extractors.content_extractor import ContentExtractor
from .extra... | code_fim | hard | {
"lang": "python",
"repo": "victormartinez/ferret",
"path": "/ferret/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> extractors = self._get_extractors(self.title_extractors, context)
for e in extractors:
title = e.extract()
if title:
return normalize_text(title)
return ''
def extract_published_date(self, context=None):
if context is None:
... | code_fim | hard | {
"lang": "python",
"repo": "victormartinez/ferret",
"path": "/ferret/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Skazu14/grapp path: /main/graph_visualization/views.py
#Djnago stuff
from .models import *
from django.shortcuts import render,redirect
from django.http import HttpResponse,JsonResponse
from django.core.serializers import serialize
import time
#helper functions
from .utils import traverse,conver... | code_fim | hard | {
"lang": "python",
"repo": "Skazu14/grapp",
"path": "/main/graph_visualization/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> response="graph [\n"
for node in nodes:
response+="node [\n"
response+=traverse(node)
response+="]\n"
for link in links:
response+="edge [\n"
response+=traverse(link)
response+="]\n"
#end of ... | code_fim | hard | {
"lang": "python",
"repo": "Skazu14/grapp",
"path": "/main/graph_visualization/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
verbose_name = _("Address")
verbose_name_plural = _("Address's")
def __str__(self):
return f"{self.user}: {self.street_address}"
def get_absolute_url(self):
return reverse("Address_detail", kwargs={"pk": self.pk})<|fim_prefix|># repo: sameh-rm/djan... | code_fim | hard | {
"lang": "python",
"repo": "sameh-rm/django-restframework-demo",
"path": "/backend/accounts/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = models.ForeignKey(
settings.AUTH_USER_MODEL,
verbose_name=_("User"),
on_delete=models.CASCADE,
related_name='address_set'
)
street_address = models.CharField(_("Street"), max_length=100)
apartment_address = models.CharField(
_("Apartment"),
... | code_fim | hard | {
"lang": "python",
"repo": "sameh-rm/django-restframework-demo",
"path": "/backend/accounts/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sameh-rm/django-restframework-demo path: /backend/accounts/models.py
from django.db import models
from django.shortcuts import reverse
from django.conf import settings
from django.utils.translation import ugettext as _
# Create your models here.
class Profile(models.Model):
<|fim_suffix|>class ... | code_fim | hard | {
"lang": "python",
"repo": "sameh-rm/django-restframework-demo",
"path": "/backend/accounts/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samarth-robo/apex path: /cassie/rewards/speedmatch_heuristic_reward.py
import numpy as np
def speedmatch_heuristic_reward(self):
######## Pelvis z accel penalty #########
pelaccel = np.abs(self.cassie_state.pelvis.translationalAcceleration[2])
pelaccel_penalty = 0
if pelaccel > 5... | code_fim | hard | {
"lang": "python",
"repo": "samarth-robo/apex",
"path": "/cassie/rewards/speedmatch_heuristic_reward.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>p.exp(-rfoot_orient)
# reward = .4*np.exp(-forward_diff) + .3*np.exp(-orient_diff) \
# + .15*np.exp(-straight_diff) + .15*np.exp(-y_vel) \
# + .1*np.exp(-self.l_foot_orient) + .1*np.exp(-self.r_foot_orient) \
# + .1*np.exp(-self.smooth_cost) \
... | code_fim | hard | {
"lang": "python",
"repo": "samarth-robo/apex",
"path": "/cassie/rewards/speedmatch_heuristic_reward.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asvetlov/bloggertool path: /tests/test_config/test_file_system.py
# -*- encoding: utf-8 -*-
import os
import shutil
import unittest
from bloggertool.config.file_system import FileSystem
from bloggertool.exceptions import FileNotFoundError, FileOutOfProject
class TestFileSystem(unittest.TestCa... | code_fim | hard | {
"lang": "python",
"repo": "asvetlov/bloggertool",
"path": "/tests/test_config/test_file_system.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.fs.open(rel_name, 'w') as f:
f.write(u'Русский текст 2')
with open(fname, 'r') as f:
content = f.read()
self.assertEqual('Русский текст 2', content)
def test_replace_text(self):
self.assertEqual('file.html', self.fs.replace_ext('f... | code_fim | hard | {
"lang": "python",
"repo": "asvetlov/bloggertool",
"path": "/tests/test_config/test_file_system.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES,
fromEncoding='utf-8')
self.real_article = True
if soup.title != None: self.title = soup.title.string
if soup.date != None: self.date = soup.time.string
if soup.body... | code_fim | hard | {
"lang": "python",
"repo": "tanyokwok/newsdiffs",
"path": "/parsers/tvm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tanyokwok/newsdiffs path: /parsers/tvm.py
from baseparser import BaseParser
from baseparser import day_diff2now
import re
#from BeautifulSoup import BeautifulSoup
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
<|fim_suffix|> @classmethod
def filter(cls, url):
... | code_fim | medium | {
"lang": "python",
"repo": "tanyokwok/newsdiffs",
"path": "/parsers/tvm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bleemeolabs/mypublicapi path: /mypublicapi/models.py
# -*- coding: utf-8 -*-
import uuid
from django.db import models
class Server(models.Model):
id = models.UUIDField(
primary_key=True, default=uuid.uuid4, editable=False
)
name = models.CharField(max_length=100)
cla... | code_fim | hard | {
"lang": "python",
"repo": "bleemeolabs/mypublicapi",
"path": "/mypublicapi/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Metric(models.Model):
id = models.UUIDField(
primary_key=True, default=uuid.uuid4, editable=False
)
server = models.ForeignKey(Server)
name = models.CharField(max_length=100)
class Meta:
ordering = ['name']
permissions = (
('view_metric', 'C... | code_fim | medium | {
"lang": "python",
"repo": "bleemeolabs/mypublicapi",
"path": "/mypublicapi/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = models.UUIDField(
primary_key=True, default=uuid.uuid4, editable=False
)
server = models.ForeignKey(Server)
name = models.CharField(max_length=100)
value = models.CharField(max_length=100)
class Meta:
ordering = ['name']
permissions = (
('v... | code_fim | hard | {
"lang": "python",
"repo": "bleemeolabs/mypublicapi",
"path": "/mypublicapi/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seanjhulse/sherlock path: /sherlock/migrations/0001_initial.py
# Generated by Django 3.1.7 on 2021-03-30 04:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | code_fim | hard | {
"lang": "python",
"repo": "seanjhulse/sherlock",
"path": "/sherlock/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e published')),
],
options={
'managed': True,
},
),
migrations.CreateModel(
name='Scan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
... | code_fim | hard | {
"lang": "python",
"repo": "seanjhulse/sherlock",
"path": "/sherlock/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_key_image(self):
return self.instance.primary_image
def get_resource_name(self):
return u'%s Article' % self.instance.primary_category
resource_list.register(Article, ArticleResource)<|fim_prefix|># repo: callowayproject/django-resources path: /doc_src/examples/articlere... | code_fim | medium | {
"lang": "python",
"repo": "callowayproject/django-resources",
"path": "/doc_src/examples/articleresource.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: callowayproject/django-resources path: /doc_src/examples/articleresource.py
from contentrelations import BaseResource, resource_list
from articleapp.models import Article
class ArticleResource(BaseResource):
def get_title(self):
return self.instance.headline
def get_description(... | code_fim | easy | {
"lang": "python",
"repo": "callowayproject/django-resources",
"path": "/doc_src/examples/articleresource.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.instance.summary
def get_key_image(self):
return self.instance.primary_image
def get_resource_name(self):
return u'%s Article' % self.instance.primary_category
resource_list.register(Article, ArticleResource)<|fim_prefix|># repo: callowayproject/django-resour... | code_fim | medium | {
"lang": "python",
"repo": "callowayproject/django-resources",
"path": "/doc_src/examples/articleresource.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brocaar/flask-views path: /flask_views/tests/unit/test_edit.py
import unittest2 as unittest
from mock import Mock, patch
from flask_views.edit import FormMixin, ProcessFormMixin
class FormMixinTestCase(unittest.TestCase):
"""
Tests for :py:class:`.FormMixin`.
"""
def test_init... | code_fim | hard | {
"lang": "python",
"repo": "brocaar/flask-views",
"path": "/flask_views/tests/unit/test_edit.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Test :py:meth:`.ProcessFormMixin.get`.
"""
mixin = ProcessFormMixin()
mixin.get_form = Mock(return_value='form-instance')
mixin.get_context_data = Mock(return_value={'context': 'data'})
mixin.render_to_response = Mock(return_value='response')
... | code_fim | hard | {
"lang": "python",
"repo": "brocaar/flask-views",
"path": "/flask_views/tests/unit/test_edit.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ProcessFormMixinTestCase(unittest.TestCase):
"""
Tests for :py:class:`.ProcessFormMixin`.
"""
def test_get(self):
"""
Test :py:meth:`.ProcessFormMixin.get`.
"""
mixin = ProcessFormMixin()
mixin.get_form = Mock(return_value='form-instance')
... | code_fim | hard | {
"lang": "python",
"repo": "brocaar/flask-views",
"path": "/flask_views/tests/unit/test_edit.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stephen-e-cox/pychron path: /pychron/options/iso_evo_views.py
# ===============================================================================
# Copyright 2015 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | code_fim | hard | {
"lang": "python",
"repo": "stephen-e-cox/pychron",
"path": "/pychron/options/iso_evo_views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for a in items:
setattr(a, attr, new)
def _get_columns(self):
cols = [object_column(name='name', editable=False),
checkbox_column(name='plot_enabled', label='Plot'),
checkbox_column(name='save_enabled', label='Save'),
object_... | code_fim | hard | {
"lang": "python",
"repo": "stephen-e-cox/pychron",
"path": "/pychron/options/iso_evo_views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>configFile = os.getenv('CONFIG') or 'config.ini'
config = ConfigParser()
config.read(configFile)
q = Qsos.Qsos(lotwFile=config.get('LOTW','cache_filename'))
q.startScan()
# set env GUI to zero, or env GUI is unset and GUI disabled in config
log.debug("GUI {}; {}".format(os.getenv('GUI'),config.get('OPTS... | code_fim | medium | {
"lang": "python",
"repo": "tisboyo/jtman",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># set env GUI to zero, or env GUI is unset and GUI disabled in config
log.debug("GUI {}; {}".format(os.getenv('GUI'),config.get('OPTS','gui',fallback=0)))
if os.getenv('GUI') == '0' or config.get('OPTS','gui') == 0 or config.get('OPTS','gui') == '0':
log.debug("no gui")
threads=[]
listeners=[]... | code_fim | hard | {
"lang": "python",
"repo": "tisboyo/jtman",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tisboyo/jtman path: /main.py
import os
from signal import signal, SIGINT
import time, threading
import tkinter as tk
from configparser import ConfigParser
from JtmanTk import JtmanTk
import Qsos
from logger import LOGGER as log
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.d... | code_fim | hard | {
"lang": "python",
"repo": "tisboyo/jtman",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' save the results or evaluate directly '''
for cnt in range(test_dataset):
my_job(cnt)<|fim_prefix|># repo: LLLLLLI/Pytorch-template path: /test.py
import argparse
import torch
from model.model import Model
from data.dataloader import PreprocessDataset
parser = argparse.ArgumentParser()
par... | code_fim | hard | {
"lang": "python",
"repo": "LLLLLLI/Pytorch-template",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LLLLLLI/Pytorch-template path: /test.py
import argparse
import torch
from model.model import Model
from data.dataloader import PreprocessDataset
<|fim_suffix|>test_dataset = PreprocessDataset(opt, 'test')
def my_job(cnt):
name = test_dataset.id_list[cnt]
feature, _, = test_dataset.__g... | code_fim | hard | {
"lang": "python",
"repo": "LLLLLLI/Pytorch-template",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = test_dataset.id_list[cnt]
feature, _, = test_dataset.__getitem__(cnt)
with torch.no_grad():
out = model.forward(feature.view(1, 1024, -1).cuda())
''' save the results or evaluate directly '''
for cnt in range(test_dataset):
my_job(cnt)<|fim_prefix|># repo: LLLLLLI... | code_fim | medium | {
"lang": "python",
"repo": "LLLLLLI/Pytorch-template",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cluster311/ggg path: /especialidades/models.py
from django.db import models
class MedidaAnexa(models.Model):
""" Cada vez que se hace alguna consulta médica vinculada
a un especialidad hay requisitos que se piden.
Por ejemplo medir masa corporal, peso y tension arterial.
... | code_fim | hard | {
"lang": "python",
"repo": "cluster311/ggg",
"path": "/especialidades/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MedidaAnexaEnConsulta(models.Model):
consulta = models.ForeignKey('pacientes.Consulta', on_delete=models.CASCADE,
related_name='medidas_anexas')
medida = models.ForeignKey(MedidaAnexa,
on_delete=models.CASCADE,
... | code_fim | hard | {
"lang": "python",
"repo": "cluster311/ggg",
"path": "/especialidades/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return f'{self.medida} en {self.especialidad}'
class Meta:
unique_together = [['especialidad', 'medida']]
class MedidaAnexaEnConsulta(models.Model):
consulta = models.ForeignKey('pacientes.Consulta', on_delete=models.CASCADE,
... | code_fim | hard | {
"lang": "python",
"repo": "cluster311/ggg",
"path": "/especialidades/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>leaseMessageWithType(item, 'Paztok', vol, chp, frag=frag, postfix=postfix, tl_type='oel')
return False<|fim_prefix|># repo: fake-name/ReadableWebProxy path: /WebMirror/management/rss_parser_funcs/feed_parse_extractPaztok.py
def extractPaztok(item):
"""
"""
vol, chp, frag, postfix = extractVolChapter... | code_fim | medium | {
"lang": "python",
"repo": "fake-name/ReadableWebProxy",
"path": "/WebMirror/management/rss_parser_funcs/feed_parse_extractPaztok.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fake-name/ReadableWebProxy path: /WebMirror/management/rss_parser_funcs/feed_parse_extractPaztok.py
def extractPaztok(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['<|fim_suffix|>leaseMessageWithType(item, 'Paztok', vol, chp, frag=frag, postfix=postfix, tl_typ... | code_fim | hard | {
"lang": "python",
"repo": "fake-name/ReadableWebProxy",
"path": "/WebMirror/management/rss_parser_funcs/feed_parse_extractPaztok.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getData(self, ctype):
if not ctype in self.store:
return None
else:
return self.store[ctype]<|fim_prefix|># repo: hrithikp/pagestat path: /src/parser.py
from HTMLParser import HTMLParser
class Parser(HTMLParser):
ctypes = ['tags', 'attrs']
def __in... | code_fim | hard | {
"lang": "python",
"repo": "hrithikp/pagestat",
"path": "/src/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hrithikp/pagestat path: /src/parser.py
from HTMLParser import HTMLParser
class Parser(HTMLParser):
ctypes = ['tags', 'attrs']
def __init__(self):
<|fim_suffix|> tags = self.store['tags']
attrs = self.store['attrs']
if name in tags:
tags[name] += 1
... | code_fim | hard | {
"lang": "python",
"repo": "hrithikp/pagestat",
"path": "/src/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1204601575/CSGO_Forward_Robot path: /config.py
import json # 模块(处理json相关格式)
<|fim_suffix|> return mysql_config, bot_config<|fim_middle|>
def load_config():
with open('config.json', 'r') as f:
data = json.load(f)
mysql_config = data['mysql_server']
bot_config = dat... | code_fim | medium | {
"lang": "python",
"repo": "1204601575/CSGO_Forward_Robot",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open('config.json', 'r') as f:
data = json.load(f)
mysql_config = data['mysql_server']
bot_config = data['vector_bot']
return mysql_config, bot_config<|fim_prefix|># repo: 1204601575/CSGO_Forward_Robot path: /config.py
import json # 模块(处理json相关格式)
<|fim_middle|>de... | code_fim | easy | {
"lang": "python",
"repo": "1204601575/CSGO_Forward_Robot",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return mysql_config, bot_config<|fim_prefix|># repo: 1204601575/CSGO_Forward_Robot path: /config.py
import json # 模块(处理json相关格式)
<|fim_middle|>
def load_config():
with open('config.json', 'r') as f:
data = json.load(f)
mysql_config = data['mysql_server']
bot_config = dat... | code_fim | medium | {
"lang": "python",
"repo": "1204601575/CSGO_Forward_Robot",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if digraph.has_path('v2', 'v3'):
print '\nThere is path between v2 and v3'
else:
print '\nThere is no path between v2 and v3'
print '\nFor Graph:'
graph = graphs.Graph(dict())
graph.add_edge('a', 'b', 1)
graph.add_edge('b', 'c', 1)
graph.add_edge('c', 'd', 1)
... | code_fim | medium | {
"lang": "python",
"repo": "amit-upadhyay-IT/next-py",
"path": "/graphs/test5_haspath.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amit-upadhyay-IT/next-py path: /graphs/test5_haspath.py
import graphs
'''
v2 v5
\ /
v1
/ \
v3<---v4
\ /
v6
Each edge has downward direction
'''
if __name__ == '__main__':
digraph = graphs.DiGraph(dict())
# agrs: src, dest, weight
digra... | code_fim | hard | {
"lang": "python",
"repo": "amit-upadhyay-IT/next-py",
"path": "/graphs/test5_haspath.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hifi2046/InTraceControl path: /call_viewer.py
import carla
import xodrReader
#import rssw
import yaml
<|fim_suffix|>fcheck = open("input-check.yaml", "r")
data = fcheck.read()
scheck = yaml.load(data)
print(yaml.dump(scheck))
print(scheck["D1"]["velocity"][0])
print(scheck["D2"]["lane"])
print(s... | code_fim | easy | {
"lang": "python",
"repo": "hifi2046/InTraceControl",
"path": "/call_viewer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fcheck = open("input-check.yaml", "r")
data = fcheck.read()
scheck = yaml.load(data)
print(yaml.dump(scheck))
print(scheck["D1"]["velocity"][0])
print(scheck["D2"]["lane"])
print(scheck["D2"]["velocity"][1])<|fim_prefix|># repo: hifi2046/InTraceControl path: /call_viewer.py
import carla
import xodrReader... | code_fim | easy | {
"lang": "python",
"repo": "hifi2046/InTraceControl",
"path": "/call_viewer.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.