gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy import stats
from itertools import product
from mytstats import tstatistic
from skbio.stats import composition
from skbio.stats.composition import clr, multiplicative_replacement
__all__ = ['otuLogRatios',
'ancom',
'g... | |
# tangerine.py
# Contact: Jacob Schreiber
# [email protected]
import sys, time, collections, hashlib, uuid, json
import itertools as it
from pomegranate import *
encrypt = lambda x: hashlib.sha512( x ).hexdigest()
def gen():
for i in [1, 2, 3]:
yield i
GENERATOR = gen()
PAGE_LIMIT = 4096
TYPE_NAM... | |
# from django.db import models
# from django.utils.timezone import localtime
from datetime import datetime
from dateutil.relativedelta import relativedelta
from django import forms
from django.contrib.gis.db import models
from django.contrib.postgres import fields as pgmodels
from relativedeltafield import RelativeDel... | |
#!/usr/bin/env python
#
# Copyright 2014 Knowledge Economy Developments Ltd
# Copyright 2014 - 2016 David Wells
#
# Henry Gomersall
# [email protected]
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... | |
"""
This script is the first thing that runs when a Kolibri container starts and
receives as args the Kolibri command CMD, e.g., ['kolibri', 'start', '--foreground']
The purpose of this script is to perform optional 'setup tasks' before starting Kolibri.
The following environment variables are used for setup steps:
- ... | |
# Default Django settings. Override these with settings in the module
# pointed-to by the DJANGO_SETTINGS_MODULE environment variable.
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
gettext_noop = lambda s: s
#################... | |
"""
Base classes and constants for the querying subsystem.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Dec 2, 2011.
"""
from everest.entities.utils import identifier_from_slug
from everest.exceptions import MultipleResultsException
... | |
# These classes implement a doctest runner plugin for nose, a "known failure"
# error class, and a customized TestProgram for NumPy.
# Because this module imports nose directly, it should not
# be used except by nosetester.py to avoid a general NumPy
# dependency on nose.
import os
import sys
import doctest
import ins... | |
# ===============================================================================
# Copyright 2016 ross
#
# 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/LICE... | |
"""
Do windowed detection by classifying a number of images/crops at once,
optionally using the selective search window proposal method.
This implementation follows
Ross Girshick, Jeff Donahue, Trevor Darrell, Jitendra Malik.
Rich feature hierarchies for accurate object detection and semantic
segmentation.
htt... | |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Defines classes for all the resources a microvm could need attaching."""
import urllib
import re
from framework.utils import compare_versions, is_io_uring_supported, run_cmd
from framework.defs import AP... | |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Node Composer: Isolate Distributor based on ``ortools``
Clusters the components of a composition into groups according to several
criteria.
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 1.0.1
..
Copyright 2014 isandlaTech
L... | |
#
# 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 not us... | |
"""
Utilities for RHL's workshop at the DSFP, Chicago, July 2016
"""
import math, os, sys
import matplotlib.pyplot as pyplot
import numpy as np
import imageProc
try:
_mpFigures
except NameError:
_mpFigures = {0 : None} # matplotlib (actually pyplot) figures
eventHandlers = {} ... | |
import numpy as np
import sklearn.svm
import sklearn.ensemble
import sklearn.neighbors
import sklearn.decomposition
import sklearn.preprocessing
import sklearn.neural_network
import sklearn.linear_model
import sklearn.feature_extraction.text
import sklearn.naive_bayes
from hyperopt.pyll import scope, as_apply
from hype... | |
#!/usr/bin/python
# Copyright 2012 William Yu
# [email protected]
#
# 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 l... | |
# The one and only GameBot (tm)
#
# Written by SplatsCreations
# Date Written: 30th July 2009
# Email: [email protected]
#
# Uses twisted matrix from ----> http://twistedmatrix.com/
# if running on windows also needs the win32api module
# from ----> http://python.net/crew/mhammond/win32/
# but probably not if on linux ... | |
#from .model_structure import dgraphModel, dgraphTypes, dgraphUID, dgraphID, dgraphString, dgraphInt, dgraphFloat, dgraphBool, dgraphGeo, dgraphDate
from .flags_structure import dgraphFlags
from textwrap import dedent
import random
import hashlib
import time
import copy
# Generate Random
SECRET_KEY = 'CC9S5AIiEtFvqn1... | |
#
# 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... | |
"""
Functions for applying functions that act on arrays to xarray's labeled data.
"""
from __future__ import absolute_import, division, print_function
from distutils.version import LooseVersion
import functools
import itertools
import operator
from collections import Counter
import numpy as np
from . import duck_arra... | |
# ******************************************************************************
# Copyright 2017-2018 Intel 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.apa... | |
# Copyright 2012 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 or agreed to in... | |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | |
"""An abstract class for entities."""
from abc import ABC
import asyncio
from datetime import datetime, timedelta
import functools as ft
import logging
from timeit import default_timer as timer
from typing import Any, Awaitable, Dict, Iterable, List, Optional
from homeassistant.config import DATA_CUSTOMIZE
from homeas... | |
#!/usr/bin/env python
"""
Copyright (c) 2019 Alex Forencich
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, merg... | |
"""
This module implements a faster canvas for plotting.
it ovewrites some matplolib methods to allow printing on sys.platform=='win32'
"""
import wx
import sys
import logging
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.backend_bases import MouseEvent, RendererBase
from matplotlib.ba... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# Copyright 2011 Justin Santa Barbara
# 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... | |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | |
"""Manages Placeholders for Graph convolution networks.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import numpy as np
imp... | |
# Copyright (c) 2010-2011 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 or agree... | |
# 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 agreed to in... | |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
connection = db._get_connection()
cursor = connection.cursor()
try:
cursor.execute('sele... | |
# Copyright (c) 2016 Dell Inc. or its subsidiaries.
# 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 requi... | |
"""
General utility functions.
"""
import json
from pathlib import Path
from typing import Callable
import numpy as np
import talib
from .object import BarData, TickData
from .constant import Exchange, Interval
def extract_vt_symbol(vt_symbol: str):
"""
:return: (symbol, exchange)
"""
symbol, excha... | |
#! /usr/bin/env python
"""Test the arraymodule.
Roger E. Masse
"""
import unittest
from test import test_support
from weakref import proxy
import array, cStringIO
from cPickle import loads, dumps
class ArraySubclass(array.array):
pass
class ArraySubclassWithKwargs(array.array):
def __init__(self, typecode... | |
from __future__ import unicode_literals
import collections
import datetime
import decimal
import functools
import math
import types
import uuid
from importlib import import_module
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.utils import COMPILED_RE... | |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import hashlib
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary_h... | |
from __future__ import absolute_import
import re
import six
import logging
from collections import namedtuple
from django.core.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from symbolic import parse_addr, arch_from_breakpad, arch_from_macho, arch_is_known, ProcessState, id_from_breakpad
from... | |
#
# 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
# ... | |
# pylint: disable=wrong-or-nonexistent-copyright-notice
import itertools
import math
from unittest import mock
import numpy as np
import pytest
import sympy
import cirq
import cirq.contrib.quimb as ccq
import cirq.experiments.google_v2_supremacy_circuit as supremacy_v2
import cirq.testing
from cirq import value
def... | |
# Copyright 2019 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... | |
# -*- coding: utf-8 -*-
'''
watdo.model
~~~~~~~~~~~
This module provides datastructures to represent and helper functions to
access data on the filesystem.
:copyright: (c) 2013 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
import datetime
import os
from atomicwrites im... | |
import re
import codecs
import ConfigParser
import os
local_first_URL = u'G:/visual.merriam-webster.com/animal-kingdom/flying-mammal/examples-bats.php.htm'
#note for the "/" , is defferent from the "\" in the original web url, or you will make a mistake
local_current_URL = local_first_URL
lo... | |
import logging
import socket
import re
import gevent
from StringIO import StringIO
from six.moves import urllib_parse as urlparse
from cachebrowser.models import Host
from cachebrowser.network import ConnectionHandler
from cachebrowser.common import silent_fail
from cachebrowser import http
from cachebrowser import dn... | |
#
# 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 not... | |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Script to plot tasks from profiling data.
This script requires the matplotlib and numpy Python modules.
"""
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import glob
import os
import sys
import numpy # pylint: disable... | |
#!/usr/bin/env python
'''
Model code for managing rectangular and hexagonal maps
======================================================
This module provides classes for managing rectangular and hexagonal maps.
---------------
Getting Started
---------------
You may create a map interactively and query it:
TBD
'''... | |
# -*- coding: utf-8 -*-
from bson import ObjectId
import eve
import json
from eve import Eve
from eve.auth import BasicAuth, TokenAuth, HMACAuth
from eve.tests import TestBase
from eve.tests.test_settings import MONGO_DBNAME
class ValidBasicAuth(BasicAuth):
def __init__(self):
self.request_auth_value = '... | |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | |
# Copyright 2019 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... | |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as pl
import pyiacsun as ps
from ipdb import set_trace as stop
import scipy.linalg as sl
import scipy.special as sp
import scipy.optimize as op
import scipy.io as io
import waveletTrans as wl
import seaborn as sn
def softThrShifted(a, b,... | |
###############################################################################
# The MIT License (MIT)
# Copyright (c) 2007-2016 Roman Rodyakin
#
# 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 Softw... | |
from unittest import TestCase
from graphql.ast import Argument, Document, Field, FragmentDefinition, \
FragmentSpread, Mutation, NamedType, NonNullType, Query, Subscription, \
Variable, VariableDefinition
from graphql.parser import GraphQLParser
class GraphQLParseTest(TestCase):
parser = GraphQLParser()
... | |
# Licensed under an MIT open source license - see LICENSE
import numpy as np
import scipy.ndimage as nd
from length import *
import matplotlib.pyplot as p
import copy
def isolateregions(binary_array, size_threshold=0, pad_size=5,
fill_hole=False, rel_size=0.1, morph_smooth=False):
'''
Lab... | |
#!/usr/bin/python
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
#!/usr/bin/python
#
# Copyright 2011 Google 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
#... | |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
import os
import pkg_resources
import sys
if sys.version_info < (2, 4):
from paste.script.util import string24 as string
else:
import string
im... | |
### IMPORTS ###
import OAuth2Util
import praw
import re
import sys
import threading
import time
import traceback
from wordnik import *
from datetime import datetime
### CLASS ###
class Define_It:
def __init__(self, reddit, footer='', sidebar='', username='', subreddit='', api_file='define_it.conf'):
self._r = reddi... | |
'''
Created on May 14, 2020
This file is subject to the terms and conditions defined in the
file 'LICENSE.txt', which is part of this source code package.
@author: David Moss
'''
from intelligence.intelligence import Intelligence
# Variable name for tracking people
AMPLITUDE_USER_PROPERTIES_VARIABLE_NAME = "amplitu... | |
# 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 ... | |
# Copyright 2020 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.
import json
import logging
from blinkpy.common.host_mock import MockHost
from blinkpy.common.net.git_cl import TryJobStatus
from blinkpy.common.net.git_cl_m... | |
"""
SMARTctl - command ``/sbin/smartctl -a {device}``
=================================================
"""
from insights.core import Parser
from insights.core.plugins import parser
from insights.parsers import ParseException
import re
from insights.specs import smartctl
@parser(smartctl)
class SMARTctl(Parser):
... | |
"""Test service helpers."""
from collections import OrderedDict
from copy import deepcopy
import unittest
from unittest.mock import AsyncMock, Mock, patch
import pytest
import voluptuous as vol
# To prevent circular import when running just this file
from homeassistant import core as ha, exceptions
from homeassistant... | |
"""Copyright (c) 2010-2012 David Rio Vierra
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WA... | |
from common_fixtures import * # NOQA
from test_services_sidekick \
import create_env_with_sidekick, validate_sidekick, validate_dns
logger = logging.getLogger(__name__)
def create_environment_with_services(
super_client, client, service_scale, consumed_service_scale, port,
ssh_port="22", isnetwo... | |
##===-- lldbutil.py ------------------------------------------*- Python -*-===##
##
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
##
##===------------------------------... | |
# -*- coding: utf-8 -*-
r"""
The :mod:`pygsp.reduction` module implements functionalities for the reduction
of graphs' vertex set while keeping the graph structure.
.. autosummary::
tree_multiresolution
graph_multiresolution
kron_reduction
pyramid_analysis
pyramid_synthesis
interpolate
gr... | |
def renderStreet(map, street_id=0):
graph = []
street = map.streets[street_id]
# graph.append([-2 for _ in range(street.height)])
for lane in range(street.width):
row = []
for cell in range(street.height):
val = street.get((lane, cell))
row.append(-1 if val =... | |
# Copyright 2018 The TensorFlow Hub 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 app... | |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012 Caffeinated Code <caffeinatedco.de>
# Copyright (C) 2012 George Czabania
# Copyright (C) 2012 Jono Cooper
# Copyright (C) 2012 Vadim Rutkovsky
# Copyright (c) The Regents of the University of California.
# ... | |
from __future__ import absolute_import
import datetime
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import override_settings, requires_tz_support
from django.utils import timezone
from .models import Book, BookSigning
def _make... | |
"""
This module provides convenient functions to transform sympy expressions to
lambda functions which can be used to calculate numerical values very fast.
"""
from __future__ import print_function, division
import inspect
import textwrap
from sympy.core.compatibility import (exec_, is_sequence, iterable,
NotIte... | |
#!/usr/bin/python
# coding=utf8
# Copyright 2013 Joel Dunham
#
# 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 app... | |
# Copyright 2018 Microsoft 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 to in... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
sessions2trash.py
Run this script in a web2py environment shell e.g. python web2py.py -S app
If models are loaded (-M option) auth.settings.expiration is assumed
for sessions without an expiration. If models are not loaded, sessions older
than 60 minutes are removed. U... | |
"""Tests for acme.messages."""
import os
import pkg_resources
import unittest
from Crypto.PublicKey import RSA
import M2Crypto
import mock
from acme import challenges
from acme import jose
CERT = jose.ComparableX509(M2Crypto.X509.load_cert_string(
pkg_resources.resource_string(
'acme.jose', os.path.join... | |
from sympy.core.numbers import igcd
from primetest import isprime
from factor_ import factorint, trailing, totient
def int_tested(*j):
"""
Return all args as Python integers and confirm that the input
was equivalent to the integer, else raise a ValueError.
Examples
========
>>> from sympy.nth... | |
import itertools
import uuid
import pickle
from collections import namedtuple
from typing import Tuple
from math import ceil
import numpy as np
from hfetch import HNumpyStore, HArrayMetadata
from . import config, log
from .IStorage import IStorage
from .tools import extract_ks_tab, get_istorage_attrs, storage_id_fro... | |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... | |
#!/usr/bin/env python
"""
Part of the World Generator project.
author: Bret Curtis
license: LGPL v2
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the ho... | |
# Copyright 2015 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... | |
# Copyright (c) 2014 Mirantis, 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... | |
#!/usr/bin/env python
#
# 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... | |
#!/usr/bin/env python
"""Email motion-detected JPEG image.
This module captures and emails a motion-detected JPEG image from a Raspberry
Pi with a camera module. The image capture part is credited to the excellent
post https://www.raspberrypi.org/forums/viewtopic.php?t=45235, by brainflakes.
Read brainflakes' original... | |
import math
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestSoftmaxCrossEntropy(unittest.TestCase):
def s... | |
# Copyright 2017 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, ... | |
from google_time_string import GoogleTimeString
from datetime import datetime, timedelta
from google_analytics_models import GoogleAnalyticsVisitors, GoogleAnalyticsReferralsModel, GoogleAnalyticsUserModel, db, \
GoogleAnalyticsSignups, GoogleAnalyticsReturningVisitors, GoogleAnalyticsExperimentVariation, GoogleAnalyt... | |
"""
Module for abstract serializer/unserializer base classes.
"""
from django.db import models
from django.utils import six
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class SerializationError(Exception):
"""Something bad happened during serialization."""
... | |
import time
from weakref import ref as weakref
from redis import StrictRedis
from redis.exceptions import ConnectionError, TimeoutError
from rb.promise import Promise
from rb.poll import poll
def assert_open(client):
if client.closed:
raise ValueError('I/O operation on closed file')
class CommandBuff... | |
"""FlatDict is a dict object that allows for single level, delimited
key/value pair mapping of nested dictionaries.
"""
try:
from collections.abc import MutableMapping
except ImportError: # pragma: nocover
from collections import MutableMapping
import sys
__version__ = '4.0.1'
NO_DEFAULT = object()
class ... | |
# 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... | |
from collections import namedtuple
from functools import wraps
import attr
from fuzzysearch.common import FuzzySearchBase, Match, \
consolidate_overlapping_matches
from fuzzysearch.compat import xrange
from fuzzysearch.search_exact import search_exact
__all__ = [
'find_near_matches_generic',
'find_near_... | |
#!/usr/bin/python
#
# texture_atlas_builder.py
# CSPong
# Created by Scott Downie on 30/06/2014.
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Tag Games Limited
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software... | |
from sita.core.api.viewsets import GenericViewSet
from rest_framework import status
from sita.api.v1.routers import router
from sita.core.api.viewsets.nested import NestedViewset
from rest_framework.permissions import IsAuthenticated
from .serializers import AppointmentSerializer, AppointmentSerializerModel, Appointmen... | |
from __future__ import unicode_literals
import functools
import sys
import tablib
import traceback
from copy import deepcopy
from diff_match_patch import diff_match_patch
from django import VERSION
from django.conf import settings
from django.core.management.color import no_style
from django.db import connections, t... | |
# $Id: io.py 8129 2017-06-27 14:55:22Z grubert $
# Author: David Goodger <[email protected]>
# Copyright: This module has been placed in the public domain.
"""
I/O classes provide a uniform API for low-level input and output. Subclasses
exist for a variety of input/output mechanisms.
"""
__docformat__ = 'reStructur... | |
from __future__ import unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericStackedInline
from django.core import checks
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, ignore_warnings, override_setting... | |
# Tests `interval.py`.
# Copyright (c) 2018 Aubrey Barnard. This is free software. See
# LICENSE for details.
import datetime
import unittest
from ..interval import AllenRelation, Interval, CompoundInterval
class AllenRelationTest(unittest.TestCase):
def test_inverse(self):
self.assertEqual(AllenRel... | |
import unittest
from w3lib.encoding import resolve_encoding
from scrapy.http import Request, Response, TextResponse, HtmlResponse, XmlResponse, Headers
from scrapy.selector import Selector
class BaseResponseTest(unittest.TestCase):
response_class = Response
def test_init(self):
# Response requires ... | |
import unittest
class TestZmqpy(unittest.TestCase):
def test_import_zmqpy(self):
try:
import zmqpy
from zmqpy import Context, Socket
except ImportError as ie:
self.fail(ie.message)
class TestContext(unittest.TestCase):
def tearDown(self):
from zmqpy ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.