text stringlengths 12 6.59M |
|---|
import unittest
import numpy
import cupy
from cupy import testing
@testing.gpu
class TestSort(unittest.TestCase):
_multiprocess_can_split_ = True
# Test ranks
@testing.numpy_cupy_raises()
def test_sort_zero_dim(self, xp):
a = testing.shaped_random((), xp)
a.sort()
@testing.nu... |
from nose_parameterized import parameterized
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from subprocess import Popen
import ckan.lib.search.index as search_index
import ckan.model as model
import ckanext.privatedatasets.db as db
import json
import os
import unittest
import re
impor... |
__version__ = "0.9.8" |
from ethereum import tester, exceptions
import datetime
import struct
import json
from functools import partial
import pytest
slow = pytest.mark.slow
from utilRelay import makeMerkleProof, randomMerkleProof, \
getHeaderBytes, dblSha256Flip, disablePyethLogging
disablePyethLogging()
class TestFee(object):
C... |
# Copyright 2015 PerfKitBenchmarker 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... |
"""
This file is part of Arakoon, a distributed key-value store. Copyright
(C) 2010 Incubaid BVBA
Licensees holding a valid Incubaid license may use this file in
accordance with Incubaid's Arakoon commercial license agreement. For
more information on how to enter into this agreement, please contact
Incubaid (contact d... |
# -*- coding: utf-8 -*-
import functools
import datetime
import mock
from factory import SubFactory
from factory.fuzzy import FuzzyDateTime, FuzzyAttribute, FuzzyChoice
from mock import patch, Mock
import factory
import pytz
from factory.django import DjangoModelFactory
from django.utils import timezone
from django.d... |
"""DataStore class for WorkBench."""
import pymongo
import gridfs
import hashlib
import datetime
import bson
import time
class DataStore(object):
"""DataStore for Workbench.
Currently tied to MongoDB but making this class 'abstract' should be
straightforward and we could think about using another back... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Timothy Dozat
#
# 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 ... |
from .exceptions import KrankshaftError
from collections import namedtuple
from cStringIO import StringIO
from datetime import datetime, date, time, timedelta
from functools import partial
import decimal
import json
import mimeparse
import urlparse
# TODO: Accept: */* dumps: no method to_urlencoded
# maybe only ... |
# -*- encoding: utf-8 -*-
import datetime
import json
from django.utils.encoding import force_text
import re
import operator
import logging
try:
from functools import reduce
except ImportError:
pass
from django.views.generic.list import ListView, MultipleObjectMixin
from django.http import HttpResponse, HttpR... |
"""Tests for plugin.py."""
from ckan import model
from ckan.plugins import toolkit
from ckanext.xroad_integration.tests.xroad_mock import xroad_rest_adapter_mock as adapter_mock
import pytest
import json
import os
from multiprocessing import Process
from ckanext.xroad_integration.harvesters.xroad_harvester import XRoad... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2015, Anima Istanbul
#
# This module is part of anima-tools and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
import functools
import os
import tempfile
from anima.ui.progress_dialog import ProgressDialogManager
from anima.env.mayaEn... |
import sys
import types
import flexmock
dummy_vim = types.ModuleType('Dummy Vim Module', "Dummy")
sys.modules['vim'] = dummy_vim
import vim
vim.command = lambda x: x
import autoload.venom as venom
def test_nnoremap():
flexmock.flexmock(vim)
vim.should_receive("command").with_args("nnoremap <c-c> :py veno... |
import logging
_logger = None
CRITICAL = logging.CRITICAL
FATAL = CRITICAL
ERROR = logging.ERROR
WARNING = logging.WARNING
WARN = WARNING
INFO = logging.INFO
DEBUG = logging.DEBUG
#//---------------------------------------------------------------------------//
def _init():
logger = logging.getLogger( "AQL"... |
'''
This file is part of Arakoon, a distributed key-value store. Copyright
(C) 2010 Incubaid BVBA
Licensees holding a valid Incubaid license may use this file in
accordance with Incubaid's Arakoon commercial license agreement. For
more information on how to enter into this agreement, please contact
Incubaid (contact d... |
import asyncio
import discord
import re
import traceback
import pytz
import urllib.parse
from datetime import datetime, timedelta
# buffer for busier servers
MAX_MESSAGES = 10000
# process level client
client = discord.Client(max_messages=MAX_MESSAGES)
# bot specific settings
settings = None
# list of channels in ... |
# -*- coding: utf-8 -*-
# Tests ported from tests/test_models.py and tests/test_user.py
import os
import json
import datetime as dt
import urlparse
from django.utils import timezone
import mock
import itsdangerous
import pytest
import pytz
from framework.auth.exceptions import ExpiredTokenError, InvalidTokenError, Ch... |
from __future__ import absolute_import
from perses.utils.openeye import *
from perses.annihilation.relative import HybridTopologyFactory
from perses.rjmc.topology_proposal import PointMutationEngine
from perses.rjmc.geometry import FFAllAngleGeometryEngine
import simtk.openmm as openmm
import simtk.openmm.app as app
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import traceback
from datetime import datetime
from django.db import models
from django.db import connection
from django.db.utils import OperationalError
import django.utils.timezone as timezone
from django import db
from Kunlun_M.const import TAMPER_TY... |
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
import tensorflow.contrib.rnn as rnn
import scipy.signal
from command import Commander
from config import Config
def normalized_columns_initializer(std=1.0):
def _initializer(shape, dtype=None, partition_info=None):
out = np... |
"""
========================================================================
Hangul normalization functions defined in KS X 1026-1
========================================================================
.. moduleauthor:: Wonsup Yoon <pusnow@me.com>
Reference
============
* http://www.unicode.org/L2/L2008/08225-n3... |
"""
ViewGroup, Collector and related classes offer optional functionality
for holding and collecting DataView objects.
"""
import time, uuid
import numpy as np
from collections import OrderedDict
import param
from .sheetviews import SheetView, SheetStack, CoordinateGrid, BoundingBox
from .views import GridLayout,Stack... |
# (c) 2009-2016 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
Implement the FileLikeQueue helper class.
This helper class is intended to handle use cases where an incoming PUT
request should be direct... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
import requests
LINK_TEMPLATE = '<link rel="canonical" href="{url}">'
@pytest.mark.headless
@pytest.ma... |
from aospy.units import Units
from aospy.constants import c_p, seconds_in_day
unitless = Units(units='')
specific_mass = Units(
units='',
plot_units=r'g kg$^{-1}$',
plot_units_conv=1e3,
vert_int_plot_units='kg m$^{-2}$',
vert_int_plot_units_conv=1.
)
K = Units(units='K')
m = Units(units='m')
m2 = U... |
#!/usr/bin/env python3
import dicom
import os
import tifffile
import blessings
import datetime
import argparse
# Maps DICOM files to RAW files using timestamps
# Usage: ./map-dicom DICOM RAW
#
# Script will print out files in the target directory that contain a matching timestamp.
#
# jtorniainen
# UEF 2017, MIT Lice... |
from __future__ import print_function, absolute_import, division
"""searchspace.py
This module contains code for specifying the hyperparameter search space.
The search space is specified as a product of bounded intervals. Each dimension
can be either an integer, floating-point or enumeration.
The base measure on the ... |
from __future__ import absolute_import
from perses.utils.openeye import *
from perses.annihilation.relative import HybridTopologyFactory
from perses.rjmc.topology_proposal import PointMutationEngine
from perses.rjmc.geometry import FFAllAngleGeometryEngine
import simtk.openmm as openmm
import simtk.openmm.app as app
... |
#!/usr/bin/env python
__all__ = ['bilibili_download']
from ..common import *
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_id
from .youku import youku_download_by_id
import re
def get_srt_xml(id):
url = 'http://comment.bilibili.tv/%s.xml' % id
return get_html(url)
def parse_s... |
from familyconnect_registration.settings import * # flake8: noqa
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'TESTSEKRET'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
CELERY_ALWAYS_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Timothy Dozat
#
# 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 ... |
"""
NdIndexableMapping and NdMapping objects.
"""
__version__='$Revision$'
import param
import numpy as np
try:
from collections import OrderedDict
except:
from odict import OrderedDict # pyflakes:ignore (try/except import)
map_type = OrderedDict
class AttrDict(dict):
"""
A dictionary type object... |
__copyright__ = "Copyright (C) 2013 Kristoffer Carlsson"
__license__ = """
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
to use, copy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Timothy Dozat
#
# 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 ... |
#!/usr/bin/env python
import os
import subprocess
import tempfile
from nose.tools import assert_true
from nose_parameterized import parameterized
try:
from shlex import quote
except ImportError: # <3.3 fallback
from shellescape import quote
sample_dir = os.path.join(os.path.dirname(os.path.realpath(__file_... |
# encoding: utf-8
from collections import namedtuple
from os import path
import pkgutil
import sys
import time
from jinja2 import Environment, FileSystemLoader
from authomatic.providers import (
oauth1,
oauth2,
openid,
)
from authomatic import six
from authomatic.six.moves import reload_module
# Add pa... |
"""Create Security Groups for Spinnaker Pipelines."""
import argparse
import configparser
import json
import logging
import os
import sys
from jinja2 import Environment, FileSystemLoader
import requests
class SpinnakerSecurityGroup:
"""Manipulate Spinnaker Security Groups."""
def __init__(self):
sel... |
import numpy
from blocks.bricks import Tanh
from blocks.bricks.recurrent import GatedRecurrent, RecurrentStack, LSTM, SimpleRecurrent
from blocks.bricks.sequence_generators import SequenceGenerator, Readout, SoftmaxEmitter, LookupFeedback
from blocks.initialization import Uniform
from blocks.model import Model
from blo... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... |
from flask import Flask, render_template, session, send_from_directory, jsonify, request, redirect
from xml.etree import ElementTree
import urllib2
def is_valid(ticket):
cas_url="https://netid.rice.edu/cas/serviceValidate?ticket="+ticket+"&service=http://example.rice.edu/login.html"
print cas_url
... |
import domino
import random
def randomized_hands():
dominoes = [domino.Domino(i, j) for i in range(7) for j in range(i, 7)]
random.shuffle(dominoes)
return dominoes[0:7], dominoes[7:14], dominoes[14:21], dominoes[21:28]
class Game:
def __init__(self, starting_domino=None, starting_player=0):
s... |
"""
Authenticator
original from the JupyterHub repository
https://github.com/jupyter/nbgrader/blob/master/nbgrader/auth/hubauth.py
"""
import json
import logging
import os
import requests
from flask import request, redirect, abort, current_app
class HubAuth:
"""Jupyter hub authenticator."""
def __init__(self):
... |
#!/usr/bin/env python3.5
import rdflib
from rdflib.extras import infixowl
from IPython import embed
from scigraph_client import Graph, Vocabulary
from utils import makeGraph
__all__ = [
'AND',
'OR',
'phenoPreds',
'PhenotypeEdge',
'NegPhenotypeEdge',
'LogicalPhenoEdge',
'DefinedNeuron',
... |
import os
import pandas as pd
import tables
import cv2
import numpy as np
from MWTracker.analysis.ske_create.helperIterROI import generateMoviesROI
from MWTracker.analysis.ske_create.getSkeletonsTables import getWormMask
from MWTracker.helper.misc import TABLE_FILTERS
def _getBlobFeatures(blob_cnt, blob_mask, roi_ima... |
# -*- coding: utf-8 -*-
from io import StringIO
from django.urls import re_path
from django.core.management import CommandError, call_command
from django.http import HttpResponse
from django.test import TestCase
from django.test.utils import override_settings
from django.views.generic.base import View
from django impo... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... |
import unittest
import warnings
from pymongo.read_preferences import ReadPreference
from mongoengine import *
from tests.utils import MongoDBTestCase
class TestQuerysetAggregate(MongoDBTestCase):
def test_read_preference_aggregation_framework(self):
class Bar(Document):
txt = StringField()
... |
"""
###################
# Empty QueryDict #
###################
>>> q = QueryDict('')
>>> q['foo']
Traceback (most recent call last):
...
MultiValueDictKeyError: "Key 'foo' not found in <QueryDict: {}>"
>>> q['something'] = 'bar'
Traceback (most recent call last):
...
AttributeError: This QueryDict instance is immut... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
nodeenv
~~~~~~~
Node.js virtual environment
:copyright: (c) 2014 by Eugene Kalinin
:license: BSD, see LICENSE for more details.
"""
nodeenv_version = '0.9.1'
import sys
import os
import stat
import logging
import optparse
import subprocess
import... |
from synapse.rest.client.v2_alpha.register import RegisterRestServlet
from synapse.api.errors import SynapseError
from twisted.internet import defer
from mock import Mock
from tests import unittest
import json
class RegisterRestServletTestCase(unittest.TestCase):
def setUp(self):
# do the dance to hook u... |
# -*- coding: utf-8 -*-
import os
import sys
import fcntl
import select
import subprocess
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
import numpy as np
from scipy.io import savemat, loadmat
__all__ = ['MatlabError',
'MatlabConnectionError',
'MatlabPi... |
"""
********************************************************************************
* Name: tethys_gizmos.py
* Author: Nathan Swain
* Created On: 2014
* Copyright: (c) Brigham Young University 2014
* License: BSD 2-Clause
********************************************************************************
"""
import os
im... |
import tempfile
import warnings
import numpy as np
import scipy.sparse
import pytest
import matrix
import matrix.constants
import matrix.decompositions
import matrix.permute
# *** random values *** #
def random_matrix(n, m, dense=True):
random_state = 1234
if dense:
np.random.seed(random_state)
... |
""" The cache bits of TileStache.
A Cache is the part of TileStache that stores static files to speed up future
requests. A few default caches are found here, but it's possible to define your
own and pull them into TileStache dynamically by class name.
Built-in providers:
- test
- disk
- multi
- memcache
- s3
Exampl... |
import os.path
import tempfile
import warnings
import numpy as np
import scipy.sparse
import pytest
import matrix
import matrix.calculate
import matrix.constants
import matrix.decompositions
import matrix.permute
RANDOM_STATE = 1234
# *** random values *** #
def random_matrix(n, m, dense=True, complex_values=Fal... |
import json
import requests
from django.views import generic
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_exempt
from django.conf import settings
from .models import Gene
class IndexView(generic.TemplateView):
template_name = 'browser/index.html'
'''
def ... |
"""
This is the Django template system.
How it works:
The Lexer.tokenize() function converts a template string (i.e., a string containing
markup with custom template tags) to tokens, which can be either plain text
(TOKEN_TEXT), variables (TOKEN_VAR) or block statements (TOKEN_BLOCK).
The Parser() class takes a list ... |
# -*- coding: utf-8 -*-
import json
import re
import django
import psycopg2
import psycopg2.extensions
import psycopg2.extras
from django import forms
from django.db import models
from django.db.backends.postgresql_psycopg2.version import get_version
from django.conf import settings
from django.utils import six
from... |
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, render_template, request, redirect, url_for,\
make_response, g as flask_g
from flask_login import LoginManager, current_user, login_required,\
login_user, logout_user
from hashlib import pbkdf2_hmac
from binascii import ... |
# -*- coding: utf-8 -*-
import os.path
from datetime import datetime
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from djangobb_forum.models import Topic, Post, Profile, Reputation, Report, \
Attachmen... |
# -*- coding: utf-8 -*-
from copy import deepcopy
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, PlaceholderAdminMixin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from parler.admin import TranslatableAdmin... |
"""Django Feed Aggregator."""
VERSION = (0, 2, 28)
__version__ = ".".join(map(str, VERSION))
__author__ = "Ask Solem"
__contact__ = "askh@opera.com"
__homepage__ = "http://github.com/ask/django-feeds/"
__docformat__ = "restructuredtext"
import logging
logger = logging.getLogger("djangofeeds")
channel = logging.Stream... |
# Original source: https://github.com/grpc/grpc-java/blob/master/java_grpc_library.bzl
#
# Modified to use "@build_buildfarm//3rdparty/..." references to protobuf and gRPC instead.
def _path_ignoring_repository(f):
if (len(f.owner.workspace_root) == 0):
return f.short_path
return f.path[f.path.find(f.owner.wor... |
__version__ = (0, 9, 7)
|
# -*- coding: utf-8 -*-
from __future__ import print_function
import collections
import os
import sys
from verta.external import six
from verta import _blob
from .._protos.public.modeldb.versioning import VersioningService_pb2
from .._protos.public.modeldb.versioning import Environment_pb2 as _EnvironmentService
... |
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# For more information, please refer to the LICENSE.txt file.
#ThreatExpert Converter Script
#Updated 02/24/2014 for MAEC v4.1 and CybOX v2.1
#ThreatExpert main parser class
#For use in extracting data from XML ThreatExpert output
from maec.bundle.bund... |
# -*- coding: utf-8 -*-
import json
import django
from django import forms
from django.core.exceptions import ValidationError
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.utils import six
from django.utils.encoding import force_text
from django.utils.translation ... |
# -*- coding: utf-8 -*-
import os
from io import BytesIO
import glob
import math
import random
import sys
import PIL
import numpy as np
from numpy import argmax, array
import tflearn
from tflearn.layers.core import input_data, fully_connected, dropout, flatten
from tflearn.layers.conv import conv_2d, max_pool_2d
from ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 10 11:35:26 2015
@author: salimeh
"""
from collections import OrderedDict
import itertools
from datetime import datetime
import zipfile
import logging
import xlrd
import pandas
from widukind_common import errors
from dlstats.fetchers._commons import Fetcher, Datasets,... |
# project/user/views.py
#################
#### imports ####
#################
from flask import render_template, Blueprint, url_for, \
redirect, flash, request
from flask.ext.login import login_user, logout_user, \
login_required, current_user
from project.models import User
# from project.email import send... |
import os
order = ['linux-x86.tbl', 'linux-x64.tbl', 'linux-x32.tbl', 'linux-arm.tbl', 'freebsd.tbl']
max_id = 0
by_name = {}
__all__ = by_id = []
translator = None
def create():
global max_id, translator
dir = os.path.join(os.path.dirname(__file__), 'syscalls')
size = len(order)
iid_map = {}
... |
import datetime
import mock
from django.contrib.auth.models import Permission
from django.core.exceptions import ValidationError
from django.test import TestCase
from timepiece.contracts.models import ProjectContract, ContractHour
from timepiece.tests.base import ViewTestMixin
from timepiece.tests import factories
... |
############################################################################
#
# Copyright (C) 2012 PX4 Development Team. 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 o... |
from __future__ import unicode_literals
import logging
import requests
import re
import json
from bs4 import BeautifulSoup
class Post(object):
stop = False
def __init__(self, url="https://steamcommunity.com/groups/ns2rus/discussions/0/527273452871150509/"):
self.url = url
self.count = None
... |
#!/usr/bin/python
import unittest
import dougrain
class ParseSimpleTest(unittest.TestCase):
def setUp(self):
self.doc = dougrain.Document.from_object({"name": "David Bowman"})
def testParseSimple(self):
self.assertEquals(self.doc.name, "David Bowman")
def testHasEmptyLinks(self):
... |
"""
Tests for matching algorithms.
"""
from numpy.testing import assert_array_equal
from matching import deferred_acceptance
class TestDeferredAcceptance:
def setUp(self):
'''Setup preference order lists'''
# Males' preference orders over females [0, 1, 2] and unmatched
m_unmatched = 3
... |
"""Unit tests for schedule.py"""
import unittest
import mock
import datetime
# Silence "missing docstring", "method could be a function",
# "class already defined", and "too many public methods" messages:
# pylint: disable-msg=R0201,C0111,E0102,R0904,R0901
import schedule
from schedule import every
def make_mock_jo... |
# Natural Language Toolkit: Tokens and Tokenizers
#
# Copyright (C) 2001 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@ldc.upenn.edu> (minor additions)
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id$
# Open questions:
# S... |
import logging
import os
import re
import socket
import threading
import time
import subprocess
from contextlib import contextmanager
from textwrap import dedent
import pytest
import requests
import stbt_rig
@pytest.fixture(scope="function", name="tmpdir")
def fixture_tmpdir():
with stbt_rig.named_temporary_dir... |
"""Automation using nox.
"""
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
import glob
import os
import shutil
import sys
import nox
sys.path.append(".")
from tools.automation import release # isort:skip # noqa
sys.path.pop()
nox.options.reuse_existing... |
import pandas as pd
import numpy as np
import operator
import os
import re
import glob
import trace
data_dir = '/data2/gmrtarch/cycle20/'
VALID_LIST = 'parser/filter_healthy/healthy2_file.txt'
valid_observations = open(VALID_LIST, 'r').read().split('\n')[0:-1]
all_observations = os.listdir(data_dir)
ltahdr_error_dir =... |
"""
DataTypes used by this provider
"""
import inspect
import json
import logging
import time
from azure.common import AzureException
from azure.mgmt.network.models import NetworkSecurityGroup
from cloudbridge.cloud.base.resources import BaseAttachmentInfo, \
BaseBucket, BaseBucketObject, BaseFloatingIP, \
... |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg 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 License, or (at your option) any later version.
#... |
from collections import Iterable, namedtuple
from functools import partial
from typing import List, Sized # flake8: noqa
from .promise import Promise, async_instance
from .context import Context
def get_chunks(iterable_obj, chunk_size=1):
chunk_size = max(1, chunk_size)
return (iterable_obj[i:i + chunk_siz... |
import os.path
import sys
import tarfile
import time
import zipfile
import StringIO
def read_file(path, use_crlf):
with open(path, 'rb') as file:
data = file.read()
if '\0' not in data:
data = data.replace('\r', '')
if use_crlf:
data = data.replace('\n', '\r\n')
return data
def write_zip(target, arcpref... |
# 2012 L. Amber Wilcox-O'Hearn
# RealWordVocabExtractor.py
import codecs, unicodedata
class RealWordVocabExtractor():
def __init__(self, vocabfile_obj, outfile_obj):
self.unicode_vocabfile_obj = codecs.getreader('utf-8')(vocabfile_obj)
self.unicode_outfile_obj = codecs.getwriter('utf-8')(outfile_... |
"""
Definition of :class:`Lightcurve`.
:class:`Lightcurve` is used to create light curves out of photon counting data
or to save existing light curves in a class that's easy to use.
"""
import logging
import numpy as np
import stingray.utils as utils
__all__ = ["Lightcurve"]
class Lightcurve(object):
def __ini... |
# coding: utf-8
import datetime
import time
import json
import flask
import requests
from flask import request, flash, redirect, url_for, render_template
import models
bp = flask.Blueprint('home', __name__)
@bp.route('/ruok', methods=['GET', 'POST'])
def ruok():
return 'imok'
def cleanname(name):
name = nam... |
# -* codding : utf-8
# supported python version: 3.6
__author__ = "Djoudi Benarfa"
__create_date__ = "12/03/2017"
__version__ = "0.1"
__email__ = "dbenarfa@outlook.com"
numbers_less_17 = {1: "un",
2: "deux",
3: "trois",
4: "quatre",
... |
"""
write_png(...) writes a numpy array to a PNG file.
write_apng(...) writes a sequence of arrays to an APNG file.
AnimatedPNGWriter is a class that can be used with Matplotlib animations.
This code has no dependencies other than numpy and the python standard
libraries.
Limitations:
* Only tested with Python 2.7 a... |
from collections import namedtuple
class Holder(object):
def __init__(self):
self.list = []
def add_to_list(self, element_name, element_value = 0):
pass
def get_list(self):
return self.list
def get_list_len(self):
return len(self.list)
class UnionHolder(Holder):
d... |
# Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
#
# 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 ... |
"""
AuxiliaryVariables subclasses for extractin isosurfaces and contours
"""
from collections import defaultdict, OrderedDict
from itertools import product
from proteus.EGeometry import etriple,ecross,enorm,edot
from mpi4py import MPI
from petsc4py import PETSc
import numpy as np
from numpy.linalg import norm
from . ... |
#
# Protein Engineering Analysis Tool Structure Analysis (PEATSA)
# Copyright (C) 2010 Michael Johnston & Jens Erik Nielsen
#
# Author: Michael Johnston
#
# 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 Fou... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import math
import pickle
import numpy
import datetime
from PIL import Image, ImageDraw, ImageOps, ImageEnhance
DEBUG_LOCATIONS = False
DEBUG_VALUES = False
DEBUG_PRINT_CHARS = False
DEBUG_PRINT_EIGS = False
"""
To run:
./ocr-eig.py ./img/Right... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' ogr2osm beta
This program takes any vector data understadable by OGR and outputs an OSM file
with that data.
By default tags will be naively copied from the input data. Hooks are provided
so that, with a little python programming, you can translate the tags however
y... |
__version__ = '1.0rc2'
|
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.