src stringlengths 721 1.04M |
|---|
'''
Copyright (c) 2016-2017 Wind River Systems, 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 a... |
import test_helper
import unittest
import json
from etvnet_service import EtvnetService
from config import Config
class EtvnetServiceTest(unittest.TestCase):
def setUp(self):
config = Config("../etvnet.config")
self.service = EtvnetService(config)
def test_channels(self):
result = s... |
"""
flask-negotiate2
===============
Content negotiation utility for Flask apps. Fork of Flask-Negotiate by
Matt Wright (github.com/mattupstate)
Resources
---------
- `Documentation <http://packages.python.org/flask-negotiate2/>`_
- `Issue Tracker <http://github.com/jackfirth/flask-negotiate/issues>`_
- `Code <http... |
import numpy as np
"""
This file contains pauli transfer matrices for all basic qubit operations.
"""
I = np.eye(4)
# Pauli group
X = np.array([[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, -1, 0],
[0, 0, 0, -1]], dtype=int)
Y = np.array([[1, 0, 0, 0],
[0, -1, 0, 0],
... |
# rrd.py
# Copyright (C) 2009-2013 PalominoDB, Inc.
#
# You may contact the maintainers at eng@palominodb.com.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License... |
from unlocode.models import Country, SubDivision, Locode, LocCountry, LocFunction, LocStatus, LocSubdivision, LocVersion
from unlocode.models import LocChangeIndicator
import os
import csv
import logging
from django.db import IntegrityError, transaction
def saveatomic(object, logger):
result = False
try:
... |
import os
import shutil
from django.conf import settings
from django.core import serializers
from django.core.management.commands.loaddata import Command as LoaddataCommand
from django.db.models import FileField
class Command(LoaddataCommand):
def handle(self, *fixture_labels, **options):
super(Command, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"Fully test this module's functionality through the use of fixtures."
from megacosm.generators import MagicItem
from megacosm.generators import NPC
from megacosm.generators import Curse
import unittest2 as unittest
import fixtures
import fakeredis
from config import TestC... |
#!/usr/bin/env python
# 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.
import cStringIO
import logging
import unittest
import sys
import isolate_common
class TraceInputs(unittest.TestCase):
def _te... |
from __future__ import print_function
import GPy
import numpy as np
def transformTimeSeriesToSeq(Y, timeWindow):
Ntr,D = Y.shape
blocksNumber = Ntr - timeWindow
X = np.zeros((blocksNumber, timeWindow*D))
Ynew = np.zeros((blocksNumber,D))
for i in range(blocksNumber):
tmp = Y[i:i+timeWindow... |
from unittest import TestCase, TestLoader, TextTestRunner, skipIf
from warnings import warn
import sys
from os.path import join
from json import load
from six import iteritems
try:
import numpy
except:
numpy = None
if __name__ == "__main__":
sys.path.insert(0, "../..")
from cobra.test import create_... |
#i = 0
#numbers = []
#
#while i < 6:
# print "At the top i is %d" % i
# numbers.append(i)
#
# i += 1
# print "Numbers now: ", numbers
# print "At the bottom i is %d" % i
#
#
#print "The numbers: "
#
#for num in numbers:
# print num
#Study Drill Part 1
#print "What's the limit of the list?"
#a = int(r... |
# Copyright 2017 Uber Technologies, 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 applica... |
#!/usr/bin/env python3
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
from linklist import *
class Solution(object):
def reorderList(self, head):
"""
:type head: ListNode
:rtype: None Do not ret... |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
# Copyright 2018 The TensorFlow 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 applica... |
#!/usr/bin/env python
import sys
from unittest import main, TestCase
import twiggy
from twiggy.lib.converter import ConversionTable
import neurokernel.mixins as mixins
# Create formatter and filter to produce predictable output that can be tested:
conv = ConversionTable()
conv.add('name', str, '{1}'.format)
conv.a... |
# Copyright (C) 2011 Bradley N. Miller
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distribute... |
from six import StringIO as StringIO
import os
import posixpath
import shutil
from fabric.api import (
run, path, put, sudo, abort, warn_only, env, cd, local, settings, get
)
from fabric.contrib.files import exists
from utils import Integration
def assert_mode(path, mode):
remote_mode = run("stat -c \"%%a... |
from affine import Affine
from textwrap import dedent
import warnings
class SpatialContextError(Exception):
"""
"""
class SpatialContext(object):
"""Stores the spatial context of the grids in niche
This class is based on the rasterio model of a grid.
Attributes
----------
transform: A... |
import pytest
from aneris.control.factory import InterfaceFactory
from dtocean_core.core import (AutoFileInput,
AutoFileOutput,
AutoQuery,
Core)
from dtocean_core.data import CoreMetaData
from dtocean_core.data.definitions imp... |
#!/usr/bin/python2.7
import sys, os, glob, shutil, re
import lib.misc as misc
import lib.config as config
import lib.message as message
import actions.common as common
def detect_boot():
global initrd, vmlinuz, mt86plus, xen_kernel, xen_efi, ipxe_kernel, ipxe_efi
initrd = None
vmlinuz = None
mt86plus... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from s4u2p import *
import httplib
import argparse
parser = argparse.ArgumentParser(description="A small example program to show usage of the services for user kerberos extension.")
parser.add_argument("--user", dest="user", help="user to impersonate", default="kraemer")
parser.add_argument("--host", dest="host", help... |
#!/usr/bin/env python
# Copyright (C) 2014 Statoil ASA, Norway.
#
# The file 'test_faults.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Foundati... |
from __future__ import division
import numpy as np
import math
def error_norm(y1, y2, atol, rtol):
tol = atol + np.maximum(y1,y2)*rtol
return np.linalg.norm((y1-y2)/tol)/(len(y1)**0.5)
def adapt_step(method, f, tn_1, yn_1, y, y_hat, h, p, atol, rtol):
'''
Checks if the step size is accepted. If n... |
# Copyright 2015 Adafruit Industries.
# Author: Tony DiCola
# License: GNU GPLv2, see LICENSE.txt
import ConfigParser
import importlib
import os
import re
import sys
import signal
import time
import pygame
from model import Playlist
# Basic video looper architecure:
#
# - VideoLooper class contains all the main log... |
# import pandas as pd
import datetime as dt
# import matplotlib.pyplot as plt
from collections import Counter
import csv
class Cluster(object):
def __init__(self, capacity):
self.week = [0] * 60
class Evaluater(object):
def __init__(self, filename, k, dist, capacity, date_range):
self.data = s... |
"""VCS tests: Bazaar."""
import os
import subprocess
from zc.buildout import UserError
from ..testing import COMMIT_USER_FULL
from ..testing import VcsTestCase
from ..bzr import BzrBranch
from ..bzr import working_directory_keeper
from ..base import UpdateError
from ..base import CloneError
class BzrBaseTestCase(Vcs... |
import re
import datetime
from urllib.parse import urlencode
from collections import defaultdict
from openstates.scrape import Scraper, Bill, VoteEvent
from openstates.utils import format_datetime
from spatula import Page, PDF, Spatula
# from https://stackoverflow.com/questions/38015537/python-requests-exceptions-ssle... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Felipe Gallego. All rights reserved.
#
# This 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 ... |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# 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 elasticsearch import TransportError
from elasticsearch_dsl import Search, DocType, Date, String, MultiSearch, \
MetaField, Index, Q
from .test_data import DATA
from pytest import raises
class Repository(DocType):
created_at = Date()
description = String(analyzer='snowball')
tags = String(index=... |
# -*- coding: utf-8 -*-
#
# Imports
import torch
# Base class for text transformers
class Transformer(object):
"""
Base class for text transformers
"""
# Constructor
def __init__(self):
"""
Constructor
"""
# Properties
self.symbols = self.generate_symbols(... |
__author__ = '1'
import re
def test_contacts_on_home_page(app):
address_from_home_page = app.address.get_address_list()[0]
address_from_edit_page = app.address.get_address_info_from_edit_page(0)
assert address_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(address_from_edit_page... |
"""
Tests for instructor.basic
"""
from django.test import TestCase
from student.models import CourseEnrollment
from django.core.urlresolvers import reverse
from student.tests.factories import UserFactory
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from shoppingcart.models import CourseRegistrationCo... |
from django.views.generic import CreateView, UpdateView
from django.shortcuts import redirect, render
from django.views.decorators.csrf import csrf_protect
from .models import Author, Book
from .forms import AuthorForm, BookFormSet, BookForm, AuthorFormSet
'''
Serverside Django views, not needed for restful services. ... |
#!/usr/bin/env python
'''
mobile devices parser
Version 0.1
by Roy Firestein (roy@firestein.net)
Parse mobile devices audit plugin and export to CSV
'''
import os
import xml.dom.minidom
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-f", "--file", action="store", type="string", d... |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
#!/usr/bin/env python
import sys
from setuptools import setup
install_requires = [
'agate>=1.6.1',
'agate-excel>=0.2.2',
'agate-dbf>=0.2.0',
'agate-sql>=0.5.3',
'six>=1.6.1',
'setuptools',
]
if sys.version_info < (2, 7):
install_requires.append('argparse>=1.2.1')
install_requires.appe... |
from sympy import Symbol, Rational, Order, C, exp, ln, log, O, var, nan, pi, S
from sympy.utilities.pytest import XFAIL, raises
from sympy.abc import w, x, y, z
def test_caching_bug():
#needs to be a first test, so that all caches are clean
#cache it
e = O(w)
#and test that this won't raise an exceptio... |
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
#
#
# 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, eith... |
"""
Copyright 2015 Esri
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, software
distributed ... |
# Copyright 2016 Bhautik J Joshi
# 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... |
"""
Tests DefaultCards.py
"""
import unittest
from unittest.mock import MagicMock, PropertyMock, patch, sentinel
import numpy
from PIL import ImageFont
from replayenhancer.DefaultCards \
import RaceResults, SeriesStandings, StartingGrid, SeriesChampion
class TestRaceResults(unittest.TestCase):
... |
import click
from arrow.cli import pass_context, json_loads
from arrow.decorators import custom_exception, dict_output
@click.command('add_transcripts')
@click.option(
"--transcripts",
help="Transcript data",
type=str,
multiple=True
)
@click.option(
"--suppress_history",
help="Suppress the his... |
# -*- coding: utf-8 -*-
#
# no_spurious_cast documentation build configuration file, created by Quark
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon'
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'no_spurious_cast'
copyright = u'2015, no_spurious_cast author... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 16 15:40:29 2016
@author: okada
$Id: pmsignature.py 205 2017-08-08 06:25:59Z aokada $
"""
########### js template
js_header = """(function() {
msig_data = {};
"""
js_footer = """
})();
Object.freeze(msig_data);
"""
js_dataset = """
msig_data.tooltip_format = {{
{to... |
## -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011 CERN.
#
# Invenio 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 2 of the
# License, or (at your option) any late... |
"""
models.py
==========
This is the models interface for the database for the config
applications.
:copyright: (c) 2015 by GammaRay.
:license: BSD, see LICENSE for more details.
Author: GammaRay
Version: 1.0
Date: 3/11/2015
"""
"""
====================... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... |
# -*- coding: utf-8 -*-
""" Provides new permission policies for django-rest-framework
"""
from rest_framework.permissions import DjangoModelPermissions, BasePermission
from django.contrib.contenttypes.models import ContentType
from rest_framework_fine_permissions.models import FilterPermissionModel
from django.core.... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mycroft AI 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 ... |
# coding:utf-8
import json
from cryptacular.bcrypt import BCRYPTPasswordManager
from webob import exc
from webob.response import Response
def convert_datetime(model_object):
model_object['pubDate'] = model_object['pubDate'].strftime("%Y-%m-%d %H:%M:%S")
model_object['modifiedDate'] = model_object['modifiedDat... |
import numpy as np
import get_fit_1D_open_manifold_3D_param
import solve_d_R_d_tau_p_3D
import a
from scipy.io import loadmat
import matplotlib.pyplot as plt
#import matplotlib.pyplot as plt
'''
function [a,b,tau] = fit_1D_open_manifold_3D(psi)
%
% fit_1D_open_manifold_3D
%
% fit the eigenvectors for ... |
import unittest
import numpy as np
import pandas as pd
from sklearn_helpers.preprocessing import \
EnhancedLabelEncoder, MultiColumnLabelEncoder
class EnhancedLabelEncoderTest(unittest.TestCase):
def test_accepts_only_1d(self):
"""It should only accept only a 1d array"""
ehe = EnhancedLabelEnc... |
__author__ = 'Konstantin Dmitriev'
from renderchan.module import RenderChanModule
from renderchan.utils import which
import subprocess
import os
import re
import random
class RenderChanMp3Module(RenderChanModule):
def __init__(self):
RenderChanModule.__init__(self)
if os.name == 'nt':
... |
import boto3
#Describe your regions here
region_list = ['us-west-2']
#For creating snapshots
def create_snapshot(volume):
Description='Created for volume '+volume
client = boto3.client('ec2')
response = client.create_snapshot(
DryRun=False,
VolumeId=volume,
Description=Descriptio... |
# -*- coding=utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import tornado.wsgi
import tornado.options
import os.path,os,datetime,sys,time,codecs
import markdown
import tohtml
import db
import json
import tohtml
import base64
import uuid
def conf(): #全局设定信息
global NAME,Subtitle,description,key... |
from PyQt5 import QtGui, QtCore, QtWidgets
import re
import string
from time import time
import sys
import TextSelection
class CTextDecorator(object):
redPen = QtGui.QPen(QtGui.QColor(255, 0, 0))
greenPen = QtGui.QPen(QtGui.QColor(255, 255, 0))
whitePen = QtGui.QPen(QtGui.QColor(255, 255, 255))
norm... |
#!/usr/bin/env python
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)... |
import asyncio
import unittest
from unittest import mock
from aiohttp.web import Request
from aiohttp.multidict import MultiDict, CIMultiDict
from aiohttp.protocol import HttpVersion
from aiohttp.protocol import RawRequestMessage
class TestWebRequest(unittest.TestCase):
def setUp(self):
self.loop = async... |
# prosaicweb
# Copyright (C) 2016 nathaniel smith
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This pro... |
import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
- X:... |
# The MIT License (MIT)
#
# Copyright (c) 2015 Saarland University
#
# 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, c... |
# -*-coding:Utf-8 -*
# ----------------------------------------------------------------------
# Align data without model
# ----------------------------------------------------------------------
# External libraries
# ----------------------------------------------------------------------
import sys
import os
# Full pa... |
import json
from urllib import quote_plus
import urllib2
from flask import Flask
from mock import Mock, ANY, MagicMock
from shapely.geometry import Point
import unittest2 as unittest
from werkzeug.exceptions import NotFound
from molly.apps.places.endpoints import PointOfInterestEndpoint, NearbySearchEndpoint, PointOf... |
#!/usr/bin/python
usage = "stripRawUnsafe.py unsafe.txt interesting.txt"
description = "reads in a list of unsafe channels from unsafe.txt. If these are not \"raw\" channel names, it converts them to that form. I then reads in a channel list from interesting.txt and performs a filter based on the unsafe channels. Chann... |
import os
DEBUG = False
WAGTAIL_ROOT = os.path.dirname(os.path.dirname(__file__))
STATIC_ROOT = os.path.join(WAGTAIL_ROOT, 'tests', 'test-static')
MEDIA_ROOT = os.path.join(WAGTAIL_ROOT, 'tests', 'test-media')
MEDIA_URL = '/media/'
TIME_ZONE = 'Asia/Tokyo'
DATABASES = {
'default': {
'ENGINE': os.environ.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: p... |
def add_correction_new(cat_list,OBJNAME,FILTER,PPRUN):
import scipy, re, string, os
''' create chebychev polynomials '''
cheby_x = [{'n':'0x','f':lambda x,y:1.},{'n':'1x','f':lambda x,y:x},{'n':'2x','f':lambda x,y:2*x**2-1},{'n':'3x','f':lambda x,y:4*x**3.-3*x}]
cheby_y = [{'n':'0y','f':lambda x,y:1.... |
#!/usr/bin/env python
"""
This is an example of a simple command line client for Spotify using pyspotify.
You can run this file directly::
python shell.py
Then run the ``help`` command on the ``spotify>`` prompt to view all available
commands.
"""
from __future__ import print_function, unicode_literals
import... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2015 Jesse Peterson
Licensed under the MIT license. See the included LICENSE.txt file for details.
Attributes:
runner_thread (threading.Timer):
runner_start (int): In seconds, time of first run
runner_time (int): In seconds, time of subsequent runs
Todo:
* Cur... |
# Copyright 2013: Mirantis 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 b... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 BigML
#
# 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 b... |
# Copyright 2015 Open Source Robotics Foundation, 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... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 Intel
#
# Author: Shuangtai Tian <shuangtai.tian@intel.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/licen... |
from django.conf.urls.defaults import *
from profiles import views as profile_views # a not very well namespaced django plugin class
from contact_form.views import contact_form
import frontend.views as frontend_views # who thinks replacing dots with underscores here is useful?? --JT
import frontend.forms as fro... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import t
def _jitter(data, jit=None):
"""
Calculate y-axis jitter for two series of data.
Parameters
----------
data : DataFrame
Two series of data to which y-axis jitter wants to be added.
jit : i... |
# Copyright 2013 OpenStack Foundation
# 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 requ... |
__no_content = object()
def node(element_name, content=__no_content, attributes={}):
attrs_string = _attrs_string(attributes)
if content == __no_content:
return node_block(element_name, attributes)
else:
return node_inline(element_name, content, attributes)
def _attrs_string(attributes):
... |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# SublimeLinter-jshint written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# Forked for JSXHint by Samuel Reed (STRML)
#
# License: MIT
#
"""This module... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... |
from BeautifulSoup import BeautifulSoup
import re
import os
import sys
import MySQLdb
conn = MySQLdb.connect(user='root')
openclosetags = re.compile('''<.*?>|</.*?>''',re.DOTALL)
files = []
for file in os.listdir('./docs/cplusplus/'):
files.append('./docs/cplusplus/%s'%(file))
#http://www.cplusp... |
''' Jottings to work out format for __function_workspace__ matrix at end
of mat file.
'''
import os.path
import io
from numpy.compat import asstr
from scipy.io.matlab.mio5 import MatFile5Reader
test_data_path = os.path.join(os.path.dirname(__file__), 'data')
def read_minimat_vars(rdr):
rdr.initialize_read()
... |
# Copyright (c) 2015 Prabhu Gurumurthy <pgurumur@users.noreply.github.com>
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED "AS... |
from __future__ import absolute_import
import test_utils
from nose.tools import eq_, ok_
from ..store import referrer_url
from ..utils import QueryURLObject
class URLTests(test_utils.TestCase):
def test_pop_query_param(self):
original = 'http://example.com/?spam=eggs'
url = QueryURLObject(origin... |
# -*- coding: utf-8 -*-
from django.db import models
from django.db.models.query import QuerySet
class EditionManager(models.Manager):
def find_edition(self, release, edition, **kwargs):
if release:
kwargs[release.identifier] = release
if edition:
kwargs[edition.parent.iden... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
this_dir = os.path.dirname(os.path.realpath(__name__))
sys.path.insert(0, os.path.join(this_dir, 'libs', 'leap'))
import Leap
import time
import sys
class FingerPoint(object):
"""
All usefull information about a finger.
Arguments:
position... |
#!/usr/bin/env vpython
# Copyright 2016 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from __future__ import print_function
import json
import sys
from google.protobuf import json_format as jsonpb
import te... |
#-*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.contrib import admin
from django import forms
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.core.mail import message
from django.db.models import Count
from functools import update_wrapper
fro... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.share
from frappe import _
from frappe.utils import cstr, now_datetime, cint, flt
from erpnext.controllers.status_updater im... |
from AccessLayer.QueryLayer import TileQuery
from AccessLayer.QueryLayer import DataQuery
from Cache import Cache
import numpy as np
import tifffile
import StringIO
import zlib
import cv2
class Core(object):
""" Starts the :class:`Cache`
Arguments
-----------
db : :data:`bfly.Butterfly._db_type`
... |
#!/usr/bin/env python3
import sys
import logging
from common import nyapass_run_instances, Nyapass
from local import ClientHandlerManager
from local_socks5 import SocksClientHandler
from config import Config
def main():
config = Config("client")
logging.basicConfig(level=config.log_level)
instances = []... |
import contextlib
import numpy as np
import pandas as pd
import warnings
from xray import conventions, Variable, Dataset, open_dataset
from xray.core import utils, indexing
from . import TestCase, requires_netCDF4, unittest
from .test_backends import CFEncodedDataTest
from xray.core.pycompat import iteritems
from xray... |
import re
from lxml import etree
from pyramid.settings import asbool
from .exception import ConfigurationError
def clean_oai_settings(settings):
"""Parse and validate OAI app settings in a dictionary.
Check that the settings required by the OAI app are in the settings
dictionary and have vali... |
# Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
# Jim Fulton
# Edward Loper
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
r"""Module doctest -- a framework for running examples in docstrings.
In... |
# -*- coding: utf8 -*-
"""
Exponential, trigonometric and hyperbolic functions
Mathics basically supports all important trigonometric and hyperbolic functions.
Numerical values and derivatives can be computed; however, most special exact values and simplification
rules are not implemented yet.
"""
from __future__ im... |
"""
Text generation using a Recurrent Neural Network (LSTM).
"""
import argparse
import os
import random
import time
import numpy as np
import tensorflow as tf
class ModelNetwork:
"""
RNN with num_layers LSTM layers and a fully-connected output layer
The network allows for a dynamic number of iterations... |
from __future__ import absolute_import, division, print_function
import numpy as np
import json
import pytest
from ..state import (GlueSerializer, GlueUnSerializer,
saver, loader, VersionedDict)
from ...external import six
from ... import core
from ...qt.glue_application import GlueApplication
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.