text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: jason-su/MKD-NET path: /core/test/cornernet.py
#coding:utf-8
import os
import cv2
import json
import numpy as np
import torch
import json
from tqdm import tqdm
from ..utils import Timer
from ..vis_utils import draw_bboxes
from ..sample.utils import crop_image
from ..external.nms import soft_nms... | code_fim | hard | {
"lang": "python",
"repo": "jason-su/MKD-NET",
"path": "/core/test/cornernet.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> height_scale = (input_size[0] + 1) // output_size[0]
width_scale = (input_size[1] + 1) // output_size[1]
im_mean = torch.cuda.FloatTensor(db.mean).reshape(1, 3, 1, 1)
im_std = torch.cuda.FloatTensor(db.std).reshape(1, 3, 1, 1)
detections = []
#multi scales
for scale in sc... | code_fim | hard | {
"lang": "python",
"repo": "jason-su/MKD-NET",
"path": "/core/test/cornernet.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># draw_proposals(image, detections,ind)
#bboxes, scores, tl_scores, br_scores, clses
top_bboxes = {}
t_boxes = []
for j in range(categories):
keep_inds = (classes == j)
top_bboxes[j + 1] = detections[keep_inds][:, 0:7].astype(np.float32)
pr_l... | code_fim | hard | {
"lang": "python",
"repo": "jason-su/MKD-NET",
"path": "/core/test/cornernet.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peopledoc/circus path: /circus/web/server.py
import socket
from bottle import ServerAdapter
class SocketIOServer(ServerAdapter):
def __init__(self, host='127.0.0.1', port=8080, **config):
super(SocketIOServer, self).__init__(host, port, **config)
self.fd = config.get('fd')
... | code_fim | hard | {
"lang": "python",
"repo": "peopledoc/circus",
"path": "/circus/web/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> socket_server = SocketIOServer(sock, handler,
namespace=namespace,
policy_server=policy_server)
handler.socket_server = socket_server
socket_server.serve_forever()<|fim_prefix|># repo: peopledoc/circus p... | code_fim | hard | {
"lang": "python",
"repo": "peopledoc/circus",
"path": "/circus/web/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agoose77/seamless path: /tests/test-itransformer.py
from seamless import context
from seamless.lib.filelink import link
from seamless.lib.itransformer import itransformer
from seamless.lib.gui.basic_display import display
from seamless.lib.gui.basic_editor import edit
ctx = context()
ctx.itf = it... | code_fim | medium | {
"lang": "python",
"repo": "agoose77/seamless",
"path": "/tests/test-itransformer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>r({
"i": {"pin": "input", "dtype": "int"},
"outp": {"pin": "output", "dtype": "json"},
})
link(ctx.itf.code.cell(), ".", "cell-test-itransformer.ipy")
link(ctx.itf.rc.code_start.cell())
display(ctx.itf.outp.cell())
edit(ctx.itf.i.cell().set(100))<|fim_prefix|># repo: agoose77/seamless path: /test... | code_fim | medium | {
"lang": "python",
"repo": "agoose77/seamless",
"path": "/tests/test-itransformer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hawson/antiroute path: /ipmap.py
#!/usr/bin/env python3
# make an IP Map
import logging
import sys
import argparse
import subprocess
import ipaddress
import re
import os
import hilbert
def ping_subnet(subnet):
if os.path.exists('/usr/sbin/fping'):
fping = '/usr/sbin/fping'
el... | code_fim | hard | {
"lang": "python",
"repo": "hawson/antiroute",
"path": "/ipmap.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if False:
if remaining_args:
elements = int(remaining_args[0])
pinged = map(int, remaining_args[1:])
for ip in pinged:
hilbert_curve.setd(ip, ip)
hilbert_curve.print()<|fim_prefix|># repo: hawson/antiroute path: /ipmap.py
#!/usr/bin/env python3... | code_fim | hard | {
"lang": "python",
"repo": "hawson/antiroute",
"path": "/ipmap.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if True:
try:
subnet = ipaddress.ip_network(remaining_args[0])
except ValueError as exc:
logging.error("Subnet [%s] doesn't look valid.", remaining_args[0])
sys.exit(1)
hilbert_curve = hilbert.Hilbert(subnet.num_addresses)
ping_out... | code_fim | hard | {
"lang": "python",
"repo": "hawson/antiroute",
"path": "/ipmap.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Saintyven/topiary path: /topiary/cli/rna.py
# Copyright (c) 2017. Mount Sinai School of Medicine
#
# 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
#
# http://www.apac... | code_fim | hard | {
"lang": "python",
"repo": "Saintyven/topiary",
"path": "/topiary/cli/rna.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def rna_transcript_expression_dict_from_args(args):
"""
Returns a dictionary mapping Ensembl transcript IDs to FPKM expression
values or None if neither Cufflinks tracking file nor StringTie GTF file
were specified.
"""
if args.rna_transcript_fpkm_tracking_file:
return load... | code_fim | hard | {
"lang": "python",
"repo": "Saintyven/topiary",
"path": "/topiary/cli/rna.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openvinotoolkit/open_model_zoo path: /models/public/deblurgan-v2/model.py
# Copyright (c) 2022-2023 Intel Corporation
#
# 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": "openvinotoolkit/open_model_zoo",
"path": "/models/public/deblurgan-v2/model.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
parameters = {'g_name': model_name, 'norm_layer': 'instance'}
self.impl = get_generator(parameters)
checkpoint = torch.load(weights, map_location='cpu')['model']
self.impl.load_state_dict(checkpoint)
self.impl.train(True)
remove_a... | code_fim | medium | {
"lang": "python",
"repo": "openvinotoolkit/open_model_zoo",
"path": "/models/public/deblurgan-v2/model.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ktmeaton/flowdash-bio path: /app/__init__.py
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from flask import Flask
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import schema
from importl... | code_fim | hard | {
"lang": "python",
"repo": "ktmeaton/flowdash-bio",
"path": "/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def register_extensions(app):
db.init_app(app)
login_manager.init_app(app)
def register_blueprints(app):
for module_name in ("base", "home", "api"):
module = import_module("app.{}.routes".format(module_name))
if module_name == "api":
app.register_blueprint(module... | code_fim | hard | {
"lang": "python",
"repo": "ktmeaton/flowdash-bio",
"path": "/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> d = ''
d += item(i, 'Date', 'Exif.Photo.DateTimeOriginal')
d += item(i, 'Camera', 'Exif.Image.Model')
d += item(i, 'Exposure time', 'Exif.Photo.ExposureTime')
d += item(i, 'F-number', 'Exif.Photo.FNumber')
d += item(i, 'ISO rating', 'Exif.Photo.ISOSpeedRatings')
d += item(i, 'F... | code_fim | hard | {
"lang": "python",
"repo": "joneskoo/kuveja",
"path": "/meta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joneskoo/kuveja path: /meta.py
#encoding: UTF-8
def readmeta(file):
import pyexiv2
i = pyexiv2.Image(file)
i.readMetadata()
def item(image, key, value):
<|fim_suffix|> d = ''
d += item(i, 'Date', 'Exif.Photo.DateTimeOriginal')
d += item(i, 'Camera', 'Exif.Ima... | code_fim | hard | {
"lang": "python",
"repo": "joneskoo/kuveja",
"path": "/meta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: telehan/python_ics path: /ics/structures/j2534_adapter_information.py
# This file was auto generated; Do not modify, if you value your sanity!
import ctypes
class j2534_adapter_information(ctypes.Structure):
<|fim_suffix|># Extra names go here:
J2534_ADAPTER_INFORMATION = j2534_adapter_informati... | code_fim | hard | {
"lang": "python",
"repo": "telehan/python_ics",
"path": "/ics/structures/j2534_adapter_information.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Extra names go here:
J2534_ADAPTER_INFORMATION = j2534_adapter_information
# End of extra names<|fim_prefix|># repo: telehan/python_ics path: /ics/structures/j2534_adapter_information.py
# This file was auto generated; Do not modify, if you value your sanity!
import ctypes
<|fim_middle|>class j2534_ad... | code_fim | hard | {
"lang": "python",
"repo": "telehan/python_ics",
"path": "/ics/structures/j2534_adapter_information.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _fields_ = [
('szName', ctypes.c_char * 128), # Adaptor name - ASCII Null terminated
('szDeviceName', ctypes.c_char * 64), # Device name - ASCII Null terminated
('Status', ctypes.c_ulong), # Adaptor Status, 0 for disabled, 1 for enabled
('bMAC_Address', ctypes.c_ubyte *... | code_fim | medium | {
"lang": "python",
"repo": "telehan/python_ics",
"path": "/ics/structures/j2534_adapter_information.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Display the best matching points
cv2.imshow('result',result)
#Naming the output image
image_name = path.split(r'/')
image_path = image_name[-1].split('.')
output = r"./ORB Algorithm/"+ image_path[0] + "(featureMatched).jpg"
cv2.imwrite(output,result)
# Print total number of matching points between th... | code_fim | hard | {
"lang": "python",
"repo": "PrajjwalDatir/Amazing-Python-Scripts",
"path": "/ORB Algorithm/ORB_Algorithm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PrajjwalDatir/Amazing-Python-Scripts path: /ORB Algorithm/ORB_Algorithm.py
import cv2
import numpy as np
# Load the image
path=input('Enter the path of the image: ')
image = cv2.imread(path)
path2=input('Enter the path for testing image: ')
test_image=cv2.imread(path2)
#Resizing the image
image... | code_fim | medium | {
"lang": "python",
"repo": "PrajjwalDatir/Amazing-Python-Scripts",
"path": "/ORB Algorithm/ORB_Algorithm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @parameterized.named_parameters(
*_TF_EXAMPLE_DECODER_TESTS)
def test_decode_example(self, example_proto_text, decoded_example):
example = tf.train.Example()
text_format.Merge(example_proto_text, example)
self._check_decoding_results(
example_coder.ExampleToNumpyDict(example.... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tfx-bsl",
"path": "/tfx_bsl/coders/example_numpy_decoder_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tfx-bsl path: /tfx_bsl/coders/example_numpy_decoder_test.py
# Copyright 2018 Google LLC
#
# 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
#
# http://www.a... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tfx-bsl",
"path": "/tfx_bsl/coders/example_numpy_decoder_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_TF_EXAMPLE_DECODER_TESTS = [
{
'testcase_name': 'empty_input',
'example_proto_text': '''features {}''',
'decoded_example': {}
},
{
'testcase_name': 'int_feature_non_empty',
'example_proto_text': '''
features {
feature {
... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tfx-bsl",
"path": "/tfx_bsl/coders/example_numpy_decoder_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self.device_ids:
return self.flow.forward(*inputs, **kwargs)
inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids)
if len(self.device_ids) == 1:
return self.flow.forward(*inputs[0], **kwargs[0])
replicas = self.replicate(self.flow, se... | code_fim | hard | {
"lang": "python",
"repo": "XuezheMax/macow",
"path": "/macow/flows/parallel/data_parallel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def scatter(self, inputs, kwargs, device_ids):
return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim)
def parallel_apply(self, replicas, inputs, kwargs, backward=False):
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)], backward=backward)
... | code_fim | medium | {
"lang": "python",
"repo": "XuezheMax/macow",
"path": "/macow/flows/parallel/data_parallel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XuezheMax/macow path: /macow/flows/parallel/data_parallel.py
__author__ = 'max'
from overrides import overrides
from typing import Tuple
import torch
from torch.nn.parallel.replicate import replicate
from macow.flows.parallel.parallel_apply import parallel_apply
from torch.nn.parallel.scatter_ga... | code_fim | hard | {
"lang": "python",
"repo": "XuezheMax/macow",
"path": "/macow/flows/parallel/data_parallel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MadTonG/gempak path: /scripts/python/GridNavRetriever.py
import os
import math
from datetime import datetime
from awips import ThriftClient
from dynamicserialize.dstypes.gov.noaa.nws.ncep.common.dataplugin.gempak.request import GetGridNavRequest
from ctypes import *
EARTH_RADIUS = 6371200.0
DEG_... | code_fim | hard | {
"lang": "python",
"repo": "MadTonG/gempak",
"path": "/scripts/python/GridNavRetriever.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class GridNavRetriever:
def __init__(self,server,pluginName,modelId,arrayLen):
self.pluginName = pluginName
self.modelId = modelId
self.arrayLen = arrayLen
self.host = os.getenv("DEFAULT_HOST", server)
self.port = os.getenv("DEFAULT_PORT", "9581")
self.client =... | code_fim | hard | {
"lang": "python",
"repo": "MadTonG/gempak",
"path": "/scripts/python/GridNavRetriever.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
print(f"invoke: {cmd_ensure}")
SUDO.execute_unit_sert(cmd_ensure)
result = SUDO.execute_unit_sert(cmd_report)
print(result.stdout)
for command in resource_create_list:
print(f"invoke: {command}")
SUDO.execute_unit_sert(command)
... | code_fim | hard | {
"lang": "python",
"repo": "random-python/nspawn",
"path": "/src/test/nspawn_test/base/machine_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> resource_create_list = machine_result.resource_create_list()
resource_delete_list = machine_result.resource_delete_list()
cmd_report = f"ls -las {machine_directory}".split()
cmd_ensure = f"mkdir -p {machine_directory}".split()
cmd_desure = f"rm -rf {machine_directory}".split()
... | code_fim | hard | {
"lang": "python",
"repo": "random-python/nspawn",
"path": "/src/test/nspawn_test/base/machine_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: random-python/nspawn path: /src/test/nspawn_test/base/machine_test.py
import platform
from nspawn.wrapper.sudo import SUDO
from nspawn.tool import stamp
from nspawn.base.machine import *
build_stamp = stamp.build_stamp()
epoch = "3.10"
release = f"{epoch}.3"
hardware = platform.machine()
image_... | code_fim | hard | {
"lang": "python",
"repo": "random-python/nspawn",
"path": "/src/test/nspawn_test/base/machine_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: City-of-Helsinki/youth-membership path: /youths/tests/test_graphql_api_additional_contact_persons.py
from string import Template
from graphql_relay import to_global_id
from common_utils.profile import ProfileAPI
from youths.models import AdditionalContactPerson
from youths.tests.factories impor... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Helsinki/youth-membership",
"path": "/youths/tests/test_graphql_api_additional_contact_persons.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> executed = user_gql_client.execute(
ADDITIONAL_CONTACT_PERSONS_QUERY, context=request
)
expected_data = {
"myYouthProfile": {
"additionalContactPersons": {
"edges": [
{
"node": {
... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Helsinki/youth-membership",
"path": "/youths/tests/test_graphql_api_additional_contact_persons.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drdee/eddytools path: /evaluation/evaluation.py
from eddytools import schema as es
def test_disc_mimic(resume=False, sampling=0, max_fields_key=2, dump_dir=None):
connection_params = {
'dialect': 'postgresql',
'username': 'postgres',
'password': 'postgres',
... | code_fim | hard | {
"lang": "python",
"repo": "drdee/eddytools",
"path": "/evaluation/evaluation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
# test_disc_ds2(resume=False, sampling=0, max_fields_key=1, dump_dir='output/ds2/dumps-ns-1/')
# test_disc_ds2(resume=False, sampling=0, max_fields_key=2, dump_dir='output/ds2/dumps-ns-2/')
# test_disc_ds2(resume=False, sampling=0, max_fields_key=3, dump_dir='output... | code_fim | hard | {
"lang": "python",
"repo": "drdee/eddytools",
"path": "/evaluation/evaluation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silky/datalad path: /datalad/distribution/tests/test_update.py
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ... | code_fim | hard | {
"lang": "python",
"repo": "silky/datalad",
"path": "/datalad/distribution/tests/test_update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@with_testrepos('.*annex.*', flavors=['clone'])
@with_tempfile(mkdir=True)
@with_tempfile(mkdir=True)
def test_update_fetch_all(src, remote_1, remote_2):
rmt1 = AnnexRepo(remote_1, src)
rmt2 = AnnexRepo(remote_2, src)
ds = Dataset(src)
ds.add_sibling(name="sibling_1", url=remote_1)
d... | code_fim | hard | {
"lang": "python",
"repo": "silky/datalad",
"path": "/datalad/distribution/tests/test_update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ds = Dataset(src)
ds.add_sibling(name="sibling_1", url=remote_1)
ds.add_sibling(name="sibling_2", url=remote_2)
# modify the remotes:
with open(opj(remote_1, "first.txt"), "w") as f:
f.write("some file load")
rmt1.add("first.txt", commit=True)
# TODO: Modify an already... | code_fim | hard | {
"lang": "python",
"repo": "silky/datalad",
"path": "/datalad/distribution/tests/test_update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DivinaThomas/dropBoxReplica_CloudComputing path: /addfile.py
import webapp2
import jinja2
import os
from google.appengine.ext import ndb
from google.appengine.ext import blobstore
from google.appengine.api import users
from directory import Directory
from uploadfilehandler import UploadFileHandle... | code_fim | hard | {
"lang": "python",
"repo": "DivinaThomas/dropBoxReplica_CloudComputing",
"path": "/addfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logout = users.create_logout_url('/')
user = users.get_current_user()
template_values = {
'directory_id' : directory_id,
'user' : user,
'logout' : logout,
'upload_url' : blobstore.create_upload_url('/uploadfilehandler'),
}
template = JINJA_ENVIRONMENT.get_template('addfile.html')
s... | code_fim | hard | {
"lang": "python",
"repo": "DivinaThomas/dropBoxReplica_CloudComputing",
"path": "/addfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WMD-group/polytype path: /Ising_model/coefficients.py
#spin2H = [1,-1]
#spin3C = [1,1,1]
#spin4H = [1,-1,-1,1]
#spin6H = [1,-1,-1,-1,1,1]
#spin9R = [1,-1,1,1,-1,1,1,-1,1]
#spin12R = [1,-1,1,1,1,-1,1,1,1,-1,1,1]
spin2H = [1,1]
spin3C = [-1,-1,-1]
spin4H = [1,-1,1,-1]
spin6H = [1,-1,-1,1,-1,-1]
s... | code_fim | medium | {
"lang": "python",
"repo": "WMD-group/polytype",
"path": "/Ising_model/coefficients.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> generalCoefficients(spin,[0])
generalCoefficients(spin,[1])
generalCoefficients(spin,[2])
generalCoefficients(spin,[3])
generalCoefficients(spin,[1,2])
generalCoefficients(spin,[2,3])
generalCoefficients(spin,[1,3])
generalCoefficients(spin,[1,2,3])
#getAll(spin2H)
#getAll... | code_fim | hard | {
"lang": "python",
"repo": "WMD-group/polytype",
"path": "/Ising_model/coefficients.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ishann/detectron2 path: /box_of_tools/upper_bound_map/utils.py
################################################################################
## Import packages. ##
########################################################################... | code_fim | hard | {
"lang": "python",
"repo": "ishann/detectron2",
"path": "/box_of_tools/upper_bound_map/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>################################################################################
## Convert 1 gt_bbox from XYHW_ABS to 1 XYXY_ABS bbox proposal. ##
################################################################################
def coco_box_to_bbox(box):
"""
Convert 1 gt_bbox from X... | code_fim | hard | {
"lang": "python",
"repo": "ishann/detectron2",
"path": "/box_of_tools/upper_bound_map/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('djconnectwise', '0168_ticket_contact_email_address_ticket_contact_name_and_more'),
]
operations = [
migrations.AddField(
model_name='connectwiseboard',
name='time_entry_discussion_flag',
field=models.BooleanField(default=F... | code_fim | medium | {
"lang": "python",
"repo": "KerkhoffTechnologies/django-connectwise",
"path": "/djconnectwise/migrations/0169_connectwiseboard_time_entry_discussion_flag_and_more.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KerkhoffTechnologies/django-connectwise path: /djconnectwise/migrations/0169_connectwiseboard_time_entry_discussion_flag_and_more.py
# Generated by Django 4.0.7 on 2023-03-08 17:09
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('djconnectwise', '0168_ticke... | code_fim | medium | {
"lang": "python",
"repo": "KerkhoffTechnologies/django-connectwise",
"path": "/djconnectwise/migrations/0169_connectwiseboard_time_entry_discussion_flag_and_more.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kakawaa/fasttest path: /fasttest/utils/server_utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import random
import platform
import traceback
import subprocess
from fasttest.common import *
class ServerUtils(object):
def __exec_command(self,cmd):
pipe = s... | code_fim | hard | {
"lang": "python",
"repo": "kakawaa/fasttest",
"path": "/fasttest/utils/server_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,port=3456):
self.__port = port
self.__thread = None
def print_server_log(self,out):
for out_ in out:
out_ = str(out_,encoding='utf-8')
log_info(out_)
if 'Macaca server started' in out_:break
def start_server(self)... | code_fim | hard | {
"lang": "python",
"repo": "kakawaa/fasttest",
"path": "/fasttest/utils/server_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def inference(self, image):
image_features = self.encoder(image)
hidden = self.decoder.init_hidden(image.shape[0])
if torch.cuda.is_available():
word = torch.cuda.IntTensor([self.vocab.word_to_index['<START>']])
else:
word = torch.tensor(self.vocab.word_to_index['<START>'])
sentence = ... | code_fim | hard | {
"lang": "python",
"repo": "ppujol76/Lucas_Transformers",
"path": "/model/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ppujol76/Lucas_Transformers path: /model/main.py
import torch
from torch import nn
#from encoder import Encoder
from model.encoder import Encoder_VGG16
from dataset.vocabulary import Vocabulary
from model.transformer.decoder import TransformerDecoder
class ImageCaptioningModel(nn.Module):
def ... | code_fim | hard | {
"lang": "python",
"repo": "ppujol76/Lucas_Transformers",
"path": "/model/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>start_node = np.array([0,0])
nodes = np.array([[0,1], [2,1], [1,1], [3,3], [4,1]])
print(test.calc_euclidean_distance(nodes, start_node))
print(test.calc_manhattan_distance(nodes, start_node))
print(test.calc_euclidean_distance(nodes))
print(test.calc_manhattan_distance(nodes))<|fim_prefix|># repo: shubha... | code_fim | hard | {
"lang": "python",
"repo": "shubhampachori12110095/trucks-and-drones",
"path": "/trucks_and_drones/simulation/positions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shubhampachori12110095/trucks-and-drones path: /trucks_and_drones/simulation/positions.py
import numpy as np
from scipy.spatial.distance import cdist
class BaseDistanceMatrices:
def __init__(self):
pass
def calc_euclidean_distance(self, nodes, start_node=None):
<|fim_suffix|> ... | code_fim | medium | {
"lang": "python",
"repo": "shubhampachori12110095/trucks-and-drones",
"path": "/trucks_and_drones/simulation/positions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ybrovman/pytorch-lightning path: /tests/base/eval_model_train_steps.py
from abc import ABC
from collections import OrderedDict
class TrainingStepVariations(ABC):
"""
Houses all variations of training steps
"""
def training_step(self, batch, batch_idx, optimizer_idx=None):
... | code_fim | medium | {
"lang": "python",
"repo": "ybrovman/pytorch-lightning",
"path": "/tests/base/eval_model_train_steps.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> y_hat = self(x)
# calculate loss
loss_val = self.loss(y, y_hat)
# alternate possible outputs to test
if self.trainer.batch_idx % 1 == 0:
output = OrderedDict({
'loss': loss_val,
'progress_bar': {'some_val': loss_val * lo... | code_fim | hard | {
"lang": "python",
"repo": "ybrovman/pytorch-lightning",
"path": "/tests/base/eval_model_train_steps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # alternate possible outputs to test
if self.trainer.batch_idx % 1 == 0:
output = OrderedDict({
'loss': loss_val,
'progress_bar': {'some_val': loss_val * loss_val},
'log': {'train_some_val': loss_val * loss_val},
})
... | code_fim | hard | {
"lang": "python",
"repo": "ybrovman/pytorch-lightning",
"path": "/tests/base/eval_model_train_steps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abdur-rahmaanJ/faker path: /tests/providers/test_internet.py
import unittest
from itertools import cycle
from unittest import mock
import pytest
from faker import Faker
from faker.providers.person.ja_JP import Provider as JaProvider
from faker.utils import text
from validators import domain as... | code_fim | hard | {
"lang": "python",
"repo": "Abdur-rahmaanJ/faker",
"path": "/tests/providers/test_internet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_tld.return_value = 'net'
mock_domain_word.return_value = 'li'
for levels in range(3, 10):
with mock.patch('faker.providers.internet.zh_CN.Provider.domain_name',
wraps=self.fake.domain_name) as mock_domain_name:
mock_tld.r... | code_fim | hard | {
"lang": "python",
"repo": "Abdur-rahmaanJ/faker",
"path": "/tests/providers/test_internet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> headers = {}
headers.update({'Authorization' : "Bearer {}".format(token)})
resp = self.http.get(endpoint, headers=headers)
if resp.status_code == 200:
cont = resp.json()
return cont['data']
if resp.status_code == 401:
raise Co... | code_fim | hard | {
"lang": "python",
"repo": "eduardhendriksen/PyForge",
"path": "/PyForge/ForgeVersions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eduardhendriksen/PyForge path: /PyForge/ForgeVersions.py
# -*- coding: utf-8 -*-
"""Module containing classes related to item versions on the Autodesk Forge BIM360 platform."""
from PyForge.ForgeApi import ForgeApi
from urllib.parse import quote_plus
class VersionsApi(ForgeApi):
"""This cla... | code_fim | hard | {
"lang": "python",
"repo": "eduardhendriksen/PyForge",
"path": "/PyForge/ForgeVersions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> endpoint=r':project_id/versions/:version_id'):
"""
Send a GET projects/:project_id/versions/:version_id request to the BIM360 API, returns the version corresponding to the version id.
Args:
project_id: The project id for the project the folder is in... | code_fim | hard | {
"lang": "python",
"repo": "eduardhendriksen/PyForge",
"path": "/PyForge/ForgeVersions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not True:
self.qtgui_time_sink_x_0.disable_legend()
labels = ['', '', '', '', '',
'', '', '', '', '']
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
colors = ["blue", "red", "green", "black", "cyan",
"magenta", "y... | code_fim | hard | {
"lang": "python",
"repo": "zleffke/flowgraph_sandbox",
"path": "/gr37/fox1d/fox1d_rx_pipe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zleffke/flowgraph_sandbox path: /gr37/fox1d/fox1d_rx_pipe.py
fractional_bw=None,
)
self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
interpolation=48,
decimation=50,
taps=None,
fractional_bw=None,
... | code_fim | hard | {
"lang": "python",
"repo": "zleffke/flowgraph_sandbox",
"path": "/gr37/fox1d/fox1d_rx_pipe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zleffke/flowgraph_sandbox path: /gr37/fox1d/fox1d_rx_pipe.py
0, 1.0]
for i in xrange(1):
if len(labels[i]) == 0:
self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
else:
self.qtgui_waterfall_sink_x_0.set_line_label... | code_fim | hard | {
"lang": "python",
"repo": "zleffke/flowgraph_sandbox",
"path": "/gr37/fox1d/fox1d_rx_pipe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rimba47prayoga/Nufarm_Asset_Management path: /N_Asset/app/NA_Views/OtherPages/NA_Acc_Fa_View.py
import json
import datetime
from decimal import Decimal
from django import forms
from django.shortcuts import render
from django.db import transaction
from django.http import HttpResponse, JsonRespons... | code_fim | hard | {
"lang": "python",
"repo": "rimba47prayoga/Nufarm_Asset_Management",
"path": "/N_Asset/app/NA_Views/OtherPages/NA_Acc_Fa_View.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def depr_method(dm):
return 'Straight Line Method' if dm == 'SL'\
else('Double Declining Balance' if dm == 'DDB' else 'Sum of The Year Digit')
goods_obj['startdate'] = goods_obj['startdate'].strftime('%d/%m/%Y')
goods_obj['enddate'] = goods_obj['enddate'].st... | code_fim | hard | {
"lang": "python",
"repo": "rimba47prayoga/Nufarm_Asset_Management",
"path": "/N_Asset/app/NA_Views/OtherPages/NA_Acc_Fa_View.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> settings = {
'month_of': opt['month_of'],
'economiclife': economiclife,
'typeApp': data['typeapp'],
'serialNumber': data['serialnumber'],
'price': price,
'depr_method': d... | code_fim | hard | {
"lang": "python",
"repo": "rimba47prayoga/Nufarm_Asset_Management",
"path": "/N_Asset/app/NA_Views/OtherPages/NA_Acc_Fa_View.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ayiork/Label-Free-XAI path: /src/lfxai/models/images.py
rDecoderMnist, self).__init__()
self.fc = nn.Linear(in_features=latent_dims, out_features=c * 2 * 7 * 7)
self.conv2 = nn.ConvTranspose2d(
in_channels=c * 2, out_channels=c, kernel_size=4, stride=2, padding=1
... | code_fim | hard | {
"lang": "python",
"repo": "ayiork/Label-Free-XAI",
"path": "/src/lfxai/models/images.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def nt_xent(x, t=0.5):
x = F.normalize(x, dim=1)
x_scores = (x @ x.t()).clamp(min=1e-7) # normalized cosine similarity scores
x_scale = x_scores / t # scale with temperature
# (2N-1)-way softmax without the score of i-th entry itself.
# Set ... | code_fim | hard | {
"lang": "python",
"repo": "ayiork/Label-Free-XAI",
"path": "/src/lfxai/models/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ayiork/Label-Free-XAI path: /src/lfxai/models/images.py
best_test_loss = test_loss.data
waiting_epoch = 0
if waiting_epoch == patience:
logging.info("Early stopping activated")
break
def save(self, directory: pathlib.... | code_fim | hard | {
"lang": "python",
"repo": "ayiork/Label-Free-XAI",
"path": "/src/lfxai/models/images.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SmartRoomCorporation/SmartRoom path: /regression/TempHumModule/tester.py
from RoomConditioning import RoomConditioning
r = RoomConditioning()
# start simulation
r.room.addPerson()
for i in range(180):
r.tempmodGen() #temp
r.tempcondGen() #tempcond
r.computeTempcalc() #tempcalc
r... | code_fim | hard | {
"lang": "python",
"repo": "SmartRoomCorporation/SmartRoom",
"path": "/regression/TempHumModule/tester.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(r.room.people)
print(r.activateReading())
print(r.sys.fan)
#r.room.addPerson()
#r.room.addPerson()
#r.sys.fan = 100
for i in range(180):
r.tempmodGen()
r.tempcondGen()
r.computeTempcalc()
r.hummodGen()
r.humcondGen()
r.computeHumcalc()
r.activateReading()
print(r.room.p... | code_fim | hard | {
"lang": "python",
"repo": "SmartRoomCorporation/SmartRoom",
"path": "/regression/TempHumModule/tester.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(180):
r.tempmodGen()
r.tempcondGen()
r.computeTempcalc()
r.hummodGen()
r.humcondGen()
r.computeHumcalc()
r.activateReading()
print(r.room.people)
print(r.activateReading())
print(r.sys.fan)
#r.room.addPerson()
#r.room.addPerson()
#r.sys.fan = 75
for i in range(... | code_fim | medium | {
"lang": "python",
"repo": "SmartRoomCorporation/SmartRoom",
"path": "/regression/TempHumModule/tester.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>DEBUG = True
HOME_DIR = None
__optlist, __args = getopt(argv[1:], 'd:')
for __o, __v in __optlist:
if __o == '-d':
HOME_DIR = abspath(__v)
break
try:
from win32com.shell import shellcon, shell
USER_DIR = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
except ImportErro... | code_fim | medium | {
"lang": "python",
"repo": "seifert/igcweight",
"path": "/igcweight/settings.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seifert/igcweight path: /igcweight/settings.py
"""
Settings of igcweight
"""
from os import mkdir
from os.path import abspath, dirname, join, expanduser, isdir
from sys import argv
from getopt import getopt
from igcweight.configuration import Configuration
<|fim_suffix|>if VERSION_GIT:
VER... | code_fim | medium | {
"lang": "python",
"repo": "seifert/igcweight",
"path": "/igcweight/settings.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DL-Thompson/InventoryShop path: /database/models.py
from flask.ext.login import UserMixin
from datetime import datetime
class User(UserMixin):
def __init__(self, doc):
self.id = doc['_id']
self.password = doc['password']
self.district = doc['district']
order_h... | code_fim | hard | {
"lang": "python",
"repo": "DL-Thompson/InventoryShop",
"path": "/database/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "(Id: " + str(self.id) + " Name: " + str(self.name) + " Quantity: " + str(self.quantity) + " Warehouse: " + str(self.warehouse) + " Price: " + str(self.price) + " Type: " + str(self.type) + ")"
def __str__(self):
return "(Id: " + str(self.id) + " Name: " + str(self.name) + " Qua... | code_fim | hard | {
"lang": "python",
"repo": "DL-Thompson/InventoryShop",
"path": "/database/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devcamcar/heat path: /heat/tests/examples/test3.py
###
### the standard unittest-derived test
## http://darcs.idyll.org/~t/projects/nose-demo/simple/tests/test_stuff.py.html
###
import sys
import nose
import unittest
from nose.plugins.attrib import attr
# sets attribute on all test methods
<|... | code_fim | medium | {
"lang": "python",
"repo": "devcamcar/heat",
"path": "/heat/tests/examples/test3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
sys.argv.append(__file__)
nose.main()<|fim_prefix|># repo: devcamcar/heat path: /heat/tests/examples/test3.py
###
### the standard unittest-derived test
## http://darcs.idyll.org/~t/projects/nose-demo/simple/tests/test_stuff.py.html
###
import sys
import nose
import u... | code_fim | medium | {
"lang": "python",
"repo": "devcamcar/heat",
"path": "/heat/tests/examples/test3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bitmovin/bitmovin-python path: /bitmovin/services/encodings/progressive_mov_muxing_service.py
from bitmovin.resources.models import ProgressiveMOVMuxing as ProgressiveMOVMuxingResource
from .generic_muxing_service import GenericMuxingService
<|fim_suffix|> super().__init__(http_client=ht... | code_fim | medium | {
"lang": "python",
"repo": "bitmovin/bitmovin-python",
"path": "/bitmovin/services/encodings/progressive_mov_muxing_service.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, http_client):
super().__init__(http_client=http_client, type_url='progressive-mov',
resource_class=ProgressiveMOVMuxingResource)<|fim_prefix|># repo: bitmovin/bitmovin-python path: /bitmovin/services/encodings/progressive_mov_muxing_service.py
from... | code_fim | easy | {
"lang": "python",
"repo": "bitmovin/bitmovin-python",
"path": "/bitmovin/services/encodings/progressive_mov_muxing_service.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>UTH_TOKEN'
OAUTH_TOKEN_SECRET = 'your OAUTH_TOKEN_SECRET'
ROUTE = 'your ROUTE'<|fim_prefix|># repo: carlosalbertm/tweet-bot path: /settings.py
APP_KEY = 'your APP_KEY'
APP_SECRET = '<|fim_middle|>your APP_SECRET'
OAUTH_TOKEN = 'your OA | code_fim | easy | {
"lang": "python",
"repo": "carlosalbertm/tweet-bot",
"path": "/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlosalbertm/tweet-bot path: /settings.py
APP_KEY = 'your APP_KEY'
APP_SECRET = '<|fim_suffix|>AUTH_TOKEN_SECRET'
ROUTE = 'your ROUTE'<|fim_middle|>your APP_SECRET'
OAUTH_TOKEN = 'your OAUTH_TOKEN'
OAUTH_TOKEN_SECRET = 'your O | code_fim | medium | {
"lang": "python",
"repo": "carlosalbertm/tweet-bot",
"path": "/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pull:
run('tx pull -a')
run('cd localflavor; django-admin.py makemessages -a; django-admin.py compilemessages; cd ..')
@task
def docs():
run('cd docs; make html; cd ..')<|fim_prefix|># repo: pjrobertson/django-localflavor path: /tasks.py
import os
from invoke import run, task
@... | code_fim | medium | {
"lang": "python",
"repo": "pjrobertson/django-localflavor",
"path": "/tasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pjrobertson/django-localflavor path: /tasks.py
import os
from invoke import run, task
@task
def clean():
run('git clean -Xfd')
@task
def install():
run('pip install --requirement=tests/requirements.txt')
<|fim_suffix|>
@task
def translations(pull=False):
if pull:
run('tx ... | code_fim | hard | {
"lang": "python",
"repo": "pjrobertson/django-localflavor",
"path": "/tasks.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if lang == 'all':
run('{0} localflavor'.format(flake_cmd))
run('{0} tests'.format(test_cmd))
run('coverage report')
elif lang not in os.listdir('localflavor'):
print('This language {0!r} is not supported yet.'.format(lang))
else:
run('{0} localflavor/{1}... | code_fim | medium | {
"lang": "python",
"repo": "pjrobertson/django-localflavor",
"path": "/tasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gerald-Much/indaba path: /indaba/talks/urls.py
from django.conf.urls import url, include
from indaba.talks.view<|fim_suffix|>^(?P<pk>\d+)/$', TalkView.as_view(), name='pyladies_talk'),
]<|fim_middle|>s import (CreateTalk, TalkView, )
urlpatterns = [
url(r'^submit_talk', CreateTalk.as_vi... | code_fim | medium | {
"lang": "python",
"repo": "Gerald-Much/indaba",
"path": "/indaba/talks/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>^(?P<pk>\d+)/$', TalkView.as_view(), name='pyladies_talk'),
]<|fim_prefix|># repo: Gerald-Much/indaba path: /indaba/talks/urls.py
from django.conf.urls import url, include
from indaba.talks.view<|fim_middle|>s import (CreateTalk, TalkView, )
urlpatterns = [
url(r'^submit_talk', CreateTalk.as_vi... | code_fim | medium | {
"lang": "python",
"repo": "Gerald-Much/indaba",
"path": "/indaba/talks/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def train(self):
"""Train the classifier
"""
return self.classifier.fit(self.training_set_vector, self.training_labels)
def test(self, dataset = None, debug = True, labels = None):
"""Test the classifier with some data
Keyword Arguments:
dataset {List} -- Dataset (default: {None})
... | code_fim | hard | {
"lang": "python",
"repo": "phenax/mr-senti",
"path": "/libs/MrSenti.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phenax/mr-senti path: /libs/MrSenti.py
import os
import math
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.metrics import classification_report
from sklearn.externals import joblib
# MrSenti class
class MrSenti:
"""A wrapper class for senti... | code_fim | hard | {
"lang": "python",
"repo": "phenax/mr-senti",
"path": "/libs/MrSenti.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return u'%d - %s'%(self.id, self.pttitulo_201)
class pttecnology(models.Model):
pttitulo_301 = models.CharField(blank=True, max_length=50)
pttext_secundario301 = models.TextField(blank=True, max_length=1000)
ptboton_301 = models.CharField(blank=True, max_length=30)
ptfondo1 = models.ImageFie... | code_fim | hard | {
"lang": "python",
"repo": "josech01/emusa",
"path": "/emusa12/emballages_pt/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: josech01/emusa path: /emusa12/emballages_pt/models.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
# Create your models here.
LANGUAGES_CHOICES = (
('es', 'Español'),
('en', 'English'... | code_fim | hard | {
"lang": "python",
"repo": "josech01/emusa",
"path": "/emusa12/emballages_pt/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def suicideMessage(self,match):
try:
# Lookup the bot who died
targ = self.clients[match.group(1)]
targ.stats.suicides = targ.stats.suicides + 1
return "%s died." % targ.name
except:
self.logf.warning('Unknown suicide: %s', match.group(1))
def fragMessage(self,match):
tr... | code_fim | hard | {
"lang": "python",
"repo": "kidmeier/q2-gpbot-client",
"path": "/quake2.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kidmeier/q2-gpbot-client path: /quake2.py
import logging
import os
import subprocess
import sys
import re
import threading
import time
from Queue import Queue
QCONSOLE_POLL_INTERVAL = 0.5
class DmFlags(object):
NO_HEALTH = 1
NO_POWERUPS = 2
WEAPONS_STAY = 4
NO_FALL_DAMAGE = 8
INSTANT_POWE... | code_fim | hard | {
"lang": "python",
"repo": "kidmeier/q2-gpbot-client",
"path": "/quake2.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahi97/XQMIX path: /src/utils/noisy_linear.py
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class NoisyLinear(nn.Module):
r"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b`
This module supports :ref:`TensorFloat32<tf32_on_am... | code_fim | hard | {
"lang": "python",
"repo": "mahi97/XQMIX",
"path": "/src/utils/noisy_linear.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, input: torch.Tensor) -> torch.Tensor:
e_w = torch.randn(self.s_w.shape, device=self.device)
e_b = torch.randn(self.s_b.shape, device=self.device)
weight = self.u_w + (self.s_w * e_w)
bias = self.u_b + (self.s_b * e_b)
return F.linear(input, wei... | code_fim | hard | {
"lang": "python",
"repo": "mahi97/XQMIX",
"path": "/src/utils/noisy_linear.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @test.docker_required
def test_create_node(self):
h = Headers()
h.add('Authorization', self.valid_test_token)
rv = self.client.post(self.node_resource_path, headers=h)
assert 'error' not in rv.data
assert 'Id' in rv.data
assert 'name' in rv.data
... | code_fim | hard | {
"lang": "python",
"repo": "hivetech/hivy",
"path": "/tests/test_node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hivetech/hivy path: /tests/test_node.py
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright (C) 2014 Hive Tech, SAS.
import time
import os
import unittest
from flask.ext.testing import TestCase
from werkzeug.datastructures import Headers
from werkzeug.test import Client
from hivy.core impor... | code_fim | hard | {
"lang": "python",
"repo": "hivetech/hivy",
"path": "/tests/test_node.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.