text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
class VipInstanceGroupAdmin(admin.ModelAdmin):
search_fields = ("name", "identifier",)
list_display = ("name", "identifier", "vip", )
search_fields = ("name", "identifier", "vip__infra__name")... |
import typing
from pg_sql import SqlId, SqlNumber, SqlObject, SqlString, sql_list
from .format import format
from .join_common import JoinTarget, Key, Structure
from .join_key import KeyConsumer, TargetRefresh
from .sql import SqlTableExpr
from .sql_query import sync_query, upsert_query
from .string import indent
d... |
import os
from mako.lookup import TemplateLookup
from pylons.configuration import PylonsConfig
from pylons.error import handle_mako_error
import harstorage.lib.app_globals as app_globals
import harstorage.lib.helpers
from harstorage.config.routing import make_map
def load_environment(global_conf, app_conf):
"""... |
# Strategy known as "Forrgviing Grim Trigger" or "Grudger".
# We will cooperate repeatedly until our opponent betrays us twice.
# Then, we will get angry and defect for the rest of time.
# Memory is the number of times the strategy has been wronged
def strategy(history, memory):
wronged = memory
if history.sha... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from datasets.models import Data
from utils.data import make_url_sassy
class DataManagement(LoginRequiredMixin, TemplateV... |
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# 打开一个文件
fo = open("foo.txt", "r+")
str = fo.read(10)
print "读取的字符串是 : ", str
# 查找当前位置
position = fo.tell()
print "当前文件位置 : ", position
# 把指针再次重新定位到文件开头
position = fo.seek(0, 0)
str = fo.read(10)
print "重新读取字符串 : ", str
# 关闭打开的文件
fo.close() |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def ge... |
# coding=utf-8
#
# Copyright © 2011-2015 Splunk, Inc.
#
# 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 ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import Frame
from compas.geometry import Transformation
from compas.robots.model.robot import RobotModel
class ToolModel(RobotModel):
"""Represents a tool to be attached to the robot'... |
# Generated by Django 2.1.4 on 2018-12-24 16:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0003_game_description_html'),
]
operations = [
migrations.AlterField(
model_name='game',
name='descriptio... |
import numpy as np
import cv2
# A motion detecetor, yup... lol.
# Remember to use an old python version < 3.6
image_path = 'room_people.jpg' # Photo
# The model was already formulated, just need to loaad it into the system.
prototxt_path = 'models/MobileNetSSD_deploy.prototxt' # Load Model
model_path = 'models/Mob... |
from chia.types.blockchain_format.program import SerializedProgram
from .load_clvm import load_clvm
MOD = SerializedProgram.from_bytes(load_clvm("rom_bootstrap_generator.clvm").as_bin())
def get_generator():
return MOD |
'''
Copyright (c) <2012> Tarek Galal <tare2.galal@gmail.com>
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,
m... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Talkcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from binascii import hexlify
fr... |
from hyperopt import hp
from sklearn.naive_bayes import MultinomialNB as _skMultinomialNB
from script.sklearn_like_toolkit.warpper.base.BaseWrapperClf import BaseWrapperClf
from script.sklearn_like_toolkit.warpper.base.MixIn import MetaBaseWrapperClfWithABC
class skMultinomial_NBClf(BaseWrapperClf, _skMultinomialNB,... |
import warnings
import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
MultiIndex,
)
def test_format(idx):
idx.format()
idx[:0].format()
def test_format_integer_names():
index = MultiIndex(
levels=[[0, 1], [0, 1]], codes=[[0, 0, 1, 1], [0, 1, 0, 1]], names=[0,... |
from __future__ import absolute_import
import ast
import re
import operator as op
import pyparsing
from ..exceptions import CloudflareSolveError
from . import JavaScriptInterpreter
# ------------------------------------------------------------------------------- #
_OP_MAP = {
ast.Add: op.add,
ast.Sub: op.su... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""
Schema Validation for Deployment map files
"""
from schema import Schema, And, Use, Or, Optional, Regex
from logger import configure_logger
LOGGER = configure_logger(__name__)
NOTIFICATION_PROPS = {
Op... |
INTENT_THRESHOLD = 0.5 |
#!/usr/bin/env python
"""
@package mi.dataset.parser A collection of parsers that strip data blocks
out of files and feed them into the system.
@file mi/dataset/parser.py
@author Steve Foley
@brief Base classes for data set agent parsers
"""
__author__ = 'Steve Foley'
__license__ = 'Apache 2.0'
import time
import nt... |
# Author: Mark Olson 2021-11-06 https://github.com/Mark-MDO47/PrisonDilemmaTourney
#
# algo_mdo_tit_for_2_tat.py - Prisoner's Dilemma tournament algorithm file
#
# The algo_mdo_tit_for_2_tat algorithm behaves as follows:
# On the first two moves it returns choices.COOPERATE
# On all subsequent moves:
# if t... |
__author__ = 'meli'
HOST = '0.0.0.0'
STATIC_PATH = "../static"
TEPLATE_PATH = "../templates" |
'''
@author: frank
'''
import sys, os, os.path
from zstacklib.utils import log
from zstacklib.utils import linux
import zstacklib.utils.iptables as iptables
pidfile = '/var/run/zstack/ceph-primarystorage.pid'
log.configure_log('/var/log/zstack/ceph-primarystorage.log')
logger = log.get_logger(__name__)
import cephage... |
import sys
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
from dynd import annotate, nd, ndt
@unittest.skip('Test disabled since callables were reworked')
class TestApply(unittest.TestCase):
def test_object(self):
@nd.functional.apply(jit = False)
def f(x... |
import math
def pra(n):
for i in range (2,(int)(math.sqrt(n))):
if (n%i==0):
return False
return True
def izpisi():
for i in range (2,200):
if (pra(i)):
print(i) |
from sqlalchemy.orm import Session
from datetime import datetime
from fastapi import HTTPException
from fastapi import status
from fastapi.encoders import jsonable_encoder
from literature.schemas import CrossReferenceSchema
from literature.schemas import CrossReferenceSchemaUpdate
from literature.models import Cross... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
#
# Modified my Varun A. Kelkar - vak2@illinois.edu
import argparse
import copy
import os
imp... |
#
# VAZ Projects
#
#
# Author: Marcelo Tellier Sartori Vaz <marcelotsvaz@gmail.com>
from functools import partial
import re
from django.template import loader
def linkAttributes( self, tokens, index, options, env ):
'''
Add target and rel attributes to links.
'''
tokens[index].attrSet( 'rel', 'noopener'... |
# -*-coding: utf-8 -*-
"""
@Project: create_tfrecord
@File : create_tfrecord.py
@Author : panjq
@E-mail : pan_jinquan@163.com
@Date : 2018-07-27 17:19:54
@desc : 将图片数据保存为单个tfrecord文件
"""
##########################################################################
import tensorflow as tf
im... |
import json
from TwitterAPI import TwitterAPI
from time import gmtime, strftime
def load_conf():
conf = json.load(open("../conf.json"))
return conf
def get_api():
conf = load_conf()
det_file = open(conf['twitter_key_location'])
det = json.load(det_file)
api = TwitterAPI(det['consumer_key'],
... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from geographic_msgs/RouteSegment.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geographic_msgs.msg
import uuid_msgs.msg
class RouteSegment(genpy.M... |
# 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.
"""isort:skip_file"""
import argparse
import importlib
import os
from fairseq.dataclass import FairseqDataclass
from fairseq.dataclass.utils ... |
"""Test suite for phlsys_workingdircommand."""
# =============================================================================
# TEST PLAN
# -----------------------------------------------------------------------------
# Here we detail the things we are concerned to test and specify wh... |
# pylint: skip-file
""" This module tests the deauth module in extensions """
import collections
import unittest
from collections import defaultdict
import mock
import scapy.layers.dot11 as dot11
import wifiphisher.common.constants as constants
import wifiphisher.extensions.deauth as deauth
class TestDeauth(unittest... |
from . import TestEnable |
from utils.color import *
from active_projects.eop.reusables.eop_constants import *
def binary(i):
# returns an array of 0s and 1s
if i == 0:
return []
j = i
binary_array = []
while j > 0:
jj = j / 2
if jj > 0:
binary_array.append(j % 2)
else:
... |
import os
import fire
import gym
import numpy as np
from scipy.special import softmax
from noboard.csv import SummaryWriter
from copy import deepcopy
from scipy.stats import entropy
from collections import OrderedDict
from infomercial.distance import kl
from infomercial.memory import DiscreteDistribution
from infom... |
import os
basedir = os.path.abspath(os.path.abspath(os.path.dirname(__file__)))
### BASIC APP CONFIG
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
SECRET_KEY = 'e951e5a1f4b94151b360f47edf596dd2'
BIND_ADDRESS = '0.0.0.0'
PORT = 9191
HSTS_ENABLED = False
### DATABASE CONFIG
SQLA_DB_USER = 'pdns'
#SQLA_DB_PASSWORD = 'changeme'... |
import pytest
from hyperborea3.chargen import (
DBPATH,
ac_to_aac,
calculate_ac,
class_id_to_name,
get_alignment,
get_attr,
get_attr_mod,
get_caster_schools,
get_class_id_map,
get_class_level_data,
get_combat_matrix,
get_deity,
get_favoured_weapons,
get_gender,
... |
"""
Django settings for forthproject project.
Generated by 'django-admin startproject' using Django 2.1.8.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
% Diffusion coeff and Schmidt number for gases in fresh/sea water
%=========================================================================
% Modified by D. Nicholson from MATLAB gas_diffusion Version 2.0 16 July 2013
% Author: Roberta C. Hamme (University of... |
import logging
import pytest
import os
from functional_tests.t_utils import remove_tmp_dir, create_tmp_dir, __data_testing_dir__
from ivadomed.scripts import convert_to_onnx
from ivadomed.utils import ArgParseException
logger = logging.getLogger(__name__)
__model_path__ = os.path.join(__data_testing_dir__, 'spinegener... |
#!/usr/bin/env python3
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
"""
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this de... |
import argparse
import http.server
import logging
import sys
import prometheus_client
import xmrig_exporter
def main():
parser = argparse.ArgumentParser("Xmrig Exporter")
parser.add_argument("--port", type=int, default=9189)
parser.add_argument("--bind_address", default="0.0.0.0")
parser.add_argume... |
"""A utility for experimenting with searching."""
from project.parsers.crud import get_goods
from project.parsers.search_goods import db
from project.recipes.models import Recipe
if __name__ == "__main__":
recipe = db.query(Recipe).filter(Recipe.id == 2).first().product_list
goods_list = get_goods(recipe,10)
... |
"""Misc. file parsers that are useful for other parsers"""
from xml.sax import saxutils, parse, parseString
class ExcelHandler(saxutils.handler.ContentHandler):
"""
This class is taken from the Python Cookbook so I guess the copyright
goes to them.
Memo: changed the handler from DefaultHandler to Con... |
import numpy as np
from copy import copy
from rlcard.games.leducholdem.dealer import LeducholdemDealer as Dealer
from rlcard.games.leducholdem.player import LeducholdemPlayer as Player
from rlcard.games.leducholdem.judger import LeducholdemJudger as Judger
from rlcard.games.leducholdem.round import LeducholdemRound as... |
#Daniel Sand
import pandas as pd
import numpy as np
fileName='/Tscores.csv'
newFileName='/Tscores_v3.csv'
df=pd.read_csv(fileName, sep=',')
#6 differnt electordes
oldFormat=['0-1','0-2','0-3','2-Jan','3-Jan','3-Feb']
newFormat=['0_1','0_2','0_3','2_1','3_1','3_2']
for iCont in range(0, len(oldFormat)):
currEl... |
from setuptools import setup
setup(
name='mpmp',
author='Jake Crawford',
version='0.0.1',
description='Multimodal Pan-cancer Mutation Prediction',
packages=['mpmp']
) |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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
#
# Unles... |
# Copyright 2015 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... |
"""Root package for the challenge.
Contains generic functionality not specific to days.
"""
import logging
import sys
from functools import partial
from pathlib import Path
ROOT_PATH = Path(Path(__file__).parents[1])
open_utf8 = partial(open, encoding="UTF-8") # Open with explict encoding
# Configuring the global ... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import subprocess
from bddown_core import Pan
from util import convert_none, parse_url, add_http, logger
from config import global_config
def download_command(filename, savedir, link, cookies, limit=None, output_dir=Non... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
import os
from Controlador.Basic_Controller import Controlador
from Controlador.Menu_Controller import Menu
from Controlador.Versus_Controller import Versus_Controlador
__author__ = "Isidora Ulloa"
__license__ = "GPL"
__version__ = "1.0.0"
__email__ = "isidor... |
"""ChQuery the comments Migration
Revision ID: 8b25b23d386f
Revises: a21b8da19c7d
Create Date: 2022-03-12 09:58:47.379065
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8b25b23d386f'
down_revision = 'a21b8da19c7d'
branch_labels = None
depends_on = None
def ... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under 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 SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
# -*- coding: utf-8 -*-
def test_all_contains_only_valid_names():
import pycamunda.resource
for name in pycamunda.resource.__all__:
getattr(pycamunda.resource, name) |
from sys import argv
script, user_name = argv
prompt = '> '
print("Hi %s, I'm the %s script." % (user_name, script))
print("I'd like to ask you a few questions.")
print("Do you like me %s?" % user_name)
likes = input(prompt)
print("Where do you live %s?" % user_name)
lives = input(prompt)
print("What kind of computer d... |
# coding: utf-8
# pylint: disable=invalid-name, no-member
"""ctypes library of mxnet and helper functions."""
from __future__ import absolute_import
import sys
import ctypes
import atexit
import warnings
import inspect
import numpy as np
from . import libinfo
warnings.filterwarnings('default', category=DeprecationWarn... |
#!python3
# -*- coding:utf-8 -*-
import sys
import time
from uiautomation import (Win32API, Logger, ControlFromCursor, GetRootControl, GetFocusedControl,
LogControl, EnumAndLogControlAncestors, EnumAndLogControl, ConsoleColor)
from uiautomation import VERSION
def usage():
Logger.Color... |
def sol():
expression = [sum(map(int, x.split("+"))) for x in input().split("-")]
print(expression[0] - sum(expression[1:]))
if __name__ == "__main__":
sol() |
import datetime
import logging
import math
import cv2
RED = (0, 0, 255)
GREEN = (0, 255, 0)
BLUE = (255, 0, 0)
YELLOW = (0, 255, 255)
logger = logging.getLogger(__name__)
def get_moment(contour):
moment1 = cv2.moments(contour)
area = int(moment1["m00"])
x = int(moment1["m10"] / area)
y = int(moment... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test_unknown_type():
array = ak._v2.Array({"x": np.arange(10)})
array = ak._v2.operations.with_field(base=array, what=Non... |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... |
import json
import lzma
from glob import glob
from pprint import pprint
import click
import smart_open
from tqdm import tqdm
@click.command()
@click.option("--path", help="Path. Wilcard '*' enabled")
@click.option("--tar", default=False, help="True for .xz files")
@click.option(
"--flavor",
default="sm",
... |
# Grace Burke
# 08/02/2018
# Exercise 3:
# Complete the exercise discussed in the Collatz conjecture video by writing a single Python script that starts with an integer and repeatedly applies the Collatz function (divide by 2 if even, multiply by three and 1 if odd) using a while loop and if statement.
# At each ite... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
xarray-based ocean analysis library
The successor of Vacumm.
"""
# Copyright 2020-2021 Shom
#
# 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... |
import connexion
import logging
from flask.ext.cors import CORS
from data.data_source import FTMDataSource
data_source = FTMDataSource()
def start_server():
logging.basicConfig(level=logging.INFO)
app = connexion.App(__name__, port=8080, specification_dir='swagger/', server='gevent')
app.add_api('ftm_ser... |
"""Support for Unifi AP direct access."""
from __future__ import annotations
import json
import logging
from pexpect import exceptions, pxssh
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassista... |
import urllib3
# 你需要一个PoolManager实例来生成请求,由该实例对象处理与线程池的连接以及
# 线程安全的所有细节,不需要任何人为操作
http = urllib3.PoolManager()
# request()方法创建一个GET请求去获取百度的网页信息,返回的r是一个HttpResponse对象
r = http.request('GET', 'https://www.baidu.com')
# 打印请求的状态
print(r.status)
# 打印请求网页的内容
print(r.data)
'''
Accept: text/html, */*;q=0.8 # 浏览器告诉服务器可以接收的文... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
This module contains the specification of 'hierarchical ROI' object,
Which is used in spatial models of the library such as structural analysis
The connection with other classes is not completely satis... |
import json
import logging
import matplotlib.pyplot as plt
import os
import tensorflow as tf
from sklearn.utils import shuffle
import model
import train
logger = logging.getLogger('utils')
logger.setLevel(logging.INFO)
def get_data_path():
'''Returns the path to the image and annotation data.
Downloads the ... |
from contextlib import contextmanager, suppress
from dataclasses import replace
from functools import lru_cache
from types import new_class
from typing import (
Any,
ClassVar,
Collection,
Generic,
Iterable,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
)
from apischema.co... |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import socket
import scrapy
import hashlib
from scrapy.exceptions import DropItem
from scrapy.pipelines.images import ImagesPipeline
from scr... |
#!/usr/bin/env python3
"""
Simple test procedure for manual printing functions of ppa6ctl module
"""
import ppa6ctl as printer
print("Start module ppa6ctl test procedure")
print("Search for a PeriPage printer, this might take some time...")
mac = printer.search()
if not mac:
print("No printer found, stopping tes... |
######################################
# Django 模块
######################################
from django.shortcuts import render, HttpResponseRedirect, redirect, reverse
from django.views import View
from django.contrib.auth import login, logout, authenticate
from django.http import HttpResponse
from django.contrib.auth.b... |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import annotations
from typing import Optional, Sequence
from pydantic import BaseModel, root_validator, validator
from datadog_checks.base.utils.functions import identity
from datadog_c... |
"""Utilities for saving/loading Checkpointable objects."""
# Copyright 2017 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.apa... |
# -*- coding: utf-8 -*-
#
# 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 ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
"""
.. include:: ../README.md
.. include:: ../examples/regression_example.md
.. include:: ../examples/calibration_example.md
"""
REGRESSION = 'regression'
CLASSIFICATION = 'classification'
from laplace.baselaplace import BaseLaplace, ParametricLaplace, FullLaplace, KronLaplace, DiagLaplace, LowRankLaplace
from laplac... |
import logging
from typing import Optional
from paperplane.backends.click import _secho
logger = logging.getLogger(__name__)
def run(
prompt: str,
color: Optional[str] = None,
fg: Optional[str] = None,
bg: Optional[str] = None,
bold: Optional[bool] = False,
):
if prompt is not None:
r... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... |
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, bikbuk and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestVetAsset(unittest.TestCase):
pass |
import setuptools
import urllib.request
DESCRIPTION = 'A standardized collection of python libs and tools'
try:
with open('README.md', 'r') as f:
LONG_DESCRIPTION = f.read()
except FileNotFoundError:
LONG_DESCRIPTION = DESCRIPTION
try:
with open('VERSION', 'r') as f:
VERSION = f.read()
e... |
import numpy as np
import scipy.interpolate as interpolate
import matplotlib.pyplot as plt
import clusterbuster.mathut as math
"""
Start with e.g. InterpolateRadio2D(psiFile = '../Analysis_MUSIC2/Hoeft_radio/mach_psi_tablefine(10,3).txt', inter=(10,6))
"""
# from http://stackoverflow.... |
from django.db import models
class Todolist(models.Model):
title = models.CharField(max_length=100)
detail = models.TextField(null=True, blank=True)
def __str__(self):
return self.title |
for _ in range(int(input())):
n = int(input())
rounds = 0
minidx = 1_000_000_000
for _, idx in sorted(zip(map(int, input().split()), range(n)), reverse=True):
if idx < minidx:
minidx = idx
rounds += 1
print("BOB" if rounds % 2 else "ANDY") |
import os
import random
import requests
import json
import time
# 分类新闻参数
news_classify = [
[0, '民生', 'news_story'],
[1, '文化', 'news_culture'],
[2, '娱乐', 'news_entertainment'],
[3, '体育', 'news_sports'],
[4, '财经', 'news_finance'],
[5, '房产', 'news_house'],
[6, '汽车', 'news_car'],
[7, '教育', ... |
#!/usr/bin/env python
# Copyright 2016 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import json
import os
import shutil
import sys
... |
from QiuBaiSpider.pymysqldb_manager import DbManager
from QiuBaiSpider.page_items import PageItems
from QiuBaiSpider.tools import Tools
'''
爬取糗事百科笑话剔除正文DOM标签然后将爬取数据存入MySQL数据库
Extra module:
PyMySQL
'''
class Main(object):
def __init__(self, max_page=1):
self.max_page = max_page
self.db_manager = Db... |
import json, subprocess
from ... pyaz_utils import get_cli_name, get_params
def list(name, repository=None, resource_group=None, suffix=None, username=None, password=None):
params = get_params(locals())
command = "az acr helm list " + params
print(command)
output = subprocess.run(command, shell=Tru... |
from http import cookies
from Extractor import Extractor
from context import Context
import networkx as nx
from facebook_scraper import get_posts,get_friends,get_profile,get_group_info
cxt=Context(account,creds,limit_post,limit_friends,max,post,False,True)
#print(get_profile("100009975842374"))
#prin... |
##
# Copyright 2018, Ammar Ali Khan
# Licensed under MIT.
# Since: v1.0.0
##
import time
import cv2
import numpy as np
from src.common.package.config import application
from src.opencv.package.config import application as _application
from src.common.package.http import server as _server
from src.common.package.http.h... |
# Copyright 2021 Red Hat, Inc.
#
# 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 agreed to in writin... |
from app import app
if __name__ == '__main__':
context = ('/etc/ssl/certificate.crt', '/etc/ssl/private.key')
app.run(host='0.0.0.0', port=8443, ssl_context=context) |
from numpy.polynomial import * |
#! /usr/bin/env python3
import click
import serial
from enum import Enum, auto
from intelhex import IntelHex,IntelHexError
import constants
@click.command()
@click.argument(
'file',
required=True,
type=click.Path(dir_okay=False, writable=True)
)
@click.option(
'--append', '-a',
help='append data to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.