text stringlengths 1 927k |
|---|
#
# CORE
# Copyright (c)2011-2014 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
'''
Helpers for loading and saving XML files. savesessionxml(session, filename) is
the main public interface here.
'''
import os.path
from core.netn... |
# -*- coding: utf-8; py-indent-offset: 2 -*-
"""
This package is used to model elemental ions in crystal structures. It handles
both identification and building of ions, but relies on the solvent module to
flag candidate sites for screening.
Notes
-----
.. [1] Echols, N. et al. Automated identification of elemental io... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from io import StringIO
from collections import deque
from typetest.utils import validate_input_file_path
@validate_input_file_path
def plot(input_file, size=10000, filter_func=lambda c: True):
"""Reads last `size` lines of `input_file` and ... |
from rest_framework import permissions
class CustomUserPermission(permissions.BasePermission):
"""
user can see or update only their own profile
"""
def has_object_permission(self, request, view, obj):
""" we have already disabled List method. so get method here will come with id"""
... |
from setuptools import setup, Extension, find_packages
m1 = Extension(
'mrhttp.internals',
sources = [
'./src/mrhttp/internals/module.c',
'./src/mrhttp/internals/utils.c',
'./src/mrhttp/internals/app.c',
'./src/mrhttp/internals/protocol.c',
'./src/mrhttp/internals/mrqprotocol.c'... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_fundamentals.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for poets.
This file was generated with PyScaffold 1.3, a tool that easily
puts up a scaffold for your new Python project. Learn more under:
http://pyscaffold.readthedocs.org/
"""
import os
import sys
import inspect
from distutils.cmd import... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'azure.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportEr... |
# MIT License
#
# Copyright (C) 2020 University of Oxford
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... |
# SPDX-License-Identifier: Apache-2.0
import sys
import inspect
import unittest
from distutils.version import StrictVersion
import onnx
import pandas
import numpy
from pyspark.ml import Pipeline
from pyspark.ml.classification import DecisionTreeClassifier
from pyspark.ml.linalg import VectorUDT, SparseVector, Vectors... |
# /***************************************************************************
#
# @package: franka_interface
# @metapackage: franka_ros_interface
# @author: Saif Sidhik <sxs1412@bham.ac.uk>
#
# **************************************************************************/
# /*****************************************... |
# -*- coding: utf-8 -*-
import numpy as np
import pygame, sys
from pygame.locals import *
from nav_maze_static_environment import NavMazeStaticEnvironment
BLACK = (0, 0, 0)
class RandomAgent(object):
def __init__(self, action_num):
self.action_num = action_num
def choose_action(self, state):
... |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
IncorrectYieldFromTargetViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
GeneratorKeywordsVisitor,
)
yield_from_template = """
def wrapper():
yield from {0}
"""
@pytest.mark.para... |
import math
from utils.solution_base import SolutionBase
class Solution(SolutionBase):
def solve(self, part_num: int):
self.test_runner(part_num)
func = getattr(self, f"part{part_num}")
result = func(self.data)
return result
def test_runner(self, part_num):
test_input... |
#! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... |
import os
import environ
environ.Env.read_env(os.path.join(os.path.dirname(__file__), '..', '..', 'test.env'))
from ..settings import *
INSTALLED_APPS.append('forsta_brand')
SOCIAL_AUTH_SAML_SP_PRIVATE_KEY = """\
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCkR4S26dW8j+yO
fxLFjdeUQ... |
import random
import torch
from deepy.data.transform import Transform, SeparatedTransform
from deepy.data.transform import PairedTransform, PairedCompose, ToPairedTransform
from deepy.nn import functional as myF
class RandomCrop(Transform):
def __init__(self, length: int, generator=None):
self.length = ... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
import requests
import sys
import os
import configparser
dir = os.path.dirname(__file__)
root_dir = os.path.dirname(dir)
sys.path.append(root_dir)
from aipmLib.FetchModel import downloadModel
from aipmLib.FetchInfo import fetchInfo
# read the config
cp = configparser.ConfigParser()
cp.read(os.path.dirname(dir)+'/con... |
#########################################
# Author : Haibo Zhu
# Email : haibo.zhu@hotmail.com
# created : 2018-11-06 13:38
# Last modified : 2018-11-08 14:49
# Filename : sqliteFunctions.py
# Description :
#########################################... |
from parsl.config import Config
from parsl.executors.threads import ThreadPoolExecutor
config = Config(
executors=[
ThreadPoolExecutor(
label='local_threads_checkpoint_task_exit',
)
],
checkpoint_mode='task_exit'
) |
import unittest
from sntools.formats import gamma
class ParseInputTest(unittest.TestCase):
def setUp(self):
self.f = gamma.Flux()
def test_default_startendtime(self):
# test extracting default start- and endtime from sample input file
self.f.parse_input("fluxes/sample-gamma.txt", "e"... |
"""
AI Challenger观点型问题阅读理解
config.py:配置文件,程序运行入口
@author: yuhaitao
"""
# -*- coding:utf-8 -*-
import os
import tensorflow as tf
import data_process
from main import train, test, dev
from file_save import *
from examine_dev import examine_dev
flags = tf.flags
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
train_file = os... |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
from typing import Union, Dict, List, Tuple, Any, Callable
from ..transition import (
Transition,
Scalar,
TransitionStorageSmart,
TransitionStorageBasic,
)
import torch as t
import random
class Buffer:
def __init__(self, buffer_size, buffer_device="cpu", *_, **__):
"""
Create a buf... |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.uix.label import Label
from electrum_gui.kivy.i18n import _
from datetime import datetime
from electrum.util import InvalidPassword
Builder.load_str... |
r"""
Error Functions
This module provides symbolic error functions. These functions use the
`mpmath library` for numerical evaluation and Maxima, Pynac for
symbolics.
The main objects which are exported from this module are:
* :meth:`erf <Function_erf>` -- The error function
* :meth:`erfc <Function_erfc>` -- The c... |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.2342
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility lib... |
# This script shows how to filter an existing target as a pose
# This is useful for a robot that has been calibrated and we need to get the filtered pose
# Important: It is assumed that the robot will reach the pose with the calculated configuration
from robolink import * # API to communicate with RoboDK
from robod... |
# -*- coding: utf-8 -*-
# This file is part of metalibm (https://github.com/kalray/metalibm)
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software wit... |
import pytest
import json
from guillotina_volto.tests.utils import add_content
from guillotina.tests.test_catalog import PG_CATALOG_SETTINGS, NOT_POSTGRES
pytestmark = pytest.mark.asyncio
@pytest.mark.app_settings(PG_CATALOG_SETTINGS)
@pytest.mark.skipif(NOT_POSTGRES, reason="Only PG")
async def test_search(cms_requ... |
# Generated by Django 2.1.7 on 2019-04-08 10:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('led', '0004_sensors_action'),
]
operations = [
migrations.AlterField(
model_name='sensors',
name='humidity',
... |
from requests import delete
delete('http://localhost:5000/delete_pokemon/0010').json() |
n , v = list(map(float , input().split()))
arr = list(map(float , input().split()))
n = int(n)
arr.sort(reverse = True)
def coins(arr , v , k1 , res):
ans =0.00
orig_v = k1
for ele in arr:
flag = True
i = 1.00
while flag == True:
... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
# -*- coding: utf-8 -*-
"""
Coin sums
Problem 31
In England the currency is made up of pound, £, and pence, p, and there are
eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many differ... |
from .MotifUtil import MotifUtil
from pprint import pprint as pp
class MEMEUtil:
def __init__(self, config):
self.scratch = config['scratch']
self.MotifUtil = MotifUtil(config)
# parse output into old motif format(maybe new format if thats useful?)
def parse(self, outputFile, params):
... |
"""praw setup.py"""
import re
from codecs import open
from os import path
from setuptools import find_packages, setup
PACKAGE_NAME = "praw"
HERE = path.abspath(path.dirname(__file__))
with open(path.join(HERE, "README.rst"), encoding="utf-8") as fp:
README = fp.read()
with open(path.join(HERE, PACKAGE_NAME, "con... |
year=int(input("Enter a year:"))
if(year%4==0 and year%100!=0):
print("It is a leap year")
elif(year%400==0):
print("It is a leap year")
elif(year%100==0):
print("It is not a leap year")
else:
print("It is not a leap year") |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse("user:create")
TOKEN_URL = reverse("user:token")
ME_URL = reverse("user:me")
def create_user(**params)... |
#!/usr/bin python3
# coding: UTF-8
import os
import webbrowser
from time import sleep
from platform import system
from core import HackINonECollection
from tools.anonsurf import AnonSurfTools
from tools.ddos import DDOSTools
from tools.exploit_frameworks import ExploitFrameworkTools
from tools.forensic_tools import F... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Huawei Technologies Co., Ltd.
# A-Tune is licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS... |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext as _
from core import models
class UserAdmin(BaseUserAdmin):
ordering = ['id']
list_display = ['email', 'name']
fieldsets = (
(None, {'fields': ('email', ... |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
from __future__ import print_function
import unittest
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
from streamsx.topology import context
from streamsx.topology.context import ConfigParams
from strea... |
# This program is free software: you can redistribute it and/or modify it under the
# terms of the Apache License (v2.0) as published by the Apache Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or... |
from project.appliances.fridge import Fridge
from project.appliances.laptop import Laptop
from project.appliances.tv import TV
from project.rooms.room import Room
class YoungCouple (Room):
def __init__(self, family_name: str, salary_one: float, salary_two: float):
super().__init__(family_name, salary_one ... |
#!/usr/bin/env python
# Copyright 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure the base address setting is extracted properly.
"""
import TestGyp
import re
import sys
if sys.platform == 'win32':
test = Te... |
"""
===========================
Computes the correlation between pairwise distances and mean exclusivity ratings for randomly drawn pairs of norms.
===========================
Dr. Cai Wingfield
---------------------------
Embodied Cognition Lab
Department of Psychology
University of Lancaster
c.wingfield@lancaster.ac.... |
import urllib.request,json
from .models import models
# Article = article.Article
Source = models.Source
Article = models.Article
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
def configure_request(app):
global api_key,base_url
api_key = app.config['NEWS_API_KEY']
base_u... |
from django.db import models
class Artist(models.Model):
artistID = models.CharField(db_column='artistID', max_length=20, primary_key=True)
artistName = models.CharField(db_column='artistName', max_length=50)
genreReign = models.CharField(db_column='artistReign', max_length=50)
class Meta:
ma... |
from torch import nn as nn
from torch.nn import functional as F
from ..utils import get_fine_tuning_parameters
from .backbone import make_encoder
from .modules import squash_dims, unsquash_dim
class MultiFrameBaseline(nn.Module):
"""Simple baseline that runs a classifier on each frame independently and averages ... |
import pytest
from unittest.mock import patch
import logging
from pyvesync import VeSync, VeSyncOutlet15A
from pyvesync.helpers import Helpers as helpers
from . import call_json
DEV_LIST_DETAIL = call_json.LIST_CONF_15A
CORRECT_15A_LIST = call_json.DEVLIST_15A
ENERGY_HISTORY = call_json.ENERGY_HISTORY
CORRECT_15A_D... |
#$Header: /opt/cvs/python/packages/share1.5/AutoDockTools/WebServices.py,v 1.21 2009/08/12 21:40:05 lclement Exp $
#$Id: WebServices.py,v 1.21 2009/08/12 21:40:05 lclement Exp $
# Author: Sargis Dallakyan (sargis@scripps.edu)
import tkinter, Pmw, os, http.client, webbrowser, urllib.request, urllib.parse, urllib.error,... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:6452")
else:
access = Ser... |
# Generated by Django 2.0.1 on 2019-01-02 10:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('maingame', '0005_lobby_lobbyplayer'),
]
operations = [
migrations.AddField(
model_name='player',
name='icon_name',
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 5 22:33:48 2019
@author: Kazuki
"""
import numpy as np
import pandas as pd
import os, gc
from glob import glob
from tqdm import tqdm
import sys
sys.path.append(f'/home/{os.environ.get("USER")}/PythonLibrary')
import lgbextension as ex
import ligh... |
from biothings.web.options import ReqArgs
def test_01():
assert str(ReqArgs(
query={
"format": "yaml",
"size": "1002"},
json_={
"q": "cdk2",
"scopes": ["ensembl", "entrez"],
"format": "json"}
)).replace(" ", "") == """
ReqArgs... |
"""
Covariance functions
"""
import numpy as np
#because it makes life easier down the line
pi, exp, sine, cosine, sqrt = np.pi, np.exp, np.sin, np.cos, np.sqrt
__all__ = ['Constant', 'WhiteNoise', 'SquaredExponential' , 'Periodic',
'QuasiPeriodic', 'RationalQuadratic', 'Cosine', 'Exponential',
... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.by import By
from gaiatest import GaiaTestCase
from gaiatest.apps.browser.app import Browser
from gaiate... |
deposit = float(input())
term_of_deposit = int(input())
interest_percent = float(input())
interest_accumulated = deposit * interest_percent / 100
interest_per_month = interest_accumulated / 12
total_amount = deposit + term_of_deposit * interest_per_month
print(total_amount) |
import os
import sys
import pandas as pd
import numpy as np
import pdb
import torch
import torch.nn as nn
import torch.nn.functional as F
sys.path.insert(1,"../")
sys.path.insert(1,"../../")
sys.path.insert(1,"../../../")
sys.path.insert(1,"../../../../")
sys.path.insert(1,"../../../../../")
sys.path.insert(1,"../../... |
#%%
import numpy as np
import pandas as pd
import futileprot.viz
import altair as alt
import altair_saver
import scipy.stats
colors, palette = futileprot.viz.altair_style()
# Add metadata
DATE = '2021-07-27'
RUN_NO = 2
STRAINS = 'SingleKO'
MEDIUM = 'acetate'
# Load the measurement data
data = pd.read_csv(f'./output... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
import railrl.misc.hyperparameter as hyp
from railrl.data_management.her_replay_buffer import RelabelingReplayBuffer
from railrl.envs.mujoco.sawyer_push_env import SawyerPushXYEnv, \
SawyerPushXYEasyEnv
from railrl.launchers.experiments.vitchyr.multitask import her_td3_experiment
from railrl.launchers.launcher_util... |
from abc import abstractmethod
import logging
from typing import List, Union
import torch
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from transformers import AutoTokenizer, AutoConfig, AutoModel, CONFIG_MAPPING, PreTrainedTokenizer
import flair
from flair.data import Sentence
from flair.... |
import numpy as np
import torch
from transformers import BertTokenizer, BertModel
from torch.utils.data import DataLoader
import util
from util import MaskableList
from collections import defaultdict, Counter
from sentence_transformers import SentenceTransformer
import spacy
import time
import itertools
from itertools... |
"""
statistics submodule.
"""
from .statistics import *
from .plot import *
from .routines import * |
# Shortest Menu driven program possible :)
def asc(l):
print("List in ascending order:",sorted(l)) #returns list in ascending order
def desc(l):
print("List in descending order:",sorted(l)[::-1]) # returns the reverse of the ascending ordered list
def menu():
while True:
print("""MENU :
1.Sort lis... |
import pytest
from thefeck.rules.python_execute import match, get_new_command
from thefeck.types import Command
@pytest.mark.parametrize('command', [
Command('python bar', ''),
Command('python bar', '')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command, new_command', [
... |
__author__ = 'Alexendar Perez'
#####################
# #
# Introduction #
# #
#####################
"""compute specificity score, Hamming, and Levinstein distance neighborhoods for strings"""
#################
# #
# Libraries #
# #
############... |
# -*- coding: utf-8 -*-
# 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from retinanet.model.backbone.builder import build_backbone
__all__ = ['build_backbone'] |
import sys
import os
import pandas as pd
import csv
import argparse
from collections import OrderedDict
from io import StringIO
def main(argv):
args = parse_arguments(argv)
out = args.out_path
file1 = args.file1
file2 = args.file2
file3 = args.file3
ddf1 = addSeqs(file1,file2)
ddf2 = rem... |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, string_types
import datetime
import frappe, sys
from frappe import _
from frappe.utils import (cint, flt, now, cstr, strip_html, getdate, get_datetime, ... |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 EntySec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... |
import os
import pytest
from ddtrace import Pin
from ddtrace.ext import test
from ... import TracerTestCase
class TestPytest(TracerTestCase):
@pytest.fixture(autouse=True)
def fixtures(self, testdir, monkeypatch):
self.testdir = testdir
self.monkeypatch = monkeypatch
def inline_run(sel... |
# %%
"""
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Terrain/us_ned_mtpi.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target=... |
#! /usr/bin/python
"""
=========================================================================
This file is part of LyX Notebook, which works with LyX but is an
independent project. License details (MIT) can be found in the file
COPYING.
Copyright (c) 2012 Allen Barker
=============================================... |
"""
The permissions classes in this module define the specific permissions that govern access to the models in the auth app.
"""
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from ..constants.collection_kinds import ADHOCLEARNERSGROUP
from ..constants.collection_kinds import FACIL... |
# Copyright (c) 2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test the `io.tools` module."""
import numpy as np
import pytest
from metpy.io._tools import hexdump, UnitLinker
from metpy.io.cdm import Dataset
from metpy.testing import assert... |
from django.contrib import admin
class BaseOwnerAdmin(admin.ModelAdmin):
"""
自动补充owner字段
用来针对queryset过滤当前用户的数据
"""
exclude = ('owner',)
def get_queryset(self, request):
qs = super(BaseOwnerAdmin, self).get_queryset(request)
return qs.filter(owner=request.user)
def save_m... |
import os
from conans.errors import ConanException, NotFoundException
from conans.model.ref import PackageReference
class ConanUploader(object):
def __init__(self, paths, user_io, remote_manager, remote):
self._paths = paths
self._user_io = user_io
self._remote_manager = remote_manager
... |
from pathlib import Path
import shutil
from django.utils.encoding import force_text
from mayan.apps.documents.storages import storage_document_files
from mayan.apps.documents.tests.base import GenericDocumentTestCase
from mayan.apps.mime_types.tests.mixins import MIMETypeBackendMixin
from mayan.apps.testing.tests.bas... |
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing
from Configuration.Eras.Era_Run3_cff import Run3
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
options = VarParsing('analysis')
options.register("run3", True, VarParsing.multiplicity.singleton, VarParsing.varTyp... |
import random
def reply(activity, bot, data):
responses = [
"I’m fine as always, thank you. Yourself?",
"I'm great!, thanks for asking. Wbu?",
"I'm good! and you?",
"Pretty well, how about you?",
"I'm alright! what about you?",
"Theek hoon, Shukriya poochne ke liye.... |
HCIPY_HCI_CMD_STRUCT_HEADER = "<BHB"
HCIPY_HCI_FILTER_STRUCT = "<LLLH"
# Vol 4 part 4.5
HCI_COMMAND_PKT = 0x01
HCI_ACLDATA_PKT = 0x02
HCI_EVENT_PKT = 0x04
# HCI ioctl Commands:
HCIDEVUP = 0x400448c9 # 201
HCIDEVDOWN = 0x400448ca # 202
HCIGETDEVINFO = -2147202861 #0x800448d3L # _IOR(ord('H'), 211, 4)
# HCI Stat... |
#!/usr/bin/env python2.7
import os
import sys
sys.path.append(os.path.realpath(__file__ + '/../../../../lib'))
sys.path.append(os.path.realpath(__file__ + '/../../../linker-namespace-sanity'))
import udf
import linker_namespace_base_test
'''
This test verifies that certain libraries are not part of the global link... |
# ============================================================================
# FILE: lsp/workspace_symbols.py
# AUTHOR: Takahiro Shirasaka <tk.shirasaka@gmail.com>
# License: MIT license
# ============================================================================
import os
import sys
sys.path.insert(1, os.path.di... |
"""Notion API endpoints."""
from typing import TYPE_CHECKING, Any
from notion_client.helpers import pick
from notion_client.typing import SyncAsync
if TYPE_CHECKING:
from notion_client.client import BaseClient
class Endpoint:
def __init__(self, parent: "BaseClient") -> None:
self.parent = parent
... |
# Generated by Django 3.0.3 on 2020-08-22 06:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jenkins_tasks', '0004_auto_20200822_1439'),
]
operations = [
migrations.AlterField(
model_name='tasklog',
name='code... |
from AlbotOnline.Snake import SnakeGame
import AlbotOnline.JsonProtocol as Prot
import random as rand
game = SnakeGame.SnakeGame(Port=int(input("Port:"))) #Connects you to the Client
maxDepth = 2
def stateToScore(state):
if(state == Prot.STATES.ongoing):
return 0.5
if(state == Prot.STATES.draw):
... |
import os
import shutil
from typing import Any, Type
import bpy
import arm.assets
from arm.exporter import ArmoryExporter
import arm.log as log
from arm.logicnode.arm_nodes import ArmLogicTreeNode
import arm.make as make
import arm.make_state as state
import arm.node_utils
import arm.utils
if arm.is_reload(__name__)... |
import cv2
class VideoCamera(object):
def __init__(self):
# Using OpenCV to capture from device 0. If you have trouble capturing
# from a webcam, comment the line below out and use a video file
# instead.
# self.video = cv2.VideoCapture(0)
self.image = None
self.cach... |
import os
import unittest
import json
from spaceone.core.unittest.runner import RichTestRunner
from spaceone.tester import TestCase, print_json
GOOGLE_APPLICATION_CREDENTIALS_PATH = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', None)
if GOOGLE_APPLICATION_CREDENTIALS_PATH is None:
print("""
##########... |
# coding=utf-8
""" Module holding tools for ee.Date """
import ee
if not ee.data._initialized:
ee.Initialize()
from datetime import datetime, timedelta
EE_EPOCH = datetime(1970, 1, 1, 0, 0, 0)
def to_datetime(date):
""" convert a `ee.Date` into a `datetime` object """
formatted = date.format('yyyy,MM,dd... |
from ray.rllib.evaluation.episode import MultiAgentEpisode
from ray.rllib.evaluation.rollout_worker import RolloutWorker
from ray.rllib.evaluation.policy_evaluator import PolicyEvaluator
from ray.rllib.evaluation.interface import EvaluatorInterface
from ray.rllib.evaluation.policy_graph import PolicyGraph
from ray.rlli... |
# proxy module
from pyface.image_button import * |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.