code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
'''
This module provides a standard interface to extract,
format and print stack traces of Python programs.
It exactly mimics the behavior of the Python interpreter when it prints a stack trace.
This is useful when you want to print stack traces under program control,
such as in a “wrapper” around the interpreter.
The... | rolandovillca/python_introduction_basic | inspect_live_objects/traceback_example.py | Python | mit | 3,032 |
# Copyright (c) 2016 kamyu. All rights reserved.
#
# Google Code Jam 2016 Round 2 - Problem A. Rather Perplexing Showdown
# https://code.google.com/codejam/contest/10224486/dashboard#s=p0
#
# Time: O(2^N)
# Space: O(2^N)
#
def rather_perplexing_showdown():
N, R, P, S = map(int, raw_input().strip().split())
#... | kamyu104/GoogleCodeJam-2016 | Round 2/rather-perplexing-showdown.py | Python | mit | 914 |
from django.test import TestCase
from django.core.management import call_command
from wagtail.core.models import Site
from wagtailmenus.conf import settings
class TestAutoPopulateMainMenus(TestCase):
fixtures = ['test.json']
def setUp(self):
super().setUp()
# Delete any existing main menus an... | rkhleics/wagtailmenus | wagtailmenus/tests/test_commands.py | Python | mit | 2,079 |
#!/usr/bin/env python
# SPDX-License-Identifier: MIT
import auracle_test
class TestInfo(auracle_test.TestCase):
def testStringFormat(self):
r = self.Auracle(['info', '-F', '{name} {version}', 'auracle-git'])
self.assertEqual(0, r.process.returncode)
self.assertEqual('auracle-git r74.82e86... | falconindy/auracle | tests/test_custom_format.py | Python | mit | 2,076 |
#!/usr/bin/env python
'''
log2png.py : BreezySLAM Python demo. Reads logfile with odometry and scan data
from Paris Mines Tech and produces a .PNG image file showing robot
trajectory and final map.
For details see
@inproceedings{coreslam-2010,
author = {Bruno Ste... | rmeertens/BreezySLAM | examples/log2png.py | Python | lgpl-3.0 | 5,100 |
__author__ = 'Robert Meyer'
import logging
import random
import os
from pypet import pypetconstants
from pypet.environment import Environment
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest,\
TestOtherHDF5Settings2, multiply
from pypet.tests.testutils.ioutils import run_suite,... | nigroup/pypet | pypet/tests/integration/environment_multiproc_test.py | Python | bsd-3-clause | 14,747 |
import datetime
import prime
def main(gt):
i = 0
num = 0
while True:
i += 1
num += i
L = prime.resolve(num)
res = 1
for (a, b) in L:
res *= b + 1
if res > gt:
return num
try:
para = int(input())
except:
para = 500
beg = datet... | nowsword/ProjectEuler | p012.py | Python | gpl-3.0 | 435 |
class Resource():
def __init__(self, name, address):
self.name = name
self.address = address | open-iot-stack/open-iot-web | app/core/models/resource.py | Python | mit | 113 |
from __future__ import unicode_literals
from math import ceil
from django.db import IntegrityError, connection, models
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from django.utils.six.moves import range
from .models import... | DONIKAN/django | tests/delete/tests.py | Python | bsd-3-clause | 18,346 |
#! /usr/bin/python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class MyTable(QTableView):
def __init__(self, data, *args):
super(MyTable, self).__init__(*args)
#data = {'col1':['1', '2', QWidget()], 'col2':['4', '5', '6'], 'col3':['7', '8', '9']}
self.data = data
... | CospanDesign/python | pyqt/getting_started/spreadsheet2.py | Python | mit | 1,982 |
# -*- coding: utf-8 -*-
#
# TACA documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 17 12:39:41 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | senthil10/TACA | doc/conf.py | Python | mit | 10,525 |
# -*-coding:utf-8 -*
# Copyright (c) 2011-2015, Intel Corporation
# 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, thi... | krocard/parameter-framework | test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py | Python | bsd-3-clause | 11,048 |
import os
import sys
import time
import copy
import json
import warnings
from astropy.io import fits as pyfits
import numpy as np
from multiprocessing import Pool
warnings.filterwarnings("ignore")
__version__ = "2.4"
# parameters for generate synthetic SS objects
au_s = 3.0 # starting au
au_e = 40.0 # ending au
# i... | CFIS-Octarine/octarine | src/daomop/CFIS_Link_stacked.py | Python | gpl-3.0 | 16,061 |
import numpy as np
import util.options
import util.cache
import util.logging
import simulation.model.constants
class ModelOptions(util.options.Options):
OPTIONS = ('model_name', 'time_step', 'parameters', 'spinup_options', 'derivative_options', 'parameter_tolerance_options', 'initial_concentration_options')
... | jor-/simulation | simulation/model/options.py | Python | agpl-3.0 | 15,740 |
#!/usr/bin/env python
#
# Raspberry Pi Bipolar Stepper Motor test motor_class.py
# Author : Bob Rathbone
# $Id: test_bipolar_class.py,v 1.1 2014/03/04 11:57:53 bob Exp $
# Site : http://www.bobrathbone.com
#
import os
import time
import atexit
from bipolar_class import Motor
# Bipolar Motor BCM GPIO definitions
dire... | bobrathbone/pistepper | test_bipolar_class.py | Python | gpl-3.0 | 1,322 |
"""
Routes and views for the flask application.
"""
from datetime import datetime
from flask import render_template, redirect, session, request
from flask_sso import SSO
import filmsoc
from app import app
app.jinja_env.globals['filmsoc'] = filmsoc
app.jinja_env.globals['app'] = app
app.jinja_env.globals['session'] =... | WarwickFilmSoc/WWW-V4 | app/views.py | Python | gpl-3.0 | 1,323 |
import asyncio
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.storage import RedisDict
class TemporaryVoice:
"""A cog to create TeamSpeak-like voice channels."""
def __init__(self, liara):
self.liara = liara
self.config = RedisDict('pandentia.te... | Pandentia/Liara-Cogs | cogs/tempvoice.py | Python | mit | 3,721 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | edespino/gpdb | src/test/tinc/tincrepo/mpp/models/regress/mpp_tc/regress_mpp_test_case.py | Python | apache-2.0 | 6,282 |
import logging
import threading
from datetime import datetime, timedelta
log = logging.getLogger('pajbot')
class CachedValue:
"""Keep a value cached and update as needed."""
def __init__(self, duration=60, update_method=None, update_method_type='direct', update_method_args=()):
"""
Keyword a... | gigglearrows/anniesbot | pajbot/models/cachedvalue.py | Python | mit | 1,919 |
import os
import unittest
import ansigenome.constants as c
import ansigenome.test_helpers as th
import ansigenome.utils as utils
class TestExport(unittest.TestCase):
"""
Integration tests for the export command.
"""
def setUp(self):
self.test_path = os.getenv("ANSIGENOME_TEST_PATH", c.TEST_PA... | AlbanAndrieu/ansigenome | test/integration/test_export.py | Python | gpl-3.0 | 4,748 |
import logging
import time
import os
import collections
import threading
from unittest import TestCase
from typing import Tuple, List, Dict, Optional
from lib.localObjects import AlertLevel, SensorAlert, SensorDataType, SensorData, Option, Sensor, SensorDataGPS, \
SensorDataNone, SensorDataInt, SensorDataFloat
from... | sqall01/alertR | server/tests/alert/test_alert.py | Python | agpl-3.0 | 97,414 |
# -*- coding: utf-8 -*-
# © 2016 Alfredo de la Fuente - AvanzOSC
# © 2016 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp.addons.event_registration_analytic.tests.\
test_event_registration_analytic import TestEventRegistrationAnalytic
from openerp import ... | avanzosc/event-wip | event_planned_by_sale_line/tests/test_event_planned_by_sale_line.py | Python | agpl-3.0 | 12,754 |
"""Starts the MPF media controller."""
import argparse
import logging
import os
import socket
import sys
import threading
from datetime import datetime
import time
import errno
import psutil
from mpf.core.config_loader import YamlMultifileConfigLoader, ProductionConfigLoader
from mpf.commands.logging_formatters impor... | missionpinball/mpf_mc | mpfmc/commands/mc.py | Python | mit | 9,594 |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='keil'
# get setting from environment.
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
if CROSS_TOOL == 'g... | 52osworld/RealBoard4088 | software/rtthread_examples/examples/6_media_mp3/rtconfig.py | Python | gpl-2.0 | 3,433 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Testing module from creating product using
http://www.sendfromchina.com/default/index/webservice
"""
from flask import Flask, render_template, request
from flask_wtf.csrf import CSRFProtect
from werkzeug.datastructures import MultiDict
from forms import SFCCreateO... | dremdem/sfc_sdk | sfc_main.py | Python | mit | 4,144 |
#!/usr/bin/python3
import datetime
import json
import lxml.etree
import os
import requests
import sys
from simplejson.errors import JSONDecodeError as SimpleJSONDecodeError
try:
import logman
except ModuleNotFoundError:
sys.path.append('.')
sys.path.append('..')
import logman
try:
from scripts imp... | gasvaktin/gasvaktin | scripts/scraper.py | Python | mit | 17,684 |
import unittest
from katas.kyu_6.delete_nth_occurrence import delete_nth
class DeleteNthOccurrenceTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(delete_nth([20, 37, 20, 21], 1), [20, 37, 21])
def test_equals_2(self):
self.assertEqual(delete_nth([1, 1, 3, 3, 7, 2, 2, 2, ... | the-zebulan/CodeWars | tests/kyu_6_tests/test_delete_nth_occurrence.py | Python | mit | 379 |
#
#
# Copyright (C) 2008 Google Inc.
#
# 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 ... | wk8/neatx | lib/app/nxdialog.py | Python | gpl-2.0 | 7,233 |
import config
from server.db import session
from server.app_redis import redis
from server.project import Project
from server.data_sources import SqlalchemyData, PandasData
import pandas as pd
if config.data_type == 'csv':
df = pd.read_csv('~/data/movie-reviews.csv')
data = PandasData(df, df.columns)
elif con... | samzhang111/labeler | server/app_project.py | Python | gpl-3.0 | 487 |
# Copyright (C) 2009 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | loveyoupeng/rt | modules/web/src/main/native/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py | Python | gpl-2.0 | 7,113 |
# -*- coding: utf-8 -*-
'''
Mepinta
Copyright (c) 2011-2012, Joaquin G. Duo
This file is part of Mepinta.
Mepinta 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 opti... | joaduo/mepinta | core/python_core/mepinta/pipeline/hi/load_unload_library.py | Python | gpl-3.0 | 2,102 |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, types
from sqlalchemy.ext.mutable import Mutable
class DenormalizedText(Mutable, types.TypeDecorator):
"""
Stores denormalized primary keys that can be accessed as a set.
:param coerce: coercion function that ensures correct type is returned
:pa... | AdamBSteele/yournewhomepage | fbone/types.py | Python | bsd-3-clause | 1,893 |
# Copyright 2016, 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | soltanmm-google/grpc | src/python/grpcio/grpc/beta/_client_adaptations.py | Python | bsd-3-clause | 26,840 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/shapes.py
"""
core of the graphics library - defines Drawing and Shapes
"""
__version__=''' $Id: shapes.py,v 1.1 2006/05/26 19:19:37 tho... | tschalch/pyTray | src/lib/reportlab/graphics/shapes.py | Python | bsd-3-clause | 45,040 |
from uuid import uuid4
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
# Taken from mezzaine, Django < 1.5 compatability
# https://github.com/stephenmcd/mezzani... | ABASystems/django-lot | lot/models.py | Python | bsd-3-clause | 2,583 |
# -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_meta_data_statistic.py
# Description:
#
# Author: Shuai Yuan
# E-mail: ysh329@sina.com
# Create: 2015-12-21 21:04:53
# Last:
__author__ = 'yuens'
######################... | ysh329/Titanic-Machine-Learning-from-Disaster | Titanic/class_meta_data_statistic.py | Python | mit | 3,652 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-06 20:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0004_auto_20161202_2047'),
]
operations = [
migrations.CreateModel(... | shintouki/augmented-pandemic | game/migrations/0005_safezone.py | Python | mit | 660 |
# This file is adapted from python code released by WellDone International
# under the terms of the LGPLv3. WellDone International's contact information is
# info@welldone.org
# http://welldone.org
#
# Modifications to this file from the original created at WellDone International
# are copyright Arch Systems Inc.
# c... | iotile/coretools | iotilecore/iotile/core/utilities/config.py | Python | gpl-3.0 | 2,060 |
from pandas import read_csv
from pandas import notnull
from pprint import pprint
import json
from django.conf import settings
from django.db import transaction
from pandas.io.excel import read_excel
from source_data.models import *
from datapoints.models import DataPoint
class DocTransform(object):
def __init_... | unicef/polio | source_data/etl_tasks/transform_upload.py | Python | agpl-3.0 | 6,279 |
import sys
import xbmc, xbmcplugin, xbmcgui, xbmcaddon
import re, os, time
from datetime import datetime, timedelta
import urllib, urllib2
import json
import calendar
addon_handle = int(sys.argv[1])
#Localisation
local_string = xbmcaddon.Addon(id='plugin.video.livestream').getLocalizedString
ROOTDIR = xbmcaddon.Addon... | chovy/plugin.video.livestream | main.py | Python | gpl-2.0 | 16,768 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#Copyright 2008, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMP... | CentralLabFacilities/m3meka | python/scripts/demo/m3_demo_hand_h2r4.py | Python | mit | 5,860 |
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2011, 2012 Open Networking Foundation
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
# See the file LICENSE.pyloxi which should have been included in the source distribution
# Automatically generated by LOXI from ... | floodlight/loxigen-artifacts | pyloxi/loxi/of13/oxm.py | Python | apache-2.0 | 210,265 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
dataobject.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... | GeoCat/QGIS | python/plugins/processing/tools/dataobjects.py | Python | gpl-2.0 | 13,153 |
import pyowm
owm = pyowm.OWM(API_key='0ce70d38fc4aaade9c6f004e226e8a61', language='de') # You MUST provide a valid API key
# Will it be sunny tomorrow at this time in Berlin (Germany) ?
# returns forecaster
forecast = owm.daily_forecast("Berlin,de")
# alternatively: owm.three_hours_forecast("Berlin, de")
# timeutil... | phucdev/weatherbot | owmtest.py | Python | apache-2.0 | 2,304 |
from __future__ import print_function
import mxnet as mx
import numpy as np
from timeit import default_timer as timer
from dataset.testdb import TestDB
from dataset.iterator import DetIter
class Detector(object):
"""
SSD detector which hold a detection network and wraps detection API
Parameters:
-----... | wolfram2012/nimo | perception/ros_track_ssd/scripts/detect/detector.py | Python | gpl-3.0 | 6,261 |
# -*- coding: utf-8 -*-
"""
Core functionality for ODESys.
Note that it is possible to use new custom ODE integrators with pyodesys by
providing a module with two functions named ``integrate_adaptive`` and
``integrate_predefined``. See the ``pyodesys.integrators`` module for examples.
"""
from __future__ import absol... | bjodah/pyodesys | pyodesys/core.py | Python | bsd-2-clause | 41,092 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
#
# If you use this software in your research, please cite the following
# journal articles:
#
# J. D. Berry, M. J. ... | jdber1/opendrop | opendrop/app/common/image_acquisition/image_acquisition.py | Python | gpl-3.0 | 3,443 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Filename : hello.py
author : Crow
creat time: 2017-06-03
updata time: 2017-06-03
'''
import sys
import datetime
sys.path.append('/Volumes/DATA/virtualboxHost/ubuntu16.04_64/x12_engine/bin')
import x12_python
count = 0
def smartconninit():
for i in range(0, 1):... | martiancrow/x12_engine | bin/testcilent/bin/smartconn/smartconn.py | Python | bsd-3-clause | 1,100 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | danieldanciu/schoggi | appengine_config.py | Python | apache-2.0 | 7,323 |
from datetime import datetime
from flask_login import UserMixin
from marshmallow import Schema, fields
from werkzeug.security import generate_password_hash, check_password_hash
from app import db
class User(db.Model, UserMixin):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
userna... | andela-bmwenda/cp2-bucketlist-api | app/models.py | Python | mit | 2,762 |
from django.http import HttpResponse
from django.test import TestCase, RequestFactory
from django.utils.unittest import TestSuite
from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
from experiments import conf
from experiments.experiment_counters import ExperimentCounter
from experiments.m... | squamous/django-experiments | experiments/tests/test_webuser_incorporate.py | Python | mit | 5,071 |
# region gplv3preamble
# The Medical Simulation Markup Language (MSML) - Simplifying the biomechanical modeling workflow
#
# MSML has been developed in the framework of 'SFB TRR 125 Cognition-Guided Surgery'
#
# If you use this software in academic work, please cite the paper:
# S. Suwelack, M. Stoll, S. Schalck, N.S... | CognitionGuidedSurgery/msml | src/msml/api/runner.py | Python | gpl-3.0 | 2,708 |
#!/usr/bin/python
###############################################################################
# Copyright 2018 The Apollo 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 t... | ycool/apollo | modules/tools/localization/evaluate_compare.py | Python | apache-2.0 | 8,734 |
#!/usr/bin/python
# Save an image from the scanner once to a specified filename
import os
import sys
import veho
if len(sys.argv) != 2:
print 'Usage: %s <output file> (must end with .jpeg)'
sys.exit(1)
img = veho.ImageCapturer(base_dir=os.path.dirname(argv[1]))
raw = img.capture()
final = img.postprocess(raw,... | gerrowadat/vehodriver | scan_once.py | Python | apache-2.0 | 377 |
from distutils.core import setup
from distutils.filelist import findall
import py2exe
import glob
import os
DESTDIR="win_dist"
setup(
windows = [
{
"script": 'student.py',
"icon_resources": [(0, "iface/student.ico")]
},
{
"sc... | eugeni/openclass | compile.py | Python | gpl-2.0 | 905 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# sandesh_trace.py
#
class SandeshTraceRequestRunner(object):
def __init__(self, sandesh, request_buffer_name, request_context, read_context, request_count):
self._sandesh = sandesh
self._req_buf_name = request_buffer_name
... | safchain/vr_nldump | vr_nldump/pysandesh/sandesh_trace.py | Python | apache-2.0 | 2,166 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Tests for Strong Typing
########################
See :mod:`~exa.typed` for more details on how typing works.
"""
import six
import pytest
from itertools import product
from exa.t... | alexvmarch/exa | exa/tests/test_typed.py | Python | apache-2.0 | 3,864 |
"""Locations where we look for configs, install stuff, etc"""
import sys
import os
from distutils import sysconfig
def running_under_virtualenv():
"""
Return True if we're running inside a virtualenv, False otherwise.
"""
return hasattr(sys, 'real_prefix')
if running_under_virtualenv():
## FIX... | jokajak/itweb | data/env/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/locations.py | Python | gpl-3.0 | 1,663 |
# -*- coding: utf-8 -*-
# @author: ntischuk
from uaweb.parser import ParsingWebsite
from uaweb.spider import Crawler, Page
from uaweb.logg import Loggs
class Pages:
def grabbing(self, links):
parser = ParsingWebsite()
if isinstance(links, str):
links = list(links)
unused = []
... | tinik/uawebchallenge-v | unused/service/grabbing.py | Python | gpl-2.0 | 1,679 |
'''Deep Dreaming in Keras.
Run the script with:
```
python deep_dream.py path_to_your_base_image.jpg prefix_for_results
```
e.g.:
```
python deep_dream.py img/mypic.jpg results/dream
```
It is preferable to run this script on GPU, for speed.
If running on CPU, prefer the TensorFlow backend (much faster).
Example res... | andrewv587/pycharm-project | style-transfer/style-transfer.py | Python | apache-2.0 | 11,548 |
#!/usr/bin/env python
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# File name: gnome-wallpaper-slideshow.py
# Author: Stewart Gateley <birbeck@gmail.com>, Copyright (c) 2010
#
# gnome-wallpaper-slideshow is free software: you can redistribute it and/or
# modify it under the terms of th... | kernt/linuxtools | gnome3-shell/nautilus-scripts/System/Wallpaper Stuff/Gnome-Wallpaper-Slideshow.py | Python | gpl-3.0 | 17,704 |
# -*- coding: utf-8 -*-
"""
Neighbor Articles Plugin for Pelican
====================================
This plugin adds ``next_article`` (newer) and ``prev_article`` (older)
variables to the article's context
"""
from pelican import signals
def iter3(seq):
it = iter(seq)
nxt = None
cur = next... | JhonyVilla/blog | pelican-plugins/neighbors/neighbors.py | Python | gpl-3.0 | 2,005 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('forums', '0004_auto_20150515_1657'),
]
operations = [
migrations.AlterField(
model_name='topic',
nam... | Aurora0000/descant | forums/migrations/0005_auto_20150515_1731.py | Python | mit | 561 |
#! /usr/bin/env python
import json
import warnings
from glob import glob
from os import path
import datreant
def convert(folder):
treants = glob(path.join(folder, 'Treant*'))
if len(treants) == 0:
warnings.warn("No treant found in folder: {}".format(folder))
return
elif len(treants) > 1:
... | dotsdl/datreant | src/datreant/scripts/datreant_07to1.py | Python | bsd-3-clause | 1,109 |
from SMRS import SMRS
import numpy as np
np.set_printoptions(threshold=np.inf)
if __name__ == '__main__':
n_sample = 500
n_feats = 500
Y = np.random.rand(n_sample,n_feats)
print ('Extracting the representatives frames from the video...It may takes a while...')
smrs = SMRS(data=Y, alpha=5,norm_ty... | DavideNardone/PySMRS | demo.py | Python | agpl-3.0 | 518 |
'''
Created on Oct 16, 2014
@author: Aaron
'''
from datetime import timedelta
from time import localtime, sleep, mktime
start_time = localtime()
sleep(5)
finish_time = localtime()
print timedelta(seconds=mktime(finish_time)-mktime(start_time)) | ak212/python-hockey-rss | test_files/test_time_sub.py | Python | mit | 245 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import request, jsonify, url_for, current_app
from flask_login import current_user
from app.models import User
from . import api
from .authentication import auth
@api.route('/users/<int:id>')
@auth.login_required
def get_user(id):
user = User.query.get_... | sharkspeed/dororis | packages/python/flask/flask-dog-book/8-chapter/app/api/users.py | Python | bsd-2-clause | 367 |
"""
This module performs some integration tests by
using a seperate preds.txt file. Each line is
treated as a predicate and is evaluated as part
of a predicate set.
"""
import os
import os.path
from pypred import Predicate, PredicateSet, OptimizedPredicateSet
from . import DOC
def test_samples():
p = os.path.dirn... | armon/pypred | tests/integ/test_set.py | Python | bsd-3-clause | 1,051 |
__doc__ = \
"""
======================================================
Message Passing Interface Utilities (:mod:`mango.mpi`)
======================================================
.. _mpi4py: http://mpi4py.scipy.org
.. currentmodule:: mango.mpi
Convenience functions for MPI (`mpi4py`_). This module imports
everything... | pymango/pymango | misc/python/mango/mpi/__init__.py | Python | bsd-2-clause | 14,935 |
"""This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import unittest
import random
from collections import Counter
import numpy as np
import thinkstats2
import thinkplot
... | wavelets/ThinkStats2 | code/thinkstats2_test.py | Python | gpl-3.0 | 10,062 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/py-lrudict/package.py | Python | lgpl-2.1 | 1,591 |
"""
mfoc module. Contains the ModflowOc class. Note that the user can access
the ModflowOc class as `flopy.modflow.ModflowOc`.
Additional information for this MODFLOW package can be found at the `Online
MODFLOW Guide
<http://water.usgs.gov/ogw/modflow/MODFLOW-2005-Guide/index.html?oc.htm>`_.
"""
import sy... | mrustl/flopy | flopy/modflow/mfoc88.py | Python | bsd-3-clause | 19,499 |
from newsblur_web.celeryapp import app
from apps.statistics.models import MStatistics
from apps.statistics.models import MFeedback
from utils import log as logging
@app.task(name='collect-stats')
def CollectStats():
logging.debug(" ---> ~FBCollecting stats...")
MStatistics.collect_statistics()
... | samuelclay/NewsBlur | apps/statistics/tasks.py | Python | mit | 468 |
#! usr/bin/env python3
def Stars(amount_of_stars, is_flag):
"""Returns the amount of stars asked for"""
if not is_flag:
return ("*" * (amount_of_stars+4)) #Adds four extra stars to close the gaps
elif is_flag:
return ("*" * (amount_of_stars))
def Flag(width):
flag = []
proper_width = width*22
for i in range... | diblaze/TDP002 | 2.3/2a/uppgift_2a.py | Python | mit | 1,025 |
import six
import unittest
from restless.exceptions import HttpError, NotFound, MethodNotImplemented
from restless.preparers import Preparer, FieldsPreparer
from restless.resources import Resource
from restless.utils import json
from .fakes import FakeHttpRequest, FakeHttpResponse
class GenericResource(Resource):
... | toastdriven/restless | tests/test_resources.py | Python | bsd-3-clause | 12,183 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from ...utils.data import get_pkg_data_contents, get_pkg_data_filename
from ...wcs import WCS
from .. import utils
from ..utils import proj_plane_pixel_scales, is_proj_plan... | kelle/astropy | astropy/wcs/tests/test_utils.py | Python | bsd-3-clause | 14,533 |
from pysqlite2 import dbapi2 as sqlite
# Create a connection to the database file "mydb":
con = sqlite.connect("mydb")
# Get a Cursor object that operates in the context of Connection con:
cur = con.cursor()
# Execute the SELECT statement:
cur.execute("select * from people order by age")
# Retrieve all rows as a se... | gburd/dbsql | src/py/doc/code/execsql_printall_1.py | Python | gpl-3.0 | 373 |
from tkinter import Tk, Label, Entry, Button, StringVar, IntVar
window = Tk()
name_array = [['a1','a2','a3'], ['b1','b2','b3'], ['c1','c2','c3'],['d1','d2','d3']]
position_track = IntVar()
first_name = StringVar()
last_name = StringVar()
email = StringVar()
def return_value(pos):
first_name.set(name... | strommer/Python_rpi | test.py | Python | gpl-2.0 | 2,519 |
'''
Created on Jul 27, 2012
@author: Peyman Kazemian
'''
from headerspace.tf import TF
from headerspace.hs import headerspace
from utils.wildcard import wildcard_create_bit_repeat
from net_plumber import NetPlumber
from time import time
from config_parser.cisco_router_parser import cisco_router
from examples.utils.net... | Br1an6/ACS_Netplumber_Implementation | hsa-python/net_plumbing/demo.py | Python | gpl-2.0 | 2,719 |
class JobInitializationException(Exception): pass | Kortemme-Lab/klab | klab/cluster/cluster_interface.py | Python | mit | 50 |
#!/usr/bin/env python
"""A small script that can act as a trust root for installing pip >=8
Embed this in your project, and your VCS checkout is all you have to trust. In
a post-peep era, this lets you claw your way to a hash-checking version of pip,
with which you can install the rest of your dependencies safely. All... | erikrose/pipstrap | pipstrap.py | Python | mit | 6,889 |
import requests
from celery.utils.log import get_task_logger
from flask_mail import Message
from redash import mail, models, settings
from redash.version_check import run_version_check
from redash.worker import celery
logger = get_task_logger(__name__)
@celery.task(name="redash.tasks.record_event")
def record_event... | EverlyWell/redash | redash/tasks/general.py | Python | bsd-2-clause | 1,915 |
#! /usr/bin/env python
###############################################################################
# Copyright 2016 Adam Jackson
###############################################################################
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | WMD-group/kgrid | kgrid/cli.py | Python | gpl-3.0 | 3,963 |
# coding=utf-8
from __future__ import absolute_import, unicode_literals
from werkzeug.security import gen_salt
from flask import Blueprint, render_template
from flask import flash, url_for, session, abort
from flask import request, redirect, current_app as app
from flask.ext.login import logout_user, current_user, log... | messense/everbean | everbean/account/views.py | Python | mit | 6,897 |
from django.db import models
from feincms import extensions
class Extension(extensions.Extension):
def handle_model(self):
self.model.add_to_class(
'sub_title',
models.CharField(max_length=255, null=True, blank=True))
def handle_modeladmin(self, modeladmin):
modeladmin... | incuna/incuna-videos | videos/extensions/sub_heading.py | Python | bsd-2-clause | 454 |
from sqlite3 import connect
class DB:
def __init__(self,path="people.db"):
self.conn = connect(path)
self.c = self.conn.cursor()
def getList(self):
self.c.execute('SELECT * FROM people')
return self.c.fetchall()
def close(self):
self.conn.close()
class Date:
def __init__(self, y, m, d):
self.y = i... | ScaDS/ORC-Schlange | Tutorial/02 DATE, ORCID and WorkSummary Class(Filter 1)/__main__.py | Python | apache-2.0 | 1,679 |
"""Tools module"""
import json
from datetime import datetime
from os import urandom
from time import time
from struct import pack
from binascii import hexlify
import cherrypy
from norimdb import DocId
class JsonEncoder(json.JSONEncoder):
"""Custom json encoder class"""
def default(self, o):
if isins... | meeron/norimq | src/core/tools.py | Python | mit | 924 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2014 Pexego Sistemas Informáticos All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lice... | Pexego/PXGO_00049_2013_PCG | project-addons/generate_requisition_from_unsafety/__openerp__.py | Python | agpl-3.0 | 1,432 |
import unittest
from unittest.mock import Mock
from messagebird import Client
class TestCallFlow(unittest.TestCase):
def test_get_flow(self):
http_client = Mock()
http_client.request.return_value = '''{
"data": [
{
"id": "de3ed163-d5fc-45f4-b8c4-7eea7458c635",... | messagebird/python-rest-api | tests/test_call_flow.py | Python | bsd-2-clause | 5,065 |
# Copyright 2013-2015 DataStax, 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 writi... | tempbottle/python-driver | cassandra/__init__.py | Python | apache-2.0 | 12,784 |
#
# Kiwi: a Framework and Enhanced Widgets for Python
#
# Copyright (C) 2003-2005 Async Open Source
#
# 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, ... | hsavolai/vmlab | src/kiwi/ui/proxywidget.py | Python | gpl-3.0 | 11,525 |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 co... | metacloud/python-troveclient | troveclient/tests/test_secgroups.py | Python | apache-2.0 | 4,489 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | kontrafiktion/ansible | lib/ansible/plugins/action/fetch.py | Python | gpl-3.0 | 8,519 |
from ... import Endpoint, UrlConfig
class TftEndpoint:
def __init__(self, url: str, **kwargs):
self._url = f"/tft{url}"
def __call__(self, **kwargs):
final_url = f"{UrlConfig.tft_url}{self._url}"
endpoint = Endpoint(final_url, **kwargs)
return endpoint(**kwargs)
| pseudonym117/Riot-Watcher | src/riotwatcher/_apis/team_fight_tactics/urls/TftEndpoint.py | Python | mit | 307 |
"""
@file
@brief This modules contains a class which implements a simple server.
"""
import sys
import os
import urllib
import datetime
from http.server import HTTPServer
from socketserver import ThreadingMixIn
from pyquickhelper.loghelper import fLOG
from pyensae.sql.database_main import Database
from ..simple_serv... | sdpython/pyrsslocal | src/pyrsslocal/custom_server/aserver.py | Python | mit | 14,021 |
# -*- coding: utf-8 -*-
import datetime as dt
from flask.ext.login import UserMixin
from metapp2.extensions import bcrypt
from metapp2.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK
)
class Group(SurrogatePK, Model):
__tablename__ = 'groups'
date_created ... | phamtrisi/metapp2 | metapp2/group/models.py | Python | bsd-3-clause | 659 |
#!/usr/bin/env python
descr = '''Iterative Closest Point (ICP) Algorithm SciKit
Provide the ICP algorithm of point sets and 3D meshes to SciPy
'''
DISTNAME = 'scikits.icp'
DESCRIPTION = 'ICP for SciPy'
LONG_DESCRIPTION = descr
MAINTAINER = 'Guofu Xiang'
MAINTAINER_EMAIL = 'gfxiang@g... | gariyanto/scikits.icp | setup.py | Python | gpl-3.0 | 1,806 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Initialize a gcloud workspace.
Creates a .gcloud folder. When gcloud starts, it looks for this .gcloud folder
in the cwd or one of the cwd's ancestors.
"""
import argparse
import os
import textwrap
from googlecloudsdk.calliope import base
from googlecloudsdk.call... | ychen820/microblog | y/google-cloud-sdk/lib/googlecloudsdk/gcloud/sdktools/root/init.py | Python | bsd-3-clause | 6,195 |
import json
from collections import defaultdict, namedtuple
from datetime import datetime
from flask import current_app
from notifications_utils.insensitive_dict import InsensitiveDict
from notifications_utils.postal_address import PostalAddress
from notifications_utils.recipients import RecipientCSV
from notification... | alphagov/notifications-api | app/celery/tasks.py | Python | mit | 26,050 |
from builtins import range
from mrq.helpers import ratelimit
import time
def test_helpers_ratelimit(worker):
worker.start_deps()
assert ratelimit("k3", 1, per=1) == 1
assert ratelimit("k3", 1, per=1) == 0
assert ratelimit("k3", 1, per=1) == 0
for i in range(0, 10):
r = ratelimit("k", 10... | pricingassistant/mrq | tests/test_ratelimit.py | Python | mit | 924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.