src stringlengths 721 1.04M |
|---|
import logging
import os
from dart.client.python.dart_client import Dart
from dart.config.config import configuration
from dart.engine.redshift.metadata import RedshiftActionTypes
from dart.model.engine import Engine, EngineData
_logger = logging.getLogger(__name__)
def add_redshift_engine(config):
engine_config... |
# Copyright 2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
from . import Block, register_build_in
from ._build import build_params
@register_build_in
class DummyBlock(Block):
is_dummy_block = True
label = 'Missing Block'
key = '_du... |
from pyBuilder import *
class MyGUIBuilder(BuildCMakeTarget):
def __init__(self):
self.initPaths()
def extract(self):
return_value = self.unzip('files/mygui-trunk*.zip')
# unpack dependencies, needed for freetype
return_value |= self.unzip('files/OgreDependencies_MSVC... |
#
# Copyright (C) 2014-2017 Nextworks
# Author: Vincenzo Maffione <v.maffione@nextworks.it>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at y... |
import os
import threading
import time
import logging
import constants
import hildonize
import Audiobook
import FileStorage
_moduleLogger = logging.getLogger(__name__)
class Player(object):
def __init__(self, ui):
self.storage = FileStorage.FileStorage(path = constants._data_path_)
if hildonize.IS_HILDON_SUP... |
from math import sqrt, sin, cos, tan, asin, acos, atan, floor, pi
from ._vector_import_helper import vec, vector, mag, norm
# List of names that are imported from this module with import *
__all__ = ['RackOutline', 'ToothOutline', 'addpos', 'convert', 'path_object',
'paths', 'rotatecp', 'roundc', 'scalecp'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import glob
import json
import re
from types import DictType, ListType, UnicodeType
from urlparse import urlparse
parser = argparse.ArgumentParser(description='Verify json files for shavar.')
parser.add_argument("-f", "--file", help="filename to verify")
... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
""" multiple clustering algorithms """
import numpy as np
import matplotlib.pyplot as plt
from .HelperFunctions import get_colors
from mpl_toolkits.mplot3d import Axes3D
from random import shuffle
class Cluster:
def __init__(self, points):
# Attributes
... |
# Copyright (c) 2011, Enthought, Ltd.
# Author: Pietro Berkes <pberkes@enthought.com>
# License: Modified BSD license (2-clause)
from traits.has_traits import HasTraits, on_trait_change
from traits.trait_numeric import Array
from traits.trait_types import (Instance, Int, ListFloat, Button, Event, File,
... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ChickenBalls'
db.create_table('suthern_chickenballs', (
... |
# Copyright 2016 Pinterest, 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 writin... |
# Copyright 2019 PerfKitBenchmarker 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... |
"""
Django settings for CroCoAPI project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... |
import re
class Scrap(object):
"""
Scraps method names from the Java doc
"""
def __init__(self, file_path, out_name):
self.file_path = file_path
self.out_name = out_name
self.java_method_re = re.compile('^([a-z]+.+)\(')
self.js_method_re = re.compile('^([a-z]+): ')
... |
"""
==============
`m31flux.util`
==============
General utilities.
Functions
---------
================== =========================================================
`calc_flux` Calculate flux in a given filter for the SFH of the
given cell.
`calc_mean_sfr` Calculate the 100 Myr mean SF... |
#
# Copyright (C) 2009 Chris Newton <redshodan@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This pro... |
# Copyright 2012 Jaap Karssenberg <jaap.karssenberg@gmail.com>
import tests
from tests.mainwindow import setUpMainWindow
from tests.pageview import press
from zim.plugins import find_extension, PluginManager
from zim.plugins.insertsymbol import *
ALPHA = chr(945)
EACUTE = chr(201)
ECIRC = chr(202)
EGRAVE = chr(... |
#!/usr/bin/python
def nextbus(where = 'guess', nbus = 5, walking_time = 3):
"""
tells you when the next bus is from home or to uni
where: 'h'/'u'/'guess': home, uni, or try to guess based on wifi connection name
walking_time: don't show buses less than n mins from now
nbus: show next n buses
... |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from contextlib import contextmanager
from textwrap import dedent
from pants.b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Excel ModelMessage表单解析器基类,
ExcelModelMessageParser
Sheet struct: 信息名称 中文名称 输入输出类型 接口描述 是否可变长 变量名称 变量中文名称
变量数据类型 粒度 单位 默认值 最小值 最大值 属性描述 赋值方法
"""
import excelsheetparser
class ExcelModelMessageParser(excelsheetparser.ExcelSheetParser):
def... |
#
# 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... |
import string
import csv
import os
from abaqusConstants import *
from part import *
from material import *
from section import *
from assembly import *
from load import *
from mesh import *
from visualization import *
def importEBSD(inpFileName):
while True:
fileName, file_extension = os.path.splitext... |
import numpy as np
a_2d = np.arange(12).reshape(3, 4)
print(a_2d)
# [[ 0 1 2 3]
# [ 4 5 6 7]
# [ 8 9 10 11]]
a_2d[0, 0] = 100
print(a_2d)
# [[100 1 2 3]
# [ 4 5 6 7]
# [ 8 9 10 11]]
a_2d[0] = 100
print(a_2d)
# [[100 100 100 100]
# [ 4 5 6 7]
# [ 8 9 10 11]]
a_2d[np.ix_([Fa... |
# The software pyradbar is a bunch of programs to compute the homology of
# Sullivan diagrams.
# Copyright (C) 2015 - 2017 Felix Boes
#
# This file is part of pyradbar.
#
# pyradbar 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... |
import os,sys
import ROOT
from ROOT import *
from math import *
from array import *
filestoplot = { 'mse peak' : {'filename' : 'mse1.txt', 'colour' : 1, 'marker' : 20},
'mse pit' : {'filename' : 'mse2.txt', 'colour' : 2, 'marker' : 21},
'theil peak' : {'filename' : 'theil1.txt', 'colour... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests the multi-process processing engine."""
import unittest
from tests import test_lib as shared_test_lib
class MultiProcessEngineTest(shared_test_lib.BaseTestCase):
"""Tests for the multi-process engine."""
# TODO: add test for _AbortJoin
# TODO: add test for _... |
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commercial ... |
# -*- coding: utf-8 -*-
# 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... |
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
RUNTIME_LIB = 'wart'
def find_runtime_dir(start_dir):
lib_name = 'lib' + RUNTIME_LIB + '.a'
if os.path.exists(os.path.join(start_dir, lib_name)):
return os.path.abspath(start_dir)
for d in [os.path.join(start_dir, x) for x in os.li... |
import argparse
import matplotlib
matplotlib.use('agg')
import csv
import json
import multiprocessing as mp
import os
import random
import re
import sys
from functools import partial
from operator import attrgetter, itemgetter
import networkx as nx
import numpy as np
import pandas as pd
import time
from sofa_aisi impor... |
from __future__ import division
from psychopy import visual, core, misc, event
import numpy as np
from IPython import embed as shell
from math import *
import os, sys, time, pickle
import pygame
from pygame.locals import *
# from pygame import mixer, time
import Quest
sys.path.append( 'exp_tools' )
# sys.path.append... |
"""CAIRN runtime options - result of commandline options and config file"""
import thirdparty.myoptparse as optparse
import os
import os.path
import platform
import re
import string
import sys
import time
from gettext import gettext as _
import cairn
from cairn import Logging
from cairn import Version
# module glo... |
#
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
import cStringIO, zlib, tempfile, errno, os, sys
from mercuria... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Michiel D. Nauta
#
# 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... |
# ##### 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... |
# -*- 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 'Distributor'
db.create_table('alibrary_distributor', (
('id', self.gf('django.db... |
from __future__ import unicode_literals
from importlib import import_module
from django.utils import six
from django.utils.html import mark_safe
from django.utils.translation import ugettext_lazy as _
def get_indicator_hidden(request, instance):
html = ''
is_visible = getattr(instance, 'is_visible', True)
... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from itertools import chain
from plugins.jinja2.debug_dump import dump, dump_all, dump_file, dump_url
from plugins.jinja2.category import find_category, category_preview_articles, mark
from plugins.jinja2.article import is_untold
from ... |
"""
Classification in Spark
@author: Chris Mantas
@contact: the1pro@gmail.com
@since: Created on 2016-02-12
@todo: custom formats, break up big lines
@license: http://www.apache.org/licenses/LICENSE-2.0 Apache License
"""
from pyspark.mllib.classification import \
LogisticRegressionWithLBFGS, LogisticRegressionMod... |
#!/usr/bin/env python2
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU... |
from PyQt4.QtCore import Qt, QMimeData
from PyQt4.QtGui import QApplication, QKeyEvent, QKeySequence, QPalette, QTextCursor, QTextEdit, QWidget
class RectangularSelection:
"""This class does not represent any object, but is part of Qutepart
It just groups together Qutepart rectangular selection methods and fi... |
# -*- coding: utf-8 -*-
"""
TODO move permission checks to the dispatch view thingee
"""
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.forms import Form
from django.http import HttpResponseForbidden
from django.http import Http404
from django.views.generic.edit import Del... |
# Copyright 2012 OpenStack LLC.
# 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... |
# Unit tests related to 'Pickups' (https://www.easypost.com/docs/api#pickups).
import time
import datetime
import easypost
import pytest
import pytz
ONE_DAY = datetime.timedelta(days=1)
@pytest.fixture
def noon_on_next_monday():
today = datetime.date.today()
next_monday = today + datetime.timedelta(days=(7 ... |
# -*- coding: utf-8 -*-
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.linear_model import BayesianRidge, LinearRegression
###############################################################################
# Generating simulated data with Gaussian weigthts
np.random.se... |
import datetime
import itertools
import os
import re
from importlib import import_module
from urllib.parse import ParseResult, urlparse
from django.apps import apps
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth import REDIRECT_FIELD_NAME, SESSION_KEY
from dj... |
import unittest
from flask import Flask
import flask_restful
from werkzeug import exceptions
class AcceptTestCase(unittest.TestCase):
def test_accept_default_application_json(self):
class Foo(flask_restful.Resource):
def get(self):
return "data"
app = Flask(__name__... |
# -*- coding: utf-8 -*-
"""UI view definitions."""
import json
from datetime import timedelta
from logging import getLogger
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth import logout as auth_logout
from django.urls import reverse
from django.http import ... |
# Copyright (C) 2008 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 ... |
try:
from queue import Queue, Empty, Full
except ImportError:
from Queue import Queue, Empty, Full
import threading
import sys
import time
import unittest
import stomp
from testutils import *
class MQ(object):
def __init__(self):
self.connection = stomp.Connection(get_standard_host(), 'admin', 'p... |
import matplotlib
matplotlib.use('Agg')
import simple_abc
import simple_model
#from astropy.io import ascii
import numpy as np
import pickle
import pylab as plt
import time
from scipy import stats
def main():
#TODO Choose new random seed after testing
np.random.seed(917)
steps = 5
eps = 0.25
m... |
from __future__ import division
from __future__ import print_function
# Copyright 2020 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/LICEN... |
# settings list
from datetime import timedelta
from constants import FLOW_BASIC, FLOW_MULTIROLE
COMPANY_NAME = 'CtrlPyME'
COMPANY_SLOGAN = 'Press Ctrl + PyME to begin.'
COMPANY_LOGO_URL = URL('static', 'images/ctrlPyME_logo.png')
# the workflow determines how the employees will interact with the application
COMPANY_... |
"""
Chat with the bot via Gitter
"""
import asyncio
import logging
from typing import Any, Dict, List
import aiohttp
from .. import gitter
from ..gitter import AioGitterAPI
from .commands import command_routes
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
"""
https://webhooks.gitter.im/e/b9e... |
# -*- 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 o... |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2018 Laurent Monin
# Copyright (C) 2019-2020 Philipp Wolfer
#
# 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 Fou... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Skype main database event formatter."""
import unittest
from plaso.formatters import skype
from tests.formatters import test_lib
class SkypeAccountFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the Skype account event formatter."""
def t... |
"""
@summary: Constants for the Lifemapper web service clients
@author: CJ Grady
@version: 2.1.3
@status: release
@license: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawr... |
# Copyright 2015 PLUMgrid
#
# 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... |
import metadata_database.type
class Base(metadata_database.database.Model):
__abstract__ = True
id = metadata_database.database.Column(
metadata_database.type.UUID,
primary_key=True
)
class Annotation(Base):
__tablename__ = "annotations"
annotator_id = metadata_database.databas... |
#!/usr/bin/python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Print information about the tools present on this machine.
Usage:
./host_info.py -j /tmp/out.json
Writes a json dictionary contain... |
import os.path as op
import numpy as np
from pyhrf import Condition
from pyhrf.paradigm import Paradigm
from pyhrf.tools import Pipeline
import pyhrf.boldsynth.scenarios as simbase
PHY_PARAMS_FRISTON00 = {
'model_name' : 'Friston00',
'tau_s' : 1/.8,
'eps' : .5,
'eps_max': 10., #TODO: check this
'... |
import abc
import typing
from django.db.migrations.operations.base import Operation
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
# @todo #283:30m Group models.py, models_operations.py, models_expressions.py into the module.
class IndexSQL(abc.ABC):
def __init__(self, name: str):
... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-09-24 11:53
from __future__ import unicode_literals
import apps.models.utils
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('models', '0027_auto_20170922_1554'),
]
operations = [
... |
'''
Some functions to fit a random forest
'''
import sklearn.ensemble
import pandas
import progressbar
bar = progressbar.ProgressBar()
def test_max_features(max_features):
if (max_features not in ['sqrt', 'auto', 'log2', None]):
try:
max_features = int(max_features)
except ValueError:... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... |
from __future__ import absolute_import
from changes.api.base import APIView
from changes.models.snapshot import Snapshot
import changes.lib.snapshot_garbage_collection as gc
class CachedSnapshotDetailsAPIView(APIView):
def unpack_snapshot_ids(self, cluster_map):
return {cluster: [i.id.hex for i in images... |
"""
# Notes:
- This simulation seeks to emulate the COBAHH benchmark simulations of (Brette
et al. 2007) using the Brian2 simulator for speed benchmark comparison to
DynaSim. However, this simulation does NOT include synapses, for better
comparison to Figure 5 of (Goodman and Brette, 2008) - although it uses the... |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from . import SceneNode
from UM.Resources import Resources
from UM.Application import Application
from UM.Math.Color import Color
from UM.Math.Vector import Vector
from UM.Scene.Selection import Selection
from UM.View... |
import oauth2
import os
class YelpySigner(object):
def __init__(self, consumer_key=None, consumer_secret=None, token=None, token_secret=None):
super(YelpySigner, self).__init__()
self.consumer_key = consumer_key or os.environ['YELPY_CONSUMER_KEY']
self.consumer_secret = consumer_secret or ... |
# 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... |
# test ustruct with a count specified before the type
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
print(struct.calcsize('0s'))
print(struct.unpack('0s', b''))
print(struct.pack('0s', b'123'))
print(struct.calcsize('2s... |
import logging
import requests
import urlparse
from django.core.exceptions import ValidationError
from django.db import models
from cabot.metricsapp import defs
from cabot.metricsapp.api import get_series_ids, get_panel_url
logger = logging.getLogger(__name__)
class GrafanaInstance(models.Model):
class Meta:
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from mock import call
from mock import Mock
from mock import patch
from paasta_tools.mesos import framework
from paasta_tools.mesos import master
from paasta_tools.mesos import task
@patch.object(master.MesosMaster, '_framework_list', autospec=True)
def test_frameworks(mock_framework_list):
fake_frameworks = [
... |
#!/usr/bin/env python
# Copyright (c) 2013 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back ... |
# coding=utf-8
"""
Collect metrics from postgresql
#### Dependencies
* psycopg2
"""
import diamond.collector
from diamond.collector import str_to_bool
try:
import psycopg2
import psycopg2.extras
psycopg2 # workaround for pyflakes issue #13
except ImportError:
psycopg2 = None
class PostgresqlCo... |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... |
import pandas
import pandasql
def num_rainy_days(filename):
'''
This function should run a SQL query on a dataframe of
weather data. The SQL query should return one column and
one row - a count of the number of days in the dataframe where
the rain column is equal to 1 (i.e., the number of days it... |
#!/usr/bin/env python
from __future__ import print_function
import sys
import shlex
import logging
import time
import cmd
import argparse
import traceback
if __name__ == '__main__':
print("Loading environment...")
import env
log = logging.getLogger("edi")
# Now env is loaded, import the apps
import ship
import ed... |
from rest_framework.response import Response
class MultipleModelMixin(object):
"""
Create a list of objects from multiple models/serializers.
Mixin is expecting the view will have a queryList variable, which is
a list/tuple of queryset/serailizer pairs, like as below:
queryList = [
(... |
#copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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 abc
class IConsumer(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def consume(self, interval, timeout):
"""
Parameters
----------
interval : float
Rate of work. The units are in seconds.
timeout : float
... |
import unittest
from ndb_prop_gen.arg import Arg
from ndb_prop_gen.arg import find_prop_type
sample_property = """\
@property
def sample_float(self):
return self._sample_float
"""
class TestArg(unittest.TestCase):
def setUp(self):
self.sample1 = Arg("sample_float", "Float", 0.0)
... |
#!/usr/bin/python
#
# Copyright (C) 2008, 2011, 2012, 2013 Google Inc.
#
# 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... |
import datetime
import unittest2
class UtilTests(unittest2.TestCase):
def ztest_days_between(self):
from kardboard.util import days_between
wednesday = datetime.datetime(year=2011, month=6, day=1)
next_wednesday = datetime.datetime(year=2011, month=6, day=8)
result = days_between... |
from scipy import *
def extractHlistData(filename,preFrames=0,postFrames=0,printFilename=1):
if (printFilename):
print ("reading input file "+filename)
f=file(filename)
s = f.readline()
input = []
while (s!=""):
words = s.split()
vect = []
for w in words:
vect.append(float(w))
input.appe... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, INSPQ Team SX5
#
# This file is not 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 y... |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from django.contrib.auth.models import User
from django.test import TestCase
from volunteers.models import Volunteer, Task, Shift, Preference, VolunteerShift, VolunteerUnavailability, \
VolunteerPresence
class VolunteerTestCase(TestCase):
def setUp(self):
self.user = User.objects.create_user(usernam... |
# coding=utf-8
from __future__ import absolute_import, division, print_function
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
fr... |
import pcwg.core.interpolators as interpolators
import unittest
from pcwg.core.binning import Bins
class TestMarmanderPowerCurveInterpolator(unittest.TestCase):
def test_spreadsheet_benchmark(self):
x = [1.00,
2.00,
3.00,
4.10,
5.06,
6.04,
... |
# Copyright (c) 2014 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this... |
# -*- coding: utf-8 -*-
#
# 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
#... |
from collections import namedtuple
import logging
from elftools.elf.constants import SH_FLAGS
Section = namedtuple('Section', 'id name type addr offset size flags')
class Sections(object):
def __init__(self, debuginfo):
self.debuginfo = debuginfo
def iter_sections():
# omit first sec... |
"""
@TODO: major rewrite here!
"""
import re
import html
import string
import os.path
import inflect
import warnings
import validators
from urllib.parse import urlparse
# SOME MACROS
STOPWORDLIST = 'resources/stopwords.txt'
KNOWN_SHORTHANDS = ['dbo', 'dbp', 'rdf', 'rdfs', 'dbr', 'foaf', 'geo', 'res', 'dct']
DBP_SHORT... |
# pylint: disable=unused-variable
# pylint: disable=misplaced-comparison-constant
from .conftest import load
def describe_get():
def when_default_text(client):
response = client.get("/templates/iw")
assert 200 == response.status_code
assert dict(
name="Insanity Wolf",
... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import sys
import pickle
import logging
from indra.sources import reach
from indra.literature import s3_client
if __name__ == '__main__':
usage = "Usage: %s pmid_list start_index end_index" % sys.argv[0]
if ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.