src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
import os
import re
import sys
# from codecs import open
from setuptools import (setup, find_packages)
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(sel... |
# -*- coding: utf-8 -*-
# @Time : 2017/7/13 下午5:13
# @Author : play4fun
# @File : findHomography.py
# @Software: PyCharm
"""
findHomography.py:联合使用特征提取和 calib3d 模块中的 findHomography 在复杂图像中查找已知对象
"""
import numpy as np
import cv2
from matplotlib import pyplot as plt
MIN_MATCH_COUNT = 10
img1 = cv2.imread('../da... |
# Adrian deWynter, 2016
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline
F, N = tuple(map(int, raw_input().strip().split(' ')))
trainingData = []
testData = []
for _ in range(N):
trainingData.appen... |
#!/usr/bin/python
# data_sender.py
#
# Copyright (C) 2008-2018 Veselin Penev, https://bitdust.io
#
# This file (data_sender.py) is part of BitDust Software.
#
# BitDust 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 Softwa... |
# -*- coding: utf-8 -*-
#
# Faker documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 11 11:25:48 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.
#
# All... |
###############################################################################
import b64_mod
from binascii import unhexlify
###############################################################################
def decode(bstring,flag = 0):
"""Decode, when flag is set to 0 or not set takes a Base64 strig and converts i... |
from cloudinary.models import CloudinaryField
from community.models import Community
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
class Resource(models.Model):
LANGUAGE_TAGS = (
('PYTHON', 'Python'),
('RUBY', 'Ruby'),
... |
"""
Dialog for building Tkinter accelerator key bindings
"""
from tkinter import *
from tkinter.ttk import Scrollbar
from tkinter import messagebox
import string
import sys
class GetKeysDialog(Toplevel):
# Dialog title for invalid key sequence
keyerror_title = 'Key Sequence Error'
def __init__(self, par... |
from projection_methods.projectables.halfspace import Halfspace
from projection_methods.projectables.hyperplane import Hyperplane
from projection_methods.projectables.projectable import Projectable
class Polyhedron(Projectable):
"""A projectable polyhedron
Defines a polyhedron via a set of hyperplanes and ha... |
"""
Revision ID: 0252_letter_branding_table
Revises: 0251_another_letter_org
Create Date: 2019-01-17 15:45:33.242955
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0252_letter_branding_table'
down_revision = '0251_another_letter_org'
def upgrade():
op... |
VBA = \
r"""
Function Base64ToText(ByVal vCode)
Dim oXML, oNode
Dim tempString As String
tempString = "Msxm"
tempString = tempString & "l2.DO"
tempString = tempString & "MDoc"
tempString = tempString & "ument.3.0"
Set oXML = CreateObject(tempString)
Set oNode = oXML.CreateElement("base6... |
import os
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from sqlalchemy import *
from sqlalchemy.orm import *
from databaseschema import *
from genericdelegates import *
from functions import *
import modelsandviews
import ui_forms.ui_findform
import receiveform
import batchform
import productionfor... |
from PySide.QtCore import *
from PySide.QtGui import *
from construct import *
from construct.adapters import *
from math import *
from binascii import *
#from ..mmapslice import *
def red(cons):
cons.color = Qt.red
return cons
class TreeNode(object):
def __init__(self, value, row, parent, cons, name=""... |
"""
Copyright (c) 2013, Triad National Security, LLC
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... |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import animation
from scipy import constants
def rotation_transform(axis, angle, ax = None):
if ax is None: ax = plt.gca()
t_scale = ax.transData
t_rotate = mpl.transforms.Affine2D().rotate_deg_around(axis[0], axis[... |
class BadGrammar(Exception):
"""The rule definitions passed to Grammar contain syntax errors."""
class VisitationError(Exception):
"""Something went wrong while traversing a parse tree.
This exception exists to augment an underlying exception with information
about where in the parse tree the error o... |
#!../bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import csv
import datetime
import json
import urllib2
import StringIO
import logging
import logging.handlers
import re
from pytz import timezone
import contextlib
import copy
# Entity type
AMBIENT_TYPE_NAME = 'AirQualityObserved'
# List o... |
#!/usr/bin/env python
# encoding: utf-8
preamble="""\\usetikzlibrary{{backgrounds,fit}}
\\begin{{tikzpicture}}
[vertex/.style={{circle,draw=blue!50,fill=blue!20,thick}},
selectedvertex/.style={{circle,draw=red!50,fill=red!20,thick}},
edge/.style={{thick}},
newedge/.style={{dashed,thick}}]"""
def compon... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Bartosz Janda
#
# 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 w... |
import shopify
import json
from test.test_helper import TestCase
class CollectionPublicationTest(TestCase):
def test_find_all_collection_publications(self):
self.fake(
"publications/55650051/collection_publications",
method="GET",
body=self.load_fixture("collection_publ... |
# Copyright 2009-2014 MongoDB, 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... |
from __future__ import print_function
import sys
class Direction:
NORTH = 1
EAST = 2
SOUTH = 3
WEST = 4
def ERROR(s):
sys.exit("ERROR: " + s)
def check_darkness_size(lines):
columns = len(lines[0])
for line in lines:
if(len(line) != columns):
ERROR("MALFORMED DARK... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
from setuptools import setup
try:
long_description = open("README.rst").read()
except IOError:
long_description = ""
LOCALEDIR = os.path.join('share', 'locale')
setup(
name="pygiftparser",
version="1.1",
url="https://github.com/mtommasi/pygiftp... |
# -*- coding: UTF-8 -*-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (C) 2015 - 2018 Simon Stuerz <simon.stuerz@guh.io> #
# ... |
"""
Tests for send_course_update management command.
"""
from __future__ import absolute_import
from unittest import skipUnless
import ddt
from django.conf import settings
from edx_ace.utils.date import serialize
from mock import patch
from six.moves import range
from openedx.core.djangoapps.schedules import resolve... |
import os
import logging
from autotest.client.shared import error
from virttest import libvirt_vm, virsh, remote, utils_libvirtd, aexpect
def run_virsh_undefine(test, params, env):
"""
Test virsh undefine command.
Undefine an inactive domain, or convert persistent to transient.
1.Prepare test environ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: victor
# @Date: 2014-02-09
# @Last Modified by: victor
# @Last Modified time: 2014-06-06
# @Copyright:
#
# This file is part of the AppVulnMS project.
#
#
# Copyright (c) 2014 Victor Dorneanu <info AAET dornea DOT nu>
#
# Permission is hereby granted... |
"""docfunc module"""
from deferred_binder import DeferredBinder
class DocFunc(DeferredBinder):
TRIGGER = None
def __init__(self, f):
super().__init__(f.__name__, f)
self.f = self.target
@staticmethod
def transform(name, context, target, obj=None):
"""The DeferredBinder trans... |
#
# General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for 1st, 2nd and 3rd generation solar cells.
# Copyright (C) 2012-2017 Roderick C. I. MacKenzie r.c.i.mackenzie at googlemail.com
#
# https://www.gpvdm.com
# Room B86 Coates, University Park, Nottingham, NG7 2RD... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## This file is part of Gajim.
##
## Gajim 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; version 3 only.
##
## Gajim is distributed in the hope that it will b... |
"""
State Space Representation and Kalman Filter
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
from warnings import warn
import numpy as np
from .representation import OptionWrapper, Representation, FrozenRepresentation
from .tools import (validate_v... |
import platform
import os
import sys
import subprocess
from pprint import pprint
print('Python version:', platform.python_version())
print('max unicode:', sys.maxunicode)
print('architecture:', platform.architecture())
print('sys.version:', sys.version)
print('platform.machine():', platform.machine())
import _bisect
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2014 Google, Inc.
# Copyright (c) 2013-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2014 Arun Persaud <arun@nubati.net>
# Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2015 Aru Sahni <arusahni@gmail.com>
# Copyright (c... |
import pandas as pd
from math import sin, cos, sqrt, asin, radians
#import ibm_db
def cal_dist(lon1, lat1, lon2, lat2):
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2
c = 2 * a... |
"""Support for AlarmDecoder-based alarm control panels (Honeywell/DSC)."""
import logging
import voluptuous as vol
from homeassistant.components.alarm_control_panel import (
FORMAT_NUMBER,
AlarmControlPanelEntity,
)
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright (c) 2011 University of Southern California / ISI
# 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 obta... |
# Copyright 2016 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 writing, ... |
"""
Test suite for django-elasticsearch.
"""
from django.test import TestCase
from testproj.myapp.models import Entry, Blog, StandardAutoFieldModel, Person, TestFieldModel, EModel
import datetime
import time
class DjangoESTest(TestCase):
# multi_db = True
# def test_add_and_delete_blog(self):
# blog1 = ... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.template import RequestContext, loader
from news.models import News
from slides.models import Slide
from django.http import HttpResponseRedirect
def home(request):
latest_news_list = News.objects.order_by('-publ... |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
import picpac
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_float('learning_rate', 0.01, 'Initial learning rate.')
flags.DEFINE_integer('max_step... |
from django.core.urlresolvers import reverse
from django.conf.urls import patterns, url
from django.views.decorators.cache import never_cache
from restlib2.params import Parametizer, BoolParam, StrParam
from avocado.models import DataContext, DataField
from avocado.query import pipeline
from .base import BaseResource, ... |
import json as jsonlib
import os
from pathlib import Path
from typing import Dict, NamedTuple, Union, TYPE_CHECKING
import urllib.request
import jsonschema
import yaml as yamllib
from lightbus.exceptions import UnexpectedConfigurationFormat
from lightbus.schema.hints_to_schema import python_type_to_json_schemas, SCHE... |
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import sys
import imp
imp.reload(sys)
try:
sys.setdefaultencoding('UTF8')
except Exception as E:
pass
import testValue
from popbill import StatementService, PopbillException
statementService = StatementService(testValue.LinkID,... |
#!/usr/bin/env python
import sys
from setuptools import setup, find_packages
from fabric.version import get_version
readme = open('README').read()
long_description = """
To find out what's new in this version of Fabric, please see `the changelog
<http://docs.fabfile.org/changes/%s.html>`_.
You can also install t... |
import datetime
class Token(object):
accessToken = None
refreshToken = None
generationDate = None
expiresIn = None # in seconds
type = None
userId = None
def __init__(self, userId, accessToken, refreshToken, type, expiresIn, generationDate=None):
self.userId = userId
s... |
from __future__ import absolute_import, division, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.wagtailadmin.edit_handlers import (
FieldPanel,
... |
import os
import unittest
from conans.client.cache.cache import ClientCache
from conans.client.tools import chdir
from conans.model.info import ConanInfo
from conans.model.ref import ConanFileReference
from conans.paths import (BUILD_FOLDER, CONANINFO, EXPORT_FOLDER, PACKAGES_FOLDER)
from conans.search.search import s... |
# unzipR - A library for recursively extracting files.
# Copyright (C) 2014 Stoney Jackson <dr.stoney@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... |
"""
Utility functions related to jGrid2
"""
import gdal
import numpy as np
import numpy.ma as ma
import rastercube.imutils as imutils
import rastercube.gdal_utils as gdal_utils
def fracs_for_poly_bbox_xy(header, polygon_xy):
"""
Returns fractions covered by the given polygon. This is based on the
polygon'... |
# Copyright 2013 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.
""" A simple device interface for build steps.
"""
import logging
import os
import re
import sys
from util import build_utils
BUILD_ANDROID_DIR = os.path... |
# -*- coding: utf-8 -*-
"""
First stage in flypy translation. Translates Python bytecode to untyped
pykit IR.
Initially adapted from flypypro/npm/symbolic.py by Siu Kwan Lam.
"""
from __future__ import print_function, division, absolute_import
import __builtin__
import inspect
import dis
import pprint
import operat... |
# download_HCP_1200.py
#
# Author: Joke Durnez (joke.durnez@gmail.com)
'''
This script downloads data from the Human Connectome Project - 1200 subjects release.
'''
# Import packages
import os
import tarfile
import shutil
SERIES_MAP = {
'MEG_unprocessed':'unprocessed/MEG/',
'3T_unprocessed':'unprocessed/3T/',
'7T_un... |
#
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
"""LALR(1) operations"""
import LR0
import LR1
import copy
from Common import *
de... |
"""
消防单位火灾风险预测
"""
import sys
import fire_risk.data_utils as fr
import sklearn.linear_model as lm
from sklearn.externals import joblib
# 读入配置参数
file_train_path, _, model_path, deadline, _, _ = fr.read_config(sys.argv[1])
# 导入数据
fire_data = fr.data_input_from_file(file_train_path)
# 对数据进行转换
fire_data = fr.DataTransla... |
"PubMed interface."
import json
import os
import os.path
import sys
import time
import unicodedata
import xml.etree.ElementTree
import requests
PUBMED_FETCH_URL = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&rettype=abstract&id=%s"
PUBMED_SEARCH_URL = "https://eutils.ncbi.nlm.nih.gov/entrez/... |
#!/usr/bin/env python
# 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.
"""Prints the total PSS attributed to another app in Chrome's mappings.
This script assumes a device with Monochrome, and requires roo... |
import os
import django
from django.conf import settings, global_settings
import oscar
def configure():
if not settings.configured:
from oscar.defaults import OSCAR_SETTINGS
# Helper function to extract absolute path
location = lambda x: os.path.join(
os.path.dirname(os.path.... |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from c... |
import pytest
from django.conf import settings
from django.core.urlresolvers import reverse
from .. import factories as f
from tests.utils import disconnect_signals, reconnect_signals
pytestmark = pytest.mark.django_db
def setup_module(module):
disconnect_signals()
def teardown_module(module):
reconnect_... |
import py
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr
from rpython.jit.metainterp.history import ResOperation, TargetToken,\
JitCellToken
from rpython.jit.metainterp.history import (ConstInt, ConstPtr, Const,
BasicFailDescr, BasicFinalDescr)
from... |
#!/usr/bin/python2.7
import subprocess
import atexit
import time
import boto3
def shell(command):
subprocess.call(command, shell=True)
class MessageQueue(object):
def __init__(self, name):
self.q = boto3.resource("sqs").
get_queue_by_name(QueueName=queue_name)
def __iter__(self):
... |
# -*- coding: utf-8 -*-
import ast
from _ast import AST
from blirgen import *
from astprint import to_source
from utils import anon
#------------------------------------------------------------------------
# Kernel Manipulation
#------------------------------------------------------------------------
IN = 0
OUT ... |
import os.path
from sentry.models import Activity
from sentry.services.smtp import SentrySMTPServer, STATUS
from sentry.testutils import TestCase
from sentry.utils.email import group_id_to_email, email_to_group_id
fixture = open(os.path.dirname(os.path.realpath(__file__)) + '/email.txt').read()
class SentrySMTPTest(... |
import collections
import optparse # using optparse as hyrda still python 2.6
import re
import sys
def report_error(error):
"""Prints the error, and exits -1"""
print error
sys.stderr.write(error)
sys.stderr.write("\n")
sys.stderr.flush()
sys.exit(1)
def clean_part(part, tab_replace=" "):
... |
def BFS(graph,root,k):
checked = []
visited=[]
level=[]
l=[]
l.append(root)
level.append(l)
count =0
checked.append(root)
while len(checked)>0:
v = checked.pop(0)
visited.append(v)
l=[]
for edge in graph[v]:
#l=list(set(graph[... |
# -*- coding: utf-8 -*-
# Copyright 2009-2017 Jaap Karssenberg <jaap.karssenberg@gmail.com>
# TODO: allow more complex queries for filter, in particular (NOT tag AND tag)
# allow multiple tabs in dialog / side pane with configurable query
#
# TODO: add an interface for this plugin in the WWW frontend
#
# TODO: ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
# python lib:
from datetime import date, timedelta
# django:
from django.db.models.functions import ExtractHour
from django.views.generic import ListView, DetailView
from django.conf import settings
from django.shor... |
import socket
import logging
logger = logging.getLogger("debugging")
def check_port(host, port_number, content=None):
logger.info(u"Port check, host: %s, port: %s, content: '%s'" % (host, port_number, content))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10)
# connect_ex retur... |
'''
Synk - Sublime Text Plugin
'''
import os
import socket
import sublime
import sublime_plugin
from threading import Thread, Timer
# variables for storing user defined settings
settings_filename = "synk_pre.sublime-settings"
enabled_field = "enabled"
server_ips_field = "project_server_ips" # NOTE: add feature ... |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import io
import six
import requests
from nose.tools import with_setup # type: ignore
from nose.tools import assert_raises # type: ignore
from nose.tools import raises # type: ign... |
"""
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
distri... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Severen Redwood <severen@shrike.me>
#
# 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 ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'NewLJ.ui'
#
# Created: Thu May 10 03:10:06 2012
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribute... |
# -*- coding: utf-8 -*-
#
# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 pywws 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... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import re
import sys
from getpass import getpass
import os
import copy
import random
import time
import datetime
import json
import argparse
import requests
import urllib
import hashlib
import select
from mutagen.id3 import ID3,TRCK,TIT2,TALB,TPE1,APIC,TDRC,COMM,TPOS,USLT... |
# coding=utf-8
import base64
import tornado.ioloop
import tornado.web
from tornado.web import _create_signature_v1, _time_independent_equals
import tornado.gen
import tornado.httpclient
import tornado.escape
from tornado.escape import utf8
from tornado.concurrent import Future
from qr import get_qrcode
import uuid
imp... |
# -*- coding: utf-8 -*
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ListProperty, ObjectProperty
from components.touch_selector import TouchSelector
from components.bubble_buttons import BubbleButtons
from layout.image_layout import ImageLayout
from kivy.uix.button import Button
class EditI... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from django.contrib.auth import logout
from django.conf import settings
from django.contrib.auth.models import User
from tendenci.apps.site_settings.utils import get_setting
class ProfileMiddleware(object):
"""
Appends a profile instance to anonymous users.
Creates a profile for logged in users w... |
from typing import Generator, List, Optional, Type
from iota.crypto.kerl import Kerl
from iota.crypto.signing import validate_signature_fragments
from iota.transaction.base import Bundle, Transaction
__all__ = [
'BundleValidator',
]
# In very rare cases, the IOTA protocol may switch hash algorithms.
# When this ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-04 14:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
#!/usr/local/lib/python2.6
import re
import sys
filename = sys.argv[1]
def generate_string_features(word, label):
dict = {}
'''
patterns = ['\d$', '\d\d$', '\d\d\d+$', '\d?\d?:\d\d$',
'[0-9:]+$', '[A-Z]', '[A-Z]$', '[A-Z][A-Z]$',
'[A-Z]+$', '[^0-9A-Za-z]+$', '[^0-9]+$'... |
"""empty message
Revision ID: 399106d8a6ad
Revises: None
Create Date: 2015-03-06 03:55:19.157958
"""
# revision identifiers, used by Alembic.
revision = '399106d8a6ad'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... |
# Copyright 2014-2016 Morgan Delahaye-Prat. All Rights Reserved.
#
# Licensed under the Simplified BSD License (the "License");
# you may not use this file except in compliance with the License.
"""Test basic CRUD operations of the CRUDProvider."""
import json
import pytest
from hypr.providers import CRUDProvider
d... |
"""Formats domain objects for route responses."""
from collections import OrderedDict
from flask import url_for
from ._bases import Formatter
# TODO: figure out a better way to serialize objects without parent objects
# pylint: disable=arguments-differ
class GameFormatter(Formatter):
"""Serializes games into... |
# Copyright (c) 2003-2016 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Author: Alberto Solino (@agsolino)
#
# Description:
# [MS-VDS]: Virtual Disk Service (VDS) Protocol... |
import uuid, datetime
from os.path import join
from shutil import rmtree
from daisyproducer.documents.storage import OverwriteStorage
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.db import models
from django.db.models import Max
from django.forms import ModelForm
from... |
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 yo... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FilerFileItem'
db.create_table(u'contentitem_file_filerfi... |
"""Field validators."""
import re
from django.core.exceptions import ValidationError
from django.core.validators import EmailValidator, URLValidator
from django.utils.translation import ugettext_lazy
class HostnameValidator(object):
"""Validator for fqdn."""
message = ugettext_lazy("Enter a valid domain n... |
"""Module to run the amore rotation search"""
__author__ = "Adam Simpkin & Felix Simkovic"
__date__ = "15 April 2018"
__version__ = "0.4"
import glob
import logging
import os
import shutil
import uuid
logger = logging.getLogger(__name__)
import pyjob
from pyjob.script import ScriptCollector, Script
import simbad.d... |
"""
Tutorial 3: Applet- and macro signatures.
"""
# Import the module with the global variables and the macro base class.
import qtmacs.qte_global as qte_global
from qtmacs.base_macro import QtmacsMacro
from qtmacs.base_applet import QtmacsApplet
from PyQt4 import QtGui
# Get a reference to the main instance of Qtmac... |
"""
Test use-case when client attempts to call an unsubscribed contact. Gabble
should ask them to "de-cloak".
"""
from gabbletest import exec_test
from servicetest import (make_channel_proxy, call_async, sync_dbus,
assertEquals, assertLength)
import jingletest
import dbus
from twisted.words.xish import xpath
... |
from django.shortcuts import render
from django.views.generic.base import TemplateView
from area.forms import AreaForm, LocationForm, BuildingForm
from area.models import Area, Location, Building
from django.http import HttpResponseRedirect
import logging
# GET /areas
class ListAreaView(TemplateView):
template_nam... |
# -*- coding: utf-8 -*-
"""
Modulo che gestisce le configurazioni del gioco.
Viene caricato il file di configurazione passato alla funzione start_mud nel
modulo engine.
"""
#= IMPORT ======================================================================
import ConfigParser
import sys
from src.color import check_c... |
from setuptools import setup
version = '0.5.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'setuptools',
'pyproj',
],
tests_require = [
'nose',
'coverage',
]
setup(name='sufrib... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
import datetime
from managers import VoteManager
class Vote(models.Model):
content_type = models.ForeignKey(ContentType, related_n... |
#!/usr/bin/env python
#
# Copyright (c) 2016, 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
# ... |
# Copyright 2018 Google LLC.
#
# 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 notice,
# this list of conditions and the following disclaimer.
#
#... |
import discord
import asyncio
from numpy import random
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith('erp with me pimbot'):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.