src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
# convenience classes for accessing hdf5 trigger files
# the 'get_column()' method is implemented parallel to
# the existing pylal.SnglInspiralUtils functions
import h5py
import numpy as np
import logging
import inspect
from lal import LIGOTimeGPS, YRJUL_SI
from pycbc_glue.ligolw import ligolw
from pycbc_glue.ligol... |
#!/usr/bin/env python
"""
Standalone script to test drive spagedi functionality.
"""
import os, re, sys, time, platform, glob, getopt, traceback
from functools import wraps
import xml.etree.cElementTree as et
from usage import Usage
import arcpy
from spagedi_tree import spagedi_tree
# enable local imports; allow import... |
from __future__ import print_function
import lis_wrapper
import numpy as np
import scipy.sparse
# Define a symmetric 8 x 8 dense upper triangular matrix first.
# This matrix is part of the examples which come with Intel's MKL library
# and is used here for historical reasons.
# A:
# 7.0, 1.0, 2.0... |
import functools
import time
import plugins
def _initialise(bot):
_migrate_dnd_config_to_memory(bot)
_reuseable = functools.partial(_user_has_dnd, bot)
functools.update_wrapper(_reuseable, _user_has_dnd)
plugins.register_shared('dnd.user_check', _reuseable)
plugins.register_user_command(["dnd"])
... |
#!/usr/bin/env python3
"""
Start atram.
This wrapper module parses the input arguments and passes them to the module
that does the actual processing (core_atram.py).
"""
import os
import argparse
import textwrap
import lib.db as db
import lib.log as log
import lib.bio as bio
import lib.util as util
import lib.blast a... |
#!/usr/bin/python
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from avocado.core.exceptions import TestFail
from dfuse_test_base import DfuseTestBase
class DfuseContainerCheck(DfuseTestBase):
# pylint: disable=too-few-public-methods,too-many-ancestors
"... |
import os
import unittest
from kfdata.parser import ModelParser
from kfdata.model import Model
from kfdata.entity import Entity
from kfdata.attributes import *
from kfdata.relationship import Relationship
class ModelParserTests(unittest.TestCase):
def fixture_model(self):
model = Model()
model.en... |
#!/usr/bin/env python3
"""
Test the 'show proficiency' widget.
"""
import sys
sys.path.append('..')
from random import randint
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton,
QHBoxLayout, QVBoxLayout)
from proficiency import Proficiency
import utils
class ProficiencyExa... |
# vim: set fileencoding=utf-8 :
import unittest
import pyvips
from .helpers import PyvipsTester
class TestCreate(PyvipsTester):
def test_black(self):
im = pyvips.Image.black(100, 100)
self.assertEqual(im.width, 100)
self.assertEqual(im.height, 100)
self.assertEqual(im.format, pyv... |
from test_framework import generic_test
from test_framework.test_failure import TestFailure
class QueueWithMax:
def enqueue(self, x: int) -> None:
# TODO - you fill in here.
return
def dequeue(self) -> int:
# TODO - you fill in here.
return 0
def max(self) -> int:
... |
import re
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
# phone number regex
pnum_pattern = re.compile(r'[0-9]{10}')
def validate_pnum(pnum):
"""Raise validation error if not a 10 digit phone number"""
if not re.match(pnum_pattern, pnum):
... |
# -*- coding: utf-8 -*-
import unittest
from solve1 import Moon, Vector, apply_gravity
class VectorUnitTests(unittest.TestCase):
def test_constructor(self):
v = Vector()
self.assertEqual(v.x, 0)
self.assertEqual(v.y, 0)
self.assertEqual(v.z, 0)
v = Vector.parse("<x=-1, ... |
# Copyright 2021 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... |
import json
def get_jwt_auth_header(username, password, client):
"""Executes the process to create a jwt header. It's just a way to avoid
repeated code in tests.
:returns: a dict with the header 'Authorization' and a valid value.
"""
payload = {'username': username, 'password': password}
aut... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# jobmanager - [insert a few words of module description on this line]
# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms o... |
# Generated by Django 2.2 on 2019-04-07 12:04
import accounts.validators
import django.contrib.auth.models
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
... |
#
# Project Kimchi
#
# Copyright IBM, Corp. 2014
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This lib... |
from app import db
from werkzeug import generate_password_hash, check_password_hash
class User(db.Model):
id = db.Column(db.Integer, primary_key = True)
firstname = db.Column(db.String(100))
lastname = db.Column(db.String(100))
email = db.Column(db.String(120), unique=True)
pwdhash = db.Column(db.String(5... |
#!/usr/bin/env python
from ROOT import TMVA, TFile, TString
from array import array
from subprocess import call
from os.path import isfile
# Setup TMVA
TMVA.Tools.Instance()
TMVA.PyMethodBase.PyInitialize()
reader = TMVA.Reader("Color:!Silent")
# Load data
if not isfile('tmva_reg_example.root'):
call(['curl', '-... |
# Copyright 2010-present Basho 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import random
import math
from Util import *
import ECS
import Cheats
import GameComponents
import GameData
import Actions
import Window
def LoadEntities( self ):
self.playerAction = None
def playerAction( __, _, wasBlocked, curTurn ):
if self.playerAction is not None:
char = GameData.Pla... |
from django.shortcuts import render
from web.models import Candidato, IdeaFuerza, Cita, Documento, Noticia
# Create your views here.
def index(request):
ideasfuerza_m = IdeaFuerza.objects.filter(seccion='m').order_by('orden')
m_columns = 0
if len(ideasfuerza_m) > 0:
m_columns = 12 / len(ideasfuerza... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import frappe, erpnext
from frappe import _, scrub
from frappe.utils import cint, flt, cstr, fmt_money, round_based_on_smallest_currency_fra... |
import sys
from PyQt4 import QtGui, QtCore
class LoginDialog(QtGui.QDialog):
def __init__(self, parent=None):
super(LoginDialog, self).__init__(parent)
self.username = QtGui.QLineEdit()
self.password = QtGui.QLineEdit()
loginLayout = QtGui.QFormLayout()
loginLayou... |
# -*- coding: utf-8 -*-
# This file is part of PyBOSSA.
#
# PyBOSSA 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.
#
# PyBOSSA... |
# -*- coding: utf-8 -*-
import datetime
from django import forms
GAS_QUANTITY = (
('20', '20 Litres'),
('25', '25 Litres'),
('30', '30 Litres'),
('35', '35 Litres'),
('40', '40 Litres'),
('45', '45 Litres'),
('50', '50 Litres'),
('55', '55 Litres'),
('60', '60 Litres'),
)
class ... |
# Copyright (c) 2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
from twisted.application import internet, service, strports
from twisted.conch import manhole, manhole_ssh, error as conch_error
from twisted.conch.insults import insults
from twisted.conch.ssh import keys
from twisted.cred im... |
"""
Copyright © 2017 Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>
This file is part of Authenticator.
Authenticator 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, o... |
from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Max
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.utils import ... |
from __future__ import division, print_function
import operator
from collections import OrderedDict
import numpy as np
import pandas as pd
import toolz
from tornado.ioloop import IOLoop
from tornado import gen
from ..collection import Streaming, _stream_types, OperatorMixin
from ..sources import Source
from ..utils i... |
'''
Created on Jun 9, 2013
@author: mmartin
'''
import sys
from gi.repository import Gtk
from CDMIAbout import CDMIAbout
from CDMIConnect import CDMIConnect
from CDMIHelp import CDMIHelp
class Handlers(object):
'''
classdocs
'''
def __init__(self, session):
self.session = session
de... |
# Copyright (C) 2012 Daniil Egorov <datsideofthemoon@gmail.com>
# 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 2011 Twitter, 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... |
# coding=utf-8
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from bs4 import BeautifulSoup
import sys
#phantonPath = "/home/jmartinz/00.py/phantomjs/phantomjs"
phantonPath = "../phantomjs/phantomjs"
contratacionPage = "https://... |
from drillion.animation_component import AnimationComponent
from drillion.collision import CollisionBody
from drillion.collision_component import CollisionComponent
from drillion.entity import Entity
from drillion.maths import Polygon2, Transform2
from drillion.sprite import PolygonSprite
from drillion.sprite_component... |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Python API for the Nitrate test case management system.
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
# Author: Petr Splichal <psplicha@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Th... |
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import sys
import tempfile
import threading
import time
import unittest
import warnings
from pathlib import Path
from unittest import mock, skipIf
from ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Gottesdienst.dauer'
db.add_column(u'gottesdienste_gottesd... |
from xml.parsers import expat
class TagStack(object):
def __init__(self):
self.tags = []
self.args = []
self.data = []
self.dataAdded = []
self.stackSize = 0
self.frameHasData = False
def push(self, tag, args):
self.tags.append(tag)
self.args.ap... |
#-------------------------------------------------------------------------------
# Name: regular backend
# Purpose:
#
# Author: D1617 64
#
# Created: 11-08-2013
# Copyright: (c) D1617 64 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------... |
import collections
import os
from protorpc import protojson
from . import messages
class Stats(object):
def __init__(self, pod, paths_to_contents=None):
self.pod = pod
if paths_to_contents is None:
paths_to_contents = pod.export()
self.paths_to_contents = paths_to_contents
def get_num_files_pe... |
import time
from twython import TwythonStreamer
import subprocess
def say(words):
devnull = open("/dev/null","w")
subprocess.call(["espeak","-v", "en-rp",words],stderr=devnull)
def showinpanel():
devnull = open("/dev/null","w")
subprocess.call(["sudo","./rpi-rgb-led-matrix-master/led-matrix","-p","2","-D","1","-t... |
"""
Define the SeriesGroupBy and DataFrameGroupBy
classes that hold the groupby interfaces (and some implementations).
These are user facing as the result of the ``df.groupby(...)`` operations,
which here returns a DataFrameGroupBy object.
"""
from __future__ import annotations
from collections import (
abc,
... |
import numpy
import sip
from PyQt4.QtGui import QColor, QRadialGradient, QPainterPathStroker
from PyQt4.QtCore import QObject, QSignalMapper
from PyQt4.QtCore import pyqtSignal as Signal
def saturated(color, factor=150):
"""Return a saturated color.
"""
h = color.hsvHueF()
s = color.hsvSaturationF()... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Copyright (c) 2014, Santiago Videla
#
# This file is part of pyzcasp.
#
# caspo 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.
#
# c... |
# Copyright 2014 Open vStorage NV
#
# 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 writ... |
"""Create a queue."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import mq
import click
@click.command()
@click.argument('account-id')
@click.argument('queue-name')
@click.option('--datacenter', help="Datacenter, E.G.: dal05")
@click.opti... |
import argparse
import os
import re
import subprocess
from . import tool
from .common import check_which, Command, guess_command, make_command_converter
from .. import log, options as opts, shell
from ..exceptions import PackageResolutionError, PackageVersionError
from ..iterutils import iterate, listify
from ..objuti... |
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
import math
from pymel.core import curve, cluster, delete, dt, duplicate, expression, group, hide, ikHandle, insertKnotCurve, joint, move, orientConstraint, parent, parentConstraint, pointConstraint, xform
from ....a... |
import json
from twisted.internet import defer, task
from twisted.trial import unittest
from txjason import client
clock = task.Clock()
class ClientTestCase(unittest.TestCase):
def setUp(self):
self.client = client.JSONRPCClient(reactor=clock)
def checkPayload(self, payload, expected, d=None):
... |
# Copyright 2016 Commerce 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 applicable law or agreed to ... |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... |
# This file is part of Scapy
# Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
# 2015, 2016, 2017 Maxence Tury
# This program is published under a GPLv2 license
"""
The _TLSAutomaton class provides methods common to both TLS client and server.
"""
import struct
from scapy.automaton import Automaton
from ... |
import argparse
import json
import os
import shutil
missing_modules = {}
try:
import orfan
except ImportError:
missing_modules['orfan'] = "main Orfan module missing"
if len(missing_modules)>0:
print("Error: Missing python modules:")
for k,v in missing_modules.items():
print(" {:20s} {}".fo... |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django_docker_processes.models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_US... |
from sympy.core import Set, Dict, Tuple, Rational
from .cartan_type import Standard_Cartan
from sympy.matrices import Matrix
class TypeF(Standard_Cartan):
def __init__(self, n):
assert n == 4
Standard_Cartan.__init__(self, "F", 4)
def dimension(self):
"""
Returns the dimensio... |
# Copyright (C) 2008 One Laptop Per Child
#
# 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 program is distribu... |
# Copyright 2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def rsplit(s, count):
f = lambda x: x > 0 and x or 0
return [s[f(i - count):i] for i in range(len(s), 0, -count)]
def id2mid(id):
result = ''
for i in rsplit(id, 7):
str62 = base62_encode(int(i))
result = str62... |
import logging
logger = logging.getLogger('parse_cdr3.py')
from .all_genes import all_genes, gap_character
def get_cdr3_and_j_match_counts( organism, ab, qseq, j_gene, min_min_j_matchlen = 3,
extended_cdr3 = False ):
#fasta = all_fasta[organism]
jg = all_genes[organism][j_gene... |
try:
from eventlet.green import zmq
except ImportError:
zmq = {} # for systems lacking zmq, skips tests instead of barfing
else:
RECV_ON_CLOSED_SOCKET_ERRNOS = (zmq.ENOTSUP, zmq.ENOTSOCK)
import eventlet
from eventlet import event, spawn, sleep, semaphore
import tests
def zmq_supported(_):
try:
... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from griddialog import *
from wequ import wequ
import pickle
from tkinter.messagebox import showerror
class Equations():
def cleanup(self,dig):
if dig.status == "Save":
self.Mat = dig.get()
self.SaveEquations()
if dig.top: dig.top.destroy()
def SaveEquations(self):
# Save Mat Equations to file
if len... |
"""
Django module container for classes and operations related to the "Course Module" content type
"""
import json
import logging
from cStringIO import StringIO
from datetime import datetime
import requests
from django.utils.timezone import UTC
from lazy import lazy
from lxml import etree
from path import Path as path... |
from django.test import TestCase
import datetime
from django.utils import timezone
from notes.models import Post
# Create your tests here.
class PostMethodTests(TestCase):
def test_waspublishedrecently_with_future_post(self):
"""
:return: False for post whose published_date is in the future
... |
from math import ceil
from django.db import IntegrityError, connection, models
from django.db.models.deletion import Collector
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models import (
MR, A, Avatar, Base, Child,... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
#!/usr/bin/env python
# Tai Sakuma <tai.sakuma@cern.ch>
##__________________________________________________________________||
import os, sys
import timeit
import array
import ROOT
from alphatwirl.roottree import Events, BEvents
##__________________________________________________________________||
inputPath = 'tree.... |
import copy
from PyQt4 import QtCore, QtGui
from utils.utils import Utils
sizeX = 1024
sizeY = 768
class Stroke:
"""Basic Stroke"""
def __init__(self, path=[], width=0, color=[0,0,0,255], id='none'):
self.path = path
self.width = width
self.color = color
if id == 'none':
... |
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## 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 v... |
import ctypes
import windows.generated_def as gdef
from windows.pycompat import int_types
from ..apiproxy import ApiProxy, NeededParameter
from ..error import fail_on_zero
class DbgHelpProxy(ApiProxy):
APIDLL = "dbghelp"
default_error_check = staticmethod(fail_on_zero)
# We keep the simple definition where c... |
"""Datatype validation."""
__all__ = ['failures', 'is_valid']
from collections import defaultdict
from datatype.tools import Choice, Literal, walk
def is_valid(datatype, value):
"""Return boolean representing validity of `value` against `datatype`."""
return not failures(datatype, value)
def failures(dat... |
#!/usr/bin/env python
"""
Run timing test (GPU) scaled over number of ports.
"""
import csv
import glob
import multiprocessing as mp
import os
import re
import subprocess
import sys
import numpy as np
from neurokernel.tools.misc import get_pids_open
try:
from subprocess import DEVNULL
except ImportError:
i... |
# Add the upper directory (where the nodebox module is) to the search path.
import os, sys; sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics import *
# The render() command executes a function with drawing commands
# in an offscreen (i.e. hidden) canvas and returns an Image object.
# This is useful ... |
from buildercore import lifecycle
from decorators import requires_aws_stack, timeit, echo_output
@requires_aws_stack
@timeit
def start(stackname):
"Starts the nodes of 'stackname'. Idempotent"
lifecycle.start(stackname)
@requires_aws_stack
@timeit
def stop(stackname, *services):
"""Stops the nodes of 'sta... |
"""Doc string Here."""
import mne
from mne.minimum_norm import (apply_inverse_epochs, read_inverse_operator)
import socket
import numpy as np
# import matplotlib.pyplot as plt
from sklearn.ensemble import AdaBoostClassifier
# from sklearn.tree import DecisionTreeClassifier
# from sklearn.metrics import confusion_mat... |
#!/usr/bin/env python
'''
show times when signal is lost
'''
import sys, time, os
# allow import from the parent directory, where mavlink.py is
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
from optparse import OptionParser
parser = OptionParser("sigloss.py [options... |
# Copyright 2014 Klaudiusz Staniek
#
# 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... |
import wpilib
from networktables import NetworkTable
class Drive(object):
'''
The sole interaction between the robot and its driving system
occurs here. Anything that wants to drive the robot must go
through this class.
'''
def __init__(self, robotDrive, gyro, backInfrared):
'''
Constructor.
:p... |
import web
import oauthlib.oauth2.rfc6749
import constants
import common
import base
import logging
import pprint
from models import oauth_consumer
class Login(base.Page):
def __init__(self):
base.Page.__init__(self, "Riolet Login")
self.redirect_uri = unicode(constants.config.get('github', 'redir... |
'''
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note: The solution set must not contain duplicate triplets.
For example, given array S = [-1, 0, 1, 2, -1, -4],
A solution set is:
[
[-1, 0, 1],
[-1, -1,... |
from __future__ import print_function
import os
import io
import time
import functools
import collections
import collections.abc
import numpy as np
import requests
import IPython
import zmq
# https://stackoverflow.com/questions/14267555/find-the-smallest-power-of-2-greater-than-n-in-python
def next_power_of_2(x):
... |
# topological.py
# Copyright (C) 2005, 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Topological sorting algorithms.
The topological sort is an algorithm that receives this list of
... |
from __future__ import unicode_literals
import boto3
import six
import json
import sure # noqa
from botocore.exceptions import ClientError
from moto import mock_sns
from moto.sns.models import DEFAULT_TOPIC_POLICY, DEFAULT_EFFECTIVE_DELIVERY_POLICY, DEFAULT_PAGE_SIZE
@mock_sns
def test_create_and_delete_topic():
... |
import os
import shutil
from vex import exceptions
def obviously_not_a_virtualenv(path):
include = os.path.join(path, 'include')
bin = os.path.join(path, 'bin')
scripts = os.path.join(path, 'Scripts')
if not os.path.exists(bin) and not os.path.exists(scripts):
return True
if os.path.exists... |
# pylint: disable=missing-docstring
"""
Common functionality to be reused among tests.
"""
from __future__ import absolute_import, print_function
import glob
import os
import subprocess as sub
import conf
import util
import util.db_control as dbc
DB_START = os.path.join(util.ROOT, 'conf', '.db_start')
def alive(pid... |
from datetime import datetime
from feedrsub.ingestion.parsers.json_activitystream.json_item_parser import (
JsonItemParser,
)
from feedrsub.models.entry import Entry
from tests.conftest import valid_uuid, assert_datetime_almost_equal
def test_item_guid():
item = dict(id="abcde")
parser = JsonItemParser(i... |
import urlparse
import json
import Cookie
import squeakspace.common.squeak_ex as ex
def json_fun(object):
#return json.dumps(object)
return json.dumps(object, indent=4) + '\n'
def respond(environ, start_response, status, content, response_headers=None):
if response_headers == None:
response_hea... |
"""
Run through the socialusers API testing what's there.
Read the TESTS variable as document of
the capabilities of the API.
If you run this test file by itself, instead
of as a test it will produce a list of test
requests and some associated information.
"""
import os
from test.fixtures import make_test_env
from... |
import time
from ..utils.log import log, INFO, ERROR, PASS
from ..utils.isaac import get_hexagon_properties
from ..utils.i_selenium import assert_tab, image_div
from ..tests import TestWithDependency
from selenium.common.exceptions import NoSuchElementException
__all__ = ["back_to_board"]
#####
# Test : Back to Boar... |
import textwrap
import pytest
from sphinx.application import Sphinx
def _format_option_raw(key, val):
if isinstance(val, bool) and val:
return ':%s:' % key
return ':%s: %s' % (key, val)
@pytest.fixture(scope='function')
def run_sphinx(tmpdir):
src = tmpdir.ensure('src', dir=True)
out = tmpd... |
import unittest
import pika
import json
import time
import requests
import threading
import amqpconsumer.components.agent
class AMQPTest(unittest.TestCase):
def setUp(self):
reg = requests.post('http://localhost/api/v1/insights/register',
data=json.dumps({'name': 'Unit Teste... |
# 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... |
##
# Copyright (c) 2010-2015 Apple 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 applicab... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... |
""":mod:`wikidata.quantity` --- Quantity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.7.0
"""
from typing import Optional
from .entity import Entity
__all__ = 'Quantity',
class Quantity:
"""A Quantity value represents a decimal number, together with information
about the uncertainty interv... |
import re
try:
import ujson as json
except ImportError:
import json
try:
import jsonpath_rw
except ImportError:
jsonpath_rw = None
try:
import lxml.etree
except ImportError:
lxml = None
try:
import yaml
except ImportError:
yaml = None
class QueryAttr(object):
def __init__(self, q... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.