src stringlengths 721 1.04M |
|---|
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
#coding: iso-8859-1
## Copyright 2005 Luc Saffre
## This file is part of the Lino project.
## Lino 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) a... |
#!/usr/bin/env python3
#
#===- format_diff.py - Diff Reformatter ----*- python3 -*--===#
#
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===-----------------------------... |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: search.py
# Purpose: Contains all Request Handlers relating to generic search
# functions
#
# Author: Andre Wiggins
#
# Created: 04/07/2011
# Copyright: (c) Jacob Marsh, And... |
import pytest
from awx.main.access import (
RoleAccess,
UserAccess,
TeamAccess)
from awx.main.models import Role, Organization
@pytest.mark.django_db
def test_team_access_attach(rando, team, inventory):
# rando is admin of the team
team.admin_role.members.add(rando)
inventory.read_role.member... |
# project
from db_file_storage.storage import DatabaseFileStorage
def delete_file_if_needed(instance, filefield_name):
"""
When editing and the filefield is a new file,
delete the previous file (if any) from the database.
Call this function immediately BEFORE saving the instance.
"""... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... |
# uArm Swift Pro - Python Library Example
# Created by: Richard Garsthagen - the.anykey@gmail.com
# V0.1 - June 2017 - Still under development
import uArmRobot
import time
#Configure Serial Port
serialport = "com5" # for windows
#serialport = "/dev/ttyACM0" # for linux like system
# Connect to u... |
from PyQt4.QtCore import Qt
import PyQt4.QtGui as qtgui
from CutSlider import CutSlider
from Parameters import Parameters
from view.ModelView import ModelView
class MainWindow(qtgui.QMainWindow):
def __init__(self, **kwargs):
super(MainWindow, self).__init__(**kwargs)
top_frame = qtgui.QFrame()
... |
from sentinels import NOTHING
from .api_object import APIObject
from .lazy_query import LazyQuery
class Test(APIObject):
def report_end(self, duration=NOTHING):
self.client.api.call_function('report_test_end', {'id': self.id, 'duration': duration})
def mark_skipped(self):
self.client.api.cal... |
# coding: utf-8
import unittest
from numeros_telefonicos import TelefonesFixos
class TestTelefonesFixos(unittest.TestCase):
def test_verificar_quantidade_digitos_fornecidos(self):
# Devem haver no máximo 10 Dígitos, considerando DDD + Tipagem Fixo
# + Número. ex: xx [2-5] xxxxxxx
# Testa... |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
version = __import__('linguist').__version__
root = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(root, 'README.rst')) as f:
README = f.read()
setup(
name='django-linguist',
version=version,
description... |
from django.core.management.base import BaseCommand, CommandError
from jsonschema import validate
from proso_configab.models import Experiment, Variable, PossibleValue, ExperimentSetup
from datetime import datetime
from django.db import transaction
import os
import json
class Command(BaseCommand):
def add_argume... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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 ... |
#!/usr/bin/env python
#coding: utf-8
import mongokit
from mongokit import Document, Connection
from mongokit.document import DocumentProperties
from bson.objectid import ObjectId
from misc.config import MONGO_CONFIG, DB
_iterables = (list, tuple, set, frozenset)
mongo = Connection(**MONGO_CONFIG)
class CallableMi... |
# -*- coding: utf-8 -*-
"""Additional pyflakes"""
# :copyright: (c) 2012-2016 by Ask Solem.
# :license: BSD, see LICENSE for more details.
from __future__ import absolute_import
from __future__ import with_statement
VERSION = (1, 1, 0)
__version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:])
__author__ =... |
"""
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 this ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @name : Infoga - Email Information Gathering
# @url : http://github.com/m4ll0k
# @author : Momo Outaadi (m4ll0k)
from lib.output import *
from lib.request import *
from lib.parser import *
class Google(Request):
def __init__(self,target):
Request.... |
import datetime
import functools
import hashlib
import random
import bitly_api
import jinja2
from django.conf import settings
from django.template.loader import get_template
from django.utils.encoding import smart_str
from django.utils.translation import ugettext, ungettext
from django_jinja import library
from taggit... |
# -*- coding: utf-8 -*-
import re
from django.db.models import Count, FieldDoesNotExist
from tcms.management.models import Product
COUNT_DISTINCT = 0
QUERY_DISTINCT = 1
ACCEPTABLE_BOOL_VALUES = ('0', '1', 0, 1, True, False)
def parse_bool_value(value):
if value in ACCEPTABLE_BOOL_VALUES:
if value is ... |
import concurrent.futures as futures
import grpc
import time
import ProtoConfig
import generated.proto_out.dao_pb2 as dao_pb2
import generated.proto_out.dao_pb2_grpc as dao_grpc
from pylibs.Database import Mongo
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Dao(dao_grpc.DaoServicer):
def __init__(self, sensor_db):
... |
"""
__name__ = settings.py
__author__ = Yash Patel
__description__ = Settings file for the accuracy predictor plot
"""
# NOTE: All the below paths are relative to the starting directory of
# gem5, since this is the default behavior for gem5 execution
# --------------------------- Sim Params -------------------------... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from warnings import catch_warnings
from datetime import datetime, date, timedelta, time
from pandas.compat import map, zip, range, lrange, lzip, long
from pandas import compat
from numpy import nan
from numpy.random import randn
import pytest
import nu... |
# coding: utf8
{
'!langcode!': 'hu',
'!langname!': 'Magyar',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'%s %%{row} deleted': ... |
from flask.ext.wtf import Form, TextField, BooleanField, TextAreaField
from flask.ext.wtf import Required, Length
from flask.ext.babel import gettext
from frmwk.model.mdUser import User
class EditForm(Form):
nickname = TextField('nickname', validators = [Required()])
about_me = TextAreaField('about_me', valid... |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Thread monitor action
Shows the current traceback of all threads.
@copyright: 2006 MoinMoin:AlexanderSchremmer
@license: GNU GPL, see COPYING for details.
"""
import os, time
from StringIO import StringIO
from MoinMoin import Page, wikiutil
from MoinMoin.ut... |
import os
from tests.base import mock
import testtools
from jenkins_jobs import utils
def fake_os_walk(paths):
"""Helper function for mocking os.walk() where must test that manipulation
of the returned dirs variable works as expected
"""
paths_dict = dict(paths)
def os_walk(top, topdown=True):
... |
from setuptools import setup, Extension
classifiers = ['Development Status :: 3 - Alpha',
'Operating System :: POSIX :: Linux',
'License :: OSI Approved :: Apache Software License',
'Intended Audience :: Developers',
'Programming Language :: Python :: 2.7',
... |
################################################################
#
# Albow - Tab Panel
#
################################################################
from pygame import Rect
from widget import Widget
from theme import ThemeProperty, FontProperty
from utils import brighten
class TabPanel(Widget):
# pages ... |
import csv
import datetime
import os
import random
import shutil
import string
import zipfile
from typing import Iterable, List, Dict
from cleo import Command
from lxml import etree
from kerapu.style.KerapuStyle import KerapuStyle
class TestShredderCommand(Command):
"""
Converteert XML-bestand met de testse... |
# 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 GetCharactersCharacterIdMailLabelsForbidden(object):
"... |
import os
import spyral
from .sprites import sprite
from . import collision
WIDTH = 1200
HEIGHT = 900
WHITE = (255, 255, 255)
SIZE = (WIDTH, HEIGHT)
GREEN = (60, 179, 113)
RED = (255, 0, 0)
BLACKBLUE = (19, 15, 48)
BG_COLOR = BLACKBLUE
ENEMYGAP = 30
XMARGIN = 175
YMARGIN = 100
MOVEX = 15
MOVEY = 20
ENEMYSIDE = 50
BA... |
from .riq_obj import RIQObject
from .riq_base import RIQBase
from .listitems import ListItems
from .listitem import ListItem
# TODO: Add version, externalId, category
# TODO: Payload exception if missing required fields
class List(RIQObject,RIQBase) :
# Object Attributes
_id = None
_modifiedDate = None
... |
import pytest
import re
def test_java(host):
cmd = host.run('. /etc/profile && java -version')
assert cmd.rc == 0
m = re.search('(?:java|openjdk) version "([0-9]+)', cmd.stderr)
assert m is not None
java_version = m.group(1)
assert '11' == java_version
def test_javac(host):
cmd = host.ru... |
# This file is part of the Juju GUI, which lets users view and manage Juju
# environments within a graphical interface (https://launchpad.net/juju-gui).
# Copyright (C) 2013 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public Lice... |
# Copyright 2013 Netherlands eScience Center
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
# words.py
def main():
try:
#txt = open("test_1.txt")
#txt = open("test_2.txt")
#txt = open("test_3.txt")
txt = open("test_4.txt")
#target = input("Enter characters (spaces will be ignored): ")
#target = "cluuud IN DeD 23*"
target = "NSCRT - oooe+*"
except OSError:
print("OSError: Cannot find th... |
from .. import TwoHaloTerm, DampedGalaxyPowerTerm
from . import SOCorrection
class PcAcB_2h(TwoHaloTerm):
"""
The 2-halo term for `PcAcB`
"""
name = 'PcAcB_2h'
def __init__(self, model):
super(PcAcB_2h, self).__init__(model, 'b1_cA', 'b1_cB')
class PcAcB(DampedGalaxyPow... |
from django.db import migrations
import utilities.fields
import utilities.ordering
def _update_model_names(model):
# Update each unique field value in bulk
for name in model.objects.values_list('name', flat=True).order_by('name').distinct():
model.objects.filter(name=name).update(_name=utilities.order... |
import os.path
import shutil
import textwrap
import pytest
from pip._internal.cli.status_codes import ERROR
from tests.lib.path import Path
def fake_wheel(data, wheel_path):
shutil.copy(
data.packages.joinpath('simple.dist-0.1-py2.py3-none-any.whl'),
data.packages.joinpath(wheel_path),
)
@... |
from flask import Flask, render_template, redirect, url_for, flash, abort, send_file
import json
from datetime import datetime
import subprocess
from picamera.exc import PiCameraMMALError
from .robotdriver import DirError
from .utils import sys_info
from .camera import capture_img
app = Flask(__name__)
a... |
#!/usr/bin/env python
import time
import sys
import threading
import queue
import collections
from foos.bus import Bus
class Pattern:
def __init__(self, time, leds=[]):
self.time = time
self.leds = leds
def flatten(l):
for el in l:
if isinstance(el, collections.Iterable):
... |
import pandas as pd
import folium.folium as folium
import itertools
import numpy as np
import logging
import geojson as gj
import copy
import attrdict as ad
from functional import seq
# import emission.analysis.classification.cleaning.location_smoothing as ls
import bson.json_util as bju
import emission.storage.decor... |
#-------------------------------------------------------------------------------
# $Id$
#
# Project: EOxServer <http://eoxserver.org>
# Authors: Fabian Schindler <fabian.schindler@eox.at>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2011 EOX IT Services GmbH
#
# Per... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Speaker.email'
db.add_column(u'pyconkr_speaker', 'email',... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
#!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name='django-mptt',
description='''Utilities for implementing Modified Preorder Tree Traversal
with your Django Models and working with trees of Model instances.''',
version=__import__('mptt').__version__,
author='Craig ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
#
# This program is free software:... |
from collections import defaultdict
import json
from django.conf import settings
from django.db import connection
from specifyweb.specify.models import (
Splocalecontainer as Container,
Splocalecontaineritem as Item,
Splocaleitemstr as SpString)
schema_localization_cache = {}
def get_schema_localization... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (C) 2006-2008 Inmaculada Luengo Merino, Néstor Arocha Rodríguez
#This file is part of pyrqt.
#
#pyrqt 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; eithe... |
# -*- coding: utf-8 -*-
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <developers@taskcoach.org>
Copyright (C) 2008 Rob McMullen <rob.mcmullen@gmail.com>
Copyright (C) 2008 Thomas Sonne Olesen <tpo@sonnet.dk>
Task Coach is free software: you can redistribute it and/or modif... |
#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
##This file is part of PyVot
#############################################################################
#############################################################################
## ##
## ... |
# Copyright 2017 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... |
import jupytext
import nbformat
import papermill as pm
import pytest
def save_and_execute_notebook(nb_str, path):
nb = jupytext.reads(nb_str, fmt='py:light')
nb.metadata['kernelspec'] = {
'name': 'python3',
'language': 'python',
'display_name': 'Python 3'
}
nbformat.write(nb, ... |
#joliebulle 3.6
#Copyright (C) 2010-2016 Pierre Tavares
#Copyright (C) 2012-2015 joliebulle's authors
#See AUTHORS file.
#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 Li... |
"""
Implementation of the Colella 2nd order unsplit Godunov scheme. This
is a 2-dimensional implementation only. We assume that the grid is
uniform, but it is relatively straightforward to relax this
assumption.
There are several differen... |
"""Support for the Locative platform."""
import logging
from homeassistant.core import callback
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.config_entry import (
DeviceTrackerEntity
)
from homeassistant.helpers.dispatcher import async_dispatcher_... |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from .base import BaseCase
class HrExpensePayableAccount(BaseCase):
# Check value account_id
# Condition :
# journal_id == True
# default_credit_account == True
# home_ad... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as _plt
class DraggableLegend:
def __init__(self, legend):
self.legend = legend
self.gotLegend = False
legend.figure.canvas.mpl_connect('motion_notify_event', self.on_motion)
legend.figure.canvas.mpl_connect('pick_ev... |
# import_export_batches/controllers_batch_process.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import create_batch_row_actions, import_data_from_batch_row_actions
from .models import ACTIVITY_NOTICE_PROCESS, API_REFRESH_REQUEST, \
AUGMENT_ANALYTICS_ACTION_WITH_ELECTION_ID, AUG... |
class ResumeXmlHandler(xml.sax.ContentHandler):
def __init__(self):
self.node = ''
self.params = {}
self.error = None
def startElement(self, name, attrs):
self.node = name
def endElement(self, name):
self.node = ''
... |
from .protocol import *
import PyQt5
class Camera:
def __init__(self, camera_dict):
self.name = camera_dict['n']
self.address = camera_dict['a']
def __str__(self):
return '{} [{}]'.format(self.name, self.address)
def __repr__(self):
return self.__str__()
@protocol(area=... |
from __future__ import annotations
from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import TypeVar, Generic, Optional, Final
from pkg_resources import iter_entry_points, DistributionNotFound
__all__ = ['PluginT', 'Plugin']
#: The plugin type variable.
PluginT = TypeVar('PluginT')
cla... |
import numpy as np
import tensorflow as tf
# Declare list of features, we only have one real-valued feature
def model(features, labels, mode):
# Build a linear model and predict values
W = tf.get_variable("W", [1], dtype=tf.float64)
b = tf.get_variable("b", [1], dtype=tf.float64)
y = W*features['x'] + b
# Los... |
#!/usr/bin/python
#Force Totumduino Reset
import RPi.GPIO as GPIO
import time,sys
import serial
import ConfigParser
import logging
config = ConfigParser.ConfigParser()
config.read('/var/www/fabui/python/config.ini')
trace_file=config.get('macro', 'trace_file')
response_file=config.get('macro', 'response_file')
log... |
# -*- 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 'Translation'
db.create_table('blogs_translation', (
('id', self.gf('django.db.mo... |
from __future__ import absolute_import, print_function, division
import unittest
from pony.orm.core import *
db = Database('sqlite', ':memory:')
class Male(db.Entity):
name = Required(unicode)
wife = Optional('Female', column='wife')
class Female(db.Entity):
name = Required(unicode)
hus... |
from django import template
from django.contrib.auth.models import Group
from organization.models import GroupCategory, Role
import re
register = template.Library()
def roles_for_user_in_group(user, group):
return Role.objects.filter(membership__user=user, membership__group=group)
def phone_number_format(number... |
#!/usr/bin/python
# Find examples of a movement
# Copyright 2015 Daniel McDonald, All rights reserved
# ============================================================================
from __future__ import print_function
from __future__ import division
import csv
import datetime
import glob
import numpy as np
import os
i... |
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from biohub.core.plugins import plugins
from bio... |
""""""
from typing import Dict, List, Set
from copy import copy
from collections import defaultdict
from vnpy.trader.object import (
LogData, ContractData, TickData,
OrderData, TradeData,
SubscribeRequest, OrderRequest
)
from vnpy.event import Event, EventEngine
from vnpy.trader.engine import BaseEngine, ... |
from theHarvester.lib.core import *
import re
class TakeOver:
def __init__(self, hosts):
# NOTE THIS MODULE IS ACTIVE RECON
self.hosts = hosts
self.results = ""
self.totalresults = ""
self.proxy = False
# Thank you to https://github.com/EdOverflow/can-i-take-over-x... |
from __future__ import division, unicode_literals, absolute_import
import ctypes
from tabulate import tabulate
#from ctypes import *
from ctypes import cdll
from ctypes import c_float, byref
import numpy as np
import traceback, os, sys, datetime, glob, copy
from siman import header
from siman.header import print_... |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... |
from twisted.words.protocols import irc
from txircd.modbase import Command
from txircd.utils import irc_lower
from fnmatch import fnmatch
class ListCommand(Command):
def onUse(self, user, data):
chancache = []
for channame, channel in self.ircd.channels.iteritems():
if data["chanfilter"... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# isomeasurer.py
# ALS 2017/06/01
import os
import astropy.units as u
from astropy.io import fits
import numpy as np
import astropy.table as at
import pickle
import scipy.ndimage as simg
from ..measurer import Measurer
from ... import tabtools
from . import polytools
from . import plottools
class isoMeasurer(Measur... |
from numpy import *
from functions import sigmoid
set_printoptions(precision=4)
class RTF():
'''
Recurrent Basis/Transformation Function
---------------------------------------
Turn x into \phi in a recurrent manner.
'''
W_hh = None
W_ih = None
z = None
def __init__(... |
################################################################################
# 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... |
#!/bin/env python
from __future__ import absolute_import
__author__ = "Gina Haeussge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The RaionPi Project - Released under terms of the AGPLv3 License"
import errno
import subp... |
"""
Adapt/extend autotest.client.test.test for Docker test sub-framework
Implement docker subtest base to avoid circular dependences in dockertest core
modules.
"""
# Pylint runs from a different directory, it's fine to import this way
# pylint: disable=W0403
import logging
import traceback
from xceptions import Dock... |
# coding: utf-8
from sqlalchemy import Column, Integer, String, Boolean, Text, text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class User(Base):
__tablename__ = 'users'
Id = Column(Integer, primary_key=True)
Username = Column(String(12, u'ut... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import base64
from PIL import Image, ImageDraw, ImageFont
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
from braces.view... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
import os
import base64
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.render("sample.html")
def post(self):
image_name = self.get_argument("name", "")
image_data = s... |
"""MagicHelper - dockable widget showing magic commands for the MainWindow
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
#-----------------------------------------------------------------------------
# Imports
#------------------------------------------------... |
"""
Implement CourseTab
"""
from abc import ABCMeta
import logging
from xblock.fields import List
from openedx.core.lib.api.plugins import PluginError
log = logging.getLogger("edx.courseware")
# Make '_' a no-op so we can scrape strings. Using lambda instead of
# `django.utils.translation.ugettext_noop` because Dja... |
"""
@created_at 2014-07-19
@author Exequiel Fuentes <efulet@gmail.com>
@author Brian Keith <briankeithn@gmail.com>
"""
# Se recomienda seguir los siguientes estandares:
# 1. Para codificacion: PEP 8 - Style Guide for Python Code (http://legacy.python.org/dev/peps/pep-0008/)
# 2. Para documentacion: PEP 257 - Docst... |
# tk/graphics.py
# by John M. Zelle, Ph.D
# edited by Rushy Panchal
"""Simple object oriented graphics library
The library is designed to make it very easy for novice programmers to
experiment with computer graphics in an object oriented fashion. It is
written by John Zelle for use with the book "Python Programming: ... |
"""Module provides higher level system tests."""
# Copyright (C) 2014 Bradley Alan Smith
import unittest,time,datetime
import sys
import config_cloud as cfg
sys.path.append('../')
from core.pg.datatypes import *
target = 'rest'
if target == 'local':
import core.cloud as cc
cloud = cc.Cloud(cfg.user)
elif... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
from __future__ import with_statement
import log... |
"""Script that formats substitution matrices obtained from NCBI
This folder contains substitution matrices (mostly PAM and BLOSUM) used by
NCBI's BLAST tool. Data was obtained from
ftp://ftp.ncbi.nih.gov/blast/matrices/ on 2/14/16.
* PAM matrices - in two formats: PAM{n} and PAM{n}.cdi. N ranges from 10 to
500 in ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 18 20:12:11 2020
@author: dougl
"""
import os
import pandas as pd
from utils import col_alpha_to_num, col_num_to_alpha
def parse_data(data, feature_cols=None, unique_col=None):
''' Ensures we're dealing with a pandas DataFrame, and cuts the frame down
to only t... |
"""
Copyright (c) 2016 Keith Sterling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,... |
#!/usr/bin/env python
from time import sleep
import sys
sys.argv.append( '-b' )
import tutils
import ROOT as r
import IPython
import argparse
import os
import fnmatch
from configobj import ConfigObj
import eval_string
from tqdm import tqdm
from tabulate import tabulate
from string import atoi
from string import at... |
import inspect
from inspect import Parameter
import logging
from ray.utils import is_cython
# Logger for this module. It should be configured at the entry point
# into the program using Ray. Ray provides a default configuration at
# entry/init points.
logger = logging.getLogger(__name__)
# This dummy type is also de... |
# Copyright (c) 2015 Thales Services SAS
# 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 i... |
'''
Test functions for handling star formation rates
'''
import numpy as np
from scipy.integrate import odeint
import sfrs as SFR
def IntegrationTest():
''' Simple test the integration
'''
logsfr = lambda mstar, t: np.log10(t**2)
for tt in np.arange(1., 11., 1.):
M_int = SFR.integ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------
# Copyright (c) 2013 Pablo Caro. All Rights Reserved.
# Pablo Caro <me@pcaro.es> - http://pcaro.es/
# ProgressBar.py
# ---------------------------------------------------
import sys
class ProgressBar:
... |
# Project Euler Problem 22
# Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.