content stringlengths 4 20k |
|---|
import os
try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase
import recognize
class TestRecognizer(TestCase):
def setUp(self):
self.recognizer = recognize.Recognizer(vocabulary=["grape", "banana", "strawberry"],
distance=3)
... |
from PyQt4.QtCore import QSettings, QTimer
from PyQt4.QtGui import (
QDialog, QDialogButtonBox, QFileDialog, QLabel, QLineEdit,
QRadioButton, QSpacerItem, QTabWidget, QToolButton, QWidget,
QPlainTextEdit, QPushButton
)
from ffmulticonverter import utils
from ffmulticonverter import conf... |
import pytest
try:
from unittest import mock
except ImportError:
import mock
from collections import defaultdict, Counter
import itertools
import numpy as np
from openpathsampling.tests.test_helpers import make_1d_traj
from .serialization_helpers import get_uuid, set_uuid
from .storable_functions import *
_... |
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.widgets.TreeWidget import TreeWidget
import collections, os, weakref, re
#import functions as fn
class ParameterTree(TreeWidget):
"""Widget used to display or control data from a ParameterSet"""
def __init__(self, parent=None):
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os # used to set lang and for backwards compat get_config
from ast import literal_eval
from jinja2 import Template
from string import ascii_letters, digits
from ansible.module_utils._text import to_text
from ansible.modul... |
from Modules.AbstractModule import AbstractModule
class UnderstandingModule(AbstractModule):
"""
Module to extract how easy is to understand
the searched code
"""
D = 10
E = 100
def __init__(self, internal_weights=[1, 1], weight=1):
AbstractModule.__init__(self, internal_... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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.
... |
import unittest
from blend import Minifier, Resource
class TestMinifier(unittest.TestCase):
def setUp(self):
self.minifier = Minifier()
self.resource = Resource('path/to/some/file')
def tearDown(self):
pass
def test_has_a_minify_method_that_takes_a_resource(self):
self.m... |
"""
little helper to get the proper ElementTree package
"""
import re
import exceptions
try:
import cElementTree as ET
import elementtree
except ImportError:
try:
from elementtree import ElementTree as ET
import elementtree
except ImportError:
# this seems to be necessary with ... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import string
import sys
import TestSCons
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
if sys.platform == 'win32':
test.write('mylink.py', r"""
import string
import sys
args = sys.argv[1:]
while args... |
import struct
from typing import Tuple
import numpy as np
from dataclasses import dataclass
from tqdm import tqdm
@dataclass
class ConstStructs:
float: struct.Struct = struct.Struct("<f")
short: struct.Struct = struct.Struct("<h")
ushort: struct.Struct = struct.Struct("<H")
double_ushort: struct.St... |
from .services.asset_service import AssetServiceClient
from .services.asset_service import AssetServiceAsyncClient
from .types.asset_service import ListAssetsRequest
from .types.asset_service import ListAssetsResponse
from .types.asset_service import ContentType
from .types.assets import Asset
from .types.assets impor... |
from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration
from opus_core.indicator_framework.core.source_data import SourceData
from numpy import arange
from opus_core.indicator_framework.image_types.matplotlib_map import Map
from opus_core.indicator_framework.image_types.matplotlib_c... |
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from sitepages.views import home, site_page
from contact.views import contact_page
urlpatterns = [
url(r'^admin/', admin.site.urls),
... |
from gi.repository import Gtk
from lollypop.define import Lp, WindowSize, DataPath
from lollypop.toolbar_playback import ToolbarPlayback
from lollypop.toolbar_info import ToolbarInfo
from lollypop.toolbar_title import ToolbarTitle
from lollypop.toolbar_end import ToolbarEnd
from lollypop.utils import debug
class Too... |
# flake8: noqa
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operation... |
import os
from progressbar import (
AnimatedMarker,
Bar,
Percentage,
ProgressBar,
UnknownLength,
)
def download_requests_stream(request_stream, destination, message=None):
"""This is a facility to download a request with nice progress bars."""
if not message:
message = 'Downloadin... |
#-*- coding: utf-8 -*-
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
use_library('django','1.1')
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app as run
from google.appengine.api import memcache
from django.uti... |
import os
import sys
import inspect
import json
path_to_this_module = os.path.abspath( os.path.dirname( inspect.getsourcefile(sys.modules[__name__]) ) )
settings_json = 'settings.json'
def get_dict():
settings_file = os.path.join(path_to_this_module, settings_json)
# Read the settings file
if not os.path... |
from collections import defaultdict
from optparse import OptionParser
import os
import random
import sys
import time
import msgpack
from swift.common.daemon import run_daemon
from swift.common.storage_policy import POLICIES
from swift.common.swob import HeaderKeyDict
from swift.common.utils import parse_options, list... |
"""
Soft Voting/Majority Rule classifier.
This module contains a Soft Voting/Majority Rule classifier for
classification estimators.
"""
# Authors: Sebastian Raschka <<EMAIL>>,
# Gilles Louppe <<EMAIL>>
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import ClassifierMixin
from ..... |
########################################################################
# $Id$
########################################################################
""" JobStateUpdateHandler is the implementation of the Job State updating
service in the DISET framework
The following methods are available in the Service i... |
import numpy as np
from scipy.sparse import issparse
import logging
logging.basicConfig(level=logging.DEBUG)
class PMICalculator(object):
"""
Parameter:
-----------
doc2word_vectorizer: object that turns list of text into doc2word matrix
for example, sklearn.feature_extraction.test.CountVecto... |
{
"name": "IPA Code (IndicePA)",
"version": "8.0.1.0.0",
"category": "Localisation/Italy",
"author": "KTec S.r.l, Odoo Community Association (OCA)",
"website": "http://www.ktec.it",
"license": "AGPL-3",
"depends": ['base'],
"data": [
'view/partner_view.xml',
],
"qweb": []... |
from django.http import HttpResponse
from django.template import loader, RequestContext
from .models import User,ParameterList,ValueEntry,ParameterIdeals
from django.shortcuts import render,get_object_or_404
from django.views.generic import TemplateView
# class SensorValueView(TemplateView):
# context_object_name ... |
"""
Note: To turn on vectorization for the equilibration, run with `--vec` argument, i.e.
python lennard_jones.py --vec
We will start with particles at random positions within
the simulation box interacting via a shifted Lennard-Jones type potential
with an interaction cutoff at 2.5.
Newtons equations of motion are... |
#!/usr/env/bin python
import json, random
class Painting:
def __init__(self, name, season, episode, elements):
self.name = name
self.season = season
self.episode = episode
self.elements = elements
self.clusterDistances = {}
def resetClusterDistances(self):
... |
"""
Management class for host-related functions (start, reboot, etc).
"""
from nova import exception
from nova.openstack.common import log as logging
from nova.openstack.common import units
from nova import utils
from nova.virt.vmwareapi import ds_util
from nova.virt.vmwareapi import vim_util
from nova.virt.vmwareapi ... |
# -*- coding: utf-8 -*-
import os
from flask import render_template, flash, redirect, url_for, current_app,\
Blueprint, send_from_directory, request, abort, g
from flask_login import login_required, current_user
from sqlalchemy.sql.expression import func
from sqlalchemy import and_
from moments.models import User... |
from django.contrib.auth.models import AnonymousUser
from django.test.client import RequestFactory
from nose.tools import eq_
from mkt.site.tests import ESTestCase, TestCase, app_factory
from mkt.tvplace.serializers import (TVAppSerializer, TVESAppSerializer,
TVWebsiteSerializer,
... |
"""
ldap.async - handle async LDAP operations
See http://www.python-ldap.org/ for details.
\$Id: async.py,v 1.32 2011/07/28 08:51:38 stroeder Exp $
Python compability note:
Tested on Python 2.0+ but should run on Python 1.5.x.
"""
import ldap
from ldap import __version__
_searchResultTypes={
ldap.RES_SEARCH_EN... |
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (<EMAIL>)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
from test.unit.test_player import PlayerTest
from test.unit.test_world import WorldTest
from test.unit.test_serverthread import ServerThreadTest
from ... |
'''
Created on 9 Nov 2012
@author: George
'''
'''
models the failures that servers can have
'''
# from SimPy.Simulation import now, Process, hold, request, release
import simpy
import math
from RandomNumberGenerator import RandomNumberGenerator
from ObjectInterruption import ObjectInterruption
class Failure(ObjectI... |
"""Tests for ImageClassifier.MetadataWriter."""
from absl.testing import parameterized
import tensorflow as tf
from tensorflow_lite_support.metadata import metadata_schema_py_generated as _metadata_fb
from tensorflow_lite_support.metadata.python.metadata_writers import image_classifier
from tensorflow_lite_support.m... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import, division
import sys, os, logging
import json
import yaml
from . import util
from . import keychain
_log_dir = os.path.expanduser('~/Library/Logs/net.jeeker.kits')
_loggers = {}
check_ok = util.colorStringGreen('✔')
chec... |
# -*- coding: utf-8 -*-
from flask import *
from database import database
from datetime import datetime, tzinfo
import random
import json
import re
import hashlib
try:
basestring
decode = lambda x: x.decode("utf-8")
except NameError:
decode = lambda x: x
app = Blueprint('substitution', __name__)
abc = u"... |
import vim
from sys import version_info
import re
from os.path import abspath, basename, dirname, expanduser, splitext, isfile, relpath, exists, join
from os import remove, mkdir
from shutil import move
from glob import glob
from .timestamps import timestamp
from .vim_interface import *
from .modelines import format_m... |
"""Unit tests for cdimage.osextras."""
import errno
import os
try:
from test.support import EnvironmentVarGuard
except ImportError:
from test.test_support import EnvironmentVarGuard
from cdimage import osextras
from cdimage.tests.helpers import TestCase, touch
class TestOSExtras(TestCase):
def setUp(sel... |
# -*- coding: utf-8 -*-
import markdown
from pyramid.httpexceptions import HTTPFound
from pyramid.view import (
view_config,
forbidden_view_config,
)
from pyramid.security import (
remember,
forget,
)
from .models import (
DBSession,
Entry,
)
from learning_journal.forms import EntryForm
from lea... |
import rx
import tx
import led
class Target(object):
def __init__(self):
# our UART consists of a RX and TX path as seen from the target
self.TX_FIFO_PATH = "../../appl/run/spike/tx_pipe"
self.RX_FILE_PATH = "../../appl/run/spike/rx_file"
self.RX_TMP_FILE_PATH = "../../appl/ru... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Tuquito Control Center
Copyright (C) 2010
Author: Mario Colque <<EMAIL>>
Tuquito Team! - www.tuquito.org.ar
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 F... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SplitLines.py
---------------------
Date : November 2014
Revised : February 2016
Copyright : (C) 2014 by Bernhard Ströbl
Email : bernhar... |
# -*- coding: utf-8 -*-
#
# Output to File classes.
#
#
from stetl.output import Output
from stetl.util import Util
from stetl.packet import FORMAT
from stetl.component import Config
import os
log = Util.get_log('fileoutput')
class FileOutput(Output):
"""
Pretty print input to file. Input may be an etree do... |
import urllib, shutil, csv
from time import time
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0,parentdir)
import summary.summary
def findRoutines(fileName):
for ln in fileName:
url = ln.split(";")[3]
routineName = url.split("/")[-1]
... |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... |
from thumbnailer import _resizer
from unittest import TestCase, main
import os.path as path
from PIL import Image, ImageChops
class ThumbnailerTests(TestCase):
def path(self, filename):
return path.join(self.img_path, filename)
def setUp(self):
self.img_path = path.join(path.dirname(__file__)... |
"""
Tomcat
=======
This module provides tools for installing `Tomcat`_.
.. _Tomcat: http://tomcat.apache.org/
"""
import os
import re
from fabric.api import cd, hide, run, settings
from fabric.operations import put
from fabtools.files import is_file, is_link, is_dir
from fabtools.utils import run_as_root
# Defa... |
# $Id: TestWebDAVbyHTTP.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for FileAccess module
#
import os
import sys
import httplib
import urllib2
import re
import base64
import unittest
from urlparse import urlparse
sys.path.append("../..")
readmetext="This directory is the root of the ADMIRAL shared file sy... |
import json
import logging
import os
import re
class GPServiceAccount():
"""Holds authentication details for connecting to the Globalization
Pipeline (GP) service instance. The service supports Globalization
Pipeline Authentication and Identity and Access Management (IAM) authentication
... |
from stix.extensions.identity.ciq_identity_3_0 import (CIQIdentity3_0Instance, STIXCIQIdentity3_0, OrganisationInfo, PartyName, Address, ElectronicAddressIdentifier, FreeTextAddress)
from stix.common import Identity
def resolveIdentityAttribute(incident, attribute, namespace):
ciq_identity = CIQIdentity3_0Instance... |
# -*- coding: utf-8 -*-
import json
import time
from base64 import urlsafe_b64decode, urlsafe_b64encode
from datetime import datetime
from urllib.parse import parse_qs, urlparse
from unittest import mock
from django.contrib.auth.models import AnonymousUser
from django.test import RequestFactory
from django.test.utils... |
"""
Simple SPARK-style scanner
Copyright (c) 2017-2018 Rocky Bernstein
"""
from __future__ import print_function
import re
from spark_parser.scanner import GenericScanner
from trepan.processor.parse.tok import Token
class ScannerError(Exception):
def __init__(self, text, text_cursor):
self.text = text
... |
"""
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
The array may conta... |
import os,json, datetime,sys
from libcowherd import *
from termcolor import colored
class CommotionCOWHerd(COWHerd):
def check_commotion(self,host,user="root"):
print colored("Checking if ","yellow"),colored(host,"cyan"),colored(" is a Commotion router","yellow")
output=self.runremote("ls /var/run/commotiond.pid"... |
from django.test import TestCase
from django.core.files.uploadedfile import SimpleUploadedFile
from directorio.models import Profesor, Asignatura, Convocatoria, PAC, Programa, Organizacion, Valoracion, Pertenece
class ProfesorTestCase(TestCase):
def setUp(self):
p = Profesor.objects.create(nombre="Profesor1", apel... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('kirppu', '0006_item_lost_property'),
]
operations = [
migrations.AlterField(
model... |
# -*- coding: utf-8 -*-
"""
tests.test_routers
==================
Unit tests for common router classes and utilities.
"""
import copy
import mock
import unittest
from flask import url_for
from flask_via.routers import BaseRouter, Include
from flask_via.routers.default import Functional
from tests import ViaTestCase... |
'''
Created on Dec 16, 2012
@author: blubin
'''
from wax import OverlayPanel;
from wax import Panel;
from wax import Button;
from inputPanel import InputPanel;
class SourceInputPanel(InputPanel, OverlayPanel):
def __init__(self, parent, stepname, form_creator, form_handler):
OverlayPanel.__i... |
# -*- coding: utf-8 -*-
"""
"""
import collections
from dibble.operations import SetMixin, IncrementMixin, RenameMixin, UnsetMixin, PushMixin, PushAllMixin
from dibble.operations import AddToSetMixin, PopMixin, PullMixin, PullAllMixin
class InvalidatedSubfieldError(Exception):
"""
Error raised when using a Su... |
parsetable = 'SSCD Parse table.csv'
lex_outputfile = 'output.txt'
__author__ = 'Ambareesh Revanur'
def M(state, terminal):
# state is an ascii string
# terminal is an ascii string
with open(parsetable) as f:
content = f.readlines()
return content[int(state) + 1].strip().split(',')[content[0].... |
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
from openbandparams import *
# Some identities and inequalities
print "Type 1 Quaternary:", AlPAsSb
assert AlPAsSb(x=0, y=0) == AlPAsSb(P=0, y=0)
assert AlPAsSb(x=0, y=0) == AlPAsSb(x=0, As=0)
assert AlPAsSb... |
"""
BibFieldUtils Unit tests.
"""
from invenio.testutils import make_test_suite, run_test_suite, InvenioTestCase
class BibFieldCoolListDictUnitTests(InvenioTestCase):
"""
Test class to verify the correct behaviour of the classes involved into the
intermediate structure
"""
def test_cool_list(sel... |
# -*- coding: utf-8 -*-
import datetime
import json
import logging.config
import os
import pytz
import redis
from . import protos
from . import enumerations
from . import models
__all__ = ['configuration', 'enumerations', 'models', 'protos']
def get_configuration(application_name):
configuration_file_path = ... |
import numpy as np
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import homogeneity_score
from sklearn.metrics.cluster import completeness_score
from sklearn.metrics.cluster import v_measure_score
from sklearn.metrics.cluster import homogeneity_completeness_v_measure
from sklearn... |
import os
import json
import unittest
import codecs
from ngram_profile import NGramProfile
class TestNGramProfile(unittest.TestCase):
def test_init(self):
profile = NGramProfile()
self.assertEqual(len(profile), 0)
def test_json_roundtrip(self):
json_profile = '{"a": 0.5, "b": 0.3, "... |
"""Defines SQLAlchemy's system of class instrumentation.
This module is usually not directly visible to user applications, but
defines a large part of the ORM's interactivity.
instrumentation.py deals with registration of end-user classes
for state tracking. It interacts closely with state.py
and attributes.py whic... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutTrueAndFalse(Koan):
def truth_value(self, condition):
if condition:
return 'true stuff'
else:
return 'false stuff'
def test_true_is_treated_as_true(self):
self.assertEqual('true ... |
#! /usr/bin/python
"""
Produces a `.chem` output from a provided `.log` format input
For information in `.chem` files see :ref:`chem_file_format`.
Usage: chem_to_dot.py [options]
Options:
-h, --help Show a help message and exit
-i INFILE, --infile=INFILE Read from INFILE (if ommited, use... |
from nova.tests import fixtures
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.functional import integrated_helpers
class MultinicSampleJsonTest(integrated_helpers.InstanceHelperMixin,
api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True
USE_... |
import unittest
from omtdrspub.elastic import elastic_mapping
from omtdrspub.elastic.elastic_query_manager import ElasticQueryManager
from omtdrspub.elastic.elastic_rs_paras import ElasticRsParameters
from omtdrspub.elastic.model.location import Location
from omtdrspub.elastic.model.resource_doc import ResourceDoc
CO... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 4 22:51:42 2014
@author: micha
"""
import numpy
from pyNN import recording
from . import simulator
class Recorder(recording.Recorder):
_simulator = simulator
def _record(self, variable, new_ids, sampling_interval=None):
if not (sampling_interval is Non... |
from typing import Union, Tuple, cast
import numpy as np
import pytest
import sympy
import cirq
from cirq import protocols
from cirq.type_workarounds import NotImplementedType
class GateUsingWorkspaceForApplyUnitary(cirq.SingleQubitGate):
def _apply_unitary_(self, args: cirq.ApplyUnitaryArgs) -> Union[np.ndarra... |
# -*- coding: utf-8 -*-
__author__ = 'rasjani'
import datetime
import dateutil.tz
import dateutil.parser
import time
import htmlentitydefs
import re
from pytz import timezone
FinlandTZ = timezone('Europe/Helsinki')
_error_msg_lookup = {
'invalid_password': 30800,
'unknown_error': 30801,
'user_not_found': 308... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
Payload Packet pack/unpack functions in Python
----------------------------------------
Author: Zheng GONG(<EMAIL>)
This file is part of FIWT.
FIWT is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as publ... |
"""Base class for classes that need modular database access."""
from oslo.config import cfg
from climate.openstack.common import importutils
db_driver_opt = cfg.StrOpt('db_driver',
default='climate.db',
help='Driver to use for database access')
CONF = cfg.CONF
C... |
from .control_activity import ControlActivity
class UntilActivity(ControlActivity):
"""This activity executes inner activities until the specified boolean
expression results to true or timeout is reached, whichever is earlier.
:param additional_properties: Unmatched properties from the message are
d... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
vector.py
---------------------
Date : February 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
******************************... |
from weboob.capabilities.bank import ICapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword, Value
from .browser import BredBrowser
__all__ = ['BredBackend']
class BredBackend(BaseBackend, ICapBank):
NAME = 'bred'
MAINTAINER... |
from config.api2_0_config import *
from modules.logger import Log
from on_http_api2_0 import ApiApi as Api
from on_http_api2_0.rest import ApiException
from proboscis.asserts import *
from proboscis import SkipTest
from proboscis import test
from json import dumps, loads
from on_http_api2_0 import rest
import time
impo... |
#!/usr/bin/env python
"""
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");... |
"""
raven.contrib.django.middleware
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import threading
from django.conf import settings
from django... |
"""
Views for the code snippets app.
"""
import os.path
from zipfile import ZipFile
from io import BytesIO
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy as _
from django.template.response import TemplateResponse
from django.http.response import HttpResponse
from ap... |
import datetime
import re
from os import walk, listdir
from os.path import exists, relpath, splitext
import markdown
from yaml import safe_load as load
from babel.messages.catalog import Catalog
from babel.messages.pofile import write_po, read_po
from flask import safe_join
from bolttools.common import UNITS
def spli... |
# ------------------------------------------------------------------------------
import appy
import os.path
# ------------------------------------------------------------------------------
appyPath = os.path.realpath(os.path.dirname(appy.__file__))
od = 'application/vnd.oasis.opendocument'
ms = 'application/vnd.openxm... |
#!/usr/bin/python
"""
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... |
#!/usr/bin/env python3
import sys, os, collections
from pathlib import Path
from PySide.QtCore import QObject, Slot, Signal
from PySide.QtGui import QApplication
from PySide.QtWebKit import QWebView, QWebSettings
from PySide.QtNetwork import QNetworkRequest
class BasicHub(QObject):
def __init__(self):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple CRUD example for the Python bindings."""
## Created: 16 May 2015 Guy Kloss <<EMAIL>>
##
## (c) 2015 by Mega Limited, Auckland, New Zealand
## https://mega.nz/
## Simplified (2-clause) BSD License.
##
## You should have received a copy of the license al... |
import sh
import shutil
import glob
import os
import re
import sh
import shutil
import sys
HOST = "https://native-toolchain.s3.amazonaws.com/build"
OS_MAPPING = {
"centos6" : "ec2-package-centos-6",
"centos5" : "ec2-package-centos-5",
"centos7" : "ec2-package-centos-7",
"debian6" : "ec2-package-debian-6",
"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from abc import abstractproperty
from pants.engine.addressable import Exactly, addressable
from pants.engine.fs import PathGlobs
from pants.engine.objects i... |
import re
import gdb
from libport.tools import *
# This class is inspired from
# https://github.com/ruediger/Boost-Pretty-Printer/ excepts that it shrink
# the typename to make it shorter.
@gdb_pretty_printer
class BoostOptional(object):
"Pretty Printer for boost::optional"
regex = re.compile('^boost::optio... |
import logging
from touchandgo.download.moov import have_moov
from touchandgo.helpers import get_settings
log = logging.getLogger('touchandgo.strategy')
class FileStrategy(object):
def __init__(self, manager):
settings = get_settings()
self.settings = settings.strategy
self.manager = ma... |
#!/usr/bin/env nix-shell
#!nix-shell -i python3.5 -p python35Packages.irc
import irc.bot
# different shebang for nix usage. (should tidy this later)
#== CONFIG ==
MESSAGE="This is a very small channel, so it may take up to 30 minutes before anyone answers the first time. Please be patient, we do answer!"
SERVER=irc... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
#!/usr/bin/env python
import coverage_utils
coverage_utils.cov_start()
import rospkg
import sys
rospack = rospkg.RosPack()
mission_control_path = rospack.get_path('mission_control')
sys.path.append("%s/src" % mission_control_path)
import rospy
import behaviour
from mission_control_utils_constants import Constants
fro... |
"""Runtime Constants in the Azure Cosmos database service.
"""
class MediaTypes(object):
"""Constants of media types.
See http://www.iana.org/assignments/media-types/media-types.xhtml for
more information.
"""
Any = "*/*"
ImageJpeg = "image/jpeg"
ImagePng = "image/png"
JavaScript = "... |
'''This module contains classes to represent the main page.'''
import PyQt4.QtGui as QtGui
import PyQt4.QtCore as QtCore
from PyQt4.QtCore import Qt
from gui.qt4ui import widgets
from gui.qt4ui.Utils import tr
import extension
import gui
import e3
class MainPage (QtGui.QWidget, gui.MainWindowBase):
'''The main ... |
"""Contains the Application class, which represents the running server."""
import logging
import cherrypy
from oobrestserver.ResourceTree import ResourceTree
from oobrestserver.GuiWrapper import GuiWrapper
from oobrestserver.Authenticator import Authenticator
from oobrestserver import ResponseBuilder
class Applica... |
import os
import numpy as np
from astropy.table import Table
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib
import pickle
import astropy.io.fits as ts
import AnniesLasso_2 as tc
import math
from astropy.time import Time
from astropy import units as u
from astropy.coordinates import Sk... |
import Draft
import numpy as np
import random
def genCylinderFace(w,yscale=1,radius=100,delta=1, angle=180,xscale=0,flipxy=False,xoffset=0.0,yoffset=1.0,model=10,details=6):
''' generate a bended wire/surface/solid for wire w
radius, radius+delta - inner and outer radius of the generated solid
yscale - factore ... |
from shellbot import Command
class Drop(Command):
"""
Deletes an item from the todo list
>>>command = Drop()
>>>shell.load_command(command)
"""
keyword = u'drop'
information_message = u'Delete an item from the todo list'
usage_message = u'drop [#<n>]'
def execute(self, bot, argu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.