text stringlengths 17 737k |
|---|
# -*- coding: utf-8 -*-
"""
Copyright 2018 Dispel, LLC
Apache 2.0 License, see https://github.com/dispel/jak/blob/master/LICENSE for details.
"""
import base64
import binascii
from io import open
from . import helpers
from .compat import b
from .aes_cipher import AES256Cipher
from .exceptions import JakException, Wro... |
# -*- coding: utf-8 -*-
"""Flexible json-like dict"""
import json
class CustomEncoder(json.JSONEncoder):
def default(this, obj):
try:
return json.JSONEncoder.default(this, obj)
except: pass
### CUSTOM ENCODER
class pyon(dict):
"""This class mimics the way JSON works in Javascript
... |
#
# Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
#
# 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 applicab... |
import os
import jsonschema
import pytest
from pyxrf.xanes_maps.xanes_maps_api import (
_build_xanes_map_api, _build_xanes_map_param_default, _build_xanes_map_param_schema,
build_xanes_map)
from pyxrf.core.yaml_param_files import (
_parse_docstring_parameters, _verify_parsed_docstring,
create_yaml_par... |
from __future__ import division, print_function, absolute_import
import math
import warnings
from collections import namedtuple
import numpy as np
from numpy import (isscalar, r_, log, around, unique, asarray,
zeros, arange, sort, amin, amax, any, atleast_1d,
sqrt, ceil, floor, a... |
# Author: Travis Oliphant, 2002
#
from __future__ import nested_scopes
import math
import statlib
import stats
import distributions
import inspect
from numpy import isscalar, r_, log, sum, around, unique, asarray
from numpy import zeros, arange, sort, amin, amax, any, where, \
array, atleast_1d, sqrt, ceil, flo... |
def print_sql(qs):
import sqlparse
try:
import pygments
from pygments.lexers import SqlLexer
from pygments.formatters import TerminalTrueColorFormatter
except ImportError:
pygments = None
sql = sqlparse.format(str(qs.query), reindent=True, keyword_case='upper')
if py... |
import json
import logging
import re
import time
from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort
from sqlalchemy.sql import or_
from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks
from CTFd.plugins.keys import ge... |
import json
import os
import re
import time
import subprocess
from subprocess import PIPE
import requests
import ray
from ray import serve
from ray.cluster_utils import Cluster
# Global variables / constants appear only right after imports.
# Ray serve deployment setup constants
NUM_REPLICAS = 7
MAX_BATCH_SIZE = 16
... |
"""
Tools to open .py files as Unicode, using the encoding specified within the file,
as per PEP 263.
Much of the code is taken from the tokenize module in Python 3.2.
"""
from __future__ import absolute_import
import io
from io import TextIOWrapper, BytesIO
import re
import urllib
cookie_re = re.compile(ur"coding[:... |
# Copyright (c) 2009 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.
{
'includes': [
'../../../common_settings.gypi', # Common settings
],
'targets': [
{
'target_name': 'udp_transport',
'type': '<... |
# -*- coding: utf-8 -*-
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2... |
# -*- coding: utf-8 -*-
import contextlib
import os
import string
import sys
import arcpy
from arcpy.sa import *
# import our local directory so we can import internal modules
local_path = os.path.dirname(__file__)
sys.path.insert(0, local_path)
# Check out any necessary licenses
arcpy.CheckOutExtension("Spatial")
... |
# -*- coding: utf-8 -*-
#
# django-codenerix-pos
#
# Copyright 2017 Centrologic Computational Logistic Center S.L.
#
# Project URL : http://www.codenerix.com
#
# 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 ... |
# -*- coding: utf-8 -*-
"""
LibreDTE
Copyright (C) SASCO SpA (https://sasco.cl)
Este programa es software libre: usted puede redistribuirlo y/o modificarlo bajo
los términos de la Licencia Pública General Affero de GNU publicada por la
Fundación para el Software Libre, ya sea la versión 3 de la Licencia, o (a su
elec... |
import unittest, gc, os
import numpy as N
from neuroimaging.modalities.fmri import fMRIImage
from neuroimaging.core.image.image import Image
from neuroimaging.utils.tests.data import repository
from neuroimaging.data_io.formats.analyze import Analyze
# not a test until test data is found
class fMRITest(unittest.TestC... |
__all__ = [
'opinions',
'oral_args',
]
__version__ = "1.1.0"
__title__ = "juriscraper"
__description__ = "An API to scrape American court websites for metadata."
__uri__ = "https://github.com/freelawproject/juriscraper"
__author__ = "Mike Lissner"
__email__ = "info@free.law"
__license__ = "BSD"
__copyright_... |
"""
Repository for the basic Projection types.
Mainly provides a place where additional Projections can be added in
future, so that all will be in a well-defined, searchable location.
$Id$
"""
__version__ = "$Revision$"
import Numeric
# So all Projections are present in this package
from topo.base.projection impor... |
from totalimpactwebapp import db
from totalimpactwebapp import heading_product
from totalimpactwebapp import profile_award
from totalimpactwebapp import util
from totalimpactwebapp import configs
from totalimpactwebapp.product import Product
from totalimpactwebapp.views import g
from werkzeug.security import generate_... |
from ..Script import Script
class PauseAtHeight(Script):
def __init__(self):
super().__init__()
def getSettingDataString(self):
return """{
"name":"Pause at height",
"key": "PauseAtHeight",
"metadata": {},
"version": 2,
"settings":
... |
# Test the 'trait_set', 'trait_get' interface to
# the HasTraits class.
#
# Copyright (c) 2014, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# License included in /LICENSE.txt and may be redistributed only under the
# conditions described in the... |
#!/usr/bin/env python3
#
# author: scott olesen <swo@alum.mit.edu>
from __future__ import print_function
import argparse, os.path, datetime, shutil, textwrap
from Bio import SeqIO
import dbotu
REQUIRED_HEADER_KEYS = ['genetic_criterion_threshold', 'abundance_criterion_threshold',
'distribution_criterion_thre... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import defaultdict
import numpy as np
import pytest
from goftests import multinomial_goodness_of_fit
from treecat.structure import find_center_of_tree
from treecat.structure import make_compl... |
import hashlib
import giveaminute.project as mProject
import giveaminute.idea as mIdea
import framework.util as util
from framework.log import log
#from framework.controller import *
class User():
def __init__(self, db, userId):
self.db = db
self.id = userId
self.data = self.populateUserDat... |
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions... |
from __future__ import division
import pysam
import numpy as np
import yaml
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.Alphabet import generic_dna
from seq_classes import locus, segment, tally
import argparse
import os
import json
def main():
parser = argparse.ArgumentParser(description='This scipts ... |
#!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to build chrome, executed by buildbot.
When this is run, the current directory (cwd) should be the outer build
directory... |
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.contrib import messages
from ummeli.opportunities.models import (Campaign, MicroTask, ACCEPTED,
MicroTa... |
#!/usr/bin/env python
''' A tool for analyzing the tools options for conflicts.
This tool analyzes the c files in the directory given as the first argument for
conflicting options within tpm command groups. The groups themselves are
organized by the standard document:
https://trustedcomputinggroup.org/wp-content/uploa... |
"""
This module defines common converter keys, used by consumers of the
converter layer to identify the desired conversion type when querying a
:py:class:`uplink.converters.ConverterFactoryRegistry`.
"""
# Standard library imports
import functools
# Local imports
__all__ = [
"CONVERT_TO_STRING",
"CONVERT_TO_R... |
# -*- coding: utf-8 -*-
from haystack import indexes
from meps.models import MEP
class MEPIndex(indexes.SearchIndex, indexes.Indexable):
fulltext = indexes.CharField(document=True, model_attr="content")
group = indexes.CharField(model_attr="group__abbreviation", faceted=True, default="")
country = indexe... |
#!/usr/bin/env python
"""
CmpRuns - A simple tool for comparing two static analyzer runs to determine
which reports have been added, removed, or changed.
This is designed to support automated testing using the static analyzer, from
two perspectives:
1. To monitor changes in the static analyzer's reports on real co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import ebaws.osutil
import util
from sarge import run, Capture, Feeder
from ebclient.eb_utils import EBUtils
from datetime import datetime
import time
import sys
import types
import subprocess
import shutil
import re
import psutil
import math
import consts
impor... |
#!/usr/bin/env python
"""
obs.py
State Estimation and Analysis for PYthon
Module to handle the observation structure within ROMS
Written by Brian Powell on 08/05/14
Copyright (c)2014 University of Hawaii under the BSD-License.
"""
from __future__ import print_function
import numpy as np
import netCDF4
imp... |
# statefbk.py - tools for state feedback control
#
# Author: Richard M. Murray, Roberto Bucher
# Date: 31 May 2010
#
# This file contains routines for designing state space controllers
#
# Copyright (c) 2010 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary for... |
#!/usr/bin/env python
def load_csv(data_file):
from csv import DictReader
with open(data_file, 'rb') as output_file:
data = DictReader(output_file)
data = [k for k in data]
return data
def main():
import sys
from utils import get_stencil_num
raw_data = load_csv(sys.argv[1])
k_l = set()
for k... |
#!/usr/bin/python
#
# File: lsf_status.py
#
# Author: George Papadimitriou
# e-mail: georgpap@isi.edu
#
#
"""
Query LSF for the status of a given job
Internally, it creates a cache of the LSF bjobs response and will reuse this
for subsequent queries.
"""
import os
import re
import pwd
import sys
import ti... |
from django.utils import simplejson
from django.http import HttpResponse
import datetime
import re
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from moocng.courses.models import Course, CourseTeacher
from moocng.courses.security import (get_course_progress_for_user)
from moocng.portal.templa... |
"""
Inspect a model with specific parameters defined in config_sandbox.py
"""
from __future__ import print_function
import visualutil
import setuputil
import yaml
import numpy
import lensutil
import os
from astropy.io import fits
from subprocess import call
import sample_vis
import uvutil
def plot(cleanup=True, ... |
"""
This file is part of Ludolph: Doorman plugin
See the LICENSE file for copying permission.
"""
import time
from doorman.doorman import Doorman
from ludolph_doorman import __version__
from ludolph.command import CommandError, command
from ludolph.plugins.plugin import LudolphPlugin
from ludolph.web import webhook, ... |
# 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.
from slave import recipe_api
class Gatekeeper(recipe_api.RecipeApi):
"""Module for Gatekeeper NG."""
def __call__(self, gatekeeper_json, gatekeeper_tre... |
# Under MIT License, see LICENSE.txt
from time import time
from PyQt4 import QtCore
from PyQt4 import QtGui
from Controller.QtToolBox import QtToolBox
from Controller.DrawQtObject.InfluenceMapQtObject import InfluenceMapQtObject
__author__ = 'RoboCupULaval'
class FieldView(QtGui.QWidget):
"""
FieldView es... |
# Under MIT License, see LICENSE.txt
from time import time
from PyQt4 import QtCore
from PyQt4 import QtGui
from Controller.QtToolBox import QtToolBox
from Controller.DrawingObject.InfluenceMapDrawing import InfluenceMapDrawing
__author__ = 'RoboCupULaval'
class FieldView(QtGui.QWidget):
"""
FieldView est... |
"""
Prepare all simulated datasets
"""
import numpy as np
np.random.seed(0)
import sys
import os
import gzip
import json
import itertools
import subprocess
from sircel.utils import IO_utils
from sircel.Sircel_master import get_args, run_all
from sircel.utils.Naive_pipeline import run_naive_pipeline
def evaluate_si... |
import re
import json
import logging
import operator
import itertools
import collections
import dt
logger = logging.getLogger(__name__)
class MetricsStorage(object):
'''
<datetime>: <value>
'''
def __init__(self, metrics=list()):
self._metrics = list()
if metrics:
sel... |
# -*- coding: utf-8 -*-
import codecs
import re
import difflib
import sys
import os
import duralex.alinea_parser as parser
import diff
from duralex.AbstractVisitor import AbstractVisitor
import duralex.tree as tree
class AddDiffVisitor(AbstractVisitor):
REGEXP = {
tree.TYPE_HEADER1_REFERENCE : re.c... |
from urwid import (Columns,
LineBox,
Text,
Frame,
ListBox,
AttrMap,
Padding,
SimpleListWalker,
signals,
connect_signal,
emit_signa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui Core.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# 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 restric... |
from itertools import product
from typing import Dict, List, Optional, Set, Tuple
default_bond_constraints = {
'H': 1, 'F': 1, 'Cl': 1, 'Br': 1, 'I': 1,
'O': 2, 'O+1': 3, 'O-1': 1,
'N': 3, 'N+1': 4, 'N-1': 2,
'C': 4, 'C+1': 5, 'C-1': 3,
'P': 5, 'P+1': 6, 'P-1': 4,
'S': 6, 'S+1': 7, 'S-1': 5,
... |
#!/usr/bin/env python
# Copyright (c) 2002, 2003, 2004 Joao Prado Maia. See the LICENSE file for more information.
# $Id: phpbb_mysql.py,v 1.15 2004-01-04 19:17:51 jpm Exp $
import MySQLdb
import time
from mimify import mime_encode_header, mime_decode_header
import re
import settings
import md5
import mime
import strut... |
import time
from django.test import TestCase
from django.contrib.auth.models import User
from django.conf import settings
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from io import BytesIO
import json
from login.models import Profile, AmbulancePermission, HospitalP... |
#!/usr/bin/env python2
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... |
"""
Generic entity edit view
"""
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2014, G. Klyne"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
import logging
log = logging.getLogger(__name__)
from django.conf import settings
from django.http ... |
from enum import auto
from django.utils.translation import ugettext_lazy as _
from django_enumfield.enum import Enum
class Access(Enum):
PUBLIC = auto()
SEMIPUBLIC = auto()
PRIVATE = auto()
__labels__ = {
PUBLIC: _("public"),
SEMIPUBLIC: _("semipublic"),
PRIVATE: _("private")... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for ``admin.packaging``.
"""
from glob import glob
import os
from subprocess import check_output, CalledProcessError, check_call
from textwrap import dedent
from unittest import skipIf
from twisted.python.filepath import FilePath
from twisted.pyt... |
from pathlib import Path
import pandas as pd
from sequana import logger
logger.name = __name__
def get_most_probable_strand(sample_folder, tolerance=0.10):
"""Return total counts by strand from featureCount matrix folder, strandness and
probable strand for a single sample (using a tolerance threshold for
... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for ``admin.packaging``.
"""
from glob import glob
from subprocess import check_output
from textwrap import dedent
from unittest import skipIf
from StringIO import StringIO
from twisted.python.filepath import FilePath
from twisted.python.procutil... |
import collections
import copy
class Manager(object):
"""Base class for all handler's managers.
Custom managers should inherit this functionality.
Attributes:
name: attribute name of owner class to which this manager assigned.
environ: Environ class object containing environment variable... |
import socket
import sys
class SerfConnectionError(Exception):
pass
class SerfConnection(object):
"""
Manages RPC communication to and from a Serf agent.
"""
def __init__(self, host='localhost', port=7373):
self.host, self.port = host, port
self._socket = None
def __repr__(... |
import sublime
import functools
import threading
def main_thread(callback, *args, **kwargs):
"""
Sends the callback to the sublime main thread by using the sublime.set_timeout function.
Most of the sublime functions need to be called from the main thread
:param callback: The callback function... |
import atexit
import os
import sys
import tempfile
import threading
import urllib
import netifaces
import qrcode
from PIL import ImageTk
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from Tkinter import Tk, Frame, Label, BitmapImage
from urlparse import urljoin
fr... |
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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 ... |
# Copyright (c) 2012 Intel, LLC
# Copyright (c) 2012 OpenStack, 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
#
# Unle... |
# -*- coding: utf8 -*-
import re
import colander
from pyramid.view import view_config
from pyramid.threadlocal import get_current_registry
from substanced.util import Batch
from dace.util import find_catalog
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from dace.util import getSite, allSubobjec... |
import ConfigParser
import os
import shutil
import tempfile
import unittest
from dcm.agent import config, cloudmetadata
import mock
from mock import patch, Mock
import sys
import dcm
import dcm.agent.cmd.configure as configure
from dcm.agent.cmd.service import get_config_files
import dcm.agent.tests.utils.general as t... |
from __future__ import print_function, absolute_import, division
from astropy import wcs
from astropy.io import fits
from astropy import units as u
from astropy import constants
from astropy.tests.helper import pytest
import warnings
import os
import numpy as np
from .helpers import assert_allclose
from . import path... |
#!/usr/bin/env python3
"""
** SELECTION SORT **
Space complexity:
- worst case: O(1)
Time complexity:
- worst case: O(n**2)
- average case: O(n**2)
- best case: O(n**2)
Algorithm's steps:
1. Find the smallest element. Swap it with the first element.
2. Fi... |
from unittest2 import skipIf
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from myuw.views.page import _is_mobile
from myuw.test.api import missing_url, MyuwApiTest
legacy_url = "http://some-test-server/myuw"
@override_sett... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 SUNET
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# noti... |
# coding=utf-8
## ES IMPORTANTE INDICAR EL ENCODING
import luigi
import os
import inspect
import re
import pickle
import unicodedata
#from gensim import corpora, models, similarities
import shutil
from pprint import pprint
# execfile('functions/TopicModeling.py')
# import time, datetime
execfile('functions/helper... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
import socket
import struct
import pkgutil
import logging
import hashlib
import xmlrpclib
import traceback
from ctypes import crea... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import distance as dist
from sklearn.neighbors import KNeighborsClassifier
# Load in the data
zip_data = pd.read_csv('./ela/data/zipcode_data.csv')
gen_data = pd.read_csv('./ela/data/generation_data.csv')
stor_data = pd.read_csv(... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
# Load in the data
zip_data = pd.read_csv('./ela/data/zipcode_data.csv')
gen_data = pd.read_csv('./ela/data/generation_data.csv')
stor_data = pd.read_csv('./ela/data/storage_data.csv')
gen_clf = ... |
from django.template import RequestContext, loader
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
#from ifind.search.engine.bing import
from ifind.search.query import Query
from keys import BING_API_KEY
from ifind.models.game_mechanics import GameMechanic
from... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys, math, random, json, re, base64
from collections import OrderedDict
import IPython.utils.timing
import numpy as np
import numpy.linalg as la
from scipy import optimize
# Importing URL-related routines, compatible with both python 2 & 3
try:
f... |
# this system uses structured settings.py as defined in http://www.slideshare.net/jacobian/the-best-and-worst-of-django
from formhub.settings import *
DEBUG = False # this setting file will not work on "runserver" -- it needs a server for static files
TESTING_MODE = False # used by celery startup
# override to set... |
"""Code that is responsible for the execution of Pipelines."""
from collections import defaultdict
import logging
import os
import random
import shutil
import tempfile
import time
import itertools
from django.utils import timezone
from django.db import transaction, OperationalError, InternalError
from django.contrib.... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
from multiprocessing import Process
from tools import blink, led_on, play_audio
from rythms import rythms_test1
import random
class GPIO_DEA(object):
"""docstring for GPIO_DEA"""
def __init__(self, pin_led, pin_onoff, pin_switch_shock, pin_cable... |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2009-2010 Ars Aperta, Itaapy, Pierlis, Talend.
#
# Authors: Hervé Cauwelier <herve@itaapy.com>
# Romain Gauthier <romain@itaapy.com>
#
# This file is part of Lpod (see: http://lpod-project.org).
# Lpod is free software; you can redistribute it and/or modify it under
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import json
"""
ansible -i dynamic_inventory.py all --list-host
ansible -i dynamic_inventory.py test --list-host
"""
if __name__ == '__main__':
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument... |
"""Utilities for asyncio-friendly file handling."""
from .threadpool import open
__version__ = "0.5.0.dev0"
__all__ = (open,)
|
import six
import json
import requests
import telnetlib
from collections import OrderedDict
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
from ..exceptions import NetParserException, NetJsonException
class BaseParser(object):
"""
Base Class for Parsers
To create a pars... |
import matplotlib.pyplot as plt
def calculate_cum_reward(policy):
"""Calculate cumulative reward with respect to time.
Parameters
----------
policy: bandit object
The bandit algorithm you want to evaluate.
Return
---------
cum_reward: dictionary
... |
# -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
from factory import DjangoModelFactory, lazy_attribute, LazyAttribute, \
SubFactory, post_generation
import random
from workflow.models import (
ApprovalWorkflow as ApprovalWorkflowM,
ApprovalType as ApprovalTypeM,
Award as Awa... |
#!/usr/bin/env python
"""
<Program Name>
keys.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
October 4, 2013.
<Copyright>
See LICENSE for licensing information.
<Purpose>
The goal of this module is to centralize cryptographic key routines and their
supported operations (e.g., creating ... |
import string
class Protocol(object):
ALPHA = string.ascii_letters
DIGIT = string.digits
UNRESERVED = ALPHA + DIGIT + '-' '.' '_' '~'
GEN_DELIMS = ':' '/' '?' '#' '[' ']' '@'
SUB_DELIMS = '!' '$' '&' '\'' '(' ')' '*' '+' ',' ';' '='
RESERVED = GEN_DELIMS + SUB_DELIMS
PCT_ENCODED = '%' + ... |
from .. import mapper
from .. import IniConfigFile
@mapper("nova.conf")
class NovaConf(IniConfigFile):
pass
|
#!/usr/bin/env python
"""
<Program Name>
keys.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
October 4, 2013.
<Copyright>
See LICENSE for licensing information.
<Purpose>
The goal of this module is to centralize cryptographic key routines and their
supported operations (e.g., creating ... |
# Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from hamcrest import *
import os
import unittest
import xml.etree.ElementTree as ET
from ...test.hamcrest import ComposedMatcher, HasAttrs, e... |
#!/usr/bin/env python
import Queue, textwrap, time
import tx
import block
import monitor
import peers
import wallet
import splash
import console
import net
def resize(s, state, window):
if state['mode'] == 'transaction':
tx.draw_window(state, window)
elif state['mode'] == 'block':
block.draw_w... |
#!/usr/bin/env python
import confu
parser = confu.standard_parser()
parser.add_argument("--backend", dest="backend", default="auto",
choices=["auto", "psimd", "scalar"])
parser.add_argument("--inference-only", dest="inference_only", default=False,
action="store_true",
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2014 The python-semanticversion project
# This code is distributed under the two-clause BSD License.
from __future__ import unicode_literals
import functools
import re
from .compat import base_cmp
def _to_int(value):
try:
return int(value), True
except V... |
#!/usr/bin/python
import Adafruit_DHT
import argparse
SENSOR = Adafruit_DHT.DHT22
DEFAULT_PIN = 27
def setup_args():
ap = argparse.ArgumentParser(prog='DHTtemp')
ap.add_argument('-t', action='store_true', help='show temperature')
ap.add_argument('-hu', action='store_true', help='show humidity')
ap.ad... |
"""
Source: https://trac.ffmpeg.org/wiki/Encode/H.264
"""
import os
import sys
import getopt
import subprocess
import re
USAGE_INFO = 'python3 encode.py -i <input_dir> -o <output_dir> [--debug] [--dry]'
FFMPEG_PATH = '/usr/local/bin/ffmpeg'
VIDEO_CODEC = 'h264'
VIDEO_ENCODER = 'h264_omx'
AUDIO_CODEC = 'aac'
AUDIO_EN... |
# Author Michele Mattioni
# Tue Oct 6 08:01:52 BST 2009
class Stimul(object):
"""Store the inputs we are going to deliver to the different synapses"""
def __init__(self, time, number, interval, chan_type, noise=0):
self.time = time
self.number = number
self.chan_type = chan... |
import requests
import json
METADATA_URL = 'http://submit.encodedcc.org'
FILES_URL = 'https://encodedcc.sdsc.edu/cgi-bin/edwWebSubmit'
headers = {'content-type': 'application/json'} # may not be necessary
# you have to get these from the DCC after loggin in
# with your email address
key_pair = {
"user": "script_... |
#!/usr/bin/env python
import Queue, textwrap, time
import tx
import block
import monitor
import peers
import wallet
import splash
import console
import net
import forks
def resize(s, state, window):
if state['mode'] == 'tx':
tx.draw_window(state, window)
elif state['mode'] == 'block':
block.dr... |
#----------------------------------------------------------------------
# Copyright (c) 2011-2013 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.