text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: cms-sw/cmssw path: /DPGAnalysis/Skims/python/ecalSkim_cfi.py
import FWCore.ParameterSet.Config as cms
skimming = cms.EDFilter("EcalSkim",
#cosmic cluster en<|fim_suffix|>uble(2.0),
endcapClusterCollection = cms.InputTag("cosmicSuperClusters","CosmicEndcapSuperClusters"),
barrelCluste... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DPGAnalysis/Skims/python/ecalSkim_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>uble(2.0),
endcapClusterCollection = cms.InputTag("cosmicSuperClusters","CosmicEndcapSuperClusters"),
barrelClusterCollection = cms.InputTag("cosmicSuperClusters","CosmicBarrelSuperClusters")
)<|fim_prefix|># repo: cms-sw/cmssw path: /DPGAnalysis/Skims/python/ecalSkim_cfi.py
import FWCore.Paramet... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DPGAnalysis/Skims/python/ecalSkim_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
# Initialise subparser
parser_solve = subparsers.add_parser(
'solve',
help='solve the model')
# Add 'verbose' argument
parser_solve.add_argument(
'-v', '--verbose',
action='store_true',
help='print detailed solution output (not yet implemente... | code_fim | hard | {
"lang": "python",
"repo": "ChrisThoung/fsic-archive",
"path": "/FSIC/cli/parsers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChrisThoung/fsic-archive path: /FSIC/cli/parsers.py
# -*- coding: utf-8 -*-
"""
parsers
=======
FSIC `argparse` ArgumentParsers for command-line operations.
"""
def add_subparser_solve(subparsers):
"""Add a 'solve' option to `subparsers`.
Parameters
==========
subparsers : arg... | code_fim | hard | {
"lang": "python",
"repo": "ChrisThoung/fsic-archive",
"path": "/FSIC/cli/parsers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mklanac/EPEdashboard path: /main.py
# This Python file uses the following encoding: utf-8
import sys
import os
import datetime
import time
from random import randrange
from pySinamics import sinamics
from pySinamics.sinamics_graph import graph
from PySide2.QtWidgets import QApplication
from PyS... | code_fim | hard | {
"lang": "python",
"repo": "mklanac/EPEdashboard",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.setName.emit("Welcome, " + name)
# Set drive IP address
@Slot(str)
def setDriveIP(self, driveIP):
self.driveIP = driveIP
# Connect to drive
@Slot()
def connectToDrive(self):
self.g120.connect(self.driveIP) # drive IP
print("Connected to g120--... | code_fim | hard | {
"lang": "python",
"repo": "mklanac/EPEdashboard",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> access_token, user_id = flow.finish(code) # Creates an access token
client = dropbox.client.DropboxClient(access_token)
print 'linked account: ', client.account_info()
folder_metadata = client.metadata('/')
print "metadata:", folder_metadata
f = open(file_name, 'rb')
response = client.put_file('/... | code_fim | hard | {
"lang": "python",
"repo": "Daniel6/softdes2015finalproject",
"path": "/lib/dropbox-python-sdk-2.2.0/upload.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open(file_name, 'rb')
response = client.put_file('/UploadX/' + file_name, f)
print "uploaded:", response
if __name__ == "__main__":
upload('test.jpg')<|fim_prefix|># repo: Daniel6/softdes2015finalproject path: /lib/dropbox-python-sdk-2.2.0/upload.py
# Include the Dropbox SDK
import dropbox
# Ge... | code_fim | hard | {
"lang": "python",
"repo": "Daniel6/softdes2015finalproject",
"path": "/lib/dropbox-python-sdk-2.2.0/upload.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Daniel6/softdes2015finalproject path: /lib/dropbox-python-sdk-2.2.0/upload.py
# Include the Dropbox SDK
import dropbox
# Get your app key and secret from the Dropbox developer website
app_key = 'q68gcs8kg63lq3y'
app_secret = 'wuus2lvqb0xnot4'
<|fim_suffix|> flow = dropbox.client.DropboxOAuth2F... | code_fim | medium | {
"lang": "python",
"repo": "Daniel6/softdes2015finalproject",
"path": "/lib/dropbox-python-sdk-2.2.0/upload.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> size = 1
if "size" in game_inputs_item["inputs"]:
size = game_inputs_item["inputs"]["size"]
if size == 1:
input_value = random.uniform(
game_inputs_item["inputs"]["minimum"],
... | code_fim | hard | {
"lang": "python",
"repo": "DylanSpicker/SerpentAI",
"path": "/serpent/machine_learning/reinforcement_learning/agents/random_agent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DylanSpicker/SerpentAI path: /serpent/machine_learning/reinforcement_learning/agents/random_agent.py
from serpent.machine_learning.reinforcement_learning.agent import Agent
from serpent.enums import InputControlTypes
import random
import enum
class RandomAgentModes(enum.Enum):
OBSERVE = 0... | code_fim | hard | {
"lang": "python",
"repo": "DylanSpicker/SerpentAI",
"path": "/serpent/machine_learning/reinforcement_learning/agents/random_agent.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: globus/globus-toolkit path: /usage/python/tools/source/globus/usage/cusagepacket.py
# Copyright 1999-2009 University of Chicago
#
# 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 Li... | code_fim | hard | {
"lang": "python",
"repo": "globus/globus-toolkit",
"path": "/usage/python/tools/source/globus/usage/cusagepacket.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> UsagePacket.__init__(self, address, packet)
self.data = {}
# Old version of the C usage code would call htons() twice on
# the component code and packet version fields, but not the other
# binary fields in the packet, so we force it to be network byte order
... | code_fim | hard | {
"lang": "python",
"repo": "globus/globus-toolkit",
"path": "/usage/python/tools/source/globus/usage/cusagepacket.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """C-Style (name=value) Usage Packet
This packet class extends the usagepacket class to include a parser
for NAME=VALUE and NAME="QUOTED VALUE" strings. It does not provide any
class-specific database upload function.
"""
_parse_re = re.compile(
" *([^ =\\\\\\\"\r... | code_fim | medium | {
"lang": "python",
"repo": "globus/globus-toolkit",
"path": "/usage/python/tools/source/globus/usage/cusagepacket.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_ivectors = combine_ivector(ivectors)
X = np.concatenate((n_ivectors, X_sample))
y = np.concatenate(([True]*len(n_ivectors), [False]*len(X_sample)))
pipe_svm.fit(X, y)
LOG.info('{} clf test score: {}'.format(user.name, pipe_svm.score(X, y)))
user.clf = B... | code_fim | hard | {
"lang": "python",
"repo": "BRASLab/VAWSR_backend",
"path": "/app/modules/svm/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BRASLab/VAWSR_backend path: /app/modules/svm/__init__.py
import logging
from app.modules.db.mongo import Users
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from bson.binary import Binary
import numpy as np
import pickle
LOG =... | code_fim | medium | {
"lang": "python",
"repo": "BRASLab/VAWSR_backend",
"path": "/app/modules/svm/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitscay/flight_tables path: /tests/test_heathrow_parsing.py
from datetime import datetime, timedelta
import json
import unittest
from flight_tables.heathrow_parsing import extract_batch_heathrow, extract_flight_heathrow, fetch_heathrow_data
class SampleData(object):
def __init__(self):... | code_fim | hard | {
"lang": "python",
"repo": "mitscay/flight_tables",
"path": "/tests/test_heathrow_parsing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.mock_response = SampleData().mock_response
self.expected_parsed_flights = SampleData().mock_parsed_flights
def test_batch_extractor(self):
self.parsed_flights = extract_batch_heathrow(self.mock_response)
self.assertIsInstance(self.parsed_flights, list)
se... | code_fim | hard | {
"lang": "python",
"repo": "mitscay/flight_tables",
"path": "/tests/test_heathrow_parsing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_user_input_fn():
user_input_fn(tf.FIFOQueue(64, [tf.string]))<|fim_prefix|># repo: TITAN-PyCompat/tensorflow-qnd path: /qnd/test_test.py
import tensorflow as tf
<|fim_middle|>from .test import *
def test_oracle_model():
oracle_model(tf.zeros([100]), tf.zeros([100]))
| code_fim | medium | {
"lang": "python",
"repo": "TITAN-PyCompat/tensorflow-qnd",
"path": "/qnd/test_test.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> user_input_fn(tf.FIFOQueue(64, [tf.string]))<|fim_prefix|># repo: TITAN-PyCompat/tensorflow-qnd path: /qnd/test_test.py
import tensorflow as tf
from .test import *
<|fim_middle|>
def test_oracle_model():
oracle_model(tf.zeros([100]), tf.zeros([100]))
def test_user_input_fn():
| code_fim | medium | {
"lang": "python",
"repo": "TITAN-PyCompat/tensorflow-qnd",
"path": "/qnd/test_test.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TITAN-PyCompat/tensorflow-qnd path: /qnd/test_test.py
import tensorflow as tf
<|fim_suffix|>def test_oracle_model():
oracle_model(tf.zeros([100]), tf.zeros([100]))
def test_user_input_fn():
user_input_fn(tf.FIFOQueue(64, [tf.string]))<|fim_middle|>from .test import *
| code_fim | easy | {
"lang": "python",
"repo": "TITAN-PyCompat/tensorflow-qnd",
"path": "/qnd/test_test.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Start ocropus over a cli
:param file: fileinputpath
:param fop: fileoutputpath
:param profile: contains user-specific parameters/option for ocropy
:return:
"""
print("Starting ocropy for:" + file.split('/')[-1])
fname = file.split('/')[-1].split('.')[0]
create_... | code_fim | hard | {
"lang": "python",
"repo": "UB-Mannheim/ocromore",
"path": "/test_code/test_ocropy_check.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fname = file.split('/')[-1].split('.')[0]
create_dir(path_out)
subprocess.Popen(args=["ocropus-nlbin", file, "-o"+path_out+fname+"/"]).wait()
subprocess.Popen(args=["ocropus-gpageseg", path_out+fname+"/????.bin.png"]).wait()
subprocess.Popen(args=["ocropus-rpred", "-Q 4", path_out+fnam... | code_fim | hard | {
"lang": "python",
"repo": "UB-Mannheim/ocromore",
"path": "/test_code/test_ocropy_check.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UB-Mannheim/ocromore path: /test_code/test_ocropy_check.py
"""
Basically this is stuff from akf-mocrin to test ocropy
"""
import os
import subprocess
IMAGE_PATH = '/media/sf_firmprofiles/many_years_firmprofiles/short/oneprof'
FILENAME = 'oneprof.jpg'
filepath = os.path.join(IMAGE_PATH, FILENAM... | code_fim | hard | {
"lang": "python",
"repo": "UB-Mannheim/ocromore",
"path": "/test_code/test_ocropy_check.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lzpdzlzpdz/lzpdzlzpdzPython path: /91_Python_Tornado_F2E/F2E.im-master/handler/mytools.py
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2012 F2E.im
# Do have a faith in what you're doing.
# Make your life a story worth telling.
import uuid
import hashlib
from PIL import Image
import StringI... | code_fim | hard | {
"lang": "python",
"repo": "lzpdzlzpdz/lzpdzlzpdzPython",
"path": "/91_Python_Tornado_F2E/F2E.im-master/handler/mytools.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.simpleblogdb.execute(
"INSERT INTO entries (author_id,title,slug,markdown,html,"
"published) VALUES (%s,%s,%s,%s,%s,UTC_TIMESTAMP())",
self.current_user["uid"], title, slug, text, html)
#self.redirect("mytools/simpleblog/bloglistview.html" + slug)
... | code_fim | hard | {
"lang": "python",
"repo": "lzpdzlzpdz/lzpdzlzpdzPython",
"path": "/91_Python_Tornado_F2E/F2E.im-master/handler/mytools.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShredEagle/shmurp path: /conan/conanfile.py
from conans import ConanFile, CMake, tools
class ShpongConan(ConanFile):
<|fim_suffix|> requires = (
("glad/0.1.29@bincrafters/stable"),
#Aunteater
#Graphics
#Math
)
default_options = {
"shared": Fal... | code_fim | hard | {
"lang": "python",
"repo": "ShredEagle/shmurp",
"path": "/conan/conanfile.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> requires = (
("glad/0.1.29@bincrafters/stable"),
#Aunteater
#Graphics
#Math
)
default_options = {
"shared": False,
}<|fim_prefix|># repo: ShredEagle/shmurp path: /conan/conanfile.py
from conans import ConanFile, CMake, tools
class ShpongConan(Con... | code_fim | hard | {
"lang": "python",
"repo": "ShredEagle/shmurp",
"path": "/conan/conanfile.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spanner28/django-cruds-adminlte path: /cruds_adminlte/widgets.py
from django.forms.utils import flatatt
from django.forms.widgets import Widget, Textarea
from django.template import loader
from django.utils.safestring import mark_safe
from django.conf import settings
class ImageWidget(Widget):
... | code_fim | hard | {
"lang": "python",
"repo": "spanner28/django-cruds-adminlte",
"path": "/cruds_adminlte/widgets.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def render(self, name, value, attrs=None, renderer=None):
context = self.get_context(name, value, attrs)
return mark_safe(loader.render_to_string(self.template_name, context))
def list_model(self, model, ids = []):
manager = getattr(model, 'objects')
return manager... | code_fim | hard | {
"lang": "python",
"repo": "spanner28/django-cruds-adminlte",
"path": "/cruds_adminlte/widgets.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> import cv2
from PIL import Image
x = cv2.cvtColor(x, cv2.COLOR_BGR2RGB)
x = Image.fromarray(x)
return x
# def cv2_transfer_size(src, dest):
# import cv2
# cv2.resize
def cv2_same_size(a,b):
import cv2
maxH = max(a.shape[0], b.shape[0])
maxW = max(a.shape[1], b.sha... | code_fim | medium | {
"lang": "python",
"repo": "Lxrd-AJ/multiresolution-image-blending",
"path": "/helper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lxrd-AJ/multiresolution-image-blending path: /helper.py
def hello() -> str:
return "world"
def half(x):
return (i//2 for i in x)
def cv2pil(x):
import cv2
from PIL import Image
x = cv2.cvtColor(x, cv2.COLOR_BGR2RGB)
x = Image.fromarray(x)
return x
<|fim_suffix|> ... | code_fim | medium | {
"lang": "python",
"repo": "Lxrd-AJ/multiresolution-image-blending",
"path": "/helper.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhou8827/DualGCN-ABSA path: /DualGCN/models/semgcn.py
'''
Description:
version:
Author: chenhao
Date: 2021-06-09 14:17:37
'''
import copy
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class SemGCNClassifie... | code_fim | hard | {
"lang": "python",
"repo": "zhou8827/DualGCN-ABSA",
"path": "/DualGCN/models/semgcn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return nn.ModuleList([copy.deepcopy(module) for _ in range(N)])
class MultiHeadAttention(nn.Module):
def __init__(self, h, d_model, dropout=0.1):
super(MultiHeadAttention, self).__init__()
assert d_model % h == 0
self.d_k = d_model // h
self.h = h
self.l... | code_fim | hard | {
"lang": "python",
"repo": "zhou8827/DualGCN-ABSA",
"path": "/DualGCN/models/semgcn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> p_attn = F.softmax(scores, dim=-1)
if dropout is not None:
p_attn = dropout(p_attn)
return p_attn
def clones(module, N):
return nn.ModuleList([copy.deepcopy(module) for _ in range(N)])
class MultiHeadAttention(nn.Module):
def __init__(self, h, d_model, dropout=0.1):
... | code_fim | hard | {
"lang": "python",
"repo": "zhou8827/DualGCN-ABSA",
"path": "/DualGCN/models/semgcn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jennwuu/swmmio path: /swmmio/tests/test_dataframes.py
from io import StringIO
from swmmio.elements import Links
from swmmio.tests.data import (MODEL_FULL_FEATURES_PATH, MODEL_FULL_FEATURES__NET_PATH,
BUILD_INSTR_01, MODEL_XSECTION_ALT_01, df_test_coordinates_csv,
... | code_fim | hard | {
"lang": "python",
"repo": "jennwuu/swmmio",
"path": "/swmmio/tests/test_dataframes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_subcatchments_dataframe_from_rpt(test_model_02):
sub_ro_summary = dataframe_from_rpt(test_model_02.rpt.path, 'Subcatchment Runoff Summary')
tot_ro = sub_ro_summary['TotalRunoffMG'].sum()
assert tot_ro == pytest.approx(0.28, 0.001)
# test retrieving timeseries results
s1_res... | code_fim | hard | {
"lang": "python",
"repo": "jennwuu/swmmio",
"path": "/swmmio/tests/test_dataframes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> animation = gltf.data.animations[anim_idx]
vnode = gltf.vnodes[node_idx]
path = channel.target.path
import_user_extensions('gather_import_animation_channel_before_hook', gltf, animation, vnode, path, channel)
action = BlenderNodeAnim.get_or_create_action(gltf, nod... | code_fim | hard | {
"lang": "python",
"repo": "sketchfab/blender-plugin",
"path": "/addons/io_sketchfab_plugin/blender/imp/gltf2_blender_animation_node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sketchfab/blender-plugin path: /addons/io_sketchfab_plugin/blender/imp/gltf2_blender_animation_node.py
# Copyright 2018-2021 The glTF-Blender-IO authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | code_fim | hard | {
"lang": "python",
"repo": "sketchfab/blender-plugin",
"path": "/addons/io_sketchfab_plugin/blender/imp/gltf2_blender_animation_node.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ["UdsSegmentationError", "UdsSequenceError",
"TransportInterfaceClient", "TransportInterfaceServer"]
from .common import UdsSegmentationError
from .client import TransportInterfaceClient, UdsSequenceError
from .server import TransportInterfaceServer<|fim_prefix|># repo: Hajerhr/uds ... | code_fim | medium | {
"lang": "python",
"repo": "Hajerhr/uds",
"path": "/uds/transport_interface/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hajerhr/uds path: /uds/transport_interface/__init__.py
"""
Abstract definition for Transport Interfaces.
Transport Interfaces are meant to handle following UDS protocol layers (according to OSI model):
- Transport (4th)
- Network (3rd)
- Data (2nd)
- Physical (1st)
<|fim_suffix|>__all__ = [... | code_fim | medium | {
"lang": "python",
"repo": "Hajerhr/uds",
"path": "/uds/transport_interface/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while(i >= 0):
if first_name[:i] in self.chinese_name_lib:
if i == len(first_name):
first_word = first_name[:i]
break
elif first_name[i:] in self.chinese_name_lib:
first_word = first_name[:i]
second... | code_fim | hard | {
"lang": "python",
"repo": "drmartinmar/chgender",
"path": "/chgender/chgender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for pinyin in self.freq:
female, male = self.freq[pinyin]
self.freq[pinyin] = (1. * female / self.female_total,
1. * male / self.male_total)
def guess(self, name):
name = name.lower()
full_name = name.split()
firs... | code_fim | hard | {
"lang": "python",
"repo": "drmartinmar/chgender",
"path": "/chgender/chgender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drmartinmar/chgender path: /chgender/chgender.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
__all__ = ['guess']
class Guesser(object):
def __init__(self):
self._build_lib()
self._build_model()
def _build_lib(self):
with open(os.path.join(os.path.dirna... | code_fim | hard | {
"lang": "python",
"repo": "drmartinmar/chgender",
"path": "/chgender/chgender.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
args = parser.parse_args()
agent = Agent(args.env_name, args.batch_size, args.gamma, args.lr, target_update=1000, initial_memory=1000, memory_size=10000, dueling=args.dueling)
# train model
if args.do_test:
print('[INFO] Starting testing subroutine. (Def... | code_fim | hard | {
"lang": "python",
"repo": "lujiarui/dqn-atari",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lujiarui/dqn-atari path: /main.py
"""Reinforment learning DQN and Dueling DQN
CS489 project
Author: Lu Jiarui
Date: 2020/06/11
"""
from __future__ import print_function
import torch
import argparse
from agent import Agent
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')... | code_fim | hard | {
"lang": "python",
"repo": "lujiarui/dqn-atari",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ksusha2626/Python_AutoTest_project path: /test/test_add_contact_to_group.py
from model.contact import Contact
from model.group import Group
import random
import pytest
<|fim_suffix|> if len(db.get_contact_list()) == 0:
app.contact.create_new_contact(
Contact(name="111"))
... | code_fim | medium | {
"lang": "python",
"repo": "Ksusha2626/Python_AutoTest_project",
"path": "/test/test_add_contact_to_group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(db.get_contact_list()) == 0:
app.contact.create_new_contact(
Contact(name="111"))
if len(db.get_group_list()) == 0:
app.group.create(Group(name="123", header="456", footer="789"))
with pytest.allure.step('Сравниваем список контактов'):
contact_list = ... | code_fim | medium | {
"lang": "python",
"repo": "Ksusha2626/Python_AutoTest_project",
"path": "/test/test_add_contact_to_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: signalwire/signalwire-python path: /examples/relay/raw_client.py
import asyncio
import os
from signalwire.relay.client import Client
async def inbound_call(call):
result = await call.answer()
if result.successful:
print('Inbound call answered successful')
await asyncio.sleep(5)
h... | code_fim | medium | {
"lang": "python",
"repo": "signalwire/signalwire-python",
"path": "/examples/relay/raw_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
project = os.getenv('PROJECT', '')
token = os.getenv('TOKEN', '')
client = Client(project=project, token=token)
client.on('ready', ready)
client.on('signalwire.socket.open', socket_open)
client.on('signalwire.socket.error', socket_error)
client.on('signalwire.socket.message', soc... | code_fim | medium | {
"lang": "python",
"repo": "signalwire/signalwire-python",
"path": "/examples/relay/raw_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "\t".join(item for item in
[self.get_fsname(), self.get_dirname(), self.get_typename(),
self._str_options(), self.get_freq(), self.get_passno()])<|fim_prefix|># repo: Infinidat/infi.mount_utils path: /src/infi/mount_utils/base/mount/entry.p... | code_fim | hard | {
"lang": "python",
"repo": "Infinidat/infi.mount_utils",
"path": "/src/infi/mount_utils/base/mount/entry.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """:returns: mount options"""
return self._bunch.opts
def get_freq(self):
""":returns: dump frequency in days"""
return self._bunch.freq
def get_passno(self):
""":returns: pass number on parallel fsck"""
return self._bunch.passno
def _str_opti... | code_fim | hard | {
"lang": "python",
"repo": "Infinidat/infi.mount_utils",
"path": "/src/infi/mount_utils/base/mount/entry.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Infinidat/infi.mount_utils path: /src/infi/mount_utils/base/mount/entry.py
from munch import Munch
class MountEntry(object):
DIRNAME_REPLACE_COUPLES = (
(r"\040", " "), # HIP-688 spaces appear different in mtab
(r"\134", "\\"), # HPT-1905
)
@classmethod
de... | code_fim | hard | {
"lang": "python",
"repo": "Infinidat/infi.mount_utils",
"path": "/src/infi/mount_utils/base/mount/entry.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amureki/lunch-with-channels path: /votes/tests/test_models.py
import pytest
from votes.models import Vote
<|fim_suffix|> assert not Vote.objects.exists()
Vote.update(place.id, username)
assert Vote.objects.exists()<|fim_middle|>
@pytest.mark.django_db
class TestVote:
... | code_fim | medium | {
"lang": "python",
"repo": "amureki/lunch-with-channels",
"path": "/votes/tests/test_models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_update(self, place, username):
assert not Vote.objects.exists()
Vote.update(place.id, username)
assert Vote.objects.exists()<|fim_prefix|># repo: amureki/lunch-with-channels path: /votes/tests/test_models.py
import pytest
from votes.models import Vote
<|fim_middle|... | code_fim | easy | {
"lang": "python",
"repo": "amureki/lunch-with-channels",
"path": "/votes/tests/test_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert not Vote.objects.exists()
Vote.update(place.id, username)
assert Vote.objects.exists()<|fim_prefix|># repo: amureki/lunch-with-channels path: /votes/tests/test_models.py
import pytest
from votes.models import Vote
<|fim_middle|>@pytest.mark.django_db
class TestVote:
... | code_fim | medium | {
"lang": "python",
"repo": "amureki/lunch-with-channels",
"path": "/votes/tests/test_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dhiraj100892/droidlet path: /locobot/agent/dialogue_objects/__init__.py
from .loco_interpreter import LocoInterpreter
from .get_memory_handler import GetMemoryHandler
from .put<|fim_suffix|>GetMemoryHandler, PutMemoryHandler, LocoInterpreter]<|fim_middle|>_memory_handler import PutMemoryHandler
... | code_fim | easy | {
"lang": "python",
"repo": "Dhiraj100892/droidlet",
"path": "/locobot/agent/dialogue_objects/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>GetMemoryHandler, PutMemoryHandler, LocoInterpreter]<|fim_prefix|># repo: Dhiraj100892/droidlet path: /locobot/agent/dialogue_objects/__init__.py
from .loco_interpreter import LocoInterpreter
from .get_memory_handler import GetMemoryHandler
from .put<|fim_middle|>_memory_handler import PutMemoryHandler
... | code_fim | easy | {
"lang": "python",
"repo": "Dhiraj100892/droidlet",
"path": "/locobot/agent/dialogue_objects/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_memory_handler import PutMemoryHandler
__all__ = [GetMemoryHandler, PutMemoryHandler, LocoInterpreter]<|fim_prefix|># repo: Dhiraj100892/droidlet path: /locobot/agent/dialogue_objects/__init__.py
from .loco_interpreter import LocoInterpreter
from .<|fim_middle|>get_memory_handler import GetMemoryHandle... | code_fim | easy | {
"lang": "python",
"repo": "Dhiraj100892/droidlet",
"path": "/locobot/agent/dialogue_objects/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keybase/pykeybasebot path: /examples/4_framework.py
#!/usr/bin/env python3
###################################
# WHAT IS IN THIS EXAMPLE?
#
# This example shows an opinionated chatbot framework built on top
# of pykeybasebot. The aim is to allow the most simple command and
# response behavior wh... | code_fim | hard | {
"lang": "python",
"repo": "keybase/pykeybasebot",
"path": "/examples/4_framework.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_command(self, trigger_func, command_func):
async_command = force_async(command_func)
self._commands.append(
{"trigger_func": trigger_func, "command_func": async_command}
)
def reply(self, event, message):
channel = event.msg.channel.replyable_di... | code_fim | hard | {
"lang": "python",
"repo": "keybase/pykeybasebot",
"path": "/examples/4_framework.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>The expression x + y is translated into x.__add__(y).
However, if x hasn't implemented __add__, and x and y are of different types, then y.__radd__(x) is called.
There are equivalent r methods for all magic methods just mentioned.
R in magic methods means reflected./yansıtılmış, geri dönmüş
'''
class... | code_fim | hard | {
"lang": "python",
"repo": "bayramcicek/language-repo",
"path": "/p032_magicmethods.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bayramcicek/language-repo path: /p032_magicmethods.py
#!/usr/bin/python3.6
# created by cicek on 07.09.2018 09:44
class Vector2D:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Vector2D(self.x + other.x, self.y + other.y)
first = Vector2D(5, 7)
... | code_fim | hard | {
"lang": "python",
"repo": "bayramcicek/language-repo",
"path": "/p032_magicmethods.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'from_to_bus': [],
'chp': []
})<|fim_prefix|># repo: FranziPl/oemof-tabular path: /src/oemof/tabular/examples/datapackages/foreignkeys/scripts/infer.py
from datapackage_utilities import building
building.infer_metadata(package_name='oemof-ta... | code_fim | hard | {
"lang": "python",
"repo": "FranziPl/oemof-tabular",
"path": "/src/oemof/tabular/examples/datapackages/foreignkeys/scripts/infer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FranziPl/oemof-tabular path: /src/oemof/tabular/examples/datapackages/foreignkeys/scripts/infer.py
from datapackage_utilities import building
building.infer_metadata(package_name='oemof-tabul<|fim_suffix|>'bus': ['component'],
'profile': ['component'],
... | code_fim | hard | {
"lang": "python",
"repo": "FranziPl/oemof-tabular",
"path": "/src/oemof/tabular/examples/datapackages/foreignkeys/scripts/infer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jantzen/eugene path: /eugene/src/virtual_sys/lorenz.py
# lorenz.py
""" Simulates a Lorenz system (in terms of Lorenz's X, Y, and Z variables).
"""
import numpy as np
import scipy.integrate
<|fim_suffix|> self._x = float(init_x)
self._y = float(init_y)
self._z = float(in... | code_fim | hard | {
"lang": "python",
"repo": "jantzen/eugene",
"path": "/eugene/src/virtual_sys/lorenz.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> t = np.array([0., elapsed_time])
out = scipy.integrate.odeint(deriv, np.array([self._x, self._y, self._z]), t)
self._x = out[1][0]
self._y = out[1][1]
self._z = out[1][2]<|fim_prefix|># repo: jantzen/eugene path: /eugene/src/virtual_sys/lorenz.py
# lorenz.py
""" S... | code_fim | hard | {
"lang": "python",
"repo": "jantzen/eugene",
"path": "/eugene/src/virtual_sys/lorenz.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_equal(zip([1, 2, 3], ["a", "b", "c", "e"]), [[1, "a"], [2, "b"], [3, "c"]])<|fim_prefix|># repo: slavaGanzin/ramda.py path: /test/test_zip.py
from ramda import *
from ramda.private.asserts import *
<|fim_middle|>
def test_zip():
| code_fim | easy | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/test/test_zip.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slavaGanzin/ramda.py path: /test/test_zip.py
from ramda import *
from ramda.private.asserts import *
<|fim_suffix|> assert_equal(zip([1, 2, 3], ["a", "b", "c", "e"]), [[1, "a"], [2, "b"], [3, "c"]])<|fim_middle|>def test_zip():
| code_fim | easy | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/test/test_zip.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: atharva-naik/boa_web path: /boa_web/_utils.py
def rand_str(N=16, char_set=None):
import string, random
from string import ascii_letters, digits
if char_set is None: char_set = ascii_letters + digits
<|fim_suffix|>def init_dirs(path):
import os
static = os.path.join(path, "sta... | code_fim | hard | {
"lang": "python",
"repo": "atharva-naik/boa_web",
"path": "/boa_web/_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def init_dirs(path):
import os
static = os.path.join(path, "static")
templates = os.path.join(path, "templates")
os.makedirs(static, exist_ok=True)
os.makedirs(templates, exist_ok=True)<|fim_prefix|># repo: atharva-naik/boa_web path: /boa_web/_utils.py
def rand_str(N=16, char_set=None... | code_fim | hard | {
"lang": "python",
"repo": "atharva-naik/boa_web",
"path": "/boa_web/_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def check_versions(cef):
import platform
ver = cef.GetVersion()
print("[hello_world.py] CEF Python {ver}".format(ver=ver["version"]))
print("[hello_world.py] Chromium {ver}".format(ver=ver["chrome_version"]))
print("[hello_world.py] CEF {ver}".format(ver=ver["cef_version"]))
print(... | code_fim | medium | {
"lang": "python",
"repo": "atharva-naik/boa_web",
"path": "/boa_web/_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.title("Transfer Speed Evaluation")
plt.xlabel("Number of peers holding files")
plt.ylabel("Total Respond time(sec)")
plt.savefig("eval.png")
plt.show()<|fim_prefix|># repo: lancewl/python-parallel-P2P path: /out/plot.py
import matplotlib.pyplot as plt
import pandas as pd
<|fim_middle|>eval_all = pd... | code_fim | medium | {
"lang": "python",
"repo": "lancewl/python-parallel-P2P",
"path": "/out/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lancewl/python-parallel-P2P path: /out/plot.py
import matplotlib.pyplot as plt
import pandas as pd
<|fim_suffix|>plt.title("Transfer Speed Evaluation")
plt.xlabel("Number of peers holding files")
plt.ylabel("Total Respond time(sec)")
plt.savefig("eval.png")
plt.show()<|fim_middle|>eval_all = pd... | code_fim | medium | {
"lang": "python",
"repo": "lancewl/python-parallel-P2P",
"path": "/out/plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Django authentication views
url(r'^login$', django_login, name="login"),
url(r'^logout$', django_logout, name="logout"),
# Custom register view
url(r'^register$', views.register, name="register"),
]<|fim_prefix|># repo: Frky/moon path: /website/urls.py
from django.conf.urls import u... | code_fim | hard | {
"lang": "python",
"repo": "Frky/moon",
"path": "/website/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Frky/moon path: /website/urls.py
from django.conf.urls import url, include
from django.contrib.auth.views import login as django_login
from django.contrib.auth.views import logout as django_logout
from . import views
<|fim_suffix|> # Django authentication views
url(r'^login$', django_lo... | code_fim | medium | {
"lang": "python",
"repo": "Frky/moon",
"path": "/website/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BlitzModder/dava.engine path: /RepoTools/Scripts/create_version_h.py
import os
import sys
import string
import argparse
import pack_app
def main():
parser = argparse.ArgumentParser()
parser.add_argument( '--dava_path', required = True )
parser.add_argument( '--build_numb... | code_fim | hard | {
"lang": "python",
"repo": "BlitzModder/dava.engine",
"path": "/RepoTools/Scripts/create_version_h.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>##
myFile = open( pathFileVersion, 'w')
myFile.write( defineString )
myFile.close()
if __name__ == '__main__':
main()<|fim_prefix|># repo: BlitzModder/dava.engine path: /RepoTools/Scripts/create_version_h.py
import os
import sys
import string
import argparse
import pack_app... | code_fim | hard | {
"lang": "python",
"repo": "BlitzModder/dava.engine",
"path": "/RepoTools/Scripts/create_version_h.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jorjasso/fuzzy-kernel-machines path: /kernelfuzzy/fuzzyset.py
"""
Class FuzzySet
"""
class FuzzySet:
_elements = None # Elements of the fuzzy set
_elements_type = None # Type of elements
_membership_function = None # Membership function
_membership_degr... | code_fim | hard | {
"lang": "python",
"repo": "jorjasso/fuzzy-kernel-machines",
"path": "/kernelfuzzy/fuzzyset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Print in the stdout the all the contents of the class, for debugging
"""
print('\n')
print("Fuzzy set: {}".format(self.get_pair()))
print('\n')
print('Properties:')
print("(_elements) \n", self._elements, "\n")
print("(... | code_fim | hard | {
"lang": "python",
"repo": "jorjasso/fuzzy-kernel-machines",
"path": "/kernelfuzzy/fuzzyset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def pre_run_normalizer(self):
pass
def run_normalizer(self, timestamp):
"""
:return: raw_devices
"""
try:
log_content = IscDhcpLeases(self.logfile)
current_devices = log_content.get_current()
if len(current_devices) > ... | code_fim | hard | {
"lang": "python",
"repo": "Juniper/YAPT",
"path": "/lib/services/normalizer/dhcp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:return: raw_devices
"""
try:
log_content = IscDhcpLeases(self.logfile)
current_devices = log_content.get_current()
if len(current_devices) > 0:
for device in current_devices:
yield SampleDevice... | code_fim | hard | {
"lang": "python",
"repo": "Juniper/YAPT",
"path": "/lib/services/normalizer/dhcp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Juniper/YAPT path: /lib/services/normalizer/dhcp.py
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
# Copyright (c) 2018 Juniper Networks, Inc.
# All rights reserved.
# Use is subject to license terms.
#
# Author: cklewar
import sys
from isc_dhcp_leases.iscdhcpleases import IscDh... | code_fim | hard | {
"lang": "python",
"repo": "Juniper/YAPT",
"path": "/lib/services/normalizer/dhcp.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> cookie_value = 'false'
user = getattr(request, 'user', None)
if user and user.is_authenticated():
cookie_value = 'true'
response.set_cookie(
'sso_display_logged_in',
value=cookie_value,
domain=settings.SESSION_COOKIE_DOMAIN,
... | code_fim | hard | {
"lang": "python",
"repo": "whos4n3/directory-sso",
"path": "/core/middleware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whos4n3/directory-sso path: /core/middleware.py
from django.conf import settings
class SSODisplayLoggedInCookieMiddleware:
<|fim_suffix|> cookie_value = 'false'
user = getattr(request, 'user', None)
if user and user.is_authenticated():
cookie_value = 'true'
... | code_fim | hard | {
"lang": "python",
"repo": "whos4n3/directory-sso",
"path": "/core/middleware.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, dependency_graph, app):
super(DistributedDependencyGraphRunner, self).__init__(dependency_graph)
assert isinstance(app, QuantDslApplication)
self.app = app
def run(self, **kwargs):
super(DistributedDependencyGraphRunner, self).run(**kwargs)
... | code_fim | hard | {
"lang": "python",
"repo": "andresvn89/quantdsl",
"path": "/quantdsl/infrastructure/runners/distributed.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andresvn89/quantdsl path: /quantdsl/infrastructure/runners/distributed.py
from quantdsl.application.base import QuantDslApplication
from quantdsl.infrastructure.celery.tasks import celery_evaluate_call
from quantdsl.infrastructure.runners.base import DependencyGraphRunner
# We can either run the... | code_fim | hard | {
"lang": "python",
"repo": "andresvn89/quantdsl",
"path": "/quantdsl/infrastructure/runners/distributed.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.result = a + b
return self.result<|fim_prefix|># repo: CSBindra/Python-Lib path: /CSB_TestPackage/File1.py
import logging
class Adder:
def __init__(self, logger):
<|fim_middle|> self.result = 0
self.logger = logger
self.logger.info("Adder Init Successfully Called")
def add_val(self, a,... | code_fim | medium | {
"lang": "python",
"repo": "CSBindra/Python-Lib",
"path": "/CSB_TestPackage/File1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CSBindra/Python-Lib path: /CSB_TestPackage/File1.py
import logging
class Adder:
def __init__(self, logger):
<|fim_suffix|> self.result = a + b
return self.result<|fim_middle|> self.result = 0
self.logger = logger
self.logger.info("Adder Init Successfully Called")
def add_val(self, a,... | code_fim | medium | {
"lang": "python",
"repo": "CSBindra/Python-Lib",
"path": "/CSB_TestPackage/File1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doneill/MapPreview path: /webmap.py
def render(data, type):
messageBegin = """
<html>
<head>
<title>Map Preview</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloN... | code_fim | hard | {
"lang": "python",
"repo": "doneill/MapPreview",
"path": "/webmap.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> messageEnd = """
L.TopoJSON = L.GeoJSON.extend({
addData: function(jsonData) {
if (jsonData.type === "Topology"){
for (key in jsonData.objects){
geojson = topojson.feature( jsonData, jsonData.objects[key]);
... | code_fim | hard | {
"lang": "python",
"repo": "doneill/MapPreview",
"path": "/webmap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paninski-lab/yass path: /src/yass/deconvolve/run_original.py
ad_interp_loc(
min_val_reshaped[idx_, j-1:j+2].transpose())
elif j == 4:
subsample_shift = quad_interp_loc(
min_val_reshaped[idx_, j-2:j+1].transpose())
subsample_shift[sub... | code_fim | hard | {
"lang": "python",
"repo": "paninski-lab/yass",
"path": "/src/yass/deconvolve/run_original.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
# # use KS eq (6)
# else:
if ptp_flag:
#templates_new[:,:,unit] = d_gpu.temps[:,:,unit]*scale
# exponential updates
t1 = d_gpu.temps[:,:,unit]*np.exp(-n_spikes/d_gpu.nu)
t2 = (1-np.exp(-n_spik... | code_fim | hard | {
"lang": "python",
"repo": "paninski-lab/yass",
"path": "/src/yass/deconvolve/run_original.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_batches_per_chunk = d_gpu.template_update_time//CONFIG.resources.n_sec_chunk_gpu
wfs_local_array = []
n_spikes_local_array = []
ptp_local_array = []
for k in range(len(chunks)):
fname = (d_gpu.out_dir + '/template_updates/chunk_data_'+
str((chunks[k]+1... | code_fim | hard | {
"lang": "python",
"repo": "paninski-lab/yass",
"path": "/src/yass/deconvolve/run_original.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: naftulikay/s3cf-deploy path: /s3cf-deploy
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import json
import logging
import os
import re
import shlex
import subprocess
import sys
import time
DESC = """
A deployment tool for syncing a directory to S3 and generating a CloudFront i... | code_fim | hard | {
"lang": "python",
"repo": "naftulikay/s3cf-deploy",
"path": "/s3cf-deploy",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
sync_results, invalidation = deployer.deploy()
if invalidation:
print("Created Invalidation {} for Changed Paths:".format(invalidation.id))
for s in sync_results:
print(" [{action}] {path}".format(action=s.action.upper(), path=s.remote_pa... | code_fim | hard | {
"lang": "python",
"repo": "naftulikay/s3cf-deploy",
"path": "/s3cf-deploy",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> h = HMRTM(n_states, n_obs, R=len(sents.r_dict), params=params_fixed, writeout=False, dirname=path,
omit_class_cond=omit_class_cond, omit_emis_cond=omit_emis_cond) if eval_spec_rel else \
HMTM(n_states, n_obs, params=params_fixed, writeout=False, dirname=path)
with open(args.... | code_fim | hard | {
"lang": "python",
"repo": "rug-compling/hmm-reps",
"path": "/output/get_posteriors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rug-compling/hmm-reps path: /output/get_posteriors.py
import argparse
import numpy as np
from eval.ner.PrepareHmmRep import read_params_from_path
from hmrtm import HMRTM
from hmtm import HMTM
from readers.conll_corpus import ConllCorpus
from util.util import nparr_to_str
if __name__ == "__mai... | code_fim | hard | {
"lang": "python",
"repo": "rug-compling/hmm-reps",
"path": "/output/get_posteriors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># yield next(data_iter_list[next(cls_iter)])
if j >= num_samples_cls:
j = 0
if j == 0:
temp_tuple = next(zip(*[data_iter_list[next(cls_iter)]]*num_samples_cls))
yield temp_tuple[j]
else:
yield temp_tuple[j]
... | code_fim | hard | {
"lang": "python",
"repo": "IdyanoLeroy/MiSLAS",
"path": "/datasets/sampler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IdyanoLeroy/MiSLAS path: /datasets/sampler.py
import numpy as np
import random
import torch
class BalancedDatasetSampler(torch.utils.data.sampler.Sampler):
def __init__(self, dataset, indices=None, num_samples=None):
# if indices is not provided,
# all ele... | code_fim | hard | {
"lang": "python",
"repo": "IdyanoLeroy/MiSLAS",
"path": "/datasets/sampler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.