src
stringlengths
721
1.04M
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File Name: MLP.py Author: Kerry Mail: yuyao90@gmail.com Created Time: 2016年10月18日 星期二 11时28分14秒 Description: 多层感知器,一种监督式神经网络算法,可以用来做分类(2分类,多分类,多标签分类)和回归, 主要取决于在output layer使用的激活函数(logistic、softmax、identity)。参数优化的算法为误差反向传导 方法,具体的支持使用多种SGD方式(mini_batch)。 Referenc...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of mtgsdk. # https://github.com/MagicTheGathering/mtg-sdk-python # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2016, Andrew Backes <backes.andrew@gmail.com> from mtgsdk.restclient import RestClient f...
#SBaaS from .stage02_physiology_pairWiseTest_postgresql_models import * from SBaaS_base.sbaas_base import sbaas_base from SBaaS_base.sbaas_base_query_update import sbaas_base_query_update from SBaaS_base.sbaas_base_query_drop import sbaas_base_query_drop from SBaaS_base.sbaas_base_query_initialize import sbaas_base_qu...
# pylint: disable=no-self-use,invalid-name import numpy from keras.layers import Input from keras.models import Model from deep_qa.layers.entailment_models import MultipleChoiceTupleEntailment from deep_qa.layers.time_distributed_embedding import TimeDistributedEmbedding class TestTupleAlignment: def test_tuple_a...
""" """ import glob import os class DatasetsManager(object): def __init__(self, logger, ids): self.ids = ids self.logger = logger self.fastq_collection = dict() self.fastq_counter = 0 def collect_fastq_from_fs(self, base_path): results = dict() count = 0 ...
#!/usr/bin/env python # Copyright 2015 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. import os import sys import unittest sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.path.pardir)) from bisect_tester i...
from sys import maxint from expects import expect, be_true, raise_error from random import randint from bankbarcode.bankbarcode import BankBarcode with description('Check input values'): with context('Length value checker'): with before.all: self.name = 'foo' self.description = 'b...
""" URLconf for registration and activation, using django-registration's default backend. If the default behavior of these views is acceptable to you, simply use a line like this in your root URLconf to set up the default URLs for registration:: (r'^accounts/', include('registration.backends.default.urls')), Thi...
import json from urllib import parse from tornado.httpclient import HTTPClient class LogClient(object): """ Client to send and retrieve logs """ def __init__(self, uri, cluster): self.uri = uri self.cluster = cluster def send(self, text): """ Send a log line to th...
from django.shortcuts import render from django.http import HttpResponseRedirect, Http404 #from django.core.ulresolvers import reverse from django.core.urlresolvers import reverse #form django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required from .models import To...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
""" Coinbase Python Client Library AUTHOR Kevin Roberts Github: Kevin-Roberts Started on: 12-11-2013 LICENSE (The MIT License) Copyright (c) 2013 Kevin Roberts "kr0b1486@hotmail.com" Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t...
class Being(): def __init__(self, base_line_1, body1, base_line_2, body2, wounds_table, fate_table): self.base_line_1 = base_line_1 self.body1 = body1 self.base_line_2 = base_line_2 self.body2 = body2 self.wounds_table = wounds_table self.fate_table = fate_table cla...
# -*- coding: ascii -*- u""" :Copyright: Copyright 2017 Andr\xe9 Malo or his licensors, as applicable :License: 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/lic...
#!/usr/bin/env python """ Get files from a remote server (to be reached by nfs, samba, ftp, html or local directory) file content is directly added to a data bank (or local file if preferred). """ from __future__ import print_function from magpy.stream import * from magpy.database import * from magpy.opt import cred...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
# -*- coding: utf-8 -*- """ redis lua redis eval, notyify in lua script """ import time import redis def main(key, val, key2, val2): # connection pool r = redis.Redis(host='localhost', port=6379, db=5) d = {"a":"v1"} """ eval("lua script","number of kkeys", keys[],argv[]) KEYS[...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import codecs import datetime import locale from decimal import Decimal from django.utils import six from django.utils.functional import Promise from django.utils.six.moves.urllib.parse import quote, unquote if six.PY3: from urllib.parse import un...
''' This is a wrapper for the networkx graphml read/writer so that the GNA can read a graphml file with multiple graphs. The current networkx read_graphml only returns the first element in the graph list that is returned by the graphMLReader class. ''' import networkx.readwrite.graphml as ml def read_graphml(path,no...
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013 # Copyright (c), Toshio Kuratomi <tkuratomi@ansible.com> 2016 # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) from __future__ import absolute_import, division, print_function SIZE_RANGES = ...
# The contents of this file are subject to the Common Public Attribution # License Version 1.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://code.reddit.com/LICENSE. The License is based on the Mozilla Public # License Version 1.1, ...
__author__ = 'mouton' from triggerExpressions import Evaluation from unittest import TestCase from math import pi, sqrt, atan from arithmeticExpressions import ALitteral, Func, UndefinedLitteral, SelfLitteral from database import Variable class TestAtan(TestCase): @classmethod def setUpClass(cls): i...
# Copyright 2021 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...
# -*- coding: utf-8; mode: Python; -*- from __future__ import unicode_literals import json from django.test import TestCase from bckt.models import Bckt from django.contrib.auth.models import User from django.contrib.auth.hashers import make_password from tests.test_bckt.utils import create_bckt class BcktTest(TestC...
#-*- coding:utf-8 -*- # # Copyright (C) 2012 - Jens Knutson <jens.knutson at gmail dot com> # This software is licensed under the GNU General Public License # version 3 or later (see the file COPYING). #pylint: disable-msg=W0201 """Collection of "manager" classes, which handle various aspects of Fluidity.""" from __fut...
# Copyright 2011 OpenStack Foundation # 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 requ...
#!/usr/bin/env python3 """ > filter_miscalled_Cs.py < Script to process the .cov files produced by bismark_methylation_extractor, and removes methylated positions that potentially arise by chance. A super-conservative estimate of 1% miscall rate is assumed (might be as low as 0.1%, evidenced by the CHG and CHH call ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
""" Admin classes for base_page related models """ from django.contrib.gis import admin from django.core.urlresolvers import reverse_lazy from base_page.forms import OrganizationSettingForm from base_page.models import Feedback from base_page.models import OrganizationSetting from django.conf import settings from model...
#!/usr/bin/python # # Hey, here's a thing: # # You can use this bit of python script to generate GCode to drill a PCB based on an image file that you used # to etch the board. # # This script makes GCode to drill the center of sections of an image that are a given color or brightness. # # All you need to do is load the...
import unittest from datetime import date, time from django.db import IntegrityError from django.test import TestCase import factories as f from volunteering.models import (Activity, Assignment, Attribute, Campaign, Duty, Event, Location, Sendable, TriggerBase, ...
from django_webtest import WebTest from candidates.tests.factories import MembershipFactory, PostFactory from candidates.tests.uk_examples import UK2015ExamplesMixin from people.models import PersonIdentifier from people.tests.factories import PersonFactory class TestPartyPages(UK2015ExamplesMixin, WebTest): def...
from time import gmtime, strftime from data_types import * from packet_structs import * import packet_extensions class Packet: def __init__(self, **kargs): self.ident = kargs.get('ident', 0) self.direction = kargs.get('direction', CLIENT_TO_SERVER) self.data = kargs.get('data', {}...
import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit from ckan.plugins.toolkit import asbool import jieba import jieba.analyse from ckan.plugins.toolkit import request, c import pylons.config as config import opencc class Data_RecommendationPlugin(plugins.SingletonPlugin): plugins.implements(plugi...
# -*- coding: utf-8 -*- # Copyright 2016 Onestein (<http://www.onestein.eu>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from dateutil.relativedelta import relativedelta from odoo import api, fields, models from odoo.exceptions import UserError from odoo.tools.translate import _ class HrHol...
from django.db import models class Locatie(models.Model): def __str__(self): return self.naam naam = models.CharField(max_length=200) lat = models.FloatField() long = models.FloatField() class Meta: verbose_name_plural = 'locaties' class Dag(models.Model): def __str__(self): ...
#import jsonlib2 import globalsObj import logging import traceback import tornado.web #import ujson #import simplejson import jsonpickle import uuid class Result(object): def __init__(self, **kwargs): #self.rootLogger = logging.getLogger('root') for name, value in kwargs.items(): exec(...
# Author: Travis Oliphant # 1999 -- 2002 from __future__ import division, print_function, absolute_import import warnings from . import sigtools from scipy.lib.six import callable from scipy import linalg from scipy.fftpack import fft, ifft, ifftshift, fft2, ifft2, fftn, \ ifftn, fftfreq from num...
# !/usr/bin/env python3 # -*- encoding: utf-8 -*- """ ERP+ """ __author__ = 'CVTek dev' __credits__ = [] __version__ = "1.0" __maintainer__ = "CVTek dev" __status__ = "Development" __model_name__ = 'gap_senha_config.GAPSenhaConfig' import auth, base_models from orm import * from form import * class GAPSenhaConfig(Mod...
''' Clipboard ========= Core class for accessing the Clipboard. If we are not able to access the system clipboard, a fake one will be used. Usage example:: >>> from kivy.core.clipboard import Clipboard >>> Clipboard.get_types() ['TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TARGETS', 'UTF8_STRING', 'COMP...
from django.db import models from mptt2.models import MPTTModel from mptt2.managers import TreeManager class CustomTreeManager(TreeManager): pass class Category(MPTTModel): name = models.CharField(max_length=50) parent = models.ForeignKey('self', null=True, blank=True, related_name='children') def...
# -*- coding: utf-8 -*- """ Created on Tue Oct 18 10:38:03 2016 @author: Vipul Munot """ tennis=[line.strip().split(',') for line in open('tennis.txt')] test_tennis=[line.strip().split(',') for line in open('test-tennis.txt')] data=[['slashdot','USA','yes',18,'None'], ['google','France','yes',23,'Premium'], ...
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse, Http404 from django.db.models import Count from modem import list_devices from humod.siminfo import ( show_operator, show_phone_no, full_sms_list, BOXES, system_info, seq ) from sms.models import * from sms.fo...
import shutil import logging import os import io try: from urllib.request import urlopen except ImportError: from urllib import urlopen from django.template.defaultfilters import slugify from django.db import transaction import networkx as nx import unicodecsv from .models import Entity, EntityType, Relatio...
# Copyright (c) 2016-2017 Chris Fournier. All rights reserved. # Use of this source code is governed by a MIT-style license that can be found # in the LICENSE file. import codecs import important.__main__ import os import pytest import re import socket import tempfile from configparser import ConfigParser from click.t...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import pycurl from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns from module.common.json_layer import json_loads from module.network.Browser import Browser from module.network.CookieJar import CookieJar class Custom...
from pywsd.lesk import adapted_lesk from nltk.corpus import wordnet as wn import pickle import time import sys def main(file_name): start = time.time() #string = '/home/adriana/Dropbox/mine/Tese/preprocessing/data_output/' #string = '/home/aferrugento/Desktop/' string = '' h = open(string + file_name + '_proc.txt...
quantity_qualifier = { "01": "Discrete Quantity", "02": "Cumulative Quantity", "03": "Discreet Quantity - Rejected Material", "04": "Discrete Quantity - Rejected Material: Disposition Replacement", "05": "Discrete Quantity - Rejected Material: Disposition Credit", "06": "Discrete Quantity - Reje...
""" Django settings for DormitoryDollars project. Generated by 'django-admin startproject' using Django 1.10.4. 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/ """ ...
# # Copyright (C) 2012 Adam Litke, IBM Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is...
# # Copyright (C) 2013-2015 RoboIME # # 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 program is distrib...
#! /usr/bin/env python isMac = True try: import Foundation except ImportError: isMac = False import Twitch import Tkinter import os def setButtons(s): copyButton.config(state=s) qtpButton.config(state=s) vlcmacButton.config(state=s) def submit(): try: channel = channelEntry.get() data = Twitch.grab(channe...
# # Copyright 2013 © Nguyễn Hà Dương (cmpitgATgmailDOTcom) # # This file is part of Blutkit. # # Blutkit 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) a...
# Copyright 2011 OpenStack Foundation # 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 requ...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2013, Nahuel Riva # 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 copyrigh...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): """ Default the criterion and option labels to the same value as "name". """ for criterion in orm...
import datetime import time from xml.etree import ElementTree data_converters = { 'integer': int, } class DataSet(list): """docstring for DataSet""" def __init__(self, raw_xml): list.__init__(self) self.raw_xml = raw_xml xml_tree = ElementTree.fromstring(self.raw_xml) self....
from typing import List # The function first discards as many whitespace characters as # necessary until the first non-whitespace character is found. # Then, starting from this character, takes an optional initial # plus or minus sign followed by as many numerical digits as possible, # and interprets them as a numeri...
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. import os import glob import time import shutil import rpmfluff from d...
#!/usr/bin/python import os import struct from cStringIO import StringIO from mapgang.constants import METATILE, META_MAGIC class MetaTile(): def __init__(self, style, x, y, z): self.style = style self.x = x self.y = y self.z = z self.content = StringIO() m2 = METAT...
from argparse import ArgumentParser import os import sys from .exporters import BrowserPDFExporter APP_ROOT = os.path.join(os.path.dirname(__file__)) def export(ipynb=None, outfile=None): exp = BrowserPDFExporter( template_file="browserpdf", template_path=[os.path.join(APP_ROOT, "templates")] ...
"""Pseudo terminal utilities.""" # Bugs: No signal handling. Doesn't set slave termios and window size. # Only tested on Linux. # See: W. Richard Stevens. 1992. Advanced Programming in the # UNIX Environment. Chapter 19. # Author: Steen Lumholt -- with additions by Guido. from select import select imp...
# -*- coding: utf-8 -*- from __future__ import absolute_import import errno import os import socket import sys from . import TTransportBase, TTransportException class TSocketBase(TTransportBase): def _resolveAddr(self): if self._unix_socket is not None: return [(socket.AF_UNIX, socket.SOCK_...
# Copyright (C) 2007, One Laptop Per Child # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distrib...
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel 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 ...
#import pdb # pause code for debugging at pdb.set_trace() import numpy as np import toolbox as tool import slab_functions as sf from pysac.plot.mayavi_seed_streamlines import SeedStreamline import matplotlib.pyplot as plt from mayavi import mlab import gc #import move_seed_points as msp import mayavi_plotting_function...
from django.db import models from django.core.urlresolvers import reverse from ckeditor.fields import RichTextField from panya.models import ModelBase PROVINCES = ( ('Eastern Cape', 'Eastern Cape'), ('Free State', 'Free State'), ('Gauteng', 'Gauteng'), ('KwaZulu-Natal', 'KwaZulu-Natal'), ('Limpopo...
from Quartz.CoreGraphics import CGEventCreateMouseEvent from Quartz.CoreGraphics import CGEventPost from Quartz.CoreGraphics import kCGEventMouseMoved from Quartz.CoreGraphics import kCGEventLeftMouseDown from Quartz.CoreGraphics import kCGEventLeftMouseUp from Quartz.CoreGraphics import kCGEventRightMouseDown from Qua...
# This code is part of Donkey project. # # Copyright (c) 2014 Alexander Lokhman <alex.lokhman@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 witho...
import sys, os, shutil import os.path as path import lxml.etree as et # print helpful message if len(sys.argv) != 4: print "[info] usage: python olxextract.py [unzipped course folder] [new course partial folder] [chapter/sequential/vertical]" sys.exit(0) # grab the directory of course and update course = sy...
from abc import ABCMeta, abstractmethod class Vehiculo(metaclass=ABCMeta): @abstractmethod def traslado(self): pass def __str__(self): return "" class Automovil(Vehiculo): def __init__(self, color, marca, desplasamiento, medicionVelocidad): self._color = color self._mar...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ A "grab bag" of relatively small general-purpose utilities that don't have a clear module/package to live in. """ import abc import copy import contextlib import difflib import inspect import json import os import signal import...
import six import re from contextlib import contextmanager from functools import wraps from inspect import getdoc from .errors import NoMatch from .tokens import END @contextmanager def _savestate(tokens): tmp = tokens._curr try: yield except NoMatch: tokens._curr = tmp def parsnip(doc=...
import tensorflow as tf import sonnet as snt from utils.data_utils import * from utils.method_utils import compute_sq_distance class RNN(): def __init__(self, init_with_true_state=False, model='2lstm', **unused_kwargs): self.placeholders = {'o': tf.placeholder('float32', [None, None, 24, 24, 3], 'observa...
from otp.ai.AIBaseGlobal import * from direct.distributed.ClockDelta import * from otp.avatar import DistributedAvatarAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals class DistributedCCharBaseAI(DistributedAvatarAI.DistributedAvatarAI): notify = DirectNotifyGloba...
# vim:fileencoding=utf-8 import argparse import logging import os import sys from . import __version__ from .client import delete_host from .junkdrawer import HelpFormatter USAGE = """%(prog)s [options] Unregister host(s) in tory. """ EPILOGUE = """\ Examples: # Unregister a machine by name %(prog)s --name foo-ba...
"""Check that required Docker images are available.""" from openshift_checks import OpenShiftCheck from openshift_checks.mixins import DockerHostMixin NODE_IMAGE_SUFFIXES = ["haproxy-router", "docker-registry", "deployer", "pod"] DEPLOYMENT_IMAGE_INFO = { "origin": { "namespace": "openshift", "na...
#!/usr/env python # -*- coding: utf-8 -*- __author__ = 'adley' import unittest import os from .. import settings here = os.path.abspath(os.path.dirname(__file__)) data_path = os.path.join(here, "../fixtures/") data_file = os.path.join(data_path, 'users/admin.json') class TestAttributesBlacklist(unittest.TestCase): ...
#---------------------------------------------------------------------- # Name: wxPython.lib.filebrowsebutton # Purpose: Composite controls that provide a Browse button next to # either a wxTextCtrl or a wxComboBox. The Browse button # launches a wxFileDialog and loads the resu...
#! /usr/bin/python3 # Command line program to create svg apollonian circles # Copyright (c) 2014 Ludger Sandig # This file is part of apollon. # Apollon 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...
# -*- coding: utf-8 -*- # Copyright 2014 Mirantis, 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 requi...
# Author: Nic Wolfe <nic@wolfeden.ca> # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License,...
#! /usr/bin/env python3 import WrightTools as wt from WrightTools import datasets from matplotlib import pyplot as plt import shutil import os def test_plot(): p = datasets.wt5.v1p0p1_MoS2_TrEE_movie p = shutil.copy(p, "./test_plot.wt5") data = wt.open(p) os.unlink(p) data.level(0, 2, -3) da...
import requests import json import hashlib # used to generate the key for the insert import base64 def req_auth(): # request authorization auth_code = base64.b64encode('2b9b835a9d2d45eab79778233e9142e4:6783d4b5790a4f5aaa94b863c30fc215') headers = {'Authorization': 'Basic ' + auth_code} auth_url = 'ht...
from __future__ import (absolute_import, print_function, division) import os import select import socket import sys import threading import time import traceback import binascii from six.moves import range import certifi from backports import ssl_match_hostname import six import OpenSSL from OpenSSL import SSL from ...
from __future__ import unicode_literals, division, absolute_import from flask import request from flask.ext.login import current_user from flexget.api import api, APIResource from flexget.webserver import change_password, generate_token, WeakPassword user_api = api.namespace('user', description='Manage user login cr...
#!/usr/bin/python3 """Define a PGPWords object inherited from bytearray. Adding initialization via hex-, or pgp-word-string, adding .hex() method and overriding __str__ Mainline code: Convert pgp words to hex strings and vice versa. Example: $ pypgpwords.py DEAD 1337 tactics perceptive Aztec consensus or $ ...
# Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8')...
# -*- coding: utf-8 -*- """Generic EMAIL client factory .. module:: network.email.client :platform: Unix :synopsis: Generic EMAIL client factory .. moduleauthor:: Petr Rašek <bowman@hydratk.org> """ from hydratk.core.masterhead import MasterHead from importlib import import_module protocols = { 'SMTP': 's...
from __future__ import unicode_literals from future.builtins import str from future.utils import native, PY2 from io import BytesIO import os from string import punctuation from zipfile import ZipFile from django.core.files.base import ContentFile from django.core.files.storage import default_storage from ...
from datetime import datetime from dateutil.tz import tzutc import dateutil.parser import re import json from mtools.util.pattern import json2pattern class DateTimeEncoder(json.JSONEncoder): """ custom datetime encoder for json output. """ def default(self, obj): if isinstance(obj, datetime): ...
# Copyright (c) 2001-2016, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public tr...
from __future__ import division, absolute_import, print_function import sys import warnings from decimal import Decimal import numpy as np from numpy.testing import * assert np.einsum is not None class TestEinSum(TestCase): def test_einsum_errors(self): # Need enough arguments assert_raises(Valu...
import traceback import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import requests import re import base64 from cryptography.hazmat.primitives.ciphers.aead import AESGCM from typing import Dict, Tuple, List, Optional class Scopes: graph = 'https://graph.microsoft...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # thug documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # 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 # autoge...
from MuVisitor import MuVisitor from MuParser import MuParser from enum import Enum class MuTypeError(Exception): pass class BaseType(Enum): Float, Integer, Boolean, String, Nil = range(5) def printBaseType(self): print(self) # Basic Type Checking for Mu programs. class MyMuTypingVisitor(MuV...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015-2018 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in ...
from datetime import date from database import db class Cron(db.Model): """ Manages pseudo-cron """ __tablename__ = 'cron' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64)) date_updated = db.Column(db.Date) # _search_on = 'name' def __init__(self, name): ...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
"""Subscribe to RabbitMQ and listen for purge instructions continuously. Manage this script through eg. supervisor.""" import json import traceback from multiprocessing.pool import ThreadPool from optparse import OptionParser from time import sleep import pika import requests import yaml class Consumer: channe...