src stringlengths 721 1.04M |
|---|
import random
from collections import namedtuple
from . import environment
import os
# TODO Resolve for information <===> state.. unneccessary confusion
class BlackJack(environment.AbstractGame):
def __init__(self):
self.action_space = ['hit', 'stay']
super(BlackJack, self).__init__('blackjack')
... |
"""Tests related to Posts."""
import pytest
from remotes.models import Source
from ..models import Job, Post
def test_post_list(admin_group_client, post):
"""Simple test for the posts list page."""
response = admin_group_client.get('/jobs/post-list/')
assert response.status_code == 200
def test_post_l... |
from flask import Flask, jsonify, render_template
from flask_restful import Api
from resource.concept import ConceptResource, ConceptResourceByID
from resource.tag import TagResource, TagResourceByID, TagResourceByValue
from resource.object import ObjectResource, ObjectResourceByID
from resource.blob import BlobResour... |
from django.db import connection
claim_to_polygon_join = """
LEFT OUTER JOIN ctracker_polygon_organizations ON (houses.polygon_id = ctracker_polygon_organizations.polygon_id)
LEFT OUTER JOIN ctracker_organization ON (ctracker_polygon_organizations.organization_id = ctracker_organization.id)
LEFT OU... |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Haltu Oy, http://haltu.fi
#
# 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 withou... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import base64
from concurrent.futures import ThreadPoolExecutor
from django.core import mail
from . import base
class DjangoConnection(base.BaseConnection):
def __init__(self, loop, conf, **kwargs):
super().__init__(**kwargs)
self.loop = loop
self.executor = ThreadPoolExecutor(max_worker... |
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------
# Copyright 2021 Arm Limited
#
# 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 ... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... |
#!/usr/bin/env python3
import argparse, select, socket, sys, termios, time
from dts import config
from dts.protocol import Packet, PacketParser
class Console:
NORMAL, LOCK, WAIT = range(3)
def __init__( self, tab, command ):
self.state = Console.NORMAL
self.value = None
self.__line = '... |
from ckan_api_client.tests.utils.diff import diff_mappings, diff_sequences
def test_diff_dicts():
dct1 = {
'one': 'VAL-1',
'two': 'VAL-2',
'three': 'VAL-3',
'four': 'VAL-4',
'five': 'VAL-5',
}
dct2 = {
'three': 'VAL-3',
'four': 'VAL-4-2',
'fi... |
#!/usr/bin/python -OO
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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, e... |
import unittest
import numpy as np
import tensorflow as tf
from neural_network_decision_tree import tf_kron_prod, tf_bin, nn_decision_tree
class TestNeuralNetworkDecisionTree(unittest.TestCase):
def test_tf_kron_prod(self):
sess = tf.InteractiveSession()
a = np.array([[1, 2],
... |
# 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
# distrib... |
#%% Libraries
import numpy as np
import root_funcs as rf
#%% predict_linear class (Module for Process_Node - Predict)
class predict_linear(object):
__lookup_dict = {
'beta_init': {
'zeros': ('Cluster_Control.Cluster_IO.Predict_Cluster.beta_init', 'beta_zeros')
},
'learn_rate... |
from PyQt5.QtWidgets import QUndoCommand
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
class ZeroHideAction(QUndoCommand):
def __init__(self, protocol: ProtocolAnalyzer, following_zeros: int, view: int, zero_hide_offsets: dict):
super().__init__()
self.protocol = protocol
... |
# -*- coding: utf-8 -*-
import random
import time
import sys
import os
import re
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import utils
def delete_image(image):
import time
time.sleep(10)
os.remove(image)
def tag_clean(tag_html):
text = tag_html.t... |
"""blogproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
# put this into ~/.alphahub/config.py and make sure it's not
# readable by anyone else (it contains passwords!)
# the host we run on and want to receive packets on; note
# that "localhost" is probably the wrong thing here, you
# want a host name that refers to an external network so you
# can receive packets from the ... |
# import pygame
import threading
import drumExMachina
class Fasade:
"""
Matrix
-> reproducir()
-> pausar()
-> salir()
-> volumen-general()
-> tempo()
-> figura()
-> agregar-pista()
-> quitar-pi... |
from flask import Blueprint, jsonify, abort, request
from kasparGUI.Web.api.database import db_session
from kasparGUI.Web.api.interactionManager import InteractionManager
import kasparGUI.Model as Model
__interactionLog = Blueprint('interaction.log', __name__)
blueprints = [
__interactionLog,
... |
"""
Django settings for MyCV project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6.1/ref/settings/
"""
import os
from configurations import Configuration, values
class Common... |
"""
forkmap -- Forking map(), uses all processors by default.
Connelly Barnes 2008, public domain. Based on forkmap by Kirk Strauser, rewritten and optimized. Version 1.0.2.
"""
import os, mmap, marshal, struct, cPickle
import ctypes, ctypes.util
import time, traceback
builtin_map = map
def nprocessors():
try:... |
import time
import Queue
import os
import sys
import random
import traceback
import socks
import socket
import json
import util
from bitcoin import *
import interface
from blockchain import Blockchain
DEFAULT_PORTS = {'t':'50001', 's':'50002', 'h':'8081', 'g':'8082'}
DEFAULT_SERVERS = {
'electrum-pkb.net': DEFA... |
# Status: ported.
# Base revision: 64488.
# Copyright 2003 Dave Abrahams
# Copyright 2002, 2003 Rene Rivera
# Copyright 2002, 2003, 2004, 2005 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Defines... |
#!/usr/bin/env python3
bufferpath = "../../python/signalProc"
fieldtripPath="../../dataAcq/buffer/python"
import os, sys, random, math, time, socket, struct
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),bufferpath))
import bufhelp
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(_... |
import json
import collections
from .mixins import ConfigMixin
from .defaults import *
class ConfigManager(object):
"""
The config manager has the responsibility of persisting plugin configs.
On initialisation it creates a default file structure in the user's home directory
"""
FILE_EXT = '.json'
... |
""" Diventi URL Configuration """
import debug_toolbar
from django.urls import include, path
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import gettext_lazy as _
fro... |
# This file is part of Shoop Wintergear Demo.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shoop.addons import add_enabled_addons
import os
BASE_DIR = os.path.realpath(
... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
# -*-coding: utf-8 -*-
import colander
from . import(
ResourceSchema,
BaseForm,
BaseSearchForm,
BaseAssignForm,
)
from ..resources.foodcats import FoodcatsResource
from ..models.foodcat import Foodcat
from ..models.task import Task
from ..models.note import Note
from ..lib.qb.foodcats import Foodcats... |
import re
from xml.dom.minidom import parseString
dir = 'E:\\programming\\Node\\POESkillTree\\'
f = open(dir + "MonsterStats.html", "rb")#html file from http://pathofexile.gamepedia.com/Monster_Experience
def fixUnclosedTags(content):
return re.sub('(\<img [^>]*?)/?\>', '\g<1> />', content).replace('<br>', '<br... |
#
# File : mkdir.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
#
# 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 th... |
# Copyright 2016 Nick Boultbee
#
# 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.
from datetime import datetime
from url... |
import numpy as np
__author__ = "Nelson Ponzoni"
__copyright__ = "Copyright 2015-2016, Proyecto Final de Carrera"
__credits__ = ["Nelson Ponzoni"]
__license__ = "GPL"
__version__ = "20160101"
__maintainer__ = "Nelson Ponzoni"
__email__ = "npcuadra@gmail.com"
__status__ = "Production"
"""
Neurons class, this is abstra... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
# Copyright (c) 2013 Johan Ceuppens.
# All rights reserved.
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# dis... |
"""
Define settings and constants
"""
from os import access, path, R_OK
APIS = ['health', 'clusterstate', 'clusterstats', 'nodeinfo', 'nodestats']
NODETYPES = ['cluster', 'coordinating', 'master', 'data', 'ml', 'ingest']
FILEPATHS = [
path.join(path.expanduser('~'), '.es_stats_zabbix', 'config.yml'),
path.j... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import collections
import datetime
import hashlib
import pytz
import threading
import re
import requests
from lxml import etree
from random import randint
from werkzeug import urls
from odoo import api, f... |
# Generated by Django 2.2.8 on 2020-01-04 13:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bom', '0030_auto_20200101_2253'),
]
operations = [
migrations.AlterField(
model_name='partrevision',
name='height_un... |
import sys
import os
import glob
import argparse
from subprocess import call
from bounding_box import BoundingBox
import json
import itertools
import utils
# common functions
def match_multiple_sift_features(tiles_file, features_file, index_pairs, jar, out_fname, conf_args):
tiles_url = utils.path2url(os.path.a... |
# Copyright 2015 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... |
"""
Created on 2 Apr 2018
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
WARNING: Path methods require that the __HOST field must be instantiated.
example document:
{"endpoint": "endpoint.iot.us-west-2.amazonaws.com", "client-id": "bruno", "cert-id": "9f08402232"}
"""
import os
from collections import ... |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetKillmailsKillmailIdKillmailHashInternalServerError(obje... |
'''
Music Generator Web Application
Copyright (C) 2016 Keiwan Donyagard
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 any later version.
This program is distrib... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from celery import Celery
from raven.contrib.celery import CeleryFilter, register_signal
from raven.handlers.logging import SentryHandler
def create_celery(app, name=None):
celery = Celery(name or app.name, broker=app.config['CELERY_BROKER_URL'])
for k in app.conf... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'tempel.db'
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
TIME_ZONE = 'Asia/Jakarta'
LANGUAGE_CODE = 'en'
SITE_ID = 1
USE_I18N = False
import os
MEDIA_ROOT = os.path.j... |
import cv2
import numpy as np
import os
import re
#############################################
#
# Gray magic:
# - the value of "C"
# - the value of "gamma"
# - the functions "preprocess*"
#
C = 20
gamma = 0.0005
#
# blurring image
#
def preprocess1(data):
img = cv2.GaussianBlur(data, (5... |
# -*- coding: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
from __future__ import absolute_import
from __future__ import unicode_literals
import urllib
import xbmcgui
from kodi65 import utils
from kodi65 import addon
from kodi65 i... |
#!/usr/bin/env python
from __future__ import print_function
class build_log():
def append(self, c):
print(c,end="")
def message(self, c):
print(c)
def percent(self, i):
print(i)
class error_printer():#error_stream
def __init__(self, log):
self.log=log
self.errors = 0
self.context = "<untitled>"
d... |
#!/usr/bin/env python2
"""
Author :Julio Sanz
Website :www.elarraydejota.com
Email :juliojosesb@gmail.com
Description :Script to create a graph about swap usage
Dependencies :Python 2.x, matplotlib
Usage :python swap.py
License :GPLv3
"""
import matplotlib
matplotlib.use('Agg')
im... |
################################################################################
# Description: Module containing various critic implementations
# Author: Pierpaolo Necchi
# Email: pierpaolo.necchi@gmail.com
# Date: dom 05 giu 2016 18:24:01 CEST
########################################################... |
from setuptools import setup, find_packages
import os
here = os.path.abspath(os.path.dirname(__file__))
def read_file(path_segments):
"""Read a file from the package. Takes a list of strings to join to
make the path"""
file_path = os.path.join(here, *path_segments)
with open(file_path) as f:
... |
import json
from django.test import TestCase
from django.core.management import call_command
from django.core.management.base import CommandError
from ..models.parameters import Schema
class DumpSchemasTestCase(TestCase):
def setUp(self):
self.schema1 = Schema(
namespace='http://www.example... |
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from pyvirtualdisplay import Display
from collections import OrderedDict
from selenium import webdriver
from tabulate import tabulate
from copy import deepcopy
import subprocess
import shutil
import json
import time
import sys
import os
def get_versio... |
"""
birthday.py
Author: Andreas
Credit: Dan, Payton, tiggerntatie
Assignment:
Your program will ask the user the following questions, in this order:
1. Their name.
2. The name of the month they were born in (e.g. "September").
3. The year they were born in (e.g. "1962").
4. The day they were born on (e.g. "11").
If ... |
# Copyright 2014 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 flakytests
from webkitpy.common.checkout.scm.scm_mock import MockSCM
from webkitpy.layout_tests.layout_package import bot_test_expectations
from webk... |
# ------------------------------------------------------------------------------
# Name: plot_cg_ppi_example.py
# Purpose: show a few examples on how to use wradlib.vis.plot_cg_ppi
#
# Author: Kai Muehlbauer
#
# Created: 25.02.2014
# Copyright: (c) Kai Muehlbauer 2014
# Licence: The MI... |
import numpy as np
import deepautoencoder.utils as utils
import tensorflow as tf
allowed_activations = ['sigmoid', 'tanh', 'softmax', 'relu', 'linear']
allowed_noises = [None, 'gaussian', 'mask']
allowed_losses = ['rmse', 'cross-entropy']
class StackedAutoEncoder:
"""A deep autoencoder with denoising capability"... |
# Copyright 2014 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.
from slave import recipe_api
PATCH_STORAGE_RIETVELD = 'rietveld'
PATCH_STORAGE_GIT = 'git'
PATCH_STORAGE_SVN = 'svn'
class TryserverApi(recipe_api.Recip... |
# -*- coding: utf-8 -*-
import os
import pygame
from thorpy.elements.browserlight import BrowserLight
from thorpy.elements._explorerutils._pathelement import PathElement
from thorpy.elements.element import Element
from thorpy.elements.inserter import Inserter
from thorpy.elements.ddlf import DropDownListFast
from tho... |
# Copyright 2012 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... |
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from os.path import exists, join
import sh
class LibsodiumRecipe(Recipe):
version = '1.0.16'
url = 'https://github.com/jedisct1/libsodium/releases/download/{version}/libsodium-{version}.tar.gz'
depends = []
patches = ['s... |
# 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 ... |
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from Singleton import *
from Instructions import Instructions
from OwnBoard import BaseOwnBoard
from BoardFunctions import *
from SendPackage import *
from kivy.lang import Builder
Builder.load_string('''
<B... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under th... |
try:
import json
except ImportError:
import simplejson as json
def parse(input):
"""Parse specified file or string and return a FamilyTree object created from it."""
if hasattr(input, "read"):
data = json.load(input)
else:
data = json.loads(input)
return FamilyTree(data)
clas... |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... |
from __future__ import print_function
from __future__ import division
from RndUtil import Random
from pdb import set_trace
from MscUtil import Params, Customer
rand = Random()
rand.set_seed(seed_val=1729)
"""
Why 1729?
Well, it is a very interesting number.
It is the smallest number expressible as the sum of two posi... |
#!/usr/bin/env python
### From:
### https://gist.github.com/sontek/1508912
__all__ = [
'set_printer',
'set_symbols',
'set_flake_symbols',
'set_currency_symbols',
'set_animation',
'make_it_snow',
]
import os
import random
import time
import platform
snowflakes = {}
_PRINTER = print
_SYMBOL... |
# -*- coding: utf-8 -*-
#
# 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 -*-
# aptirepo - Simple APT Repository Tool
# Copyright (C) 2013,2014,2015 Opinsys
#
# 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... |
"""
Tests basic API operations against simple test data.
"""
from rest_framework.test import APITestCase
from rest_framework import status
from django.urls import reverse
from sites.models import Site, Scan
from urllib.parse import urljoin
urlroot = reverse('api-root-v1')
def create_site():
"""
Make an examp... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.misc import parse_size
from module.plugins.internal.SimpleHoster import SimpleHoster
class SpeedvidNet(SimpleHoster):
__name__ = "SpeedvidNet"
__type__ = "hoster"
__version__ = "0.01"
__pattern__ = r"https?://(?:\w*\.)*(?P<DOMAIN>speedvid\... |
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
def generate_key_pair(username):
private_key = RSA.generate(2048)
public_key = private_key.publickey()
return private_key.exportKey(), public_key.exportKey()
class RSAVerifier(object):
def __init__(se... |
__author__ = """N. Cullen <ncullen.th@dartmouth.edu>"""
from pyBN.classes.factor import Factor
from pyBN.classes.factorization import Factorization
from pyBN.utils.graph import *
from copy import deepcopy, copy
import numpy as np
import json
def exact_bp(bn, target=None, evidence=None, downward_pass=False):
"""
... |
import boto.ec2
import sys
import unittest
import urllib3
from mock import Mock, patch
from collections import namedtuple
from patroni.scripts.aws import AWSConnection, main as _main
class MockEc2Connection(object):
@staticmethod
def get_all_volumes(*args, **kwargs):
oid = namedtuple('Volume', 'id')... |
from copy import deepcopy
import os
import sys
import versioneer
if sys.version_info[0] < 3:
import __builtin__ as builtins
else:
import builtins
try:
import numpy
except ImportError as e:
raise ImportError("cyflann requires numpy to be installed:\n{}".format(e))
# Don't do this in the setup() req... |
from __future__ import absolute_import, unicode_literals
import datetime
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils.datastructures import SortedDict
from .models import TestObject, Order, RevisionableModel
class ExtraRegressTests(TestCase):
def setUp(self):
... |
#-----------------------------------------------------------
#
# QGIS setting manager is a python module to easily manage read/write
# settings and set/get corresponding widgets.
#
# Copyright : (C) 2013 Denis Rouzaud
# Email : denis.rouzaud@gmail.com
#
#-------------------------------------------------------... |
############################################################################
# /T /I #
# / |/ | .-~/ #
# T\ Y I |/ / _ #
# /T... |
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
import time
import networkx as nx
from Functions import buildGraph, cost, updatePheromone, isSolution, \
buildSaturatedGraph, sensTotal
import Ant
import sys
def runExperiment(samples, scenario1, tau_min, tau_max):
g, numPaths, numSol... |
#!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2018 Thomas Voegtlin
#
# 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 withou... |
import random
import pygame
from koon.geo import Vec2D
import koon.geo as geo
from koon.gfx import SpriteFilm, Font, LoopAnimationTimer, PingPongTimer, Timer
from koon.res import resman
import pickups
import event
import tiles
class PickupView:
def __init__( self ):
self.pos = None
self.jump_pos... |
# -*- coding: utf-8 -*-
# This file is part of Dyko
# Copyright © 2008-2010 Kozea
#
# This library 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 lat... |
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2019 Corrado Ubezio
#
# 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 r... |
#!/usr/bin/env python3.2
#
# Copyright (c) Net24 Limited, Christchurch, New Zealand 2011-2012
# and Voyager Internet Ltd, New Zealand, 2012-2013
#
# This file is part of py-magcode-core.
#
# Py-magcode-core is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gener... |
#!/usr/bin/env python
# http://sccommerce.com/sc-industrial-directory
import requests
import requests_cache
from pprint import pprint
from bs4 import BeautifulSoup
from lib.csvtools import dict_to_csv
def main():
# This page has a search form that must be submitted to get the list of companies.
# To post da... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
clean_html,
determine_ext,
ExtractorError,
int_or_none,
parse_duration,
try_get,
url_or_none,
)
from .dailymotion import Dailymotion... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("base", "0009_migrate_user_to_gouser"),
)
def forwards(self, orm):
# Changing field 'Account.user'
... |
'''
Copyright (c) 2017 Yogesh Khatri
This file is part of mac_apt (macOS Artifact Parsing Tool).
Usage or distribution of this software/code is subject to the
terms of the MIT License.
'''
import logging
import sqlite3
import struct
from os import path
from plistutils.alias import AliasParser
from pl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
"""
This is an equivalent of a C++ program trying to load a
Python module using libqi, but written in Python.
"""
from __fu... |
#!/usr/bin/env python
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
"""
Implementation of a FileEditor demo plugin for Traits UI demo program.
This demo shows each of the four styles of the FileEditor
"""
# Imports:
from traits.api \
import HasTraits, File
from traitsui.api \
import Item, G... |
from datetime import datetime
from django.core.urlresolvers import reverse, reverse_lazy
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
from django.utils.encoding import smart_str
from tagging.fields import TagField
from markdown import markdown
class Cate... |
from google.appengine.ext import db
from django import forms
from django.utils.translation import ugettext_lazy as _
class TransitTypeProperty(db.IntegerProperty):
"""
Transit Type Property - Storage of transit type
"""
def __init__ (self,*args,**kwargs):
kwargs["choices"] = range(0,8) ... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio-JSONSchemas errors."""
from __future__ import absolute_import, print_func... |
import argparse
import os
import numpy
def compute_mean_std(X):
mean_train = numpy.mean(X, axis=0)
std_train = numpy.std(X, axis=0)
# print mu_train.shape, std_train.shape
return mean_train, std_train
def parse_args():
parser = argparse.ArgumentParser(
description='Compute mean and std ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... |
"""
"""
# Native
import time
import pprint
import json
from collections import OrderedDict
# 3rd-Party
from sqlalchemy import Table, Column, ForeignKey, Integer, String, Boolean, Float
from sqlalchemy.orm import relationship, backref
import pydash
#
from request import Request
from models.model import Model
class... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.