text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
def in_list(value, arg):
return value in (arg or [])
register = template.Library()
register.filter(in_list)<|fim_prefix|># repo: django-helpdesk/django-helpdesk path: /helpdesk/templatetags/in_list.py
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
<|fim_middle|>(c) Co... | code_fim | hard | {
"lang": "python",
"repo": "django-helpdesk/django-helpdesk",
"path": "/helpdesk/templatetags/in_list.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return value in (arg or [])
register = template.Library()
register.filter(in_list)<|fim_prefix|># repo: django-helpdesk/django-helpdesk path: /helpdesk/templatetags/in_list.py
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved.... | code_fim | hard | {
"lang": "python",
"repo": "django-helpdesk/django-helpdesk",
"path": "/helpdesk/templatetags/in_list.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UrielCode/python-fundamentos path: /04_convertir_datos.py
# Convertir de número a string
numero1 = input('Escribe un número: ') #4
numero2 = input('Escribe otro número: ') #4
<|fim_suffix|># Convertir el texto en un número entero para poderlo sumar e imprimir
numero1 = int(input('Escribe un núm... | code_fim | easy | {
"lang": "python",
"repo": "UrielCode/python-fundamentos",
"path": "/04_convertir_datos.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Convertir el texto en un número entero para poderlo sumar e imprimir
numero1 = int(input('Escribe un número: ')) #4
numero2 = int(input('Escribe otro número: ')) #4
numero1 + numero2 # Salida 8
# Converti de número a string
str(numero1)<|fim_prefix|># repo: UrielCode/python-fundamentos path: /04_conv... | code_fim | easy | {
"lang": "python",
"repo": "UrielCode/python-fundamentos",
"path": "/04_convertir_datos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Converti de número a string
str(numero1)<|fim_prefix|># repo: UrielCode/python-fundamentos path: /04_convertir_datos.py
# Convertir de número a string
numero1 = input('Escribe un número: ') #4
numero2 = input('Escribe otro número: ') #4
<|fim_middle|>numero1 + numero2 # Salida '44'
# Convertir el te... | code_fim | hard | {
"lang": "python",
"repo": "UrielCode/python-fundamentos",
"path": "/04_convertir_datos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: negati-ve/piton3 path: /piton/utils/installer.py
import os
import sys
# import pip
import subprocess
import shutil
from . import sneak_config, python_modules
<|fim_suffix|> sneak_config.sneak_config_setup()
if version:
install_item = package+"=="+version
else:
install_item = package
print... | code_fim | medium | {
"lang": "python",
"repo": "negati-ve/piton3",
"path": "/piton/utils/installer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def remove(package):
metadata = python_modules.get_package(os.path.join(os.getcwd(), "python_modules"), package)
if not metadata:
return False
pending_removals = []
pending_removals += metadata.top_level_packs
pending_removals.append(metadata.dist_info)
for pending_removal in pending_removals:
t... | code_fim | hard | {
"lang": "python",
"repo": "negati-ve/piton3",
"path": "/piton/utils/installer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vilkasgroup/epages_client path: /epages_client/dataobjects/script_tag_create.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .data_object import DataObject
<|fim_suffix|> def is_valid(self):
# Script url must be set always
if not self._scriptUrl:
... | code_fim | hard | {
"lang": "python",
"repo": "vilkasgroup/epages_client",
"path": "/epages_client/dataobjects/script_tag_create.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._scriptUrl
@scriptUrl.setter
def scriptUrl(self, value):
self._scriptUrl = self._check_url(value, "ScriptUrl has to be a str.")
def is_valid(self):
# Script url must be set always
if not self._scriptUrl:
return False
else:
... | code_fim | hard | {
"lang": "python",
"repo": "vilkasgroup/epages_client",
"path": "/epages_client/dataobjects/script_tag_create.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: readex-eu/readex-scorep path: /vendor/otf2/test/python/test_otf2_io.py
import os
import os.path
import unittest
from shutil import rmtree
from tempfile import mkdtemp
import time
import otf2
TIMER_GRANULARITY = 1000000
def t():
return int(round(time.time() * TIMER_GRANULARITY))
class T... | code_fim | hard | {
"lang": "python",
"repo": "readex-eu/readex-scorep",
"path": "/vendor/otf2/test/python/test_otf2_io.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_handle = trace.definitions.io_handle('', file, posix_paradigm)
directory_handle = trace.definitions.io_handle('', directory, mpi_io_paradigm)
writer.io_create_handle(t(), file_handle, otf2.IoAccessMode.WRITE_ONLY,
otf2.IoCreatio... | code_fim | hard | {
"lang": "python",
"repo": "readex-eu/readex-scorep",
"path": "/vendor/otf2/test/python/test_otf2_io.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoaoMoreira2002/Linguagens-de-programacao path: /Python/pythonProject/exercise/ex017.py
import random
a1 = str(input('aluno 1:'))
a2 = str(inpu<|fim_suffix|>t('aluno 4:'))
lista = [a1, a2, a3, a4]
random.shuffle(lista)
print('e a ordem escolhida foi {}' .format(lista))<|fim_middle|>t('aluno 2:'))... | code_fim | easy | {
"lang": "python",
"repo": "JoaoMoreira2002/Linguagens-de-programacao",
"path": "/Python/pythonProject/exercise/ex017.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ista)
print('e a ordem escolhida foi {}' .format(lista))<|fim_prefix|># repo: JoaoMoreira2002/Linguagens-de-programacao path: /Python/pythonProject/exercise/ex017.py
import random
a1 = str(input('aluno 1:'))
a2 = str(input('aluno 2:'))
a3 = str(input('aluno 3:'))
a4 = str(inpu<|fim_middle|>t('aluno 4:'))... | code_fim | easy | {
"lang": "python",
"repo": "JoaoMoreira2002/Linguagens-de-programacao",
"path": "/Python/pythonProject/exercise/ex017.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StamKaly/altitude-mod-foundation path: /altitude/commands.py
class Commands:
def __init__(self, players_object, port, command_file):
self.players = players_object
self.command_file = command_file
self.console = "{},console,".format(port)
def write_command(self, cm... | code_fim | hard | {
"lang": "python",
"repo": "StamKaly/altitude-mod-foundation",
"path": "/altitude/commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def plane_scale(self, scale):
"""
Modifies the scale of each player's plane.
:param scale: A number between 40 and 300
"""
cmd = '{}testPlaneScale {}'.format(self.console, scale)
self.write_command(cmd)
def gravity_modifier(self, mode):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "StamKaly/altitude-mod-foundation",
"path": "/altitude/commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def ticker_to_df(
ticker: Ticker,
column_list: List[str] = None,
) -> pd.DataFrame:
"""Converts a ticker to a "pandas.DataFrame".
Args:
ticker (Ticker):
Ticker to convert.
column_list (List[str]):
Mandatory fields : will be set to "None" if empty.
... | code_fim | hard | {
"lang": "python",
"repo": "simon-saliba/degiro-connector",
"path": "/degiro_connector/quotecast/helpers/pb_handler.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> json_format.ParseDict(
js_dict=js_dict,
message=message,
ignore_unknown_fields=True,
descriptor_pool=None,
)
# GRPC TO API
def quotecast_request_to_api(request: Quotecast.Request) -> str:
payload = '{"controlData":"'
for vwd_id in request.subscriptions:
... | code_fim | hard | {
"lang": "python",
"repo": "simon-saliba/degiro-connector",
"path": "/degiro_connector/quotecast/helpers/pb_handler.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simon-saliba/degiro-connector path: /degiro_connector/quotecast/helpers/pb_handler.py
import pandas as pd
import random
from google.protobuf import json_format
from google.protobuf.message import Message
from degiro_connector.quotecast.pb.quotecast_pb2 import (
Chart,
Quotecast,
Tick... | code_fim | hard | {
"lang": "python",
"repo": "simon-saliba/degiro-connector",
"path": "/degiro_connector/quotecast/helpers/pb_handler.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def PlotImage(quarter):
# Load the data
ap = EBaperture(quarter)
rows, cols = ap.shape
file = glob.glob(os.path.join('data', 'ngc6791',
'Q%d' % quarter, '*.fits'))[0]
with pyfits.open(file) as f:
flux = f[0].data
# Plot the image + apertur... | code_fim | hard | {
"lang": "python",
"repo": "rodluger/L1",
"path": "/old/ngc6791/plotting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rodluger/L1 path: /old/ngc6791/plotting.py
from astropy.io import fits as pyfits
import numpy as np
import matplotlib.pyplot as pl
import glob
import os
from tqdm import tqdm
from scipy.ndimage import zoom
from .apertures import EBaperture
__all__ = ["PlotImage"]
<|fim_suffix|> vector[:pad_w... | code_fim | medium | {
"lang": "python",
"repo": "rodluger/L1",
"path": "/old/ngc6791/plotting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Panzerschrek/U-00DC-Sprache path: /source/tests/py_tests/take_operator_test.py
from py_tests_common import *
def TakeForPart_Test0():
c_program_text= """
// Take from struct.
struct S
{
i32 x;
fn constructor() ( x= 0 ) {}
fn constructor( i32 in_x ) ( x= in_x ) {}
fn destructo... | code_fim | hard | {
"lang": "python",
"repo": "Panzerschrek/U-00DC-Sprache",
"path": "/source/tests/py_tests/take_operator_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def TakeForConstReference_Test0():
c_program_text= """
// Take from struct.
struct S
{
i32 x;
fn constructor() ( x= 0 ) {}
fn constructor( i32 in_x ) ( x= in_x ) {}
fn destructor() { x= -1; }
fn constructor( mut this, S &imut other )= delete;
op=( mut this, S &imut other )= delet... | code_fim | hard | {
"lang": "python",
"repo": "Panzerschrek/U-00DC-Sprache",
"path": "/source/tests/py_tests/take_operator_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def TakeForValueVariable_Test2():
c_program_text= """
// Take moved value.
struct S
{
i32 x;
fn constructor( i32 in_x ) ( x= in_x ) {}
fn destructor() { x= -1; }
fn constructor( mut this, S &imut other )= delete;
op=( mut this, S &imut other )= delete;
}
fn Foo()
{
var S mu... | code_fim | hard | {
"lang": "python",
"repo": "Panzerschrek/U-00DC-Sprache",
"path": "/source/tests/py_tests/take_operator_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def initialize(self, *args, **kwargs):
raise NotImplementedError("Not Implemented By Base Model")<|fim_prefix|># repo: BenjamenMeyer/openstackinabox path: /openstackinabox/models/base_db.py
from openstackinabox.models.base_model import BaseModel
class ModelDbBase(BaseModel):
<|fim_middle|>
... | code_fim | hard | {
"lang": "python",
"repo": "BenjamenMeyer/openstackinabox",
"path": "/openstackinabox/models/base_db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def bool_from_database(value):
if value:
return True
return False
@staticmethod
def bool_to_database(value):
if value:
return 1
return 0
def initialize(self, *args, **kwargs):
raise NotImplementedError("Not... | code_fim | medium | {
"lang": "python",
"repo": "BenjamenMeyer/openstackinabox",
"path": "/openstackinabox/models/base_db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BenjamenMeyer/openstackinabox path: /openstackinabox/models/base_db.py
from openstackinabox.models.base_model import BaseModel
class ModelDbBase(BaseModel):
def __init__(self, name, master, db):
super(ModelDbBase, self).__init__(name)
self.__master = master
self.__d... | code_fim | medium | {
"lang": "python",
"repo": "BenjamenMeyer/openstackinabox",
"path": "/openstackinabox/models/base_db.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _find_identifiers(text):
# Pattern could be improved based on a extended
# clinical trial identifiers format analysis
PATTERN = r'(%s\d{3,})'
PREFIXES = [
'ACTRN',
'EUCTR',
'GSK',
'ISRCTN',
'JPRN',
'NCT',
'TAKEDA',
'UMIN',... | code_fim | hard | {
"lang": "python",
"repo": "bzhr/processors",
"path": "/processors/pubmed/extractors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Find identifiers
identifiers = []
for prefix in PREFIXES:
pattern = PATTERN % prefix
identifiers.extend(re.findall(pattern, text))
return identifiers<|fim_prefix|># repo: bzhr/processors path: /processors/pubmed/extractors.py
# -*- coding: utf-8 -*-
from __future__ impo... | code_fim | hard | {
"lang": "python",
"repo": "bzhr/processors",
"path": "/processors/pubmed/extractors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bzhr/processors path: /processors/pubmed/extractors.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
# Module API
def extract_source(record):
source = {... | code_fim | hard | {
"lang": "python",
"repo": "bzhr/processors",
"path": "/processors/pubmed/extractors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uroborus/synapse path: /synapse/handlers/__init__.py
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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
#
# htt... | code_fim | hard | {
"lang": "python",
"repo": "uroborus/synapse",
"path": "/synapse/handlers/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.registration_handler = RegistrationHandler(hs)
self.message_handler = MessageHandler(hs)
self.room_creation_handler = RoomCreationHandler(hs)
self.room_member_handler = RoomMemberHandler(hs)
self.event_stream_handler = EventStreamHandler(hs)
self.event_... | code_fim | hard | {
"lang": "python",
"repo": "uroborus/synapse",
"path": "/synapse/handlers/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: callsign-viper/LOM-PlanA path: /Server/app/views/post/post.py
from flask import request
from flask_validation import json_required, validate_with_fields
from flask_validation import StringField
from app.context import context_property as cp
from app.models.reaction_available_element import Comme... | code_fim | hard | {
"lang": "python",
"repo": "callsign-viper/LOM-PlanA",
"path": "/Server/app/views/post/post.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> skip = int(request.args.get('skip', cp.post_list_default_skip))
size = int(request.args.get('size', cp.post_list_default_size))
return [comment.json for comment in CommentModel.list(post, skip, size)]
@validate_with_fields({
'content': _POST_CONTENT_TERM,
})
@... | code_fim | medium | {
"lang": "python",
"repo": "callsign-viper/LOM-PlanA",
"path": "/Server/app/views/post/post.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if y is not None and len(X) != len(y):
raise ValueError('X (features) and y (labels) '
'should have the same length. '
'Found: X.shape = %s, y.shape = %s' % (X.shape, y.shape))
if w is not None and len(X) != len(w):
... | code_fim | hard | {
"lang": "python",
"repo": "janscherer/courses",
"path": "/deeplearning1/nbs/BcolzArrayIterator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janscherer/courses path: /deeplearning1/nbs/BcolzArrayIterator.py
import numpy as np
import bcolz
import threading
class BcolzArrayIterator(object):
"""
Returns an iterator object into Bcolz carray files
Thanks to R4mon: http://pastebin.com/y0DskiK6
:Example:
X = bco... | code_fim | hard | {
"lang": "python",
"repo": "janscherer/courses",
"path": "/deeplearning1/nbs/BcolzArrayIterator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XENON1T/pax path: /pax/plugins/peak_processing/PeakAreaCorrections.py
import numpy as np
from pax import plugin, exceptions
from pax.dsputils import saturation_correction
# Must be run before 'BuildInteractions.BasicInteractionProperties'
class S2SpatialCorrection(plugin.TransformPlugin):
... | code_fim | hard | {
"lang": "python",
"repo": "XENON1T/pax",
"path": "/pax/plugins/peak_processing/PeakAreaCorrections.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def startup(self):
self.s2_patterns = self.processor.simulator.s2_patterns
self.zombie_pmts_s2 = np.array(self.config.get('zombie_pmts_s2', []))
def transform_event(self, event):
for peak in event.peaks:
# check that there is a position
if not len(... | code_fim | hard | {
"lang": "python",
"repo": "XENON1T/pax",
"path": "/pax/plugins/peak_processing/PeakAreaCorrections.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ali-Parandeh/Data_Science_Playground path: /Datacamp Assignments/NLP Skills Track/1. NLP Fundamentals/7_bag_of_words.py
# Import Counter
from collections import Counter
# Tokenize the article: tokens
tokens = word_tokenize(article)
<|fim_suffix|># Create a Counter with the lowercase tokens: bow... | code_fim | medium | {
"lang": "python",
"repo": "Ali-Parandeh/Data_Science_Playground",
"path": "/Datacamp Assignments/NLP Skills Track/1. NLP Fundamentals/7_bag_of_words.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Print the 10 most common tokens
print(bow_simple.most_common(10))
# <script.py> output:
# [(',', 151), ('the', 150), ('.', 89), ('of', 81), ("''", 68),
# ('to', 63), ('a', 60), ('in', 44), ('and', 41), ('debugging', 40)]<|fim_prefix|># repo: Ali-Parandeh/Data_Science_Playground path: /Datacamp ... | code_fim | medium | {
"lang": "python",
"repo": "Ali-Parandeh/Data_Science_Playground",
"path": "/Datacamp Assignments/NLP Skills Track/1. NLP Fundamentals/7_bag_of_words.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NVIDIA/Megatron-LM path: /megatron/mpu/tests/test_initialize.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
from commons import print_separator
from commons import initialize_distributed
import mpu
import torch
import sys
sys.path.append("../..")
def test_initialize_model_pa... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/Megatron-LM",
"path": "/megatron/mpu/tests/test_initialize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
initialize_distributed()
world_size = torch.distributed.get_world_size()
tensor_model_parallel_size = 1
while tensor_model_parallel_size <= world_size:
print_separator('test initialize model parallel')
test_initialize_model_parallel(tensor_model_... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/Megatron-LM",
"path": "/megatron/mpu/tests/test_initialize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fastrockstar/openBatLib path: /openbatlib/model.py
n from kWh to Wh
_E_BAT *= 1000
# Effiency of the battery in percent
_eta_BAT /= 100
# Check if the dead or settling time can be ignored and set flags accordingly
if _dt >= (3 * _t_CONSTANT) or _tend == 1:
_t... | code_fim | hard | {
"lang": "python",
"repo": "fastrockstar/openBatLib",
"path": "/openbatlib/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fastrockstar/openBatLib path: /openbatlib/model.py
self.Ppv2bat_in # DC input power of the PV2BAT conversion pathway
def bat_mod_res(self):
"""Function to calculate the power flows and energy sums including curtailment of PV power
"""
self.E = bat_res_mod(self.... | code_fim | hard | {
"lang": "python",
"repo": "fastrockstar/openBatLib",
"path": "/openbatlib/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param parameter: Holds parameters of the system
:type parameter: dict
:return: Dictionary holding parameters from the Excel sheet
:rtype: dict
"""
# PV2AC conversion pathway TODO
if parameter['Top'] == 'DC' or parameter['Top'] == 'PVINV' or parameter['Top'] == 'PV' and p... | code_fim | hard | {
"lang": "python",
"repo": "fastrockstar/openBatLib",
"path": "/openbatlib/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gpassero/cogroo4py path: /python/org-stubs/cogroo/formats/ad/__init__.pyi
import java.util
import opennlp.tools.chunker
import opennlp.tools.formats
import opennlp.tools.namefind
import opennlp.tools.postag
import opennlp.tools.util
import org.cogroo.tools.featurizer
import typing
class ADChun... | code_fim | hard | {
"lang": "python",
"repo": "gpassero/cogroo4py",
"path": "/python/org-stubs/cogroo/formats/ad/__init__.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create(self, stringArray: typing.List[str]) -> opennlp.tools.util.ObjectStream[opennlp.tools.namefind.NameSample]: ...
@staticmethod
def registerFactory() -> None: ...
class ADFeatureSampleStreamFactory(opennlp.tools.formats.LanguageSampleStreamFactory[org.cogroo.tools.featurizer.FeatureS... | code_fim | hard | {
"lang": "python",
"repo": "gpassero/cogroo4py",
"path": "/python/org-stubs/cogroo/formats/ad/__init__.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> loss_mat = max_elements + tf.math.log(loss_exp_left + tf.transpose(loss_exp_left))
# Add the positive distance.
loss_mat += pairwise_distances
mask_positives = tf.cast(adjacency, dtype=tf.dtypes.float32) - tf.linalg.diag(
tf.ones([batch_size])
)
# *0.5 for upper triangula... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/addons",
"path": "/tensorflow_addons/losses/lifted.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask_positives = tf.cast(adjacency, dtype=tf.dtypes.float32) - tf.linalg.diag(
tf.ones([batch_size])
)
# *0.5 for upper triangular, and another *0.5 for 1/2 factor for loss^2.
num_positives = tf.math.reduce_sum(mask_positives) / 2.0
lifted_loss = tf.math.truediv(
0.25... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/addons",
"path": "/tensorflow_addons/losses/lifted.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/addons path: /tensorflow_addons/losses/lifted.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/addons",
"path": "/tensorflow_addons/losses/lifted.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xiaojiean/deep-human-action-recognition path: /benset/data/benset_batchloader_ar.py
import numpy as np
import math as calc
from tensorflow.python.keras.utils import Sequence
import json
import os
import cv2
import random
import time
from numpy.random import default_rng
from PIL import Image
fro... | code_fim | hard | {
"lang": "python",
"repo": "Xiaojiean/deep-human-action-recognition",
"path": "/benset/data/benset_batchloader_ar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if mode:
random.seed(int(time.time()))
new_index = random.randint(0,len(self.frame_list[0])-1)
self.frame_list = [[self.frame_list[0][new_index]]]
def get_frame_list(self):
return self.frame_list
def __next__(self):
... | code_fim | hard | {
"lang": "python",
"repo": "Xiaojiean/deep-human-action-recognition",
"path": "/benset/data/benset_batchloader_ar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikealfare/pyrva-coding-night path: /src/pyrva_coding_night/w3r_collections.py
# https://www.w3resource.com/python-exercises/collections/
from typing import Dict, List, Tuple
import collections
<|fim_suffix|>
def get_most_common_chars(my_string: str) -> List[Tuple[str, int]]:
my_tally = coll... | code_fim | medium | {
"lang": "python",
"repo": "mikealfare/pyrva-coding-night",
"path": "/src/pyrva_coding_night/w3r_collections.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_most_common_chars(my_string: str) -> List[Tuple[str, int]]:
my_tally = collections.Counter(my_string)
return my_tally.most_common(3)<|fim_prefix|># repo: mikealfare/pyrva-coding-night path: /src/pyrva_coding_night/w3r_collections.py
# https://www.w3resource.com/python-exercises/collection... | code_fim | medium | {
"lang": "python",
"repo": "mikealfare/pyrva-coding-night",
"path": "/src/pyrva_coding_night/w3r_collections.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> my_tally = collections.Counter(**char_counts)
return list(my_tally.elements())
def get_most_common_chars(my_string: str) -> List[Tuple[str, int]]:
my_tally = collections.Counter(my_string)
return my_tally.most_common(3)<|fim_prefix|># repo: mikealfare/pyrva-coding-night path: /src/pyrva... | code_fim | medium | {
"lang": "python",
"repo": "mikealfare/pyrva-coding-night",
"path": "/src/pyrva_coding_night/w3r_collections.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url("",views.BookApiView.as_view()), #new
]<|fim_prefix|># repo: jprsurendra/DjangoProject path: /project/apis/bookapi/urls.py
from django.contrib import admin
from django.urls import path
from django.conf.urls import url
<|fim_middle|>from apis.bookapi import views
| code_fim | easy | {
"lang": "python",
"repo": "jprsurendra/DjangoProject",
"path": "/project/apis/bookapi/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jprsurendra/DjangoProject path: /project/apis/bookapi/urls.py
from django.contrib import admin
from django.urls import path
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url("",views.BookApiView.as_view()), #new
]<|fim_middle|>from apis.bookapi import views
| code_fim | easy | {
"lang": "python",
"repo": "jprsurendra/DjangoProject",
"path": "/project/apis/bookapi/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timjr/Openstack-Anvil path: /anvil/components/__init__.py
cls = packager.get_packager_class(package, default_class)
return cls(**kwargs)
####
#### INSTALL CLASSES
####
class PkgInstallComponent(component.Component):
def __init__(self, *args, **kargs):
component.Component.__... | code_fim | hard | {
"lang": "python",
"repo": "timjr/Openstack-Anvil",
"path": "/anvil/components/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pip_found = False
pkg_found = None
# Try to find it in anyones pip -> pkg list
pip2_pkg_mp = {
self.name: self.pips_to_packages,
}
for (name, c) in self.instances.items():
if c is self or not c.activated:
continue
... | code_fim | hard | {
"lang": "python",
"repo": "timjr/Openstack-Anvil",
"path": "/anvil/components/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timjr/Openstack-Anvil path: /anvil/components/__init__.py
tch(pip_info['name'], pip_name):
pip_found = True
pip_who = pip_info
LOG.debug("Matched pip %r from other component %r", pip_name, who)
break
if pi... | code_fim | hard | {
"lang": "python",
"repo": "timjr/Openstack-Anvil",
"path": "/anvil/components/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedromcruz/pheweb path: /pheweb/serve/autocomplete.py
from ..file_utils import common_filepaths
from .server_utils import parse_variant
import itertools
import re
import marisa_trie
import copy
# TODO: sort suggestions better.
# - It's good that hitting enter sends you to the thing with the hi... | code_fim | hard | {
"lang": "python",
"repo": "pedromcruz/pheweb",
"path": "/pheweb/serve/autocomplete.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for cpra, rsids in self._cpra_to_rsids_trie.iteritems(key):
if cpra != key:
yield from f(cpra, rsids)
def _autocomplete_rsid(self, query):
query = query.lower()
if query.startswith('rs'):
key = query
# In Trie.it... | code_fim | hard | {
"lang": "python",
"repo": "pedromcruz/pheweb",
"path": "/pheweb/serve/autocomplete.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smilingsorav/DummyRDD path: /dummy_spark/sql/sql_context.py
# -*- coding: utf-8 -*-
__author__ = 'willmcginnis'
class SQLContext(object):
def __init__(self, parkContext, sqlContext=None):
pass
@property
def _ssql_ctx(self):
"""
NotImplemented
:retu... | code_fim | hard | {
"lang": "python",
"repo": "smilingsorav/DummyRDD",
"path": "/dummy_spark/sql/sql_context.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param data:
:return:
"""
raise NotImplementedError
def _inferSchema(self, rdd, samplingRatio=None):
"""
NotImplemented
:param rdd:
:param samplingRatio:
:return:
"""
raise NotImplementedError
def inferSchem... | code_fim | hard | {
"lang": "python",
"repo": "smilingsorav/DummyRDD",
"path": "/dummy_spark/sql/sql_context.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class EmailAlarmParser(BaseAlarmParser):
@option(required=True)
def parse_description(alarm, line):
alarm.body = unescape_string(line.value) if line else None
@option(required=True)
def parse_summary(alarm, line):
alarm.subject = unescape_string(line.value) if line else N... | code_fim | hard | {
"lang": "python",
"repo": "Andrei486/class_export",
"path": "/recurrent_ics/parsers/alarm_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Andrei486/class_export path: /recurrent_ics/parsers/alarm_parser.py
import warnings
from recurrent_ics.attendee import Attendee
from recurrent_ics.parsers.parser import Parser, option
from recurrent_ics.utils import iso_to_arrow, parse_duration, unescape_string
class BaseAlarmParser(Parser):
... | code_fim | hard | {
"lang": "python",
"repo": "Andrei486/class_export",
"path": "/recurrent_ics/parsers/alarm_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if True:
lr = 1e-6
Interval_Epoch = 50
Epoch = 100
Batch_size = 1 #根据显存确定
optimizer = optim.Adam(model.parameters(),lr)
lr_scheduler = optim.lr_scheduler.StepLR(optimizer,step_size=1,gamma=0.92)
tr... | code_fim | hard | {
"lang": "python",
"repo": "XHYsdjkdsjsk2021/unet-pytorch",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for param in model.vgg.parameters():
param.requires_grad = False
for epoch in range(Init_Epoch,Interval_Epoch):
fit_one_epoch(model,epoch,epoch_size,epoch_size_val,gen,gen_val,Interval_Epoch,Cuda)
lr_scheduler.step()
if True:
lr... | code_fim | hard | {
"lang": "python",
"repo": "XHYsdjkdsjsk2021/unet-pytorch",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XHYsdjkdsjsk2021/unet-pytorch path: /train.py
import os
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.utils.data import DataLoader
from tqdm import tqdm
from nets.unet import Unet
from nets.unet_training import... | code_fim | hard | {
"lang": "python",
"repo": "XHYsdjkdsjsk2021/unet-pytorch",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.data_to_store = data_to_store
self.memory = memory<|fim_prefix|># repo: Kingsford-Group/rlforlqh path: /Reinforcement Learning/build/lib/tests/common_mocks/mock_policy/mock_timestep_data.py
from continual_rl.policies.timestep_data_base import TimestepDataBa... | code_fim | medium | {
"lang": "python",
"repo": "Kingsford-Group/rlforlqh",
"path": "/Reinforcement Learning/build/lib/tests/common_mocks/mock_policy/mock_timestep_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kingsford-Group/rlforlqh path: /Reinforcement Learning/build/lib/tests/common_mocks/mock_policy/mock_timestep_data.py
from continual_rl.policies.timestep_data_base import TimestepDataBase
<|fim_suffix|> super().__init__()
self.data_to_store = data_to_store
self.memory = me... | code_fim | medium | {
"lang": "python",
"repo": "Kingsford-Group/rlforlqh",
"path": "/Reinforcement Learning/build/lib/tests/common_mocks/mock_policy/mock_timestep_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def publishData( power ):
try:
publish.single("k34/power", "{\"power\": %d, \"timestamp\": %d}" % (power, int(time.time())*1000), hostname="k34.mine.nu")
except:
pass
def logData():
global pulses
# sampling interval is 60 s so multiply by 60 to
# convert from Wh to Ws... | code_fim | medium | {
"lang": "python",
"repo": "pmvester/k34",
"path": "/power/power.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># global counter holding number of pulses for a given time interval
pulses = 0
db = mdb.connect('localhost', 'logger', '13142k34', 'housedb')
cursor = db.cursor()
# callback function counting pulses
def my_callback(channel):
global pulses
pulses += 1
def publishData( power ):
try:
p... | code_fim | medium | {
"lang": "python",
"repo": "pmvester/k34",
"path": "/power/power.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pmvester/k34 path: /power/power.py
#!/usr/bin/env python2.7
import MySQLdb as mdb
import RPi.GPIO as GPIO
import sys
import time
import paho.mqtt.publish as publish
from apscheduler.scheduler import Scheduler
from datetime import datetime
from datetime import timedelta
<|fim_suffix|>db = mdb.co... | code_fim | medium | {
"lang": "python",
"repo": "pmvester/k34",
"path": "/power/power.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miri64/murdock-nio-bot path: /tests/test_github.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright (C) 2021 Freie Universität Berlin
#
# Distributed under terms of the MIT license.
from murdock_nio_bot.github import Workflow
<|fim_suffix|> # use property to make... | code_fim | medium | {
"lang": "python",
"repo": "miri64/murdock-nio-bot",
"path": "/tests/test_github.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_workflow_scheduled_runs():
config = MockConfig()
workflow = Workflow.fetch_workflows(config)[1]
for run in workflow.scheduled_runs:
print(run.conclusion)
assert isinstance(run.id, int)<|fim_prefix|># repo: miri64/murdock-nio-bot path: /tests/test_github.py
#! /usr/bi... | code_fim | hard | {
"lang": "python",
"repo": "miri64/murdock-nio-bot",
"path": "/tests/test_github.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [[placement.x, placement.y],
[placement.x + width, placement.y],
[placement.x, placement.y + height],
[placement.x + width, placement.y + height]].every(
function(pos) {
var a = this.canvasWidth / 2;
var... | code_fim | hard | {
"lang": "python",
"repo": "terryyin/lizard",
"path": "/lizard_ext/lizardwordcount.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>TagCloud.prototype._isPlaceEmpty = function (placement, width, height) {
if (placement.x < 0 || placement.y < 0 || placement.x + width >
this.canvasWidth || placement.y + height > this.canvasHeight)
return false;
var pix = this.ctx.getImageData(
placement.x, place... | code_fim | hard | {
"lang": "python",
"repo": "terryyin/lizard",
"path": "/lizard_ext/lizardwordcount.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: terryyin/lizard path: /lizard_ext/lizardwordcount.py
'''
This is an extension to lizard. It counts the recurrence of every identifier
in the source code (ignoring the comments and strings), and then generate
a tag cloud based on the popularity of the identifiers.
The tag cloud is generated on an ... | code_fim | hard | {
"lang": "python",
"repo": "terryyin/lizard",
"path": "/lizard_ext/lizardwordcount.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michalisFr/last_will path: /last_will/check_in.py
from emails import send_email
from twilio.rest import Client
from pathlib import Path
from datetime import date, datetime
import json
from crontab import CronTab
class Check:
def __init__(self, last_check_in, deadline=None, warning_sent=Fals... | code_fim | hard | {
"lang": "python",
"repo": "michalisFr/last_will",
"path": "/last_will/check_in.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("\nEmail with important info sent. Rest in peace, your money is in good hands\n")
# Remove the cron job. No point in checking any longer.
my_cron = CronTab(user=True)
my_cron.remove_all(comment='check in')
exit(0)
def send_warning(self):
"""Func... | code_fim | hard | {
"lang": "python",
"repo": "michalisFr/last_will",
"path": "/last_will/check_in.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lishikuan/cutrect path: /rect/migrations/0012_merge_20180123_1448.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-23 06:48
from __future__ import unicode_literals
from django.db import migrations
<|fim_suffix|> dependencies = [
('rect', '0011_auto_20180119_2046'),
... | code_fim | easy | {
"lang": "python",
"repo": "lishikuan/cutrect",
"path": "/rect/migrations/0012_merge_20180123_1448.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('rect', '0011_auto_20180119_2046'),
('rect', '0010_auto_20180121_0407'),
]
operations = [
]<|fim_prefix|># repo: lishikuan/cutrect path: /rect/migrations/0012_merge_20180123_1448.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-23 06:48... | code_fim | easy | {
"lang": "python",
"repo": "lishikuan/cutrect",
"path": "/rect/migrations/0012_merge_20180123_1448.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zetechmoy/recsys path: /CollaborativeFiltering/colfil2.py
import sys, json
import numpy as np
np.set_printoptions(threshold=sys.maxsize)
import pandas as pd
import matplotlib.pyplot as plt
import os
import warnings
warnings.filterwarnings('ignore')
def tanimoto(a, b):
mod_a = sum(a)
mod_b = s... | code_fim | hard | {
"lang": "python",
"repo": "zetechmoy/recsys",
"path": "/CollaborativeFiltering/colfil2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open("dataset_recsys2.json", "w")
f.write(json.dumps(data))
f.close()
else:
f = open("dataset_recsys2.json", "r")
raw = f.read()
data = json.loads(raw)
f.close()
user_vectors = np.array(data["user_vectors"])
ratings = np.array(data["ratings"])
movie_vectors = np.array(data["movie_vectors"])... | code_fim | hard | {
"lang": "python",
"repo": "zetechmoy/recsys",
"path": "/CollaborativeFiltering/colfil2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
f = open("dataset_recsys2.json", "r")
raw = f.read()
data = json.loads(raw)
f.close()
user_vectors = np.array(data["user_vectors"])
ratings = np.array(data["ratings"])
movie_vectors = np.array(data["movie_vectors"])
#create the matrix factorizatioon
tab = np.dot(user_vectors, movie_vectors.T... | code_fim | hard | {
"lang": "python",
"repo": "zetechmoy/recsys",
"path": "/CollaborativeFiltering/colfil2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ['FileWriter', 'FileReader', 'MindPage',
'Cifar10ToMR', 'Cifar100ToMR', 'CsvToMR', 'ImageNetToMR', 'MnistToMR', 'TFRecordToMR',
'SUCCESS', 'FAILED']<|fim_prefix|># repo: mindspore-ai/mindspore path: /mindspore/python/mindspore/mindrecord/__init__.py
# Copyright 2019 Huawei... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/mindspore/python/mindspore/mindrecord/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/mindspore path: /mindspore/python/mindspore/mindrecord/__init__.py
# Copyright 2019 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 Licen... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/mindspore/python/mindspore/mindrecord/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dimkarakostas/project-euler path: /problem_47.py
from time import time
from problem_35 import is_prime
def main():
primes = [2, 3]
consecutives = []
number_of_consecutives = 4
index = 3
while len(consecutives) < number_of_consecutives:
index += 1
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "dimkarakostas/project-euler",
"path": "/problem_47.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(prime_factors) == number_of_consecutives:
consecutives.append(index)
else:
consecutives = []
print consecutives
if __name__ == '__main__':
t = time()
main()
print 'Time:', time() - t<|fim_prefix|># repo: dimkarakostas/project-euler path: /... | code_fim | hard | {
"lang": "python",
"repo": "dimkarakostas/project-euler",
"path": "/problem_47.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BrianTJackett/msgraph-cli path: /msgraph-cli-extensions/v1_0/identitydirmgt_v1_0/azext_identitydirmgt_v1_0/generated/custom.py
bers=None,
extensions=None):
body = {}
body['id'] = id_
body['deleted_date_time'] = deleted_date_t... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/v1_0/identitydirmgt_v1_0/azext_identitydirmgt_v1_0/generated/custom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def identitydirmgt_domain_domain_create_domain(client,
id_=None,
authentication_type=None,
availability_status=None,
... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/v1_0/identitydirmgt_v1_0/azext_identitydirmgt_v1_0/generated/custom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shinchu/pyndlsearch path: /pyndlsearch/api/sru.py
# -*- coding: utf-8 -*-
""" SRU: Search/Retrieval via URL APIクラス."""
import requests
from xml.etree import ElementTree
from .abs_api import AbstractAPI
class RecordData(object):
title = None
creator = None
description = None
pu... | code_fim | hard | {
"lang": "python",
"repo": "shinchu/pyndlsearch",
"path": "/pyndlsearch/api/sru.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif name == 'NDC':
ndc = {}
for child_ndc in child:
ndc[child_ndc.get('name')] = child_ndc.text
extra_resdata.facets['NDC'] = ndc
elif name == 'ISSUED_DATE':
issued_date = {}
for ... | code_fim | hard | {
"lang": "python",
"repo": "shinchu/pyndlsearch",
"path": "/pyndlsearch/api/sru.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> extra_resdata.facets['REPOSITORY_NO'] = repository_no
elif name == 'NDC':
ndc = {}
for child_ndc in child:
ndc[child_ndc.get('name')] = child_ndc.text
extra_resdata.facets['NDC'] = ndc
elif name ... | code_fim | hard | {
"lang": "python",
"repo": "shinchu/pyndlsearch",
"path": "/pyndlsearch/api/sru.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MaastrichtU-BISS/PyTaskManager path: /client/runScript.py
import json
import requests
import time
import os
import subprocess
# connect to service
headerData = {
'Content-Type': "application/json"
}
# Init configuration file
configFile = open("config.json")
clientData = json.load(configFile... | code_fim | hard | {
"lang": "python",
"repo": "MaastrichtU-BISS/PyTaskManager",
"path": "/client/runScript.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tmpVolume = "tmp_" + str(runId)
subprocess.Popen("docker volume create " + tmpVolume, shell=True)
dockerParams = "--rm " #container should be removed after execution
dockerParams += "-v " + ioVolumeName + ":/input_output " #mount input file
dockerParams += "-v " + ... | code_fim | hard | {
"lang": "python",
"repo": "MaastrichtU-BISS/PyTaskManager",
"path": "/client/runScript.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """A saved search query."""
project = models.ForeignKey(
'db.Project',
on_delete=models.CASCADE,
related_name='searches')
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='+')
query = models.TextField... | code_fim | medium | {
"lang": "python",
"repo": "wbuchwalter/polyaxon",
"path": "/polyaxon/db/models/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
app_label = 'db'
unique_together = (('project', 'name'), )<|fim_prefix|># repo: wbuchwalter/polyaxon path: /polyaxon/db/models/search.py
from django.conf import settings
from django.db import models
from db.models.utils import DiffModel, NameableModel
<|fim_middle|>
clas... | code_fim | hard | {
"lang": "python",
"repo": "wbuchwalter/polyaxon",
"path": "/polyaxon/db/models/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wbuchwalter/polyaxon path: /polyaxon/db/models/search.py
from django.conf import settings
from django.db import models
<|fim_suffix|> """A saved search query."""
project = models.ForeignKey(
'db.Project',
on_delete=models.CASCADE,
related_name='searches')
user ... | code_fim | medium | {
"lang": "python",
"repo": "wbuchwalter/polyaxon",
"path": "/polyaxon/db/models/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TimeType(QuantityType):
pri_unit = s
SI_conherent_unit = pri_unit
minute = minute
hour = hour
day = day
@classmethod
def register_type(cls):
pass
class Time(Quantity):
def __init__(self, value, unit=None):
super().__init__(value, TimeType, unit)<|fim... | code_fim | hard | {
"lang": "python",
"repo": "chenmich/Quantities",
"path": "/quantities/time.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.