gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import datetime
import logging
import os
import sys
import datetime
import json
from dateutil.parser import parse
import multiprocessing
import ast
import random
# cloud
from pymongo import MongoClient
# kafka
from kafka import KafkaConsumer, KafkaProducer
from kafka.errors import KafkaError
from volttron.platform.v... | |
import threading
from unittest import mock
from mopidy import backend as backend_api
import spotify
from mopidy_spotify import backend, library, playback, playlists
def get_backend(config, session_mock=None):
obj = backend.SpotifyBackend(config=config, audio=None)
if session_mock:
obj._session = ses... | |
#!/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... | |
"""Python STIX2 Memory Source/Sink"""
import io
import itertools
import json
import os
from stix2 import v20, v21
from stix2.base import _STIXBase
from stix2.datastore import DataSink, DataSource, DataStoreMixin
from stix2.datastore.filters import FilterSet, apply_common_filters
from stix2.parsing import parse
def ... | |
"""
GFA1 Serializer for nodes, edge, Subgraphs and networkx graphs.
Can serialize either one of the object from the group mentioned
before or from a dictionary with equivalent key.
"""
import copy
import logging
import networkx as nx
from pygfa.graph_element.parser import field_validator as fv
from pygfa.serializer ... | |
"""Representation of Z-Wave binary sensors."""
import logging
from typing import Callable, List, Optional, TypedDict
from zwave_js_server.client import Client as ZwaveClient
from zwave_js_server.const import CommandClass
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_... | |
#!/usr/bin/env python
#
# Copyright (c) 2014 The pblcache 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 applica... | |
import sys
import math
Pi = 3.141592653
R = 8.3144621
dt = 0.00000000001
nsElements = 5
nsLength = 1.0
Bore = 0.14
Stroke = 0.14
PortArea = Pi*(Bore/4)**2
Compression = 6.7
Gamma = 7.0/5.0
Alpha = Gamma/(Gamma-1)
airMolMass = 0.02897
portLength = 0.01
RotationRate = 1000 * 0.104719755
timeToRotate = 2*Pi * RotationRa... | |
import unittest
import logging
import sys
import datetime
from decimal import Decimal
from tigershark.facade import f835
from tigershark.parsers import M835_4010_X091_A1
class TestParsed835(unittest.TestCase):
def setUp(self):
m = M835_4010_X091_A1.parsed_835
with open('tests/835-example-2.txt')... | |
#
# Info.py -- FITS Info plugin for the Ginga fits viewer
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import gtk
import numpy
from ginga.gtkw import GtkHelp
from ... | |
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | |
import unittest
import dynetx as dn
class DynGraphTestCase(unittest.TestCase):
def test_coverage(self):
G = dn.DynGraph()
G.add_interaction(0, 1, t=0)
G.add_interaction(0, 2, t=0)
G.add_interaction(0, 1, t=1)
G.add_interaction(0, 2, t=2)
G.add_interaction(0, 3, t=2... | |
# Copyright (c) 2014 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 ... | |
# Copyright (c) 2013 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 or agreed to in writi... | |
#
# astro.py -- classes for special astronomy shapes drawn on
# ginga canvases.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import math
import numpy
from ginga.canvas.CanvasObject import (CanvasObjectBase, _bool, _color,
... | |
"""
Module to set up run time parameters for Clawpack -- AMRClaw code.
The values set in the function setrun are then written out to data files
that will be read in by the Fortran code.
"""
import os
import numpy as np
#------------------------------
def setrun(claw_pkg='geoclaw'):
#-------------------------... | |
# Copyright (c) 2018-2021 Micro Focus or one of its affiliates.
# Copyright (c) 2018 Uber Technologies, 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/licen... | |
import numpy as np
import pandas as pd
from zipline.data.session_bars import SessionBarReader
class ContinuousFutureSessionBarReader(SessionBarReader):
def __init__(self, bar_reader, roll_finders):
self._bar_reader = bar_reader
self._roll_finders = roll_finders
def load_raw_arrays(self, colu... | |
"""
Test model API
"""
import random
import json
import six
import copy
from datetime import datetime
from botocore.client import ClientError
from pynamodb.compat import CompatTestCase as TestCase
from pynamodb.compat import OrderedDict
from pynamodb.throttle import Throttle
from pynamodb.connection.util import pythoni... | |
import json
import os
import re
import shutil
import subprocess
import sys
import tempfile
if sys.version_info[:2] >= (3, 4):
import pathlib
else:
import pathlib2 as pathlib
import py
import pytest
import tox
from tox.config import parseconfig
from tox.reporter import Verbosity
from tox.session import Session... | |
# Copyright 2021 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... | |
#!/usr/bin/env python2.7.5
#Carnac Gui using OOP
'''
Intent of program is to:
Pull in a csv
Process the title column
Run rules to modify the column contents based on "roles"
Make the rule able to be changed in app by user
Run rules multiple times
Export to file
'''
#----------
#Import your shit
#----------
from Tkinter... | |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from backend.firebase_db_util import post_feed, get_last_feeds, get_reddit_url, update_desc, is_enabled, delete_feed
from backend.fcm_util import send_fcm
from ba... | |
# 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... | |
# 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 applicab... | |
__file__ = 'IRI_v7'
__date__ = '1/28/2016'
__author__ = 'ABREZNIC'
"""
The MIT License (MIT)
Copyright (c) 2016 Texas Department of Transportation
Author: Adam Breznicky
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... | |
"""
SSL with SNI_-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.
This needs the following packages installed:
* pyOpenSSL (tested w... | |
# -*- coding: utf-8 -*-
"""
pysteps.io.interface
====================
Interface for the io module.
.. currentmodule:: pysteps.io.interface
.. autosummary::
:toctree: ../generated/
get_method
"""
import importlib
from pkg_resources import iter_entry_points
from pysteps import io
from pysteps.decorators imp... | |
#!/usr/bin/python
"""
Test some SPARQL queries
"""
import os, os.path
import sys
import re
import shutil
import unittest
import logging
import datetime
import StringIO
import rdflib
# Stand-alone test: don't import from ro_prefixes
prefixes = (
[ ("", "http://example.org/")
, ("rdf", "http:/... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# Copyright 2011 Piston Cloud Computing, 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 o... | |
class Vakai(In.entity.Entity):
'''Vakai Entity class.'''
def __init__(self, data = None, items = None, **args):
self.weight = 0
super().__init__(data, items, **args)
self.css.append(self.__type__)
@IN.register('Vakai', type = 'Entitier')
class VakaiEntitier(In.entity.EntityEntitier):
'''Base Vakai Ent... | |
#!/usr/bin/env python
# Copyright (c) 2015, Andre Lucas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this... | |
# coding:utf-8
from base import TestBase
class TestDefault(TestBase):
"""Default tests"""
# for debug
# def tearDown(self):
# pass
insert_position_text = """
# Heading 0
# Heading 1
...
## Heading 2
...
## Heading 3
...
# Heading with anchor [with-anchor]
...
"""
def test_b... | |
import numpy as np
import pytest
import dask.array as da
from dask.array.utils import assert_eq, same_keys, AxisError, IS_NEP18_ACTIVE
from dask.array.gufunc import apply_gufunc
from dask.sizeof import sizeof
cupy = pytest.importorskip("cupy")
functions = [
lambda x: x,
lambda x: da.expm1(x),
lambda x: ... | |
#!/usr/bin/env python
"""Tests for Yara flows."""
import contextlib
import functools
import inspect
import os
import platform
import string
from typing import Iterable
from typing import Optional
import unittest
from unittest import mock
from absl import app
import psutil
import yara
from grr_response_client import ... | |
#!/usr/local/bin/python
#
# Copyright (c) 2009-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain th... | |
#!/usr/bin/python
# Copyright (c) 2008-2011 Mark Eichin <eichin@thok.org>
# See ./LICENSE (MIT style.)
"""take recent twitters and zephyr them to me"""
__version__ = "0.4"
__author__ = "Mark Eichin <eichin@thok.org>"
__license__ = "MIT"
import sys
import os
import getpass
import subprocess
import signal
import twe... | |
import unittest
import sys
import numpy as np
from sklearn.mixture import DPGMM, VBGMM
from sklearn.mixture.dpgmm import log_normalize
from sklearn.datasets import make_blobs
from sklearn.utils.testing import assert_array_less, assert_equal
from sklearn.utils.testing import assert_warns_message, ignore_warnings
from ... | |
from __future__ import division
import sys
import os
import shutil
import warnings
import inspect
import configparser
import threading as thread
import traceback
import copy
import logging
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.use('agg') # Prevents crash when GUI runs matplotlib in thre... | |
#
# This file is part of pySMT.
#
# Copyright 2014 Andrea Micheli and Marco Gario
#
# 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
... | |
"""
@package mi.dataset.driver.moas.gl.engineering.test.test_driver
@file marine-integrations/mi/dataset/driver/moas/gl/engineering/test/test_driver.py
@author Bill French, Nick Almonte
@brief Test cases for glider ctd data
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/dsa/test_driver
... | |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | |
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | |
# Copyright 2019 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import collections
import logging
import ntpath... | |
"""Weak reference support for Python.
This module is an implementation of PEP 205:
http://www.python.org/dev/peps/pep-0205/
"""
# Naming convention: Variables named "wr" are weak reference objects;
# they are called this instead of "ref" to avoid name collisions with
# the module-global ref() function imported from ... | |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from divide import divide
import config
def kdtree(_input, path=None, treemap=None, parentmeta=None, parent=None):
_input=[n for n in _input]
if None == treemap:
# root
treemap = {}
path = []
node = Node()
node.parent = parent
... | |
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.exceptions import NotFound
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import url_for, current_app
from flask_sqlalchemy import SQLAlchemy
from .helpers import args... | |
"""Test config validators."""
from collections import OrderedDict
from datetime import date, datetime, timedelta
import enum
import os
from socket import _GLOBAL_DEFAULT_TIMEOUT
from unittest.mock import Mock, patch
import uuid
import pytest
import voluptuous as vol
import homeassistant
from homeassistant.helpers imp... | |
#
# (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful... | |
import functools, operator, os, types, sys, itertools
import datetime, cgi, time
import six, mimetypes
WIN32 = True if sys.platform == 'win32' else False
try:
# Python3
from http.server import BaseHTTPRequestHandler, HTTPServer
except ImportError:
# Python 2
from BaseHTTPServer import BaseHTTPRequestH... | |
import re
from django.template import Node, Variable, VariableNode
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.template.base import _render_value_in_context
from django.utils import translation
from django.utils.encoding import for... | |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | |
# Copyright (c) 2018 PaddlePaddle 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... | |
import settings, sys, os, re, socket, requests, logging, traceback, inspect, string, random
from flask import request, render_template, make_response
from werkzeug.utils import escape
from werkzeug.urls import iri_to_uri
def ipv4Test(address):
try:
socket.inet_pton(socket.AF_INET, address)
except Attr... | |
# Copyright 2020 The FedLearner 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... | |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Script to create Chrome Installer archive.
This script is used to create an archive of all the files required for a
Chrome ... | |
# Copyright 2012 OpenStack Foundation
# 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
#
# ht... | |
# Copyright 2014 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 ... | |
'''
Created on 8. des. 2017
@author: ljb
'''
from __future__ import division, absolute_import
from numba import jit, float64, void
import numpy as np
import matplotlib.pyplot as plt
import timeit
import scipy.linalg as linalg
from fys4150.project5.figure_saver import my_savefig
def fun(x):
return 100 * np.exp(-1... | |
# -*- encoding: utf-8 *-*
import os
import io
import re
import sys
from collections import OrderedDict
from datetime import datetime
from glob import glob
from distutils.command.build import build
from distutils.core import Command
import textwrap
min_python = (3, 4)
my_python = sys.version_info
if my_python < min_... | |
#!/usr/bin/env python
copyright = '''
/*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* 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 li... | |
"""
This demo demonstrates how to draw a dynamic mpl (matplotlib)
plot in a wxPython application.
It allows "live" plotting as well as manual zooming to specific
regions.
Both X and Y axes allow "auto" or "manual" settings. For Y, auto
mode sets the scaling of the graph to see all the data points.
For X, auto mode m... | |
import pickle
import pytest
from pyrsistent import pdeque, dq
def test_basic_right_and_left():
x = pdeque([1, 2])
assert x.right == 2
assert x.left == 1
assert len(x) == 2
def test_construction_with_maxlen():
assert pdeque([1, 2, 3, 4], maxlen=2) == pdeque([3, 4])
assert pdeque([1, 2, 3, 4]... | |
"""Support for SimpliSafe alarm systems."""
import asyncio
from uuid import UUID
from simplipy import API
from simplipy.errors import EndpointUnavailable, InvalidCredentialsError, SimplipyError
import voluptuous as vol
from homeassistant.const import ATTR_CODE, CONF_CODE, CONF_TOKEN, CONF_USERNAME
from homeassistant.... | |
# Copyright 2015 Intel 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
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | |
#!/usr/bin/env python2.7
# WARNING! This a Python 2 script. Read README.rst for rationale.
"""
Usage: make_lite.py <wrapped_routines_file> <lapack_dir>
Typical invocation:
make_lite.py wrapped_routines /tmp/lapack-3.x.x
Requires the following to be on the path:
* f2c
* patch
"""
import sys
import os
import re... | |
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | |
import json
import configparser
import socket
import threading
import os
import sys
import traceback
from digtemp import read_dig_temp
sys.path.append( "../lib" )
from iseclogger import Logger
from rpiinfo import get_temperature
#remove _dud for production
from rpictrl import addGPIOEvent
from rpictrl import getGPIO... | |
#!/usr/local/sci/bin/python
# PYTHON3
#
# Author: Kate Willett
# Created: 24 February 2014
# Last update: 17 February 2020
# Location: /data/local/hadkw/HADCRUH2/UPDATE2015/PROGS/HADISDH_BUILD/
# GitHub: https://github.com/Kate-Willett/HadISDH_Build
# -----------------------
# CODE PURPOSE AND OUTPUT
# ---------... | |
"""
:codeauthor: Gareth J. Greenaway <ggreenaway@vmware.com>
"""
import logging
import pytest
import salt.modules.beacons as beaconmod
import salt.states.beacon as beaconstate
import salt.states.service as service
import salt.utils.platform
from salt.utils.event import SaltEvent
from tests.support.mock import Mag... | |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | |
"""Fabfile for the ``webfaction-django-boilerplate``.
Make sure to setup your ``fabric_settings.py`` first. As a start, just copy
``fabric_settings.py.sample``.
"""
from __future__ import with_statement
import os
from fabric.api import (
cd,
env,
lcd,
local,
run,
settings,
)
from fabric.cont... | |
# encoding: utf-8
# Broadcast protocol used to build a distributed cluster of solver processes.
#
# This code uses the twisted event driven networking framework:
# http://twistedmatrix.com/documents/13.0.0/core/howto/servers.html
#
import json
import logging
import threading
import time
import twisted
from twisted.i... | |
# coding: utf-8
from __future__ import unicode_literals
import unittest
import sys
from pymatgen.analysis.defects.point_defects import *
from pymatgen.core.structure import Structure
from pymatgen.core.periodic_table import Element
from pymatgen.analysis.bond_valence import BVAnalyzer
from monty.os.path import which... | |
import base64
import struct
from typing import Any, Dict, List, Optional
# This file is adapted from samples/shellinabox/ssh-krb-wrapper in
# https://github.com/davidben/webathena, which has the following
# license:
#
# Copyright (c) 2013 David Benjamin and Alan Huang
#
# Permission is hereby granted, free of charge, ... | |
import asyncio
import warnings
from typing import Dict, Optional, Tuple
from mitmproxy import command, controller, ctx, exceptions, flow, http, log, master, options, platform, tcp, websocket
from mitmproxy.flow import Error, Flow
from mitmproxy.proxy import commands, events, server_hooks
from mitmproxy.proxy import se... | |
"""
hash_table.py
Python implementation of the very simple, fixed-array hash table
used for the audfprint fingerprinter.
2014-05-25 Dan Ellis dpwe@ee.columbia.edu
"""
from __future__ import print_function
import numpy as np
import random
import cPickle as pickle
import os, gzip
import scipy.io
import math
# Current... | |
#
# authen.py
# Mixin providing various approaches to authentication
#
import sys, os, time, base64, string, threading, json
import socket, grp
# Extra chars from base64
ALTCHARS="_+"
# Why Python lacks isxdigit(), dunno
Xdigits = set(string.digits)
Xdigits.update( ['a', 'b', 'c', 'd', 'e', 'f'] )
Xdigits.update( ['A... | |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 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
#
# U... | |
# Copyright (c) 2009-2011 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for using NMEA sentences.
"""
import datetime
from operator import attrgetter
from zope.interface import implementer
from twisted.positioning import base, nmea, ipositioning
from twisted.positioning.test.receiver import Mo... | |
"""Tests for eval_lib.work_data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import unittest
from six import assertCountEqual
from six import itervalues
from eval_lib import work_data
from eval_lib.tests import fake_cloud_client
TEST_... | |
#!/usr/bin/env python
################################################################################
# \file build.py
# \author Gregory Diamos <gregory.diamos@gatech.edu>
# \date Sunday March 13, 2011
# \brief The Ocelot build script to direct scons builds and run unit tests
#################################... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | |
#!/usr/bin/env python
"""CoNLL 2002 shared task format support."""
__author__ = 'Sampo Pyysalo'
__license__ = 'MIT'
import sys
import re
import os
import codecs
import json
INPUT_ENCODING = "Latin-1"
OUTPUT_ENCODING = "UTF-8"
def argparser():
import argparse
parser = argparse.ArgumentParser(description="Co... | |
r'''
In practice, :class:`~pyop.linop.LinearOperator` instances composed of distinct
sub-blocks are common. In general, access to both the constituent operators and
larger operators is desired. The :mod:`~pyop.block` module provides several
functions to help build block instances of :class:`~pyop.linop.LinearOperator`... | |
# Copyright 2016 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 ag... | |
from __future__ import absolute_import
from copy import deepcopy
from datetime import datetime
from django.core.exceptions import MultipleObjectsReturned, FieldError
from django.test import TestCase
from django.utils.translation import ugettext_lazy
from .models import Article, Reporter
class ManyToOneTests(TestCa... | |
'''
***
Modified generic daemon class
***
Author: http://www.jejik.com/articles/2007/02/
a_simple_unix_linux_daemon_in_python/www.boxedice.com
License: http://creativecommons.org/licenses/by-sa/3.0/
Changes: 23rd Jan 2009 (David Mytton <david@boxedice.com>)
... | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | |
import json, re
import numpy as np
from keras.layers import Dense, LSTM, Conv1D, Flatten, Reshape, Bidirectional, Input, MaxPooling1D, dot, add, GRU, Lambda
from keras.layers.embeddings import Embedding
from keras.models import Model
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenize... | |
"""Support for Rflink lights."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
)
from homeassistant.const import CONF_NAME, CONF_TYPE
import homeassistant.helpers.config_validation as cv
from . import ... | |
#!/usr/bin/env python3
# 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
# "L... | |
"""Support to serve the Home Assistant API as WSGI application."""
from ipaddress import ip_network
import logging
import os
import ssl
from typing import Optional
from aiohttp import web
from aiohttp.web_exceptions import HTTPMovedPermanently
import voluptuous as vol
from homeassistant.const import (
EVENT_HOMEA... | |
"""
=============================================================
Online Latent Dirichlet Allocation with variational inference
=============================================================
This implementation is modified from Matthew D. Hoffman's onlineldavb code
Link: http://www.cs.princeton.edu/~mdhoffma/code/onli... | |
#!/usr/bin/env python3
# coding: utf-8
"""Test AST representation."""
import unittest
from triton import TritonContext, ARCH, AST_REPRESENTATION, VERSION
smtlifting = """(define-fun bswap8 ((value (_ BitVec 8))) (_ BitVec 8)
value
)
(define-fun bswap16 ((value (_ BitVec 16))) (_ BitVec 16)
(bvor
(bvshl
... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Locaweb.
# 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/license... | |
#!/usr/bin/env python2
# 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 "Lice... | |
"""
epistar_lpd8806.py: Raspberry Pi library for the Epistar LPD8806 RGB Strand
Provides the ability to drive a LPD8806 based strand of RGB leds from the Raspberry Pi
Colors are provided as RGB and converted internally to the strand's 7 bit values.
The leds are available here:
https://www.aliexpress.com/item/1M-5M-L... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.