text stringlengths 12 6.59M |
|---|
from HARK.utilities import memoize
from itertools import product
import math
import numpy as np
from scipy.special import erf, erfc
import scipy.stats as stats
class Distribution:
"""
Base class for all probability distributions.
Parameters
----------
seed : int
Seed for random number gen... |
# coding: utf-8
import urllib.parse
import functools
import lglass.rpsl
class Database(object):
""" Database is an abstract class which defines some constants and setter/getter
for subscripts. You have to extend from it by creating a new class and
overriding __init__, get, list, find, save and delete to conform t... |
#!/usr/bin/python
"""
The program manual!
"""
import re
import time
from common import *
from compat import ts_to_iso
MAN_NAME = ("""\
pagekite.py - Make localhost servers publicly visible.
""")
MAN_SYNOPSIS = ("""\
<b>pagekite.py</b> [<a>--options</a>] [<a>service</a>] <a>kite-name</a> [<a>+flags</a>]
""")
M... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from numpy.testing import assert_allclose, assert_approx_equal
from nose.tools import assert_equal, assert_tuple_equal, assert_is_none, assert_true, assert_false, raises, assert_in, assert_not_in
from UliEngineering.EngineerIO import *
from UliEngineering.Units import *
fr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from numpy.testing import assert_approx_equal
from nose.tools import assert_equal, assert_tuple_equal, assert_is_none, assert_true, assert_false, raises
from UliEngineering.EngineerIO import *
from UliEngineering.EngineerIO import _formatWithSuffix
class TestEngineerIO(ob... |
"PubMed interface."
from collections import OrderedDict
import os
import time
import unicodedata
import xml.etree.ElementTree
import requests
PUBMED_FETCH_URL = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&rettype=abstract&id=%s'
PUBMED_SEARCH_URL = 'https://eutils.ncbi.nlm.nih.gov/entrez/eu... |
# -*- coding: utf-8 -*-
"""
Pull Effect
~~~~~~
An information consolidation machine or something.
"""
from flask import Flask
from flask import render_template
from pulleffect.lib.flask_cas import CAS
from pulleffect.lib.google.gcal import gcal
from pulleffect.lib.google.gplus import gplus
# from pulleffe... |
import os
import copy
import glob
import json
import uuid
import logging
from pupa.utils import get_psuedo_id
from pupa.utils.topsort import Network
from opencivicdata.models import LegislativeSession
from pupa.exceptions import UnresolvedIdError, DataImportError
def omnihash(obj):
""" recursively hash unhashable ... |
import mock
from django.utils import timezone
from rest_framework import status
from nodeconductor.structure.tests import factories as structure_factories
from .test_backend import BaseBackendTestCase
from . import factories
from .. import models
class BaseImportTestCase(BaseBackendTestCase):
def setUp(self):
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms... |
from random import random
import time
import itertools
from dimod.core.composite import Composite
from dimod.core.sampler import Sampler
from dimod.core.structured import Structured
from dimod.response import Response
from dimod.vartypes import Vartype
__all__ = ['SpinReversalTransformComposite']
class SpinReversal... |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import time
import os
import re
import threading
import math
import Queue
from serial import SerialTimeoutException
from octoprint... |
# -*- coding: utf-8 -*
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
# ('BT', 'Barletta-Andria-Trani'), # active starting from 2009... |
from __future__ import absolute_import, unicode_literals
from datetime import date
from collections import namedtuple
from unittest import TestCase
import pytest
from django_dynamic_fixture import G
from ..models import AverageTargetPercentMixin, LogFrame, Result, Period
from mock import Mock
from rest_framework.test... |
import re
import json
import time
import tarfile
import functools
from bs4 import BeautifulSoup
from bson import ObjectId
from six import BytesIO
from dlkit.abstract_osid.assessment.objects import Item
from dlkit.abstract_osid.osid.errors import IllegalState, NotFound
from dlkit.primordium.id.primitives import Id
f... |
import base64
import hashlib
import hmac
import random
import struct
import sys
import platform
from puresasl import SASLError, SASLProtocolException, QOP
try:
import kerberos
have_kerberos = True
except ImportError:
have_kerberos = False
if platform.system() == 'Windows':
try:
import winkerb... |
#!/usr/bin/env python
'''
@package ion.services.dm.distribution.pubsub_management_service Implementation of IPubsubManagementService interface
@file ion/services/dm/distribution/pubsub_management_service.py
@author Tim Giguere
@brief PubSub Management service to keep track of Streams, Publishers, Subscriptions,
and th... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import pytest
from click.testing import CliRunner
from great_expectations import DataContext
from great_expectations.cli import cli
from tests.cli.utils import assert_no_logging_messages_or_tracebacks
def test_suite_help_output(caplog,):
... |
import os
from eg import eg_util
from mock import patch
from nose.tools import assert_equal
def test_pager_set_returns_true():
with patch('os.getenv', return_value='less'):
actual = eg_util.pager_env_is_set()
assert actual is True
def test_pager_not_set_returns_false():
# os.getenv returns ... |
__version__ = '0.29.0.dev1617'
|
#!/usr/bin/env python
'''
@package ion.services.dm.distribution.pubsub_management_service Implementation of IPubsubManagementService interface
@file ion/services/dm/distribution/pubsub_management_service.py
@author Tim Giguere
@brief PubSub Management service to keep track of Streams, Publishers, Subscriptions,
and th... |
import unittest
import os.path
import sudoku.io
import sudoku.coloring
class ColoringTests(unittest.TestCase):
def test_welsh_powell(self):
filepath = os.path.join(
os.path.dirname(__file__),
'../rsc/9/sample-2.sdk')
graph = sudoku.io.read(filepath)
graph_solved = ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
==================
desitarget.skies
==================
Module dealing with the assignation of sky fibers for target selection
"""
from __future__ import (absolute_import, division)
#
import numpy as np
import fitsio
from time i... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
================
desiutil.modules
================
This package contains code for processing and installing `Module files`_.
.. _`Module files`: http://modules.sourceforge.net
"""
from shutil import which
def init_modules(mo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bounding classes used when proposing new live points, along with a number of
useful helper functions. Bounding objects include:
UnitCube:
The unit N-cube (unconstrained draws from the prior).
Ellipsoid:
Bounding ellipsoid.
MultiEllipsoid:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Functions for proposing new live points used by
:class:`~dynesty.sampler.Sampler` (and its children from
:mod:`~dynesty.nestedsamplers`) and
:class:`~dynesty.dynamicsampler.DynamicSampler`.
"""
import warnings
import numpy as np
from numpy import linalg
from .utils i... |
from __future__ import print_function
import os, warnings
import numpy as np
import fitsio
from tractor.splinesky import SplineSky
from tractor import PixelizedPsfEx, PixelizedPSF
from astrometry.util.fits import fits_table
from legacypipe.utils import read_primary_header
from legacypipe.bits import DQ_BITS
import log... |
###############################################################################
# plot_afe_spectra.py: plot residual spectra for a [Fe/H] bin to demonstrate
# that we can measure [a/Fe]
###############################################################################
import sys
import os, os.path
im... |
__author__ = 'wlas'
import pytest
import json
import os.path
from fixture.application import Application
fixture = None
target = None
@pytest.fixture
def app(request):
global fixture
global target
browser = request.config.getoption("--browser")
config_file = os.path.join(os.path.dirname(os.path.abspa... |
from array import array
import datetime
from decimal import Decimal
from vtdb import times
# These numbers should exactly match values defined in dist/mysql-5.1.52/include/mysql/mysql_com.h
VT_DECIMAL = 0
VT_TINY = 1
VT_SHORT = 2
VT_LONG = 3
VT_FLOAT = 4
VT_DOUBLE = 5
VT_NULL = 6
VT_TIMESTAMP = 7
VT_LONGLONG = 8
VT_IN... |
import glob
import os
import re
from collections import namedtuple
import pytest
import yaml
from contrib.namespaces import LinuxNamespace
Scenario = namedtuple("Scenario", ["path", "qmin", "config"])
def config_sanity_check(config_dict, config_name):
"""Checks if parsed configuration is valid"""
mandatory... |
import requests
import json
import types
from document import Document, Edge
from theExceptions import ValidationError, SchemaViolation, CreationError, UpdateError, DeletionError, InvalidDocument, AbstractInstanciationError
from query import SimpleQuery
COLLECTION_DOCUMENT_TYPE = 2
COLLECTION_EDGE_TYPE = 3
COLLECTIO... |
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2016-2019
# (c) University of Strathclyde 2019
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# Cathedral Street,
# Glasgow,
# G1 1XQ
# Scotland,
# ... |
#-*- coding: utf-8 -*-
from ..data import BoletoData, CustomProperty
class BoletoCaixa(BoletoData):
'''
Gera Dados necessários para criação de boleto para o banco Caixa
Economica Federal
'''
conta_cedente = CustomProperty('conta_cedente', 11)
'''
Este numero tem o inicio fixo... |
# -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2015 Scifabric LTD.
#
# PYBOSSA 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 op... |
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake 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) any later version.
#
# OpenQuake is distri... |
"""
end2end_test.py
Copyright 2014 ETH Zurich
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,... |
#!/usr/bin/env python
from sebastian.core.elements import Point, HSeq, OSeq, VSeq, UnificationError
p1 = Point(a=1, b="foo")
assert p1.tuple("b", "a") == ("foo", 1)
p2 = Point(a=1, b="foo")
assert p1 == p2
p3 = Point(c=2)
assert p1 != p3
p4 = p1 % p3
assert p4 == Point(a=1, b="foo", c=2)
assert p1 % p2 == p1
... |
# -*- coding: utf-8 -*-
# Copyright (c) Cognitect, Inc.
# All rights reserved.
import unittest
# get parent directory into python path
import sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + os.path.sep + os.path.pardir))
# then import transit stuff
from transit.reader import JsonUnmarshaler, MsgPa... |
# This file is part of PyDisALEXI for running disALEXI using different TSEB models
# Copyright 2016 Mitchell Schull and contributors listed in the README.md file.
#
# This program 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 ... |
"""Convert ASTs into L{pydoctor.model.Documentable} instances."""
from pydoctor import model, ast_pp
from compiler import visitor, transformer, ast
import symbol, token
class str_with_orig(str):
"""Hack to allow recovery of the literal that gave rise to a docstring in an AST.
We do this to allow the users to... |
#! python3
# Copyright 2017 Michael Neeley
#
# This contains the main functions
# built-in libs
import os, argparse
from os.path import join, dirname
# installed libs
from robobrowser import RoboBrowser # pip install robobrowser
from twilio.rest import Client # pip install twilio
from twilio.base.exceptions import Tw... |
# -*- coding: utf-8 -*-
import sys
import pkg_resources
import unicodecsv as csv
class FeatureError(Exception):
pass
class SegmentError(Exception):
pass
class FeatureTable(object):
"""Encapsulate the segment <=> feature mapping in the file
data/segment_features.csv.
"""
def __init__(self):... |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# 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... |
###############################################################################
#
# Copyright 2011-2012 Pants Developers (see AUTHORS.txt)
#
# 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
#
# ... |
import requests
import json
from . import endpoints
from . import globals
from .models.competition import Competition
from .models.team import Team
class Football(object):
def __init__(self, api_key):
""" Create a Football instance that serves as a driver for this
library. Checks for validity... |
"""Module containing the core functions of pygametemplate."""
import os
import sys
import traceback
from datetime import datetime
import ctypes
import pygame
from pygametemplate.exceptions import CaughtFatalException
TEST = bool(int(os.environ.get("TEST", "0")))
PATH = os.getcwd()
def path_to(*path):
"""Retu... |
#!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
class Win32Display(Display):
def get_screens(self):
screens = []
... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.asm
~~~~~~~~~~~~~~~~~~~
Lexers for assembly languages.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, words, \
... |
import pytest
import os
import sys
import random
import lz4.frame as lz4frame
test_data=[
(b''),
(os.urandom(8 * 1024)),
(b'0' * 8 * 1024),
# (bytearray(b'')),
# (bytearray(os.urandom(8 * 1024))),
]
# if sys.version_info > (2, 7):
# test_data += [
# (memoryview(b'')),
# (memory... |
import os
import re
import sys
name = "svg"
ksyms = {}
special_ksyms = {
"ISO_Level5_Shift": "Lv5",
"ISO_Level3_Latch": "Lv3",
}
def convert(debug, outdir, keydefs, layouts, partials):
read_keysymdefs(outdir)
outldir = os.path.join(outdir, "layouts")
outpdir = os.path.join(outdir, "partials")
... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.asm
~~~~~~~~~~~~~~~~~~~
Lexers for assembly languages.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, words, \
... |
from nose.tools import *
from tempfile import mkdtemp
import genomepy
import shutil
# Python 2
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError
def setup():
print("SETUP!")
def teardown():
print("TEAR DOWN!")
def test_basic():
cfg = genomepy.functions.config
assert 1 == l... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.hdl
~~~~~~~~~~~~~~~~~~~
Lexers for hardware descriptor languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups, include, using, t... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.idl
~~~~~~~~~~~~~~~~~~~
Lexers for IDL.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, words
from pygments.token import Text, Comment, Oper... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.web
~~~~~~~~~~~~~~~~~~~
Lexers for web-related languages and markup.
:copyright: 2006-2008 by Georg Brandl, Armin Ronacher,
Tim Hatch <tim@timhatch.com>, Stou Sandalski.
:license: BSD, see LICENSE for more details.
"""
import re
try:
... |
from __future__ import print_function
import os
import numpy as np
import uuid
import hashlib
import sys
import getopt
from collections import namedtuple, OrderedDict, defaultdict
from wheezy.template import Engine, CoreExtension, DictLoader
from pyimzml.compression import NoCompression, ZlibCompression
IMZML_TEMPL... |
from abc import abstractmethod
import math
import scipy
import numpy as np
import tqdm
import sys
from astropy.io import fits as pyfits
from oktopus.posterior import PoissonPosterior
from .utils import channel_to_module_output, plot_image
if sys.version_info[0] == 2:
from inspect import getargspec
def _get_num... |
#!/usr/bin/env python
# encoding: utf-8
"""
cmd.py
Created by Geert Dekkers on 2010-03-28.
Copyright (c) 2010 Geert Dekkers Web Studio. All rights reserved.
Class dedicated to subprocess functions
"""
import sys
import os
import unittest
import subprocess
from pyPdf import PdfFileWriter, PdfFileReader
class Comman... |
#-*- coding:Utf-8 -*-
"""
.. currentmodule:: pylayers.gis.layout
This class handle the description of an Indoor layout
Class Layout
============
.. autosummary::
:toctree: generated
Utility functions
-----------------
.. autosummary::
:toctree: generated/
Layout.__init__
Layout.__repr__
Layout... |
import pygame
import sys,os
import core
pygame.font.init()
ft = pygame.font.Font(os.path.join("fonts","Vera.ttf"),10)
class Window(object):
_focused = None
def sf(self,v):
self._focused = v
focused = property(lambda s: s._focused,sf)
move = []
over = None
window = Window()
... |
# 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) any later version.
#
# This program is distributed in the hope that it will be usefu... |
# Copyright 2018 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 agreed to in writing, ... |
# -*- coding: utf-8 -*-
#
#
# LAYOUT Module
#
#
#
r"""
.. currentmodule:: pylayers.gis.layout
.. autosummary::
:toctree: generated
Layout Class
============
.. autosummary::
:toctree: generated
Layout.Layout.add_fnod
Layout.add_furniture
Layout.add_furniture_file
Layout.add_nfpe
Layo... |
# -*- coding: utf8 -*-
"""
Module to work with world maps (Generation, edition, save...)
"""
import subprocess
import os
from core import config
import sqlite3
import sys
import tarfile
import csv
# Import an external check class from the generator
sys.path.insert(0, config.generator['map']['path'])
import checks
cl... |
# Copyright 2018 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 agreed to in writing, ... |
import numpy as np
import pytest
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from poliastro.twobody import angles
# Data from Schlesinger & Udick, 1912
ANGLES_DATA = [
# ecc, M (deg), nu (deg)
(0.0, 0.0, 0.0),
(0.05, 10.0, 11.06),
(0.06, 30.0, 33.67),
(... |
"""This module provides the HaaS service's public API.
haas.api_server translates between this and HTTP.
TODO: Spec out and document what sanitization is required.
"""
import model
class APIError(Exception):
"""An exception indicating an error that should be reported to the user.
i.e. If such an error occu... |
###This will hold all api calls for TrafficCloud
import os
import pickle
import uuid
import requests
from app_config import AppConfig as ac
import json
from pprint import pprint
def CloudWizard(ip_addr, port=8088):
return TrafficCloud(ip_addr, port)
class TrafficCloud:
def __init__(self, ip_addr, port):
... |
# coding=utf-8
# Copyright 2018 Foursquare Labs Inc. All Rights Reserved.
from __future__ import (
absolute_import,
division,
generators,
nested_scopes,
print_function,
unicode_literals,
with_statement,
)
import json
import os
from pants.backend.project_info.tasks.export import ExportTask, get_buildroo... |
import collections
from datetime import datetime
import hashlib
import time
import uuid
from django.conf import settings
from django.db import models, connection
import amo
import amo.models
from amo.utils import sorted_groupby
from amo.urlresolvers import reverse
from addons.models import Addon, AddonCategory, Addon... |
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2011, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "Ian Goodfellow"
import time
from pylearn2.models.model import Model
from theano import config, function
import theano.tensor as T
import numpy as np
i... |
from ummbNet import *
db.drop_all()
db.create_all()
# Create bands
gold_band = Band('Gold Band')
maroon_band = Band('Maroon Band')
gopher_band = Band('Gopher Band')
db.session.add_all([gold_band, maroon_band, gopher_band])
db.session.commit()
# Create EventTypes
mens_basketball = EventType("Men's Basketball")
wom... |
# Copyright 2018 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 agreed to in writing, ... |
#!/usr/bin/env python
from PIL import Image
import numpy as np
from scipy.ndimage.interpolation import rotate
from scipy.ndimage import gaussian_filter
import argparse
import os
from TiffWriter import write_tiff
def crop_center(img, new_shape):
"""
Crop an image equally on each size to create the new_shape
... |
#!/usr/bin/env python2.6
#
# This file is used to test host- and service-downtimes.
#
import sys
import time
import datetime
import os
import string
import re
import random
import unittest
sys.path.append("..")
sys.path.append("../shinken")
#sys.path.append("../bin")
#sys.path.append(os.path.abspath("bin"))
import... |
# Copyright (c) 2021 The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this lis... |
"""The picket fence module is meant for analyzing EPID images where a "picket fence" MLC pattern has been made.
Physicists regularly check MLC positioning through this test. This test can be done using film and one can
"eyeball" it, but this is the 21st century and we have numerous ways of quantifying such data. This m... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from collections import Counter
import itertools
import math
import numpy as np
import random
# ------------------------------------------------------------
# Cards
# Cards are integers:
CARD_FACES = 'A234567890JQK'
CARD_SUITS = 'SH... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import itertools
from dataclasses import dataclass
from typing import Any, Iterator
from pants.build_graph.address import BANNED_CHARS_IN_PARAMETERS
fr... |
import os
import re
import yaml
import importlib.util
from pymacaron.log import pymlogger
log = pymlogger(__name__)
def modified_time(path):
return os.path.getmtime(path)
def swagger_type_to_pydantic_type(t, models=[]):
"""Given a swagger type or format or ref definition, return its corresponding python t... |
# Copyright 2016 by Raytheon BBN Technologies Corp. All Rights Reserved.
from qgl2.qgl2 import qgl2decl, qbit, pulse
from qgl1.qgl1 import Sync, Wait
# init will demarcate the beginning of a list of
# experiments. QGL1 compiler injects WAITs in beginning of
# every sequence for now
# In QGL1 there's an implicit `ini... |
import IPython.nbformat.current as nbformat
import numpy as np
def format_line(line):
"""
Format a line of Matlab into either a markdown line or a code line.
Parameters
----------
line : str
The line of code to be formatted. Formatting occurs according to the
following rules:
... |
"""Thermos garbage-collection (GC) executor
This module containts the Thermos GC executor, responsible for garbage collecting old tasks and
reconciling task states with the Mesos scheduler. It is intended to be run periodically on Mesos
slaves utilising the Thermos executor.
"""
from functools import wraps
import os... |
#!/usr/bin/env python
"""
This module implements a Unit, which is a subclass of float. It also defines
supported units for some commonly used units for energy, length, temperature,
time and charge. Units also support conversion to one another,
and additions and subtractions perform automatic conversion if units are
de... |
import difflib
import datetime
import time
import random
import re
import math
import mongoengine as mongo
import zlib
import hashlib
import redis
import pymongo
import HTMLParser
from collections import defaultdict
from operator import itemgetter
from bson.objectid import ObjectId
from BeautifulSoup import BeautifulSo... |
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from crowdsourcing import views
from crowdsourcing.viewsets.project import *
from crowdsourcing.viewsets.user import UserViewSet, UserProfileViewSet, UserPreferencesViewSet
from crowdsourcing.viewsets... |
# coding: utf-8
from __future__ import division, unicode_literals
"""
This class implements smart io classes that performs intelligent io based on
file extensions.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email_... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Utility methods for MQTT tests
:author: Thomas Calmant
:copyright: Copyright 2016, Thomas Calmant
:license: Apache License 2.0
..
Copyright 2016 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this fil... |
import difflib
import datetime
import time
import random
import re
import math
import mongoengine as mongo
import zlib
import hashlib
import redis
from utils.feed_functions import Counter
from collections import defaultdict
from operator import itemgetter
from bson.objectid import ObjectId
# from nltk.collocations impo... |
"""
Functions and classes related to scripting, including `MelGlobals` and `Mel`
"""
import sys
import os
import inspect
from getpass import getuser as _getuser
import system
import collections
import maya.mel as _mm
import maya.cmds as _mc
import pymel.util as util
import pymel.internal.pmcmds as cmds
import pymel.i... |
import webapp2
from webapp2_extras.security import generate_random_string
from webapp2_extras import sessions
from webapp2_extras import jinja2
from jinja2 import Markup
from models import LogEntry,StoreUser,Item
from datetime import tzinfo,timedelta
import logging
from google.appengine.api import users
from google.app... |
import warnings
import copy
import re
class ChildSubsetSimplified:
''' Provide simplified access to specific child elements through regex
matching of descriptors such as tag, attributes, or a combination thereof.
For example, if you want to simply match a tag (or tags), pass in a regular
expression st... |
# Standard libs
import httplib2
import json
import os
import datetime
from webapp2_extras import sessions
from webapp2_extras import i18n
import webapp2
import datetime
import time
import re
import jinja2
import random
import sys
from discovery import Discovery
from google.appengine._internal.django.utils.encoding impo... |
"""ageo.ranging - active geolocation library: calibration curves.
A calibration curve models the relationship between distance and
round-trip time.
"""
import collections
from functools import partial
import warnings
import numpy as np
from scipy import optimize, spatial
class _Line(collections.namedtuple("__Line"... |
from pathlib import PurePath
from tempfile import mkdtemp
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.views.generic import RedirectView
from django.views.generic.detail import SingleObjectMixin
from viewflow.models import Task
from viewflow.flow.views import UpdateProc... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
import unittest
import os.path as op
from nose.plugins.attrib import attr
path_to_script = op.dirname(op.abspath(__file__))
import sys
sys.path.insert(0, op.abspath(op.join(path_to_script, "../../io3d")))
sys.path.insert... |
# Python implementation of the MySQL client-server protocol
# http://dev.mysql.com/doc/internals/en/client-server-protocol.html
from __future__ import print_function
from ._compat import PY2, range_type, text_type, str_type, JYTHON, IRONPYTHON
from functools import partial
import os
import hashlib
import socket
try:... |
# -*- coding: utf-8 -*-
__author__ = 'CubexX'
from models import db, Entity, Chat, User, UserStat, ChatStat, Stack
from config import SITE_URL, cache, logger
from telegram import ParseMode
import locale
import re
def number_format(num, places=0):
return locale.format("%.*f", (places, num), True)
def start(bot, u... |
import os
import ConfigParser
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from schema import *
def fetch_engine():
"""
Read from config.ini file and load appropriate database
"""
echo = False
config = ConfigParser.ConfigParser()
config.read('{0}/config.ini'.fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.