src stringlengths 721 1.04M |
|---|
from fabric.api import run, sudo, env, roles, settings, hide, execute, local, put, get, show
import re, pdb
import time
env.connection_attempts = 250
env.timeout = 1
env.abort_on_prompts = True
env.disable_known_hosts = True
env.no_keys = True
env.no_agent = True
##################### move to mapred environment
env.u... |
#!/usr/bin/python
import pyaudio
import wave
import opus
from opus import encoder, decoder
import time
import RPIO
#the gpio routines
PTT_PIN = 27
def gpio_init():
global PTT_PIN, COR_PIN
print "RPi Board rev %d" % (RPIO.RPI_REVISION)
RPIO.setwarnings(False)
#RPIO.setmode(RPIO.BOARD)
RPIO.setup(P... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 20 12:01:18 2015
@author: Eric Dodds
Abstract dictionary learner.
Includes gradient descent on MSE energy function as a default learning method.
"""
import numpy as np
import pickle
# the try/except block avoids an issue with the cluster
try:
import matp... |
# Generate a Secret
import hashlib
import string
# Globals {{{1
DEFAULT_PASSPHRASE_LENGTH = 4
DEFAULT_PASSWORD_LENGTH = 12
DEFAULT_SEPARATOR = ' '
DEFAULT_ALPHABET = string.ascii_letters + string.digits
# Utilities {{{1
# Partition a string into chunks, each of chars_per_chunk characters, and return
# them one at a ... |
from base64 import b64encode
from io import BytesIO
from uuid import uuid4
import requests
import time
import wddx
import settings
TRANSFER_API_URL_FMT = 'https://transfer.nyp.org/seos/1000/%s.api'
TRANSFER_LOGIN_URL = TRANSFER_API_URL_FMT % 'login'
TRANSFER_FIND_URL = TRANSFER_API_URL_FMT % 'find'
TRANSFER_PUT_URL ... |
# -*- coding: utf8 -*-
import feedparser
from bs4 import BeautifulSoup
from datetime import datetime
from time import mktime
class MeetupRSS:
MEETUP_DOMAIN = 'www.meetup.com'
def __init__(self, group_id):
self.group_id = group_id
self.__rss__ = None
self.__events__ = None
@proper... |
# encoding:utf-8
"""
:synopsis: views diplaying and processing main content post forms
This module contains views that allow adding, editing, and deleting main textual content.
"""
import datetime
import logging
import os
import os.path
import random
import sys
import tempfile
import time
from django.shortcuts import ... |
##
# getpthreadfunctions.py - outputs the pthread man page to mapthread.txt
# parses the latter, creates a dictionary with pairs
# (functionname, list of function args where last element is result type)
# marshals dictionary to pthreaddict file
#
# Author - Christos Stergiou (chster@eecs.berkeley.edu)
#
import os,re,... |
"""
Module containing widgets specific to the Pisak audio player application.
"""
from gi.repository import Mx, GObject
from pisak import res, widgets, configurator, properties, pager
from pisak.audio import db_manager
class FoldersSource(pager.DataSource):
"""
Data source that provides tiles representing di... |
# $Id: gp_macosx.py 291 2006-03-03 08:58:48Z mhagger $
# Copyright (C) 1998-2003 Michael Haggerty <mhagger@alum.mit.edu>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""gp_macosx -- an interface to the command line version of gnuplot
used under Mac OS ... |
#!/usr/bin/env python
# Copyright (C) 2014 Statoil ASA, Norway.
#
# The file 'test_grid.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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... |
"""
IcsR53: Library for Route53
---------------------------
+--------------------+------------+--+
| This is the IcsR53 common library. |
+--------------------+------------+--+
"""
import time
import string
from boto.route53 import Route53Connection
#from boto.route53.zone import Zone
from boto.route53.record import... |
# -*- coding: utf-8 -*-
import re
from flask import (
render_template, current_app,
request, abort, flash, redirect, url_for
)
from flask_login import current_user
from purchasing.database import db
from purchasing.utils import SimplePagination
from purchasing.decorators import wrap_form, requires_roles
from... |
"""
Utility functions for
- building and importing modules on test time, using a temporary location
- detecting if compilers are present
"""
import os
import sys
import subprocess
import tempfile
import shutil
import atexit
import textwrap
import re
import random
import nose
from numpy.compat i... |
"""
xanalytics.gzipfs.xattrs
==============
Extended-attribute support for GZIPFS
"""
import os
import sys
import errno
from fs.errors import *
from fs.path import *
from fs.base import FS
try:
import xattr
except ImportError:
xattr = None
if xattr is not None:
class GZIPFSXAttrMixin(object):
... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
try:
from cdecimal import Decimal
except ImportError: # pragma: no cover
from decimal import Decimal
import warnings
import json
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import os
import sys
import six
from six.move... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## 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 ve... |
# -----------------------------------------------------------------------------
# Karajlug.org
# Copyright (C) 2010 Karajlug community
#
# 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 Found... |
# -*- coding: utf-8 -*-
"""
Model classes for messages received over the bittorrent protocol.
"""
from __future__ import annotations
__all__ = ['Message', 'Handshake', 'KeepAlive', 'Choke', 'Unchoke',
'Interested', 'NotInterested', 'Have', 'Bitfield', 'Request',
'Block', 'Piece', 'Cancel', 'MES... |
# Copyright 2015 Denver Coneybeare <denver@sleepydragon.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This ... |
from unittest.mock import MagicMock
from asynctest import CoroutineMock
from alarme import Action
from tests.common import BaseTest
class ActionTest(BaseTest):
def setUp(self):
super().setUp()
self.app = MagicMock()
self.id = MagicMock()
self.action = Action(self.app, self.id)
... |
# -*- coding: utf-8 -*-
"""This file contains the Windows NT Known Folder identifier definitions."""
from __future__ import unicode_literals
# For now ignore the line too long errors.
# pylint: disable=line-too-long
# For now copied from:
# https://code.google.com/p/libfwsi/wiki/KnownFolderIdentifiers
# TODO: stor... |
from __future__ import unicode_literals
from django.core.exceptions import FieldError
from django.test import TestCase
from django.utils import six
from .models import (
Entry, Line, Post, RegressionModelSplit, SelfRefer, SelfReferChild,
SelfReferChildSibling, Tag, TagCollection, Worksheet,
)
cl... |
from __future__ import print_function
# Explore some possibilities for optimizing the grid.
import sys
import numpy as np
from scipy.linalg import norm
from ..spatial import field
class OptimizeGridMixin(object):
""" Meant to be mixed in with paver.Paving, to add some methods for optimizing a
grid.
"""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-05-07.
# 2019, SMART Health IT.
from . import element
class ContactPoint(element.Element):
""" Details of a Technology mediated contact point (phone, fax, email,... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
class GDCVaultIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)'
_TESTS = [
{
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-29 10:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MyUser'... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
"""
search_part.py realize the part search
@author: Bowen
"""
from elasticsearch import Elasticsearch
from design.models import parts, teams, team_parts, part_papers, paper
import traceback
def getPart(partName):
"""
find the part with part name
@param partName: name of a part
@type partName: str
... |
#!/usr/bin/python
#
# OpenPMR - tools to make old PMR radios useful.
#
# Copyright (C) 2013,2014 John Gumb, G4RDC
#
# This file is part of OpenPMR.
# OpenPMR 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, e... |
"""
Tools for working with Computer Programs in Seismology velocity models
"""
import os
import numpy as np
import datetime
import pandas as pd
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from rockfish2 import logging
from rockfish2.models.profile import Profile
class CPSModel1d(Profile):
... |
from debuginfo_trace_writer import DebugInfoTraceWriter
import sys
'''
Generate a trace simulating an exec. When an exec happens, the address space
of the process is reset (previously loaded libraries are not there anymore,
and the main executable is replaced), so any know mapping should be forgotten.
In the trace, t... |
# Warning: not part of the published Quick2Wire API.
#
# Converted from i2c.h and i2c-dev.h
# I2C only, no SMB definitions
from ctypes import c_int, c_uint16, c_ushort, c_short, c_char, POINTER, Structure
# /usr/include/linux/i2c-dev.h: 38
class i2c_msg(Structure):
"""<linux/i2c-dev.h> struct i2c_msg"""
_fie... |
#!/usr/bin/python
#
# nodewatcher monitoring daemon
#
# Copyright (C) 2009 by Jernej Kos <kostko@unimatrix-one.org>
#
# First parse options (this must be done here since they contain import paths
# that must be parsed before Django models can be imported)
import sys, os
from optparse import OptionParser
print "======... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('globenocturneapp', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DMSPDataset',
fie... |
"""Bag class is a container for generic items."""
class Bag(object): # <Item> implements Iterable<Item>:
"""The Bag class represents a bag (or multiset) of generic items."""
class _Node(object): # private static class <Item>:
"""helper linked list class"""
def __init__(self, Item, Next):
self._item... |
from numpy import *
from util.gen_util import *
from util.math_util import *
from util.dtree_util import *
from rnn.adagrad import Adagrad
import rnn.propagation as prop
from classify.learn_classifiers import validate
import cPickle, time, argparse
from multiprocessing import Pool
# splits the training data into mini... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
# coding: utf-8
# In[1]:
get_ipython().magic('pylab inline')
from pylab import *
from mkCSPs import *
# In[18]:
# In[2]:
SHARDS = FilterSet('../../HFF/transmCurves_SHARDS/shards_f*.res')
gs = glob('../smpy-fit/GOODS-S_18_FilterCurves/Filter*.txt')
print(gs)
#for filt in gs:
# SHARDS.addFileFilter(filt)
# In... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
# OpenSCAD example, ported by Michael Mlivoncic
# a beautiful dice...
# an interesting test case, to get the Boolean operations somehow fixed (TODO)
#import sys
#sys.path.append("O:/BlenderStuff")
import blendscad
#import imp
#imp.reload(blendscad)
#imp.reload(blendscad.core)
#imp.reload(blendscad.primitives)
... |
# -*- coding: utf-8 -*-
from collections import namedtuple
try:
from string import lowercase
except:
from string import ascii_lowercase as lowercase
grammar_rule = namedtuple('grammar_rule', ['pattern', 'valid_following_patterns'])
OPENPAREN = ['(']
CLOSEPAREN = [')']
VAR = [letter for letter in lowercase.r... |
#! /usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import collections
import os
import re
import shutil
import sys
import tempfile
import zipfile
import devil_chromium
... |
from django.conf import settings
from django import newforms as forms
from datetime import datetime, time, date
from time import strptime
# DATETIMEWIDGET
calbtn = u"""
<script type="text/javascript">
Calendar.setup({
inputField : "%s",
ifFormat : "%s",
button ... |
# coding: utf-8
"""
Notifications API
Notifications # noqa: E501
The version of the OpenAPI document: 2.1.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import telestream_cloud_notifications
from ... |
import os
import hashlib
from ensconce.crypto import MasterKey, state, util as crypto_util
from ensconce import exc
from tests import BaseModelTest
class EphemeralStateTest(BaseModelTest):
def setUp(self):
super(EphemeralStateTest, self).setUp()
# We need to reset the state
state.se... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
from urllib import request
from urllib.error import URLError
from lxml import etree
import re
import pymysql
def get_page(url):
req=request.Request(url)
req.add_header('User-Agent', 'Mozilla/6.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/8.0 Mobile/10A5376e Safari... |
# Exercise 35: Branches and Functions
from sys import exit
def gold_room():
print "This room is full of gold. How much do you take?"
choice = raw_input("> ")
if "0" in choice or "1" in choice:
how_much = int(choice)
else:
dead("Man, learn to type a number.")
if how_much < 50:
... |
# -*- coding: utf-8 -*-
"""
solace.badges
~~~~~~~~~~~~~
This module implements the badge system.
:copyright: (c) 2010 by the Solace Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from operator import attrgetter
from solace.i18n import lazy_gettext, _
from sol... |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... |
from __future__ import absolute_import
import responses
from mock import patch
from exam import fixture
from django.test import RequestFactory
from sentry.integrations.github.integration import GitHubIntegration
from sentry.models import Integration, ExternalIssue
from sentry.testutils import TestCase
from sentry.ut... |
## begin license ##
#
# "Meresco Components" are components to build searchengines, repositories
# and archives, based on "Meresco Core".
#
# Copyright (C) 2011-2012, 2015 Seecr (Seek You Too B.V.) http://seecr.nl
# Copyright (C) 2011, 2015 Stichting Kennisnet http://www.kennisnet.nl
# Copyright (C) 2012 Stichting Bibl... |
"""
Node connecting to the broker like a normal player,
except it stores an up-to-date game state by subscribing to all in-game events,
and it runs the whole game with its own tick.
"""
from __future__ import division # So to make division be float instead of int
from network import poll_for, Handler
from random imp... |
import importlib
import uuid
import boto3
from botocore.exceptions import ClientError
from noopy import settings
from noopy.endpoint import Endpoint, Resource
class ApiGatewayDeployer(object):
def __init__(self, function_arn, stage):
self.function_arn = function_arn
self.stage = stage
s... |
import numpy as np
class ODF_Slice(object):
def __init__(self,odfs,vertices,faces,noiso,batch,group=None):
J=0
self.odfs_no=J
self.vertex_list=(odfs.shape[0]*odfs.shape[1])*[None]
for index in np.ndindex(odfs.shape[:2]):
values=odfs[index]
if noi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Zuza Software Foundation
# Copyright 2013-2014 Evernote Corporation
#
# This file is part of Pootle.
#
# Pootle 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 lxml.etree as ET
gexf_doc = """
<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">
<meta lastmodifieddate="{}">
<creator>https://dig-ed-cat.acdh.oeaw.ac.at</creator>
<description>The dig-ed-cat-net</description>
</meta>
<graph defaultedgetype="directed">
<attributes cl... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2021 Jose Antonio Chavarría <jachavar@gmail.com>
# Copyright (c) 2015-2021 Alberto Gacías <alberto@migasfree.org>
#
# 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... |
#!/usr/bin/env python
import os
import re
from setuptools import setup
DIRNAME = os.path.abspath(os.path.dirname(__file__))
rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts))
README = open(rel('README.rst')).read()
MAIN = open(rel('ldif3.py')).read()
VERSION = re.search("__version__ = '([^']+)'", MA... |
# -*- coding: utf-8 -*-
from pytest import raises
# The parametrize function is generated, so this doesn't work:
#
# from pytest.mark import parametrize
#
import pytest
parametrize = pytest.mark.parametrize
from hotchip import metadata
from hotchip.main import main
class TestMain(object):
@parametrize('help... |
from elasticsearch import Elasticsearch # type: ignore
from elasticsearch_dsl import Search # type: ignore
from typing import Any, Dict, List, Tuple, Union
from service import app
ELASTICSEARCH_ENDPOINT = app.config['ELASTIC_SEARCH_ENDPOINT']
MAX_NUMBER_SEARCH_RESULTS = app.config['MAX_NUMBER_SEARCH_RESULTS']
SE... |
# import numpy
# from cycgkit.cgtypes import vec3, quat
def getClosest(keys, time, chrid, sortedKeys):
def getfrom(keys1, time, ch):
try:
if ch == 'p':
return keys1[time].position
elif ch == 's':
return keys1[time].scale
else:
... |
#!/usr/bin/env python2
# * **************************************************************** **
# File: program.py
# Requires: Python 2.7+ (but not Python 3.0+)
# Note: For history, changes and dates for this file, consult git.
# Author: Brian Danilko, Likeable Software (brian@likeablesoftware.com)
# Copyright 2015-2017... |
# -*- coding: UTF-8 -*-
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of Wammu <https://wammu.eu/>
#
# 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 ve... |
# -*- 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... |
"""This file provides a class used for incrementally updating a single gaussian inference problem.
The functionality 'setting apart' this class, is that includes a method that flattens the parameter distributions, while retaining the
predictive distribution. This allows simple moving average calculation without... |
#!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law ... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
from sleekxmpp import Iq
from sleekxmpp.plugins import BasePlugin
from sleekxmpp.xmlstream.handler import Callb... |
"""
Django settings for main project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
from scipy.io import wavfile
import numpy as np
from scipy.signal import firwin, lfilter, hamming
def _num_windows(length, window, step):
return max(0, int((length - window + step) / step))
def window_slice_iterator(length, window, step):
"""Generate slices into a 1-dimensional array of specified *length*
... |
from __future__ import division
import pytest
import numpy as np
import itertools
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils import check_array
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created: Tue May 2 23:29:11 2017
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attri... |
#coding=utf-8
#author='Shichao-Dong'
import sys,os
reload(sys)
sys.path.append('D:\Ptest\Appium\Testcase')
from appium import webdriver
import unittest
import time
from public import public
from logs.log import log
class visit_temp(unittest.TestCase):
log = log()
u'临时拜访--通用流程'
@classmethod
def setUpC... |
import logging
from azure.cosmos.cosmos_client import CosmosClient
from azure.cosmos.errors import HTTPFailure
from config import Mongo
log = logging.getLogger(__name__)
def configure_collections(db_name, collection_names, master_key, url_connection):
client = CosmosClient(url_connection=url_connection, auth={"ma... |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2011-2013 Bitcraze AB
#
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
owner_users = {'email': 'prozorroytenderowner@gmail.com',
'password': '123456'}
provider_users = {
'prozorroyprovider2@gmail.com': '123456'
}
# 'prozorroyprovider1@gmail.com': '123456',
broker = {'url': 'http://25h8.byus... |
"""Dot-notation dictionary data structures.
Used to make dictionaries where keys can be accessed like properties through
dot notation.
.. moduleauthor:: Dave Zimmelman <zimmed@zimmed.io>
Exports:
:class DotDict -- Standard mutable dot-notation dictionary.
:class ImmutableDotDict -- Dot-notation dictionary th... |
import django_filters
from django.db.models import Q
from extras.filters import CustomFieldModelFilterSet, CreatedUpdatedFilterSet
from utilities.filters import BaseFilterSet, NameSlugSearchFilterSet, TagFilter, TreeNodeMultipleChoiceFilter
from .models import Tenant, TenantGroup
__all__ = (
'TenancyFilterSet',
... |
import os
import unittest
import mocker.utils
class TestUtils(unittest.TestCase):
def setUp(self):
self.data_path = './tests/data'
def test_compute_file_path_for_get(self):
path = '/test'
command = 'GET'
file_path = mocker.utils.compute_file_path(self.data_path, path, comman... |
import sys
from django import http
from django.core import signals
from django.utils.encoding import force_unicode
from django.utils.importlib import import_module
class BaseHandler(object):
# Changes that are always applied to a response (in this order).
response_fixes = [
http.fix_location... |
import autograd.numpy as np
import numpy.testing as np_testing
import pymanopt
from pymanopt.manifolds import Euclidean, FixedRankEmbedded, Product
from ._test import TestCase
class TestProblemBackendInterface(TestCase):
def setUp(self):
self.m = m = 20
self.n = n = 10
self.rank = rank = ... |
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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, copy, modify, merge... |
#!/usr/bin/env python
import sys
import os
import filecmp
from feed_maker_util import exec_cmd
def test_script(feed, script, work_dir, test_dir, index):
os.chdir(work_dir)
cmd = "cat %s/input.%d.txt | %s > %s/result.%d.temp" % (test_dir, index, script, test_dir, index)
#print(cmd)
(result, error) = ... |
import sys
import time
from typing import Any, List, Optional
import tempfile
import pytest
import inspect
import requests
from fastapi import (Cookie, Depends, FastAPI, Header, Query, Request,
APIRouter, BackgroundTasks, Response)
from fastapi.middleware.cors import CORSMiddleware
from fastapi.re... |
import utils
import config
import re
import git
import copy
import comment_list
import webbrowser
import github
try:
import vim
except ImportError as e:
vim = False
i_hash = {} # hash individual issues
class Issue:
defaults = {
"title": "",
"assignee": "",
"milestone": "",
... |
"""The Hunter Douglas PowerView integration."""
import asyncio
from datetime import timedelta
import logging
from aiopvapi.helpers.aiorequest import AioRequest
from aiopvapi.helpers.constants import ATTR_ID
from aiopvapi.helpers.tools import base64_to_unicode
from aiopvapi.rooms import Rooms
from aiopvapi.scenes impor... |
import sys
import pytest
from conftest import get_config, network_delay
import bonsai
from bonsai import LDAPClient
from bonsai.ldapconnection import LDAPConnection
@pytest.fixture(scope="module")
def url():
""" Get the LDAPURL. """
cfg = get_config()
url = "ldap://%s:%s" % (cfg["SERVER"]["hostip"], cfg... |
""" Library for parsing route output from VPR route files. """
from collections import namedtuple
Node = namedtuple('Node', 'inode x_low y_low x_high y_high ptc')
def format_name(s):
""" Converts VPR parenthesized name to just name. """
assert s[0] == '('
assert s[-1] == ')'
return s[1:-1]
def form... |
"""
Functions to get insight into the data
"""
import sys
import pickle
#
# Categories anaylisis of all the amazon data
#
# Number of products: 2498330
# Multilabel elements: 888864
# Percentage of products with a given category
# ============================================
# Collectibles: 0.000273
# Music: 0.024316... |
import sys
if sys.version_info < (3, 7):
from ._zsrc import ZsrcValidator
from ._zhoverformat import ZhoverformatValidator
from ._zcalendar import ZcalendarValidator
from ._z import ZValidator
from ._ysrc import YsrcValidator
from ._yhoverformat import YhoverformatValidator
from ._ycalendar... |
# -*- coding: utf-8 -*-
"""Display Craigslist rental market statistics"""
# standard imports
import argparse
import os
import re
import statistics
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from datetime import timedelta
from textwrap import dedent
# external imports
import appdirs
impo... |
"""
Usage:
phenix.python dano_vs_d.py your.sca 20
"""
import iotbx.file_reader
from cctbx.array_family import flex
def run(hklin, n_bins):
for array in iotbx.file_reader.any_file(hklin).file_server.miller_arrays:
# skip if not anomalous intensity data
if not (array.is_xray_intensity_array() and a... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
#!/usr/bin/env python3
# Version 1.0
# Author Alexis Blanchet-Cohen
# Date: 09/06/2014
import argparse
import glob
import os
import subprocess
import util
# Read the command line arguments.
parser = argparse.ArgumentParser(description="Generates Picard tools MarkDuplicates scripts.")
parser.add_argument("-s", "--scr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed... |
import subprocess
import re
import os
filename = ''
def findAndGet(url, lines):
retVal = None
fname, root, query = getFilename(url)
resrc = re.compile('.*src="%s(.*)".*' % url)
rebg = re.compile('.*\(%s(.*)\).*' % url)
for line in lines:
match = resrc.match(line)
if match:
... |
from cms.toolbar.items import Menu, ModalItem, SubMenu
from cms.utils.i18n import get_language_object
from django.contrib.auth.models import Permission, User
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.encoding import force_text
from djangocms_page_meta.cms_toolbar... |
from __future__ import unicode_literals
import logging
import pymongo
from django.core import signing
from django.conf import settings
from . import models, exceptions
SECRET_KEY = "test"
routing = {}
logger = logging.getLogger(__name__)
def resolve(name):
return routing[name]
def event(message_or_func):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.