src stringlengths 721 1.04M |
|---|
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import econml.dr as dr
from .utilities import deprecated
@deprecated("The econml.drlearner.DRLearner class has been moved to econml.dr.DRLearner; "
"an upcoming release will remove support for the old name")
cla... |
import sys, subprocess
from time import *
from common import *
from pprint import *
def error(error=''):
print 'Error:',error
sys.exit(1)
def parse_csv(what):
if what.count(',') == 0:
return list([what])
return val.split(',')
a = sys.argv
var = {'-s' : 'btc'}
d = {}
for i in range(a.__len__()):
... |
#
#
import gym
from NeuralQLearner import *
#
#
if __name__ == "__main__":
# ----------------------------------------
# Define parameters for greedy policy
epsilon = 0.5 # exploration
epsilon_floor = 0.1
exploration_decay = 0.998
# Define parameters for Q-learning
alpha = 0.2
gamma = 0... |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import
import inspect
from cStringIO import StringIO
import types
import ROOT
from .. import log; log = log[__name__]
from .treetypes import Column
from .treebuffer import TreeBuffer... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2015 daite
# 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 limi... |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.utils.translation import ugettext
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.dec... |
#start building up structure for the web page
from flask import Flask
from flask import session,request,render_template, url_for, redirect
#from Populator import populate_database
#import search
#from Populator import populate_database
from userdb import *
from initcoldb import *
from Populator import populate_database... |
from Gaudi.Configuration import *
from Configurables import DaVinci
from Configurables import GaudiSequencer
simulation=False
stream='Bhadron'
line='StrippingB2XEtaLb2pKeta3piLine'
from Configurables import DecayTreeTuple
from DecayTreeTuple.Configuration import *
tuple=DecayTreeTuple()
tuple.Decay="[Lambda_b0 -> ^p... |
"""Provides a class that represents an iTerm2 tab."""
import enum
import iterm2.api_pb2
import iterm2.app
import iterm2.capabilities
import iterm2.rpc
import iterm2.session
import iterm2
import json
import typing
class NavigationDirection(enum.Enum):
"""Cardinal directions."""
LEFT = "left"
RIGHT = "right... |
# Copyright 2019 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>
# Copyright 2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
import io
import logging
import tempfile
from datetime import datetime
from odoo import api, f... |
# 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, os, json
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.permissions import add_permission
f... |
import posixpath # instead of os.path, to always use forward slashes
import os
import re
# TODOs:
# (more TODOs in code)
standardTypes = {
"bool",
"char",
"short",
"int",
"long",
"long long",
"unsigned char",
"unsigned short",
"unsigned int",
"unsigned long",
"unsigned lon... |
# Copyright 2018 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.
"""Blink feature-policy presubmit script.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit AP... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016,小忆机器人
All rights reserved.
摘 要:绘本语义
创 建 者:余菲
创建日期:17/2/10
"""
from nlu.rule import Rule
from nlu.media.common import *
from utils.utils import attach_perperty
class PictureBook(object):
"""
绘本语义
"""
# 标识是mode领域
serv... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#statisticalArbitrageMultiple.py
import baseMultiple
import numpy, copy, csv
class CStatisticalArbitrageMultiple(baseMultiple.CBaseMultiple):
#------------------------------
#继承重载函数
#------------------------------
#自定义初始化函数
def customInit(self):
self.name = "statistical... |
import numpy as np
def Initial_diag(dim):
conv=np.diag(np.random.rand(dim))
return conv
def Convergence(matrix):
delta=(np.abs(matrix).max(axis=0)).max(axis=0)
return delta
def Train(trainingset,label):
(imagenum,dim)=trainingset.shape
#Each column vector stands for a image.
dataset=np.transpose(trainingset)
... |
import datetime
from scrapy.selector import Selector
from .base import BaseSpider as Spider
from manga.items import MangaItem, MangaChapterItem
from utils import extract_link
class AnimeA(Spider):
name = "animea"
allowed_domains = ["animea.net"]
start_urls = [
"http://manga.animea.net/series_old... |
# -*- coding: utf-8 -*-
#
# GridCompute documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 8 19:36:13 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... |
# coding: utf-8
# pylint: disable=wildcard-import, arguments-differ
r"""Module for pre-defined neural network models.
This module contains definitions for the following model architectures:
- `AlexNet`_
- `DenseNet`_
- `Inception V3`_
- `ResNet V1`_
- `ResNet V2`_
- `SqueezeNet`_
- `VGG`_
You can construct a mod... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011-2012 Daniel (Avanzosc) <http://www.avanzosc.com>
# 28/03/2012
#
# This program is free software: you can redistribute it and/or modify
# ... |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http://... |
__author__ = 'sushil'
from sys import path
path.append("src/main/python")
# from mockito import mock, verify
import unittest
import numbers
import requests
import time
import zmq
from pprint import pprint
from hydra.lib.hydrabase import HydraBase
'''
tests :
-Check connectivity to mesos
-check connectivity to mara... |
import datajoint as dj
from datajoint.jobs import key_hash
import numpy as np
from commons import lab
import os
from . import experiment, notify
from .utils import h5
from .exceptions import PipelineException
schema = dj.schema('pipeline_treadmill', locals())
@schema
class Sync(dj.Computed):
definition = """ #... |
from espressomd import System, shapes, electrokinetics
import sys
system = System(box_l = [10, 10, 10])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
system.cell_system.skin = 0.4
system.time_step = 0.1
ek = electrokinetics.Electrokinetics(
lb_density=1, frict... |
#!/usr/bin/python
#coding: utf-8
from Common import *
from DiarioTools.Parser import *
from DiarioTools.Process import *
from DiarioTools.Search import *
import re
wordsOfInterest = ["Prodam",
"Pro-dam",
"EMPRESA DE TECNOLOGIA DA INFORMAÇÃO E COMUNICAÇÃO",
"Emp. Tec. da Informação e Comunicação",
... |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... |
from djangorestframework_camel_case.render import CamelCaseJSONRenderer
from rest_framework.permissions import AllowAny
from wagtail.api.v2.endpoints import PagesAPIEndpoint as WagtailPagesAPIEndpoint
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.images.api.v2.endpoints import ImagesAPIEndpoint
from w... |
import tornado.ioloop
import tornado.web
import tornado.httpserver
from tornado.options import define, options, parse_command_line
import os.path
from broadcast_api import load_schedule
import argparse
import config.settings
define('port',default=4000,help='run the server on the given port',type=int)
#define('log_fil... |
# -*- coding: utf-8 -*-
"""Analysis plugin to look up files in Viper and tag events."""
from plaso.analysis import hash_tagging
from plaso.analysis import logger
from plaso.analysis import manager
from plaso.containers import events
from plaso.lib import errors
class ViperAnalyzer(hash_tagging.HTTPHashAnalyzer):
"... |
"""
tl_mono_to_color_enums.py
"""
from enum import IntEnum
class _CTypesEnum(IntEnum):
@classmethod
def from_param(cls, obj):
return int(obj)
class COLOR_SPACE(_CTypesEnum):
"""
A color space describes how the colors in an image are going to be specified. Some commonly used color spaces are... |
# Copyright (C) 2008 Erik Hetzner
# This file is part of Spydaap. Spydaap 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.
# Spydaap i... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Smart Solution bvba
# Copyright (C) 2010-Today Smart Solution BVBA (<http://www.smartsolution.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... |
from django.db import models
from fields import MACAddressField
class Building(models.Model):
number = models.CharField(max_length=6)
name = models.CharField(max_length=50,blank=True)
def __unicode__(self):
return self.name if self.name else "Building " + self.number
class AP(models.Model):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Joshua Santos
Author: Joshua Santos <nerdsville@nerdsville.net>
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2, o... |
#!/usr/bin/env python
import sys
import socket
import fcntl
import struct
import array
from time import sleep
import subprocess
import shlex
from qpid.messaging import *
#global vars
broker_local = "localhost:5672"
addr_control = "agie_inbound/agie_inbound_control"
def pinger(iadr):
# This pings the local interface
... |
import unittest
import StringIO
from time import time
from packetsexample import PacketsExample
from prers import QueriesPerSecond
class TestQueriesPerSecond(unittest.TestCase):
def reinit(self):
self.__stringbuffer1 = StringIO.StringIO()
self.__stringbuffer2 = StringIO.StringIO()
self._... |
import string
import re
import json
import six
from django.utils.encoding import force_text
from django.core.serializers.json import DjangoJSONEncoder
try:
from django.utils.functional import keep_lazy # Django-1.8 doesn't have it.
except ImportError:
# allow_lazy has been deprecated at Django-1.10, will be r... |
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt import QtGui as Qt4Gui
class OutputWindow(QtGui.QPlainTextEdit):
def __init__(self, parent=None):
"""
Initialize default settings.
"""
QtGui.QPlainTextEdit.__init__(self, parent)
self.setTabStopWidth(4 * se... |
from setuptools import setup
setup(
name='fqdn',
packages=['fqdn'],
version='1.1.0',
description=('Validate fully-qualified domain names compliant '
'to RFC 1035 and the preferred form in RFC 3686 s. 2.'),
author='Guy Hughes',
author_email='0x6768@gmail.com',
url='https://gi... |
from google.appengine.ext import ndb
import datetime
import json
import pytz
import re
from consts.district_type import DistrictType
from consts.event_type import EventType
class Event(ndb.Model):
"""
Events represent FIRST Robotics Competition events, both official and unofficial.
key_name is like '2010... |
from core.query import plasma
from lookup import files as lookup_files
from structs.highlight_list import *
from structs.plasma import *
def all(base, nests, plasmas, spots, external):
unused_list = unused(plasmas, spots)
missing_list = missing(plasmas, spots)
incorrect_list = incorrect(base, nests, plasm... |
# -*- coding: utf-8 -*
import base64
import collections
import json
import unittest
from datetime import date, datetime
from decimal import Decimal
# non-standard import name for gettext_lazy, to prevent strings from being picked up for translation
from django import forms
from django.core.exceptions import Validatio... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy import sparse
from pygsp import utils
from . import Graph # prevent circular import in Python < 3.5
class RandomRing(Graph):
r"""Ring graph with randomly sampled vertices.
Parameters
----------
N : int
Number of vertices.
angles : a... |
# -*- coding: utf-8 -*-
#
# dinnertime documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 19 10:27:46 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
"""
OAuth dance session
"""
from google.appengine.ext import ndb
from ferris.core.ndb import Model
from credentials_property import CredentialsProperty
from ndb_storage import NdbStorage
import hashlib
class UserCredentials(Model):
user = ndb.UserProperty(indexed=True)
scopes = ndb.StringProperty(repeated=T... |
# MIT License
#
# Copyright (c) 2017 Matt Boyer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... |
import unittest
import tempfile
from tempfile import NamedTemporaryFile
from ZODB import DB, config
from ZODB.FileStorage import FileStorage
from db import Graph, Element, Edge, Node
from backends import DictionaryBackend, ZODBBTreeBackend
class TestGraph(unittest.TestCase):
def setUp(self):
self.g = G... |
#!/usr/bin/env python3
# hafwl2l3prov.py
from resources import getUPA
from resources import getHAdevices
from resources import showSummaryHA
from resources import getVLAN
from resources import getIpsVLAN
from resources import getDepth
from resources import getIPSDepth
from resources import getSubnets
from r... |
# -*- coding: utf-8 -*-
import unittest
from guildwars2api.v2 import GuildWars2API
class URLBuildTestCase(unittest.TestCase):
def setUp(self):
self.api = GuildWars2API()
def test_all_items_url(self):
self.assertEqual(self.api.items.build_url(), 'https://api.guildwars2.com/v2/items')
def... |
"""CILogon OAuthAuthenticator for JupyterHub
Uses OAuth 2.0 with cilogon.org (override with CILOGON_HOST)
Caveats:
- For user whitelist/admin purposes, username will be the ePPN by default.
This is typically an email address and may not work as a Unix userid.
Normalization may be required to turn the JupyterHub ... |
# 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 use ... |
#
# PyCLIgen module
#
# Copyright (C) 2014-2015 Benny Holmgren
#
# This file is part of PyCLIgen.
#
# PyPyCLIgen 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 ... |
from ase.structure import bulk
from sys import argv
from ase.dft.kpoints import ibz_points, get_bandpath
from gpaw import *
from ase import *
from gpaw.test import gen
from gpaw import setup_paths
import os
"""This calculation has the following structure.
1) Calculate the ground state of Diamond.
2) Calculate the ban... |
# Leauge of Legends Statistics Chat Bot
# A chat bot written in Python that provides match statistics right to your Twitch chat.
# 2015 Benjamin Chu - https://github.com/blenderben
import socket # imports module allowing connection to IRC
import threading # imports module allowing timing functions
import requests # im... |
import abc
from collections import namedtuple
Op = namedtuple('Op', ['function', 'cycles', 'description'])
class ClockListener(metaclass=abc.ABCMeta):
@abc.abstractmethod
def notify(self, clock: int, cycles: int):
"""Notify the listener that the clock has advanced.
:param clock: The new valu... |
from __future__ import print_function
import logging # debug < info < warn < error < critical # from https://docs.python.org/3/howto/logging-cookbook.html
import traceback
import theano
import theano.tensor as T
from tqdm import tqdm
logger_combinedtools = logging.getLogger('combined.tools')
logger_combinedtools.s... |
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils import timezone
# apps internas y externas
from datospersonalesapp.models import Paciente
from empleadosapp.models import Empleado, Doctor
ESTADO_ELECCIONES = (
('N','Normal'),
('C','Cancelado'),
('R','... |
#!/usr/bin/env python
# coding: utf-8
from PyQt4 import QtCore, QtGui, QtOpenGL
from OpenGL import GL
from src.util.qt_util import Color
class GLWidget(QtOpenGL.QGLWidget):
"""
OpenGLを用いた3D描画を行うQtウィジェットクラス
"""
class GLLight(object):
def __init__(self, type, position, diffuse):
se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#... |
"""
Recursions are the recipe of |jedi| to conquer Python code. However, someone
must stop recursions going mad. Some settings are here to make |jedi| stop at
the right time. You can read more about them :ref:`here <settings-recursion>`.
Next to :mod:`jedi.evaluate.cache` this module also makes |jedi| not
thread-safe.... |
# Nix
# Copyright (c) 2017 Mark Biciunas.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distrib... |
from smtplib import SMTP, SMTP_SSL
from smtplib import SMTPException
from mimetypes import guess_type
from os.path import basename
from email.utils import COMMASPACE
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.encoders import encode... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#-*- coding: utf-8 -*-
'''
Created on 2016. 11. 19
Updated on 2016. 01. 09
'''
from __future__ import print_function
import os
import re
from utils import PrettyStringBuilder
from utils import Progress
import javalang
class Resource(object):
Stopwords = None
EngDictionary = None
@staticmethod
d... |
from pytest import fixture
import vcr
from uwaterloodriver import UW_Driver
@fixture
def list_keys():
# Responsible for only returning the test data
return ['current_term', 'previous_term', 'next_term', 'listings']
@fixture
def courses_keys():
return ['units', 'catalog_number', 'subject', 'title']
@fixtu... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already se... |
"""
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.
Example 1:
Input: "aba"
Output: True
Example 2:
Input: "abca"
Output: True
Explanation: You could delete the character 'c'.
Note:
The string will only contain lowercase characters a-z. The maximum length o... |
#!/usr/bin/env python3
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
... |
# 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
# d... |
import sys,os
import urllib.request, urllib.parse, urllib.error,glob
import astropy.io.fits as fits
import zipfile
import shutil
def listdirectory(path):
fichier=[]
l = glob.glob(path+'\\*')
for i in l:
if os.path.isdir(i): fichier.extend(listdirectory(i))
else: fichier.append(i) ... |
# -*- coding: utf-8 -*-
import datetime
import requests
from django.contrib.auth import get_user_model
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.core.mail import send_mail
from django.template.loader import get_template
from django.temp... |
#!/usr/bin/python
"""
Create the database and the user/role, associate it in case,
the database does not exists.
"""
import sys
import time
import psycopg2
from pyramid.paster import get_appsettings, setup_logging, _getpathsec
from urllib.parse import urlparse
config_uri = sys.argv[1]
setup_logging(config_uri)
set... |
'''
Created on 05/09/2017
@author: chernomirdinmacuvele
'''
from ui_AmostEspeEspecie import Ui_frmAmostEspeEspecieAmost
import GenericAmostrasQDialog
class dialog_AmostEspecificaEspe(GenericAmostrasQDialog.CustomForm_Amostras, Ui_frmAmostEspeEspecieAmost):
def __init__(self, parent=None, TblName=None, dbcon=None... |
#!/usr/bin/env python
import numpy as np
import numba
import zstandard as zstd # pip install zstandard
# ================================================================ Funcs
def nbits_cost(diffs, signed=True):
"""
>>> [nbits_cost(i) for i in [0, 1, 2, 3, 4, 5, 7, 8, 9]]
[0, 2, 3, 3, 4, 4, 4, 5, 5]
... |
from django.contrib.auth.models import User
from api.models import Build, Metric, Smell
from rest_framework import routers, serializers, viewsets, decorators, response
from api.permissions import IsSelfOrSuperUser
from api.serializers import BuildSerializer, MetricSerializer, SmellSerializer
from rest_framework.permiss... |
"""
BSD 3-Clause License
Copyright (c) 2017, Mairie de Paris
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of cond... |
# obfsproxy logging code
import logging
import sys
# XXX Add Formatter!!!
our_logger = logging.getLogger('our_logger')
default_handler = logging.StreamHandler(sys.stdout)
our_logger.addHandler(default_handler)
our_logger.propagate = False
def set_log_file(filename):
"""Set up our logger so that it starts loggin... |
import superdesk
import traceback
from superdesk import get_resource_service
from .resource import Resource
from .services import BaseService
import logging
logger = logging.getLogger(__name__)
def init_app(app):
endpoint_name = "sequences"
service = SequencesService(endpoint_name, backend=superdesk.get_bac... |
# -*- coding: utf-8 -*-
#
# Qtile documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 11 15:20:21 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
#Boss Ogg - A Music Server
#(c)2003 by Ted Kulp (wishy@comcast.net)
#This project's homepage is: http://bossogg.wishy.org
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the L... |
# Copyright 2017 Google 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 required by applicable law or agreed to in wri... |
"""
Non-generic moderation cog.
"""
import asyncio
import collections
import random
import discord
from discord.ext import commands
from joku.cogs._common import Cog
from joku.core import checks
from joku.core.bot import Context
from joku.core.checks import mod_command, bot_has_permissions
from joku.core.utils import... |
#!/usr/bin/env python
# this code was inspired by this tutorial by Adrian Rosebrock:
# http://www.pyimagesearch.com/2015/06/01/home-surveillance-and-motion-detection-with-the-raspberry-pi-python-and-opencv/
import time, datetime, json, cv2, warnings
import RPi.GPIO as GPIO
from argparse import ArgumentParser
from imu... |
import pygame
import sys
from Menu.MenuItem import *
white = (255, 255, 255)
black = (0, 0, 0)
grey = (195, 195, 195)
pink = (242, 217, 229)
green = (210, 255, 191)
# TODO: More robust menu system. Different menus with different menu items. Maybe have button action here.
main_menu = [MenuItem("New Game", True), Menu... |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models
class partner... |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
import glob
import os
import stdeb.util as util
from distutils.core import Command
__all__ = ['install_deb']
class install_deb(Command):
description = 'distutils command to install debian binary package'
user_options = []
boolean_options = []
def initialize_options(self):
pass
def fin... |
#!/usr/bin/env python
#coding:utf-8
# Author : tuxpy
# Email : q8886888@qq.com.com
# Last modified : 2015-03-30 18:06:49
# Filename : log.py
# Description :
from __future__ import unicode_literals
import logging
import re
access_log = logging.getLogger('access_log')
gen_log = logging.getLogger('... |
# inspired by some code by Nathan Denny (1999)
# see http://www.ece.arizona.edu/~denny/python_nest/graph_lib_1.0.1.html
try:
# use reduce against BDFL's will even on python > 2.6
from functools import reduce
except ImportError:
pass
class GraphException(Exception):
"""Base class for exception in the g... |
##\package base
# \brief The base class for a core plugin.
#
# Core plugins are plugins that do not check parameters to keep the machine alive.
# They just execute some code to get a wanted behaviour.
#
# \author Philip Luyckx
# \copyright GNU Public License
# This file is part of Keep Alive Monitor (kam).
#
# Keep Al... |
from insights.core.context import (ExecutionContextMeta, HostArchiveContext,
SerializedArchiveContext, SosArchiveContext)
def test_host_archive_context():
files = ["/foo/junk", "/insights_commands"]
actual = HostArchiveContext.handles(files)
assert actual == ("/", HostAr... |
import logging
from catmaid import history
from django.apps import AppConfig
from django.conf import settings
from django.core.checks import Warning, register
from django.core.exceptions import ImproperlyConfigured
from django.db import connection
from django.db.utils import ProgrammingError
from django.db.models imp... |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
from aaf2.mobid import MobID
from uuid import UUID
from aaf2.auid import AUID
import uuid
import unittest
class MobIDTests(unittest.TestCase):
def test_mob_id(self):
m = MobID.new()
material... |
#
# Cassandra Cluster Management lib
#
from __future__ import absolute_import
import copy
import fnmatch
import logging
import os
import platform
import re
import shutil
import signal
import socket
import stat
import subprocess
import sys
import time
from distutils.version import LooseVersion #pylint: disable=import... |
# Copyright (c) 2015 "Hugo Herter http://hugoherter.com"
#
# This file is part of Billabong.
#
# Intercom 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, or (at your o... |
#!/usr/bin/python3 -tt
# -*- coding: utf-8 -*-
import re
from threading import Lock
from requests import Session, HTTPError
from time import time
from xml.etree.ElementTree import XML, ParseError
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.packages.urllib3 import disable_war... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import logging
from datetime import datetime
from PySide2 import QtGui, QtCore, QtWidgets
import requests
import json
# Python3 compatibility
if os.getenv("PINGUINO_PYTHON") is "3":
#Python3
#from urllib.request import urlopen
#from urllib.parse impo... |
#!/usr/bin/env python
import logging
import optparse
import traceback
import unittest
import sys
import utils
import framework
from queryservice_tests import cache_tests
from queryservice_tests import nocache_tests
from queryservice_tests import stream_tests
from queryservice_tests import status_tests
from queryserv... |
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2015 Robin Schneider <ypid@riseup.net>
#
# SPDX-License-Identifier: AGPL-3.0-only
"""
Telnet login script.
"""
__version__ = '0.5'
# modules {{{
# std {{{
import re
import logging
# }}}
from lxml import etree
# }}}
class CdCatDatabase:
_RE_RSYNC = re.compile(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.