text stringlengths 2 999k |
|---|
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import random
from seesaw.config import realize, NumberConfigValue
from seesaw.externalprocess import ExternalProcess
from seesaw.item import ItemInterpolation, ItemValue
from seesaw.task import SimpleTask, LimitCo... |
from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class ZhimaCreditPeUserContractUnsignResponse(AlipayResponse):
def __init__(self):
super(ZhimaCreditPeUserContractUnsignResponse, self).__init__()
self._operate_time = None... |
__version__ = "1.8.7"
|
# Copyright 2012-2013 OpenStack Foundation
#
# 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 la... |
# -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import
import os
import sys
import copy
import errno
import signal
import hashlib
import logging
import weakref
from random import randint
# Import Salt Libs
import salt.auth
import salt.crypt
import salt.uti... |
from GNN.globals import *
import numpy as np
import scipy.sparse
import abc
import time
import math
import pdb
from math import ceil
import GNN.cython_sampler as cy
class graph_sampler:
__metaclass__ = abc.ABCMeta
def __init__(self,adj_train,node_train,size_subgraph,args_preproc):
self.a... |
from django.urls import path
from .views import LoginView, IndexView
urlpatterns = [
path("login/", LoginView.as_view(), name="login"),
path("", IndexView.as_view()),
]
|
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
import os
import aria2p
import math
from asyncio import sleep
from subprocess import PIPE, Popen
from userbot import LOG... |
# __init__.py
# Version of the realpython-reader package
__version__ = "1.0.0" |
from schafkopf.game import Game
from schafkopf.card_deck import CardDeck
from schafkopf.game_modes import NO_GAME, WENZ, PARTNER_MODE, SOLO
from schafkopf.suits import SUITS, ACORNS, LEAVES, BELLS
class Tournament:
def __init__(self, playerlist, number_of_games=32, record_games=False):
self.playerlist = p... |
import json
import math
import logging
import string
import nltk
import scipy
import torch
from nltk.stem.porter import *
import numpy as np
from collections import Counter
import os
from torch.autograd import Variable
import config
import pykp
from utils import Progbar
from pykp.metric.bleu import bleu
stemmer = ... |
# Extracting dependencies from lock file.
# LGTM looks for setup.py or requirements.txt files, but fails.
# We are using Poetry, which has no feature to export dependencies list yet...
# Should be started from the project root.
LOCK_FILE = "poetry.lock"
REQUIREMENTS_FILE = "requirements.txt"
if __name__ == "__main__"... |
import pydantic
from pydantic import BaseModel
from typing import Optional, List
from env_parser import EnvConfigs
example_img = 'test_images/Stallone.jpg'
# Read runtime settings from environment variables
configs = EnvConfigs()
class Images(BaseModel):
data: Optional[List[str]] = pydantic.Field(default=None, ex... |
import asyncio
from typing import Type, Dict, Callable, Optional, Set, List, Union
from arclet.letoderea.utils import search_event, TEvent
from arclet.letoderea.entities.auxiliary import BaseAuxiliary
from arclet.letoderea.entities.delegate import EventDelegate, Subscriber
from arclet.letoderea.utils import run_always_... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-07-03 19:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0004_newwriting'),
]
operations = [
migrations.AddField(
... |
# Copyright 2014 Tesora, 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 app... |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 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... |
import json
import logging
import os
import re
import subprocess
import tempfile
from datetime import datetime
from pathlib import Path
import requests
from fastapi import FastAPI
from fastapi_utils.tasks import repeat_every
from grayskull.__main__ import create_python_recipe
from grayskull.cli import CLIConfig
from g... |
# -*- coding: utf-8 -*-
"""SimpleADDScenarioColab.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1yBHXw30_rc1E3NI6g8NsvbZ54_t1DMXX
Retrieve/Import Necessary Packages
"""
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')
impo... |
r"""
Simple profiling tool
AUTHORS:
- David Harvey (August 2006)
- Martin Albrecht
"""
#*****************************************************************************
# Copyright (C) 2006 William Stein <wstein@gmail.com>
# 2006 David Harvey <dmharvey@math.harvard.edu>
#
# Distributed under ... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='krakenpy',
version='0.1.1',
description='Unofficial Python3 library for the Kraken API',
long_description=readme,
... |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Denis Engemann <denis.engemann@gmail.com>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
from copy import deepcopy
from itertools import count
from math i... |
import ipaddress
import os
import threading
from enum import Enum
from functools import lru_cache
from pathlib import Path
from typing import Any, BinaryIO, Callable, Iterable, Optional
import certifi
from OpenSSL.crypto import X509
from cryptography.hazmat.primitives.asymmetric import rsa
from OpenSSL import SSL, c... |
#do the loading of the obj file
import numpy as np
from collections import namedtuple
ObjectData = namedtuple("ObjectData", "V T N F")
Inequalities = namedtuple("Inequality", "A b N V")
def toFloat(stringArray):
res= np.zeros(len(stringArray))
for i in range(0,len(stringArray)):
res[i] = float(stringArray[i])
ret... |
import sys
import webbrowser
sys.path.append("..")
from data import csv_reader
from api import nhs_api
def save(warning_page, tk):
filename = tk.filedialog.asksaveasfile(mode='w', defaultextension=".txt", filetypes=( ("Text Files", "*.txt"), ("All Files", "*.*") ) )
if filename:
filename.write(warni... |
import subprocess
import os
if os.path.exists("inp-output/Time.csv"):
os.remove("inp-output/Time.csv")
for i in range(1, 11):
cmd = ["./serialCoin", "11", "5", "2"]
subprocess.call(cmd)
print("\n +++++++++++++++++++++++++++++++++\n")
|
"""Support for generic GeoJSON events."""
from datetime import timedelta
import logging
from typing import Optional
import voluptuous as vol
from homeassistant.components.geo_location import (
PLATFORM_SCHEMA, GeolocationEvent)
from homeassistant.const import (
CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS, CONF... |
import keras
from keras.applications.inception_v3 import InceptionV3
from keras.applications.mobilenetv2 import MobileNetV2
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
import numpy as np
import magenta.music as mm
from magenta.models.m... |
from pyvirtualdisplay.abstractdisplay import AbstractDisplay
from pyvirtualdisplay.xephyr import XephyrDisplay
from pyvirtualdisplay.xvfb import XvfbDisplay
from pyvirtualdisplay.xvnc import XvncDisplay
class Display(AbstractDisplay):
'''
Common class
:param color_depth: [8, 16, 24, 32]
:param size: ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import sys
import numpy as np
try:
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors... |
# Copyright (c) 2020 Huawei Technologies Co., Ltd
# Copyright (c) 2019, Facebook CORPORATION.
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/lice... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import u... |
import matplotlib.pyplot as plt
import numpy as np
Tg = 16.0
q = 0.090
h = np.array([10, 50, 100, 500])
k = np.array([1, 3, 0.5, 4])
I = np.array([0, 1, 2, 3])
def T(l, z):
return Tg + sum(q/k[:l]*h[:l]) - sum(q/k[l]*h[:l]) - q/k[l]*z
z1 = 0
for l in range(len(h)):
z2 = z1 - h[l]
z = np.linspace(z1, z2,... |
#!/usr/bin/env pytest
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read/write functionality for MrSID driver.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#
#################################################################... |
#
# Copyright (c) 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# 901. Online Stock Span
# brute force: TLE
class StockSpanner2:
def __init__(self):
self.arr = []
def next(self, price):
self.arr.append(price)
i = len(self.arr) - 1
while i >= 0 and self.arr[i] <= price:
i -= 1
if i < 0: return len(self.arr)
return... |
import sklearn.datasets as dt
import matplotlib.pyplot as plt
import numpy as np
seed = 1
# Create dataset
"""
x_data,y_data = dt.make_classification(n_samples=1000,
n_features=2,
n_repeated=0,
class_se... |
from .Utils import JsonEncoder
from applicationinsights.channel.contracts import AvailabilityData
import unittest
import json
import sys
import os.path
root_directory = os.path.join(os.path.dirname(
os.path.realpath(__file__)), '..', '..', '..', '..')
if root_directory not in sys.path:
sys.path.append(root_dir... |
from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.Notification)
class NotificationAdmin(admin.ModelAdmin):
list_display = [
'creator',
'to',
'notification_type'
] |
from sympy import symbols, diff, exp, sqrt, factor, Symbol, printing, simplify, acos, sin, cos, pretty_print
x, y, z, r, k, theta, phi = symbols('x y z r k theta phi')
r = sqrt(x*x+y*y+z*z)
theta = acos(z/r)
R = Symbol('r')
def associatedLaguerre(X, p, q):
if q==0:
return 1
elif q==1:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_mqtt_videocap
----------------------------------
Tests for `mqtt_videocap` module.
"""
import pytest
from contextlib import contextmanager
from click.testing import CliRunner
from mqtt_videocap import mqtt_videocap
from mqtt_videocap import cli
@pytest.fixtu... |
import torch
from torch import Tensor
EPS = torch.tensor(1e-8)
@torch.jit.script
def dist_iou_ab(box_a: Tensor, box_b: Tensor, eps=EPS):
"""
Args:
box_a: tensor of shape [batch_size, boxes_a, 4]
box_b: tensor of shape [batch_size, boxes_b, 4]
gamma: float
eps: float
Origi... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 15:06:04 2020
@author: KIIT
"""
import cv2
import time
import numpy as np
protoFile = "pose_deploy.prototxt"
weightsFile = "pose_iter_102000.caffemodel"
nPoints = 22
POSE_PAIRS = [ [0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[0,9],[9,10],[10,11],[11,12],[0,13],... |
#!/usr/bin/python3 -i
#
# Copyright (c) 2021 LunarG, 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, modify... |
import netket as nk
import numpy as np
import netket.experimental as nkx
from netket.experimental.operator._fermions_2nd import _convert_terms_to_spin_blocks
from netket.experimental.operator.fermion import destroy, create, number
import pytest
op_ferm = {}
hi = nkx.hilbert.SpinOrbitalFermions(3)
op_ferm["FermionOper... |
# Copyright 2021 DAI Foundation
#
# 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,... |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... |
# -*- coding: utf-8 -*-
from gluon import current
from gluon.storage import Storage
from gluon.contrib.simplejson.ordered_dict import OrderedDict
settings = current.deployment_settings
T = current.T
"""
Template settings for US
All settings which are to configure a specific template are located here
Dep... |
def _get_label_info(G, label_name):
"""Get and return information of labels from the input graph
Parameters
----------
G : Network X graph
label_name : string
Name of the target label
Returns
----------
labels : numpy array, shape = [n_labeled_samples, 2]
Array of pairs... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
# credits to @AvinashReddy3108
#
"""
This module updates the userbot based on upstream revision
"""
import asyncio
impor... |
"""Test config validators."""
from datetime import date, datetime, timedelta
import enum
import os
from socket import _GLOBAL_DEFAULT_TIMEOUT
import uuid
import pytest
import voluptuous as vol
import homeassistant
import homeassistant.helpers.config_validation as cv
from tests.async_mock import Mock, patch
def tes... |
import threading
class ThreadWith(threading.Thread):
"""
Yep
"""
def start(self):
super(ThreadWith, self).start()
return self
|
#!/usr/bin/env python
#credits to: Ryu Woon Jung (Leon) and ROBOTIS CO., LTD.
#modified by Billy Nugraha Sutandi
from __future__ import print_function
import os
import sys, select, termios, tty
import numpy as np
import time
from dynamixel_sdk import * # Uses Dynamixel SDK library
if os.name == '... |
"""
The routines to manipulate the handler progression over the event cycle.
Used to track which handlers are finished, which are not yet,
and how many retries were there.
There could be more than one low-level k8s watch-events per one actual
high-level kopf-event (a cause). The handlers are called at different times... |
from django.dispatch import receiver
from django.utils import timezone
from django.db import models
from django_currentuser.middleware import get_current_user
from dalme_app.models import rs_resource, Workflow, Work_log, Page, PublicRegister, Set_x_content, Source, Transcription, Source_pages
from django.contrib.conten... |
# -*- coding: utf-8 -*-
"""this is for the part 5 of CourseWork 1."""
__author__ = 'Chengkun Li'
import sys
import os
import open3d as o3d
import numpy as np
import trimesh
import matplotlib
import matplotlib.pyplot as plt
import tools.baseICP
import tools.tools
# check whether the data folder... |
import maya.cmds as mc
def reset_pivot(*objs):
if not objs:
objs = mc.ls(sl=True, fl=True)
if not objs:
mc.warning('Select at least one object')
return
for obj in objs:
pivot = mc.group(em=True, w=True, n='{}Pivot#'.format(obj))
mc.delete(mc.parentConstraint(obj, ... |
#!/usr/bin/env python3
# Copyright (c) 2016-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 segwit transactions and blocks on P2P network."""
from test_framework.mininode import *
from test... |
"""
ASGI config for Datapeace project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefaul... |
#!/usr/bin/env python
# Copyright 2008-2019 Univa 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 applica... |
from pybo import WordTokenizer
tokenizer = WordTokenizer()
user_input = input("Enter the plain text\n")
tokens = tokenizer.tokenize(user_input)
for _ in range (len(tokens)):
tokens[_]
|
# Copyright (c) 2018-2019 Patricio Cubillos and contributors.
# bibmanager is open-source software under the MIT license (see LICENSE).
__all__ = [
'manager',
'search',
'display',
'add_bibtex',
'update',
'key_update',
]
import os
import re
import json
import urllib
import textwrap
import pickl... |
# encoding=utf-8
'''
净值分析工具
提供:净值分析、净值合并分析、相关性分析
'''
import copy
from functools import reduce
import pandas as pd
import numpy as np
def getWeight(nvDf_dict, weightMethod="equal"):
result = {}
if weightMethod == "equal":
result = {name: 1 for name in nvDf_dict.keys()}
elif weightMethod == "equal_... |
#!/usr/bin/env python3
"""
Launch a Docker image with Ubuntu and LXDE window manager, and
automatically open up the URL in the default web browser.
It also sets up port forwarding for ssh.
"""
# Author: Xiangmin Jiao <xmjiao@gmail.com>
from __future__ import print_function # Only Python 2.x
import sys
import subpr... |
"""
Common Python utilities for interacting with the dashboard infra.
"""
import argparse
import datetime
import json
import logging
import os
import sys
def print_log(msg, dec_char='*'):
padding = max(list(map(len, str(msg).split('\n'))))
decorate = dec_char * (padding + 4)
print(f'{decorate}\n{msg}\n{de... |
from django.shortcuts import render,redirect
from oauth_backend import OauthBackend
from django.http import HttpResponse, HttpResponseForbidden
from django.http import Http404
from django.utils.crypto import get_random_string
from django.conf import settings
from django.contrib.auth import authenticate, login
from tuke... |
import objgraph
import os
x = ['a', '1', [2, 3]]
filename = os.path.dirname(__file__) + '/objgraph_test.png'
objgraph.show_refs([x], filename=filename)
|
from collections import namedtuple
import common.numpy_fast as np
from common.realtime import sec_since_boot
from selfdrive.config import CruiseButtons
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.controls.lib.drive_helpers import actuator_hystereses, rate_limit
class AH:
#[alert_idx, va... |
from quantization_common.quantization_enums import QUANTIZATION
from quantization_common.quantization_config import QuantizationConfig
class NetworkQuantizationController(object):
def __init__(self, quantization_config: QuantizationConfig, quantization_part: QUANTIZATION, p_init: float = 0.95,
st... |
# Generated by Django 2.0.7 on 2018-07-13 10:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogs', '0002_comment'),
]
operations = [
migrations.AddField(
model_name='comment',
name='created_at',
... |
#!/usr/bin/env python2
##
# @file plot_cross_section_by_elevation.py
# @brief Plots a cross section using command-line parameters.
# @author
# @version
#
# Plots a cross section given a set of command-line parameters.
from pycvm import ElevationCrossSection, UCVM, VERSION, UCVM_CVMS, Point, ask_number, ask_path... |
#A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove ... |
#%% 1-misol
list1=[1,2,3]
list2=[11, 22, 33]
list3=[]
if(len(list1)==len(list2)):
list3 = [i for j in zip(list1, list2) for i in j]
print(list3)
elif(len(list1)>len(list2)):
list3 = [i for j in zip(list1, list2) for i in j]
list3.append(list1[len(list2):len(list1)])
print(list3)
elif(len(list1)<l... |
#!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
# pylint: disable=invalid-name
"""Dataloader of CIHP dataset."""
import os
from tensorbay.dataset import Data, Dataset
from tensorbay.label import InstanceMask, SemanticMask
DATASET_NAME = "CIHP"
_SEGMENTS_INFO = {"train": "Training", ... |
import os
import sys
sys.path.append(os.path.abspath('.'))
def install():
from context_menu import menus
import modules
pyLoc = sys.executable # .replace('python.exe', 'pythonw.exe')
scriptLoc = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'main.py') # Location of ... |
# -*- coding: utf-8 -*-
'''
Asset: basic data
=================
'''
ASSET = {
"PERSONS":(
# (tag / name / full / age (birth) / sex / job / call / info)
('man', '男', '', 30,(1,1), 'male', '会社員'),
('woman', '女', '', 30,(1,1), 'female', '会社員'),
),
"STAGES":(
# (tag ... |
#!/usr/bin/env python
import logging
import unittest
import environment
import utils
import tablet
shard_0_master = tablet.Tablet()
shard_0_replica1 = tablet.Tablet()
shard_0_replica2 = tablet.Tablet()
shard_0_rdonly = tablet.Tablet()
shard_0_backup = tablet.Tablet()
shard_1_master = tablet.Tablet()
shard_1_replica1... |
#
# Copyright (C) 2019 Databricks, 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 i... |
import copy
# Array solution
def part1(cups):
cups = copy.deepcopy(cups)
current = None
cups_len = len(cups)
for i in range(100):
# 1. Find current cup
current_ix = (cups.index(current) + 1) % cups_len if current else 0
current = cups[current_ix]
# 2. Pi... |
import numpy as np
import matplotlib.pyplot as plt
def insert_zeros(trace, tt=None):
"""Insert zero locations in data trace and tt vector based on linear fit"""
if tt is None:
tt = np.arange(len(trace))
# Find zeros
zc_idx = np.where(np.diff(np.signbit(trace)))[0]
x1 = tt[zc_idx]
x2... |
# 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... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# 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, ... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .turner import TurnerBaseIE
from ..compat import (
compat_urllib_parse_urlparse,
compat_parse_qs,
)
from ..utils import (
float_or_none,
int_or_none,
strip_or_none,
)
class TBSIE(TurnerBaseIE):
_VALID_URL = r'https?://(?:... |
import theano.tensor as T
import numpy as np
import theano
from theano import shared
class sgd(object):
""" Stochastic Gradient Descent (SGD)
Generates update expressions of the form:
param := param - learning_rate * gradient
"""
def __init__(self, params, masks=None):
self.masks = masks
... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, merge, publish,
... |
import time
import pca9685
from utility import *
class DCMotors:
def __init__(self, i2c, address=0x40, freq=50):
self.pca9685 = pca9685.PCA9685(i2c, address)
self.pca9685.freq(freq)
self.m1_speed = 0
self.m2_speed = 0
def _pin(self, pin, value=None):
if value is None:
... |
import geometry
import math
import OpenGL.GL as gl
import json
import numpy as np
class tree(geometry.base):
lampsize = 1/50
vertex_code = """
uniform mat4 modelview;
uniform mat4 projection;
in highp vec3 position;
in highp float id;
out highp vec2 v_texcoor;... |
#!/usr/bin/env python
print "Content-type:text/html"
print
print "<html><head><title> Test URL Encoding </title></head><body>"
print "<a href=\"http://localhost:8888/test_urlencode.py?first=Jack&last=Trades\">Link</a>"
print "</body></html>" |
from cv2 import namedWindow
from .cli import ArgParser
from .debug_utils import cCOLOURS, debug_show
from .image import WarpedImage
from .options import cfg
from .pdf import save_pdf
# for some reason pylint complains about cv2 members being undefined :(
# pylint: disable=E1101
def main():
parser = ArgParser()
... |
import typing
def main() -> typing.NoReturn:
n, k = map(
int, input().split(),
)
*h, = map(
int, input().split(),
)
inf = 1 << 30
c = [inf] * (n + 1)
c[0] = c[1] = 0
h = [h[0]] + h
for i in range(2, n + 1):
x = inf
for j in range(i - k, i):
if j < 0: continue
x = min(
... |
"""This module implements an abstract base class (ABC) 'BaseDataset' for datasets.
It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses.
"""
import random
import numpy as np
import torch.utils.data as data
from PIL import Image
import torchvision.... |
import contextlib
import os
import ffp
import ffp.io
import numpy as np
import pytest
import tempfile
def test_read_array(tests_root, vocab_array_tuple):
with pytest.raises(TypeError):
ffp.storage.load_storage(None)
with pytest.raises(ffp.io.FinalfusionFormatError):
ffp.storage.load_storage(1... |
# (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... |
from __future__ import print_function
from pylab import *
from pprint import pprint
import scipy.linalg
# test cases, derived from doc/nasa_rotation_def.pdf
#pylint: disable=all
def euler_to_quat(phi, theta, psi):
"Quaternion from (body 3(psi)-2(theta)-1(phi) euler angles"
s1 = sin(psi/2)
c1 = cos(psi/2)... |
#!/bin/python
#Learn the parameters of a Bayesian network for a given structure
from Variable import Variable
from Factor import Factor
def learn_CPT_from_file(data, varCard, parentSets, ess=1.0):
# varCard: cardinalities of variables
# parentSets: dictionary of parents of each variable
# ess: BDe prior e... |
# -*- coding: utf-8 -*-
import csv
import json
import os
import sys
import traceback
from datetime import datetime, timedelta
from io import StringIO
from tempfile import NamedTemporaryFile
import gevent
import requests
from pyquery import PyQuery as pq
import locust
from locust import constant
from locust.argument_p... |
"""
This file offers the methods to automatically retrieve the graph Aidingimonas halophila.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.