text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Maxim-Mushizky/eurotherm_controller_monitor path: /eurotherm_reader/controller/serial_ports.py
import serial.tools.list_ports
import serial
import sys
import glob
class SerialPorts():
def __init__(self, include_links = True):
# Items are returned in no particular order. It may make ... | code_fim | hard | {
"lang": "python",
"repo": "Maxim-Mushizky/eurotherm_controller_monitor",
"path": "/eurotherm_reader/controller/serial_ports.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
if len(self._coms) > 0:
return self._coms
else:
return self._coms
print("No available com ports found")
except NameError:
pass
def get_com_list_TEST(self):
""" Lists serial port names
... | code_fim | hard | {
"lang": "python",
"repo": "Maxim-Mushizky/eurotherm_controller_monitor",
"path": "/eurotherm_reader/controller/serial_ports.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s.pmap = n.ones((s.size,)*s.ndim)
for e in s.events: s.pmap = e.update(s.pmap, curUT())
s.rcCentroid()
def rcCentroid(s):
# TODO: Revise centroiding algorithm.
centroid = n.zeros(s.ndim)
for ind in n.ndindex((s.size,)*s.ndim):
for i... | code_fim | hard | {
"lang": "python",
"repo": "AmarNathH/software",
"path": "/aslam/deprecated/ASLAM/deprecated/old2/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def dObs(s, obj, distance, err):
initn, inite = s.objects[obj].centroid
subn, sube = s.objects['sub'].centroid
prevh = toPolar(initn - subn, inite - sube)[1]
newn, newe = toCartesian(distance, prevh)
deltan, deltae = newn - initn, newe - inite
expDistanc... | code_fim | hard | {
"lang": "python",
"repo": "AmarNathH/software",
"path": "/aslam/deprecated/ASLAM/deprecated/old2/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmarNathH/software path: /aslam/deprecated/ASLAM/deprecated/old2/classes.py
GRIDSIZE = 50
GRIDSCALE = 0.1
TDCOEFF = 0.001
AUTOREJFRAC = 0.3
import numpy as n
from aux import toPolar, toCartesian, gaussian, curUT
from math import pi
class Event:
def __init__(s, euf, eut, ndim = 2):
... | code_fim | hard | {
"lang": "python",
"repo": "AmarNathH/software",
"path": "/aslam/deprecated/ASLAM/deprecated/old2/classes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = X(val=1, deep={'deep_thing': [1, 2]})
y = copy_method(x)
y.val = 2
y.deep['deep_thing'].append(3)
assert x.val == 1
assert y.val == 2
# deep['deep_thing'] gets modified
assert x.deep['deep_thing'] == [1, 2, 3]
assert y.deep['deep_thing'] == [1, 2, 3]
def test_co... | code_fim | hard | {
"lang": "python",
"repo": "slafs/pydantic",
"path": "/tests/test_construction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slafs/pydantic path: /tests/test_construction.py
import pickle
from typing import Any, List, Optional
import pytest
from pydantic_core import PydanticUndefined, ValidationError
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, PydanticDeprecatedSince20
class Model(BaseModel):
... | code_fim | hard | {
"lang": "python",
"repo": "slafs/pydantic",
"path": "/tests/test_construction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bollwyvl/vak path: /src/vak/datasets/unannotated_dataset.py
import pandas as pd
import torch
from torchvision.datasets.vision import VisionDataset
from .. import files
class UnannotatedDataset(VisionDataset):
"""Dataset class that represents a set of spectrograms
generated from audio o... | code_fim | hard | {
"lang": "python",
"repo": "bollwyvl/vak",
"path": "/src/vak/datasets/unannotated_dataset.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """number of batches"""
return len(self.spect_paths)
@classmethod
def from_csv(cls, csv_path, split, window_size,
spect_key='s', timebins_key='t',
transform=None, target_transform=None):
"""given a path to a csv representing a dataset,
... | code_fim | hard | {
"lang": "python",
"repo": "bollwyvl/vak",
"path": "/src/vak/datasets/unannotated_dataset.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> treePredName = 'tree'
treeBaseName = dcData[6].treename
truthMap = dcData[6].reducedtruthmap
truthOrder = dcData[6].reducedtruthclasses
n = len(truthMap)
tfileMapFile = '{}/tree_association.txt'.format(args.predictionDir)
for x in truthOrder:
sig_bg = [(x,y) for ... | code_fim | hard | {
"lang": "python",
"repo": "dntaylor/DeepJet",
"path": "/scripts/plotPerformance.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> labels = {
'isJet' : r'jet',
'isLight' : r'udsg',
'isB' : r'b',
'isC' : r'c',
'isTauTau' : r'$\tau\tau$',
'isTauHTauH': r'$\tau_{h}\tau_{h}$',
'isTauHTauM': r'$\tau_{\mu}\tau_{h}$',
'isTauHTauE': r'$\tau_{e}\tau_{h}$',
... | code_fim | hard | {
"lang": "python",
"repo": "dntaylor/DeepJet",
"path": "/scripts/plotPerformance.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dntaylor/DeepJet path: /scripts/plotPerformance.py
from __future__ import print_function
import os
import sys
import operator
import pickle
import argparse
import itertools
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
ROOT.... | code_fim | hard | {
"lang": "python",
"repo": "dntaylor/DeepJet",
"path": "/scripts/plotPerformance.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>_gmsma_revenue /= n_trials
average_vcg_revenue /= n_trials
average_gmsma_runtime /= n_trials
average_vcg_runtime /= n_trials
vcg_revenue.append(average_vcg_revenue)
gmsma_revenue.append(average_gmsma_revenue)
vcg_runtime.append(average_vcg_runtime)
gmsma_runtime.append(average_gmsma_runtime)... | code_fim | hard | {
"lang": "python",
"repo": "zhuliquan/TravelResourseTrade_CombinatorialAuction",
"path": "/other_github_resource/CombinatorialAuctions/plots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhuliquan/TravelResourseTrade_CombinatorialAuction path: /other_github_resource/CombinatorialAuctions/plots.py
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import time
from auctions import *
from approximations import *
from simul... | code_fim | hard | {
"lang": "python",
"repo": "zhuliquan/TravelResourseTrade_CombinatorialAuction",
"path": "/other_github_resource/CombinatorialAuctions/plots.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __call__(self, trainer):
self.aggregator(trainer)
return self.actual_trigger(trainer)
def _stop_condition(self):
return self.actual_trigger._stop_condition()
def _init_summary(self):
return self.actual_trigger._init_summary()
def get_training_length(s... | code_fim | hard | {
"lang": "python",
"repo": "crcrpar/chainer",
"path": "/chainermn/extensions/multi_node_early_stopping_trigger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crcrpar/chainer path: /chainermn/extensions/multi_node_early_stopping_trigger.py
from chainer.training.triggers import EarlyStoppingTrigger
from chainermn.extensions import ObservationAggregator
class MultiNodeEarlyStoppingTrigger(object):
"""__init__(\
self, comm, check_trigger=(1,... | code_fim | hard | {
"lang": "python",
"repo": "crcrpar/chainer",
"path": "/chainermn/extensions/multi_node_early_stopping_trigger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> patience=None, mode='auto', verbose=False,
max_trigger=(100, 'epoch'), suffix='_aggregated', **kwargs):
# `patients` as an alias of `patience`
monitor_aggregated = monitor + suffix
self.actual_trigger = EarlyStoppingTrigger(check_trigger=check_tr... | code_fim | hard | {
"lang": "python",
"repo": "crcrpar/chainer",
"path": "/chainermn/extensions/multi_node_early_stopping_trigger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Istom1n/theoceanx-python path: /theoceanx/websockets.py
import os
from socketIO_client import SocketIO
def on_connect():
<|fim_suffix|>
socket_ = SocketIO(os.environ['SOCKET_URL'], verify=False)
socket_.emit('data', {
'type': 'subscribe',
'channel': 'order_book',
'payload': {
... | code_fim | medium | {
"lang": "python",
"repo": "Istom1n/theoceanx-python",
"path": "/theoceanx/websockets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def on_message(message):
print(message)
socket_ = SocketIO(os.environ['SOCKET_URL'], verify=False)
socket_.emit('data', {
'type': 'subscribe',
'channel': 'order_book',
'payload': {
'baseTokenAddress': '0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570',
'quoteTokenAddress': '0x... | code_fim | medium | {
"lang": "python",
"repo": "Istom1n/theoceanx-python",
"path": "/theoceanx/websockets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DavidNKraemer/ConvexOptimizationDRP2019Fa path: /optimization/optfunction.py
class OptFunction:
"""
Wrapper class for functions associated with optimization algorithms. The
idea is to include the function, the gradient function, and/or the Hessian
function inside of the same objec... | code_fim | medium | {
"lang": "python",
"repo": "DavidNKraemer/ConvexOptimizationDRP2019Fa",
"path": "/optimization/optfunction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if order > self.order:
raise ValueError(f"Function does not support calls of order {order}")
fx = self.f(x)
if order == 0:
return (fx,)
else:
gradfx = self.gradf(x)
if order == 1:
return (fx, gradfx)
... | code_fim | hard | {
"lang": "python",
"repo": "DavidNKraemer/ConvexOptimizationDRP2019Fa",
"path": "/optimization/optfunction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hainm/jamber path: /jamber/compat.py
import sys
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
<|fim_suffix|>if PY3:
string_types = str
else:
string_types = basestring<|fim_middle|>PY3 = sys.version_info[0] == 3
| code_fim | easy | {
"lang": "python",
"repo": "hainm/jamber",
"path": "/jamber/compat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if PY3:
string_types = str
else:
string_types = basestring<|fim_prefix|># repo: hainm/jamber path: /jamber/compat.py
import sys
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
<|fim_middle|>PY3 = sys.version_info[0] == 3
| code_fim | easy | {
"lang": "python",
"repo": "hainm/jamber",
"path": "/jamber/compat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def score_nopaths(pairs, modelfile, rb_vocab):
'''
'''
# read pairs
orderedpairs = []
for p1, p2 in pairs:
orderedpairs.extend([(p1,p2)])
# extract edges we need to predict (direct only in this case)
orderedfeats = []
G = graph_from_json(GRAPHFILE)
fo... | code_fim | hard | {
"lang": "python",
"repo": "acocos/scalar-adj",
"path": "/iqap/src/rb_lr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, (pair, probs) in enumerate(zip(orderedpairs, pred_probs)):
if sum(X[i])==0:
predweights[pair] = 0.5
else:
predweights[pair] = probs[1]
# finalize scores
scores = {}
for x,y in pairs :
W_x = predweights[(x,y)]
... | code_fim | hard | {
"lang": "python",
"repo": "acocos/scalar-adj",
"path": "/iqap/src/rb_lr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acocos/scalar-adj path: /iqap/src/rb_lr.py
#!/usr/bin/env python
'''
rb_lr.py
Score pairwise adjective intensity based on logistic regression classifier trained
on RB+JJ-->JJ paraphrase patterns
'''
import os, sys
import gzip
import json
import pickle
from networkx.readwrite import json_graph... | code_fim | hard | {
"lang": "python",
"repo": "acocos/scalar-adj",
"path": "/iqap/src/rb_lr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andreatramo/dataset_category_selector path: /openimage_db.py
from database import Database
import csv, sys
import tensorflow as tf
from labeled_image import LabeledImage
from PIL import Image
class OpenimageDB(Database):
def __init__(self, input_file_path, output_file_path):
super(... | code_fim | hard | {
"lang": "python",
"repo": "andreatramo/dataset_category_selector",
"path": "/openimage_db.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # add line to the new file
if exist:
# update statistics
self.my_obj_list[idx-1].update_num()
else:
self.img_not_found += 1
sys.stdout.write("\r" + " DONE!")
... | code_fim | hard | {
"lang": "python",
"repo": "andreatramo/dataset_category_selector",
"path": "/openimage_db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ghadd/online_informer_bot path: /settings/logger.py
"""
This file provides a basic logger support
* get_logger - returns a logger which pipes to /tmp/online_informer_bot.log and console.
"""
import logging
def get_logger(name: str) -> logging.Logger:
"""
Parameters
----------
... | code_fim | hard | {
"lang": "python",
"repo": "ghadd/online_informer_bot",
"path": "/settings/logger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def LOG_HANDLE_CALLBACK_QUERY(logger, q):
logger.info("Handling request from {user}: {text}".format(
user=USER(q.from_user),
text=q.data
))<|fim_prefix|># repo: ghadd/online_informer_bot path: /settings/logger.py
"""
This file provides a basic logger support
* get_logger - re... | code_fim | hard | {
"lang": "python",
"repo": "ghadd/online_informer_bot",
"path": "/settings/logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Shear center --------------------------------
y_s = -3*h**2/(6*h + w)
r = cls(radius=radius,
area=area, I11=I11, I22=I22, I33=I33, Iw=Iw,
young_mod=young_mod, shear_mod=shear_mod,
sec_type='C', sec_par... | code_fim | hard | {
"lang": "python",
"repo": "tianhaichen/bike-wheel-calc",
"path": "/bikewheelcalc/bicycle_wheel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Remove any existing spokes
self.spokes = []
for s in range(n_spokes):
theta_rim = 2*np.pi/n_spokes * s
side = 2*((s + 1) % 2) - 1
s_dir = 2*((s % 4) < 2) - 1
rim_pt = (self.rim.radius, theta_rim, side*offset)
... | code_fim | hard | {
"lang": "python",
"repo": "tianhaichen/bike-wheel-calc",
"path": "/bikewheelcalc/bicycle_wheel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tianhaichen/bike-wheel-calc path: /bikewheelcalc/bicycle_wheel.py
import numpy as np
class BicycleWheel:
"""Bicycle wheel definition.
Defines a bicycle wheel including geometry, spoke properties, and rim
properties. Instances of the BicycleWheel class can be used as an input... | code_fim | hard | {
"lang": "python",
"repo": "tianhaichen/bike-wheel-calc",
"path": "/bikewheelcalc/bicycle_wheel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.edtName.SetValue(self.test.name)
self.edtDescr.SetValue(self.test.descr if self.test.descr is not None else "")
self.edtCommand.SetValue(str(self.test.cmd) if self.test.cmd is not None else "")
self.edtTimeout.SetValue(str(self.test.timeout))
self.edtExpOut.SetValue(str(self.test.expectStdo... | code_fim | hard | {
"lang": "python",
"repo": "MarcusRiemer/pyTest",
"path": "/pyTestEditForm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarcusRiemer/pyTest path: /pyTestEditForm.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from pyTest import Test
from pyTestRunner import TestRunner
import wx
class TestEditForm(wx.Frame):
"""Form for editing one test"""
def __init__(self, parent, idx, test, runner, gui):
"""
Initialis... | code_fim | hard | {
"lang": "python",
"repo": "MarcusRiemer/pyTest",
"path": "/pyTestEditForm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for m in self.modules():
if isinstance(m, nn.Conv2d):
kaiming_init(m)
def forward(self, inputs):
feature_shape = inputs.shape
selected = inputs
selected = self.norm(selected)
selected = selected.permute(0, 3, 1, 2)
selected ... | code_fim | hard | {
"lang": "python",
"repo": "huawei-noah/Pretrained-Language-Model",
"path": "/Noah_WuKong/model/modules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huawei-noah/Pretrained-Language-Model path: /Noah_WuKong/model/modules.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2022, Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | code_fim | hard | {
"lang": "python",
"repo": "huawei-noah/Pretrained-Language-Model",
"path": "/Noah_WuKong/model/modules.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.attention_maps = nn.Sequential(
nn.Conv2d(
self.in_channels, self.in_channels, kernel_size=(1, 1),
stride=(1, 1), padding=0, groups=self.num_groups, bias=False),
nn.Conv2d(
self.in_channels, self.num_tokens, kernel_size=(... | code_fim | hard | {
"lang": "python",
"repo": "huawei-noah/Pretrained-Language-Model",
"path": "/Noah_WuKong/model/modules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RomainJunca/twitter-lapetite path: /bot/word_manager.py
def pick_word():
words = None
with open("./data/word_backlog.txt","r") as file:
words = file.readlines()
if len(words) < 1:
raise Exception('No more word to pick')
word = words.pop(0)
with open("./data/word_backlog.txt","w") as file... | code_fim | easy | {
"lang": "python",
"repo": "RomainJunca/twitter-lapetite",
"path": "/bot/word_manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open("./data/word_published.txt","a") as file:
file.write(str(tweetid)+" "+word)<|fim_prefix|># repo: RomainJunca/twitter-lapetite path: /bot/word_manager.py
def pick_word():
words = None
with open("./data/word_backlog.txt","r") as file:
words = file.readlines()
if len(words) < 1:
raise Ex... | code_fim | easy | {
"lang": "python",
"repo": "RomainJunca/twitter-lapetite",
"path": "/bot/word_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Etiqa/bromine path: /tests/unit/test_locator.py
import pytest
@pytest.mark.skip(reason="TODO: this test has not been implemented yet") # TODO: write test
def test_locator():
raise NotImplementedError
@pytest.mark.skip(reason="TODO: this test has not been implemented yet") # TODO: write tes... | code_fim | easy | {
"lang": "python",
"repo": "Etiqa/bromine",
"path": "/tests/unit/test_locator.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.skip(reason="TODO: this test has not been implemented yet") # TODO: write test
def test_index_locator():
raise NotImplementedError<|fim_prefix|># repo: Etiqa/bromine path: /tests/unit/test_locator.py
import pytest
@pytest.mark.skip(reason="TODO: this test has not been implemented yet")... | code_fim | easy | {
"lang": "python",
"repo": "Etiqa/bromine",
"path": "/tests/unit/test_locator.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ericziethen/legocollector path: /legocollector/utils/ldraw_studcount_parser.py
import datetime
import enum
import json
import os
from pathlib import Path, PureWindowsPath
class SubfileMissingError(Exception):
"""Subfile is Missing Exception."""
@enum.unique
class LineType(enum.Enum):
... | code_fim | hard | {
"lang": "python",
"repo": "ericziethen/legocollector",
"path": "/legocollector/utils/ldraw_studcount_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_file_from_part_line(line):
return Path(PureWindowsPath(line.split()[-1].lower()))
def get_ldraw_file_type(file_name):
file_type = FileType.UNKNOWN
top_stud_file_names = [
'stud.dat', 'studa.dat', 'studp01.dat', 'studel.dat', 'stud10.dat',
'stud15.dat', 'stud2.dat', '... | code_fim | hard | {
"lang": "python",
"repo": "ericziethen/legocollector",
"path": "/legocollector/utils/ldraw_studcount_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def calc_top_studs_for_part_file(
file_path, file_dic, processed_files_dic=None, file_visited_count=None, rec_level=0):
if processed_files_dic is None:
processed_files_dic = {}
if file_visited_count is not None:
if file_path not in file_visited_count:
file_visit... | code_fim | hard | {
"lang": "python",
"repo": "ericziethen/legocollector",
"path": "/legocollector/utils/ldraw_studcount_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model_name='carpool',
name='reg_arrival_time',
field=models.TimeField(null=True, blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='carpool',
name='reg_departure_time',
field=models.TimeFie... | code_fim | hard | {
"lang": "python",
"repo": "LucienD/Mobct",
"path": "/mobycity/carpooling/migrations/0019_auto_20151023_1659.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LucienD/Mobct path: /mobycity/carpooling/migrations/0019_auto_20151023_1659.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('carpooling', '0018_auto_20151023_1621')... | code_fim | hard | {
"lang": "python",
"repo": "LucienD/Mobct",
"path": "/mobycity/carpooling/migrations/0019_auto_20151023_1659.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: annihilatethee/seedsync path: /src/python/tests/integration/test_web/test_handler/test_stream_model.py
# Copyright 2017, Inderpreet Singh, All rights reserved.
import unittest
from unittest.mock import MagicMock, patch
from threading import Timer
from tests.integration.test_web.test_web_app imp... | code_fim | hard | {
"lang": "python",
"repo": "annihilatethee/seedsync",
"path": "/src/python/tests/integration/test_web/test_handler/test_stream_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Queue updates
added_file = ModelFile("a", True)
removed_file = ModelFile("b", False)
old_file = ModelFile("c", False)
old_file.local_size = 100
new_file = ModelFile("c", False)
new_file.local_size = 200
def send_updates():
self... | code_fim | hard | {
"lang": "python",
"repo": "annihilatethee/seedsync",
"path": "/src/python/tests/integration/test_web/test_handler/test_stream_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Setup mock serialize instance
mock_serialize = mock_serialize_model_cls.return_value
mock_serialize.model.return_value = "\n"
mock_serialize.update_event.return_value = "\n"
# Use the real UpdateEvent class
mock_serialize_model_cls.UpdateEvent = SerializeM... | code_fim | hard | {
"lang": "python",
"repo": "annihilatethee/seedsync",
"path": "/src/python/tests/integration/test_web/test_handler/test_stream_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwilson21/PS5Tracker path: /app/retailers/adorama_retailer.py
from datetime import datetime
from typing import List
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from app.const... | code_fim | hard | {
"lang": "python",
"repo": "kwilson21/PS5Tracker",
"path": "/app/retailers/adorama_retailer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> price_xpath = '//*[@id="product-container"]/section/div[2]/form/section/div[1]/div[1]/div/strong'
stock_xpath = '//*[@id="SO3005718_btn"]'
price_element = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH, price_xpath)))
price = price... | code_fim | hard | {
"lang": "python",
"repo": "kwilson21/PS5Tracker",
"path": "/app/retailers/adorama_retailer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: richardbarran/django-photologue path: /photologue/management/commands/plcache.py
from django.core.management.base import BaseCommand, CommandError
from photologue.models import ImageModel, PhotoSize
class Command(BaseCommand):
help = 'Manages Photologue cache file for the given sizes.'
... | code_fim | hard | {
"lang": "python",
"repo": "richardbarran/django-photologue",
"path": "/photologue/management/commands/plcache.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('sizes',
nargs='*',
type=str,
help='Name of the photosize.')
parser.add_argument('--reset',
action='store_true',
default=False,
... | code_fim | hard | {
"lang": "python",
"repo": "richardbarran/django-photologue",
"path": "/photologue/management/commands/plcache.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not len(photosizes):
raise CommandError('No photo sizes were found.')
print('Caching photos, this may take a while...')
for cls in ImageModel.__subclasses__():
for photosize in photosizes:
print('Cacheing %s size images' % photosize.name... | code_fim | hard | {
"lang": "python",
"repo": "richardbarran/django-photologue",
"path": "/photologue/management/commands/plcache.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if debug == True:
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
def get(name):
return logging.getLogger(name)<|fim_prefix|># repo: theonlydude/RandomMetroidSolver path: /utils/log.py
import logging, sys
# store the ... | code_fim | easy | {
"lang": "python",
"repo": "theonlydude/RandomMetroidSolver",
"path": "/utils/log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theonlydude/RandomMetroidSolver path: /utils/log.py
import logging, sys
# store the debug flag at module level
debug = False
<|fim_suffix|> if debug == True:
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
def get... | code_fim | easy | {
"lang": "python",
"repo": "theonlydude/RandomMetroidSolver",
"path": "/utils/log.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return logging.getLogger(name)<|fim_prefix|># repo: theonlydude/RandomMetroidSolver path: /utils/log.py
import logging, sys
# store the debug flag at module level
debug = False
def init(pdebug):
global debug
debug = pdebug
if debug == True:
logging.basicConfig(stream=sys.stdout... | code_fim | easy | {
"lang": "python",
"repo": "theonlydude/RandomMetroidSolver",
"path": "/utils/log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask = torch.zeros(1,63,dtype=torch.long)
token_type_ids = torch.zeros(1,63,dtype=torch.long)
traced = torch.jit.trace(model,ids,mask,token_type_ids)
return traced
def main():
MODEL = NLUModel(57,54,18)
MODEL.load_state_dict(torch.load(config.MODEL_PATH,
... | code_fim | hard | {
"lang": "python",
"repo": "rishiraj/heychinki",
"path": "/nlu/neuralnet/optimize_graph.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('tracing model')
traced_model = trace(MODEL)
print('Saving traced model to ', config.TRACE_MODEL_PATH)
traced_model.save(config.TRACE_MODEL_PATH)
print('Done!')
if __name__ == "__main__":
main()<|fim_prefix|># repo: rishiraj/heychinki path: /nlu/neuralnet/optimize_graph.py
... | code_fim | medium | {
"lang": "python",
"repo": "rishiraj/heychinki",
"path": "/nlu/neuralnet/optimize_graph.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rishiraj/heychinki path: /nlu/neuralnet/optimize_graph.py
import torch
from model import NLUModel
import config
DEVICE = config.DEVICE
def trace(model):
<|fim_suffix|> mask = torch.zeros(1,63,dtype=torch.long)
token_type_ids = torch.zeros(1,63,dtype=torch.long)
traced = torch.jit.tra... | code_fim | hard | {
"lang": "python",
"repo": "rishiraj/heychinki",
"path": "/nlu/neuralnet/optimize_graph.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Register your models here.
admin.site.register(Server)<|fim_prefix|># repo: omiltoro/testkenyacap path: /working/admin.py
__author__ = 'judywawira'
<|fim_middle|>from django.contrib import admin
from working.models import Server,UserProfile
| code_fim | medium | {
"lang": "python",
"repo": "omiltoro/testkenyacap",
"path": "/working/admin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: omiltoro/testkenyacap path: /working/admin.py
__author__ = 'judywawira'
<|fim_suffix|># Register your models here.
admin.site.register(Server)<|fim_middle|>from django.contrib import admin
from working.models import Server,UserProfile
| code_fim | medium | {
"lang": "python",
"repo": "omiltoro/testkenyacap",
"path": "/working/admin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CopyReportTest(DataModelTestCase):
"""Unit tests for the copy report action."""
def setUp(self):
"""Extend to set up the report under test."""
super().setUp()
self.report = {
"report_uuid": "report_uuid",
"title": "Report",
"subjec... | code_fim | hard | {
"lang": "python",
"repo": "ICTU/quality-time",
"path": "/components/api_server/tests/model/test_actions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test that the metrics are copied too."""
subject_copy = copy_subject(self.subject, self.DATA_MODEL)
self.assertEqual("Metric", first(subject_copy["metrics"].values())["name"])
class CopyReportTest(DataModelTestCase):
"""Unit tests for the copy report action."""
def se... | code_fim | hard | {
"lang": "python",
"repo": "ICTU/quality-time",
"path": "/components/api_server/tests/model/test_actions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ICTU/quality-time path: /components/api_server/tests/model/test_actions.py
"""Unit tests for the model actions."""
from shared.utils.functions import first
from model.actions import copy_metric, copy_report, copy_source, copy_subject
from tests.base import DataModelTestCase
class CopySourceT... | code_fim | hard | {
"lang": "python",
"repo": "ICTU/quality-time",
"path": "/components/api_server/tests/model/test_actions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Dataclass for transform estimator and parameters
"""
numerical_transform: Union[None, TransformEstimator] = field(default=None)
categorical_transform: Union[None, TransformEstimator] = \
field(default=None)
numerical_parameters: dict = field(default_factory=dict)
c... | code_fim | medium | {
"lang": "python",
"repo": "made-ml-in-prod-2021/andyst75",
"path": "/online_inference/src/classes/transforms_params.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: made-ml-in-prod-2021/andyst75 path: /online_inference/src/classes/transforms_params.py
"""
Dataclass for transform estimator and parameters (from YAML-file)
"""
from dataclasses import dataclass, field
from typing import Union
from src.classes import TransformEstimator
<|fim_suffix|> numer... | code_fim | medium | {
"lang": "python",
"repo": "made-ml-in-prod-2021/andyst75",
"path": "/online_inference/src/classes/transforms_params.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sean-reed/ramsmod path: /ramsmod/plotting.py
, d, ax=None, show_legend=True):
"""
Returns a plot of observations from right-censored failure data.
:param t: Survival times for each observation.
:param d: Indicator variable value for each observation, where
value 1 indicates ex... | code_fim | hard | {
"lang": "python",
"repo": "sean-reed/ramsmod",
"path": "/ramsmod/plotting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> interval_t = tmin != tmax
exact_t = tmin == tmax
interval_log_likelihoods = np.log(ttf_rv.cdf(tmax[interval_t]) - ttf_rv.cdf(tmin[interval_t]))
exact_log_likelihoods = np.log(ttf_rv.pdf(tmin[exact_t]))
total_log_likelihood = interval_log_likelihoods.sum() + exact_log_likelihoods.sum()... | code_fim | hard | {
"lang": "python",
"repo": "sean-reed/ramsmod",
"path": "/ramsmod/plotting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sean-reed/ramsmod path: /ramsmod/plotting.py
om ramsmod.utils import convert_to_pd_series
__all__ = ['plot_right_censored', 'plot_interval_censored', 'plot_np_reliability',
'plot_exponential_prob_plot', 'plot_weibull_prob_plot', 'plot_lognormal_prob_plot',
'plot_exponential... | code_fim | hard | {
"lang": "python",
"repo": "sean-reed/ramsmod",
"path": "/ramsmod/plotting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ptoman/SimpleML path: /simpleml/persistables/base_sqlalchemy.py
'''
Base class for sqlalchemy
'''
__author__ = 'Elisha Yadgaran'
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, DateTime, func
from sqlalchemy_mixins import AllFeaturesMixin
Base = declara... | code_fim | medium | {
"lang": "python",
"repo": "ptoman/SimpleML",
"path": "/simpleml/persistables/base_sqlalchemy.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> created_timestamp = Column(DateTime(timezone=True), nullable=False, server_default=func.now())
modified_timestamp = Column(DateTime(timezone=True), server_onupdate=func.now())
@classmethod
def filter(cls, *filters):
return cls._session.query(cls).filter(*filters)
@classmethod... | code_fim | hard | {
"lang": "python",
"repo": "ptoman/SimpleML",
"path": "/simpleml/persistables/base_sqlalchemy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create ad group ad.
ad_group_ad = {
'adGroupId': ad_group_id,
'ad': multi_asset_responsive_display_ad,
# Optional.
'status': 'PAUSED'
}
# Add ad.
ads = ad_group_ad_service.mutate([
{'operator': 'ADD', 'operand': ad_group_ad}
])
# Display results.
if 'value'... | code_fim | hard | {
"lang": "python",
"repo": "sheinnick/googleads-python-lib",
"path": "/examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sheinnick/googleads-python-lib path: /examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py
#!/usr/bin/env python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | code_fim | hard | {
"lang": "python",
"repo": "sheinnick/googleads-python-lib",
"path": "/examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Add ad.
ads = ad_group_ad_service.mutate([
{'operator': 'ADD', 'operand': ad_group_ad}
])
# Display results.
if 'value' in ads:
for ad in ads['value']:
print('Added new responsive display ad ad with ID "%d" '
'and long headline "%s".'
% (ad['ad']['id'], ... | code_fim | hard | {
"lang": "python",
"repo": "sheinnick/googleads-python-lib",
"path": "/examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Oneplus/twpipe path: /scripts/eval_parsing.py
#!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
def main():
cmd = argparse.ArgumentParser()
cmd.add_argument('--system', help='the path to the system output')
cmd.add_argument('--answer', h... | code_fim | medium | {
"lang": "python",
"repo": "Oneplus/twpipe",
"path": "/scripts/eval_parsing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> answer = answers[key]
gold_heads = answer["heads"]
gold_deprels = answer['deprels']
gold_postags = answers["gold_postags"]
for i in range(len(words)):
if args.exclude_punct and gold_postags[i] in ('PUCNT', ".", ",", ":", "''", "``"):
... | code_fim | hard | {
"lang": "python",
"repo": "Oneplus/twpipe",
"path": "/scripts/eval_parsing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> row = ',PW,AKID,SAK,https://console.link\n'
with self.assertRaises(CredentialParserError):
self.parser.parse_credentials(CSV_HEADERS + row)
def test_csv_parser_no_username_header(self):
contents = 'Access key ID,Secret access key\n'
with self.assertRaises(C... | code_fim | hard | {
"lang": "python",
"repo": "jamsheedsaeed/awsapp",
"path": "/tests/unit/customizations/configure/test_importer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamsheedsaeed/awsapp path: /tests/unit/customizations/configure/test_importer.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy ... | code_fim | hard | {
"lang": "python",
"repo": "jamsheedsaeed/awsapp",
"path": "/tests/unit/customizations/configure/test_importer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_post_one_request_with_data(self):
data = {'key': 'value'}
my_requestor = requestor.Requestor(
number_of_requests=1, url=self.url, method=utils.POST,
data=data
)
my_requestor.start_requests()
results = my_requestor.results
... | code_fim | hard | {
"lang": "python",
"repo": "davide-ceretti/meteora",
"path": "/tests/test_requestor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = {'key': 'value'}
my_requestor = requestor.Requestor(
number_of_requests=1, url=self.url, method=utils.POST,
data=data
)
my_requestor.start_requests()
results = my_requestor.results
self.assertEquals(results.responses[0].request... | code_fim | hard | {
"lang": "python",
"repo": "davide-ceretti/meteora",
"path": "/tests/test_requestor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davide-ceretti/meteora path: /tests/test_requestor.py
import unittest
from meteora import requestor
from meteora import utils
class TestRequestor(unittest.TestCase):
def setUp(self):
self.url = 'http://echo.jsontest.com/'
<|fim_suffix|> def test_generate_one_post_request(self)... | code_fim | hard | {
"lang": "python",
"repo": "davide-ceretti/meteora",
"path": "/tests/test_requestor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Huawei/Server_Management_Plugin_Puppet path: /src/files/REST-Linux/scripts/add_user.py
# -*- coding:utf-8 -*-
'''
#=========================================================================
# @Description: add user
#
# @author:
# @Date:
#=====================================================... | code_fim | hard | {
"lang": "python",
"repo": "Huawei/Server_Management_Plugin_Puppet",
"path": "/src/files/REST-Linux/scripts/add_user.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload = {
"UserName": args.newusername,
"Password": args.newpassword,
"RoleId": args.role
}
resp = client.create_resource(url, payload)
if resp is None:
return None
if resp['status_code'] == 201:
print('Success: successfully completed request... | code_fim | hard | {
"lang": "python",
"repo": "Huawei/Server_Management_Plugin_Puppet",
"path": "/src/files/REST-Linux/scripts/add_user.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: houxinli/MelodyEva path: /beat_.py
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import numpy as np
import librosa
import matplotlib.pyplot as plt
import librosa.display
from dtw import dtw
import math
class Tempo:
def __init__(self):
return
def beat_track(self,y,sr):
... | code_fim | hard | {
"lang": "python",
"repo": "houxinli/MelodyEva",
"path": "/beat_.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def beattrack_dp(self,localscore,period,tightness):
beats=[]
backlink=np.zeros(localscore.shape)
cumscore = np.zeros(localscore.shape)
periodrange=np.arange(-2*period,-int(period/2)+1,dtype=int)
#skewed window
txwt=-tightness*(np.log(-periodrange/period)... | code_fim | hard | {
"lang": "python",
"repo": "houxinli/MelodyEva",
"path": "/beat_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #print(y.shape)
sro=22050
swin=2048 #window size
shop=512
step=swin/shop
oesr=sro/shop #the sampel rate for the specgram frames
if sro!=sr:
y=librosa.resample(y, sr, sro)
D=np.abs(librosa.stft(y, n_fft=2048, hop_length=shop, win_... | code_fim | hard | {
"lang": "python",
"repo": "houxinli/MelodyEva",
"path": "/beat_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>db_sampler = dict(
type="GT-AUG",
enable=True,
db_info_path="/data/Datasets/LYFT/dbinfos_train.pkl",
sample_groups=[
dict(car=1),
dict(pedestrian=4),
dict(motorcycle=4),
dict(bicycle=4),
dict(other_vehicle=2),
dict(bus=5),
dict(truck=... | code_fim | hard | {
"lang": "python",
"repo": "chisyliu/Det3D",
"path": "/examples/cbgs/configs/lyft_all_vfev3_spmiddleresnetfhd_rpn2_mghead_syncbn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chisyliu/Det3D path: /examples/cbgs/configs/lyft_all_vfev3_spmiddleresnetfhd_rpn2_mghead_syncbn.py
import itertools
import logging
from det3d.builder import build_box_coder
from det3d.utils.config_tool import get_downsample_factor
# norm_cfg = dict(type='SyncBN', eps=1e-3, momentum=0.01)
norm_c... | code_fim | hard | {
"lang": "python",
"repo": "chisyliu/Det3D",
"path": "/examples/cbgs/configs/lyft_all_vfev3_spmiddleresnetfhd_rpn2_mghead_syncbn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># dataset settings
dataset_type = "LyftDataset"
data_root = "/data/Datasets/LYFT"
db_sampler = dict(
type="GT-AUG",
enable=True,
db_info_path="/data/Datasets/LYFT/dbinfos_train.pkl",
sample_groups=[
dict(car=1),
dict(pedestrian=4),
dict(motorcycle=4),
dict(... | code_fim | hard | {
"lang": "python",
"repo": "chisyliu/Det3D",
"path": "/examples/cbgs/configs/lyft_all_vfev3_spmiddleresnetfhd_rpn2_mghead_syncbn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: B3-348/summary_model path: /util.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications Copyright 2017 Abigail See
#
# 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 co... | code_fim | hard | {
"lang": "python",
"repo": "B3-348/summary_model",
"path": "/util.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> article_batch = tf.unstack(batch_article)
abstract_batch = tf.unstack(batch_abstract)
num = 0
sentence_score = []
sentence_class = []
for article in article_batch:
article_sentence = tf.unstack(article,axis=0)
for sentence in article_sentence:
score = ro... | code_fim | hard | {
"lang": "python",
"repo": "B3-348/summary_model",
"path": "/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nidaizamir/Test-PY path: /awsecommerceservice/models/offers.py
# -*- coding: utf-8 -*-
"""
awsecommerceservice
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
import awsecommerceservice.models.offer
class Offers(object):
"""Implementation of th... | code_fim | hard | {
"lang": "python",
"repo": "nidaizamir/Test-PY",
"path": "/awsecommerceservice/models/offers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure... | code_fim | hard | {
"lang": "python",
"repo": "nidaizamir/Test-PY",
"path": "/awsecommerceservice/models/offers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> loop.call_later(delay, callback, lc)
pt = zaggregator.ProcTable()
for n in pt.get_bundle_names():
b = pt.get_bundle_by_name(n)
sqlite.add_record(
(
b.bundle_name,
b.get_memory_info_rss(),
b.get_memory_i... | code_fim | medium | {
"lang": "python",
"repo": "skyeng/zaggregator",
"path": "/zaggregator/daemon.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skyeng/zaggregator path: /zaggregator/daemon.py
import asyncio
import sys, os
import zaggregator
import time
import setproctitle
from zaggregator import sqlite
if len(sys.argv) > 1:
pidfile = sys.argv[1]
with open(pidfile, "w") as fd:
fd.write(str(os.getpid()))
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "skyeng/zaggregator",
"path": "/zaggregator/daemon.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lkuligin/Cirq path: /cirq/protocols/channel.py
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licen... | code_fim | hard | {
"lang": "python",
"repo": "lkuligin/Cirq",
"path": "/cirq/protocols/channel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> unitary_getter = getattr(val, '_unitary_', None)
unitary_result = (
NotImplemented if unitary_getter is None else unitary_getter())
if unitary_result is not NotImplemented:
return (unitary_result,)
if default is not RaiseTypeErrorIfNotProvided:
return default
... | code_fim | hard | {
"lang": "python",
"repo": "lkuligin/Cirq",
"path": "/cirq/protocols/channel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: panoramichq/panoramic-cli path: /src/panoramic/cli/husky/core/tel/helper.py
from collections import namedtuple
from typing import Any, List, Optional
from panoramic.cli.husky.core.tel.visitors.terminal_visitor import TelTerminalVisitor
from panoramic.cli.tel_grammar.TelParser import TelParser as... | code_fim | hard | {
"lang": "python",
"repo": "panoramichq/panoramic-cli",
"path": "/src/panoramic/cli/husky/core/tel/helper.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.