text stringlengths 475 200k |
|---|
# ________________________________________________________________________
#
# Copyright (C) 2014 Andrew Fullford
#
# 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.ap... |
#!/usr/bin/env python
import ast
import re
import sys
from xml.etree import ElementTree as ET
import docutils.core
import docutils.nodes
from itertools import izip
import inspect
import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.docstring
def new_call(self, func):
return func
matplotlib.docstring.Subst... |
#!/usr/bin/env python
#
# lsdserver -- Linked Sensor Data Server
# Copyright (C) 2014 Geoff Williams <[EMAIL]>
#
# 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... |
"""**Tests for map creation in QGIS plugin.**
"""
__author__ = 'Tim Sutton <[EMAIL]>'
__revision__ = '$Format:%H$'
__date__ = '17/10/2010'
__license__ = "GPL"
__copyright__ = 'Copyright 2012, Australia Indonesia Facility for '
__copyright__ += 'Disaster Reduction'
import os
import re
import unittest
import logging
... |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/spider.py
# spider chart, also known as radar chart
__version__=''' $Id: spider.py 3662 2010-02-09 11:23:58Z rgbecker $ '''
__doc_... |
from collections import defaultdict
import os
class VagrantStatusEntry(object):
def __init__(self, id, name, provider, state, directory):
self.id = id
self.name = name
self.provider = provider
self.state = state
self.directory = directory
def __str__(self):
ret... |
# coding=utf-8
# Copyright 2013 International Business Machines Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from django import forms
from djan... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import re
import string
import logging
import random
from autotest.client.shared import error
from autotest.client.shared import utils
from virttest import qemu_monitor
from virttest import storage
from virttest import utils_misc
from virttest import env_process
from virttest import data_dir
from virttest import qemu... |
#!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, 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... |
from __future__ import absolute_import, print_function, division
import os.path
import pkg_resources
from unittest import TestCase
from ..images import files
from . import utils
samples_dir = pkg_resources.resource_filename('pyramid_frontend.tests', 'data')
class TestFiles(TestCase):
def test_check_bad(self)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <[EMAIL]>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import bz2
import sys
i... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from enum import Enum
from typing import TYPE_CHECKING, Dict, Any, Optional
from azure.core.pipeline.transport import HttpTransport
from ._authenticatio... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from itertools import chain
from operator import attrgetter
from indico.core.db import db
from indico.cor... |
# -*- 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 field 'ApiKey.dataset'
db.add_column('apikey_apikey', 'dataset',
self.gf('dja... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import os
DATABASE_URL = os.environ.get('DATABASE_URL')
CACHE = {x: os.environ.... |
import hashlib
import hmac
import struct
from . import _utils
'''
HOTP implementation
To compute an HOTP one-time-password:
>>> hotp(key, counter)
where is the hotp is a key given as an hexadecimal string and counter is an
integer. The counter value must be kept synchronized on the server and the
client side.
... |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... |
"""
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 to in writing, software
di... |
import os
import sys
import django_webtest
import pytest
from example.management.demo import create_sample_data
def pytest_configure(config):
here = os.path.dirname(__file__)
sys.path.insert(0, here)
if config.option.log_level:
import logging
level = config.option.log_level.upper()
... |
# 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 __future__ import unicode_literals
import logging
import plumber
import pyramid
from lxml import etree
from plumber import precondition
from datetime import datetime
from simpleslug import slugfy
logging.basicConfig()
logger = logging.getLogger('Pipeline')
xmlns = "http://www.openarchives.org/OAI/2.0/"
xsi = ... |
"""Tests for building.py"""
import pytest
from uwg import Building
def test_building_init():
"""Test BEMDef init method."""
# LargeOffce, Pst80, Zone 1A (Miami)
# coolCap for UTM ~ 200 W/m2, U ~ 2.0
bld = Building(floor_height=3.5, int_heat_night=1, int_heat_day=1, int_heat_frad=0.1,
... |
# 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... |
#!/usr/bin/env python
import json
import os
import time
import uuid
from google.appengine.api import urlfetch
from models import Profile
def getUserId(user, id_type="email"):
if id_type == "email":
return user.email()
if id_type == "oauth":
"""A workaround implementation for getting userid."... |
#!/usr/bin/python
#
# Problem: Alphabetomials
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
from itertools import *
MOD = 10009
def compute():
def f(k, m):
if (k, m) not in mem:
if len(m) == 0:
out = pow(n, k, MOD)
els... |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2019 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... |
import numexpr as ne
# source: http://www.neercartography.com/latitudelongitude-tofrom-web-mercator/
def toWebMercator(xLon, yLat):
semimajorAxis = 6378137.0 # WGS84 spheriod semimajor axis
east = ne.evaluate("xLon * 0.017453292519943295")
north = ne.evaluate("yLat * 0.017453292519943295")
northing =... |
# Copyright 2017-2021 TensorHub, 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 writ... |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
# -*- coding: utf-8 -*-
# The pam components have been modified to be salty and have been taken from
# the pam module under this licence:
# (c) 2007 Chris AtLee <[EMAIL]>
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
'''
Authenticate against PAM
Provides an authenticate functio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pub... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..char_classes import LIST_PUNCT, LIST_ELLIPSES, LIST_QUOTES, LIST_CURRENCY
from ..char_classes import LIST_ICONS, ALPHA_LOWER, ALPHA_UPPER, ALPHA, HYPHENS
from ..char_classes import CONCAT_QUOTES, CURRENCY
_units = (
"km km² km³ m m² m³ dm dm²... |
try:
from urllib import parse as urllib_parse
except ImportError: # Python 2
import urllib as urllib_parse
import urlparse
urllib_parse.urlparse = urlparse.urlparse
from django.contrib.auth.models import User
from django.conf import settings
from django.http import HttpResponse, HttpResponseForbidd... |
#/usr/bin/env python
class ReactorElement:
def __init__(self, position):
self._posiiton=position
def add_element(self, m, material, overwrite=True):
for i, mat, ve in m:
coord = m.mesh.getVtxCoords(ve)
if self.in_element(coord):
if overwrite... |
import httplib as http
import logging
import os
import requests
from addons.base.models import (BaseOAuthNodeSettings, BaseOAuthUserSettings,
BaseStorageAddon)
from box import BoxClient, CredentialsV2
from box.client import BoxClientException
from django.db import models
from framework.... |
"""
Benchmark function from "Practical Bayesian optimization of machine learning
algorithms." The LDA example tunes the online latent Dirichlet allocation, of
Hoffman et al., applied to Wikipedia articles, while the SVM example tunes a
support vector machine. In order to save computation, the algorithms'
performances w... |
from pybars import strlist
from pybars._compiler import Scope
from ..repr import pformat
import logging
logger = logging.getLogger("lifeshare.rendering.helpers")
ROOT = "/api/1.0/"
from pyramid.traversal import resource_path
def URLHelper(this, arg=None, route="", args=[]):
"""transforms a url event into the r... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2012 Zuza Software Foundation
# Copyright 2014 Evernote Corporation
#
# This file is part of Pootle.
#
# Pootle 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 voluptuous import Required, Optional
from ._schema import condition_for
from ..request import TransactionMethod
class NewProspect(TransactionMethod):
__name__ = 'NewProspect'
schema = {Optional('first_name'): condition_for['first_name'],
Optional('last_name'): cond... |
"""
This script allows to transfer files or folders via Globus transfer APIs and wait until
the transfer is completed.
Credentials and transfer parameters can be be passed through a json resource_file
like this:
{
"globus_username":"",
"globus_password":"",
"myproxy_userna... |
import os
import cv2
import multiprocessing
import futures
import cli
import sys
try:
from gi.repository import GExiv2 as exiv
except ImportError:
print "GExiv2 is missing. Consider installing gir*-gexiv2* or the like"
sys.exit()
class ImageMeta(object):
def __init__(self, filename):
self.file... |
# ##### 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 3
# of the License, or (at your option) any later version.
#
# This program is distrib... |
'''
SYNBIOCHEM-DB (c) University of Manchester 2015
SYNBIOCHEM-DB is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
import math
import uuid
from libchebipy._chebi_entity import ChebiEntity, ChebiException
from sbcdb import na... |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski ([EMAIL])
#
from __future__ import absolute_import, division, unicode_... |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import logging
import os
from typing import Any, Dict, Iterator, List, Mapping, Optional, Pattern, Sequence, Tuple, Union
import yaml
from .compat import get_config
from .exceptions import CouldNotDecodeOID, S... |
# Copyright 2012 Google Inc. All Rights Reserved.
"""Helpers shared by cloudstorage_stub and cloudstorage_api."""
__all__ = ['CS_XML_NS',
'CSFileStat',
'dt_str_to_posix',
'LOCAL_API_HOST',
'local_run',
'get_access_token',
'get_metadata',
... |
# Abstract base classes for UI classes
#
# Copyright (C) 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is ... |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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:/... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division
import weakref
import numpy as np
from .. import gloo
from .. import app
from .visuals import VisualNode
from ..visuals.transforms import Tra... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Plots the ratio of two empirical runtime distributions (aka aRT values)
in objective space comparing two algorithms.
adapted by Dimo Brockhoff 2016
"""
from __future__ import absolute_import, division, print_function, unicode_literals
try: range = xrange # let ra... |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
''' Synchronizer
Module that keeps the database synchronized with the CS
Module that updates the RSS database ( ResourceStatusDB ) with the information
in the Resources section. If there are additions in the CS, those are incorporated
to the DB. If there are deletions, entries in RSS tables for those elements ... |
import textwrap
import unittest
class ContainerEqualityTest(unittest.TestCase):
def testCount(self):
self.assertCountEqual(
[1, 2, 3, 2],
[1, 3, 2, 3],
)
def testDict(self):
self.assertDictEqual(
{'a': 1, 'b': 2},
{'a': 1, 'b': 3},
... |
#coding:utf8
import numpy as np, scipy
import pylab as pl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import math
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from itertools import *
import collections
from multiprocessing import Pool
import rand... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.files.storage
import django_extensions.db.fields
import fileupload.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
... |
# This file is part of wger Workout Manager <https://github.com/wger-project>.
# Copyright (C) 2013 - 2021 wger Team
#
# wger Workout Manager 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 ... |
from south.db import db
from django.db import models
from cms.plugins.snippet.models import *
class Migration:
depends_on = (
("cms", "0012_publisher"),
)
needed_by = (
("cms", "0019_public_table_renames"),
)
def forwards(self, orm):
# Adding model 'Pub... |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, [EMAIL]
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test f... |
#!/usr/bin/env python
#
# Generate the routines to draw each scanline of a primitive.
# Run:
# python misc/make_scanline_drawers.py | indent -kr -i3 -l0 > src/scanline_drawers.inc
import sys, re
# http://code.activestate.com/recipes/502257/
def interp(string):
locals = sys._getframe(1).f_locals
globals = sys.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import djorm_pgarray.fields
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Dataset',
f... |
import locale
import warnings
import superdesk
from flask import current_app as app, request
from flask_babel import _
from datetime import timedelta
from superdesk.utils import ListCursor
from superdesk.utc import utcnow
from superdesk.errors import SuperdeskApiError
SETTING_ENABLED = "ARCHIVE_AUTOCOMPLETE"
SETTING... |
# (c) 2012-2014, Michael DeHaan <[EMAIL]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... |
#
# Karaka Skype-XMPP Gateway: Master MUC manager
# <http://www.vipadia.com/products/karaka.html>
#
# Copyright (C) 2008-2009 Vipadia Limited
# Copyright (C) 2010 Voxeo Corporation
# Richard Mortier <[EMAIL]>
# Neil Stratford <[EMAIL]>
#
## This program is free software; you can redistribute it and/or
## modify it und... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
# -*- coding: utf-8 -*-
#
# zap documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 10 14:26:54 2013.
import os
import re
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to t... |
"""
Brilliant Sierpinski gasket generator submitted by Oscar Lindberg
"""
from __future__ import division
import numpy as np
from ..engine.shape import Shape
from .vec3 import Vec3
def SierpinskiTetra(original, n, scale=0.5, **kwargs):
verts = list(original.vertices)
faces = list(original.faces... |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
import time
import uuid
from django.conf import settings
import pycassa
from pycassa.util import convert_time_to_uuid, convert_uuid_to_time
from pycassa.system_manager import SystemManager
from .pool import CASSANDRA_POOL
MANAGER_MAPS = {}
class CassandraIndexError(IndexError):
pass
class CassandraListManager(py... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 9 12:52:31 2015
@author: stuart
"""
import os
import glob
import numpy as np
import pysac.yt as sacyt
import pysac.mhs_atmosphere as atm
l_mpi=False
scales, physical_constants = \
atm.units_const.get_parameters()
#define the models required
spruits = ['spruit_const'... |
import os.path
from dmoj.executors.java_executor import JavaExecutor
with open(os.path.join(os.path.dirname(__file__), 'java-security.policy')) as policy_file:
policy = policy_file.read()
class Executor(JavaExecutor):
name = 'KOTLIN'
ext = 'kt'
compiler = 'kotlinc'
compiler_time_limit = 20
... |
from __future__ import division
import json
import base64
import functools
from uuid import uuid4
import os
from flask import Flask, request, g, redirect, url_for, render_template, flash, session, Response, \
copy_current_request_context
from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop
from... |
from collections import deque
import logging
import nghttp2
import urllib
from urllib.parse import urlparse, parse_qs
import io
import asyncio
import pynats
LOG = logging.getLogger(__name__)
loop = asyncio.get_event_loop()
def _topic_translation(key, translation=str.maketrans('/#', '.>')):
return key.translate(tr... |
# -*- coding: utf-8 -*-
# Copyright 2009-2017 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import datetime
import logging
from openerp import api, fields, models, _
from openerp.addons.decimal_precision import decimal_precision as dp
from openerp.exceptions import Warning as UserError
_logg... |
"""Define tests for stat endpoints."""
from datetime import date
import aiohttp
import pytest
from regenmaschine import Client
from .common import TEST_HOST, TEST_PASSWORD, TEST_PORT, load_fixture
@pytest.mark.asyncio
async def test_stats(aresponses, authenticated_local_client):
"""Test getting states (with or... |
#!/usr/bin/python
from serial import Serial as Sr
from time import sleep
from Tkinter import *
from threading import Thread
from json import load
need_to_exit = 0
class Biu:
M,S,Fl,Fr = [0]*4
t = Tk()
lock = False
def write(x):
global lock
lock = True
print x.encode('hex')
s.write(x)
... |
from socket import gethostname
from numpy import floor,array
import os
# Subcluster number 0 denotes the locus nodes (CEPII cluster)
# The old subcluster numbers (on lse and lce) start from 1
# There are 100 locus nodes, each being their own "subcluster"
def is_compute_node(name=gethostname()):
return len(name) =... |
data = open("input/dec01").read().split(',')
coords = {'x': 0, 'y': 0}
been_here = {}
dir_lookup = ['north', 'right', 'down', 'left']
dir_idx = 0
def populate(x, y):
if x in been_here and y in been_here[x]:
print("We've been here before: " + str(x) + "," + str(y) + " d: " + str(abs(x)+abs(y)))
if x ... |
"""
Object to manage regular expressions, try to optimize the result:
- '(a|b)' => '[ab]'
- '(color red|color blue)' => 'color (red|blue)'
- '([ab]|c)' => '[abc]'
- 'ab' + 'cd' => 'abcd' (one long string)
- [a-z]|[b] => [a-z]
- [a-c]|[a-e] => [a-z]
- [a-c]|[d] => [a-d]
- [a-c]|[d-f] => [a-f]
Operation:
- str(... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Copyright (C) 2008 Krzysztof Kosyl <[EMAIL]>
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) an... |
from evelink import api, constants
from evelink.parsing.assets import parse_assets
from evelink.parsing.bookmarks import parse_bookmarks
from evelink.parsing.contact_list import parse_contact_list
from evelink.parsing.contract_bids import parse_contract_bids
from evelink.parsing.contract_items import parse_contract_ite... |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... |
"""Test the Vultr binary sensor platform."""
import json
import unittest
from unittest.mock import patch
import requests_mock
import pytest
import voluptuous as vol
from homeassistant.components.binary_sensor import vultr
from homeassistant.components import vultr as base_vultr
from homeassistant.components.vultr imp... |
from restclients.models.r25 import Reservation
from restclients.r25 import nsmap, get_resource
from restclients.r25.spaces import space_reservation_from_xml
from urllib import urlencode
def get_reservation_by_id(reservation_id):
url = "/r25ws/servlet/wrd/run/reservation.xml?rsrv_id=%s" % reservation_id
return... |
"""Multi-layer Perceptron
"""
# Authors: Issam H. Laradji <[EMAIL]>
# Andreas Mueller
# Jiyuan Qian
# Licence: BSD 3 clause
import numpy as np
from abc import ABCMeta, abstractmethod
from scipy.optimize import fmin_l_bfgs_b
import warnings
from ..base import BaseEstimator, ClassifierMixin, Regress... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
# .. py:currentmodule:: dolfin_adjoint
#
# Topology optimisation of fluids in Stokes flow
# ==============================================
#
# .. sectionauthor:: Patrick E. Farrell <[EMAIL]>
#
# This demo solves example 4 of :cite:`borrvall2003`.
#
# Problem definition
# ******************
#
# This problem is to minimi... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, [EMAIL]
#
import unittest
from ...compatibility import StringIO
from ...worksheet import Worksheet
class TestWriteSheetPr(unittest.TestCase):
"""
Test the Workshee... |
#!/bin/env python2
__author__ = "Ludovic Duvaux"
__maintainer__ = "Ludovic Duvaux"
__license__ = "GPL_v3"
import sys, argparse as ap, os, gzip, re
# 0.1) get options from commands lines
parser = ap.ArgumentParser(description='Filter snpeff annotated vcf to detect interesting genes')
parser.add_argument('group_list'... |
# Postgres Listener, writes out flatfiles when SQL NOTIFYs are triggered
# Copyright (C) 2005 Rob Bradford <[EMAIL]>
# Copyright (C) 2007-8 Robert McQueen <[EMAIL]>
#
# 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 ... |
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... |
# Copyright 2016 iNuron 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 writing, so... |
# encoding: 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 index on 'DatafileParameter', fields ['string_value']
db.create_index('tardis_portal_datafileparameter', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.