src stringlengths 721 1.04M |
|---|
#
#
# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list ... |
#-------------------------------------------------------------------------------
#
# This file is part of pylibgimpplugin.
#
# Copyright (C) 2014 khalim19 <khalim19@gmail.com>
#
# pylibgimpplugin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... |
import os
from os.path import dirname, exists, isdir, join, splitext
import base64
import hmac
import hashlib
import json
import boto3
import tempfile
import re
import tornado.ioloop
import tornado.web
from tornado.options import define, options
from datetime import datetime as dt
import yaml
from notify import post_t... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Call'
db.create_table('football365_call', (
('id', self.gf('django.db.models.fie... |
import pathlib
import supriya.osc
from supriya.commands.Request import Request
from supriya.commands.RequestBundle import RequestBundle
from supriya.enums import RequestId
class SynthDefLoadDirectoryRequest(Request):
"""
A /d_loadDir request.
"""
### CLASS VARIABLES ###
__slots__ = ("_callback"... |
"""
.. module: lemur.plugins.lemur_kubernetes.plugin
:platform: Unix
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
The plugin inserts certificates and the private key as Kubernetes secret that
can later be used to secure service endpoin... |
# Copyright 2016 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... |
# -*- coding: UTF-8 -*-
"""Module for enhancing virtualenv preimport.
"""
import os
import re
import site
import sys
import virtualenv
from importlib import import_module
from pip._internal.cli.main_parser import parse_command
from pip._internal.exceptions import PipError
from shutil import rmtree
from six import stri... |
from itertools import islice
from math import log
from random import choice, randrange
from ..core import Basic
from ..functions import factorial
from ..ntheory import sieve
from ..utilities import has_variety
from ..utilities.iterables import is_sequence, uniq
from ..utilities.randtest import _randrange
from .permuta... |
#!/usr/bin/env python3
import sys, os
from PyQt5.QtWidgets import QApplication, qApp, QFileDialog,\
QTableWidgetItem as _t
from PyQt5.uic import loadUi
from PyQt5.QtGui import QIcon
from PyQt5 import QtCore
from inhx import Inhx8
from utils import functions as fn
from utils.pk2usb import Pk2USB
from gui import ... |
from bokeh.layouts import column
from bokeh.models.widgets import Div
from dashboard.bokeh.plots.descriptors.table import Table
from dashboard.bokeh.plots.descriptors.title import Title
from qlf_models import QLFModels
import logging
from bokeh.resources import CDN
from bokeh.embed import file_html
logger = logging... |
import function
from matplotlib.pyplot import *
from pylab import *
import numpy as np
import math
class TrapecioComp:
def __init__(self, fun, xi, xf,n):
self.fun = function.Function(fun,'x')
self.a,self.b = xi,xf
self.n = n
self.fig, self.ax = subplots()
def relativeError(self):
f = self.fun.getDerivate(... |
#!/usr/bin/env python
'''Wraps common operations on settings and environmental variables needed
during build.
'''
import os
_DEF_OPEN_TREE_VERSION = '0.0.1'
_build_env_var_list = ['OPEN_TREE_USER_SETTINGS_DIR',
'OPEN_TREE_INSTALL_DIR',
'OPEN_TREE_VERSION',
... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import random
def convert_sci(nombre):
nombre_sci='%.4E' %(nombre)
nombre_sci=nombre_sci.split('E')
base=nombre_sci[0]
exposant=nombre_sci[1]
nombre=float(base)*(10**int(exposant)) #on reformate le nombre pour ne conserver que 4 chifres signi... |
# Author : globalpolicy
# Date : March 2-4, 2017
# Script : pyWall
# Description : Change windows wallpaper
# Python : 3.5
# Blog : c0dew0rth.blogspot.com
import requests
from bs4 import BeautifulSoup
import random
import shutil # for copying raw image data(a file-like object) to an actual image file
i... |
# coding=utf-8
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
STATUS_OPEN = 0
STATUS_ON_HOLD = 1
STATUS_BELATED = 2
STATUS_RESOLVED = 3
STATUS_CLOSED = 4
PRIORITY_LOW = 0
PRIORITY_NORMAL = 1
PRIORITY_HIGHT = 2
PERMISSION_CAN_ASSIGNED = "can_assign... |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.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 Foundatio... |
def add_hg_segment():
import os
import subprocess
env = {"LANG": "C", "HOME": os.getenv("HOME")}
def get_hg_status():
has_modified_files = False
has_untracked_files = False
has_missing_files = False
try:
output = subprocess.check_output(['hg', 'status'], e... |
#!/usr/bin/env python
'''
Copyright (C) 2005 Carsten Goetze c.goetze@tu-bs.de
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 __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# Hack for local models
import os, sys
sys.path.append(os.getcwd())
from ADSDeploy.models import Base
try:
from ADSDeploy.local_config import SQLALCHEMY_URL
except... |
"""
=====
SMOTE
=====
An illustration of the SMOTE method and its variant.
"""
# Authors: Fernando Nogueira
# Christos Aridas
# Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License: MIT
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.decomposition imp... |
#!/usr/bin/env python3
# grouping algorithms for images and videos
# PixPack Photo Organiser
import re
import os
def group_by_dates(date_meta, destination, pattern='ym'):
# generate folder name by using basic date informations
# available patterns: yr=2017, ym=2017-03, ss=summer
# exif date format -> 2006... |
# -*- coding: utf-8 -*-
"""
Speech
"""
from .base import AipBase
from .base import base64
from .base import hashlib
from .base import json
class AipSpeech(AipBase):
"""
Aip Speech
"""
__asrUrl = 'http://vop.baidu.com/server_api'
__ttsUrl = 'http://tsn.baidu.com/text2audio'
def _isP... |
# -*- coding: utf-8 -*-
import django.contrib.postgres.fields
from django.db import migrations, models
import maasserver.fields
class Migration(migrations.Migration):
dependencies = [("maasserver", "0007_create_node_proxy_models")]
operations = [
migrations.AlterField(
model_name="bloc... |
'''
Created on 15-Oct-2016
@author: kabanus
'''
from collections import UserDict
class Primitive(object):
def __eq__(self,other):
return self.val == other
def __repr__(self):
return str(self)
def __str__(self):
return str(self.val)
class... |
# Copyright 2016 Pavle Jonoski
#
# 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... |
import json
import re
import httpretty
from analyticsclient.constants import activity_types, data_formats, demographics
from analyticsclient.exceptions import NotFoundError, InvalidRequestError
from analyticsclient.tests import ClientTestCase
class CoursesTests(ClientTestCase):
def setUp(self):
super(Co... |
"""
Operator classes for eval.
"""
from datetime import datetime
from distutils.version import LooseVersion
from functools import partial
import operator
from typing import Callable, Iterable, Optional, Union
import numpy as np
from pandas._libs.tslibs import Timestamp
from pandas.core.dtypes.common import is_list_... |
# -*- coding: utf-8 -*-
#
# oauth2client documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 17 23:13:19 2014.
#
import os
from pkg_resources import get_distribution
import sys
import mock
# See
# (https://read-the-docs.readthedocs.io/en/latest/faq.html#\
# i-get-import-errors-on-libra... |
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
import openerp.addons.decimal_precision as dp
from datetime import datetime
import re
class FakturPajakCommon(models.AbstractModel):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Audio recording using a microphone.
"""
# 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).
__all__ = ['Microphone']
import sys
import ps... |
from operator import itemgetter
import gym
from gym import spaces
from gym.utils import seeding
from .game import Game
from .card import Card
from .player import PlayerAction, PlayerTools
from .agents.random import AgentRandom
class LoveLetterEnv(gym.Env):
"""Love Letter Game Environment
The goal of hotter... |
#!/usr/bin/env python3
##
## Copyright (C) 2015 Simon Boyé
##
## This file is part of lair.
##
## lair 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 o... |
# -*- coding: utf-8 -*-
#
# Originally from django-otp 0.2.2:
# * django_otp/plugins/otp_hotp/tests.py
#
# Copyright (c) 2012, Peter Sagerson
# Copyright (c) 2014, 2015, Mark Lee
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... |
# coding: utf-8
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc & contributors.
#
# 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.a... |
#!/usr/bin/env python
#
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.cache import cache
from django.http import HttpRequest
from django.template import Template
from django.template.context import Context
from django.test import override_settings
from django.urls impor... |
#coding=utf-8
import string, random, time
from django.http import HttpResponseRedirect,HttpResponse,Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login,logout
from... |
from angr.errors import SimEngineError, SimMemoryError
from angr.analyses.bindiff import differing_constants
from angr import Analysis, register_analysis
import chain_builder
import gadget_analyzer
import common
import pickle
import inspect
import logging
import progressbar
from errors import RopException
from .rop_... |
# -*- coding: utf-8 -*-
"""
Wrapper around property builtin to restrict attribute to defined
integer value range (throws ValueError).
Intended to ensure that values packed with struct are in the
correct range
>>> class T(object):
... a = range_property('a',-100,100)
... b = B('b... |
from collections import namedtuple
from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT
def resolve_relation(model, app_label=None, model_name=None):
"""
Turn a model class or model reference string and return a model tuple.
app_label and model_name are used to resolve the scope o... |
"""Settings for an SVM-based citation extractor."""
import pkg_resources
from sklearn.svm import LinearSVC
# Sets debug on (=true) or off (=false)
DEBUG = False
POS = True
# leave empty to write the log to the console
LOG_FILE = ""
# list of directories containing data (IOB format with .iob extension)
DATA_DIRS = (
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Get data from file page
import os # get file path
import webbrowser # open webpages
import time # get unix code
import datetime # convert in unix timestamp
import urllib, json, io # read json
from urllib import urlopen # open file
import sys # r... |
from pyrsistent import freeze, inc, discard, rex, ny, field, PClass, pmap
def test_callable_command():
m = freeze({'foo': {'bar': {'baz': 1}}})
assert m.transform(['foo', 'bar', 'baz'], inc) == {'foo': {'bar': {'baz': 2}}}
def test_predicate():
m = freeze({'foo': {'bar': {'baz': 1}, 'qux': {'baz': 1}}})... |
# coding: utf-8
import binascii
import unittest
from gor.base import Gor
class TestCommon(unittest.TestCase):
def setUp(self):
self.gor = Gor()
def tearDown(self):
pass
def test_parse_message(self):
payload = binascii.hexlify(b'1 2 3\nGET / HTTP/1.1\r\n\r\n')
message =... |
import logging
from sqlalchemy import *
from kallithea.lib.dbmigrate.migrate import *
from kallithea.lib.dbmigrate.migrate.changeset import *
from kallithea.lib.dbmigrate.versions import _reset_base
log = logging.getLogger(__name__)
def upgrade(migrate_engine):
"""
Upgrade operations go here.
Don't cr... |
# -*- coding: utf-8 -*-
# from django.conf import settings
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
f... |
# -*- coding:utf-8 -*-
import json
from datetime import timedelta
from markdown2 import markdown
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.db.models import Max, Sum
from django.utils.timezone import now
from django.http import HttpRe... |
import Components.IComponent
import Infrastructure.PackageableElement
import PortInterface.IPort
class BaseComponent(Components.IComponent.IComponent, Infrastructure.PackageableElement.PackageableElement):
"""Represents the BaseComponent of the meta-model"""
def __init__(self, inpName):
super(BaseComp... |
"""Add another table to accompany your 'inventory' table called 'orders'. This table should have the following fields: 'make', 'model', and 'order_date'. Make sure to only include makes and models for the cars found in the inventory table. Add 15 records (3 for each car), each with a separate order date (YYYY-MM-DD). M... |
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs':[np.get_include()]}, inplace=True)
from _glrl_loop import _glrl_vector_loop
from profiling_tools import time
def glrl_vector_loop(image, direction, bin_width):
# convert pixel intensities into gray levels wi
bin_width = int(b... |
from pelican import signals
import re
import html5lib
RAW_FOOTNOTE_CONTAINERS = ["code"]
def getText(node, recursive = False):
"""Get all the text associated with this node.
With recursive == True, all text from child nodes is retrieved."""
L = ['']
for n in node.childNodes:
if n.nodeType i... |
from django.conf import settings
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
pass
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
import datet... |
#!/bin/env python
# Translated into python from C++ tutorial at
# http:#trac.openscenegraph.org/projects/osg/wiki/Support/Tutorials/Textures
from osgpypp import osg, osgDB, osgViewer
import sys
# Creating Textured Geometry using StateSets
# Goals
# Add a texture to geometry defined by OpenGL drawing primitives intr... |
#
# Manage registers in a hardware design
#
# Copyright (C) 2008 Donald N. Allingham
#
# 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... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 01:27:04 2013
@author: jsousa
"""
from scn import *
import os
#MAP = 'cubes'
#scn = CScn(MAP + '.scn')
ws = scn.solids[0]
verts = [[v.x,v.y,v.z] for v in ws.verts]
uvs = [[uv.u,uv.v] for uv in ws.uvs]
idxs = list(ws.vertidxs)
uvidxs = list(ws.uvidxs)
def exists(t... |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from ..payment_provider import BasePaymentProvider
from .tasks import process_pledge
from .app_... |
from PyQt4 import QtGui, QtCore
from acq4.pyqtgraph import PlotWidget
from acq4.devices.DAQGeneric import DAQGenericTaskGui
from acq4.util.SequenceRunner import runSequence
from acq4.pyqtgraph.functions import siFormat
from acq4.pyqtgraph.WidgetGroup import WidgetGroup
import taskTemplate
from acq4.util.HelpfulExceptio... |
#!/usr/bin/env python
"""
A feature extractor for chunking.
__author__ = linlin
"""
# Separator of field values.
separator = ' '
# Field names of the input data.
fields = 'y w pos token sem part pp p n nn nont'
# Attribute templates.
templates = (
(('w', -2), ),
(('w', -1), ),
(('w', 0), ),
(('w', ... |
# -*- test-case-name: wokkel.test.test_xmppim -*-
#
# Copyright (c) 2003-2009 Ralph Meijer
# See LICENSE for details.
"""
XMPP IM protocol support.
This module provides generic implementations for the protocols defined in
U{RFC 3921<http://www.xmpp.org/rfcs/rfc3921.html>} (XMPP IM).
All of it should eventually move ... |
#!/usr/bin/env python
import os
import sys
import glob
from os import path
import json
import docopt # http://pypi.python.org/pypi/docopt/
docstring = """
Manage LOCAL_TODO files.
In the default invocation, will create or move an existing LOCAL_TODO
file to a shared folder, then create a link to it in it's origi... |
# -*- 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... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from Perceptron import Perceptron
def plotRawData():
plt.scatter(X[:50, 0], X[:50, 1], color='red', marker='o', label='setosa')
plt.scatter(X[50:100, 0], X[50:100, 1], color='blue', marker='x', ... |
# este link es para asegurarse de que un usuario ingrese un numero entero y no un caracter
# https://mail.python.org/pipermail/python-es/2011-September/030635.html
# empresa_arranque_gana.py
seleccion_menu_uno = 5
# define the function blocks
def uno():
print("\nEsa opcion es correcta\n")
print "cliente categoria 1"... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
import pytest
from cfme import test_requirements
from cfme.configure.tasks import Tasks
from cfme.fixtures import pytest_selenium as sel
from cfme.infrastructure import host as host_obj
from cfme.infrastructure.provider import InfraProvider
from cfme.web_ui import DriftGrid, toolbar as tb
from... |
#! /usr/bin/env python
'''
processor_element.py
A patch element corresponding to a signal or control processor
'''
from gi.repository import Clutter
import cairo
from .patch_element import PatchElement
from .colordb import ColorDB
from .modes.label_edit import LabelEditMode
from ..gui_main import MFPGUI
from mfp impor... |
'''app.notify.tasks'''
import json, os, pytz
from os import environ as env
from datetime import datetime, date, time, timedelta
from dateutil.parser import parse
from bson import ObjectId as oid
from flask import g, render_template
from app import get_keys, celery #, smart_emit
from app.lib.dt import to_local
from app.... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright 2002-2005 Vladimir Prus.
# Copyright 2002-2003 Dave Abrahams.
# Copyright 2006 Rene Rivera.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import TestCmd
import copy
import fnmatch
import gl... |
"""
WSGI config for minimo 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`` s... |
from unittest import TestCase
from unittest.mock import Mock
from Schemes import Blueprint
from ItemStack import ItemStack
class TestProcess(TestCase):
def test_InitProcess(self):
scheme = Blueprint(0, "Name", 0, [ItemStack(0, 1)], ItemStack(0, 1))
process = Process(scheme)
assert process.inputs[0].ammount =... |
# Copyright 2014 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from __future__ import print_function
## 3D Lattice Boltzmann (BGK) model of a fluid.
## D3Q19 model. At each timestep, particle densities propagate
## outwards in the directions indicated in the figure. An
## equivalent 'equilibrium' density is found, and the densities
## relax towards that state, in a proportion gove... |
#
# The Python Imaging Library
# $Id$
#
# map CSS3-style colour description strings to RGB
#
# History:
# 2002-10-24 fl Added support for CSS-style color strings
# 2002-12-15 fl Added RGBA support
# 2004-03-27 fl Fixed remaining int() problems for Python 1.5.2
# 2004-07-19 fl Fixed gray/grey spelling ... |
import os, sys
import numpy as np
import pandas as pd
from pytrack_analysis import Node
from pytrack_analysis.array import rle
from pytrack_analysis.cli import colorprint, flprint, prn
"""
Classifier class: loads kinematics data and metadata >> processes and returns classification data
"""
class Classifier(Node):
... |
from .. import auth
from ..forms.login_form import LoginForm
from ..models.user import User
from ..errors import UserError
from flask import redirect, url_for, request, render_template
from flask.ext.login import login_user, logout_user, login_required
@auth.route('/login', methods=['GET', 'POST'])
def login():
re... |
# test_parser.py
# Try a few things with creating tokens which know the
# kind of token that should follow them.
import string, itertools
class token(object):
def __init__(self):
self.type = self.next = self.stmttype = None
self.attrdict = vars(self)
# Set an attribute
# NOTE! Thi... |
#!/usr/bin/env python
"""
This is an interface library for Hantek DDS-3X25 arbitrary waveform generator.
Licenced LGPL2+
Copyright (C) 2013 Domas Jokubauskis (domas@jokubauskis.lt)
Copyright (C) 2014 Tymm Twillman (tymmothy@gmail.com)
"""
import struct
import math
import collections
# dds3x25 imports...
from usb_int... |
# -*- coding: UTF-8 -*-
from django.db import models
from django import template
register = template.Library()
@register.tag
def get_objects(parser, token):
"""
Gets a queryset of objects of the model specified by app and model names
Usage:
{% get_objects [<manager>.]<method> from <app_name>.<m... |
#!/usr/bin/env python3
""" Solution by Andrei Regiani - https://regiani.xyz """
import sys
import doctest
def special_sort(line_input):
"""
>>> special_sort('1')
'1'
>>> special_sort('car truck bus')
'bus car truck'
>>> special_sort('8 4 6 1 -2 9 5')
'-2 1 4 5 6 8 9'
>>> special_so... |
# -*- encoding: utf-8 -*-
import collections
from supriya.tools import osctools
from supriya.tools.requesttools.Request import Request
class NodeFreeRequest(Request):
r'''A /n_free request.
::
>>> from supriya.tools import requesttools
>>> request = requesttools.NodeFreeRequest(
... ... |
import os
import time
import numpy as np
from chainer import cuda, Variable, function, FunctionSet, optimizers
from chainer import functions as F
class VAE_YZ_X(FunctionSet):
def __init__(self, **layers):
super(VAE_YZ_X, self).__init__(**layers)
def softplus(self, x):
return F.log(F.exp(x) ... |
# Django settings for logger project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psyco... |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... |
# Made by Emperorc
import sys
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from quests.SagasSuperclass import Quest as JQuest
qn = "87_SagaOfEvasSaint"
qnu = 87
qna = "Saga of Eva's Saint"
class Quest (JQuest) :
def __init__(self,id,name,descr):
... |
import sys
import setuptools
def read_long_description():
with open('README.rst') as f:
data = f.read()
with open('CHANGES.rst') as f:
data += '\n\n' + f.read()
return data
importlib_req = ['importlib'] if sys.version_info < (2,7) else []
argparse_req = ['argparse'] if sys.ver... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import gtk
import gobject
import appindicator
import os
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from subprocess import call, check_call
class SinkRadioMenuItem(gtk.RadioMenuItem):
def __init__(
self,
radioGroup,
label,
pa... |
from __future__ import print_function
import re
from streamlink import PluginError
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
from streamlink.utils import parse_json
from streamlink.plugin import PluginO... |
"""Compare predicted detector density to the detected number of particles
Errors on data:
- Scintillator transmission and PMT gain errors (relative error of ~70%).
- Error due to non linearity of the PMT curve.
- Poisson error on both in and output.
Bias:
- There may be a bias in the data, at low particle densities d... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... |
"""MaxwellBloch
MaxwellBloch is a Python package for solving the coupled Maxwell-Bloch equations
describing the nonlinear propagation of near-resonant light through thermal
atomic vapours.
"""
import os
import textwrap
from setuptools import setup, find_packages
import subprocess
DESCRIPTION = "A Python package f... |
class PriceDisagreementError(Exception):
pass
class DuplicateStreamHashError(Exception):
pass
class DownloadCanceledError(Exception):
pass
class RequestCanceledError(Exception):
pass
class InsufficientFundsError(Exception):
pass
class ConnectionClosedBeforeResponseError(Exception):
pas... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License... |
from collections import OrderedDict
import matplotlib.pyplot as plt
import numpy as np
from democritus.factories import SenderStrategyFactory, ReceiverStrategyFactory
from democritus.metrics import ExpectedUtilityMetric, SenderNormalizedEntropyMetric, ReceiverNormalizedEntropyMetric
class SimulationMetricConverter(... |
#!/usr/bin/python
'Nova Echo Trade Tool'
# Copyright (C) 2014 Tim Cumming
#
# 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 vers... |
from mock import patch
from race_code import race_code_globals
from . import FormulaPiTestCase
class TestFormula(FormulaPiTestCase):
def setUp(self):
# Capture all of the global defaults and reset them after we modify them with this code
# to keep sanity when running tests.
self.original_... |
#!/usr/bin/env python
import argparse
import logging
import os
import certificate
import acme
import parser
def main():
log = logging.getLogger(__name__)
log.addHandler(logging.StreamHandler())
log.setLevel(logging.INFO)
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--path", re... |
#!/usr/bin/python -t
# 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.
#
# This program is distributed in the hope that i... |
"""Provides the base class for Printers"""
from sympy.core.basic import Basic as SympyBasic
from sympy.printing.printer import Printer as SympyPrinter
from ..algebra.core.scalar_algebra import Scalar
from ..utils.indices import StrLabel
from .sympy import SympyStrPrinter
from ._render_head_repr import render_head_rep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.