text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: laitalaj/cvpce path: /cvpce/cli/dihe.py
from ray.tune.schedulers import ASHAScheduler
from torch import multiprocessing as mp
from .. import classification_training, classification_eval, datautils, production, utils
from ..defaults import (GP_TRAIN_FOLDERS, GP_TEST_DIR, GP_ANN_DIR, GP_TEST_VALID... | code_fim | hard | {
"lang": "python",
"repo": "laitalaj/cvpce",
"path": "/cvpce/cli/dihe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: laitalaj/cvpce path: /cvpce/cli/dihe.py
training and evaluation.
This command group contains functionality related to the Domain Invariant Hierarchial Embedding (DIHE)
of Tonioni et al. (2019).
It especially includes functions for training a DIHE, evaluating retail product classific... | code_fim | hard | {
"lang": "python",
"repo": "laitalaj/cvpce",
"path": "/cvpce/cli/dihe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> only_list = None
skip_list = None
if only == 'test':
skip_list = GP_TEST_VALIDATION_SET_SIZE
elif only == 'val':
only_list = GP_TEST_VALIDATION_SET_SIZE
testset = datautils.GroceryProductsTestSet(test_imgs, annotations, only=only_list, skip=skip_list)
if model == '... | code_fim | hard | {
"lang": "python",
"repo": "laitalaj/cvpce",
"path": "/cvpce/cli/dihe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Create widget with checkbox for each layer.
Returns:
widgets.VBox: widget
"""
checkboxes = []
pgons_checkboxes = []
graph_checkboxes = []
graphs = [
(name, "graphs", layer_subtype, graph)
for name, graph in se... | code_fim | hard | {
"lang": "python",
"repo": "ai4er-cdt/geograph",
"path": "/geograph/visualisation/control_widgets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ai4er-cdt/geograph path: /geograph/visualisation/control_widgets.py
er=self.viewer,
)
view_disconnected_nodes_btn = LayerButtonWidget(
description="Disconnected patches",
tooltip="View disconnected patches (patches with no edge)",
icon="exclamat... | code_fim | hard | {
"lang": "python",
"repo": "ai4er-cdt/geograph",
"path": "/geograph/visualisation/control_widgets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ai4er-cdt/geograph path: /geograph/visualisation/control_widgets.py
idgets.link((radio_buttons, "value"), (self.viewer, viewer_attr))
return radio_buttons
def create_visibility_buttons(self) -> widgets.Box:
"""Create buttons that toggle the visibility of current graph and ma... | code_fim | hard | {
"lang": "python",
"repo": "ai4er-cdt/geograph",
"path": "/geograph/visualisation/control_widgets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZwodahS/LD45-SquareWorld path: /assets/process_json.py
#!/usr/bin/env python3
import json
import sys
if len(sys.argv) == 1:
print("[0] [name] [out]".format(sys.argv[0]))
sys.exit(0)
with open(sys.argv[1]) as f:
data = json.loads(f.read())
frame_tags = data["meta"]["frameTags"]
de... | code_fim | hard | {
"lang": "python",
"repo": "ZwodahS/LD45-SquareWorld",
"path": "/assets/process_json.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(definition) != frame_len:
raise Exception("Frame Length is not the same as Definitions.")
ind = 0
for i in range(frame_tag["from"], frame_tag["to"]+1):
d = frames[i]
processed_frames[definition[ind]] = {
"x": d["frame"]["x... | code_fim | hard | {
"lang": "python",
"repo": "ZwodahS/LD45-SquareWorld",
"path": "/assets/process_json.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qtothec/pyomo path: /examples/pyomo/connectors/network_flow_proposed.py
# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms... | code_fim | hard | {
"lang": "python",
"repo": "qtothec/pyomo",
"path": "/examples/pyomo/connectors/network_flow_proposed.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>model.friction = Param( within=NonNegativeReals )
model.pipe_links = Param( model.PIPES, RangeSet(2) )
model.pipes = Block( model.PIPES, rule=pipe_rule )
model.nodes = Block( model.NODES, rule=node_rule )
# Connect the network
model.network_src = Constraint(model.PIPES, rule=_src_rule)
model.networ... | code_fim | hard | {
"lang": "python",
"repo": "qtothec/pyomo",
"path": "/examples/pyomo/connectors/network_flow_proposed.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CLARIAH/wp4-inspector path: /src/app/config_template.py
# -*- coding: utf-8 -*-
import os
# Copy this file to<|fim_suffix|> os.getenv('ENDPOINT_URL') or'<URL OF SPARQL ENDPOINT>'<|fim_middle|> 'config.py' and make necessary changes for your local setup.
# SPARQL Endpoint Configuration
ENDPOINT_U... | code_fim | medium | {
"lang": "python",
"repo": "CLARIAH/wp4-inspector",
"path": "/src/app/config_template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> setup.
# SPARQL Endpoint Configuration
ENDPOINT_URL = os.getenv('ENDPOINT_URL') or'<URL OF SPARQL ENDPOINT>'<|fim_prefix|># repo: CLARIAH/wp4-inspector path: /src/app/config_template.py
# -*- coding: utf-8 -*-
import os
# Copy this file to<|fim_middle|> 'config.py' and make necessary changes for your l... | code_fim | easy | {
"lang": "python",
"repo": "CLARIAH/wp4-inspector",
"path": "/src/app/config_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WGBH/django-curated-content path: /curated_content/migrations/0001_initial.py
# Generated by Django 2.1.7 on 2019-02-13 15:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
<|fim_suffix|> operations = [
... | code_fim | hard | {
"lang": "python",
"repo": "WGBH/django-curated-content",
"path": "/curated_content/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='CuratedContentBlock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200, verbose_name='Title'... | code_fim | hard | {
"lang": "python",
"repo": "WGBH/django-curated-content",
"path": "/curated_content/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def sentence_score(
self,
reference: str,
hypothesis: str,
mode: str = 'N',
n: int = 1) -> float:
"""Sentece ROUGE metrics.
Args:
reference (str): reference sentence.
hypothesis: (str): hypothesis sent... | code_fim | hard | {
"lang": "python",
"repo": "katsugeneration/tf2-ndg-benchmarks",
"path": "/tf2_ndg_benckmarks/metrics/rouge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: katsugeneration/tf2-ndg-benchmarks path: /tf2_ndg_benckmarks/metrics/rouge.py
"""
Copyright:
Copyright 2019 by Katsuya SHIMABUKURO.
License:
MIT, see LICENSE for details.
"""
from tf2_ndg_benckmarks.metrics.utils import ngram
class Rouge(object):
"""ROUGE score calculator."""
d... | code_fim | hard | {
"lang": "python",
"repo": "katsugeneration/tf2-ndg-benchmarks",
"path": "/tf2_ndg_benckmarks/metrics/rouge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(N):
LCS.append([0] * M)
for i in range(1, N):
for j in range(1, M):
if words_ref[i - 1] == words_hyp[j - 1]:
LCS[i][j] = LCS[i - 1][j - 1] + 1
else:
LCS[i][j] = max(LCS[i - 1][j]... | code_fim | hard | {
"lang": "python",
"repo": "katsugeneration/tf2-ndg-benchmarks",
"path": "/tf2_ndg_benckmarks/metrics/rouge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def root_dir():
"""
Returns parent directory location
"""
return Path(__file__).parent.parent<|fim_prefix|># repo: rdmorgnzation/soilbearing path: /blcalc/__init__.py
"""
Default exported functions
"""
<|fim_middle|>from pathlib import Path
| code_fim | easy | {
"lang": "python",
"repo": "rdmorgnzation/soilbearing",
"path": "/blcalc/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdmorgnzation/soilbearing path: /blcalc/__init__.py
"""
Default exported functions
"""
<|fim_suffix|> """
Returns parent directory location
"""
return Path(__file__).parent.parent<|fim_middle|>from pathlib import Path
def root_dir():
| code_fim | easy | {
"lang": "python",
"repo": "rdmorgnzation/soilbearing",
"path": "/blcalc/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdmorgnzation/soilbearing path: /blcalc/__init__.py
"""
Default exported functions
"""
from pathlib import Path
<|fim_suffix|> """
Returns parent directory location
"""
return Path(__file__).parent.parent<|fim_middle|>def root_dir():
| code_fim | easy | {
"lang": "python",
"repo": "rdmorgnzation/soilbearing",
"path": "/blcalc/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def cell2html(cell):
pawn_html = ""
if(cell.isOccupied()):
pawn_html = WebController.cell2html(cell.pawn)
return ("<td class=%s, row=%s, col=%s>%s</td>" %
(type(cell).__name__, pawn_html,
cell.position[1], cell.posi... | code_fim | hard | {
"lang": "python",
"repo": "antoine-sachet/thekingsescape",
"path": "/thekingsescape/webcontroller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antoine-sachet/thekingsescape path: /thekingsescape/webcontroller.py
from .game.player import Player
from .game.game import Game
from .web_app.app import app
from bottle import run
class WebController():
<|fim_suffix|> for cell in row:
yield(WebController.cell2ht... | code_fim | hard | {
"lang": "python",
"repo": "antoine-sachet/thekingsescape",
"path": "/thekingsescape/webcontroller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yantijin/docset-tensorflow-2.0 path: /md2html.py
# -*- coding: utf-8
import markdown
import os
import sys
# reload(sys)
# sys.setdefaultencoding('utf8')
def md2html(mdstr, k):
exts = ['markdown.extensions.extra', 'markdown.extensions.codehilite','markdown.extensions.tables','markdown.exten... | code_fim | hard | {
"lang": "python",
"repo": "yantijin/docset-tensorflow-2.0",
"path": "/md2html.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
# if len(sys.argv) < 3:
# print('usage: md2html source_filename target_file')
# sys.exit()
names = getName()
print(names)
for name in names:
name2 = name[:-2] + 'html'
k=-1
for i in range(len(name)):
if name[i]... | code_fim | hard | {
"lang": "python",
"repo": "yantijin/docset-tensorflow-2.0",
"path": "/md2html.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kudesnick/stc_diyclock path: /post_extra_script.py
''' custom script for platformio '''
from os.path import join
from SCons.Script import DefaultEnvironment
<|fim_suffix|># compiler and linker flags dont work very well in build_flags of platformio.ini - need to set them here
env.Append(
CFL... | code_fim | medium | {
"lang": "python",
"repo": "Kudesnick/stc_diyclock",
"path": "/post_extra_script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#print "post_extra_script running..."
#print env.Dump()
# compiler and linker flags dont work very well in build_flags of platformio.ini - need to set them here
env.Append(
CFLAGS = [
"--disable-warning", 126,
"--disable-warning", 59
],
LINKFLAGS = [
"--data-loc", 0x30
]
)... | code_fim | easy | {
"lang": "python",
"repo": "Kudesnick/stc_diyclock",
"path": "/post_extra_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def contains_field(field, PASSPORT):
return f"{field}:" in PASSPORT
def is_valid(passport):
#contains_field = list(map((get_trees_for_slope), inputs))
#total = reduce((lambda x,y: x * y), trees_per_slope)
results = [contains_field(f, passport) for f in FIELDS]
is_valid = (not (Fals... | code_fim | medium | {
"lang": "python",
"repo": "nostyleguy/advent_of_code_2020",
"path": "/Day4/d4p1-passport-processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
input = get_input("input.txt")
#for passport in input:
# print(f"{bcolors.OKCYAN}Passport:{bcolors.ENDC} {passport}Contains Fields: {str(is_valid(passport))}{nl}{nl}")
valid_passports = [p for p in input if (is_valid(p) == True)]
invalid_passports = [p for p i... | code_fim | hard | {
"lang": "python",
"repo": "nostyleguy/advent_of_code_2020",
"path": "/Day4/d4p1-passport-processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nostyleguy/advent_of_code_2020 path: /Day4/d4p1-passport-processing.py
import re
nl = '\n'
class bcolors:
MAGENTA = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
... | code_fim | hard | {
"lang": "python",
"repo": "nostyleguy/advent_of_code_2020",
"path": "/Day4/d4p1-passport-processing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> unit = ''
if value < 1024:
unit = ''
else:
value /= 1024
if value < 1024:
unit = 'k'
else:
value /= 1024
if value < 1024:
unit = 'M'
else:
value /= 1024
unit = 'G'... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderToifl/RIV",
"path": "/src/myPyCommon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexanderToifl/RIV path: /src/myPyCommon.py
me
import time
import os
import commands
import pickle
import subprocess
from subprocess import Popen, list2cmdline
import zlib
#
kb = 1.38066e-23 # J/K
q0 = 1.60218e-19 # C
#########################################################################... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderToifl/RIV",
"path": "/src/myPyCommon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexanderToifl/RIV path: /src/myPyCommon.py
printWarning('Enviroment variable %s does not exist' %name)
return ''
###############################################################################
def getTimeString(toffset = 0, timepoint = None):
currenttime = time.time()
if tim... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderToifl/RIV",
"path": "/src/myPyCommon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def keygen(cls, device, **kwargs):
"""Generate the cache key from device and attributes."""
key = '%s/%s' % (cls.__name__, device)
for v in kwargs.values():
key += '/' + str(v)
return key
def creator(cls, cache_key, device, *... | code_fim | hard | {
"lang": "python",
"repo": "ORG-MARS/dragon",
"path": "/torch/core/autograd/function.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ORG-MARS/dragon path: /torch/core/autograd/function.py
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the softw... | code_fim | hard | {
"lang": "python",
"repo": "ORG-MARS/dragon",
"path": "/torch/core/autograd/function.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>= 3:
l64i = ((l64[:, :, 0] << 2 * w) + (l64[:, :, 1] << w) + l64[:, :, 2])
else:
l64i = l64
colors = np.unique(l64i)
segmentations = []
colors_all = []
for c in colors:
if c != 0:
segmentation = (l64i == c).astype('uint8')
segmentations.a... | code_fim | medium | {
"lang": "python",
"repo": "Khoa-NT/rec-attend-public",
"path": "/data_api/sep_labels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Khoa-NT/rec-attend-public path: /data_api/sep_labels.py
import numpy as np
def get_separate_labels(label_img):
# 64-bit encoding
dtype = label_img.dtype
if dtype == np.uint8:
w = 8
elif dtype == np.uint16:
w = 16
eli<|fim_suffix|>colors:
if c != 0:
... | code_fim | hard | {
"lang": "python",
"repo": "Khoa-NT/rec-attend-public",
"path": "/data_api/sep_labels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not random_grid:
self._grid = GridSearchCV(self._pipe,
param_grid=self._params,
n_jobs=self._n_jobs,
cv=self._nfolds,
verbose=False)
... | code_fim | hard | {
"lang": "python",
"repo": "conradbm/streamml2",
"path": "/streamml2/streamline/model_selection/models/AbstractRegressorPredictiveModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conradbm/streamml2 path: /streamml2/streamline/model_selection/models/AbstractRegressorPredictiveModel.py
import sys
import os
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import r2_score
from sklearn.metrics import... | code_fim | hard | {
"lang": "python",
"repo": "conradbm/streamml2",
"path": "/streamml2/streamline/model_selection/models/AbstractRegressorPredictiveModel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == 'POST':
data = request.form['data']
if data:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1)
s.connect((HOST,PORT))
s.sendall(data)
s.sendall("\n")
s.close()
a... | code_fim | medium | {
"lang": "python",
"repo": "v0d0r/gproxy",
"path": "/gproxy.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> @wraps(f)
def decorated(*args, **kwargs):
auth = request.authorization
if not auth or not check_auth(auth.username, auth.password):
return authenticate()
return f(*args, **kwargs)
return decorated
app = Flask(__name__)
app.config.from_object(__name__)
HOST... | code_fim | medium | {
"lang": "python",
"repo": "v0d0r/gproxy",
"path": "/gproxy.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: v0d0r/gproxy path: /gproxy.py
#!/usr/bin/python
from flask import Flask, request, abort
from flup.server.fcgi import WSGIServer
import socket
from functools import wraps
from flask import request, Response
import logging
<|fim_suffix|>@app.route('/upload', methods = ['POST'])
@requires_auth
def ... | code_fim | hard | {
"lang": "python",
"repo": "v0d0r/gproxy",
"path": "/gproxy.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KlubJagiellonski/pola-backend path: /pola/logic_bot_report.py
from pola.report.models import Report
def create_bot_report(product, description, check_if_already_exists=False):
<|fim_suffix|> report = Report(description=description)
report.product = product
report.client = 'krs-bot'
... | code_fim | medium | {
"lang": "python",
"repo": "KlubJagiellonski/pola-backend",
"path": "/pola/logic_bot_report.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> report = Report(description=description)
report.product = product
report.client = 'krs-bot'
report.save()<|fim_prefix|># repo: KlubJagiellonski/pola-backend path: /pola/logic_bot_report.py
from pola.report.models import Report
def create_bot_report(product, description, check_if_already... | code_fim | medium | {
"lang": "python",
"repo": "KlubJagiellonski/pola-backend",
"path": "/pola/logic_bot_report.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> model_config_path = model_directory / (model_name + ".json")
if not model_config_path.is_file() or not model_config_path.exists():
raise FileNotFoundError("Model config file must be named the same as its parent directory and must exist")
with open(model_config_path, "r") as fp:
... | code_fim | medium | {
"lang": "python",
"repo": "aethersis/VisualEyeTracker",
"path": "/models/model_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if model_type == "resnet":
model = ResNetModel()
elif model_type == "vgg":
model = VggModel()
else:
raise ValueError(f"Invalid model type {model_type}")
model.load(model_directory, model_name)
return model<|fim_prefix|># repo: aethersis/VisualEyeTracker path: ... | code_fim | hard | {
"lang": "python",
"repo": "aethersis/VisualEyeTracker",
"path": "/models/model_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aethersis/VisualEyeTracker path: /models/model_factory.py
import json
from pathlib import Path
from models.detection_model import DetectionModel
from models.vgg_model import VggModel
from models.resnet_model import ResNetModel
def load_model_from_directory(model_directory: Path) -> DetectionMo... | code_fim | hard | {
"lang": "python",
"repo": "aethersis/VisualEyeTracker",
"path": "/models/model_factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns 1 if model selection error is less than or equal to prob rate,
0 else.
NOTE: why does np.nonzero/np.flatnonzero create so much problems?
"""
m_nz = np.flatnonzero(np.triu(m, 1))
m_hat_nz = np.flatnonzero(np.triu(m_hat, 1))
upper_diagonal_mask = np.flatnonzero(np.tr... | code_fim | hard | {
"lang": "python",
"repo": "skggm/skggm",
"path": "/inverse_covariance/profiling/metrics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skggm/skggm path: /inverse_covariance/profiling/metrics.py
import numpy as np
def _nonzero_intersection(m, m_hat):
"""Count the number of nonzeros in and between m and m_hat.
Returns
----------
m_nnz : number of nonzeros in m (w/o diagonal)
m_hat_nnz : number of nonzeros ... | code_fim | hard | {
"lang": "python",
"repo": "skggm/skggm",
"path": "/inverse_covariance/profiling/metrics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,):
_MANICURIST.__init__(self)
self.name = "MANICURISTS"
self.specie = 'nouns'
self.basic = "manicurist"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_manicurists.py
from xai.brain.wordbase.nouns._manicurist import _MANICURIST
<|fim_... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_manicurists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_manicurists.py
from xai.brain.wordbase.nouns._manicurist import _MANICURIST
<|fim_suffix|> def __init__(self,):
_MANICURIST.__init__(self)
self.name = "MANICURISTS"
self.specie = 'nouns'
self.basic = "manicurist"
self.jsondata = {}<|fim_... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_manicurists.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _MANICURIST.__init__(self)
self.name = "MANICURISTS"
self.specie = 'nouns'
self.basic = "manicurist"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_manicurists.py
from xai.brain.wordbase.nouns._manicurist import _MANICURIST
<|fim_middle|>#calss header
c... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_manicurists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Add v2 routes
from kuas_api.views.v2.utils import routes as utils_routes
from kuas_api.views.v2.ap import routes as ap_routes
from kuas_api.views.v2.bus import routes as bus_routes
from kuas_api.views.v2.leave import routes as leave_routes
from kuas_api.views.v2.notifications import routes as notificat... | code_fim | hard | {
"lang": "python",
"repo": "Xmax1231/AP-API",
"path": "/src/kuas_api/views/v2/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xmax1231/AP-API path: /src/kuas_api/views/v2/__init__.py
from flask_apiblueprint import APIBlueprint
from kuas_api.modules.json import jsonify
from .doc import auto
# Create v2 blueprint
api_v2 = APIBlueprint(
'api_v2', __name__,
subdomain='',
url_prefix='/v2')
def get_git_revision... | code_fim | hard | {
"lang": "python",
"repo": "Xmax1231/AP-API",
"path": "/src/kuas_api/views/v2/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Dirty from #593
routes = (
utils_routes +
ap_routes +
bus_routes +
leave_routes +
notifications_routes
)
for r in routes:
endpoint = r["options"].pop("endpoint", None)
api_v2.add_url_rule(
r["rule"],
endpoint,
r["view_func"],
**r["options"]
... | code_fim | hard | {
"lang": "python",
"repo": "Xmax1231/AP-API",
"path": "/src/kuas_api/views/v2/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = re.sub(IMAGE_MATCH, _handle_image, s)
s = re.sub(UPLOADS_MATCH, app.config["UPLOADS_URL"]+"/", s)
return s
def _handle_image(s):
file_name = s.groups(1)[1]
uploads_url = app.config["UPLOADS_URL"]
return "%s/%s" % (uploads_url, file_name)<|fim_prefix|># repo: marteinn/AtomicPr... | code_fim | hard | {
"lang": "python",
"repo": "marteinn/AtomicPress",
"path": "/atomicpress/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marteinn/AtomicPress path: /atomicpress/filters.py
# -*- coding: utf-8 -*-
import re
import requests
import markdown
from app import app
IMAGE_MATCH = re.compile("\[(image|img).src=\"(.*?)\"\]",
re.MULTILINE | re.DOTALL)
UPLOADS_MATCH = re.compile("\[uploads\]")
GIST... | code_fim | hard | {
"lang": "python",
"repo": "marteinn/AtomicPress",
"path": "/atomicpress/filters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Load data for backend rendering (and seo)
if app.config["GIST_BACKEND_RENDERING"]:
if gist_id not in _gist_cache:
result = requests.get("https://api.github.com/gists/%s" % gist_id,
timeout=30)
gist = result.json()
fo... | code_fim | hard | {
"lang": "python",
"repo": "marteinn/AtomicPress",
"path": "/atomicpress/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nvsnvyu/hikyuu path: /fenge.py
#!/usr/bin/python
# -*- coding: utf8 -*-
# cp936
import tables
class FiveMinDataRecordH5File(tables.IsDescription):
datetime = tables.UInt64Col() #IGNORE:E1101
openPrice = tables.UInt32Col() #IGNORE:E1101
highPrice = tables.UInt32Col() ... | code_fim | hard | {
"lang": "python",
"repo": "nvsnvyu/hikyuu",
"path": "/fenge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> src_hdf5.close()
dest_hdf5.close()
if __name__ == "__main__":
import time
starttime = time.time()
year_list = [2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011]
# month_list = [1,2,3,4,5,6,7,8,9,10,11,12]
for year in year_list:
src_file_name = 'd:\\s... | code_fim | hard | {
"lang": "python",
"repo": "nvsnvyu/hikyuu",
"path": "/fenge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
import time
starttime = time.time()
year_list = [2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011]
# month_list = [1,2,3,4,5,6,7,8,9,10,11,12]
for year in year_list:
src_file_name = 'd:\\stock\\sz_1min.h5'
dest_file_name = "d:\\... | code_fim | medium | {
"lang": "python",
"repo": "nvsnvyu/hikyuu",
"path": "/fenge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def record_visitors(addr):
global visitors_record
visitors_record[addr] += 1
return visitors_record
def hit_count():
"""
Count server hits.
"""
global hit
hit += 1
return hit<|fim_prefix|># repo: BrandoZhang/cc_flask_demo path: /src/utils.py
import socket
from collec... | code_fim | medium | {
"lang": "python",
"repo": "BrandoZhang/cc_flask_demo",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Count server hits.
"""
global hit
hit += 1
return hit<|fim_prefix|># repo: BrandoZhang/cc_flask_demo path: /src/utils.py
import socket
from collections import defaultdict
hit = 0
visitors_record = defaultdict(int)
def get_hostname():
return socket.gethostname()
def get_... | code_fim | medium | {
"lang": "python",
"repo": "BrandoZhang/cc_flask_demo",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BrandoZhang/cc_flask_demo path: /src/utils.py
import socket
from collections import defaultdict
hit = 0
visitors_record = defaultdict(int)
def get_hostname():
return socket.gethostname()
<|fim_suffix|> return socket.gethostbyname(socket.gethostname())
def record_visitors(addr):
glo... | code_fim | easy | {
"lang": "python",
"repo": "BrandoZhang/cc_flask_demo",
"path": "/src/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setNoteData(self, noteDataDict):
self.spectrumNote.set_from_dict(noteDataDict)
def loadReferenceComposition(self, referenceComposition):
self.referenceComposition = copy.deepcopy(referenceComposition)
# _reference_composition = [
# [ 1, 0.9204 , 'H' , 'Hydroge... | code_fim | hard | {
"lang": "python",
"repo": "RozanskiT/HANDY",
"path": "/normAppLogic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def normSpectrum(self):
sep = 1
w,f = self.fitFunctionToRegions(separation = sep)
# Insert special points before interpolation
absolutePoints = self.continuumRegionsLogic.getAbsolutePoints(self.spectrum)
for x,y in absolutePoints:
idx = np.searchsor... | code_fim | hard | {
"lang": "python",
"repo": "RozanskiT/HANDY",
"path": "/normAppLogic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RozanskiT/HANDY path: /normAppLogic.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, sys
import numpy as np
import pandas as pd
import copy
from scipy.interpolate import Akima1DInterpolator
import matplotlib.pyplot as plt
from PyAstronomy import pyasl
import spectrum as sp
import regionL... | code_fim | hard | {
"lang": "python",
"repo": "RozanskiT/HANDY",
"path": "/normAppLogic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baverman/supp path: /supp/server.py
import sys
import os.path
import logging
logger = logging.getLogger('server')
try:
import supp
except ImportError:
old_path = sys.path[:]
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
try:
import supp
finally:
... | code_fim | hard | {
"lang": "python",
"repo": "baverman/supp",
"path": "/supp/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.project.check_changes():
return assistant.location(self.project, nstr(source), tuple(position), filename)
def lint(self, source, filename, syntax_only=False):
with self.project.check_changes():
return [r[:4] for r in linter.lint(self.project, nstr(sou... | code_fim | hard | {
"lang": "python",
"repo": "baverman/supp",
"path": "/supp/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pandas-dev/pandas path: /pandas/core/_numba/kernels/__init__.py
from pandas.core._numba.kernels.mean_ import (
grouped_mean,
sliding_mean,
)
from pandas.core._numba.kernels.min_max_ import (
grouped_min_max,
sliding_min_max,
)
from pandas.core._numba.kernels.sum_ import (
grou... | code_fim | medium | {
"lang": "python",
"repo": "pandas-dev/pandas",
"path": "/pandas/core/_numba/kernels/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>mean",
"sliding_sum",
"grouped_sum",
"sliding_var",
"grouped_var",
"sliding_min_max",
"grouped_min_max",
]<|fim_prefix|># repo: pandas-dev/pandas path: /pandas/core/_numba/kernels/__init__.py
from pandas.core._numba.kernels.mean_ import (
grouped_mean,
sliding_mean,
)
from... | code_fim | medium | {
"lang": "python",
"repo": "pandas-dev/pandas",
"path": "/pandas/core/_numba/kernels/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pistarlab/pistarlab path: /pistarlab/extensions/pistarlab-rllib/pistarlab_rllib/ac_trainer.py
import math
from ray.rllib.agents.a3c.a3c import DEFAULT_CONFIG as A3C_CONFIG, \
validate_config, get_policy_class
from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy
from ray.rllib.agents.tr... | code_fim | medium | {
"lang": "python",
"repo": "pistarlab/pistarlab",
"path": "/pistarlab/extensions/pistarlab-rllib/pistarlab_rllib/ac_trainer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> rollouts = ParallelRollouts(workers, mode="bulk_sync")
if config["microbatch_size"]:
num_microbatches = math.ceil(
config["train_batch_size"] / config["microbatch_size"])
# In microbatch mode, we want to compute gradients on experience
# microbatches, average a... | code_fim | medium | {
"lang": "python",
"repo": "pistarlab/pistarlab",
"path": "/pistarlab/extensions/pistarlab-rllib/pistarlab_rllib/ac_trainer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gruenstreifen-eV/BSFrance-stm32 path: /stm32/tools/script/generate_build_define.py
ath
from os import listdir
import sys
import re
cubemx_dir = 'D:\programs\STM32Cube\STM32CubeMX'
stm32_dir = '../../STM32/cores/arduino/stm32/'
system_dir = '../../STM32/system/'
header_lines = []
with open(syst... | code_fim | hard | {
"lang": "python",
"repo": "Gruenstreifen-eV/BSFrance-stm32",
"path": "/stm32/tools/script/generate_build_define.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for pin in self.mcu_pins:
pin_name = pin.attrib['Name']
pin_name = re.search('^(\D*\d*)', pin_name).group(1)
self.pins.append(pin_name)
if not pin.attrib['Type'] == 'I/O':
continue
... | code_fim | hard | {
"lang": "python",
"repo": "Gruenstreifen-eV/BSFrance-stm32",
"path": "/stm32/tools/script/generate_build_define.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> source_code += ' {' + periph.ljust(6) + ', HAL_RCC_GetPCLK1Freq }, \n'
source_code += '\n'
for periph in sorted(self.PCLK2_PERIPHERALS):
if not periph.startswith('USART') and not periph.startswith('SPI') and not periph.startswith('I2C'):
... | code_fim | hard | {
"lang": "python",
"repo": "Gruenstreifen-eV/BSFrance-stm32",
"path": "/stm32/tools/script/generate_build_define.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: njoubert/UndergraduateProjects path: /ShakaPlayer/trunk/vendor/pyglet-1.1.3/tests/window/WINDOW_SET_ICON_SIZES.py
#!/usr/bin/env python
'''Test that window icon can be set for multiple sizes.
Expected behaviour:
One window will be opened. The window's icon depends on the icon
size:
<|... | code_fim | hard | {
"lang": "python",
"repo": "njoubert/UndergraduateProjects",
"path": "/ShakaPlayer/trunk/vendor/pyglet-1.1.3/tests/window/WINDOW_SET_ICON_SIZES.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_set_icon_sizes(self):
self.width, self.height = 200, 200
self.w = w = window.Window(self.width, self.height)
w.set_icon(image.load(icon_file1),
image.load(icon_file2),
image.load(icon_file3),
image.load(icon_file... | code_fim | hard | {
"lang": "python",
"repo": "njoubert/UndergraduateProjects",
"path": "/ShakaPlayer/trunk/vendor/pyglet-1.1.3/tests/window/WINDOW_SET_ICON_SIZES.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for ff in argv[1:]:
p = admit.Project(ff,commit=False)
p.mergeFlow(False)
p.setAstale(False,True,True)<|fim_prefix|># repo: astroumd/admit path: /bin/admit_stale
#! /usr/bin/env casarun
# -*- python -*-
#
# python system modules
import sys, os, math
#
import admit
import admit.util.utils a... | code_fim | easy | {
"lang": "python",
"repo": "astroumd/admit",
"path": "/bin/admit_stale",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astroumd/admit path: /bin/admit_stale
#! /usr/bin/env casarun
# -*- python -*-
#
# python system modules
import sys, os, math
#
import admit
import admit.util.utils as utils
<|fim_suffix|>verbose = True
dryrun = True
for ff in argv[1:]:
p = admit.Project(ff,commit=False)
p.mergeFlow(... | code_fim | easy | {
"lang": "python",
"repo": "astroumd/admit",
"path": "/bin/admit_stale",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plot_t = tar_t - ot - sperseg / 2
plot_t = np.append(plot_t, plot_t[-1] + sperseg / 2)
plot_f = f - (f[1] - f[0]) / 2
plot_f = np.append(plot_f, plot_f[-1] + (f[1] - f[0]))
img = ax1.pcolormesh(
plot_t, plo... | code_fim | hard | {
"lang": "python",
"repo": "yunndlalala/dynamic_earthquake_triggering",
"path": "/dyntripy/plot_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> t = np.full(len(t), starttime) + t
tb_index = np.where((t >= tb_b) & (t <= tb_e))[0]
te_index = np.where((t >= te_b) & (t <= te_e))[0]
tb_pxx_all = pxx_all[:, tb_index]
te_pxx_all = pxx_all[:, te_index]
gf_lis... | code_fim | hard | {
"lang": "python",
"repo": "yunndlalala/dynamic_earthquake_triggering",
"path": "/dyntripy/plot_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yunndlalala/dynamic_earthquake_triggering path: /dyntripy/plot_utils.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: yunnaidan
@time: 2020/08/09
@file: plot_utils.py
"""
import os
import obspy as ob
import numpy as np
from scipy import stats
from scipy.signal import spectrogram
impo... | code_fim | hard | {
"lang": "python",
"repo": "yunndlalala/dynamic_earthquake_triggering",
"path": "/dyntripy/plot_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: viaict/viaduct path: /migrations/versions/2018_09_19_7135c4a2339e_remove_user_column_from_examination_.py
"""Remove user column from examination table.
Revision ID: 7135c4a2339e
Revises: 6aff43ad8f2a
Create Date: 2018-09-19 21:22:56.309265
"""
from alembic import op
import sqlalchemy as sa
fr... | code_fim | medium | {
"lang": "python",
"repo": "viaict/viaduct",
"path": "/migrations/versions/2018_09_19_7135c4a2339e_remove_user_column_from_examination_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Base = declarative_base()
db = sa
db.Model = Base
db.relationship = relationship
def create_session():
connection = op.get_bind()
session_maker = sa.orm.sessionmaker()
session = session_maker(bind=connection)
db.session = session
def upgrade():
create_session()
# ### commands ... | code_fim | hard | {
"lang": "python",
"repo": "viaict/viaduct",
"path": "/migrations/versions/2018_09_19_7135c4a2339e_remove_user_column_from_examination_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythoneyron/EmployeeBase path: /src/apps/accounts/api/serializers.py
# -*- coding: utf-8 -*-
from rest_framework import serializers
from apps.accounts.models import User
<|fim_suffix|> model = User
fields = ('id', 'get_full_name', 'get_age', 'get_company', 'position',
... | code_fim | medium | {
"lang": "python",
"repo": "pythoneyron/EmployeeBase",
"path": "/src/apps/accounts/api/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserSerializers(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'get_full_name', 'get_age', 'get_company', 'position',
'get_section', 'start_date', 'end_date', 'get_status')<|fim_prefix|># repo: pythoneyron/EmployeeBase path: /src/apps/ac... | code_fim | easy | {
"lang": "python",
"repo": "pythoneyron/EmployeeBase",
"path": "/src/apps/accounts/api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jimmyjtc001/indoorair-webapp-b path: /indoorair/report/urls.py
from django.urls import path
<|fim_suffix|>urlpatterns = [
path('report_list',views.report_list_page, name = 'report_list_page'),
path('report_01',views.report_01_page, name = 'report_01_page'),
]<|fim_middle|>from . import views
| code_fim | easy | {
"lang": "python",
"repo": "Jimmyjtc001/indoorair-webapp-b",
"path": "/indoorair/report/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('report_list',views.report_list_page, name = 'report_list_page'),
path('report_01',views.report_01_page, name = 'report_01_page'),
]<|fim_prefix|># repo: Jimmyjtc001/indoorair-webapp-b path: /indoorair/report/urls.py
from django.urls import path
<|fim_middle|>from . import views
| code_fim | easy | {
"lang": "python",
"repo": "Jimmyjtc001/indoorair-webapp-b",
"path": "/indoorair/report/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: podhmo/jqfpy path: /jqfpy/langhelpers.py
# stolen from pyramid
class reify(object):
<|fim_suffix|> def __get__(self, inst, objtype=None):
if inst is None:
return self
val = self.wrapped(inst)
setattr(inst, self.wrapped.__name__, val)
return val<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "podhmo/jqfpy",
"path": "/jqfpy/langhelpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.wrapped = wrapped
try:
self.__doc__ = wrapped.__doc__
except: # noqa
pass
def __get__(self, inst, objtype=None):
if inst is None:
return self
val = self.wrapped(inst)
setattr(inst, self.wrapped.__name__, val)
... | code_fim | medium | {
"lang": "python",
"repo": "podhmo/jqfpy",
"path": "/jqfpy/langhelpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if inst is None:
return self
val = self.wrapped(inst)
setattr(inst, self.wrapped.__name__, val)
return val<|fim_prefix|># repo: podhmo/jqfpy path: /jqfpy/langhelpers.py
# stolen from pyramid
class reify(object):
"""cached property"""
def __init__(self,... | code_fim | easy | {
"lang": "python",
"repo": "podhmo/jqfpy",
"path": "/jqfpy/langhelpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ctandon11/SmartSim path: /smartsim/launcher/step/__init__.py
from .alpsStep import AprunStep
from .cobaltStep import CobaltBatchStep
from .localStep import LocalStep
from<|fim_suffix|>ubBatchStep
from .slurmStep import SbatchStep, SrunStep<|fim_middle|> .mpirunStep import MpirunStep
from .pbsStep... | code_fim | easy | {
"lang": "python",
"repo": "ctandon11/SmartSim",
"path": "/smartsim/launcher/step/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ubBatchStep
from .slurmStep import SbatchStep, SrunStep<|fim_prefix|># repo: ctandon11/SmartSim path: /smartsim/launcher/step/__init__.py
from .alpsStep import AprunStep
from .cobaltStep import CobaltBatchStep
from .localStep import LocalStep
from<|fim_middle|> .mpirunStep import MpirunStep
from .pbsStep... | code_fim | easy | {
"lang": "python",
"repo": "ctandon11/SmartSim",
"path": "/smartsim/launcher/step/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> X_inputs = X;
SIGMA_inputs = T.zeros_like(X);
if layers > 1:
if Q > 1:
for i in range(0, order):
X_inputs = T.concatenate((X_inputs, MU[order - 1 - i:-i - 1,0][:,None]), axis=1)
... | code_fim | hard | {
"lang": "python",
"repo": "opaquezxd/DRGP-VSS",
"path": "/python_ip/DEEPvSSGP_model_SV2_IP.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_opt_A(self, sn_trf, EPhiTPhi, XT_EPhi, K_MM):
cholSigInv = sT.cholesky(EPhiTPhi + sn_trf * K_MM + 1e-6 * T.identity_like(K_MM))
cholK_MM = sT.cholesky(K_MM + 1e-6 * T.identity_like(K_MM))
invCholSigInv = sT.matrix_inverse(cholSigInv)
invCholK_MM = sT.matri... | code_fim | hard | {
"lang": "python",
"repo": "opaquezxd/DRGP-VSS",
"path": "/python_ip/DEEPvSSGP_model_SV2_IP.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opaquezxd/DRGP-VSS path: /python_ip/DEEPvSSGP_model_SV2_IP.py
('hyp', 'S', 'MU', 'SIGMA', 'U', 'b')
y, MEAN_MAP, sn, sf = T.dvectors('y','MEAN_MAP','sn','sf')
w = T.dscalars('w')
if Q > 1:
X = T.dmatrix('X')
else:
X = T.dvector('X') ... | code_fim | hard | {
"lang": "python",
"repo": "opaquezxd/DRGP-VSS",
"path": "/python_ip/DEEPvSSGP_model_SV2_IP.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('application_projects', '0043_remove_project_approval_form'),
]
operations = [
migrations.AlterField(
model_name='invoice',
name='status',
field=models.TextField(choices=[('submitted', 'Submitted'), ('changes_requested', 'C... | code_fim | medium | {
"lang": "python",
"repo": "ResetNetwork/apply-app",
"path": "/hypha/apply/projects/migrations/0044_add_resubmitted_status.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ResetNetwork/apply-app path: /hypha/apply/projects/migrations/0044_add_resubmitted_status.py
# Generated by Django 2.2.24 on 2021-12-07 20:18
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "ResetNetwork/apply-app",
"path": "/hypha/apply/projects/migrations/0044_add_resubmitted_status.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> word = string.split()
# sanity check
try:
if word[0] != 'sta' or word[6] != 'PT':
raise ValueError('Not a valid pick string')
except IndexError:
raise ValueError('Not a valid pick string')
self.station = word[1]
self.a... | code_fim | hard | {
"lang": "python",
"repo": "ResearchObject/workflow-run-crate",
"path": "/docs/examples/COMPSs/COMPSs_RO-Crate_62ac6a22-40f2-4af9-b65a-b68279ebe48e/application_sources/backtrackbb/bp_types.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ResearchObject/workflow-run-crate path: /docs/examples/COMPSs/COMPSs_RO-Crate_62ac6a22-40f2-4af9-b65a-b68279ebe48e/application_sources/backtrackbb/bp_types.py
# bp_types.py
# Data types for BackTrackBB
from __future__ import (absolute_import, division, print_function,
unic... | code_fim | hard | {
"lang": "python",
"repo": "ResearchObject/workflow-run-crate",
"path": "/docs/examples/COMPSs/COMPSs_RO-Crate_62ac6a22-40f2-4af9-b65a-b68279ebe48e/application_sources/backtrackbb/bp_types.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.