src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# SerialGrabber reads data from a serial port and processes it with the
# configured processor.
# Copyright (C) 2012 NigelB
#
# This program 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 Foundatio... |
class HeapSort(object):
"""docstring for HeapSort"""
def __init__(self, A):
self.A = A;
self.heap_size = len(A);
def parent(self,i):
"""Вернуть родителя"""
return (i-1)//2;
def left(self,i):
return 2*i + 1;
def right(self,i):
return 2*i +1 + 1;
def max_heapify(self, i):
"""Размещает i-й элемент ... |
from unittest import TestCase, skip
import time
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
class ExampleTest(TestCase):
def test_something(self):
""" A test to check something """
time.sleep(0.5)
self.assertEqual("something", "something")
... |
from setuptools import setup
from os import path
BASE_PATH = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(BASE_PATH, 'README.rst'), 'r') as f:
long_description = f.read()
setup(
name='python-jumprunpro',
version='0.0.2',
author='Nate Mara',
author_em... |
import arrow
import random
from watson import Watson
watson = Watson(frames=None, current=None)
projects = [
("apollo11", ["reactor", "module", "wheels", "steering", "brakes"]),
("hubble", ["lens", "camera", "transmission"]),
("voyager1", ["probe", "generators", "sensors", "antenna"]),
("voyager2", [... |
from util import failUnless, failUnlessRaises, SoftFailure
class Rights(object):
def __init__(self, pwhash):
self.pwhash = pwhash
self.actions = set([])
class PasswordAuthentication(object):
def __init__(self):
self.credentials = {}
def userIsValid(self, username):
retur... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# F2BB Fail2Ban Broadcast
# (c) Thanat0s 2013
#
# Fail2Ban BroadCast 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 2 of the License, or
# (at your o... |
import pytest
from unittest.mock import patch
from Silverfort import get_user_entity_risk_command, get_resource_entity_risk_command,\
update_user_entity_risk_command, update_resource_entity_risk_command
API_KEY = "APIKEY"
@pytest.fixture(autouse=True)
def upn():
return 'sfuser@silverfort.io'
@pytest.fixture... |
"""Provide variant calling with VarScan from TGI at Wash U.
http://varscan.sourceforge.net/
"""
from collections import namedtuple
import contextlib
from distutils.version import LooseVersion
import os
import shutil
from bcbio import broad, utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
... |
# -*- coding: utf-8 -*-
import leancloud
from leancloud import Object
from leancloud import LeanCloudError
from leancloud import Query
from leancloud import User
from wsgi import signer
not_binary_label_dict = {'field':['field__manufacture', 'field__financial', 'field__infotech', 'field__law', 'field__agriculture'... |
"""/help command"""
import random
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
from telegram.ext import CallbackContext
from module.shared import AULARIO, CLOUD, CUSicon, check_log
def help_cmd(update: Update, context: CallbackContext):
"""Called by the /help command.
Shows all the ... |
from couchpotato import get_session
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.encoding import ss
from couchpotato.core.helpers.variable import splitString, md5
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model im... |
"""
Author: Omkar Pathak
Created At: 25th August 2017
"""
import inspect
def longest_increasing_subsequence(_list):
"""
The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a
given sequence such that all elements of the subsequence are sorted in increasing or... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
('filer', '0007_auto_20161016_1055'),
... |
# -*- coding: utf-8 -*-
"""
USID utilities for performing randomized singular value decomposition and reconstructing results
Created on Mon Mar 28 09:45:08 2016
@author: Suhas Somnath, Chris Smith
"""
from __future__ import division, print_function, absolute_import
import time
from multiprocessing import cpu_count
i... |
#!/usr/bin/python
#
# 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 b... |
# minqlx - Extends Quake Live's dedicated server with extra functionality and scripting.
# Copyright (C) 2015 Mino <mino@minomino.org>
# This file is part of minqlx.
# minqlx 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 Softw... |
from scapy.all import *
from veripy.assertions import *
from slaac_test_helper import SlaacTestHelper
from veripy.models import IPv6Address
class GlobalAddressAutoConfigHostTestHelper(SlaacTestHelper):
def base_ra(self):
ll_info = ICMPv6NDOptSrcLLAddr(lladdr=self.router(1).iface(0).ll_addr)
link_m... |
# -*- coding: utf-8 -*-
from collections import Iterable
try:
from django.db.models.query import QuerySet
from django.db.models import Manager
except ImportError:
QuerySet = None
Manager = None
from aserializer.fields import ListSerializerField
from aserializer.django.utils import get_local_fields, get... |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
from functools import partial
from itertools import product
from f... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
[path]
cd /Users/brunoflaven/Documents/01_work/blog_articles/extending_streamlit_usage/001_nlp_spacy_python_realp/
[file]
python 002c_nlp_spacy_python.py
# source
Source: https://realpython.com/natural-language-processing-spacy-python/
# required
pip install spacy-... |
# Copyright (c) 2006 Seo Sanghyeon
# 2006-06-08 sanxiyn Created
# 2006-06-11 sanxiyn Implemented .value on primitive types
# 2006-11-02 sanxiyn Support for multiple signatures
__all__ = [
'c_int', 'c_float', 'c_double', 'c_char_p', 'c_void_p',
'LibraryLoader', 'CDLL', 'cdll',
'byref', 'sizeof'
]
# --... |
# 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 python
# System imports
from distutils.core import *
from distutils import sysconfig
# Third-party modules - we depend on numpy
import numpy
# in order to check whether lapack are present ...
import numpy.distutils.system_info as sysinfo
# Obtain the numpy include directory. This works across nu... |
import subprocess
import numpy as np
import hypothesis as h
import hypothesis.strategies as st
import hypothesis.extra.numpy as hnp
#h.settings(buffer_size = 819200000)
min_img_width = 1
min_img_height = 1
max_img_width = 10
max_img_height = 10
max_uint32 = 2**32 - 1
max_int32 = 2**31 - 1
min_int32 = -(2**31)
max_sho... |
# Copyright 2015 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, ... |
#-----------------------------------------------------------------------------
# Copyright (c) 2014-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... |
# Copyright 2013 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... |
from mpi4py import MPI
import mpiunittest as unittest
import arrayimpl
import sys
pypy_lt_53 = (hasattr(sys, 'pypy_version_info') and
sys.pypy_version_info < (5, 3))
def mkzeros(n):
if pypy_lt_53:
return b'\0' * n
return bytearray(n)
def memzero(m):
try:
m[:] = 0
except ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# 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
#... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
# 下一个新版本的特性导入到当前版本,可以在当前版本中使用一些新版本的特性,必须放在文档开头
'''
工具类与工具方法
'''
# from builtins import *
# 引入内建模块,该模块中有一些常用函数;而该模块在Python启动后、且没有执行程序员所写的任何代码前,
# Python会首先加载该内建函数到内存,如str(),min(),max()等常用函数,不是必要
import t... |
################################################################################
# copyright 2009 Gabriel Pettier <gabriel.pettier@gmail.com> #
# #
# This file is part of Ultimate Smash Friends. ... |
from pyjamas.ui.HTMLPanel import HTMLPanel
from pyjamas.ui.Hyperlink import Hyperlink
from pyjamas import Window
from pyjamas import DOM
class HTMLLinkPanel(HTMLPanel):
def __init__(self, html="", **kwargs):
self.hyperlinks = []
HTMLPanel.__init__(self, html, **kwargs)
def setHTML(self, html)... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Appier Framework
# Copyright (c) 2008-2021 Hive Solutions Lda.
#
# This file is part of Hive Appier Framework.
#
# Hive Appier Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
#!/usr/bin/env python3
"""Compute the returns of a portfolio.
A document exists to describe the problem in more detail.
http://furius.ca/beancount/doc/portfolio-returns
Calculating the returns is carried out by identifying the entries whose accounts
match a regular expression that defines accounts to consider for val... |
"""
This module provides helper functions for the rest of the testing module
"""
from collections import Iterable
import os
import sys
from math import isnan
import numpy as np
ROOT_FOLDER = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
sys.path = [ROOT_FOLDER] + sys.path
np.seter... |
#
# stats class for Gig-o-Matic 2
#
# Aaron Oppenheimer
# 29 Jan 2014
#
from google.appengine.ext import ndb
from requestmodel import *
import webapp2_extras.appengine.auth.models
import webapp2
from debug import *
import assoc
import gig
import band
import member
import logging
import json
def stats_key(member_n... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import errors
from mozrunner.devices.emulator_screen import EmulatorScreen
from marionette_harne... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'xitem_dialog_base.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.... |
"""Configuration YAML files for Gemini.
Provide Gemini configuration files in alternative locations:
- Installer based: gemini-virtualenv/../data or gemini-virtualenv/../gemini/data
- Global: /usr/local/share/gemini/gemini-config.yaml
- User only: $HOME/.gemini/gemini-config.yaml
Prefer installer based or global ... |
"""
Functions to test that map measurements haven't changed.
Use generate() to save data, and test() to check that the data is
unchanged in a later version. Results from generate() are already
checked into svn, so intentional changes to map measurement mean new
data must be generated and committed. E.g.
# ...delibera... |
"""******************************************************************
* Module: regd
*
* File name: fs.py
*
* Created: 2015-12-17 15:14:24
*
* Abstract: "File system"
*
* Author: Albert Berger [ alberger@gmail.com ].
*
*******************************************************************"""
__lastedited__ = "2016... |
#!/usr/bin/python
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
"""
{description}
Copyright (C) {2014} {Karl Parkinson}
This program 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 2 of the License, or
(at your option) any later version.
... |
#!/usr/bin/env python
import sys
import os.path
import optparse
import geniutil
import datetime
import subprocess
import uuid
CA_CERT_FILE = 'ca-cert.pem'
CA_KEY_FILE = 'ca-key.pem'
SA_CERT_FILE = 'sa-cert.pem'
SA_KEY_FILE = 'sa-key.pem'
MA_CERT_FILE = 'ma-cert.pem'
MA_KEY_FILE = 'ma-key.pem'
AM_CERT_FILE = 'am-cert.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
from django.conf import settings
from django.http import HttpResponse, Http404,HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.models import User
from ..acc... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Nico Epp and Ralf Funk
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from urllib import parse
from typing import Dict, ... |
from SimPEG import Mesh, Regularization, Maps, Utils, EM
from SimPEG.EM.Static import DC
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
import copy
#import pandas as pd
#from scipy.sparse import csr_matrix, spdiags, dia_matrix,diags
#from scipy.sparse.linalg import spsolve
from scipy.stats imp... |
"""
Adaptive numerical evaluation of SymPy expressions, using mpmath
for mathematical functions.
"""
from __future__ import print_function, division
import math
import sympy.mpmath.libmp as libmp
from sympy.mpmath import make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc
from sympy.mpmath import inf as mpmath_in... |
# -*- coding: utf-8 -*-
"""
Author: @gabvaztor
StartDate: 04/03/2017
This file contains the next information:
- Libraries to import with installation comment and reason.
- Data Mining Algorithm.
- Sets (train,validation and test) information.
- ANN Arquitectures.
- A lot of utils methods which you'... |
from avatar.system import System
import logging
from avatar.emulators.s2e import init_s2e_emulator
import threading
import subprocess
from avatar.targets.gdbserver_target import init_gdbserver_target
import os
import time
log = logging.getLogger(__name__)
configuration = {
"output_directory": "/tmp/1",
"con... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import mozdevice
import logging
import unittest
import mozunit
from sut... |
#%% Demo 13: Helical Geometry tests
#
#
# This demo shows an example of TIGRE working on Helical scan geometries
#
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
# This file is part of the TIGRE Toolbox
#
# Copyri... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from .. import appsettings
class Migration(migrations.Migration):
dependencies = [
('ik_links', '0004_auto_20170314_1401'),
('ik_links', '0004_auto_20170306_1529'),
]
operations = [
... |
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup
setup(
name='packed',
version='0.2.0',
url='https://github.com/michaeljones/packed',
download_url='https://github.com/mich... |
# -*- coding: utf-8 -*-
import datetime
import hashlib
from nose.tools import raises, with_setup
import mock
import StringIO
import textwrap
import xml.etree.cElementTree as ET
import harvestmedia.api.exceptions
from harvestmedia.api.member import Member
from harvestmedia.api.playlist import Playlist
from utils impor... |
# -*-coding: utf-8-*-
import logging
from pyramid.view import view_config, view_defaults
from pyramid.httpexceptions import HTTPFound
from . import BaseView
from ..models import DBSession
from ..models.contract import Contract
from ..lib.bl.contracts import get_contract_copy
from ..lib.bl.subscriptions import subscr... |
#!/usr/bin/env python
# I use this to keep the sourceforge pages up to date with the
# latest documentation and I like to keep a copy of the distribution
# on the web site so that it will be compatible with
# The Vaults of Parnasus which requires a direct URL link to a
# tar ball distribution. I don't advertise the pa... |
# Copyright 2013 IBM Corp.
#
# 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... |
import os
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
packages = [
'skosprovider_heritagedata'
]
requires = [
'skosprovider>=0.6.0',
... |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import os
import sys
import argparse
import netaddr
import netifaces
import ConfigParser
import platform
from fabric.api import local
from contrail_provisioning.common.base import ContrailSetup
from contrail_provisioning.compute.n... |
"""
Tests for dit.helpers.
"""
from __future__ import division
import pytest
from dit import Distribution
from dit.exceptions import ditException, InvalidDistribution, InvalidOutcome
from dit.helpers import construct_alphabets, get_product_func, parse_rvs, \
reorder, normalize_pmfs, numerical... |
# coding: utf-8
from __future__ import absolute_import, division, print_function
import numpy as np
import pytest
import astrodynamics.lowlevel.ephemerides as ephemerides
class MockSegment(object):
def __init__(self, a, b):
self.a = a
self.b = b
def compute_and_differentiate(self, tdb, tdb2... |
import random
class MarkovState:
def __init__(self,charsToEmit, emissionProbs,transitionProbs):
self.charsToEmit = charsToEmit
self.emissionProbs = emissionProbs
self.transitionProbs = transitionProbs
def getEmissionIndex(self):
aRand = random.random()
cumulative = 0
index =0
for val ... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import json
import o... |
# -*- coding: utf-8 -*-
# locks.py
# Copyright (C) 2013 LEAP
#
# This program 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.
#
# This ... |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... |
"""
This module contains dsolve() and different helper functions that it
uses.
dsolve() solves ordinary differential equations. See the docstring on
the various functions for their uses. Note that partial differential
equations support is in pde.py. Note that ode_hint() functions have
docstrings describing their vari... |
from tdl.map import Map
from random import randint
from components.ai import BasicMonster
from components.fighter import Fighter
from entity import Entity
class GameMap(Map):
def __init__(self, width, height):
super().__init__(width, height)
self.explored = [[False for y in range(height)] for x in ... |
# encoding: utf-8
from __future__ import absolute_import
from __future__ import division
"""
This module contains any disk template related classes and functions, including
the repository store manager classes and template providers, some useful
definitions:
* Template repositories:
Repository where to fe... |
__author__ = 'rakesh.varma'
from fabric.api import *
import os
import time
class install:
fuse_git_repo = 'https://github.com/s3fs-fuse/s3fs-fuse.git'
def __init__(self, host_ip, host_user, host_key_file):
env.host_string = host_ip
env.user = host_user
env.key_filename = host_key_file
... |
'''
Copyright 2014 Pierre Cadart
This file is part of Factory Maker.
Factory Maker 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) a... |
import datetime
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from duo_auth.models import VerificationDetails
class auth_backend(ModelBackend):
supports_object_permissions = False
supports_anonymous_user = False
supports_inactive_user = False
def a... |
# coding: utf-8
import json
import argparse
import logging
import os
import sys
from publication.controller import stats, ServerError
import thriftpy
import thriftpywrap
from thriftpy.rpc import make_server
logger = logging.getLogger(__name__)
publication_stats_thrift = thriftpy.load(
os.path.join(os.path.dirna... |
"""The WaveBlocks Project
Compute the action of the gradient operator applied to a Hagedorn wavepacket.
@author: R. Bourquin
@copyright: Copyright (C) 2012, 2013, 2014, 2016 R. Bourquin
@license: Modified BSD License
"""
from numpy import zeros, complexfloating, conjugate, squeeze
from scipy import sqrt
from WaveBl... |
import json
import re
import datetime
import time
import os
import os.path
import dulwich.repo
import jenkinscli
import xml.etree.ElementTree as ET
import sys
import argparse
import textwrap
# This script will create jobs for each remote branch found in the repository
# in the current directory. It will also remove th... |
from ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector
from Components.ActionMap import ActionMap, HelpableActionMap
from Components.ActionMap import NumberActionMap
from Components.Harddisk import harddiskmanager
from Components.Input import Input
from Components.Label import Label
from... |
# 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 or agreed to in writing, so... |
#
# Copyright (C) 2008 Rico Schiekel (fire at downgra dot de)
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This... |
#!/usr/bin/env python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class FacebookStatus():
def __init__(self):
self.driver = webdriver.PhantomJS()
self.username = 'myFbName' # user credentials
self.passwd = passwd = 'myFbPassword'
self.statusMessage = 'https:/... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
#!/usr/bin/python
# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
""" The Adapter Pattern
Notes:
If the interface of an object does not match the interface required by the
client code, this pattern recommends using an 'adapter' that can create a proxy
interface. It is particularly useful in homogenizing interfaces of
non-homogenous objects.
The following example represents a use ... |
"""Utilities to run the OpenCraft IM tests."""
import os
import unittest
from django.test.runner import DiscoverRunner
def shard(index):
"""Mark a test method as running only on a particular shard when running tests in parallel.
This decorator sets an attribute on the function that is read by our customise... |
import argparse
import logging
import sys
import textwrap
from sslscan import __version__, modules, Scanner
from sslscan.exception import ConfigOptionNotFound, ModuleLoadStatus, ModuleNotFound, OptionValueError
from sslscan import _helper
from sslscan.module import STATUS_NAMES
from sslscan.module.handler import Base... |
import os
import vtkAll as vtk
import math
import time
import re
import numpy as np
from director.timercallback import TimerCallback
from director import objectmodel as om
from director.simpletimer import SimpleTimer
from director.utime import getUtime
from director import robotstate
import copy
import pickle
import ... |
import logging
import serial
import sys
import time
import serial.tools.list_ports
#------------------------------------------------#
# serial connection functions
#------------------------------------------------#
def OpenSerial(port, baudrate, bytesize, stopbits, parity, flowcontrol, timeout):
# configure th... |
"""
.. Copyright (c) 2016 Marshall Farrier
license http://opensource.org/licenses/MIT
Get options to be tracked
"""
import datetime as dt
from bson.codec_options import CodecOptions
import config
import constants
from dbwrapper import job
class TrackPuller(object):
def __init__(self, logger):
self.l... |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
"""Sparse accessor"""
import numpy as np
from pandas.compat._optional import import_optional_dependency
from pandas.core.dtypes.cast import find_common_type
from pandas.core.accessor import (
PandasDelegate,
delegate_names,
)
from pandas.core.arrays.sparse.array import SparseArray
from pandas.core.arrays.sp... |
from __future__ import absolute_import, print_function
""" Multicast DNS Service Discovery for Python, v0.12
Copyright (C) 2003, Paul Scott-Murphy
This module provides a framework for the use of DNS Service Discovery
using IP multicast. It has been tested against the JRendezvous
implementation 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
# distributed under t... |
__author__ = 'phillip'
from .MailReceiver import MailReceiver
import poplib
class IMAPReceiver(MailReceiver):
def __init__(self, config):
self._conn = None
def connect(self, config):
self._server = poplib.POP3_SSL()
self._server.apop()
def delete_mail(self, n):
self._se... |
# 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 ... |
import requests
import bs4
import re
import random
URL = 'http://longform.org'
def parse_page(url):
page = requests.get(url)
soup = bs4.BeautifulSoup(page.text)
posts = soup.select('div.post')
## filter out posts whose second class element is not empty, because those are collections or sponsored posts... |
#!/usr/bin/env python
'''I-surround bump plots with the original E-surround settings but with
increased theta/constant drive to E cells.'''
from __future__ import absolute_import, print_function
from grid_cell_model.submitting import flagparse
import noisefigs
from noisefigs.env import NoiseEnvironment
import config_... |
# this solution preserves original list structure, but new nodes shallow copy old data, so if the data is a reference type, changing it in one list will affect one of the others
class Node(object):
def __init__(self, data=None):
self.data = data
self.next = None
# shallow copy of the data,... |
#/usr/bin/env python
from lame import gfx
from lame import map
from lame import ctrl
def main():
xoffset = 0
offsetw = 0
w1 = 0
dx = 0
map.start(gfx.start())
gfx.limit(gfx.FULLSPEED)
cavelake = gfx.load('gfx/cavelake.png')
cave = map.load('gfx/cave.tmx')
cave2 = map.... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.