src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
#
# Tweak documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 17 11:55:06 2015.
#
# 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 file.
#
# All... |
import sys
import hashlib
import binascii
import os
import struct
import copy
from cryptography.hazmat.primitives import padding, hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
from Utils import methoddispatch, singledispatch,... |
from time import time, ctime
import numpy as np
import pickle
from math import pi
from ase.units import Hartree
from ase.io import write
from gpaw.io.tar import Writer, Reader
from gpaw.mpi import world, size, rank, serial_comm
from gpaw.utilities.blas import gemmdot, gemm, gemv
from gpaw.utilities import devnull
from ... |
'''Trains a simple CNN on the MNIST dataset.
Gets to 97.14% test accuracy after 2 epochs
(there is *a lot* of margin for parameter tuning).
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Conv2D, MaxPo... |
import random
from genetics.dna.binary import DNABinary
def test_basic_init():
init = (True, False, True, True, False, False, False, True, True, False)
x = DNABinary(init)
for component, b in zip(x, init):
assert component == b
def test_string_init():
init = '1000101011110101010010100101001... |
import os
from cryptography.hazmat.primitives import hashes, padding, ciphers
from cryptography.hazmat.backends import default_backend
import base64
import binascii
def xor(a,b):
"""
xors two raw byte streams.
"""
assert len(a) == len(b), "Lengths of two strings are not same. a = {}, b = {}".format(le... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2021 Bitergia
#
# 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 ... |
# -*- coding: utf-8 -*-
"""
Minimum cost flow algorithms on directed connected graphs.
"""
__author__ = """Loïc Séguin-C. <loicseguin@gmail.com>"""
# Copyright (C) 2010 Loïc Séguin-C. <loicseguin@gmail.com>
# All rights reserved.
# BSD license.
__all__ = ['network_simplex',
'min_cost_flow_cost',
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#author:gaoda
#date:2012.7.30
#filename:passkeeper.core
#descirbe:a keeper for your all kinds of password
#spilt using tab
from sqlalchemy import *
from sqlalchemy.orm import *
import string
import sys
import argparse
from pkg_resources import resource_stream
'''init th... |
# Version info: $Id: Test_Equations.py 1 2012-01-07 22:20:43Z zunzun.com@gmail.com $
import sys, os, unittest, inspect
if os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..') not in sys.path:
sys.path.append(os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..'))
import pyeq2
class Test_BioScien... |
# Inspired by https://github.com/asaglimbeni/django-datetime-widget/blob/master/datetimewidget/widgets.py
# Copyright (c) 2013, Alfredo Saglimbeni (BSD license)
import re
from django.utils import translation
from django.utils.formats import get_format
from pretix import settings
date_conversion_to_moment = {
'%a... |
#-------------------------------------------------------------------------------
# Name: executive_dashboard.py
# Purpose:
#
# Author: Local Government
#
# Created: 05/06/2016 AM
# Version: Python 2.7
#-------------------------------------------------------------------------------
import json, ... |
import os
import sys
from django.contrib.messages import constants as messages
from geotrek import __version__
from . import PROJECT_ROOT_PATH
def gettext_noop(s):
return s
DEBUG = False
TEMPLATE_DEBUG = DEBUG
TEST = 'test' in sys.argv
VERSION = __version__
ADMINS = (
('Makina Corpus', 'geobi@makina-corp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**templates_outliner.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Defines the :class:`TemplatesOutliner` Component Interface class.
**Others:**
"""
from __future__ import unicode_literals
import os
import platform
import re
import sys
if... |
# -*- encoding: utf-8 -*-
from flask_script import Command, Option
from lbtasks.tasks import (spawn_character_tasks, spawn_universe_tasks,
task_purge)
class ManualCeleryTasks(Command):
""" Manually trigger task spawner for celery.
Arguments:
-c|--character: triggers charac... |
from base import Device
import math as math
class SectorBendingMagnet(Device):
def __init__(self, nomenclature="", width=0., height=0., length=0., angle=0.):
Device.__init__(self, nomenclature, width, height, length)
self.angle = angle
def __repr__(self):
r = str(self) + "("
... |
# coding: utf-8
from __future__ import print_function, absolute_import, division, unicode_literals
"""
You cannot subclass bool, and this is necessary for round-tripping anchored
bool values (and also if you want to preserve the original way of writing)
bool.__bases__ is type 'int', so that is what is used as the ba... |
import re
from vdw.raw.management.subcommands.load import LoadCommand
from vdw.raw.utils.stream import PGCopyEditor
valid_date_re = re.compile('\d{4}-\d{2}-\d{2}')
class HGNCGeneParser(PGCopyEditor):
def process_column(self, idx, value):
if not value:
value = None
elif idx == 0:
... |
# -*- coding: utf-8 -*-
#
# This file is part of plotextractor.
# Copyright (C) 2015 CERN.
#
# plotextractor 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 optio... |
#!/usr/bin/env python
# Copyright (c) 2014, Robot Control and Pattern Recognition Group, Warsaw University of Technology
# 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 o... |
#!/usr/bin/env python
# *********************************************************************
# * Copyright (C) 2014 Luca Baldini (luca.baldini@pi.infn.it) *
# * *
# * For the license terms see the file LICENSE, distributed *
# * along ... |
from ereuse_devicehub.resources.account.role import Role
from ereuse_devicehub.resources.resource import ResourceSettings
from ereuse_devicehub.resources.schema import Thing
from ereuse_devicehub.security.perms import DB_PERMS
from ereuse_devicehub.validation.validation import ALLOWED_WRITE_ROLE
class Account(Thing):... |
# -*- coding:utf-8 -*-
# ========================================================== #
# File name: vgg_19.py
# Author: BIGBALLON
# Date created: 07/22/2017
# Python Version: 3.5.2
# Description: implement vgg19 network to train cifar10
# ========================================================== #
import t... |
"""
Perturbations
-------------
Module oriented to perform a perturbation of the system in order to carry out
with statistical testing of models.
The main function of this module is grouping functions which are able to
change the system to other statistically probable options in order to explore
the sample space.
TO... |
from __future__ import absolute_import, division, unicode_literals
from flask.ext.restful import reqparse
from sqlalchemy.orm import contains_eager, joinedload
from changes.api.base import APIView
from changes.constants import Status
from changes.models import Project, TestCase, Job, Source
class ProjectTestHistory... |
# Copyright (C) 2003-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation 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 IS" AND ... |
import numpy as np
import time
import sys
from multiprocessing import Pool
import room_impulse as rimp
#-----------------------------------------------------------------------------#
# Room Class #
#------------------------------------------------------... |
"""
WSGI config for djrt project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... |
##
##
## NOTE: Because the pure python dynamicserialize code does not
# have a means of accessing the DiscreteDefinition, this class
# is only really useful as a container for deserialized data
# from EDEX. I would not recommend trying to use it for anything
# else.
SUBKEY_SEPARATOR = '^'
AUXDATA_SEPARATOR = ':'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-21 18:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('account', '__first__'),
]
oper... |
# Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
# This collects a lot of quality and quality changes related code which was split between ContainerManager
# and the MachineManager and really needs to usable from both.
from typing import List
from UM.Application i... |
"""User interface to help test maya tool code. Will work from within Maya UI as
well as standalone and can be run from an external interpreter such as mayapy.
Example::
Todo:
"""
import os
import sys
from nw_tools.Qt import QtWidgets, QtGui, QtCore
from nw_tools.ui.tools import get_maya_window, SuperWindow
import run... |
import json
import pprint
import time
import datetime
import django.core.serializers
from django.contrib.auth import *
from django.contrib.auth.decorators import *
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.serializers import geojson
from django.core import *
from django.http import *
from... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains the coordinate frames actually implemented by astropy.
Users shouldn't use this module directly, but rather import from the
`astropy.coordinates` module. While it is likely to exist for the long-term,
the... |
#!/usr/bin/env python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# 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 t... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Usage:
mazerunner.py -m <filename>
"""
import signal
import random
import curses
import time
import sys
import pdb
import os
import threading
import atexit
import locale
from docopt import docopt
locale.setlocale(locale.LC_ALL,"") # necessary to get curses to work w... |
# -*- coding: utf-8 -*-
from cms.utils.i18n import get_default_language
from django.conf import settings
from django.core.urlresolvers import reverse
from django.middleware.locale import LocaleMiddleware
from django.utils import translation
import re
import urllib
SUPPORTED = dict(settings.CMS_LANGUAGES)
HAS_LANG_PRE... |
# Copyright 2020 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 PB.go.chromium.org.luci.lucictx import sections as sections_pb2
DEPS = [
'assertions',
'context',
'path',
'step',
]
def RunSteps(ap... |
from lib.datasets import Cifar10 as Data
from lib.model import Model as BaseModel, generate_placeholders, train
from lib.segmentation import extract_features_fixed
# from lib.segmentation import slic_fixed
from lib.segmentation import quickshift_fixed
from lib.pipeline import preprocess_pipeline_fixed
from lib.layer im... |
import elink_api
import random
import sys
import logging
log = logging.getLogger("serial")
def echo_test(api):
"""Test API given instance by sending and receiving random data to/from echo stream endpoint"""
print 'testing echo endpoint'
api.rd_stream_all(elink_api.API_EP_ECHO)
n = 0
while True:
sz = random.rand... |
from .request import BoxRestRequest
from .upload import MultipartUploadWrapper
from .exceptions import BoxError, BoxHttpResponseError
class BoxSession(object):
"""Manage files and folder from Box.
When you instanciate this class you have to provide at least the Refresh Token (found with :class:`BoxAuthentica... |
# Copyright (C) 2006, 2007, 2008 One Laptop Per Child
#
# 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.
#... |
#!/usr/bin/env python3
##
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... |
# -*- coding: utf-8 -*-
import re
_REGEX = re.compile('^(?P<major>(?:0|[1-9][0-9]*))'
'\.(?P<minor>(?:0|[1-9][0-9]*))'
'\.(?P<patch>(?:0|[1-9][0-9]*))'
'(\-(?P<prerelease>[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?'
'(\+(?P<build>[0-9A-Za-z-]+(\.[... |
import logging
from django.shortcuts import render
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import pandas as pd
import numpy as np
import json
def fill_neighbors(series, radius):
n = series.shape[0]
... |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as publis... |
import scipy.optimize as opt
import numpy as np
def log_loss(p, stim, resp, order):
#get number of samples and dimensionality of stimulus
Nsamples, Ndim = stim.shape
resp = np.reshape(resp, (-1))
#unpack p: (var names match names in Fitzgerald paper)
a = p[0]
h = p[1:Ndim+1].T
#ca... |
#!/usr/bin/env python
# vim: set sw=2 ts=2 softtabstop=2 expandtab:
"""
Script to run a Symbooglix's AxiomAndEntryRequiresCheckTransformPass
pass on a set of boogie programs (from a program List) in preparation
for running a smoke test to check that all the assumptions leading to
an entry point are sati... |
import uuid
import datetime
from barking_owl import BusAccess
from api import add_document
def new_document_callback(payload):
"""
payload = {
'command': 'found_doc',
'source_id': '6eae01ff-ce21-4122-9f25-cb39455aa78e',
'destination_id': 'broadcast',
'mes... |
# vim: set ts=8 sts=2 sw=2 tw=99 et:
import re
import os, sys
import subprocess
argv = sys.argv[1:]
if len(argv) < 2:
sys.stderr.write('Usage: generate_headers.py <source_path> <output_folder>\n')
sys.exit(1)
SourceFolder = os.path.abspath(os.path.normpath(argv[0]))
OutputFolder = os.path.normpath(argv[1])
class... |
# Univeral Tool Template v011.0
tpl_ver = 10.2
tpl_date = 180220
print("tpl_ver: {0}-{1}".format(tpl_ver, tpl_date))
# by ying - https://github.com/shiningdesign/universal_tool_template.py
import importlib
import sys
# ---- hostMode ----
hostMode = ''
hostModeList = [
['maya', {'mui':'maya.OpenMayaUI', ... |
# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from __future__ import annotations
from concurrent.futures import Future
import aqt
from aqt.qt import *
from aqt.utils import showText, tooltip
def on_progress(mw: aqt.main.AnkiQt) -> Non... |
#!/usr/bin/python2.4
"""Tests for autotest_lib.scheduler.drones."""
import cPickle
import common
from autotest_lib.client.common_lib import utils
from autotest_lib.client.common_lib.test_utils import mock, unittest
from autotest_lib.scheduler import drones
from autotest_lib.server.hosts import ssh_host
class Remot... |
"""Create a Doubly linked list."""
class Node(object):
"""Create node to push into Doubly link list."""
def __init__(self, value=None, next_node=None, previous_node=None):
"""Create node to push into Doubly link list."""
self.value = value
self.next_node = next_node
self.previ... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
import configparser
from enum import Enum
import logging
import argpars... |
from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
import json
from taskifier import const
from taskifier.models import Task, TaskOwner
from taskifier.internal.TaskPayloadHelper import TaskPayloadHelper
def DELETE(task_owner, task_id):
task = _get_task_by_id(task_id)
if task... |
"""Settings for testing zinnia"""
import os
from zinnia.xmlrpc import ZINNIA_XMLRPC_METHODS
SITE_ID = 1
USE_TZ = True
STATIC_URL = '/static/'
SECRET_KEY = 'secret-key'
ROOT_URLCONF = 'zinnia.tests.implementions.urls.default'
LOCALE_PATHS = [os.path.join(os.path.dirname(__file__), 'locale')]
PASSWORD_HASHERS = [
... |
from se34euca.lib.EucaUITestLib_Base import *
import time
class EucaUITestLib_Instance(EucaUITestLib_Base):
def test_ui_gotopage_running(self):
print
print "Started Test: GotoPage Running"
self.click_element_by_id("euca-logo")
print
print "Test: Received the Page Title -... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lice... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Related to AboutOpenClasses in the Ruby Koans
#
from runner.koan import *
class AboutMonkeyPatching(Koan):
class Dog(object):
def bark(self):
return "WOOF"
def test_as_defined_dogs_do_bark(self):
fido = self.Dog()
self... |
"""Odlcs view."""
from PIL import Image
import io
import json
import logging
import os
import os.path
import re
from auvsi_suas.models.gps_position import GpsPosition
from auvsi_suas.models.mission_config import MissionConfig
from auvsi_suas.models.odlc import Odlc
from auvsi_suas.proto import interop_admin_api_pb2
fro... |
# coding=utf-8
import datetime
import mongomock
import pytz
import twisted
from bson import ObjectId
from faker import Faker
from mock import mock, call
from twisted.internet import reactor
from mdstudio.db.cursor import Cursor, query
from mdstudio.db.exception import DatabaseException
from mdstudio.db.fields import... |
import sys
from distutils.util import strtobool
from django.db import transaction
from django.db.utils import IntegrityError
from django.core import serializers
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.... |
#From the spec (and a few more)
pointers = [('xpointer(id("list37")/item)',
'xpointer(id("list37")/child::item)'),
('xpointer(id("list37")/item[1]/range-to(following-sibling::item[2]))',
'xpointer(id("list37")/child::item[1]/range-to(following-sibling::item[2]))'),
('... |
class ADMM_method():
import numpy as np
def __init__(self, A, b, mu, init_iteration, max_iteration, tol):
self.A = A
self.AT = self.A.T
self.b = b
self.m, self.n = self.A.shape
self.mu = mu
self.init_iteration = init_iteration
self.max_iteration = max_iteration
self.tol = tol
self.AAT = np.dot(self... |
# -*- coding: utf-8 -*-
# Code by Yinzo: https://github.com/Yinzo
# Origin repository: https://github.com/Yinzo/SmartQQBot
from QQLogin import *
from Configs import *
from Msg import *
class Pm:
def __init__(self, operator, ip):
assert isinstance(operator, QQ), "Pm's operator is not a QQ"
... |
from django.core.exceptions import ValidationError
from django.db.models import URLField
from django.utils.translation import ugettext_lazy as _
from fluent_contents.plugins.oembeditem import backend
class OEmbedUrlField(URLField):
"""
URL Field which validates whether the URL is supported by the OEmbed provi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ecnet/tasks/tuning.py
# v.3.3.2
# Developed in 2020 by Travis Kessler <travis.j.kessler@gmail.com>
#
# Contains functions/fitness functions for tuning hyperparameters
#
# stdlib. imports
from multiprocessing import set_start_method
from os import name
# 3rd party impo... |
import os
from setuptools import setup, find_packages
import good_practice_examples as app
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
dependency_links = [
# needs this dev version for django 1.6 fixes
'https://gi... |
'''Base table class.'''
import abc
class DatabaseError(Exception):
'''Any database error.'''
class NotFound(DatabaseError):
'''Item not found in the table.'''
class BaseURLTable(object, metaclass=abc.ABCMeta):
'''URL table.'''
@abc.abstractmethod
def count(self):
'''Return the number ... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.external_interface import ExternalInterfaceFunctionalMockupUnitExportToSchedule
log = logging.getLogger(__name__)
class TestExternalInterfaceFunctionalMockupUnitExportToSchedule... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
"""
URLResolver Addon for Kodi
Copyright (C) 2016 t0mm0, tknorris
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 late... |
from cassandra.cluster import Cluster
from cassandra.query import BatchStatement
from old.project import PagedResultHandler
class CassandraInsert:
def __init__(self, cluster=None, session=None, cluster_name=None):
self.cluster_name = cluster_name or 'twitter_resumed'
self.cluster = cluster or Clu... |
# coding=utf-8
from __future__ import absolute_import, division, print_function
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
im... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Red Hat, 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 applicab... |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apac... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class SessionGroup(models.Model):
""" The session group. In most cases it will be section.
"""
title = models.CharField(
max_length=80,
verbose_name=_(u'title'),
unique=True,
... |
# -*- coding: utf-8 -*-
import random
import string
import urllib
import urlparse
from django import http
from django.conf import settings
from django.core.urlresolvers import reverse
def make_nonce(length=10, chars=(string.letters + string.digits)):
"""Generate a random nonce (number used once)."""
re... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pwn import *
context(arch='amd64', os='linux', aslr=True, terminal=['tmux', 'neww'])
if args['GDB']:
elf, libc = ELF('./zone-amd64-2.23-0ubuntu9'), ELF('libs/amd64/2.23/0ubuntu9/libc-2.23.so')
io = gdb.debug('./zone-amd64-2.23-0ubuntu9', gdbscript='''\
... |
# coding: utf-8
# Imports
from app.models import *
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
class FGroupeUtilisateur(forms.ModelForm) :
# Champ
util = forms.ModelMultipleChoiceField(
label = 'Utilisateurs composant le groupe',
queryset = TUtilis... |
from __future__ import absolute_import
from . import Category, Question, Range
class MainHelper(object):
@classmethod
def save_filtered_data(cls, quiz, data):
"""
filter out & save the posted data to match our required schema for each quiz step
"""
step = data['step']
... |
import os, sys, datetime
import countershape
from countershape import Page, Directory, PythonModule, markup, model
import countershape.template
sys.path.insert(0, "..")
from libmproxy import filt, version
MITMPROXY_SRC = os.environ.get("MITMPROXY_SRC", os.path.abspath(".."))
ns.VERSION = version.VERSION
if ns.options... |
# -*- coding: utf-8 -*-
"""Random Forest Regression for machine learning.
Random forest algorithm is a supervised classification algorithm. As the name
suggest, this algorithm creates the forest with a number of decision trees.
In general, the more trees in the forest the more robust the forest looks like.
In the sam... |
"""
Support for RESTful binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.rest/
"""
import logging
from blumate.components.binary_sensor import (BinarySensorDevice,
SENSOR_CLASSES)... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013-2015 clowwindy
#
# 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... |
#MenuTitle: Create .ssXX glyph from current layer
# -*- coding: utf-8 -*-
__doc__="""
Takes the currently opened layers and creates new glyphs with a .ssXX ending.
Checks if the name is free.
"""
import GlyphsApp
Font = Glyphs.font
FirstMasterID = Font.masters[0].id
allGlyphNames = [ x.name for x in Font.glyphs ]
sel... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python considers any map or collection as JSON elements. 'Serializing/DeSerializing' them is VERY easy
Read:
- json.load(data_file) --> Loads an object from a File
- json.loads(json_as_string) --> Loads an object from a string representing a JSON object
Write:
- json.d... |
import math
from timeit import Timer
def solve_p10_sieve():
return sum(sieve_primes_up_to(2000000))
def solve_p10_sieve_w_generator():
return sum(prime_sieve_generator(2000000))
def sieve_primes_up_to(num):
num_list = list(range(num))
num_list[1] = 0 # cross out 1, special case
i = 2
while ... |
#!/usr/bin/python
# copyright (c) 2014 wladimir j. van der laan
# distributed under the mit software license, see the accompanying
# file copying or http://www.opensource.org/licenses/mit-license.php.
'''
run this script from the root of the repository to update all translations from
transifex.
it will do the following... |
'''
Etendard v0.4 - Copyright 2012 James Slaughter,
This file is part of Etendard v0.4.
Etendard v0.4 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... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
import numpy as np
from cluster import *
from sklearn import manifold
from plot_utils import *
def plot_rho_delta(rho, delta):
'''
Plot scatter diagram for rho-delta points
Args:
rho : rho list
delta : delta list
'''
logger.info("PLOT: rho-delta... |
# jhbuild - a build script for GNOME 1.x and 2.x
# Copyright (C) 2001-2006 James Henstridge
# Copyright (C) 2003-2004 Seth Nickell
#
# buildscript.py: base class of the various interface types
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... |
# orm/descriptor_props.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Descriptor properties are more "auxiliary" properties
that exist as confi... |
import csv
from structures import *
import os
import yaml
import xml.etree.ElementTree as ET
from scheduler import *
from time import strftime, gmtime
from weakref import ref
from datetime import date, time as time_obj
import constraint
from Tkinter import Tk
from tkMessageBox import showinfo
def course_has_all_attri... |
import sys
import re
# Temporary solution for string/unicode in py2 vs py3
if sys.version >= '3':
basestring = str
class TypedList(list):
"""Strongly typed list
All elements of the list must be one of the given types.
Attributes:
init - initial values
types - allowed types
n... |
'''
Copyright (C) 2013 Travis DeWolf
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 distributed in the hope t... |
'''wrapper class for Trello REST API'''
import requests
import yaml
import datetime
BASE = "https://api.trello.com/1/"
class Trello():
def __init__(self, project=None, username=None, password=None):
self._key = None
self._token = None
self._authorize()
if project:
self._board = self.setProject(project)
... |
# coding: utf-8
import sqlite3
import os
import time
import bottle
from bottle import default_app, route, view
from bottle import request
from bottle_utils.i18n import I18NPlugin
#from bottle_utils.i18n import lazy_gettext as _
#todo: refactor so that there is no error in Py3 local deployment and testing
import inpu... |
# -*- coding: utf-8 -*-
#
# PySyncObj documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 17 17:25:17 2016.
#
# 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 file.
#
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.