text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: shuangrain/binary-flask-sample-on-the-container path: /src/wsgi.py
from abc import ABC
from gunicorn.app.base import Application, Config
from src.app import app
<|fim_suffix|> def run(self, **options):
self.cfg = Config()
for key, value in options.items():
self.... | code_fim | medium | {
"lang": "python",
"repo": "shuangrain/binary-flask-sample-on-the-container",
"path": "/src/wsgi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
start_no = 0
file_path = "scenario_2/"
# filename = 'prereq.json'
# filename = ['prereq2.json']
filename = "out_combined.json"
outfilename = "combined.json"
if isinstance(filename, str):
open_path = os.path.join(os.path.dirname(__file__),f... | code_fim | hard | {
"lang": "python",
"repo": "benjaminturnbull/Patronus",
"path": "/ingestion/scenario_importer/unique_types_and_rels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def read_json_to_objects(filename):
"""
:param input_objs:
:param start_no:
:return:
"""
# print(filename)
jsn_in_file = open(filename, 'r')
json_txt = jsn_in_file.read()
file_json = json.loads(json_txt)
return file_json
if __name__ == "__main__":
start_... | code_fim | hard | {
"lang": "python",
"repo": "benjaminturnbull/Patronus",
"path": "/ingestion/scenario_importer/unique_types_and_rels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benjaminturnbull/Patronus path: /ingestion/scenario_importer/unique_types_and_rels.py
"""
author:bpt
numbers and renumbers ids
also combines files.
"""
import re
import sys
import os
import json
import pprint
sys.path.append('../../')
from utils import utilsv2 as util
from config import graph_... | code_fim | hard | {
"lang": "python",
"repo": "benjaminturnbull/Patronus",
"path": "/ingestion/scenario_importer/unique_types_and_rels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FIWARE-GEs/quantum-leap path: /src/wq/tests/conftest.py
import os
import pytest
from time import sleep
from translators.factory import QL_DEFAULT_DB_ENV_VAR, TIMESCALE_BACKEND
from translators.timescale import postgres_translator_instance
from utils.tests.docker import DockerCompose
from wq.core... | code_fim | hard | {
"lang": "python",
"repo": "FIWARE-GEs/quantum-leap",
"path": "/src/wq/tests/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture(scope='session', autouse=True)
def set_env_vars():
os.environ[OFFLOAD_WORK_VAR.name] = 'true'
os.environ[QL_DEFAULT_DB_ENV_VAR] = TIMESCALE_BACKEND<|fim_prefix|># repo: FIWARE-GEs/quantum-leap path: /src/wq/tests/conftest.py
import os
import pytest
from time import sleep
from tra... | code_fim | hard | {
"lang": "python",
"repo": "FIWARE-GEs/quantum-leap",
"path": "/src/wq/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blacy/direct-imaging-sims path: /Models/LightCurveGUI/wx/_gdi.py
temEncoding(*args):
"""Locale_GetSystemEncoding() -> int"""
return _gdi_.Locale_GetSystemEncoding(*args)
def Locale_GetSystemEncodingName(*args):
"""Locale_GetSystemEncodingName() -> String"""
return _gdi_.Locale_GetSystemE... | code_fim | hard | {
"lang": "python",
"repo": "blacy/direct-imaging-sims",
"path": "/Models/LightCurveGUI/wx/_gdi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Convenience function that returns true if the given face name exist in
the user's system
"""
return _gdi_.FontEnumerator_IsValidFacename(*args, **kwargs)
IsValidFacename = staticmethod(IsValidFacename)
_gdi_.FontEnumerator_swigregister(FontEnumerator)
def FontEnumerat... | code_fim | hard | {
"lang": "python",
"repo": "blacy/direct-imaging-sims",
"path": "/Models/LightCurveGUI/wx/_gdi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def GetSize(*args, **kwargs):
"""GetSize(index) -> (width,height)"""
return _gdi_.ImageList_GetSize(*args, **kwargs)
ImageCount = property(GetImageCount,doc="See `GetImageCount`")
Size = property(GetSize,doc="See `GetSize`")
_gdi_.ImageList_swigregister(ImageList)
#--------... | code_fim | hard | {
"lang": "python",
"repo": "blacy/direct-imaging-sims",
"path": "/Models/LightCurveGUI/wx/_gdi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> perms = []
if self.read_permission:
perms.append('read')
if self.write_permission:
perms.append('write')
if self.delete_permission:
perms.append('delete')
if self.login_permission:
perms.append('login')
return ... | code_fim | hard | {
"lang": "python",
"repo": "wooster/django-topsoil",
"path": "/tests/test_provider/oauth_clients/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wooster/django-topsoil path: /tests/test_provider/oauth_clients/models.py
from django.db import models
from django.utils.translation import ugettext as _
from oauth_provider.consts import CONSUMER_STATES, MAX_URL_LENGTH
from oauth_provider.models import Consumer
class OAuthApplication(models.Mod... | code_fim | hard | {
"lang": "python",
"repo": "wooster/django-topsoil",
"path": "/tests/test_provider/oauth_clients/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def wants_access_permission(self):
return self.read_permission
def wants_modify_permission(self):
return self.write_permission or self.delete_permission
def name(self):
return self.consumer.name<|fim_prefix|># repo: wooster/django-topsoil path: /tests/test_pr... | code_fim | hard | {
"lang": "python",
"repo": "wooster/django-topsoil",
"path": "/tests/test_provider/oauth_clients/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dev-Learn/LearnPython path: /syntax/class_object/testAttributePlayer.py
from syntax.class_object.player import Player
player1 = Player("Tom", 20)
player2 = Player("Jerry", 20)
<|fim_suffix|>print("player2.name = ", player2.name)
print("player2.age = ", player2.age)<|fim_middle|>print("player1.... | code_fim | hard | {
"lang": "python",
"repo": "Dev-Learn/LearnPython",
"path": "/syntax/class_object/testAttributePlayer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Gán giá trị mới cho thuộc tính (attribute) age của player1.
player1.age = 21
print("player1.name = ", player1.name)
print("player1.age = ", player1.age)
print("player2.name = ", player2.name)
print("player2.age = ", player2.age)<|fim_prefix|># repo: Dev-Learn/LearnPython path: /syntax/class_object/te... | code_fim | medium | {
"lang": "python",
"repo": "Dev-Learn/LearnPython",
"path": "/syntax/class_object/testAttributePlayer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _rank = 10
def __init__ (self, msg, parent=None, api_object=None, from_log=False) :
SagaException.__init__ (self, msg, parent, api_object, from_log)
# ------------------------------------------------------------------------------
#
class BadParameter(SagaException):
""" A given... | code_fim | hard | {
"lang": "python",
"repo": "virthead/COMPASS-pilot",
"path": "/saga/exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># ------------------------------------------------------------------------------
#
class AlreadyExists(SagaException):
""" The entity to be created already exists. (rank: 8)"""
_rank = 8
def __init__ (self, msg, parent=None, api_object=None, from_log=False) :
SagaException.__ini... | code_fim | hard | {
"lang": "python",
"repo": "virthead/COMPASS-pilot",
"path": "/saga/exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: virthead/COMPASS-pilot path: /saga/exceptions.py
thor__ = "Andre Merzky, Ole Weidner"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
""" Exception classes
"""
import sys
import weakref
import operator
import traceback
# We have the choice of doing signature ... | code_fim | hard | {
"lang": "python",
"repo": "virthead/COMPASS-pilot",
"path": "/saga/exceptions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rams1996/Trees path: /binary-tree-right-side-view/binary-tree-right-side-view.py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from collections import deque
class Solution:
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "rams1996/Trees",
"path": "/binary-tree-right-side-view/binary-tree-right-side-view.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not root:
return []
queue=deque()
queue.append(root)
res=[]
while(queue):
size=len(queue)
for i in range(size):
currNode=queue.popleft()
if i==size-1:
res.append(currNode.val)... | code_fim | hard | {
"lang": "python",
"repo": "rams1996/Trees",
"path": "/binary-tree-right-side-view/binary-tree-right-side-view.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NVIDIA/TensorRT path: /demo/BERT/helpers/calibrator.py
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you m... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/TensorRT",
"path": "/demo/BERT/helpers/calibrator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.current_index += self.batch_size
return self.device_inputs
def read_calibration_cache(self):
# If there is a cache, use it instead of calibrating again. Otherwise, implicitly return None.
if os.path.exists(self.cache_file):
with open(self.cache_file, "... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/TensorRT",
"path": "/demo/BERT/helpers/calibrator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # If there is a cache, use it instead of calibrating again. Otherwise, implicitly return None.
if os.path.exists(self.cache_file):
with open(self.cache_file, "rb") as f:
return f.read()
def write_calibration_cache(self, cache):
with open(self.cache_... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/TensorRT",
"path": "/demo/BERT/helpers/calibrator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def decode(encoded, alphabet=ALPHABET):
"""Converts an alphanumerical string to an int"""
base = len(alphabet)
decoded = 0
power = 1
encoded = list(encoded)
encoded.reverse()
for char in encoded:
decoded += alphabet.index(char) * power
power *= base
retu... | code_fim | medium | {
"lang": "python",
"repo": "coinpayee/django-short-urls",
"path": "/django_short_urls/int_to_alnum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coinpayee/django-short-urls path: /django_short_urls/int_to_alnum.py
# coding=utf-8
"""Converts an integer to an alphanumerical string"""
from __future__ import unicode_literals
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"
def encode(decoded, alphabet=ALPHABET):
"""Converts an int t... | code_fim | hard | {
"lang": "python",
"repo": "coinpayee/django-short-urls",
"path": "/django_short_urls/int_to_alnum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Converts an int to an alphanumerical string"""
if decoded == 0:
return alphabet[0]
base = len(alphabet)
encoded = []
while decoded:
encoded.append(alphabet[decoded % base])
decoded = decoded // base
encoded.reverse()
return ''.join(encoded)
def ... | code_fim | medium | {
"lang": "python",
"repo": "coinpayee/django-short-urls",
"path": "/django_short_urls/int_to_alnum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>XP_ILLEGAL_FUNCTION = 0x01
EXP_DATA_ADDRESS = 0x02
EXP_DATA_VALUE = 0x03
EXP_SLAVE_DEVICE_FAILURE = 0x04
EXP_ACKNOWLEDGE = 0x05
EXP_SLAVE_DEVICE_BUSY = 0x06
EXP_MEMORY_PARITY_ERROR = 0x08
EXP_GATEWAY_PATH_UNAVAILABLE = 0x0A
EXP_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND = 0x0B
## Module error codes
MB_NO_ERR... | code_fim | hard | {
"lang": "python",
"repo": "type-a/test-final",
"path": "/pyModbusTCP-0.1.1/pyModbusTCP/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: type-a/test-final path: /pyModbusTCP-0.1.1/pyModbusTCP/constants.py
# -*- coding: utf-8 -*-
VERSION = '0.1.1'
## ModBus/TCP
MODBUS_PORT = 502
## Modbus mode
MODBUS_TCP = 1
MODBUS_RTU = 2
## Modbus function code
# standard
READ_COILS = 0x01
READ_DISCRETE_INPUTS = 0x02
READ_HOLDING_REGISTERS <|fim... | code_fim | hard | {
"lang": "python",
"repo": "type-a/test-final",
"path": "/pyModbusTCP-0.1.1/pyModbusTCP/constants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rfikki/pydevp2p path: /devp2p/tests/test_connection_strategy.py
import time
import networkx as nx
import matplotlib.pyplot as plt
import devp2p.kademlia
from test_kademlia_protocol import test_many
from collections import OrderedDict
import random
random.seed(42)
class ConnectableNodeBase(obje... | code_fim | hard | {
"lang": "python",
"repo": "rfikki/pydevp2p",
"path": "/devp2p/tests/test_connection_strategy.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create ConnectableNode instances
print 'executing connection strategy'
network = OrderedDict() # node.id -> Node
# .process executes all messages on the network
network.process = lambda: kademlia_protocols[0].wire.process(kademlia_protocols)
# wrap protos in connectable nodes a... | code_fim | hard | {
"lang": "python",
"repo": "rfikki/pydevp2p",
"path": "/devp2p/tests/test_connection_strategy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert other in self.connections
self.connections.remove(other)
def find_targets(self):
"call find node to fill buckets with addresses close to the target"
for t in self.targets:
self.proto.find_node(t['address'])
self.network.process()
def... | code_fim | hard | {
"lang": "python",
"repo": "rfikki/pydevp2p",
"path": "/devp2p/tests/test_connection_strategy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = union.dispatch(DataFrame)(x, y)
return reconstruct_tibble(x, out, keep_rowwise=True)
@setdiff.register(DataFrame, context=Context.EVAL)
def _(x: DataFrame, y: DataFrame) -> DataFrame:
"""Set diff of two dataframes
Args:
_data, *datas: Dataframes to perform operations
... | code_fim | hard | {
"lang": "python",
"repo": "Gedevan-Aleksizde/datar",
"path": "/datar/dplyr/sets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gedevan-Aleksizde/datar path: /datar/dplyr/sets.py
"""Set operations
https://github.com/tidyverse/dplyr/blob/master/R/sets.r
"""
import pandas
from pandas import DataFrame
from pipda import register_verb
from pipda.utils import CallingEnvs
from ..core.contexts import Context
from ..core.groupe... | code_fim | hard | {
"lang": "python",
"repo": "Gedevan-Aleksizde/datar",
"path": "/datar/dplyr/sets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: txtbits/daw-python path: /Basesdedatos/ejemplo_sqlite/ciclistas.py
# -*- coding: utf-8 -*-
import sqlite3 as bd
import matplotlib.pyplot as plt
# crear basde de datos de ciclistas
# crear tablas
# insertar datos
def crea_inserta(conexion):
datos = open('ciclismo_BD.sql').read()
curso... | code_fim | medium | {
"lang": "python",
"repo": "txtbits/daw-python",
"path": "/Basesdedatos/ejemplo_sqlite/ciclistas.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
conexion = bd.connect('ciclistas.dat')
#crea_inserta(conexion)
cons = 'select * from maillot'
#consulta(conexion, cons)
grafico(conexion,'select nompuerto,altura from puerto')
conexion.close()<|fim_prefix|># repo: txtbits/daw-python path: /Basesdedatos/... | code_fim | hard | {
"lang": "python",
"repo": "txtbits/daw-python",
"path": "/Basesdedatos/ejemplo_sqlite/ciclistas.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.skip(reason="Kofia API needs to be investigated.")
def test_kofia_fetch_data():
provider = Kofia()
from_date, to_date = parse_date("2016-05-01"), parse_date("2016-05-30")
data = provider.fetch_data("KR5223941018", from_date, to_date)
for date, unit_price, quantity in data:
... | code_fim | hard | {
"lang": "python",
"repo": "suminb/finance",
"path": "/tests/test_providers.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_kofia_request_headers():
provider = Kofia()
headers = provider.request_headers
assert "Origin" in headers
assert "kofia.or.kr" in headers["Origin"]
assert "User-Agent" in headers
assert "Content-Type" in headers
assert headers["Content-Type"] == "text/xml"
ass... | code_fim | hard | {
"lang": "python",
"repo": "suminb/finance",
"path": "/tests/test_providers.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suminb/finance path: /tests/test_providers.py
import decimal
import os
from datetime import datetime, time, timedelta
import pytest
from finance.models import Granularity
from finance.providers import Dart, Kofia, Miraeasset
from finance.providers.dart import Report as DartReport
from finance.p... | code_fim | hard | {
"lang": "python",
"repo": "suminb/finance",
"path": "/tests/test_providers.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> save_result(result, results_folder / "result.yml", allow_overwrite=True)
end2 = timer()
print(f"Saving took: {end2 - end}")
# %%
print(result.markdown(True))
# %%
res = result.data["dataset1"]
# Tip: print the xarray object to explore its content
print(res)
# %% Set... | code_fim | hard | {
"lang": "python",
"repo": "glotaran/pyglotaran-examples",
"path": "/pyglotaran_examples/study_fluorescence/target_analysis_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glotaran/pyglotaran-examples path: /pyglotaran_examples/study_fluorescence/target_analysis_script.py
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
from timeit import default_timer as timer
import matplotlib.pyplot as plt
from glotaran.io import load_d... | code_fim | hard | {
"lang": "python",
"repo": "glotaran/pyglotaran-examples",
"path": "/pyglotaran_examples/study_fluorescence/target_analysis_script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biomed-AI/MolRep path: /MolRep/Interactions/link_models/CFLP/utils.py
T = ward_hierarchy(adj, k)
elif method == 'jaccard':
T = jaccard_index(adj, k)
elif method == 'sbm':
T = SBM(adj, k)
return T
def SBM(adj, k):
nx_g = nx.from_scipy_sparse_matrix(adj)
standa... | code_fim | hard | {
"lang": "python",
"repo": "biomed-AI/MolRep",
"path": "/MolRep/Interactions/link_models/CFLP/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def eval_ep_batched(logits, labels, n_pos, evaluator=None):
# roc-auc and ap
roc_auc = roc_auc_score(labels, logits)
ap_score = average_precision_score(labels, logits)
results = {'auc': roc_auc,
'ap': ap_score}
# hits@K
if evaluator is None:
evaluator = Evalu... | code_fim | hard | {
"lang": "python",
"repo": "biomed-AI/MolRep",
"path": "/MolRep/Interactions/link_models/CFLP/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def step(self):
for op in self.optimizers:
op.step()
def no_update(self, base_lr):
return base_lr
def update_lr_SGDR(self, base_lr):
end_lr = 1e-3 # 0.001
total_T = self.total_epoch + 1
if total_T >= self.next_start_step:
self.st... | code_fim | hard | {
"lang": "python",
"repo": "biomed-AI/MolRep",
"path": "/MolRep/Interactions/link_models/CFLP/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if n <=20: return -1
l = [ int(i) for i in str(n)]
if l.count(l[0]) == len(l): return -1
import collections
c = collections.Counter(l)
c1 = dict(c)
s = l.copy()
s.sort()
if s[0] == 0:
for a in range(1,len(s)):
if s[a]!= 0:
... | code_fim | hard | {
"lang": "python",
"repo": "azuretime/Codewars-Python-Practice",
"path": "/4kyu/next_smaller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: azuretime/Codewars-Python-Practice path: /4kyu/next_smaller.py
#https://www.codewars.com/kata/next-smaller-number-with-the-same-digits
def next_smaller(n):
s = list(str(n))
i = j = len(s) - 1
while i > 0 and s[i - 1] <= s[i]: i -= 1
# s[i - 1] : the lowerest digit which is > the ... | code_fim | hard | {
"lang": "python",
"repo": "azuretime/Codewars-Python-Practice",
"path": "/4kyu/next_smaller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CDDLeiden/DrugEx path: /drugex/molecules/converters/tests.py
"""
tests.py
Created by: Martin Sicho
On: 22.04.22, 13:40
"""
from unittest import TestCase
from drugex.molecules.converters.standardizers import DefaultStandardizer
from drugex.molecules.mol import DrExMol
from drugex.molecules.suppl... | code_fim | hard | {
"lang": "python",
"repo": "CDDLeiden/DrugEx",
"path": "/drugex/molecules/converters/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Tests whether the default standardizer is working as expected.
Returns: None
"""
standardized_mols = StandardizedSupplier(["c1ccccc1CN(=O)", "CC(=O)[O-]", "CCCCn1cc[n+](c1)C.F[P-](F)(F)(F)(F)F"], standardizer=DefaultStandardizer())
expected = (
... | code_fim | hard | {
"lang": "python",
"repo": "CDDLeiden/DrugEx",
"path": "/drugex/molecules/converters/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get the names of all the included files
includes = set()
for header in headers:
if header.name in known_failures:
print(f"Skipping file {header}")
continue
for include in get_includes(header):
print(f"{header}: {include}")
incl... | code_fim | medium | {
"lang": "python",
"repo": "graphcore/popart",
"path": "/tests/integration/boost_free_interface_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> known_failures = ["testdevice.hpp", "mergevarupdates.hpp"]
# get the names of all the included files
includes = set()
for header in headers:
if header.name in known_failures:
print(f"Skipping file {header}")
continue
for include in get_includes(hea... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/popart",
"path": "/tests/integration/boost_free_interface_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: graphcore/popart path: /tests/integration/boost_free_interface_test.py
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
# This test checks through all the header files it can find
# in the argument path and checks the files "#include"
# statements for boost headers.
# Usage:
# python3 b... | code_fim | medium | {
"lang": "python",
"repo": "graphcore/popart",
"path": "/tests/integration/boost_free_interface_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mewbak/gtirb path: /python/gtirb/auxdata.py
from io import BytesIO
import AuxData_pb2
import AuxDataContainer_pb2
from .node import Node
from .serialization import Serialization
class AuxData:
"""Types and operations for auxiliary data. AuxData objects can be
attached to the IR or in... | code_fim | hard | {
"lang": "python",
"repo": "mewbak/gtirb",
"path": "/python/gtirb/auxdata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _to_protobuf(self):
proto_auxdatacontainer = AuxDataContainer_pb2.AuxDataContainer()
for k, v in self.aux_data.items():
proto_auxdatacontainer.aux_data[k].CopyFrom(v._to_protobuf())
return proto_auxdatacontainer
def deep_eq(self, other):
"""Compare ... | code_fim | hard | {
"lang": "python",
"repo": "mewbak/gtirb",
"path": "/python/gtirb/auxdata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Note that because AuxData can store any type of data, it is not deeply
checked. This method only checks that two AuxDataContainers contain the
same keys.
"""
if not isinstance(other, AuxDataContainer):
return False
if (
self.uuid != ... | code_fim | hard | {
"lang": "python",
"repo": "mewbak/gtirb",
"path": "/python/gtirb/auxdata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cellml/libcellml path: /tests/resources/generator/robertson_model_1966/model.ode.py
# The content of this file was generated using the Python profile of libCellML 0.4.0.
from enum import Enum
from math import *
__version__ = "0.4.0"
LIBCELLML_VERSION = "0.4.0"
STATE_COUNT = 3
VARIABLE_COUNT =... | code_fim | hard | {
"lang": "python",
"repo": "cellml/libcellml",
"path": "/tests/resources/generator/robertson_model_1966/model.ode.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> rates[0] = -variables[0]*states[0]+variables[1]*states[2]*states[1]
rates[2] = variables[0]*states[0]-variables[2]*pow(states[2], 2.0)-variables[1]*states[2]*states[1]
rates[1] = variables[2]*pow(states[2], 2.0)
def compute_variables(voi, states, rates, variables):
variables[3] = 10000.0... | code_fim | hard | {
"lang": "python",
"repo": "cellml/libcellml",
"path": "/tests/resources/generator/robertson_model_1966/model.ode.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zhaoxiaolistudy/CNN-for-CQA path: /Separator.py
# -*- coding: utf-8 -*-
'''
Created on 2013-3-13
@author: hmwv1114
'''
import shelve
from com.util.PageGroup import PageGroup
import time
import shutil
from datetime import date
import os
def classupcast(categories, category):
for a,b,c,d in c... | code_fim | hard | {
"lang": "python",
"repo": "Zhaoxiaolistudy/CNN-for-CQA",
"path": "/Separator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.chdir(newFolderName)
try:
#create new database
db = shelve.open(origine+'.dat', 'c')
questionTable = db['Table']
if db.has_key('pageGroupList'):
pageGroupList = db['pageGroupList']
else:
pageGroupList = []
... | code_fim | hard | {
"lang": "python",
"repo": "Zhaoxiaolistudy/CNN-for-CQA",
"path": "/Separator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class EventSerializer(serializers.Serializer):
"""Serializer for calendar events displayed in fullcalendar"""
taskId = serializers.IntegerField()
title = serializers.CharField()
id = serializers.IntegerField()
start = serializers.DateTimeField()
end = serializers.DateTimeField()
... | code_fim | medium | {
"lang": "python",
"repo": "Guilouf/AgenDjang",
"path": "/hostproject/agendjang/serializers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Guilouf/AgenDjang path: /hostproject/agendjang/serializers.py
from rest_framework import serializers
from agendjang.models import Task, DateRange
<|fim_suffix|> id = serializers.IntegerField()
start = serializers.DateTimeField()
end = serializers.DateTimeField()
allDay = serializ... | code_fim | hard | {
"lang": "python",
"repo": "Guilouf/AgenDjang",
"path": "/hostproject/agendjang/serializers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> zenith_source = moonsky
Ntimes = 500
ets = np.linspace(0, 4 * 28 * 24 * 3600, Ntimes)
times = zenith_source.time + TimeDelta(ets, format="sec")
lmns = np.zeros((Ntimes, 3))
for ti in range(Ntimes):
zenith_source.update_positions(times[ti], zenith_source.telescope_location... | code_fim | hard | {
"lang": "python",
"repo": "RadioAstronomySoftwareGroup/pyradiosky",
"path": "/tests/test_skymodel.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RadioAstronomySoftwareGroup/pyradiosky path: /tests/test_skymodel.py
o("icrs")
stokes = units.Quantity(np.zeros((4, 1, hp_obj.npix)), unit=units.K)
stokes[0] += 1 << units.K
freq = 75 * units.MHz
yield hp_obj, coords_icrs, stokes, freq
del hp_obj, coords_icrs, stokes, freq
... | code_fim | hard | {
"lang": "python",
"repo": "RadioAstronomySoftwareGroup/pyradiosky",
"path": "/tests/test_skymodel.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RadioAstronomySoftwareGroup/pyradiosky path: /tests/test_skymodel.py
ert mock_sky.name.tolist() == expected_names
def test_read_text_errors(tmp_path):
skyobj = SkyModel.from_file(GLEAM_vot, spectral_type="subband", with_error=True)
skyobj.at_frequencies(skyobj.freq_array)
fname = o... | code_fim | hard | {
"lang": "python",
"repo": "RadioAstronomySoftwareGroup/pyradiosky",
"path": "/tests/test_skymodel.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fizzoo/kod path: /python/interviewbit/largest-distance-between-nodes-of-a-tree.py
def maxtwo(a, b, n):
# sort s.t. a > b > n, return a, b.
if b > a:
# shouldn't occur if always using this one, but ensure this
b, a = a, b
if n > a:
return n, a
elif n ... | code_fim | hard | {
"lang": "python",
"repo": "fizzoo/kod",
"path": "/python/interviewbit/largest-distance-between-nodes-of-a-tree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.adj = [[] for _ in A]
for i, a in enumerate(A):
if a == -1:
root = i
else:
self.adj[a].append(i)
dists = [-2] * len(A)
maxtwos = [-2] * len(A)
s = [root]
while s:
... | code_fim | hard | {
"lang": "python",
"repo": "fizzoo/kod",
"path": "/python/interviewbit/largest-distance-between-nodes-of-a-tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elifesciences-publications/saenopy path: /saenopy/__init__.py
from . import numbaOverload
from .loa<|fim_suffix|>FiniteBodyForces import FiniteBodyForces, load, save
__version__ = '0.7.2'<|fim_middle|>d import *
from .save import *
from . | code_fim | easy | {
"lang": "python",
"repo": "elifesciences-publications/saenopy",
"path": "/saenopy/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>es, load, save
__version__ = '0.7.2'<|fim_prefix|># repo: elifesciences-publications/saenopy path: /saenopy/__init__.py
from . import numbaOverload
from .load import *
from .save import *
from .<|fim_middle|>FiniteBodyForces import FiniteBodyForc | code_fim | easy | {
"lang": "python",
"repo": "elifesciences-publications/saenopy",
"path": "/saenopy/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert per_decoder(per_stream=bytearray.fromhex('8004F401640202DEAD02BEEF'), asn1Spec=MySeq()) == DATA_first_sequence()
def test_seq_of_seq_of_of_seq_in_root_can_be_decoded():
assert per_decoder(per_stream=bytearray.fromhex('80010A0114'), asn1Spec=OuterSeq()) == DATA_seq__of__seq_of__of__seq_in_... | code_fim | medium | {
"lang": "python",
"repo": "erupikus/asn1PERser",
"path": "/asn1PERser/test/per/decoder/test_per_decode_mixed_schemas.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erupikus/asn1PERser path: /asn1PERser/test/per/decoder/test_per_decode_mixed_schemas.py
import pytest
from asn1PERser.codec.per.decoder import decode as per_decoder
from asn1PERser.test.per.encoder.test_per_encode_mixed_schemas import DATA_first_sequence, MySeq, \
DATA_seq__of__seq_of__of__se... | code_fim | hard | {
"lang": "python",
"repo": "erupikus/asn1PERser",
"path": "/asn1PERser/test/per/decoder/test_per_decode_mixed_schemas.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ra1nb0rn/avain path: /modules/web/crawler/crawler.py
set()
# store the text in a separate file for Linkfinder
tmp_filename_in = "linkfinder_tmp_%d.in" % random.randint(0, 2**32)
with open(tmp_filename_in, "w") as f:
f.write(text)
# Run Linkfinder as s... | code_fim | hard | {
"lang": "python",
"repo": "ra1nb0rn/avain",
"path": "/modules/web/crawler/crawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Extract code comments from the response's content. Regardless of the response's
content type, the content is searched for HTML comments '<!-- .... -->', JS line
comments '//...' and JS block comments '/* ... */'.
"""
# use the comment_parser package to ... | code_fim | hard | {
"lang": "python",
"repo": "ra1nb0rn/avain",
"path": "/modules/web/crawler/crawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ra1nb0rn/avain path: /modules/web/crawler/crawler.py
el.xpath("@href")
if href_sels:
href = href_sels.extract_first()
base_domain = urllib.parse.urlparse(href).netloc
break
# setup allowed domains and extract... | code_fim | hard | {
"lang": "python",
"repo": "ra1nb0rn/avain",
"path": "/modules/web/crawler/crawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomaszpiotro/honeypot_reports path: /reports/miner/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.Creat... | code_fim | hard | {
"lang": "python",
"repo": "tomaszpiotro/honeypot_reports",
"path": "/reports/miner/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> },
bases=(models.Model,),
),
migrations.CreateModel(
name='Operation',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('start', models.DateTimeField(verbos... | code_fim | hard | {
"lang": "python",
"repo": "tomaszpiotro/honeypot_reports",
"path": "/reports/miner/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Leaky_relu activation with alpha changed to 0.1 by default.
"""
return tf.nn.leaky_relu(x, alpha=alpha)<|fim_prefix|># repo: GinnyWeasley-Tech/neuroaikit path: /neuroaikit/tf/activations.py
"""Activations provided by NeuroAI Toolkit.
"""
import tensorflow as tf
def step_function... | code_fim | hard | {
"lang": "python",
"repo": "GinnyWeasley-Tech/neuroaikit",
"path": "/neuroaikit/tf/activations.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GinnyWeasley-Tech/neuroaikit path: /neuroaikit/tf/activations.py
"""Activations provided by NeuroAI Toolkit.
"""
import tensorflow as tf
def step_function(x, pseudoderivative_of=tf.nn.tanh):
"""Step function activation that in backward pass acts as if it was a function given in the
... | code_fim | medium | {
"lang": "python",
"repo": "GinnyWeasley-Tech/neuroaikit",
"path": "/neuroaikit/tf/activations.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kdart/pycopia path: /core/pycopia/interactive.py
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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 c... | code_fim | hard | {
"lang": "python",
"repo": "kdart/pycopia",
"path": "/core/pycopia/interactive.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
## readline key bindings
if sys.platform =="darwin":
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
##readline.parse_and_bind("tab: menu-complete")
#readline.parse_and_bind('"?": possible-completions')
readline.parse_and_bind('"\M-?": possible-co... | code_fim | hard | {
"lang": "python",
"repo": "kdart/pycopia",
"path": "/core/pycopia/interactive.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tammo42/AoC_2020 path: /09.py
from adventofcode import AdventDay
from concurrent.futures import ThreadPoolExecutor
import os
def prev_n(li, index, count=0) -> list:
if index < count:
raise Exception("prevn: " + "The index was too low to provide " + str(count) + " numbers.")
retur... | code_fim | hard | {
"lang": "python",
"repo": "Tammo42/AoC_2020",
"path": "/09.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("The sum of the smallest (" + str(smallest) + ") and largest" \
+ " number (" + str(largest) + ") is", smallest+largest)
pass
pass
input_path = os.path.dirname(os.path.realpath(__file__)) + "/09-01_input.txt"
mission = Day09_01(input_path)
mission.do()
print("")
... | code_fim | hard | {
"lang": "python",
"repo": "Tammo42/AoC_2020",
"path": "/09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KTH-dESA/OnSSET-2016 path: /onsset/__init__.py
"""
The onsset package contains the following modules:
<|fim_suffix|>__version__ = "2019.0"
from .onsset import *<|fim_middle|> - onsset.py : main functions of the model
- runner.py : runner is used to calibrate inputs and specify scenario runs
""... | code_fim | medium | {
"lang": "python",
"repo": "KTH-dESA/OnSSET-2016",
"path": "/onsset/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__version__ = "2019.0"
from .onsset import *<|fim_prefix|># repo: KTH-dESA/OnSSET-2016 path: /onsset/__init__.py
"""
The onsset package contains the following modules:
<|fim_middle|> - onsset.py : main functions of the model
- runner.py : runner is used to calibrate inputs and specify scenario runs
""... | code_fim | medium | {
"lang": "python",
"repo": "KTH-dESA/OnSSET-2016",
"path": "/onsset/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert output_result.success
assert pd.read_csv(temp_file_name).to_dict('list') == {
'num1': [1, 3],
'num2': [2, 4],
'sum': [3, 7],
}
def create_definition_based_solid():
table_input = InputDefinition('num_csv', dagster_pd.DataFrame)
... | code_fim | hard | {
"lang": "python",
"repo": "mistercrunch/dagster",
"path": "/python_modules/dagster/dagster/pandas/pandas_tests/test_pandas_hello_world_library_slide.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mistercrunch/dagster path: /python_modules/dagster/dagster/pandas/pandas_tests/test_pandas_hello_world_library_slide.py
import pandas as pd
from dagster import (
DependencyDefinition,
InputDefinition,
OutputDefinition,
config,
execute_pipeline,
lambda_solid,
PipelineD... | code_fim | hard | {
"lang": "python",
"repo": "mistercrunch/dagster",
"path": "/python_modules/dagster/dagster/pandas/pandas_tests/test_pandas_hello_world_library_slide.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> app = self._app
app.child('Movie').point()
time.sleep(1)
app.child('Movie').click()
time.sleep(2)
app.child('Open...').point()
time.sleep(1)
app.child('Open...').click()
time.sleep(2)
app.child('Home').click()
time.sle... | code_fim | medium | {
"lang": "python",
"repo": "srautomation/srautogitmation",
"path": "/sr_automation/platform/linux/applications/Totem/Totem.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srautomation/srautogitmation path: /sr_automation/platform/linux/applications/Totem/Totem.py
import time
from Application import _Application
class Totem(_Application):
def __init__(self, linux):
<|fim_suffix|> self._dogtail = self._linux.ui.dogtail
self._process = self._linux... | code_fim | medium | {
"lang": "python",
"repo": "srautomation/srautogitmation",
"path": "/sr_automation/platform/linux/applications/Totem/Totem.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._dogtail = self._linux.ui.dogtail
self._process = self._linux.cmd("totem")
time.sleep(9)
self._app = self._dogtail.tree.root.application("totem")
def stop(self):
if self._process.is_running():
self._process.terminate()
def open(self, movie... | code_fim | medium | {
"lang": "python",
"repo": "srautomation/srautogitmation",
"path": "/sr_automation/platform/linux/applications/Totem/Totem.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.setFocusPolicy(Qt.StrongFocus)
self.setReadOnly(False)
def lock(self):
self.setFocusPolicy(Qt.NoFocus)
self.setReadOnly(True)<|fim_prefix|># repo: erfanmalakooti/wordperil path: /src/wordperil/interface/solvebar.py
from PySide2.QtWidgets import QLineEdit
from PyS... | code_fim | hard | {
"lang": "python",
"repo": "erfanmalakooti/wordperil",
"path": "/src/wordperil/interface/solvebar.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erfanmalakooti/wordperil path: /src/wordperil/interface/solvebar.py
from PySide2.QtWidgets import QLineEdit
from PySide2.QtGui import QFont
from PySide2.QtCore import Qt
class SolveBar(QLineEdit):
style = """
background-color: black;
color: green;
"""
font = QFont(... | code_fim | medium | {
"lang": "python",
"repo": "erfanmalakooti/wordperil",
"path": "/src/wordperil/interface/solvebar.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def showMessage(self, message):
self.lock()
self.setText(message)
def showPrompt(self, message):
self.setText("")
self.unlock()
self.setPlaceholderText(message)
def getText(self):
return self.text
def unlock(self):
self.setFocusPol... | code_fim | hard | {
"lang": "python",
"repo": "erfanmalakooti/wordperil",
"path": "/src/wordperil/interface/solvebar.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Draw detected bounding boxes. Adapted from Ross Girshick's Fast R-CNN"""
im = im[:, :, (2, 1, 0)]
fig, ax = plt.subplots(figsize=(12, 12))
ax.imshow(im, aspect='equal')
ax.add_patch(
plt.Rectangle((bbox[0], bbox[1]),
bbox[2] - bbox[0],
... | code_fim | hard | {
"lang": "python",
"repo": "debidatta/RenderForCNN",
"path": "/detection_render_pipeline/detection_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(output_file, 'w') as f:
for im_file in glob.glob(path_rendered_images+'/*/*'+ext):
f.write('%s '%im_file)
bbox = get_bbox(im_file)
f.write('%s %s %s %s\n'%(tuple(bbox)))
def vis_bbox(im, bbox):
"""Draw detected bounding boxes. Adapted from Ro... | code_fim | medium | {
"lang": "python",
"repo": "debidatta/RenderForCNN",
"path": "/detection_render_pipeline/detection_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: debidatta/RenderForCNN path: /detection_render_pipeline/detection_utils.py
import glob
import cv2
import matplotlib.pyplot as plt
def get_bbox(im_file, visualize=False):
"""Gets bounding box of a single object in a image against a black background"""
im = cv2.imread(im_file)
non_blac... | code_fim | hard | {
"lang": "python",
"repo": "debidatta/RenderForCNN",
"path": "/detection_render_pipeline/detection_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>), name="user-page"),
url(r'^register_child/$', child_form, name='register_child'),
]<|fim_prefix|># repo: kotys07/final_project path: /apps/user_profile/urls.py
from django.conf.urls import url
from apps.user_profile.views import (
RegisterFormView,
UserPageView,
child_form)
urlpatterns... | code_fim | medium | {
"lang": "python",
"repo": "kotys07/final_project",
"path": "/apps/user_profile/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kotys07/final_project path: /apps/user_profile/urls.py
from django.conf.urls import url
from apps.user_profile.views import (
RegisterFormV<|fim_suffix|>ormView.as_view(), name="register"),
url(r'^(?P<pk>[0-9]+)/$', UserPageView.as_view(), name="user-page"),
url(r'^register_child/$', ... | code_fim | medium | {
"lang": "python",
"repo": "kotys07/final_project",
"path": "/apps/user_profile/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.before_first_request
def create_tables():
db.create_all()
from resume import routes<|fim_prefix|># repo: ShubhamPalriwala/Resume-Generator path: /resume/__init__.py
from flask import Flask
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
... | code_fim | hard | {
"lang": "python",
"repo": "ShubhamPalriwala/Resume-Generator",
"path": "/resume/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShubhamPalriwala/Resume-Generator path: /resume/__init__.py
from flask import Flask
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
import subprocess as sp
from flask_mail import Mail
from dotenv import l... | code_fim | hard | {
"lang": "python",
"repo": "ShubhamPalriwala/Resume-Generator",
"path": "/resume/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CrackerCat/ida-qscripts path: /test_scripts/trigger-native/qscripts_native.py
import time
# Give the linker time to finish flushing the binary
time.sleep(1)
<|fim_suffix|># Optionally, do post work, etc.<|fim_middle|># Optionally clear the screen:
#idaapi.msg_clear()
# Load your plugin... | code_fim | medium | {
"lang": "python",
"repo": "CrackerCat/ida-qscripts",
"path": "/test_scripts/trigger-native/qscripts_native.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Optionally, do post work, etc.<|fim_prefix|># repo: CrackerCat/ida-qscripts path: /test_scripts/trigger-native/qscripts_native.py
import time
# Give the linker time to finish flushing the binary
time.sleep(1)
<|fim_middle|># Optionally clear the screen:
#idaapi.msg_clear()
# Load your plugin... | code_fim | medium | {
"lang": "python",
"repo": "CrackerCat/ida-qscripts",
"path": "/test_scripts/trigger-native/qscripts_native.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>parator = '\.'
kSeriePrefix = 's'
kEpisodePrefix = 'e'
movie = ''
serie = ''<|fim_prefix|># repo: marcomaio/MediaMover path: /common/types.py
class UserTypes:
kStandardDelimiter = ' '
<|fim_middle|> kStandardSeparator = '-'
kForbiddenSerieSe | code_fim | easy | {
"lang": "python",
"repo": "marcomaio/MediaMover",
"path": "/common/types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>dePrefix = 'e'
movie = ''
serie = ''<|fim_prefix|># repo: marcomaio/MediaMover path: /common/types.py
class UserTypes:
kStandardDelimiter = ' '
kStandardSeparator = '-'
kForbiddenSerieSe<|fim_middle|>parator = '\.'
kSeriePrefix = 's'
kEpiso | code_fim | easy | {
"lang": "python",
"repo": "marcomaio/MediaMover",
"path": "/common/types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcomaio/MediaMover path: /common/types.py
class UserTypes:
kStandardDelimiter = ' '
kStandardSeparator = '-'
kForbiddenSerieSe<|fim_suffix|>dePrefix = 'e'
movie = ''
serie = ''<|fim_middle|>parator = '\.'
kSeriePrefix = 's'
kEpiso | code_fim | easy | {
"lang": "python",
"repo": "marcomaio/MediaMover",
"path": "/common/types.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.