gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
"""This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import logging
import math
import matplotlib
import matplotlib.pyplot as pyplot
... | |
# hybrid_lda.py
# Implementation of LDA-based hybrid metric learning
# Author: Brian D. Bue (bbue@rice.edu)
# Last modified: 5/14/12
#
# If you use this code in a publication, please cite the following paper:
# B. Bue and E. Merenyi, "An Adaptive Similarity Measure for Classification
# of Hyperspectral Signatures," IEE... | |
"""Support for Radio Thermostat wifi-enabled home thermostats."""
import logging
from socket import timeout
import radiotherm
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_COOL,
CURRENT_HVA... | |
# 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 (t... | |
"MAPI attribute definitions"
import logging
from util import bytes_to_int
logging.basicConfig()
logger = logging.getLogger("mapi-decode")
SZMAPI_UNSPECIFIED = 0x0000 # MAPI Unspecified
SZMAPI_NULL = 0x0001 # MAPI null property
SZMAPI_SHORT = 0x0002 # MAPI short (signed 16 bits)
SZMAPI_INT ... | |
import sys
import pprint
pp = pprint.PrettyPrinter();
import pymongo
from pymongo import MongoClient
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 12 20:30:54 2016
@author: ryanlim, jpitts
Requirements:
- pymongo needs to be installed
- mongodb needs to be running
- brigade-match... | |
"""The tests for the logbook component."""
# pylint: disable=protected-access,too-many-public-methods
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.components import sun
import homeassistant.core as ha
from homeassistant.const import (
EVENT_STATE_CHANGED, EVENT_... | |
import unittest
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import pandas as pd
import os
from subprocess import call
# Prep for Oracle and MySQL database connection
# http://stackoverflow.com/questions/10065051/python-pandas-and-databases-like-mysql
# import cx_Oracle
# import MySQLdb
... | |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Database Module
# --------------------
from __future__ import unicode_literals
import MySQLdb
from markdown2 import UnicodeWithAttrs
import warnings
import datetime
import frappe
import re
import frappe.model.meta... | |
"""
Python module for the basis of free-electron laser calculation.
"""
from __future__ import print_function
import numpy as np
import scipy.special as sp
from scipy.optimize import fsolve
class PhysicalConstants(object):
"""Physical constants
:param c0: :math:`c_0`, velocity of light in vacuum
:param... | |
# Requirements:
# - Python version late enough to support argparse (2.7+ or 3.2+)
# - Pillow 2.7+
# - Windows note: may need to install using easy_install instead of pip
# - Linux note: may need to install the libraries for any image
# format(s) you'll use, such as libpng and zlib for PNG
import datetime
impor... | |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | |
#! usr/bin/env python3
"""
I intend this to be a crytanalysis suite that can analyze an arbitrary
ciphertext and provide details on what the encryption method might be,
what the key might look like, and/or a potential cipher text solution.
"""
ORIGINAL_CIPHERTEXT = "\
NAGQNXIIZAGBGIIYXQOMQUGQUZAXTNGMYXQGTTASNISQO\
AM... | |
# Copyright 2015 IBM Corp.
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | |
# Lint as: python3
# 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 ... | |
#
# Core modules and methods
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import numpy as np
import pints
class ForwardModel(object):
"""
Defines an inte... | |
from collections import defaultdict
import pymongo
from bson import SON
from mongoengine.base.fields import UPDATE_OPERATORS
from mongoengine.connection import get_connection
from mongoengine.common import _import_class
from mongoengine.errors import InvalidQueryError
from mongoengine.python_support import IS_PYMONGO... | |
#!/usr/bin/env python
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import os
import re
import sys
from xml.dom import minidom
import appdirs
import multimap
try:
from configparser import ConfigParser
except:
from ConfigParser import SafeConfigParser as ConfigParse... | |
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import GLib
try:
from kismon.client import decode_cryptset
import kismon.utils as utils
except ImportError:
from client import decode_cryptset
import utils
class NetworkList:
def __init__(self, netwo... | |
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
import sys
import cv2
import math
class ClassifyEnv(gym.Env):
def __init__(self, trainSet, target, batch_size=1000, accuracy_mode=False):
"""
Data set is a tuple of
[0] input data: [nSamples x... | |
# -*- coding: utf-8 -*-
import json
import logging
import os
import signal
from unittest.mock import patch, call, Mock, MagicMock
import requests
import requests_mock
from django.conf import settings
from django.test import TestCase
from django.utils import timezone
from eventkit_cloud.tasks.enumerations import Task... | |
import re
from math import ceil
from vusion.error import MissingField, VusionError, InvalidField, MissingData
from vusion.persist import Model
from vusion.persist.participant.participant import Participant
from vusion.const import TAG_REGEX, LABEL_REGEX
from vusion.utils import clean_phone
from vumi.log import log
c... | |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | |
import numpy as np
import regimes as REGI
import user_output as USER
import multiprocessing as mp
import scipy.sparse as SP
from utils import sphstack, set_warn, RegressionProps_basic, spdot, sphstack
from twosls import BaseTSLS
from robust import hac_multi
import summary_output as SUMMARY
from platform import system
... | |
from numpy.testing import (assert_, assert_allclose, run_module_suite,
assert_equal)
import numpy as np
import pandas as pd
from pyins.filt import (InertialSensor, LatLonObs, VeVnObs, propagate_errors,
FeedforwardFilter, FeedbackFilter, traj_diff,
... | |
# Copyright 2013 Netherlands eScience Center
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | |
"""Support for ZHA covers."""
from __future__ import annotations
import asyncio
import functools
import logging
from zigpy.zcl.foundation import Status
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION,
ATTR_POSITION,
CoverDeviceClass,
CoverEntity,
)
from homeassistant.config_entries... | |
# 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... | |
from urllib.parse import urlparse, parse_qsl
from .log import logger
_NOTSET = object()
# NOTE: never put here anything else;
# just this basic types
_converters = {
bytes: lambda val: val,
bytearray: lambda val: val,
str: lambda val: val.encode(),
int: lambda val: b'%d' % val,
float: lamb... | |
# encoding: utf-8
"""
utils.py
Created by Thomas Mangin on 2009-09-06.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
import os
import sys
import stat
import time
import syslog
import logging
import logging.handlers
from exabgp.configuration.environment import environment
_short = {
'CRITICAL': 'CR... | |
# Copyright 2017 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... | |
import os
import twisted
import six
from twisted.trial import unittest
from twisted.protocols.policies import WrappingFactory
from twisted.python.filepath import FilePath
from twisted.internet import reactor, defer, error
from twisted.web import server, static, util, resource
from twisted.web.test.test_webclient impor... | |
import carmunk
import numpy as np
import random
import csv
from nn import neural_net, LossHistory
import os.path
import timeit
NUM_INPUT = 3
GAMMA = 0.9 # Forgetting.
TUNING = False # If False, just use arbitrary, pre-selected params.
def train_net(model, params):
filename = params_to_filename(params)
observe ... | |
"""Test the helper method for writing tests."""
import asyncio
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from unittest.mock import M... | |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
# OCSP request/response syntax
#
# Derived from a minimal OCSP library (RFC2560) code written by
# Bud P. Bruegger <bud@ancitel.it>
# Copyright: Ancitel, S... | |
'''iPhoto database: reads iPhoto database and parses it into albums and images.
@author: tsporkert@gmail.com
This class reads iPhoto image, event, album information from the file
AlbumData.xml in the iPhoto library directory. That file is written by iPhoto
for the media browser in other applications. All data are
org... | |
# coding: utf-8
"""Library with training routines of LightGBM."""
import collections
import copy
from operator import attrgetter
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import numpy as np
from . import callback
from .basic import (Booster, Dataset, LightGBMError, ... | |
# Copyright 2016 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, unicode_literals
from future.builtins import input, int
from optparse import make_option
try:
from urllib.parse import urlparse
except:
from urlparse import urlparse
from django.contrib.auth import get_user_model
from django.contrib.redirects.models import Redirect
from d... | |
#!/usr/bin/env python3
"""Fetch alerting and aggregation rules from provided urls into this chart."""
import textwrap
from os import makedirs
import requests
import yaml
from yaml.representer import SafeRepresenter
# https://stackoverflow.com/a/20863889/961092
class LiteralStr(str):
pass
def change_style(style... | |
"""
**Factory** provides convenient way to train several classifiers on the same dataset.
These classifiers can be trained one-by-one in a single thread, or simultaneously
with IPython cluster or in several threads.
Also `Factory` allows comparison of several classifiers (predictions of which can be used in parallel).... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | |
import bcrypt
import psycopg2
import psycopg2.extras
##Database Exceptional Class##
class invalidQueryException(Exception): pass
##Basic Connection Class for Database##
class database:
def __init__(self):
self.__HOST = "myawsdatabase.c7mfxxgrjakk.ap-southeast-1.rds.amazonaws.com"
#self.__HOST = "l... | |
""" XVM (c) www.modxvm.com 2013-2017 """
__all__ = ['start', 'stop', 'call']
# PUBLIC
import os
import threading
import simplejson
import traceback
import uuid
import BigWorld
from gui.shared import g_eventBus, events
import pika
from pika import exceptions as pika_exceptions
from xfw import *
from xvm_main.pyth... | |
import unittest
import time
import datetime
import json
import sys
#import base64
#from werkzeug.wrappers import Response
sys.path.append("..")
#from flask import current_app
#from werkzeug.datastructures import Headers
from gameevents_app import create_app
#Extensions
from gameevents_app.extensions import db, LO... | |
# Copyright 2017 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | |
import sys
sys.stdout = sys.stderr
import os
import atexit
import threading
import cherrypy
import MySQLdb
import pickle
import subprocess
from collections import OrderedDict
from datetime import datetime
from dateutil import parser
db = MySQLdb.connect(
host="127.0.0.1",
user="divvy",
passwd="keepC4LM",
db="... | |
"""Test network helper."""
from unittest.mock import Mock, patch
import pytest
from homeassistant.components import cloud
from homeassistant.config import async_process_ha_core_config
from homeassistant.core import HomeAssistant
from homeassistant.helpers.network import (
NoURLAvailableError,
_get_cloud_url,
... | |
import matplotlib
#matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from matplotlib import cm
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import cm
import cP... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
::
# from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496942
# Title: Cross-site scripting (XSS) defense
# Submitter: Josh Goldfoot (other recipes)
# Last Updated: 2006/08/05
# Version no: 1.0
"""
from htmllib import HTMLParser
from ... | |
#
# 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 json
import re
import tg
import pkg_resources
import pylons
pylons.c = pylons.tmpl_context
pylons.g = pylons.app_globals
from pylons import c
from ming.orm import ThreadLocalORMSession
from datadiff.tools import assert_equal
from allura import model as M
from allura.lib import helpers as h
from allura.tests im... | |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
from generate import generate
def add_not_null(arg_t):
return arg_t if arg_t.endswith("?") else "[NotNull] ... | |
from intervaltree import Interval, IntervalTree
import json
import logging
import mms
import os
import struct
import sys
import time
def PageAligned(x):
return ((x & 0xfff) == 0)
class AslrOracle:
def __init__(self):
self.queries = 0
self.InitCache()
def CheckAddress(self, address):
return self.Ch... | |
import sys
from pytest import raises
if sys.version_info >= (3, 8):
from unittest.mock import AsyncMock
else:
from asynctest.mock import CoroutineMock as AsyncMock
from unittest.mock import Mock, call
import pytest
from baby_steps import given, then, when
from vedro import Scenario
from vedro.core import D... | |
"""
Provides generic filtering backends that can be used to filter the results
returned by list views.
"""
from __future__ import unicode_literals
import operator
from functools import reduce
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.constants import LO... | |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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 r... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# Copyright (c) 2013 Hewlett-Pa... | |
# Copyright (c) 2014 Huawei Technologies Co., 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
#
# ... | |
from __future__ import print_function
import numpy as np
import scipy.sparse as sp
import warnings
from abc import ABCMeta, abstractmethod
from . import libsvm, liblinear
from . import libsvm_sparse
from ..base import BaseEstimator, ClassifierMixin, ChangedBehaviorWarning
from ..preprocessing import LabelEncoder
from... | |
import os
import sys
import re
import zipfile
import urllib2
import shutil
import string
import imp
import time
import urllib
import yaml
from play.utils import *
NM = ['new-module', 'nm']
LM = ['list-modules', 'lm']
BM = ['build-module', 'bm']
AM = ['add']
IM = ['install']
COMMANDS = NM + LM + BM + IM + AM
HELP = ... | |
'''
Created on Oct 4, 2016
@author: Marc Pucci
'''
# TODO
# This library was initially common to gen_test and tmgr/tnode.
# it split when I separated configuration from test
# they need to become common again
import json
import collections
# host is specified as either name:port or /tmp/socket. In the latter case,... | |
"""
Experimental trash, and jet set.
A ndb.tasklet-style interface to waterf.queue
::
from waterf import snake
def A(data):
rv = yield snake.task(other_func, data)
rv2 = yield (
snake.task(B, rv),
snake.task(C)
)
raise snake.Return(rv2)
snake.tas... | |
import re
import random
from jinja2 import Template
tmpls = [
"<WOWPHRASE><INFOSRC> {{subj_prop}} is {{real_prop_val}}<QP> <SWORNPHRASE>it was {{alt_prop_val}}<QP>",
"<PFFTORNOT>Don't <BUY> <ORG>'s <LIES>. {{ucfirst(subj_prop)}} is {{alt_prop_val}}, not {{real_prop_val}}<WOWPUNC><SHEEPLE>",
"<PFFTORNOT>... | |
from pkg_resources import resource_filename
from pyramid.events import (
BeforeRender,
subscriber,
)
from pyramid.httpexceptions import (
HTTPMovedPermanently,
HTTPPreconditionFailed,
HTTPUnauthorized,
HTTPUnsupportedMediaType,
)
from pyramid.security import forget
from pyramid.settings import a... | |
#!/usr/bin/env python
__author__ = "Gawen Arab"
__copyright__ = "Copyright 2012, Gawen Arab"
__credits__ = ["Gawen Arab"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Gawen Arab"
__email__ = "gawen@forgetbox.com"
__status__ = "Beta"
import BeautifulSoup
import datetime
import email.utils
import errno
imp... | |
import unittest
import subprocess
import json
import os
import util
import time
from TestConfig import *
config = {}
test_env = os.getenv('test_env', 'aiaas')
env_setup = TestConfig()
config = env_setup.setEnvironment(test_env)
cli = os.path.abspath('./pb-cli/index.js')
class TestPBUpload(unittest.TestCase):
@cl... | |
'''
Created on Jan 18, 2016
@author: Marc Pucci (Vencore Labs)
'''
'''
Convert simple description into json policy definitions
participants are labeled from 'a' ... and correspond to 1 ...
ports (C1, C2) correspond to 0, 1, ... are router connections from name C1
create file with name 'participant_#.py where number... | |
import abc
import copy
import logging
import time
import six
import kafka.common as Errors
from kafka.future import Future
from kafka.protocol.commit import (GroupCoordinatorRequest,
OffsetCommitRequest_v2 as OffsetCommitRequest)
from kafka.protocol.group import (HeartbeatRequest, J... | |
""" discover and run doctests in modules and test files."""
from __future__ import absolute_import
import traceback
import pytest
from _pytest._code.code import TerminalRepr, ReprFileLocation, ExceptionInfo
from _pytest.python import FixtureRequest
def pytest_addoption(parser):
parser.addini('doctest_optionfla... | |
#
# Copyright (c) SAS Institute 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 w... | |
from collections import OrderedDict, defaultdict, namedtuple
from cbmonitor import models
Observable = namedtuple(
"Observable", ["cluster", "server", "bucket", "index", "name", "collector"]
)
class Report(object):
"""Provide all existing observables that meet following requirements:
-- observable is ... | |
from functools import partial
from urlparse import urlparse
import logging
import json
from types import GeneratorType
from rdflib import URIRef, Graph, RDF
from oldman.exception import OMUnauthorizedTypeChangeError, OMInternalError, OMUserError
from oldman.exception import OMAttributeAccessError, OMUniquenessError, OM... | |
cnfClass = None
class Variable(object):
def __init__(self, name, inverted=False):
self.name = name
self.inverted = inverted
def __neg__(self):
v = Variable(self.name)
v.inverted = not self.inverted
return v
def __and__(self, other):
c = cnfClass.create_from... | |
import os
import json
import zipfile
import hashlib
import requests
import backoff
from zipfile import ZipFile
from io import BytesIO
class pycritsFetchError(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class pycrits(object):
_API... | |
import json
import nbformat
from pathlib import Path
from subprocess import CalledProcessError
from unittest.mock import patch
import pytest
import tornado
from jupyterlab_git.git import Git
from .testutils import maybe_future
@pytest.mark.asyncio
async def test_changed_files_invalid_input():
with pytest.raise... | |
from django.db import models
from wsgiref.handlers import format_date_time
import time
from authz_group.authz_implementation.solstice import (
SolsticeCrowdImplementation)
from django.conf import settings
class Person(models.Model):
person_id = models.AutoField(primary_key=True, db_column='person_id')
log... | |
import logging
import sys
import os
import socket
import re
import xmlrpclib
from time import sleep
from urlparse import urlparse
from flexget.utils.template import RenderError
from flexget.utils.pathscrub import pathscrub
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
from... | |
# Copyright 2017 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... | |
import datetime
import hashlib
import urllib
import time
import collections
import urlparse
import requests
from django import http
from django.conf import settings
from django.contrib.sites.requests import RequestSite
from django.shortcuts import get_object_or_404, redirect, render
from django.core.cache import cach... | |
# // Copyright (c) <2014> <Brian Wheatman>
from collections import Counter
import random
import copy
# the basic task
class Task():
def __init__(self, set_inputs, inputs_to_output, set_up_time, processing_time,\
output, output_a_round, items_waiting , items_done, in_set_up, counter , on_off , bro... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nicira Networks, Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | |
# -*- coding:utf8 -*-
# File : cnn.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 12/30/16
#
# This file is part of TensorArtist.
from ._defaults import __default_dtype__, __default_nonlin__
from .helper import as_varnode, get_4dshape, get_2dshape, wrap_varnode_func, wrap_force_named_op, Static... | |
# coding=utf-8
import json
import config
import requests
get_headers = {
'app_version': '6.9.4',
'platform': 'ios',
"User-agent": "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)",
"Accept": "application/json"
}
headers = get_headers.copy()
headers['content-type'] = "application/json"
def get_auth_toke... | |
"""Support for PlayStation 4 consoles."""
import logging
import os
from pyps4_2ndscreen.ddp import async_create_ddp_endpoint
from pyps4_2ndscreen.media_art import COUNTRIES
import voluptuous as vol
from homeassistant.components.media_player.const import (
ATTR_MEDIA_CONTENT_TYPE,
ATTR_MEDIA_TITLE,
MEDIA_T... | |
# don't need to care about the first 3 lines (just some configuration for ipython notebook)
import matplotlib
matplotlib.use('Agg')
from __future__ import print_function, division, absolute_import
import os
help(os)
import numpy as np
import matplotlib.pyplot as plt
## List
X = [1, 2, 3, 4]
print('Access list eleme... | |
"""
This module handles the connections of the server.
Attributes:
receiver_running (bool): Flag to kill the receiver thread
"""
import socket
import threading
import logging
import select
import cStringIO as StringIO
import protocol
import protocol.thread
from utils import handle_except
receiver_running = True... | |
from __future__ import absolute_import
import copy
import pytest
from six.moves import xrange
from bokeh.core.properties import List, String, Instance, Dict, Any, Int
from bokeh.model import Model
from bokeh.core.property.wrappers import PropertyValueList, PropertyValueDict
from bokeh.util.future import with_metacla... | |
# Copyright 2013 Mark Dickinson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | |
# Copyright 2009-2015 MongoDB, 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 writin... | |
# 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 2013 IBM Corp.
# 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... | |
import os, sys
import csv
import svgwrite
import svggraph
from collections import namedtuple
from datetime import datetime, timedelta
from time import mktime
def float_xrange(start, stop, step):
c = start
while c < stop:
yield c
c += step
RowType = namedtuple('RowType', ('buildid', 'users', 'c... | |
"""Role(s) API"""
from flask import Blueprint, abort, jsonify, request
from ..database import db
from ..extensions import oauth
from ..models.role import Role
from ..models.user import current_user, get_user
from .crossdomain import crossdomain
role_api = Blueprint('role_api', __name__)
@role_api.route('/api/roles'... | |
# -*- 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):
# Adding model 'LostPasswordHash'
db.create_table('sentry_lostpasswordhash', (
('id', self.gf('d... | |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | |
#!/usr/bin/env python
import csv
import datetime
import os
from struct import pack
import sys
import warnings
from fitparse import FitFile
from fitparse.processors import UTC_REFERENCE, StandardUnitsDataProcessor
from fitparse.records import BASE_TYPES, Crc
from fitparse.utils import FitEOFError, FitCRCError, FitHead... | |
import errno
import os.path
from requests.exceptions import HTTPError
import cloudinary.uploader
from django.test import SimpleTestCase, override_settings
from django.core.files.base import ContentFile
from django.conf import settings
from cloudinary_storage.storage import (MediaCloudinaryStorage, ManifestCloudinaryS... | |
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Defines validation rules for configuration files.
Configurations requested with store_last_good=True are automatically validated
against rules... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.