text stringlengths 12 6.59M |
|---|
from flask import *
from flask_sqlalchemy import SQLAlchemy
import json
from datetime import datetime
from sqlalchemy.dialects.mysql import *
app = Flask(__name__)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://impact:helloworld@localhost/impact"
db = SQLAlchemy(a... |
# example showing how to plot scattered data with hexbin.
from numpy.random import uniform
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.basemap import Basemap
# create north polar stereographic basemap
m = Basemap(lon_0=270, boundinglat=20, projection='npstere',round=True)
# number of points t... |
from __future__ import with_statement
from contextlib import contextmanager
import sqlite3
import tempfile
import simplejson as json
from common import TestCase
import api_spec
@contextmanager
def db_session(pool):
session = pool.get_session()
try:
yield session
finally:
pool.put_session(s... |
from asl.interface.importer import initialize_cli_application, InitializationContext
import unittest
import json
initialize_cli_application(InitializationContext(unit_test=True))
from asl.task.task_data import TaskData
from asl.utils.injection_helper import inject
from asl.application.service_application import... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import copy
class Message(object):
def __init__(self, backend, caller=None, text=None):
self._backend = backend
self.caller = caller
self.text = text
self.responses = []
def __unicode__(self):
return self.text
... |
"""
tests.test_views
~~~~~~~~~~~~~~~~
Provides unit tests for the :mod:`flask_restless.views` module.
:copyright: 2011 by Lincoln de Sousa <lincoln@comum.org>
:copyright: 2012, 2013 Jeffrey Finkelstein <jeffrey.finkelstein@gmail.com>
:license: GNU AGPLv3+ or BSD
"""
from datetime import date
... |
# Copyright (c) 2014 Mirantis 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 agreed to in writing, so... |
from flask import *
from flask_sqlalchemy import SQLAlchemy
import json
from datetime import datetime
from sqlalchemy.dialects.mysql import *
app = Flask(__name__)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://impact:helloworld@localhost/impact"
db = SQLAlchemy(a... |
import time
import json
import unittest
import storjcore
from time import mktime
from datetime import datetime
from datetime import timedelta
from dataserv.app import db, app
from btctxstore import BtcTxStore
from email.utils import formatdate
from dataserv.Farmer import sha256
from dataserv.Farmer import Farmer
clas... |
"""UPER (Unaligned Packed Encoding Rules) codec.
"""
from . import EncodeError, DecodeError
class DecodeChoiceError(Exception):
pass
class Encoder(object):
def __init__(self):
self.byte = 0
self.index = 7
self.buf = bytearray()
def append_bit(self, bit):
"""Append giv... |
from cheeseprism import index
from cheeseprism import utils
from cheeseprism.resources import App
from contextlib import contextmanager
from mock import Mock
from mock import patch
from nose.tools import raises
from path import path
from pyramid import testing
from pyramid.decorator import reify
from pyramid.events imp... |
# -*- coding: utf-8 -*-
from os.path import join
from inspect import isclass, getmembers
from django.forms import Widget, TextInput, Textarea, CharField
from django.contrib import admin
from django.utils.translation import ugettext as _, ugettext_lazy
from django.utils.encoding import force_unicode
from django.conf im... |
#!/usr/bin/env python
"""
Run this example with:
mpirun -np 2 python examples/loadbalance.py
Author: Manodeep Sinha. Jan 8, 2014
- part of the load-balancing implementation for emcee.
"""
from __future__ import print_function
import sys
import time
import pickle
import numpy as np
import emcee
from emcee.utils... |
#! /usr/bin/env python
"""A suite to test file_exist."""
import sys
import os
import unittest
import pytest
dir_path = os.path.dirname(os.path.realpath(__file__))
lib_path = os.path.abspath(os.path.join(dir_path, '..'))
sys.path.append(lib_path)
from pypiret.Runs import FastQC # noqa
import luigi
import shutil
class ... |
"""
WSGI config for MAGE project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Views tests for the OSF."""
from __future__ import absolute_import
import datetime as dt
import httplib as http
import json
import time
import pytz
import unittest
from flask import request
import mock
import pytest
from nose.tools import * # noqa PEP8 asserts
from d... |
import json
import shutil
from django.test import TestCase
from django.test.client import Client
from override_settings import override_settings
from django.conf import settings
from django.core.urlresolvers import reverse
from path import path
from tempfile import mkdtemp
import json
from student.models import Regist... |
# 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... |
import os
import re
import sys
import time
import random
import datetime
import commands
import threading
from taskbuffer.TaskBuffer import taskBuffer
from pandalogger.PandaLogger import PandaLogger
from dataservice.Adder import Adder
from brokerage.SiteMapper import SiteMapper
# password
from config import panda_conf... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for Chromium JS resources.
See chrome/browser/resources/PRESUBMIT.py
"""
class JSChecker(object):
def __init__(self, input_api, o... |
from raspibot.Serial import AttinyProtocol, InvalidResponseException, InvalidLengthException
import pytest
ALIVE = b'\x01'
ENCODERS_RIGHT = b'\x02'
ENCODERS_LEFT = b'\x03'
ENCODERS_BOTH = b'\x04'
ENCODERS_RESET_RIGHT = b'\x05'
ENCODERS_RESET_LEFT = b'\x06'
ENCODERS_RESET_BOTH = b'\x07'
ECHO = b'\x0C'
ACK = b'\x10... |
#!/usr/bin/env python3
import argparse
# import glob
# import itertools
import math
import os
# import sys
from pathlib import Path
from typing import Iterable
import numpy as np
import pandas as pd
from astropy import constants as const
from astropy import units as u
import artistools as at
import artistools.spectr... |
from biplist import *
import datetime
import os
from test_utils import *
import unittest
class TestWritePlist(unittest.TestCase):
def setUp(self):
pass
def roundTrip(self, root):
plist = writePlistToString(root)
self.assertTrue(len(plist) > 0)
readResult = readPlistFromStri... |
"""
This file will read in the file 'ParameterFile', which is a human-readable
version of the input for LBLRTM (called TAPE5). It will convert that into
TAPE5 for use by LBLRTM. You should never need to call this directly!
This file is part of the TelFit program.
TelFit is free software: yo... |
# -*- coding: utf-8 -*-
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
from django.template.defaultfilters import stringfilter
from cms_content.settings import *
from pygments import highlight
from pygments.lex... |
from .utils import TemplateTestCase, Mock
class BlockTagTest(TemplateTestCase):
def test_block_parse(self):
self.assertRendered('{% block name %}%{% endblock %}', '%')
class ForTagTest(TemplateTestCase):
def test_simple_for(self):
self.assertRendered(
'{% for _in=seq %}{{ item }... |
# pylint: disable=no-member, invalid-name, redefined-outer-name
# pylint: disable=too-many-lines
from collections import namedtuple
import os
from urllib.parse import urlunsplit
import numpy as np
from numpy import ma
import pymc3 as pm
import pytest
from arviz import (
concat,
convert_to_inferen... |
import io
import os
import random
import signal
import sys
import time
import pytest
from pathlib import Path
from xopen import xopen, PipedCompressionWriter, PipedGzipReader, \
PipedGzipWriter, _MAX_PIPE_SIZE, _can_read_concatenated_gz
extensions = ["", ".gz", ".bz2"]
try:
import lzma
extensions.append(... |
"""
Vision-specific analysis functions.
$Id: featureresponses.py 7714 2008-01-24 16:42:21Z antolikjan $
"""
__version__='$Revision: 7714 $'
from math import fmod,floor,pi,sin,cos,sqrt
import numpy
from numpy.oldnumeric import Float
from numpy import zeros, array, size, empty, object_
#import scipy
try:
import p... |
import base64
import email.utils
import os
import smtplib
import time
import zlib
from Crypto import Random
from Crypto.Cipher import Blowfish
from Crypto.Hash import SHA
from email.mime.text import MIMEText
from flask import Flask, render_template, request, redirect, url_for
from threading import Thread
# BEGIN CHANG... |
import os
import urllib2
from StringIO import StringIO
from nose.tools import assert_raises, assert_equals
from nose import SkipTest
from webassets import Bundle
from webassets.exceptions import BundleError, BuildError
from webassets.filter import Filter
from webassets.updater import TimestampUpdater, BaseUpdater, SK... |
from collections import defaultdict
from itertools import count
import mmap
class Vocab:
def __init__(self, w2i=None):
if w2i is None: w2i = defaultdict(count(0).next)
self.w2i = dict(w2i)
self.i2w = {i:w for w,i in w2i.iteritems()}
@classmethod
def from_corpus(cls, corpus):
... |
"""
Projection and related classes.
"""
import numpy
from numpy import array,asarray,ones,sometrue, logical_and, logical_or
import param
from param.parameterized import overridable_property
from imagen.views import SheetView
from imagen.odict import OrderedDict
from topo.misc.attrdict import AttrDict
from sheet im... |
# -*- coding: utf-8 -*-
import os
import urlparse
import posixpath
import re
import shutil
import urllib2
from functools import wraps
from sqlite3 import dbapi2 as sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash, _app_ctx_stack, jsonify
from flask.ext.log... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import logging
import threading
import time
import vobject
import uuid
import tempfile
from collections import namedtuple
from datetime import datetime
from six import PY3
from nose.tools import assert_equal, assert_not_equal, assert_raises
from nose.plugins.skip import ... |
#!/usr/bin/env python
'''Test that character and paragraph-level style is adhered to correctly in
incremental layout.
Examine and type over the text in the window that appears. The window
contents can be scrolled with the mouse wheel. There are no formatting
commands, however formatting should be preserved as expec... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.util import Log
from echomesh.util.thread.LockedList import LockedList
from echomesh.util.thread import Openable
LOGGER = Log.logger(__name__)
class Closer(Openable.Openable):
def __init__(self):
super(Closer, self... |
"""
A general-purpose Simulation class for discrete events.
The Simulation object is the central object of a simulation. It
handles the simulation clock time and maintains communication between
the components of the simulation.
A simulation is structured as a directed graph of event-processing
nodes called EventPr... |
#!/usr/bin/python
"""
A simple example script to automatically submit a job to the ModLoop server
then wait for the results. It uses the REST interface automatically set up
by the web server framework.
"""
from __future__ import print_function
rest_url = 'http://salilab.org/modloop/job'
import urllib2
import sys
fr... |
# coding: utf-8
from __future__ import unicode_literals
import unittest
import tempfile
import shutil
from flask import Flask
from pitools import camera
app = Flask(__name__)
app.register_blueprint(camera.blueprint)
class CameraTestCase(unittest.TestCase):
def setUp(self):
self.workspace = tempfile.mkd... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import unittest
import re
from cStringIO import StringIO
import zipfile
from time import sleep
import uuid
from mock import patch, ANY
import gnupg
from flask import session, g, escape
from flask_wtf import CsrfProtect
from bs4 impor... |
"""
Simple functions operating on a matrix, potentially modifying it.
These are useful for neuron output functions, normalization of
matrices, etc.
All of these function objects (callable objects) should work for
Numpy array arguments of arbitrary shape. Some may also work for
scalars.
$Id$
"""
__version__='$Revisi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from unittest.mock import Mock
from tinyrpc.exc import RPCError
from tinyrpc.client import RPCClient, RPCProxy
from tinyrpc.protocols import RPCProtocol, RPCResponse, RPCErrorResponse, RPCRequest
from tinyrpc.transports import ClientTransport
@pytest.fixtu... |
__author__ = 'kevin'
import unittest
from attack_surface.stack import Stack
from attack_surface.call import Call
from attack_surface.call_graph import CallGraph
class StackTestCase(unittest.TestCase):
def test_push(self):
# Arrange
test_stack = Stack()
# Act
test_stack.push(1)
... |
"""
Basic SparseCFProjection with associated sparse CFs and output,
response, and learning function. If sparse component cannot be imported,
SparseCFProjection will fall back to a basic dense CFProjection.
CFSOF and CFSLF Plugin function allow any single CF output function to
be applied to the sparse CFs, but may suff... |
#!/usr/bin/python
"""Underdark Web Framework -- uWeb"""
__author__ = 'Elmer de Looff <elmer@underdark.nl>'
__version__ = '0.14'
# Standard modules
import htmlentitydefs
import os
import re
import sys
import warnings
# Underdark package module
#
# If the underdark package is not directly available, add the 'ud_lib'
... |
from unittest import TestCase
from stats.client.client import Client
from stats.client.query_parameter_generator import Season, Team
class TestClient(TestCase):
def test_players_for_season(self):
Client.get_players_for_season(season=Season.season_2015)
def test_games_for_team(self):
Client.g... |
import argparse
import logging
import os
import subprocess
import sys
import tempfile
import yaml
import beanstalkc
from teuthology import safepath
log = logging.getLogger(__name__)
teuthology_git_upstream = "https://github.com/ceph/teuthology.git"
def connect(ctx):
host = ctx.teuthology_config['queue_host']
... |
from totalimpact import default_settings
import os, logging, sys
import analytics
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_debugtoolbar import DebugToolbarExtension
# see http://wiki.pylonshq.com/display/pylonscookbook/Alternative+logging+configuration
logging.basicConfig(
stream=... |
"""
from PROJECT.settings import ProjectSettings
>>> class ConcreteProgram(Program):
... pass
>>> @ConcreteProgram.command
... def test(*args, **options):
... print 'command', args
>>> @test.subcommand('subcommand')
... def sub_command(*args, **options):
... print 'named subcommand'
>>> ConcreteProgram([... |
import json
from functools import partial
from nose.tools import ok_, eq_, nottest
from solnado import SolrClient
from tornado import gen
from tornado.testing import AsyncTestCase, gen_test
class ClientTestCase(AsyncTestCase):
def setUp(self):
super(ClientTestCase, self).setUp()
self.client = Solr... |
import argparse
import copy
import errno
import itertools
import logging
import os
import re
# this file is responsible for submitting tests into the queue
# by generating combinations of facets found in
# https://github.com/ceph/ceph-qa-suite.git
import subprocess
import sys
import time
import yaml
from teuthology ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2006 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2005-2006 Christian Boos <cboos@neuf.fr>
# All rights reserved.
#
# This software is licensed as described in th... |
# SSSD Providers
#
# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# li... |
import exptools
import sys
from hilbert import hilbert_plot, hilbert_to_image
import rpy2.robjects as robjects
exptools.ensureSoftwareVersion('pyvenn','tip')
import pyvenn
import re
from sequence_logos import plot_sequences
from pwmlocationplotter import PWMLocationPlotter
_r_loaded = False
def load_r():
global _r... |
import json
import unittest
import httpretty
from morfeu.tsuru.client import TsuruClient, TsuruClientUrls
class MorfeuTsuruClientTestCase(unittest.TestCase):
def setUp(self):
self.tsuru_client = TsuruClient()
def tearDown(self):
self.tsuru_client = None
# ## LIST APPS ## #
@httpret... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... |
"""
Modules that get shown to the users when an error has occurred while
loading or rendering other modules
"""
import hashlib
import logging
import json
import sys
from lxml import etree
from xmodule.x_module import XModule, XModuleDescriptor
from xmodule.errortracker import exc_info_to_str
from xblock.fields import... |
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
from __future__ import absolute_import;
import os;
from time import time;
im... |
"""
test_client
----------------------------------
Tests for `alpenhorn.clien` module.
"""
import pytest
from click.testing import CliRunner
import os
import re
from io import StringIO
from mock import patch, call
# TODO: use Pytest's directory used for tmpdir/basedir, not '/tmp'
os.environ['ALPENHORN_LOG_FILE'] = ... |
# --coding: UTF-8 --
import csv
from django.contrib import admin
from django.utils.encoding import smart_str, smart_unicode
from django.http import HttpResponse
from models import Guest, Event, GuestType, Registration
from views import send_registration_email
admin.site.register(GuestType)
def resend_invoice_email(m... |
import numpy as np
import datetime
class RangesIterator(object):
def __init__(self,ranges,parameters=None):
# Check if ranges is just a single range, and if so make it a list
if isinstance(ranges,dict):
ranges = [ranges]
self.ranges = ranges
self.p = parameters
def ranges_expand(self,level=0,iteration=t... |
from __future__ import absolute_import, unicode_literals
import datetime
from decimal import Decimal, InvalidOperation
from itertools import groupby
import json
import numpy
from operator import itemgetter
import re
from dash.utils import datetime_to_ms
from django.db.models import Count, F
from django.core.urlresol... |
"""
Copyright 2011 Ryan Fobel
This file is part of dmf_control_board.
dmf_control_board 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.
dm... |
from __future__ import unicode_literals
import json
import pytest
import requests_mock
from fb_messenger.fb_messenger.client import FBMessenger, Response
from fb_messenger.fb_messenger.types import action_types
from fb_messenger.fb_messenger import exceptions
from . import data
def test_send_action():
with reques... |
import time, types
from TftpShared import *
from TftpPacketFactory import *
from TftpStates import TftpContextClientDownload
class TftpClient(TftpSession):
"""This class is an implementation of a tftp client. Once instantiated, a
download can be initiated via the download() method."""
def __init__(self, ho... |
#!/usr/bin/python
# Copyright (C) 2003-2004 Robey Pointer <robey@lag.net>
#
# This file is part of paramiko.
#
# Paramiko 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 2.1 of the Licen... |
from __future__ import absolute_import, unicode_literals
from collections import Counter, defaultdict, OrderedDict
from decimal import Decimal, InvalidOperation
import operator
from dateutil.relativedelta import relativedelta
from enum import Enum
import pytz
from django.conf import settings
from django.core.cache i... |
from fragment import Fragment
import xyz_operations
import file_templates
|
import datetime
import decimal
import ipaddress
import math
import random
import uuid
import asyncpg
from asyncpg import _testbase as tb
def _timezone(offset):
minutes = offset // 60
return datetime.timezone(datetime.timedelta(minutes=minutes))
infinity_datetime = datetime.datetime(
datetime.MAXYEAR, 1... |
"""Configuration Helpers for TurboGears 2"""
import atexit
import os
import logging
from copy import copy
from UserDict import DictMixin
from pylons.i18n import ugettext
from genshi.filters import Translator
from pylons import config as pylons_config
from beaker.middleware import SessionMiddleware, CacheMiddleware
fro... |
from __future__ import absolute_import, unicode_literals
from collections import Counter
from itertools import chain, groupby
import json
from operator import itemgetter
import pytz
from django.conf import settings
from django.db import models, transaction
from django.db.models import Count, Q
from django.utils impo... |
from allgo_utils import PCA9685,ultrasonic,ir_sens
import wiringpi as wp
import time
DIR_DISTANCE_ALERT = 20
preMillis = 0
ULTRASONIC_TRIG = 3 # TRIG port is to use as output signal
ULTRASONIC_ECHO = 23 # ECHO port is to use as input signal
OUT = {'front_left_led':5,
'front_right_led':0,
'rear_right_le... |
from pydigree.common import product, cumsum
from pydigree.common import runs, runs_gte
from pydigree.cyfuncs import runs_gte_uint8
import numpy as np
def test_product():
assert product([1,2,3,4,5]) == 120
assert product([0,1,2,3,4]) == 0
def test_cumsums():
assert cumsum([]) == []
assert cumsum([1,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from lxml import etree
from utils import str_to_timedelta
from db import create_or_update_db_item
from db.team import Team
from db.shift import Shift
logger = logging.getLogger(__name__)
class ShiftParser():
# partial xpath expression used for per ... |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... |
from keras.layers import Dense, Flatten, Input, BatchNormalization
from keras.models import Sequential, model_from_json, load_model, Model
from keras.layers import Conv2D, MaxPooling2D, Dropout
from keras.optimizers import RMSprop
from keras.initializers import Constant
from keras import optimizers
from keras.applicati... |
from collections import defaultdict
class Abort(Exception):
""" raise this when aborting an action. Must be raised during the pre-action hook call """
pass
class List(list):
""" A list that can call pre- and post- hook functions for the add, remove, and replace
operations. If the Abort exception is r... |
#
# Copyright 2015-2016 Red Hat, Inc.
#
# 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 Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distr... |
#! /usr/bin/env python
# $Id$
"""Gnuplot.py -- A pipe-based interface to the gnuplot plotting program.
Copyright (C) 1998,1999 Michael Haggerty
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; eithe... |
import collections
class Abort(Exception):
""" raise this when aborting an action. Must be raised during the pre-action hook call """
pass
class List(list):
""" A list that can call pre- and post- hook functions for the add, remove, and replace
operations. If the Abort exception is raised in any pre-... |
import atexit
import logging
import os
import pathlib
import pickle
import random
import time
import typeguard
import inspect
import threading
import sys
import datetime
from getpass import getuser
from typing import Any, Dict, List, Optional, Sequence
from uuid import uuid4
from socket import gethostname
from concurre... |
# -*- coding: utf-8 -*-
def hostname():
# Import standard modules ...
import socket
# Get (potentially fully-qualified) hostname and return the first part ...
return socket.gethostname().split(".")[0]
|
'''
DataFlowKernel
==============
The DataFlowKernel adds dependency awareness to an existing executor.
It is responsible for managing futures, such that when dependencies are resolved, pending tasks
move to the runnable state.
Here's a simplified diagram of what happens internally::
User | DF... |
#!/usr/bin/python
import os
"""
Configuration file for the socket server; contains information about location of database, Host, Port, and etc.
Settings are contained in a dictionary named 'settings', currently holding the following information:
- Fileconfig
- filename
- Host
- Port
Example:
An ... |
"""
TorCtl is a python Tor controller with extensions to support path
building and various constraints on node and path selection, as well as
statistics gathering.
Apps can hook into the TorCtl package at whatever level they wish.
The lowest level of interaction is to use the TorCtl module
(TorCtl/TorCtl.py). Typica... |
# -*- coding: utf-8 -*-
# Copyright 2009-2016, Simon Kennedy, sffjunkie+code@gmail.com
"""The :mod:`astral` module provides the means to calculate dawn, sunrise,
solar noon, sunset, dusk and rahukaalam times, plus solar azimuth and
elevation, for specific locations or at a specific latitude/longitude. It can
a... |
import hashlib
import importlib.util
from itertools import chain
import logging
import os
import pickle
import subprocess
import sys
from glob import glob
import pytest
import parsl
from parsl.tests.util import get_rundir
logger = logging.getLogger('parsl')
def pytest_addoption(parser):
"""Add parsl-specific c... |
import sys
from textwrap import dedent
import py
import pytest
import tox
import tox._config
from tox._config import * # noqa
from tox._config import _split_env
class TestVenvConfig:
def test_config_parsing_minimal(self, tmpdir, newconfig):
config = newconfig([], """
[testenv:py1]
""... |
# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
#
# 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 la... |
# -*- coding: utf-8 -*-
# Copyright 2009-2017, Simon Kennedy, sffjunkie+code@gmail.com
# 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... |
from __future__ import unicode_literals
from concurrent.futures import ThreadPoolExecutor
from hiku import query
from hiku.graph import Graph, Edge, Field, Link, Option, Root, Many
from hiku.types import Record, Sequence, Integer, Optional
from hiku.engine import Engine
from hiku.readers.simple import read
from hiku.... |
import exptools
from ordereddict import OrderedDict
import pydataframe
import sys
from hilbert import hilbert_plot, hilbert_to_image
import rpy2.robjects as robjects
exptools.load_software('pyvenn')
import pyvenn
from square_euler import SquareEuler
import re
from sequence_logos import plot_sequences, plot_sequence_ali... |
"""
Unit tests for data fields
"""
import unittest
from cellardoor.model import *
from datetime import datetime
import time
class TestAbstractField(unittest.TestCase):
def test_field_abstract(self):
"""
Shouldn't be able to use base Field as a field
"""
field = Field()
... |
from beauty import *
#### Parameters I chose arbitrarily
USE_TEX = True # whether or not to render *all* text w/latex
USE_SERIFS = False # serif vs san-serif font (computer modern)
LEGEND_FONT_SIZE = TICK_FONT_SIZE = 9
TITLE_FONT_SIZE = LABEL_FONT_SIZE = 10.5
DPI = 150 # Font size adjustments should scale with ... |
#!/usr/bin/env python
# coding: utf-8
# References:
# man curl
# https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
# https://curl.haxx.se/libcurl/c/easy_getinfo_options.html
# http://blog.kenweiner.com/2014/11/http-request-timings-with-curl.html
from __future__ import print_function
import os
import json
import s... |
class Solution(object):
def strsort(self, s):
cnt=[0]*26
res=''
for ch in s:
cnt[ord(ch)-ord('a')]+=1
for i in xrange(26):
res+=str(ord('a')+i)*cnt[i]
return res
def groupAnagrams(self, strs):
"""
:type strs: List[str]
... |
import struct
import image_utils
import png
from PIL import Image
import os
from io import BytesIO
#---------------------CONSTANTS-----------------------------------------------#
ICNS_TABLE_OF_CONTENTS = 0x544F4320 # "TOC "
ICNS_ICON_VERSION = 0x69636E56 # "icnV"
ICNS_1024x1024_32BIT_ARGB_DATA = 0x69633130 # "ic... |
from __future__ import print_function
import inspect
import os
import subprocess
import sys
from fnmatch import fnmatchcase
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
from itertools import izip_longest
except ImportError:
from itertools import zip_longest as izi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.