src stringlengths 721 1.04M |
|---|
from django.db.models.signals import post_save, pre_delete, pre_save
from django.dispatch import receiver
from app.forms import MenuForm
from django import forms
from app.models import *
from django.core.exceptions import ObjectDoesNotExist
#from django.db.models.base import ObjectDoesNotExist
@receiver(post_save, sen... |
#!/usr/bin/python
__author__ = 'mp911de'
import time
import os,sys
import picamera
import picamera.array
import time
import numpy as np
import lib_mqtt as MQTT
from math import sqrt, atan2, degrees
DEBUG = False
def get_colour_name(rgb):
rgb = rgb / 255
alpha = (2 * rgb[0] - rgb[1] - rgb [2])/2
beta =... |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 IBM Corp
# 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/LICE... |
import os
import argparse
import yaml
import cherrypy
from more_itertools.recipes import consume
from . import datastore
from .pastebin import BASE, Server
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'-c', '--config', dest="configs",
default=[], action="append", h... |
import os.path as op
import base64
import h5py
import pytest
import clodius.tiles.multivec as hgmu
def test_multivec():
filename = op.join("test/sample_data", "sample_gwas.multires.mv5")
with h5py.File(filename, "r") as h5:
tile_size = h5["info"].attrs["tile-size"]
resolutions = list(h5["reso... |
# coding: utf-8
"""
weasyprint.layout.markers
-------------------------
Layout for list markers (for ``display: list-item``).
:copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, unicode_literals
... |
from pychron.experiment.utilities.aliquot_numbering import renumber_aliquots
__author__ = 'ross'
import unittest
class MockRun(object):
def __init__(self, l, uda, pos):
self.labnumber = l
self.user_defined_aliquot = uda
self.position = pos
class RenumberAliquotTestCase(unittest.TestCas... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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... |
#------------------------------------------------------------------------------
# Name: 01_es_lu_cc.py
# Purpose: Processing for the CREW project on ES, LUC and CC.
#
# Author: James Sample
#
# Created: 14/01/2015
# Copyright: (c) James Sample and JHI, 2015
# License: https://github.com/JamesS... |
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import os
import logging
# validate, , validate things, internal
from .lib import validate
# CMakeGen, , generate build files, internal
from .lib import cmakegen
def addOpt... |
import numpy as np
import numpy.random as ra
from gpaw.setup import create_setup
from gpaw.xc import XC
from gpaw.test import equal
x = 0.000001
ra.seed(8)
for xc in ['LDA', 'PBE']:
print xc
xc = XC(xc)
s = create_setup('N', xc)
ni = s.ni
nii = ni * (ni + 1) // 2
D_p = 0.1 * ra.random(nii) + 0... |
from numpy import repeat
from numpy import tile
from numpy import where
from numpy import zeros
from gwlfe.Input.LandUse.NLU import NLU
from gwlfe.Input.WaterBudget.Water import Water, Water_f
from gwlfe.Memoization import memoize
from gwlfe.MultiUse_Fxns.Runoff.CNI import CNI, CNI_f
from gwlfe.MultiUse_Fxns.Runoff.CN... |
# -*- coding: utf-8 -*-
"""
Assess model performance
"""
from __future__ import print_function, division
import os
from nltk import sent_tokenize
from utils import replace_sents, pk_load
from evaluator import Evaluator
from coherence_probability import ProbabilityVector
class Assessment(object):
def __init__(se... |
# -*- coding: utf-8 -*-
#
# Adds Parameterized tests for Python's unittest module
#
# Code from: parameterizedtestcase, version: 0.1.0
# Homepage: https://github.com/msabramo/python_unittest_parameterized_test_case
# Author: Marc Abramowitz, email: marc@marc-abramowitz.com
# License: MIT
#
# Fixed for to work in Python... |
from datetime import date
from django.conf import settings
from django.core import mail
from django.urls import reverse
from extforms.forms import SelfOrganisedSubmissionExternalForm
from extrequests.models import SelfOrganisedSubmission
from workshops.models import Curriculum, Language
from workshops.tests.base impo... |
import re
import uuid
from django.db import models
from django.core.validators import RegexValidator
from jsonfield import JSONField
from uuidfield import UUIDField
from .. import common
class OCDIDField(models.CharField):
def __init__(self, *args, **kwargs):
self.ocd_type = kwargs.pop('ocd_type')
... |
import theano
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import numpy as np
from theano.tensor.nnet.conv import conv2d
from theano.tensor.signal.downsample import max_pool_2d
from load import mnist, save_model
theano.config.floatX = 'float32'
srng = RandomStr... |
#! /usr/bin/env python
# Panflute
# Copyright (C) 2010 Paul Kuliniewicz <paul@kuliniewicz.org>
#
# 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, or (at your option)
# any late... |
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def modify_contact_by_index(self, index, new_contact_data):
wd = self.app.wd
self.select_contact_by_index(index)
wd.find_elements_by_css_selector("img[alt='Edit']")[index].... |
'''
* Given an array of integers, return indices of the two numbers such that t
* hey add up to a specific target.
* You may assume that each input would have exactly one solution.
* Example:
* Given nums = [2, 7, 11, 15], target = 9,
*
* Because nums[0] + nums[1] = 2 + 7 = 9,
* return [0, 1].
*
* Author: qia... |
#! /usr/bin/env python
"""! @package mrd
"""
from utils.attr import check_attr_type
class SubjectField():
"""! "Subject Field is a class representing a text string that provides domain or status information." (LMF)
"""
def __init__(self):
"""! @brief Constructor.
SubjectField instances ar... |
# Copyright (C) 2016, A10 Networks 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 requi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""Functions and classes related to image handling"""
from __future__ import absolute_imp... |
from __future__ import absolute_import, unicode_literals, division
import time
import mock
import pytest
from quadriga import QuadrigaClient
api_key = 'test_api_key'
api_secret = 'test_api_secret'
client_id = 'test_client_id'
nonce = 14914812560000
timeout = 123456789
signature = '6d39de3ac91dd6189993059be99068d229... |
from django.conf.urls.defaults import *
from django.conf import settings
from crm.xmlrpc import rpc_handler
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# crm and contactinfo URLs (required)
(r'^crm/', include('crm.urls')... |
"""
Test cases for the Block class.
"""
from inscriptis.model.canvas.block import Block
from inscriptis.model.canvas.prefix import Prefix
def test_merge_normal_text_collapsable_whitespaces():
"""
test cases where the block has collapsable whitespaces
"""
b = Block(0, Prefix())
b.merge_normal_text(... |
from __future__ import with_statement
import os, sys, re, pynav, time, datetime, pytz ,pyaeso, spharm, matplotlib,xml_marshaller, xmlbuilder
from xml_marshaller import xml_marshaller
from xml_marshaller.xml_marshaller import *
from xmlbuilder import XMLBuilder
import numpy as np
from pynav import Pynav
from pyaeso i... |
import QuantLib as ql
from .common import CreatorBase
from qtk.templates import Template as T
from qtk.fields import Field as F
class USDLiborCreator(CreatorBase):
_templates = [T.INDEX_IBOR_USDLIBOR]
_req_fields = [F.YIELD_CURVE, F.TENOR]
_opt_fields = []
def _create(self, asof_date):
yield_... |
#!/usr/bin/env python3
# -*- coding: cp1251 -*-
import jlinkarm as jl
import os, sys, time, struct
dllfilename = 'D:/MCU/SEGGER/JLink_V612i/JLinkARM.dll'
if __name__ == '__main__':
if len(sys.argv) >= 2:
if sys.argv[1] == '-h':
print 'Usage: ldram.py ram_all.bin'
exit(0)
imgfilename = 'build/bin/ram_all.bin... |
"""
LISSOM and related sheet classes.
$Id$
"""
__version__='$Revision$'
from numpy import zeros,ones
import copy
import param
import topo
from topo.base.projection import Projection
from topo.base.sheet import activity_type
from topo.base.simulation import EPConnectionEvent
from topo.transferfn.basic import Piecew... |
#!/usr/bin/env python2
from parser import Node
from copy import deepcopy
import numpy as np
from eqclib import getClassDefinition, resetClassDefinition
class CircuitTree(Node):
def __init__(
self,
params=[],
eqc=lambda w,
p: 0,
name="",
pNa... |
# Copyright (c) 2011 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. All rights reserved.
# Copyright (c) 2010 Research In Motion Limited. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are... |
import sys
import numpy as np
import numpy.random as npr
from sklearn.neighbors.kde import KernelDensity
from scipy.special import gammaln
import matplotlib.pyplot as plt
from calculate_phist import read_counts
from calculate_phist import normalize_haplotypes
def log_factorial(n):
return gammaln(n+1)
def log_multino... |
"""
truthfinder.py - given a statement and a list of truths, determine whether or
not the statement is confirmed (always true), plausible
(sometimes true), or busted (never true). Thanks Mythbusters.
"""
from .constants import CONFIRMED, BUSTED, PLAUSIBLE
from .utils import invert
de... |
"""
MIT License
Copyright (c) 2018 Chad Rosenquist
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, modify, merge, publis... |
import datetime
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.views.decorators.cache import cache_page
from public.models import News
from bering.models import Station, Ablation
... |
"""Provide access to attributes of currently running plugin"""
__all__ = ["plugin"]
import re
from core import plugins
class Plugin:
"""Get access to currently running plugin attributes.
Usage:
>>> from api import plugin
Attributes:
* name (type: str)
# Plugin name.
>>> plugin.... |
#!/usr/bin/python3
#import time
import random
import imp
modl = imp.load_source('ppFunctions', '../00/ppFunctions.py')
import os
from ppFunctions import *
from termcolor import colored, cprint
#sleep becouse of loading midi modules
print("Are you ready?")
time.sleep(1)
print_status = lambda x: cprint(x, 'white', 'on_b... |
# -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
# LSTM for sequence classification in the IMDB dataset
import numpy
from keras.datasets import imdb
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers.embeddings import Embedding
from keras.preprocessing import sequence
# fix random seed for reproducibili... |
"""
Django settings for yegsms project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import dj_database_url
# Build paths inside the project like this: os.path.j... |
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from django.shortcuts import render
from django.http import HttpResponse, HttpRequest, JsonResponse
from api.repositories.pilots import Pilots
from api.repositories.airplanes import Airplanes
from api.repositories... |
## @file
# This file is used to be the main entrance of EOT tool
#
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The ... |
import time
import statistics
from src.l3svms import *
from src.utils import *
args = get_args(__file__)
TRAIN = args.train_file
TEST = args.test_file
LAND = args.nb_landmarks # default 10
CLUS = args.nb_clusters # default 1
NORM = args.norm # default False
LIN = args.linear # default True
PCA_BOOL = args.pca # defa... |
from openerp.osv import osv
from openerp.tools.translate import _
from openerp import netsvc
class edi_tools_edi_wizard_archive_incoming(osv.TransientModel):
_name = 'edi.tools.edi.wizard.archive.incoming'
_description = 'Archive EDI Documents'
''' edi.tools.edi.wizard.archive.incoming:archive()
-... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2010 TUBITAK/UEKAE
#
# 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, or (at your option)
# any later version.
#
# ... |
# Copyright 2017 Battelle Energy Alliance, 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 t... |
# -*- coding: utf-8 -*-
import requests
from xml.etree import ElementTree
from datetime import datetime, timedelta
from .constants import epoch, G_XML_ROOT, G_XML_NAMESPACES, TZ_API_URL
def ts2dt(ts, millisecs=False):
"""Convert a timestamp to a datetime."""
if millisecs:
dt = datetime.utcfromtimest... |
import os
import sys
import fileinput
import re
import random
import math
from operator import itemgetter, attrgetter
import subprocess
from optparse import OptionParser
import copy
import time
import argparse
from dateutil import parser as dparser
import calendar
from scipy.stats import binom
from scipy.stats import... |
import re
import os.path
import logging
import subprocess
import research_papers.logutils as logutils
__author__ = 'robodasha'
__email__ = 'damirah@live.com'
class ParscitExtractor(object):
def __init__(self, parscit_dir):
"""
:param parscit_dir: directory where ParsCit is installed
"... |
# -*- coding: utf-8 -*-
import copy
def simple_rotate(s, m):
if m < 0:
raise Exception('m is less than 0')
m %= len(s)
t = copy.copy(s)
del s[:]
s += t[m:] + t[:m]
def left_shift_m(s, m):
if m < 0:
raise Exception('m is less than 0')
length = len(s)
m %= length
for ... |
import numpy as np
from fos.actor.primitives import AABBPrimitive
from pyglet.gl import GLfloat
from pyglet.gl import *
class Actor(object):
""" Define a visualization object in Fos """
def __init__(self,
affine = None,
aabb = None,
force_center_data = F... |
from abc import ABCMeta, abstractmethod
from six import add_metaclass
from uuid import uuid4
@add_metaclass(ABCMeta)
class Broker(object):
@abstractmethod
def add_job(self, job_class, *args, **kwargs):
"""
Add a job to the broker
:param job_class: python class of the payload job
... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
# encoding=utf-8
# -------------------------------------------------------------------- #
# MAIN CONFIGURATION #
# -------------------------------------------------------------------- #
# you should configure your da... |
import inject
from mcloud.application import ApplicationController
from mcloud.events import EventBus
from mcloud.plugin import IMcloudPlugin
from mcloud.plugins import Plugin
from mcloud.txdocker import IDockerClient
from twisted.internet import reactor
from twisted.python import log
from zope.interface import impleme... |
# Phatch - Photo Batch Processor
# Copyright (C) 2007-2009 www.stani.be
#
# 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... |
import os
from spectre.syntax import Instance, common
from string import *
import numpy as np
__all__ = ['Noise', 'Xf', 'Ac', 'Dc', 'Sweep', 'MonteCarlo', 'Sp', 'Transient', 'Pss' ]
class values(list):
def __init__(self, it):
if isinstance(it, (list, np.ndarray)):
list.__init__(self, it)
else... |
import sys
sys.path.append('../')
import unittest
from bayesian import Bayes, classify, classify_normal
class TestBayes(unittest.TestCase):
def test_empty_constructor(self):
with self.assertRaises(ValueError):
b = Bayes()
def test_list_constructor(self):
self.assertEqual(Bayes([]... |
# =============================================================================
#
# Copyright (c) 2016, Cisco Systems
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source ... |
import logging
import time
import threading as th
import multiprocessing as mp
from queue import Empty, Full
from ...stepper import StpdReader
logger = logging.getLogger(__name__)
class BFGBase(object):
"""
A BFG load generator that manages multiple workers as processes and
threads in each of them and f... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 David García Goñi
#
# This file is part of Phatty.
#
# Phatty 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) a... |
import logging
from PyQt4 import QtCore
from gnr.renderingtaskstate import AdvanceRenderingVerificationOptions
logger = logging.getLogger("gnr.gui")
def read_advance_verification_params(gui, definition):
if gui.ui.advanceVerificationCheckBox.isChecked():
definition.verification_options = Advan... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
TRANSMISSION = (('1','Vivo'),('2','Grabado'))
class Project(models.Model):
proj_name = models.CharField(max_length=30, unique=True, verbose_name='Nombre del Proyecto')
proj_date = models.DateField(auto_now_add=... |
# Token types
#
# EOF (end-of-file) token is used to indicate that
# there is no more input left for lexical analysis
INTEGER, OPERATOR, PLUS, MINUS, EOF = 'INTEGER', 'OPERATOR',\
'PLUS', 'MINUS', 'EOF'
class Token(object):
def __init__(self, type, value):
# token type: INTEGER, PLUS, or EOF
s... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from base import GAETestCase
from datetime import datetime, date
from decimal import Decimal
from editar_produto_app.editar_produto_model import Editar_produto
from routes.editar_produtos.new import index, save
from tekton.gae.middleware.r... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... |
import datetime
from typing import Sequence
import logging
import time
import sqlalchemy
from apis import github
from database import db
from database import models
SCRAPE_INTERVAL_SECONDS = 5
def timestamp_90_days_ago() -> datetime.datetime:
return datetime.datetime.now() - datetime.timedelta(days=90)
class Co... |
# coding=utf-8
"""
This module, views.py, is where all the backend and frontend server requests are handled and returned to the user.
"""
# Needed to send back a rendered HTML page.
from django.shortcuts import render
# Needed for sending a simple HttpResponse such as a string response.
from django.http import HttpRe... |
from __future__ import absolute_import
import pytest
from datetime import datetime, timedelta
from sentry.constants import MAX_VERSION_LENGTH, MAX_CULPRIT_LENGTH
from sentry.event_manager import EventManager
def validate_and_normalize(data):
manager = EventManager(data)
manager.normalize()
return manag... |
import queryCiteFile
import librarybase
import pywikibot
from epmclib.getPMCID import getPMCID
from epmclib.exceptions import IDNotResolvedException
import queue
import threading
import time
def rununthreaded():
citefile = queryCiteFile.CiteFile()
citations = citefile.findRowsWithIDType('pmc')
... |
"""
Production settings
- DATABASE_URL and DJANGO_SECRET_KEY should be in env
"""
# noinspection PyUnresolvedReferences
from .common import * # noqa
DEBUG = env.bool('DJANGO_DEBUG', default=False)
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = env('DJANGO_SECRET_KEY')
... |
#encoding: utf-8
sort_list = [(1,4),(5,1),(2,3)]
for j in range(len(sort_list) - 1):
for i in range(len(sort_list) - 1):
if max(sort_list[i]) > max(sort_list[i + 1]): #比较元素
#交换元素
temp = sort_list[i]
sort_list[i] = sort_list[i + 1]
sort_list[i + 1] = temp
pr... |
# -*- coding: utf-8 -*-
"""
Miscellaneous functions for LOTlib.
"""
# Special handling to deal with numpypy (which actually tends to be slower for LOTlib)
import collections
import math
from math import exp, log, pi
from random import random, sample
import re
import sys
import types # For checking if something is ... |
# awl.templatetags.awltags.py
from django import template
register = template.Library()
# ============================================================================
@register.filter
def getitem(dictionary, keyvar):
"""Custom django template filter that allows access to an item of a
dictionary through the ... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (... |
from __future__ import unicode_literals
from __future__ import absolute_import
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-20 18:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetable', '0009_coursea_courseb'),
]
operations = [
migrations.AlterFiel... |
#!/usr/bin/env python
#
# Copyright (C) 2017 - Massachusetts Institute of Technology (MIT)
#
# 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... |
# coding: utf-8
import unittest
import doctest
import os
from workspacemanager import setup
from workspacemanager import generateSetup
from workspacemanager.utils import *
from shutil import *
from workspacemanager.test.utils import *
# The level allow the unit test execution to choose only the top level test
min = ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AutoincrementalField.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... |
# 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 logging
from flask import redirect
from flask import request
from flask import url_for
from flask.ext.login impo... |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: ??
@author: muyeby
@contact: bxf_hit@163.com
@site: http://muyeby.github.io
@software: PyCharm
@file: test.py
@time: 16-9-4 下午8:17
"""
import time
import sys
import os
import re
import math
sys.path.append(os.getcwd() + "/../../../")
sys.path.append(os.getcwd() ... |
# -*- coding: utf-8 -*-
#
# Public-contracts documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 7 20:45:35 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fi... |
from django.db import models
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class UnknownPermission(Exception):
"""
An attempt was made to query for a permission that was not registered for that model... |
import sys
from IPython.core.interactiveshell import InteractiveShell
import pandasjson as json
import StringIO
if __name__=="__main__":
mode = "ipython"
line = sys.stdin.readline()
shell = InteractiveShell()
while line:
# explicitly write to stdout
sys.stdout.write(line)
sys.st... |
# from django.shortcuts import render
# Create your views here.
# from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import CreateView, UpdateView
from django.views.generic import DetailVi... |
#!/usr/bin/env python
# -*- coding:utf8 -*-
import pygame
import sys
import numpy
class Activity(object):
def __init__(self, screen_size, manager, clock):
self.screen_size = screen_size
self.manager = manager
def render(self, surface):
pass
def process_event(self, event):
pass
def step(self):
pass
... |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: ElementTree.py
__all__ = [
'Comment',
'dump',
'Element', 'ElementTree',
'fromstring', 'fromstringlist',
'iselement', 'iterparse',
'parse', 'Par... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@author: Tengwei Yuan
1. Get all links of summary pages - from start search page result
2. From each summary page get all links of detail product pages
3. From each detail product page get basic information and the number of review pages
4. From each review page get review ... |
import math
import Util
class Quaternion(object):
__slots__ = ['x', 'y', 'z', 'w']
__hash__ = None
def __init__(self, x=0.0, y=0.0, z=0.0, w=1.0):
self.x = float(x)
self.y = float(y)
self.z = float(z)
self.w = float(w)
def set(self, x, y, z, w):
sel... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# git-branch-viewer documentation build configuration file, created by
# sphinx-quickstart on Wed May 7 15:45:21 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in... |
import numpy as np
def group_indexes_by(data, group):
"""
groups the indexes of an array.
data: Array of which the indexes should be sorted
group: Array of functions that should return if an item belongs to a group.
"""
# create an array of groups
groups = [[] for g in group]
... |
"""
This module is responsible for setup of executors defined in buildtest
configuration. The BuildExecutor class initializes the executors and chooses the
executor class (LocalExecutor, LSFExecutor, SlurmExecutor) to call depending
on executor name.
"""
import logging
import os
import sys
from buildtest.defaults imp... |
import sys,os, pickle, numpy, pylab, operator
import cv2
from shutil import copy as copyfile
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import matplotlib.pyplot as plt
from DataParseApp import dataparseDialog
from sklearn.decomposition import NMF
projectpath=os.path.split(os.path.abspath(__file__))[0]
sys.pa... |
"""
Regular expression patterns for Markdown files.
Names of regex variables in this file:
anchor_link
ref_link
setext_underline
code_block_start
code_block_end
Markdown:
https://daringfireball.net/projects/markdown/syntax
"""
"""
anchor_link: Inline Markdown link that uses an anchor tag
Has the following specifica... |
# -*- coding: utf-8 -*-
import base64
import re
import time
import urllib.parse
from pyload.core.network.http.exceptions import BadHeader
from ..base.addon import BaseAddon, threaded
class Captcha9Kw(BaseAddon):
__name__ = "Captcha9Kw"
__type__ = "addon"
__version__ = "0.38"
__status__ = "testing"
... |
from __future__ import absolute_import
import numpy as np
from sklearn.metrics import pairwise_distances
from graphs import Graph
__all__ = ['incremental_neighbor_graph']
def incremental_neighbor_graph(X, precomputed=False, k=None, epsilon=None,
weighting='none'):
'''See neighbor_g... |
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Person upcoming view showing workitems and bugs for a person."""
__meta__ = type
__all__ = [
'PersonUpcomingWorkView',
]
from datetime import (
datetime,
timed... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.