content stringlengths 5 1.05M |
|---|
# Copyright 2018 Wind River
#
# 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, so... |
"""Meta tools for integrations."""
import inspect
from typing import Any
class MetaIntegration(type):
"""
Metaclass for context-bound integrations.
The purpose of this metaclass is to simplify writing integrations that
need to attach to the application or request context.
A typical pattern whe... |
from .vars import *
class AccessChecker:
"""An object that checks whether an operation (or request) has the right permission"""
def __init__(self, access, destination):
self.access = access
self.destination = destination
def allowed(self, operation, token, tentative=False):
... |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
from unittest.mock import MagicMock
import pytest
from airbyte_cdk.models import ConnectorSpecification
from airbyte_cdk.sources.streams import Stream
from source_amazon_seller_partner import ConnectorConfig, SourceAmazonSellerPartner
from source_amazon_sel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*--
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
import ads
from ads.vault import Vault
from base64 import b64encode, b64decode
import os
import json
from con... |
import typing
import asyncio
from grpclib.utils import graceful_exit
from grpclib.server import Server
def run_forever(handlers: typing.List[typing.Any], host, port):
async def start():
server = Server(handlers)
with graceful_exit([server]):
await server.start(host, port)
... |
from typing import List
class Solution:
def search(self, nums: List[int], target: int) -> int:
l, r = 0, len(nums) - 1
while l <= r:
mid = l + (r-l) // 2
if nums[mid] == target:
return mid
elif nums[mid] < target:
l = mid + 1
... |
'''
Defines adapters from various accessibility toolkits to required interfaces.
Logic to decide what toolkit to import would go here.
@author: Peter Parente <parente@cs.unc.edu>
@copyright: Copyright (c) 2008 Peter Parente
@license: BSD License
All rights reserved. This program and the accompanying materials are mad... |
from sinks.sink import Source
from sinks.generator_sink import GeneratorSource
__all__ = ('Source',)
|
# Copyright (c) 2019 Bita Hasheminezhad
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# #826: Optional arguments don't work in Python front-end
from phylanx import Phylanx
@Phylanx
def fx(shape, minval=0.25... |
# coding: utf-8
"""
Trend Micro Deep Security API
Copyright 2018 - 2020 Trend Micro Incorporated.<br/>Get protected, stay secured, and keep informed with Trend Micro Deep Security's new RESTful API. Access system data and manage security configurations to automate your security workflows and integrate De... |
"""
Init file for the PyNetworkD3 library.
"""
from PyNetworkD3.core import AdjacencyMatrix, ArcDiagram, ForceGraph, RadialDiagram
version_info = (0, 0, 9)
__version__ = ".".join([str(x) for x in version_info])
|
# Generated by Django 3.1.7 on 2021-03-12 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zenslackchat', '0009_auto_20210311_1214'),
]
operations = [
migrations.AlterField(
model_name='outofhoursinformation',
... |
"""This module implements the packet types of TFTP itself, and the
corresponding encode and decode methods for them."""
import struct
from TftpShared import *
class TftpSession(object):
"""This class is the base class for the tftp client and server. Any shared
code should be in this class."""
# FIXME: do ... |
# Given a string, you need to reverse the order of characters in each word within a sentence while still preserving
# whitespace and initial word order.
import unittest
from hamcrest import assert_that, equal_to
def reverse(chars, acc=""):
if len(chars) is 0:
return acc
else:
return reverse(c... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-02 18:36
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('certificate', '0001_initial'),
]
operations = [
migrations.RenameModel(
... |
#!/usr/bin/env python
from __future__ import annotations
tplx_dict = {
'overwrite': ['notebook_output', 'notebook_input_code'],
'meta_docstring': 'with in/out prompts',
'document_definitions': """
% Exact colors from NB
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
\definecolor{outcolor}{rgb}{0.54... |
from .status import Status
from .status2 import Status2
import random
from operator import itemgetter
class file:
def __init__(self):
self.name = ""
def addname(self, name):
self.name = name;
class folder:
def __init__(self):
self.files = [ ]
self.dirs = [ ]
... |
#Tarea2
#License by : Karl A. Hines
#Velocidad
#Crear un programa en Python que resuelva el siguiente problema
#de física:
#Una ambulancia se mueve con una velocidad de 120 km/h y
#necesita recorrer un tramo recto de 60km.
#Calcular el tiempo necesario, en segundos,
#para que la ambulancia llegue a su destino.
... |
from collections import Counter
from services.log_service import LogService
from enums.ocr_output_type import OCROutputType
from services.process.evaluation_process_service import EvaluationProcessService
from services.process.process_service_base import ProcessServiceBase
from entities.word_evaluation import WordEvalu... |
import shutil
from eval import voc_eval
from utils.data_augment import *
from utils.tools import *
from tqdm import tqdm
from utils.visualize import *
from utils.heatmap import imshowAtt
import config.yolov4_config as cfg
import time
current_milli_time = lambda: int(round(time.time() * 1000))
class Evaluator(object)... |
#! /usr/bin/env python
# coding=utf-8
from __future__ import print_function
import json
import os
import numpy as np
import rospkg
import rospy
import tf
from gtec_msgs.msg import Ranging
from nav_msgs.msg import Odometry
from scipy.optimize import least_squares
from tf.transformations import euler_from_quaternion, q... |
import argparse
import math
import pathlib
import pickle
from typing import Dict
import matplotlib.pyplot as plt
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as transforms
from src.data.vwapdataset import VwapDataset
from src.feature.minma... |
from typing import Any
from requests_oauthlib import OAuth1, OAuth1Session
__all__ = ("OauthSession",)
class OauthSession(OAuth1Session):
"""
The OauthSession, this usually is uses for POST requests and requests that need Oauth1 Authorization.
.. versionadded:: 1.2.0
"""
def __init__(self, con... |
# -*- coding: utf-8 -*-
"""
https://raw.githubusercontent.com/DeanIsMe/Keras_Objects/master/ClockworkRNN.py
Clockwork RNN implementation on Keras (Tensorflow)
Based off the paper by
Jan Koutník, Klaus Greff, Faustino Gomez, Jürgen Schmidhuber
Retrieved from https://arxiv.org/abs/1402.3511
Implementation taking inspirat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.Qt import QWidget, QApplication, QPushButton, QVBoxLayout, QMessageBox
class MainWindow(QWidget):
def __init__(self):
super().__init__()
button = QPushButton('Close')
button.clicked.connect(self.close)
... |
"""Exports GPT, Example, and UIConfig classes."""
from .gpt import *
from .ui_config import *
from .demo_web_app import demo_web_app
|
Traits = [ # Acolyte
'I idolize a particular hero of my faith, and constantly refer to their deeds and example.',
'I can find common ground between the fiercest enemies, empathizing with them and always working towards peace.',
'I see omens in every event and action. The gods try to speak to us, we just need to listen.... |
import pygame
def Spritesheet(path) :
""" This function returns a spritesheet on the given path """
return pygame.image.load(path)
def give_images(spritesheet, x, y, width, height, count):
""" This function will give a list of images """
sheet_width = spritesheet.get_width()
sheet_height = sprit... |
#!/usr/local/bin/python
#-*- coding: utf-8 -*-
import urllib
import urllib2
import cookielib
def get_page(url):
urlInfo = urllib.urlencode({})
# print urlInfo
request = urllib2.Request(url, urlInfo, {})
# print request
response = urllib2.urlopen(request)
# print response
return response.re... |
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.views import APIView
import pickle
import numpy as np
from api import serializers
# Create your views here.
class MainPage(APIView):
# serializer_class = seriali... |
from cluster_pack.skein import skein_launcher
import sys
sys.modules['cluster_pack.skein.yarn_launcher'] = skein_launcher
|
from selenium import webdriver
# 같은 경로에 chromedriver.exe가 위치해야 함
driver = webdriver.Chrome('chromedriver.exe')
driver.get('http://comp.fnguide.com/')
selector = "#svdMainChart11 > a"
ui = driver.find_element_by_css_selector(selector)
ui.click()
driver.switch_to.window( driver.window_handles[-1])
selector = "#chartD... |
# Copyright (c) 2014 Mirantis 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 writ... |
from decimal import Decimal, getcontext
from vector import Vector
getcontext().prec = 30
class Plane(object):
NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'
def __init__(self, normal_vector=None, constant_term=None):
self.dimension = 3
if not normal_vector:
all_zeros ... |
import random
class Deck:
_READY = ["AS", "2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "10S", "JS", "QS", "KS",
"AC", "2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "10C", "JC", "QC", "KC",
"AD", "2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "10D", "JD", "QD", "KD",
"AH", "2H", "3H... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2014 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-07-04
#
"""Update the cache of projects.
Uses settings from the workflow's `settings.json` file.
"""
from __future__ import print_function, unicode_literals... |
#!/usr/bin/env python
# adaptive_sched.py
import subprocess
import threading
import datetime
names = [("pid", int),
("comm", str),
("state", str),
("ppid", int),
("pgrp", int),
("session", int),
("tty_nr", int),
("tpgid", int),
("flags", int),
... |
# Copyright (c) Corporation for National Research Initiatives
import jast
import org, java
def makeAnys(args):
ret = []
for arg in args:
ret.append(arg.asAny())
return ret
def PyObjectArray(args):
aargs = makeAnys(args)
return Object(
jast.FilledArray("PyObject", aargs),
... |
# -*- coding: utf-8 -*-
# author: Tac
# contact: cookiezhx@163.com
import os
# 依赖库
_DEPENDENCY = [
'PyQt6',
]
def check_dependency():
"""
检查第三方依赖库
为用户安装第三方依赖库
Returns:
None
"""
for lib_name in _DEPENDENCY:
try:
__import__(lib_name)
except ImportError:
... |
import os
import requests
class Client(object):
""" A client for accessing the EOcean API. """
def __init__(self, username=None, password=None, server=None, port=None,
originator=None, report_url=None, max_response=None,
response_fmt=None, service_provider=None, environment=... |
# -*- coding: utf-8 -*-
"""Algorithm for sampling coreset:
Based on the following two papers
M. F. Balcan, S. Ehrlich, Y. Liang.
Distributed k-Means and k-Median Clustering on General Topologies. NIPS'13
J. Chen, E. S. Azer, Q. Zhang,
A Practical Algorithm for Distributed Clustering and Outlier Detection, NIPS'18
"""
... |
# ============================================================================
# ============================================================================
# Copyright (c) 2021 Nghia T. Vo. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
"""
Módulo que representa um ticket, uma pessoa ou um serviço.
Não deve ser usado diretamente, mas obtido no retorno de algum método
da classe Entity ou Query.
Exemplo de uso:
>>> from pyvidesk.tickets import Tickets
>>> tickets = Tickets(token="my_token")
>>> ticket = ticket.get_by_id(3)
>>> print(ticket)
... <Mod... |
"""A submodule containing functions relating to grid cell properties."""
import logging
log = logging.getLogger(__name__)
import numpy as np
import resqpy.olio.vector_utilities as vec
import resqpy.olio.volume as vol
from ._defined_geometry import cell_geometry_is_defined
def thickness(grid,
cell_k... |
#!/usr/bin/env python3
from aws_cdk import core, aws_ec2, aws_redshift, aws_sam
class TestEnvStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
nat_instance = aws_ec2.NatProvider.instance(instance_type=aws_ec2.InstanceTy... |
import pandas as pd
import os
from shutil import rmtree
# Set file directories
read_dir = 'data/01_raw/ucsd_all/'
write_dir = 'data/02_intermediate/'
book_list_dir = write_dir
scratch_dir = f'{write_dir}ucsd_reviews_scratch/'
# If output directories do not exist, create them
if not os.path.isdir(write_dir):
os.m... |
from QInstrument.lib import QInstrumentInterface
from QInstrument.instruments.Proscan.Proscan import Proscan
from PyQt5.QtCore import (pyqtSlot, QTimer)
import numpy as np
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class QProscan(QInstrumentInterface):
... |
import asyncio
from multiprocessing.pool import ThreadPool
from pathlib import Path
import pytest
from cmagic import Magic, find_db
@pytest.fixture
def magic():
m = Magic()
m.check(find_db())
m.load(find_db())
return m
def test_magic_find(magic):
assert "ASCII text" in magic.guess_file("/etc/h... |
from ._utils import get_useful_receipt
def main():
receipt = get_useful_receipt()
receipt.show_trace()
|
import firedrake as fd
import firedrake_ts as fdts
from firedrake import inner, dot, grad, div, dx, ds, dS, jump, avg
from letop.physics import AdvectionDiffusionGLS, InteriorBC
from typing import Union, List, Callable
def HamiltonJacobiCGSolver(
V: fd.FunctionSpace,
theta: fd.Function,
phi: fd.Function,
... |
from distutils.core import setup
setup(
name='OSExtension',
version='0.1.5',
author='Andrew Udvare',
author_email='audvare@gmail.com',
packages=['osext'],
url='http://pypi.python.org/pypi/OSExtension/',
license='LICENSE.txt',
description='Extension for os module, for POSIX systems only'... |
from django.conf.urls import url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from uploads.core import views
from downloads.views import *
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^uploads/$', views.simple_upload, name='simple_... |
"""Tests for custom layers."""
import numpy as np
import tensorflow as tf
from tensorflow import keras
# pylint: disable=no-name-in-module
from tensorflow.python.framework import test_util as tf_test_util
from tensorflow.python.keras import keras_parameterized, testing_utils
# pylint: enable=no-name-in-module
from dis... |
import os
class Config(object):
def __init__(self, **kwargs):
# configuration for building the network
self.data_dir = os.path.join('..','data')
self.y_dim = kwargs.get("y_dim", 6)
self.tr_dim = kwargs.get("tr_dim", 7)
self.ir_dim = kwargs.get("ir_dim", 10)
self.laten... |
"""
Setup script for nrf5_multi_prog.
USAGE:
python setup.py install
"""
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def read_requirements(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).rea... |
import data_mine as dm
import random
from data_mine.nlp.allen_ai_obqa import OBQAFacts, OBQAType
def main():
print("Train examples:")
print(dm.ALLEN_AI_OBQA(OBQAType.TRAIN)) # Displays a Pandas DataFrame.
print("\n\n")
print("Dev examples:")
print(dm.ALLEN_AI_OBQA(OBQAType.DEV)) # Displays a P... |
# -*- coding:utf-8 -*-
from distutils.core import setup
setup(
name = 'python-lattice',
version = '0.0.1',
author = 'Luciano Bello',
author_email = 'luciano (a) debian (*) org',
py_modules = ['lattice'],
url = 'https://code.google.com/p/python-lattice/',
license = 'LICENSE.txt',
descrip... |
"""Implementaton of :class:`SymPyIntegerRing` class. """
from sympy.polys.domains.integerring import IntegerRing
from sympy.polys.domains.groundtypes import SymPyIntegerType
from sympy.polys.polyerrors import CoercionFailed
class SymPyIntegerRing(IntegerRing):
"""Integer ring based on SymPy's ``Integer`` type. "... |
# サイコロ関数(dice)を作ってみよう
# よくある2次関数の例
def f(x):
return x ** 2 - 2 * x + 1
# 常に1を返すダイス関数
def dice(n):
return 1
print(dice(6))
print(dice(6))
print(dice(6))
|
import numpy as np
from fractions import Fraction
class FourierSeries:
def __init__(self, r, p, n=None):
"""
Parameters
----------
r : list of int or float
振幅
p : list of int or float
位相
n : int
次数
"""
... |
if '.' in IP_ADDRESS:
result = 'IPv4'
else:
result = 'IPv6'
|
# --------------- Dash components ------------------
from functools import reduce
from typing import Dict, Union
import dash
import dash_cytoscape as cyto
import dash_bootstrap_components as dbc
from dash import Input, Output, State, dcc, html
import plotly.graph_objects as go
import numpy as np
from mmodel.flux import... |
# Copyright (c) 2021. Sergei Sazonov. All Rights Reserved
import calendar
from datetime import datetime
import dash_bootstrap_components as dbc
from dash import Dash, html, dcc
from hardio.dashapp import UserConfig
from iobrocker import IO
from .utils import CalendarFormatter
from ..presenter_config import AppDashI... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------#
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. #
# #
# Licensed under the BSD 2-Clause License (the “License... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program and the accompanying materials are made available under the
# terms of the MIT license (X11 license) which accompanies this distribution.
# Author: R. Schoene
import sys, re, os, csv, timeit, shutil, json, threading, time
from datetime import datetime
from ... |
#
# Copyright (c) 2020, NVIDIA 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
# -*- coding: utf-8 -*-
"""
URLs related to Attachment objects in the Basecamp 3 API.
"""
import mimetypes
import os
from .base import EndpointURLs
class Attachments(EndpointURLs):
"""
https://github.com/basecamp/bc3-api/blob/master/sections/attachments.md
"""
def create(self, filepath, name=None, c... |
from functools import lru_cache
from operator import and_, or_, lshift, rshift
parse_input = lambda data: {(s := line.split(' -> '))[1]: s[0].split() for line in data}
def get_value(wires, wire='a', b=None):
operations = {'AND': and_, 'OR': or_, 'LSHIFT': lshift, 'RSHIFT': rshift}
@lru_cache
def aux(wire... |
import io
import time
import pandas as pd
import pywinauto
from pywinauto import clipboard
from pywinauto import keyboard
from .captcha_recognize import captcha_recognize
class SimpleTHSTrader:
""" 定义一些常量 """
def __init__(self, exe_path, main_wnd_title):
"""
exe_path:经纪商软件exe路径
main_... |
#!/usr/bin/python
import os, sys
adminUser=sys.argv[1]
adminPassword=sys.argv[2]
domainHome=sys.argv[3]
selectTemplate("Basic WebLogic Server Domain", "12.2.1.2.0")
loadTemplates()
# Create admin user
cd('/Security/base_domain/User/' + adminUser)
cmo.setPassword(adminPassword)
# Create admin server
cd('/Server/Admi... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import namedtuple
import numpy as np
from matplotlib import pyplot as plt
import cvxopt as op
import random
Point = namedtuple("Point", ['x', 'y'])
Facility = namedtuple("Facility", ['index', 'setup_cost', 'capacity', 'location'])
Customer = namedtuple("Cu... |
# performing important imports
import pandas as pd
import os
import numpy as np
from application_logging.logger import AppLogger
from prediction_data_validation.prediction_data_validation import PredictionDataValidation
from preprocessing.preprocessing import PreProcessing
from file_operation.file_handler import FileHa... |
from http import HTTPStatus
from typing import AsyncIterator, Callable, Optional, cast
from aiohttp import web
from aiohttp.web_app import _Middleware
from aiohttp.web_routedef import _SimpleHandler
from aiohttp.web_urldispatcher import DynamicResource, MatchInfoError
from aiodogstatsd import Client, typedefs
from ai... |
def _codeowners_impl(ctx):
path = "/" + ctx.label.package + "/"
# The PATH will be set to the empty string,
# if the codeowners is defined in the ROOT of the WORKSPACE
if ctx.label.package == "":
path = ""
if len(ctx.attr.team) == 0 and len(ctx.attr.teams) == 0:
fail("Either team o... |
"""
The sqlite integration instruments the built-in sqlite module to trace SQLite queries.
Enabling
~~~~~~~~
The integration is enabled automatically when using
:ref:`ddtrace-run<ddtracerun>` or :ref:`patch_all()<patch_all>`.
Or use :ref:`patch()<patch>` to manually enable the integration::
from ddtrace import... |
from __future__ import annotations
import parsedatetime
from subtypes import Enum
class MetaInfoMixin:
_calendar = parsedatetime.Calendar()
class Enums:
class WeekDay(Enum):
"""An Enum holding the days of the week."""
MONDAY = MON = Enum.Alias()
TUESDAY = TUE = E... |
"""Messages for wake word detection."""
import re
import typing
from dataclasses import dataclass
from enum import Enum
from dataclasses_json import LetterCase, dataclass_json
from .base import Message
class HotwordToggleReason(str, Enum):
"""Reason for hotword toggle on/off."""
UNKNOWN = ""
"""Overrid... |
#!/usr/bin/env python3
from requests import get
from requests.auth import HTTPBasicAuth
class odl_switch_info(object):
"""
This module is used to gather switch interface
details from the OpendayLight controller.
"""
def __init__(self, controller_ip, odl_user, odl_pass):
"""
I... |
import slackbot.surveybot
import unittest
class VoteBadInput(unittest.TestCase):
def testNoArguments(self):
"""vote should fail with no arguments"""
result = slackbot.surveybot.vote("testuser","")
self.assertEqual("Parameters ERROR - Example to vote option Green for survey #2: `/survey re... |
print('Calculadora de Tabuada')
n = int(input('Insira o número: '))
print('-'*15)
print(f'{n} * {1:2} = {n*1:2}')
print(f'{n} * {2:2} = {n*2:2}')
print(f'{n} * {3:2} = {n*3:2}')
print(f'{n} * {4:2} = {n*4:2}')
print(f'{n} * {5:2} = {n*6:2}')
print(f'{n} * {6:2} = {n*7:2}')
print(f'{n} * {7:2} = {n*8:2}')
print(f'{n} * ... |
# TODO: remove in 0.11
import warnings
warnings.warn(
"snapshot_download.py has been made private and will no longer be available from"
" version 0.11. Please use `from huggingface_hub import snapshot_download` to"
" import the only public function in this module. Other members of the file may be"
" ... |
# -*- coding: utf-8 -*-
#
# cijoe documentation build configuration file, created by sphinx-quickstart
import cij
import sys
import os
numfig = True
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
extensions = [
'sphinx.ext.todo',
'sphinx.ext.imgmath',
# 'sphinxcontrib.bibtex',
]
templates_path = [... |
from circllhist.wrapper import Circllhist, Circllbin
|
# Copyright 2019 Xanadu Quantum 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
# Unless required by applicable law or agre... |
# -*- coding: utf-8 -*-
from qgis.PyQt.QtCore import QSettings
from qgis.core import QgsCoordinateReferenceSystem
from qgis.utils import iface
QGIS_SETTINGS = QSettings()
LOCALE = QGIS_SETTINGS.value("locale/userLocale")[0:2]
SRID = 2193
def get_attribute_dialog_setting():
"""
Used to retrieve the user co... |
import asyncio
import aiohttp
from ipwhois import IPWhois as _IPWhois
from typing import List, Iterable, Dict
from .base import BaseAsyncWhois, Action, Kind
from .cache import IPWhoisCacheHandler
from .extractor import IPWhoisExtractor
from ipaddress import IPv4Address
import time
class IPWhois(BaseAsyncWhois):
... |
n= 5
for n in range(1, n+1):
for i in range(1, n + 1):
print(i, end=' ')
print("")
|
import numpy as np
import scipy.spatial
import scipy.linalg
def nullspace(A, atol=1e-13, rtol=0):
u, s, vh = np.linalg.svd(A)
tol = max(atol, rtol * s[0])
nnz = (s >= tol).sum()
ns = vh[nnz:].conj().T
return ns
def nearest_orthogonal_matrix(R):
U,S,Vt = np.linalg.svd(R)
return U @ np.eye(3,dtype=R.dtype... |
import os
import numpy as np
from dataset.hcp.covariates import Covariates
from util.logging import get_logger, set_logger
from fwk.config import Config
from util.path import absolute_path
import nibabel as nb
from util.arrays import slice_from_list_of_pairs
from dipy.io.image import load_nifti
class MnistReader:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... |
#%%
# always check the input carefully after opening and splitting
# split r and c indices for simplicity (instead of combining them into a tuple)
# when using re, be sure to thing if greedy or nongreedy parsing is necessary
# don't use re when split() suffices, whitespaces can be casted to int
# make sure to experimen... |
"""assistant_worker.py
"""
from threading import Thread
import numpy as np
class AssistantWorker(Thread):
"""AssistantWorker(Thread)
Args:
Thread
This class is a worker thread which, when run, is responsible for taking a list of messages
from a queue, opening a Session with the Watson... |
#
# 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... |
__title__ = "reckon"
__package__ = "reckon"
__description__ = "reckon: Dead simple, dynamic caching."
__url__ = "https://github.com/seandstewart/reckon"
__version__ = "0.2.0"
__author__ = "Sean Stewart"
__author_email__ = "sean_stewart@me.com"
__license__ = "MIT"
__copyright__ = "Copyright 2019 Sean Stewart"
|
"""
Client module for the oidc app
"""
import json
import secrets
from typing import Optional
from django.conf import settings
from django.core.cache import cache
from django.http import HttpResponseRedirect
import jwt
import requests
from jwt.algorithms import RSAAlgorithm
import oidc.settings as default
from oidc.... |
#
# Copyright © 2012-2016 VMware, 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 required by applicable law ... |
# Generated by Django 3.0.8 on 2020-08-05 20:30
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[
('ID', model... |
import pandas as pd
import json
from time import sleep
from datetime import datetime
from selenium.common.exceptions import NoSuchElementException
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from fake_useragent import UserAgent
from webdriver_manager.chrome import ChromeDriverM... |
# coding = 'utf-8'
"""
In this file, we implemented the so-called `remove one selector.' The idea is to select the most important variable by discovering how much the model
accuracy suffers by randomly permuting a variable.
Currently, there are some other things that needs to be done.
1. Add more metrics for classif... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.