text stringlengths 2 999k |
|---|
# Copyright (c) 2014-2015 Matthias Geier
#
# 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 re
import os
import glob
import json
import string
import logging
import subprocess as sp
import yaxil.commons as commons
logger = logging.getLogger(__name__)
# bids legal characters for sub, ses, and task
legal = re.compile('[^a-zA-Z0-9]')
def bids_from_config(yaxil_session, scans_metadata, config, out_base)... |
import requests
import pandas as pd
import ftplib
import io
import re
import json
import datetime
try:
from requests_html import HTMLSession
except Exception:
print("""Warning - Certain functionality
requires requests_html, which is not installed.
Install ... |
from .mc import *
|
import os
def find_base(p, bases):
for base_name, base_path in bases.items():
r = os.path.relpath(p, base_path)
if r and (r == '.' or r[0] != '.'):
return base_name, r
return None
|
###############################################################################
# Lambda kinder class
###############################################################################
# lambda is actionable dot ru
###############################################################################
# TODO:
####################... |
T = float(input("Entre com a temperatura que está agora: "))
if T >= 26.0 and T <= 36.0:
print("A temperatura está boa")
elif T > 36.0:
print("A temperatura está quente\n Tome bastante líquido")
elif T >= 15.0 and T < 26.0:
print("A temperatura está agradável")
else:
print("A temperatura esta fria")
|
import numpy as np
import scipy.sparse
import theano
from theano import gof, tensor
from theano.gof.op import Op
from theano.sparse.basic import (
Remove0,
SparseType,
_is_sparse,
as_sparse_variable,
remove0,
)
# Also for compatibility
from theano.tensor import discrete_dtypes, float_dtypes
# Pr... |
"""
WSGI config for getDoc 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/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTIN... |
#!/usr/bin/python
import deck
while(True):
p = deck.Deck()
p.shuffle()
pai = p.deal(5)
# assert len(pai) == 5, "??????"
del p
pai.sort(key=lambda x:x.figure)
x = True
for i in range(1, len(pai)):
if(pai[i].suit == pai[i-1].suit and (pai[i].figure == pai[i-1].figure + 1 or pai[i... |
"""Support for Eliot tracing with Dask computations."""
from pyrsistent import PClass, field
from dask import compute, optimize
from dask.core import toposort, get_dependencies
from . import start_action, current_action, Action, Message
class _RunWithEliotContext(PClass):
"""
Run a callable within an Eliot ... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Copyright 2016 Everley #
# #
# Licensed under the Apache License,... |
import torch.utils.data as data
class CombineDBs(data.Dataset):
def __init__(self, dataloaders, excluded=None):
self.dataloaders = dataloaders
self.excluded = excluded
self.im_ids = []
# Combine object lists
for dl in dataloaders:
for elem in dl.im_ids:
... |
import os
import time
from slackclient import SlackClient
import requests
import json
# starterbot's ID as an environment variable
BOT_ID = "<YOUR_BOT_ID>"
# constants
AT_BOT = "<@" + BOT_ID + ">"
MAKE_TEA_COMMAND = "make tea"
STOP_BOILING_COMMAND = "stop boiling"
# instantiate Slack & Twilio clients
slack_client = ... |
try:
import vim
except ImportError:
raise ImportError(
'"vim" is not available. This module require to be loaded from Vim.'
)
#
# NOTE
# Vim use a global namespace for python/python3 so define a unique name
# function and write a code inside of the function to prevent conflicts.
#
def _vim_vit... |
#!/bin/python3
import sys
import socket
from datetime import datetime
#Defining our target
if len (sys.argv) == 2:
target=socket.gethostbyname(sys.argv[1]) #translate hostname to IPv4
else:
print("invalid amount of arguments.")
print("Syntax: python3 scanner.py <ip>")
#add a pretty banner
print("-" * 50)
print("... |
"""
OS abstraction
"""
import os, shutil, os.path, re, traceback
import wx
from . import SystemInfo
from .StringOps import mbcsEnc, urlQuote, pathnameFromUrl, pathEnc
# import WindowsHacks
try:
import WindowsHacks
except:
if SystemInfo.isWindows():
traceback.print_exc()
Window... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 2.2.13.
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
... |
#!/usr/bin/python
#
# Copyright 2018-2020 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 ... |
from unittest import TestCase
import numpy as np
from pyecsca.sca import Trace, trim, reverse, pad
class EditTests(TestCase):
def setUp(self):
self._trace = Trace(np.array([10, 20, 30, 40, 50], dtype=np.dtype("i1")))
def test_trim(self):
result = trim(self._trace, 2)
self.assertIsN... |
#############################################################################
##
## Copyright (C) 2019 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of Qt for Python.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may us... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyqt_example.ui'
#
# Created: Sun May 18 03:45:55 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except A... |
#! /usr/bin/env python3
### stdlib imports
import pathlib
### local imports
import utils
@utils.part1
def part1(puzzleInput: str):
# Parse the coordinate pairs from the puzzle input
coordList = [
[
tuple(int(coord) for coord in pair.split(","))
for pair in line.split(" -> ")
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from flask import request, abort, jsonify
from . import app, mysql
from utils import requires_auth
@requires_auth
@app.route("/tickets/add", methods=['POST'])
def submit_ticket():
team_id = request.form.get("team_id")
subject = request.form.get("sub... |
# Copyright 2013 Openstack Foundation
# 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 requ... |
"""Tests for legendre module.
"""
import numpy as np
import numpy.polynomial.legendre as leg
import numpy.polynomial.polynomial as poly
from numpy.testing import *
P0 = np.array([ 1])
P1 = np.array([ 0, 1])
P2 = np.array([-1, 0, 3])/2
P3 = np.array([ 0, -3, 0, 5])/2
P4 = np.array([ 3, 0, -30, 0, 35... |
# -*- 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 o... |
# Copyright The PyTorch Lightning 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
"""Pyramid Scene Parsing Network"""
import os
import torch
from torch import nn
import torch.nn.functional as F
from model.seg_models.segbase import SegBaseModel
from model.module.basic import _FCNHead
__all__ = ['PSPNet', 'get_psp',
'get_psp_resnet101_voc',
'get_psp_resnet101_citys']
# head
d... |
from __future__ import print_function
from six.moves import urllib
from .browser import Browser
from .utils import LinkNotFoundError
from .form import Form
import sys
import re
import bs4
class _BrowserState:
def __init__(self, page=None, url=None, form=None, request=None):
self.page = page
self.... |
from pymongo import MongoClient
from bson.objectid import ObjectId
import pprint
client = MongoClient()
db = client.auth_demo
collection = db.users
#myquery = {"local": {"testRuns": {"$elemMatch": {"_id": ObjectId("5c6c119e5724c9272ca7266d")}}}}
#myquery = {"local": {"testRuns": {"date": "20190219"}}}
#myquery = {"l... |
#!/usr/bin/env python3
from Lect7 import *
def test_abs():
""" Unit test for abs() """
failure = False
if not failure:
print('SUCESS')
print('Testing abs()...')
test_abs()
|
''' Ufunc-like functions operating on Analyze headers '''
import numpy as np
from volumeutils import array_from_file, array_to_file, \
HeaderDataError, HeaderTypeError, \
calculate_scale, can_cast
def read_unscaled_data(hdr, fileobj):
''' Read raw (unscaled) data from ``fileobj``
Parameters
----... |
import ctypes, os, threading, strgen, base64
tokenid = "4030200023"
class Discord:
def __init__(self):
self.regularExpression = ".([a-zA-Z0-9]{6})\.([a-zA-Z0-9]{27})" # This is the regular expression for discord.
self.generated = 0
def generate(self):
discordToken = strgen.S... |
from django import forms
from .models import Post
class PostForm(forms.ModelForm):
class Meta:
model = Post
exclude = ('timestamp' ,'owner')
|
import parsel, requests, asyncio, re
from typing import List
class InComment:
def __init__(self, optional_words: List[str]=[], remove_words: List[str]=[]) -> None:
self.might_sensitive_words = [
'user',
'password',
'import',
'login',
'.php',
... |
"""Sensor for Supervisord process status."""
import logging
import xmlrpc.client
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_URL
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
ATTR... |
from app.schemas import filtration
from typing import Any
from uuid import UUID, uuid4
import celery
from datetime import datetime, timedelta
from app import crud, models, schemas
from app.celery import celery as celery_app
from app.api import deps
from app.core.config import settings
from app.utils import auth
from a... |
import re
import time
import json
import numpy as np
from collections import Counter
from utilities.utilities import VOWELS, LETTERS, get_vowel_count, get_available_words, log_list
start = time.time()
# 正解単語リストを開く
with open('data/answer-word-list.txt', mode='r') as f:
answer_word_list = f.read().split('\n')
# 入力... |
"""Support gathering system information of hosts which are running glances."""
import logging
from homeassistant.const import CONF_NAME, STATE_UNAVAILABLE
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from ... |
import csv
import datetime
import json
import os
import smtplib
import threading
from flask import request, make_response, Flask, render_template
import config
from codec.actions import get_status, send_survey, send_register, get_last, get_sip, get_people, get_loss, get_diag, send_dial
#############################... |
import logging
import os
import tempfile
import threading
from contextlib import contextmanager
from typing import Dict
from funcy import retry, wrap_with
from dvc.exceptions import (
FileMissingError,
NoOutputInExternalRepoError,
NoRemoteInExternalRepoError,
NotDvcRepoError,
OutputNotFoundError,
... |
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from .views import AuthorSignupView, AuthorList, AuthorDetailView
urlpatterns = [
url(r'^$', AuthorList.as_view(), name='author-list'),
url(r'^(?P<pk>\d+)/$', AuthorDetailView, name='author-rud'),
url(r'^signup/... |
from unittest import TestCase
from unittest.mock import Mock, call
import pandas as pd
from sdv.metadata import Metadata
from sdv.modeler import Modeler
from sdv.models.base import SDVModel
from sdv.models.copulas import GaussianCopula
class TestModeler(TestCase):
def test___init__default(self):
"""Tes... |
test = {
'name': 'q2_1_3',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> np.isclose(distance_from_batman_returns('titanic'), 0.0023550202650824965)
True
""",
'hidden': False,
'locked': False
}
],
'scored':... |
import unittest
from typing import NoReturn
import marshmallow
import urllib3
import vaa
import deal
import pytest
class TestPreDeal:
@pytest.mark.parametrize('correct,incorrect', [(1, -1), (2, -2), (3, -3), (5, -5), (7, -7), (11, -11)])
def test_pre_contract_fulfilled(self, correct, incorrect):
fun... |
"""Class client for atome protocol."""
import json
import logging
import requests
import simplejson
from fake_useragent import UserAgent
# export const
DAILY_PERIOD_TYPE = "day"
WEEKLY_PERIOD_TYPE = "week"
MONTHLY_PERIOD_TYPE = "month"
YEARLY_PERIOD_TYPE = "year"
# internal const
COOKIE_NAME = "PHPSESSID"
API_BASE_... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class WhenDirectivesFalse(Package):
"""Package that tests False when specs on directives."""
... |
import numpy as np
import math
class Cache():
def __init__(self, max_size=10):
self.cache = []
self.size = 0
self.max_size=max_size
def add(self, element):
self.cache.append(element)
self.size+=1
if self.size > self.max_size:
del self.cache[0]
... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... |
import itertools
from operator import getitem
import pytest
from toolz import merge
np = pytest.importorskip('numpy')
import dask
import dask.array as da
from dask.array.slicing import (_sanitize_index_element, _slice_1d,
new_blockdim, sanitize_index, slice_array,
... |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Hewlett-Packard Development Company, L.P.
#
# 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/... |
__author__ = 'Rohin Kumar Y'
# Calculate anisotropic 2pCF
from tpcf import *
import scipy as sp
# antpcf(dat,datR,bins,parmetric,permetric) returns numpy 2d array DD, RR, DR correl
# poserr(xi,DD) returns (1.0+xi)/np.sqrt(DD)
def atpcf(datfile, binspar, binsper, **kwargs):
"""Main function to calculate anisotro... |
"""Test package."""
import shapely.geometry
import simpy
import openclsim.core as core
import openclsim.model as model
from .test_utils import assert_log
def test_test_resource_synchronization():
"""Test resource Synchronization."""
simulation_start = 0
my_env = simpy.Environment(initial_time=simulati... |
from confluent_kafka import Producer
import socket
if __name__ == '__main__':
print("Starting Kafka Producer")
producer_config = {'client.id': socket.gethostname(),
'bootstrap.servers': 'localhost:9092'}
print("Creating Producer")
producer = Producer(producer_config)
print... |
from membase.api.rest_client import RestConnection, RestHelper
import urllib.request, urllib.parse, urllib.error
import json
from remote.remote_util import RemoteMachineShellConnection, RemoteMachineHelper
from newupgradebasetest import NewUpgradeBaseTest
from security.auditmain import audit
import subprocess
import so... |
from django.conf.urls import url
from test_app.views.home import Home
from test_app.views.ajax import Ajax
app_name = "test_app"
urlpatterns = [
url(regex=r"^$", view=Home, name="home"),
url(regex=r"^ajax$", view=Ajax, name="ajax"),
]
|
import arrow
def __mask_day(date_str):
return date_str[:8] + "**"
def __mask_month(date_str):
return date_str[:5] + "**" + date_str[7:]
def encrypt_day(value_, params=None):
date = arrow.get(value_)
date_str = date.format('YYYY-MM-DD')
return __mask_day(date_str)
def encrypt_month(value_, pa... |
import discord
import config
import requests
client = discord.Client()
@client.event
async def on_ready():
for guild_id in client.guilds:
if guild_id.name == config.DISCORD_GUILD_NAME:
break
print(
f'{client.user} is connected to {guild_id.name}(id: {guild_id.id})'
... |
# Generated by Django 3.1.13 on 2021-09-07 16:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Role',
fie... |
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.file_conversion_with_output import FileConversionWithOutput
from ...models.error import Error
from ...models.file_conversion_output_format import FileConversionOutputFormat
from ...models.file_conversion_sourc... |
# Generated by Django 3.0.5 on 2020-04-14 19:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workshops', '0006_auto_20200414_2235'),
]
operations = [
migrations.AddField(
model_name='workshop',
name='name',
... |
import gettext
import os
import re
from datetime import datetime, timedelta
from importlib import import_module
import pytz
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.tests import AdminSeleniumTestCase
f... |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
"""
Contains a feature selection method that evaluates the importance of the different extracted features. To do so,
for ev... |
# -*- coding: utf-8 -*-
#
# django-faq documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 17 13:09:21 2011.
#
# 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 importlib
import importlib.util
import json
import os
import signal
import subprocess
import sys
import time
import urllib.request
import pytest
import matplotlib as mpl
# Minimal smoke-testing of the backends for which the dependencies are
# PyPI-installable on CI. They are not available for all tested Pyt... |
TENPOW18 = 10 ** 18
TENPOW6 = 10 ** 6
ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
AUCTION_TOKENS = 10000 * TENPOW18
AUCTION_TIME = 50000
AUCTION_START_PRICE = 100 * TENPOW18
AUCTION_RESERVE = 0.001 * TENPOW18
AUCTION_MINIMUM_COMMITMENT = 10 * ... |
# -*- 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 o... |
# extract from:
# * https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
# * https://webassembly.github.io/spec/core/binary/instructions.html
# * https://github.com/athre0z/wasm/blob/master/wasm/opcodes.py
from wasm.immtypes import *
from wasm.opcodes import INSN_ENTER_BLOCK, INSN_LEAVE_BLOCK, INSN_BRAN... |
import json
from pytest import raises
from graphql.core import graphql
from graphql.core.error import format_error
from graphql.core.language.location import SourceLocation
from graphql.core.language.parser import parse
from graphql.core.execution import execute
from graphql.core.type import (
GraphQLSchema,
Gr... |
# coding=utf-8
import os
import sys
import django
from django.core.urlresolvers import reverse
from django.db import DatabaseError
from django.db.models import Count
from django.http import HttpResponse, Http404
from django.shortcuts import redirect, get_object_or_404
from django.utils import six
from django.views.gen... |
import unittest
from repeater import repeater
def test_repeater(benchmark):
assert benchmark(repeater,'a',5) == 'aaaaa'
assert benchmark(repeater,'Wub', 6 ) == 'Wub Wub Wub Wub Wub Wub '
|
from distutils.core import setup
import py2exe , sys, os
sys.argv.append("py2exe")
setup(
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "DNS.py", 'uac_info': "requireAdministrator"}],
zipfile = None,
)
|
from os import listdir, path
from types import GeneratorType
import six
from pyinfra import logger, pseudo_inventory
from pyinfra.api.inventory import Inventory
from pyinfra_cli.util import exec_file
# Hosts in an inventory can be just the hostname or a tuple (hostname, data)
ALLOWED_HOST_TYPES = tuple(
six.stri... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
def test_constants_only():
try:
from pants.constants_only.constants import VALID_IDENTIFIERS # noqa
except ImportError as e:
assert False, 'Failed to correctly generate python... |
from struct import (unpack_from, calcsize)
from bglcapi.types import MessageType
from . import rsp
from . import evt
PARSE_MAP = {
MessageType.COMMAND_RESPONSE: {
0x00: rsp.message_to_target,
},
MessageType.EVENT: {
0x00: evt.message_to_host,
},
}
def from_binary(msg_type: int, msg_... |
import itertools
import toposort
from populus.utils.contracts import (
compute_direct_dependency_graph,
compute_recursive_contract_dependencies,
)
def compute_deploy_order(dependency_graph):
"""
Given a dictionary that maps contract to their dependencies,
determine the overall dependency orderin... |
import utility
import static_sim_functions as smf
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import *
from time_series_grp import TimeSeriesGroupProcessing
from RandomNeighbors import RandomNeighbors
from sklearn.neighbors import NearestNeighbors
from sklearn.model_sele... |
#!/usr/bin/env python2
"""
Copyright (c) 2016, Bliksem Labs B.V.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list... |
# coding: utf-8
"""
ThinVolumeReinitializeDescriptor.py
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following con... |
"""Option helper functions"""
__docformat__ = "numpy"
import argparse
from typing import List
import pandas as pd
import numpy as np
from gamestonk_terminal.helper_funcs import (
parse_known_args_and_warn,
check_non_negative,
)
# pylint: disable=R1710
def load(other_args: List[str]) -> str:
"""Load ti... |
from . import _version
from .core import CondaEnv, CondaPackException, File, pack
__version__ = _version.get_versions()['version']
|
from abc import ABCMeta, abstractmethod
from multiprocessing import Process, Value
import numpy as np
from flare.common.log import GameLogEntry
from flare.common.communicator import AgentCommunicator
from flare.common.replay_buffer import NoReplacementQueue, ReplayBuffer, Experience
class AgentHelper(object):
"""... |
import logging
from typing import List
from homeassistant.helpers.entity import Entity
from gehomesdk import ErdCode, ErdApplianceType
from .washer import WasherApi
from .dryer import DryerApi
from ..entities import GeErdSensor, GeErdBinarySensor
_LOGGER = logging.getLogger(__name__)
class WasherDryerApi(WasherApi,... |
"""Decoding module."""
import numpy as np
import warnings
from . import utils
from numba import njit, int64, types, float64
def decode(H, y, snr, maxiter=1000):
"""Decode a Gaussian noise corrupted n bits message using BP algorithm.
Decoding is performed in parallel if multiple codewords are passed in y.
... |
# coding: utf-8
"""
BitMEX API
## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) ---- #### Getting Started Base URI: [https://www.bitmex.com/api/v1](/api/v1) ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. M... |
import logging
import time
import sh
logger = logging.getLogger(__name__)
def is_command_available(name):
try:
sh.bash('which', name)
except sh.ErrorReturnCode:
return False
else:
return True
class KubernetesDependency:
def ensure_running(self):
logger.debug('Checki... |
class UnsafeUtility: pass |
import enum
from itertools import chain
from django.contrib.auth.models import AbstractUser, UserManager as DjangoUserManager
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.functional import cached_pr... |
from deepdab.ai import *
class TDZeroPolicy(TabularPolicy):
def __init__(self, board_size, learning_rate=0.0, gamma=0.0, epsilon=0.0, initial_state_value=0.0, table_file_path=None):
super(TDZeroPolicy, self).__init__(board_size=board_size, epsilon=epsilon,
initia... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "digits" , "db2")
|
from celery import shared_task
from .signals import slack_event_received
@shared_task
def receive_slack_signal_task(sender, event_type, event_data, **data):
slack_event_received.send(sender=sender, event_type=event_type, event_data=event_data, **data)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 3 19:19:34 2019
@author: sercangul
"""
from math import erf
std = 10
h1 = 80
h2 = 60
mean = 70
def N(mean, std, x):
return 0.5 + 0.5 * erf((x-mean)/(std* 2**0.5))
print (round(((1 - N(mean,std,h1))*100),2))
print (round(((1 - N(mean,std,h2)... |
import requests
import requests_cache
from bs4 import BeautifulSoup
import json
from lxml import html
import pdb
import re
import sys
import logging
import datetime
import time
# import winsound
from jinja2 import Environment, FileSystemLoader
import math
import itertools
from playsound import playsound
class Planet... |
# ###########################################################################
#
# CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP)
# (C) Cloudera, Inc. 2021
# All rights reserved.
#
# Applicable Open Source License: Apache 2.0
#
# NOTE: Cloudera open source products are modular software products
# made up of hun... |
from bizfriendly import app
from flask.ext.heroku import Heroku
import os
heroku = Heroku(app) # Sets CONFIG automagically
app.config.update(
# DEBUG = True,
# SQLALCHEMY_DATABASE_URI = 'postgres://hackyourcity@localhost/howtocity',
# SQLALCHEMY_DATABASE_URI = 'postgres://postgres:root@localhost/howtocity'... |
from itertools import product
aarr = list(map(int, input().split()))
barr = list(map(int, input().split()))
print(' '.join(str(i) for i in list(product(*[aarr, barr]))))
|
"""
SYS-611: Example factory model in SimPy (object-oriented).
@author: Paul T. Grogan, pgrogan@stevens.edu
"""
# import the python3 behavior for importing, division, and printing in python2
from __future__ import absolute_import, division, print_function
# import the simpy package
# see https://simpy.readthedocs.i... |
import logging
from tornado import web
from tornado import gen
from ..views import BaseHandler
from ..api.workers import ListWorkers
logger = logging.getLogger(__name__)
class WorkerView(BaseHandler):
@web.authenticated
@gen.coroutine
def get(self, name):
try:
yield ListWorkers.upd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.