src stringlengths 721 1.04M |
|---|
from tokenizer import sent_tokenizer, word_tokenizer
import biviewer
import pdb
import re
import progressbar
import collections
import string
from unidecode import unidecode
import codecs
import yaml
from pprint import pprint
import numpy as np
import math
import difflib
import sklearn
from sklearn.feature_extracti... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class City(models.Model):
"""
geocode INT NOT NULL,
forecast_model_id INT,
active BOOL NOT NULL,
"""
geocode = models.IntegerField(
db_column='geocodigo',
null=False,
primary_key=True... |
#!/usr/bin/env python
from signal import SIGTERM
from os import remove, path, kill, getpid, chdir, dup2, fork, setsid, umask
from sqlalchemy.exc import OperationalError
from time import sleep
from datetime import timedelta, datetime
from pytz import timezone
from perception.database.models import OpenvasAdmin,\
Ope... |
# -*- coding: utf-8 -*-
#
# This file is part of PyGaze - the open-source toolbox for eye tracking
#
# PyGaze is a Python module for easily creating gaze contingent experiments
# or other software (as well as non-gaze contingent experiments/software)
# Copyright (C) 2012-2013 Edwin S. Dalmaijer
#
# ... |
# This file is part of OpenHatch.
# Copyright (C) 2010 Parker Phinney
# Copyright (C) 2010 Jack Grigg
# Copyright (C) 2009, 2010 OpenHatch, Inc.
# Copyright (C) 2010 Jessica McKellar
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as... |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright 2008, Frank Scholz <coherence@beebits.net>
# Copyright 2008, James Livingston <doclivingston@gmail.com>
#
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
import rhythmdb, rb
import gobject, gtk
i... |
import decimal
import mock
import unittest2
from wtforms.validators import ValidationError
from forms.custom_validators import DecimalPlaces
from library import testing
class TestDecimalPlaces(testing.TestCase, unittest2.TestCase):
def test_decimal_places(self):
# Mock a form and a field.
form = mock.Moc... |
#!/usr/bin/env python
import numpy as np
import nibabel as nib
# Traits stuff
from traits.api import ( HasTraits, Instance, Array,
Bool, Dict, on_trait_change, Range, Color, Any, Int,
DelegatesTo, CInt, Property, File )
from traitsui.api import View, Item, VGroup, \
HGroup, Group, RangeEditor, ColorEdito... |
"""
Contains information relevant to Instrument object
Classes and Functions
---------------------
"""
import operator
import unidecode
from nordb.core.validationTools import validateFloat
from nordb.core.validationTools import validateInteger
from nordb.core.validationTools import validateString
from nordb.core.val... |
#!/usr/bin/env python
def configuration(parent_package='', top_path=None):
import os.path as op
from numpy.distutils.misc_util import Configuration
from sfepy import Config
site_config = Config()
os_flag = {'posix' : 0, 'windows' : 1}
auto_dir = op.dirname(__file__)
auto_name = op.split(... |
import cv2
img_name = raw_input("Enter the image filename:")
img = cv2.imread(img_name,0)
def menu():
print "Select filter type:"
print "Press '1' for Low Pass filter."
print "Press '2' for High Pass filter."
print "Press '3' for Band Pass filter."
print "Press '4' for Notch filter."
print "Pres... |
import json
from server.models import database, PatientModel, LoginModel
from server.hmsexceptions import UserNotExistException
from server.utils import logger
def register_patient(post_data):
"""
Register a patient in the system. The post data is in json format.
:param post_data: dict
:returns: a st... |
#!/usr/bin/python
# Common functions and builders for VPC Templates
import troposphere as tp
import troposphere.ec2 as ec2
CIDR_ANY = '0.0.0.0/0'
CIDR_NONE = '0.0.0.0/32'
HTTP = 80
HTTPS = 443
SSH = 22
EPHEMERAL = (32767, 65536)
NAT = (1024, 65535)
ANY_PORT = (0, 65535)
TCP = '6'
UDP = '17'
ICMP = '1'
ANY_PROTOCO... |
# 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 ... |
# coding=utf-8
# Copyright 2021 The Edward2 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 applicable law o... |
#!/usr/bin/env python3
import pytest
import zlib
from aiospamc.exceptions import *
from aiospamc.header_values import CompressValue
from aiospamc.incremental_parser import ResponseParser
from aiospamc.responses import Response
def test_init_version():
r = Response(version="4.2", status_code=0, message="EX_OK")... |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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/LIC... |
"""
This module calculates a linear system by Gaussian elimination with pivoting.
Almost a copy of on Mike Zingale's code, spring 2013.
"""
import numpy as npy
def gaussElim(A, b):
""" perform gaussian elimination with pivoting, solving A x = b A
is an NxN matrix, x and b are an N-element vector... |
from office365.sharepoint.web_application.webApplication import WebApplication
from tests import test_site_url
from tests.sharepoint.sharepoint_case import SPTestCase
from office365.sharepoint.lists.list_template_type import ListTemplateType
from office365.sharepoint.sites.site import Site
class TestSite(SPTestCase)... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
from odoo import http, tools
from odoo.addons.website.tools import MockRequest
from odoo.modules.module import get_module_resource
from odoo.tests.common import TransactionCase
class TestQweb(TransactionCase... |
import pytest
import sys
import unittest
from exam import Exam, fixture
from lxml import etree, html
from lxml.cssselect import CSSSelector
from toronado import Rule, Properties, inline, from_string
try:
from lxml.html import soupparser
except ImportError:
soupparser = None
class TestCase(Exam, unittest.Te... |
# Standard Library Imports
from __future__ import division, print_function
from time import time
# External Imports
import numpy as np
from sklearn.decomposition import TruncatedSVD
import matplotlib.pyplot as plt
# %matplotlib inline # use when in JUPYTER NOTEBOOK (or risk hang)
# plt.ion() # allow ipython %run to ... |
# Copyright 2015 Red Hat 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 writing... |
from bs4 import BeautifulSoup
import geopy.distance as dist
import glob
import numpy as np
import gpxpy
def consecutive_arrays(arr):
consec_arr = []
consec = []
for i, arr_val in enumerate(arr):
if len(consec) == 0 or arr_val == consec[-1] + 1:
consec.append(arr_val)
else:
consec_arr.append(consec)
co... |
# coding=utf-8
from sfc_models.objects import *
from sfc_gui.chart_plotter import ChartPlotterWindow2
register_standard_logs('output', __file__)
mod = Model()
# Create first country - Canada. (This model only has one country.)
can = Country(mod, 'Canada', 'CA')
# Create sectors
gov = DoNothingGovernment(can, 'Governme... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2015 be-cloud.be
# Jerome Sonnet <jerome.sonnet@be-cloud.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... |
import imp
from io import StringIO
from pluggdapps.plugin import Plugin, implements
from tayra import BaseTTLPlugin
def __traceback_decorator__( frames ):
from copy import deepcopy
from os.path import basename
def _map2ttl( frame ):
filename = frame.fil... |
# Copyright 2011 OpenStack LLC. # 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 ... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.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, eithe... |
import os
import re
from fab_deploy2 import functions
from fab_deploy2.config import CustomConfig
from fab_deploy2.tasks import ServiceContextTask, task_method
from fabric.api import run, sudo, env, put, local
from fabric.contrib.files import append, exists
from jinja2.exceptions import TemplateNotFound
class Colle... |
#!/usr/bin/env python
# Copyright 2015-2016 Yelp 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 ... |
#!/usr/bin/python
"""
Exp5_Bumpers -- RedBot Experiment 5
Now let's experiment with the whisker bumpers. These super-simple switches
let you detect a collision before it really happens- the whisker will
bump something before your robot crashes into it.
This sketch was written by SparkFun Electronics, with l... |
#!/usr/bin/env python
#
# Copyright (C) 2009 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 ... |
#! /usr/bin/env python
"""
This script will print out the quadrupole field gradient
distribution in accelerator sequences in the JPARC Linac.
The files will include results for the case of hard edge quads
and the distributed quadrupole fields described by Enge's and
PMQ Trace3D functions.
"""
import sys
import math
... |
#!/usr/bin/env python3
__version__ = '1.3'
from lxml import etree
from collections import OrderedDict
from wand.drawing import Drawing
from wand.image import Image
from wand.font import Font
from wand.color import Color
import cgi
import cgitb
import html
import sys
import string
import random
import datetime
impo... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import defaultdict
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.osv import expression
from odoo.addons.stock.models.stock_rule import ... |
import errno
import time
from flask import current_app, render_template, Markup, url_for
from flask.views import MethodView
from werkzeug.exceptions import NotFound, Forbidden
from pygments import highlight
from pygments.lexers import get_lexer_for_mimetype
from pygments.util import ClassNotFound as NoPygmentsLexer
f... |
from datetime import timedelta
from django.test import TestCase, RequestFactory
from django.contrib.auth.models import User
from payments.models import Payment
from payments.backends import StripeBackend
class StripeBackendTest(TestCase):
def setUp(self):
self.user = User.objects.create_user('test', 'te... |
#!/usr/bin/python
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2011 Marek Marczykowski <marmarek@invisiblethingslab.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;... |
#! -*- coding: utf-8 -*-
#
# Tiny Skype debug log parser.
# Created by aki in about half an hour, at the request of bn0x.
#
# ---------------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 43.5):
# @__akiaki wrote this file. As long as you retain this notice you ca... |
################################################################################
# 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... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 by Pablo Martín <goinnn@gmail.com>
#
# This software 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 License, or
# (at your option) a... |
import socket
import hashlib
import email
import sober.config
import sober.datasource
import others.spamc as spamc
import others.bogofilter as bogofilter
import sober.definitions as defines
class Scanner:
ST_OK = 0
ST_FOUND = 1
ST_ERROR = -1
ST_SCORE = 0
AGENT = ''
handler = None
ds ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# pynexus, a Python library for easy playing with Nexus
# Copyright (C) 2016 by the pynexus team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU L... |
#!/usr/bin/env python3
#!/usr/bin/python
import subprocess
import os
import shutil
import pty
master, slave = pty.openpty()
args = ('stdin1.py')
# popen = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd='.')
# http://stackoverflow.com/questions/5411780/python-run-a-da... |
import os
class Properties:
def __init__(self, query, example_query_index = -1, thepath = None):
self.query = query
main_dir = os.getcwd()
self.SCRAPY_EXEC = "C:/WinPython36/python-3.6.3.amd64/Scripts/scrapy.exe"
self.PARENT_DIR = main_dir + os.path.sep
if example_query_index >= 0:
self.DATA_DIR... |
#! /usr/bin/env python2.7
from bs4 import BeautifulSoup
def printStats(gl, soup, adminPageEx):
if adminPageEx == 'true':
print('${font Arial:bold:size=10}'+ gl.topicCol +'COMMENTS '+gl.topicLineCol+'${hr 2}')
print('${color red}Error getting comment stats')
print(gl.secOffset)
else:
#Private variables
pend... |
#!/usr/bin/env python
import pygame
import sys
import math
import random
SCALE = 0.5
sprite_size = [int(85*SCALE), int(112*SCALE)]
# Initialize the screen
pygame.init()
SCREEN_SIZE = (640, 480)
screen = pygame.display.set_mode(SCREEN_SIZE)
pygame.display.set_caption('Get Off My Head')
#pygame.mouse.set_visible(0)
... |
#implimentation of the standard inceptionnet v3 inception module in sonnet
import tensorflow as tf
import sonnet as snt
class InceptionModule(snt.AbstractModule):
def __init__(self, output_channels, name="inception_module"):
super(InceptionModule, self).__init__(name=name)
self._output_channels = output_cha... |
'''
Copyright (c) 2015 Chris Doherty, Oliver Nabavian
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, publi... |
#!/usr/bin/env python3
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
"""
``revscoring fit -h``
::
Fits a dependent (an extractable value like a Datasource or Feature) to
observed data. These are often used along with bag-of-words
methods to reduce the feature space prior to training and testing a model
or to train a sub-model.
Usage:
fit -h | --help
... |
# -*- coding: utf-8 -*-
#
# PlantwebTest documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 24 03:02:39 2016.
#
# 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.
... |
"""
ChoiceWidget is intended to work as a replacement for django's Select widget,
and MultipleChoiceWidget for django's SelectMultiple.
Constructing a widget needs an Autocomplete class or registered autocomplete
name.
The choice autocomplete widget renders from autocomplete_light/widget.html
template.
"""
from djan... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2003-2013 Ulrich von Zadow
#
# This library 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
# vers... |
"""Interfaces with TotalConnect alarm control panels."""
import logging
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
STATE_ALARM_DISARMED, STATE_ALARM_ARMING, STATE_ALARM_DISARMING,
ST... |
from turtle import Turtle, colormode
from random import randint
import sys
def randColor():
return randint(0,255)
def drawTriangle(t,dist):
t.fillcolor(randColor(),randColor(),randColor())
t.down()
t.setheading(0)
t.begin_fill()
t.forward(dist)
t.left(120)
t.forward(dist)
... |
#!/usr/bin/env python
# Copyright (c) 2011-2020, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
import numpy as np
import pytest
from wradlib import adjust
class Data:
# Arguments to be used throughout all test classes
raw_x, raw_y = np.meshgrid(np.arange(4).astype("... |
import json
from w3af_api_client.utils.exceptions import APIException
class LogEntry(object):
def __init__(self, _type, message, _time, severity, _id):
self.type = _type
self.message = message
self.time = _time
self.severity = severity
self.id = _id
def __eq__(self, o... |
# -*- coding: utf-8 -*-
import os
import codecs
from setuptools import setup, find_packages
import django_future_url
read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read()
setup(
name="django-future-url",
version=django_future_url.__version__,
author='Vitaly Olevinsky',
author_email='olev... |
#
# This file is part of rhevsh. rhevsh is free software that is made
# available under the MIT license. Consult the file "LICENSE" that is
# distributed together with this file for the exact licensing terms.
#
# rhevsh is copyright (c) 2011 by the rhevsh authors. See the file
# "AUTHORS" for a complete overview.
impo... |
import pygame as pg
from random import uniform, choice, randint, random
from settings import *
from tilemap import collide_hit_rect
import pytweening as tween
vec = pg.math.Vector2
def collide_with_walls(sprite, group, dir):
if dir == 'x':
hits = pg.sprite.spritecollide(sprite, group, False, collide_hit_re... |
#!/usr/bin/env python
"""
@package ion.services.sa.tcaa.test.test_terrestrial_endpoint
@file ion/services/sa/tcaa/test/test_terrestrial_endpoint.py
@author Edward Hunter
@brief Test cases for 2CAA terrestrial endpoint.
"""
__author__ = 'Edward Hunter'
# Pyon log and config objects.
from pyon.public import log
from p... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/node_configurator_dialog.ui'
#
# Created: Sun Aug 17 18:05:14 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, Q... |
import heapq
def solution():
T = int(input())
for t in range(1, T+1):
solve(t)
xx = [0, 1, 0, -1]
yy = [1, 0, -1, 0]
def solve(t):
r, c = map(int, input().split(' '))
h = []
for i in range(r):
h.append(list(map(int, input().split(' '))))
measured = [[False,]*c for i in range(r)]
... |
import unittest
from typing import Callable
from flask import Flask, g
from flask_jsontools import FlaskJsonClient, DynamicJSONEncoder
from sqlalchemy.orm.exc import NoResultFound
from . import models
from .crud_view import ArticleView, GirlWatcherView
from mongosql import StrictCrudHelper, StrictCrudHelperSettingsD... |
'''Misc functions.'''
import functools
import gettext
import itertools
import logging
import mimetypes
import re
import string
import wpull.url
from wpull.backport.logging import BraceMessage as __
from wpull.pipeline.item import LinkType
_ = gettext.gettext
_logger = logging.getLogger(__name__)
def parse_refresh(... |
# coding: utf-8
import copy
from flask.ext import login
from flask.ext import wtf
from flask.ext.babel import gettext as __
from flask.ext.babel import lazy_gettext as _
from google.appengine.ext import ndb
import flask
import wtforms
import auth
import cache
import config
import i18n
import model
import task
import... |
import argparse
import base64
import sys
from base64 import b64decode as b64decodeValidate
from base64 import encodebytes as b64encodebytes
from timeit import default_timer as timer
import pybase64
def bench_one(duration, data, enc, dec, encbytes, altchars=None, validate=False):
duration = duration / 2.0
if... |
# -*- coding: utf-8 -*-
"""
@note: 分析ngxin日志,提取出频繁访问网站的ip
"""
import sys
import os
# 引入父目录来引入其他模块
SITE_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.extend([os.path.abspath(os.path.join(SITE_ROOT, '../')),
os.path.abspath(os.path.join(SITE_ROOT, '../../')),
]... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mice_parameters_page.ui'
#
# Created: Fri Mar 7 09:30:08 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
... |
import warnings
from contextlib import contextmanager
from copy import deepcopy
from lxml import etree
from jnpr.junos.factory.viewfields import ViewFields
class View(object):
"""
View is the base-class that makes extracting values from XML
data appear as objects with attributes.
"""
ITEM_NAME_... |
"""
Launchers for invoking SIPp user agents
"""
import subprocess
import os
import shlex
import select
import threading
import signal
import time
from . import utils
from pprint import pformat
from collections import OrderedDict, namedtuple
log = utils.get_logger()
Streams = namedtuple("Streams", "stdout stderr")
c... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import os
import Aplicacion
import math
import random
from datetime import datetime
from Menu import *
from Variable import *
class Prueba(Aplicacion.Aplicacion):
def iniciar(self,**args):
# las variables de usuario se agregan con la clase Variable.
# la funcion para modificarlas debe ser creada en la clase que ... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... |
from tastypie.exceptions import Unauthorized
from tastypie.authorization import Authorization, DjangoAuthorization
class UsersDjangoAuthorization(DjangoAuthorization):
def update_detail(self, object_list, bundle):
if bundle.request.user.id == bundle.obj.id:
return True
return super(Us... |
from __future__ import unicode_literals
from collections import OrderedDict
import datetime
from operator import attrgetter
import pickle
import unittest
import warnings
from django.core.exceptions import FieldError
from django.db import connection, DEFAULT_DB_ALIAS
from django.db.models import Count, F, Q
from djang... |
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 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/... |
# -*- coding: utf-8 -*-
#
# privacyIDEA is a fork of LinOTP
# 2014-12-05 Cornelius Kölbel <cornelius@privacyidea.org>
# Migration to flask
#
# May 08, 2014 Cornelius Kölbel
# License: AGPLv3
# contact: http://www.privacyidea.org
#
# Copyright (C) 2010 - 2014 LSE Leading Security Experts GmbH
# Lice... |
# Copyright (C) 2016 Linaro Limited
#
# Author: Dean Arnold <dean.arnold@linaro.org>
#
# This file is part of LAVA Dispatcher.
#
# LAVA Dispatcher 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... |
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
# WeCase -- This model implemented a model for smileies.
# Copyright (C) 2013, 2014 The WeCase Developers.
# License: GPL v3 or later.
import wecasepath as path
from WeHack import Singleton
from collections import OrderedDict
try:
from xml.etree.cElementTree ... |
__author__ = 'firatlepirate'
import socket
import threading
import Queue
import time
import errno
class WriteThread (threading.Thread):
def __init__(self, name, cSocket, address,fihrist,threadQueue, logQueue ):
threading.Thread.__init__(self)
self.name = name
self.cSocket = cSocket
... |
from netbox_api.model.common import CustomFields
from enum import Enum
class RackWidthConstant(Enum):
WIDTH_19_INCHES = 19
WIDTH_23_INCHES = 23
class RackTypeConstant(Enum):
FRAME_2_POST = 100
FRAME_4_POST = 200
CABINET_4_POST = 300
FRAME_WALL_MOUNTED = 1000
CABINET_WALL_MOUNTED = 1100
... |
"""Support for functionality to keep track of the sun."""
import logging
from datetime import timedelta
from homeassistant.const import (
CONF_ELEVATION, SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET)
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event imp... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 14:01:33 2015
@author: jdh
Tile task system for celery
"""
from datacube.api.query import SortType
from matplotlib.mlab import PCA
from datetime import datetime,timedelta
import logging
import os
from osgeo import gdal
import osr #agregado para exportar el archivo de ... |
import re
from urllib2 import unquote
from django import forms
from django.utils.translation import ugettext, ugettext_lazy as _
from bleach import TLDS
from olympia.amo.utils import raise_required
from .models import RatingFlag
class RatingReplyForm(forms.Form):
form_id = 'review-reply-edit'
title = for... |
'''
Test Steps:
1. grace stop host where vip located.
2. check vip switch to another MN.
3. create vm to validate everything goes on well.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test... |
# -*- coding: utf-8 -*-
import datetime
import os
import math
from PyQt5 import QtWidgets, QtCore, uic
from pypipboy.types import eValueType
from widgets import widgets
class PlayerInfoWidget(widgets.WidgetBase):
_signalInfoUpdated = QtCore.pyqtSignal()
def __init__(self, handle, controller, parent):
... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... |
"""
Class: Brain.py
Description: This class summarize the steps needed to make a neural network with, actually,
backpropagation algorithm.
Since: 03/11/2017
Author: Fernando Ferreira Abreu (abreu.fernando.f@gmail.com)
"""
import Neuron
import pandas
import math
import matpl... |
#!/usr/bin/env python
# Script to generate TVTK files from CitcomS hdf files
# author: Martin Weier
# Copyright (C) 2006 California Institue of Technology
#
# 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
# ... |
#%%
import networkx as nx
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
import textwrap
import pydot
import random, string
def drawGraph(data2Draw,current,trues,pos):
if drawActive == False:
return ""
text = str("Now we delete:"+textwrap.fill(str(cur... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright (c) 2017 Jesse Pinnell
# 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... |
from django.contrib import admin
from chat.models import UserProfile, Comments, Roll, Emblem
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
# Register your models here.
class UserProfileAdmin(admin.StackedInline):
... |
# encoding: UTF-8
'''
本文件中包含了CTA模块中用到的一些基础设置、类和常量等。
'''
from __future__ import division
# 把vn.trader根目录添加到python环境变量中
import sys
sys.path.append('..')
# 常量定义
# CTA引擎中涉及到的交易方向类型
CTAORDER_BUY = u'买开'
CTAORDER_SELL = u'卖平'
CTAORDER_SELLTODAY = u'卖平今'
CTAORDER_SELLYESTERDAY = u'卖平昨'
CTAORDER_SHORT = u'卖开'
CTAORDER_CO... |
r"""
Implementation of a random fern, used for regression.
The fern is learnt a mapping from vectors of pixels to corresponding
vectorial delta shapes.
"""
import numpy as np
import cv2
from facefit.base import RegressorBuilder, Regressor
from facefit.util import rand_unit_vector
class FernBuilder(RegressorBuilder)... |
#
# MIT License
#
# Copyright (c) 2017 David Landeros [dh.landeros08@gmail.com]
#
# 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 right... |
# coding: utf-8
#
# Copyright © 2017 weirdgiraffe <giraffe@cyberzoo.xyz>
#
# Distributed under terms of the MIT license.
#
from kodi import logger, Plugin
import seasonvar
from datetime import datetime, timedelta
def week(plugin):
date = datetime.today()
for date_offset in range(7):
datestr = date.st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.