text stringlengths 1 927k |
|---|
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __futu... |
# 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 writing, software
# distributed under the Li... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2020 MBI-Division-B
# MIT License, refer to LICENSE file
# Author: Luca Barbera / Email: barbera@mbi-berlin.de
from tango import AttrWriteType, DevState, DebugIt, ErrorIt, InfoIt, DeviceProxy
from tango.server import Device, attribute, command, device_... |
#
# Copyright (c) 2021 Citrix Systems, 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... |
from asynctest import TestCase as AsyncTestCase
from asynctest import mock as async_mock
import pytest
from aiohttp.web import HTTPForbidden
from ...config.injection_context import InjectionContext
from ...ledger.base import BaseLedger
from ...wallet.base import BaseWallet, DIDInfo
from .. import routes as test_modu... |
from .returnable import Returnable
__all__ = ['Returnable'] |
import math
from math import radians
lat1 = 13.0827
lat2 = 9.4533
long1 = 80.2707
long2 = 77.8024
R = 6371
teta1 = radians(lat1)
teta2 = radians(lat2)
teta = radians(lat2 - lat1)
landa = radians(long2 - long1)
a = math.sin(teta/2) * math.sin(teta/2) + math.cos(teta1) * math.cos(teta2) * math.sin(landa/2) * math.sin... |
import json
from airiam.terraform.entity_terraformers.BaseEntityTransformer import BaseEntityTransformer
class IAMPolicyDocumentTransformer(BaseEntityTransformer):
def __init__(self, entity_json: dict, policy_name, principal_name=None):
policy_document_name = f"{policy_name}_document"
if principa... |
from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
# decorators = [login_required, ]
# @method_decorator(decorators, name='dispatch')
class BenchmarkViewAppCGOne(TemplateView):
template_name = "benchmar... |
# coding=utf-8
import unittest
__author__ = "zephor"
# noinspection PyUnresolvedReferences
class TestNewspaper(unittest.TestCase):
pass |
# -*- coding: utf-8 -*-
import itertools
import sys
from lumbermill.BaseThreadedModule import BaseThreadedModule
from lumbermill.utils.Decorators import ModuleDocstringParser
@ModuleDocstringParser
class Permutate(BaseThreadedModule):
"""
Creates successive len('target_fields') length permutations of element... |
import datetime
import pathlib
import pytest
from textacy import utils
@pytest.mark.parametrize(
"val,val_type,col_type,expected",
[
(None, int, list, None),
(1, int, list, [1]),
([1, 2], int, tuple, (1, 2)),
((1, 1.0), (int, float), set, {1, 1.0}),
],
)
def test_to_colle... |
# Copyright 2020 Supun Nakandala, Yuhao Zhang, and Arun Kumar. All Rights Reserved.
# Copyright 2019 Uber Technologies, 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 ... |
# -*- coding: utf-8 -*-
"""
Function adjust spines
Created on Fri Apr 17 10:18:30 2015
@author: anderson
"""
def adjust_spines(ax, spines):
for loc, spine in ax.spines.items():
if loc in spines:
spine.set_position(('outward', 2)) # outward by 10 points
spine.set_smart_bounds(False... |
import ctypes
from numpy.ctypeslib import ndpointer
lib = ctypes.cdll.LoadLibrary('./libdist.so')
fn = lib.dist
fn.restype = ctypes.c_double
fn.argtypes = [
ndpointer(ctypes.c_double),
ndpointer(ctypes.c_double),
ctypes.c_size_t
]
def dist(x, y):
return fn(x, y, len(x)) |
import numpy as np
# as in the previous example, load decays.csv into a NumPy array
decaydata = np.loadtxt('decays.csv', delimiter=',', skiprows=1)
# provide handles for the x and y columns
time = decaydata[:,0]
decays = decaydata[:,1]
# import the matplotlib plotting functionality
import pylab as plt
plt.plot(time... |
# pylint: disable=useless-super-delegation
import json
from concurrent.futures import ThreadPoolExecutor, Future
import boto3
from oautom import get_logger
from oautom.execution.execution import Execution
class LambdaExecution(Execution):
def __init__(self, name: str, flow: 'Flow', lambda_function: str, payloa... |
#!/usr/bin/env python
import rospy
import sys
import cv2
from sensor_msgs.msg import Image, CompressedImage, CameraInfo
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class cvBridgeDemo:
def __init__(self):
self.node_name = "cv_bridge_demo_compressed"
rospy.init_node(self.node_nam... |
from numpy.testing import assert_array_equal, assert_almost_equal, \
assert_array_almost_equal, assert_raises, assert_equal
import numpy as np
import math
from skimage.measure._regionprops import (regionprops, PROPS, perimeter,
_parse_docs)
SAMPLE = np.array(
[[0, 0,... |
"""
Some useful plot functions
"""
import matplotlib.pyplot as plt
import numpy as np
def matrix_surf(m, xlimits=None, ylimits=None, **kwargs):
if xlimits is None:
xlimits = [0, m.shape[0]]
if ylimits is None:
ylimits = [0, m.shape[1]]
Y, X = np.meshgrid(np.arange(ylimits[0], ylimits[1... |
#! /usr/bin/python
import sys
def readDocs(fn):
docs=[]
doc=[]
for line in open(fn):
line = line.strip()
if line=="":
if doc!=[]: docs.append(doc)
doc=[]
else:
doc.append(line)
if doc!=[]:
docs.append(doc)
return docs
def readDocsFine(fn,field=5):
docs=[]
doc=[[]]
lastLabel = None
for ... |
#!/usr/bin/python
def test_import():
"""
Testing import of torsionfit.
"""
import torsionfit |
from cirq import circuits, ops, protocols
import cirq
from cirq.contrib.qasm_import import circuit_from_qasm, qasm
import re
import os
from cirq import decompose
from cirq.circuits import Circuit
from pyvoqc.formatting.format_from_qasm import format_from_qasm
from pyvoqc.formatting.rzq_to_rz import rzq_to_rz
from pyvoq... |
"""
Plot vertical plots of PAMIP data for each month from November to April using
the ensemble mean (300)
Notes
-----
Author : Zachary Labe
Date : 26 June 2019
"""
### Import modules
import numpy as np
import matplotlib.pyplot as plt
import datetime
import read_MonthlyData as MO
import statsmodels.stats.mul... |
# Inspired by npm's package.json file
name = 'hisa'
version = '0.1.0'
release = '0.1.0'
description = 'A stock market predictor and model builder'
long_description = ['README.md']
keywords = ['neural', 'network', 'machine', 'deep',
'learning', 'tensorflow', 'stock', ... |
#!/usr/bin/python
import RPi.GPIO as GPIO
import datetime
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.OUT)
print "Starting to blink GPIO 24" + datetime.datetime.now().isoformat()
while True:
print "GPIO On : " + datetime.datetime.now().isoformat()
GPIO.output(24, True)
time.slee... |
from setuptools import setup
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='adamacs',
version='0.0.1',
description='Architectures for Data Management and Computational Support.',
long_description=readme,
author='Daniel Müller-Kom... |
# Copyright 2016 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... |
# -*- coding: utf-8 -*-
#
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache 2 License.
#
# This product includes software developed at Datadog
# (https://www.datadoghq.com/).
#
# Copyright 2018 Datadog, Inc.
#
"""run.py
Run the application locally by runnnig:
`pyt... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 18 18:19:15 2019
@author: pepo
"""
import libardrone
import pygame
from time import sleep
import time
import cv2
drone = libardrone.ARDrone()
def operation(sleep):
t1 = time.time()
t2=t1
while t2-t1<sleep:
drone.turn_left()
t2=time.time()
... |
# Micropython a9g example
# Source: https://github.com/pulkin/micropython
# Author: pulkin
# Demonstrates how to wrap sockets into ssl tunnel
import cellular
import socket
import ssl
cellular.gprs("internet", "", "")
print("IP", socket.get_local_ip())
host = "httpstat.us"
port = 443
s = socket.socket()
s.connect((host,... |
#!/usr/bin/env python
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
log = sys.stdout if is_verbose_mode() e... |
from keras.layers.convolutional import Convolution2D
from keras.layers.convolutional import MaxPooling2D
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.optimizers import SGD, Adam
import numpy as np
import theano as th
from keras.utils.np_utils import to_... |
# -*- coding: utf-8 -*-
{
'!langcode!': 'he-il',
'!langname!': 'עברית',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"עדכן" הוא ביטוי אופציונאלי, כגון "field1=newvalue". אינך יוכל להשתמש בjoin, בעת שימוש ב"עדכן" או "מחק".',
'"User Exception" debug ... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v1.proto.resources import asset_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_resources_dot_asset__pb2
from google.ads.google_ads.v1.proto.services import asset_service_pb2 as google_dot_ads_dot_googlea... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: oracle_profile
short_description: Manage profiles in an Oracle database
description:
- Manage profiles in an Oracle database
version_added: "0.8.0"
optio... |
import logging
import azure.functions as func
from azure.iot.hub import IoTHubRegistryManager
# Note that Azure Key Vault doesn't support underscores
# and some other special chars;
# we substitute with a hyphen for underscore
CONNECTION_STRING = "{c2d connection string}"
DEVICE_ID = "{device to invoke}"
MESSAGE_COU... |
# Copyright Amazon.com, Inc. or its affiliates. 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
#
# Unl... |
def Main():
a = (True, True, False) |
import configparser
import os
import re
import subprocess
import sys
import PyPDF2
config = configparser.ConfigParser()
config.read('config.ini', encoding='utf-8')
INKSCAPE_PATH = config['DEFAULT']['InkscapePath']
def replace_text(target_doc, target_str, replace_str, id_str):
pattern = '''id="''' + id_str + '''"... |
import os
import bz2
import requests
import glob
global HOME
HOME = "https://pci-ids.ucw.cz"
class Vendor:
"""
Class for vendors. This is the top level class
for the devices belong to a specific vendor.
self.devices is the device dictionary
subdevices are in each device.
"""
def __init__(s... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -alertnotify, -blocknotify and -walletnotify options."""
import os
from test_framework.addres... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The TMIcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from .mininode import *
from .script import CSc... |
"""The Public Utility Data Liberation (PUDL) Project."""
# Create a parent logger for all PUDL loggers to inherit from
import logging
import pkg_resources
import pudl.analysis.mcoe
import pudl.cli
import pudl.constants
import pudl.convert.datapkg_to_sqlite
import pudl.convert.epacems_to_parquet
import pudl.convert.f... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node disconnect and ban behavior"""
import time
from test_framework.test_framework import RbxTest... |
from zeit.cms.browser.resources import SplitDirResource, Library
import zeit.cms.browser.resources
import zeit.find.browser.resources
lib_css = Library('zeit.edit', 'resources')
lib_js = Library('zeit.edit.js', 'js')
SplitDirResource('editor.css')
SplitDirResource('fold.js', depends=[zeit.cms.browser.resources.base... |
from cliff.lister import Lister
from factioncli.processing.config import get_passwords
class Credentials(Lister):
"Returns a list of the default credentials for this instance of Faction"
def take_action(self, parsed_args):
passwords = get_passwords()
return ("Type", "Username", "Password"), p... |
"""Test functions for the sparse.linalg.interface module
"""
from functools import partial
from itertools import product
import operator
import pytest
from pytest import raises as assert_raises, warns
from numpy.testing import assert_, assert_equal
import numpy as np
import scipy.sparse as sparse
from scipy.sparse.l... |
# -*- coding: utf-8 -*-
#
# CFFI documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 14 16:37:47 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... |
#!/usr/bin/env python
"""Tests for `erd` package."""
import unittest
from click.testing import CliRunner
from erd import erd
from erd import cli
class TestErd(unittest.TestCase):
"""Tests for `erd` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"... |
import os
from collections import defaultdict
from traceback import print_exc
from typing import List, Dict, Any, Optional, Tuple, Type
import numpy as np
from modnet.preprocessing import MODData
from modnet.models import MODNetModel
from modnet.utils import LOG
from modnet.hyper_opt import FitGenetic
MATBENCH_SEED ... |
from __future__ import absolute_import, print_function
import math
import numpy as np
import matplotlib.pyplot as plt
from random import randint
from .misc import *
from .transforms import transform, transform_preds
__all__ = ['accuracy', 'AverageMeter']
def get_preds(scores):
''' get predictions from score ma... |
from fileinput import filename
from urllib.request import Request
from api.drivers import student
from api.drivers.student import student_drivers
from api.middlewares import authentication_middleware
from api.schemas.admin.admin_request_schema import admin_request_schemas
from api.schemas.student.request_schemas impor... |
import csv
from collections import defaultdict, OrderedDict
from django.core.exceptions import PermissionDenied
from django.http.response import StreamingHttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.urls.base import reverse
from django.views.decorators.cache import cache_pa... |
# The following comments couldn't be translated into the new config version:
# Configuration file for EventSetupTest_t
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.PoolDBESSource = cms.ESSource("PoolDBESSource",
loadAll = cms.bool(True),
toGet = cms.VPSet(cms.PSet(
r... |
#!/usr/bin/env python
"""
USAGE:
apache_log_parser_split.py some_log_file
This script takes one command line argument: the name of a log file
to parse. It then parses the log file and generates a report which
associates remote hosts with number of bytes transferred to them.
"""
import sys
def dictify_logline(line... |
from telegram.ext import CommandHandler
from telegram.ext import ConversationHandler
from telegram.ext import Filters
from telegram.ext import MessageHandler
from thx_bot.commands import CHOOSING
from thx_bot.commands import CHOOSING_ADD_MEMBER
from thx_bot.commands import CHOOSING_REWARDS
from thx_bot.commands import... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from de... |
"""
Make a "broken" horizontal bar plot, i.e. one with gaps, of run times.
(c) 2015 Massachusetts Institute of Technology
"""
import numpy
import pprint
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
label_fontsize = 11
labels = ['Disk Reset',
# 'Power On',
... |
import gevent.server
from mud_telnet_handler import MudTelnetHandler
from game_server import GameServer
import argparse
import logging
# Set up logging
log = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
handler.setFormatter(formatter)
... |
from __future__ import absolute_import
import json
from datetime import timedelta
import django
from django.utils.timezone import now
from django.test.utils import override_settings
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.core imp... |
# ----------------------------------------------------------------------
# Decorators
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from ... |
__all__ = ['hubCommands']
import sys
import Vocab.InternalCmd as InternalCmd
from tron import Misc, g, hub
from tron.Hub.KV.KVDict import kvAsASCII
class hubCommands(InternalCmd.InternalCmd):
""" All the commands that the "hub" package provides.
The user executes these from the command window:
hub st... |
import torch
import torch.distributions as td
class GMM2D(td.MixtureSameFamily):
def __init__(self, mixture_distribution, component_distribution):
super(GMM2D, self).__init__(mixture_distribution, component_distribution)
def mode_mode(self):
mode_k = torch.argmax(self.mixture_distribution.pro... |
# Copyright 2013 IBM Corp.
#
# 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 agree... |
# 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
# "License"); you may not u... |
import typing as ty
import numpy as np
import scipy.special
import sklearn.metrics as skm
from . import util
def calculate_metrics(
task_type: str,
y: np.ndarray,
prediction: np.ndarray,
classification_mode: str,
y_info: ty.Optional[ty.Dict[str, ty.Any]],
) -> ty.Dict[str, float]:
if task_ty... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, override_settings
from django.contrib.auth import get_user_model
import json
import responses
## responses:
def kong_login_success():
responses.add(
responses.POST,
'https://kong:8443/test/oauth2/toke... |
# Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
"""
SAM CLI version
"""
__version__ = "1.13.1" |
#!/usr/bin/python3
"""
premium question
"""
from typing import List
import heapq
dirs = [(0, -1), (0, 1), (-1, 0), (1, 0)]
class Solution:
def shortestDistance(self, maze: List[List[int]], start: List[int], destination: List[int]) -> int:
"""
No friction rolling ball
F[i][j][dir] = min ... |
"""
Suppose you have some input data sources `data_in` on which you apply some process `F` parameterized by `args`:
data_out = F(data_in, args)
You want to serialize `data_out`, but also don't want to lose `args`,
to preserve the exact setup that generated the output data.
Now suppose you want to inspect `args` ... |
from abc import abstractmethod
from crawling.crawler_data_structures.crawl_data import CrawlData
class Crawler:
"""
An abstract class for other Crawlers to inherit from.
A Crawler should open a given file and attempt to find an associated file pattern at every byte in the given file.
"""
@abstrac... |
# This file is execfile()d with the current directory set to its containing dir.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# All configuration values have a default; values that are comme... |
import itertools
import math
import numpy as np
from abc import abstractmethod
from io import TextIOWrapper
from sorted_list import SortedList
class Stream():
def __init__(self, length, save=True):
self.length = length
self.N = 0
self.n = 0
self.save = save
self.elements =... |
from flask import Blueprint
bp = Blueprint("base_routes", __name__)
from . import delete, get # noqa: F401, E402 |
import os
TELEGRAM_TOKEN = os.environ['TELEGRAM_TOKEN']
DATABASE = {
'HOST': os.getenv('DB_PORT_3306_TCP_ADDR', 'localhost'),
'USER': os.getenv('DB_MYSQL_USER', 'root'),
'PASSWORD': os.getenv('DB_MYSQL_PASSWORD', ''),
'NAME': 'aurora',
} |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Modified by Haozhi Qi, Yuwen Xiong
# --------------------------------------------------------
import mxnet as mx
import numpy as np
... |
#CONSTRUINDO UMA CLASSE ITERATOR
class GenItem(object):
def __init__(self, first, last):
self.first = first
self.last = last
def __iter__(self):
return self
def __next__(self):
if self.first > self.last:
raise StopIteration
else:
self.first +... |
#----------------------------------------------------------------------------
# Name: GridColMover.py
# Purpose: Grid Column Mover Extension
#
# Author: Gerrit van Dyk (email: gerritvd@decillion.net)
#
# Version 0.1
# Date: Nov 19, 2002
# RCS-ID: $Id$
# Licence: wxWindows lic... |
import sys
sys.path = ['.'] + sys.path
from test.test_support import verbose, run_unittest
import re
from sre import Scanner
import sys, os, traceback
# Misc tests from Tim Peters' re.doc
# WARNING: Don't change details in these tests if you don't know
# what you're doing. Some of these tests were carefuly modeled t... |
from __future__ import division
import inspect
import numpy as np
import warnings
from scipy.optimize import root
from .ancil import natural, cmip6_volcanic, cmip6_solar, historical_scaling
from .constants import molwt, lifetime, radeff
from .constants.general import M_ATMOS, ppm_gtc
from .defaults import carbon, ther... |
# Copyright 2017 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# -*- coding: utf-8 -*-
"""
pybit
------------------------
pybit is a lightweight and high-performance API connector for the
RESTful and WebSocket APIs of the Bybit exchange.
Documentation can be found at
https://github.com/verata-veritatis/pybit
:copyright: (c) 2020-2021 verata-veritatis
:license: MIT License
"""... |
#coding=utf-8
def MultiplePackage(N,C,weight,value,num,physic):
'''
多重背包问题(每个物品都有次数限制)
:param N: 预测的虚拟机种类,如N=pre_num
:param C:输入文件是CPU,那么背包总容量就是MEM,如C=
:param weight: 每个物品的容量数组表示,如weight=[0,5,4,7,2,6]
:param value: 每个物品的价值数组表示,如value=[0,12,3,10,3,6]
:param num:每个物品的个数限制,如num=[0,2,4,1,5,3]
... |
# Generated by Django 3.2.8 on 2021-10-21 16:43
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_m... |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outp... |
#!/usr/bin/env python3
# Usage:
# ./stats.py results.csv chart.svg
# ./stats.py official.csv official_chart.svg
import argparse
import csv
import json
import subprocess
UNKNOWN = 0
PASSED = 1
FAILED = 2
CRASHED = 3
PARTIAL = 4
OUT_OF_SCOPE = 5
class RowData:
def __init__(self, name, ... |
#!/usr/bin/env python
#
# mac_to_ip documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
"""
Ometria API
http://docs.ometria.com/apis/data_api_v2/
- the env vars for the authentication are stored on the kubernetes cluster
under 'ometria-access-credentials'
- functionality:
set api credentials
send custom events
"""
import logging
import os
import requests
class OmetriaExecutor:
"""
Ometr... |
import antlr4
from csharp.CSharp4Lexer import CSharp4Lexer
import re
def parseCSharp(code):
code = code.replace('\\n', '\n')
parsedVersion = []
stream = antlr4.InputStream(code)
lexer = CSharp4Lexer(stream)
toks = antlr4.CommonTokenStream(lexer)
toks.fetch(500)
identifiers = {}
identCount = 0
for to... |
# -*- 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
#... |
"""
This file offers the methods to automatically retrieve the graph Paraprevotella xylaniphila.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: ... |
from typing import Dict, List
import requests
from bs4 import BeautifulSoup # type: ignore[import]
class _RequestCache:
def __init__(self) -> None:
self._cache: Dict[str, BeautifulSoup] = {}
def __call__(self, page: str) -> BeautifulSoup:
if page.endswith(".html"):
page = page[:... |
def DivisiblePairCount(arr) :
count = 0
k = len(arr)
for i in range(0, k):
for j in range(i+1, k):
if (arr[i] % arr[j] == 0 or arr[j] % arr[i] == 0):
count += 1
return count
if __name__ == "__main__":
#give input in form of a list -- [1,2,3]
arr = [int... |
from d2a import transfer
from . import models
transfer(models, globals(), db_type='mysql') |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.3192
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class ResourceListOfGetCounterpartyResponse(object):
... |
# -*- encoding: utf-8 -*-
"""
_models/models_dataset_outputs.py
"""
from log_config import log, pformat
log.debug("... loading models_dataset_outputs.py ...")
from flask_restplus import fields
### import data serializers
from solidata_api._serializers.schema_logs import *
from solidata_api._serializers.sche... |
# coding: utf-8
"""
VAAS API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 0.0.1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.