repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
sebastic/QGIS | python/plugins/processing/algs/otb/maintenance/parsing.py | # -*- coding: utf-8 -*-
"""
***************************************************************************
parsing.py
---------------------
Copyright : (C) 2013 by CS Systemes d'information (CS SI)
Email : otb at c-s dot fr (CS SI)
Contributors : Julien Malik (CS SI)
... |
orlenko/bccf | src/mezzanine/core/management/commands/collecttemplates.py |
import os
from optparse import make_option
import shutil
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from mezzanine.utils.importing import path_for_import
class Command(BaseCommand):
"""
Copies templates from app templates directories, into the
pro... |
Metaswitch/horizon | openstack_dashboard/contrib/sahara/content/data_processing/data_sources/urls.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
jawilson/home-assistant | homeassistant/util/yaml/input.py | """Deal with YAML input."""
from __future__ import annotations
from typing import Any
from .objects import Input
class UndefinedSubstitution(Exception):
"""Error raised when we find a substitution that is not defined."""
def __init__(self, input_name: str) -> None:
"""Initialize the undefined subst... |
jasonmccampbell/numpy-refactor-sprint | doc/sphinxext/plot_directive.py | """
A special directive for generating a matplotlib plot.
.. warning::
This is a hacked version of plot_directive.py from Matplotlib.
It's very much subject to change!
Usage
-----
Can be used like this::
.. plot:: examples/example.py
.. plot::
import matplotlib.pyplot as plt
plt.plot... |
swn1/pyzmq | zmq/backend/cffi/_cffi.py | # coding: utf-8
"""The main CFFI wrapping of libzmq"""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import json
import os
from os.path import dirname, join
from cffi import FFI
from zmq.utils.constant_names import all_names, no_prefix
base_zmq_version = (3,2,2)
def ... |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/indexes/period/test_ops.py | import pytest
import numpy as np
from datetime import timedelta
import pandas as pd
import pandas._libs.tslib as tslib
import pandas.util.testing as tm
import pandas.core.indexes.period as period
from pandas import (DatetimeIndex, PeriodIndex, period_range, Series, Period,
_np_version_under1p10, I... |
EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/internet/test/test_inotify.py | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for the inotify wrapper in L{twisted.internet.inotify}.
"""
import sys
from twisted.internet import defer, reactor
from twisted.python import filepath, runtime
from twisted.python.reflect import requireModule
from twisted.trial import u... |
zrhans/python | exemplos/Examples.lnk/bokeh/compat/mpl/listcollection.py | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from bokeh import mpl
from bokeh.plotting import show
def make_segments(x, y):
'''
Create list of line segments from x and y coordinates.
'''
points = np.array([x, y]).T.reshape(-1, 1, 2)
segments... |
simartin/servo | tests/wpt/web-platform-tests/tools/third_party/pywebsocket3/test/test_handshake.py | #!/usr/bin/env python
#
# Copyright 2012, 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... |
ZerpaTechnology/AsenZor | static/js/brython/Lib/importlib/util.py | """Utility code for constructing importers, etc."""
from ._bootstrap import module_for_loader
from ._bootstrap import set_loader
from ._bootstrap import set_package
from ._bootstrap import _resolve_name
def resolve_name(name, package):
"""Resolve a relative module name to an absolute one."""
if not... |
ashaarunkumar/spark-tk | python/sparktk/graph/ops/degrees.py | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 require... |
xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/seq_tests.py | """
Tests common to tuple, list and UserList.UserList
"""
import unittest
from test import test_support
class CommonTest(unittest.TestCase):
# The type to be tested
type2test = None
def test_constructors(self):
l0 = []
l1 = [0]
l2 = [0, 1]
u = self.type2test()
u0 ... |
josenavas/qiime | scripts/compare_trajectories.py | #!/usr/bin/env python
from __future__ import division
__author__ = "Jose Antonio Navas Molina"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Jose Antonio Navas Molina", "Antonio Gonzalez Pena",
"Yoshiki Vazquez Baeza"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = ... |
glove747/liberty-neutron | neutron/tests/unit/db/quota/test_api.py | # Copyright (c) 2015 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 ... |
valesi/electrum | lib/tests/test_account.py | import unittest
from lib import account
from lib import wallet
class Test_Account(unittest.TestCase):
def test_bip32_account(self):
v = {
'change': [
'02d2967089cbcecf308f133cdec7e97eeeb53a1d8d76fc3656eaa55dac67b7694c',
'023a667b846434d35fa76d5fe452c11a74504f5d... |
WANdisco/amplab-hive | testutils/ptest/Report.py | #!/usr/bin/env python
#
# 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 "Lic... |
azjps/bokeh | bokeh/core/compat/mplexporter/renderers/base.py | import warnings
import itertools
from contextlib import contextmanager
import numpy as np
from matplotlib import transforms
from .. import utils
from .. import _py3k_compat as py3k
class Renderer(object):
@staticmethod
def ax_zoomable(ax):
return bool(ax and ax.get_navigate())
@staticmethod
... |
dsajkl/reqiop | common/test/acceptance/pages/lms/dashboard.py | # -*- coding: utf-8 -*-
"""
Student dashboard page.
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from . import BASE_URL
class DashboardPage(PageObject):
"""
Student dashboard, where the student can view
courses she/he has registered for.
"""
url = BAS... |
Tarrasch/luigi | luigi/contrib/hdfs/webhdfs_client.py | # -*- coding: utf-8 -*-
#
# Copyright 2015 VNG 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 applicable law... |
unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/differential_privacy/multiple_teachers/train_student.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... |
Tatsh-ansible/ansible | lib/ansible/modules/network/nxos/nxos_system.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... |
LethusTI/supportcenter | vendor/django/tests/regressiontests/admin_views/models.py | # -*- coding: utf-8 -*-
import datetime
import tempfile
import os
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
from django.db import models
class Section(m... |
manojgudi/sandhi | modules/gr36/gnuradio-core/src/python/gnuradio/gr/qa_noise.py | #!/usr/bin/env python
#
# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... |
felixonmars/mongo-python-driver | tools/benchmark.py | # Copyright 2009-2015 MongoDB, 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 writin... |
roidy/service.skin.refresh | watchdog/observers/winapi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# winapi.py: Windows API-Python interface (removes dependency on pywin32)
#
# Copyright (C) 2007 Thomas Heller <theller@ctypes.org>
# Copyright (C) 2010 Will McGugan <will@willmcgugan.com>
# Copyright (C) 2010 Ryan Kelly <ryan@rfk.id.au>
# Copyright (C) 2010 Yesudeep Mangal... |
zarboz/XBMC-PVR-mac | tools/darwin/depends/samba/samba-3.6.6/source4/torture/drs/python/fsmo.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Unix SMB/CIFS implementation.
# Copyright (C) Anatoliy Atanasov <anatoliy.atanasov@postpath.com> 2010
#
# 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 Foun... |
c0d3z3r0/linux-rockchip | scripts/bpf_helpers_doc.py | #!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2018-2019 Netronome Systems, Inc.
# In case user attempts to run with Python 2.
from __future__ import print_function
import argparse
import re
import sys, os
class NoHelperFound(BaseException):
pass
class ParsingError(BaseException):
... |
YzPaul3/h2o-3 | py2/testdir_rapids/test_rapids_ddply_with_funs.py | import unittest, random, sys, time, re
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_browse as h2b, h2o_exec as h2e, h2o_import as h2i, h2o_cmd
from h2o_test import dump_json, verboseprint
initList = [
'(+ (* #2 #2) (* #5 #5))',
'(* #1 (+ (* #2 #2) (* #5 #5)))',
'(= !x... |
cwtaylor/viper | viper/modules/verifysigs/pecoff_blob.py | #!/usr/bin/env python
# Copyright 2011 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... |
zymsys/sms-tools | software/transformations/stftTransformations.py | # functions that implement transformations using the stft
import numpy as np
import sys, os, math
from scipy.signal import resample
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/'))
import dftModel as DFT
def stftFiltering(x, fs, w, N, H, filter):
"""
Apply a filter to a sound... |
valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/scipy/spatial/kdtree.py | # Copyright Anne M. Archibald 2008
# Released under the scipy license
from __future__ import division, print_function, absolute_import
import sys
import numpy as np
from heapq import heappush, heappop
import scipy.sparse
__all__ = ['minkowski_distance_p', 'minkowski_distance',
'distance_matrix',
... |
sserrot/champion_relationships | venv/Lib/site-packages/jinja2/environment.py | # -*- coding: utf-8 -*-
"""Classes for managing templates and their runtime and compile time
options.
"""
import os
import sys
import weakref
from functools import partial
from functools import reduce
from markupsafe import Markup
from . import nodes
from ._compat import encode_filename
from ._compat import implement... |
samabhi/pstHealth | venv/lib/python2.7/site-packages/tests/panels/test_redirects.py | from __future__ import absolute_import, unicode_literals
import django
from django.conf import settings
from django.http import HttpResponse
from django.test.utils import override_settings
from django.utils import unittest
from ..base import BaseTestCase
@override_settings(DEBUG_TOOLBAR_CONFIG={'INTERCEPT_REDIRECTS... |
AsimmHirani/ISpyPi | tensorflow/contrib/tensorflow-master/tensorflow/contrib/distributions/python/ops/bijectors/chain.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... |
indictranstech/frappe | frappe/tests/test_document.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
class TestDocument(unittest.TestCase):
def test_get_return_empty_list_for_table_field_if_none(self):
d = frappe.get_doc({"doctype":"User"})
self.asse... |
MrKiven/gunicorn | examples/multiapp.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#
# Run this application with:
#
# $ gunicorn multiapp:app
#
# And then visit:
#
# http://127.0.0.1:8000/app1url
# http://127.0.0.1:8000/app2url
# http://127.0.0.1:8000/this_is_a_404
#
... |
Karosuo/Linux_tools | xls_handlers/xls_sum_venv/lib/python3.6/site-packages/setuptools/command/easy_install.py | #!/usr/bin/env python
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://setuptools.readthedocs.io/en/latest/easy_install.html
""... |
yohanko88/gem5-DC | tests/configs/realview64-o3.py | # Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... |
ncliam/serverpos | openerp/addons/base_import_module/models/ir_module.py | import logging
import os
import sys
import zipfile
from os.path import join as opj
import openerp
from openerp.osv import osv
from openerp.tools import convert_file
from openerp.tools.translate import _
from openerp import tools
_logger = logging.getLogger(__name__)
MAX_FILE_SIZE = 100 * 1024 * 1024 # in megabytes
... |
qnib/QNIBCollect | src/diamond/collectors/dseopscenter/dseopscenter.py | # coding=utf-8
"""
Collect the DataStax OpsCenter metrics
#### Dependencies
* urlib2
"""
import urllib2
import datetime
try:
import json
except ImportError:
import simplejson as json
import diamond.collector
class DseOpsCenterCollector(diamond.collector.Collector):
last_run_time = 0
column_fam... |
yuryleb/osrm-backend | third_party/flatbuffers/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: NamespaceB
import flatbuffers
class StructInNestedNS(object):
__slots__ = ['_tab']
# StructInNestedNS
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# StructInNestedNS
def A(self):... |
jutako/raspi | thingspeak/kasvuboksi/I2C.py | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Based on Adafruit_I2C.py created by Kevin Townsend.
#
# 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... |
3nids/QGIS | python/plugins/processing/modeler/ModelerAlgorithmProvider.py | # -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************... |
jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/numpy/fft/tests/test_helper.py | #!/usr/bin/env python
"""Test functions for fftpack.helper module
Copied from fftpack.helper by Pearu Peterson, October 2005
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal
from numpy import fft
fr... |
open-synergy/account-financial-reporting | account_chart_report/wizard/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Savoir-faire Linux (<www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the t... |
cevaris/pants | src/python/pants/util/xml_parser.py | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from xml.dom.minidom... |
chienlieu2017/it_management | odoo/addons/purchase/tests/test_onchange_product_id.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo.tests.common import TransactionCase
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
class TestOnchangeProductId(TransactionCase):
"""Test that when an included tax is ma... |
burzillibus/RobHome | venv/lib/python2.7/site-packages/SOAPpy/Utilities.py | """
################################################################################
# Copyright (c) 2003, Pfizer
# Copyright (c) 2001, Cayce Ullman.
# Copyright (c) 2001, Brian Matthews.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provid... |
uniphil/heroku-buildpack-pythonsass | test/django-1.5-skeleton/haystack/settings.py | # Django settings for haystack project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', ... |
orione7/Italorione | servers/rapidtube.py | # -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Rapidtube
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from cor... |
ovnicraft/openerp-restaurant | test_exceptions/models.py | # -*- coding: utf-8 -*-
import openerp
class m(openerp.osv.osv.Model):
""" This model exposes a few methods that will raise the different
exceptions that must be handled by the server (and its RPC layer)
and the clients.
"""
_name = 'test.exceptions.model'
def generate_except_osv(self,... |
JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/packaged_dependencies/theano_linear/conv2d.py | from theano.tensor.nnet.conv import conv2d, ConvOp
from .imaging import tile_slices_to_image, most_square_shape
from .linear import LinearTransform
import numpy
from theano import tensor
def tile_conv_weights(w, flip=False, scale_each=False):
"""
Return something that can be rendered as an image to visualize ... |
jxta/cc | vendor/Twisted-10.0.0/twisted/words/protocols/jabber/jid.py | # -*- test-case-name: twisted.words.test.test_jabberjid -*-
#
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Jabber Identifier support.
This module provides an object to represent Jabber Identifiers (JIDs) and
parse string representations into them with proper checking for illeg... |
invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_poll.py | # Test case for the os.poll() function
import os, select, random, unittest
from test.support import TESTFN, run_unittest
try:
select.poll
except AttributeError:
raise unittest.SkipTest("select.poll not defined -- skipping test_poll")
def find_ready_matching(ready, flag):
match = []
for fd, mode in r... |
horance-liu/tensorflow | tensorflow/contrib/learn/python/learn/learn_runner_test.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... |
rooshilp/CMPUT410Lab6 | virt_env/virt1/lib/python2.7/site-packages/django/utils/dateparse.py | """Functions to parse datetime objects."""
# We're using regular expressions rather than time.strptime because:
# - They provide both validation and parsing.
# - They're more flexible for datetimes.
# - The date/datetime/time constructors produce friendlier error messages.
import datetime
import re
from django.utils ... |
ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/wheel/test/test_tool.py | from .. import tool
def test_keygen():
def get_keyring():
WheelKeys, keyring = tool.get_keyring()
class WheelKeysTest(WheelKeys):
def save(self):
pass
class keyringTest:
backend = keyring.backend
class backends:
... |
gears/gears | gears/compressors/base.py | # -*- coding: utf-8 -*-
from ..asset_handler import BaseAssetHandler, ExecMixin
class BaseCompressor(BaseAssetHandler):
"""Base class for all asset compressors. Subclass's :meth:`__call__` method
must return compressed :attr:`~gears.assets.Asset.bundled_source` attribute.
"""
class ExecCompressor(BaseC... |
zacwentzell/BIA-660-C-Spring2017 | Video_Lectures/003-Files_and_Strings/code_from_lecture.py | # == Python 2 Ipython window
infile = open('test_ascii_file')
infile.readline()
infile.read()
infile.read()
infile.seek(0)
infile.read()
infile = open('test_write_file', 'w')
infile.write('Hello World!')
infile.close()
infile = open('test_write_file', 'w')
infile.write('Different text')
infile.close()
infi... |
mahendra-r/home-assistant | homeassistant/const.py | # coding: utf-8
""" Constants used by Home Assistant components. """
__version__ = "0.7.4dev0"
# Can be used to specify a catch all when registering state or event listeners.
MATCH_ALL = '*'
# If no name is specified
DEVICE_DEFAULT_NAME = "Unnamed Device"
# #### CONFIG ####
CONF_LATITUDE = "latitude"
CONF_LONGITUDE... |
pcu4dros/pandora-core | api/tests/users_tests/base_users.py | import json
from database.models.users import User
client_version = "/v1"
def user_add(self, response_login, args):
user_add_response = self.client.post(
client_version + '/users',
data=json.dumps(args),
content_type='application/json',
headers=dict(
Authorization='Be... |
tacwon/DPL | weight_init_compare.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 4 10:44:59 2017
@author: tacwon
"""
import os
import sys
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
import matplotlib.pyplot as plt
from dataset.mnist import load_mnist
from common.util import smooth_curve
from Mu... |
Azure/azure-sdk-for-python | sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_credentials_operations.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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
biosustain/venom | tests/test_message.py | from collections import OrderedDict
from typing import List
from unittest import TestCase, SkipTest
from venom.fields import String, Integer, repeated, Field
from venom.message import Message, from_object, items
class MessageTestCase(TestCase):
def test_message_fields(self):
class Pet(Message):
... |
adrienemery/auv-control-pi | calibrate_ahrs.py | """
This is adapted from https://github.com/micropython-IMU/micropython-fusion
Basically things have been renamed to AHRS naming scheme, pep8 improvements
and adjusted to work with CPython instead of MicroPython.
Supports 6 and 9 degrees of freedom sensors. Tested with InvenSense MPU-9150 9DOF sensor.
Source https:/... |
jackylee0424/YCHack-MakeHAL9000 | software/computervision/faceenroll.py | import os
import cv2
import time
biggest_face = None
def detectFaces(img, cascade):
global biggest_face
# convert to gray color to save some processing time
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.equalizeHist(gray)
rects = cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighb... |
levilucio/SyVOLT | UMLRT2Kiltera_MM/graph_MatchModel.py | """
__graph_MatchModel.py___________________________________________________________
Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION
________________________________________________________________________________
"""
import tkFont
from graphEntity import *
from GraphicalForm impo... |
rcosnita/fantastico | fantastico/oauth2/passwords_hasher.py | '''
Copyright 2013 Cosnita Radu Viorel
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... |
fmartingr/iosfu | iosfu/gui/core.py | from importlib import import_module
from iosfu.utils import slugify
from .components.base import Panel
class GUIController(object):
"""
Object that store and control all the UI compoennts.
"""
_panels = {}
_sections = {}
_categories = {}
def register_panel(self, panel_component):
... |
ChrisLeeGit/colored | tests/test_output.py | #!/usr/bin/env python3
# -*-coding: utf-8-*-
# Author : Christopher L
# License: MIT license
# Blog : http://blog.chriscabin.com
# GitHub : https://www.github.com/chrisleegit
# File : test_output.py
# Date : 2016/12/02 22:40
# Version: 0.1
# Description: some description of this file.
import os
import sys
from c... |
koduj-z-klasa/python101 | docs/mcpi/podstawy/mcpi-piramida.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
os.environ["USERNAME"] = "Steve" # nazwa użytkownika
os.environ["COMPUTERNAME"] = "mykomp" # nazwa komputera
# utworzenie połaczenia z s... |
WindfallLabs/dslw | tests/test_apsw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_utils.py: dslw Testing Suite
Copyright (c) 2017 Garin Wally
MIT License; see LICENSE
Unittests for apsw are kept to a minimum here since apsw and SQLite are
so thougoughly tested.
"""
import unittest
import apsw
# ==============================================... |
churchill-lab/g2gtools | g2gtools/vcf.py | # -*- coding: utf-8 -*-
#
# Collection of functions related to VCF files
#
# 1 based
from future.utils import lmap
from past.builtins import xrange
from collections import namedtuple
import re
from . import g2g
from . import g2g_utils
from . import exceptions
VCF_FIELDS = ['chrom', 'pos', 'id', 'ref', 'alt', 'qua... |
amadev/api_tests | test_nova_servers.py | import random
import requests
import json
from creds import *
from requests_toolbelt.utils import dump
VERSION = '2.42'
def test_server_details():
_headers = headers()
r = requests.get(
NOVA_URL + '/servers/detail?system_metadata={"foo":"bar"}',
headers=_headers)
assert 400 == r.status_c... |
jumoconnect/openjumo | jumodjango/mailer/views.py | from datetime import datetime
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse, Http404
from donation.models import Donor
from etc import cache
from etc.func import salted_hash
from etc.decorators import AccountRequired
from etc.view_helpers imp... |
monasysinfo/pyodbcOpenEdge | OpenEdge/pyodbc/aggregates.py | #===============================================================================
# from django.db.models.sql.aggregates import *
#
# class StdDev(Aggregate):
# is_computed = True
#
# def __init__(self, col, sample=False, **extra):
# super(StdDev, self).__init__(col, **extra)
# self.sql_functio... |
citationfinder/scholarly_citation_finder | scholarly_citation_finder/tools/harvester/Harvester.py | import logging
import os.path
from scholarly_citation_finder import config
from scholarly_citation_finder.lib.file import create_dir
from scholarly_citation_finder.apps.parser.Parser import Parser
logger = logging.getLogger(__name__)
class Harvester(object):
'''
Abstract harvester class.
'''
CO... |
facebookresearch/ParlAI | projects/safety_recipes/human_safety_evaluation/run.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from dataclasses import dataclass, field
from typing import Any, List
import hydra
from mephisto.operations.h... |
kyamaguchi/SublimeObjC2RubyMotion | tests/test_comment.py | import unittest, os, sys
from custom_test_case import CustomTestCase
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.append(os.path.join(PROJECT_ROOT, ".."))
from CodeConverter import CodeConverter
class TestComment(unittest.TestCase, CustomTestCase):
def test_remove_line_comment(self):
source = """... |
smartschat/art | art/test/test_scores.py | import os
import unittest
from art.scores import Score
from art.scores import Scores
__author__ = 'smartschat'
class TestScores(unittest.TestCase):
def test_from_file(self):
expected_scores = Scores(
[
Score([2, 3]),
Score([4, 12]),
Score([22, ... |
nuncjo/Delver | run_doctest.py | # -*- coding:utf-8 -*-
import os
import doctest
import shutil
from delver import (
crawler,
forms,
helpers,
parser,
proxies
)
if __name__ == "__main__":
os.makedirs('test', exist_ok=True)
with open('test/test_file.txt', 'wb') as f:
f.write(b"If the road is easy, you're likely goin... |
klekhaav/django-rest-custom-user | app/accounts/templatetags/accounts_extras.py | from django import template
import datetime
register = template.Library()
@register.filter(name='get_age')
def get_age(value):
age_year_ctrl = int(datetime.date.today().year) - 13
age_month_ctrl = datetime.date.today().month
age_day_ctrl = datetime.date.today().day
if value.year <= age_year_ctrl:
... |
ielia/prtg-py | setup.py | from setuptools import setup
setup(
name='prtg-py',
version='0.0.1',
description='A Python client for PRTG',
url='http://github.com/ielia/prtg-py',
author='Kevin Schoon',
author_email='kevinschoon@gmail.com',
maintainer='Ignacio Elia',
maintainer_email='ielia@olenick.com',
keywords=... |
zeckalpha/widely | widely/commands/auth.py | """
Manage the authorization tokens.
"""
import os
from ConfigParser import DuplicateSectionError, NoSectionError
import boto
def auth_login():
"""
Saves user authentication data for AWS S3 using boto. This does not
verify your credentials.
Usage: widely auth:login
"""
print('Enter your AWS... |
tacitia/ThoughtFlow | project/core/models.py | from django.db import models
class TextManager(models.Manager):
def create_text(self, title, content, created_by):
text, created = self.get_or_create(title=title, content=content, created_by=created_by)
return text
class Text(models.Model):
title = models.CharField(max_length=256)
content = models.Text... |
mic4ael/indico | indico/testing/fixtures/event.py | # This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import timedelta
import pytest
from indico.modules.events import Event
from indico.modules... |
AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/network_interface.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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
iamweilee/pylearn | zipfile-example-3.py | '''
ÏòѹËõµµ¼ÓÈëÎļþºÜ¼òµ¥, ½«ÎļþÃû, ÎļþÔÚ ZIP µµÖеÄÃû³Æ´«µÝ¸ø write ·½·¨¼´¿É.
ÏÂÀý ½« samples Ŀ¼ÖеÄËùÓÐÎļþ´ò°üΪһ¸ö ZIP Îļþ.
'''
import zipfile
import glob, os
# open the zip file for writing, and write stuff to it
file = zipfile.ZipFile("test.zip", "w")
for name in glob.glob("samples/*"):
file.write(n... |
HenriNijborg/MIS | Bank/bank/server.py | import json
from cherrypy.wsgiserver import CherryPyWSGIServer
from flask import Flask, abort, request, url_for, render_template, redirect, g
from .database import Database
from .models import TransactionRequest, PaymentRequest
app = Flask(__name__)
def serve(config):
app.config.update(config)
app.debug =... |
Lynn-015/NJU_DMRG | giggleliu/tba/hgen/generator.py | #!/usr/bin/python
#-*-coding:utf-8-*-
#By Giggle Liu
from numpy import *
from numpy.linalg import norm
from multithreading import mpido
from scipy.sparse import csr_matrix
from scipy.linalg import solve,eigvalsh
from matplotlib.pyplot import *
import os,time,re
__all__=['HGeneratorBase','KHGenerator','RHGenerator']
c... |
chaosdorf/chaospizza | src/chaospizza/orders/admin.py | # pylint: disable=C0111
from django.contrib import admin
from .models import Order, OrderItem, OrderStateChange
class OrderItemInline(admin.TabularInline): # noqa
model = OrderItem
class OrderStateChangeInline(admin.TabularInline): # noqa
model = OrderStateChange
class OrderAdmin(admin.ModelAdmin): # n... |
vladpopa/ent_analysis | conversion/generate_tracking.py | #!/usr/bin/env python
"""
This program generates a pkl file containing a list of dictionaries.
Each dictionary in the list represents a cloudlet.
The dictionaries have the structure:
{'core': array of ints of core points,
'plume': array of ints of plume points,
'u_core': ,
'v_core': ,
'w_core': ,
'u_plume': ,
'v_plume'... |
ExPHAT/binding-of-isaac | Pickup.py | # Pickup.py
# Aaron Taylor
# Moose Abumeeiz
#
# This is the class for the HUD pickups (keys, bombs, coins)
#
from pygame import *
class Pickup:
"""The class for the HUD pickup counters"""
def __init__(self, variant, textures, font):
self.variant = variant
self.score = 0
self.font = font
self.digit1 = fon... |
jpvanhal/cloudsizzle | cloudsizzle/studyplanner/common/planner_session.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2009-2010 CloudSizzle Team
#
# 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,
#... |
bengovernment/pyfawn | python-challenge/puzzle_3.py | import string
with open('input-puzzle_3.py', 'r') as file:
d = file.read().replace('\n', '')
data = list(d)
lowercase = set(list(string.ascii_lowercase))
uppercase = set(list(string.ascii_uppercase))
answer = []
for idx, character in enumerate(data):
if character in lowercase:
if idx > 2 and idx < l... |
HeliumGas/helium | qa/pull-tester/rpc-tests.py | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Run Regression Test Suite
This module calls down into individual test cases via subprocess. It will
... |
LarsSchy/SMAC-M | chart-installation/generate_map_files/mapgen/chartsymbols.py | # -*- coding: utf-8 -*-
import os
from xml.etree import ElementTree as etree
from .cs import lookups_from_cs
from .filters import MSAnd, MSFilter
from .instructions import get_command, CS
from .layer import DisplayPriority, Layer, LightsLayer
from .lookup import Lookup
from .symbol import VectorSymbol, Pattern
# Imp... |
caffeine-potent/Streamer-Datastructure | tests/test_flatmap.py | import mr_streams as ms
import unittest
# :::: auxilary functions ::::
def repeat_n_times(x, n = 1):
return [x] * n
def double(x):
return [x,x]
class TestMisc(unittest.TestCase):
def test_list_casting(self):
_ = ms.stream([1,2,3,4,5]).flatmap(double)
_ = list(_)
_ = ms.stream([1, ... |
Pulgama/supriya | etc/pending_ugens/ScopeOut2.py | import collections
from supriya.enums import CalculationRate
from supriya.ugens.UGen import UGen
class ScopeOut2(UGen):
"""
::
>>> scope_out_2 = supriya.ugens.ScopeOut2.ar(
... input_array=input_array,
... max_frames=4096,
... scope_frames=scope_frames,
..... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.