src stringlengths 721 1.04M |
|---|
import os
import logging
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] [%(funcName)s:%(lineno)d] %(message)s',
'datefmt': '%m/%d/%Y %I:%M:%S %p',
},
},
'handlers': {
... |
import sys
import music, language
_debug_ = False
replacements = [('full note', 'semibreve'), ('whole note', 'semibreve'), ('half note', 'minim'), ('quarter note', 'crotchet'), ('eighth note', 'quaver'), ('sixteenth note', 'semiquaver'), ('32nd note', 'demisemiquaver'), ('sharp', '#'), ('flat', 'b')]
translatetimes = ... |
"""Misc utilities."""
import os
import sys
import logging
import hashlib
from textwrap import TextWrapper
from random import random
def rando(salt=None):
"""
Generate a random MD5 hash for whatever purpose. Useful for testing
or any other time that something random is required.
:param salt: Optiona... |
from datetime import datetime, date, timedelta
import re
from django.db import models, transaction, IntegrityError
from django.db.models import Q
from django.contrib.auth.models import User
from django.conf import settings
from django.forms import ValidationError
from django.core.exceptions import PermissionDenied
fr... |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 21:49:22 2015
@author: Alisa
"""
import os
import utils, urlutils
URL1 = "http://abc-english-grammar.com/1/sochinenia_po_angliiskomu_yaziku.htm"
str_to_look = "<a href=\"http://abc-english-grammar.com/1/sochinenia_po_angliiskomu_yaziku"
URL2 = "http://en365.ru/topic... |
#
# Copyright 2015 Olli Tapaninen, VTT Technical Research Center of Finland
#
# 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... |
"""
A collection of functions to find the weights and abscissas for
Gaussian Quadrature.
These calculations are done by finding the eigenvalues of a
tridiagonal matrix whose entries are dependent on the coefficients
in the recursion formula for the orthogonal polynomials with the
corresponding weighting function over ... |
#!/usr/bin/python
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
import procgame.game, sys, os
import procgame.config
import random
import procgame.sound
sys.path.insert(0,os.path.pardir)
import bingo_emulator.common.units as units
import bingo_em... |
# Copyright (c) Amr Ali <amr.ali.cc@gmail.com>
# See LICENSE for details.
import os
import sys
import unittest
from StringIO import StringIO
from pybf import Interpreter
def _get_fd(filename):
samples_dir = os.path.join(os.path.dirname(__file__), "samples")
return file(os.path.join(samples_dir, filename))
cl... |
# -*- coding: utf-8 -*-
'''Samples generators
'''
from __future__ import with_statement, division, absolute_import, print_function
from array import array
from math import pi, sin
from random import SystemRandom
# http://stackoverflow.com/a/5174008
def synth_complex(freqs=None, coefs=None, datasize=0, fname=''):
... |
import numpy as np
import cPickle as pickle
from AudioPipe.features import mfcc
from silence import remove_silence
import scipy.io.wavfile as wav
import librosa
from skgmm import GMMSet, GMM
class GMMRec(object):
def __init__(self):
self.features = []
self.gmmset = GMMSet()
self.classes =... |
#!/usr/bin/python
# This script prints the IPs that are likely natted using the TCP timestamp option.
# The script invokes tshark and gets as parameter a pcap file.
# Copyright 2015 Marc-André Bär
import sys
import subprocess
listIPs=[]
listNattedIPs=[]
#Returns number of frames
def getFrameCount(frames):
return... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c)2012 Rackspace US, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.a... |
from __future__ import division
""" This module handles the wavecat.dat table presently used by the
synphot countrate task (and thus the ETC) to select an appropriate wavelength
set for a given obsmode. """
import re
import os
import numpy as N
import locations
class Wavetable(object):
""" Class to h... |
import mf
class FuzzySet(object):
"""docstring for FuzzySet"""
TRIMF = 'trimf'
def __init__(self, name, params, _range, type=TRIMF):
self.name = name
self.type = type
self.params = params
self.range = _range
def _get_mf(self, input_value):
return mf.trimf(in... |
from django.contrib.auth import authenticate, logout, login
from django.contrib.auth import get_user_model
from django.http import HttpResponse
from app.models import Label, Place, Guide, Question, Answer
from hashlib import md5
import json
import re
LOGIN_OK_CODE = 200
LOGIN_OK = 'Login success'
LOGOUT_OK_CODE = 201... |
import os
import re
import socket
import pyqrcode
import requests
import xbmc
import xbmcgui
import xbmcaddon
import xbmcvfs
ADDON = xbmcaddon.Addon()
ADDONID = ADDON.getAddonInfo('id')
ADDONNAME = ADDON.getAddonInfo('name')
ADDONVERSION = ADDON.getAddonInfo('version')
CWD = ADDON.getAddonInfo('path').decode('utf-8')
... |
# encoding: utf-8
"""
neighbor.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from collections import deque
from collections import Counter
from exabgp.protocol.family import AFI
from exabgp.util.dns import ho... |
import shutil
import os
import webbrowser
from socketserver import TCPServer
from dbt.include import DOCS_INDEX_FILE_PATH
from dbt.compat import SimpleHTTPRequestHandler
from dbt.logger import GLOBAL_LOGGER as logger
from dbt.task.base_task import RunnableTask
class ServeTask(RunnableTask):
def run(self):
... |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2018 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... |
from gitlab import cli, utils
from gitlab import exceptions as exc
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import RefreshMixin, RetrieveMixin
__all__ = [
"ProjectJob",
"ProjectJobManager",
]
class ProjectJob(RefreshMixin, RESTObject):
@cli.register_custom_action("ProjectJob")
... |
# -*- encoding: UTF-8 -*-
"""
'I Refuse' web application.
Copyright (C) 2017 Jacob Delgado
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... |
from flask import Blueprint, jsonify, request
from flask_login import login_required
import data_tools as dt
from helpers import get_current_user, handle_exception
analyses_api = Blueprint('analyses_api', __name__, url_prefix='/api/analyses')
@analyses_api.route('/', methods=['GET', 'POST'])
@login_required
def lis... |
'''
Created on 8 Oct 2015
@author: MBRANDAOCA
'''
import logging
logger = logging.getLogger('ankiwiktionarygrabber')
import re
from .entities import Word
import pprint
class DutchParser:
def __init__(self, wordName, sourceText):
self.wordName = wordName
self.sourceText = sourceText
s... |
import os
import shutil
import tempfile
import ConfigParser
import epumgmt.defaults.log_events
from epumgmt.defaults import DefaultParameters
from mocks.common import FakeCommon
class TestAmqpEvents:
def setup(self):
self.runlogdir = tempfile.mkdtemp()
self.vmlogdir = tempfile.mkdtemp()
... |
from poretools.Fast5File import Fast5FileSet
import sys
# extract with constraints:
# -- only one group ever
# -- only one flowcell ID ever
# -- always unique read ID
def run(parser, args):
flowcells = set()
reads = set()
i = 0
basecaller_version = None
for fast5 in Fast5FileSet(args.directory, None, args... |
import zlib
import socket
import struct
from pyexfil.includes.prepare import PrepFile, DEFAULT_KEY
GQUIC_PORT = 443
def _send_one(data, pckt_counter, dest_ip, dest_port=GQUIC_PORT, ccc=None):
"""
Send out one packet of data
:param data: Data to send [str]
:param pckt_counter: Counter of file/comm [int]
:param... |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... |
#
# Extensible User Folder
#
# (C) Copyright 2000-2005 The Internet (Aust) Pty Ltd
# ACN: 082 081 472 ABN: 83 082 081 472
# All Rights Reserved
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MER... |
# -*- coding: utf-8 -*-
"""
Helper functions to assist file upload to db using boottle, sqlachemy
Requires specific class definition as :
class Upload(Base, MkMixin):
id = Column(BigInteger, Sequence('gn_upload'), primary_key=True)
uuid = Column(String(40), unique=True)
file_name = Column(String(200))
... |
"""
Unit test for cgroup_service - Treadmill cgroup service
"""
import os
import tempfile
import unittest
import select
import shutil
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
import mock
import treadmill
from treadmill.services import cgroup_service
class CGroupServ... |
""" Process all the model finetuning output files in the given directory
and produce a lineplot of the top 10 models based on reconstruction error.
Fine-tuning file names look like this: finetune_sda_900_500_100_50.2013-06-16.02:25:26.981658
The average training error for each epoch and batch is reported:
e.g epoch 1... |
from datetime import timedelta
from django.conf import settings
try:
from celery import conf as celeryconf
DEFAULT_ROUTING_KEY = celeryconf.DEFAULT_ROUTING_KEY
except ImportError:
DEFAULT_ROUTING_KEY = "celery"
DEFAULT_DEFAULT_POST_LIMIT = 20
DEFAULT_NUM_POSTS = -1
DEFAULT_CACHE_MIN = 30
DEFAULT_ENTRY_WO... |
# Lint as: python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
from math import ceil
from bearlibterminal import terminal
from goldminer import settings, texts, colors
from goldminer.actor import Actor
from goldminer.inventory import Inventory
from goldminer.history import History
from goldminer.geom import Rect
from goldminer.items import Item
from goldminer.worldmap import Tile
... |
#!/usr/bin/env python
# This file is part of Augur - <http://github.com/winry-linux/augur>
#
# Copyright 2017, Joshua Strot <joshua@winrylinux.org>
#
# Augur 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 Foun... |
# -*- coding: utf-8 -*-
from httplib import HTTPSConnection
from urllib import urlencode
from base64 import b64encode
from json import loads
from django.conf import settings
from dbmail.providers.prowl.push import from_unicode
from dbmail import get_version
class TwilioSmsError(Exception):
pass
def send(sms_... |
# Copyright 2019 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Copyright (c) 2010-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
#
# Unless required by applicable law or agreed to ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
# Support for fake joystick/gamepad during development
# if no 'real' joystick/gamepad is ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PIL import Image
import os
import codecs
if ("scripts" in os.getcwd()):
cwd = os.getcwd().replace("\\scripts", "")
else:
cwd = os.getcwd()
print(cwd)
prov_dir = cwd+"\\shatterednippon\\history\\provinces\\"
local_dir = cwd+"\\shatterednippon\\localisation\\"... |
"""
Django settings for imagr_site 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, ...)... |
import urllib
import urllib2
import re
from ircutils.ehp import *
from htmlentitydefs import name2codepoint as entity
MAX_SIZE = 262144
def chmsg(event, server):
nicka = event['nicka']
chan = event['channel']
msg = event['msg']
"""I need to make it handle other domains """
pointer = re.search('... |
# -*- coding: utf-8 -*-
#
# FQRead documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 6 13:49:02 2014.
#
# 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.
#
# Al... |
from collections import defaultdict
import itertools
from django.dispatch import Signal
from casexml.apps.case.signals import cases_received
from casexml.apps.case.xform import get_case_updates
from corehq.apps.commtrack import const
from corehq.apps.commtrack.const import is_supply_point_form
from corehq.apps.commtrac... |
from google.transit import gtfs_realtime_pb2
import urllib
import datetime
import time
import zipfile
import StringIO
import csv
import sqlite3
class Ingestor:
_endpoint_url = 'http://datamine.mta.info/mta_esi.php'
_static_data_url = 'http://web.mta.info/developers/data/nyct/subway/google_transit.zip'
_... |
## Copyright 2016 Davide Albanese <davide.albanese@gmail.com>
## Copyright 2016 Fondazione Edmund Mach (FEM)
## This file is part of micca.
##
## micca 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 ... |
#!/usr/bin/env python
"""
MDS IRC Lib
Copyright (C) 2009 Mad Dog Software
http://maddogsoftware.co.uk - morfeusz8@yahoo.co.uk
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 ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'FulfillmentOrderLine.shipment'
db.add_column('oscar_mws_fulfillmentorderline', 'shipment',
... |
import os
import sys
import time
import traceback
import six
import re
from os import path
from six import unichr
from six.moves import StringIO
from .unittest import TestResult, _TextTestResult
# Matches invalid XML1.0 unicode characters, like control characters:
# http://www.w3.org/TR/2006/REC-xml-20060816/#chars... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-18 16:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import djangocms_text_ckeditor.fields
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
... |
#!/usr/bin/env python
# pmx Copyright Notice
# ============================
#
# The pmx source code is copyrighted, but you can freely use and
# copy it as long as you don't change or remove any of the copyright
# notices.
#
# ----------------------------------------------------------------------
# pmx is Copyright (C... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2010 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/... |
#! /usr/bin/python
"""
test_base.py
By Paul Malmsten, 2010
pmalmsten@gmail.com
Tests the XBeeBase superclass module for XBee API conformance.
"""
import unittest
from xbee.base import XBeeBase
from xbee.tests.Fake import Serial
class TestWriteToDevice(unittest.TestCase):
"""
XBeeBase class should properly._w... |
# Copyright 2016 AT&T Corp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# definition of a dict-replacement class that allows dot-notation attribute access
import collections
class Dict(dict):
"""A dict class that:
* allows dot-notation attribute access, returning None if key not found
* sorts keys on calls to keys() and items() and repr(), making many things easier
... |
# -*- coding: utf-8 -*-
"""
Youtube Subtitle Downloader downloads subtitles from Youtube videos
(if those are present) and convert them to SRT format.
Usage: youtubesub.py [-h] [-l] [--language LANGUAGE] [--filename FILENAME]
[--filetype {srt,xml}]
url
... |
# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; truncate-lines: 0 -*-
# vi: set fileencoding=utf-8 filetype=python expandtab tabstop=4 shiftwidth=4 softtabstop=4 cindent:
# :mode=python:indentSize=4:tabSize=4:noTabs=true:
#-----------------------------------------------------... |
""" This module contains chess logic functins for the pychess client. They are
based upon the lutils modules, but supports standard object types and is
therefore not as fast. """
from lutils import lmovegen
from lutils.validator import validateMove
from lutils.lmove import FCORD, TCORD
from lutils import ldraw... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import cruds
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = cruds.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You probably want to also... |
#! /usr/bin/python
import sys
import string
import os
import copy
import transaction
import pattern
from transaction import decode_items, encode_items
if len(sys.argv)!=5:
print 'usage: prog <db> <freq itemset1> <freq itemset2> <support>'
sys.exit(-1)
else:
dbname = sys.argv[1]
freq1name = sys.argv[2]... |
# -*- coding: utf-8 -*-
"""
Tests for enterprise.api_client.lms.py
"""
import json
import time
import mock
import requests
import responses
from pytest import raises
from slumber.exceptions import HttpNotFoundError
from enterprise.api_client import lms as lms_api
from enterprise.utils import NotConnectedToOpenEdX
U... |
from time import sleep
from uos import urandom
from machine import Pin
from cockle import pins
dataPin = pins[1]
clockPin = pins[2]
latchPin = pins[3]
dataPin.init(Pin.OUT)
latchPin.init(Pin.OUT)
clockPin.init(Pin.OUT)
dataPin.value(0)
latchPin.value(0)
clockPin.value(0)
delay = 1
numLights = 8
byteCount = numLigh... |
#!/usr/bin/env python
import subprocess
import praw
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
import OAuth2Util
import os
import mar... |
#!/usr/bin/env python3
from reporter.core import Schedule
from reporter.connections import RedcapInstance
from reporter.emailing import (
RECIPIENT_FAST_MANAGER,
RECIPIENT_FAST_ADMIN,
)
from reporter.application_abstract_reports.redcap.data_quality import (
RedcapMissingDataWhen,
RedcapMissin... |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 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 version 2 of the
## License, or (at your option) any... |
#!/usr/bin/env python
"""
Created on 2015-02-22T19:41:02
"""
from __future__ import division, print_function
import sys
import argparse
import re
try:
import numpy as np
except ImportError:
print('You need numpy installed')
sys.exit(1)
try:
from astropy.io import fits
except ImportError:
print('... |
# encoding: utf-8
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
class ObjCDataFormatterNS... |
# Copyright 2021 The Floq 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# Copyright 2016-2017 Capital One Services, 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 ... |
#!/usr/bin/env python3
# call with python3
# test [1] times; stream from [2]; play on [3]
import os
import time
import sys
import threading
import saleae
# from gtts import gTTS
# TEST_SECONDS = 10
TEST_LOOPS = int(sys.argv[1])
TTY_SOURCE = "/dev/" + str(sys.argv[2])
TTY_DESTINATION = "/dev/" + str(sys.argv[3])
TT... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
# standard libraries
import gettext
import typing
# third party libraries
# None
# local libraries
import numpy
from nion.swift import DocumentController
from nion.swift import Panel
from nion.ui import CanvasItem
from nion.ui import Declarative
from nion.ui import DrawingContext
from nion.ui import UserInterface
fro... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestri... |
from django.db import models
from django.utils.translation import gettext as _
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from django.conf import settings
from django.db.models import Sum, Count
from oscar.apps.product.reviews.managers import (ApprovedReviewsManage... |
from abc import ABCMeta, abstractmethod
from functools import reduce
from xii.entity import Entity
from xii.store import HasStore
from xii import error, util
class Component(Entity, HasStore):
__metaclass__ = ABCMeta
ctype = ""
"""
Name of the component (eg. 'node')
"""
default_attributes =... |
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 2017-2018 - Edoardo Morassutto <edoardo.morassutto@gmail.com>
# Copyright 2017-2018 ... |
from classtools import AttrDisplay
class Person(AttrDisplay):
'''
Create and process person records
'''
def __init__(self, name, job=None, pay=0):
self.name = name
self.job = job
self.pay = pay
def lastName(self):
return self.name.split()[-1]
def giveRaise(self... |
###############################################################################
#
# 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):
"""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2015 CERN and Helsinki Institute of Physics.
# This software is distributed under the terms of the
# GNU General Public License version 3 (GPL Version 3),
# copied verbatim in the file LICENCE.md. In applying this
# license, CERN does not waive the privil... |
'''
Generic functions for handling spectral images.
'''
from __future__ import absolute_import, division, print_function, unicode_literals
import numbers
import numpy as np
from .spectral import BandInfo
class Image(object):
'''spectral.Image is the common base class for spectral image objects.'''
def __in... |
from pycket.test.testhelper import run_mod_expr, run_mod
from pycket.values_hash import (ll_get_dict_item, get_dict_item,
StringHashmapStrategy)
from pycket.values_hash import ByteHashmapStrategy
from pycket import values
def test_hash_simple(doctest):
"""
! (define ht (make-has... |
# Generated by Django 3.1 on 2020-08-28 15:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('pl_messages', '0001_initia... |
# -*- coding: utf-8 -*-
"""
StringFormat
============
StringFormat is an independent port of the Python 3 advanced string
formatting, compatible with Python >= 2.4.
This implementation is pure Python.
Add the method ``str.format`` only if it is missing (Python < 2.6)::
import stringformat
stringformat.init(... |
#!/usr/bin/env python3
from datetime import date
import math
import numpy as np
import sys
today = date(2015, 11, 20)
expiry = date(2017, 1, 20)
#Global inputs
s = 138.65
k = 133
t = (expiry - today).days / 365
r = 0.0106161830925
sig = 0.22545538993
div = .027000
def tree(steps, flavor):
Dt = t / steps
r_D... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import multiselectfield.db.fields
import django.core.validators
import re
class Migration(migrations.Migration):
dependencies = [
('main', '0039_merge'),
]
operations = [
migrations.... |
import cgitb
cgitb.enable()
import cgi
import email
import os
import sys
import time
import zipfile
import Cookie
import ezmlm
from globals import *
from globalfns import *
import context
import config
###############################################################################
# Main routine
####################... |
from __future__ import absolute_import
import yaml
import re
import os
import logging
logger = logging.getLogger(__name__)
class DateNormalizer(object):
"""
find matches in text strings using regular expressions and transforms them
according to a pattern transformation expression evaluated on the match
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... |
# coding=utf-8
# Author: Dustyn Gibson <miigotu@gmail.com>
#
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill 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 ... |
# -*- coding: utf-8 -*-
"""Test for Poll Xmodule functional logic."""
from mock import Mock
from xmodule.poll_module import PollDescriptor
from . import LogicTest
from .test_import import DummySystem
class PollModuleTest(LogicTest):
"""Logic tests for Poll Xmodule."""
descriptor_class = PollDescriptor
... |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of data model for physical router
configuration manager
"""
from vnc_api.common.exceptions import NoIdError
from physical_router_config import PhysicalRouterConfig
from sandesh.dm_introspect import ttypes as sand... |
import json
import os
import sys
def print_usage():
print """./type_from_json <json_file> [ARGS]
Options
--typedef <type_name>\t\t\t Displays the type as a typedef."""
def type_of_int(obj):
return "JSONNumber"
type_of_float = type_of_int
def type_of_string(obj):
return "JSONString"
type_of_un... |
# -*- coding: utf8 -*-
from qstatpretty.ttyutil.unicode import unicode, ulen
DELIMITERS_FULL = {
'header_tl': u"┌",
'header_t': u"─",
'header_tr': u"┐",
'header_b': u"─",
'header_bl': u"├",
'header_l': u"│",
'header_r': u"│",
'header_br': u"┤",
... |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2015 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... |
from io import StringIO
import pkg_resources
import pytest
import threading
import bender._main
from bender.backbones.console import BenderConsole
from bender.decorators import backbone_start
from bender.testing import VolatileBrain, DumbMessage
@pytest.mark.timeout(3.0)
def test_main(mock):
stdout = StringIO()
... |
"""SCons.Tool.mslink
Tool-specific initialization for the Microsoft linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, ... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView
from httpproxy.views import HttpProxy
from ufindit.views import RulesView
admin.autodiscover()
urlpatterns = p... |
import argparse
import os
from shutil import which
import sys
import urllib.request as request
from vcstool import __version__ as vcstool_version
from vcstool.clients import vcstool_clients
from vcstool.clients.vcs_base import run_command
from vcstool.executor import ansi
from vcstool.executor import execute_jobs
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.