src stringlengths 721 1.04M |
|---|
# Copyright 2010 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 l... |
# -*- coding: utf-8 -*-
#
# flask-request-params documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 25 19:11:33 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerate... |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Sketching on touchscreen
#----------------------------------------------------------------------------
# Copyright 2008, Oliver White
#
# This program is free software: you can redistribute it and/or modify
# it unde... |
from copy import deepcopy
from threading import Event, Lock, Thread
import bluetooth as bt
from constants import UUID
from receiver import Receiver
class Pi(Thread):
def __init__(self):
Thread.__init__(self)
self._devices = {}
self._lock_devices = Lock()
self.server_sock = bt.B... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/python
# This is a script to download course lists of a department in all quarters.
# Usage: python download_all_courses_in_a_department.py department_name
# Example: python download_all_courses_in_a_department.py COMPSCI
import urllib2, sys, os, string
def find_between( s, first, last ):
try:
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import tempfile
import string
import random
import pickle
import pytest
import datrie
def test_trie():
trie = datrie.Trie(string.printable)
assert trie.is_dirty() == True
assert 'foo' not in trie
assert 'Foo' not in trie... |
"""Test suite for distutils.
This test suite consists of a collection of test modules in the
distutils.tests package. Each test module has a name starting with
'test' and contains a function test_suite(). The function is expected
to return an initialized unittest.TestSuite instance.
Tests for the command classes in... |
"""
Top-level system wrapper.
"""
import re
import sys
import pandas as pd
from simulator.exception import SimulatorException
class System:
"""
A system class to wrap a collection of processing and memory elements as well as the channels through which they
communicate.
"""
def __init__(self):
... |
# -*- encoding: utf-8 -*-
from django.test import TestCase
from scriptorium.elementor import GenericElement
class TestAbstractBaseElement(TestCase):
def setUp(self):
self.ele = GenericElement("div")
self.second_ele = GenericElement("div")
def test_add_classes(self):
self.ele.add_cls(... |
import tensorflow as tf
import cv2 as cv
import numpy as np
import time as te
from parse import *
ABS_PATH="/home/visualization/work/ML/tensorflow/separa/"
SIZE = 828
LABEL = 6
TRAIN_SIZE = 768
BATCH_SIZE = 128
GLOBAL_STEP = 200000
DECAY_STEPS = 10
EVAL_SIZE = SIZE - TRAIN_SIZE
IMAGE_SIZE = 128
NUM_CHANNEL = 1
TRAI... |
import ast
import logging
import os
import traceback
from celery.signals import after_task_publish, task_failure, task_success
from celery.utils.log import get_task_logger
from django.core.exceptions import ObjectDoesNotExist
from contentcuration.models import Task, User
# because Celery connects signals upon import... |
#########################################################################
# #
# Name: SQPRO (Service definition for Quick Protocolo #
# #
# Project: PQPRO ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Get the version
version_regex = r'__version__ = ["\']([^"\']*)["\']'
with open('hpack/__init__.py', 'r') as f:
text = f.read()
match = r... |
import unittest
from unittest.mock import patch, PropertyMock, Mock
from Firefly import Scheduler
from Firefly.helpers.location import Location
from Firefly.helpers.events import Event
from Firefly.const import EVENT_TYPE_BROADCAST, SOURCE_LOCATION
# Change this to false if you are not connected to the internet.
SETUP... |
from ..algorithm import EncryptionAlgorithm
from ..transform import CryptoTransform
from abc import ABCMeta
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
def _default_encryption_padding():
return padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA1(... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# lifetimes documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 7 14:10:36 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... |
# Algorithms classes for medalbound package.
# Copyright 2015-2021 Joseph Samuel Myers.
# 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) a... |
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.config import config
from Components.AVSwitch import AVSwitch
from Components.SystemInfo import SystemInfo
from GlobalActions import globalActionMap
from enigma import eDVBVolumecontrol
from os import path
import Screens.InfoBar
inSta... |
import sys
from distutils.core import setup
VERSION_FILE = 'codebug_tether/version.py'
PY3 = sys.version_info[0] >= 3
def get_version():
if PY3:
version_vars = {}
with open(VERSION_FILE) as f:
code = compile(f.read(), VERSION_FILE, 'exec')
exec(code, None, version_vars)
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012, Rui Carmo
Description: In-process job management
License: MIT (see LICENSE.md for details)
"""
from Queue import Empty, Queue, PriorityQueue
from collections import defaultdict
from functools import partial
from signal import signal, SIGINT, SIGTERM, S... |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
from authentic2.compat import user_model_label
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'AuthenticationEvent'
db.create_table(u'authentic2_authenticationevent', (
(u'i... |
#!/usr/bin/env python3
"""
Created on 27 Sep 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
import json
from scs_core.data.json import JSONify
from scs_core.data.path_dict import PathDict
# -------------------------------------------------------------------------------------------------------... |
# Copyright (c) 2010-2016 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from mock import Mock
from boxsdk.object.legal_hold_policy_assignment import LegalHoldPolicyAssignment
from boxsdk.config import API
from boxsdk.network.default_network import DefaultNetworkResponse
def test_get(test_legal_hold_policy_assignment,... |
# Linear and nonlinear control of startup of a CSTR.
import mpctools as mpc
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
import time
# Define some parameters and then the CSTR model.
Nx = 3
Nu = 2
Nd = 1
# Ny = Nx
Delta = .25
# eps = 1e-6 # Use this as a small number.
T0 = 350
c0... |
# Copyright 2015 healthcheck-as-a-service authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import unittest
import json
import mock
import inspect
import os
from healthcheck import api, backends
from . import managers
class APITestCas... |
from collections import defaultdict
from rest_framework import serializers
from .models import ResourceItem, ResourceSla
from .utils import get_period, to_list
class ResourceSlaStateTransitionSerializer(serializers.Serializer):
timestamp = serializers.IntegerField()
state = serializers.SerializerMethodField... |
from mock import Mock, MagicMock
import unittest2 as unittest
from contextlib import contextmanager
from monocle.callback import defer
from helpers import mock_db, listen_for, mock_worker
def _account_for_test(config=None, db=None):
from tinymail.account import Account
if config is None:
config = {
... |
"""
Copyright 2013 OpERA
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, softwar... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Unit tests for wikipedia.py"""
# This test script is intended to be used with mature unittest code.
#
# This script contains important unittests in order to ensure the function
# and stability of core code (for e.g. DrTrigonBot framework) and methods.
# You should not cha... |
#!/usr/bin/env python3
# Copyright 2014-2019 Netflix, 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 applicabl... |
# MyLibrary.py
import sys, time, random, math, pygame
from pygame.locals import *
# prints text using the supplied font
def print_text(font, x, y, text, color=(255, 255, 255)):
imgText = font.render(text, True, color)
screen = pygame.display.get_surface() # req'd when function moved into MyLibrary
scree... |
import multiprocessing as mp
import nibabel as nib
import nipype.interfaces.io as nio
import numpy as np
import os
import pandas as pd
from itertools import product
from joblib import Parallel, delayed
from os import path
# PyBIDS 0.6.5 and 0.10.2 compatibility
try:
from bids.grabbids import BIDSLayout
except ModuleNo... |
# -*- mode:python; tab-width:4; indent-tabs-mode:t; -*-
# slideshow.py
#
# Classes to represent a deck of slides, and handle things like file I/O and
# formats
# B. Mayton <bmayton@cs.washington.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publi... |
import inspect
import logging
import venusian
from pyramid.config import predicates
log = logging.getLogger(__name__)
SERVICES = {}
def get_services():
return SERVICES.values()
class ViewMapper(object):
""" Mapper to pass request specific data to view method
"""
ROOT_ARRAY_KW_NAME = "items"
... |
#
# Copyright (C) 2012 UNINETT
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope th... |
from django.db import models
from django.contrib.auth.models import User
import project
class TaskSeverity(models.Model):
name = models.CharField('Name', max_length=255)
sort_order = models.IntegerField('Sort Order', default=99)
def __unicode__(self):
return str(self)
def __str__(self):
... |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyostila ... |
#!/usr/bin/python
import time
import smbus
#from Adafruit_I2C import Adafruit_I2C
# ===========================================================================
# ADS1x15 Class
#
# Originally written by K. Townsend, Adafruit (https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/master/Adafruit_ADS1x15)
#... |
import os
import shutil
import time
from seleniumbase.config import settings
from seleniumbase.fixtures import constants
# The "downloads_folder" is a folder for saving downloaded files.
# Works for downloads initiated by Chromium and Firefox WebDriver clicks.
# Browser type doesn't matter if using self.download_file(... |
from collections import defaultdict
import mock
from searx.engines import qwant
from searx.testing import SearxTestCase
class TestQwantEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dicto = defaultdict(dict)
dicto['pageno'] = 0
dicto['language'] = 'fr-FR'
... |
# Copyright 2013 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
#!/usr/bin/env python
import os
import tempfile
import networkx as nx
from networkx.testing.utils import *
class TestGpickle(object):
@classmethod
def setup_class(cls):
G = nx.Graph(name="test")
e = [('a', 'b'), ('b', 'c'), ('c', 'd'), ('d', 'e'), ('e', 'f'), ('a', 'f')]
G.add_edges_f... |
import random
from copy import deepcopy
DIRECTIONS = ['right', 'left', 'up', 'down']
def locate_free_square(width, height, obstacles):
square = {'x': 0, 'y': 0}
while square in obstacles:
square['x'] = random.choice( range(0,width) )
square['y'] = random.choice( range(0,height) )
retur... |
# 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 agreed to in writing, ... |
from utils import version, deferred_verpick
from cfme.exceptions import OptionNotAvailable
from cfme.web_ui import fill, flash
from cfme.fixtures import pytest_selenium as sel
from . import Instance, select_provision_image
class GCEInstance(Instance):
# CFME & provider power control options
START = "Start"
... |
#!/usr/bin/env python
# Implements a GENIA Treebank - like tokenization.
# This is a python translation of my GTB-tokenize.pl, which in turn
# draws in part on Robert MacIntyre's 1995 PTB tokenizer,
# (http://www.cis.upenn.edu/~treebank/tokenizer.sed) and Yoshimasa
# Tsuruoka's GENIA tagger tokenization (tokenize.cp... |
# coding: utf-8
import os
from signal import SIGUSR1
from celery.result import AsyncResult
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class DownloadT... |
import hashlib
import os
import time
import ujson
import urllib.request
import OSMPythonTools
class CacheObject:
def __init__(self, prefix, endpoint, cacheDir='cache', waitBetweenQueries=None, jsonResult=True):
self._prefix = prefix
self._endpoint = endpoint
self.__cacheDir = cacheDir
... |
# iban.py - functions for handling International Bank Account Numbers (IBANs)
#
# Copyright (C) 2011, 2012, 2013 Arthur de Jong
#
# 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
# ... |
import pymysql
from sauron.metrics import Metric, MetricException
class MySQLMetric(Metric):
def __init__(self, name, host=None, user=None, passwd=None, **kwargs):
Metric.__init__(self, name, **kwargs)
self.reconfig(name, host, user, passwd)
def reconfig(self, name, host=None, user=None, pass... |
import os
import tempfile
import shutil
import git
from mock import Mock, patch
from ..testcases import DustyTestCase
from dusty.commands.repos import override_repo
from dusty.source import Repo, git_error_handling
from dusty.compiler.spec_assembler import get_all_repos
class TestSource(DustyTestCase):
def setUp... |
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource information of userrestrictrole
"""
def get_name(friendly=False):
"""Get name of this resource
:return: name of this resource
:rtype: str
"""
if friendly: # pragma: no cover
return "User role restriction"
return 'userrestrict... |
#!/usr/bin/env python
from __future__ import print_function, division
import unittest
import struct
import csv
import sys
import subprocess
import tempfile
import os
import io
import re
try:
import gen_esp32part
except ImportError:
sys.path.append("..")
import gen_esp32part
SIMPLE_CSV = """
# Name,Type,Su... |
# Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... |
# -*- coding: utf-8 -*-
"""
************************************************************************************
Class : USDA_28_Reader
Author : Thierry Maillard (TMD)
Date : 29/7/2016 - 2/10/2016
Role : Read a USDA 2013 database from CSV or CSVzipped text file.
Licence : GPLv3
Copyright (c) 2016 - Thierry Maillard... |
"""
Set of programs to read and interact with output from Multifluid/multispecies
"""
import numpy as np
import os
from .bifrost import BifrostData, Rhoeetab, read_idl_ascii, subs2grph
class EbysusData(BifrostData):
"""
Class to hold data from Multifluid/multispecies simulations
in native format.
""... |
import pandas as pd
import numpy as np
import re
import json
import os
import warnings
import shutil
from pathlib import Path
import codecs
"""
Helper functions to load the article data. The main method to use
is load_data().
"""
# Caution! Modifying this in code will have no effect since the
# default arguments are ... |
# -*- coding: utf-8 -*-
import functools
from tornado.web import HTTPError
import settings
def admin_auth_async(method):
@functools.wraps(method)
async def wrapper(self, *args, **kwargs):
self.current_user = await self.get_current_admin_async()
if not self.current_user:
raise HT... |
#!/usr/bin/env python
#
# cachepurgy - script to reduce the size of a jftpgw cache
#
# (C) 2001 Julian Einwag <julian@brightstar.swin.de>
#
from sys import *
from os import *
from string import *
from stat import *
from time import *
maxsize = 40*1024*1024
cachedir = "/tmp/cache"
# This class stores the informati... |
# coding: utf-8
from sqlalchemy import BigInteger, Column, Index, Integer, String, VARBINARY
from sqlalchemy import String, Unicode, ForeignKey
from sqlalchemy.orm import relationship, backref
from dbdatetime import dbdatetime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata ... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import datetime
import pkg_resources
# -- Path setup --------------------------------... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
from sslyze.concurrent_scanner import ConcurrentScanner
from sslyze.plugins.certificate_info_plugin import CertificateInfoScanCommand
from sslyze.plugins.compression_plugin import CompressionScanComm... |
"""
Functions for working with arXiv identifier strings.
"""
import re
from sets import Set
def extract(value):
"""
Attempt to extract an arXiv identifier from a string.
:param value: String to extract arXiv identifier from
:raises ValueError: If value does not contain an arXiv identifier
:re... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TaggedItem'
db.create_table('blog_taggeditem', (
('id', self.gf('django.db.model... |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# 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 Soft... |
import Control
from tkinter.messagebox import showerror
from Window import *
from Utils import *
canvas, field, scale = None, None, None
def init(window, p_field=-1, p_scale=10):
"""using to init World with params"""
global canvas, field, scale
canvas = tk.Canvas(window, highlightthickness=0, bg='#FFF3A4'... |
""" bends with grating couplers inside the spiral
maybe: need to add grating coupler loopback as well
"""
from typing import Optional, Tuple
import numpy as np
import pp
from pp.component import Component
from pp.components.bend_circular import bend_circular, bend_circular180
from pp.components.bend_euler import bend... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus
import processout
from processout.networking.request import Request
from processout.networking.response import Response
# The content of this file was automatically generated
class Token(object):
def __init__(sel... |
# -*- coding: utf-8 -*-
__author__ = 'zappyk'
from lib_zappyk._email import _email
from lib_zappyk._os_file import _nameListDir
from lib_zappyk._string import _removeFirstEmptyLine, _stringToList, _search
from FindNameSend.cfg.load_cfg import parser_args, parser_conf, logger_conf
from FindNameSend.cfg.load_ini i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Rafael Figueroa
"""
#Python imports
import numpy as np
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
#pyqtgraph configuration
pg.setConfigOptions(antialias = True)
class GUI_haws:
def __init__(self):
#Qt Initialization (once per ... |
"""
QM/MM test simulation
"""
from pycp2k import CP2K
#===============================================================================
# Setup calculator
calc = CP2K()
calc.working_directory = "./"
calc.project_name = "qmmmwater"
calc.mpi_n_processes = 2
#==============================================================... |
# Copyright 2005-2010 Wesabe, 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 ... |
import os
import pycqed as pq
import unittest
import h5py
from pycqed.measurement import hdf5_data as h5d
import numpy as np
import pycqed.utilities.general as gen
from pycqed.measurement import measurement_control
from pycqed.instrument_drivers.physical_instruments.dummy_instruments \
import DummyParHolder
from q... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
from tornado import netutil
from tornado.escape import json_decode, json_encode, utf8, _unicode, recursive_unicode, native_str
from tornado import gen
from tornado.http1connection import HTTP1Connection
from tornado... |
'''
Custom django admin command to import data from CSV file into database
'''
# Copyright (C) 2013 Timothy James Austen, Eileen Qiuhua Lin,
# Richard Esplin <richard-oss@esplins.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Unity Autopilot Test Suite
# Copyright (C) 2012, 2013, 2014, 2015 Canonical
#
# 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 F... |
import dbus
import os
from networkmanager.base import Bus
from networkmanager.applet.settings import Settings
# server analog of cConnection
class Connection(dbus.service.Object):
def __init__(self, opath, conmap):
assert isinstance(conmap, dict)
bus = Bus()
dbus.service.Object.__init__(sel... |
#!/usr/bin/env python
import os
import json
import StringIO
from contextlib import closing
import re
import time
import pprint
import boto3
from boto3.session import Session
import botocore
import jwt
from cryptography.x509 import load_pem_x509_certificate
from cryptography.hazmat.backends import default_backend
#... |
#!/usr/bin/env python
# Author: Morgan Langille (morgan.g.i.langille@gmail.com)
# count_wagner.py
""" Application controller for the `ace' function within the R package `ape`.
File created on Feb 2012.
"""
from __future__ import division
from cogent.util.table import Table
from os.path import split, splitext
from os... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.18
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
from kkmonleeUtils import EulerTools
import math
upperlim = 75000000
primes = EulerTools.primes_sieve(upperlim)
factor_dict = {}
# Compute how many of each prime factors are there in 75000000!
for p in primes:
num_factors = 0
q = p
while upperlim // q > 0:
num_factors += upperlim // q
q *=... |
# -*- coding: utf-8 -*-
"""
jinja2.loaders
~~~~~~~~~~~~~~
Jinja loader classes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import weakref
from types import ModuleType
from os import path
from hashlib import sha1
from jinja2.excepti... |
from abstract_graph import Abstract_Graph, Abstract_Edge, Abstract_Vertex
import abstract_graph
import os
import saveparser
import experimental
import graph
import logging
import cStringIO
import itertools
from test_util import TestUtils
from rectangle import Rectangle
from utils import conjugate
import utils
DEEP_T... |
CORE_DOMAINS = ["Random sequence generation", "Allocation concealment", "Blinding of participants and personnel",
"Blinding of outcome assessment", "Incomplete outcome data", "Selective reporting"]
# "OTHER" is generated in code, not in the mapping file
# see data/domai... |
import csv
import pandas as pd
def fix_turnstile_data(filenames):
'''
Filenames is a list of MTA Subway turnstile text files. A link to an example
MTA Subway turnstile text file can be seen at the URL below:
http://web.mta.info/developers/data/nyct/turnstile/turnstile_110507.txt
As you can see... |
#!/usr/bin/python
# This script automatically creates a list of examples by reading the header in all problem.c files.
import glob
import subprocess
ghash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip()
with open("version.txt") as f:
reboundversion = f.readlines()[0].strip()
pri... |
from TestSuite import EMPTY_NAMESPACE
def test(tester):
tester.startGroup('Entity')
tester.startTest('Testing syntax')
try:
from xml.dom import Entity
from xml.dom.Entity import Entity
except:
tester.error('Error in syntax', 1)
tester.testDone()
tester.startTest('Crea... |
#Modules
import configparser
from pokemontcgsdk import Set
from pokemontcgsdk import Card
from pymongo import MongoClient
#Config
Config = configparser.ConfigParser()
Config.read("settings.ini")
host = Config.get("db", "host")
port = Config.get("db", "port")
user = Config.get("db", "user")
password = Config.get("db", ... |
import ma
import unittest
class TrialTest(unittest.TestCase):
def test_events(self):
t = ma.Trial('trial')
evts = t.events()
self.assertEqual(t.hasChildren(), True)
self.assertEqual(evts.hasParents(), True)
self.assertEqual(t.name(), 'trial')
self.assertEqual(ev... |
import threading
from typing import Any, List, Optional
from rx.disposable import Disposable
from rx.core import Observable, Observer, typing
from rx.internal import DisposedException
from .innersubscription import InnerSubscription
class Subject(Observable, Observer, typing.Subject):
"""Represents an object th... |
# jon klein, jtklein@alaska.edu
# utility to display landsat-8 images for the decision theater north
# created during fairbanks 2015 hackathon
# mit license
import datetime
import time
import subprocess
import pdb
import re
import ast
import os
import argparse
from PIL import Image, ImageDraw, ImageFont
from geopy.g... |
#!/usr/bin/env python
##
## 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 Softwar... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from cStringIO import StringIO
import mock
from gratipay.testing import T
from gratipay.testing.email import QueuedEmailHarness
from pytest import raises
from gratipay.project_review_process import ConsolePoste... |
# -*- coding: utf-8 -*-
"""Authentication secrets store."""
#-----
# PyAuth
# Copyright (C) 2018 Silverglass Technical
# Author: Todd Knarr <tknarr@silverglass.org>
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.