text stringlengths 1 927k |
|---|
"""
WSGI config for Spardha project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint
from nltk import NgramTagger
from nltk import jsontags
from nltk.corpus import brown
import nltk
"""
5 章 単語の分類とタグ付け
37. 1つ前のタグ情報を利用するデフォルトタガーを作る
'I like to blog on Kim's blog' の blog にどうやってタグを付けるか?
a. 1つ前の単語を調べるが、現在の単語は無視... |
#!/usr/bin/env pypy
from sys import argv
from random import *
n = int(argv[1])
print 1
print n, n**2
for i in xrange(n):
P = range(1, n + 1)
shuffle(P)
line = ""
for x in P:
line += "0 " * i + str(x) + " " + "0 " * (n - i - 1)
print line |
# -*- coding: utf-8 -*-
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
####################################################################... |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.3725
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getf... |
# Generated by Django 3.1.3 on 2021-06-19 21:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('onlinecourse', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='submission',
old_name='chocies',
... |
from sys import platform
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
ext_modules = [
Extension(
"src.libs.cutils",
["src/libs/cutils.pyx"],
extra_compile_args=['/openmp' if platform == "win32" else '-fopenmp']
... |
from ..request_factory import RequestFactory
from .exceptions import ServerResponseError
from .endpoint import Endpoint, api
import xml.etree.ElementTree as ET
import logging
logger = logging.getLogger('tableau.endpoint.auth')
class Auth(Endpoint):
class contextmgr(object):
def __init__(self, callback):
... |
# 下载选手代码
import re
import os
from ac.pre import get_yaml
from ac.pre import get_html
from selenium import webdriver
from urllib.request import quote
from selenium.webdriver.firefox.options import Options
config = get_yaml()
contest_url = str(config['oj_url'])+'/contest/'+str(config['contest_id'])
options = Options(... |
"""
Django settings for aula_ORM project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# ... |
"""
What was the busiest hour of any day for northbound bike traffic? How about southbound pedestrian traffic?
"""
import bgt_traffic
busiest_bike_nb = []
busiest_bike_count = 0
busiest_ped_sb = []
busiest_ped_count = 0
for dkey, dval in bgt_traffic.traffic.items():
for hkey, hval in dval.items():
if hva... |
# -*- coding: utf-8 -*-
"""
- We should have plotting functions
bode_ba(ba, ...)
Takes an analog transfer function in ba form
bode_z(b, a=1, fs, ...)
Takes a digital transfer function in z form. Is fs, nyq, or dt preferred?
bode_zpk(zpk, fs?, ...)
Use zpk form (or state space?)
... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
import csv
import math
import numpy as np
import matplotlib.pyplot as plt
def read_csv_file(name):
file = open(name)
type(file)
csvreader = csv.reader(file)
header = []
header = next(csvreader) #First line of CSV is name of headers
"Populates array with rows from CSV [[shoulder_angle_1,elbow_... |
# Copyright 2021 Hathor Labs
#
# 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, s... |
from eclcli.common import command
from eclcli.common import utils
from eclcli.bare import bare_utils
class ShowZone(command.Lister):
"""Show availability zone details"""
def get_parser(self, prog_name):
parser = super(ShowZone, self).get_parser(prog_name)
return parser
def take_action(s... |
import Adafruit_DHT;
import MySQLdb as mysql;
import datetime;
import time;
ts = time.time();
sensor = Adafruit_DHT.DHT22;
pin = 4;
umidade, temperatura = Adafruit_DHT.read_retry(sensor, pin);
db = mysql.connect("localhost","root","","colddev");
while(1):
ts = time.time();
sensor = Adafruit_DHT.DHT22;
pin =... |
import random, math
from agent import Agent
from variables import *
MAX_NEIGHBOR_FORCE = abs(math.log(PREDATOR_SENSING_DISTANCE/PREDATOR_DESIRED_DIST))
## Built on predator that zig-zags.
## Coordinate with other predators.
class CoordPredator(Agent):
def __init__(self, sim, start_loc = None):
random.seed... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python
import env
import os
import sys
from subprocess import Popen, call
from tempfile import TemporaryFile
#from run_unit_tests import run_unit_tests
ROBOT_ARGS = [
'--doc', 'YamlVariablesOutput',
'--outputdir', '%(outdir)s',
'--escape', 'space:SP',
'--report', 'none',
'--log', '... |
# Copyright 2012, 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 agr... |
"""Top down operator precedence parser.
This is an implementation of Vaughan R. Pratt's
"Top Down Operator Precedence" parser.
(http://dl.acm.org/citation.cfm?doid=512927.512931).
These are some additional resources that help explain the
general idea behind a Pratt parser:
* http://effbot.org/zone/simple-top-down-pa... |
import os
import subprocess
from pathlib import Path
from tkinter import *
from tkinter import ttk
from tkinter import font
BASE_DIR = Path(__file__).resolve(strict=True).parent
RCLONE = BASE_DIR / 'rclone/rclone.exe'
# subprocess.run([RCLONE, 'ls'], shell=True)
class Application(Frame):
def __init__(self, ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from ... import _utilities, _tables
__a... |
from toontown.coghq import PlatformEntity
class PaintMixer(PlatformEntity.PlatformEntity):
def start(self):
PlatformEntity.PlatformEntity.start(self)
model = self.platform.model
shaft = model.find('**/PaintMixerBase1')
shaft.setSz(self.shaftScale)
shaft.node().setPreserveTr... |
#!/usr/bin/env python
# Copyright (c) 2015-2020 Vector 35 Inc
#
# 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, mo... |
# Adding parent directory to the PYTHONPATH
import sys
sys.path.insert(0,'..')
import numpy as np
from utils.GlobalVariables import *
class EMA_FT(object):
# Base class for all of the feature transformers
def __init__(self):
super(EMA_FT, self).__init__()
def transform(self, df, features):
# it construct a set... |
#!/usr/bin/env python
import os
import plistlib
import yaml
if __name__ == "__main__":
in_path = os.path.join(
os.path.dirname(__file__), "restructuredtext.tmLanguage.yaml"
)
out_path = os.path.join(os.path.dirname(__file__), "restructuredtext.tmLanguage")
with open(in_path) as fp:
syn... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
import struct
import datetime
import io
import re
import os
import os.path
import stat
import sys
if sys.platform == 'darwin':
from . import osx
try:
long
except NameError:
long = int
from .utils import *
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import queue
import threading
import contextlib
import time
import traceback
StopEvent = object()
class ThreadPool(object):
def __init__(self, max_num):
self.q = queue.Queue() # 存放任务的队列
self.max_num = max_num # 最大线程并发数
self.terminal = Fals... |
"""Module for compiling codegen output, and wrap the binary for use in
python.
.. note:: To use the autowrap module it must first be imported
>>> from sympy.utilities.autowrap import autowrap
This module provides a common interface for different external backends, such
as f2py, fwrap, Cython, SWIG(?) etc. (Curren... |
# coding=utf-8
from proposition import *
from establish import establish
from org.opentreeoflife.taxa import Rank
this_source = 'https://github.com/OpenTreeOfLife/reference-taxonomy/blob/master/taxonomies.py'
# Don't change the otc() ids!
# ----- Difficult polysemies -----
def deal_with_polysemies(ott):
# Cte... |
# Files of this project is modified versions of 'https://github.com/AshishBora/csgm', which
#comes with the MIT licence: https://github.com/AshishBora/csgm/blob/master/LICENSE
"""Utils for the DCGAN model
File based on : https://github.com/carpedm20/DCGAN-tensorflow/blob/master/utils.py
It comes with the following lic... |
import numpy as np
from PIL import Image
import torchvision
import torch
class TransformTwice:
def __init__(self, transform):
self.transform = transform
def __call__(self, inp):
out1 = self.transform(inp)
out2 = self.transform(inp)
return out1, out2
def get_cifar10(root, n_la... |
#
# Copyright (C) Francesco Guarnieri 2020 <francesco@guarnie.net>
#
# import os
from pathlib import Path
import configparser
from importlib import metadata
import logging
import logging.config
import logging.handlers
from appdirs import AppDirs
# Estraggo il percorso principale da __file__ e deduco il nome del packa... |
"""
For processing data sent to Firehose by Cloudwatch Logs subscription filters.
Cloudwatch Logs sends to Firehose records that look like this:
{
"messageType": "DATA_MESSAGE",
"owner": "123456789012",
"logGroup": "log_group_name",
"logStream": "log_stream_name",
"subscriptionFilters": [
"subscription_... |
#--*--coding: utf-8 --*--
import tensorflow as tf
from numpy.random import RandomState
bacth_size = 8
# 两个输入节点
x = tf.placeholder(tf.float32, shape=[None, 2], name='x-input')
# 回归问题一般只有一个输出节点
y_ = tf.placeholder(tf.float32, shape=[None, 1], name='y-output')
# 定义了一个单层的神经网络前向传播的过程, 这里就是简单的加权和
w1 = tf.Variable(tf.ran... |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
from itertools import permutations
def maxnum(x):
return max(int(''.join(n) for n in permutations(str(i) for i in x)))
for numbers in [(1, 34, 3, 98, 9, 76, 45, 4), (54, 546, 548, 60)]:
print('Numbers: %r\n Largest integer: %15s' % (numbers, maxnum(numbers))) |
"""
Django settings for web project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
from pat... |
import sys
import subprocess
from unittest import TestCase
from unittest.mock import patch
diffview = sys.modules["DiffView"]
BzrHelper = diffview.util.vcs.BzrHelper
class test_BzrHelper(TestCase):
def setUp(self):
self.dummy_process = DummyProcess()
def test_init(self):
bzr_helper = BzrHel... |
#!/usr/bin/env python3
import os
import re
import sys
import time
import packaging.version
import requests
PROJECT = "praw"
HEADERS = {"Authorization": f"token {os.environ.get('READTHEDOCS_TOKEN')}"}
def fetch_versions():
response = requests.get(
f"https://readthedocs.org/api/v3/projects/{PROJECT}/versi... |
# Copyright 2011 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.
from __future__ import print_function
from distutils.spawn import fi... |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
import os
import sys
import hou
import struct
class pcache(object):
fileName = ""
fileType = 'a'
fileVersion = 1.0
propertyNames = []
propertyTypes = []
propertyData = bytearray()
itemcount = 0
itemstride = 0
defaultBindings = {
'P': 'position',
'N': 'normal',
... |
from dataclasses import dataclass
from bindings.gmd.abstract_curve_segment_type import AbstractCurveSegmentType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class AbstractCurveSegment(AbstractCurveSegmentType):
"""A curve segment defines a homogeneous segment of a curve.
The attributes numDerivat... |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline
class MichelineCodingTestKT1E7x(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.code = get_data(
path='contrac... |
# Add code for Mapping using dataframe containaing id and target.
# Port from pytorch_cnn_trainer
# https://github.com/oke-aditya/pytorch_cnn_trainer
import torchvision
from torchvision import datasets
from torch.utils.data import Dataset
import os
import torch
from PIL import Image
__all__ = ["create_folder_dataset"... |
"""
OpenVINO DL Workbench
Class for creating ORM local profiling pipeline model and dependent models
Copyright (c) 2020 Intel Corporation
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
... |
"""the_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
# 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... |
from process import Process
class Project:
def __init__(self):
self.process = Process()
def date(self):
self._get_date()
def _get_date(self):
print self.process.execute("date")
def print_example_arg(self):
print self.options.example |
from django.conf.urls import url
from . import views
urlpatterns = [
url('^callback/', views.callback),
url('^direct_callback/', views.direct_callback),
] |
"""webots_ros2 package setup file."""
from setuptools import setup
package_name = 'webots_ros2_core'
data_files = []
data_files.append(('share/ament_index/resource_index/packages', ['resource/' + package_name]))
data_files.append(('share/' + package_name, ['package.xml']))
data_files.append(('share/' + package_name +... |
# qubit number=3
# total number=11
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "hr_doc_expire"
app_title = "Employee Document Expire"
app_publisher = "Mostafa Mohamed"
app_description = "Manage employee documents within the company"
app_icon = "fa fa-book"
app_color = "grey"
app_em... |
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import SummaryView, CompanyView
urlpatterns = [
path('summary/', SummaryView.as_view(), name='summary'),
path('companies/<int:pk>/', CompanyView.as_view(), name='companies'),
]
urlpatterns = format_suffix_... |
"""Config flow for TWCManager integration."""
from __future__ import annotations
import logging
from typing import Any
from aiohttp import ClientConnectorError
from twcmanager_client.client import TWCManagerClient
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.data_entry_flow im... |
# Copyright 2021 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 agreed to in writing, ... |
import os
import pickle
import torch
import numpy as np
def save(toBeSaved, filename, mode='wb'):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
file = open(filename, mode)
pickle.dump(toBeSaved, file)
file.close()
def load(filename, mode='rb'):
... |
from parallelm.components import ConnectableComponent
from parallelm.mlops import mlops
class StringSink(ConnectableComponent):
def __init__(self, engine):
super(self.__class__, self).__init__(engine)
def _materialize(self, parent_data_objs, user_data):
expected_str_value = self._params.get(... |
import os
import errno
import tensorflow as tf
from keras import backend as K
def safe_mkdir(dir_to_make: str) -> None:
'''
Attempts to make a directory following the Pythonic EAFP strategy which prevents race conditions.
:param dir_to_make: The directory path to attempt to make.
:return: None
''... |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... |
# Lesson 5. String function and methods
# All string methods returns new values. They do not change the original string.
print("--- Searchig position of a specified symbol")
# index() - Searches the string for a specified value and returns the position of where it was found
s = "programming language"
print(s[1:-1])
#... |
from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... |
import torch
from torch import nn
from utils import set_default
# This module is dedicated to Norm Macdonald
# Implementations from https://github.com/lucidrains/x-transformer
class RMSNorm(nn.Module):
def __init__(self, dim, eps=1e-8):
super().__init__()
self.scale = dim ** -0.5
self.eps... |
from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("_user_id") is None:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function |
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_... |
from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
urlpatterns = [
path('api/predict/', include('prediction.api.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, docume... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
""" cria e salva um novo usuário"""
if... |
from typing import Callable
from typing import Dict
from typing import NamedTuple
from typing import Optional
from typing import Tuple
from typing import TYPE_CHECKING
import numpy as np
from optuna import distributions
from optuna._imports import _LazyImport
from optuna.distributions import BaseDistribution
if TYP... |
import os
import torch
import random
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
from PIL import Image
class Dataset():
def __init__(self, train_dir, basic_types = None, shuffle = True):
self.train_dir = train_dir
self.basic_types = basic_types
self.sh... |
from pathlib import Path
# -------------------------------------------------------------------------------
# Locations
# -------------------------------------------------------------------------------
_BASE = Path(__file__).parent.parent.relative_to(Path(".").resolve())
_PUBLIC = _BASE / "public"
_TEMPLATES = _BASE / ... |
"""
PyTorch code for SAC-AR-DAE. Copied and modified from PyTorch code for SAC-NF (Mazoure et al., 2019): https://arxiv.org/abs/1905.06893
"""
import os
import sys
import argparse
import time
import datetime
import itertools
import random
import pickle
import glob
import gym
import numpy as np
import torch
from sac_a... |
import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from ..utils import as_tuple
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DMMLayer",
]
if n... |
from metamvc.DatabaseUserData import DatabaseUserData
def main():
DatabaseUserData() |
import moeda
valor = float(input('Digite o preço: '))
p = 20
print(f'A metade de {moeda.moeda(valor)} é {moeda.metade(valor, True)}')
print(f'O dobro de {moeda.moeda(valor)} é {moeda.dobro(valor, True)}')
print(f'Aumentando {p}%, temos {moeda.aumentar(valor, p, True)}')
print(f'Diminuindo 10%, temos {moeda.diminuir(va... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
#!/usr/bin/env python
import rospy
import numpy as np
import cv2, cv_bridge
from sensor_msgs.msg import Image
class drone_camera:
def __init__(self, drone_N):
assert int(drone_N) in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
rospy.init_node("drone{}_kinect_vision".format(drone_N), anonymous=False)
se... |
# A*B
# https://www.acmicpc.net/problem/10998
import sys
# testData = [
# '1 2'
# ]
# testData.reverse()
# rl = lambda: testData.pop()
rl = lambda: input()
line = rl()
a = int(line.split(' ')[0])
b = int(line.split(' ')[1])
print(a*b) |
#!/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 the rawtransaction RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... |
def doubles(s): |
"""Tests for distutils.archive_util."""
__revision__ = "$Id: test_archive_util.py 75659 2009-10-24 13:29:44Z tarek.ziade $"
import unittest
import os
import tarfile
from os.path import splitdrive
import warnings
from distutils.archive_util import (check_archive_formats, make_tarball,
... |
{
'target_defaults': {
'defines': [
'OS_CHROMEOS',
'USE_CHEETS=<(USE_cheets)',
'USE_NSS_CERTS',
'USE_SYSTEMD=<(USE_systemd)',
],
'variables': {
'deps': [
'dbus-1',
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libchromeos-ui-<(libbas... |
# -*- coding: utf-8 -*-
def main():
s = input()
ans = float('inf')
for i in range(len(s) - 3 + 1):
candidate = int(s[i:i + 3])
ans = min(ans, abs(753 - candidate))
print(ans)
if __name__ == '__main__':
main() |
import unittest
from app.models import NewsArticle
class ArticleTest(unittest.TestCase):
'''
Test Class to test the behaviour of the NewsArticle class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_article = NewsArticle("CNN", "John ... |
# -*- coding: utf-8 -*-
#
# 格式为 "%Y-%m-%d %H:%M:%S", 如'2018-10-01 00:00:01'
#
# 常用函数
# (1) 时间戳转为struct_time对象
# time.localtime(ts))
# time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=8, tm_min=0, tm_sec=12,
# tm_wday=3, tm_yday=1, tm_isdst=0)
# (2)
# date_obj = datetime.date(int(... |
from pysys.basetest import BaseTest
import time
"""
Validate end to end behaviour for the dummy-plugin for multiple packages with mixed versions
When we install a bunch of packages
Then they are installed
When we deinstall them again
Then they are not installed
This test is currently skipped as it needs a speciali... |
from urllib.parse import urlparse
from datetime import date
class TableNode:
def __init__(self, task, _id):
self.task = task
self.requires = []
self.id = _id
class GraphDependency:
def __init__(self, tasks):
nodes = {}
for task in tasks:
nodes[task.id] = T... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import sys
def mean_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.mean(a), scipy.stats.sem(a)
h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
return m, m... |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... |
# Electrum - lightweight Bitcoin client
# Copyright (C) 2018 The Electrum Developers
#
# 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 ... |
# -*- coding: utf-8 -*-
# This file is generated from NI-FGEN API metadata version 19.6.0d0
attributes = {
1050002: {
'access': 'read-write',
'channel_based': False,
'codegen_method': 'no',
'documentation': {
'description': '\nSpecifies whether to validate attribute value... |
class Solution:
def XXX(self, num: int) -> str:
if num < 1 or num > 3999:
return False
a = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
b = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
r = []
for i in range(len(a)):
... |
# check that we can do certain things without allocating heap memory
import micropython
# Check for stackless build, which can't call functions without
# allocating a frame on heap.
try:
def stackless(): pass
micropython.heap_lock(); stackless(); micropython.heap_unlock()
except RuntimeError:
print("SKIP"... |
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2018 Datadog, Inc.
from datadog_checks.utils.subprocess_output import get_subprocess_output |
# Copyright 2016-2021 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");... |
"""Angles and anomalies.
"""
import numpy as np
from astropy import coordinates, units as u
from poliastro import constants
from poliastro.core.angles import (
D_to_M as D_to_M_fast,
D_to_nu as D_to_nu_fast,
E_to_M as E_to_M_fast,
E_to_nu as E_to_nu_fast,
F_to_M as F_to_M_fast,
F_to_nu as F_to... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import numpy as np
import shutil
import json
import math
import os
import sys
import time
import tensorflow as tf
import gtsrb_input
from model import Model
os.environ["CUDA_VISI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.