src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
"""Appends metadata to estimators files reading from input xml files.
The current version of the DMRG does not include any metadata into the
estimator files. Metadata are comment lines that have information about the run
the estimator was obtained from, such as the value of the Hamiltonian
parame... |
import math
import numpy as np
import parakeet
from parakeet.testing_helpers import run_local_tests, expect_each
xs = [0.1, 0.5, 2.0]
def test_sin():
expect_each(parakeet.sin, np.sin, xs)
expect_each(math.sin, math.sin, xs)
expect_each(np.sin, np.sin, xs)
def test_parakeet_sinh():
expect_each(parakeet.sinh... |
#
# 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
# ... |
# -*- 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):
db.execute("create index canvas_comment_id_and_visibility_and_parent_comment_id on canvas_comment (id, visibility, p... |
# Copyright 2013 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.
"""Finds android browsers that can be started and controlled by telemetry."""
from __future__ import absolute_import
import contextlib
import logging
import... |
from BaseDaemon import BaseDaemon
import time
import os
class SecureShellServer(BaseDaemon):
"""
Controls Privoxy daemon
"""
def start(self, interface, settings):
"""
Start processes
:param interface:
:param settings:
:return:
"""
# openssh-ser... |
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... |
"""
A test spanning all the capabilities of all the serializers.
This class defines sample data and a dynamically generated
test case that is capable of testing the capabilities of
the serializers. This includes all valid data values, plus
forward, backwards and self references.
"""
from __future__ import unicode_lite... |
"""
mobile
=======
Devices which (are supposed to) move in a predictable way
Configurable parameters::
{
"area_centre" : e.g. "London, UK" } optional, but both must be specified if either are. Points-to-visit will be within this set.
"area_radius" : e.g. "Manchester, UK" }
"num_lo... |
import threading
def ebv_list(list_submit,list_dict,i,ppid):
import os
lineindex = 0
timehold = time.time()
list_out = []
out = open('/tmp/tmpf_' + str(i) + '_' + str(ppid),'w')
for line in list_submit:
tt = re.split('\s+',line)
ra = float(tt[0])
dec = float(tt[1])
EB... |
from flask import request, Response
from sqlalchemy.orm import contains_eager
from zeus import auth
from zeus.constants import PERMISSION_MAP
from zeus.models import ChangeRequest, Repository, RepositoryProvider
from .base import Resource
class BaseChangeRequestResource(Resource):
def dispatch_request(
... |
#coding=utf-8
import smtplib
from datetime import datetime
from hashlib import md5
import sys, re
from .misc import *
from .parts import *
from collections import OrderedDict as odict
class Mimemail():
def __init__(self, **kwargs):
self.headers = odict()
self.headers['MIME-Version'] = '1.0'
... |
__author__ = 'jml168@pitt.edu (J. Matthew Landis)'
import os
import logging
import pickle
import webapp2
import time
import httplib2
import json
import tweepy
import haigha
from collections import Counter
from haigha.connections.rabbit_connection import RabbitConnection
from apiclient import discovery
from oauth2clie... |
#!/usr/bin/python
import sys
import os
import re
import fnmatch
import string
import matplotlib.pyplot as plt
def print_period(stat):
# use to profile the application running solo.
# stat is an iterator or array
i = 0
for item in stat:
plt.plot(item, label=str(i))
p... |
import json
import os
from crank.core.workouts import (Workouts, WorkoutsJSONEncoder,
WorkoutsJSONDecoder)
parent = os.path.dirname(os.path.abspath(__file__))
TEST_WKT_FILE = os.path.join(parent, 'fixtures', 'squat.wkt')
def test_workouts_storage():
"""Parse, save, and load wor... |
#!/usr/bin/python
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opti... |
#!/usr/bin/env python
"""test_shacl.py: Test generated ontologies against SHACL shapes."""
import os
import libshacl
import pytest
def test_execute_testShacl():
""" Can we execute testShacl at all? """
(rc, stdout, stderr) = libshacl.exec_testShacl(["--version"])
print stdout
print stderr
assert ... |
"""
Module containing class with colors
"""
COLORS = {
'white': "\033[1;37m",
'yellow': "\033[1;33m",
'green': "\033[1;32m",
'blue': "\033[1;34m",
'cyan': "\033[1;36m",
'red': "\033[1;31m",
'magenta': "\033[1;35m",
'black': "\033[1;30m",
'darkwhite': "... |
# -*- coding: utf-8 -*-
"""Thread of structural synthesis."""
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2021"
__license__ = "AGPL"
__email__ = "pyslvs@gmail.com"
from typing import Sequence, Dict, List
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QWidget, QTreeWidgetItem
from pyslvs.... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# Copyright (c) 2008-2021 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... |
import pybullet as p
import time
import math
p.connect(p.GUI)
useMaximalCoordinates = False
p.setGravity(0, 0, -10)
plane = p.loadURDF("plane.urdf", [0, 0, -1], useMaximalCoordinates=useMaximalCoordinates)
p.setRealTimeSimulation(0)
velocity = 1
num = 40
p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0)
p.configureDe... |
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
def get_target():
return SVG()
class SVG:
def __init__(self):
self.svg = ET.parse('skeleton.svg')
self.mmpx = 3.543307
def output(self, path):
self.svg.write(path)
def add_package(self, package):
'''
Target SVG only handles one drawing at a t... |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'ZHang Chuan'
'''
Models for user, blog, comment.
'''
import time, uuid
from transwarp.db import next_id
from transwarp.orm import Model, StringField, BooleanField, FloatField, TextField
class User(Model):
__table__ = 'users'
id = StringField(primary_key=T... |
"""
`calcifer.tree` module
This module implements a non-deterministic nested dictionary (tree).
The tree comprises leaf nodes, dict nodes, and "unknown nodes" -- nodes
which are known to exist but undefined beyond that.
Ultimately, the policy tree contains *definitions*, a higher-level abstraction
on "value": LeafPol... |
#######################################
# pyGPGO examples
# example2d: SHows how the Bayesian Optimization works on a two-dimensional
# rastrigin function, step by step.
#######################################
import os
from collections import OrderedDict
import numpy as np
import matplotlib.pyplot as plt
from pyGP... |
# -*- coding: utf-8 -*-
"""meta(\*\*metadata): Marker for metadata addition.
To add metadata to a test simply pass the kwargs as plugins wish.
You can write your own plugins. They generally live in ``metaplugins/`` directory but you can
define them pretty much everywhere py.test loads modules. Plugin has a name and a... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django import forms
from django.utils.text import slugify
from django.contrib.auth import authenticate
from mozart.core.messages import custom_error_messages, media_messages
def eval_blank(data):
if str(data).isspace():
raise forms.ValidationError(custom_er... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
import odoo.addons.decimal_precision as dp
cl... |
# DDE support for Pythonwin
#
# Seems to work fine (in the context that IE4 seems to have broken
# DDE on _all_ NT4 machines I have tried, but only when a "Command Prompt" window
# is open. Strange, but true. If you have problems with this, close all Command Prompts!
import win32ui
import win32api, win32con... |
"""
Filesystem-related utilities.
"""
from __future__ import print_function
from threading import Lock
from tempfile import mkdtemp
from contextlib import contextmanager
from uuid import uuid4
import errno
import weakref
import atexit
import posixpath
import ntpath
import os.path
import shutil
import os
import re
impo... |
# -*- 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 'Backend'
db.create_table(u'backend_backend', (
('created', self.gf('django.db.mo... |
# -*- coding: utf-8 -*-
# Automatic provisioning of AWS S3 buckets.
import time
import botocore
import boto3
import nixops.util
import nixops.resources
import nixops.ec2_utils
class S3BucketDefinition(nixops.resources.ResourceDefinition):
"""Definition of an S3 bucket."""
@classmethod
def get_type(cls)... |
# -*- coding: utf-8 -*-
from ...qt import QtWidgets, QtCore
from ..custom import FlatButton, HorizontalLine, LabelAlignRight
class TransferFunctionWidget(QtWidgets.QWidget):
def __init__(self, *args):
super(TransferFunctionWidget, self).__init__(*args)
self.create_widgets()
self.create_... |
#
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# Lead Developers: Dan Lovell and Jay Baxter
# Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka
# Research Leads: Vikash Mansinghka, Patrick Shafto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may... |
########
# Copyright (c) 2013-2019 Cloudify Platform Ltd. 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 ... |
# -*- coding: utf-8 -*-
# Copyright 2016 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
# -*- coding: utf-8 -*-
"""
.. module:: deck
:synopsis: Encapsulates the behavior of card collections
.. moduleauthor:: Zach Mitchell <zmitchell@fastmail.com>
"""
from random import shuffle
from typing import List
from .cards import (
Card,
CardFaction,
CardEffect,
CardAction,
CardTarget
)
from... |
import pytest
import asyncio
from aioredis import ConnectionClosedError, ReplyError
from aioredis.pool import ConnectionsPool
from aioredis import Redis
@pytest.mark.run_loop
async def test_repr(create_redis, loop, server):
redis = await create_redis(
server.tcp_address, db=1, loop=loop)
assert repr(... |
#!/usr/bin/env python
#
# Copyright (c) 2011 Somia Dynamoid Oy
#
# 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.
#
imp... |
"""
WSGI config for lambda project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... |
import os
class AnalyzeFileObjBug(Exception):
msg = ("\n"
"Expected file object to have %d bytes, instead we read %d bytes.\n"
"File size detection may have failed (see dropbox.util.AnalyzeFileObj)\n")
def __init__(self, expected, actual):
self.expected = expected
self.a... |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.contrib.auth import authenticate, logout, login
from .utils import TianYuClient
from .settings import TIANYUYUN_LOGIN_URL
LOGIN_SUCCESS_REDIRECT_URL = '/dashboard'
LOGIN_CREATE_SUCCESS_REDIRECT_URL = '/dashboard' # '/accou... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function, unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import open, str, bytes
import os
import... |
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.ticker as tik
import os
from matplotlib import cm
from neural import NeuralState
def plot_weigth_matrix_bars(m: np.ndarray):
"""
Plot a weight matrix as 3d bar diagram
:param m: Weight matrix
:... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('lizard_efcis', '0052_opname_validation_state'),
]
operations = [
migrations.AddField(
model_name='locatie',
... |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from models import *
class PersonAttributeInline(admin.TabularInline):
model = PersonAttribute
list_display = ('email', 'birthdate', 'height', 'weight')
class PlayerInline(admin.TabularInline):
model = Player
e... |
# 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... |
## Copyright (c) 2016-2017 Upstream Research, Inc. All Rights Reserved. ##
## Subject to an 'MIT' License. See LICENSE file in top-level directory ##
## #python-3.x
## python 2 does not work due mostly to issues with csv and io modules with unicode data
help_text = (
"CSV-PREPEND tool version 20170918\n"
... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..utils import (
int_or_none,
determine_ext,
parse_age_limit,
urlencode_postdata,
ExtractorError,
)
class GoIE(AdobePassIE):
_SITE_INFO = {
'abc': {
'brand': '001',
... |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2010 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# =============================================================================
"""... |
import sys
from nose2 import session
from nose2.tests._common import support_file, FunctionalTestCase
class SessionFunctionalTests(FunctionalTestCase):
def setUp(self):
self.s = session.Session()
self.s.loadConfigFiles(support_file('cfg', 'a.cfg'),
support_file('cf... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 23 10:17:53 2014
@author: ibackus
"""
# External modules
import numpy as np
import pynbody
SimArray = pynbody.array.SimArray
# diskpy modules
from diskpy.pdmath import smoothstep
from diskpy.utils import match_units
def make_profile(ICobj):
"""
A wrapper for g... |
import sys
from setuptools import setup
tests_require = ["nose>=1.0"]
if sys.version_info < (3,0):
tests_require = ["nose>=1.0", "mock"]
setup(
name="unitils",
version="0.1.2",
author="iLoveTux",
author_email="me@ilovetux.com",
description="Cross platform utilities I have found to be incredibl... |
'''
Created on Mar 10, 2015
Test Suite Created for the purpose of including a test suite inside the setup
file. This allows the user to run tests while setting up the module inside
python.
@author: harsnara
@change: 2015-03-10 First Draft.
'''
import unittest
from deadcheck.deadcheck import DeadcheckAPI
class T... |
# -*- coding: utf-8 -*-
"""Module used to launch rating dialogues and send ratings to Trakt"""
import xbmc
import xbmcaddon
import xbmcgui
import utilities as utils
import globals
import logging
logger = logging.getLogger(__name__)
__addon__ = xbmcaddon.Addon("script.trakt")
def ratingCheck(media_type, summary_info... |
# -*- coding: utf-8 -*-
#
# Flask-FS documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 6 12:44:29 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
""" A parser for chord progressions in the Weimar Jazzomat CSV format """
import re
from itertools import chain
from typing import Tuple, Optional
from music import ABCNote, ChordType, Chord, ChordProgression, Note
_chordtype_mapping = {
'': ChordType.maj,
'6': ChordType.maj,
'j7': ChordType.maj,
'-7'... |
#!/usr/bin/env python
# asciinator.py
#
# Copyright 2014 Christian Diener <ch.diener@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
# ... |
#
# Copyright (C) 2011 - 2013 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
"""Misc parsers"""
import re
INT_PATTERN = re.compile(r"^(\d|([1-9]\d+))$")
BOOL_PATTERN = re.compile(r"^(true|false)$", re.I)
STR_PATTERN = re.compile(r"^['\"](.*)['\"]$")
def parse_single(s):
"""
Very simple parser to parse e... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Energi Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the... |
__author__ = 'Mirko Rossini'
import unittest
import shutil
from integrationtest_support import IntegrationTestSupport
from pybuilder.errors import BuildFailedException
from common import BUILD_FILE_TEMPLATE
class DjangoEnhancedPluginTest(IntegrationTestSupport):
def test_django_test(self):
# self.set_tmp... |
# Copyright 2019 Tecnativa Victor M.M. Torres>
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class BusinessRequirement(models.Model):
_inherit = 'business.requirement'
sale_order_ids = fields.One2many(
... |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
# -*- coding: utf-8 -*-
"""This module contains tests that exercise control of evmserverd service."""
import pytest
from cfme.utils import version
from cfme.utils.wait import wait_for_decorator
@pytest.yield_fixture(scope="module")
def start_evmserverd_after_module(appliance):
appliance.start_evm_service()
ap... |
""" Builds membrane protein systems """
__version__ = '2.7.12'
__author__ = 'Robin Betz'
import sys
import inspect
#=========================================================================
# Currently supported output formats and description
supported_formats = {
"amber": ".prmtop and .inpcrd Amber PARM7 and R... |
#!/usr/bin/python
from troposphere import (
Template,
If,
NoValue,
Equals,
Ref,
Output,
Parameter
)
from troposphere.dynamodb import (
KeySchema,
AttributeDefinition,
Projection,
ProvisionedThroughput,
Table,
GlobalSecondaryIndex
)
template = Template()
template.se... |
""" Manage learning from training data and making predictions on test data. """
import logging
__author__ = 'smartschat'
def learn(training_corpus, instance_extractor, perceptron):
""" Learn a model for coreference resolution from training data.
In particular, apply an instance/feature extractor to a tra... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
dir = os.path.join(dir, 'scripts')
sys.path.append(dir)
from setup.load import LoadConfig
from utilities.prompt_format import item
from utilities.database import CleanTable, StoreRecord... |
# 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 writi... |
# Copyright (C) 2011-2012 CRS4.
#
# This file is part of Seal.
#
# Seal 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.
#
# Seal is dis... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import datetime
from time import strptime
import re
import os
import json
class FileStatus(object):
def __init__(self, path, rights, nbFiles, owner, group, size, date, relpath = None):
self.path = path
self.rights = rights
self.nbFiles = nbFil... |
import numpy as np
import numpy.matlib
import scipy as sp
import scipy.io as sio
import inspect
import pdb
from numbers import Number
import warnings
import pdb
singleton = None
class Result:
def __init__(this, name, passes=0, total=0):
this.name = name
this.passes = float(passe... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium 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 appl... |
#!/usr/bin/env python
import zmq
import sys
import time
import binascii
import argparse
import csv
#from scapy.utils import wrpcap
sys.path.insert(0,'../../../Engine/libraries/netip/python/')
sys.path.insert(0,'../../../ryu/ryu/')
from netip import *
from ofproto import ofproto_parser
from ofproto import ofproto_comm... |
# encoding: utf-8
# Extra Lib
from functools import wraps
from flask import session, render_template, flash
from flask.ext.babel import gettext as _
# Custom Tools
from .erp import openerp
from .web import redirect_url_for
def logout():
session.clear()
# Decorator called for pages that DON'T require authentic... |
#!/usr/bin/env python
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
'''
Created on 24 Apr 2017
@author: ernesto
'''
import subprocess
import tempfile
class BEDTools:
'''
Class used to perform different operations with the BEDTools package.
This is essentially a wrapper for the BEDTools package. The functionality is quite limited and
additional functions will be added... |
from zlib import crc32
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import EmailMessage
from django.template import Context, loader
from django.urls import reverse as django_reverse
from django.utils.module_loading import import_string
from .compat imp... |
"""Copyright 2014 Cyrus Dasadia
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
distr... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mg_gui.ui'
#
# Created: Fri Jul 29 15:42:51 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribut... |
__author__ = 'Maria'
import constants
from watson_developer_cloud import ConversationV1
import pprint
#API: https://www.ibm.com/watson/developercloud/conversation/api/v1/
class Watson(object):
def __init__(self):
self.conversation = ConversationV1(
username=constants.WATSON['username'],
... |
# -*- coding: utf-8 -*-
#
# MCN CC SDK documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 14 14:01:16 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
from gnuradio import gr
class const_multi_cc(gr.hier_block2):
""" Constant channel model.
"""
def __init__(self, tx_id, rx_id,
k11=0.0, k12=1.0, k13=1.0,
k21=1.0, k22=0.0, k23=1.0,
k31=1.0, k32=1.0, k33=0.0):
gr.hier_block2.__init__(
s... |
from functools import wraps
from flask import Blueprint, request, redirect, render_template, url_for, g, flash
from flask.ext.login import LoginManager, login_user, logout_user, current_user
from flask_wtf import Form
from wtforms import StringField, PasswordField
import base64
from . import auth
login_manager = Login... |
# Copyright 2021 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... |
# coding=utf-8
"""Overrides for Discord.py classes"""
import contextlib
import inspect
import io
import itertools
import re
import discord
from discord.ext.commands import HelpFormatter as HelpF, Paginator, Command
from bot.utils import polr, privatebin
from bot.utils.args import ArgParseConverter as ArgPC
def crea... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Extract a closed coast line
Extracts a coast line from GSHHS using the
advanced polygon handling features in Basemap
The polygons are saved to a two-columns
text file, using Nans to sepatate the polygons.
An example of how to read back the data and
plot filled land i... |
# -*- coding: utf-8 -*-
"""
the classical toll station problem:
given the distance between all toll stations on a long road,
find the location of them.
"""
import random
def points_generator(number, rangee):
lst = range(1,rangee+1)
random.shuffle(lst)
f =lst[0:number-1]
f.sort()
result = [0] + f
... |
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title)
btn = wx.Button(self, label="SomeProcessing")
self.Bind(wx.EVT_BUTTON, self.SomeProcessing, btn)
def SomeProcessing(self,event):
self.dlg = Dlg_GetUserInput(self)
... |
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from scipy.ndimage.filters import maximum_filter
from scipy.ndimage.morphology import (generate_binary_structure,
iterate_structure, binary_erosion)
import hashlib
from operator import itemgetter
IDX... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import siconos.numerics as SN
import numpy as np
import matplotlib.pyplot as plt
try:
from cffi import FFI
except:
import sys
print('no cffi module installed, exiting')
sys.exit(0)
withPlot = False
if __name__ == '__main__':
xk = np.array((1., 10.))
T = 10.0
t = 0.0
h = 1e-3
z... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-03-11
Last_modify: 2016-03-11
******************************************
'''
'''
Given a 2D board containing 'X' and 'O',
c... |
"""Use the isolation plugin with --with-isolation or the
NOSE_WITH_ISOLATION environment variable to clean sys.modules after
each test module is loaded and executed.
The isolation module is in effect similar to wrapping the following
functions around the import and execution of each test module::
def setup(module... |
# -*- coding: utf-8 -*-
from rest_framework import permissions
from rest_framework import exceptions
from addons.base.models import BaseAddonSettings
from osf.models import (
AbstractNode,
Contributor,
DraftRegistration,
Institution,
Node,
NodeRelation,
OSFUser,
PreprintService,
Pri... |
import time
def jd_now():
"""
Returns Julian Date at the current moment.
"""
return 2440587.5 + time.time() / 86400.0
def normalize_star_name(name):
"""
Normalize star name with GCVS names, for example: V339 -> V0339.
"""
digits = "123456789"
if name[0] == "V" and name[1] in digi... |
"""Verify AWS Lambda Function creation."""
import copy
from unittest import mock
from foremast.awslambda.awslambda import LambdaFunction
TEST_PROPERTIES = {
'pipeline': {
'lambda': {
'app_description': None,
'handler': None,
'runtime': None,
'vpc_enabled': N... |
# -*- 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 -*-
"""Add Keras Core Layer Operation Reshape
Revision ID: 1d7c21b6c7d2
Revises: 4a4b7df125b7
Create Date: 2018-11-01 10:26:22.659859
"""
from alembic import op
import sqlalchemy as sa
from alembic import context
from alembic import op
from sqlalchemy import String, Integer, Text
from sqlalchemy.o... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.