repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
ovnicraft/openerp-restaurant | sale/report/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
mikhaelharswanto/ryu | ryu/lib/xflow/sflow.py | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
dunphyben/btce-api | test/test_public.py | import decimal
import unittest
from btceapi.public import *
class TestPublic(unittest.TestCase):
def test_constructTrade(self):
d = {"pair": "btc_usd",
"trade_type": "bid",
"price": decimal.Decimal("1.234"),
"tid": 1,
"amount": decimal.Decimal("3.2"),
... |
bregman-arie/ansible | lib/ansible/modules/network/eos/eos_banner.py | #!/usr/bin/python
#
# 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) any later version.
#
# Ansible is distribut... |
michaelpacer/scikit-image | skimage/feature/_hog.py | from __future__ import division
import numpy as np
from .._shared.utils import assert_nD
from . import _hoghistogram
def hog(image, orientations=9, pixels_per_cell=(8, 8),
cells_per_block=(3, 3), visualise=False, normalise=False):
"""Extract Histogram of Oriented Gradients (HOG) for a given image.
Co... |
ostrokach/bioconda-recipes | recipes/pgdspider/PGDSpider2-cli.py | #!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Parameters
#
import os
import s... |
Mega-DatA-Lab/mxnet | tests/python/unittest/test_multi_device_exec.py | # 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 u... |
thomasem/nova | nova/scheduler/client/__init__.py | # Copyright (c) 2014 Red Hat, 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 require... |
tempbottle/zerorpc-python | tests/test_heartbeat.py | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2015 François-Xavier Bourlet (bombela+zerorpc@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files... |
54Pany/pupy | pupy/genpayload.py | #!/usr/bin/env python
# -*- coding: UTF8 -*-
# ---------------------------------------------------------------
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following c... |
vortex-ape/scikit-learn | sklearn/manifold/tests/test_isomap.py | from itertools import product
import numpy as np
from numpy.testing import (assert_almost_equal, assert_array_almost_equal,
assert_equal)
from sklearn import datasets
from sklearn import manifold
from sklearn import neighbors
from sklearn import pipeline
from sklearn import preprocessing
fro... |
kanjie128/test | pymavlink/fgFDM.py | #!/usr/bin/env python
# parse and construct FlightGear NET FDM packets
# Andrew Tridgell, November 2011
# released under GNU GPL version 2 or later
import struct, math
class fgFDMError(Exception):
'''fgFDM error class'''
def __init__(self, msg):
Exception.__init__(self, msg)
self.message = 'fg... |
superchilli/webapp | venv/lib/python2.7/site-packages/selenium/selenium.py |
"""
Copyright 2011 Software Freedom Conservancy.
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 w... |
mark-me/Pi-Jukebox | venv/Lib/site-packages/pygame/examples/vgrade.py | #!/usr/bin/env python
"""This example demonstrates creating an image with numpy
python, and displaying that through SDL. You can look at the
method of importing numpy and pygame.surfarray. This method
will fail 'gracefully' if it is not available.
I've tried mixing in a lot of comments where the code might
not be self... |
synmnstr/flexx | flexx/ui/_splitter.py | """
The splitter layout classes provide a mechanism to horizontally
or vertically stack child widgets, where the available space can be
manually specified by the user.
Example:
.. UIExample:: 200
from flexx import ui
class Example(ui.Widget):
def init(self):
with ui.HSplitter():
... |
alxgu/ansible | lib/ansible/modules/network/fortios/fortios_system_dns.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 3 of the Lic... |
oneandoneis2/dd-agent | checks.d/sqlserver.py | '''
Check the performance counters from SQL Server
See http://blogs.msdn.com/b/psssql/archive/2013/09/23/interpreting-the-counter-values-from-sys-dm-os-performance-counters.aspx
for information on how to report the metrics available in the sys.dm_os_performance_counters table
'''
# stdlib
import traceback
# 3rd party... |
pizzathief/scipy | scipy/misc/common.py | """
Functions which are common and require SciPy Base and Level 1 SciPy
(special, linalg)
"""
from numpy import arange, newaxis, hstack, prod, array, frombuffer, load
__all__ = ['central_diff_weights', 'derivative', 'ascent', 'face',
'electrocardiogram']
def central_diff_weights(Np, ndiv=1):
"""
... |
rodo/django-extensions | tests/test_uuid_field.py | import re
import uuid
import six
from django.test import TestCase
from django_extensions.db.fields import PostgreSQLUUIDField
from .testapp.models import (
UUIDTestAgregateModel, UUIDTestManyToManyModel, UUIDTestModel_field,
UUIDTestModel_pk,
)
class UUIDFieldTest(TestCase):
def test_UUID_field_create(... |
Chilledheart/chromium | tools/telemetry/telemetry/internal/backends/chrome/ios_browser_backend.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import contextlib
import json
import logging
import re
import urllib2
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.i... |
kylon/pacman-fakeroot | test/pacman/tests/upgrade055.py | self.description = "Upgrade a package that provides one of two imaginary packages"
lp1 = pmpkg("pkg1")
lp1.depends = ["imaginary", "imaginary2"]
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.provides = ["imaginary"]
self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3")
lp3.provides = ["imaginary2"]
self.addpkg2db(... |
mdakin/engine | build/android/gyp/generate_v14_compatible_resources.py | #!/usr/bin/env python
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Convert Android xml resources to API 14 compatible.
There are two reasons that we cannot just use API 17 attributes,
so we are ge... |
pniedzielski/fb-hackathon-2013-11-21 | src/repl.it/jsrepl/extern/python/unclosured/lib/python2.7/platform.py | #!/usr/bin/env python
""" This module tries to retrieve as much platform-identifying data as
possible. It makes this information available via function APIs.
If called from the command line, it prints the platform
information concatenated as single string to stdout. The output
format is useable as par... |
jckuester/droidtracer-module | src/main/jni/libnl-3.2.22/python/netlink/route/address.py | #
# Copyright (c) 2011 Thomas Graf <tgraf@suug.ch>
#
"""Module providing access to network addresses
"""
from __future__ import absolute_import
__version__ = '1.0'
__all__ = [
'AddressCache',
'Address']
import datetime
from .. import core as netlink
from . import capi as capi
from . import link as Link
f... |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/social/backends/shopify.py | """
Shopify OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/shopify.html
"""
import imp
import six
from social.utils import handle_http_errors
from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthFailed, AuthCanceled
class ShopifyOAuth2(BaseOAuth2):
"""Shopify OA... |
CyanogenMod/android_external_chromium-trace | trace-viewer/third_party/pywebsocket/src/mod_pywebsocket/util.py | # Copyright 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
scripnichenko/nova | nova/api/openstack/compute/legacy_v2/versions.py | # Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
samsu/neutron | openstack/common/policy.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... |
ghchinoy/tensorflow | tensorflow/contrib/learn/python/learn/datasets/base.py | # 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... |
skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/internet/test/test_pollingfile.py | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet._pollingfile}.
"""
from twisted.python.runtime import platform
from twisted.trial.unittest import TestCase
if platform.isWindows():
from twisted.internet import _pollingfile
else:
_pollingfile = None
c... |
tszym/ansible | lib/ansible/modules/cloud/ovirt/ovirt_quotas_facts.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... |
inovtec-solutions/OpenERP | openerp/addons/mail/tests/test_mail_base.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... |
samabhi/pstHealth | venv/lib/python2.7/site-packages/requests/packages/urllib3/_collections.py | # urllib3/_collections.py
# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from collections import deque
from threading import RLock
__all__ = ['RecentlyUsedContai... |
popazerty/EG-2 | lib/python/Components/Converter/CryptoInfo.py | from Components.Converter.Converter import Converter
from Components.Element import cached
from Components.config import config
from Tools.GetEcmInfo import GetEcmInfo
from Poll import Poll
class CryptoInfo(Poll, Converter, object):
def __init__(self, type):
Converter.__init__(self, type)
Poll.__init__(self)
... |
rubendura/django-rest-framework | tests/test_response.py | from __future__ import unicode_literals
from django.conf.urls import include, url
from django.test import TestCase
from django.utils import six
from rest_framework import generics, routers, serializers, status, viewsets
from rest_framework.renderers import (
BaseRenderer, BrowsableAPIRenderer, JSONRenderer
)
from... |
kaichogami/sympy | sympy/external/tests/test_codegen.py | # This tests the compilation and execution of the source code generated with
# utilities.codegen. The compilation takes place in a temporary directory that
# is removed after the test. By default the test directory is always removed,
# but this behavior can be changed by setting the environment variable
# SYMPY_TEST_CL... |
minixalpha/SourceLearning | webpy/src/web/wsgiserver/ssl_builtin.py | """A library for integrating Python's builtin ``ssl`` library with CherryPy.
The ssl module must be importable for SSL functionality.
To use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of
``BuiltinSSLAdapter``.
"""
try:
import ssl
except ImportError:
ssl = None
from cherrypy import ws... |
mycodeday/crm-platform | website_forum/tests/common.py | # -*- coding: utf-8 -*-
from openerp.tests import common
KARMA = {
'ask': 5, 'ans': 10,
'com_own': 5, 'com_all': 10,
'com_conv_all': 50,
'upv': 5, 'dwv': 10,
'edit_own': 10, 'edit_all': 20,
'close_own': 10, 'close_all': 20,
'unlink_own': 10, 'unlink_all': 20,
'gen_que_new': 1, 'gen_que... |
sysbot/pastedown | vendor/pygments/scripts/vim2pygments.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Vim Colorscheme Converter
~~~~~~~~~~~~~~~~~~~~~~~~~
This script converts vim colorscheme files to valid pygments
style classes meant for putting into modules.
:copyright 2006 by Armin Ronacher.
:license: BSD, see LICENSE for details.
"""
impor... |
diogocs1/comps | web/addons/account/wizard/account_report_common_partner.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/migrations/0036_auto__add_field_cmsplugin_changed_date.py | # -*- 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):
# Dummy migration
pass
def backwards(self, orm):
# Dummy migration
pass
models = {
... |
DONIKAN/django | tests/migrations2/test_migrations_2/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("migrations", "0002_second")]
operations = [
migrations.CreateModel(
"OtherAuthor",
[
("id", mode... |
rhots/automation | heroes-sidebar-master/reddit.py | import praw
import requests
from env import env
from twitch import twitch
class reddit:
def __init__(self):
self.r = praw.Reddit(user_agent='Heroes of the Storm Sidebar by /u/Hermes13')
self.env = env()
self.access_information = None
def setup(self):
# self.r.set_oauth_app_info( client_id=self.env.redditC... |
uber/clusto-query | test/test_lexer.py | import unittest
import clusto_query.lexer
from clusto_query.exceptions import StringParseError
class LexerTest(unittest.TestCase):
def test_consume(self):
self.assertEqual(clusto_query.lexer.consume('nom', 'nomnomnom'),
'nomnom')
def test_lex_string_inner_quoted_basic(self):
... |
bertjwregeer/pyramid_keystone | pyramid_keystone/__init__.py | from pyramid.exceptions import ConfigurationError
from pyramid.interfaces import ISessionFactory
from .settings import parse_settings
def includeme(config):
""" Set up standard configurator registrations. Use via:
.. code-block:: python
config = Configurator()
config.include('pyramid_keystone... |
ustuehler/git-cvs | tests/test_cvs.py | from os.path import dirname, join
import unittest
from cvsgit.cvs import CVS
from cvsgit.changeset import Change
class Test(unittest.TestCase):
def test_rcsfilename(self):
"""Find the RCS file for a working copy path.
"""
cvs = CVS(join(dirname(__file__), 'data', 'zombie'), None)
... |
tanium/pytan | BUILD/build_api_examples.py | #!/usr/bin/env python
# -*- mode: Python; tab-width: 4; indent-tabs-mode: nil; -*-
# ex: set tabstop=4
# Please do not change the two lines above. See PEP 8, PEP 263.
'''generates all of the examples from the test/ddt JSON files'''
__author__ = 'Jim Olsen (jim.olsen@tanium.com)'
__version__ = '2.1.4'
import os
import ... |
milas/traktcast | main.py | import logging
import time
import pychromecast
from traktcast.trakt import configure_trakt_client
from traktcast.hulu import HuluHandler
from traktcast.scrobble import TraktScrobblerListener
if __name__ == '__main__':
logging.basicConfig()
logging.getLogger('traktcast').setLevel(logging.DEBUG)
configur... |
infinite-turtles/duo_logger | duo_logger.py | #!/usr/bin/env python3
import argparse
import configparser
import json
import logging
import time
from datetime import datetime
from logging.handlers import SysLogHandler
from operator import itemgetter
import duo_client
from tzlocal import get_localzone
def get_logs(mintime):
logs = []
admin_api = duo_clien... |
xuru/pyvisdk | tests/test_facade.py | import unittest,types
from pyvisdk import Vim
from pyvisdk.base.managed_object_types import ManagedObjectTypes
from pyvisdk.mo.host_system import HostSystem
from pyvisdk.mo.folder import Folder
from pyvisdk.mo.datastore import Datastore
from pyvisdk.mo.cluster_compute_resource import ClusterComputeResource
from pyvisdk... |
arvinddoraiswamy/mywebappscripts | BurpExtensions/FileUploadFuzz.py | from burp import IBurpExtender
from burp import IContextMenuFactory
from javax.swing import JMenuItem
import sys
import os
import re
#Adding directory to the path where Python searches for modules
module_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/Git/WebAppsec/BurpExtensions/modules/')
sys.path.in... |
JasonSanchez/w261 | week2/NBPredict.py |
import re
from mrjob.job import MRJob
from math import log
def tsv_model_to_dict(file):
results = {}
with open(file, "r") as model:
for line in model:
term, ham, spam = line.strip().split("\t")
results[term] = (float(ham), float(spam))
return results
class NBPredict(M... |
jmoiron/daneel | daneel/plugins/weblib.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convenience functions for doing web things."""
import re
import requests
import urlparse
import traceback
import json
from lxml.cssselect import CSSSelector as cs
from lxml.html import document_fromstring
from daneel import utils
ua = "Mozilla/5.0 (Macintosh; Intel M... |
joequant/pyswagger | pyswagger/tests/v2_0/test_circular.py | from pyswagger import SwaggerApp, utils, primitives, errs
from ..utils import get_test_data_folder
from ...scanner import CycleDetector
from ...scan import Scanner
import unittest
import os
import six
class CircularRefTestCase(unittest.TestCase):
""" test for circular reference guard """
def test_path_item_... |
kiriappeee/reply-later | src/core/tests/TestMessageSender.py | import unittest
from unittest.mock import Mock, patch
import copy
from datetime import timezone, timedelta, datetime
from ..reply.Reply import Reply
from ..reply import ReplyCRUD
from ..user.User import User
from ..messager import TweetAdapter, MessageBreaker, MessageSender
from ..data import DataConfig
from ..schedule... |
JNU-Include/CNN | lib/mnist_classifier_del.py | import matplotlib.pyplot as plt
import tensorflow as tf
from softmax_del import Softmax
from lib import mytool
'''
gildong = MnistClassifier()
gildong.learn(3, 100) # epoch, partial_size
gildong.evaluate() # for all test data
gildong.classify_random_image() # classify a randomly selected image
#gildong.show_errors()
... |
zhenxuan00/mmdgm | conv-mmdgm/layer/LogisticRegression.py | import cPickle
import gzip
import os
import sys
import time
import numpy
import theano
import theano.tensor as T
class LogisticRegression(object):
"""
Multi-class Logistic Regression Class
The logistic regression is fully described by a weight matrix :math:`W`
and bias vector :math:`b`. Classif... |
Mikescher/Project-Euler_Befunge | compiled/Python2/Euler_Problem-020.py | #!/usr/bin/env python2
# transpiled with BefunCompile v1.3.0 (c) 2017
import sys
import zlib, base64
_g = ("AR+LCAAAAAAABAC9jz0KAjEQha+SnZhmh5hMhogECbZeYrcR0qZK6dkddxVEEGOzrxjmD977mt9AbQMPynCFTDYNus3Jc/XEFW4XwMA1By5yNoRr4wp4sJ7LSFwwxYjm"
+ "cFRNdWla6k5/rOdJD5VDslQ4VCaHMVYnZjIimWcznvpMVuUFgAUm84uA3whQKRkTWXnpjf9N5/2D... |
lv10/bestbuyapi | bestbuyapi/api/bulk.py | import json
import zipfile
from io import BytesIO
from ..constants import BULK_API
from ..api.base import BestBuyCore
from ..utils.exceptions import BestBuyBulkAPIError
class BestBuyBulkAPI(BestBuyCore):
def _api_name(self):
return BULK_API
def archive(self, name, file_format):
"""BestBuy ge... |
radio-astro/radiopadre | radiopadre/js9/__init__.py | import os
import os.path
import traceback
# init JS9 configuration
# js9 source directory
DIRNAME = os.path.dirname(__file__)
JS9_ERROR = os.environ.get("RADIOPADRE_JS9_ERROR") or None
def init_js9():
global radiopadre
import radiopadre
from radiopadre.render import render_status_message
global JS9... |
cxchope/YashiLogin | tests/test_login.py | # -*- coding:utf-8 -*-
import test_core
import demjson
import datetime
test_core.title("登录测试")
f = open("testconfig.json", 'r')
lines = f.read()
f.close()
jsonfiledata = demjson.decode(lines)
if jsonfiledata["url"] == "":
test_core.terr("错误: 'testconfig.json' 配置不完全。")
exit()
uurl = jsonfiledata["url"]+"nyalogin... |
gepd/uPiotMicroPythonTool | tools/sampy_manager.py | # This file is part of the uPiot project, https://github.com/gepd/upiot/
#
# MIT License
#
# Copyright (c) 2017 GEPD
#
# 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, inc... |
upconsulting/IsisCB | isiscb/isisdata/migrations/0041_auto_20160712_1656.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('isisdata', '0040_auto_20160701_1946'),
]
operations = [
migrations.AlterField(
model_name='aarelation',
... |
coldfusion39/excel-press | excel_press.py | #!/usr/bin/env python
# Copyright (c) 2015, Brandan [coldfusion]
#
# 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,... |
pierre-chaville/automlk | automlk/utils/keras_wrapper.py | import logging
log = logging.getLogger(__name__)
try:
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.normalization import BatchNormalization
from keras.layers.advanced_activations import PReLU, LeakyReLU
from keras.optimizers import A... |
MGautier/Programacion | Python/salida_estandar.py | #!/usr/bin/env python
print "Hola\n\n\tmundo"
#Para que la impresion se realizara en la misma linea tendriamos
# que colocar una coma al final de la sentencia
for i in range(3):
print i,
print "\n"
for i in range(3):
print i
#Diferencias entre , y el + en las cadenas: al utilizar las comas
#print introduce ... |
KristianOellegaard/django-filer | filer/server/backends/default.py | #-*- coding: utf-8 -*-
import os
import stat
from django.http import Http404, HttpResponse, HttpResponseNotModified
from django.utils.http import http_date
from django.views.static import was_modified_since
from filer.server.backends.base import ServerBase
class DefaultServer(ServerBase):
'''
Serve static file... |
thomasleese/gantt-charts | ganttcharts/web/routes/api.py | """
Routes for the API.
"""
import datetime
import dateutil.parser
from cerberus import Validator
import flask
import sqlalchemy
from ganttcharts.chart import Chart, InvalidGanttChart
from ganttcharts.models import AccessLevel, Project, \
ProjectCalendarHoliday, ProjectEntry, ProjectEntryDependency, \
Projec... |
alexalv-practice/topoml | modules/root.py | # -*- coding: utf-8 -*-
import cherrypy
class Root(object):
exposed = True
@cherrypy.tools.json_out()
def GET(self, id=None):
return ["Hello", "world", "!"]
if __name__ == '__main__':
conf = {
'/': {
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
'... |
EmanueleCannizzaro/scons | test/CC/SHCC.py | #!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
gjwajda/Computational-Tools-For-Big-Data | Exercise2/exercise2_1.py | #!/usr/bin/python
#First Method taking in file "matrix.txt" and printing list of lists
#Function1
def readmatrix( file ):
list = open( file, 'r' )
return list.readlines();
#Calling function
print readmatrix( 'matrix.txt' )
#Funtion2
def reverse( list, matrixfile ):
file = open( matrixfile, 'w' )
for i i... |
gwtsa/gwtsa | pastas/stressmodels.py | """The stressmodels module contains all the stressmodels that available in
Pastas.
Supported Stressmodels
----------------------
The following stressmodels are supported and tested:
- StressModel
- StressModel2
- FactorModel
- StepModel
- WellModel
All other stressmodels are for research purposes only and are not (y... |
tim-tang/arctic-bear | setup.py | # coding: utf-8
import arctic
from email.utils import parseaddr
from setuptools import setup, find_packages
kwargs = {}
try:
from babel.messages import frontend as babel
kwargs['cmdclass'] = {
'extract_messages': babel.extract_messages,
'update_catalog': babel.update_catalog,
'compile_... |
huyphan/pyyawhois | test/record/parser/test_response_whois_domainregistry_ie_property_contacts_multiple.py |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.domainregistry.ie/property_contacts_multiple
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.... |
oxford-pcs/measure_lens_alignment | errors.py | import numpy as np
from scipy.spatial import distance
class measurementError():
'''
Requires repeated measurements at single position (no rotation).
Takes a set of solver.axis instances as input.
'''
def __init__(self, axes):
self.axes = axes
def calculate_angle_error_at_z(self, z=0, vect... |
woutdenolf/spectrocrunch | spectrocrunch/patch/pint.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from pint import UnitRegistry, errors
from pint.quantity import _Quantity
from pint.unit import _Unit
from pint.measurement import _Measurement
ureg = UnitRegistry()
# Because of unpickling:
class Quantity(_Quantity):
_REGISTRY = ureg
force_nd... |
talon-one/talon_one.py | test/test_attributes_mandatory.py | # coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... |
pyshop/pyjobs | src/adverts/migrations/0012_auto_20151214_1910.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('adverts', '0011_auto_20151210_1116'),
]
operations = [
migrations.CreateModel(
... |
Tim-Erwin/marshmallow-jsonapi | docs/conf.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime as dt
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import marshmallow_jsonapi
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx_issues',
]
primary_domain = 'p... |
jabbalaci/Bash-Utils | is_net_back.py | #!/usr/bin/env python3
"""
Play a sound when the Internet connection is back.
"""
import os
import socket
from pathlib import Path
from time import sleep
from lib import network
from lib.audio import play
ROOT = os.path.dirname(os.path.abspath(__file__))
TIMEOUT = 3
AUDIO = str(Path(ROOT, "assets", "alert.wav"))
... |
piton-package-manager/piton | piton/commands/outdated.py | from ..utils.command import BaseCommand
from ..utils.tabulate import tabulate
from ..utils.info import get_packages, Sources
class Colors:
PURPLE = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
UNDERLINE = '\033[4m'
ENDC = '\033[0m'
class Command(BaseCommand):
name... |
mpg-age-bioinformatics/bit | bit/config.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import sys
import getpass
from os.path import expanduser
import stat
import shutil
import bit.git as git
structure="\n\
/file_system_a\n\
|\n\
'- data\n\
|\n\
'- p... |
goulu/pdfminer | tools/pdfdiff.py | #!/usr/bin/env python3
"""
compares two pdf files.
"""
import io
import logging
import sys
import pdfminer.settings
from pdfminer import high_level, layout
pdfminer.settings.STRICT = False
logging.basicConfig()
def compare(file1, file2, **kwargs):
# If any LAParams group arguments were passed,
# create a... |
leandromet/Geoprocessamento---Geoprocessing | Palsar_HH_HV_to_RGB8bit.py | """
#-------------------------------------------------------------------------------
# Name: ALOS HH, HV and RFDI on RGB 16signedint GEOTIFF
# Purpose: Calculates the RFDI , saves geotiff with HH, HV and RFDI layers
# in 8bit unsigned format, with values stretched for contrast enhancement.
# A... |
pinggit/plwe | bin/liaoxuefeng_scan.py | #!/usr/bin/env python
# coding:utf-8
import urllib
domain = 'http://www.liaoxuefeng.com' #廖雪峰的域名
path = r'C:\Users\cyhhao2013\Desktop\temp\\' #html要保存的路径
# 一个html的头文件
input = open(r'C:\Users\cyhhao2013\Desktop\0.html', 'r')
head = input.read()
# 打开python教程主界面
f = urllib.urlopen("http://www.liaoxuefeng.c... |
martindurant/misc | congrid.py | import numpy as n
import scipy.interpolate
import scipy.ndimage
def congrid(a, newdims, method='linear', centre=False, minusone=False):
'''Arbitrary resampling of source array to new dimension sizes.
Currently only supports maintaining the same number of dimensions.
To use 1-D arrays, first promote them to... |
kengz/python-structure | setup.py | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
from structure import __version__
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# str... |
abduhbm/python-qaym | qaym/api.py | from models import Country, City, Item, Location, Review, Image, Vote, Tag
import requests
BASE_URL = 'http://api.qaym.com/0.1'
class Api(object):
"""
A python interface to the Qaym API
"""
def __init__(self, key=None, base_url=None):
if base_url is None:
self.base_url = BASE_URL
... |
bsautermeister/machine-learning-examples | dnn_classification/tf_learn/dnn_iris.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import urllib
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
# Data sets
IRIS_TRAINING = "iris_training.csv"
IRIS_TRAINING_URL = "http://download.tensorflow.or... |
henrysky/astroNN | astroNN/datasets/apogee.py | import numpy as np
from astropy import units as u
from astropy.io import fits
from astroNN.apogee import allstar
from astroNN.apogee.downloader import apogee_distances, apogee_rc
from astroNN.gaia import mag_to_absmag, mag_to_fakemag, extinction_correction
from astroquery.vizier import Vizier
def load_apogee_distanc... |
sienkie/pathways-analysis | methods/SPIA/SPIA.py | from .constants import *
from databases import KEGGPathways
from methods.method import Method, MethodResult
from models import Experiment
from networkx import get_edge_attributes
from scipy import stats
from scipy.stats import norm
from stats import ttest
from statsmodels.sandbox.stats import multicomp
import math
impo... |
xianjunzhengbackup/code | http/django/mysite/mysite/settings.py | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... |
flyingSprite/spinelle | task_inventory/order_1_to_30/order_17_show_time_with_current_and_given.py |
"""Order 17: show time with give time and current time.
"""
class ShowTimeWithCurrentAndGiven(object):
@staticmethod
def show(current_timestamp=0, given_timestamp=0):
if current_timestamp - given_timestamp < 0:
return ''
if current_timestamp - given_timestamp < 120:
... |
Azure/azure-sdk-for-python | sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py | # 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.
# --------------------------------------------------------------------... |
donnell74/CSC-450-Scheduler | tests/structures/test_room.py | from __future__ import print_function
import unittest
from genetic.structures import *
from genetic import *
sample_scheduler = interface.create_scheduler_from_file_test("tests/schedules/morning_class_test.xml")
class TestRoom(unittest.TestCase):
def setUp(self):
self.roomMWF = sample_scheduler.weeks[0].... |
RLejolivet/MarioMakerLevelsBot | MarioMakerLevelsBot/MarioMakerLevelsBot/ui/window.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'window.ui'
#
# Created: Tue Dec 22 17:18:58 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(se... |
thijsmie/imp_flask | imp_flask/middleware.py | """Flask middleware definitions. This is also where template filters are defined.
To be imported by the application.current_app() factory.
"""
from logging import getLogger
import os
from flask import current_app, render_template, request
from markupsafe import Markup
import simplejson as json
from imp_... |
aldialimucaj/Streaker | docs/source/conf.py | # -*- coding: utf-8 -*-
#
# Streaker documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 6 12:34:57 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
Submanifold/Aleph | utilities/make_pinched_torus.py | #!/usr/bin/env python3
#
# This file is part of the utilities shipped with 'Aleph - A Library for
# Exploring Persistent Homology'. It contains test code to parametrize a
# 'pinched torus'. The parametrization follows a sine pattern as the gap
# towards the singular point is approached.
#
# Original author: Bastian Rie... |
furritos/mercado-api | mercado/core/safeway.py | # -*- coding: UTF-8 -*-
import datetime
import json
import logging
import re
from mercado.core.base import Mercado
from mercado.core.common import nt_merge
log = logging.getLogger(__name__)
class Safeway(Mercado):
def __init__(self, auth, urls, headers, sleep_multiplier=1.0):
self.auth = auth
se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.