src stringlengths 721 1.04M |
|---|
#Global imports
from netmiko import ConnectHandler
from datetime import datetime
import csv, os.path
#Local imports
import credentials
# Begin timing the script
start_time = datetime.now()
# Define the primary function (to be moved to a separate module some day...)
def nc(username, password, secret, customer):
wi... |
from django.conf import settings
from datetime import datetime
#set up logger
#import logging
#logging.basicConfig(filename=settings.JMS_SETTINGS["resource_manager"]["log_file"],
#level=logging.ERROR)
class ResourceManagerException(Exception):
def __init__(self, message):
super(ResourceManagerExcep... |
#!/usr/bin/env python
"""
Uses the Random Forest classifier
"""
from api import State, util
import random, os
from sklearn.externals import joblib
DEFAULT_MODEL = os.path.dirname(os.path.realpath(__file__)) + '/model.pkl'
class Bot:
__max_depth = -1
__randomize = True
__model = None
def __init__... |
import time
import os
import subprocess
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common import utils
chrome_options = Options()
chrome_optio... |
"""Classes for events in ``emanate``."""
import blinker
from jaraco.classes.properties import classproperty
__metaclass__ = type
class Event:
"""Base class for ``emanate`` events."""
event_type = None
def __init__(self, extra_context=None, extra_data=None):
self._context = extra_context if extra... |
"""
An auto-completion window for IDLE, used by the AutoComplete extension
"""
from Tkinter import *
from idlelib.MultiCall import MC_SHIFT
from idlelib.AutoComplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES
HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>"
HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>... |
import lasagne
def setup(input_var, box_size = 29,):
# Setup network
net = lasagne.layers.InputLayer(
shape=(None, 1, box_size, box_size),
input_var=input_var)
# stage 1 : filter bank -> squashing -> max-pooling
net = lasagne.layers.Conv2DLayer(
net,
n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import cProfile
from pstats import Stats
from qclobot.amberobject import AmberObject
from qclobot.utils import get_model
import proteindf_bridge as bridge
class TestAmberObject(unittest.TestCase):
def setUp(self):
pass
#self.pr = cProf... |
"""
You are given a tree(a simple connected graph with no cycles). The tree has N
nodes numbered from 1 to N and is rooted at node 1.
Find the maximum number of edges you can remove from the tree to get a forest
such that each connected component of the forest contains an even number of
nodes.
Constraints
2 <= 2 <= 1... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
# -*- coding: utf-8 -*-
#
# Copyright 2009: Johannes Raggam, BlueDynamics Alliance
# http://bluedynamics.com
# GNU Lesser General Public License Version 2 or later
__author__ = """Johannes Raggam <johannes@raggam.co.at>"""
__docformat__ = 'plaintext'
from zope.interface import implements
from zope.com... |
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/o... |
"""
Get information about the network.
In this case, we are interested in a small set of neurons. We go through each of
the neurons and get connectivity information about each connection it has with
another cell.
This type of script could be useful for visualizing data, generating reports,
or any number programmatic ... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
import os
from base.views import group_required
from base.models import Person, Logger, Root, Admin, Appointment, Doctor, ExtendedStay
from django.contrib.auth.models impo... |
'''
simple-MC: Main module
Copyright 2014, Dan Schien
Licensed under MIT.
'''
import importlib
import xlrd
__author__ = 'schien'
NAME = 'name'
TYPE = 'type'
PARAM_A = 'param_a'
PARAM_B = 'param_b'
PARAM_C = 'param_c'
MODULE = 'module'
LABEL = 'label'
UNIT = 'unit'
TABLE_STRUCT = {
NAME: 0,
MODULE: 1,
... |
import re
import sys
import time
from datetime import datetime
import pytest
import requests.adapters
from mollie.api.client import Client, generate_querystring
from mollie.api.error import (
DataConsistencyError,
IdentifierError,
NotFoundError,
RequestError,
RequestSetupError,
ResponseError,
... |
#!/usr/bin/python
# This file is part of Coccitools.
# Copyright (C) 2010 Florian MANY
# Coccitools is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2013, gamesun
# 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 copyr... |
from pathlib import Path
import pickle
from weibo.weibo import Weibo
DATA_FILE = 'followers.pickle'
if Path(DATA_FILE).exists():
followers = pickle.load(open(DATA_FILE, 'rb'))
# for l in data:
# print(l)
else:
exit()
count = {
'location': {},
'age': {},
'gender': {}
}
for i in followers:
user ... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
import json
from django.http import HttpResponse
from .calculations import surgeo_model
from .calculations import surname_model
from .calculations import geocode_model
from .calculations import forename_model
from .hmac_utility import verify_message
class RestAPI(object):
'''Takes queries and gets results.'''
... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import unittest
import docker
import requests.exceptions
import tempfile
import os
import shutil
import subprocess
import sys
from crawler.namespace import run_as_another_namespace
from crawler.crawler_exceptions import CrawlTimeoutError, CrawlError
all_namespaces = ["user", "pid", "uts", "ipc", "net", "mnt"]
# Fun... |
# Authors: Mark Wronkiewicz <wronk@uw.edu>
# Yousra Bekhti <yousra.bekhti@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import warnings
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
fro... |
def toProperFormula(s):
"""
Given formula string, returns a modified formula with missing
multiplication symbols and grouping symbols [],{} replaced by parentheses.
Only primitive error checking for mismatched grouping symbols is shown in
this recipe.
author: ernesto.adorio@gmail.com, ernie@... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-07 13:52
from __future__ import unicode_literals
import datetime
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import django_revision.revision_field
import edc_base.... |
# -*- coding: utf-8 -*-
def falling_fuzzy(small_value, big_value, value):
"""
Will return how true the provided value is depending on the small and big numbers. The closer the value is to
small_value the more true it is. The closer it is to the big_value the less true it is.
@type small_value: float
... |
import unittest
from AddressBook import AddressBook
from AddressBookHandler import AddressBookHandler
class AddressBookTests(unittest.TestCase):
def setUp(self):
self.obj = AddressBookHandler()
def test_address_book_object(self):
assert not AddressBook("Umair", "Bhatti", "GHQ", "marry@smart.co... |
#!/usr/bin/env python
import os
import pytest
boto3 = pytest.importorskip('boto3')
from simplekv.net.boto3store import Boto3Store
from simplekv._compat import BytesIO
from basic_store import BasicStore
from url_store import UrlStore
from bucket_manager import boto_credentials, boto3_bucket
from conftest import Exte... |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
'''IMPORTS'''
import re
import json
from datetime import datetime, date
import urllib3.util
# Disable insecure warnings
urllib3.disable_warnings()
def parse_tag_field(tags_str):
tags = []
regex = re.compile(r... |
import numpy as np
import materials
import lamination
from copy import deepcopy
class LaminateProperties(object):
# Superclass containing the basic constructor and essential contract
# through which the LaminateProperties subclasses operate.
def __init__(self, lam=None):
# Constructor wants a Laminate type as it... |
"""Yahoo Search Web Services
This module implements a set of classes and functions to work with the
Yahoo Search Web Services. All results from these services are properly
formatted XML, and this package facilitates for proper parsing of these
result sets. Some of the features include:
* Extendandable API, with r... |
from django.db import IntegrityError
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from waldur_core.core.fields import MappedChoiceField, NaturalChoiceField
from waldur_core.core.serializers import GenericRelatedField
from waldur_core.logging import models, utils, logge... |
# -*- coding: utf-8 -*-
"""Simple galil file templating and minification
Preforms useful actions on galil encoder files.
- Substitution of template variables (using jinja2)
- Whitespace trimming and minification by command packing
"""
# Author: Dean Serenevy <deans@apcisystems.com>
# This software is Copyright ... |
# Copyright 2016 Google LLC
#
# 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, s... |
# -*- coding: utf-8 -*-
# Scrapy settings for prototypeAWS project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/l... |
# coding: UTF-8
import urllib
import urllib2
import re
from pyquery import PyQuery as pq
from lxml import etree
import json
import sys
import string
reload(sys)
sys.setdefaultencoding("utf-8")
#urllib函数,用于提交http数据
def open(aurl,post='',Referer=''):
#proxy = 'http://127.0.0.1:8088'
#opener = urllib2.build_opener... |
# Copyright (c) 2017 Intel Corporation
#
# 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 i... |
from unittest import TestCase
class TestFunctions(TestCase):
"""Test the various rst helper functions"""
def test_no_anchor(self):
"""Only add anchors if we have names"""
from rippy.RIP import anchor
self.assertEqual(anchor(None), '')
self.assertEqual(anchor(''), '')
... |
#
# Evy - a concurrent networking library for Python
#
# Unless otherwise noted, the files in Evy are under the following MIT license:
#
# Copyright (c) 2012, Alvaro Saurin
# Copyright (c) 2008-2010, Eventlet Contributors (see AUTHORS)
# Copyright (c) 2007-2010, Linden Research, Inc.
# Copyright (c) 2005-2006, Bob Ippo... |
from setuptools import setup, find_packages
setup(
name='pushgp',
version='0.1.0',
description='Use genetic programming, implemented with Push, for machine learning.',
long_description=open('README.rst').read(),
author='Saul Shanabrook',
author_email='s.shanabrook@gmail.com',
url='https://g... |
# coding: utf-8
from __future__ import unicode_literals
from model_mommy import mommy
from django.test import TestCase
from cmdbox.scaffold_templates.models import File
class FileModelTests(TestCase):
def setUp(self):
self.file = mommy.make(File)
def test__get_name_parts_valid_extension(self):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# test_indentation.py
#
# test for indentation rule
# ----------------------------------------------------------------
# copyright (c) 2014 - Domen Ipavec
# Distributed under The MIT License, see LICENSE
#... |
import six
from swimlane.core.resolver import SwimlaneResolver
class APIResourceMetaclass(type):
"""Metaclass for all APIResource classes"""
def __call__(cls, *args, **kwargs):
"""Hook __init__ call to push resource instance into Swimlane client ResourceCache after instantiation"""
resource_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import threading
import json
from time import sleep
from db import exec_sql
from cloud_client import ret_code
from cloud_client.all_clients import get_cloud_client
import cloud_client.request as Req
# python keyword arguments mak... |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2005-2011, TUBITAK/UEKAE
#
# 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 pymongo
from math import sin,cos,atan2,sqrt
c = pymongo.MongoClient()
print('Loading rivers from db...')
rivers = list(c['wwsupdb']['osm'].find({},{'paths':True}))
print('Loaded %d rivers'%len(rivers))
def GeodeticDistGreatCircle(lat1,lon1,lat2,lon2):
"Compute distance between two points of the earth geoid... |
# -*- coding: utf-8 -*-
import os
import sys
import getpass
import locale
import logging
from argparse import SUPPRESS
from collections import OrderedDict
from datetime import date, datetime
import argcomplete
from moulinette import msignals, m18n
from moulinette.core import MoulinetteError
from moulinette.interface... |
import setuptools
setuptools.setup(
name='nexradaws',
version='1.1',
packages=['nexradaws','nexradaws.resources'],
description= 'Query and download NEXRAD data from AWS S3 storage.',
long_description= '''This module is designed to allow you to query and download Nexrad
radar files from Amazon Web S... |
import pygame as pg
from collections import deque
from os import path
vec = pg.math.Vector2
TILESIZE = 48
GRIDWIDTH = 28
GRIDHEIGHT = 15
WIDTH = TILESIZE * GRIDWIDTH
HEIGHT = TILESIZE * GRIDHEIGHT
FPS = 30
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
MAGENTA = (2... |
#
# Copyright 2013 TeamSWAP
#
# 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, so... |
# 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 distributed in the hope that it will be useful,
# bu... |
#!/usr/bin/env python
#
# Copyright 2015 Arvind Singh
# This file is part of the mtools library.
#
# mtools 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 optio... |
# ported from gnulib rev be7d73709d2b3bceb987f1be00a049bb7021bf87
#
# Copyright (C) 2014, Mark Laws.
# Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2014 Free Software
# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Lice... |
# -*- coding: utf-8 -*-
# Copyright Tom SF Haines, Aaron Snoswell
#
# 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 appl... |
from __future__ import unicode_literals
try:
from urllib import urlencode, quote
except ImportError:
from urllib.parse import urlencode, quote
import json
import pytz
import datetime
import base64
import requests
import hashlib
import hmac
import urlparse
from collections import OrderedDict
from uuid import uui... |
# Author: Harsh Gupta
# Date: 18th August 2014
# Overlap Graphs http://rosalind.info/problems/grph/
def read_input(in_file):
""" Reads the input and returns a dictionary of DNA inputs """
tags = []
strings = []
for line in in_file.readlines():
if line[0] == '>':
tags.append(line[1:-... |
# -*- coding: utf-8 -*-
#
# Jansson documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 5 21:47:20 2010.
#
# 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... |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
#
# 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 ... |
# -*- coding: utf-8 -*-
"""Annotators to detect and identify faces.
Identifying individuals in an image generally requires two distinct steps. The
first is detecting bounding boxes for faces in the image and the second is
identifying the faces themselves. Currently the most common method for doing
the second step is t... |
'''An helper file for the pydev debugger (REPL) console
'''
import sys
import traceback
from code import InteractiveConsole
from _pydev_bundle import _pydev_completer
from _pydev_bundle.pydev_console_utils import BaseInterpreterInterface, BaseStdIn
from _pydev_bundle.pydev_imports import Exec
from _pydev_bund... |
"""
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import check_predicat... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... |
import truetypetracer as ttt
import openvoronoi as ovd
import time
import sys
def translate(segs,x,y):
out = []
for seg in segs:
seg2 = []
for p in seg:
p2 = []
p2.append(p[0] + x)
p2.append(p[1] + y)
seg2.append(p2)
#seg2.append(seg[3... |
from ideFoam.inputFiles import ReadWriteFile, getFilePath
from PyFoam.Basics.DataStructures import DictProxy
from os.path import join
from ideFoam.inputFiles.compatOF import water, air
"""
Convenience class to simply write "TransportProperties"
"""
class TransportProperties(ReadWriteFile) :
"""
Transp... |
sys and os modules form the core of much of Python’s system-related tool set
>>> import sys
>>> sys.platform, sys.maxsize, sys.version
('win32', 2147483647, '3.1.1 (r311:74483, Aug 17 2009, 17:02:12) ...more deleted...')
>>> if sys.platform[:3] == 'win': print('hello windows') ...
hello windows... |
from .hp import HoverPy
class capture(object):
def __init__(self, dbpath="requests.db", capture=True, **kwargs):
self.dbpath = dbpath
self.capture = capture
self.kwargs = kwargs
def __call__(self, f):
def wrapped_f(*args):
with HoverPy(capture=self.capture, dbpath=... |
from vumi.persist.model import VumiRiakError
from go_api.collections.errors import CollectionUsageError
from go_api.queue import PausingQueueCloseMarker
from twisted.internet.defer import inlineCallbacks, returnValue
@inlineCallbacks
def _get_page_of_keys(
model_proxy, user_account_key, max_results, cursor,
... |
# Copyright (C) 2010-2012 Red Hat, Inc.
# This work is licensed under the GNU GPLv2 or later.
# Define a storage pool of 'iscsi' type
from libvirt import libvirtError
from libvirttestapi.src import sharedmod
from libvirttestapi.repos.storage import storage_common
required_params = ('poolname', 'sourcehost', 'sourcepa... |
# Settings
# https://docs.djangoproject.com/en/2.0/topics/settings/
# https://docs.djangoproject.com/en/2.0/ref/settings/
# https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
import os
import django_heroku
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.environ... |
#!/usr/bin/python
import sys
from os.path import isfile
from PyQt4 import QtGui
from PyQt4 import QtCore
from main_window import Ui_MainWindow
sys.path.append('..')
from aei.aei import StdioEngine, EngineController
from aei import board
ERROR = -1
AKIMOT_CMD = 'bots/akimot -c bots/default.cfg -l'
from board_wi... |
# -*- coding: utf-8 -*-
import logging
from . import build_genotype, build_compound, build_gene, build_clnsig
LOG = logging.getLogger(__name__)
def build_variant(
variant, institute_id, gene_to_panels=None, hgncid_to_gene=None, sample_info=None
):
"""Build a variant object based on parsed information
A... |
import rebound
import reboundx
from reboundx import data
import unittest
import math
import numpy as np
from ctypes import c_uint, c_uint8, c_uint32, c_uint64
def mycomp(obj1, obj2):
if type(obj1) != type(obj2):
return False
for attr in [attr for attr in dir(obj1) if not attr.startswith('_')]:
... |
"""
Copyright (c) 2017, 2018 Genome Research Ltd.
Authors:
* Christopher Harrison <ch12@sanger.ac.uk>
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
y... |
'''
Copyright (C) 2005-17 www.interpss.org
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 b... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class CriterionIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?criterion\.com/films/(?P<id>[0-9]+)-.+'
_TEST = {
'url': 'http://www.criterion.com/films/184-le-samourai',
'md5': 'b... |
# Copyright 2015 Cisco Systems
# 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... |
__author__ = 'MeisamHe'
#=================================Start with the first data set farm ads=======================================================
import csv
import sys
import math
import random
import numpy as np
import os
#-----------------------------------------------------------------------------
# Read t... |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from config import PYTHON_PATH
if PYTHON_PATH is not None:
for i in PYTHON_PATH: sys.path.insert(0,i)
import argparse
import h5py
import pandas as pd
import numpy as np
from hdgwas.tools import Timer
import tables
import... |
try:
import pyfits
except:
pass
import os
import re
from AstroData import *
ldebug = False
verbose = False
from astrodata.adutils import terminal
from ReductionContextRecords import AstroDataRecord
import subprocess
import os
from copy import copy,deepcopy
from AstroData import Errors
from astrodata import new... |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 l... |
#!/usr/bin/env python
"""
source: https://github.com/carljm/django-model-utils/blob/f8a7c50/runtests.py
"""
import os
import sys
from django.conf import settings
import django
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
LOGGING_CONFIG = {
'version': 1,
# 'disable_existing_loggers': True,
'di... |
#!/usr/bin/env python
# passphrase
#
# Generates a passphrase from random words (four by default, number may
# be specified as first argument on command line). By default, words are
# between 6 and 10 characters in length. Different minimum and maximum
# word lengths may be specified in the seconda and third command l... |
# -*- coding: UTF-8 -*-
#/*
# * Copyright (C) 2012 Libor Zoubek
# *
# *
# * 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, or (at your option)
# * any later version... |
# 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... |
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011-2012 Serge Noiraud
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... |
import webapp2
from webapp2_extras import sessions
class MainHandler(webapp2.RequestHandler):
def get(self):
# Session is stored on both client browser and our database
session_1 = self.session_store.get_session(name='dbcookie',backend='datastore')
previous_value_1 = session_1.get("my_attr_... |
# -*- coding: utf-8 -*-
# This file is part of TextVentures - https://github.com/RMed/textventures
#
# Copyright (C) 2013 Rafael Medina García <rafamedgar@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... |
# coding: UTF-8
import os
import fileinput
import re
class TextReplacer:
def __init__(self):
self.file = ''
def replace_text_in_file(self, file_location = '', text_current = '', text_new = ''):
self.file = file_location
print('Plan to change ' ,text_current, ' to ',text_new)
if o... |
"""Tests that :class:`aflow.entries.Entry` objects have the correct
attributes and that lazy fetching works correctly.
"""
import pytest
def test_eq_hash(paper):
"""Tests equality and hashing of database entries.
"""
paper.reset_iter()
a = paper[0]
assert a == a
assert hash(a) == hash(a.auid)
... |
#!/usr/bin/env python
#
# Copyright 2015-2015 breakwa11
#
# 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 la... |
"""
Basic pulsar-related functions and statistics.
"""
import functools
from collections.abc import Iterable
import warnings
from scipy.optimize import minimize, basinhopping
import numpy as np
from .fftfit import fftfit as taylor_fftfit
from ..utils import simon, jit
from . import HAS_PINT, get_model, toa
__all__ ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
r"""
This module contains :py:meth:`~sympy.solvers.ode.dsolve` and different helper
functions that it uses.
:py:meth:`~sympy.solvers.ode.dsolve` solves ordinary differential equations.
See the docstring on the various functions for their uses. Note that partial
differential equations support is in ``pde.py``. Note t... |
import base64
import argparse
import json
import requests
import sys
import os
import fnmatch
WS_LIST = "/workspace/list"
WS_STATUS = "/workspace/get-status"
WS_MKDIRS = "/workspace/mkdirs"
WS_IMPORT = "/workspace/import"
WS_EXPORT = "/workspace/export"
LS_ZONES = "/clusters/list-zones"
error_401 = """
Credentials ar... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/platform/responses/plat_eight_response.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _mes... |
from aiovault import Vault
from conftest import async_test
import pytest
@async_test
def test_ldap(dev_server):
client = Vault(dev_server.addr, token=dev_server.root_token)
backend = yield from client.auth.enable('ldap')
configured = yield from backend.configure(url='ldap://ldap.forumsys.com',
... |
def yes_value(response):
'''Returns True if a response is intended to be a Yes
Returns False if a response is intended to be a No
Returns None if response is blank or irrelevant'''
if response.lower() in ['yes','y']:
return True
elif response.lower() in ['no','n']:
return False... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import pytest
from changelog.git import Git
from changelog.changelog import read_config, DEFAULT_CONFIG
@pytest.fixture
def config():
return read_config(DEFAULT_CONFIG)
@pytest.fixture
def git():
return Git()
class TestGit():
de... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# 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 ver... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.