src
stringlengths
721
1.04M
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, cint, nowdate, add_days, comma_and from frappe import msgprint, _ from frappe.model.document impo...
""" sentry.web.frontend.admin ~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import functools import logging import sys import uuid from collections import def...
# -*- coding: utf-8 -*- #MIT License #Copyright (c) 2017 Marton Kelemen #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, c...
############################################################################### ## ## Copyright 2011,2012 Tavendo GmbH ## ## 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:...
import requests import os import zipfile import StringIO import glob import shapefile import tempfile import json def point_inside_polygon(x,y,poly): """Return True if the point described by x, y is inside of the polygon described by the list of points [(x0, y0), (x1, y1), ... (xn, yn)] in ``poly`` Co...
# Justin Tulloss # # Putting user in its own file since it's huge import logging from pylons import cache, request, session, c from pylons.templating import render from decorator import decorator from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Table, sql from sqlalchemy.sql impo...
from django.core.urlresolvers import resolve from django.test import TestCase class AtlasUrlTestCase(TestCase): def test_all_concepts(self): found = resolve('/concepts') self.assertEqual(found.view_name, 'all_concepts') def test_all_tasks(self): found = resolve('/tasks') self.a...
"""Constants and routines for handling advisory postgres locks.""" import mediawords.db from mediawords.util.log import create_logger from mediawords.util.perl import decode_object_from_bytes_if_needed log = create_logger(__name__) """ This package just has constants that can be passed to the first value of the post...
#!/bin/python import logging import unittest WEIGHT = 0 VALUE = 1 ITEMS_LIST = 2 def calc_items_to_take(items_list, weight): weight_list = [] # (weight, value, items_list) for current_weight in xrange(0, weight+1): total_weight = 0 total_value = 0 taken_items_list = [] max_...
""" Version management with versioneer https://github.com/warner/python-versioneer Distribution through PyPI 1: git tag 0.6.31 2: python setup.py register sdist upload Distributiuon through github (i.e. users use github to generate tarballs with git archive) 1: git tag 0.6.31 2: git push; git push -...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # DPLib documentation build configuration file, created by # sphinx-quickstart on Wed Jun 28 11:28:21 2017. # # 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 # auto...
# # pull data from sql, plot using matplotlib # see http://stackoverflow.com/questions/18663746/matplotlib-multiple-lines-with-common-date-on-x-axis-solved # # rev 1.0 12/02/2013 WPNS built from GraphAirmuxSD.py V1.1 # rev 1.1 12/02/2013 WPNS remove large delta values # rev 1.2 12/02/2013 WPNS remove -0.1 values (faile...
# -*- coding: utf-8 -*- TONES = ( (0, u'轻声'), (1, u'一声'), (2, u'二声'), (3, u'三声'), (4, u'四声') ) INITIALS = ( ('b', 'b'), ('p', 'p'), ('m', 'm'), ('f', 'f'), ('d', 'd'), ('t', 't'), ('n', 'n'), ('l', 'l'), ('g', 'g'), ('k', 'k'), ('h', 'h'), ('j', 'j')...
from __future__ import division import os, sys, copy from time import time from physicsTable import * from physicsTable.constants import * import numpy as np import scipy as sp import pygame as pg R = -5 G = -10 W = -1 FL = 1 CL = 0 def pointInRect(pt, ul, br): wl, wu = ul wr, wb = br r = pg.Rect(wl,wu,wr...
""" Build script for the PCP python package """ # # Copyright (C) 2012-2014 Red Hat. # Copyright (C) 2009-2012 Michael T. Werner # # This file is part of the "pcp" module, the python interfaces for the # Performance Co-Pilot toolkit. # # This program is free software; you can redistribute it and/or modify it # under th...
#!/usr/bin/env python import time import StringIO from threading import Thread from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from SocketServer import ThreadingMixIn import cv2 import numpy from PIL import Image class DummyStream: def __init__(self): self.stopped = False self._fr...
""" Contains a tornado-based WebSocket server in charge of supplying connected clients with live or replay data. """ import tornado.ioloop import tornado.web import tornado.websocket from collections import deque from pprint import pprint import json from .config import CACHE_SIZE, PORT, FREQUENCY from groundstat...
import json import requests from django.http import JsonResponse, HttpResponse from django.shortcuts import render from django.views.generic import View from .forms import ToneForm # Create your views here. class IndexView(View): form = ToneForm template = 'bots/index.html' def get(self, request): context = { ...
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sets/ # # Code is licensed under MIT license. # import re import urllib.request, urllib.parse, urllib.error import random from html.entities...
""" * Test whether multiple recvs on the same connection (non-blocking) will eventually have the connection closed (use another net instance.) * Test whether multiple sends on the same connection (non-blocking) will eventually lead to the connection being closed (use a net instance with no recvs! and loop over the ...
# -*- coding: utf-8 -*- """ flask_marshmallow.fields ~~~~~~~~~~~~~~~~~~~~~~~~ Custom, Flask-specific fields. See the following link for a list of all available fields from the marshmallow library. See http://marshmallow.readthedocs.org/en/latest/api_reference.html#module-marshmallow.fields """ im...
from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User from datetime import datetime class AppUser(models.Model): user = models.OneToOneField(User) age = models.IntegerField(null=True) birthday = models.DateField(null=True) profile_pi...
import gym, os, time, json, random, sys import tensorflow as tf import numpy as np from agents import make_agent, get_agent_class from hpsearch.hyperband import Hyperband, run_params from hpsearch import fullsearch from hpsearch import randomsearch dir = os.path.dirname(os.path.realpath(__file__)) flags = tf.app.fla...
""" An set of status exception classes to be used when an NiFpga function returns either a warning or error status. Use check_status() to raise an appropriate exception if necessary. Error and Warning exception class names are auto-generated from the strings in 'codeToString' in this file. For example, handle a fatal...
import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.zone_airflow import ZoneCrossMixing log = logging.getLogger(__name__) class TestZoneCrossMixing(unittest.TestCase): def setUp(self): self.fd, self.path = tempfile.m...
# -*-coding:utf-8 -*- from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from config.conf import get_db_args # for proxy database from config.conf import get_proxy_db_args # end def get_engine(): args = get_db_args() c...
# -*- coding: utf-8 -*- # # 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 configuration values have a default; values that are commented out # serve to show the default. import sys # ...
#! /usr/bin/env python import sys,os import re import codecs import helper ads_fields={'R': 'Bibliographic Code', 'A': 'Author List', 'a': 'Book Authors', 'F': 'Author Affiliation', 'J': 'Journal Name', 'V': 'Journal Volume', 'D': 'Publication Da...
import random import numpy import pysam import sys from intervaltree import Interval, IntervalTree from intervaltree_bio import GenomeIntervalTree class Amplicon: ampID="" chr="" ampS=0 inS=0 inE=0 ampE=0 gene="" trans="" exon="" pool="" datType="" mappedReadList=[] ...
#!/usr/bin/env python3 from setuptools import setup, find_packages setup( name='directory-tools', version='0.1.0', description='Manage OpenLDAP users and groups.', url='https://github.com/FunTimeCoding/directory-tools', author='Alexander Reitzel', author_email='funtimecoding@gmail.com', lic...
from __future__ import absolute_import from celery import shared_task from ygo_cards.models import Card, CardVersion, CardSet, UserCardVersion from ygo_core.utils import process_string, slugify from ygo_variables.models import Variable import unirest import urllib from ygo_cards.utils import sn_has_language_code, sn_n...
# ThotKeeper -- a personal daily journal application. # # Copyright (c) 2004-2021 C. Michael Pilato. All rights reserved. # # By using this file, you agree to the terms and conditions set forth in # the LICENSE file which can be found at the top level of the ThotKeeper # distribution. # # Website: http://www.thotkeepe...
#!/usr/bin/python3 import time import glob import ephem import subprocess from pathlib import Path import os from amscommon import read_config video_dir = "/mnt/ams2/SD/" hd_video_dir = "/mnt/ams2/HD/" def parse_date (this_file): el = this_file.split("/") file_name = el[-1] file_name = file_name.replace("_"...
# 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/. """skillcheck.py: """ from sys import argv import csv import eveapi_simple as api from evestatic import StaticDB sdb ...
#!/usr/bin/env python # preprocess.py - Preprocess the data # Common imports import os import sys import time import numpy import csv from sklearn.preprocessing import normalize # Imorts from other custom modules def load_set(file): X = list() Y = list() filehandle = open(file, 'r') reader = csv.reader(filehan...
# event/attr.py # Copyright (C) 2005-2018 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Attribute implementation for _Dispatch classes. The various listener targets for a...
#!python3 from blackmamba.uikit.picker import PickerView, PickerItem, PickerDataSource import editor import console import os import jedi from blackmamba.config import get_config_value import blackmamba.log as log import blackmamba.ide.source as source import blackmamba.ide.tab as tab class LocationPickerItem(Picker...
# -*- coding: utf-8 -*- snp_check={ "rs1042713":["A","G"], "rs1050152":["C","T"], "rs1051266":["C","T"], "rs1136410":["A","G"], "rs1229984":["C","T"], "rs1234315":["C","T"], "rs12720461":["C","T"], "rs13306517":["A","G"], "rs1544410":["C","T"], "rs16944":["A","G"], "rs1695":["A","G"], "rs1799724":["C","T"], "rs1799782"...
# ~*~ coding: utf-8 ~*~ import os import shutil from collections import namedtuple from ansible import context from ansible.module_utils.common.collections import ImmutableDict from ansible.executor.task_queue_manager import TaskQueueManager from ansible.vars.manager import VariableManager from ansible.parsing.datal...
''' Created on 2016 @author: camilothorne ''' #import re, string, array from subprocess import call import os class SaveStat: # path : path to report file # plotfile : path to the plots # tables : path to the table # constructor def __init__(self,table,plotfi...
#!/usr/bin/env python3 import sys from Bio import SeqIO def read_uc (filename, origins): # Init true_clusters = [] clusters = {} read_clusters = {} lines = {} treated = {} # File reading with open(filename) as fp: for line in fp: # Line reading split = line.strip().split("\t") line_type, cluster_i...
import warnings from canvasapi.assignment import Assignment, AssignmentGroup from canvasapi.blueprint import BlueprintSubscription from canvasapi.canvas_object import CanvasObject from canvasapi.collaboration import Collaboration from canvasapi.course_epub_export import CourseEpubExport from canvasapi.custom_gradebook...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from .. import base # Module API def extract_source(record): source = { 'id': 'actrn', 'name': 'ANZCTR', 'type': 'r...
from datetime import timedelta from dj.utils import api_func_anonymous from django.db import connection from backend import dates, model_manager from backend.api_helper import get_session_app from backend.models import AppDailyStat @api_func_anonymous def api_get_app_month_data(request): app = get_session_app(r...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Version 1.0, 201607, Harry van der Wolf # Version 1.1, 201701, Harry van der Wolf; urllib -> do not read large files into memory) # Version 1.3, 201701, Harry van der Wolf; use csv as intermediate format as gpsbabel osm to gpx only copies about 10% import os, sys, platf...
#top25germanadverbs import random while True: #initiate loop d = { 'eben ':'just now', 'erst ':'first', 'natürlich ': 'naturally', 'vielleicht ':'perhaps', 'dort ': 'there', 'auch ':'also', 'so ':'so', ...
from django.db import models from django.contrib.auth.models import User from django.conf import settings class Profile(models.Model): user = models.OneToOneField(User) name = models.CharField(max_length=100, blank=True, verbose_name="name", db_index=True) headline = models.CharField(max_length=...
import json import ssl import time import urllib.request from datetime import timedelta import logging import Crypto.PublicKey.RSA import python_jwt as jwt _accepted_sign_algs = ["PS512"] _pubkey_cache_living_time = 60*10 # 10min _pubkey_cache_exp_time = 0 _pubkey_cache = "" _iat_skew = timedelta(minutes=5) logger...
import re import paramiko import telnetlib import time from django.core.exceptions import ObjectDoesNotExist from netmiko import ConnectHandler from .models import Service, CommandGroup class Switch(object): def __init__(self, value): self.value = value self.fall = False def __iter__(self):...
""" Default settings for the ``mezzanine.twitter`` app. Each of these can be overridden in your project's settings module, just like regular Django settings. The ``editable`` argument for each controls whether the setting is editable via Django's admin. Thought should be given to how a setting is actually used before ...
#!/usr/bin/env python3 # # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution # Copyright (C)2013-2021 The MMGen Project <mmgen@tuta.io> # # 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 Softwa...
import re import operator import argparse import textwrap from collections import defaultdict from sqlalchemy.util import KeyedTuple """ #h XmapEntryID QryContigID RefContigID QryStartPos QryEndPos RefStartPos RefEndPos Orientation Confidence HitEnum QryLen RefLen Label...
#!/usr/bin/env python3 import netCDF4 as nc import sys import argparse import numpy as np from utilities import partialMatchFromList debug = True # =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* def asciiEncode(uList, uStr): n = len(uList) if(n > 0): uList = list(uList) # This might be a tuple coming...
import pyon import pickle import time import ast import json class C(object): def __init__(self, count): self.count = count # def __reduce__(self): _dict = dict(self.__dict__) count = _dict.pop('count') return C, (count,), _dict lst = [] for i in range(10000): c ...
from django.shortcuts import render, redirect from django.conf import settings import textwrap from converter import convert_xml_to_json from converter import update_primary_key_in_xml, merge_relationship_in_xml, validate_xml import lxml.etree as etree from django.http import HttpResponse from django.views.generic.ba...
import mock import pytest from api.base.settings.defaults import API_BASE from api_tests.requests.mixins import NodeRequestTestMixin, PreprintRequestTestMixin from osf.utils import permissions @pytest.mark.django_db @pytest.mark.enable_enqueue @pytest.mark.enable_quickfiles_creation class TestCreateNodeRequestAction...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Calendar-Indicator # # Copyright (C) 2011-2019 Lorenzo Carbonell Cerezo # lorenzo.carbonell.cerezo@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 Softw...
import sys import unittest import io from resync.resource import Resource from resync.resource_list import ResourceList from resync.capability_list import CapabilityList from resync.sitemap import Sitemap, SitemapIndexError, SitemapParseError import subprocess def run_resync(args): args.insert(0, './resync-buil...
""" Helper script to build libmad Version: libmad-0.15.1b Usage: - Download the libmad sourcecode. - Unzip the sourcecode - Set the environment variable LIBMAD_FOLDER to the unzipped dir - Run this script """ import sys import os import logging import time try: from powertb import print_exc except ImportError...
from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import render from django.core.urlresolvers import reverse from django.core.exceptions import ObjectDoesNotExist from models import Stage, Route, StageSeq def server_error(request): return render(request,template_name="500.h...
import warnings from django.conf.urls.defaults import * from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseBadRequest from tastypie.exceptions import NotRegistered, BadRequest from tastypie.serializers import Serializer ...
import decimal from wtforms import fields, widgets class ReferencePropertyField(fields.SelectFieldBase): """ A field for ``db.ReferenceProperty``. The list items are rendered in a select. """ widget = widgets.Select() def __init__(self, label=u'', validators=None, reference_class=None, ...
# Copyright (C) 2008 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # Distributed under the terms of the GNU Lesser General Public License # http://www.gnu.org/copyleft/lesser.html from networkx.classes.multigraph import MultiGraph from netwo...
# -*- coding: utf-8 -*- import os import re import ctypes import threading from itertools import chain stripper = re.compile(r'[^\w\-:]', re.U) def string_to_words(s): s = s.lower() s = stripper.sub(' ', s) words = s.split() return words class Stemmer(object): FI_PROJECT = 'sukija/suomi.pro' ...
#!/usr/bin/env python # -*- coding: iso-8859-15 -*- ## this file is part of tagstore, an alternative way of storing and retrieving information ## Copyright (C) 2010 Karl Voit, Christoph Friedl, Wolfgang Wintersteller ## ## This program is free software; you can redistribute it and/or modify it under the terms ## of t...
# -*- coding: utf-8 -*- """ Catch-up TV & More Copyright (C) 2016 SylvainCecchetto This file is part of Catch-up TV & More. Catch-up TV & More 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 Foundat...
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys, logging import pywikibot import csv import MySQLdb as mdb from MySQLdb import cursors import traceback import re import time import argparse import utils import pdb NOW = time.strftime("%Y_%m_%d_%H_%M") OUT_DIR_LOGS = os.path.expanduser('~/logs') OUT_DIR...
#!/usr/bin/env python from __future__ import print_function from setuptools import setup, find_packages from os import path import codecs import os import re import sys # When creating the sdist, make sure the django.mo file also exists: if 'sdist' in sys.argv or 'develop' in sys.argv: try: os.chdir('flue...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Copyright (c) 2018-2019 NVIDIA CORPORATION. All rights reserved. import torch from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from maskrcnn...
# encoding: UTF-8 from __future__ import print_function import hashlib import hmac import json import ssl import traceback import base64 from queue import Queue, Empty from multiprocessing.dummy import Pool from time import time from urlparse import urlparse from copy import copy from urllib import urlencode from thr...
from core.plugins.Plugin import Plugin, PluginException, Playable, DataStream, SubtitleStream """ This is a skeleton for a PCS plugin. Read the comments CAREFULLY. This plugin works fine inside PCS, try it. Rules: 0) The ID must be a UNIQUE int. And 0xCAFEBABE is NOT unique. 1) The plugin file must only contain one...
import unittest from ctypes import * import re, struct, sys if sys.byteorder == "little": THIS_ENDIAN = "<" OTHER_ENDIAN = ">" else: THIS_ENDIAN = ">" OTHER_ENDIAN = "<" class memoryview(object): # This class creates a memoryview - like object from data returned # by the private _ctypes._buffe...
import h5py from keras import models import numpy from steps.prediction.shared.tensor2d import prediction_array from util import data_validation, file_structure, progressbar, logger, file_util, hdf5_util, misc class Tensor2D: @staticmethod def get_id(): return 'tensor_2d' @staticmethod def ...
# Copyright 2014 # The Cloudscaling Group, 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...
from django.db import models from django.db.models import Q from django.utils.translation import ugettext_lazy as _, ungettext_lazy import netfields from lana_dashboard.lana_data.models.institution import Institution class IPv4Subnet(models.Model): network = netfields.CidrAddressField(unique=True, verbose_name=_("N...
#! /usr/bin/env python #David Shean #dshean@gmail.com import sys import os import argparse import numpy as np from osgeo import gdal from pygeotools.lib import iolib #Can use ASP image_calc for multithreaded ndv replacement of huge images #image_calc -o ${1%.*}_ndv.tif -c 'var_0' --output-nodata-value $2 $1 def g...
import os # initialize a list task = [] # check current python file path currentpath = os.path.dirname(os.path.realpath(__file__)) # set name of the file filename = "my_todo.txt" # set directory to save the file filepath = os.path.join(currentpath, filename) # function for check the file is exist and is empty or not...
# Copyright (c) 2020 PaddlePaddle 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 app...
from django.core.management.base import BaseCommand from package.models import Package class Command(BaseCommand): args = 'None' help = 'Checks for updates on packages and schedules rebuilds if needed.' def handle(self, *args, **kwargs): self.stdout.write("Checking for updates on packages...") ...
"""When processor test suite.""" import collections.abc import itertools import pathlib import pytest import holocron from holocron._processors import when @pytest.fixture(scope="function") def testapp(request): def spam(app, items, *, text=42): for item in items: item["spam"] = text ...
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '6+dqad9^b51rix$3hc#rdn9@%6uhat+@$9udx^yh=j-1+8+2n*' DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.session...
import unittest import os import chowda.parsing as parse import datetime import pandas as pd from chowda.load import load_file DATA_DIR = os.path.join(os.path.dirname(__file__), "data") TEST_FILE = "CTL1 wk3 exp1 RAW data.txt" TEST_1 = os.path.join(DATA_DIR, TEST_FILE) class TestChowda(unittest.TestCase): def s...
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np # Number of "papers using libmesh" by year. # # Note 1: this does not count citations "only," the authors must have actually # used libmesh in part of their work. Therefore, these counts do not include # things like Wolfgang citing us in his pap...
from __future__ import print_function import os import sys import re from model_test_setup import ModelTestSetup from test_run import tests as test_specs class TestBitReproducibility(ModelTestSetup): def __init__(self): super(TestBitReproducibility, self).__init__() def checksums_to_dict(self, fil...
import unittest from MusicCollection import MusicCollection class TestMusicCollection(unittest.TestCase): # def test_all(self): mc = MusicCollection("./test_collection/", flac=True, ogg=True) self.assertEqual(len(mc.audio_files), 9) def test_flac(self): mc = MusicCollection("./t...
# ActivitySim # See full license in LICENSE.txt. from __future__ import (absolute_import, division, print_function, ) from future.standard_library import install_aliases install_aliases() # noqa: E402 import logging import pandas as pd from activitysim.core import tracing from activitysim.core import config from a...
""" Install 'pycrypto' package to use this module """ from Crypto.Cipher import AES from . import BaseCryptor def add_padding(data, block_size): data_len = len(data) pad_len = (block_size - data_len) % block_size if pad_len == 0: pad_len = block_size padding = chr(pad_len) return ''.join...
""" desispec.io.frame ================= IO routines for frame. """ import os.path import numpy as np import scipy,scipy.sparse from astropy.io import fits from desispec.frame import Frame from desispec.io import findfile from desispec.io.util import fitsheader, native_endian, makepath from desispec.log import get_lo...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, 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.ap...
import config from plyny.plio.image import PathedImage as Image, HTMLImage from web import Page, Url import unittest class TestCase(unittest.TestCase): def setUp(self): self.p = config.fake_proxy() self.p.activate() def tearDown(self): self.p.deactivate() def test_estimate_co...
############################################################################## # Package: ormpy # File: TestPopulation.py # Author: Matthew Nizol ############################################################################## """ This file contains unit tests for the lib.Population module. """ import os, sys, re f...
""" Let's encrypt Blueprint =============== **Prerequisites:** Webserver need to be configured to serve acme-challenge requests for requested domains Example: .. code-block:: nginx location ^~ /.well-known/acme-challenge/ { default_type "text/plain"; root /srv/www/letsencrypt; } location =...
from lib.data.message import Message from tests.unittest.base_custom import TestCustomField # Needs to be imported last from ..custom import query class TestCustomCommandCustomQuery(TestCustomField): def setUp(self): super().setUp() self.args = self.args._replace(field='query', message=Message('a...
"""Test all commands.""" import sys from StringIO import StringIO from django.conf import settings from django.test import TestCase from django.core import management from django.contrib.sites.shortcuts import get_current_site from allauth.socialaccount import providers from allauth.socialaccount.models import Soci...
# Copyright 2014 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 collections import copy import datetime import json import logging import os import random import sys import tempfile import time import traceback fr...
#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio import copy import ipaddress import json import sys from typing import cast, Dict import unittest sys.path.append("..") # httpretty currently doesn't work, but mocket with the compat interface # does. from mocket import Mocket # type: ignore from mocket.p...
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from six ...
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Provides a xmlrpc frontend to gecod backend ''' import backend import secure_xmlrpc as sxmlrpc HOST = 'localhost' PORT = 4343 DATABASE = 'sqlite:///database.sqlite' KEYFILE='certs/key.pem' CERTFILE='certs/cert.pem' def parseconfig(configfile): global HOST, PORT, DAT...
import unittest from mygrations.formats.mysql.file_reader.database import database as database_reader from mygrations.formats.mysql.file_reader.create_parser import create_parser class test_database(unittest.TestCase): def _get_sample_db(self): strings = [ """ CREATE TABLE `logs` (...
from django import forms from django.forms.models import modelform_factory from django.forms.formsets import formset_factory from form_utils.forms import BetterForm, BetterModelForm from localflavor.nl.forms import NLZipCodeField, NLPhoneNumberField from jd_projects.models import Project, ProjectIncomeExpenses class P...