text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|># print(response.json())
# Get Conversation ID, Send Message
payload = {
"message": "Hello Suman! Thank you for contating us. Please call 9840063224 for coupon delivery.",
"access_token":"EAAJeSI6et1kBAG0PhzkRHIh1Wk5VZBQbhWj2tFIatrzqnvPdXct1yYWfkgLOu66a9oerFcaZCrxqtbE5wLYKZCZBF5NbjKfkc3BfCvGSLnZCZAG1... | code_fim | hard | {
"lang": "python",
"repo": "Efshub/PersonalityTest1",
"path": "/message.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Efshub/PersonalityTest1 path: /message.py
import requests
import json
# Steps for Jokes Delivery
# 1. Retrieve page access token from https://developers.facebook.com/tools/explorer/666615676843865?method=GET&path=667782319960906%2Fconversations%20&version=v2.9
# 2. Read all the conversations
# ... | code_fim | hard | {
"lang": "python",
"repo": "Efshub/PersonalityTest1",
"path": "/message.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>response = requests.post(
"https://graph.facebook.com/v2.9/t_mid.$cAAIFrnoyzmViWhEOQVcKMvFJaCYe/messages",
data=json.dumps(payload),
headers = {"Content-Type": "application/json"}
)
print(response.json())<|fim_prefix|># repo: Efshub/PersonalityTest1 path: /message.py
import requests
import j... | code_fim | hard | {
"lang": "python",
"repo": "Efshub/PersonalityTest1",
"path": "/message.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avara1986/ardy path: /tests/test_deploy_integration.py
# coding=utf-8
from __future__ import unicode_literals, print_function, absolute_import
import os
import unittest
import boto3
import botocore
from mock import patch
from moto import mock_lambda, mock_s3, mock_sns, mock_cloudwatch
from requ... | code_fim | hard | {
"lang": "python",
"repo": "avara1986/ardy",
"path": "/tests/test_deploy_integration.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.remove(zip_file)
@mock_s3
@mock_lambda
@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
@patch.object(Deploy, "is_client_result_ok")
@patch.object(Build, "pip_install_to_target")
@patch.object(Build, "copytree")
@patch.object(Build, "creat... | code_fim | hard | {
"lang": "python",
"repo": "avara1986/ardy",
"path": "/tests/test_deploy_integration.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param np.array input: input data on which the parameter estimation has been taken place
:param np.array R: approximation error of the ODE/PDE for this input set
:param np.array delta: smoothened approximation error of the ODE/PDE for this input set
:param np.array deltadot: derivative of ... | code_fim | hard | {
"lang": "python",
"repo": "bhillebrecht/CertifiedML_PDE",
"path": "/nse/nse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_collocation_points(self, X_f):
"""
Sets collocation points in class to X_f.
The components correspond to time (t), and space (x, y) in this order.
"""
self.t = self.tensor(X_f[:,0:1])
self.x = self.tensor(X_f[:,1:2])
self.y = self.tensor(... | code_fim | hard | {
"lang": "python",
"repo": "bhillebrecht/CertifiedML_PDE",
"path": "/nse/nse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhillebrecht/CertifiedML_PDE path: /nse/nse.py
###################################################################################################
# Copyright (c) 2022 Birgit Hillebrecht
#
# To cite this code in publications, please use
# B. Hillebrecht and B. Unger : "Certified machine lea... | code_fim | hard | {
"lang": "python",
"repo": "bhillebrecht/CertifiedML_PDE",
"path": "/nse/nse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duqtools/duqtools path: /src/duqtools/models/_run.py
from pathlib import Path
from typing import Optional, Union
from pydantic import Field, root_validator
from ..ids import ImasHandle
from ..schema import BaseModel, IDSOperation, ImasBaseModel, JettoOperation
class Run(BaseModel):
dirnam... | code_fim | hard | {
"lang": "python",
"repo": "duqtools/duqtools",
"path": "/src/duqtools/models/_run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self.data_out:
raise NotImplementedError(
'Run has no data_out, necessary for mapping')
handle = ImasHandle.parse_obj(self.data_out)
return handle
@classmethod
def from_path(cls, path: Path):
return cls(shortname=path, dirname=pat... | code_fim | hard | {
"lang": "python",
"repo": "duqtools/duqtools",
"path": "/src/duqtools/models/_run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> debug = cms.untracked.bool(False),
reverseFilter = cms.untracked.bool(False), # if True, will select only events failing filter, rather than events passing
hbheInputLabel=cms.untracked.InputTag("h... | code_fim | hard | {
"lang": "python",
"repo": "simonecid/cmssw",
"path": "/RecoMET/METFilters/python/hcalLaserEventFilter_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simonecid/cmssw path: /RecoMET/METFilters/python/hcalLaserEventFilter_cfi.py
import FWCore.ParameterSet.Config as cms
try:
from hcalLaserBadEvents_2011 import badEvents
except:
print "<hcalLaserEventFilter_cfi> WARNING! No explicit list 'badEvents.py' containing bad HCAL laser run/... | code_fim | hard | {
"lang": "python",
"repo": "simonecid/cmssw",
"path": "/RecoMET/METFilters/python/hcalLaserEventFilter_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abdullah-V/CargoGlobal.net path: /hesablar/urls.py
from django.conf.urls import url,include
from .views import login_view,register_view,logout_view
<|fim_suffix|>urlpatterns = [
url(r'^giris/$',login_view),
url(r'^qeydiyyat/$',register_view),
url(r'^cixis/$',logout_view),
]<|fim_midd... | code_fim | easy | {
"lang": "python",
"repo": "Abdullah-V/CargoGlobal.net",
"path": "/hesablar/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^giris/$',login_view),
url(r'^qeydiyyat/$',register_view),
url(r'^cixis/$',logout_view),
]<|fim_prefix|># repo: Abdullah-V/CargoGlobal.net path: /hesablar/urls.py
from django.conf.urls import url,include
from .views import login_view,register_view,logout_view
<|fim_midd... | code_fim | easy | {
"lang": "python",
"repo": "Abdullah-V/CargoGlobal.net",
"path": "/hesablar/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if link.upload or link.download:
print "upload is already completed"
elif not path:
print "no local copy exists."
elif path:
try:
saved = None
with self.session.upload(capsule, archi... | code_fim | hard | {
"lang": "python",
"repo": "V-Lamp/longaccess-client",
"path": "/lacli/command.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: V-Lamp/longaccess-client path: /lacli/command.py
list
lacli capsule create <title>
lacli capsule --help
"""
prompt = 'lacli:capsule> '
def makecmd(self, options):
line = []
if options['list']:
line.append("list")
return " ".j... | code_fim | hard | {
"lang": "python",
"repo": "V-Lamp/longaccess-client",
"path": "/lacli/command.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(archives):
for n, archive in enumerate(archives.iteritems()):
archive = archive[1]
status = "LOCAL"
cert = ""
if 'signature' in archive:
status = "COMPLETE"
cert = archive['si... | code_fim | hard | {
"lang": "python",
"repo": "V-Lamp/longaccess-client",
"path": "/lacli/command.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>
db = SQLAlchemy(
session_options={
"autocommit": False,
"autoflush": False
}
)<|fim_prefix|># repo: frankiegu/dashboard path: /rekcurd_dashboard/models/dao.py
# coding: utf-8
<|fim_middle|>from flask_sqlalchemy import SQLAlchemy
| code_fim | easy | {
"lang": "python",
"repo": "frankiegu/dashboard",
"path": "/rekcurd_dashboard/models/dao.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frankiegu/dashboard path: /rekcurd_dashboard/models/dao.py
# coding: utf-8
<|fim_suffix|>
db = SQLAlchemy(
session_options={
"autocommit": False,
"autoflush": False
}
)<|fim_middle|>from flask_sqlalchemy import SQLAlchemy
| code_fim | easy | {
"lang": "python",
"repo": "frankiegu/dashboard",
"path": "/rekcurd_dashboard/models/dao.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Initialise the value with zeros
value_type = ir.ArrayType(context.word_type, n_elems)
value = create_aligned_global(context.module, value_type, self.name)
value.modifiers = ['align {}'.format(context.bytes_per_word)]
value.initializer = ir.Constant(value_type, Non... | code_fim | hard | {
"lang": "python",
"repo": "ajstrand/rbc",
"path": "/rbc/codegen/external.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Allocate stack variable for this argument and copy argument
stack_var = context.builder.alloca(
context.word_type, name=arg_name)
context.builder.store(arg_value, stack_var)
# Store the stack variable in the scope
... | code_fim | hard | {
"lang": "python",
"repo": "ajstrand/rbc",
"path": "/rbc/codegen/external.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajstrand/rbc path: /rbc/codegen/external.py
from __future__ import print_function
from llvmlite import ir
from .astnode import ast_node, ASTNode
from .context import (
address_to_llvm_ptr, create_constructor, create_aligned_global,
mangle_symbol_name
)
from .expression import Constant... | code_fim | hard | {
"lang": "python",
"repo": "ajstrand/rbc",
"path": "/rbc/codegen/external.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saulocatharino/SGoLAM path: /habitat_baselines/__init__.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
<|fim_suffix|>__all__ = ["BaseTrainer"... | code_fim | hard | {
"lang": "python",
"repo": "saulocatharino/SGoLAM",
"path": "/habitat_baselines/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ["BaseTrainer", "BaseRLTrainerNonOracle", "BaseRLTrainerOracle", "PPOTrainerO", "PPOTrainerNO", "RolloutStorage", "RolloutStorageOracle", "RolloutStorageNonOracle"]<|fim_prefix|># repo: saulocatharino/SGoLAM path: /habitat_baselines/__init__.py
#!/usr/bin/env python3
# Copyright (c) Facebook, ... | code_fim | hard | {
"lang": "python",
"repo": "saulocatharino/SGoLAM",
"path": "/habitat_baselines/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # self.matches = np.hstack((pts1_2d, pts2_2d))
N = pts1_2d.shape[0]
self.kpts = np.zeros((ncameras,N,2)) #np.hstack((pts1_2d, pts2_2d))
self.kpts[0,:,:] = pts1_2d
self.kpts[1,:,:] = pts2_2d
self.kpts_idxs = np.zeros((N,ncameras), dtype=np.int32)
... | code_fim | hard | {
"lang": "python",
"repo": "flyingGH/SFM-4",
"path": "/src/sfm_graph/pair_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flyingGH/SFM-4 path: /src/sfm_graph/pair_graph.py
import numpy as np
class PairGraph(object):
def __init__(self, pair_img_idxs=[], pose=np.eye(4),
<|fim_suffix|> # self.matches = np.hstack((pts1_2d, pts2_2d))
N = pts1_2d.shape[0]
self.kpts = np.zeros((ncameras,N,2))... | code_fim | hard | {
"lang": "python",
"repo": "flyingGH/SFM-4",
"path": "/src/sfm_graph/pair_graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(0,n):#Mueve filas
for j in range(0,n):#Mueve columnas
if j == i:#Diagonal
a[i] = A[i,j]#Guarda valor en la matriz
elif (i+1) == j:
b[i] = A[i,j]
elif (i-1) == j:
c[i] = A[i,j]
else:
... | code_fim | hard | {
"lang": "python",
"repo": "ce-box/CE3102-Catalogo-Metodos-Numericos",
"path": "/Catalogo/04. Interpolación/Python/trazador_cubico.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ce-box/CE3102-Catalogo-Metodos-Numericos path: /Catalogo/04. Interpolación/Python/trazador_cubico.py
import numpy
import numpy as np
import sys
from sympy import *
#Parametros de entrada
#XK vector de puntos de tamano n, #YK vector de imagenes de tamano n
#Salida
#S vector de polinomios del traz... | code_fim | hard | {
"lang": "python",
"repo": "ce-box/CE3102-Catalogo-Metodos-Numericos",
"path": "/Catalogo/04. Interpolación/Python/trazador_cubico.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # write model to file at every 50 epochs.
if epoch % 50 == 49:
fname = f'finetuned({self.model_name})model_epoch({epoch+1})'
self.save_model(fname)
return epoch_stats
import pickle
class Stats():
def __init__(self, phases=['train', 'val']):
... | code_fim | hard | {
"lang": "python",
"repo": "canermercancs/Deep-Learning-for-Pathology-Image-Analysis",
"path": "/deepnets/torch_0.2_version/convnet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> running_loss_epoch = 0.0
running_corrects_epoch = 0.0
running_loss = 0.0
# Iterate over data.
for i, (inputs, labels) in enumerate(dataloaders[phase]):
inputs, labels = Variable(inputs), Variable(labe... | code_fim | hard | {
"lang": "python",
"repo": "canermercancs/Deep-Learning-for-Pathology-Image-Analysis",
"path": "/deepnets/torch_0.2_version/convnet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: canermercancs/Deep-Learning-for-Pathology-Image-Analysis path: /deepnets/torch_0.2_version/convnet.py
"""
author: Caner Mercan
"""
import pdb
import os
import time
import copy
import numpy as np
import torch
from torch.autograd import Variable
import torchvision
# from deepnets.models.finetuned... | code_fim | hard | {
"lang": "python",
"repo": "canermercancs/Deep-Learning-for-Pathology-Image-Analysis",
"path": "/deepnets/torch_0.2_version/convnet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: redxyb/python path: /code/pycharm project/studying/Thread/创建一个Thread.py
import time,threading
def loop():#定义新线程执行函数
print('thread %s is running...' % threading.current_thread().name)
n = 0
while n <<|fim_suffix|>hread(target=loop,name='LoopThread')#创建一个名为LoopThread的线程
t.start()
t.jo... | code_fim | hard | {
"lang": "python",
"repo": "redxyb/python",
"path": "/code/pycharm project/studying/Thread/创建一个Thread.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>hread(target=loop,name='LoopThread')#创建一个名为LoopThread的线程
t.start()
t.join()
print('thread %s ended.' % threading.current_thread().name)#主线程结束<|fim_prefix|># repo: redxyb/python path: /code/pycharm project/studying/Thread/创建一个Thread.py
import time,threading
def loop():#定义新线程执行函数
print('thread %s is ... | code_fim | medium | {
"lang": "python",
"repo": "redxyb/python",
"path": "/code/pycharm project/studying/Thread/创建一个Thread.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_update(self, api_client):
assert api_client.patch(self.get_detail_url(self.event.id)).status_code == status.HTTP_405_METHOD_NOT_ALLOWED
assert api_client.put(self.get_detail_url(self.event.id)).status_code == status.HTTP_405_METHOD_NOT_ALLOWED
def test_delete(self, api_cl... | code_fim | hard | {
"lang": "python",
"repo": "CreativeOthman/hipeac",
"path": "/tests/api/test_events.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CreativeOthman/hipeac path: /tests/api/test_events.py
import pytest
from django.urls import reverse
from model_bakery import baker
from rest_framework import status
class TestForAnonymous:
<|fim_suffix|> assert api_client.post(self.list_url, {"name": "name"}).status_code == status.HTTP_... | code_fim | hard | {
"lang": "python",
"repo": "CreativeOthman/hipeac",
"path": "/tests/api/test_events.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: felixfontein/cryptography path: /src/_cffi_src/openssl/hmac.py
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import annotations
INCLUDES = """
#i... | code_fim | medium | {
"lang": "python",
"repo": "felixfontein/cryptography",
"path": "/src/_cffi_src/openssl/hmac.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>HMAC_CTX *HMAC_CTX_new(void);
void HMAC_CTX_free(HMAC_CTX *ctx);
"""
CUSTOMIZATIONS = """
"""<|fim_prefix|># repo: felixfontein/cryptography path: /src/_cffi_src/openssl/hmac.py
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file i... | code_fim | hard | {
"lang": "python",
"repo": "felixfontein/cryptography",
"path": "/src/_cffi_src/openssl/hmac.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>hasInstallFile = os.popen("ls Install.py").read()
if len(hasInstallFile) > 0:
os.system("rm -f ../Install_IntermediateCopy5551234.py") #removes the copy of the install file one level up
os.system("rm -f ../ShowSciServerTags_IntermediateCopy5551234.py") #removes the copy of the install file one lev... | code_fim | hard | {
"lang": "python",
"repo": "sciserver/SciScript-Python",
"path": "/Install.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sciserver/SciScript-Python path: /Install.py
#!/usr/bin/python
import sys
import os
commandLineArguments = sys.argv
# Checks whether the library is being run within the SciServer-Compute environment. Returns True if the library is being run within the SciServer-Compute environment, and False if... | code_fim | hard | {
"lang": "python",
"repo": "sciserver/SciScript-Python",
"path": "/Install.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OpenMined/PyDP path: /examples/Sample_code/error_handling.py
# pydp absolute
import pydp as dp
# Sample code to display error handling
x = dp.algorithms.laplacian.Max(1)
try:
print(x.quick<|fim_suffix|>ystemError:
print("system error")
else:
print("i give up")<|fim_middle|>_result([2... | code_fim | medium | {
"lang": "python",
"repo": "OpenMined/PyDP",
"path": "/examples/Sample_code/error_handling.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>_result([2, 8]))
except RuntimeError as e:
print("e")
except SystemError:
print("system error")
else:
print("i give up")<|fim_prefix|># repo: OpenMined/PyDP path: /examples/Sample_code/error_handling.py
# pydp absolute
import pydp as dp
# Sample code to display error <|fim_middle|>handling
x... | code_fim | medium | {
"lang": "python",
"repo": "OpenMined/PyDP",
"path": "/examples/Sample_code/error_handling.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ystemError:
print("system error")
else:
print("i give up")<|fim_prefix|># repo: OpenMined/PyDP path: /examples/Sample_code/error_handling.py
# pydp absolute
import pydp as dp
# Sample code to display error handling
x = dp.algorithms.laplacian.Max(1)
try:
print(x.quick<|fim_middle|>_result([2... | code_fim | medium | {
"lang": "python",
"repo": "OpenMined/PyDP",
"path": "/examples/Sample_code/error_handling.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liangdas/pymqant path: /src/pymqant/rpc/local_client.py
# -*- coding: utf-8 -*-
'''
Created on 17/3/13.
@author: love
'''
import time
import gevent
from gevent import Greenlet
from gevent.queue import Queue, Empty
from pymqant.log.logger import log
from gevent.coros import BoundedSemaphore
from g... | code_fim | hard | {
"lang": "python",
"repo": "liangdas/pymqant",
"path": "/src/pymqant/rpc/local_client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ccf=ClinetCallInfo(callInfo.Cid,callInfo,None)
self.callinfos[callInfo.Cid]=ccf
self.lock.release()
# 发送RPC请求内容到RPC请求队列`rpc_queue`,同时发送的还有`reply_to`和`correlation_id`
self.localServer.write(callInfo)
return None
def _run(self):
try:
... | code_fim | hard | {
"lang": "python",
"repo": "liangdas/pymqant",
"path": "/src/pymqant/rpc/local_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rockychen-dpaw/it-assets path: /tracking/disable_admin.py
from datetime import date, datetime, timedelta
from django.conf import settings
from django.conf.urls import url
from django.contrib.admin import register, ModelAdmin
from django.http import HttpResponse
import pytz
import xlsxwriter
from... | code_fim | hard | {
"lang": "python",
"repo": "rockychen-dpaw/it-assets",
"path": "/tracking/disable_admin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def source_display(self, obj):
return obj.get_source_display()
source_display.short_description = "Source"
def status_display(self, obj):
return obj.get_status_display()
status_display.short_description = "Status"
def priority_display(self, obj):
return obj.... | code_fim | hard | {
"lang": "python",
"repo": "rockychen-dpaw/it-assets",
"path": "/tracking/disable_admin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_subclass_non_uniquish():
class Bar():
def __init__(self, x):
self.x = x
b1 = Bar(10)
b2 = Bar(10)
b3 = Bar(10)
s = {b1, b2, b3}
assert len(s) == 3
assert hash(b1) != hash(b2)
assert hash(b2) != hash(b3)
def test_subclass_uniquish():
clas... | code_fim | medium | {
"lang": "python",
"repo": "jeff-a-holland/python_class_2021_B2",
"path": "/exercise_9/test_solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> b1 = Bar(10)
b2 = Bar(10)
b3 = Bar(10)
s = {b1, b2, b3}
assert len(s) == 3
assert hash(b1) != hash(b2)
assert hash(b2) != hash(b3)
def test_subclass_uniquish():
class Bar(Uniquish):
def __init__(self, x):
self.x = x
b1 = Bar(10)
b2 = Bar(10)
... | code_fim | medium | {
"lang": "python",
"repo": "jeff-a-holland/python_class_2021_B2",
"path": "/exercise_9/test_solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeff-a-holland/python_class_2021_B2 path: /exercise_9/test_solution.py
#!/Users/jeff/.pyenv/shims/python
from solution import Foo, Uniquish
def test_foo():
f1 = Foo(10)
f2 = Foo(10)
f3 = Foo(10)
s = {f1, f2, f3}
assert len(s) == 1
assert hash(f1) == hash(f2)
assert ... | code_fim | medium | {
"lang": "python",
"repo": "jeff-a-holland/python_class_2021_B2",
"path": "/exercise_9/test_solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NCAR/aircraft_nc_utils path: /deprecated/nc_sane/SConscript
# -*- python -*-
tools=['default', 'prefixoptions', 'netcdf']
env = Environment(tools=tools)
env.Append(CXXFLAGS='-g -Werror')
<|fim_suffix|>env.Install('$INSTALL_PREFIX/bin', 'nc_sane')<|fim_middle|>nc_sane = env.Program('nc_sane.cc'... | code_fim | easy | {
"lang": "python",
"repo": "NCAR/aircraft_nc_utils",
"path": "/deprecated/nc_sane/SConscript",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>env.Install('$INSTALL_PREFIX/bin', 'nc_sane')<|fim_prefix|># repo: NCAR/aircraft_nc_utils path: /deprecated/nc_sane/SConscript
# -*- python -*-
tools=['default', 'prefixoptions', 'netcdf']
env = Environment(tools=tools)
env.Append(CXXFLAGS='-g -Werror')
<|fim_middle|>
nc_sane = env.Program('nc_sane.cc'... | code_fim | easy | {
"lang": "python",
"repo": "NCAR/aircraft_nc_utils",
"path": "/deprecated/nc_sane/SConscript",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: widgetti/solara path: /tests/unit/select_test.py
from unittest.mock import MagicMock
import ipyvuetify as vw
import solara
def test_select():
"""
test select widget
"""
disabled = None
on_value = MagicMock()
on_value_multiple = MagicMock()
@solara.component
de... | code_fim | hard | {
"lang": "python",
"repo": "widgetti/solara",
"path": "/tests/unit/select_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> select_multi.v_model = ["test0", "test1"]
assert on_value_multiple.call_count == 1
assert on_value_multiple.call_args[0][0] == ["test0", "test1"]
# test disable
disabled.set(True)
assert len(rc.find(vw.Select, disabled=True).widgets) == 2
rc.close()<|fim_prefix|># repo: widge... | code_fim | hard | {
"lang": "python",
"repo": "widgetti/solara",
"path": "/tests/unit/select_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> items = list(iterator)
for i, item in enumerate(items):
yield i == len(items) - 1, item
def first_flag(iterator: Iterator[T]) -> Iterator[Tuple[bool, T]]:
items = list(iterator)
for i, item in enumerate(items):
yield i == 0, item<|fim_prefix|># repo: GeneLiuXe/d3rlpy pat... | code_fim | medium | {
"lang": "python",
"repo": "GeneLiuXe/d3rlpy",
"path": "/d3rlpy/itertools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def first_flag(iterator: Iterator[T]) -> Iterator[Tuple[bool, T]]:
items = list(iterator)
for i, item in enumerate(items):
yield i == 0, item<|fim_prefix|># repo: GeneLiuXe/d3rlpy path: /d3rlpy/itertools.py
from typing import Iterator, Tuple, TypeVar
T = TypeVar("T")
<|fim_middle|>
def ... | code_fim | medium | {
"lang": "python",
"repo": "GeneLiuXe/d3rlpy",
"path": "/d3rlpy/itertools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeneLiuXe/d3rlpy path: /d3rlpy/itertools.py
from typing import Iterator, Tuple, TypeVar
T = TypeVar("T")
<|fim_suffix|>
def first_flag(iterator: Iterator[T]) -> Iterator[Tuple[bool, T]]:
items = list(iterator)
for i, item in enumerate(items):
yield i == 0, item<|fim_middle|>def... | code_fim | medium | {
"lang": "python",
"repo": "GeneLiuXe/d3rlpy",
"path": "/d3rlpy/itertools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def delete_data_by_shop_sk(self, shop_name):
ShoppedData.query.filter(
ShoppedData.searched_keyword == self.search_keyword,
ShoppedData.shop_name == shop_name,
).delete()
ShoppedData().commit()
return
def get_shops_without_data(self, results... | code_fim | hard | {
"lang": "python",
"repo": "ikp4success/shopasource",
"path": "/tasks/results_factory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ikp4success/shopasource path: /tasks/results_factory.py
import json
import traceback
from datetime import datetime, timezone
from dateutil import parser
from sqlalchemy import or_
from db.models import ShoppedData
from shops.shop_util.extra_function import safe_grab, safe_json, truncate_data
fr... | code_fim | hard | {
"lang": "python",
"repo": "ikp4success/shopasource",
"path": "/tasks/results_factory.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davtalab/TigerControl path: /tigercontrol/planners/registration.py
import re
import importlib
import warnings
from tigercontrol import error
from tigercontrol.utils import Spec, Registry
import copy
# This format is true today, but it's *not* an official spec.
# [username/](planner-name) - Note... | code_fim | hard | {
"lang": "python",
"repo": "davtalab/TigerControl",
"path": "/tigercontrol/planners/registration.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return planner_registry.register(id, **kwargs)
def planner_spec(id):
return planner_registry.spec(id)
def planner(id, **kwargs):
#return planner_registry.make(id, **kwargs)
return planner_registry.get_class(id) # return planner class instead of single instance<|fim_prefix|># repo: davtal... | code_fim | medium | {
"lang": "python",
"repo": "davtalab/TigerControl",
"path": "/tigercontrol/planners/registration.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JaspervanBlokland/SandyApp path: /src/PosterIdentity/PosterIdentity.py
#
# Example Poster Identity
#
# Create a RootStyle instance by calling function. Alter some of the default values
# on initialization, so we don't that to replace them later for our version of the
# root style.
from date... | code_fim | hard | {
"lang": "python",
"repo": "JaspervanBlokland/SandyApp",
"path": "/src/PosterIdentity/PosterIdentity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fontSize = 50
style = makeStyle(template.style, align=align, fontSize=fontSize, fill=NO_COLOR, font='Antenna-Black', textFill=1, leading=fontSize*1.1)
fs = getFormattedString(title, style);
template.textBox(fs, x, y, w=w,
h=fontSize*3, style=style)
def drawCredits(template, x, y,... | code_fim | hard | {
"lang": "python",
"repo": "JaspervanBlokland/SandyApp",
"path": "/src/PosterIdentity/PosterIdentity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''
If tests pass, it means previous implementation is not needed now.
If it will be in future, version control system will remember.
'''
def flatten(list_):
return [item for sublist in list_ for item in sublist]<|fim_prefix|># repo: aurzenligl/tdd_training path: /doj... | code_fim | medium | {
"lang": "python",
"repo": "aurzenligl/tdd_training",
"path": "/dojos/design/6_implementation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aurzenligl/tdd_training path: /dojos/design/6_implementation.py
# TODO - remove previous implementation if not needed
#
# def flatten(list_):
# res = []
# for sublist in list_:
# for elem in sublist:
# res.append(elem)
# return res
def flatten(list_):
<|fim_suffix... | code_fim | medium | {
"lang": "python",
"repo": "aurzenligl/tdd_training",
"path": "/dojos/design/6_implementation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Uranussss/Retro_Game path: /run.py
# coding=utf-8
import sys
import random
import argparse
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from main import Tetris
parser = argparse.ArgumentParser()
parser.add_argument('--value_of_speed', default='300')
cla... | code_fim | hard | {
"lang": "python",
"repo": "Uranussss/Retro_Game",
"path": "/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # play
self.start = QPushButton('start', self)
self.start.setToolTip('start the tetris game!')
self.start.setGeometry(140, 150, 300, 20)
# for child windows of start
layout = QVBoxLayout()
layout.addWidget(self.start)
self.setLayout(layout)
... | code_fim | hard | {
"lang": "python",
"repo": "Uranussss/Retro_Game",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return '<\n' \
'DatasetMeta\n' \
'uuid:{},\n' \
'name:{},\n' \
'data_format:{}, \n' \
'description:{},\n' \
'uri:{},\n' \
'create_time:{},\n' \
'update_tim... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/ai_flow/meta/dataset_meta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgeng777/flink-ai-extended path: /flink-ai-flow/ai_flow/meta/dataset_meta.py
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/ai_flow/meta/dataset_meta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petukhovv/tree2vec path: /main.py
import argparse
from .feature_extractor import feature_extractor
parser = argparse.ArgumentParser()
parser.add_argument('--input', '-i', nargs=1, type=str, help='file with AST')
parser.add_argument('--output', '-o', nargs=1, type=str,
help='... | code_fim | medium | {
"lang": "python",
"repo": "petukhovv/tree2vec",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>features.extend(map(lambda feature: {'type': feature}, simple_features))
feature_extractor(ast_file, features, output)<|fim_prefix|># repo: petukhovv/tree2vec path: /main.py
import argparse
from .feature_extractor import feature_extractor
parser = argparse.ArgumentParser()
parser.add_argument('--input... | code_fim | hard | {
"lang": "python",
"repo": "petukhovv/tree2vec",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leonore/ugenie path: /tests/tdd_units.py
import sys
# replicate folder situation
sys.path.append('../chat-service/model')
import elastic
# a file for unit tests in test driven development
cat, title, answer = elastic.get_description("mario decision")
assert(answer == "MaRio decision means admi... | code_fim | hard | {
"lang": "python",
"repo": "leonore/ugenie",
"path": "/tests/tdd_units.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># tests that were ran while cleaning up code -- test driven development
# sc, sc_len = elastic.get_sc_type_courses("art")
# new_sc, new_sc_len = elastic.get_type_courses("art", "short")
# new_ad, new_ad_len = elastic.get_type_courses("science", "admissions")
# assert sorted(sc) == sorted(new_sc), "New fun... | code_fim | hard | {
"lang": "python",
"repo": "leonore/ugenie",
"path": "/tests/tdd_units.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = Conv2D(filters=64, kernel_size=(3, 3))(x)
x = BatchNormalization()(x)
x = Activation('relu')(x)
x = MaxPooling2D()(x)
x = Flatten()(x)
x = Dense(units=128, activation='relu')(x)
x = Dense(units=50)(x) # feature vector
cnn = Model(inputs=i, outputs=x)
# feed both images into the same CNN
img_placeh... | code_fim | hard | {
"lang": "python",
"repo": "vicb1/deep-learning",
"path": "/1-notebook-examples/keras-udemy-course/cnn_class2/siamese.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vicb1/deep-learning path: /1-notebook-examples/keras-udemy-course/cnn_class2/siamese.py
# https://deeplearningcourses.com/c/advanced-computer-vision
from __future__ import print_function, division
from builtins import range, input
# Note: you may need to update your version of future
# sudo pip i... | code_fim | hard | {
"lang": "python",
"repo": "vicb1/deep-learning",
"path": "/1-notebook-examples/keras-udemy-course/cnn_class2/siamese.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.bbox.aspect = 1
assert_allclose(self.bbox.height, 2.)
class AnchorDragBase(object):
""" Base class, that moves all anchors in several directions
Subclasses override the check method, to test that the drag behaves
as expected
"""
# starting position of bbox
... | code_fim | hard | {
"lang": "python",
"repo": "ChrisBeaumont/bermuda",
"path": "/mpl_shapes/tests/test_bbox.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_anchor_toggle_visibility(self):
self.a.visible = False
self.a.visible = True
class TestBBox(object):
def setup_method(self, method):
self.bbox = BBox(center=(3, 4), width=2, height=3, theta=0)
def check_corners(self, vertices, corners):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "ChrisBeaumont/bermuda",
"path": "/mpl_shapes/tests/test_bbox.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChrisBeaumont/bermuda path: /mpl_shapes/tests/test_bbox.py
from itertools import product
from numpy.testing import assert_allclose
import pytest
from ..bbox import AnchorPoint, FrozenError, BBox
class TestAnchor(object):
def setup_method(self, method):
self.a = AnchorPoint(x=1, y=... | code_fim | hard | {
"lang": "python",
"repo": "ChrisBeaumont/bermuda",
"path": "/mpl_shapes/tests/test_bbox.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opensounder/python-sllib path: /sllib/reader.py
from sllib.errors import FieldNotFoundError
from typing import List, Tuple
import io
import logging
from .header import Header
from .frame import Frame
from .definitions import CALCULATED_FIELDS, FRAME_FIELDS
logger = logging.getLogger(__name__)
... | code_fim | hard | {
"lang": "python",
"repo": "opensounder/python-sllib",
"path": "/sllib/reader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __next__(self) -> Frame:
r"""Reads next frame.
:returns:
A read frame instance
"""
while True:
frame = Frame.read(self.fs, self.format_version, self.header.framesize, strict=self.strict)
if frame is None:
raise St... | code_fim | hard | {
"lang": "python",
"repo": "opensounder/python-sllib",
"path": "/sllib/reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open(path, "w")
content = "".join(content)
f.write(content)
f.close()
def createRenderCam(obj):
cam = bpy.data.cameras.new("cam")
cam_ob = bpy.data.objects.new("Cam", cam)
bpy.context.scene.objects.link(cam_ob)
# setup camera
tt = cam_ob.constraints.new("TRACK_TO")... | code_fim | hard | {
"lang": "python",
"repo": "thomasrstorey/recipesfordisaster",
"path": "/render_and_export.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomasrstorey/recipesfordisaster path: /render_and_export.py
'''
render_and_export.py
open dish.blend
gather all objects together into one object, named <title> (provided as arg)
uv unwrap
bake all textures to one texture
set up three cameras and three-point lighting
render three images
export ... | code_fim | hard | {
"lang": "python",
"repo": "thomasrstorey/recipesfordisaster",
"path": "/render_and_export.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def execute(title, ipath, opath):
ctx = bpy.context
scn = ctx.scene
joinScene(scn, title)
obj = bpy.data.objects.get(title)
if(obj == None):
exit(1)
uvUnwrap(scn, obj)
img = bakeTexture(scn, obj, title)
export(scn, obj, img, title, opath)
render(scn, obj, title,... | code_fim | hard | {
"lang": "python",
"repo": "thomasrstorey/recipesfordisaster",
"path": "/render_and_export.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Dictionary = corpora.Dictionary(Texts)
CorpusMat = [Dictionary.doc2bow(text) for text in Texts]
LDAModel = models.ldamodel.LdaModel(CorpusMat, num_topics=3, id2word = Dictionary, passes=20)
print(LDAModel.print_topics(num_topics=3, num_words=3))<|fim_prefix|># repo: Evelynatrocks/Python-Machine-Lear... | code_fim | hard | {
"lang": "python",
"repo": "Evelynatrocks/Python-Machine-Learning-Cookbook-Second-Edition",
"path": "/Chapter14/PrepDataLDA.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Evelynatrocks/Python-Machine-Learning-Cookbook-Second-Edition path: /Chapter14/PrepDataLDA.py
from nltk.tokenize import RegexpTokenizer
from stop_words import get_stop_words
from nltk.stem.porter import PorterStemmer
from gensim import corpora, models
Doc1 = "Some doctors say that pizza is good ... | code_fim | medium | {
"lang": "python",
"repo": "Evelynatrocks/Python-Machine-Learning-Cookbook-Second-Edition",
"path": "/Chapter14/PrepDataLDA.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Packages the design parameters into a numpy array.
"""
self.design_params = np.array([self.r1, self.r2, self.d1, self.d2, self.Ixx, self.Iyy, self.Izz])
def select_SRM(self, url1, url2=None):
"""Creates SolidRocketMotor object complete with motor information... | code_fim | hard | {
"lang": "python",
"repo": "matthewdmorse/SRMspinanalysis",
"path": "/SRMspinanalysis/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matthewdmorse/SRMspinanalysis path: /SRMspinanalysis/model.py
import numpy as np
import get_data
import solver
import plot
import os
class RocketModel(object):
"""Rocket model includes physical characteristics of launch vehicle.
Attributes
----------
r1 : Radial location of soli... | code_fim | hard | {
"lang": "python",
"repo": "matthewdmorse/SRMspinanalysis",
"path": "/SRMspinanalysis/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def solve_eom(self, tend, dt=0.0001):
"""Solves equations of motion for a specified duration (s) with an optional time step argument (s).
"""
ic = np.zeros(6)
tstart = 0.0
self.t_span = np.linspace(tstart, tend, tend/dt)
self.create_design_params()
... | code_fim | hard | {
"lang": "python",
"repo": "matthewdmorse/SRMspinanalysis",
"path": "/SRMspinanalysis/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danse-inelastic/AbInitio path: /espresso/vinil/vinil/qecalc/qetask/q2rtask.py
#!/usr/bin/env python
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# QEcalc by DANSE Inelastic group
# Nikolay Markovskiy
# Cali... | code_fim | medium | {
"lang": "python",
"repo": "danse-inelastic/AbInitio",
"path": "/espresso/vinil/vinil/qecalc/qetask/q2rtask.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.input = QEInput(filename = self.setting.q2rInput, type = 'q2r')
self.output = QEOutput(self.setting, type = 'q2r')
self._cmdStr = "q2r.x < " + self.setting.q2rInput + " > " + \
self.setting.q2rOutput
if __name__ == "__main__":
print "Hello World";... | code_fim | hard | {
"lang": "python",
"repo": "danse-inelastic/AbInitio",
"path": "/espresso/vinil/vinil/qecalc/qetask/q2rtask.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> server.serve(port=args.port, host=args.host, root='build/html')
else:
import http.server
import socketserver
host = args.host if args.host is not None else "127.0.0.1"
port = args.port
Handler = lambda request, client_address, server: http.server.SimpleHTTPRequestHandler(
... | code_fim | medium | {
"lang": "python",
"repo": "bohlinger/wavy",
"path": "/docs/serve.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bohlinger/wavy path: /docs/serve.py
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description='Watch and serve documentation.')
parser.add_argument('--host,h', dest='host', type=str, default=None)
parser.add_argument('--port,p', dest='port', type=str, default=5500)
parse... | code_fim | hard | {
"lang": "python",
"repo": "bohlinger/wavy",
"path": "/docs/serve.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ine/lib/webapp2-2.5.2')
sys.path.insert(0,'/usr/local/google_appengine/lib/webob-1.2.3')
sys.path.insert(0,'/usr/local/google_appengine/lib/yaml/lib')
import argparse
import etl
if __name__ =='__main__':
PARSER = argparse.ArgumentParser(add_help=False, parents=[etl.PARSER])
etl.main(PARSER.parse_... | code_fim | medium | {
"lang": "python",
"repo": "graemian/ami-mooc-pilot",
"path": "/tools/etl/gcbpaths.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: graemian/ami-mooc-pilot path: /tools/etl/gcbpaths.py
import sys
sys.path.insert(0,'/Users/graemepyle/Dropbox/Documents/AMI/MOOC/coursebuilder')
sys.path.insert(0,'/usr/local/google_appengine')
sys.path.insert(<|fim_suffix|>rt argparse
import etl
if __name__ =='__main__':
PARSER = argparse.Arg... | code_fim | hard | {
"lang": "python",
"repo": "graemian/ami-mooc-pilot",
"path": "/tools/etl/gcbpaths.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = read_complex_data(instances = instances,
dict_onehot = dict_onehot,
cols_numb_onehot = cols_numb_onehot,
cols_ordinal_ = cols_ordinal,
cols_continuous_ = cols_continuous,
... | code_fim | hard | {
"lang": "python",
"repo": "alanlegoallec/Multidimensionality_of_Aging",
"path": "/Biomarkers_and_XWAS_Pipeline/aging/environment_processing/PsychosocialFactors/mental_health_processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alanlegoallec/Multidimensionality_of_Aging path: /Biomarkers_and_XWAS_Pipeline/aging/environment_processing/PsychosocialFactors/mental_health_processing.py
from ..base_processing import read_complex_data
"""
1920 Mood swings
1930 Miserableness
1940 Irritability
1950 Sensitivity / hurt feelings... | code_fim | hard | {
"lang": "python",
"repo": "alanlegoallec/Multidimensionality_of_Aging",
"path": "/Biomarkers_and_XWAS_Pipeline/aging/environment_processing/PsychosocialFactors/mental_health_processing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # solve 0 = cos(x), this has no uncertainty!
fn = lambda x: cos(x)
x = implicit(fn,0,math.pi)
self.assertTrue( equivalent(value(x), math.pi/2.0 ) )
self.assertTrue( equivalent( value(fn(x)),0 ) )
self.assertTrue( equivalent( rp.u_component(x,x),0.0 ) )
... | code_fim | hard | {
"lang": "python",
"repo": "MSLNZ/GTC",
"path": "/test/test_implicit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MSLNZ/GTC path: /test/test_implicit.py
import unittest
import math
TOL = 1E-13
DIGITS = 13
from GTC import *
from testing_tools import *
implicit = fn.implicit
#-----------------------------------------------------
class TestImplicit(unittest.TestCase):
"""
The implicit(fn,x_min,x_max... | code_fim | medium | {
"lang": "python",
"repo": "MSLNZ/GTC",
"path": "/test/test_implicit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lintonylin/Information_Retrieval path: /train_tacred_bert_softmax.py
# coding:utf-8
import torch
import numpy as np
import json
import opennre
from opennre import encoder, model, framework
import sys
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--mask_entity'... | code_fim | hard | {
"lang": "python",
"repo": "lintonylin/Information_Retrieval",
"path": "/train_tacred_bert_softmax.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># opennre.download('bert_base_uncased', root_path=root_path)
rel2id = json.load(open(os.path.join(root_path, 'benchmark/tacred/tacred_rel2id.json')))
# Define the sentence encoder
sentence_encoder = opennre.encoder.BERTEncoder(
max_length=128,
pretrain_path=args.pretrain_path,
mask_entity=ar... | code_fim | medium | {
"lang": "python",
"repo": "lintonylin/Information_Retrieval",
"path": "/train_tacred_bert_softmax.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Define the whole training framework
framework = opennre.framework.SentenceRE(
train_path=os.path.join(root_path, 'benchmark/tacred/tacred_train.txt'),
val_path=os.path.join(root_path, 'benchmark/tacred/tacred_val.txt'),
test_path=os.path.join(root_path, 'benchmark/tacred/tacred_test.txt'),
... | code_fim | hard | {
"lang": "python",
"repo": "lintonylin/Information_Retrieval",
"path": "/train_tacred_bert_softmax.py",
"mode": "spm",
"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.