text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> menu = MenuController(**menu_args)
if 4 in menu_args['actions'] or 6 in menu_args['actions']:
self.stats['stats'].append({
"model": MODELS[model],
"history": menu.history,
"score": menu.scores,
"config": {
... | code_fim | hard | {
"lang": "python",
"repo": "AlessandroStaffolani/traffic-sign-recognition",
"path": "/src/controllers/MultipleRunController.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>####################################################################################
# Trainig loop
def train(args):
for epoch in range(args.n_epoch):
cnt = 0
for batch in args.ds:
cnt += 1
if cnt % (args.n_update_dis + 1) > 0:
train_step_dis(ar... | code_fim | hard | {
"lang": "python",
"repo": "library-of-code/deep-learning",
"path": "/generative_models/WGAN_TensorFlow/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.GradientTape() as tape:
z = tf.random.uniform([args.batch_size, args.noise_dim], -1.0, 1.0)
fake_sample = args.gen(z)
fake_score = args.dis(fake_sample)
loss = - tf.reduce_mean(fake_score)
gradients = tape.gradient(loss, args.gen.trainable_variables)
args.gen_opt.apply_gradients(zip(gra... | code_fim | hard | {
"lang": "python",
"repo": "library-of-code/deep-learning",
"path": "/generative_models/WGAN_TensorFlow/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: library-of-code/deep-learning path: /generative_models/WGAN_TensorFlow/train.py
from model import *
from utils import *
from dataloader import *
import argparse
import tensorflow as tf
import numpy as np
import datetime
##########################################################################... | code_fim | hard | {
"lang": "python",
"repo": "library-of-code/deep-learning",
"path": "/generative_models/WGAN_TensorFlow/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlflow/mlflow path: /examples/xgboost/xgboost_sklearn/train.py
from pprint import pprint
import xgboost as xgb
from sklearn.datasets import load_diabetes
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from utils import fetch_logged_data
impor... | code_fim | hard | {
"lang": "python",
"repo": "mlflow/mlflow",
"path": "/examples/xgboost/xgboost_sklearn/train.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # show logged data
for key, data in fetch_logged_data(run_id).items():
print(f"\n---------- logged {key} ----------")
pprint(data)
if __name__ == "__main__":
main()<|fim_prefix|># repo: mlflow/mlflow path: /examples/xgboost/xgboost_sklearn/train.py
from pprint import pprint
... | code_fim | hard | {
"lang": "python",
"repo": "mlflow/mlflow",
"path": "/examples/xgboost/xgboost_sklearn/train.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>OUTPUT SAMPLE:
Print out the value of N Mod M
"""
from sys import argv
in_file = argv[1]
def find_mod(a, b):
x = a / b
y = int(x) * b
return a - y
def read_file(file):
with open(file, 'r') as f:
lines = f.read().strip().splitlines()
for _ in lines:
x, y ... | code_fim | medium | {
"lang": "python",
"repo": "marshallhumble/Coding_Challenges",
"path": "/Code_Eval/Easy/Modulus/Modulus.py3",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marshallhumble/Coding_Challenges path: /Code_Eval/Easy/Modulus/Modulus.py3
#!/usr/bin/env python
"""
Given two integers N and M, calculate N Mod M (without using any inbuilt modulus operator).
<|fim_suffix|>in_file = argv[1]
def find_mod(a, b):
x = a / b
y = int(x) * b
return a - ... | code_fim | hard | {
"lang": "python",
"repo": "marshallhumble/Coding_Challenges",
"path": "/Code_Eval/Easy/Modulus/Modulus.py3",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DarylFernandes99/ProjectRepo_Django-Backend path: /poem/api/views.py
from ..models import Poem
from rest_framework import viewsets
from .serializers import PoemSerializers
<|fim_suffix|> serializer_class = PoemSerializers
queryset = Poem.objects.all()<|fim_middle|>class PoemViewSet(viewse... | code_fim | easy | {
"lang": "python",
"repo": "DarylFernandes99/ProjectRepo_Django-Backend",
"path": "/poem/api/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> serializer_class = PoemSerializers
queryset = Poem.objects.all()<|fim_prefix|># repo: DarylFernandes99/ProjectRepo_Django-Backend path: /poem/api/views.py
from ..models import Poem
from rest_framework import viewsets
from .serializers import PoemSerializers
<|fim_middle|>class PoemViewSet(viewse... | code_fim | easy | {
"lang": "python",
"repo": "DarylFernandes99/ProjectRepo_Django-Backend",
"path": "/poem/api/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # For each p2sph, get the FarmerRecords
farmer_records = await self.store.get_farmer_records_for_p2_singleton_phs(
set([ph for ph in ph_to_amounts.keys()])
)
# For each singleton, create, submit, and save a claim transact... | code_fim | hard | {
"lang": "python",
"repo": "BobZombiE69/pool-reference",
"path": "/pool/reward/reward_collector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BobZombiE69/pool-reference path: /pool/reward/reward_collector.py
import asyncio
import logging
import pathlib
import traceback
from typing import Dict, Optional, Set, List
import os
import yaml
import time
from chia.rpc.wallet_rpc_client import WalletRpcClient
from chia.types.blockchain_format... | code_fim | hard | {
"lang": "python",
"repo": "BobZombiE69/pool-reference",
"path": "/pool/reward/reward_collector.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> singleton_coin_record: Optional[
CoinRecord
] = await self.node_rpc_client.get_coin_record_by_name(singleton_tip.name())
if singleton_coin_record is None:
continue
... | code_fim | hard | {
"lang": "python",
"repo": "BobZombiE69/pool-reference",
"path": "/pool/reward/reward_collector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns a dcc.Tabs"""
def __init__(
self,
*args: Any,
**kwargs: Any,
) -> None:
super().__init__(*args, **kwargs)<|fim_prefix|># repo: equinor/webviz-core-components path: /webviz_core_components/wrapped_components/tabs.py
from typing import Any
from dash ... | code_fim | easy | {
"lang": "python",
"repo": "equinor/webviz-core-components",
"path": "/webviz_core_components/wrapped_components/tabs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: equinor/webviz-core-components path: /webviz_core_components/wrapped_components/tabs.py
from typing import Any
<|fim_suffix|>
class Tabs(dcc.Tabs):
"""Returns a dcc.Tabs"""
def __init__(
self,
*args: Any,
**kwargs: Any,
) -> None:
super().__init__(*ar... | code_fim | easy | {
"lang": "python",
"repo": "equinor/webviz-core-components",
"path": "/webviz_core_components/wrapped_components/tabs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dzdx/bh3 path: /bh3/wow.py
# coding=utf-8
import random
from collections import deque
class DogeDeque(deque):
"""
A doge deque. A doqe, if you may.
Because random is random, just using a random choice from the static lists
below there will always be some repetition in the outp... | code_fim | hard | {
"lang": "python",
"repo": "dzdx/bh3",
"path": "/bh3/wow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = list(self)
random.shuffle(args)
self.clear()
super(DogeDeque, self).__init__(args)
# A subset of the 255 color cube with the darkest colors removed. This is
# suited for use on dark terminals. Lighter colors are still present so some
# colors might be semi-unread... | code_fim | hard | {
"lang": "python",
"repo": "dzdx/bh3",
"path": "/bh3/wow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Shuffle the deque
Deques themselves do not support this, so this will make all items into
a list, shuffle that list, clear the deque, and then re-init the deque.
"""
args = list(self)
random.shuffle(args)
self.clear()
super(Do... | code_fim | hard | {
"lang": "python",
"repo": "dzdx/bh3",
"path": "/bh3/wow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: knifelees3/vtkplotter path: /bin/vtkplotter
im.SetInputData(img)
im.SliceFacesCameraOn()
im.SliceAtFocalPointOn()
im.BorderOn()
ip = vtk.vtkImageProperty()
ip.SetInterpolationTypeToLinear()
ia = vtk.vtkImageSlice()
ia.SetMapper(im)
... | code_fim | hard | {
"lang": "python",
"repo": "knifelees3/vtkplotter",
"path": "/bin/vtkplotter",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for mat in matching[:25]:
printc(os.path.basename(mat).replace('.py',''), c='y', italic=1, end=' ')
with open(mat) as fm:
lline = ''.join(fm.readlines(60))
lline = lline.replace('\n','').replace('\'','').replace('\"','').replace('-','')
... | code_fim | hard | {
"lang": "python",
"repo": "knifelees3/vtkplotter",
"path": "/bin/vtkplotter",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: knifelees3/vtkplotter path: /bin/vtkplotter
ue()
setOTF()
w1 = vp.addSlider2D(
sliderA1, 0, 1, value=_alphaslider1, pos=[(0.89, 0.1), (0.89, 0.26)], c=csl, showValue=0
)
def sliderA2(widget, event):
global _alphaslider2
_al... | code_fim | hard | {
"lang": "python",
"repo": "knifelees3/vtkplotter",
"path": "/bin/vtkplotter",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samluescher/django-media-tree path: /media_tree/contrib/cms_plugins/media_tree_image/models.py
from media_tree import media_types
from media_tree.contrib.cms_plugins import settings as plugins_settings
from media_tree.fields import FileNodeForeignKey, DimensionField
from cms.models import CMSPlug... | code_fim | medium | {
"lang": "python",
"repo": "samluescher/django-media-tree",
"path": "/media_tree/contrib/cms_plugins/media_tree_image/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> node = FileNodeForeignKey(allowed_media_types=(media_types.SUPPORTED_IMAGE,), verbose_name=_('file'))
link_type = models.CharField(_('link type'), max_length=1, blank=True, null=True, default=plugins_settings.MEDIA_TREE_CMS_PLUGIN_LINK_TYPE_DEFAULT, choices=plugins_settings.MEDIA_TREE_CMS_PLUGIN_L... | code_fim | medium | {
"lang": "python",
"repo": "samluescher/django-media-tree",
"path": "/media_tree/contrib/cms_plugins/media_tree_image/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: weijie88/spider_files path: /code10/queueDemo3.py
'''
# queue.Queue,先进先出队列
# queue.LifoQueue,后进先出队列
# queue.PriorityQueue,优先级队列
# queue.deque,双向对队
<|fim_suffix|>q = queue.deque()
q.append(123)
q.append(333)
q.appendleft(456)
# deque([456, 123, 333])
print(q)
# 打印:456
print(q[0])
q.pop() # 从右... | code_fim | hard | {
"lang": "python",
"repo": "weijie88/spider_files",
"path": "/code10/queueDemo3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>q = queue.deque()
q.append(123)
q.append(333)
q.appendleft(456)
# deque([456, 123, 333])
print(q)
# 打印:456
print(q[0])
q.pop() # 从右边删除
# # deque([456, 123])
print(q)
q.popleft() # 从左边删除<|fim_prefix|># repo: weijie88/spider_files path: /code10/queueDemo3.py
'''
# queue.Queue,先进先出队列
# queue.LifoQueue,后... | code_fim | hard | {
"lang": "python",
"repo": "weijie88/spider_files",
"path": "/code10/queueDemo3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
file_location = glob.glob("**/comments.txt", recursive=True).pop()
with open(file_location, "r") as c:
COMMENTS = c.read()
COMMENTS = COMMENTS.replace(
"{TEMPLATE_REPO}",
f"https://github.com/{context['GITHUB_ORG']}/{context['TEMPLATE_REPO']}",
)
get_all_repos... | code_fim | medium | {
"lang": "python",
"repo": "mabel-dev/rosey",
"path": "/src/internals/flows/sync_repos_flow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@operator
def print_item(data):
print(data)
return data
def sync_repos_flow(context):
file_location = glob.glob("**/comments.txt", recursive=True).pop()
with open(file_location, "r") as c:
COMMENTS = c.read()
COMMENTS = COMMENTS.replace(
"{TEMPLATE_REPO}",
f... | code_fim | medium | {
"lang": "python",
"repo": "mabel-dev/rosey",
"path": "/src/internals/flows/sync_repos_flow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mabel-dev/rosey path: /src/internals/flows/sync_repos_flow.py
import glob
from mabel.operators import EndOperator
from ..operators import (
GetReposOperator,
FilterOnFileOperator,
SyncWithRepoOperator,
) # type:ignore
from mabel import operator
@operator
def print_item(data):
... | code_fim | medium | {
"lang": "python",
"repo": "mabel-dev/rosey",
"path": "/src/internals/flows/sync_repos_flow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(credential.pk)
credential.user = "super3"
self.assertRaises(AttributeError, credential.save)
def test_cannot_edit_database_credential(self):
credential = factory_logical.CredentialFactory(database=self.database)
another_database = factory_log... | code_fim | hard | {
"lang": "python",
"repo": "TiagoDanin-Forks/database-as-a-service",
"path": "/dbaas/logical/tests/test_credential.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @mock.patch.object(FakeDriver, 'remove_user')
def test_delete_model_remove_credentials_from_driver(self, remove_user):
credential = factory_logical.CredentialFactory()
credential.delete()
remove_user.assert_called_once_with(credential)<|fim_prefix|># repo: TiagoDanin-Forks... | code_fim | hard | {
"lang": "python",
"repo": "TiagoDanin-Forks/database-as-a-service",
"path": "/dbaas/logical/tests/test_credential.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TiagoDanin-Forks/database-as-a-service path: /dbaas/logical/tests/test_credential.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import mock
from django.test import TestCase
from physical.tests import factory as factory_physical
from drivers.fake import FakeDr... | code_fim | hard | {
"lang": "python",
"repo": "TiagoDanin-Forks/database-as-a-service",
"path": "/dbaas/logical/tests/test_credential.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manhdqhe153129/mask_rcnn_pytorch path: /net/layer/rpn/rpn_head.py
import torch
from torch import nn
import torch.nn.functional as F
class RpnMultiHead(nn.Module):
"""
N-way RPN head
"""
def __init__(self, cfg, in_channels):
"""
:param cfg: net configuration
... | code_fim | hard | {
"lang": "python",
"repo": "manhdqhe153129/mask_rcnn_pytorch",
"path": "/net/layer/rpn/rpn_head.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = foreground deltas
db = background deltas
in which df, db = [cx, cy, w, h]
a total of N = (16*16*3 + 32*32*3 + 64*64*3 + 128*128*3) = 65280 proposals in an input
"""
batch_size = len(fs[0])
logits_flat = []
deltas_flat =... | code_fim | hard | {
"lang": "python",
"repo": "manhdqhe153129/mask_rcnn_pytorch",
"path": "/net/layer/rpn/rpn_head.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lijiunderstand/brute_knn_benchmarks path: /find_max_dataset.py
'''
This script is used to determine, through experimentation, the maximum dataset
size supported by FAISS on a particular GPU configuration.
This script attempts to load a dataset of a particular size, and records
whether the load ... | code_fim | hard | {
"lang": "python",
"repo": "lijiunderstand/brute_knn_benchmarks",
"path": "/find_max_dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Record the name of the dataset.
generate = False
t0 = time.time()
if generate:
print('Generating dataset...')
sys.stdout.flush()
vecs = np.random.rand(test['vec_count'], test['vec_len']).astype('float32')
else:
print('Loading dataset...')
sys.stdout.flush()
#... | code_fim | hard | {
"lang": "python",
"repo": "lijiunderstand/brute_knn_benchmarks",
"path": "/find_max_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
print('Loading dataset...')
sys.stdout.flush()
# Open a memory mapped version of the matrix.
vecs_mmap = np.load('./%d_x_%d.npy' % (int(130E6), int(300)), mmap_mode='r')
# Read the portion of the dataset that we need.
vecs = vecs_mmap[0:test['vec_count'],:]
pri... | code_fim | hard | {
"lang": "python",
"repo": "lijiunderstand/brute_knn_benchmarks",
"path": "/find_max_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dials/dials path: /src/dials/algorithms/indexing/lattice_search/strategy.py
"""Lattice search strategies."""
from __future__ import annotations
class Strategy:
"""A base class for lattice search strategies."""
phil_help = None
phil_scope = None
<|fim_suffix|> def find_crysta... | code_fim | hard | {
"lang": "python",
"repo": "dials/dials",
"path": "/src/dials/algorithms/indexing/lattice_search/strategy.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
params: an extracted PHIL scope containing the parameters
"""
self._params = params
if self._params is None and self.phil_scope is not None:
self._params = self.phil_scope.extract()
def find_crystal_models(self, reflections, experiments):
... | code_fim | medium | {
"lang": "python",
"repo": "dials/dials",
"path": "/src/dials/algorithms/indexing/lattice_search/strategy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def kart_add(request, slug):
try:
kart = Carrito.objects.get(comprador=request.user.id, checkedOut=False)
try:
item = Item.objects.get(slug=slug)
kart_item = CarritoItem.objects.get(carrito=kart, item=item)
kart_item.cantidad = kart_item.cantidad + 1
kart_item.save()
except CarritoItem.... | code_fim | hard | {
"lang": "python",
"repo": "AdolfoCastro/Storeathon",
"path": "/django-testapp-develop/storeathon/views.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AdolfoCastro/Storeathon path: /django-testapp-develop/storeathon/views.py
from django.shortcuts import render
from django.http import HttpResponseRedirect, Http404
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.template.defaultfil... | code_fim | hard | {
"lang": "python",
"repo": "AdolfoCastro/Storeathon",
"path": "/django-testapp-develop/storeathon/views.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = Column(db.Integer, primary_key=True)
tag = Column(db.String(16), unique=True, nullable=False)
title = Column(db.String(150), nullable=False)
new_thread_requires_file = Column(db.Boolean, default=True)
max_file_size = Column(db.Integer, default=config['attachments']['max_file_size'... | code_fim | hard | {
"lang": "python",
"repo": "interphx/noxboard",
"path": "/app/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: interphx/noxboard path: /app/models.py
import datetime
from app.database import Column, Model, relationship, db
from app import config
attachment_to_post = db.Table('attachment_to_post',
Column('attachment_id', db.Integer, db.ForeignKey('attachment.id')),
Column('post_id', db.Integer, db... | code_fim | hard | {
"lang": "python",
"repo": "interphx/noxboard",
"path": "/app/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Attachment(Model):
id = Column(db.Integer, primary_key=True)
resource = Column(db.String(512), nullable=False)
type = Column(db.String(64), nullable=False)
is_local = Column(db.Boolean, nullable=False)
hash = Column(db.String(64), nullable=False)
#post_id = Column(db.Integer,... | code_fim | hard | {
"lang": "python",
"repo": "interphx/noxboard",
"path": "/app/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: portalmaster12/pycolab path: /pycolab/examples/aperture.py
# Copyright 2017 the pycolab Authors
#
# 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.apac... | code_fim | hard | {
"lang": "python",
"repo": "portalmaster12/pycolab",
"path": "/pycolab/examples/aperture.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> del backdrop # Unused.
# Handles basic movement, but not movement through apertures.
if actions == 0: # go upward?
self._north(board, the_plot)
elif actions == 1: # go downward?
self._south(board, the_plot)
elif actions == 2: # go leftward?
self._west(board, the_... | code_fim | hard | {
"lang": "python",
"repo": "portalmaster12/pycolab",
"path": "/pycolab/examples/aperture.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> wellitem=item['wellMeasurements'][key]
name='wellMeasurements.'+key
value=''
uom=''
if len(wellitem)>0:
value=wellitem[0]['value']
uom=wellitem[0]['uom']
... | code_fim | hard | {
"lang": "python",
"repo": "digitalcollaboration-collabor8/subsurfaceSampleClient",
"path": "/subsurfaceCollabor8/production_frames.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: digitalcollaboration-collabor8/subsurfaceSampleClient path: /subsurfaceCollabor8/production_frames.py
from pandas import json_normalize
import pandas as pd
def production_volumes_to_frame(data):
"""
Takes a json production volumes result from the Collabor8 Graphql response
and turn... | code_fim | hard | {
"lang": "python",
"repo": "digitalcollaboration-collabor8/subsurfaceSampleClient",
"path": "/subsurfaceCollabor8/production_frames.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Sm3 128.958302
3 2017-11-01T00:00:00Z 2017-11-02T00:00:00Z 2017-11-01T00:00:00Z 2017-11-02T00:00:00Z day ... 34/10-A-23 well Sm3 333.958300
4 2017-11-01T00:00:00Z 2017-11-02T00:00:00Z 2017-11-01T00:00:00Z 2017-11-02T00:00:00Z day ... ... | code_fim | hard | {
"lang": "python",
"repo": "digitalcollaboration-collabor8/subsurfaceSampleClient",
"path": "/subsurfaceCollabor8/production_frames.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marqeta/marqeta-python path: /marqeta/response_models/card_personalization.py
from datetime import datetime, date
from marqeta.response_models.text import Text
from marqeta.response_models.images import Images
from marqeta.response_models.carrier import Carrier
from marqeta.response_models import... | code_fim | medium | {
"lang": "python",
"repo": "marqeta/marqeta-python",
"path": "/marqeta/response_models/card_personalization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return '<Marqeta.response_models.card_personalization.CardPersonalization>' + self.__str__()<|fim_prefix|># repo: marqeta/marqeta-python path: /marqeta/response_models/card_personalization.py
from datetime import datetime, date
from marqeta.response_models.text import Tex... | code_fim | hard | {
"lang": "python",
"repo": "marqeta/marqeta-python",
"path": "/marqeta/response_models/card_personalization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(o, datetime) or isinstance(o, date):
return o.__str__()
@property
def text(self):
if 'text' in self.json_response:
return Text(self.json_response['text'])
@property
def images(self):
if 'images' in self.json_response:
... | code_fim | medium | {
"lang": "python",
"repo": "marqeta/marqeta-python",
"path": "/marqeta/response_models/card_personalization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nels885/csd_dashboard path: /psa/urls.py
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views
from . import ajax
<|fim_suffix|>urlpatterns = [
path('', include(router.urls)),
path('nac/tools/', views.nac_tools, name='nac_tools'),
... | code_fim | medium | {
"lang": "python",
"repo": "Nels885/csd_dashboard",
"path": "/psa/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app_name = 'psa'
urlpatterns = [
path('', include(router.urls)),
path('nac/tools/', views.nac_tools, name='nac_tools'),
path('nac/tools/license/', views.nac_license, name='nac_license'),
path('nac/tools/update-id/license/', views.nac_update_id_license, name='nac_id_license'),
path('na... | code_fim | medium | {
"lang": "python",
"repo": "Nels885/csd_dashboard",
"path": "/psa/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jacob1/lykos path: /src/status/voteweight.py
from src.decorators import event_listener
from src.containers import UserDict
from src.functions import get_players
from src.messages import messages
from src import users
__all__ = ["add_vote_weight", "remove_vote_weight", "get_vote_weight"]
WEIGHT ... | code_fim | hard | {
"lang": "python",
"repo": "jacob1/lykos",
"path": "/src/status/voteweight.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Get how much weight the target's votes have."""
# ensure we don't return negative numbers here;
# we still track them for stacking purposes but anything below 0 counts as 0
return max(WEIGHT.get(target, 1), 0)
@event_listener("del_player")
def on_del_player(evt, var, player, allroles, ... | code_fim | hard | {
"lang": "python",
"repo": "jacob1/lykos",
"path": "/src/status/voteweight.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Make the target's votes as having less weight."""
add_vote_weight(var, target, -amount)
def get_vote_weight(var, target : users.User) -> int:
"""Get how much weight the target's votes have."""
# ensure we don't return negative numbers here;
# we still track them for stacking purpos... | code_fim | medium | {
"lang": "python",
"repo": "jacob1/lykos",
"path": "/src/status/voteweight.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linuxsoftware/ls.joyous path: /ls/joyous/apps.py
from django.apps import AppConfig
<|fim_suffix|> def ready(self):
from ls.joyous import signals<|fim_middle|>class JoyousAppConfig(AppConfig):
name = 'ls.joyous'
label = 'joyous'
verbose_name = "Joyous Calendar"
default_... | code_fim | medium | {
"lang": "python",
"repo": "linuxsoftware/ls.joyous",
"path": "/ls/joyous/apps.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linuxsoftware/ls.joyous path: /ls/joyous/apps.py
from django.apps import AppConfig
class JoyousAppConfig(AppConfig):
<|fim_suffix|> from ls.joyous import signals<|fim_middle|> name = 'ls.joyous'
label = 'joyous'
verbose_name = "Joyous Calendar"
default_auto_field = 'django.... | code_fim | medium | {
"lang": "python",
"repo": "linuxsoftware/ls.joyous",
"path": "/ls/joyous/apps.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ready(self):
from ls.joyous import signals<|fim_prefix|># repo: linuxsoftware/ls.joyous path: /ls/joyous/apps.py
from django.apps import AppConfig
<|fim_middle|>class JoyousAppConfig(AppConfig):
name = 'ls.joyous'
label = 'joyous'
verbose_name = "Joyous Calendar"
default_... | code_fim | medium | {
"lang": "python",
"repo": "linuxsoftware/ls.joyous",
"path": "/ls/joyous/apps.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wseemann/hate5grip path: /code/ver1/remote.py
from signal import pause
from gpiozero import Button
import requests
ip_addr = ""
port = 5000
button_map = {
"GPIO6": "1",
"GPIO13": "2",
"GPIO19": "3",
"GPIO26": "4"}
<|fim_suffix|>try:
button1.when_pressed = tx
button2.wh... | code_fim | hard | {
"lang": "python",
"repo": "wseemann/hate5grip",
"path": "/code/ver1/remote.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>button1 = Button(6)
button2 = Button(13)
button3 = Button(19)
button4 = Button(26)
try:
button1.when_pressed = tx
button2.when_pressed = tx
button3.when_pressed = tx
button4.when_pressed = tx
pause()
finally:
pass<|fim_prefix|># repo: wseemann/hate5grip path: /code/ver1/remote.... | code_fim | medium | {
"lang": "python",
"repo": "wseemann/hate5grip",
"path": "/code/ver1/remote.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> angle = button_map[str(button.pin)]
requests.post("http://%s:%s/hate5grip?angle=%s" % (ip_addr, port, angle))
button1 = Button(6)
button2 = Button(13)
button3 = Button(19)
button4 = Button(26)
try:
button1.when_pressed = tx
button2.when_pressed = tx
button3.when_pressed = tx
butt... | code_fim | medium | {
"lang": "python",
"repo": "wseemann/hate5grip",
"path": "/code/ver1/remote.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OskarBreach/hit-hit-crit path: /hithitcrit/viewer/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^pilots/$', views.pilots),
url(r'^pilots/(\d+)/$', views.pilot_by_id),
url(r'^upgrades/$', views.upgrades),... | code_fim | medium | {
"lang": "python",
"repo": "OskarBreach/hit-hit-crit",
"path": "/hithitcrit/viewer/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ews.reference_card_by_id),
url(r'^conditions/$', views.conditions),
url(r'^conditions/(\d+)/$', views.condition_by_id),
]<|fim_prefix|># repo: OskarBreach/hit-hit-crit path: /hithitcrit/viewer/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.inde... | code_fim | hard | {
"lang": "python",
"repo": "OskarBreach/hit-hit-crit",
"path": "/hithitcrit/viewer/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/portal/end_cygtuto.py
sm.systemMessage("Go to the Small Bridge.")
# Unhandled Message [47] Packet: 2F 03 00 00 00 70 94 00 00 00 00 00 00 26 00 00 00 00 00 00 80 05 BB 46 E6 17 02 0C 00 75 73 65 72 5F 6C 76 75 70 3D 31 30 <|fim_suffix|>D 31 30 B0 83 08 00 00 00 00 ... | code_fim | medium | {
"lang": "python",
"repo": "Bratah123/v203.4",
"path": "/scripts/portal/end_cygtuto.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>D 31 30 B0 83 08 00 00 00 00 00 2E 02 00 00 00 00 00 80 05 BB 46 E6 17 02 00 00
sm.warp(130030006, 0)<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/portal/end_cygtuto.py
sm.systemMessage("Go to the Small Bridge.")
# Unhandled Message [47] Packet: 2F 03 00 00 00 70 94 00<|fim_middle|> 00 00 00 00 0... | code_fim | medium | {
"lang": "python",
"repo": "Bratah123/v203.4",
"path": "/scripts/portal/end_cygtuto.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class InferenceConfig(CamusConfig):
GPU_COUNT = 1
IMAGES_PER_GPU = 1
def eval_detection(gt_mask, r):
"""Apply the IoU metric to compare the ground truth and the detections"""
ids = np.unique(r['class_ids'])
merged_masks = {}
qualities = dict([(1,0), (2,0), (3,0)])
for i in i... | code_fim | hard | {
"lang": "python",
"repo": "Tauffer-Consulting/Mask_RCNN",
"path": "/samples/camus/camus_image_processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tauffer-Consulting/Mask_RCNN path: /samples/camus/camus_image_processing.py
import os
import sys
from glob import glob
from tqdm import tqdm
import cv2
import numpy as np
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
# Directory to save logs and trained model
MODEL_DIR ... | code_fim | hard | {
"lang": "python",
"repo": "Tauffer-Consulting/Mask_RCNN",
"path": "/samples/camus/camus_image_processing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_saldo_vahenee_oikein(self):
self.maksukortti.ota_rahaa(400)
self.assertEqual(str(self.maksukortti), "saldo: 6.0")
def test_saldo_ei_muutu_negatiiviseksi(self):
self.maksukortti.ota_rahaa(1100)
self.assertEqual(str(self.maksukortti), "saldo: 10.0")
def... | code_fim | hard | {
"lang": "python",
"repo": "pupunu/Rytmipeli",
"path": "/laskarit/viikko2/unicafe/src/tests/maksukortti_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pupunu/Rytmipeli path: /laskarit/viikko2/unicafe/src/tests/maksukortti_test.py
import unittest
from maksukortti import Maksukortti
class TestMaksukortti(unittest.TestCase):
def setUp(self):
self.maksukortti = Maksukortti(1000)
def test_luotu_kortti_on_olemassa(self):
sel... | code_fim | hard | {
"lang": "python",
"repo": "pupunu/Rytmipeli",
"path": "/laskarit/viikko2/unicafe/src/tests/maksukortti_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(str(self.maksukortti),"saldo: 10.0")
def test_lataaminen_toimii(self):
self.maksukortti.lataa_rahaa(200)
self.assertEqual(str(self.maksukortti), "saldo: 12.0")
def test_saldo_vahenee_oikein(self):
self.maksukortti.ota_rahaa(400)
self.asser... | code_fim | medium | {
"lang": "python",
"repo": "pupunu/Rytmipeli",
"path": "/laskarit/viikko2/unicafe/src/tests/maksukortti_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Send a simple Propose to the sender of the CFP."""
print("[{0}]: Received CFP from {1}".format(self.public_key, origin))
# prepare the proposal with a given price.
price = 50
proposal = Description({"price": price})
print("[{}]: Sending propose at price:... | code_fim | hard | {
"lang": "python",
"repo": "therobertc/oef-sdk-python",
"path": "/examples/weather/weather_station.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: therobertc/oef-sdk-python path: /examples/weather/weather_station.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "Li... | code_fim | hard | {
"lang": "python",
"repo": "therobertc/oef-sdk-python",
"path": "/examples/weather/weather_station.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vetal16/N path: /pylenet/smala/examples/lid.py
import numpy,glob,Image
from smala.modules import *
# Paths where the spectrograms are for each language
names = {'en': glob.glob("./data-lid-en/*.pgm"),'fr': glob.glob("./data-lid-fr/*.pgm"),}
# Generate a sample for the selected lang
def sample(l... | code_fim | hard | {
"lang": "python",
"repo": "vetal16/N",
"path": "/pylenet/smala/examples/lid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>err = 0.5
for i in range(10000):
# Train
X,T = sample('en' if i%2==0 else 'fr')
n.forward(X)
n.backward(X,n.Y-T)
n.update(1e-2,pfanin=-0.5)
# Estimate the training error "online"
X,T = sample('en' if numpy.random.randint(2)==0 else 'fr')
n.forward(X)
err = 0.999*err + (0 if n.Y[0]*T[0] > 0 else ... | code_fim | hard | {
"lang": "python",
"repo": "vetal16/N",
"path": "/pylenet/smala/examples/lid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alouifahima/djangoapp path: /polls/views.py
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect<|fim_suffix|>s import generic
from django.utils import timezone<|fim_middle|>
from django.urls import reverse
from django.view | code_fim | easy | {
"lang": "python",
"repo": "alouifahima/djangoapp",
"path": "/polls/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alouifahima/djangoapp path: /polls/views.py
from django.shortcuts import get_object_or_404, r<|fim_suffix|>
from django.urls import reverse
from django.views import generic
from django.utils import timezone<|fim_middle|>ender
from django.http import HttpResponseRedirect | code_fim | easy | {
"lang": "python",
"repo": "alouifahima/djangoapp",
"path": "/polls/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from django.urls import reverse
from django.views import generic
from django.utils import timezone<|fim_prefix|># repo: alouifahima/djangoapp path: /polls/views.py
from django.shortcuts import get_object_or_404, r<|fim_middle|>ender
from django.http import HttpResponseRedirect | code_fim | easy | {
"lang": "python",
"repo": "alouifahima/djangoapp",
"path": "/polls/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
make and obect of testClass, and make a global reference to that object that is called by callback
"""
myObj = myTestClass()
global gObject
gObject = myObj
"""
make a tag reader object, and install the custom callback. installCallBack
makes a global reference to tag... | code_fim | hard | {
"lang": "python",
"repo": "jamieboyd/RFIDTagReader",
"path": "/RFIDTagReaderCustomCallback.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamieboyd/RFIDTagReader path: /RFIDTagReaderCustomCallback.py
#! /usr/bin/python3
#-*-coding: utf-8 -*-
"""
Simple program to illustrate using a custom call back function with the Tag-In-Range
pin on the Innovations Design tag readers (ID-L3, ID-L12, ID-L20). The custom callback
references a glob... | code_fim | hard | {
"lang": "python",
"repo": "jamieboyd/RFIDTagReader",
"path": "/RFIDTagReaderCustomCallback.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def printResults(self):
"""
Prints results of entries and exits for all tags encountered
"""
for key in self.mDict.keys():
print ('for {:d}, entries = {:d} and exits = {:d}'.format (key, self.mDict.get(key).get ('entries'), self.mDict.get(key).get ('exits'... | code_fim | hard | {
"lang": "python",
"repo": "jamieboyd/RFIDTagReader",
"path": "/RFIDTagReaderCustomCallback.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Index of the last item returned by InMemoryReader.
# Initialized to None.
self._current_index = None
self._range_tracker = range_trackers.OffsetRangeTracker(
self._source.start_index, self._source.end_index)
def __enter__(self):
return self
def __exit__(self, exception... | code_fim | hard | {
"lang": "python",
"repo": "github-cloud-corporation/DataflowPythonSDK",
"path": "/google/cloud/dataflow/worker/inmemory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """A reader for in-memory source."""
def __init__(self, source):
self._source = source
# Index of the last item returned by InMemoryReader.
# Initialized to None.
self._current_index = None
self._range_tracker = range_trackers.OffsetRangeTracker(
self._source.start_index... | code_fim | hard | {
"lang": "python",
"repo": "github-cloud-corporation/DataflowPythonSDK",
"path": "/google/cloud/dataflow/worker/inmemory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: github-cloud-corporation/DataflowPythonSDK path: /google/cloud/dataflow/worker/inmemory.py
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a co... | code_fim | hard | {
"lang": "python",
"repo": "github-cloud-corporation/DataflowPythonSDK",
"path": "/google/cloud/dataflow/worker/inmemory.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def bbr():
global len_
#构写url,入队
code_pool = [random.randint(1798298, 1798498) for _ in range(100) ]
for code in code_pool :
url = 'http://www.pigai.org/?c=v2&a=write&rid={}'.format(code)
print(url)
urlQ.put_nowait(url)
#获取cookie
cookie = get_cookie()
... | code_fim | hard | {
"lang": "python",
"repo": "QIN2DIM/pigAI",
"path": "/paper_code/抓取作文号.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QIN2DIM/pigAI path: /paper_code/抓取作文号.py
from gevent import monkey
monkey.patch_all()
from selenium.webdriver import Chrome
from selenium.webdriver import ChromeOptions
from selenium.webdriver.support.wait import WebDriverWait
import selenium.webdriver.support.expected_conditions as EC
import ... | code_fim | hard | {
"lang": "python",
"repo": "QIN2DIM/pigAI",
"path": "/paper_code/抓取作文号.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def chunk_sequence(sequence, chunk_length, randomize=True, num_chunks=None):
"""Split a nested dict of sequence tensors into a batch of chunks.
This function does not expect a batch of sequences, but a single sequence. A
`length` key is added if it did not exist already. When `randomize` is set,
... | code_fim | medium | {
"lang": "python",
"repo": "createamind/Planet",
"path": "/planet/tools/chunk_sequence.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: createamind/Planet path: /planet/tools/chunk_sequence.py
# Copyright 2019 The PlaNet Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | code_fim | medium | {
"lang": "python",
"repo": "createamind/Planet",
"path": "/planet/tools/chunk_sequence.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NJManganelli/FourTopNAOD path: /RDF/pileup_correction_analysis.py
import ROOT
import pdb
f = ROOT.TFile.Open("~/private/nTruePileup_analysis_mc.root", "read")
names = ["ElEl___nom",
"ElEl___pileupDown",
"ElEl___pileupOff",
"ElEl___pileupUp",
"ElMu___nom",
"ElMu___pileupDown",
"ElMu___pileupOff",
... | code_fim | hard | {
"lang": "python",
"repo": "NJManganelli/FourTopNAOD",
"path": "/RDF/pileup_correction_analysis.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># c_reweighted_label = ROOT.TLatex();
# c_reweighted_label.SetTextSize(0.05)
# c_reweighted_label.DrawLatexNDC(0.1, 0.9, "Post-selection events in analysis versus assumed MC pileup")
c_reweighted.SetTitle("Total OSDL simulation post-PUReweighting versus data; pileup;")
c_reweighted.Draw()
rew_legend = c_r... | code_fim | hard | {
"lang": "python",
"repo": "NJManganelli/FourTopNAOD",
"path": "/RDF/pileup_correction_analysis.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stggh/PyAbel path: /abel/direct.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import scipy.integrate
from .math import gradient
try:
from .li... | code_fim | hard | {
"lang": "python",
"repo": "stggh/PyAbel",
"path": "/abel/direct.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# append the same docstring to all functions
iabel_direct.__doc__ += _direct_doctsting
fabel_direct.__doc__ += _direct_doctsting
_abel_transform_wrapper.__doc__ += _direct_doctsting
def is_uniform_sampling(r):
dr = np.diff(r)
ddr = np.diff(dr)
return np.allclose(ddr, 0, atol=1e-13)
def ... | code_fim | hard | {
"lang": "python",
"repo": "stggh/PyAbel",
"path": "/abel/direct.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print('{} UNKNOWN TYPE ({})'.format(v, value['type']), file=sys.stderr)
else:
print('{} PROPERTIES NOT FOUND'.format(v), file=sys.stderr)
print('\n\n'.join(result))
if __name__ == '__main__':
main()<|fim_prefix|># repo: sangwon090/notion2md ... | code_fim | hard | {
"lang": "python",
"repo": "sangwon090/notion2md",
"path": "/notion2md.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sangwon090/notion2md path: /notion2md.py
import os
import sys
import json
from urllib import request
from urllib import parse
def main():
if len(sys.argv) < 2:
print("usage: ./notion2md.py <filename>")
sys.exit(0)
if not os.path.exists('./assets'):
os.makedirs('... | code_fim | hard | {
"lang": "python",
"repo": "sangwon090/notion2md",
"path": "/notion2md.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shubhranshu-Shekhar/pyaad path: /pyalad/r_support.py
the same matrix will be returned if input data dimensions are
same as output data dimensions. Else, a new matrix will be created
and returned.
Example:
d = np.reshape(range(12), (6, 2))
matrix(d[0:2, :], nrow=2, by... | code_fim | hard | {
"lang": "python",
"repo": "Shubhranshu-Shekhar/pyaad",
"path": "/pyalad/r_support.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> wdi = W["di"]
Wdi2 = cvxopt.spdiag(cvxopt.mul(wdi, wdi))
S = G.T * Wdi2
P = S * G
Q = _H + P
# now, do the cholesky decomposition of Q
cvxopt.lapack.potrf(Q)
if False and fn is not None:
logger.debug("At setup f(x) = %d" % (fn(... | code_fim | hard | {
"lang": "python",
"repo": "Shubhranshu-Shekhar/pyaad",
"path": "/pyalad/r_support.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def save(obj, filepath):
filehandler = open(filepath, 'w')
pickle.dump(obj, filehandler)
return obj
def load(filepath):
filehandler = open(filepath, 'r')
obj = pickle.load(filehandler)
return obj
def dir_create(path):
try:
os.makedirs(path)
except OSError as ex... | code_fim | hard | {
"lang": "python",
"repo": "Shubhranshu-Shekhar/pyaad",
"path": "/pyalad/r_support.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __queryTableRow(self, itemId):
table = self.__getTable()
return table.get_item(itemId = itemId)
@retry(stop_max_attempt_number=3)
def put(self, item):
"""
Put a new item.
"""
tableData = {}
tableData['itemId'] = item.id
for... | code_fim | hard | {
"lang": "python",
"repo": "adityabansal/newsAroundMe",
"path": "/newsApp/dbItemManagerV2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Put a new item.
"""
tableData = {}
tableData['itemId'] = item.id
for tagName in item.tags:
tableData[tagName] = item.tags[tagName];
table = self.__getTable();
table.put_item(data = tableData, overwrite = True)
def get(s... | code_fim | hard | {
"lang": "python",
"repo": "adityabansal/newsAroundMe",
"path": "/newsApp/dbItemManagerV2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adityabansal/newsAroundMe path: /newsApp/dbItemManagerV2.py
#TODO: make separate class for exceptions and raise them instead of generic
import decimal
from boto.dynamodb2.table import Table
from boto.dynamodb2.fields import HashKey, RangeKey
from retrying import retry
from .dbItem import DbItem... | code_fim | hard | {
"lang": "python",
"repo": "adityabansal/newsAroundMe",
"path": "/newsApp/dbItemManagerV2.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.