text stringlengths 17 737k |
|---|
try:
import _path
except NameError:
pass
import spyral
import sys
SIZE = (600, 600)
BG_COLOR = (0, 0, 0)
class StupidSprite(spyral.Sprite, spyral.Actor):
def __init__(self, camera):
spyral.Sprite.__init__(self, camera)
spyral.Actor.__init__(self)
self.image = spyral.Im... |
# Copyright 2016, 2017 Echo Squad. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
from django.conf import settings
from mako.template import Template
from fabric.api import local
from fabric.context_managers import lcd
from libs.utils.data import merge_dicts
import os
import yaml
import json
import shutil
import copy
class ProvisionBackened(object):
def __init__(self, stage_unique_token, re... |
# -*- mode: python -*-
import os
import sys
import gettext
import ldap
import yaml
import json
from twisted.python.log import ILogObserver, FileLogObserver, startLogging
from twisted.python.logfile import DailyLogFile
from twisted.web.server import Site
from twisted.internet import reactor
from twisted.application impo... |
import itertools
import os
import threading
import six
from six.moves import zip as izip
from Crypto import Random
import transaction
from hashlib import sha256
from zerodbext.catalog.query import optimize
from zerodb.collective.indexing.indexer import PortalCatalogProcessor
from zerodb.collective.indexing.interfaces... |
# type: ignore
# silence linter errors
defaults = defaults
run = run
### trackpad settings ###
for key in (
'com.apple.AppleMultitouchTrackpad',
'com.apple.driver.AppleBluetoothMultitouch.trackpad'
):
trackpad = defaults[key]
trackpad['Clicking'] = True # touch to click
# enable *both* methods o... |
from pupynere import NetCDFFile
from matplotlib.toolkits.basemap import Basemap, cm
import pylab, copy
from matplotlib import rcParams
# make tick labels smaller
rcParams['xtick.labelsize']=9
rcParams['ytick.labelsize']=9
# plot rainfall from NWS using special precipitation
# colormap used by the NWS, and included in... |
import taichi_lang as ti
import math
import numpy as np
import cv2
import os
import matplotlib.pyplot as plt
real = ti.f32
ti.set_default_fp(real)
# ti.runtime.print_preprocessed = True
n_grid = 256
dx = 1 / n_grid
inv_dx = 1 / dx
dt = 3e-4
max_steps = 128
vis_interval = 32
output_vis_interval = 2
steps = 64
assert s... |
#!/usr/bin/env python2
"""UnitConverter (CLI)
Usage:
cli.py <args>... [-d N] [-p N] [h]
Options:
-d, --decimals=<decimals> Maximum decimal points. [default: 10]
-p, --precision=<precision> Accuracy of the floats. [default: 10]
-h, --help Print this help text and exit.
--versi... |
import discord
from discord.ext import commands
from .utils import checks
from cogs.utils.dataIO import dataIO, fileIO
from __main__ import send_cmd_help
import json
import os
import asyncio
import aiohttp
import datetime
try:
from bs4 import BeautifulSoup
soupAvailable = True
except:
soupAvailable = Fal... |
import discord
from discord.ext import commands
from .utils import checks
from cogs.utils.dataIO import dataIO, fileIO
from __main__ import send_cmd_help
import json
import os
import asyncio
import aiohttp
import datetime
try:
from bs4 import BeautifulSoup
soupAvailable = True
except:
soupAvailable = Fal... |
#!/usr/bin/env python
# -*- encoding: utf8 -*-
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
from xml.sax.saxutils import unescape
import urllib
import re
SOURCE_FIXES = [
# <td background-color: "#ededed;"> becomes <td>
(re.compile(r'\s*[-\w]+:\s*"[a-zA-Z0-9#;]+"'), lambda s: ''),
]
SOURCE_URL = "h... |
from __future__ import division, print_function
import os
import logging
import numpy as np
import time
from collections import defaultdict
from base.io_util import myopen
from itertools import izip
import pandas as pd
TITER_ROUND=4
logger = logging.getLogger(__name__)
class TiterModel(object):
'''
this clas... |
# Generated by Django 2.2.10 on 2022-06-07 16:59
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import embed_video.fields
class Migration(migrations.Migration):
dependencies = [
('accelerator',
'0105_in... |
from __future__ import absolute_import
import os
DEBUG = True
BASE_DIR = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
AUTH_PASSWORD_VALIDATORS = [{'NAME': 'testapp.validators.Is666'}]
SECRET_K... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, timedelta
from io import BytesIO
from itertools import chain
import time
from unittest import skipIf
from django.db import connection, connections
from django.core import signals
from django.core.exceptions import Suspici... |
#!/usr/bin/env python
"""
unit tests for twemredis.py
"""
from builtins import bytes, chr
import unittest
import twemredis
import mockredis
import yaml
test_yaml = """
sentinels:
- sentinel01.example.com
- sentinel02.example.com
- sentinel03.example.com
num_shards: 10
shard_name_format: tdb{0:03d}
hash_tag: "{}"... |
'''
experiment (:mod:`calour.experiment`)
=====================================
.. currentmodule:: calour.experiment
Classes
^^^^^^^
.. autosummary::
:toctree: generated
Experiment
'''
# ----------------------------------------------------------------------------
# Copyright (c) 2016--, Calour development t... |
# admin
import models
from django.contrib import admin
from django.contrib.auth.decorators import permission_required
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, render... |
# Copyright DataStax, 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, softwa... |
"""
This module houses the main classes you will interact with,
:class:`.Cluster` and :class:`.Session`.
"""
from futures import ThreadPoolExecutor
import logging
import time
from threading import RLock, Thread, Event
import traceback
import Queue
import weakref
from functools import partial
from itertools import grou... |
import sys
import datetime
import hashlib
import subprocess
from cax import qsub, config
from cax.task import Task
# Obtain pax repository hash
def get_pax_hash(pax_version, host):
PAX_DEPLOY_DIR = ''
if host == 'midway-login1':
# Location of GitHub source code on Midway
PAX_DEPLOY_DIR="/proj... |
import numba
import numpy
import pkg_resources
import pytest
import scipy
# The first version of numpy that broke backwards compat and improved printing.
#
# We set the printing format to legacy to maintain our doctests' compatibility
# with both newer and older versions.
#
# See: https://docs.scipy.org/doc/numpy/re... |
"""
A collection of utility functions for working with ``*.DBF`` (dBase database) files.
"""
import numpy as np
import pandas as pd
import os
import cea.config
# import PySAL without the warning
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
import pysal.lib
__author__ = "Clayton Miller"
__... |
import collections
import copy
import warnings
import numpy
import six
from chainer import cuda
from chainer import link as link_module
from chainer import serializer as serializer_module
from chainer import variable
def _sum_sqnorm(arr):
sq_sum = collections.defaultdict(float)
for x in arr:
with cu... |
import sys, pygame
import pygame.locals
from model import Model, Chip
from gameboard.coordinate import Coordinate
######### SAMPLE BOARD ###########
##
## initial state
##
## x _ x _ x _ x _
## _ x _ x _ x _ x
## x _ x _ x _ x _
## _ e _ e _ e _ e
## e _ e _ e _ e _
## _ o _ o _ o _ o
## o _ o _ o _ o _
## ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
from utils.XY import XY
class Diagram:
def __init__(self):
self.nodes = []
self.edges = []
self.xy = None
self.width = None
self.height = None
self.subdiagram = False
self.rankdir = None
... |
"""
Individual pages
"""
from dominate import document
from dominate.tags import *
import urllib2
from bs4 import BeautifulSoup
from pyteaser import SummarizeUrl
from flask import (
Blueprint,
g,
render_template)
analytics = Blueprint('analytics', __name__)
urls = [
'http://www.wired.com/',
... |
# -*- coding: utf-8 -*-
from pipeline import *
#import spotlight
import csv
import re
import json
import os
from sutime import SUTime
'''
class DBSpotlightEntityLinker(BasePipeline):
def __init__(self, spotlight_url='http://localhost:2222/rest/annotate', confidence=0.2, support=1):
"""
:param spo... |
import os
import sys
import errno
import tempfile
import time
import datetime
import optparse
import logging
from stat import S_IFDIR, S_IFREG
from fuse import FUSE, FuseOSError, Operations, LoggingMixIn
from kamaki.cli import config as kamaki_config
from kamaki.clients.astakos import AstakosClient
from kamaki.clients... |
from datetime import date, datetime
import random
import string
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.core.exceptions import ValidationError
from django.core.urlresolvers import get_callable
from django.db import models
from django.db.models import Q
from ... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import datetime
import decimal
import httplib
import json
import threading
import time
import re
from decimal import Decimal
from electrum_ltc.plugins import BasePlugin
from electrum_ltc.i18n import _
from electrum_ltc_gui.qt.util import *
from electrum_ltc_gui.qt.a... |
"""
specpolwavmap
Split O and E and produce wavelength map for spectropolarimetric data
"""
import os, sys, glob, shutil, inspect
import numpy as np
import pyfits
from scipy.interpolate import interp1d
from scipy.ndimage.interpolation import shift
from scipy import linalg as la
from pyraf import iraf
from iraf im... |
# Bug tracker for the OS/Net (core) section of OpenSolaris
# Why just OS/Net?
# Triskelios and Asheesh discussed this in #opensolaris
#
# <paulproteus> Hello OpenSolaris folks! I'm trying to find a list of good bugs for OpenSolaris newcomers to tackle. I see http://hub.opensolaris.org/bin/view/Main/oss_bite_size whic... |
#!/usr/bin/python2.5
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A bare-bones test server for testing cloud policy support.
This implements a simple cloud policy test server that can be used to... |
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
# Copyright 2014 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://w... |
"""
oauthlib.oauth2.rfc8628
~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 Device Authorization RFC8628.
"""
from oauthlib.oauth2 import BackendApplicationClient, Client
from oauthlib.oauth2.rfc6749.errors import InsecureTransportError
from oauth... |
"""
Web Service Resource for OpenNSA.
Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2011)
"""
import time
import StringIO
from xml.etree import cElementTree as ET
from dateutil import parser
from twisted.python import log, failure
from opennsa import nsa, error
from opennsa.protocols.shared i... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2017 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... |
import difflib
from functools import wraps, update_wrapper
import hail as hl
from hail.expr.expressions import *
from hail.expr.types import *
from hail.ir import *
from hail.typecheck import *
from hail.utils import wrap_to_list
from hail.utils.java import Env
class AggregableChecker(TypeChecker):
def __init__(... |
"""
Home of IQR LSH implementation based on UNC Chapel Hill paper / sample code.
"""
import heapq
import logging
import os.path as osp
import numpy
import numpy.matlib
from smqtk.algorithms.nn_index import NearestNeighborsIndex
from smqtk.representation.code_index import get_code_index_impls
from smqtk.representatio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
from core.alert import messages
from core.alert import info
from core.alert import error
from core import compatible
from core._time import now
try:
import texttable
except:
from core.color import finish
error('pip install -r requiremen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2013 Sebastien Maccagnoni-Munch
#
# This file is part of OSPFM.
#
# OSPFM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, e... |
# Copyright 2022 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 agreed to in writing, ... |
"""This file provides Python types for the client API.
Most of these types are direct copies of what the interop server API
requires. They include input validation, making a best-effort to ensure
values will be accepted by the server.
"""
import re
import sys
class ClientBaseType(object):
""" ClientBaseType is ... |
# -*- coding: utf-8 -*-
"""
Created March 2016.
@author: dejh
"""
from __future__ import print_function
from six.moves import range # this is Python 3's generator, not P2's list
from landlab import ModelParameterDictionary, Component, FieldError, \
FIXED_VALUE_BOUNDARY, BAD_INDEX_VALUE, CLOSED_BO... |
import geohash
import logging
import operator
from functools import partial
from itertools import chain, product, combinations, imap
from address_normalizer.deduping.duplicates import *
from address_normalizer.deduping.storage.base import *
from address_normalizer.text.gazetteers import *
from address_normalizer.t... |
import time
from i2c_device.i2c_device import I2CDevice
class ColorSensor(I2CDevice):
"""Wrapper class for TCS3472 I2C-based color sensor."""
# TODO: Make these config items and load in __init__()
max_c = 65536
def __init__(self):
I2CDevice.__init__(self, 1, 0x29, config='tcs3472_i2c.yaml')
... |
"""
Utilities for working with the Telegram API itself (such as handy methods
to convert between an entity like a User, Chat, etc. into its Input version)
"""
import base64
import binascii
import imghdr
import inspect
import io
import itertools
import logging
import math
import mimetypes
import os
import re
import stru... |
# -*- coding: utf-8 -*-
import random
import urllib2
import lxml.html
URL = 'https://en.wikipedia.org/wiki/List_of_Chopped_episodes'
html = urllib2.urlopen(URL).read()
doc = lxml.html.fromstring(html)
ingredient_lists = doc.xpath(
'//p[text()="Ingredients:"]/following-sibling::ul[1]/li')
appetizers = []
ent... |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2014 TrilioData, Inc
# Copyright (c) 2015 EMC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# ... |
# Copyright 2011 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is distri... |
#!/usr/bin/env python
# encoding: utf-8
from ..experiment import Experiment, RuntimeExperiment
from pprof.experiment import step, substep
from ..settings import config
from pprof import likwid
from pprof.utils.db import create_run, get_db_connection
from plumbum import local, FG
from plumbum.cmd import cp, awk, echo,... |
from cloudmesh.cm_mongo import cm_mongo
from cloudmesh.user.cm_user import cm_user
from cloudmesh_common.logger import LOGGER
from cloudmesh.iaas.cm_cloud import CloudManage
from cloudmesh.config.cm_config import cm_config
from pprint import pprint
from cloudmesh import banner
from cloudmesh import yn_choice
import tim... |
# 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
# distributed under t... |
import os
import inspect
import biokbase.narrative.monkeypatch as monkeypatch
# Configuration file for ipython-notebook.
c = get_config()
#------------------------------------------------------------------------------
# NotebookApp configuration
#----------------------------------------------------------------------... |
"""Test the CLTK.
TODO: Write test for copy_dir_contents
"""
__author__ = 'Kyle P. Johnson <kyle@kyle-p-johnson.com>'
__license__ = 'MIT License. See LICENSE.'
import os
import unittest
from cltk.corpus.greek.beta_to_unicode import Replacer
from cltk.corpus.greek.tlgu import TLGU
from cltk.utils.file_operations imp... |
import virtool.utils
import virtool.virus
import virtool.virus_history
from virtool.handlers.utils import json_response, not_found, paginate
async def find(req):
"""
Get a list of change documents.
"""
db = req.app["db"]
data = await paginate(
db.history,
{},
req.query,
... |
#!/usr/bin/env python
## top-level script for generating probability distributions for component scores as part of CMS 2.0.
## last updated: 09.27.16 vitti@broadinstitute.org
from dists.likes_func import get_old_likes, read_likes_file, plot_likes, get_hist_bins
from dists.freqbins_func import get_bin_strings, get_bin... |
# Copyright 2009 the Melange 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 or agreed to in ... |
import numpy as np
import pandas as pd
from collections import defaultdict
from sklearn.ensemble import RandomForestRegressor
from scipy.optimize import curve_fit
from preprocessing import dump_to_pickle, load_from_pickle, process_features, convert_to_array
from cashflow import calc_monthly_payments, get_monthly_paymen... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import scipy.io
import numpy as np
import requests
import zipfile
from .. import config
def _urlretrieve(url, filename):
'''Defines a convenience method for downloading files with requests.
... |
import os
import pyfits
import numpy as np
import glob
import shutil
import time
import matplotlib.pyplot as plt
USE_PLOT_GUI=False
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
import matplotlib.ticker as mticker
from pyraf import iraf
from iraf import iraf
impor... |
import re
import numpy as np
import nltk
__all__ = ['strip_punc', 'rem_num', 'rehyph', 'add_metadata',
'apply_stoplist', 'filter_by_suffix', 'word_tokenize',
'sentence_tokenize', 'paragraph_tokenize', 'change_label']
def strip_punc(tsent):
"""
"""
p1 = re.compile(r'^(\W*)')
p... |
# -*- test-case-name: vumidash.tests.test_holodeck_pusher -*-
"""Service that pushes metrics to Holodeck."""
import heapq
import math
from datetime import datetime, timedelta
from twisted.application.service import Service
from twisted.internet.defer import (
inlineCallbacks, gatherResults, maybeDeferred)
from t... |
from common import Graph, Node, PynException, Rule, Scope
class NinjaAnalyzer(object):
# "method could be a function" pylint: disable=R0201
def __init__(self, host, args, parse, expand_vars):
self.host = host
self.args = args
self.parse = parse
self.expand_vars = expand_vars
... |
from collections import defaultdict
import networkx
import logging
import simuvex
import claripy
import angr
from .exit_wrapper import SimExitWrapper
from .cfg_base import CFGBase
l = logging.getLogger(name="angr.cfg")
# The maximum tracing times of a basic block before we widen the results
MAX_TRACING_TIMES = 1
c... |
#!/usr/local/bin/python
import sys
import json
import cgi
import re
import numpy #used for smoothing.
import copy
import decimal
import MySQLdb
"""
#There are 'fast' and 'full' tables for books and words;
#that's so memory tables can be used in certain cases for fast, hashed matching, but longer form data (like book ... |
"""This client generates a similarity graph from features in PE Files."""
import zerorpc
import os
import workbench_client
def add_it(workbench, file_list, labels):
"""Add the given file_list to workbench as samples, also add them as nodes.
Args:
workbench: Instance of Workbench Client.
file_... |
#!/usr/bin/env python
import os
import robot
from robot.result.jsparser import create_datamodel_from
BASEDIR = os.path.dirname(__file__)
TESTDATA = os.path.join(BASEDIR, 'dir.suite')
OUTPUT = os.path.join(BASEDIR, 'output.xml')
TARGET = os.path.join(BASEDIR, 'data.js')
if __name__ == '__main__':
robot.run(TESTDA... |
"""
SQLAlchemy-JSONAPI
Colton J. Provias - cj@coltonprovias.com
http://github.com/coltonprovias/sqlalchemy-jsonapi
"""
from sqlalchemy.orm.base import MANYTOONE
class JSONAPIMixin:
_jsonapi_converters = {}
def _inflector(self, to_inflect):
"""
Override this to change the formatting of the k... |
"""Specify the SqueezeDet architecture in MXNet"""
import mxnet as mx
import mxnet.ndarray as nd
import mxnet.symbol as sym
import numpy as np
from .constants import NUM_OUT_CHANNELS
from .constants import ANCHORS_PER_GRID
from .constants import NUM_CLASSES
from .constants import NUM_BBOX_ATTRS
from .utils import batc... |
import pyqtgraph.parametertree.parameterTypes as pTypes
from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType
params = [
{'name': 'Connection', 'type': 'group', 'children': [
{'name': 'Host', 'type': 'str'},
{'name': 'Port', 'type': 'str'},
{'nam... |
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
import os
from os.path import exists
from tempfile import mkdtemp
import django_dynamic_fixture as fixture
import pytest
import six
from django.contrib.auth.models import User
from mock imp... |
"""
Title: Writing a training loop from scratch
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2019/03/01
Last modified: 2020/04/15
Description: Complete guide to writing low-level training & evaluation loops.
"""
"""
## Setup
"""
import tensorflow as tf
from tensorflow import keras
from tensorflow.ker... |
"""
Database_setup.py
* programmed by Guillaume Simler
* sets up the database
"""
"""
I. Import & Initialization
"""
from sqlalchemy import Column, ForeignKey, Integer, String, Text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy impor... |
""" Class Research and auxiliary classes for multiple experiments. """
import os
from copy import copy, deepcopy
from collections import OrderedDict
from math import ceil
import json
import warnings
import dill
from .. import Config, Pipeline
from .distributor import Distributor
from .workers import PipelineWorker
fr... |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from .comm... |
"""Computes activation for the given class, neurons, or channels of a CNN.
CNN = convolutional neural network
"""
import os.path
import argparse
import numpy
from keras import backend as K
from gewittergefahr.gg_utils import general_utils
from gewittergefahr.gg_utils import time_conversion
from gewittergefahr.gg_util... |
"""The Tesla Powerwall integration."""
from __future__ import annotations
import contextlib
from datetime import timedelta
import logging
import requests
from tesla_powerwall import (
AccessDeniedError,
APIError,
MissingAttributeError,
Powerwall,
PowerwallError,
PowerwallUnreachableError,
)
f... |
import json
from uuid import uuid4
class Request(object):
"""
Representation of an HTTP request.
"""
def __init__(self, method, path, body=None, headers=None):
self.method = method
self.path = path
self.body = body
self.headers = headers if headers is not None else {}
... |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... |
import itertools
import types
from numbers import Number
from itertools import groupby
from functools import partial
from contextlib import contextmanager
import numpy as np
import param
from . import traversal, util
from .dimension import OrderedDict, Dimension, ViewableElement, redim
from .layout import Layout, Adj... |
from math import atan2, floor, tau
import numpy as np
from numpy import exp
from scipy.optimize import newton
class SpiralMap:
# Use a complex representation internally for simplicity
def __init__(self, omega, c):
self.omega = omega
self.c = c
def encode_complex(self, s):
return se... |
import logging
from pymongo import MongoClient
from django.conf import settings
from .untappd import UntappdApi
logger = logging.getLogger(__name__)
def fetch(suburb='Northcote'):
untappd = UntappdApi(
settings.HARVEST_UNTAPPD_CLIENT_ENDPOINT,
client_id = settings.HARVEST_UNTAPPD_CLIENT_ID,
... |
import os
import heapq
import rdflib
from rdflib import URIRef
from rdflib import Graph
from django.contrib.auth.models import User
from django.core.files.uploadedfile import UploadedFile
from django.db import IntegrityError
from hs_core.hydroshare.utils import get_resource_types
from hs_core.hydroshare.date_util im... |
"""Models for Hydra Classes."""
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
import os
# engine = create_engine('sqlite:///database.db')
POSTGRES_IP = os.environ.get("POSTGRES_1_PORT_5432_TCP_ADDR", 'localhost')... |
######
# Class for Menus
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
class cnxMenu:
menuitems = []
# Function to add menuitems
d... |
'''
Pure-python parsing backend.
'''
from decimal import Decimal
import re
from codecs import unicode_escape_decode
from ijson import common
from ijson.compat import b2s
BUFSIZE = 16 * 1024
NONWS = re.compile(r'\S')
LEXTERM = re.compile(r'[^a-z0-9\.-]')
class UnexpectedSymbol(common.JSONError):
def __init__(s... |
from imhotep.tools import Tool
import os
import re
class PyLint(Tool):
response_format = re.compile(r'(?P<filename>.*):(?P<line_num>\d+):'
'(?P<message>.*)')
pylintrc_filename = '.pylintrc'
def get_file_extensions(self):
return ['.py']
def process_line(self, d... |
import json
from redis import StrictRedis, BlockingConnectionPool
from inbox.config import config
from nylas.logging import get_logger
log = get_logger()
REDIS_HOSTNAME = config.get('NOTIFY_QUEUE_REDIS_HOSTNAME')
REDIS_PORT = int(config.get('NOTIFY_QUEUE_REDIS_PORT', 6379))
REDIS_DB = int(config.get('NOTIFY_QUEUE_REDI... |
#!/usr/bin/python2.4
#
# Copyright (c) 2006-2007 rPath, Inc.
#
# All rights reserved
#
import testsuite
testsuite.setup()
import os
import simplejson
import sha
import StringIO
import tempfile
import time
import xmlrpclib
import jobslave_helper
from jobslave import buildtypes
from jobslave import slave
from jobslav... |
# Singleton for dealing with the backend
from contextlib import contextmanager
from os import path
from collections import namedtuple
class AbstractDatabase(object):
# TODO: Add overrides for this in the settings
def __init__(self, sqlpath='schema'):
self.sqlpath = sqlpath
def reinitialize(self):
... |
# coding=utf-8
from __future__ import print_function
import calendar
import datetime, time
import hashlib
import pytz
import dateutil.parser
import httplib2
import json
from googleapiclient import discovery
from collections import namedtuple
import os
from infounibot.google_api import get_credentials
class CalendarR... |
#!/usr/bin/env python
import csv
import ctypes
import glob
import serial
import sys
import time
from struct import *
c_uint8 = ctypes.c_uint8
class B27Flags_bits(ctypes.LittleEndianStructure):
_fields_ = [
("gp_switch", c_uint8, 1),
("tap_switch", c_uint8, 1),
("roomtherm", c_... |
# -*- coding: utf-8 -*-
from bson import ObjectId
import eve
import json
import copy
from eve import Eve
from eve.tests import TestBase
from eve import STATUS, STATUS_OK, ISSUES, ETAG
from eve.tests.test_settings import MONGO_DBNAME
from bson.objectid import ObjectId
class TestVersioningBase(TestBase):
def setUp... |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from posterior import Posterior
from ...util.linalg import mdot, jitchol, backsub_both_sides, tdot, dtrtrs, dtrtri, dpotri, dpotrs, symmetrify
from ...util import diag
from ...core.parameterization.variatio... |
import csv
from contextlib import contextmanager
import datetime
import os
import shutil
import tempfile
from zipfile import ZipFile, ZIP_DEFLATED
from ichnaea.backup.s3 import S3Backend, compute_hash
from ichnaea.models import (
CellMeasure,
MEASURE_TYPE,
MeasureBlock,
WifiMeasure,
)
from ichnaea.task... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.