text stringlengths 475 200k |
|---|
#Nagios execute this cript
import os.path,sys,datetime
from sqlalchemy import insert
import G_iisLogDbModel_SqlAlchemy
#SQL Alchemy Core
mt = G_iisLogDbModel_SqlAlchemy.metadata
lt = G_iisLogDbModel_SqlAlchemy.logtable
e = G_iisLogDbModel_SqlAlchemy.engine
connection = e.connect()
#Parser part
c = 0
t... |
from __future__ import absolute_import, division, print_function, unicode_literals
from .log import Log
from .alert_contact import AlertContact
from termcolor import colored
class Monitor(object):
class Type:
HTTP = 1
KEYWORD = 2
PING = 3
PORT = 4
TYPES = {
Type.HTTP:... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test fee estimation code."""
from test_framework.test_framework import PivxTestFramework
from test_fra... |
# 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.
import unittest
from dashboard import testing_common
from dashboard.models import sheriff
class SheriffTest(testing_common.TestCase):
def testSheriffUr... |
# -*- coding: latin1 -*-
################################################################################################
import tweepy, datetime, sys, time, json, os, os.path, shutil, time, struct, random
reload(sys)
sys.setdefaultencoding('utf-8')
#####################################################################... |
#!/usr/bin/env python
"""
cnfhash
~~~~~~~
CNF hashing implemented in python3
(C) Lukas Prokop, 2015, Public Domain
"""
import os.path
from setuptools import setup
def readfile(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as fp:
return fp.read()
setup(
name='c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**notifications_manager.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Defines the :class:`NotificationsManager` and :class:`Notification` classes.
**Others:**
"""
from __future__ import unicode_literals
import time
from PyQt4.QtCore import... |
import json
import discord
def pp_json(json_thing, sort=True, indents=4):
with open('keys.json', 'w') as outfile:
if type(json_thing) is str:
json.dump(json.loads(json_thing), outfile, sort_keys=sort, indent=indents)
else:
json.dump(json_thing, outfile, sort_keys=sort, indent... |
"""
Acceptance tests for Content Libraries in Studio
"""
from ddt import ddt, data
from flaky import flaky
from nose.plugins.attrib import attr
from .base_studio_test import StudioLibraryTest
from ...fixtures.course import XBlockFixtureDesc
from ...pages.studio.auto_auth import AutoAuthPage
from ...pages.studio.utils ... |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... |
"""Examples using create_subprocess_exec() and create_subprocess_shell()."""
import asyncio
import signal
from asyncio.subprocess import PIPE
@asyncio.coroutine
def cat(loop):
proc = yield from asyncio.create_subprocess_shell("cat",
stdin=PIPE,
... |
"""
WSGI config for aloeveraofforever 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_APPL... |
"""
Module to read ARFF files, which are the standard data format for WEKA.
ARFF is a text file format which support numerical, string and data values.
The format can also represent missing data and sparse data.
See the `WEKA website
<http://weka.wikispaces.com/ARFF>`_
for more details about arff format and available... |
from test.test_support import (findfile, TESTFN, unlink, captured_stdout,
run_unittest)
import unittest
from test import audiotests
import os
import io
import sys
import struct
import aifc
class AifcTest(audiotests.AudioWriteTests,
audiotests.AudioTestsWithSourceFile):
... |
import re
import sys
import time
import os
import argparse
# This script uses the TAMA read levels support file for sampling curves
ap = argparse.ArgumentParser(description='This script uses the TAMA read support levels file to create a saturation curve')
ap.add_argument('-r', type=str, nargs=1, help='Read supp... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, [EMAIL]
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test f... |
from flask import request
from flask_restplus import Resource
from skf.api.security import security_headers, validate_privilege
from skf.api.code.business import get_code_items_checklist_kb
from skf.api.code.serializers import code_items_checklist_kb_all, message
from skf.api.restplus import api
from skf.api.code.parse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import urlparse
def encode_unicode_dict(unicodedict, encoding="utf-8"):
bytedict = {}
for key in unicodedict:
if isinstance(unicodedict[key], unicode):
bytedict[key] = unicodedict[key].encode(encoding)
elif isinstance(unic... |
from nmrmint.model.nmrmath import *
import numpy as np
from scipy.sparse import lil_matrix
from scipy.linalg import eigh
# from .testdata import TWOSPIN_SLOW, AB_WINDNMR
# , TWOSPIN_COALESCE, TWOSPIN_FAST omitted for now
# The attempt to put pytest code in a class failed. For whatever reason,
# pytest could not detect... |
"""
Geometric primitives like prisms, spheres, etc.
"""
import numpy as np
class WithPhysicalProperties():
"""
Base class for all geometric objects that have physical properties.
"""
def __init__(self, **properties):
self._density = None
self._magnetization = None
self._induce... |
'''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
'''
import fit_path # NOQA: unused import
from nose.plugins.attrib import attr
import fit_common
import flogging
import sys
log = flogging.get_loggers()
# This gets the list of nodes
NODECATALOG = fit_common.node_select()
# dict containing boo... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
MultipleInputDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... |
# 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"); y... |
# Copyright (c) 2012 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.
""" Source file for buildbot.status module modifications. """
import urllib
import buildbot
import buildbot.util
import buildbot.status.web.base as bas... |
# Tests some corner cases with isinstance() and issubclass(). While these
# tests use new style classes and properties, they actually do whitebox
# testing of error conditions uncovered when using extension types.
import unittest
from test import test_support
class TestIsInstanceExceptions(unittest.TestCase):
... |
#!/usr/bin/env python3
#
# Copyright (C) 2015 Peter Todd
#
# 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,... |
class Node(object):
"""
A node is the lowest level component and represents a single binary state.
A node can be connected to another node, when its value changes so does the value of its connected node.
"""
def __init__(self, value, value_changed):
self._value_changed = value_changed
... |
#!/usr/bin/env python
from pysqlcipher import dbapi2
from db.migrations import migrations_util
from node import constants
def upgrade(db_path):
with dbapi2.connect(db_path) as con:
cur = con.cursor()
# Use PRAGMA key to encrypt / decrypt database.
cur.execute("PRAGMA key = 'passphrase';... |
# 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 the... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# NOTE: This is not truly a data migration.
# It instead asserts that your... |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... |
# Copyright 2012-2013 John Sullivan
# Copyright 2012-2013 Other contributers as noted in the CONTRIBUTERS file
#
# This file is part of Galah.
#
# Galah is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, e... |
from __future__ import absolute_import
from ._compat import urlopen
from ._util import xml2dict
class Niconico():
def login(self):
'''TODO:
'''
def logout(self):
'''TODO:
'''
def search(self):
'''TODO: implement: http://search.nicovideo.jp/docs/api/snapshot.html
'''... |
import fauxfactory
import pytest
from widgetastic_patternfly import Dropdown
from cfme import test_requirements
from cfme.automate.dialogs.service_dialogs import DialogsView
from cfme.fixtures.automate import DatastoreImport
from cfme.services.service_catalogs import ServiceCatalogs
from cfme.tests.automate.custom_but... |
"""
loaddb.py:
Handler for loading and reinitializing the data store.
* Author: Mitchell Bowden <mitchellbowden AT gmail DOT com>
* License: MIT License: http://creativecommons.org/licenses/MIT/
"""
from google.appengine.runtime import DeadlineExceededError
from google.appengine.ext import webapp
from google.appengin... |
#!/usr/bin/env python2
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, ... |
import argparse
import itertools
import reader
import paddle.v2 as paddle
from network_conf import DSSM
from utils import logger, ModelType, ModelArch, load_dic
parser = argparse.ArgumentParser(description="PaddlePaddle DSSM infer")
parser.add_argument(
'--model_path',
type=str,
required=True,
help="p... |
"""Tests the utils.sentinel module of pyexperiment
Note that some of the tests below are redundant, but they are kept here
as future python versions might change in an incompatible way (it
happened before...).
Written by Peter Duerr
"""
from __future__ import print_function
from __future__ import unicode_literals
fro... |
'''Sitemap.xml'''
import gzip
import zlib
from wpull.document.base import BaseExtractiveReader, BaseDocumentDetector
from wpull.document.util import is_gzip
from wpull.thirdparty import robotexclusionrulesparser
import wpull.decompression
import wpull.util
from wpull.document.htmlparse.element import Element
class ... |
# -*- coding: utf-8 -*-
"""
Common Utilities run most requests
"""
# =============================================================================
# Special local requests (e.g. from scheduler)
#
if request.is_local:
# This is a request made from the local server
f = get_vars.get("format", None)
auth... |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The primar... |
# Copyright (c) 2016,2017,2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of generally useful calculation tools."""
import functools
from inspect import signature
from operator import itemgetter
import warnings
impo... |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os.path
from ..job import ImageModelJob
from digits.utils import subclass, override
# NOTE: Increment this everytime the pickled object changes
PICKLE_VERSION = 1
@subclass
class ImageClassificationMod... |
# -*- 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):
# Changing field 'Subscription.plan'
db.alter_column('spreedly_subscription', 'plan_id', self.gf('django.db... |
"""The tests for Kira sensor platform."""
import unittest
from unittest.mock import MagicMock
from homeassistant.components.sensor import kira as kira
from tests.common import get_test_home_assistant
TEST_CONFIG = {kira.DOMAIN: {
'sensors': [{'host': '127.0.0.1',
'port': 17324}]}}
DISCOVERY_INF... |
from utils.Observable import Observable
from tips import TIPS
import gtk
#
# Class for tip-of-the-day dialogs.
#
class TipOfTheDay(gtk.MessageDialog, Observable):
OBS_TIP = 0
OBS_TOGGLED = 1
def __init__(self, index):
self.__index = index - 1
gtk.MessageDialog.__init__(self, None, g... |
from settings.dependencies.base_settings import *
# Django Suit configuration example
SUIT_CONFIG = {
# header
'ADMIN_NAME': 'Funky Dashboard',
# 'HEADER_DATE_FORMAT': 'l, j. F Y',
# 'HEADER_TIME_FORMAT': 'H:i',
# forms
'SHOW_REQUIRED_ASTERISK': True, # Default True
'CONFIRM_UNSAVED_CHANGE... |
# -*- coding: utf-8 -*-
from django_tables2 import tables, columns
from django_tables2.utils import A
from .models import Backup
from .models.schedule import Schedule
import itertools
class BackupTable(tables.Table):
row_number = columns.Column(empty_values=(), verbose_name='No.')
schedule = columns.Column(... |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""FAQ document models."""
__metaclass__ = type
__all__ = [
'FAQ',
'FAQSearch',
'FAQSet',
]
from lazr.lifecycle.event import ObjectCreatedEvent
from sqlobject im... |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
""" This module reimplements Python's native thread module using Panda
threading constructs. It's designed as a drop-in replacement for the
thread module for code that works with Panda; it is necessary because
in some compilation models, Panda's threading constructs are
incompatible with the OS-provided threads used b... |
# Copyright (C) 2006-2011 by
# Aric Hagberg <[EMAIL]>
# Dan Schult <[EMAIL]>
# Pieter Swart <[EMAIL]>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = """\n""".join(['Aric Hagberg ([EMAIL])',
'Pieter Swart ([EMAIL])',
'Dan ... |
"""
This stemmer is re-used from the Whoosh project.
If we want a Porter2 stemmer, there is one available at http://dirolf.com/project/pyporter2.html
Reimplementation of the
`Porter stemming algorithm <http://tartarus.org/~martin/PorterStemmer/>`_
in Python.
In my quick tests, this implementation about 3.5 times fast... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Darren Worrall <[EMAIL]>
# Copyright (c) 2015, René Moser <[EMAIL]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIB... |
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import re
from .const import REPO_ROOT
from compose import const as compose_const
section_header_re = re.compile(r'^[0-9]+\.[0-9]+\.[0-9]+ \([0-9]{4}-[01][0-9]-[0-3][0-9]\)$')
class ScriptError(Exception):
pass
def branc... |
from django.core import validators
from django import oldforms
from django.core.mail import mail_admins, mail_managers
from django.http import Http404
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.comm... |
# Concept profile generation and analysis for Gene-Disease paper
# Copyright (C) 2015 Biosemantics Group, Leiden University Medical Center
# Leiden, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by ... |
# Copyright 2010-2012 Opera Software ASA
#
# 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 ... |
# Copyright (c) 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.
"""LayoutTests/ presubmit script for Blink.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presu... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [EMAIL], All rights reserved.
# LLNL-CODE-647188
#
# F... |
# The MIT License
#
# Copyright 2014, 2015 Piotr Dabkowski
#
# 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, modif... |
# 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... |
#
# Pan.py -- Pan plugin for fits viewer
#
# Eric Jeschke ([EMAIL])
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import math
from ginga.misc import Widgets, CanvasTypes, Bunch
from ginga import Gin... |
from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls import patterns, include, url
try:
from django.conf.urls.i18n import i18n_patterns
except ImportError:
from i18nurls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
urlpatterns = p... |
import time
import requests
import urllib3
import websocket
import threading
import json
import logging
import touchphat
from logging.handlers import SysLogHandler
#GW_URL = "http://localhost/monitor/kodi.php"
GW_URL = "https://gateway/things/"
KODI_URL = "http://libreelec:8080/jsonrpc"
WEB_THING = "ws://... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <[EMAIL]>
# Copyright 2007 Kenneth Loafman <[EMAIL]>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the... |
from unittest import TestCase
import numpy as np
from teafacto.blocks.seq.encdec import SimpleSeqEncDecAtt
from teafacto.blocks.match import LinearDistance
from teafacto.core.base import Val
class TestSimpleSeqEncDecAtt(TestCase):
def test_vector_out(self):
encdec = SimpleSeqEncDecAtt(inpvocsize=19, out... |
# Copyright (C) 2013 Deutsche Telekom AG
# 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 r... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [EMAIL], All rights reserved.
# LLNL-CODE-647188
#
# F... |
from setuptools import setup, find_packages
import sys
import os
version = '0.9.0'
setup(name='matrixdriver',
version=version,
description='Driver for the 8x8 RPI-RGB-LED-Matrix based on the 74HC595 chip.',
long_description='''MatrixDriver is a powerful Python API to control 8x8 RPI-RGB-LED-Matrix b... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
CreateConstantRaster.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Article.git_dir'
db.add_column('Articles', 'git_dir',
self.gf('django.... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import copy
from copy import deepcopy
from time import time
from django.conf import settings
from django.db.models import Q
from django.db.models.base import ModelBase
from django.utils import six
from django.utils import tree
from haystack.constants impor... |
# -*- coding:utf8 -*-
'''
The LMDI calculator
'''
from __future__ import unicode_literals
from __future__ import division
import logging
import operator
from math import log, sqrt, exp
from Algorithm import lambda_min, theta_max
from Cef_Read import CEF_DIC
class Lmdi(object):
'''
The class of Lmdi
'''
... |
#!/usr/bin/env python2
# -*- coding:windows-1251 -*-
"""Find files with letters in russian windows-1251 encoding.
windows-1251 is a single byte encoding with a range 0xC0-0xFF
and 0xA8,0xB8 for symbols ¸ and ¨ respectfully. Unfortunately,
russian symbols in windows-1251 clash with russian symbols in
utf-8, where they... |
# Author: Henri Starmans
# Company: Hexastorm
# Date: 3-3-2017
import numpy as np
from scipy.integrate import dblquad
from sympy import symbols, diff, cos, sin, sqrt
# Parameters used:
n=1.53 # refractive index should equal s.refractive_index(405e-9,4)
facets = 4 # number of p... |
#----------------------------------------------------------------------
# Copyright (c) 2008 Board of Trustees, Princeton University
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, i... |
# (c) 2012, Michael DeHaan <[EMAIL]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# A... |
"""
This config file runs the simplest dev environment"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import
from .common import *
from logsettings import get_logger_config
# import settin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This module contains functions to manipulate very restricted UTC
timestamps and time deltas.
'''
import time as _time
import datetime as _datetime
from BTL.canonical.unicode import to_utf8 as _to_utf8
def to_datetime(dt):
'''
Convert dt to a datetime.dateti... |
import os
import tempfile
import pytest
from rancher import ApiError
from kubernetes.client import CoreV1Api
from .common import auth_check, random_str, string_to_encoding
from .conftest import wait_for, wait_for_condition
import time
def test_node_fields(admin_mc):
cclient = admin_mc.client
fields = {
... |
"""Auth pipeline definitions.
Auth pipelines handle the process of authenticating a user. They involve a
consumer system and a provider service. The general pattern is:
1. The consumer system exposes a URL endpoint that starts the process.
2. When a user visits that URL, the client system redirects the user t... |
# Copyright 2014 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.
import os
import re
import shutil
import sys
import StringIO
import tempfile
import unittest
from telemetry import benchmark
from telemetry import story
fro... |
#
# DX Analytics
# Fourier-based Pricing
# dx_fourier.py
#
# DX Analytics is a financial analytics library, mainly for
# derviatives modeling and pricing by Monte Carlo simulation
#
# (c) Dr. Yves J. Hilpisch
# The Python Quants GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under th... |
class SpriteAnimationPlayer(object):
def __init__(self, renderer, animation):
self.renderer = renderer
self.animation = animation
self.stage_index = 0
def start_animation(self, extra_time=0):
self.stage_index = 0
self.start_next_stage(extra_time=extra_time)
def st... |
import datetime
import time
import logging
from . import celery, db
from .models import ConfigTemplate
from .utils.export import export_configuration_to_local_ftp, export_configuration_to_local_tftp
logger = logging.getLogger("tasks")
@celery.task()
def debug_celery_task(a, b):
"""
simple debug task to test ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
OneSideBuffer.py
---------------------
Date : Janaury 2015
Copyright : (C) 2015 by Giovanni Manghi
Email : giovanni dot manghi at naturalgis dot pt
*****... |
# Copyright 2012 IBM Corp.
#
# 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... |
HEADER = '''#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:%s
#EXT-X-MEDIA-SEQUENCE:%s'''
FOOTER = '''
#EXT-X-ENDLIST'''
class M3U8:
files = []
target_duration = 10
def add_file(self, file_name, file_length):
self.files.append({'length': file_length, 'name': file_name})
# Takes an M3U8 file... |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.storage import Storage
from gluon.validators import IS_NOT_EMPTY, IS_EMPTY_OR, IS_IN_SET
from s3 import... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012-2013 eNovance <[EMAIL]>
#
# Author: Julien Danjou <[EMAIL]>
#
# 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/licen... |
# Copyright (C) 2013 Jeremy S. Sanders
# Email: Jeremy Sanders <[EMAIL]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from cms.api import add_plugin, create_page
from cms.models.placeholdermodel import Placeholder
from cmsplugin_cascade.link.plugin_base import LinkElementMixin
from cmsplugin_cascade.bootstrap3.buttons import BootstrapButto... |
# QThread Class file
# We will use this class to run the process in separate Thread
# So that the main GUI will not freeze/hang while the process is running
from PySide import QtCore, QtGui
import subprocess # library for running os console command
class ProcessThread(QtCore.QThread):
def __init__(self,drive,rad... |
# Copyright (c) 2012, Tom Hendrikx
# All rights reserved.
#
# See LICENSE for the license.
import argparse
import ConfigParser
import datetime
import logging
import os.path
import re
import sys
import time
from pkg_resources import resource_string
import Milter
from dspam import VERSION, utils
from dspam.client impo... |
from django.db import models
from django.utils import timezone
import datetime
# Create your models here.
class Relatorio(models.Model):
Id = models.AutoField(primary_key=True)
Date_Created = models.DateTimeField(default=timezone.now)
@classmethod
def get_all(cls):
return cls.objects.all()
... |
# 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... |
import psycopg2
import scipy.io
import os
# Create a connection to RoboticBicycle database
conn = psycopg2.connect(database="robot_bicycle_parameters", user="hazelnusse")
cur = conn.cursor()
def insert_statement(cur, table, row):
q = cur.mogrify("insert into " + table + " values(%s, %s, %s, %s, %s);", row)
re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.