src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Image, ImageDraw, ImageChops, ImageOps, ImageFilter
import pygame.display, pygame.image
import random
import sys
from math import ceil
percentWater = .70
mapSize = 600 #in pixels
maxSize = 1.40 # 1 to 5 How big should the slices be cut, smaller slices create more is... |
"""
WSGI config for Creamas 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`` ... |
from django import forms
from stocks.models import *
from django.forms.models import modelformset_factory, inlineformset_factory, BaseInlineFormSet
from django.forms.formsets import formset_factory, BaseFormSet
import re
import datetime
class DonorForm(forms.ModelForm):
class Meta:
model = Donor
c... |
from epidemic_emulator import node
from datetime import datetime
import platform
import argparse
import time
import os
import matplotlib.pyplot as plt
import random
def parse_network(f, node_id, topology = "clique"):
neighbors = []
nd = None
t = datetime.now()
t = t-t
net = []
index = -1
... |
try:
from pdae_cython import *
except ImportError:
from pdae_python import *
import unittest
import time
import os
try:
import cStringIO as StringIO
except ImportError:
import StringIO
CURDIR = os.path.abspath(os.path.dirname(__file__))
class PM_OP:
INDEX_UPDATE = 1
TRIANGLE_ADDITION = 2
... |
#!/usr/bin/python
# coding=utf-8
"""Pokéstop API"""
import sys
import argparse
import json
from pokestop import Pokestop
from flask import Flask, jsonify
from flask_restful import Api, reqparse, Resource
#----------------------------------------------------------------#
# Constants
HOSTNAME = '0.0.0.0'
PORT ... |
from django.template.defaultfilters import register
from django.utils.safestring import mark_safe
from django.conf import settings
from nvd3.NVD3Chart import NVD3Chart
from nvd3 import lineWithFocusChart, lineChart, \
multiBarChart, pieChart, stackedAreaChart, \
multiBarHorizontalChart, linePlusBarChart, \
... |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
# This file is part of Merlin.
# Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Based on https://github.com/pypa/sampleproject/blob/master/setup.py."""
from __future__ import unicode_literals
# To use a consistent encoding
import codecs
import os
from setuptools import setup, find_packages
import sys
# Shortcut for building/publishing to Pypi
if sy... |
from decimal import *
from operator import attrgetter
from storage.models import Collection
from storage.report_funding import ReportRow, FundingReportRow, \
FundingReportForCollection, AbstractFundingReportBase
class Bunch(list):
"""
http://code.activestate.com/recipes/52308-the-simple-but-handy-collect... |
#!/usr/bin/python3
import sock
import translator
import sys
import html
import json
from time import time
from nltk import sent_tokenize
from constraints import getPolitenessConstraints as getCnstrs
from log import log
# IP and port for the server
MY_IP = '172.17.66.215'
MY_PORT = 12346
supportedStyles = { 'fml'... |
# If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.
# {20,48,52}, {24,45,51}, {30,40,50}
# For which value of p 1000, is the number of solutions maximised?
# p = 120
# sols = 0
# for a in range(1, p//2):
# for b in range... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import random
import re
from odoo import api, fields, models, modules, _
class ImLivechatChannel(models.Model):
""" Livechat Channel
Define a communication channel, which can be accessed with ... |
# 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... |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
# Copyright (C) Zing contributors.
#
# This file is a part of the Zing project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pyte... |
from __future__ import print_function
from threading import Thread
from json import loads
from enigma import ePoint
from Screens.ChoiceBox import ChoiceBox
from Screens.Screen import Screen
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Components.config import config, ConfigText, getConfigListEntry
from Co... |
#!/usr/bin/env python
import numpy as np,plot,auger
import scipy.stats
from numpy import sqrt
#OPT: quickly get sorted rundirs
# zb autogen | sort -k1.13 -r
#OPT: fix seed
#np.random.seed(65983247)
#we dont know what the added or reduced noise level is when changing energy windows, so we cant compare performance for... |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... |
# dirtool.py - diff tool for directories
# Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
r"""
The base class for QuickRelease steps, along with error reporting classes,
custom subclasses of steps, and classes to run the individual parts of the
steps.
L{Step}s are usually searched for in the C{quickrelease/steps} di... |
"""Support for Sytadin Traffic, French Traffic Supervision."""
import logging
import re
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
LENGTH_... |
from django.shortcuts import render
from content.models import Picture
from django.middleware.csrf import get_token
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist
def blog_list(request):
if not request.user.is... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class Flang(CMakePackage, CudaPackage):
"""Flang is a Fortran compiler targeting LLVM... |
#!/usr/bin/env python
# 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.
"""Seek performance testing for <video>.
Calculates the short and long seek times for different video formats on
different network... |
import pytest
import os
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from .. import run_nbgrader
from .conftest import... |
#!/usr/bin/env python
"""
This module provides a tool for handling computer experiments with
of a set of input parameters, where each input parameter
is varied in a prescribed fashion.
In short, the parameters are held in a dictionary where the keys are
the names of the parameters and the values are the numerical, str... |
from .core import ( # noqa
AssetID,
AssetIDPlusDay,
EPOCH,
ExplodingObject,
FakeDataPortal,
FetcherDataPortal,
MockDailyBarReader,
OpenPrice,
add_security_data,
all_pairs_matching_predicate,
all_subindices,
assert_single_position,
assert_timestamp_equal,
check_al... |
"""This module contains the general information for StorageLocalDiskEp ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class StorageLocalDiskEpConsts:
pass
class StorageLocalDiskEp(ManagedObject):
"""This is StorageLo... |
# object tracking algorithm with trajectory points plotting on
# video stream window
# after taking 20 points it stores them in txt files
from naoqi import ALProxy, ALBroker, ALModule
import time
from vision_definitions import kVGA, kBGRColorSpace
import cv2 as opencv
import numpy as np
import random
from ghmm import ... |
import numpy as SP
import subprocess, sys, os.path
from itertools import *
from fastlmm.pyplink.snpset import *
from fastlmm.pyplink.altset_list import *
import pandas as pd
import fastlmm.util.preprocess as util
import logging
WRAPPED_PLINK_PARSER_PRESENT = None
def decide_once_on_plink_reader():
#This is now do... |
#
# blocklist/webui.py
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
# Deluge is free software.
#
# You may 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 la... |
#!/usr/bin/env python3
"""
Shell Manager -- Tools for deploying and packaging problems.
"""
import logging, coloredlogs
import shell_manager
import json
from argparse import ArgumentParser
from shell_manager.package import problem_builder
from shell_manager.bundle import bundle_problems
from shell_manager.problem im... |
#!/usr/bin/env python
"""\file hw_thread.py
hardware thread class
\author Markus Happe <markus.happe@upb.de>
\date 30.07.2009
"""
#
# This file is part of the ReconOS project <http://www.reconos.de>.
# University of Paderborn, Computer Engineering Group.
#
# (C) Copyright University of Paderborn 2009. Per... |
# 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... |
# Author: Dustyn Gibson <miigotu@gmail.com>
# URL: https://github.com/SiCKRAGETV/SickRage
#
# This file is part of SickRage.
#
# SickRage 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... |
# 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, either version 3 of the ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under th... |
## system-config-printer
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
## Authors:
## Florian Festi <ffesti@redhat.com>
## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public... |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... |
from registrasion.controllers.cart import CartController
from registrasion.controllers.credit_note import CreditNoteController
from registrasion.controllers.invoice import InvoiceController
from registrasion.models import commerce
from django.core.exceptions import ObjectDoesNotExist
class TestingCartController(Cart... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://launchpad.net/wxbanker
# testbase.py: Copyright 2007-2010 Mike Rooney <mrooney@ubuntu.com>
#
# This file is part of wxBanker.
#
# wxBanker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License... |
#!/usr/bin/env python
# coding: utf-8
from cron.PictureDay import *
from WXMessage import *
class WXMessageBuilder:
def to_text(self, msgs, to_user, from_user, create_time):
xml_string = u"<xml>\n" \
"<ToUserName><![CDATA[{}]]></ToUserName>\n" \
"<... |
# 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 (t... |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2000-2009 Bastian Kleineidam
"""
Group filter rules into folders.
"""
from ... import fileutil, configuration
from . import Rule
def recalc_up_down(rules):
"""
Add .up and .down attributes to rules, used for display up/down
arrows in GUIs
"""
upper = le... |
#encoding: utf-8
import json
import gconf
import MySQLdb
from dbutils import execute_fetch_sql
from dbutils import execute_commit_sql
'''
获取用户信息
'''
def get_users():
_columns = ('id','username','password','age')
_sql = 'select * from user'
_count,_rt_list = execute_fetch_sql(_sql)
_rt = []
for _l... |
import unittest
from unittest.mock import Mock
from aquarius.Aquarius import Aquarius
from aquarius.Harvester import Harvester
from aquarius.Interactor import Interactor
from aquarius.InteractorFactory import InteractorFactory
from aquarius.interactors.AddBookInteractor import AddBookInteractor
from aquarius.interacto... |
"""Retry backoff strategies."""
import random
import time
from typing import Union
__all__ = ['ExponentialBackoff']
class ExponentialBackoff:
"""An implementation of the exponential backoff strategy.
This is useful for getting an exponentially backed-off delay for
reconnection or retry actions.
Ea... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2007 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Contribution 2009 by Brad Crittenden <brad [AT] bradcrittenden.net>
# Copyright (C) 2008 Benny Malengier
# Copyright (C) 2010 Jakim Friant
#
# This program is free... |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... |
# 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... |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from common import public
class zyktgg():
"""开庭公告"""
need_check_ziduan = ['main',
'city',
'bbd_dotime',
'title'
]
def check_... |
# -*- coding: utf-8 -*-
# Scrapy settings for activesport project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/la... |
from ..remote import RemoteModel
class ChangedPortNetExplorerInvSummaryGridRemote(RemoteModel):
"""
| ``DeviceIPDotted:`` none
| ``attribute type:`` string
| ``DeviceIPNumeric:`` none
| ``attribute type:`` string
| ``VirtualNetworkID:`` none
| ``attribute type:`` string
| ... |
# -*- coding: utf-8 -*-
"""
werkzeug.security
~~~~~~~~~~~~~~~~~
Security related helpers such as secure password hashing tools.
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import hmac
import string
fr... |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch 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 applicab... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... |
import sys as _sys
if len(_sys.argv) != 2:
print("Incorrect number of arguments")
exit(-1)
elif ["c", "h", "asm"].index(_sys.argv[1]) == -1:
print("Invalid filetype %s" % _sys.argv[1])
exit(-1)
print("\t\033[32;1mGenerating\033[0m include/gen/syscall_gen.%s" % _sys.argv[1])
syscall_list = []
def sys... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
# Copyright 2015 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... |
import itertools
import time
from math import floor
from level import FakeChunk, MCLevel
import logging
from materials import pocketMaterials
import os
from mclevelbase import ChunkNotPresent, ChunkMalformed
import nbt
import numpy
import struct
from infiniteworld import ChunkedLevelMixin, SessionLockLost, AnvilChunk... |
"""Mapping a vertical table as a dictionary.
This example illustrates accessing and modifying a "vertical" (or
"properties", or pivoted) table via a dict-like interface. These are tables
that store free-form object properties as rows instead of columns. For
example, instead of::
# A regular ("horizontal") table h... |
"""
Turtle RDF graph serializer for RDFLib.
See <http://www.w3.org/TeamSubmission/turtle/> for syntax specification.
"""
from collections import defaultdict
from rdflib.term import BNode, Literal, URIRef
from rdflib.exceptions import Error
from rdflib.serializer import Serializer
from rdflib.namespace import RDF, RDF... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ... |
# Copyright (c) 2012 Midokura Japan K.K.
#
# 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... |
import scipy.io
from sklearn.metrics import accuracy_score
from sklearn import cross_validation
from sklearn import svm
from skfeature.function.statistical_based import chi_square
def main():
# load data
mat = scipy.io.loadmat('../data/BASEHOCK.mat')
X = mat['X'] # data
X = X.astype(floa... |
from decimal import Decimal
from django.db.models import Q, Count
from django.utils.encoding import smart_unicode
from restlib2.http import codes
from restlib2.params import Parametizer, StrParam, BoolParam, IntParam
from modeltree.tree import MODELTREE_DEFAULT_ALIAS, trees
from avocado.events import usage
from avocado... |
"""
Project Euler Problem 8
=======================
Find the greatest product of thirteen consecutive digits in the 1000-digit
number.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
858615607891129494954595017379583319528532088... |
"""
Django settings for webodm project.
Generated by 'django-admin startproject' using Django 1.10.
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, s... |
"""
Component to interface with various media players.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/media_player/
"""
import logging
import os
import voluptuous as vol
from homeassistant.components import discovery
from homeassistant.config import l... |
'''
This code will put a video on a colored object (like a green ball)in the main
video stream. It will resize the overlay video on the fly
based on big the tracked object is. The code will not work without
the file: hist_for_tracking.png
that is the 'color calibration' image. The program does allow you
to calibrate... |
from DataAPI import *
import numpy
import math
import Evaluation
class UserProfile:
def __init__(self, user):
self.user = user
self.relevant_vector = [0 for x in range(19)]
self.irrelevant_vector = [0 for x in range(19)]
# Calculate the relevant and irrelevant genres for the user.
... |
import re
import datetime
import math
from collections import namedtuple
Location = namedtuple('Location', ['ts', 'date', 'lat', 'lon', 'accuracy', 'speed'])
def convertStrFloat(s):
return float(s.replace(',', '.'))
def formatTimezone(timezone):
if timezone == 0:
strTimezone = "GMT"
else:
if timezone > 0:
... |
#
# Copyright (c) 2017-2020 by QA Cafe.
# All Rights Reserved.
#
"""Module for accessing CDRouter Jobs."""
import collections
from marshmallow import Schema, fields, post_load
from .cdr_datetime import DateTime
class Options(object):
"""Model for CDRouter Job Options.
:param tags: (optional) Tags as string... |
# Copyright 2021 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, ... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
#!/usr/bin/env python
# Copyright Greg Hogan, 2012. Last modified 2016.
#
# 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 versio... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... |
# -*- coding: utf-8 -*-
# Copyright 2016-2019 Juca Crispim <juca@poraodojuca.net>
# This file is part of toxicbuild.
# toxicbuild 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 t... |
#!/usr/bin/python
# l.basicConfig?
# l.Formatter?
# man date or time.strftime()
# subprocess:https://docs.python.org/2/library/subprocess.html
# crontab or scheduler
# shelx
# handlers: https://docs.python.org/2/howto/logging.html#useful-handlers
# lh.SysLogHandler?
import logging
from logging.handlers import SysLogHa... |
from django.contrib.auth.models import User
from django.http import HttpRequest
from tastefulpy.bundle import Bundle
from tastefulpy.fields import ToOneField, ToManyField
from tastefulpy.resources import ModelResource
from basic.api.resources import SlugBasedNoteResource
from basic.models import Note, AnnotatedNote, Sl... |
import Queue
import threading
sqlSubmitQueue = Queue.Queue() #SQLITE3 is so thread-unsafe that they won't even let you call it from different threads using your own locks. SQL objects can only be called from one thread.
sqlReturnQueue = Queue.Queue()
sqlLock = threading.Lock()
def sqlQuery(sqlStatement, *args):
s... |
"""Support for fans through the SmartThings cloud API."""
import math
from typing import Optional, Sequence
from pysmartthings import Capability
from homeassistant.components.fan import SUPPORT_SET_SPEED, FanEntity
from homeassistant.util.percentage import (
int_states_in_range,
percentage_to_ranged_value,
... |
import subprocess
import time
import optparse
import os.path
import traceback
from django.conf import settings
from django.core import management
from django.core import serializers
from django.core.management import base as management_base
from django.core.management import color as management_color
from django.db im... |
from Tkinter import *
from basics import *
NODE_RADIUS = 5
NODE_COLOR = "green"
NODE_PENDING_COLOR = "purple"
CONNECTION_COLOR = "yellow"
PACKETS_SENT_MAX = 100
class NodeError(Exception):
pass
class Node:
def __init__(self, location):
self.location = location
self.connections = []
s... |
"""
Contains functions to retrieve fillable values for
API request jobs.
"""
import datetime
from .. import db, CONFIG
from ..scrape.utils import get_date_before, format_date_for_api_request, PROPER_DATE_FORMAT
QUERY_PARAM_VALUES = {}
def get_possible_query_param_values(query_param, is_daily):
"""
Valid quer... |
import json
import os
import taggit
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.forms import HiddenInput, TextInput
from modeltranslation.forms import TranslationModelF... |
import unittest
from LibvirtQMFTest import *
PROPERTIES = ('uuid', 'name', 'parentVolume', 'state', 'capacity', 'allocation',
'available', 'node')
class PoolTest(unittest.TestCase, LibvirtQMFTest):
@classmethod
def setUpClass(cls):
LibvirtQMFTest.setUpClass()
cls.cleanUp()
@classme... |
import socket
import pytest
from eventlet import wsgi
from mock import patch
from werkzeug.contrib.fixers import ProxyFix
from nameko.exceptions import ConfigurationError
from nameko.web.handlers import HttpRequestHandler, http
from nameko.web.server import (
BaseHTTPServer, HttpOnlyProtocol, WebServer, parse_add... |
#### encoding: cp1255 ####
import urllib2
import re
import logging
logger = logging.getLogger("open-knesset.parse_committee_members")
from knesset.mks.models import Member
from knesset.committees.models import Committee
from django.core.management.base import BaseCommand
class Command(BaseCommand):
args = ''
... |
#!/usr/bin/env python3
"""
Hub management script
"""
import os, shutil, sys, tempfile
join = os.path.join
# Boilerplate to ensure we are in the directory fo this path and make the util module available.
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
sys.path.insert(0, os.path.abspath(os.path.join(SCRIPT_... |
from django.test import TestCase
from django.conf import settings
from restclients.exceptions import DataFailureException
import restclients.trumba.calendar as Calendar
from restclients.trumba.exceptions import TrumbaException, CalendarNotExist, CalendarOwnByDiffAccount, NoDataReturned, UnknownError, UnexpectedError
c... |
import json
import logging
from typing import List
import redis
from django.conf import settings
from redis import RedisError
CHAT_STATE_STORAGE_ENABLED = True
CHAT_ROOM_USERS_REDIS_KEY = "chat-room-users"
CHAT_ROOM_OLD_MESSAGES_KEY = "chat-room-messages"
CHAT_ROOM_MAX_MESSAGES = 50
try:
db = redis.Redis(
... |
#! /usr/bin/env python
import rospy
import actionlib
from actionlib_msgs.msg import GoalStatus
from strands_executive_msgs.msg import ExecutePolicyAction, ExecutePolicyFeedback, ExecutePolicyGoal, MdpStateVar, StringIntPair, StringTriple, MdpAction, MdpActionOutcome, MdpDomainSpec, MdpTask, Task
from strands_executiv... |
#pgn2csv 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.
#You should have received a copy of the GNU General Public License
#along with p... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
# file eulxml/xmlmap/premis.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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... |
# -*- coding: utf-8 -*-
"""
sphinx.errors
~~~~~~~~~~~~~
Contains SphinxError and a few subclasses (in an extra module to avoid
circular import problems).
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
class SphinxError(Exception):... |
from PythonQt.QtCore import QSettings
from PythonQt.QtGui import QDesktopServices
import os, string, base64
try:
from md5 import md5
except ImportError:
from hashlib import md5 #md5 has been moved to hashlib in python 3
from random import randint
from collections import defaultdict
from time import strftime, localtim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.