text stringlengths 12 6.59M |
|---|
#!/usr/bin/env python
"""
Copyright (c) 2011, Scott Burns
All rights reserved.
"""
from .spm import SPM
from .config import Configurator
__version__ = "0.0"
|
import threading
import time
_timers = {}
class DiscreteEventEmitter():
def __init__(self, interval, period_length, group, callback, start_immediate=False):
self.interval = float(interval)
self.period_length = period_length
self.group = group
self.intervals = self.period_length / ... |
import pentai.base.board_strip as bs_m
import length_lookup_table as llt_m
from pentai.base.defines import *
# TODO: move this to test code?
def pass_through_func(a, ignored):
""" This is just a stub, shouldn't be called in production code. """
return (a, 0)
class UtilityStats(object):
def __init__(self,... |
from sqlalchemy import (
Column,
Integer,
DateTime,
Boolean,
Text,
String,
Unicode,
ForeignKey,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relation,
backref,
)
import pyramid.threadlocal
import p... |
from calendar import timegm
from datetime import timedelta
import qrcode
from django.core.files import File
from django.http import Http404, HttpResponse, HttpResponseNotModified
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.utils import timezone
from djan... |
#!/usr/bin/env python
# dtimg2dtb
# Copyright 2015 wuxianlin
#
# 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 applicabl... |
__author__ = 'nlw'
import logging
import re
from dipper.utils.GraphUtils import GraphUtils
from dipper import curie_map
from dipper.models.GenomicFeature import Feature, makeChromID, makeChromLabel
logger = logging.getLogger(__name__)
class Genotype():
"""
These methods provide convenient methods to add i... |
from __future__ import division, print_function, absolute_import
from nose.plugins.attrib import attr
import numpy as np
from numpy.random import RandomState
from ..core import (binom_conf_interval,
corr,
permute_within_groups,
permute_rows,
... |
#!/usr/bin/env
import argparse
import subprocess
import numpy as np
from astropy.io import fits
import os.path
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
from matplotlib.ticker import MultipleLocator
from matplotlib.ticker import ScalarFormatter
import tools
import get_lags as lags... |
import logging
import csv
import re
from datetime import datetime
import stat
import os
import pysftp
from dipper.sources.Source import Source
from dipper.models.assoc.Association import Assoc
from dipper.models.Dataset import Dataset
from dipper import config
from dipper.utils.GraphUtils import GraphUtils
from dippe... |
import os
import glob
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
def load_Neah_Bay(datadir):
"""
Function to load the Neah Bay tidal station data from 2015 - 2016
and returns a dataframe and a Datetime Index object
Datadir is the directory path to where ... |
#
# Copyright 2019 Mikko Korpela
#
# 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... |
#!/usr/bin/env python
"""This displays uptime information using uptime.
A bit redundant perhaps, but it demonstrates expecting for a
regular expression that uses subgroups.
"""
import pexpect
import re
# Different styles of uptime results.
#
# [x86] Linux 2.4 (Redhat 7.3)
# 2:06pm up 63 days, 18 min, 3 users, loa... |
import logging
import csv
import pysftp
import re
import unicodedata
from dipper.sources.Source import Source
from dipper.models.Assoc import Assoc
from dipper.models.Dataset import Dataset
from dipper import config
from dipper.utils.GraphUtils import GraphUtils
from dipper import curie_map
from dipper.models.Genotype... |
#!/usr/bin/python
import sys
import ovirtsdk.api
import time
import datetime
import re
from ovirtsdk.xml import params
import ConfigParser
import os
scriptdir = os.path.abspath(os.path.dirname(sys.argv[0]))
conffile = scriptdir + "/ovirt-vm-hot-backup.conf"
Config = ConfigParser.ConfigParser()
if not os.path.isfil... |
import io
import psycopg2
from psycopg2 import sql
import sys
import json
import datetime
import decimal
import time
import base64
import os
from distutils.sysconfig import get_python_lib
class pg_encoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.time) or \
isinstance(obj, datetim... |
import tarfile
import re
import logging
from dipper.sources.Source import Source
from dipper.models.assoc.OrthologyAssoc import OrthologyAssoc
from dipper.models.Dataset import Dataset
from dipper.utils.GraphUtils import GraphUtils
from dipper import config, curie_map
__author__ = 'nicole'
logger = logging.getLogger... |
#!/usr/bin/env python3.4
# -*- coding: utf8 -*-
import re
import unicodedata
import csv
import oxy.usual as oxyu
def count_field(valIni, valStep, fieldBreak):
''' Closure to "count" function variable '''
ini = int(valIni)
step = int(valStep)
breakVal = None
def inner_func(dictRow):
nonl... |
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on May 14, 2012
@author: Jeffrey Portman
@contact: chromox@gmail.com
@summary: <summary>
'''
import os
impor... |
"""Level.py: contains the Level class"""
import DirectNotifyGlobal
import string
import LevelConstants
from PythonUtil import lineInfo, uniqueElements
import types
"""
Any data that can be edited by a level editor must be represented as
an attribute of an entity owned by the level, in order to keep the
level-editing ... |
import django.forms as forms
from src.photos.models import Photo
from src.photos.cs import palette
from src.settings import IMAGE_SIZE_BOUNDS, MEDIA_ROOT
from custom_widgets import *
from PIL import Image
class PhotoAddForm( forms.ModelForm ):
def save(self, force_insert=False, force_update=False, commit=True):
... |
"""Operations regarding miscellaneous files."""
from __future__ import absolute_import, division, print_function
from contextlib import contextmanager
import logging
from pathlib2 import Path
import re
import shutil
import tempfile
import zipfile
import numpy as np
import dwi.asciifile
import dwi.dicomfile
import dw... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: messages.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... |
#! /usr/bin/env python
usageText = """
This command will pack a Panda application, consisting of a directory
tree of .py files and models, into a p3d file for convenient
distribution. The resulting p3d file can be run by the Panda3D
runtime executable, or by the Panda3D web browser plugin.
This command will build p... |
# Copyright (c) 2015 Intel Corporation
#
# 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 ... |
"""Image as an np.ndarray subclass."""
# Subclassing: https://docs.scipy.org/doc/numpy/user/basics.subclassing.html
# Masked array: https://docs.scipy.org/doc/numpy/reference/maskedarray.html
from __future__ import absolute_import, division, print_function
import numpy as np
import dwi.files
from dwi.files import P... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import cv2
import re
import numpy as np
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
reload(sys)
sys.setdefaultencoding('utf-8')
boundaries = [
# Yellow
#([17, 100, 100], [50, 200, 200]),
# RED
([17, 15, 100]... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
image_resizer.py - a script that reduces the size of non-free images
usage:
python pwb.py image_resizer
"""
#
# (C) w:fa:User:Huji, 2021
#
# Distributed under the terms of the MIT license.
#
import io
import os
import math
from PIL import Image
import pywikibot
fro... |
#!/usr/bin/env python
"""Specialized version of RO.Wdg.LogWdg that adds nice filtering and text highlighting.
Known Issues:
- This log may hold more data than logSource (because it truncates excess data separately from logSource),
but that extra data is fragile: you will instantly lose it if you change the filter.
-... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import platform
import re
import llnl.util.tty as tty
from spack import *
# - vanilla CentOS 7, and possibly ot... |
# -*- coding: utf-8 -*-
# Copyright © 2012-2014 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... |
from som.compiler.method_generation_context import MethodGenerationContextBase
from som.interpreter.ast.frame import FRAME_AND_INNER_RCVR_IDX
from som.interpreter.bc.bytecodes import (
bytecode_stack_effect,
bytecode_stack_effect_depends_on_send,
bytecode_length,
Bytecodes,
)
from som.vmobjects.primitiv... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions for performing aperture photometry on 2-D arrays."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import math
import abc
import numpy as np
import warnings
from astropy.table imp... |
"""
Internal hook annotation, representation and calling machinery.
"""
import inspect
import sys
import warnings
from .callers import _legacymulticall, _multicall
if sys.version_info[0] >= 3:
from inspect import signature, Parameter
else:
from funcsigs import signature, Parameter
class HookspecMarker(object... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
from datetime import datetime, date
from django.db import transaction
from django.shortcuts import get_object_or_404
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from re... |
#!/usr/bin/env python
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A top level harness to run all unit-tests in a specific engine build.
"""
import sys
import os
import argparse
import glob
import s... |
from codecs import getdecoder
import cgi
from datetime import datetime
from fnmatch import fnmatchcase
from heapq import merge
from itertools import chain, compress, groupby, izip_longest
import json
from operator import itemgetter
import os
from os import stat
from os.path import dirname
import shutil
import subproces... |
# -*- coding: utf-8 -*-
"""
@author: andresberejnoi
"""
#TODO: During training, if the network gets stuck in a local minima for several epochs,
# then randomly modify certain weights in the matrix. This might allow the network to get out
# of that minima and converge
import numpy as np
#import tools # thi... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Xz(AutotoolsPackage, SourceforgePackage):
"""XZ Utils is free general-purpose data compres... |
import argparse
import json
from collections import Counter
from amcatclient import amcatclient
from nlpipe.client import get_client
import logging
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("amcatserver", help="AmCAT Server hostname")
parser.add_argument("project", ... |
#!/usr/bin/env python2.7
from __future__ import with_statement
import os, sys
import struct
import pprint; pp = pprint.pprint
import glob
import array
import ctypes
import time, datetime, calendar
from funcs import *
from filetools import *
import trecformat
# =========================================================... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
from datetime import datetime, date
from django.db import transaction
from django.shortcuts import get_object_or_404
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from re... |
import os, sys
from urlparse import urlparse
from csv import DictReader, Sniffer
from StringIO import StringIO
from requests import get
from app import db, Project, Organization
gdocs_url = 'https://docs.google.com/a/codeforamerica.org/spreadsheet/ccc?key=0ArHmv-6U1drqdGNCLWV5Q0d5YmllUzE5WGlUY3hhT2c&output=csv'
if '... |
import os
import sys
from unittest import mock
import pytest
from _pytest.main import ExitCode
from _pytest.mark import EMPTY_PARAMETERSET_OPTION
from _pytest.mark import MarkGenerator as Mark
from _pytest.nodes import Collector
from _pytest.nodes import Node
class TestMark:
@pytest.mark.parametrize("attr", ["ma... |
# -*- coding: utf-8 -*-
"""Tools for inspecting Python objects.
Uses syntax highlighting for presenting the various information elements.
Similar in spirit to the inspect module, but all calls take a name argument to
reference the name under which an object is being read.
"""
# Copyright (c) IPython Development Team... |
import errno
import json
import logging
import platform
from pprint import pformat
from urlparse import urlparse
import obelisk
import zmq
from zmq.error import ZMQError
from zmq.eventloop import ioloop, zmqstream
import constants
from crypto_util import Cryptor
from guid import GUIDMixin
import network_util
class ... |
import os
from tempfile import mkstemp, mkdtemp
from shutil import rmtree
from zipfile import ZipFile
from datetime import datetime
from boto.s3.connection import S3Connection
from boto.s3.key import Key
class ZipBackup(object):
def __init__(self, name):
self.name = name
_, self._path = mkstemp()
... |
class Error(Exception):
def __init__(self, node, msg):
self.node = node
self.msg = msg
def show(self, fn):
if self.node.pos is None:
return '%s: %s\n' % (fn, self.msg)
pos = self.node.pos
a = '%s [%s.%s]: %s' % (fn, pos[0][0] + 1, pos[0][1] + 1, self.msg)
b = pos[2].replace('\t', ' ' * 4).rs... |
#
# 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 may not... |
import os
import sys
import pytest
from pipsi import Repo, find_scripts
@pytest.fixture(params=['normal', 'MixedCase'])
def mix(request):
return request.param
@pytest.fixture
def bin(tmpdir, mix):
return tmpdir.ensure(mix, 'bin', dir=1)
@pytest.fixture
def home(tmpdir, mix):
return tmpdir.ensure(mix, ... |
import types, re
class easy_mock(object):
locked = False
def __init__(self, name):
self.name = name
def __getattr__(self, attr):
if easy_mock.locked:
raise Exception('Attribute "%s" of "%s" used and not defined before lock.' % (attr, self.name))
e_mock = easy_mock(attr)... |
# -*- coding: utf-8 -*-
"""Tools for inspecting Python objects.
Uses syntax highlighting for presenting the various information elements.
Similar in spirit to the inspect module, but all calls take a name argument to
reference the name under which an object is being read.
"""
# Copyright (c) IPython Development Team... |
from django.test import TestCase
from wagtail.tests.models import SimplePage, EventPage
from wagtail.tests.utils import login, unittest
from wagtail.wagtailcore.models import Page, PageRevision
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Permission
from django.core import m... |
#
# 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 may not... |
#!/usr/bin/python
# EasyScope
# This script will take an IP address range or a list of addresses/ranges and either
# expand them into single IPs or combine them into a supernet.
#
# This script requires the netaddr library, use: "python -m pip install netaddr"
#
# This program is free software: you can redistribute it... |
# coding: utf-8
"""
Inputhook management for GUI event loop integration.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2009 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distribu... |
from collections import namedtuple
from django.db import models
from instachart.models import SimpleChart
from .base import APP_LABEL
"""
field names are slugified().replace('-', '_') versions of the labels given
in the IPEDS source
"""
__all__ = ['PriceTrends', 'TestScores', 'Admissions',
'Enrollment', 'Graduati... |
#!./env/bin/python
"""
OpenBazaar launcher script.
Authors: Angel "gubatron" Leon
"""
import argparse
import multiprocessing
import os
import sys
import threading
import psutil
import network_util
from openbazaar_daemon import node_starter, OpenBazaarContext
import setup_db
def arg_to_key(arg):
"""
Convert... |
"""Generic testing tools.
Authors
-------
- Fernando Perez <Fernando.Perez@berkeley.edu>
"""
from __future__ import absolute_import
#-----------------------------------------------------------------------------
# Copyright (C) 2009-2011 The IPython Development Team
#
# Distributed under the terms of the BSD Licen... |
#!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... |
from twisted.internet import reactor
from twisted.plugin import IPlugin
from twisted.python import log
from txircd.module_interface import IModuleData
from txircd.user import LocalUser
from txircd.utils import isValidNick, ircLower
from zope.interface import implements
import re
from dbservice import DBService
def g... |
#!/usr/bin/env python3
import argparse
import subprocess
import os
import shutil
import sys
import re
args = None
def sh(command):
subprocess.call(command, shell=True)
def parseargs():
parser = argparse.ArgumentParser(description="Creates all necessary artifacts for a davix release.\n")
parser.add_argume... |
"""serialization utilities for apply messages
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as p... |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
from twisted.enterprise import adbapi
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from txircd.modbase import Command
from txircd.utils import chunk_message, crypt, irc_lower, now, CaseInsensitiveDictionary
from base64 import b64decode, b64encode
from Crypto.Random.random import getr... |
from opencivicdata.api.client import SunlightOCDAPI
api = VagrantOCDAPI()
people = api.people()
while people.has_next():
for person in people:
print(person['name'])
people = people.next()
|
import tempfile
from collections import namedtuple
from math import isclose
from pathlib import Path
from typing import List
import SimpleITK
import numpy as np
import pydicom
from grandchallenge.cases.image_builders import ImageBuilderResult
from grandchallenge.cases.image_builders.utils import convert_itk_to_intern... |
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
import os
from nolearn import cache
import numpy as np
from sklearn.base import BaseEstimator
def _transform_cache_key(self, X):
if len(X) == 1:
raise cache.DontCache
return ','.join([
str(X),
str(len(X)),
str(sorted(self.get_params().items())),
])
class ConvNetFeatu... |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.config import ConfigValidationError
from txircd.module_interface import Command, ICommand, IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType, now
from zope.interface import implements
from datetime import timedel... |
from django.apps import AppConfig
from django.db.utils import OperationalError, ProgrammingError, IntegrityError
class CommonConfig(AppConfig):
name = 'common'
def ready(self):
pass
|
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import getopt
import os
import sys
import socket
import threading
target = None
port = 0
listen = False
command = False
execute = ''
upload_dest = ''
def usage():
print './mynetcat.py -t localhost -p 80 -l -c ls -u -e'
def run_command(command):
command = comm... |
# Tests for labels
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.test import TestCase
from django.conf import settings
from django.apps import apps
from django.urls import reverse
from django.core.exceptions import ValidationError
from InvenTree.helpers import validateFilterS... |
# -*- coding: utf-8 -*-
ALL_VAR = 'all'
true_words = [True, 'True', 'true', 'Yes', 'yes', 'Y', 'y']
false_words = [False, 'False', 'false', 'No', 'no', 'N', 'n']
all_words = ['All', 'all']
#TODO: not used
sort_dict = {'vote':'Vote', 'title':'Title', 'desc': 'Desc', 'init_date': 'Creation Date',
'last_mo... |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from import_export.resources import ModelResource
from import_export.fields import Field
from .models import PurchaseOrder, PurchaseOrderLineItem
from .models impor... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import importlib
import pathlib
import logging
from typing import OrderedDict
from importlib import reload
from django.apps import AppConfig, apps
from django.conf import settings
from django.db.utils import OperationalError, ProgrammingError
from django.... |
#J750DatalogBinSummary.py
#Creator: Dennis Lin
#Notice:
#It's just a handy small tool for personal use on datalog convert
#It might occupy huge memory due to its "not so good" algorithm
#Just keep it in mind and be careful with it...
#How to execute this code:
#See the options -> c:\folder_name>python J750Datalo... |
#!/usr/bin/env python
# coding: utf-8
# Copyright (C) Vladimir M. Zaytsev <zaytsev@usc.edu>
# Author: Vladimir M. Zaytsev <zaytsev@usc.edu>
# URL: <http://zvm.me/>
# For more information, see README.md
# For license information, see LICENSE
import gc
import logging
import numpy as np
import cPickle as pickle
from n7... |
# vim: et ts=4 :
import logging
import psycopg2
import psycopg2.extras
class Nap:
""" Network Address Planner
"""
_logger = None
_con_pg = None
_curs_pg = None
def __init__(self):
""" Constructor.
Creates database connections n' stuff, yo.
"""
self._logg... |
# vim: et ts=4 :
import logging
import psycopg2
import psycopg2.extras
import socket
class Inet(object):
""" This works around a bug in psycopg2 version somewhere before 2.4.
The __init__ function in the original class is broken and so this is merely a copy with the bug fixed.
Wrap a string to a... |
# vim: et ts=4 :
import logging
import psycopg2
import psycopg2.extras
class Nap:
""" Network Address Planner
"""
_logger = None
_con_pg = None
_curs_pg = None
def __init__(self):
""" Constructor.
Creates database connections n' stuff, yo.
"""
self._logg... |
# Copyright 2004 Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
import logging
import sys
from typing import List
import warnings
import weakref
import dask
from .spec import SpecCluster, ProcessInterface
from ..utils import cli_keywords
from ..scheduler import Scheduler as _Scheduler
from ..worker import Worker as _Worker
from ..utils import serialize_for_cli
logger = logging.g... |
#!/usr/bin/python
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
"""
Copyright 2016 Parham Pourdavood
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, softw... |
import re
import sys
import argparse
wheelV = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
wheelVI = ['a', 'c', 'e', 'd', 'f', 'h', 'g', 'i', 'k', 'j', 'l', 'n', 'm', 'o', 'q', 'p', 'r', 't', 's', 'u', 'w', 'v', 'x', 'z', 'y', 'b']
w... |
# bootstrap
import os
plugin_path = os.path.dirname(__file__)
if not os.path.exists(os.path.join(plugin_path, 'coverage')):
# Fetch coverage.py
print 'SublimePythonCoverage installing coverage.py.'
from StringIO import StringIO
import tarfile
import urllib
from hashlib import md5
SOURCE = ... |
from django.contrib import admin
from .models import PlaceType, Source, City, Place
class PlaceAdmin(admin.ModelAdmin):
list_display = ('__unicode__','placetype','description')
list_editable = ('placetype',)
admin.site.register(PlaceType)
admin.site.register(Source)
admin.site.register(City)
admin.site.register(... |
"Specialized Context and ModPythonRequest classes for Django. Use these!"
from django.core.template import Context
from django.utils.httpwrappers import ModPythonRequest
from django.conf.settings import DEBUG, INTERNAL_IPS
from pprint import pformat
class DjangoContext(Context):
"""
This subclass of template.... |
"""
Move a file in the safest way possible::
>>> from django.core.files.move import file_move_safe
>>> file_move_safe("/tmp/old_file", "/tmp/new_file")
"""
import os
from django.core.files import locks
try:
from shutil import copystat
except ImportError:
import stat
def copystat(src, dst):
... |
# Django management-related functions, including "CREATE TABLE" generation and
# development-server initialization.
import django
from django.core.exceptions import ImproperlyConfigured
import os, re, shutil, sys, textwrap
from optparse import OptionParser
from django.utils import termcolors
# For Python 2.3
if not h... |
from typing import Any, Dict, List, Union
import numpy as np
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_vision_available():
from PIL import Image
from ..image_utils import load_image
if is... |
# Django management-related functions, including "CREATE TABLE" generation and
# development-server initialization.
import django
from django.core.exceptions import ImproperlyConfigured
import os, re, shutil, sys, textwrap
from optparse import OptionParser
from django.utils import termcolors
# For Python 2.3
if not h... |
import logging
from modules.loggingFunctions import initialize_logging
from modules.groupComparisons.handle_logical import handle_logical
from modules.groupComparisons.logical_queries import query_targets
from modules.groupComparisons.fishers import fishers
from modules.decorators import tofromHumanReadable
# logging
... |
from django.contrib.auth.models import User #to get auth_user table
from .models import user as csv2_user
'''
UTILITY FUNCTIONS
'''
#-------------------------------------------------------------------------------
def db_close(db_ctl, commit=False):
"""
Commit or rollback and then close the database connectio... |
# Django management-related functions, including "CREATE TABLE" generation and
# development-server initialization.
import django
from django.core.exceptions import ImproperlyConfigured
import os, re, shutil, sys, textwrap
from optparse import OptionParser
from django.utils import termcolors
# For Python 2.3
if not h... |
from uber.common import *
def generate_staff_badges(start_badge, end_badge, out, session):
assert start_badge >= c.BADGE_RANGES[c.STAFF_BADGE][0]
assert end_badge <= c.BADGE_RANGES[c.STAFF_BADGE][1]
badge_range = (start_badge, end_badge)
uber.reports.PrintedBadgeReport(
badge_type=c.STAFF_BA... |
"""
A library of validators that return None and raise ValidationError when the
provided data isn't valid.
Validators may be callable classes, and they may have an 'always_test'
attribute. If an 'always_test' attribute exists (regardless of value), the
validator will *always* be run, regardless of whether its associat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.