text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import os
import re
import unittest
from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from django.contrib.admin.o... |
# Main Classes
from defichain.node.node import Node
from defichain.ocean.ocean import Ocean
# Helping Classes
from defichain.node.util import BuildToJson
|
# 8. Hot Dog Cookout Calculator
#
# Assume hot dogs come in packages of 10, and hot dog
# buns come in packages of 8. Write a program that
# calculates the number of packages of hot dogs and
# the number of packages of hot dog buns needed for a
# cookout, with the minimum amount of leftovers. The
# program should... |
"""
WSGI config for amaztv 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amaztv.settings")
from django.core.wsg... |
from sorting.sorting_helpers import *
import pygame
import sys
def bubble_sort(screen, matrix, nums):
screen.fill(BLACK)
sorted = False
for i in range(len(nums)-1):
screen.fill(BLACK)
if sorted:
break
sorted = True
for j in range(0, len(nums)-i-1):
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Generic output file parser and related tools"""
import bz2
import fileinput
import gzip
import inspect
import io
impor... |
# encoding: utf-8
# module renderdoc
# from P:\1-Scripts\_Python\Py-Autocomplete\renderdoc.pyd
# by generator 1.146
# no doc
# imports
import enum as __enum
from .SwigPyObject import SwigPyObject
class GLFixedVertexProcessing(SwigPyObject):
""" Describes the setup for fixed vertex processing operations. """
... |
# Copyright 2020-2022 Cambridge Quantum Computing
#
# 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 a... |
# FIRST NON REPEATING CHARACTER
# O(N) time and O(1) space
def firstNonRepeatingCharacter(string):
# Write your code here.
counts = {}
for index, char in enumerate(string):
if char in counts:
counts[char][1] += 1
else:
counts[char] = [index, 1]
minIndex = float("inf")
for char in counts:
if c... |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.4425
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getf... |
"""Application Models."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
from .DateMeta import DateMeta
from .Entity import Entity
from .Entity import Entity
from .FeedbackState import FeedbackState
from .TagMeta... |
#!/usr/bin/python
import urllib2
from datetime import datetime
from dateutil import tz
import os
import ssl
lines=urllib2.urlopen("https://developer.yahoo.com/util/timeservice/V1/getTime.html", context=ssl._https_verify_certificates(False)).readlines()
dateline=lines[-1]
#print dateline
#parse the date from the resp... |
version = 14
print(version)
language = "python"
print(language)
# multiple declaration
name, age, day = "john", 25, "tuesday"
print(name, age, day)
# ValueError: too many values to unpack
# v1, v2 = "basics"
# multiple assignment
v1 = v2 = "basics"
print(v1, v2)
# data types: int, string, list, tuple, diction... |
# Copyright Ari Wasch 2020
import cv2 as cv2
import numpy as np
import math
class Vision:
focalLength = 0.0 # Focal length of largest contour
angle = 0.0 # Angle of largest contour relative to camera
fittedHeight = 0.0 # Fitted height of the largest contour
fittedWidth = 0.0 # Fitted width of the... |
import logging
import uuid
import boto3
import requests
from flask import Flask
from aws_xray_sdk.core import patch_all, xray_recorder
from aws_xray_sdk.ext.flask.middleware import XRayMiddleware
# Patch all supported modules to enable automatic instrumentation
patch_all()
app = Flask(__name__)
logging.basicConfig(... |
import io
import os
import pkg_resources
import shlex
import sys
import unittest
# If the REPAIR_FAILURES environment variable is set, any tests failing due to
# wrong output will be corrected. Be sure to do a "git diff" to validate that
# you're getting changes you expect.
REPAIR_FAILURES = os.getenv("REPAIR_FAILUR... |
import random
import tqdm
from collections import Counter
from tqdm import tqdm
DOORS = 3
choices1 = Counter()
choices2 = Counter()
experiments = list(range(100000))
for i in tqdm(experiments):
prize = random.randrange(0, 3)
choice1 = random.randrange(0, 3)
revealable = [
door for door in range(D... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-19 15:40
from __future__ import unicode_literals
from django.db import migrations, models
import isi_mip.contrib.blocks
import isi_mip.pages.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.documents.blocks
import wagtail.embeds.... |
'''Functional boxplots and rainbow plots
see docstrings for an explanation
Author: Ralf Gommers
'''
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
#Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
#surface temperature... |
# ============================================================================
#
# Copyright (C) 2007-2016 Conceptive Engineering bvba.
# www.conceptive.be / info@conceptive.be
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition... |
from poledni_menu import version
from setuptools import setup
from pathlib import Path
readme = Path(__file__).with_name("README.rst").read_text()
setup(
name="poledni-menu",
version=version.VERSION,
description="Scrap daily menu and send it via e-mail",
long_description=readme,
long_description_... |
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
# function to display the grades individually
def print_grades(grades):
for grade in grades:
print(grade)
# function to calculate the sum of the grades
def grades_sum(grades):
total = 0
for grade in grades:
total += grade... |
import pytest
from numpy.testing import assert_allclose
import numpy as np
import scipy.sparse as sparse
import warnings
from keras.utils.test_utils import keras_test
from keras import backend as K
from keras.backend import floatx, set_floatx, variable
from keras.utils.conv_utils import convert_kernel
import reference... |
from tapiriik.settings import PP_WEBSCR, PP_RECEIVER_ID, PAYMENT_CURRENCY
from tapiriik.auth import User
from tapiriik.payments import Payments, ExternalPaymentProvider
from tapiriik.web.views.ab import ab_experiment_complete, ab_register_experiment
from django.views.decorators.csrf import csrf_exempt
from django.views... |
import numpy as np
import random
import torch
import torchvision
import torch.nn as nn
import time
from torch.utils import data
from d2l import torch as d2l
from matplotlib import pyplot as plt
from IPython import display
#################### Data Pipeline ####################
# 进行分装,增加 Resize 功能
def load_data_fashi... |
from oshino.util import dynamic_import
from oshino.agents.test_agent import StubAgent
def test_dynamic_import_sucessful():
agent = dynamic_import("oshino.agents.test_agent.StubAgent")
assert agent == StubAgent
|
import tensorflow as tf
from tensorflow import keras
print(tf.VERSION)
print(tf.keras.__version__)
from tensorflow.keras.preprocessing import image
# import utils.preprocessing.image as image
from tensorflow.keras.applications.inception_v3 import preprocess_input
from tensorflow.keras.applications import nasnet
impor... |
from partd.dict import Dict
from partd.file import File
from partd.buffer import Buffer, keys_to_flush
import pickle
import shutil
import os
def test_partd():
a = Dict()
b = Dict()
with Buffer(a, b, available_memory=10) as p:
p.append({'x': b'Hello', 'y': b'abc'})
assert a.get(['x', 'y'])... |
import pyb
import uasyncio
from uvacbot.ui.heartbeat import Heartbeat
async def killer(timespan):
await uasyncio.sleep(timespan)
class SystemObjects(object):
_instance = None
@staticmethod
def getInstance():
if SystemObjects._instance == None:
SystemObjects._instance =... |
from abc import ABC
from job.pkgs.tf.feature_util import *
from job.pkgs.tf.extend_layers import ModelInputLayer, MMoELayer, DNNLayer
from job.pkgs.tf.helperfuncs import TF_REF_VERSION
class MMoEModel(tf.keras.Model, ABC):
def __init__(self, model_input_config: ModelInputConfig, task_structs, num_experts, exper... |
# -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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... |
#// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#// SPDX-License-Identifier: MIT-0
import json
import boto3
iam = boto3.client('iam')
def lambda_handler(event, context):
appstream_service_role_policy_document = { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal... |
from __future__ import unicode_literals
from boto.ec2.elb.attributes import (
ConnectionSettingAttribute,
ConnectionDrainingAttribute,
AccessLogAttribute,
CrossZoneLoadBalancingAttribute,
)
from boto.ec2.elb.policies import AppCookieStickinessPolicy, OtherPolicy
from moto.core.responses import BaseResp... |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup(
packages=['dock'],
package_dir={'': 'src'}
)
setup(**setup_args)
|
# -*- coding: utf-8 -*-
# @Author: Zhai Menghua
# @Date: 2020-07-27 15:16:16
# @Last Modified by: Zhai Menghua
# @Last Modified time: 2020-07-31 12:38:42
from .id_related import *
from .path_related import *
from .coding_related import *
from .cnn_json_related import ClassNameManager
from .cnn_json_related import ... |
#!/usr/bin/env python
import numpy as np
from LLC_Membranes.analysis import hbonds
from LLC_Membranes.llclib import topology, physical
path = "/home/bcoscia/Documents/Gromacs/Transport/NaGA3C11/pure_water"
spline = True
tails = False # look at hbonds in the tails
head_groups = True
if head_groups:
tails = False #... |
from typing import Optional
from ..nodes import *
from ..blocks import *
class ComputedVectorBlock(Block):
"""
ComputedVector block
Args:
parent (SimulationNode): The parent node
type (str): The computed vector type
dimensions (str): The computed vector dimensions
initial_... |
# 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, overload
from ... import _utilities
fro... |
import os, sys
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.
abspath(__file__))))
if path not in sys.path:
sys.path.append(path)
from CM.CM_TUW32.N3scenario_to_raster import CalcEffectsAtRasterLevel
from CM.common_modules.readCsvData import RE... |
#!/usr/bin/env python
import copy
import logging
import optparse
import os
import random
import sqlite3
import string
import sys
import threading
from typing import Optional, Union, Tuple, List, Dict
import pump
import pump_bfd
import pump_csv
import pump_cb
import pump_gen
import pump_mc
import pump_dcp
from pump ... |
"""
data hash pandas / numpy objects
"""
from __future__ import annotations
import itertools
from typing import (
TYPE_CHECKING,
Hashable,
Iterable,
Iterator,
cast,
)
import numpy as np
from pandas._libs import lib
from pandas._libs.hashing import hash_object_array
from pandas._typing import Arra... |
"""
Tests for dit.divergences.earth_mover_distance.
"""
import warnings
import pytest
import numpy as np
from dit import Distribution, ScalarDistribution
from dit.divergences.earth_movers_distance import earth_movers_distance, earth_movers_distance_pmf
@pytest.mark.parametrize(('p', 'q', 'emd'), [
([0, 1], [1... |
import jax
import jax.numpy as jnp
import haiku as hk
import numpy as np
import optax
from haiku_baselines.DDPG.base_class import Deteministic_Policy_Gradient_Family
from haiku_baselines.DDPG.network import Actor, Critic
from haiku_baselines.DDPG.ou_noise import OUNoise
from haiku_baselines.common.schedules import Lin... |
# 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 ... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (c) 2014 Lance Hepler
# Copyright (c) 2004-2011 Ero Carrera <ero@dkbza.org>
# Copyright (c) 2004-2007 Michael Krause <michael@krause-software.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a c... |
# Copyright 2018 The Feast 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
import numpy as np
import pytest
from PIL import Image
from ebl_ai.app import Model
from ebl_ai.model import BoundingBoxesPrediction
CONFIG_FILE = "model/fcenet_no_dcvn.py"
CHECKPOINT = "model/checkpoint.pth"
TEST_IMAGE_PATH = "ebl_ai/tests/test_image.jpg"
@pytest.mark.skip(reason="Takes very long")
def test_mode... |
"""Populate topic, subtopic, subtopic_measure and measure table from the main page table.
Revision ID: 20181220_populate_measures
Revises: rename_uri_slug
Create Date: 2018-12-11 13:11:47.567135
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "20181220_populate... |
import math
import time
from dataclasses import dataclass
from typing import List, Tuple
from PIL import Image, ImageDraw, ImageFilter
from seedsigner.gui.renderer import Renderer
from seedsigner.helpers.qr import QR
from seedsigner.models.qr_type import QRType
from seedsigner.models.threads import BaseThread, Thread... |
# 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 ... |
"""
Neoclassical growth model with constant savings rate, where the dynamics are
given by
k_{t+1} = s A_{t+1} f(k_t) + (1 - delta) k_t
Marginal densities are computed using the look-ahead estimator. Thus, the
estimate of the density psi_t of k_t is
(1/n) sum_{i=0}^n p(k_{t-1}^i, y)
This is a density in y.
... |
from behave import step
from nose.tools import assert_equal
from constants import system_messages, system_label
@step("eu clico no botão contato para abrir a página de contato")
def step_impl(context):
context.contact_page.contact_link().click()
context.helper.wait_for_element_is_visible(context.contact_page... |
# -*- 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... |
import asyncio
import typing
import logging
import traceback
if typing.TYPE_CHECKING:
from types import AsyncGeneratorType
log = logging.getLogger(__name__)
def cancel_task(task: typing.Optional[asyncio.Task]):
if task and not (task.done() or task.cancelled()):
task.cancel()
def drain_tasks(tasks: ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models import Q
from mptt.managers import TreeManager
class ForumManager(TreeManager):
def displayable_subforums(self, start_from=None):
"""
Returns all the forums that can be seen from a forum at a given level in the... |
import codecs
import fnmatch
import glob
import os
from os import path
import re
import shutil
import sys
import uuid
import json
from copy import copy
from build import ConfigurationError
import firefox_tasks
import lib
from lib import task, walk_with_depth, read_file_as_str, cd
import safari_tasks
import ie_tasks
im... |
import numpy as np
from numpy import identity as I
from numpy import newaxis as nax
from numpy import vstack, atleast_3d
class Kernel:
""" Function like class that generate kernel matrix.
Parameters
----------
key2idx: dict
linking between name of hyperparameters and index of that parameters i... |
from django.db import models
from django.core.exceptions import ValidationError
# Create your models here.
class CTA(models.Model):
status_choices = (
('P', 'Published'),
('D', 'Draft'),
)
message = models.TextField(max_length=512)
status = models.CharField(max_length=1, choices=status... |
"""migration
Revision ID: cf53986008cf
Revises: b10c643435c4
Create Date: 2022-03-31 23:08:05.180384
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "cf53986008cf"
down_revision = "b10c643435c4"
branch_labels = None
depends_on = None
def upgrade():
# ### ... |
# Copyright 2020 PerfKitBenchmarker 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 appli... |
""" Plotting result of motion_pattern_error
used for SPIE abstract
"""
def read_error_ouput(exceldir, workbook, rowS=18, colS=1, colE=5):
"""
"""
wb = openpyxl.load_workbook(os.path.join(exceldir, workbook), data_only=True)
sheet = wb.get_sheet_by_name('summery')
rowS = rowS
colS = ... |
# -*- 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... |
#!/usr/bin/python3
import sys
sys.path.append('../src/ry')
from libry import *
K = Configuration()
D = K.camera()
K.addFile('../test/lgp-example.g');
D.update()
lgp = K.lgp("../test/fol.g");
lgp.optimizeFixedSequence("(grasp baxterR stick) (push stickTip redBall table1) (grasp baxterL redBall) ");
D.update(True)... |
# -*- coding: utf-8 -*-
#
# VHDL-extras documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 6 19:03:10 2014.
#
# 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.
#
#... |
#!/usr/bin/env python
# coding: utf-8
# # Extract Data from SQL Database (Postgresql) in Pandas
# Bonus question to investigate if the employee data is fake through data visualizations.
#
# In[1]:
get_ipython().system('pip3 install psycopg2-binary')
# In[5]:
import pandas as pd
from sqlalchemy import create_en... |
# 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
# d... |
#########################################
# AudioFile.py
# more info @: http://myrobotlab.org/service/AudioFile
#########################################
# start the services
audiocapture = Runtime.start("audiocapture","AudioCapture")
audiofile = Runtime.start("audiofile", "AudioFile")
# it starts capturing audio
au... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
import json
import uuid
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDeserializer, Serializer as PythonSerializer,
)
from django.utils.duration import duration_iso... |
import chainer
from chainercv.links import SSD300
from chainercv import utils
from chainercv.datasets import voc_bbox_label_names
def item_detection(img_file):
"""
Recieve a image file for detection.
Return detected data to create 'Item' model
:param img_file:
:return: bbox, name, score
"""
... |
from ...superTemplate import SuperTemplate
class alphat(SuperTemplate):
template=r'''
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox... |
from django.contrib.auth.models import User
from django.contrib.auth.password_validation import validate_password
from django.forms import ModelForm, CharField, PasswordInput, ValidationError, HiddenInput
from django.utils.translation import ugettext_lazy as _
from apps.account.models import Account
class AccountFor... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, saru and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class AddressCheck(Document):
pass
|
#!/usr/bin/env python
"""
See how many processes we can create
"""
import os
import signal
def fork_bomb():
"""
Fork bomb
"""
pids = 0
# Reset signal handler for SIGTERM
signal.signal(signal.SIGTERM, signal.SIG_DFL)
# Fork and create as many children as we can
while True:
try:... |
### Run this program to create json file that contains label of each vehicle type in CARLA
### The JSON file is required to get vehicle's ground truth class when using carla_vehicle_annotator function
### Set this variable to True if you want the program to give label 0 to every vehicle type
autoFill = False
### This... |
#!/usr/bin/env python3
# ./frame_changes.py ../capture/boot_buttons.vcd '(' '&' '$' 2>/dev/null
import re
import sys
class App:
IDLE_TIME_US = 13000
BIT_FRAME_LENGTH = 76
def __init__(self, file_name, clk_char, spa_char, dsp_char, clock_edge):
self.file_name = file_name
if clock_edge:
... |
"""Comparison between I-V curves obtained by using the smooth nonlinear
memristance approximation function introduced in the study by Bao, B.
C.; Liu, Z. and Xu, J. P.: Steady periodic memristor oscillator with
transient chaotic behaviours, Electronic Letters, doi:
10.1049/el.2010.3114, and by using the formulation tha... |
# %%
from src.QOCInstructionScheduleMap import *
from src.QutipOptimizer import *
from qiskit import IBMQ
from qiskit.circuit.quantumcircuit import QuantumCircuit
import qiskit
from qiskit.compiler.assemble import assemble
from qiskit.tools.monitor.job_monitor import job_monitor
from qiskit.circuit.library import XGate... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""Module for traversing a directory structure, finding duplicate FILES and displaying them, but does NOT delete them."""
import os
import argparse
import hashlib
import zlib
from functools import reduce
import UpdatePrinter
__author__ = "Michael Krisper"
__copyright__ =... |
'''
Prep the very large GEBCO 2021 elevation data,
by extracting tiled files and downsampling.
'''
from zipfile import ZipFile
from io import BytesIO
from PIL import Image
Image.MAX_IMAGE_PIXELS = 999999999999999999
path = r'C:\Users\kimok\Downloads\gebco_2021_geotiff.zip'
import transformio as tio
size = 10000,50... |
"""
This file offers the methods to automatically retrieve the graph Methanoregula boonei.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 2021-0... |
#!/usr/bin/python
# encoding: utf-8
# Setup file for dulwich
# Copyright (C) 2008-2016 Jelmer Vernooij <jelmer@jelmer.uk>
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
has_setuptools = False
else:
has_setuptools = True
from distutils.core im... |
import random
from peewee import CharField, DateTimeField
from .base_attachment import BaseAttachment
class PlayerBrain(BaseAttachment):
username = CharField(max_length=255)
password = CharField(max_length=255)
pass_salt = CharField(max_length=255, default=lambda: str(random.getrandbits(128)))
la... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CBVs.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportErr... |
import numpy as np
import pandas as pd
import scipy.stats
from vivarium.framework.engine import Builder
from vivarium.framework.population import SimulantData
from vivarium_gates_iv_iron.constants.data_values import (
HEMOGLOBIN_DISTRIBUTION_PARAMETERS,
HEMOGLOBIN_THRESHOLD_DATA,
ANEMIA_DISABILITY_WEIGHTS... |
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name = "school_algorithms",
version = "1.14.0",
author = "Sammy Garcia",
author_email = "s@mmygarcia.com",
description = "School algorithm module for Python",
... |
from . import config, formats, logging, proxy_fix, request_id
from .flask_init import init_app
__version__ = '60.6.0'
|
# Generated by Django 3.1.4 on 2021-06-05 00:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dockerapi', '0010_auto_20210605_0006'),
]
operations = [
migrations.AlterField(
model_name='timemoudel',
name='time_... |
#!/usr/bin/env python3
# -*- encoding: utf-8
# SPDX-License-Identifier: CC0-1.0 & Additional T&Cs
# Copyright (c) 12021 - 12021 HE, Emporia.AI Pte Ltd
# See LICENSE.md for Additional Terms and Conditions
from typing import Any, IO, Optional, List, Dict
from .base import *
#
# alters, typically taxes and success fees ... |
'''
This module stores the stock market variables related to the stock ticker,
This module must be run after training the model by calling the train_model() function in the train module.
'''
import numpy as np
from . import train
class Market():
def __init__(self, ticker):
self.train = train.Training(ticke... |
# coding: utf-8
from __future__ import unicode_literals
from ..compat import compat_str
from ..utils import determine_ext, int_or_none, url_or_none
from .common import InfoExtractor
class RENTVIE(InfoExtractor):
_VALID_URL = (
r"(?:rentv:|https?://(?:www\.)?ren\.tv/(?:player|video/epizod)/)(?P<id>\d+)"
... |
"""
Unit tests for attention mechanism.
"""
import unittest
import numpy as np
import torch
from texar.core.attention_mechanism import *
class AttentionMechanismTest(unittest.TestCase):
r"""Tests attention mechanism.
"""
def setUp(self):
self._batch_size = 8
self._max_time = 16
... |
SECRET_KEY = "not-so-secret"
INSTALLED_APPS = [
"django.contrib.contenttypes",
"django.contrib.auth",
"django.contrib.sessions",
"processlib",
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
MIDDLEWARE = [
"django.contrib.sessi... |
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import ckanext.hdx_service_checker.actions.get as actions
import ckanext.hdx_service_checker.actions.authorize as authorize
import ckanext.hdx_service_checker.views.run_checks as run_checks
class HdxServiceCheckerPlugin(plugins.SingletonPlugin):
... |
# -*- coding: utf-8 -*-
# Copyright 2009-2013, Peter A. Bigot
#
# 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... |
from load import ROOT as R
from scipy.interpolate import interp1d
import numpy as N
import gna.constructors as C
from gna.converters import convert
from mpl_tools.root2numpy import get_buffers_graph_or_hist1
from gna.env import env, namespace
from gna.configurator import NestedDict
from collections import OrderedDict
f... |
#! /usr/bin/env python
from __future__ import print_function
import os
import os.path
import sys
import string
import getopt
import re
import socket
import time
import threading
import traceback
import types
import io
import linecache
from code import InteractiveInterpreter
from platform import python_version, system... |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... |
import numpy as np
from network import network
from draw import *
def main():
x = np.array([0.1, 0.2, 0.3, 0.5])
y = np.array([0.092, 0.185, 0.279, 0.462])
z = np.polyfit(x, y, 1)
a, b = z
print("a:{}, b:{}".format(a, b))
x_reg = np.array([0, 0.6])
y_reg = a * x_reg + b
pr... |
# Copyright 2016-2018 Dirk Thomas
# Licensed under the Apache License, Version 2.0
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from colcon_core.package_descriptor import PackageDescriptor
from colcon_core.package_discovery.path import _expand_wildcards
from colcon_core.package_discovery... |
"""Zookeeper Partitioner Implementation
:Maintainer: None
:Status: Unknown
:class:`SetPartitioner` implements a partitioning scheme using
Zookeeper for dividing up resources amongst members of a party.
This is useful when there is a set of resources that should only be
accessed by a single process at a time that mul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.