src stringlengths 721 1.04M |
|---|
"""Tests for cement.core.exc."""
import unittest
from nose.tools import eq_, raises
from nose import SkipTest
from cement.core import exc
from cement.utils import test_helper as _t
class ExceptionTestCase(unittest.TestCase):
def setUp(self):
self.app = _t.prep()
@raises(exc.CementConfigError)
... |
#
# Simnet Network Layout: Two HANs with shared gateways implemented on host
#
# This simnet configuration defines two HANs, each with its own WiFi and Thread networks.
# Both HANs contain a single Weave device connected to the respective WiFi/Thread networks.
# The HANs also contain separate Gateway nodes that are imp... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2016 - now Bytebrand Outsourcing AG (<http://www.bytebrand.net>).
#
# This program is free software: you can redistribute it and/or modify
# it... |
# 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, ... |
import time
from decouple import config
from selenium import webdriver
HOME = config('HOME')
# page = webdriver.Firefox()
page = webdriver.Chrome(executable_path=HOME + '/chromedriver/chromedriver')
page.maximize_window()
time.sleep(0.5)
pages = [
'http://localhost:8000/',
'http://localhost:8000/proposal/entr... |
#! /usr/bin/env python
from __future__ import print_function, unicode_literals, division, absolute_import
from optparse import OptionParser
import os
import sys
import shutil
import io
class DirHelper(object):
def __init__(self, is_dir, list_dir, walk, rmtree):
self.is_dir = is_dir
self.list... |
# -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import copy
import io
import os
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import... |
from setuptools import setup
__version__ = (5, 5, 6)
setup(
name="nchelpers",
description="Helper classes and methods for Climate and Forecast NetCDF"
"datasets",
keywords="NetCDF climate forecast",
packages=['nchelpers'],
version='.'.join(str(d) for d in __version__),
url="htt... |
#!/usr/bin/python
# src from https://github.com/rusec/scapy-arpspoof-demo
from scapy.all import *
from argparse import ArgumentParser
import os
IP_FORWARD = '/proc/sys/net/ipv4/ip_forward'
TIMEOUT = 2
RETRY = 10
# This function uses argparse to parse command line
# arguments passed to the script.
def set_configs()... |
#!/usr/bin/env python
# -*- coding: utf_8 -*-
"""
Uki Articulation
Chris Mock, 2017
Uki Articulation UI
- Controls UkiModbusManager
- Plays CSV scripts/sequences to control speed/accel
Licensed under GNU General Public License v3.0, https://www.gnu.org/licenses/gpl-3.0.txt
"""
import threading
import time
... |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... |
import datetime
from akismet.exceptions import AkismetServerError, MissingParameterError
__version__ = '0.3.0'
PYTHON_AKISMET_USER_AGENT = "Python-Akismet/{0}".format(__version__)
# API URIs
AKISMET_PROTOCOL = 'https'
AKISMET_DOMAIN = 'rest.akismet.com'
AKISMET_VERSION = '1.1'
AKISMET_CHECK_URL = "{protocol}://{api_... |
import unittest
from reporting.parsers import JsonGrepParser
class JsonGrepParserTestCase(unittest.TestCase):
def test_case1(self):
parser=JsonGrepParser(pattern="chargebackData", list_name="hcp-chargeback")
input= '{"chargebackData":[{"systemName":"hcp1.s3.ersa.edu.au"}, {"systemName":"hcp2.s3.e... |
from django.conf import settings
from django.core.urlresolvers import reverse
import mock
from nose import SkipTest
from nose.tools import eq_
import amo
from lib.crypto import packaged
from lib.crypto.tests import mock_sign
from mkt.site.fixtures import fixture
from mkt.submit.tests.test_views import BasePackagedApp... |
# https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
import os
from xml.etree.ElementTree import ElementTree
import urllib.request
class NCBIEfetch(object):
def __init__(self, email_address="", download_folder="ncbi_files"):
self._email_address = email_address
self._base_url = "http://e... |
#!/usr/bin/python
import os,struct,sys
''' Version 0.1.0
ARC, DAT and MPP unpacker. '''
class FileBundle:
def __init__(self):
self.files = []
def addFiles(self):
raise NotImplementedError()
def extractFiles(self, outputFolder):
if not os.path.exists(outputFolder):
... |
from __future__ import division, print_function
import sys
from ..shared.functions import lagrangian_derivative_coefs
from numpy import linspace, power, empty, array, log
from ..shared.consolidation import (create_CON, CON_SLURRY, CON_GOMPERTZ,
CON_FREEFORM, CON_SLURRY_CC, CON_SLURR... |
from django.conf import settings
from django.core.cache import cache
from django.utils.cache import get_cache_key, learn_cache_key, patch_response_headers
class CacheMiddleware(object):
"""
Cache middleware. If this is enabled, each Django-powered page will be
cached for CACHE_MIDDLEWARE_SECONDS seconds. C... |
from kivy.base import runTouchApp
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.floatlayout import FloatLayout
from kivy.lang import Builder
import sys, os
sys.path.append(os.path.abspath(".."))
from rotabox import Rotabox
Builder.load_string('''
<Root>:
RotaButton:
size: 200, 50
cent... |
import numpy as np
import tensorflow as tf
def save_weights(graph, fpath):
sess = tf.get_default_session()
variables = graph.get_collection("variables")
variable_names = [v.name for v in variables]
kwargs = dict(zip(variable_names, sess.run(variables)))
np.savez(fpath, **kwargs)
def load_weights(g... |
import pytest
import random
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.gce import GCEProvider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.utils.wait import wait_for
from cfme.utils.log import logger
pytestmark ... |
# -*- coding: utf-8 -*-
class Environment(object):
def __init__(self, agents, initial_state):
self.agents = agents
self.initial_state = initial_state
self.state = initial_state
def run(self, steps=10000, viewer=None):
self.state = self.initial_state
for step in range(... |
from __future__ import print_function
import IMP
import IMP.core
import IMP.algebra
import IMP.test
class Tests(IMP.test.TestCase):
"""Test particle transformations"""
def test_transformation(self):
"""Test the TransformationFunction class"""
imp_model = IMP.Model()
particles = IMP.c... |
#!/usr/bin/python2.4
#
# Copyright (C) 2014 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 l... |
# -*- coding: utf-8 -*-
import base64
import json
import os
import os.path
import random
import shutil
import tempfile
import unittest
from docker import auth, errors
try:
from unittest import mock
except ImportError:
import mock
class RegressionTest(unittest.TestCase):
def test_803_urlsafe_encode(self... |
import fix_paths
import common
import config
from load_samples import load_samples_from_file
from models.commit import Commit
from collections import Counter
import json
import string
def get_words_from_message(commit_message):
#TODO: clean up this method
cleaned_message = str(commit_message.encode('ascii', 'ign... |
#!/usr/bin/env python
import argparse
import sys
from imdb import IMDb
args = None
def parse_args():
global args
parser = argparse.ArgumentParser()
parser.add_argument('first_movie')
parser.add_argument('second_movie')
args = parser.parse_args()
def main():
imdb = IMDb()
# Get 2 movi... |
#!/usr/bin/env python2.7
import os.path
import argparse
import datetime
import hashlib
import random
import time
import M2Crypto.X509
import M2Crypto.ASN1
import M2Crypto.RSA
import M2Crypto.EVP
_OUTPUT_PATH = 'output'
_CA_PASSPHRASE = 'test'
_CA_KEY_PEM_FILENAME = 'output/ca.key.pem'
_CA_CRT_PEM_FILENAME = 'output... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Test routines for the quadprog package. Excepted where noted, all examples are drawn
from the R quadprog package documentation and test suite.
"""
import numpy as np
import quadprog
import unittest
class TestQuadprog(unittest.TestCase):
def setUp(self):
... |
# -*- coding: utf-8 -*-
#
# setup.py
# pangaea
#
# Created by Alan D Snow, 2017.
# BSD 3-Clause
from setuptools import setup, find_packages
requires = [
'gazar',
'wrf-python',
]
setup(name='pangaea',
version='0.0.4',
description='An xarray extension for gridded land surface'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""from python cookbook 2nd edition."""
class RingBuffer(object):
""" a ringbuffer not filled """
def __init__(self, size_max):
self.max = size_max
self.data = []
class __Full(object):
""" a ringbuffer filled """
def append(se... |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... |
# -*- coding: utf-8 -*-
###############################################################################
import logging
import os
import sys
import xbmc
import xbmcaddon
###############################################################################
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
try:
... |
# coding=utf-8
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import, division
import logging
import uuid
from xml.etree import ElementTree
import re
from pathlib import Path
import yaml
from dateutil import parser
from datetime import timedelta
import rasterio.warp
import click
from osgeo ... |
import sys
import limp
import limp.errors
import limp.environment
COMMAND = 'limp'
__author__ = 'byxor'
GLOBAL_DEFINITIONS = {}
def main(bot, author_id, source_code, thread_id, thread_type, **kwargs):
def send(message):
bot.sendMessage(str(message), thread_id=thread_id,
thread... |
import os
import json
import argparse
import urllib
import logging
# ------------------------------------------------------------------------------------------
search_dirs = ["/hps/nobackup/production/xfam/rfam/RELEASES/14.3/miRNA_relabelled/batch1_chunk1_searches",
"/hps/nobackup/production/xfam/rfam/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, time, sys, itertools, math
import re
import random
import NaiveBayesWordClassifier
# holdout
def separateTrainAndTestGroupsUsingHoldout(csvfile='Sentiment Analysis Dataset.csv', testSetPercentSize=0.3):
# reading file
sourceFile = open(csvfile, 'r')
... |
from flask import request, jsonify, render_template
from todoModel import TodoModel
import flask.views
import json
RETRIEVE_DEFAULT_NR = 5
# Render template for main.html
class TodoView(flask.views.MethodView):
def get(self):
return render_template('main.html')
# Add todo (item) and if it is checked or ... |
# coding=utf-8
# Copyright 2019 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 ... |
# coding: utf-8
import itertools
import math
import random
import struct
import time
from collections import OrderedDict
from distutils.version import LooseVersion
from unittest import skipUnless
from uuid import UUID, uuid4
from cassandra import ConsistencyLevel, InvalidRequest
from cassandra.concurrent import execu... |
# -*- 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... |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility a... |
"""
FRODO: a FRamework for Open/Distributed Optimization
Copyright (C) 2008-2013 Thomas Leaute, Brammert Ottens & Radoslaw Szymanek
FRODO 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 o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref:
# - http://doc.qt.io/qt-5/modelview.html#3-4-delegates
# - http://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
# - http://doc.qt.io/qt-5/qabstractitemdelegate.html#details
# - http://doc.qt.io/qt-5/qitemdelegate.html#details
# - http://doc.qt.io/qt-5... |
import re
import random
def test_contact_data_from_home_page(app):
r_index = random.randrange(len(app.contact.get_contact_list()))
data_from_home_page = app.contact.get_contact_list()[r_index]
data_from_edit_page = app.contact.get_contact_info_from_edit_page(r_index)
assert data_from_home_page.firstna... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsVectorFileWriter.
.. note:: 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.
"... |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
## A script for finding every cox coefficient and pvalue for every mRNA in STAD Tier 3 data downloaded Jan. 5th, 2016
from rpy2 import robjects as ro
import numpy as np
import os
ro.r('library(survival)')
import re
##This call will only work if you are running python from the command line.
##If you are not running fr... |
"""Settings file for project development.
These settings should **NOT** be used to deploy
"""
import webserver.settings.defaults as default_settings
from webserver.settings.defaults import *
# Choose which site we're using. initial_data.yaml installs some
# fixture data so that localhost:8000 has SIDE_ID == 1, and
# ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... |
"""Interfaces with TotalConnect alarm control panels."""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.const import (
... |
# -*- coding: utf-8 -*-
# This file defines the Add Fossil dialog.
# Import GTK for the dialog.
from gi.repository import Gtk
class AddFossilDialog(Gtk.Dialog):
"""Shows the "Add Fossil" dialog."""
def __init__(self, parent):
"""Create the dialog."""
# This window should be m... |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
user = Table('user', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('email', String(length=120)),
Column('hashed_password', String(length=60)),
C... |
"""
Django settings for web project.
Generated by 'django-admin startproject' using Django 1.8.14.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... |
from bottle import route, run, request # Python server library
import sys
import httplib2, urllib
import base64
# Hello World route example
@route('/hello')
def hello():
return "Hello World!"
# Fitbit callback route
@route('/auth/fitbit/callback')
def fitbit_callback():
# Edit these variables to suit you... |
# Copyright 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied... |
import numpy as np
import array
import os, sys
import re
import time
import multiprocessing
import h5py
import logging
from astropy.table import Table, Column
from astropy import units as u
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-p","--params", type=str,
help = "Pa... |
from tabulate import tabulate
from . import models
def render_form(form):
s = form.title + '\n\n'
for question in form.questions.order_by('order').select_subclasses():
s += _render_question_heading(question)
s += _render_question(question) + '\n\n'
return s
def _render_question_heading(... |
#!/usr/bin/env python
# Unicorn Jauge Display Client
import json
import os
import sys, getopt
# pip install socketIO-client
# https://github.com/invisibleroads/socketIO-client
from socketIO_client import SocketIO, LoggingNamespace
current_page = 0;
# The socker server Hostname
DISPLAY_SERVER_HOST = 'localhost'... |
"""Event arrays are 2D label arrays (time x ROI) that are generated from an
array of fluorescent traces of the same size.
Uses the following inequality to determine if an event occured at a specific time in a cell:
dF/F of cell > (baseline of cell + std_threshold * std of cell * alpha)
See the findEve... |
# -*- coding: utf-8 -*-
#/#############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under th... |
#!/opt/local/bin/pypy -tt
# -*- coding: utf-8 -*-
#Copyright (C) 2014 Chris Hinsley All Rights Reserved
import sys, argparse, router
from copy import deepcopy
from ast import literal_eval
from mymath import *
def main():
parser = argparse.ArgumentParser(description = 'Pcb layout optimizer.', formatter_class = argpa... |
import datetime
import pickle
from textwrap import TextWrapper
class Item:
"""Represents a ToDo item.
Args:
name (str): The name/title of the item
description (str): A longer description of the item
"""
def __init__(self, name, description):
self.name = name
self.... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-11-28 14:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... |
# Copyright (C) 2011 Tim Freund and contributors.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from functools import wraps
from pycontrol import pycontrol
import logging
import pycontrolshed
import socket
# In [1]: route_domai... |
"""
The current status (player, stopped, paused)
(c) webarok project
http://sourceforge.net/projects/webarok/
This file is part of Webarok.
Webarok 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 versio... |
import os
from docker.client import from_env
from pkg_resources import resource_stream
from vpnporthole.ip import IPv4Subnet
from vpnporthole.system import TmpDir, SystemCalls
class Session(object):
__dnsmasq_port = 53
__ip = None
def __init__(self, settings):
self.__settings = settings
... |
from django.views.generic.edit import CreateView
from django.core.urlresolvers import reverse_lazy, reverse
from django.views.generic.list import ListView
from django.views.generic import DeleteView
from django.db.models import Q
from django.shortcuts import redirect
from django.views.generic.detail import DetailView
f... |
import numpy as np
from flare.kernels.kernels import (
force_helper,
force_energy_helper,
grad_helper,
three_body_fe_perm,
three_body_ee_perm,
three_body_se_perm,
three_body_ff_perm,
three_body_sf_perm,
three_body_ss_perm,
three_body_grad_perm,
grad_constants,
)
from numba im... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Steven Berler <steven.berler@dreamhost.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.postgresql_psycopg2.introspection import \
DatabaseIntrospection
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated... |
from cloudify.decorators import workflow
from cloudify.workflows import ctx
from cloudify.workflows import tasks as workflow_tasks
from utils import set_state_task
from utils import operation_task
from utils import link_tasks
from utils import CustomContext
from utils import generate_native_node_workflows
from utils im... |
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
"""
Controller to interface with the YouTube-app.
Use the media controller to play, pause etc.
"""
import threading
from casttube import YouTubeSession
from . import BaseController
from ..error import UnsupportedNamespace
from ..config import APP_YOUTUBE
YOUTUBE_NAMESPACE = "urn:x-cast:com.google.youtube.mdx"
TYPE_GE... |
# -*- coding: utf-8 -*-
'''
@author: nick
'''
import pygame
def isIn(objPos, objBounds, point):
if (point[0] > objPos[0] and point[0] < objPos[0] + objBounds[0]) and (point[1] > objPos[1] and point[1] < objPos[1] + objBounds[1]):
return True
else:
return False
class Component():
... |
#!/usr/bin/env python
# encoding: utf-8
from .request import ICAPRequestFactory
from .response import ICAPResponseFactory
from .header import ICAPResponseHeaderFactory
class ICAPParser (object):
ICAPResponseHeaderFactory = ICAPResponseHeaderFactory
ICAPRequestFactory = ICAPRequestFactory
ICAPResponseFactory = ICAPR... |
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
import math
from triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
# -----------------------------------------------------------------------------
# --- operateur de rotation translation d'un objet centré à l'origine
def rotTrans(objet, o... |
# Transposition File Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
import sys, time, os, sys, transpositionDecrypt, detectEnglish
inputFilename = 'frankenstein.encrypted.txt'
outputFilename = 'frankenstein.decrypted.txt'
def main():
if not os.path.exists(inputFilename):
print('The... |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... |
import unittest
from unittest.mock import Mock, PropertyMock, patch
from Firefly.const import EVENT_ACTION_ANY, EVENT_ACTION_ON, EVENT_TYPE_BROADCAST, STATE
from Firefly.helpers.automation import Automation
from Firefly.helpers.events import Event
# TODO(zpriddy): These should be in const file
LABEL_TRIGGERS = 'trigg... |
"""
Objects that receive generated C/C++ code lines, reindents them, and
writes them to a file, memory, or another code sink object.
"""
import sys
PY3 = (sys.version_info[0] >= 3)
if PY3:
string_types = str,
else:
string_types = basestring,
DEBUG = 0
if DEBUG:
import traceback
import sys
class Code... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import rdflib
import logging
try:
from functools import lru_cache
except ImportError:
from functools32 import lru_cache
logger = logging.getLogger('hierarchy_manager')
class HierarchyManager(objec... |
# Copyright 2015 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 applicable law or a... |
'''
Season Simulation
2017 Jacob Grishey
For the purpose of simulating sports seasons
and determining regular season standings.
'''
# IMPORTS
import json
import statistics
import numpy
from operator import itemgetter
import copy
# Read JSON file (schedule, team list)
with open("./../data/seas... |
import logging
# create logger
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import rc
rc('font',**{'family':'serif'})
rc('text', usetex=True)
from vec3 import vec3, cross
import scipy.constants as... |
import sys
import unittest2
from mock import MagicMock, Mock, patch
import svb
from svb.test.helper import SvbUnitTestCase
VALID_API_METHODS = ('get', 'post', 'delete')
class HttpClientTests(SvbUnitTestCase):
def setUp(self):
super(HttpClientTests, self).setUp()
self.original_filters = svb.h... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
# coding=utf-8
import json
import os
class FootballDB:
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
groups_file = BASE_DIR + '/sources/groups.json'
wc_history_file = BASE_DIR + '/sources/wc_history'
wc_team_file = BASE_DIR + '/sources/squads/'
top_teams = ['RealMadrid(ESP)', 'Barcelona... |
#!/usr/bin/python
import sys
import os
def readBoard(fname):
try:
f=open(fname)
s = f.readline()
(W,K) = s.split()
W = int(W)
K = int(K)
N = int(f.readline())
# print "wymiary",W,K,N
t={}
t["W"]=W
t["K"]=K
t["N"]=N
for w in range(W):
for k in range(K): t[w,k... |
# 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 ... |
import numpy as np
import pytest
from pandas import DataFrame, NaT, compat, date_range
import pandas.util.testing as tm
@pytest.fixture
def float_frame():
"""
Fixture for DataFrame of floats with index of unique strings
Columns are ['A', 'B', 'C', 'D'].
"""
return DataFrame(tm.getSeriesData())
... |
"""
A simple pomodoro timer.
It times a 25 minute work session then 5 minutes rest.
Press the reset button to restart the timer.
"""
from microbit import *
# Tweak CLOCK_ADJUST to make your system clock more accurate.
# My clock is too fast by 4 seconds every minute so I use 4/60.
# If your clock is too slow by 3 sec... |
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 ... |
##
# Copyright 2011-2013 Ghent University
#
# This file is part of vsc-manage,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... |
# Generated by Django 2.2.3 on 2019-07-18 18:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappab... |
# Copyright (c) 2012 Nick Douma < n.douma [at] nekoconeko . nl >
#
# This file is part of rsscat.
#
# rsscat 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 Lice... |
# -*- coding: utf-8 -*-
# This script is shared under the
# Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0)
# Added clause to Attribution:
# - You may not remove or hide the '<Bot_name> who created you?' functionality
# and you may not modify the name given in the response.
#CREDITS
# Author: Skibi... |
#!/usr/bin/env python
# ~*~ encoding: utf-8 ~*~
#=======
# _____ ______ __
# /__ / ___ _________ /_ __/___ ______/ /_______
# / / / _ \/ ___/ __ \ / / / __ `/ ___/ //_/ ___/
# / /__/ __/ / / /_/ / / / / /_/ (__ ) ,< (__ )
# /____/\___/_/ \____/ /_/ ... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015, 2016 CERN.
#
# INSPIRE 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 optio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.