src stringlengths 721 1.04M |
|---|
"""Config flow for Plex."""
import copy
import logging
from aiohttp import web_response
import plexapi.exceptions
from plexauth import PlexAuth
import requests.exceptions
import voluptuous as vol
from homeassistant.components.http.view import HomeAssistantView
from homeassistant.helpers.aiohttp_client import async_ge... |
from enum import Enum
class Item(Enum):
ITEM_UNKNOWN = 0
ITEM_POKE_BALL = 1
ITEM_GREAT_BALL = 2
ITEM_ULTRA_BALL = 3
ITEM_MASTER_BALL = 4
ITEM_PREMIER_BALL = 5
ITEM_POTION = 101
ITEM_SUPER_POTION = 102
ITEM_HYPER_POTION = 103
ITEM_MAX_POTION = 104
ITEM_REVIVE = 201
ITEM_... |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the ... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'AuthAPIKey.callback'
db.add_column('api_authapikey', 'callback', self.gf('django.db.models... |
# -*- coding: utf-8 -*-
from decimal import Decimal
from datetime import datetime as dt
from bs4 import BeautifulSoup as Bs
from config import LoggerLoader
__author__ = 'leandroloi'
__license__ = "GPL"
__version__ = "0.0.1"
__maintainer__ = "Leandro Loi"
__email__ = "leandroloi at gmail dot com"
logger = LoggerLoader... |
# -*- coding: utf-8 -*-
import unittest
from atramhasis.protected_resources import ProtectedResourceEvent, ProtectedResourceException, protected_operation
try:
from unittest.mock import Mock, MagicMock
except ImportError:
from mock import Mock, MagicMock, call # pragma: no cover
from atramhasis.errors import C... |
# ===============================================================================
# Copyright 2014 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# terminal based Media Organisator
# Author: Martin Jung
# Date: 2011
# Imports
import imdb # aptitude install python-imdbpy
import sqlite3 # aptitude install python-sqlite
import os, sys, getopt, fnmatch
# Video Datatype Endings
ext = ['*.avi','*.mkv']
extB = map(lambd... |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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) any l... |
#-*- coding: utf-8 -*-
from numpy import *
import operator
# 读取数据到矩阵
def file2matrix(filename):
# 打开数据文件,读取每行内容
fr = open(filename)
arrayOLines = fr.readlines()
# 初始化矩阵
numberOfLines = len(arrayOLines)
returnMat = zeros((numberOfLines,3))
# 初始化类标签向量
classLabelVector = []
# 循环读取... |
import pytest
from django.http.request import QueryDict
from apps.public.search.forms import SearchForm
from apps.public.search.utils import get_search_elements
class FakeSolrData:
def get_search_form_facets(self):
return {
'disciplines': [],
'languages': [
('fr',... |
#!/usr/bin/env python
"""
Run the queries described in README
cmd: env keystore=`pwd` ./query.py
"""
import os
import ABAC
ctxt = ABAC.Context()
# Keystore is the directory containing the principal credentials.
# Load existing principals and/or policy credentials
if (os.environ.has_key("keystore")) :
keystore... |
from . base import Component
class Grid(Component):
"""A CSS grid layout.
A grid consists arbitrary rows and 16 columns per row. see http://semantic-ui.com/collections/grid.html
for more.
"""
template = "cba/layouts/grid.html"
class Column(Component):
"""A column of a grid.
width
... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, unicode_literals, print_function
import buildconfig
import os
import shutil
imp... |
# Copyright 2019 The TensorNetwork 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 or agreed ... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# lis... |
from etcetera.checkout.models import Checkout
from django.contrib import admin
# This file determines what's shown in the admin interface
class CheckoutAdmin(admin.ModelAdmin):
fieldsets = (
('Basic information', {
'fields': (
'first_name',
'last_name',
... |
# -*- coding: utf-8 -*-
from setuptools import find_packages
from setuptools import setup
version = '1.0.23'
setup(
name='elan.sitrep',
version=version,
description="",
long_description="""\
""",
# Get more strings from
# http://www.python.org/pypi?%3Aaction=list_classifiers
classifiers=[... |
# -*- coding: utf-8 -*-
import logging
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.response import TemplateResponse
from models import SimpleProduct, ComplexProduct
logger = logging.getLogger('ccbasket')
def home(request):
return render_to_respon... |
# -------------------------------------------------------------------------- #
# OpenSim Moco: plot_gait10dof18musc_activation.py #
# -------------------------------------------------------------------------- #
# Copyright (c) 2017 Stanford University and the Authors #
# ... |
"""
10-20-15
"""
import tempfile
import csv
def load_csv_as_dict(csv_path):
"""
Loads a CSV into a dictionary.
"""
with open(csv_path, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
header_row = reader.next()
dat = [[] for _ in header_row]
row_len = len... |
import unittest
import quadedge as qe
class TestQuadedge(unittest.TestCase):
def test_quadedge(self):
q = qe.QuadEdge()
e = q.base
self.assertIs(e, q.edges[0])
self.assertIsNot(e, e.rot)
self.assertIs(e._rot, e.rot)
self.assertIs(e, e.rot.rot.rot.rot)
self... |
#!/bin/python
class DflatIdentifiable(object):
def __init__(self, keys):
self._keys = keys
def add(self, val):
self._keys.append(val)
def __repr__(self):
return self.__str__()
def __str__(self):
return str(self._keys)
def id(self):
return DflatIdentifiable.idstr(self._keys)
def keys(self):
retu... |
"""read_data.py: Helper script to read data from csv files."""
import config
import pandas as pd
import numpy as np
import datetime as dt
import pre_process
def setCatgories(data,fields):
for field in fields:
data[field] = pd.Categorical.from_array(data[field]).codes
return data
dataConv = lambda t : (dt.dateti... |
#Ver. 0.0.7
#Author: Zach Almon
import urllib.request
import re
import os
import platform
import sys
import string
import html
import time
platformType = platform.system()
def Batoto(link_to_manga_site):
success = False
currentDirectory = os.getcwd()
if platformType == 'Windows':
MASTERdirecto... |
"""Search operator for searching sequences using MMseqs2 (BLAST-like)."""
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Union
class SequenceType(Enum):
"""Type of sequence being searched."""
DNA = "pdb_dna_sequence"
RNA = "pdb_rna_sequence"
PROTEIN = "... |
'''
A file of small misc. functions
'''
import socket
import subprocess
import httplib2
class Singleton(type):
'''
Singlton Design Pattern metaclass
'''
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls)... |
# Copyright 2013 IBM Corp.
# Copyright 2011 OpenStack Foundation
#
# 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 ... |
__author__ = 'dexter'
import requests
from bson.json_util import dumps
class NetworkGeneAnalyzer:
def __init__(self, network_id, ndex):
self.ndex = ndex
self.network = self.ndex.get_complete_network(network_id)
self.identifiers = []
self.node_map = self.network.get("nodes")
... |
"""
External service key settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from askbot.deps import livesettings
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings
from askbot.skins import... |
'''
usage: scrapy runspider recursive_link_results.py (or from root folder: scrapy crawl scrapy_spyder_recursive)
'''
#from scrapy.spider import Spider
from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from scrapy.http import Reque... |
from builtins import object
from django.conf import settings
from django.db import connections
from django.db.models.fields import Field
from importlib import import_module
from future.utils import with_metaclass
DATABASES = settings.DATABASES
BACKEND_TO_OPERATIONS = {
'mysql': 'MySQLOperations',
'oracle': 'O... |
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# Baruwa - Web 2.0 MailScanner front-end.
# Copyright (C) 2010-2012 Andrew Colin Kissa <andrew@topdog.za.net>
#
# 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 S... |
from decimal import Decimal
import datetime
from django.db import models
from django.contrib.localflavor.us.models import USStateField
from django.conf.urls.static import static
PAYMENT_TYPES = (
('cash', 'Cash'),
('check', 'Check'),
('credit card', 'Credit Card'),
)
# Create your models here.
class Cus... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2017 Bitergia
#
# 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 l... |
import numpy
__all__ = [
"interpolate",
]
class interpolate:
# Convert two vectors into a normalzied coordinate system via GS orthogonalization
@staticmethod
def plane_to_cs(cs):
# Normalize vectors
cs[0] = cs[0]/numpy.linalg.norm(cs[0])
cs[1] = cs[1]/numpy.linalg.norm(cs[1])
... |
import mock
import pytest
@pytest.fixture
def get_related_assert():
def fn(model_obj, related, resource_name, related_resource_name):
assert related_resource_name in related
assert related[related_resource_name] == '/api/v2/%s/%d/%s/' % (resource_name, model_obj.pk, related_resource_name)
retu... |
#!/usr/bin/env python
import argparse
from intelhex import IntelHex
from time import sleep, time
from struct import unpack
import sys
import subprocess
from pyOCD.interface import INTERFACE, usb_backend
from pyOCD.board import MbedBoard
import logging
VID = 0x0D28
PID = 0x0204
NVMC_READY = 0x4001E400
NVMC_CON... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import logging
import sys
import urllib
import mechanize
import cookielib
import urlparse
class Singleton(object):
_instances = {}
def __new__(class_, *args, **kwargs):
if class_ not in class_._instances:
class_._instances[class_] = super(Singleto... |
from commando import management
BaseDataMigrationCommand = management.get_command_class(
"datamigration", exclude_packages=("commando",))
if BaseDataMigrationCommand is not None:
base = BaseDataMigrationCommand()
class DataMigrationCommandOptions(management.CommandOptions):
"""
... |
from flask import make_response
from flask import request
from flask import redirect
from flask import abort
from flask import render_template
from flask import jsonify
from flask import g
from flask import url_for
from flask import Response
from openpyxl import Workbook
from sqlalchemy.orm import raiseload
import jso... |
# -*- coding: utf-8 -*-
import logging
import os
from django.contrib.auth.models import Group, User
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import GEOSGeometry, Polygon
from django.core.files import File
from django.test import TestCase
from django.utils import timezone
import jobs... |
from django.contrib.auth.models import Group
from django_cas_ng.backends import CASBackend
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.core.exceptions import PermissionDenied
from molo.profiles.models import UserProfile
UserModel = get_user_model()
... |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... |
'''
Created on 11. jan. 2012
@author: pcn
'''
from xml.etree.ElementTree import Element, SubElement
from xml.etree import ElementTree
from BeautifulSoup import BeautifulStoneSoup
import os
import random
import sys
def getDefaultDirectories():
taktPackageConfigDir = os.path.join(os.getcwd(), "config... |
# Copyright (c) 2017-18 Luke Montalvo <lukemontalvo@gmail.com>
#
# This file is part of BEEF.
# BEEF is free software and comes with ABSOLUTELY NO WARANTY.
# See LICENSE for more details.
try:
import wx
except ImportError:
raise ImportError("The wxPython module is required to run this program")
from resources.enum ... |
#!/usr/bin/env python
# -*-coding: utf8 -*-
"""Task Queue API
TaskQueue is a distributed task queue service provided by SAE for developers as
a simple way to execute asynchronous user tasks.
Example:
1. Add a GET task.
from sae.taskqueue import Task, TaskQueue
queue = TaskQueue('queue_name')
queue.... |
# Copyright (C) 2011-2018 Patrick Totzke <patricktotzke@gmail.com>
# Copyright © 2018 Dylan Baker
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import asyncio
import urwid
import logging
from urwidtrees import ArrowTree, TreeBox, NestedTree
from .... |
# Python3
from solution1 import sortCodesignalUsers as f
qa = [
([['warrior', '1', '1050'],
['Ninja!', '21', '995'],
['recruit', '3', '995']],
['warrior',
'recruit',
'Ninja!']),
([],
[]),
([['single hero', '234', '283']],
['single hero']),
([['Corrie', '66', '5']... |
#!/usr/bin/env python
# import modules
import pytest
from rig_remote.queue_comms import QueueComms
from rig_remote.constants import QUEUE_MAX_SIZE
from Queue import Queue, Empty, Full
def test_queued_for_parent1():
qc=QueueComms()
qc.parent_queue.put("2")
qc.parent_queue.get()
assert(qc.queued_for_par... |
__docformat__ = 'restructuredtext en'
# -----------------------------------------------------------------------------
# _ _
# (_)_ __ ___ _ __ ___ _ __| |_ ___
# | | '_ ` _ \| '_ \ / _ \| '__| __/ __|
# | | | | | | | |_) | (_) | | | |_\__ \
# |_|_| |_| |_| .__/ \___/|_| \__|___/
# ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Thierry Lemeunier <thierry at lemeunier dot net>
# 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 th... |
from attack import Attack
from vulnerability import Vulnerability, Anomaly
import requests
from net import HTTP
# Wapiti SVN - A web application vulnerability scanner
# Wapiti Project (http://wapiti.sourceforge.net)
# Copyright (C) 2008 Nicolas Surribas
#
# David del Pozo
# Alberto Pastor
# Informatica Gesfor
# ICT Ro... |
#!/usr/bin/env python
"""Handle records from /proc/self/maps data files"""
import regentest as RG
import ProcHandlers as PH
PFC = PH.ProcFieldConstants
# ---
def re_self_maps(inprecs):
"""Iterate through parsed records and re-generate data file"""
__leadtemp = "{st:08x}-{en:08x} {fl:4s} {offset:08x} \
{m... |
"""
By default the HEAD of the current branch will be pushed to the remote server:
fab stage deploy
This can be overridden by providing a hash:
fab stage deploy:2ab1c583e35c99b66079877d49e3ec03812d3e53
If you don't like all the output:
fab stage deploy --hide=stdout
"""
import os
from fabric.api import env, execute,... |
from copy import copy
from collections import namedtuple
import datetime
import numpy as np
import pandas as pd
from syscore.genutils import transfer_object_attributes
from syscore.pdutils import make_df_from_list_of_named_tuple
from syscore.objects import header, table, body_text, arg_not_supplied, missing_data
fro... |
# Copyright 2015 Google Inc. 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 applicable law or agreed ... |
'''
Copyright (C) 2021 Gitcoin Core
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This progra... |
def fjordify(f):
lines = [line.strip() for line in open(f).readlines()]
width = len(lines[0])
fjord = {
'map': [],
'boat': None,
}
for y, line in enumerate(lines):
row = [' '] * width
for x in range(0, len(line)):
if line[x] == '#':
row[... |
#!/home/pi/Django/bin/python3
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
import serial
from serial.tools.list_po... |
from __future__ import division #brings in Python 3.0 mixed type calculation rules
from functools import wraps
import logging
import numpy as np
import pandas as pd
import time
from math import exp
class KabamFunctions(object):
"""
Function class for Kabam.
"""
def __init__(self):
"""Class r... |
import os
import signal
import time
import unittest
from unittest.mock import patch, Mock
from tornado import gen
from tornado.options import options
from tornado.testing import AsyncTestCase, LogTrapTestCase, ExpectLog, gen_test
from ..__main__ import main, shutdown
from ..app import ShoestringApplication
from ..ba... |
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.db import connection
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models.tablespaces import (
Article, ArticleRef, Authors, Reviewers, Scientist, ScientistRef,
... |
#========================================
# WLST Script purpose: Configuring JMS Module
# Author: Pavan Devarakonda
# Update date: 3rd Aug 2017
#========================================
from java.util import Properties
from java.io import FileInputStream
from java.io import File
from java.io import FileOutputStream
fro... |
import time
import logging
import unittest
from copy import copy
import epics
from ophyd import (PVPositioner, PVPositionerPC, EpicsMotor)
from ophyd import (EpicsSignal, EpicsSignalRO)
from ophyd import (Component as C)
logger = logging.getLogger(__name__)
def setUpModule():
logging.getLogger('ophyd.pv_posit... |
#-------------------------------------------------------------------------------
# Copyright (C) 2017 Carlos Guzman (cguZZman) carlosguzmang@protonmail.com
#
# This file is part of OneDrive for Kodi
#
# OneDrive for Kodi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gen... |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: WordNet
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Steven Bethard <Steven.Bethard@colorado.edu>
# Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# Nitin Madnani <nmadnani@ets.org>
# Nasruddin A’ai... |
import logging
import sys
import re
import string
from collections import defaultdict
try:
import pyparsing
from pyparsing import Literal, Word, Group, Combine, Optional, Forward, alphanums, SkipTo, LineEnd, nums, delimitedList # nopep8
except ImportError:
logging.critical("PyParsing has to be installed o... |
from django.conf import settings
from django.utils import timezone
def alliance_id(request):
return {'ALLIANCE_ID': settings.ALLIANCE_ID}
def alliance_name(request):
return {'ALLIANCE_NAME': settings.ALLIANCE_NAME}
def jabber_url(request):
return {'JABBER_URL': settings.JABBER_URL}
def domain_url(re... |
#!/usr/bin/env python
#
# git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
#
# Author: Simon Hausmann <simon@lst.de>
# Copyright: 2007 Simon Hausmann <simon@lst.de>
# 2007 Trolltech ASA
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
#
import sys
if sys.he... |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# 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 ... |
#! /usr/bin/env python
'''
compiler from markdown file to pdf using wkhtmltopdf
Usage:
compile.py [--script FILE] [--style FILE]
[--pdf-options STRING] [--toc] <input> [<output>]
compile.py (-h | --help)
Options:
-h --help Show help screen
--script FILE Script re... |
# -*- coding: utf-8 -*-
import os
from abc import ABCMeta, abstractmethod
from exception import InputException
from ..domnode import EbookNode
# Input driver base class
class Driver:
__metaclass__ = ABCMeta
##########################################################################
# Constructor
def __init__(s... |
"""
For Class #1 of an informal mini-course at NYU Stern, Fall 2014.
Topics: calculations, assignments, strings, slicing, lists, data frames,
reading csv and xls files
Repository of materials (including this file):
* https://github.com/DaveBackus/Data_Bootcamp
Written by Dave Backus, Sarah Beckett-Hile, and Glenn O... |
__author__ = 'Kevin Gullikson'
import os
import sys
import re
from collections import defaultdict
import warnings
from collections import OrderedDict
import itertools
import FittingUtilities
import logging
from astropy import units
from scipy.interpolate import InterpolatedUnivariateSpline as spline, LinearNDInterpola... |
import sublime, sublime_plugin
class DirectionalDuplicateLineCommand(sublime_plugin.TextCommand):
"""
Duplicate line/selection before or after the current one. As it turns out,
duplicating "before" just means restoring each selection to the state it was
before duplication.
"""
def ... |
import time
import math
import random
from naoqi import ALProxy
#IP = '127.0.0.1'
#port = 49951
IP = '192.168.3.9'
port = 9559
motion_proxy = ALProxy('ALMotion',IP,port)
part = 'Body'
time.sleep(3.0)
for i in range(200):
motion_proxy.setStiffnesses(part, 1.0)
body_names = motion_proxy.getBodyNames(part)
if i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""SIP SDP Tango Master Device server.
Run with:
```bash
python3 sdp_master_ds.py 1 -v4
```
"""
import sys
from tango import Database, DbDevInfo
from tango.server import run
from sdp_master_device import SDPMasterDevice
from sip_logging import init_logger
from release ... |
#-*- coding:utf-8 -*-
import cv2
import time
from tool.ConnectMysql import *
from tool.faceapi import *
from tool.log import *
from tool.board import *
from tool.email import *
import threading
class Camera:
'''
摄像头模块以及人脸和人体识别
'''
def __init__(self):
self.mysql = Mysql()
self.logging = ... |
#!/bin/python3
import numpy as np
import cv2
import base64
import pdb
from tkinter import *
from matplotlib import pyplot as plt
class FeatureMatcher:
__PORC_DISTANCE = 0.7
def __init__(self,feature_extractor='SURF',upright=True,min_match_count=10,threshold=400):
self.MIN_MATCH_COUNT = min_match_count
... |
"""
The `compat` module provides support for backwards compatibility with older
versions of Django/Python, and compatibility wrappers around optional packages.
"""
from django.conf import settings
from django.views.generic import View
def unicode_http_header(value):
# Coerce HTTP header value to unicode.
if i... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'RecurringDirectDebitPayment'
db.create_table(u'fund_recurringdirectdebitpayment', (
... |
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.db import IntegrityError
from django_fixmystreet.fixmystreet.models import FMSUser
from django_fixmystreet.fixmystreet.models ... |
# Copyright 2017 Mycroft AI 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 writin... |
#!/usr/bin/env python
# Copyright 2017 Nick Dekker, Marthe Veldhuis.
#
# This work is licensed under the terms of the MIT license.
# For a copy, see LICENSE.txt.
from avocado import Test
from utils import internet, utils
import time
class WifiConnectAP(Test):
"""
Uses the first access point from internet_data... |
import types
from urlparse import urlparse, urlunparse, parse_qs
from urllib import urlencode
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from djan... |
"""
Django settings for paperless project.
Generated by 'django-admin startproject' using Django 1.9.
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 jso... |
# Copyright (c) 2010 Franz Allan Valencia See
#
# 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... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... |
import datetime
from django import forms
from django.contrib.auth.models import Group
from django.forms.models import (
BaseInlineFormSet,
inlineformset_factory,
BaseModelFormSet,
modelformset_factory,
)
from cellsamples.models import Biosensor
from assays.models import (
AssayStudyConfiguration,
... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Blockstack
~~~~~
copyright: (c) 2014-2015 by Halfmoon Labs, Inc.
copyright: (c) 2016 by Blockstack.org
This file is part of Blockstack
Blockstack is free software: you can redistribute it and/or modify
it under the terms of the GNU General... |
# -*- coding: utf-8 -*-
'''
Created on 2012/12/14
自作のPDB関連リストの操作をまとめたモジュール
対象となるものは、基本的にはリストになる。
セパレーターはデフォルトを "," とする
ReadList
ToInt
ToStr
WriteList
DivideList
ToDetailNum
ToPDBNum
MakeLinkerTupple
@author: ryosuke
'''
def ReadList(filename, shold_ToInt=True, sep=","):
'''
Read my definition PDB list file... |
from collections import namedtuple
import datetime
import calendar
import struct
import sys
class StructType(object):
"""
Automatically uses SHAPE to pack/unpack simple structs.
"""
@classmethod
def from_binary(cls, data):
try:
return cls(*cls._decode(*struct.unpack(cls.SHAPE, data)))
except:
sys.stderr... |
# Copyright 2013-2014 The Meson development team
# 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 agree... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
DESCRIPTION: Code to run a n-fold cross validation on the results of the GRASS
GIS v.surf.bspline and v.surf.idw function. This code is used in
a tutorial about carrying out n-fold cross validation in GRASS
GIS (https://tutori... |
import sys
import argparse
import simpleamt
if __name__ == '__main__':
parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()],
description="Delete HITs")
parser.add_argument('--all', action='store_true', default=False)
args = parser.parse_args()
if (args.hit_ids_file is not No... |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# 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 ... |
# -*- coding: utf-8 -*-you
import urllib2
import json
import pandas as pd
import numpy as np
from sql_functions import *
day = 1
month = 8
# find which of the returned 10 forecasts corresponds to next Saturday
def find_record(parsed_json, day=day, month=month):
for i in range(10):
iday = parsed_json['forecast... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.