text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: JackZhouSz/human_motion_manifold path: /trainer.py
return m_recon_flip, m_recon_vel_flip
def recon_criterion(self, input_seq, target_seq):
# 3 for exp. 4 for quaternion
return torch.mean((input_seq.view(input_seq.shape[0], input_seq.shape[1], -1, 3)
... | code_fim | hard | {
"lang": "python",
"repo": "JackZhouSz/human_motion_manifold",
"path": "/trainer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> m_recon_vel_flip_np = m_recon_vel_flip_un.data.cpu().numpy()
m_recon_vel_np = np.flip(m_recon_vel_flip_np, 1)
m_recon_vel_np = m_recon_vel_np.reshape(m_recon_vel_np.shape[0], m_recon_vel_np.shape[1], -1, 3)
m_recon_vel_np = expmap_to_quaterni... | code_fim | hard | {
"lang": "python",
"repo": "JackZhouSz/human_motion_manifold",
"path": "/trainer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> type_map(gtype, add_enum)
return ffi.NULL
# Enums
type_map(type_from_name('GEnum'), add_enum)
# Flags
all_nicknames.append('VipsForeignPngFilter')
gtype_to_js_param[type_from_name('VipsForeignPngFilter')] = f'{remove_prefix("VipsForeignPngFilter")} | Flag'
with ... | code_fim | hard | {
"lang": "python",
"repo": "dpribul/wasm-vips",
"path": "/build/gen_type_declarations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> values = values_for_enum(gtype) if is_enum else values_for_flag(gtype)
for i, value in enumerate(values):
js_value = value.replace('-', '_')
if js_value == 'error' or js_value == 'notset':
continue
member = node.f... | code_fim | hard | {
"lang": "python",
"repo": "dpribul/wasm-vips",
"path": "/build/gen_type_declarations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dpribul/wasm-vips path: /build/gen_type_declarations.py
#!/usr/bin/env python
# This file generates the TypeScript declaration file
# this needs pyvips
#
# pip install --user git+https://github.com/kleisauke/pyvips@flags-helper
import argparse
import xml.etree.ElementTree as ET
from pyvips ... | code_fim | hard | {
"lang": "python",
"repo": "dpribul/wasm-vips",
"path": "/build/gen_type_declarations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Howest-AdvMathProg/project-2021-Joren-vanGoethem path: /server/main.py
from backend import Backend
import json
import sys
from gui.gui import GUI
from util.logger import Log
# in-depth memory access violation error logging
import faulthandler
faulthandler.enable()
<|fim_suffix|>backend = Backen... | code_fim | medium | {
"lang": "python",
"repo": "Howest-AdvMathProg/project-2021-Joren-vanGoethem",
"path": "/server/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
Log.info('MAIN', 'Starting application...')
backend.start()
gui.run()
except (Exception, KeyboardInterrupt) as e:
if (isinstance(e, KeyboardInterrupt)):
Log.info('MAIN', 'Received keyboard interrupt')
else:
print("Unexpected error...")
print(e)
finally:
... | code_fim | medium | {
"lang": "python",
"repo": "Howest-AdvMathProg/project-2021-Joren-vanGoethem",
"path": "/server/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save_gradient(self, g, k):
path = os.path.join(self.log_path, 'gradient')
if not os.path.exists(path):
os.makedirs(path)
g.astype(np.float32).tofile(os.path.join(path, 'g_'+str(k)))
def save_misfit(self, fval, g):
file = os.path.join(self.log_path, 'misfit')
norm_g = np.max(np.abs(g))
... | code_fim | hard | {
"lang": "python",
"repo": "LongyanU/devito-fwi",
"path": "/minimize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LongyanU/devito-fwi path: /minimize.py
import os
import numpy as np
from fwi import fwi_loss
def divides(i, j):
"""True if j divides i"""
if j is 0:
return False
elif i % j:
return False
else:
return True
class minimize(object):
def __init__(self, optimizer, maxIter=10, ftol=1e-2, ... | code_fim | hard | {
"lang": "python",
"repo": "LongyanU/devito-fwi",
"path": "/minimize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def finalize(self, m, g, fk, fkp1, iter_count):
self.write_count()
if divides(iter_count, self.save_model_freq):
self.save_model(m, iter_count)
status = self.check_stopping_criteria(fk, fkp1, g)
return status
def check_stopping_criteria(self, fk, fkp1, g):
"""Stop when |fk - fkp1|/max(|fk|... | code_fim | hard | {
"lang": "python",
"repo": "LongyanU/devito-fwi",
"path": "/minimize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NJManganelli/FourTopNAOD path: /Kai/python/data/leptonSF/Electron/formSFConfiguration.py
import ROOT
# muon_options_syst["LooseRelIso/TightIDandIPCut"] = {"RunBCDEF_SF_ISO_syst.root", "NUM_LooseRelIso_DEN_TightIDandIPCut_pt_abseta_syst", "TH2Lookup", };
for fn, f in enumerate(["2016/UL/post... | code_fim | hard | {
"lang": "python",
"repo": "NJManganelli/FourTopNAOD",
"path": "/Kai/python/data/leptonSF/Electron/formSFConfiguration.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>f)
kf = f.split("/")[-1]
in_file = ROOT.TFile.Open(f, "read")
subkeys = [(kk.GetName(), kk.GetClassName()) for kk in in_file.GetListOfKeys()]
for subkey, subkeyclassname in subkeys:
if subkey != "EGamma_SF2D": continue
h = in_file.Get(subkey)
# print("subkey: ", sub... | code_fim | hard | {
"lang": "python",
"repo": "NJManganelli/FourTopNAOD",
"path": "/Kai/python/data/leptonSF/Electron/formSFConfiguration.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chloe-Shen/TGSA path: /models/TGDRP.py
import torch
import torch.nn as nn
from models.GNN_drug import GNN_drug
from models.GNN_cell import GNN_cell
class TGDRP(nn.Module):
def __init__(self, cluster_predefine, args):
super().__init__()
self.batch_size = args.batch_s... | code_fim | hard | {
"lang": "python",
"repo": "Chloe-Shen/TGSA",
"path": "/models/TGDRP.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # forward cell
x_cell = self.GNN_cell(cell)
x_cell = self.cell_emb(x_cell)
# combine drug feature and cell line feature
x = torch.cat([x_drug, x_cell], -1)
x = self.regression(x)
return x<|fim_prefix|># repo: Chloe-Shen/TGSA path: /models/... | code_fim | hard | {
"lang": "python",
"repo": "Chloe-Shen/TGSA",
"path": "/models/TGDRP.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def add_AccessApprovalServicer_to_server(servicer, server):
rpc_method_handlers = {
"ListApprovalRequests": grpc.unary_unary_rpc_method_handler(
servicer.ListApprovalRequests,
request_deserializer=google_dot_cloud_dot_accessapproval__v1_dot_proto_dot_accessapproval__pb... | code_fim | hard | {
"lang": "python",
"repo": "johnsonchuang1970/python-access-approval",
"path": "/google/cloud/accessapproval_v1/proto/accessapproval_pb2_grpc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnsonchuang1970/python-access-approval path: /google/cloud/accessapproval_v1/proto/accessapproval_pb2_grpc.py
# Copyright 2020 Google LLC
#
# 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 cop... | code_fim | hard | {
"lang": "python",
"repo": "johnsonchuang1970/python-access-approval",
"path": "/google/cloud/accessapproval_v1/proto/accessapproval_pb2_grpc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> If a request is not approved or dismissed, we call it pending.
"""
def ListApprovalRequests(self, request, context):
"""Lists approval requests associated with a project, folder, or organization.
Approval requests can be filtered by state (pending, active, dismissed).
The order is... | code_fim | hard | {
"lang": "python",
"repo": "johnsonchuang1970/python-access-approval",
"path": "/google/cloud/accessapproval_v1/proto/accessapproval_pb2_grpc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># You can us fixture by adding it as argument to tests. Its value will be the
# return value of fixture function:
# def test_format_data_for_excel(example_people_data):
# assert format_data_for_excel(example_people_data) == """given,family,title
# Alfonsa,Ruiz,Senior Software Engineer
# Sayid,Khan,Proje... | code_fim | hard | {
"lang": "python",
"repo": "ernestyalumni/HrdwCCppCUDA",
"path": "/Voltron/unit_tests/test_with_pytest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ernestyalumni/HrdwCCppCUDA path: /Voltron/unit_tests/test_with_pytest.py
"""
@file test_with_pytest.py
@ref https://realpython.com/pytest-python-testing/
@details
EXAMPLE USAGE:
pytest ./test_with_pytest.py
or
pytest test_with_pytest.py
"""
import pytest
# If you find yourself writing sever... | code_fim | hard | {
"lang": "python",
"repo": "ernestyalumni/HrdwCCppCUDA",
"path": "/Voltron/unit_tests/test_with_pytest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_path(self, obj):
try:
return obj.media_file_orig.url
except Exception:
return None
def get_path_large(self, obj):
try:
return obj.media_file_large.url
except Exception:
return None
def get_path_medium(sel... | code_fim | hard | {
"lang": "python",
"repo": "LocalGround/localground",
"path": "/apps/site/api/serializers/photo_serializer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LocalGround/localground path: /apps/site/api/serializers/photo_serializer.py
import os
import sys
from django.conf import settings
from localground.apps.site.api.serializers.base_serializer \
import MediaGeometrySerializer, NamedSerializerMixin
from rest_framework import serializers
from loca... | code_fim | hard | {
"lang": "python",
"repo": "LocalGround/localground",
"path": "/apps/site/api/serializers/photo_serializer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_path_marker_lg(self, obj):
try:
return obj.media_file_marker_lg.url
except Exception:
return None
def get_path_marker_sm(self, obj):
try:
return obj.media_file_marker_sm.url
except Exception:
return None
... | code_fim | hard | {
"lang": "python",
"repo": "LocalGround/localground",
"path": "/apps/site/api/serializers/photo_serializer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeqiTang/pymatflow path: /pymatflow/siesta/scripts/siesta-scf.py
#!/usr/bin/evn python
# _*_ coding:utf-8 _*_
import os
import argparse
from pymatflow.siesta.static import static_run
"""
usage:
qe-scf.py -f xxx.xyz -k '2 2 2 0 0 0' -- 100
"""
if __name__ == "__main__":
... | code_fim | hard | {
"lang": "python",
"repo": "DeqiTang/pymatflow",
"path": "/pymatflow/siesta/scripts/siesta-scf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument("--optical-energy-minimum", type=float,
default=0.0,
help="Optical.Energy.Minimum")
parser.add_argument("--optical-energy-maximum", type=float,
default=10.0,
help="Optical.Energy.Maximum")
parser.add_argument("--opti... | code_fim | hard | {
"lang": "python",
"repo": "DeqiTang/pymatflow",
"path": "/pymatflow/siesta/scripts/siesta-scf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument("--jobname", type=str, default="siesta-scf",
help="jobname on the pbs server")
parser.add_argument("--nodes", type=int, default=1,
help="Nodes used in server")
parser.add_argument("--ppn", type=int, default=32,
help="ppn of the s... | code_fim | hard | {
"lang": "python",
"repo": "DeqiTang/pymatflow",
"path": "/pymatflow/siesta/scripts/siesta-scf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
##https://stackoverflow.com/questions/15173225/how-to-calculate-cosine-similarity-given-2-sentence-strings-python
#text1 = 'This is a foo bar sentence '
#text2 = 'This sentence is similar to a foo bar sentence .'
#https://stackoverflow.com/questions/41610543/corpora-stopwords-not-found-when-import... | code_fim | hard | {
"lang": "python",
"repo": "manjunath-s/datascience-experiments",
"path": "/similarity-algorithms/similarity-algo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manjunath-s/datascience-experiments path: /similarity-algorithms/similarity-algo.py
import re, math
from collections import Counter
from nltk.corpus import stopwords
WORD = re.compile(r'\w+')
stop_words = set(stopwords.words('english'))
stop_words.update(['.', ',', '"', "'", '?', '!', ':', ';', ... | code_fim | hard | {
"lang": "python",
"repo": "manjunath-s/datascience-experiments",
"path": "/similarity-algorithms/similarity-algo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rusamus/HPointLoc path: /pipelines/utils/subprocces.py
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
import subprocess
import sys
import os
import os.path as path
from typing import List, Optional
#from 3rd.kapture_localization.utils.logging import getLogger
def find_in_PATH(... | code_fim | hard | {
"lang": "python",
"repo": "Rusamus/HPointLoc",
"path": "/pipelines/utils/subprocces.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># getLogger().debug(f'run_python_command : {args}')
use_shell = sys.platform.startswith("win")
python_process = subprocess.Popen(args, shell=use_shell)
python_process.wait()
if python_process.returncode != 0:
raise ValueError('\nSubprocess Error (Return code:' f' {python_proces... | code_fim | hard | {
"lang": "python",
"repo": "Rusamus/HPointLoc",
"path": "/pipelines/utils/subprocces.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pbetkier/add-issue-id-hook path: /spec.py
#!/usr/bin/env python
import os
import subprocess
import unittest
class AddIssueIdHookTest(unittest.TestCase):
def setUp(self):
self.execute('git init tmp_repo', 'cp commit-msg tmp_repo/.git/hooks/.')
os.chdir('tmp_repo')
def ... | code_fim | hard | {
"lang": "python",
"repo": "pbetkier/add-issue-id-hook",
"path": "/spec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
return subprocess.check_output('; '.join(commands), shell=True).decode()
except subprocess.CalledProcessError as e:
print(e)
def assert_last_commit_message_is(self, expected):
self.assertEqual(self.execute('git log -1 --pretty=format:"%s"'), expect... | code_fim | hard | {
"lang": "python",
"repo": "pbetkier/add-issue-id-hook",
"path": "/spec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_doesnt_modify_commit_message_if_it_already_contains_this_issue_id(self):
# given
self.on_branch("EXAMPLE-1337_some_feature")
self.with_changes_to_be_committed()
# when
self.commit_with_message("EXAMPLE-1337 Added some file.")
# then
se... | code_fim | hard | {
"lang": "python",
"repo": "pbetkier/add-issue-id-hook",
"path": "/spec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ngdeva99/Fulcrum path: /Cheapest Flights Within K Stops.py
class Solution:
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
#bellmann ford algorithm
#### what i tried
"""
maxi = 1000005
dist = [... | code_fim | hard | {
"lang": "python",
"repo": "ngdeva99/Fulcrum",
"path": "/Cheapest Flights Within K Stops.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(dist)
if dist[dst]==maxi:
return -1
return dist[dst]
"""
costs = [float('inf')] * n
costs[src] = 0
for _ in range(K+1):
copy = costs[:]
for s, d, w in flights:
copy[d] = min(copy[... | code_fim | hard | {
"lang": "python",
"repo": "ngdeva99/Fulcrum",
"path": "/Cheapest Flights Within K Stops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
"prompt": self.prompt,
"inputHandler": self.inputHandler,
"check": self.check,
"completionHandler": self.completionHandler
}<|fim_prefix|># repo: Wombatlord/St_Germain path: /src/models/recipe/menuConfig.py
from typing import... | code_fim | hard | {
"lang": "python",
"repo": "Wombatlord/St_Germain",
"path": "/src/models/recipe/menuConfig.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Wombatlord/St_Germain path: /src/models/recipe/menuConfig.py
from typing import Callable, Coroutine, Any
import discord
from discord.ext.commands import Context
<|fim_suffix|>class NodeConfig:
def __init__(self, prompt: discord.Embed, inputHandler: InputHandler, check: Check, comple... | code_fim | hard | {
"lang": "python",
"repo": "Wombatlord/St_Germain",
"path": "/src/models/recipe/menuConfig.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_calculate_trading_intensity_deterministic(self):
def curve_fn(t_, a_, b_): # see curve fit in `TradingIntensityIndicator.c_estimate_intensity`
return a_ * np.exp(-b_ * t_)
last_price = 1
trade_price_levels = [2, 3, 4, 5]
a = 2
b = 0.1
... | code_fim | hard | {
"lang": "python",
"repo": "CoinAlpha/hummingbot",
"path": "/test/hummingbot/strategy/utils/trailing_indicators/test_trading_intensity.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CoinAlpha/hummingbot path: /test/hummingbot/strategy/utils/trailing_indicators/test_trading_intensity.py
import math
import unittest
from decimal import Decimal
import numpy as np
import pandas as pd
from hummingbot.client.config.client_config_map import ClientConfigMap
from hummingbot.client.c... | code_fim | hard | {
"lang": "python",
"repo": "CoinAlpha/hummingbot",
"path": "/test/hummingbot/strategy/utils/trailing_indicators/test_trading_intensity.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stan-dev/cmdstanpy path: /test/test_compliance.py
"""Testing for things like pickleability, deep copying"""
import copy
import pathlib
import pickle
import cmdstanpy
DATAFILES_PATH = pathlib.Path(__file__).parent.resolve() / 'data'
def test_sample_pickle_ability() -> None:
csvfiles_path ... | code_fim | hard | {
"lang": "python",
"repo": "stan-dev/cmdstanpy",
"path": "/test/test_compliance.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_variational_copy_ability() -> None:
csvfiles_path = DATAFILES_PATH / 'variational'
fit = cmdstanpy.from_csv(path=csvfiles_path)
fit2 = copy.deepcopy(fit)
assert fit.stan_variables().keys() == fit2.stan_variables().keys()<|fim_prefix|># repo: stan-dev/cmdstanpy path: /test/test_c... | code_fim | hard | {
"lang": "python",
"repo": "stan-dev/cmdstanpy",
"path": "/test/test_compliance.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_variational_copy_ability() -> None:
csvfiles_path = DATAFILES_PATH / 'variational'
fit = cmdstanpy.from_csv(path=csvfiles_path)
fit2 = copy.deepcopy(fit)
assert fit.stan_variables().keys() == fit2.stan_variables().keys()<|fim_prefix|># repo: stan-dev/cmdstanpy path: /test/test_co... | code_fim | hard | {
"lang": "python",
"repo": "stan-dev/cmdstanpy",
"path": "/test/test_compliance.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vishwachintu/Crime-Spot path: /app/app.py
#!/usr/bin/env python
from flask import Flask, render_template, flash, request
import logging, io, base64, os, datetime
from datetime import timedelta
# global variables
crime_horizon_df = None
src = 'static/sf-crime-horizon.csv'
app = Flask(__... | code_fim | hard | {
"lang": "python",
"repo": "vishwachintu/Crime-Spot",
"path": "/app/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/prediction", methods=['POST', 'GET'])
def prediction():
if request.method == 'POST':
horizon_date_int = int(request.form.get('slider_crime_horizon'))
# offering 3 months horizon over 270 points - 3 per day to account for time segments
date_in... | code_fim | hard | {
"lang": "python",
"repo": "vishwachintu/Crime-Spot",
"path": "/app/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/access_info_list_enum.py
# -*- coding: utf-8 -*-
# Copyright 2023 Cohesity Inc.
class AccessInfoListEnum(object):
"""Implementation of the 'AccessInfoList' enum.
Specifies the access information. 'kFileReadData' indica... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/access_info_list_enum.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> KFILEEXECUTE = 'kFileExecute'
KFILEDELETECHILD = 'kFileDeleteChild'
KFILEREADATTRIBUTES = 'kFileReadAttributes'
KFILEWRITEATTRIBUTES = 'kFileWriteAttributes'
KDELETE = 'kDelete'
KREADCONTROL = 'kReadControl'
KWRITEDAC = 'kWriteDac'
KWRITEOWNER = 'kWriteOwner'
KS... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/access_info_list_enum.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloud-custodian/cloud-custodian path: /tools/c7n_azure/c7n_azure/resources/subscription.py
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from azure.mgmt.resource.policy.models import PolicyAssignment
from azure.mgmt.resource import SubscriptionClient
from azure.m... | code_fim | hard | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/tools/c7n_azure/c7n_azure/resources/subscription.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Subscription.filter_registry.register('missing', Missing)
@Subscription.filter_registry.register('diagnostic-settings')
class SubscriptionDiagnosticSettingFilter(ValueFilter):
"""Filter by diagnostic settings for this subscription
Each diagnostic setting for the subscription is made available to... | code_fim | hard | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/tools/c7n_azure/c7n_azure/resources/subscription.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@given('the user is on the Survey Details Page')
@when('they navigate to the Survey Details page')
def user_navigate_to_survey_details(context):
collection_exercise.go_to(context.short_name)
@then('they are able to see the Status for each collection exercise')
def survey_ce_state_is_scheduled(conte... | code_fim | hard | {
"lang": "python",
"repo": "uk-gov-mirror/ONSdigital.rasrm-acceptance-tests",
"path": "/acceptance_tests/features/steps/view_collection_exercise_scheduled_state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uk-gov-mirror/ONSdigital.rasrm-acceptance-tests path: /acceptance_tests/features/steps/view_collection_exercise_scheduled_state.py
from behave import given, when, then
from acceptance_tests.features.pages import collection_exercise, collection_exercise_details, survey
from controllers.collection... | code_fim | hard | {
"lang": "python",
"repo": "uk-gov-mirror/ONSdigital.rasrm-acceptance-tests",
"path": "/acceptance_tests/features/steps/view_collection_exercise_scheduled_state.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: getsentry/sentry-health path: /tests/test_utils.py
from tervis.web import is_allowed_origin
<|fim_suffix|> assert is_allowed_origin('http://foo', ['http://foo'])
assert is_allowed_origin('http://foo', ['*'])
assert not is_allowed_origin('http://foo', ['http://bar'])<|fim_middle|>def ... | code_fim | easy | {
"lang": "python",
"repo": "getsentry/sentry-health",
"path": "/tests/test_utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert is_allowed_origin('http://foo', ['http://foo'])
assert is_allowed_origin('http://foo', ['*'])
assert not is_allowed_origin('http://foo', ['http://bar'])<|fim_prefix|># repo: getsentry/sentry-health path: /tests/test_utils.py
from tervis.web import is_allowed_origin
<|fim_middle|>
def ... | code_fim | easy | {
"lang": "python",
"repo": "getsentry/sentry-health",
"path": "/tests/test_utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> value = get_number_of_lit_lights(instructions)
self.assertEqual(expected_value, value)
def test_get_number_of_lit_lights_example_3(self):
expected_value = 0
instructions = [("turn off", (499, 499), (500, 500))]
value = get_number_of_lit_lights(instructions)
... | code_fim | medium | {
"lang": "python",
"repo": "willienel/advent-of-code-2015",
"path": "/day6/part1/test_get_number_of_lit_lights.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_number_of_lit_lights_example_3(self):
expected_value = 0
instructions = [("turn off", (499, 499), (500, 500))]
value = get_number_of_lit_lights(instructions)
self.assertEqual(expected_value, value)<|fim_prefix|># repo: willienel/advent-of-code-2015 path... | code_fim | hard | {
"lang": "python",
"repo": "willienel/advent-of-code-2015",
"path": "/day6/part1/test_get_number_of_lit_lights.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willienel/advent-of-code-2015 path: /day6/part1/test_get_number_of_lit_lights.py
import unittest
from day6.part1.get_number_of_lit_lights import get_number_of_lit_lights
class TestGetNumberOfLitLights(unittest.TestCase):
def test_get_number_of_lit_lights_example_1(self):
expected... | code_fim | hard | {
"lang": "python",
"repo": "willienel/advent-of-code-2015",
"path": "/day6/part1/test_get_number_of_lit_lights.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronalcc/vnpy path: /vnpy/trader/app/strategy/uiStrategyInstanceListWidget.py
# encoding: UTF-8
'''
CTA模块相关的GUI控制组件
'''
from vnpy.trader.uiBasicWidget import *
from vnpy.event import Event
from vnpy.trader.vtEvent import *
from PyQt4 import QtGui
from abc import ABCMeta,abstractmethod,abstractpr... | code_fim | hard | {
"lang": "python",
"repo": "ronalcc/vnpy",
"path": "/vnpy/trader/app/strategy/uiStrategyInstanceListWidget.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 设置允许排序
self.setSorting(True)
# 初始化表格
self.initTable()
self.dictUtils = CommonUtils()
# 注册事件监听
#self.registerEvent()
#------------------------------------------------
def initTable(self):
super(StrategyInstanceListMonitor, self... | code_fim | hard | {
"lang": "python",
"repo": "ronalcc/vnpy",
"path": "/vnpy/trader/app/strategy/uiStrategyInstanceListWidget.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bucaojit/RealEstate-Streaming path: /scripts/getHostnamePort.py
#!/usr/bin/python
import os
from xml.dom import minidom
znodeParentProp = "zookeeper.znode.parent"
zkClientPortProp = "hbase.zookeeper.property.clientPort"
zkQuorumProp = "hbase.zookeeper.quorum"
zkHostname = ""
zkPort = ""
zkPare... | code_fim | medium | {
"lang": "python",
"repo": "bucaojit/RealEstate-Streaming",
"path": "/scripts/getHostnamePort.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if zkClientPortProp in xmlKV:
xmlval = minidom.parseString(xmlKV)
zkPort = xmlval.getElementsByTagName('value')[0].firstChild.nodeValue
if zkQuorumProp in xmlKV:
xmlval = minidom.parseString(xmlKV)
zkHostname = xmlval.getElementsByTagName('value')[0].firstChild.nodeValue
print zkHostname + ":"... | code_fim | hard | {
"lang": "python",
"repo": "bucaojit/RealEstate-Streaming",
"path": "/scripts/getHostnamePort.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in arr1:
found = False
for j in arr2:
if i == j:
found = True
if not found:
return False
return True
def main():
check_sort([325432, 989, 547510, 3, -93, 189019, 5042, 123,
597, 42, 7506, 184, 184, 2409, 4... | code_fim | hard | {
"lang": "python",
"repo": "AmrReda/Algorithms",
"path": "/src/sorting/quick_sort/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmrReda/Algorithms path: /src/sorting/quick_sort/main.py
from quick_sort import QuickSort
def is_sorted(numbers):
last_num = float("-inf")
for num in numbers:
if num < last_num:
return False
else:
last_num = num
return True
def check_sort(... | code_fim | hard | {
"lang": "python",
"repo": "AmrReda/Algorithms",
"path": "/src/sorting/quick_sort/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
check_sort([325432, 989, 547510, 3, -93, 189019, 5042, 123,
597, 42, 7506, 184, 184, 2409, 45, 824,
4, -2650, 9, 662, 3928, -170, 45358, 395,
842, 7697, 110, 14, 99, 221])
check_sort([9, 9, 9, 9, 9, 9, 9, 9, 9, 9])
check_sort([3, 5... | code_fim | hard | {
"lang": "python",
"repo": "AmrReda/Algorithms",
"path": "/src/sorting/quick_sort/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BrianTJackett/msgraph-cli path: /msgraph-cli-extensions/beta/devicescloudprint_beta/azext_devicescloudprint_beta/generated/_params.py
elp='')
c.argument('is_accepting_jobs', arg_type=get_three_state_flag(), help='')
c.argument('location', arg_type=get_location_type(self.cli_ctx)... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/devicescloudprint_beta/azext_devicescloudprint_beta/generated/_params.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.argument_context('devicescloudprint print-printer show-allowed-user') as c:
c.argument('printer_id', type=str, help='key: id of printer')
c.argument('print_user_identity_id', type=str, help='key: id of printUserIdentity')
c.argument('select', nargs='+', help='Selec... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/devicescloudprint_beta/azext_devicescloudprint_beta/generated/_params.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nizaevka/mlshell path: /tests/test_set.py
import difflib
import filecmp
import glob
import importlib.util
import shutil
import sys
import time
import pandas as pd
import pycnfg
import pytest
cnfg_default = None
def file_diff(filepath1, filepath2):
filename1 = filepath1.split('/')[-1]
... | code_fim | hard | {
"lang": "python",
"repo": "nizaevka/mlshell",
"path": "/tests/test_set.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
- Delete previous test output if exist.
- Start mlshell.run.py.
- Check current output with original.
"""
# Remove results for test.
results_path = expected['results_path']
shutil.rmtree(results_path, ignore_errors=True)
# Start code.
# [future] attempts to run... | code_fim | hard | {
"lang": "python",
"repo": "nizaevka/mlshell",
"path": "/tests/test_set.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>EJERCICIO4: Escribir las fichas de dominó
"""
#Bucle for, itera y da valores a x desde 0 hasta 6
for x in range(0,7):
#Bucle for, para cada valor de x asigna valores a y desde x hasta 6
for y in range(x,7):
#Escribe en la forma 'x:y'
print "%s:%s" %(x,y)<|fim_prefix|># repo: fborra... | code_fim | easy | {
"lang": "python",
"repo": "fborrasumh/seminario-python",
"path": "/codigo/Scripts-Informatica/Ejercicio4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fborrasumh/seminario-python path: /codigo/Scripts-Informatica/Ejercicio4.py
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 31 19:32:47 2014
<|fim_suffix|>EJERCICIO4: Escribir las fichas de dominó
"""
#Bucle for, itera y da valores a x desde 0 hasta 6
for x in range(0,7):
#Bucle for, para cad... | code_fim | easy | {
"lang": "python",
"repo": "fborrasumh/seminario-python",
"path": "/codigo/Scripts-Informatica/Ejercicio4.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robin-shaun/XTDrone path: /control/keyboard/usv_keyboard_control.py
import rospy
import sys, select, os
import tty, termios
from std_msgs.msg import String, Float32
MAX_LIN_VEL = 100
MAX_ANGLE = 10
LIN_VEL_STEP_SIZE = 1
ANGLE_STEP_SIZE = 0.3
cmd_vel_mask = False
ctrl_leader = False
msg2all = ... | code_fim | hard | {
"lang": "python",
"repo": "robin-shaun/XTDrone",
"path": "/control/keyboard/usv_keyboard_control.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> usv_num = int(sys.argv[1])
rospy.init_node('usv_keyboard_control')
multi_left_thrust_pub = [None]*usv_num
multi_right_thrust_pub = [None]*usv_num
for i in range(usv_num):
multi_left_thrust_pub[i] = rospy.Publisher('/usv_'+str(i)+'/thrusters/left_thrust_cmd', Float32, queue_size... | code_fim | hard | {
"lang": "python",
"repo": "robin-shaun/XTDrone",
"path": "/control/keyboard/usv_keyboard_control.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_foreign_key(None, 'played', 'songs', ['song_id'], ['id'])
op.create_foreign_key(None, 'played', 'artists', ['artist_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands aut... | code_fim | medium | {
"lang": "python",
"repo": "lordp/rova",
"path": "/migrations/versions/63ed5d88e84b_change_played_time_column_to_use_a_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'played', type_='foreignkey')
op.drop_constraint(None, 'played', type_='foreignkey')
# ### end Alembic commands ###<|fim_prefix|># repo: lordp/rova path: /migrations/versions/63ed5d88e84b_change_played_... | code_fim | hard | {
"lang": "python",
"repo": "lordp/rova",
"path": "/migrations/versions/63ed5d88e84b_change_played_time_column_to_use_a_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lordp/rova path: /migrations/versions/63ed5d88e84b_change_played_time_column_to_use_a_.py
"""Change played time column to use a timezone
Revision ID: 63ed5d88e84b
Revises: 7c2b39c913a5
Create Date: 2020-08-14 13:15:17.020465
"""
from alembic import op
import sqlalchemy as sa
<|fim_suffix|>def ... | code_fim | medium | {
"lang": "python",
"repo": "lordp/rova",
"path": "/migrations/versions/63ed5d88e84b_change_played_time_column_to_use_a_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: btlorch/gaussian-processes-for-camera-model-identification path: /ood_detector/gpc_detector.py
from ood_detector.out_of_distribution_detector import OutOfDistributionDetector
from classifier.gp_classification_model import InducingGPClassificationModel
from utils.constants import GAUSSIAN_PROCESS_... | code_fim | hard | {
"lang": "python",
"repo": "btlorch/gaussian-processes-for-camera-model-identification",
"path": "/ood_detector/gpc_detector.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> X_train_torch = torch.from_numpy(kwargs["X_train"]).to(self.device)
y_train_torch = torch.from_numpy(kwargs["y_train"]).to(self.device)
mll = gpytorch.mlls.VariationalELBO(self.likelihood, self.model, num_data=y_train_torch.numel())
with torch.no_grad(), gpytorch.settings.... | code_fim | hard | {
"lang": "python",
"repo": "btlorch/gaussian-processes-for-camera-model-identification",
"path": "/ood_detector/gpc_detector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def eval_ind_accuracy(self, X, y):
y_pred, _ = self.predict(X)
y_pred = np.argmax(y_pred, axis=1)
return accuracy_score(y, y_pred)
def eval_ood_auc(self, X_known, X_unknown):
assert len(X_known) == len(X_unknown), "Expected known and unknown sets to have same lengt... | code_fim | hard | {
"lang": "python",
"repo": "btlorch/gaussian-processes-for-camera-model-identification",
"path": "/ood_detector/gpc_detector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('per', '0005_auto_20190603_1703'),
]
operations = [
migrations.CreateModel(
name='Draft',
fields=[
('id', models.AutoField(auto_created=True, primary_ke... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/per/migrations/0006_draft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IFRCGo/go-api path: /per/migrations/0006_draft.py
# Generated by Django 2.0.12 on 2019-06-11 12:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|>
dependencies = [
migrations.swappable_dependency(settings.AUT... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/per/migrations/0006_draft.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Draft',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=10)),
('data', models.Te... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/per/migrations/0006_draft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ProteinsWebTeam/interpro7-dw path: /interpro7dw/interpro/ftp/uniparc.py
import math
import multiprocessing as mp
import os
import tarfile
from xml.dom.minidom import getDOMImplementation
from interpro7dw.utils import logger
from interpro7dw.utils.store import KVStore
_ARCHIVE = "uniparc_match.... | code_fim | hard | {
"lang": "python",
"repo": "ProteinsWebTeam/interpro7-dw",
"path": "/interpro7dw/interpro/ftp/uniparc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> match = doc.createElement("match")
match.setAttribute("id", signature_acc)
match.setAttribute("name", signature["name"])
match.setAttribute("dbname", signature["database"])
match.setAttr... | code_fim | hard | {
"lang": "python",
"repo": "ProteinsWebTeam/interpro7-dw",
"path": "/interpro7dw/interpro/ftp/uniparc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().ejecutar(tabla,arbol)
prim = None
strGram = ""
if self.tipo.tipo == Tipo_Dato.SMALLINT:
prim = Primitivo(0, Tipo(Tipo_Dato.SMALLINT), strGram,0,0)
elif self.tipo.tipo == Tipo_Dato.INTEGER:
prim = Primitivo(0, Tipo(Tipo_Dato.INTEGER), ... | code_fim | hard | {
"lang": "python",
"repo": "joorgej/tytus",
"path": "/parser/fase2/team10/sql/Instrucciones/Declaracion.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joorgej/tytus path: /parser/fase2/team10/sql/Instrucciones/Declaracion.py
from sql.Instrucciones.TablaSimbolos.Instruccion import Instruccion
from sql.Instrucciones.Excepcion import Excepcion
from sql.lexico import columas
from tkinter.constants import FALSE
from sql.Instrucciones.Sql_create.Show... | code_fim | hard | {
"lang": "python",
"repo": "joorgej/tytus",
"path": "/parser/fase2/team10/sql/Instrucciones/Declaracion.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> variable = Simbolo(self.nombre,self.tipo,prim.valor,0,0)
resultadoInsertar = tabla.setVariable(variable)
if resultadoInsertar != None:
error = Excepcion("100","Semantico","La columna "+self.nombre+" yo existe",self.linea,self.columna)
arbol.excepciones.appen... | code_fim | hard | {
"lang": "python",
"repo": "joorgej/tytus",
"path": "/parser/fase2/team10/sql/Instrucciones/Declaracion.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blockchainGuru1018/CryptoCurrencyBot path: /backend/bitcoin_arbitrage/monitor/exchange/bitfinex.py
from bitcoin_arbitrage.monitor.currency import CurrencyPair
from bitcoin_arbitrage.monitor.exchange import Exchange, BTCAmount
from bitcoin_arbitrage.monitor.log import setup_logger
from bitcoin_arb... | code_fim | hard | {
"lang": "python",
"repo": "blockchainGuru1018/CryptoCurrencyBot",
"path": "/backend/bitcoin_arbitrage/monitor/exchange/bitfinex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def limit_buy_order(self, amount: BTCAmount, limit: float) -> Order:
raise NotImplementedError
def get_order_state(self, order: Order) -> OrderState:
raise NotImplementedError<|fim_prefix|># repo: blockchainGuru1018/CryptoCurrencyBot path: /backend/bitcoin_arbitrage/monitor/excha... | code_fim | hard | {
"lang": "python",
"repo": "blockchainGuru1018/CryptoCurrencyBot",
"path": "/backend/bitcoin_arbitrage/monitor/exchange/bitfinex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
extra_options = {}
if self.executor:
# We only include it optionally since
# executor is not a valid argument in all backends
extra_options["executor"] = self.executor
return document.execute(
... | code_fim | hard | {
"lang": "python",
"repo": "ladal1/simple_api",
"path": "/simple_api/adapters/graphql/security/DifficultyScoreGraphQLView.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ladal1/simple_api path: /simple_api/adapters/graphql/security/DifficultyScoreGraphQLView.py
import re
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
from graphene_django.views import GraphQLView, HttpError
from graphql.execution import ExecutionResult
from graphql.languag... | code_fim | hard | {
"lang": "python",
"repo": "ladal1/simple_api",
"path": "/simple_api/adapters/graphql/security/DifficultyScoreGraphQLView.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cbbbbbbbb/sspywork path: /savecode/threeyears/idownclient/clientdatafeedback/scoutdatafeedback/domain.py
"""object domain"""
# -*- coding:utf-8 -*-
import json
import threading
from commonbaby.helpers import helper_time
from datacontract.iscoutdataset.iscouttask import EObjectType, IscoutTask... | code_fim | hard | {
"lang": "python",
"repo": "cbbbbbbbb/sspywork",
"path": "/savecode/threeyears/idownclient/clientdatafeedback/scoutdatafeedback/domain.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _outputdict_add_realip(self, rootdict: dict):
"""real_ip"""
if len(self._realip) < 1:
return
if not rootdict.__contains__("realip"):
rootdict["realip"] = []
with self._realip_locker:
for rp in self._realip.keys():
... | code_fim | hard | {
"lang": "python",
"repo": "cbbbbbbbb/sspywork",
"path": "/savecode/threeyears/idownclient/clientdatafeedback/scoutdatafeedback/domain.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NoahRJohnson/vsi_common path: /python/vsi/windows/find_process.py
import subprocess
from vsi.tools.subprocess_util import PopenBg as Popen
def findProcess(imageName, filterString):
"""
Parameters
----------
imageName : str
The image name
filterString : str
The filter stri... | code_fim | medium | {
"lang": "python",
"repo": "NoahRJohnson/vsi_common",
"path": "/python/vsi/windows/find_process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = filter(lambda x: filterString in x[1], out)
return map(lambda x: x[0], out)
return []
if __name__ == '__main__':
import sys
import os
myPid = os.getpid()
try:
imageName = sys.argv[1]
filterString = sys.argv[2]
pids = findProcess(imageName, filterString)
pids = filt... | code_fim | hard | {
"lang": "python",
"repo": "NoahRJohnson/vsi_common",
"path": "/python/vsi/windows/find_process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> np.set_printoptions(
edgeitems=30,
linewidth=100000,
formatter=dict(float=lambda x: "%.3g" % x)
)<|fim_prefix|># repo: uiyunkim-private/recommendation-model path: /data_loader/src/main/python/utils/display.py
import numpy as np
import pandas as pd
def pandas_df_display_s... | code_fim | easy | {
"lang": "python",
"repo": "uiyunkim-private/recommendation-model",
"path": "/data_loader/src/main/python/utils/display.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def numpy_array_display_setting():
np.set_printoptions(
edgeitems=30,
linewidth=100000,
formatter=dict(float=lambda x: "%.3g" % x)
)<|fim_prefix|># repo: uiyunkim-private/recommendation-model path: /data_loader/src/main/python/utils/display.py
import numpy as np
import pan... | code_fim | medium | {
"lang": "python",
"repo": "uiyunkim-private/recommendation-model",
"path": "/data_loader/src/main/python/utils/display.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uiyunkim-private/recommendation-model path: /data_loader/src/main/python/utils/display.py
import numpy as np
import pandas as pd
def pandas_df_display_setting():
<|fim_suffix|> np.set_printoptions(
edgeitems=30,
linewidth=100000,
formatter=dict(float=lambda x: "%.3g" ... | code_fim | hard | {
"lang": "python",
"repo": "uiyunkim-private/recommendation-model",
"path": "/data_loader/src/main/python/utils/display.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param type_: type or list of types
:raise: TypeError
"""
if not (isinstance(val, type_) or (or_none and val is None)):
raise TypeError('{} should be of type {}, got {}'.format(
name, type_, type(val)))<|fim_prefix|># repo: thestick613/python-slimta path: /slimta/util/... | code_fim | easy | {
"lang": "python",
"repo": "thestick613/python-slimta",
"path": "/slimta/util/typecheck.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thestick613/python-slimta path: /slimta/util/typecheck.py
def check_argtype(val, type_, name, or_none=False):
<|fim_suffix|> :param type_: type or list of types
:raise: TypeError
"""
if not (isinstance(val, type_) or (or_none and val is None)):
raise TypeError('{} should be... | code_fim | easy | {
"lang": "python",
"repo": "thestick613/python-slimta",
"path": "/slimta/util/typecheck.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> "Get value from key"
t = time()
v = self._get(key, t)
if v is None:
return None
if timeout is not None:
self._set(key, v[0], t, timeout)
return v[0]
def set(self, key, value, timeout = None):
"Set value to key, with an opt... | code_fim | hard | {
"lang": "python",
"repo": "missuzhang/vlcp",
"path": "/vlcp/service/utils/knowledge.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: missuzhang/vlcp path: /vlcp/service/utils/knowledge.py
'''
Created on 2015/11/9
:author: hubo
'''
from vlcp.config import defaultconfig
from vlcp.server.module import Module, api, proxy
from vlcp.event.core import TimerEvent
from vlcp.event.runnable import RoutineContainer
from time import time
... | code_fim | hard | {
"lang": "python",
"repo": "missuzhang/vlcp",
"path": "/vlcp/service/utils/knowledge.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> "Update multiple keys in-place, with a function updater(keys, values, timestamp) which returns (updated_keys, updated_values). Either all success or all fail. Timestamp is a integer standing for current time in microseconds."
t = time()
vs = [v[0] if v is not None else None for v... | code_fim | hard | {
"lang": "python",
"repo": "missuzhang/vlcp",
"path": "/vlcp/service/utils/knowledge.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bioidiap/bob.db.biosecurid.face path: /bob/db/biosecurid/face/test.py
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""A few checks at the Biosecurid database.
"""
import os, sys
import unittest
import bob.db.biosecurid.face
class BiosecuridDatabaseTest(unittest.TestCase):
"""Perform... | code_fim | medium | {
"lang": "python",
"repo": "bioidiap/bob.db.biosecurid.face",
"path": "/bob/db/biosecurid/face/test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.