src stringlengths 721 1.04M |
|---|
import time
import sys
import RPi.GPIO as GPIO
off = '1242424352424342424242424242425342524342'
b0 = '12424243524243424242424242424242424242424242'
b1 = '124242435242434242424242424242534242424242'
b2 = '1242424352424342424242424242425353424242'
b3 = '124242435242434242424242424242424253424242'
b4 = '12424243524243424... |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
"""\
MINDO3.py: Dewar's MINDO/3 Semiempirical Method
This program is part of the PyQuante quantum chemistry program suite.
Copyright (c) 2004, Richard P. Muller. All Rights Reserved.
PyQuante version 1.2 and later is covered by the modified BSD
license. Please see the file LICENSE that is part of this
distrib... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
#!/usr/bin/env python
#/******************************************************************************
# * $Id: gdalinfo.py 28391 2015-01-30 19:57:31Z rouault $
# *
# * Project: GDAL Utilities
# * Purpose: Python port of Commandline application to list info about a file.
# * Author: Even Rouault, <even dot rouault ... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests microvm start with configuration file as command line parameter."""
import os
import re
from retry.api import retry_call
import pytest
import framework.utils as utils
def _configure_vm_from_jso... |
# -*- coding: utf-8 -*-
from module.plugins.Account import Account
class PremiumTo(Account):
__name__ = "PremiumTo"
__type__ = "account"
__version__ = "0.06"
__description__ = """Premium.to account plugin"""
__license__ = "GPLv3"
__authors__ = [("RaNaN", "RaNaN@pyload.org"),
... |
#!/usr/bin/env python
# coding:utf-8
import logging
RECORD_NORMAL = 0
RECORD_DELETED = 1
RECORD_CHOICE = (
(RECORD_NORMAL, u'正常'),
(RECORD_DELETED, u'已删除'),
)
def is_valid_kw(obj, is_update=False, **kw):
mappings = obj.__mappings__
if is_update and kw.get('deleted', None) == RECORD_DELETED:
... |
'''
This is a GRID search to find the best parameters of an algorithm.
In future developments it will be parallelized.
In the Mountain Car Problem, for Sarsa with Tile Coding, we
have the parameters from Sutton and Barto Book
alpha = 0.5 (then divided by num tilings, so it becomes 0.5/0.8, check the implement... |
# -*- coding: utf-8 -*-
from intstr import IntStr
from redis import StrictRedis
redis_keyer = IntStr(
'!"#$&()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~'
)
REDIS_KEY_ID = 'RedisKeyId'
REDIS_KEY = 'RedisKey'
REDIS_ID_KEY = 'RedisIdKey'
_EXIST = set()
class RedisKey(object):
... |
from .part import Part
from .request import Request
from .response import Response
from .primitives import Array, String, Bytes, Int16, Int32
api_name = "join_group"
__all__ = [
"JoinGroupRequest",
"JoinGroupResponse",
"GroupProtocol",
"Member",
]
class GroupProtocol(Part):
"""
::
G... |
import ast
import hashlib
import itertools
import json
import re
def create_thumbnail(image_filename, thumb_filename, window_size=(280, 160)):
"""Create a thumbnail whose shortest dimension matches the window"""
from PIL import Image
im = Image.open(image_filename)
im_width, im_height = im.size
w... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import erpnext
from frappe.desk.reportview import get_match_cond, get_filters_cond
from frappe.utils import nowdate, getdate
from collecti... |
#004BB1#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Disco Defense
Open source game by Ferris(FerrisofVienna) Bartak
and Paolo "Broccolimaniac" Perfahl
using python3 and pygame
"""
#the next line is only needed for python2.x and not necessary for python3.x
from __future__ import print_function, division
import ra... |
import pkg_resources
import numpy as np
import pandas as pd
from ..core.pycompat import basestring
def _load_default_cmap(fname='default_colormap.csv'):
"""
Returns viridis color map
"""
from matplotlib.colors import LinearSegmentedColormap
# Not sure what the first arg here should be
f = p... |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Force-Directed Graph Layout
===========================
This module contains implementations for a force-directed layout, where the
graph is modelled like a... |
#!/usr/bin/env python3
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# vim: set fileencoding=utf-8 filetype=python syntax=python.doxygen fileformat=unix tabstop=4 expandtab :
# kate: encoding utf-8; bom off; syntax python; indent-mode python; eol unix; replace-tabs off; indent-width 4; tab-... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
# This module is empty. It is merged whith l10n_be version 14.1. This behaviour was backported in 14.0
# but the module can not removed in a stabl... |
from openid.consumer.html_parse import parseLinkAttrs
import os.path
import codecs
import unittest
def parseLink(line):
parts = line.split()
optional = parts[0] == 'Link*:'
assert optional or parts[0] == 'Link:'
attrs = {}
for attr in parts[1:]:
k, v = attr.split('=', 1)
if k[-1] ... |
# encoding: utf-8
from south.v2 import DataMigration
from django.contrib.contenttypes.models import ContentType
from django.db.models import signals
from ratings.models import RatedItem, SimilarItem
class Migration(DataMigration):
def forwards(self, orm):
signals.post_save.disconnect(sender=RatedItem, ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import argparse
import logging
import os
from psd2svg import psd2svg
def main():
parser = argparse.ArgumentParser(description='Convert PSD file to SVG')
parser.add_argument(
'input', metavar='INPUT', type=str, help='Input ... |
"""Climatologies comparison"""
import datetime
import calendar
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
def get_description():
"""Return a dict describing how to call this plotter"""
... |
# Copyright 2018 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from django.test import TestCase
from cms.api import add_plugin
from cms.models import Placeholder
from socialmedia.cms_plugins import SocialLinkPlugin
from socialmedia.models import ICON_CHOICES
class SocialLinkPluginTest(TestCase):
def test_plugin_context(self):
placeholder = Placeholder.objects.creat... |
#!/usr/bin/env python
"""\
Stream g-code to Smoothie USB serial connection
Based on GRBL stream.py, but completely different
"""
from __future__ import print_function
import sys
import argparse
import serial
import threading
import time
import signal
import sys
errorflg = False
intrflg = False
def signal_term_hand... |
#! /usr/bin/env python3
from __future__ import print_function
"""Writes lines from the B6/M8 file under the given E-value to output
Usage:
b6_evalue_filter.py --b6 <b6 file> --e_value <max e_value>
--output <output file>
Copyright:
filter_b6_evalue.py filter lines of B6/M8 file by ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('yearbook', '0004_auto_20141212_1558'),
]
operations = [
migrations.RemoveField(
model_name='lotacao',
... |
from django.http.response import HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.urls.base import reverse
from lykops.forms import Form_Login
from lykops.views import Base
class Privacy(Base):
'''
该功能用于保存用户的机密数据,但该版本暂时不需要使用,故暂时不做展示
'''
def detail(sel... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
# -*- test-case-name: flocker.node.test.test_deploy -*-
"""
Deploy applications on nodes.
"""
from zope.interface import Interface, implementer
from characteristic import attributes
from twisted.internet.defer import gatherResults, fail, DeferredList, suc... |
# -*- coding: utf-8 -*-
"""
Module to create and use Redis-based cache
Uses :mod:`jukoro.pickle` to transparently pickle/unpickle cached
Python values
"""
import hashlib
import logging
from jukoro import pickle
logger = logging.getLogger(__name__)
TTL = 60 * 60 * 24
class RedisCache(object):
"""
Abstra... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
import math
from math import pi, radians, sin, cos, degrees
import mysql.connector
from mysql.connector import errorcode
size(2048, 2048)
stroke(0)
strokewidth(1)
nofill()
translate(1024, 1024)
beginpath(0, 0)
c = oval(-1024, -1024, 2048, 2048)
endpath(draw = False)
drawpath(c)
months = ["Jan", "Feb", "Mar", "Apr"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 ... |
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.db import models
ICON_CHOICES = (
("fa-delicious", _("Delicious")),
("fa-digg", _("Digg")),
("fa-facebook", _("Facebook")),
("fa-flickr", _("Flickr")),
("fa-google-p... |
#<pycode(py_ua)>
# -----------------------------------------------------------------------
class op_t(py_clinked_object_t):
"""Class representing operands"""
def __init__(self, lnk = None):
py_clinked_object_t.__init__(self, lnk)
def _create_clink(self):
return _idaapi.op_t_create()
d... |
__author__ = 'arobres'
# -*- coding: utf-8 -*-
from commons.rest_utils import RestUtils
from nose.tools import assert_true, assert_false
import commons.assertions as Assertions
import commons.fabric_utils as Fabutils
from commons.constants import URL, MODULE_NAME, REPOSITORY
from lettuce import step, world, before
... |
"""
WSGI config for crm 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`` sett... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""http://codesnipers.com/?q=python-flyweights"""
import weakref
class FlyweightMeta(type):
def __new__(mcs, name, parents, dct):
"""
:param name: class name
:param parents: class parents
:param dct: dict: includes class attributes,... |
import pika
import RPi.GPIO as GPIO
import paho.mqtt.client as mqtt
from threading import Thread
USER = "test"
PASS = "test123"
VHOST = "/cloudlynk"
HOST = "mohawk.link"
KEY = "solfeta"
XCHANGE = "home"
OUTPUT_PIN = 7
def callback(ch, method, properties, body):
level = int(body)
print("received msg: " + repr(level)... |
"""
Django settings for mad project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# ... |
from airflow import DAG
from airflow.operators import TelradExtractor
from datetime import datetime, timedelta
from airflow.models import Variable
#from airflow.telrad_extractor_operator import TelradExtractor
default_args = {
'owner': 'wireless',
'depends_on_past': False,
'start_date': datetime.now(... |
# -*- coding: utf-8 -*-
"""
************************************************************************************
Class : DatabaseReaderFactory
Author : Thierry Maillard (TMD)
Date : 13/6/2016 - 17/12/2016
Role : Return a database reader according parameters.
Licence : GPLv3
Copyright (c) 2016 - Thierry Maillard
Th... |
import MySQLdb
class DatabaseHandler:
def __init__(self):
pass
def is_delete(self, tableName):
reservedTableNameList = ["mantis_user_table", "mantis_tokens_table", "mantis_project_table", "mantis_config_table"]
isDeleteFlag = 1
for name in reservedTableNameList:
... |
from threading import Thread
from traceback import format_exc
import zmq
import logging
class MessageQueue():
def __init__(self):
self.__handlers = {}
self.__zmq_context = zmq.Context()
self.__out_socket = self.__zmq_context.socket(zmq.PUSH)
self.__thread = None
self.__protocol = None
self._... |
#!/usr/bin/python
"""
A sound level meter for the MooresCloud Holiday.
Requires PyAudio.
Copyright (c) 2013, Josh Deprez
License: MIT (see LICENSE for details)
"""
__author__ = 'Josh Deprez'
__version__ = '0.01-dev'
__license__ = 'MIT'
import pyaudio
import audioop
import struct
import math
import holiday
import sy... |
import numpy as np
from scipy.spatial import Delaunay
points = np.random.rand(30, 2) # 30 points in 2-d
tri = Delaunay(points)
# Make a list of line segments:
# edge_points = [ ((x1_1, y1_1), (x2_1, y2_1)),
# ((x1_2, y1_2), (x2_2, y2_2)),
# ... ]
edge_points = []
edges = set()
def ad... |
from Tags import P, Span, A, Strong
class Page_navigation( P ):
def __init__( self, page_path, displayed_item_count, total_item_count, start, items_per_page, return_text = None ):
if start is None or items_per_page is None:
P.__init__( self )
return
if displayed_item_count == 1 and displayed_ite... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#---------------------------------------------------------------
# FoLiA Set Definition tool
# by Maarten van Gompel
# Centre for Language Studies
# Radboud University Nijmegen
# proycon AT anaproy DOT nl
#
# Licensed under GPLv3
#----------------------------------... |
import json
from StringIO import StringIO
from testtools import TestCase
from testtools.matchers import (
AfterPreprocessing, ContainsDict, Equals, IsInstance, MatchesAll,
MatchesListwise, MatchesStructure)
from testtools.twistedsupport import failed, succeeded
from treq.testing import StringStubbingResource, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
from re... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_li... |
from GenericRequest import GenericRequest
from kol.database import SkillDatabase
from kol.manager import PatternManager
class UseSkillRequest(GenericRequest):
def __init__(self, session, skillId, numTimes=1, targetPlayer=None):
super(UseSkillRequest, self).__init__(session)
self.get = True
... |
import random
class Game(object):
"""
holds all information for a game. Later it may be
possible to run several game instances at once
"""
number = 0
def __init__(self):
self.number = Game.number
Game.number += 1
self.rooms = {} # dictionary of rooms, key is room number... |
from django.db import models
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
import re
# Create your models here.
class Scan(models.Model):
name=models.CharField(max_length=200,default="")
hosts=models.TextField(default="")
profile=models.ForeignKey("Scan_Profile", r... |
# Copyright 2008-2015 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... |
# Copyright 2015 Isotoma Limited
#
# 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... |
"""
Copyright (c) 2014 Idiap Research Institute, http://www.idiap.ch/
Written by Kenneth Funes <kenneth.funes@idiap.ch>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the ... |
"""
Meraki Networks API Resource
"""
import urllib
from .meraki_api_resource import MerakiAPIResource
from .devices import Devices
from .ssids import SSIDs
from .site_to_site_vpn import SiteToSiteVPN
from .phone_contacts import PhoneContacts
from .sm import SM
from .static_routes import StaticRoutes
from .vlans import... |
import tempfile
import os
import shutil
import subprocess
import shlex
import cgi
import sys
# For development only
import cgitb
cgitb.enable()
# Set some global preferences
template_dir = os.path.dirname(os.path.realpath(__file__))+"/../R/"
pandoc_location = "/usr/lib/rstudio/bin/pandoc"
path = "/usr/bin:/bin"
# ... |
# Problem name: 10849 Move the bishop
# Problem url: https://uva.onlinejudge.org/external/108/10849.pdf
# Author: Andrey Yemelyanov
import sys
import math
WHITE, BLACK = 0, 1
INFINITY = -1
def main():
n_test_cases = int(sys.stdin.readline().strip())
for i in range(n_test_cases):
sys.stdin.readline()
... |
# This file is part of cloud-init. See LICENSE file for license information.
from copy import copy
import mock
import os
import shutil
import tempfile
import yaml
from cloudinit.sources import DataSourceMAAS
from cloudinit import url_helper
from cloudinit.tests.helpers import CiTestCase, populate_dir
class TestMAAS... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import uuid
from abc import ABCMeta, abstractmethod
from kong.exceptions import ConflictError
from kong_admin.models import ConsumerReference, BasicAuthReference, KeyAuthReference, OAuth2Reference
from .base import KongProxySyncEngine
c... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Label.object_created'
db.add_column(u'spa_label', 'object... |
# -*- coding: ibm850 -*-
template_typed = """
#ifdef TYPED_METHOD_BIND
template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
public:
$ifret R$ $ifnoret void$ (T::*method)($arg, P@$) $ifconst const$;
#ifdef DEBUG_METHODS_ENABLED
virtual Variant... |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... |
from pillowtop.listener import AliasedElasticPillow
from dimagi.utils.decorators.memoized import memoized
from django.conf import settings
VALUE_TAG = '#value'
def map_types(item, mapping, override_root_keys=None):
if isinstance(item, dict):
return convert_property_dict(item, mapping, override_root_keys=... |
# -*- coding: utf-8 -*-
# Geographic information providers
from core import threads, constants
class DummyController(object):
"""A default dummy object that implements the
task controller interface that modRanaThreads have"""
def __init__(self):
self.status = None
self.progress = None
... |
"""
Interfaces with Z-Wave sensors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/binary_sensor.zwave/
"""
import logging
import datetime
import homeassistant.util.dt as dt_util
from homeassistant.helpers.event import track_point_in_time
from homeassistant... |
import os
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from django.utils.deconstruct import deconstructible
@deconstructible
class ConfRenamePath(object):
def __init__(self, path):
self.path = path
def __call__(self, instance, filename):
... |
#-
# Copyright (c) 2011 William M. Morland
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed... |
import numpy as np
import pandas as pd
from functools import partial
from ..utils import derived_from
def maybe_wrap_pandas(obj, x):
if isinstance(x, np.ndarray):
if isinstance(obj, pd.Series):
return pd.Series(x, index=obj.index, dtype=x.dtype)
return pd.Index(x)
return x
class... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Rasmus Sorensen, rasmusscholer@gmail.com <scholer.github.io>
## 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, eit... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import json
import time
from config import settings
from src.backend import logger
def main():
card_list = os.listdir(settings.USER_DIR_FOLDER)
for card in card_list:
basic_info = json.load(open(os.path.join(settings.USER_DIR_FOLDER, card, 'basic... |
"""Fixtures for UniFi methods."""
from typing import Optional
from unittest.mock import patch
from aiounifi.websocket import SIGNAL_CONNECTION_STATE, SIGNAL_DATA
import pytest
@pytest.fixture(autouse=True)
def mock_unifi_websocket():
"""No real websocket allowed."""
with patch("aiounifi.controller.WSClient")... |
import re
# noinspection PyPackageRequirements
import wx
# noinspection PyPackageRequirements
from wx.lib.buttons import GenBitmapButton
import gui.builtinMarketBrowser.pfSearchBox as SBox
import gui.display as d
from gui.bitmap_loader import BitmapLoader
from gui.marketBrowser import SearchBox
from service.market im... |
from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
version = '0.4.5'
install_requires = [
'urllib3>=1.7.1',
'dnspython>=1.13.0'
]
test_requires... |
import hashlib
import base64
from six.moves.urllib.parse import quote
try:
import mock
except ImportError:
from unittest import mock
import globus_sdk
from globus_sdk.auth.oauth2_native_app import make_native_app_challenge
from tests.framework import CapturedIOTestCase
class GlobusNativeAppFlowManagerTests(C... |
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
import datetime
import logging
from typing import Dict
from .utils import import_from_string
class SMSHandler(logging.Handler):
def __init__(self, provider_config: Dict) -> None:
"""
Initializes the SMSHandler
params:
provider_config: The provider configurations.
... |
#!/usr/bin/env python3
# Copied from https://github.com/scikit-learn/scikit-learn/blob/master/
# build_tools/circle/list_versions.sh
# The scikit-learn developers.
# License: BSD-style
# List all available versions of the documentation
import json
import re
import sys
from distutils.version import LooseVersion
from ur... |
#!/usr/bin/env python3
# Copyright 2020-2021 The Verible 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 ap... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Author: Andreas Älveborn
# URL: https://github.com/aelveborn/Wii-Scale
#
# This file is part of Wii-Scale
# Copyright (C) 2015 Andreas Älveborn
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
__version__=''' $Id$ '''
__doc__=''
#REPORTLAB_TEST_SCRIPT
import sys, copy, os
from reportlab.platypus import *
_NEW_PARA=os.environ.get('NEW_PARA','0')[0] in ('y','Y','1')
_REDCAP=int(os.environ.get('REDCAP','0'))
_CALLBACK=os.environ.ge... |
"""
Generate files provided by TFTP server based on Cobbler object tree.
This is the code behind 'cobbler sync'.
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Licen... |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.typecast
~~~~~~~~~~~~~~~~~~~~~
Provides functions for casting fields into specific types.
Examples:
basic usage::
>>> from riko.modules.typecast import pipe
>>>
>>> conf = {'type': 'date'}
>>> next(pipe({'content':... |
from pycparser import c_parser
import pycparser.c_ast as c_ast
import vstruct
import vstruct.primitives as vs_prim
class StructParser:
def __init__(self, psize=4, bigend=False):
self.psize = psize
self.pclass = vs_prim.v_ptr32
self.cls_parsers = {
c_ast.Decl: sel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Janice Cheng
# 在 Java/C+ 世界里没法打印 name
# 但在 Python/ JavaScript 世界里可以打印 name
# if 1 == 1:
# name = 'Janice'
# for i in range(10):
# name = i
# def func():
# name = 'Janice'
# name = 'janice'
#
# def f1():
# name = 'eric'
# print(name)
#
# f... |
#
# Copyright (C) 2015-2020 by Last Run Contributors.
#
# This file is part of Arena of Titans.
#
# Arena of Titans is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, ... |
from resources.lib import kodion
from resources.lib.youtube.client import YouTube
from resources.lib.youtube.helper.video_info import VideoInfo
__author__ = 'bromix'
import unittest
class TestClient(unittest.TestCase):
TEST_ACCESS_TOKEN = ''
def test_my_subscriptions_tv(self):
client = YouTube(acce... |
from __future__ import unicode_literals
import base64
import boto3
import collections
import datetime
import importlib
import inspect
import json
import logging
import os
import sys
import traceback
import zipfile
from builtins import str
from werkzeug.wrappers import Response
# This file may be copied into a projec... |
"""CALLHORIZONS - a Python interface to access JPL HORIZONS
ephemerides and orbital elements.
This module provides a convenient python interface to the JPL
HORIZONS system by directly accessing and parsing the HORIZONS
website. Ephemerides can be obtained through get_ephemerides,
orbital elements through get_elements.... |
import configparser as cp
import datetime
import logging
import os
import shutil
from git import Repo
from git.exc import BadName
from kentauros.conntest import is_connected
from kentauros.context import KtrContext
from kentauros.package import KtrPackage
from kentauros.result import KtrResult
from kentauros.shell_en... |
from __future__ import division
from imagefit.conf import ext_to_format, settings
from PIL import Image as PilImage
import mimetypes
try:
import StringIO
except ImportError:
import io as StringIO
import re
import os
class Image(object):
"""
Represents an Image file on the system.
"""
def __i... |
import operator
from datetime import datetime, timedelta
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from arkestra_utilities.generic_lister import (
ArkestraGenericLister, ArkestraGenericList, ArkestraGenericFilterSet,
ArkestraGenericPluginLister
)
from arkestra... |
import time
import random
from datapath import Datapath
from controller import Delta
from controller import State
from controller import FSMD
def locked_on_enter():
print "Entered locked state"
time.sleep(3)
def locked_on_leave():
pass
locked = State("locked")
locked.on_enter = locked_on_enter
locke... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
SYSTEM_NAME = "エリアパーキング"
END_DATE = '9999-12-31'
DATABASE_DEFAULT = "default"
DATABASE_REVOLUTION = "fk5dtsql"
MIME_TYPE_EXCEL = 'application/excel'
MIME_TYPE_PDF = 'application/pdf'
MIME_TYPE_ZIP = 'application/zip'
MIME_TYPE_HTML = 'text/html'
CONFI... |
"""v0 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... |
# -*- 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 'subuser'
db.create_table(u'configuration_subuser', (
(u'id', self.gf('django.db.... |
from tv_runner import TvRunner
from movie_runner import MovieRunner
from settings import (MEDIAVIEWER_INFER_SCRAPERS_URL,
SEND_EMAIL,
CELERY_VHOST,
)
from utils import postData, send_email
from celery import Celery
from log import LogFile
log = LogFile(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.