text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> def on_epoch_end(self, epoch, logs=None):
if logs is None:
logs = {}
if not self.log_in_batch_or_epoch:
self.add_sigma_z_logs(logs)<|fim_prefix|># repo: vigsterkr/FlowKet path: /src/flowket/callbacks/exact/sigma_z.py
import numpy
from tensorflow.keras.callbacks... | code_fim | hard | {
"lang": "python",
"repo": "vigsterkr/FlowKet",
"path": "/src/flowket/callbacks/exact/sigma_z.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_batch_end(self, batch, logs=None):
if logs is None:
logs = {}
if self.log_in_batch_or_epoch and ((batch % self.exact_variational.num_of_batch_until_full_cycle) == 0):
self.add_sigma_z_logs(logs)
def on_epoch_end(self, epoch, logs=None):
... | code_fim | hard | {
"lang": "python",
"repo": "vigsterkr/FlowKet",
"path": "/src/flowket/callbacks/exact/sigma_z.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Specify and parse the command line arguments
# USAGE: git-stash-and-backup message [<backup_parent_dir>/]
parser = argparse.ArgumentParser(
# print document string "as is" on --help
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent(_... | code_fim | hard | {
"lang": "python",
"repo": "dinkumsoftware/dinkum",
"path": "/git/bin/git_stash_and_backup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dinkumsoftware/dinkum path: /git/bin/git_stash_and_backup.py
#!/usr/bin/env python3
#<filename> git_stash_and_backup.py
#<path> dinkum/git/bin
#<repo> https://github.com/dinkumsoftware/dinkum.git
#<mod_doc>
'''
Makes a backup copy of the current directory (if it's under
git control) and regardl... | code_fim | hard | {
"lang": "python",
"repo": "dinkumsoftware/dinkum",
"path": "/git/bin/git_stash_and_backup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hityzy1122/CAM-Net path: /code/train.py
import os.path
import os
import sys
import math
import argparse
import time
import random
from collections import OrderedDict
import torch
import options.options as option
from utils import util
from data import create_dataloader, create_dataset
from mode... | code_fim | hard | {
"lang": "python",
"repo": "hityzy1122/CAM-Net",
"path": "/code/train.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # training
model.feed_data(cur_day_train_data, code=code)
model.optimize_parameters(current_step, inter_supervision=inter_supervision)
time_elapsed = time.time() - start_time
start_time = time.time()
# log
... | code_fim | hard | {
"lang": "python",
"repo": "hityzy1122/CAM-Net",
"path": "/code/train.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: francoricci/sapspid path: /modules/easyspid/handlers/authnreqBuild.py
from response import ResponseObj
import tornado.web
import tornado.gen
import tornado.ioloop
import tornado.concurrent
import tornado.httpclient
import logging
import asyncio
from easyspid.handlers.easyspidhandler import easysp... | code_fim | hard | {
"lang": "python",
"repo": "francoricci/sapspid",
"path": "/modules/easyspid/handlers/authnreqBuild.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> spSettings = Saml2_Settings(sp_settings['result'])
key = spSettings.get_sp_key()
cert = spSettings.get_sp_cert()
sign_alg = (spSettings.get_security_data())['signatureAlgorithm']
digest = (spSettings.get_security_data())['dig... | code_fim | hard | {
"lang": "python",
"repo": "francoricci/sapspid",
"path": "/modules/easyspid/handlers/authnreqBuild.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: consbio/python-josso-auth path: /setup.py
from setuptools import setup
setup(
name='python-josso-auth',
description='A JOSSO backend for python-soci<|fim_suffix|>-auth-app-django', 'suds-jurko', 'six'],
url='https://github.com/consbio/python-josso-auth',
license='BSD'
)<|fim_mid... | code_fim | hard | {
"lang": "python",
"repo": "consbio/python-josso-auth",
"path": "/setup.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>-auth-app-django', 'suds-jurko', 'six'],
url='https://github.com/consbio/python-josso-auth',
license='BSD'
)<|fim_prefix|># repo: consbio/python-josso-auth path: /setup.py
from setuptools import setup
setup(
name='python-josso-auth',
description='A JOSSO backend for python-social-auth',... | code_fim | medium | {
"lang": "python",
"repo": "consbio/python-josso-auth",
"path": "/setup.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anuragjain0610/synergy_task path: /averaging.py
# import the opencv module
import cv2
def frame_averaging(input_video_file, output_filename):
# create a capture object(file pointer) by loading the given video
# video file downloaded from [https://drive.google.com/file/d/1il2yWyr7-t9XfG1... | code_fim | hard | {
"lang": "python",
"repo": "anuragjain0610/synergy_task",
"path": "/averaging.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Total No. of frames processed:', frames_processed)
avg_result = cv2.merge([B_Avg, G_Avg, R_Avg]).astype("uint8")
cv2.imwrite(output_filename, avg_result)
# releasing the file pointer
cap.release()
# function call
input_video_file = 'cut.mp4' # put your video file name here
o... | code_fim | hard | {
"lang": "python",
"repo": "anuragjain0610/synergy_task",
"path": "/averaging.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with gui() as app:
app.label('hello world')
app.label("Control - 1 - 2")
app.bindKey('1', menu1)
app.bindKey('<Control-Key-1>', shiftmenu1)
app.addMenuItem('test', 'test', menu2, shortcut='2')
app.addMenuItem('test', 'shufttest', shiftmenu2, shortcut='Control-2')<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "jarvisteach/appJar",
"path": "/examples/issues/issue488.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jarvisteach/appJar path: /examples/issues/issue488.py
import sys
sys.path.append("../../")
from appJar import gui
<|fim_suffix|>with gui() as app:
app.label('hello world')
app.label("Control - 1 - 2")
app.bindKey('1', menu1)
app.bindKey('<Control-Key-1>', shiftmenu1)
app.add... | code_fim | medium | {
"lang": "python",
"repo": "jarvisteach/appJar",
"path": "/examples/issues/issue488.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def shiftmenu2(): print('shiftmenu2')
with gui() as app:
app.label('hello world')
app.label("Control - 1 - 2")
app.bindKey('1', menu1)
app.bindKey('<Control-Key-1>', shiftmenu1)
app.addMenuItem('test', 'test', menu2, shortcut='2')
app.addMenuItem('test', 'shufttest', shiftmenu2, s... | code_fim | easy | {
"lang": "python",
"repo": "jarvisteach/appJar",
"path": "/examples/issues/issue488.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamiejamiebobamie/Tic-Tac-Toe-with-Q-Reinforcement-Learning path: /old_files/tictactoe.py
# Design a Tic-tac-toe game that is played between two players on a n x n grid.
#
# You may assume the following rules:
#
# A move is guaranteed to be valid and is placed on an empty block.
# Once a winning ... | code_fim | hard | {
"lang": "python",
"repo": "jamiejamiebobamie/Tic-Tac-Toe-with-Q-Reinforcement-Learning",
"path": "/old_files/tictactoe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Mark the column with the current person's token (X or O).
# Admittedly, this could be improved to not update every time.
self.rows[i][1] = turn
# Update the count by one.
self.rows[i][2] += 1
# If the count is equal to the board size, end the game and return who... | code_fim | hard | {
"lang": "python",
"repo": "jamiejamiebobamie/Tic-Tac-Toe-with-Q-Reinforcement-Learning",
"path": "/old_files/tictactoe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shen-ee/dr-2019sp path: /yolo_v3/generateTrainData.py
import os
img_path = "data/images"
label_path = "data/labels"
img_files = os.listdir(img_path)
label_files = os.listdir(label_path)
with open("train.txt", 'w') as f1:
for i in range(len(img_files)):
img = img_files[i]
labe... | code_fim | hard | {
"lang": "python",
"repo": "shen-ee/dr-2019sp",
"path": "/yolo_v3/generateTrainData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ine.replace('Turret_Red', '5')
line = line.replace('Inhib_Red', '6')
line = line.replace('Nexus_Red', '7')
line = line.replace('SuperMinion_Blue', '9')
line = line.replace('Minion_Blue', '8')
line = line.re... | code_fim | hard | {
"lang": "python",
"repo": "shen-ee/dr-2019sp",
"path": "/yolo_v3/generateTrainData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> line = line.replace('Inhib_Blue', '12')
line = line.replace('Nexus_Blue', '13')
line = line.replace('Ashe', '14')
line = line.replace('Veigar', '0')
f1.write(line)
if j != len(f2_lines)-1:
... | code_fim | hard | {
"lang": "python",
"repo": "shen-ee/dr-2019sp",
"path": "/yolo_v3/generateTrainData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bogdanovs/meta-mender path: /tests/acceptance/mocks/mock_websocket_server.py
#!/usr/bin/python
# Copyright 2021 Northern.tech AS
#
# 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 ... | code_fim | hard | {
"lang": "python",
"repo": "bogdanovs/meta-mender",
"path": "/tests/acceptance/mocks/mock_websocket_server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def hello(websocket, path):
await websocket.recv()
start_server = websockets.serve(hello, server_host, args.port)
serverws = asyncio.get_event_loop().run_until_complete(start_server)
port = serverws.server.sockets[0].getsockname()[1]
server_url = f"http://{server_host}:{port}"
print("Listen... | code_fim | medium | {
"lang": "python",
"repo": "bogdanovs/meta-mender",
"path": "/tests/acceptance/mocks/mock_websocket_server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def hello(websocket, path):
await websocket.recv()
start_server = websockets.serve(hello, server_host, args.port)
serverws = asyncio.get_event_loop().run_until_complete(start_server)
port = serverws.server.sockets[0].getsockname()[1]
server_url = f"http://{server_host}:{port}"
print("Listeni... | code_fim | medium | {
"lang": "python",
"repo": "bogdanovs/meta-mender",
"path": "/tests/acceptance/mocks/mock_websocket_server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vaniisgh/lightex path: /lightex/mulogger/trains_logger.py
from dataclasses import dataclass
from typing import List
from . import AbstractLogger, get_experiment_name, get_project_name
import logging
from pathlib import Path
@dataclass
class TrainsConfig:
_class_: str = 'TrainsLogger'
#ho... | code_fim | hard | {
"lang": "python",
"repo": "vaniisgh/lightex",
"path": "/lightex/mulogger/trains_logger.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> import trains
self.trains = trains
config.check()
self.project_name = get_project_name(project_name)
self.experiment_name = get_experiment_name(experiment_name)
self.task = None
self.logger = None
self.init_task_logger()
def start_run(s... | code_fim | hard | {
"lang": "python",
"repo": "vaniisgh/lightex",
"path": "/lightex/mulogger/trains_logger.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ErmirioABonfim/Exercicos-Python path: /Exercios Em Python/ex056_v2.py
# class atributos:
# def __init__(self,nome:str, idade:int, sexo:str): #Definindo a o método inicializador com os atributos da classe
# self.nome = nome #Nas linhas onde utilizao self.(atributo) signi... | code_fim | hard | {
"lang": "python",
"repo": "ErmirioABonfim/Exercicos-Python",
"path": "/Exercios Em Python/ex056_v2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,nome:str, idade:int, sexo:str): #Definindo a o método inicializador com os atributos da classe
self.nome = nome #Nas linhas onde utilizao self.(atributo) significa que onde eu utilizar esse comando vai ser atribuído ao correspondente.
self.idade = idade #Exemplo... | code_fim | medium | {
"lang": "python",
"repo": "ErmirioABonfim/Exercicos-Python",
"path": "/Exercios Em Python/ex056_v2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cadastrar(self):
novoCadastro = str(input(' Deseja realizar novo cadastro? S/N'))
if novoCadastro == 'S':
self.PosiCastr = self.PosiCastr + 1
self.nome = str(input(' Informe o Nome: '))
self.idade = int (input('Informe a idade: '))
se... | code_fim | hard | {
"lang": "python",
"repo": "ErmirioABonfim/Exercicos-Python",
"path": "/Exercios Em Python/ex056_v2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /DQM/Physics/python/HiggsDQM_cfi.py
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
HiggsDQM = DQMEDAnalyzer('HiggsDQM',
elecTriggerPathToPass = cms.string("HLT_Ele10_LW_L1R"),
muonTriggerPathToPass = cms.string("... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQM/Physics/python/HiggsDQM_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Collection = cms.InputTag("pfMet"),
genParticleCollection = cms.InputTag("genParticles"),
PtThrMu1 = cms.untracked.double(3.0),
PtThrMu2 = cms.untracked.double(3.0)
)<|fim_prefix|># repo: cms-sw/cmssw path: /DQM/Physics/python/HiggsDQM_cfi.py
import FWCore.ParameterSet.Config as ... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQM/Physics/python/HiggsDQM_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: singnet/snet-cli path: /packages/snet_cli/snet_cli/commands/mpe_channel.py
return list(channels_dict.values())
def _get_org_info_file(self, org_id):
return os.path.join(self._get_org_base_dir(org_id), "org_info.pickle")
def _save_org_info(self, org_id, org_info):
... | code_fim | hard | {
"lang": "python",
"repo": "singnet/snet-cli",
"path": "/packages/snet_cli/snet_cli/commands/mpe_channel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return pickle.load(open(fn, "rb"))
def is_org_initialized(self):
return os.path.isfile(self._get_org_info_file(self.args.org_id))
def _check_mpe_address_metadata(self, metadata):
""" we make sure that MultiPartyEscrow address from metadata is correct """
mpe_addre... | code_fim | hard | {
"lang": "python",
"repo": "singnet/snet-cli",
"path": "/packages/snet_cli/snet_cli/commands/mpe_channel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def print_all_channels_filter_recipient(self):
address = self.get_address_from_arg_or_ident(self.args.recipient)
address_padded = pad_hex(address.lower(), 256)
channels_ids = self._get_all_filtered_channels([None, address_padded])
self._print_channels_from_blockchain(ch... | code_fim | hard | {
"lang": "python",
"repo": "singnet/snet-cli",
"path": "/packages/snet_cli/snet_cli/commands/mpe_channel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emory-libraries/OpenEmory path: /openemory/accounts/fields.py
# file openemory/accounts/fields.py
#
# Copyright 2010 Emory University General Library
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | code_fim | medium | {
"lang": "python",
"repo": "emory-libraries/OpenEmory",
"path": "/openemory/accounts/fields.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(value, bool) or value is None:
return value
return not (value == 'N')
def get_prep_value(self, value):
if value is None:
return value
return 'Y' if value else 'N'<|fim_prefix|># repo: emory-libraries/OpenEmory path: /openemory/acc... | code_fim | hard | {
"lang": "python",
"repo": "emory-libraries/OpenEmory",
"path": "/openemory/accounts/fields.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_python(self, value):
if isinstance(value, bool) or value is None:
return value
return not (value == 'N')
def get_prep_value(self, value):
if value is None:
return value
return 'Y' if value else 'N'<|fim_prefix|># repo: emory-libraries... | code_fim | hard | {
"lang": "python",
"repo": "emory-libraries/OpenEmory",
"path": "/openemory/accounts/fields.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _send_packet(self, datapath, in_port, pkt):
ofproto =datapath.ofproto
parser = datapath.ofproto_parser
pkt.serialize()
data = pkt.data
actions = [parser.OFPActionOutput(port=in_port)]
out = parser.OFPPacketOut(datapath=datapath,
... | code_fim | hard | {
"lang": "python",
"repo": "ray6/sdn",
"path": "/actualSDN.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ray6/sdn path: /actualSDN.py
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ether
from ryu.lib.p... | code_fim | hard | {
"lang": "python",
"repo": "ray6/sdn",
"path": "/actualSDN.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smrutishah/markov_bots path: /example_newsbot.py
from rw import RandomWriter
from rw import Tokenization
from configparser import ConfigParser
import praw
import tweepy
# Configurable bot behavior.
reddit_agent = "praw:generatenews:v1.0 (by nobody)"
subreddits = ["news", "worldnews", "upliftingn... | code_fim | medium | {
"lang": "python",
"repo": "smrutishah/markov_bots",
"path": "/example_newsbot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Aggregate the titles for processing.
titles = ""
for subreddit in subreddits:
hot = r.get_subreddit(subreddit).get_hot(limit=submissions_limit)
for thread in hot:
titles += thread.title + " "
print("Aggregated Reddit thread titles.")
# Train on the accumulated titles.
rw = RandomWriter(... | code_fim | medium | {
"lang": "python",
"repo": "smrutishah/markov_bots",
"path": "/example_newsbot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Finally, submit the tweet.
tweet = t.update_status(tweet)
tweet_url = "https://twitter.com/{}/status/{}".format(t.me().id_str,
tweet.id_str)
print("{} just tweeted: {}\nSee Tweet at: {}".format(t.me().screen_name,
... | code_fim | medium | {
"lang": "python",
"repo": "smrutishah/markov_bots",
"path": "/example_newsbot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kyaaqba/magma path: /symphony/cli/pyworkforce/graphql/input/check_list_definition.py
#!/usr/bin/env python3
# @generated AUTOGENERATED file. Do not Change!
from dataclasses import dataclass
from datetime import datetime
from functools import partial
from gql.gql.datetime_utils import DATETIME_FI... | code_fim | medium | {
"lang": "python",
"repo": "kyaaqba/magma",
"path": "/symphony/cli/pyworkforce/graphql/input/check_list_definition.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> title: str
type: CheckListItemType = enum_field(CheckListItemType)
enumSelectionMode: Optional[CheckListItemEnumSelectionMode] = None
id: Optional[str] = None
index: Optional[int] = None
enumValues: Optional[str] = None
helpText: Optional[str] = None<|fim_prefix|># repo: kyaaqb... | code_fim | medium | {
"lang": "python",
"repo": "kyaaqba/magma",
"path": "/symphony/cli/pyworkforce/graphql/input/check_list_definition.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeltaEngine/pycoin path: /pycoin/symbols/dash.py
from pycoin.networks.bitcoinish import create_bitcoinish_network
from pycoin.coins.dash.Tx import Tx as DashTx
from pycoin.coins.dash.Block import Block as DashBlock
#See https://github.com/dashevo/dashcore-lib/blob/master/lib/networks.js
network ... | code_fim | medium | {
"lang": "python",
"repo": "DeltaEngine/pycoin",
"path": "/pycoin/symbols/dash.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>hBlock,
wif_prefix_hex="cc", address_prefix_hex="4c", pay_to_script_prefix_hex="10",
bip32_prv_prefix_hex="02fe52f8", bip32_pub_prefix_hex="02fe52cc",
magic_header_hex="bf0c6bbd", default_port=9999,
dns_bootstrap=[
'dnsseed.darkcoin.io',
'dnsseed.dashdot.io',
'dnsse... | code_fim | medium | {
"lang": "python",
"repo": "DeltaEngine/pycoin",
"path": "/pycoin/symbols/dash.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack/rally-openstack path: /tests/unit/task/contexts/swift/test_utils.py
# Copyright 2015: Cisco Systems, Inc.
# 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
# ... | code_fim | hard | {
"lang": "python",
"repo": "openstack/rally-openstack",
"path": "/tests/unit/task/contexts/swift/test_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for tenant_id in context["tenants"]:
for container in context["tenants"][tenant_id]["containers"]:
self.assertEqual(objects_per_container,
len(container["objects"]))
@mock.patch("rally_openstack.common.osclients.Clients")
def te... | code_fim | hard | {
"lang": "python",
"repo": "openstack/rally-openstack",
"path": "/tests/unit/task/contexts/swift/test_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def isPassComment(comment: CommentNode) -> bool:
""" Checks if CommentNode should pass the assertion """
if isPass(comment.comment):
return True
if isPass(comment.filepath): # pragma: no cover
return True
return False
def isPassNodeList(nodelist: List[Union[DirectiveNod... | code_fim | hard | {
"lang": "python",
"repo": "certbot/certbot",
"path": "/certbot-apache/certbot_apache/_internal/assertions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Checks if a ParserNode in the nodelist should pass the assertion,
this function is used for results of find_* methods. Unimplemented find_*
methods should return a sequence containing a single ParserNode instance
with assertion pass string."""
node: Optional[Union[DirectiveNode, C... | code_fim | hard | {
"lang": "python",
"repo": "certbot/certbot",
"path": "/certbot-apache/certbot_apache/_internal/assertions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: certbot/certbot path: /certbot-apache/certbot_apache/_internal/assertions.py
"""Dual parser node assertions"""
import fnmatch
from typing import Any
from typing import Iterable
from typing import List
from typing import Optional
from typing import Union
from certbot_apache._internal import inter... | code_fim | hard | {
"lang": "python",
"repo": "certbot/certbot",
"path": "/certbot-apache/certbot_apache/_internal/assertions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: incuna/incuna-feincms path: /incunafein/content/video/models.py
from django import forms
from django.conf import settings
from django.contrib.admin.widgets import AdminRadioSelect
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.template.loader impo... | code_fim | hard | {
"lang": "python",
"repo": "incuna/incuna-feincms",
"path": "/incunafein/content/video/models.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> cls.add_to_class('video', models.ForeignKey('videos.video', verbose_name=_('video'),
related_name='%s_%s_set' % (cls._meta.app_label, cls._meta.module_name)
))
cls.add_to_class('position', models.CharField(_('position'),
max_length=10, choices=TYPE_CHOICES,... | code_fim | hard | {
"lang": "python",
"repo": "incuna/incuna-feincms",
"path": "/incunafein/content/video/models.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def media(self):
return forms.Media(
js=(
settings.STATIC_URL+'videos/scripts/flowplayer-3.2.6.min.js',
settings.STATIC_URL+'incuna/script/flowplayer.plugins.js',
settings.STATIC_URL+'videos/scripts/videos.js',
... | code_fim | medium | {
"lang": "python",
"repo": "incuna/incuna-feincms",
"path": "/incunafein/content/video/models.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.heapArray+=alist[:]
self.currentSize=len(alist)
i=self.currentSize//2
while i>0:
self.shiftDown(i)
i-=1
def insert(self,k):
self.heapArray.append(k)
self.currentSize+=1
self.shiftUp(self.currentSize)
def shiftUp... | code_fim | hard | {
"lang": "python",
"repo": "yaominzh/CodeLrn2019",
"path": "/mooc43-bobo-algo/pythonEdition/repo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yaominzh/CodeLrn2019 path: /mooc43-bobo-algo/pythonEdition/repo.py
ltEnd,gtStart=partition3Ways(alist,first,last)
quickSort3WaysHelper(alist,first,ltEnd)
quickSort3WaysHelper(alist,gtStart,last)
def partition3Ways(alist,first,last):
rand=randint(first,last)
alis... | code_fim | hard | {
"lang": "python",
"repo": "yaominzh/CodeLrn2019",
"path": "/mooc43-bobo-algo/pythonEdition/repo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __setitem__(self, key, value):
self.put(key,value)
def get(self,key):
if self.root:
res=self._get(key,self.root)
if res:
return res.value
else:
return None
else:
return None
def _get(s... | code_fim | hard | {
"lang": "python",
"repo": "yaominzh/CodeLrn2019",
"path": "/mooc43-bobo-algo/pythonEdition/repo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: b3ttin4/network_simulation_and_analysis path: /analysis/tools/auto_correlation.py
import numpy as np
def get_autocorr(opm,max_lag,method='wiener_khinchin'):
''' calculate auto correlation function using wiener-khinchin theorem'''
if opm.ndim==2:
opm = opm[None,:,:]
nframes,hs,ws = opm.shape... | code_fim | hard | {
"lang": "python",
"repo": "b3ttin4/network_simulation_and_analysis",
"path": "/analysis/tools/auto_correlation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>added//2+max_lag+1]
norm = (hs-abs(np.arange(-max_lag,max_lag+1)))[:,None]*(ws-abs(np.arange(-max_lag,max_lag+1)))[None,:]
autocorr = autocorr/norm # only biased through sigma and mean
return np.real(np.squeeze(autocorr))<|fim_prefix|># repo: b3ttin4/network_simulation_and_analysis path: /analysis... | code_fim | hard | {
"lang": "python",
"repo": "b3ttin4/network_simulation_and_analysis",
"path": "/analysis/tools/auto_correlation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohammadzainabbas/AI-Decision-Support-Systems path: /Lab 06/Task_1 & 2 - Greedy First Search Algorithm.py
import queue as Q
def GBFS(graph, start_node, goal_node, priority = 0, path = []):
pq = Q.PriorityQueue()
pq.put((priority, start_node))
while(not pq.empty()):
u = pq.ge... | code_fim | hard | {
"lang": "python",
"repo": "mohammadzainabbas/AI-Decision-Support-Systems",
"path": "/Lab 06/Task_1 & 2 - Greedy First Search Algorithm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>graph_2 = {'Arad':[{'Zerind':75},{'Timisoara':118},{'Sibiu':140}],
'Zerind':[{'Oradea':71},{'Arad':75}],
'Timisoara':[{'Lugoj':111},{'Arad':118}],
'Sibiu':[{'Arad':140},{'Oradea':151},{'Fagaras':99},{'Rimnicu Vilcea':80}],
'Oradea':[{'Zerind':71},{'Sibiu':151}],... | code_fim | hard | {
"lang": "python",
"repo": "mohammadzainabbas/AI-Decision-Support-Systems",
"path": "/Lab 06/Task_1 & 2 - Greedy First Search Algorithm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pwei1018/sbc-auth path: /notify-api/src/notify_api/resources/__init__.py
# Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... | code_fim | medium | {
"lang": "python",
"repo": "pwei1018/sbc-auth",
"path": "/notify-api/src/notify_api/resources/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ROUTER = APIRouter()
ROUTER.include_router(notify.ROUTER, prefix='/notify', tags=['notify'])<|fim_prefix|># repo: pwei1018/sbc-auth path: /notify-api/src/notify_api/resources/__init__.py
# Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# ... | code_fim | medium | {
"lang": "python",
"repo": "pwei1018/sbc-auth",
"path": "/notify-api/src/notify_api/resources/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ans = 0
def minCameraCover(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def dfs(node):
if not node: return 2
if not node.left and not node.right: return 0
l, r = dfs(node.left), dfs(node.right)
if l ==... | code_fim | medium | {
"lang": "python",
"repo": "nurnisi/algorithms-and-data-structures",
"path": "/leetcode/0-250/206-968. Binary Tree Cameras.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nurnisi/algorithms-and-data-structures path: /leetcode/0-250/206-968. Binary Tree Cameras.py
# 968. Binary Tree Cameras
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution... | code_fim | medium | {
"lang": "python",
"repo": "nurnisi/algorithms-and-data-structures",
"path": "/leetcode/0-250/206-968. Binary Tree Cameras.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return iter(self._frames)
def __getitem__(self, item):
return self._frames[item]
def __len__(self):
return len(self._frames)
def __str__(self):
return 'FrameChain with {} frames'.format(len(self))
def __eq__(self, other):
cl1, cl2 = len(self._fra... | code_fim | hard | {
"lang": "python",
"repo": "AsiminaAth/eyes.selenium.python",
"path": "/applitools/selenium/frames.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AsiminaAth/eyes.selenium.python path: /applitools/selenium/frames.py
import copy
import typing as tp
from applitools.core import Point, EyesError
if tp.TYPE_CHECKING:
from applitools.utils.custom_types import FrameReference, RectangleSize
__all__ = ('Frame', 'FrameChain')
class Frame(obj... | code_fim | hard | {
"lang": "python",
"repo": "AsiminaAth/eyes.selenium.python",
"path": "/applitools/selenium/frames.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stratisMarkou/pilco path: /pilco/utils.py
import tensorflow as tf
def quadratic_form(x, loc, cov):
# Uprank tensors if needed
if tf.rank(x) < 2:
x = tf.reshape(x, (1,) + x.shape)
<|fim_suffix|> if tf.rank(cov) < 3:
cov = tf.reshape(cov, (1,) + cov.shape)
... | code_fim | medium | {
"lang": "python",
"repo": "stratisMarkou/pilco",
"path": "/pilco/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # RBF output is the weighted sum of rbf components
rbf = tf.matmul(self.rbf_weights, exp_quads)
return rbf<|fim_prefix|># repo: stratisMarkou/pilco path: /pilco/utils.py
import tensorflow as tf
def quadratic_form(x, loc, cov):
# Uprank tensors if needed
if tf.rank(x) < 2:
... | code_fim | hard | {
"lang": "python",
"repo": "stratisMarkou/pilco",
"path": "/pilco/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agdsn/pycroft path: /tests/lib/user/test_address_change.py
import abc
import re
import pytest
from sqlalchemy.orm import Session
from pycroft.helpers.i18n import localized
from pycroft.lib.user import edit_address
from pycroft.model.logging import UserLogEntry
from pycroft.model.user import Use... | code_fim | hard | {
"lang": "python",
"repo": "agdsn/pycroft",
"path": "/tests/lib/user/test_address_change.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> le: UserLogEntry = user.latest_log_entry
assert le and le.author == processor
assert self.RE_MESSAGE.search(localized(le.message))
def test_user_address_change(
self, user: User, address_args: dict[str], processor: User, session: Session
):
if user.room:
... | code_fim | hard | {
"lang": "python",
"repo": "agdsn/pycroft",
"path": "/tests/lib/user/test_address_change.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @pytest.fixture(scope="class")
def user(self, class_session: Session) -> User:
return UserFactory()
def test_user_has_custom_address(self, user):
assert user.has_custom_address
class TestUserWithoutRoomAddressChange(TestUserAddressChange):
__test__ = True
@pytest.fi... | code_fim | hard | {
"lang": "python",
"repo": "agdsn/pycroft",
"path": "/tests/lib/user/test_address_change.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zyh1999/pytorch-quantum path: /torchquantum/noise_model.py
-np.cos(current_epoch / prob_schedule_separator *
np.pi) / 2 + 0.5)
else:
noise_total_prob = orig_noise_total_prob
elif prob_schedule == 'decrease':
if curre... | code_fim | hard | {
"lang": "python",
"repo": "zyh1999/pytorch-quantum",
"path": "/torchquantum/noise_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.std = cos_adjust_noise(
current_epoch=current_epoch,
n_epochs=self.n_epochs,
prob_schedule=self.prob_schedule,
prob_schedule_separator=self.prob_schedule_separator,
orig_noise_total_prob=self.orig_std
)
def sample_noise_... | code_fim | hard | {
"lang": "python",
"repo": "zyh1999/pytorch-quantum",
"path": "/torchquantum/noise_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zyh1999/pytorch-quantum path: /torchquantum/noise_model.py
total_prob):
if prob_schedule is None:
noise_total_prob = orig_noise_total_prob
elif prob_schedule == 'increase':
# scale the cos
if current_epoch <= prob_schedule_separator:
noise_total_prob = ... | code_fim | hard | {
"lang": "python",
"repo": "zyh1999/pytorch-quantum",
"path": "/torchquantum/noise_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beliaev-maksim/Office365-REST-Python-Client path: /office365/onedrive/columns/column_definition.py
from office365.base_item import BaseItem
from office365.onedrive.columns.calculated_column import CalculatedColumn
from office365.onedrive.columns.choice_column import ChoiceColumn
from office365.on... | code_fim | medium | {
"lang": "python",
"repo": "beliaev-maksim/Office365-REST-Python-Client",
"path": "/office365/onedrive/columns/column_definition.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def lookup(self):
"""This column's data is looked up from another source in the site."""
return self.get_property('lookup', LookupColumn())
@property
def default_value(self):
"""The default value for this column."""
return self.get_property('defau... | code_fim | medium | {
"lang": "python",
"repo": "beliaev-maksim/Office365-REST-Python-Client",
"path": "/office365/onedrive/columns/column_definition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hosts = state.pop('client')
client = KazooClient(hosts)
client.start()
self.__dict__ = state
self.client = client
class Queue(KazooQueue, SerializeMixin):
pass
class LockingQueue(KazooLockingQueue, SerializeMixin):
pass<|fim_prefix|># repo: usheth/satyr... | code_fim | hard | {
"lang": "python",
"repo": "usheth/satyr",
"path": "/satyr/queue.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Queue(KazooQueue, SerializeMixin):
pass
class LockingQueue(KazooLockingQueue, SerializeMixin):
pass<|fim_prefix|># repo: usheth/satyr path: /satyr/queue.py
from kazoo.client import KazooClient
from kazoo.recipe.queue import LockingQueue as KazooLockingQueue
from kazoo.recipe.queue import... | code_fim | medium | {
"lang": "python",
"repo": "usheth/satyr",
"path": "/satyr/queue.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: usheth/satyr path: /satyr/queue.py
from kazoo.client import KazooClient
from kazoo.recipe.queue import LockingQueue as KazooLockingQueue
from kazoo.recipe.queue import Queue as KazooQueue
class SerializeMixin(object):
def __getstate__(self):
hosts = ["{}:{}".format(h, p) for h, p i... | code_fim | medium | {
"lang": "python",
"repo": "usheth/satyr",
"path": "/satyr/queue.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rishiwadhwa0/MIT_BWSI_Project path: /BWSIFace/whispers/graph.py
# from algorithm import algorithm
# from ..profile import Profile
from .node import Node
from itertools import product
import numpy as np
class Graph:
<|fim_suffix|> distance = np.linalg.norm(node1.data.descr - node2.data.descr)
... | code_fim | hard | {
"lang": "python",
"repo": "rishiwadhwa0/MIT_BWSI_Project",
"path": "/BWSIFace/whispers/graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, profiles):
"""
This initializes a list of nodes when a list of profiles is passed towards me
"""
self.nodes = []
for i, profile in enumerate(profiles):
uniNode = Node(i, {}, profile, truth = profile.name)
self.nodes.append(uniNode)
self.computeDistances()
def __repr... | code_fim | medium | {
"lang": "python",
"repo": "rishiwadhwa0/MIT_BWSI_Project",
"path": "/BWSIFace/whispers/graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return tuple(task.name for task in self.values())<|fim_prefix|># repo: kagayakuff/darq path: /darq/registry.py
import typing as t
from collections import UserDict
from . import worker
if t.TYPE_CHECKING: # pragma: no cover
BaseRegistry = UserDict[str, worker.Task]
else:
BaseRegistry = ... | code_fim | medium | {
"lang": "python",
"repo": "kagayakuff/darq",
"path": "/darq/registry.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kagayakuff/darq path: /darq/registry.py
import typing as t
from collections import UserDict
from . import worker
if t.TYPE_CHECKING: # pragma: no cover
BaseRegistry = UserDict[str, worker.Task]
else:
BaseRegistry = UserDict
<|fim_suffix|> def get_functions(self) -> t.Sequence['work... | code_fim | medium | {
"lang": "python",
"repo": "kagayakuff/darq",
"path": "/darq/registry.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_useremail(em):
con=sqlite3.connect("atm.db")
cursor = con1.execute("SELECT ID FROM USERS WHERE EMAIL=?",[em])
return cursor.fetchone()
def show_balance(uid):
con1=sqlite3.connect("atm.db")
cursor = con1.execute("SELECT BALANCE FROM USERS WHERE ID=?",[uid])
return c... | code_fim | hard | {
"lang": "python",
"repo": "khushboomehla33/Voice-Controlled-Secured-Futuristic-ATM",
"path": "/sqlconn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: khushboomehla33/Voice-Controlled-Secured-Futuristic-ATM path: /sqlconn.py
import sqlite3
def dbconnect():
con=sqlite3.connect("atm.db")
def create_utable():
con=sqlite3.connect("atm.db")
con.execute('''CREATE TABLE USERS(ID INT PRIMARY KEY NOT NULL,
NAME TE... | code_fim | hard | {
"lang": "python",
"repo": "khushboomehla33/Voice-Controlled-Secured-Futuristic-ATM",
"path": "/sqlconn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_user(uid):
con1=sqlite3.connect("atm.db")
cursor = con1.execute("SELECT ID,NAME,BALANCE FROM USERS WHERE ID=?",[uid])
return cursor.fetchone()
def get_useremail(em):
con=sqlite3.connect("atm.db")
cursor = con1.execute("SELECT ID FROM USERS WHERE EMAIL=?",[em])
retu... | code_fim | hard | {
"lang": "python",
"repo": "khushboomehla33/Voice-Controlled-Secured-Futuristic-ATM",
"path": "/sqlconn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zaubermaerchen/imas_cg_image path: /idol/views.py
# -*- coding: utf-8 -*-
import io
import json
from django.views import View
from django.http import HttpResponse, HttpResponseNotFound
from urllib.request import Request, urlopen
from urllib.parse import urlencode
from image.settings import *
from... | code_fim | medium | {
"lang": "python",
"repo": "zaubermaerchen/imas_cg_image",
"path": "/idol/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 画像データ読み込み
image = self.get_image(setting['attribute'][idol['rarity']], idol['hash'])
if image is None:
image = Image.new("RGB", (setting['width'], setting['height']))
# レスポンス出力
response = HttpResponse(content_type='image/jpeg')
response['Acces... | code_fim | hard | {
"lang": "python",
"repo": "zaubermaerchen/imas_cg_image",
"path": "/idol/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pozar87/apts path: /apts/place.py
import datetime
from math import radians as rad, degrees as deg
import ephem
import matplotlib.font_manager as font_manager
import pandas as pd
import pkg_resources
import pytz
from dateutil import tz
from timezonefinder import TimezoneFinder
from .weather impo... | code_fim | hard | {
"lang": "python",
"repo": "pozar87/apts",
"path": "/apts/place.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def moon_lunation(self):
return int(self.moon_path()['Lunation'][48] * 100)
def moon_phase(self):
return int(self.moon_path()['Phase'][48])
def moon_path(self):
self.date = datetime.date.today()
result = []
for i in range(24 * 4): # compute position for every 15 minutes
... | code_fim | hard | {
"lang": "python",
"repo": "pozar87/apts",
"path": "/apts/place.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def moon_path(self):
self.date = datetime.date.today()
result = []
for i in range(24 * 4): # compute position for every 15 minutes
self.moon.compute(self)
next_new_moon = ephem.next_new_moon(self.date)
previous_new_moon = ephem.previous_new_moon(self.date)
lunation =... | code_fim | hard | {
"lang": "python",
"repo": "pozar87/apts",
"path": "/apts/place.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_quick(self):
self.assertEqual(self.sorted1, quicksort(self.unsorted1, 0, len(self.unsorted1)-1))
self.assertEqual(self.sorted2, quicksort(self.unsorted2, 0, len(self.unsorted2)-1))
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: jhomola/python-washu-2014 path: /hw3/hw3t... | code_fim | medium | {
"lang": "python",
"repo": "jhomola/python-washu-2014",
"path": "/hw3/hw3test_jh.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jhomola/python-washu-2014 path: /hw3/hw3test_jh.py
import unittest
from hw3_jh import *
from random import *
class hw3Test(unittest.TestCase):
def setUp(self):
self.unsorted1 = [uniform(-1000,1000) for i in xrange(1000)]
self.unsorted2 = ["A", "c", "Q", "def", "zzz", "Hello", "23", "w0RLd",... | code_fim | medium | {
"lang": "python",
"repo": "jhomola/python-washu-2014",
"path": "/hw3/hw3test_jh.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>train_images = train_images.reshape((60000, 28, 28, 1))
train_images = train_images.astype("float32") / 255
test_images = test_images.reshape((10000, 28, 28, 1))
test_images = test_images.astype("float32") / 255
train_labels = to_categorical(train_labels)
test_labels = to_categorical(test_labels)
# -
mod... | code_fim | medium | {
"lang": "python",
"repo": "daizutabi/scratch",
"path": "/docs/keras/p10_Deep_Learning_with_Python/Chapter_5/s51_introduction_to_convnets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daizutabi/scratch path: /docs/keras/p10_Deep_Learning_with_Python/Chapter_5/s51_introduction_to_convnets.py
# # 5.1 Introduction to convnets
# # (https://nbviewer.jupyter.org/github/fchollet/deep-learning-with-python-notebooks/
# # blob/master/5.1-introduction-to-convnets.ipynb)
from tensorflow.... | code_fim | hard | {
"lang": "python",
"repo": "daizutabi/scratch",
"path": "/docs/keras/p10_Deep_Learning_with_Python/Chapter_5/s51_introduction_to_convnets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># -
model.add(layers.Flatten())
model.add(layers.Dense(64, activation="relu"))
model.add(layers.Dense(10, activation="softmax"))
model.summary()
# -
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
train_images = train_images.reshape((60000, 28, 28, 1))
train_images = train_... | code_fim | hard | {
"lang": "python",
"repo": "daizutabi/scratch",
"path": "/docs/keras/p10_Deep_Learning_with_Python/Chapter_5/s51_introduction_to_convnets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> MatchTo = cms.InputTag("tauGenJetsSelectorAllHadrons")
)<|fim_prefix|># repo: cms-sw/cmssw path: /Validation/RecoParticleFlow/python/GenJetClosestMatchSelector_cfi.py
import FWCore.ParameterSet.Config as cms
genJetClosestMatchSelector = cms.EDFilter("GenJetClosestMatchSelector",
... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Validation/RecoParticleFlow/python/GenJetClosestMatchSelector_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /Validation/RecoParticleFlow/python/GenJetClosestMatchSelector_cfi.py
import FWCore.ParameterSet.Config as cms
genJetClosestMatchSelect<|fim_suffix|> src = cms.InputTag("ak4GenJets"),
MatchTo = cms.InputTag("tauGenJetsSelectorAllHadrons"... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Validation/RecoParticleFlow/python/GenJetClosestMatchSelector_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sladinji/blousebrothers path: /blousebrothers/confs/management/commands/pay_conf2.py
from decimal import Decimal
from datetime import datetime, timedelta
from django.core.management.base import BaseCommand
from blousebrothers.confs.models import Subscription
<|fim_suffix|> """
For each ... | code_fim | hard | {
"lang": "python",
"repo": "sladinji/blousebrothers",
"path": "/blousebrothers/confs/management/commands/pay_conf2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yesterday = datetime.now() - timedelta(days=1)
two_days_ago = datetime.now() - timedelta(days=2)
for sub in Subscription.objects.filter(
date_over__day=yesterday.day,
date_over__gt=two_days_ago,
price_paid__gt=0,
).all():
tota... | code_fim | hard | {
"lang": "python",
"repo": "sladinji/blousebrothers",
"path": "/blousebrothers/confs/management/commands/pay_conf2.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.