text stringlengths 2 999k |
|---|
# Copyright 2016-2021, Pulumi 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 t... |
# This script converts files from the HaloFinder
# into hdf5 readable files.
#It also computes the Sersic index of all structures
# Not all quantities are dumped, should be modified depending on what is needed
# and the version of the HaloFinder
import numpy as np
import pandas as pd
import yt.utilities.fortran_util... |
from .ReGeXRules import SMSRules, TRECRules, YoutubeRules, CENSUSRules, MITRRules, SPOUSERules |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Gui/main_window.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from Gui.commit_list_view import CommitListView
class Ui_MainWindow(Qt... |
from z3 import *
Tie, Shirt = Bools('Tie Shirt')
s = Solver()
s.add(Or(Tie, Shirt),
Or(Not(Tie), Shirt),
Or(Not(Tie), Not(Shirt)))
print(s.check())
print(s.model())
|
import re
def list_cite(tex):
r"""
List all citation keys in::
\cite{...}
\citet{...}
\citep{...}
"""
# extract keys from "cite"
def extract(s):
try:
return list(
re.split(r"([pt])?(\[.*\]\[.*\])?(\{[a-zA-Z0-9\,\-\ ]*\})", s)[3][1:-1].s... |
import electrum.crypto
import electrum.util
from electrum_gui.common.basic.functional.require import require
from electrum_gui.common.secret import exceptions
def encrypt_data(password: str, data: str) -> str:
require(bool(password))
return electrum.crypto.pw_encode(data, password, version=1)
def decrypt_da... |
import json
def get_conf():
with open('cyrkus.json', 'rb') as j:
return json.load(j)
|
import asyncio
import inspect
from typing import Callable
import discord
class ReactionMenu:
@classmethod
async def create(
cls,
ctx,
msg: discord.Message,
body: str,
options: dict[str, "ReactionMenuOption"],
):
obj = ReactionMenu(ctx, msg, body, options)
... |
def speed(distance, time):
"""
Вовращает скорость тела.
"""
return distance / time
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# imports - standard imports
from __future__ import unicode_literals
import re, copy, os, shutil
import json
# imports - third party imports
import six
from six import iteritems
# imports - module imports
import frapp... |
import logging
import tensorflow as tf
logging.config.fileConfig(fname='log.conf')
logger = logging.getLogger('dev')
def get_gan_losses_fn():
bce = tf.losses.BinaryCrossentropy(from_logits=True)
def d_loss_fn(r_logit, f_logit):
r_loss = bce(tf.ones_like(r_logit), r_logit)
f_loss = bce(tf.ze... |
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'subject_widget.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# 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.setObject... |
# Generated by Django 3.0.5 on 2020-05-29 19:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('vote', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='voter',
... |
# Copyright 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
#!/usr/bin/env python
# ===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... |
#You can write your own classification file to use the module
from attention.model import StructuredSelfAttention
from attention.train import train,get_activation_wts,evaluate
from utils.pretrained_glove_embeddings import load_glove_embeddings
from utils.data_loader import load_data_set
from visualization.attention_vis... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: sw=4:expandtab
#
# copyright 2014 Hrishikesh K B <hrishi.kb@gmail.com>
# Copyright 2008 Emanuele Rocca <ema@galliera.it>
# Copyright 2008 Marco De Benedetto <debe@galliera.it>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... |
import os
import sys
import bbauto.app
from alembic import context
from freenit.migration import run_migrations_offline, run_migrations_online
sys.path.append(os.getcwd())
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
|
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# NOTE: To be removed once (if) https://github.com/pytorch/pytorch/pull/37385 lands
from __future__ import annotations... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2018 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014-2015 Brett Cannon <brett@python.org>
# Copyright (c) 2015 Simu Toni <simutoni@gmail.com>
# Copyright (c) 2015 Pavel Roskin <proski@gnu.org>
# Copyright (c) 2015 Ionel Cristian Maries <contact@ionelmc.ro>
# Copyri... |
from .. import _Menu
from . import _layout_node_json
from nanome.util import Logs
import json
def parse_json(menu_json):
new_menu = _Menu._create()
assert(menu_json.read("is_menu", True))
new_menu._title = menu_json.read("title", new_menu._title)
new_menu._width = menu_json.read("width", new_menu._wid... |
# coding: utf-8
#
# Copyright (c) 2021 Target Brands, Inc. All rights reserved.
"""
Vela server
API for the Vela server # noqa: E501
OpenAPI spec version: 0.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... |
#!/usr/bin/env python
# Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
"""
.. module:: simulation_data
:platform: Unix, Windows
:synopsis: Data object for storing metadata and par... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
from project.hardware.hardware import Hardware
class HeavyHardware(Hardware):
def __init__(self, name, capacity, memory):
super().__init__(name, 'Heavy', int(capacity * 2), int(memory * 0.75))
|
import re
pattern= 'test'
string1= 'this is a test or another test2 test3'
string2= 'test is a failure'
string3= 'success=1 and failure != 23'
"""
Search for the first occurence of a pattern in a string
"""
m1= re.search(pattern, string1)
print "First position and occurence of the pattern in the string"
print m1.star... |
from qtpy.QtCore import QPoint, QRect, QSize, Qt
from qtpy.QtGui import QFontMetrics, QPainter, QTextLayout
from qtpy.QtWidgets import QFrame, QWidget
class MultilineElidedLabel(QFrame):
"""A multiline QLabel-like widget that elides the last line.
Behaves like a multiline QLabel, but will fill the available ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG),
# acting on behalf of its Max Planck Institute for Intelligent Systems and the
# Max Planck Institute for Biological Cybernetics. All rights reserved.
#
# Max-Planck-Gesellschaft zur Förderung der Wissens... |
# Prints a sample request packet
'''from response import response
code = '200'
sender_name = 'CLIENT'
domain = 'VaaanInfra.com'
port = '5060'
protocol = 'UDP'
receiver_name = 'SIP-SERVER'
receiver_network_name = 'SIP-Server'
seq_num = '1'
request_type = 'REGISTER'
call_id = 'somerandomcallid'
subject = 'SUBJECT'
cont... |
# -*- coding: utf-8 -*-
from os import getenv
from time import time as ttime
from pbt.core import Car
def _get_time():
precision = int(getenv('PBT_CAR_EXECTIME_PRECISION', 0))
now = ttime()
execs = now - float(getenv('PBT_CAR_EXECTIME_SECS', now))
if precision > 0:
subsecs = ".%s" % int((ex... |
import os
import sys
import argparse
import time
import multiprocessing
import threading
import platform
from fHDHR import fHDHR_VERSION, fHDHR_OBJ
import fHDHR.exceptions
import fHDHR.config
from fHDHR.http import fHDHR_HTTP_Server
from fHDHR.db import fHDHRdb
ERR_CODE = 1
ERR_CODE_NO_RESTART = 2
if sys.version_in... |
# --------------------------------------------------------
# mcan-vqa (Deep Modular Co-Attention Networks)
# Licensed under The MIT License [see LICENSE for details]
# Written by Yuhao Cui https://github.com/cuiyuhao1996
# --------------------------------------------------------
from core.data.load_data import DataSet... |
# Copyright 2018 Dustin Ingram
#
# 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, s... |
#!/usr/bin/env python
import argparse
import rospkg
import cv2
import numpy as np
from utils import Utils
import math
import sys
import os
from cameras import CamerasParams
from map import Map
from shelf import Shelf
from tsp import Tsp
#a Point of interest is a point in map with a shelf inside the store to which it... |
from mqttplotter import MQTTPlotter
from mqttclient import MQTTClient
from math import sin, cos, exp, pi
mqtt = MQTTClient("iot.eclipse.org")
mp = MQTTPlotter(mqtt)
SERIES = "sinusoid"
mp.new_series(SERIES, 'time', 'cos', 'sin', 'sin*cos')
def f1(t): return cos(2 * pi * t) * exp(-t)
def f2(t): return sin(2 * pi * t)... |
from setuptools import setup
setup(
setup_requires=['pbr'],
pbr=True
) |
#!/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 agilent33220a as agi
import numpy as np
import matplotlib.pyplot as plt
import arbitraryfunctions as af
instrument=agi.connect_device()
#t=np.linspace(-32768,32767)
#function=np.round(t/6553.6)
function=af.mati()
plt.plot(function)
plt.show()
print(len(function))
instrument.load_signal(function,"MAT... |
from __future__ import absolute_import
from contextlib import contextmanager
import zlib
import io
import logging
from socket import timeout as SocketTimeout
from socket import error as SocketError
try:
import brotli
except ImportError:
brotli = None
from ._collections import HTTPHeaderDict
from .exceptions i... |
#!/usr/bin/env python
'''
This module contains some common routines used by other samples.
'''
# Python 2/3 compatibility
from __future__ import print_function
import sys
PY3 = sys.version_info[0] == 3
if PY3:
from functools import reduce
import numpy as np
import cv2
# built-in modules
impor... |
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
import torch.nn as nn
from torch.testing._internal.common_fx2trt import AccTestCase
from parameterized import parameterized
class TestSplitConverter(AccTestCase):
@parameterized.expand(
[
("split_size", 3, 1),
("se... |
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
import re
from typing import List, Tuple, Union
def build_arg_parser() -> argparse.ArgumentParser:
"""Create and return argument parser."""
parser = argparse.ArgumentParser(add_help=False)... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
未验证:使用Python快速实现显示器关闭和锁住桌面
from: http://blog.csdn.net/caimouse/article/details/45840363
"""
# python 3.4 win7
from ctypes import *
from ctypes.wintypes import *
HWND_BROADCAST = 0xffff
WM_SYSCOMMAND = 0x0112
SC_MONITORPOWER = 0xF170
MonitorPowerOff = 2
SW_SHOW = 5
def... |
import os
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
class SugarbeetDataset(BaseDataset):
"""
This dataset class can load unaligned/unpaired datasets.
It requires two directories to host training images from doma... |
#!/usr/bin/env python3
# Copyright (c) 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 the RPC call related to the uptime command.
Test corresponds to code in rpc/server.cpp.
"""
import ti... |
"""Base and mixin classes for nearest neighbors"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Jol... |
# coding: utf-8
import pprint
import re
import six
class RemoveProjectPermissionFromAgencyRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... |
#!/usr/bin/env python3
import sense_energy
import requests
import re
import time
import config
import asyncio
from flask import Flask, Response
from threading import Thread
app = Flask(__name__)
runSenseLoop = False
def refreshSense(sense):
try:
sense.get_realtime()
except:
# assume we are l... |
import tkinter as tk
pad = 1
width = 12
class Entry(tk.Entry):
def __init__(self, master, **kwargs):
kwargs['width'] = 12
command = kwargs['command']
del(kwargs['command'])
if type(kwargs['textvariable']) is UfloatVar:
kwargs['justify'] = 'right'
else:
... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
# Copyright 2015 ARM Limited
#
# 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 writin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 18-11-19 下午7:05
# @Author : Vitan
# @File : MaoTuView.py
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions ... |
import pytest
from linked_list import Linked_list, Node
@pytest.fixture
def linked_list():
return Linked_list()
def test_one(linked_list):
"""Can successfully instantiate an empty linked list"""
assert linked_list
def test_two(linked_list):
"""Can properly insert into the linked list"""
expected... |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... |
import os
import numpy as np
import time
from collections import deque
import glob
import matplotlib.pyplot as plt
import torch
def ddpg(agent, env, n_episodes=1000, max_t=1000, scores_window=100, progress_every=2, save_every=60, folder=None):
brain_name = env.brain_names[0]
brain = env.brains[brain_name]
... |
#CYBER NAME BLACK-KILLER
#GITHUB: https://github.com/ShuBhamg0sain
#WHATAPP NO +919557777030
import os
CorrectUsername = "g0sain"
CorrectPassword = "sim"
loop = 'true'
while (loop == 'true'):
username = raw_input("\033[1;96m[#] \x1b[0;36m Enter Username\x1b[1;92m➤ ")
if (username == CorrectUsername):
pass... |
from django.contrib import admin
from .models import Game, Scene, Path
admin.site.register(Game)
admin.site.register(Scene)
admin.site.register(Path)
|
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
from contextlib import contextmanager
from dataclasses import dataclass
from os import environ
from pathlib import Path... |
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.structure.io.pdb"
__author__ = "Patrick Kunzmann, Daniel Bauer"
__all__ = ["PDBFile"]
import warnings
import numpy as np
from ...atoms import A... |
"""
Utility functions for capa.
"""
import logging
import re
from cmath import isinf, isnan
from decimal import Decimal
import bleach
import six
from calc import evaluator
from lxml import etree
from openedx.core.djangolib.markup import HTML
#------------------------------------------------------------------------... |
import asyncio
import random
from typing import Iterable, List, Union
import yddg.api_tasks as api_tasks
import yddg.constants as const
import yddg.custom_types as T
async def flush(queue: Union[T.YDiskPathQueue, T.ItemQueue],
by_none: bool = False) -> None:
if by_none:
while await queue.... |
# 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... |
# -*- coding: utf-8 -*-
from openprocurement.api.utils import (
json_view,
context_unpack,
APIResource,
get_now
)
from openprocurement.auctions.core.utils import (
apply_patch,
save_auction,
add_next_award,
opresource,
)
from openprocurement.auctions.core.validation import (
validat... |
import struct, io, collections, os, random, ipaddress
from . import enums, crypto
class Payload:
def __init__(self, type, critical=False):
self.type = enums.Payload(type)
self.critical = critical
self.data = None
@classmethod
def parse(cls, type, critical, stream, length):
s... |
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, ai_settings, screen):
"""Initialize the ship, and set its starting position."""
super(Ship, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
# Load the ship image, and... |
from setuptools import setup
setup(name='copyright-updater',
version=0.1,
description='Simple tool to update the copyright in C and Python files',
url='https://github.com/swasun/copyright-updater',
author='Charly Lamothe',
license='MIT',
packages=['copyright_updater'],
package_data={'copyri... |
from helium import Client
# Session
#
def test_token_auth(client):
assert client.api_token is not None
client.api_token = 'test_auth'
assert client.api_token == 'test_auth'
assert client.base_url is not None
# Test api token on creation
test_client = Client(api_token='test_auth')
assert ... |
""" Here we store badges. """
from .storage import FILE_NAMESPACE, mtype_from_file, calculate_file_hash, store_file
from peewee import JOIN
from .models import Badge, UserMetadata, SubMod
from flask_babel import lazy_gettext as _l
import uuid
class Badges:
"""
Badge exposes a stable API for dealing with user ... |
# Generated by Django 3.2.4 on 2021-06-24 23:17
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('customer', '0004_auto_20210624_2317'),
('project', '0002_projectconsumables_quantity'),
]
... |
#!/usr/bin/env python3
# mc_sc_module.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by Michael P. Allen <m.p.allen@warwick.ac.uk>/<m.p.allen@bristol.ac.uk> ... |
#!/usr/bin/env python2.7
# Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this li... |
"""
https://leetcode.com/problems/binary-tree-level-order-traversal-ii/
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree [3,9,20,null,null,15,7],
3
/ \
9 20
/ \
15 7
retur... |
# Copyright (C) 2015 Red Hat, 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... |
from sympy import Range
def is_composite(a: int, d: int, n: int, s: int) -> bool:
if pow(a, d, n) == 1:
return False
for i in Range(s):
if pow(a, 2 ** i * d, n) == n - 1:
return False
# n is definitely composite
return True
def is_prime(number: int, rounds: int = 128) ->... |
alphabet = ["-", "_"]
def to_camel_case(text):
l = text.split("-")
if len(l) == 1:
l = text.split("_")
print(l)
for i in range(len(l)):
if i == 0:
continue
if l[i] in alphabet:
l[i] = ""
l[i] = l[i].capitalize()
res = "".join(l)
return re... |
import numpy as np, sys, os, random, pdb, json, uuid, time, argparse
from pprint import pprint
import logging, logging.config
from collections import defaultdict as ddict
from ordered_set import OrderedSet
# PyTorch related imports
import torch
from torch.nn import functional as F
from torch.nn.init import xavier_norm... |
import logging
import pytz
from django.conf import settings
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from apps.emailutil.tasks import Email
from apps.emailutil.utils import EmailRecipientHelper
from apps.physicaldevice.models import Device, DeviceStatus
from apps.sqswo... |
#!/usr/bin/python3
import argparse
import os
def main(inputPath, outputPath):
is_header = False
with open(inputPath, "r") as input_file, open(outputPath, "w") as output_file:
for line in input_file:
line = line.strip()
comma = ""
if line.startswith(">"):
... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from numpyro.distributions.conjugate import (
BetaBinomial,
DirichletMultinomial,
GammaPoisson,
NegativeBinomial2,
NegativeBinomialLogits,
NegativeBinomialProbs,
ZeroInflatedNegativeBinomial2,
)
from numpyro... |
from django.contrib import admin
# Register your models here.
from .models import Category
from .models import Question
from .models import Option
admin.site.register(Category)
admin.site.register(Question)
admin.site.register(Option) |
# Copyright 2010-2013 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Python 3 compatibility tools (PRIVATE).
We used to have lines like this under Python 2 in... |
"""
This file implements the base agent class.
"""
# Standard libraries
from abc import ABC, abstractmethod
from typing import TypeVar
# Third-party dependencies
import torch
# Type definitions
Action = TypeVar("Action")
# Need this for type hints, true base
# class is hidden.
Scheduler = TypeVar("Scheduler")
clas... |
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 11 13:59:10 2017
@author: Alastair Wiseman
"""
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
#set up Latex labeling
matplotlib.rcParams['text.usetex'] = True
matp... |
"""Module for syntactic terms and their support."""
__all__ = [
'Constant',
'IndexedVariable',
'Function',
'Substitution',
'Term',
'Variable',
'variables'
]
from abc import abstractmethod
from dataclasses import dataclass, field
from typing import Generic, Iterable, Iterator, Mapping, Tup... |
#!coding=utf8
|
import getpass
import time
import sys
import re
from pyopencga.opencga_config import ClientConfiguration
from pyopencga.rest_clients.admin_client import Admin
from pyopencga.rest_clients.alignment_client import Alignment
from pyopencga.rest_clients.clinical_client import Clinical
from pyopencga.rest_clients.cohort_cli... |
from flask_restful import Resource, current_app
from backend.services.campaign_service import CampaignService
from backend.services.organisation_service import OrganisationService
from backend.models.postgis.utils import NotFound
from backend.services.users.authentication_service import token_auth
class Organisation... |
from .exceptions import *
from .upload_result import UploadResult
from .uploader import Uploader
|
# -*- coding: utf-8 -*-
from __future__ import with_statement
import copy
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, Permission, Group
from django.template import Template, TemplateSyntaxError
from django.test.utils import override_settings
from django.utils.translation impo... |
"""Smbus2 asyncio support."""
import asyncio
from smbus2 import SMBus
class SMBus2Asyncio:
"""Asyncio version of SMBus2."""
def __init__(self, bus, *, loop=None, executor=None):
"""Initialise SMBus2 Asyncio."""
self.bus = bus
self.smbus = None
if not loop:
loop =... |
#!/usr/bin/python3
"""
Copyright 2018 Marco Lattuada
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 ... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2017,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the ab... |
# qubit number=5
# total number=60
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,floor, sqrt, pi
import numpy as np
import networkx as ... |
# project/api/common/utils/push_notifications.py
from project import app
from project.extensions import db
from project.models.event import Event
from project.models.user import User
from project.models.device import Device
from project.tasks.push_notification_tasks import send_async_push_notifications
def send_noti... |
def init():
return """
{
"queryType": "groupBy",
"dataSource": {
"type": "table",
"name": "telemetry-events"
},
"intervals": {
"type": "intervals",
"intervals": [
"$start_date/$end_date"
]
},
... |
import pytest
from plouffe.users.forms import UserCreationForm
from plouffe.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
class TestUserCreationForm:
def test_clean_username(self):
# A user with proto_user params does not exist yet.
proto_user = UserFactory.build()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.