text stringlengths 1 927k |
|---|
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
Development script of the ChemEnv utility to get the equivalent indices of the model coordination environments
"""
__author__ = "David Waroquiers"
__copyr... |
# Copyright 2017 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... |
# Problem 16 Power Digit Sum
x = 2**1000
print(x)
value = str(2**1000)
totalling = []
for i in range(len(value)):
total = int(value[i])
totalling.append(total)
print(sum(totalling)) |
# Copyright 2014 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 law ... |
"""
Generalized Recommender models.
This module contains basic memory recommender interfaces used throughout
the whole scikit-crab package.
The interfaces are realized as abstract base classes (ie., some optional
functionality is provided in the interface itself, so that the interfaces
can be subclassed).
"""
# Aut... |
import abc
import datetime
from collections import OrderedDict
from typing import Any, Dict
import dateparser
from django.contrib.gis.geos import Point
from pytz import unicode
from rest_framework import status
from rest_framework.test import APITestCase
from care.facility.models import (
CATEGORY_CHOICES,
DI... |
import pdb
import numpy as np
import os
import glob
import torch
import torch.nn as nn
import torchvision.models as models
import torchvision.transforms as transforms
from torch.autograd import Variable
from PIL import Image
from tqdm import tqdm
relative_path = 'datasets/resnet_features_subset_office31/'
# relative_p... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
from namedlist import namedlist
import pytest
# fmt: off
@pytest.fixture(indirect=True)
def foo(request):
Foo = namedlist('Foo', (
('some_option', 42),
('another_option', 'test'),
))
return Foo(**request.param)
@pytest.fixture(indirect=True)
def bar(request):
Bar = namedlist('Bar',... |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
Copyright 2013 Rackspace
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
dist... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/kalyco/mfp_workspace/src/srslib_test/include".split(';') if "/home/kalyco/mfp_workspace/src/srslib_test/include" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_W... |
#!/usr/bin/env python
import os
import shutil
import sys
import subprocess
import cairo
def main():
version = '0.1.11'
script_location = sys.argv[0]
script_path = os.path.abspath(script_location)
app_path = os.sep.join(script_path.split(os.sep)[:-3])
src = os.path.join(app_path,'theory')
d... |
import operator
from typing import (
TYPE_CHECKING,
Any,
Callable,
)
from eth_typing import (
ChecksumAddress,
)
from eth_utils import (
is_dict,
is_hex,
is_string,
)
from eth_utils.curried import (
apply_formatter_if,
apply_formatters_to_dict,
)
from eth_utils.toolz import (
as... |
from .AbstractAnnotator import AbstractAnnotator
class WebAnnotator(AbstractAnnotator):
def annotate(self, unlab_index, unlabeled_x, unlabeled_y):
raise NotImplementedError() |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
from enum import Enum
from gi.repository import GLib
from zope.interface import implementer
import mxdc.devices.shutter
from mxdc import Device, Signal, Property
from mxdc.devices import misc
from mxdc.utils.log import get_module_logger
from .interfaces import ICryostat
logger = get_module_logger(__name__)
class C... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""
PrimitivePShape.
Using a PShape to display a custom polygon.
"""
def setup():
size(640, 360, P2D)
smooth()
# First create the shape.
global star
star = createShape()
star.beginShape()
# You can set fill and stroke.
star.fill(102)
star.stroke(255)
star.strokeWeight(2)
... |
"""Standard FAUCET pipeline."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... |
"""test_dataio.py - tests the dataio module
Chris R. Coughlin (TRI/Austin, Inc.)
"""
__author__ = 'Chris R. Coughlin'
import unittest
from models import dataio
from controllers import pathfinder
from utils.skiptest import skipIfModuleNotInstalled
import h5py
import numpy as np
import numpy.testing
import scipy.misc
... |
#!/usr/bin/python3
# part of https://github.com/WolfgangFahl/play-chess-with-a-webcam
from pcwawc.runningstats import RunningStats, ColorStats, MovingAverage
import pytest
from unittest import TestCase
class RunningStatsTest(TestCase):
def test_RunningStats(self):
rs = RunningStats()
rs.push(1... |
# -*- coding: utf-8 -*-
import py
try:
from jabberbot import capat
except ImportError:
py.test.skip("Skipping jabber bot tests - pyxmpp is not installed")
def test_ver_simple():
# example values supplied by the XEP
ident = (("client", "pc"), )
feat = ("http://jabber.org/protocol/disco#info",
... |
from django.db import models
class Place(models.Model):
title = models.CharField(max_length=150, verbose_name='Наименование')
description_short = models.TextField(blank=True, verbose_name='Краткое описание')
description_long = models.TextField(blank=True, verbose_name='Полное описание')
lng = models.D... |
import os
from pathlib import Path
import numpy as np
from PIL import Image
import requests
from google.cloud import storage
import base64
from io import BytesIO
import uuid
__all__ = ['do', 'recaptcha_check']
def predict_and2jpg(model, cap):
''' cap: "white hair yellow eyes", returns: jpeg file buffer remember t... |
# Copyright (C) 2018 Garth N. Wells
#
# SPDX-License-Identifier: MIT
import datetime
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.stationdata import build_station_list
def run():
"""Requirements for Task2D"""
# Build list of stations
stations = build_station_list()
# S... |
import os
import json
from flask import Flask, render_template
DATABASE_PATH = "../.contacts-store"
# Read database and build HTML string
file_names = os.listdir(DATABASE_PATH)
file_names.remove(".git")
html = "<table><th>Contact</th><th>Last Name</th><th>Tlf</th><th>Email</th><th>Job</th><th>Province</th>"
for file_... |
'''
* This Software is under the MIT License
* Refer to LICENSE or https://opensource.org/licenses/MIT for more information
* Written by Kohulan Rajan
* © 2019
'''
#Parallelized datareading network
import tensorflow as tf
import os
import sys
import numpy as np
import matplotlib as mpl
import csv
mpl.use('Agg')
im... |
# Copyright 2020 The TensorFlow Quantum 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... |
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... |
"""an observable configuration object for the JupyterLite lifecycle
.. todo::
Move to a canonical JSON schema?
"""
import os
from pathlib import Path
from typing import Optional as _Optional
from typing import Text as _Text
from typing import Tuple as _Tuple
from traitlets import CInt, Tuple, Unicode, default
f... |
# -*- coding: utf-8 -*-
import logging
import json
import inspect
import pytest
from mappyfile.parser import Parser
from mappyfile.pprint import PrettyPrinter
from mappyfile.transformer import MapfileToDict
def output(s):
"""
Parse, transform, and pretty print
the result
"""
p = Parser()
m = M... |
# This code is a part of XMM: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner (david.turner@sussex.ac.uk) 11/12/2020, 16:41. Copyright (c) David J Turner |
import pytest
import app
@pytest.fixture
def client():
app.app.config['TESTING'] = True
client = app.app.test_client()
yield client
def test_client_page(client):
rv = client.get('/')
# Main page (instructions)
assert b'<p class="lead">A Pusher-powered chat application built using Flask</p>' ... |
import pytest
from aries_cloudagent.core.protocol_registry import ProtocolRegistry
from aries_cloudagent.messaging.base_handler import HandlerException
from aries_cloudagent.messaging.request_context import RequestContext
from aries_cloudagent.messaging.responder import MockResponder
from ...handlers.query_handler im... |
# qubit number=4
# total number=49
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
from __future__ import print_function
import os
import sys
import shutil
from glob import glob
from setuptools import find_packages
from distutils.core import setup
# the name of the project
name = "purly"
# basic paths used to gather files
here = os.path.abspath(os.path.dirname(__file__))
root = os.path.join(here, ... |
"""
JavaScript encryption module ver. 2.0 by Daniel Rench
Based on existing code:
Copyright (c) 2003 by Andre Mueller.
Init of blowfish constants with a function (init/backup errors)
Copyright (c) 2003 by Rainer Wollmann
This Object is open source. You can redistribute it and/or modify
it under the terms of th... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\restaurants\restaurant_commands.py
# Compiled at: 2018-08-28 03:56:41
# Size of source mod 2**32: 29... |
from PyWebBrowserApp import PluginBase
from PyWebBrowserApp import register_plugin_op
class Plugin(PluginBase):
def __init__(self):
super(Plugin, self).__init__()
self.name = '${P}'
@register_plugin_op
def test_plugin_callback(self, op_data):
# self.info(op_data.get('message', ... |
#
# Copyright (C) 2014 Tommy Winther
# http://tommy.winther.nu
#
# Modified for FTV Guide (09/2014 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... |
"""
nm-theme setup
"""
import json
import sys
from pathlib import Path
import setuptools
HERE = Path(__file__).parent.resolve()
# Get the package info from package.json
pkg_json = json.loads((HERE / "package.json").read_bytes())
# The name of the project
name = "nm-theme"
lab_path = (HERE / pkg_json["jupyterlab"][... |
from __future__ import unicode_literals
"""
S3 bucket CRUD operations core module
"""
import logging
import time
import boto3
import botocore
from botocore.client import Config
class S3Client: # pragma: no cover
"""
S3 class encapsulates uploading,
downloading & other s3 file ops and handling errors
... |
# Stack 활용해서 풀기
N = int(input())
class Node(object):
def __init__(self, value=None, next=None):
self.value = value
self.next = next
class Stack(object):
def __init__(self):
self.head = None
self.count = 0
def is_empty(self):
return not bool(self.head)
def pus... |
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. 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 requir... |
from django.utils.translation import ugettext as _
from corehq.apps.locations.permissions import location_safe
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn, NumericColumn
from corehq.apps.reports.filters.select import MonthFilter, YearFilter
from corehq.apps.reports.standard import Mon... |
from gameinn import app
if __name__ == '__main__':
app.run() |
"""
****************** COPYRIGHT AND CONFIDENTIALITY INFORMATION ******************
Copyright (c) 2018 [Thomson Licensing]
All Rights Reserved
This program contains proprietary information which is a trade secret/business \
secret of [Thomson Licensing] and is protected, even if unpublished, under \
applicable Copyrigh... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.contactus, name= 'contactus')
] |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import collections
import json
from typing import Any, Dict, List, Tuple, Type
from hydra.expe... |
#
# Module implementing queues
#
# multiprocessing/queues.py
#
# Copyright (c) 2006-2008, R Oudkerk
# 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 ret... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
"""
Copyright 2017-2018 Jagoba Pérez-Gómez
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 ... |
"""
This module contains description of class for probability distributions
from location-scale family.
"""
from method_of_moments.continuous._base_continuous import BaseContinuous
class LocScale(BaseContinuous):
"""
Class for probability distributions from location-scale family.
Parameters
------... |
from brukerapi.jcampdx import JCAMPDX
import numpy as np
from pathlib import Path
import pytest
@pytest.mark.skip(reason="in progress")
def test_jcampdx(test_jcampdx_data):
j = JCAMPDX(Path(test_jcampdx_data[1]) / test_jcampdx_data[0]['path'])
for key, ref in test_jcampdx_data[0]['parameters'].items():
... |
#!/usr/bin/env python
# pylint: disable=R0903
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public L... |
from __future__ import division, print_function
import numpy as np
from openmdao.api import ExplicitComponent
class SectionPropertiesTube(ExplicitComponent):
"""
Compute geometric properties for a tube element.
The thicknesses are added to the interior of the element, so the
'radius' value is the oute... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from mav_manager/GoalTimedRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import genpy
class GoalTimedRequest(genpy.Message):
_md5sum = "3c9a1ea281c62219122f22a... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# Copyright (c) OpenMMLab. All rights reserved.
import math
from mmcv.parallel import is_module_wrapper
from mmcv.runner.hooks import HOOKS, Hook
class BaseEMAHook(Hook):
"""Exponential Moving Average Hook.
Use Exponential Moving Average on all parameters of model in training
process. All parameters hav... |
import os
import csv
filepath = os.path.join('..','**PyBank**','Resources','budget_data.csv')
output_path = os.path.join('..','**PyBank**','financial_analysis.txt')
total_months = 0
total_net = 0
net_change_list = []
month_of_change = []
greatest_increase = ["", 0]
greatest_decrease = ["", 9999999999999]
with open (... |
# Copyright (c) 2020-2021, 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 agre... |
# -*- coding: utf-8 -*-
# system imports
import sys
try:
from importlib.metadata import metadata
except ImportError:
# Backwards compatibility Python 3.7 and lower
from importlib_metadata import metadata # type: ignore
_app_module = sys.modules["__main__"].__package__
_md = metadata(_app_module) # typ... |
from sqlalchemy.orm import sessionmaker
from models import Forecasts, db_connect, create_forecast_table
import logging
class PollenScraperPipeline(object):
def __init__(self):
engine = db_connect()
create_forecast_table(engine)
self.Session = sessionmaker(bind=engine)
def process_item... |
# Copyright 2018 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
# -*- coding: utf-8 -*-
# /'' |''\ | |
# \. | |../ | * |..
# / \/ T | \ / | | | \
# \.../\.| __ | \/ | | |../
# ###################/###############
# /
"""
ext_pylib
~~~~~~~~~
Extra python libraries for scaffolding server... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/4/6 10:55
# @Author : Yunhao Cao
# @File : train_set.py
import os
import re
import shutil
import tool
import config
__author__ = 'Yunhao Cao'
__all__ = [
'',
]
level_list = config.LV_LIST
classes = config.NUM_OF_LEVEL
validation_rate = config.... |
# -*- coding: utf-8; -*-
#
# Licensed to Crate (https://crate.io) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License");
# yo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.struct import HStruct
from hwt.hdl.types.union import HUnion
from hwtLib.types.ctypes import uint8_t, uint16_t, int8_t, uint32_t
from pyMathBitPrecise.bit_utils import mask
class UnionTC(unittest.Te... |
"""Define imports."""
from PIL import ImageFilter, ImageOps, ImageEnhance
def grayscale(image, name, temp_url):
"""Return an image with a contrast of grey."""
image.seek(0)
photo = ImageOps.grayscale(image)
photo.save(temp_url + "GRAYSCALE" + name)
return temp_url + "GRAYSCALE" + name
def smooth... |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
# URL pattern for the UserListView
url(
regex=r'^add/$',
view=views.AddPlan.as_view(),
name='add'
),
url(
regex=r'^manage/$',
view=views.ManagePlans.as_view(),
... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import inspect
import math
import struct
import types
from urllib.parse import urljoin
from urllib.request import pathname2url
from urllib import parse as urlparse
import numpy as np
from .extern.decorators import add_common_doc... |
'''Access World Bank API data
'''
import wbgapi as w
try:
import numpy as np
import pandas as pd
except ImportError:
np = None
pd = None
def fetch(series, economy='all', time='all', mrv=None, mrnev=None, skipBlanks=False, labels=False, skipAggs=False, numericTimeKeys=False, params={}, db=None, **dimen... |
import gym
from garage.baselines import LinearFeatureBaseline
from garage.experiment import run_experiment
from garage.tf.algos import TRPO
from garage.tf.envs import TfEnv
from garage.tf.policies import CategoricalMLPPolicy
# Need to wrap in a tf environment and force_reset to true
# see https://github.com/openai/rl... |
r, y, g = map(int, input().split())
n = int(input())
ans = 0
for _ in range(n):
k, t = map(int, input().split())
if k == 0:
ans += t
elif k == 1:
ans += t
elif k == 2:
ans = ans + t + r
elif k == 3:
pass
print(ans) |
import site
site.addsitedir('..')
import torch
from pytorch_probgraph import BernoulliLayer
from pytorch_probgraph import InteractionLinear
from pytorch_probgraph import HelmholtzMachine
from itertools import chain
from tqdm import tqdm
class Model_HM_RWS(torch.nn.Module):
def __init__(self):
super().__in... |
import threading
import numpy as np
import jesse.helpers as jh
from jesse.models.Candle import Candle
from jesse.models.CompletedTrade import CompletedTrade
from jesse.models.DailyBalance import DailyBalance
from jesse.models.Order import Order
from jesse.models.Orderbook import Orderbook
from jesse.models.Ticker imp... |
import copy
from typing import Optional
from vyper import ast as vy_ast
from vyper.ast.validation import validate_call_args
from vyper.exceptions import (
ExceptionList,
FunctionDeclarationException,
ImmutableViolation,
InvalidLiteral,
InvalidOperation,
InvalidType,
IteratorException,
N... |
# -*- 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... |
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'''
Script for processing SPI Data for use in CLUS Caribou Project
Mike Fowler
Spatial Data Analyst
June 2018
'''
#---------------------------------... |
from lxml import etree
from StringIO import StringIO
# lxml provides full XPath syntax unlike ElementTree's ElementPath
# https://www.w3.org/TR/xpath/
# http://lxml.de/xpathxslt.html
# http://lxml.de/api/lxml.etree._ElementTree-class.html#xpath
# http://www.ibm.com/developerworks/library/x-hiperfparse/
# http://infoh... |
# Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import os.path as osp
import tempfile
import mmcv
import pytest
from detection_tasks.extension.datasets.data_utils import (
CocoDataset,
LoadAnnotations,
find_label_by_name,
format_list_to_str,
get_anchor_boxes,
... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
from pyadlml.dataset._representations.raw import create_raw
from pyadlml.dataset._representations.changepoint import create_changepoint
from pyadlml.dataset.activities import check_activities
class Data():
def __init__(self, activities, devices, activity_list, device_list):
#assert check_activities(activit... |
#!/usr/bin/env python
# pyinotify.py - python interface to inotify
# Copyright (c) 2005-2011 Sebastien Martini <seb@dbzteam.org>
#
# 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 res... |
from .pydotted import pydot
__ALL__ = ["pydot"] |
from datetime import datetime, timedelta
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
STATE_UNAVAILABLE,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_PM25,
TEMP_CELSIUS,
ENERGY_KILO_WATT_HOUR,
... |
# -*- coding: utf-8
"""Tests for prompt generation."""
import unittest
import os
import nose.tools as nt
from IPython.testing import tools as tt, decorators as dec
from IPython.core.prompts import PromptManager, LazyEvaluate
from IPython.testing.globalipapp import get_ipython
from IPython.utils import py3compat
from... |
# 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 *
import sys
class Ginkgo(CMakePackage, CudaPackage):
"""High-performance linear algebra library f... |
from __future__ import annotations
import asyncio
import io
from cgi import FieldStorage, parse_header
from typing import Any, AnyStr, Awaitable, Callable, Generator, Optional
from urllib.parse import parse_qs
from werkzeug.datastructures import CombinedMultiDict, Headers, MultiDict
from .base import BaseRequestWebs... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import ujson
from pathlib import Path
from typing import Dict, Tuple, List, Set, Union, Optional, Any
from semantic_modeling.config import config
from semantic_modeling.data_io import get_data_tables, get_raw_data_tables, get_semantic_models, get_ontology, \
get_sampled_da... |
import csv
import requests
import socket
from bs4 import BeautifulSoup
import re
import json
def parse_artists():
artist_profiles = []
try:
url = 'http://wx.toronto.ca/inter/pmmd/streetart.nsf/artists?OpenView'
response = requests.get(url)
html = response.content
soup = Beautifu... |
def read_input():
with open("input.txt", "r") as file:
return [int(p[28:]) for p in file.read().splitlines()]
mod = lambda i,j: ((i-1) % j) + 1
def main():
pos = read_input()
s = [0,0]
for i in range(1,1000,3):
pos[(i-1)%2] += sum([mod(j,100) for j in range(i,i+3)])
pos[(i-1)%2... |
from sort.abstract_sort import Sort
class InsertionSort(Sort):
def __call__(self, array, left_bound=None, right_bound=None):
if left_bound is None:
left_bound = 0
if right_bound is None:
right_bound = len(array) - 1
for i in range(left_bound + 1, right_bound + 1):
... |
import numpy as np
from ray.rllib.utils import try_import_tree
from ray.rllib.utils.framework import try_import_torch
torch, _ = try_import_torch()
tree = try_import_tree()
def explained_variance(y, pred):
y_var = torch.var(y, dim=[0])
diff_var = torch.var(y - pred, dim=[0])
min_ = torch.Tensor([-1.0])
... |
import time
import logging
from .spotify_client import SpotifyPlaylistClient
from . import config
logger = logging.getLogger(name='spotify_tracker')
class SpotifyWatcherClient(SpotifyPlaylistClient):
def __init__(self):
self.playlist_id = config.get_config_value('watcher_playlist_id')
self.last... |
# Form implementation generated from reading ui file 'pyqtgraph/console/template.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")... |
import datetime
import pprint
import random
import time
from itertools import cycle
from phue import Bridge
from helper import colour_helper
class HueWrapper(object):
def __init__(self, bridge_ip='192.168.1.73', light_configs=None, profiles=None):
if not light_configs:
light_configs = [
... |
from __future__ import division
from openmdao.api import Group, ExplicitComponent, IndepVarComp, BalanceComp, ImplicitComponent
import openconcept.api as oc
from openconcept.analysis.atmospherics.compute_atmos_props import ComputeAtmosphericProperties
from openconcept.analysis.aerodynamics import Lift, StallSpeed
from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.