src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rst2db.py
# =========
#
# A reStructuredText to DocBook conversion tool, using Python's docutils
# library.
#
# by Eron Hennessey
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
import os
import sys
from abstrys.docutils_ext.docboo... |
# -*- coding: utf-8 -*-
#
# 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
#... |
"""Unit tests for the FunctionAssigner class"""
# Copyright (C) 2013 Johan Hake
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... |
# copyright (c) 2019 paddlepaddle authors. all rights reserved.
#
# licensed under the apache license, version 2.0 (the "license");
# you may not use this file except in compliance with the license.
# you may obtain a copy of the license at
#
# http://www.apache.org/licenses/license-2.0
#
# unless required by app... |
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
"""psycopg2cffi -- global constants
This module can be imported from everywhere without problems of cross imports.
"""
# Isolation level values.
ISOLATION_LEVEL_AUTOCOMMIT = 0
ISOLATION_LEVEL_READ_UNCOMMITTED = 4
ISOLATION_LEVEL_READ_COMMITTED = 1
ISOLATION_LEVEL_REPEATABLE_READ = 2
ISOLATION_LEVEL_SERIALIZABLE = 3
... |
# Django settings for medicine project.
import os
from django.conf import global_settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../')
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
... |
# -*- 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... |
import unittest
import ccs
import time
####################################################################################################################
# BITFINEX #
##############################################... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from .models import ClientSite
from servers.models import Server
class ClientSiteTest(TestCase):
def test_create_new_clientsite(self):
clientsite = ClientSite()
clientsite.dom... |
# Copyright 2014 the Melange 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 applicable law or agreed to in wr... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
# coding=utf-8
import os
import sys
import codecs
import json
import logging
import logging.config
from rpyc import Service
from rpyc.utils.server import ThreadedServer
from ConfigParser import SafeConfigParser
class Message(Service):
@staticmethod
def exposed_send(message):
import urllib2
l... |
from lxml import etree
from lxml.builder import E
import copy
import itertools
import logging
from odoo.tools.translate import _
from odoo.tools import SKIPPED_ELEMENT_TYPES, html_escape
_logger = logging.getLogger(__name__)
def add_text_before(node, text):
""" Add text before ``node`` in its XML tree. """
... |
"""
Burr Settles
Duolingo ML Dev Talk #3: Clustering
EM-GMM (expectaction maximization with Gaussian mixture models) clustering example using
scikit-learn.
"""
import argparse
import math
import json
import numpy as np
from bs4 import BeautifulSoup
from sklearn.mixture import GaussianMixture
# cluster colors (for ... |
#!/usr/bin/env python
import os
import shutil
import sys
import subprocess
import cairo
def main():
version = '0.1.11'
script_location = sys.argv[0]
script_path = os.path.abspath(script_location)
app_path = os.sep.join(script_path.split(os.sep)[:-3])
src = os.path.join(app_path,'theory')
d... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
import re
from pylint import epylint as lint
from djanban.apps.repositories.cloc import Cloc
# Pylinter for directories
class PythonDirectoryAnalyzer(object):
def __init__(self, dir_path):
self.dir_path = dir_path
... |
"""An example of the colorbar display on the scatter plot."""
import ternary
import matplotlib.pyplot as plt
def _en_to_enth(energy, concs, A, B, C):
"""Converts an energy to an enthalpy.
Converts energy to enthalpy using the following formula:
Enthalpy = energy - (energy contribution from A) - (energy c... |
<<<<<<< HEAD
<<<<<<< HEAD
"""
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
"""
__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
"haslocal", "hascompare", "hasfree", "opname", "opmap",
"HAVE_ARGUMENT", "EX... |
#!/usr/bin/env python
import rospy
from threading import Thread
from sensor_msgs.msg import JointState
from rospy.exceptions import ROSException
from robotnik_msgs.msg import State
from std_srvs.srv import Empty
import time
#
# STANDARD INTERFACE
#
class DeviceCommandInterface():
'''
Class intended to communicat... |
# Copyright 2011 VMware, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.info.base import MovieProvider
from couchpotato.environment import Env
import base64
import time
log = CPLog(__name__)
class Couc... |
from django.contrib.auth import get_user_model
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView
from .views_mixins import HelpOthersMetaDataMixin
from listings.models import GatheringCenter, Resource
class HomeView(... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
from __future__ import absolute_import
import six
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from sentry import tagstore
from sentry.models import EventUser, OrganizationMemberTeam
from sentry.testutils import APITestCase
class OrganizationUserIssu... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Practicas de Desarrollo de Aplicaciones para Internet (DAI)
# Copyright (C) 2013 - Zerjillo (zerjioi@ugr.es)
#
# 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 Softwar... |
# coding=utf-8
"""Dialog test.
.. note:: 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.
"""
__author__ = 'ser... |
'''
Configuration object
====================
The :class:`Config` object is an instance of a modified Python ConfigParser.
See the `ConfigParser documentation
<http://docs.python.org/library/configparser.html>`_ for more information.
Kivy has a configuration file which determines the default settings. In
order to cha... |
# Universidade de Aveiro - Physics Department
# 2016/2017 Project - Andre Calatre, 73207
# "Simulation of an epidemic" - 28/6/2017
# Selecting Data from an excel file to another
#import numpy as np
import pandas as pd
from openpyxl import load_workbook
#r = [0, 301, 302, 303, 304, 305, 306]
#desired = ['S_Avg', 'I_Av... |
#
# Copyright 2013 Simone Campagna
#
# 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 wri... |
# Generated by Django 2.0.8 on 2020-04-02 11:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('angles', '0010_residueangle_tau_angle'),
]
operations = [
migrations.AddField(
model_name='residueangle',
name='chi1... |
# -------------------------------------------------------------------------
#
# Copyright (c) 2009, IMB, RWTH Aachen.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in simvisage/LICENSE.txt and may be redistributed only
# under the conditions describe... |
__author__ = 'Gareth'
import os
from twisted.internet import reactor
import yaml
# import control.system.servers as servers
import control.system.ssl as ssl
from control.utils.log import getLogger
from control.system.singleton import Singleton
CONF_DIR = "control/config/"
DATA_DIR = "control/data/"
LOGS_DIR = "con... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 Jacob Mendt
Created on 07.10.15
@author: mendt
'''
import traceback
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPInternalServerError
from sqlalchemy import desc
from georeference import LOGGER
from georeference.settings import OAI_ID_PATTE... |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... |
# -*- 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... |
"""
Allow the ability to connect and publish to a queue.
"""
import logging
import time
import kombu
import six
class Producer(object):
def __init__(self, dest_queue_name, rabbitmq_host, rabbitmq_port=None,
serializer=None, compression=None,
userid=None, password=None):
... |
"""
Resources for the telex server.
This file is part of the telex project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jul 7, 2014.
"""
from datetime import datetime
from everest.resources.base import Member
from everest.resources.descriptors import collection_attribute
f... |
"""
==================================================
Probability Calibration for 3-class classification
==================================================
This example illustrates how sigmoid calibration changes predicted
probabilities for a 3-class classification problem. Illustrated is the
standard 2-simplex, wher... |
import json
import re
import datetime
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from mongoengine.base import ValidationError
from crits.core import form_c... |
#
# TestSylvia.py
#
# Unit tests for the Sylvia class
#
import unittest
from SylviaApiWrapper import Sylvia
class TestSylvia( unittest.TestCase ):
"""
Unit testing for the Sylvia class.
"""
def verifyPronunciation( self, pronunciation ):
"""
Complain if this isn't a valid pronunciatio... |
#!/usr/bin/env python
# Copyright (C) 2013 Casey Duquette
#
# 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 late... |
from main.logger_helper import L
from pydispatch import dispatcher
from main import thread_pool, sqlitedb
if sqlitedb:
from storage.sqalc import models
from common import Constant
from presence import presence_bt
from presence import presence_wifi
from storage.model import m
__author__ = 'Dan Cristian<dan.cristian... |
import os
from setuptools import setup
requires = (
'Jinja2',
'Werkzeug',
'certifi',
'chardet',
'distribute',
'gunicorn',
'requests',
'urllib3',
'itsdangerous>=0.21',
'click>=2.0',
)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "tourist-... |
# -*- 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 model 'ScheduledCommand'
db.create_table(u'projects_scheduledcommand', (
(u'id', self.g... |
'''
Some convenince methods for use with multiprocessing.Pool.
'''
from __future__ import division, print_function
from contextlib import contextmanager
import itertools
import multiprocessing as mp
import os
import random
import string
from .utils import strict_map, imap, izip
def _apply(func_args):
func, args... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
#
# 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... |
"""Let's Encrypt CLI."""
# TODO: Sanity check all input. Be sure to avoid shell code etc...
# pylint: disable=too-many-lines
# (TODO: split this file into main.py and cli.py)
import argparse
import atexit
import functools
import json
import logging
import logging.handlers
import os
import sys
import time
import traceb... |
#
# Copyright (C) 2009 Juan Pedro Bolivar Puente, Alberto Villegas Erce
#
# This file is part of Pigeoncide.
#
# Pigeoncide is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# Lic... |
# -*- coding: utf-8 -*
from PIL import Image
import os
import argparse
import requests
import math
from CSMap import CSMap
parser = argparse.ArgumentParser(description='MyScript')
parser.add_argument('images_x_start', type=int)
parser.add_argument('images_x_end', type=int)
parser.add_argument('images_y_... |
#-*- coding:utf-8 -*-
import os
import json
import re
import time
from pyblog.config import Config
class LocaleProxyer(dict):
_locale_file_dir = None
_locale_files_content = {}
def __init__(self, locale_file_dir):
assert isinstance(locale_file_dir, str)
if type(self)._locale_file_dir != o... |
import logging
from datetime import datetime
from app.validation.abstract_validator import AbstractValidator
from app.validation.validation_result import ValidationResult
logger = logging.getLogger(__name__)
class DateRangeCheck(AbstractValidator):
def validate(self, user_answers):
"""
Validat... |
# Copyright 2012 Red Hat, 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 agre... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'recipe.ui'
#
# Created by: PyQt5 UI code generator 5.7.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectNa... |
#!/usr/bin/env python3
import torch
from ..constraints import Positive
from ..distributions import base_distributions
from .likelihood import _OneDimensionalLikelihood
class LaplaceLikelihood(_OneDimensionalLikelihood):
r"""
A Laplace likelihood/noise model for GP regression.
It has one learnable parame... |
#!/usr/bin/python
"""
Register nodes with HIL.
This is intended to be used as a template for either creating a mock HIL setup
for development or to be modified to register real-life nodes that follow a
particular pattern.
In the example environment for which this module is written, there are 10
nodes which have IPMI ... |
from django.db import models
from django.contrib.auth.models import User
from objectset.models import ObjectSet, SetObject
from vdw.literature.models import PubMed
from vdw.genome.models import Chromosome
from vdw.phenotypes.models import Phenotype, PhenotypeThrough
from .managers import GeneManager
class GeneFamily(... |
#Alessandro Minali 2014
# www.alessandrom.me
#questions/suggestions/feedback to: alessandro.minali@gmail.com
##ONLY CHANGE VALUES THAT HAVE COMMENTS BESIDE THEM
import socket
import commands
import moderation
import time
class PyIRCBot():
def __init__(self):
HOST = "irc.twitch.tv"
P... |
# -*- coding: utf-8 -*-
'''
Created on 3 Mar 2013
@author: tedlaz
version 1.0
'''
import decimal
import PyQt5.QtCore as Qc
import PyQt5.QtGui as Qg
import PyQt5.QtPrintSupport as Qp
PAGE_NUMBER_TEXT = 'Σελίδα'
def isNum(value): # Einai to value arithmos, i den einai ?
""" use: Returns False i... |
# -*- coding: utf-8 -*-
# util.py ---
#
# Created: Fri Dec 30 23:27:52 2011 (+0200)
# Author: Janne Kuuskeri
#
import re
charset_pattern = re.compile('.*;\s*charset=(.*)')
def camelcase_to_slash(name):
""" Converts CamelCase to camel/case
code ripped from http://stackoverflow.com/questions/1175208/does-... |
"""This module implements additional tests ala autoconf which can be useful.
"""
from __future__ import division, absolute_import, print_function
# We put them here since they could be easily reused outside numpy.distutils
def check_inline(cmd):
"""Return the inline identifier (may be empty)."""
cmd._check_... |
import os
import sys
import argparse
import synapse.telepath as s_telepath
import synapse.lib.output as s_output
def getArgParser():
p = argparse.ArgumentParser()
p.add_argument('cortex', help='telepath URL for a target cortex')
p.add_argument('filenames', nargs='+', help='files to upload')
p.add_arg... |
# Copyright 2013 Jack David Baucum
#
# This file is part of Orthosie.
#
# Orthosie 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 l... |
import datetime
import email
import functools
import hashlib
import json
import logging
import logging.handlers
import mistune
import os
import re
import requests
import shutil
import smtplib
import socket
import subprocess
import sys
import tempfile
import time
import urllib
import dataset
import zipfile
import io
fr... |
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123")
class AddSmsTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_sms/" ... |
import random
from functools import wraps
from heapq import heappop, heappush
from math import ceil
from os import listdir
from os.path import isfile, join
class Grid(object):
def __init__(self, game, type, dimensions = ('x', 'y')):
self.game = game
self.type = type
self.grid = {}
... |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... |
import sys
import numpy as np
from astropy.table import Table, Column
import csv
import os.path as path
import re
filelist = sys.argv[1:]
scriptloc = sys.argv[0]
tagloc = scriptloc.replace('neatparser.py','neat_tags.txt')
names = ('MaskName','ObsDate','Slit','Object','DBKey')
dtypes = ('S10','S10','S10','S10','S40')
un... |
"""
Dll2Lib
This tool will generate a .lib file under windows for a given .dll file
This uses dumpfile to export a list of symbols
dumpbin /exports C:\yourpath\yourlib.dll
The list of symbols is then written to a .def file
The lib command is then used to generate the .lib file from the .def file
... |
# -*- coding: utf-8
from yade import ymport, utils,pack,export,qt
import gts,os
from yade import geom
#import matplotlib
from yade import plot
#from pylab import *
#import os.path, locale
#################################
##### FUNCTIONS ####
#################################
def writeFile():
yade.expo... |
import sys
import time
import tensorflow as tf
import awesome_gans.discogan.discogan_model as discogan
import awesome_gans.image_utils as iu
from awesome_gans.datasets import Pix2PixDataSet as DataSets
# import numpy as np
sys.path.insert(0, '../')
results = {'sample_output': './gen_img/', 'model': './model/Disco... |
#!/usr/bin/env vpython
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Integration test for the Swarming server."""
import json
import logging
import optparse
import os
import subprocess
imp... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
# -*- coding: utf-8 -*-
import httplib as http
from flask import request
from django.core.exceptions import ValidationError
from framework import forms, status
from framework.auth import cas
from framework.auth.core import get_user, generate_verification_key
from framework.auth.decorators import block_bing_preview, ... |
from django.contrib import admin
from django import forms
from string import Template
from django.utils.safestring import mark_safe
from .models import CampaignCustomParam, Campaign, CampaignQuestion, \
UserCampaign, UserCampaignResponse
# Widget to set markdown editor
class MarkdownDelightEditorWidget(forms.Tex... |
"""
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
"""
import os
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
import ma... |
from __future__ import absolute_import, unicode_literals
import six
from dash.orgs.models import Org
from dash.utils import intersection
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.db import models
from django.db.models import Q, Count, Prefetch
from dja... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
from __future__ import print_function
import logging
import os
import sys
import json
TESTNAME='test_conversion'
logging.basicConfig(filename='/tmp/mmokta.log',level=logging.DEBUG)
LOG = logging.getLogger(__name__)
# Workaround to allow testing from parent dir
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.pat... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... |
## Graphite local_settings.py
# Edit this file to customize the default Graphite webapp settings
#
# Additional customizations to Django settings can be added to this file as well
#####################################
# General Configuration #
#####################################
# Set this to a long, random unique s... |
#!/usr/bin/env python3
#
# Copyright (c) 2015 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
from io import BytesIO
import copy, math, struct
from Catalog.Identifiers import TupleId
class PageHeader:
"""
A base class for page headers, storing bookkeeping information on a page.
Page headers implement structural equality over their component fields.
This includes the page's flags (e.g., whether the p... |
'''
Created on Feb 15, 2012
@author: Jeff
'''
import numpy
import numpyTransform
from scipy.spatial import cKDTree as KDTree
# from scipy.spatial import Delaunay
from scipy.spatial.distance import cdist
import scipy.optimize
import time
from math import pi
from MatlabFunctions import MatlabFmincon
import... |
#!/usr/bin/python
import time
from simple_sorts import *
from shell_sort import *
from quick_sort import *
from external_merge_sort import *
from radix_sort import *
from merge_sort import *
from heap_sort import *
from intro_sort import *
from timsort import *
from list_generators import *
result = {}
def run_un... |
# Simple Summarizer
# Copyright (C) 2010-2012 Tristan Havelick
# Author: Tristan Havelick <tristan@havelick.com>
# URL: <https://github.com/thavelick/summarize/>
# For license information, see LICENSE.TXT
"""
A summarizer based on the algorithm found in Classifier4J by Nick Lothan.
In order to summarize a document thi... |
########################################################################
# File : TaskQueueDirector.py
# Author : Stuart Paterson, Ricardo Graciani
########################################################################
""" The TaskQueue Director Agent controls the submission of pilots via the
PilotDirectors. ... |
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(is_safe=True)
def json(value):
# Encode value as JSON for inclusion within a <script></script> tag.
# Since we are not using |escapej... |
"""Tests of the Meta class"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from bson import ObjectId
import mock
import pymongo
from simon.meta import Meta
def skip_with_mongoclient(f):
if pymongo.version_tuple[:2] >= (2, 4):
return unittest.skip('`MongoClient` is suppo... |
import struct
# Reads packed pdb files
#
class Pack:
def __init__(self, bytes):
self.bytes = bytes
self.directory = self.BuildDirectory()
def BuildDirectory(self):
bytes = self.GetRecord(0)
directory = []
for index in xrange(len(bytes) / 32):
entrybytes = b... |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <ryanssdev@icl... |
from gi.repository import Gtk, Pango, GObject
class GridViewCellRendererText(Gtk.CellRendererText):
"""CellRendererText adjusted for grid view display, removes extra padding"""
def __init__(self, width, *args, **kwargs):
super(GridViewCellRendererText, self).__init__(*args, **kwargs)
self.prop... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
import sys
# usage: openstack-config-parser.py [service] [config file] [output file]
def parse_config(serviceName, fileName):
# a dict containing key/value
# pairs, last value is what is
# stored.
values = {}
with open(fileName) as config:
section = None
for line in config:
... |
"""Provide access to output window and its functionality.
This module provides access to the output window for the currently running
pyRevit command. The proper way to access this wrapper object is through
the :func:`get_output` of :mod:`pyrevit.script` module. This method, in return
uses the `pyrevit.output` module t... |
#!/usr/bin/python
import optparse
import sys
import boto3
import re
parser = optparse.OptionParser("usage: %prog action [options]")
(options, args) = parser.parse_args()
if len(args) == 0:
parser.error("Argument 'action' missing.")
action = args[0]
if action not in ['print', 'delete']:
sys.exit("Invalid act... |
from setuptools import setup, find_packages
import os
version = '0.3.2'
setup(name='django-moderation',
version=version,
description="Generic Django objects moderation application",
long_description=open("README.rst").read() + "\n" +
open(os.path.join("docs", "HISTORY.txt")).r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.