text stringlengths 2 999k |
|---|
import ocl
import camvtk
import time
import datetime
import vtk
def drawTree(myscreen,t,color=camvtk.red,opacity=0.2, offset=(0,0,0)):
nodes = t.get_nodes()
black=0
nmax=len(nodes)
i=0
for n in nodes:
cen = n.point()
#print "cen=",cen.str()
scale = n.get_scale()
#p... |
"""
nomad.models.evaluation
The models defined in this module can be found
[here](https://github.com/hashicorp/nomad/blob/v1.0.4/api/evaluations.go)
in Hashicorp Nomad project.
"""
from dataclasses import dataclass, field
from typing import Optional
from serde import deserialize, serialize
@deserialize(rename_all="... |
import numpy as np
class History:
def __init__(self):
self.all_theta = []
self.all_loss = []
self.best_thetas = []
self.best_losses = []
self.all_best = []
self.best = np.inf
self.best_theta = None
self.loss_trace = []
self.iters = 0
... |
# Copyright 2020 (author: Meng Wu)
import jieba
import jieba.posseg as pseg
#import hanlp
class HanlpTokenizer():
def __init__(self, wsmodel="LARGE_ALBERT_BASE", posmodel="hanlp.pretrained.pos.CTB5_POS_RNN_FASTTEXT_ZH"):
self.tokenizer = hanlp.load(wsmodel)
self.tagger = hanlp.load(posmodel)
... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : main.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 10/23/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import os.path as osp
import jacinle.io as io
from jacinle.logging import get_logger
from jacin... |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, 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 ... |
a = int(input('Digite um número: '))
b = int(input('Digite o valor da Razão: '))
c = 0
x = a
total = 0
t = 10
while t != 0:
total += t
while c < total:
print('{} '.format(x), end='')
x = x + b
c += 1
print('PAUSA')
t = int(input('Quantos termos você quer mostrar a mais? '))
print... |
# Copyright (c) 2020, DCSO GmbH
from collections import namedtuple
from datetime import datetime, timezone
import unittest
from unittest.mock import patch
from . import temporal
class TestUTCNow(unittest.TestCase):
def test_timezone_is_utc(self):
now = temporal.utc_now()
self.assertEqual(timezon... |
from base64 import decodestring
import hashlib
class vars:
class boollst(object):
def __init__(self):
self.item = []
def index(self,n):
#print(n)
#print(len(self.item))
if (n < len(self.item)):
return self.item[n]
else:
return None
def add(self,b):
try:
self.it... |
#!/usr/bin/env python
#
# Copyright 2016 Cisco 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 applicab... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'http://astro.up.pt/~jfaria/sandbox'
RELATIVE_... |
"""Tests for alpacka.agents.deterministic_mcts."""
from alpacka import agents
from alpacka import envs
from alpacka import testing
def test_integration_with_cartpole():
env = envs.CartPole()
agent = agents.DeterministicMCTSAgent(
action_space=env.action_space,
n_passes=2,
)
episode = ... |
from bddrest import status, response, given
from nanohttp import Application, Controller, action, html, json, text, \
xml, binary, context
from nanohttp.tests.helpers import Given, when
app_init_calls = 0
begin_response_calls = 0
begin_request_calls = 0
end_response_calls = 0
def test_application_hooks():
cl... |
# [2009]-"Cuckoo search via Levy flights"
import numpy as np
from numpy.random import rand
import math
from sklearn.svm import SVC
def error_rate(x, opts):
# parameters
fold = opts['fold']
xt = fold['xt']
yt = fold['yt']
xv = fold['xv']
yv = fold['yv']
# Number of insta... |
"""
Scale a mesh asymmetrically in one coordinate
"""
from dolfin import *
from mshr import *
domain = Rectangle(Point(0.0, 0.0), Point(5.0, 0.01))
mesh = generate_mesh(domain, 20)
V = FunctionSpace(mesh, "CG", 2)
e = Expression("sin(2*pi*(x[0]*x[0]+x[1]*x[1]))", degree=2)
f = interpolate(e, V)
#####################... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from multiprocessing import Process, Value, Array
def f(n, a):
n.value = 3.1415927
for i in range(len(a)):
a[i] = -a[i]
if __name__ == '__main__':
num = Value('d', 0.0)
arr = Array('i', range(10))
p = Process(target=f, args=(num, arr))
p.st... |
fp1 = open("1.txt", "r")
fp2 = open("2.txt", "w")
for s in fp1.readlines():
fp2.write(s.replace('Hello','Hi'))
fp1.close()
fp2.close()
|
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
# pylint: disable=protected-access
from typing import Any, IO, Union, TYPE_CHECKING
from azure.core.tracing.decorator_async import distributed_trace_asy... |
import os,sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
_n=115.131 # factor de correción para llevar a 10^4 hab
#datos vacunacion
df1=pd.read_csv('vacunas/datos/primera.csv',sep=',').sort_values(by='fecha').set_index('fecha').fillna(0)
df2=pd.read_csv('vacunas/datos/segunda.csv',sep=',').... |
'''
Need the dot binary from the graphviz package (www.graphviz.org).
'''
if '__file__' in globals():
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import numpy as np
from dezero import Variable
from dezero.utils import plot_dot_graph
def goldstein(x, y):
z = (1 + (x + y + ... |
'''
Zoinks: a program to print field values from Zotero records
Authors
-------
Michael Hucka <mhucka@caltech.edu> -- Caltech Library
Copyright
---------
Copyright (c) 2022 by Michael Hucka and the California Institute of Technology.
This code is open-source software released under a 3-clause BSD license.
Please se... |
"""
=========================================
prop_cycle property markevery in rcParams
=========================================
This example demonstrates a working solution to issue #8576, providing full
support of the markevery property for axes.prop_cycle assignments through
rcParams. Makes use of the same list of... |
# Стандартная атмосфера и неоднородность ландшафта SSPade vs SSF
from rwp.sspade import *
from rwp.vis import *
from rwp.environment import *
from rwp.petool import PETOOLPropagationTask
from propagators.sspade import TerrainMethod
logging.basicConfig(level=logging.DEBUG)
environment = Troposphere()
h = 110
w = 1000... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 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 responses to invalid transactions.
In this test we connect to one node over p2p, and test tx... |
import sys
import numpy
def lis(ans, vec, pos):
hi = 0
# Last element of vector, nothing after it
if(pos == len(vec)-1):
return 1
if(ans[pos] != 0):
return ans[pos]
# Test all combinations
for j in range(pos+1, len(vec)):
if vec[pos] <= vec[j]:
a = lis(an... |
import random
import unittest
def quick_sort(num_list):
if len(num_list) > 1:
quick_sort_detail(num_list, 0, len(num_list))
def quick_sort_detail(num_list, begin, end):
if end - begin <= 0:
return
else:
pivot_idx = end - 1
left_idx, right_idx = begin, pivot_idx - 1
... |
#!/usr/bin/env python3
# Generate a tic-tac-toe board using dicts.
theBoard = {
"top-L": " ",
"top-M": " ",
"top-R": " ",
"mid-L": " ",
"mid-M": " ",
"mid-R": " ",
"low-L": " ",
"low-M": " ",
"low-R": " ",
}
"""
theBoard = [
{"top-L": " ", "top-M": " ", "top-R": " "},
{"m... |
from __future__ import absolute_import, division, unicode_literals
from flask.ext.restful import reqparse
from changes.api.base import APIView
from changes.api.serializer import Crumbler
from changes.config import db
from changes.constants import Result, Status
from changes.models.build import Build
from changes.mode... |
# Copyright (c) 2020 PaddlePaddle 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 applic... |
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
import abc
import os
import re
import shutil
import subprocess
import sys
import tempfile
import warnings
from contextlib import suppress
from typing import Dict, List, Mapping, Op... |
from aes import AESModeOfOperation
__all__ = ["AESModeOfOperation"]
|
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
from .time import make_ingti_times, deadtime_correction, GTI, tGTI
from .orientation import quat_to_pol_and_roll, pol_to_vec, \
vec_to_pol, get_wcs_roll_for_qval, align_with_z_quat, minimize_norm_to_survey
from .caldb import ARTQUATS
from ._det_spatial import DL, offset_to_vec, vec_to_offset_pairs, vec_to_offset
fr... |
INTERNAL_IPS = ('127.0.0.1',)
ALLOWED_HOSTS = ['localhost', '127.0.0.1', ]
APPEND_SLASH = True
TIME_ZONE = 'UTC'
USE_TZ = True
ROOT_URLCONF = 'testapp.urls'
SECRET_KEY = 'abc'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.messages',
... |
BIL = 1000*1000*1000
class C:
COL_GIA3 = 3
COL_VOL3 = 4
COL_GIA2 = 5
COL_VOL2 = 6
COL_GIA1 = 7
COL_VOL1 = 8
COL_GIA = 9
COL_VOL = 10
COL_GIA1b = 12
COL_VOL1b = 13
COL_GIA2b = 14
COL_VOL2b = 15
COL_GIA3b = 16
COL_VOL3b = 17
COL_TOTAL_VOL = 18
COL_AVG_PRI... |
import frappe
from frappe.query_builder.functions import GroupConcat, Coalesce
def execute():
frappe.reload_doc("desk", "doctype", "todo")
ToDo = frappe.qb.DocType("ToDo")
assignees = GroupConcat("owner").distinct().as_("assignees")
query = (
frappe.qb.from_(ToDo)
.select(ToDo.name, ToDo.reference_type, assi... |
import os
import socket
import logging
from airflow.operators.python_operator import PythonOperator
from airflow.operators.dummy_operator import DummyOperator
from jinja2 import Template
from src.module.common import etl_dict, jdbc_ops
from src.utils.enum import etl_layer, conn_id
from src.utils import common
from src.... |
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
from pydantic import EmailStr, root_validator
from sqlalchemy.sql.expression import Select, or_
from sqlmodel import Field, Relationship
from joj.horse.models.base import BaseORMModel
from joj.horse.models.user_oauth_account import UserOAuthAccount
fr... |
from typing import Union, Any, List, Optional, Callable, Iterator
from collections import OrderedDict
from string import ascii_uppercase
from datetime import datetime
from fnmatch import fnmatch
from decimal import Decimal
from dateutil.parser import parse as iso_parse
from toolz import curry, compose
_iso_pattern_d... |
import configparser
import json
import os
import traceback
from flask import Flask, request, redirect, session, render_template, escape
from duo_universal.client import Client, DuoException
config = configparser.ConfigParser()
config.read("duo.conf")
try:
duo_client = Client(
client_id=config['duo']['cl... |
from collections import defaultdict
import json
class RestAPI(object):
def __init__(self, database=None):
"""Our constructor class to create API objects."""
self.database = database
self.balance = {}
def get(self, url, payload=None):
"""The GET method of our API"""
if... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the niceman package for the
# copyright and license terms... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/workspace/src/navigation/move_slow_and_clear/include".split(';') if "/workspace/src/navigation/move_slow_and_clear/include" != "" else []
PROJECT_CATKIN_DEPENDS = "geometry_msgs;nav_core;pluginlib;ros... |
""" This exercises and tests Ellis.py """
import pytest
import socket
import json
TEST_FORMAT = [{'name':'Potato', 'region':'potato'}, {'name':'Potato2', 'region':'potato'}]
TEST_JSON = '[{"name":"Potato","region":"potato"},{"name":"Potato2","region":"potato"}]\n'
@pytest.fixture(autouse=True)
def patch_modules(mon... |
from setuptools import setup, find_packages
import sys
requirements = ['numpy', 'pandas']
setup_requirements = requirements + ['pytest-runner']
test_requirements = requirements + ['pytest']
install_requirements = requirements
setup(
name='si',
version='0.0.1',
python_requires='>=3.7',
package_dir={''... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import json
from setuptools import setup, find_packages
def locked_requirements(section):
"""Look through the 'Pipfile.lock' to fetch requirements by section."""
with open('Pipfile.lock') as pip_file:
pipfile_json = json.load(pip_file)
if se... |
# Generated by Django 2.0.4 on 2018-04-20 07:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Comment',
fields=[
('id', models.AutoField(... |
# t009.py
from simp_py import lcd
lcd.polygon(50,50,50,5,5)
lcd.circle(150,50,50,lcd.RED,lcd.BLUE)
lcd.ellipse(100,100,80,50,15,lcd.MAROON, lcd.PURPLE)
lcd.arc(50,200,40,4,-90,90,lcd.MAGENTA,lcd.ORANGE)
lcd.roundrect(150,180,80,60,5,lcd.CYAN, lcd.PINK)
|
from allennlp.common.util import JsonDict
from allennlp.common.util import get_spacy_model
from allennlp.data import DatasetReader, Instance
from allennlp.models import Model
from allennlp.predictors.predictor import Predictor
from overrides import overrides
@Predictor.register("tne_predictor")
class TNEPredictor(Pre... |
# Copyright 2014 NEC Corporation. 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 ... |
from datetime import datetime, timedelta
from uuid import uuid4
from flask import current_app
from alerta.app import db
from alerta.utils.api import absolute_url
from alerta.utils.format import DateTime
class Blackout(object):
def __init__(self, environment, **kwargs):
if not environment:
... |
#!/usr/bin/env python
import scipy.ndimage as ndi
import scipy.stats as stats
import numpy as np
from matplotlib import pyplot as plt
import PIL
import glob
import cv2
from ietk.util import get_background
def get_dark_channel(
img: np.ndarray, filter_size: int):
"""Compute the dark channel of given image... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 23:52:16 2019
@author: Winham
网络训练
"""
import os
import numpy as np
from Config import Config
import net
from keras.utils import to_categorical
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras.models import load_model
impo... |
import warnings
from math import sqrt
from typing import Iterator, List, Optional, Union, Any
import e3nn
import torch
import torch.fx
from e3nn import o3
from e3nn.util import prod
from e3nn.util.codegen import CodeGenMixin
from e3nn.util.jit import compile_mode
from torch import fx
from ._codegen import codegen_tens... |
class Solution:
def numWaterBottles(self, numFullBottles: int, numExchange: int) -> int:
numEmptyBottles = 0
result = 0
while numFullBottles > 0:
result += numFullBottles
numEmptyBottles += numFullBottles
numFullBottles = (int)(numEmptyBottles / numExchang... |
from flask_mail import Message
from flask import render_template
from . import mail
def mail_message(subject,template,to,**kwargs):
sender_email = maranahuwase12@gmail.com
email = Message(subject, sender=sender_email, recipients=[to])
email.body= render_template(template + ".txt",**kwargs)
email.html ... |
from django.contrib import admin
# Register your models here.
from .models import Persona,TipoEmpleado
class PersonaAdmin(admin.ModelAdmin):
fieldsets = (
('Informacion basica', {
'fields': ('rfc','nombre_completo')
}),
('Datos generales', {
'fields': ('dir... |
"""END MODEL
To better evaluate the quality of our generated training data,
we evaluate an end model trained on this data.
Here, the end model is implemented as a logistic regression bag of words model.
However, you can replace this with any model of your choosing, as long as it has
functions "fit" and "predict" wi... |
"""
Mapping routines to map to and from linear conductivities (what is used
internally) to other representations such as resistivities or logarithms
thereof.
Interpolation routines mapping values between different grids.
"""
# Copyright 2018-2022 The emsig community.
#
# This file is part of emg3d.
#
# Licensed under ... |
class Config:
PYTHON_PORT = "6950"
GRAPH_HOST = "http://localhost:7474/"
GRAPH_USER = "neo4j"
GRAPH_PASSWD = "123456"
import os
# 读取环境变量,更新到Config后,以和容器一起使用
for k in os.environ:
if k in Config.__dict__:
# logger.info(f'use environ var:{k},{os.environ.get(k)}')
setattr(Conf... |
# https://github.com/andy-gh/prettyjson/blob/master/prettyjson.py
def prettyjson(obj, indent=2, maxlinelength=80):
"""Renders JSON content with indentation and line splits/concatenations to fit maxlinelength.
Only dicts, lists and basic types are supported"""
items, _ = getsubitems(obj, itemkey="", islas... |
import os
print('python started')
print('hello nathaniel')
print("welcome")
print("hello world")
os.system("python node_free.py") |
#
# 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
# ... |
from kivymd.uix.screen import MDScreen
from kivy.uix.screenmanager import Screen
from kivy.storage.jsonstore import JsonStore
class LoginScreen(Screen):
"""
esta e uma tela de login
"""
dados = JsonStore('banco/auth.json')
def login(self):
cpf = self.ids.cpf.text
senha = self.ids.s... |
import itertools
from django.contrib.admin.utils import NestedObjects
from django.db import router
def related_objects(obj):
collector = NestedObjects(using=router.db_for_write(obj))
collector.collect([obj])
def flatten(elem):
if isinstance(elem, list):
return itertools.chain.from_it... |
from typing import TYPE_CHECKING, Iterable, Optional
from ..core.taxes import quantize_price
from ..discount import DiscountInfo
from ..plugins.manager import get_plugins_manager
if TYPE_CHECKING:
from prices import TaxedMoney
from .models import Checkout, CheckoutLine
def checkout_shipping_price(
*,
... |
import logging
import os
import datetime as dt
class Easylog:
"""Fast and easy logging with Easylog
The `Easylog` is a class designed to make logging a lot easier and faster
by targeting the most common types of logging (console, file) and setting
them up with usable default settings. `Easylog` is es... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class FullyConnectedBlock(nn.Module):
def __init__(self, width, BN=False):
super(FullyConnectedBlock, self).__init__()
self.BN = BN
self.linear = nn.Linear(width, width, bias = not self.BN... |
"""
Created by Epic at 12/31/20
"""
|
# Tool Imports
from bph.tools.windows.resourcehacker import BphResourceHacker as ResourceHacker
# Core Imports
from bph.core.server.template import BphTemplateServer as TemplateServer
from bph.core.session import BphSession as Session
from bph.core.sample import BphLabFile as LabFile
session = Session(project_name='b... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.messaging, name='messaging'),
url(r'^send/$', views.send, name='send_message'),
]
|
#!/usr/bin/env python3
# Copyright (c) 2019 The DogeCash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Covers the scenario of a zPoS block where the coinstake input is a zerocoin spend
of an already spent coin.
''... |
import unittest
import sys
import random
sys.path.insert(0,"..")
import deck as d
class MyTest(unittest.TestCase):
def setUp(self):
pass
#Checks to see if two cards are shuffled by making sure they are not the exact same at least once out of 30 tries
def test_Two_Cards(self):
deck = ["A", "B... |
import os
import sys
# All supported rounding modes
round_nearest = intern('n')
round_floor = intern('f')
round_ceiling = intern('c')
round_up = intern('u')
round_down = intern('d')
round_fast = round_down
def prec_to_dps(n):
"""Return number of accurate decimals that can be represented
with a precision of n... |
"""Relationships between models.
These are DATABASE relationships. They create new tables in the database,
include columns which are foreign keys, and might include unique constraints
resulting from a combination of multiple foreign keys. For instance, there
cannot be duplicates for a pair of [character - voice actor]... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... |
try:
import numpy as np
except ImportError:
np = None
from tests.numpy.testcase import NumpyBaseTestCase
class StringTestCase(NumpyBaseTestCase):
def test_string(self):
with self.create_table('a String'):
data = [np.array(['a', 'b', 'c'])]
self.client.execute(
... |
#!/bin/python
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import json
import logging
import os
import re
import boto3 # pylint: disable=import-error
logger = logging.getLogger('Main')
logger.setLevel(logging.DEBUG)
logger.propagate = False
eb = None
d... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... |
import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import uwallet
from uwallet.bitcoin import TYPE_ADDRESS
from uwallet import WalletStorage, Wallet
from uwallet_gui.kivy.i18n import _
from uwallet.contacts import Contacts
from uwallet.paymentreques... |
"""Example program to show how to read a multi-channel time series from LSL."""
import time
from pylsl import StreamInlet, resolve_stream
from time import sleep
# first resolve an EEG stream on the lab network
print("looking for an EEG stream...")
streams = resolve_stream('type', 'EEG')
# create a new inlet to read f... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with the Amazon Kinesis API to
generate a data stream. This script generates data for the _Detecting Hotspots on
a Stream_ example in the Amazon Kinesi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
# You need to finish implementing triangle() in the file 'triangle.py'
from .triangle import *
class AboutTriangleProject2(Koan):
# The first assignment did not talk about how to handle errors.
# Let's handle that part now.
def test_... |
# coding: utf-8
import pprint
import six
from enum import Enum
class AbstractSubscriptionProductActive:
swagger_types = {
'allowed_payment_method_configurations': 'list[int]',
'failed_payment_suspension_period': 'str',
'name': 'str',
'sort_order': 'int',
'state': 'Su... |
import subprocess
import os
class ConvertFile:
def __init__(self, fin: str, fout: str=None) -> None:
self.fin = fin
self.fout = fout
self.error = str()
self.success = str()
self.mime = None # type: str
self.no_access_mimes = {"application/zip": ".txt",
... |
#################
#@zhai fengyun -->Yanshan University
#################
# model_node = ['Conv/Relu6:0', 'SeparableConv2d/Relu6:0', 'Conv_1/Conv2D:0', 'Conv_2/Relu6:0',
# 'SeparableConv2d_1/Relu6:0', 'Conv_3/Conv2D:0', 'Conv_4/Relu6:0', 'SeparableConv2d_2/Relu6:0',
# 'Conv_5/Conv2... |
from typing import List
from dungeon import DungeonProblem, Direction, DungeonState, DungeonTile
from agents import HumanAgent, UninformedSearchAgent, InformedSearchAgent
from helpers.utils import fetch_tracked_call_count
from helpers.heuristic_checks import test_heuristic_consistency
from functools import lru_cache
im... |
# -*- coding: utf-8 -*-
#
# argparse documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 20 14:03:24 2015.
#
# 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.
#
# ... |
import numpy
from scipy import optimize
import math
import time
locations = [numpy.array([0,0,0]), numpy.array([0,3.91,2.7]), numpy.array([3.40,3.91,0]), numpy.array([3.40,0,2.7])]
CENTER_DIST = 5.84278
CENTER_POINT = numpy.array([1.7,1.955, 1.35])
#Helper Functions
def rssiToMeter(rssi, txPower =-71.25):
rati... |
# Solution 1
# O(wh) time / O(wh) space
# w - width of the matrix
# h - height of the matrix
def removeIslands(matrix):
onesConnectedToBorder = [[False for col in matrix[0]] for row in matrix]
# Find all the 1s that are not islands
for row in range(len(matrix)):
for col in range(len(matrix[row])):... |
# pylint: disable=too-many-lines
from unittest.mock import Mock, patch
from app.data_models.answer_store import Answer, AnswerStore
from app.data_models.list_store import ListStore
from app.questionnaire.location import Location
from app.questionnaire.questionnaire_schema import QuestionnaireSchema
from app.questionna... |
#tiklanan noktanin rengini ayri bir ekranda gosterir
import cv2
import numpy as np
def click_event(event, x, y, flags, param) :
if event == cv2.EVENT_LBUTTONDOWN :
red = img[y,x,2]
green = img[y,x,1]
blue = img[y,x,0]
colorImage = np.zeros((100,100,3),np.uint8)
colorImage[:... |
AI_TYPE_TO_ROLE = {"redis_ycsb": ("ycsb", "redis"), "hadoop": ("hadoopmaster", "hadoopslave"),
"linpack": ("linpack",), "wrk": ("wrk", "apache"), "filebench": ("filebench",),
"sysbench": ("sysbench", "mysql"),
#"unixbench": ("unixbench",), "netperf": ("netclient"... |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A library to assist automatically downloading files.
This library is used by scripts that download tarballs, zipfiles, etc. a... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#! /usr/bin/env python
import numpy
import random
import copy
from itertools import permutations
class graph:
'''A graph data structure.
The data structure consists of a dictionary for which each element is a
node. Each node stores a dictionary of all other nodes to which the node
is connected along wit... |
import json
from typing import Any, Dict, Optional, cast
from django.db.models import Prefetch, QuerySet
from rest_framework import authentication, exceptions, request, serializers, status, viewsets
from rest_framework.decorators import action
from rest_framework.permissions import IsAuthenticated
from rest_framework.... |
"""The Satellite class."""
from sgp4.earth_gravity import wgs72old, wgs72, wgs84
from sgp4.ext import days2mdhms, jday
from sgp4.functions import jday as jday2
from sgp4.io import twoline2rv
from sgp4.propagation import sgp4, sgp4init
WGS72OLD = 0
WGS72 = 1
WGS84 = 2
gravity_constants = wgs72old, wgs72, wgs84 # inde... |
"""
WSGI config for ImagesDB 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/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.