src stringlengths 721 1.04M |
|---|
import logging
import random
import sqlite3
from os import path
from ..exceptions import NoDialogFoundException
logger = logging.getLogger(__name__)
DEFAULT_SQLITE_PATH = path.join(path.dirname(path.dirname(path.abspath(__file__))),
'assets', 'dialog.sqlite')
class DialogChooser(obj... |
#!/usr/bin/env python
"""
APM automatic test suite
Andrew Tridgell, October 2011
"""
from __future__ import print_function
import atexit
import fnmatch
import glob
import optparse
import os
import shutil
import signal
import sys
import time
import traceback
from apmrover2 import *
from arducopter import *
from quadp... |
#!/usr/bin/env python
from .util import Spec
class File(Spec):
STATES = [
"directory", "file",
"owned_by",
"smaller_than", "larger_than"
]
def __init__(self, path):
self.path = path
self.state = {}
self.get_state()
self.WIN = "File %s is %%s" % se... |
# -*- coding: latin1 -*-
#
# Copyright (C) 2003, 2004 Ayose Cazorla León
#
# Authors
# Ayose Cazorla <ayose.cazorla@hispalinux.es>
#
# This file is part of Pyslide.
#
# Pyslide 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... |
'''
Note::
This facade depends on:
- nmcli (Network Manager command line tool)
It is found in most of the popular distros. Support for other
managers is not provided yet.
- python-wifi module
`https://wifi.readthedocs.io/en/latest/`
`https://g... |
# get entities from API.AI
import urllib2
import json
token = "8c1583c6a19d4ca09247a38ddcc2f740"
author_entity_id = "ad1e6041-0979-41bc-aa6b-3ef308f9045c"
time_range_entity_id = "c6645f34-3fdf-4ee6-8670-27991cb2dba6"
def get_all_entities():
return _handle_request("https://api.api.ai/v1/entities?v=20150910")
de... |
#
# Copyright 2012 ibiblio
#
# 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.txt
#
# Unless required by applicable law or agreed to in writing... |
from __future__ import print_function, unicode_literals
import unittest
from os import path
from binstar_client.inspect_package import pypi
from pprint import pprint
import os
import shutil
import tempfile
def data_path(filename):
return path.join(path.dirname(__file__), 'data', filename)
expected_package_data ... |
#===============================================================================
# @Author: Madison Aster
# @ModuleDescription:
# @License:
# MediaApp Library - Python Package framework for developing robust Media
# Applications with Qt Library
# Copyright (C) 2013 Madison Aster
# ... |
"""DocuSign client."""
from collections import namedtuple
import base64
import json
import logging
import os
import warnings
import requests
from pydocusign import exceptions
logger = logging.getLogger(__name__)
Response = namedtuple('Response', ['status_code', 'text'])
class DocuSignClient(object):
"""DocuS... |
#!/usr/bin/env python
from saml2.sigver import _get_xmlsec_cryptobackend, SecurityContext
from saml2.httpbase import HTTPBase
from saml2 import saml
from saml2 import md
from saml2.attribute_converter import ac_factory
from saml2.extension import dri
from saml2.extension import idpdisc
from saml2.extension import mdat... |
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import os
from flask import Flask, session, redirect, url_for, render_template, flash
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_script import Manager, Shell
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import Form
from wtform... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015-Trust-Code (<http://www.trustcode.com.br>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
# Parse Yakei Config Files
import os
class ConfMissingError(Exception):
def __init__(self):
self.value = "Yakei.conf not found"
def __str__(self):
return repr(self.value)
class ConfBadlyFormed(Exception):
def __init__(self, value):
self.value = value
def __str__(sel... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2016 Borja Menendez Moreno
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
any later version.
This p... |
"""vobject module for reading vCard and vCalendar files."""
import copy
import re
import sys
import logging
import StringIO
import string
import exceptions
import codecs
#------------------------------------ Logging ----------------------------------
logger = logging.getLogger(__name__)
if not logging.getLogger().han... |
import re
import time
import io
import sys
import argparse
from collections import defaultdict
# parse/validate arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-d", "--delimiter", type=str, default='\t', help="delimiter defaults to \t")
argParser.add_argument("-1", "--firstFilename", type=str)
... |
# Netsink - Network Sinkhole for Isolated Malware Analysis
# Copyright (C) 2013-2014 Steve Henderson
#
# 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 ... |
"""
Structural Assemblies - SAs (:mod:`structmanager.sas`)
======================================================
.. currentmodule:: structmanager.sas
"""
class FrameAssembly(object):
"""Frame Assembly"""
def __init__(self, name, args):
args = outerflange, web, innerflange
self.name = name
... |
import sys
import json
import time
import pymongo
import threading
from kagen import utils
from queue import Queue
from threading import Thread
from datetime import datetime
from kagen.utils import config
logger = utils.get_logger("languages")
dir_data = config["paths"]["dir_data"]
lang = config["run"]["language"]
dt... |
"""Support for the Philips Hue lights."""
import asyncio
from datetime import timedelta
import logging
from time import monotonic
import random
import aiohue
import async_timeout
from homeassistant.components import hue
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, AT... |
import requests
import json
class Tankerkoenig():
"""
Wrapper for Tankerkönig-API calls.
* Parameters:
:api_key: ``str``; Tankerönik API key.
"""
def __init__(self, api_key):
self.api_key = api_key
def __check(self, r):
"""
Internal method to check whether a ... |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import tempfile
import json
import fabric
import vcloud_plugin_common
from cloudify import ctx
PROVIDER_CONTEXT_RUNTIME_PROPERTY = 'provider_context'
def configure(vcloud_config):
_copy_vsphere_configuration_to_manager(vcloud_config)
_install_docker()
_save_context()
def _copy_vsphere_configuration_t... |
#!/usr/bin/env python
import numpy
import sncosmo
import scipy.optimize
import matplotlib.pyplot as plt
model=sncosmo.Model(source='salt2-extended')
def f(t ,rlim):
# print t, model.bandflux('desr',t, zp = rlim, zpsys='ab')
return model.bandflux('desr',t, zp = rlim, zpsys='ab')-1.
def controlTime(z,rlim):
... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import itertools
imp... |
from email.mime.image import MIMEImage
from django.core.mail import EmailMultiAlternatives
from django.template import loader, Context
from django.conf import settings
def send_temba_email(to_email, subject, template, context, branding):
"""
Utility method that sends a pretty email, attaching our logo
to ... |
#!/usr/bin/env python
#
# Copyright (c) 2015 - 2021, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
################################################################################
# Commonly used functions for Euler Project (www.projecteuler.com)
# Author: Eugene Kolo 2014
# Contact: www.eugenekolo.com
########################################################################... |
BLINKING_RATE_READY = 1.5
BLINKING_RATE_WAITING = 0.1
BLINKING_RATE_LOADING = 0.3
PIN_BUTTON=3
PIN_BLUE=23
PIN_RED=24
import os,sys,time,signal,subprocess,json
import rtmidi_python as rtmidi
import RPi.GPIO as GPIO
midi_in = [rtmidi.MidiIn()]
attached = set()
attached.add(midi_in[0].ports[0])
p = None
with open('noi... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QGIS Web Processing Service Plugin
-------------------------------------------------------------------
Date : 09 November 2009
Copyright : (C) 2009 by Dr. Horst Duester
email ... |
"""GATK variant calling -- HaplotypeCaller and UnifiedGenotyper.
"""
import os
from distutils.version import LooseVersion
import shutil
import subprocess
import toolz as tz
from bcbio import bam, broad, utils
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio... |
#!BPY
# -*- coding: UTF-8 -*-
# Set IK Limits
#
# 2016.01.17 Natukikazemizo
import bpy
import math
import re
# Using Regular expression
#"[0]" 1文字が0
#"[0-9]" 1文字が0,1,2,3,4,5,6,7,8,9のいずれか
#"[02468]" 1文字が偶数
#"[BCD]" 1文字がB,C,Dのいずれか
#"[B-D]" 1文字がB,C,Dのいずれか
#"[0-2A-C]" 1文字が0,1,2,A,B,Cのいずれか
#"[^12]" 1文字が1,2以外
#"\w" 1文字が英数字
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Ignacio Ibeas <ignacio@acysos.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
import time
import logging
_logger = logging.getLogger(__name__)
class EdicomAlbar... |
# -*- 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):
# Changing field 'CheckIn.date'
db.alter_column(u'students_checkin', 'da... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are... |
from compressor.conf import settings
from compressor.base import Compressor, SOURCE_HUNK, SOURCE_FILE
class JsCompressor(Compressor):
def __init__(self, content=None, output_prefix="js", context=None):
filters = list(settings.COMPRESS_JS_FILTERS)
super(JsCompressor, self).__init__(content, output... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class NavbarSettings(Document):
def validate(self):
self.validat... |
import unittest
import os
import shutil
import json
import threading
import Queue
import time
import random
import memcache
import testUtils
testUtils.addSymServerToPath()
import quickstart
# WARNING: Setting this too high will result in problems with too many handles
# open.
REQUEST_COUNT = 300
TEST_DIR = os.path.d... |
# -*- coding: utf-8 -*-
"""
Django settings for fifo project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_litera... |
from django.urls import include, path, re_path
from quicktill.tillweb.views import *
from .stocktake import *
tillurls = [
path('', pubroot, name="tillweb-pubroot"),
path('session/', sessionfinder, name="tillweb-sessions"),
path('session/<int:sessionid>/', include([
path('', session, name="tillweb... |
#
# Classes for building disk device xml
#
# Copyright 2006-2008, 2012-2014 Red Hat, Inc.
# Jeremy Katz <katzj@redhat.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 t... |
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=None, headers=None, max_age=21600, attach_to_all=True, automatic_options=True):
if methods is not None:
methods = ', '.join(sorted(x.upper() for x in me... |
# Copyright 2013 Canonical 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 required b... |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
from flask import url_for, jsonify
from haha.user.models import User, BlacklistToken
from .factories import UserFactory
import time
class TestRegistering:
"""Register a user."""
def test_auth_registration(s... |
"""Note: this code was modified from:
https://github.com/lpigou/Theano-3D-ConvNet/blob/master/LICENSE
by @lpigou and collaborators
"""
import numpy as np
import theano.tensor as T
import keras.backend as K
from keras.layers.core import Layer
class NormLayer(Layer):
""" Normalization layer """
def __init__(s... |
# Copyright 2012 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 requ... |
# -*- coding: utf-8 -*-
p = (Multbeta, Multr, Multl, Multbrl)
if TipoModelo == 'MARAD':
arq = os.path.abspath('./dados/marad_derivada.dat')
elif TipoModelo == 'TP':
arq = os.path.abspath('./dados/tp_derivada.dat')
en = ('Navioteste', arq, 'inputtab.dat')
io = es(en)
DicionarioDerivadas = io.lerarqder... |
# -*- coding: utf-8 -*-
# test/unit/core/test_client.py
# Copyright (C) 2016 authors and contributors (see AUTHORS file)
#
# This module is released under the MIT License.
"""Test client"""
# ============================================================================
# Imports
# =====================================... |
# coding: utf-8
# Copyright (C) 2017 Open Path View, Maison Du Libre
# 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.
# ... |
# 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) 2009 Canonical
#
# Authors:
# Andrew Higginson
#
# 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; version 3.
#
# This program is distributed in the hope that it will be useful, b... |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# python version: 2.7.5 final, serial: 0
import argparse
import os
import signal
import sys
import traceback
import warnings
from hashcalclib import __version__, __author__, __date__
from hashcalclib.hashcalclib import FileInfo, Error
from hashcalclib.... |
#!/usr/bin/env python3
def cost(matrix1, matrix2):
return matrix1[0]*matrix1[1]*matrix2[1]
def single_to_double(elements):
return [(elements[i], elements[i+1]) for i in range(len(elements)-1)]
def minimum_cost(i, j, matrix_array, cache=None):
if not cache:
cache={}
if not (i,j) in cache:
... |
# -*- 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):
# Deleting field 'Image.alt'
db.delete_column(u'programs_image', 'alt')
def backwards(self, orm):
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-24 09:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_username_max_length'),
('user', '0001_initial'),
]
op... |
import os
import math
import random
import sys
import unittest
from openglider.airfoil.parametric import BezierProfile2D
from openglider.vector import Polygon2D, PolyLine2D
import openglider.plots.marks
try:
import openglider
except ImportError:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(s... |
# MIT License
#
# Copyright (c) 2016 Daily Actie
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
# -*- coding: utf-8 -*-
#
# Read The Docs documentation build configuration file, created by
# sphinx-quickstart on Sat Aug 14 00:06:40 2010.
#
# 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.
#... |
# -*- 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... |
# Copyright (c) 2013 Johan Ceuppens.
# All rights reserved.
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# dis... |
#
# Copyright (c) 2019-2020 Google LLC. All Rights Reserved.
# Copyright (c) 2016-2018 Nest Labs 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
#
# ... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio 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 opt... |
# -*- coding: utf-8 -*-
"""Docker Swarm Client API."""
from typing import List
import re
import os
import logging
import copy
import docker
import yaml
LOG = logging.getLogger('sip.ec.docker_swarm_client')
class DockerSwarmClient:
"""Docker Swarm Client Interface."""
def __init__(self):
"""Initial... |
# 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):
# Deleting field 'SubtitleLanguage.subtitles_fetched_count'
db.delete_column('subtitles_subtitlelangua... |
import argparse, os, time
import urlparse, random
from selenium import webdriver
from bs4 import BeautifulSoup
import io
"""
Given a page soure get links of user profiles
Input: HTML page source
Output: Links of people profile
"""
def getPeopleLinks(page):
links = []
# Find all hyper links
for link... |
# @ 2020 Akretion - www.akretion.com.br -
# Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import os
import sys
import traceback
from odoo import _, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.addons.account_move_bas... |
# -*- coding: utf-8 -*-
"""
Module for machine
"""
import paramiko
import re, string
class Machine(object):
"""
Representation of a machine
"""
def __init__(self, name, ip, username, password, gateway="", prompt=None):
"""
Create a new Machine object
:param n... |
import click
import pytest
from click.testing import CliRunner
from tests.core.mock_source import MockSource
from time_tracker.frontends.cli.tracker import print_time_tracking_info
from time_tracker.frontends.cli.options import DependentOption
@pytest.fixture(autouse=True)
def monkeypatch_config(monkeypatch):
... |
# -*- test-case-name: twisted.test.test_internet -*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Posix reactor base class
"""
import warnings
import socket
import errno
import os
from zope.interface import implements, classImplements
from twisted.python.compat import set
fr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0004_client_activation_link_offset'),
]
operations = [
migrations.CreateModel(
name='Ride',
... |
"""
Formatting numeric literals.
"""
from blib2to3.pytree import Leaf
def format_hex(text: str) -> str:
"""
Formats a hexadecimal string like "0x12B3"
"""
before, after = text[:2], text[2:]
return f"{before}{after.upper()}"
def format_scientific_notation(text: str) -> str:
"""Formats a numer... |
# -*- coding: UTF-8 -*-
"""
Plot visualization of user habits, i.e. show which actions typically follow some given user action.
Note: the figure for "Frontdoor=Closed" slightly deviates from Figure 1 in the paper and Figure 5.1 in the
dissertation (see paper_experiments.py for bibliographical information). The numb... |
"""Translation helper functions."""
from __future__ import unicode_literals
import locale
import os
import re
import sys
import gettext as gettext_module
from threading import local
import warnings
from yweb.utils.importlib import import_module
from yweb.utils.datastructures import SortedDict
from yweb.utils.encoding... |
# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.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.
# ... |
from __future__ import absolute_import, division, print_function
import codecs
import functools
import inspect
import io
import math
import os
import re
import shutil
import struct
import sys
import tempfile
from errno import ENOENT
from collections import Iterator
from contextlib import contextmanager
from importlib ... |
'''
Convert article's text in the dataset to word embeddings using a pretrained word2vec dictionary.
'''
import h5py
import numpy as np
from nltk.tokenize import wordpunct_tokenize
import nltk
import utils
import cPickle as pkl
import os
import parameters as prm
import time
def compute_emb(pages_path_in, pages_path_ou... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Provides:
- List; like list but returns None instead of IndexOutOfBounds
- Storage; like dictionary allowi... |
#---------------------------------------------------------------------------
# Copyright 2013 PwC
#
# 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/LICENS... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# moehime / saimoe / data source - livedoor - thread
#
# Copyright (C) 2012 Wang Xuerui <idontknw.wang@gmail.com>
#
# This file is part of moehime.
#
# moehime is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License ... |
# Copyright 2017 Battelle Energy Alliance, 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 t... |
"""Test the logging backend"""
import json
import datetime
from unittest import TestCase
from unittest.mock import patch
from unittest.mock import sentinel
import pytz
from eventtracking.backends.logger import LoggerBackend
class TestLoggerBackend(TestCase):
"""Test the logging backend"""
def setUp(self)... |
import random
import time
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.cache import cache
from django.utils import simplejson as json
from django.views.decorators.http import require_POST
from djan... |
# Copyright (c) 2017 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.Settings.ContainerRegistry import ContainerRegistry
from cura.MachineAction import MachineAction
from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty
from UM.i18n import i18nCatalog
from UM.Application im... |
'''
mysql_clone_database.py - clone a mysql database
================================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
This script clones a mysql database.
Usage
-----
Example::
python mysql_clone_database.py src dest
will clone the database ``... |
"""
=============================================
Integration and ODEs (:mod:`scipy.integrate`)
=============================================
.. currentmodule:: scipy.integrate
Integrating functions, given function object
============================================
.. autosummary::
:toctree: generated/
quad ... |
import unittest
from pyisc import DataObject
from numpy import array, c_,unique
from scipy.stats import norm
from numpy.testing.utils import assert_allclose, assert_equal
class test_DataObject(unittest.TestCase):
def test_dataobject_set_column_values(self):
X = array([norm(1.0).rvs(10) for _ in range(1000... |
# Time-stamp: <03/08/11 13:12:06 smulloni>
########################################################################
# Copyright (C) 2002 Andrew Csillag <drew_csillag@yahoo.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
#... |
#
# 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... |
#
# This file is part of Healpy.
#
# Healpy 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.
#
# Healpy is distributed in the hope... |
# Copyright (c) 2010-2011 IBM.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
import sys
import base64
import os
import math
import shutil
def cout(s, nl=True, flush=False):
sys.stdout.write(s)
if nl:
sys.stdout.write('\n')
if flush:
sys.stdout.flush()
def cerr(s, nl=True, flush=False):
sys.stderr.write(s)
if nl:
sys.stderr.write('\n')
if flush... |
"""codegen related to bool types"""
import tvm
import numpy as np
def test_cmp_load_store():
n = 32
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder((n,), name='B')
C = tvm.compute(A.shape, lambda *i: A(*i) > B(*i), name='C')
D = tvm.compute(C.shape, lambda *i: tvm.all(C(*i), A(*i) > 1), na... |
# -*- Mode: Python; py-indent-offset: 4 -*-
# pygobject - Python bindings for the GObject library
# Copyright (C) 2012 Simon Feltman
#
# gi/_signalhelper.py: GObject signal binding decorator object
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... |
# -*- Mode: Python; coding: utf-8; -*-
import sys, os
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
import gettext
import imp
try:
from ConfigParser import ConfigParser as ConfigParser
except:
from configparser import ConfigParser as ConfigParser
nebula_dir = os.getenv('NEBULA... |
import datetime
from dateutil.parser import parse
import json
import pythesint as pti
from nansat.vrt import VRT
from nansat.mappers.mapper_netcdf_cf import Mapper as NetcdfCF
from nansat.exceptions import WrongMapperError
# Dictionary with mappings of GCMD metadata keywords:
def get_gcmd_keywords_mapping():
gc... |
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2015 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. 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 ob... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from main_ui import Ui_Form
import ast
import os
import string
import random
from libs.dialogs import message, text
class mainPopup(QMainWindow, Ui_Form):
def __init__(self, args):
QMainWindow.__init__(self)
self.setupUi(self)
self.anim ... |
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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,... |
import mimetypes
import os
import re
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.files.uploadedfile import UploadedFile
from django.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.