repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
mmottahedi/neuralnilm_prototype | scripts/e65.py | 2 | 2721 | from __future__ import print_function, division
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy
from lasagne.init import Uniform, Normal
from lasagne.layers import LSTMLayer, Dens... | mit |
aisipos/django | django/db/backends/mysql/features.py | 28 | 2938 | from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
from .base import Database
try:
import pytz
except ImportError:
pytz = None
class DatabaseFeatures(BaseDatabaseFeatures):
empty_fetchmany_value = ()
update_can_self_select = False
... | bsd-3-clause |
hbohuang/kubernetes | cluster/juju/charms/trusty/kubernetes/hooks/kubernetes_installer.py | 148 | 2518 | #!/usr/bin/env python
# Copyright 2015 The Kubernetes 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
#
# Unle... | apache-2.0 |
simongoffin/my_odoo_tutorial | addons/resource/faces/plocale.py | 433 | 1910 | ############################################################################
# Copyright (C) 2005 by Reithinger GmbH
# mreithinger@web.de
#
# This file is part of faces.
#
# faces is free software; you can redistribute it and/or modify
# ... | agpl-3.0 |
ganeshgore/myremolab | server/launch/sample_balanced2_concurrent_experiments/main_machine/lab_and_experiment1/experiment76/server_config.py | 242 | 1525 | #!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
weblab_xilinx_experiment_xilinx_device = 'FPGA'
weblab_xilinx_experiment_port_number = 1
# This should be something like this:
# import os as _os
# xilinx_home = _os.getenv('XILINX_HOME')
# if xilinx_home == None:
# if _os.name == 'nt':
# xilinx_home = r'C:... | bsd-2-clause |
nicoTrombon/DjangoPolls | env/Lib/site-packages/django/db/models/sql/aggregates.py | 174 | 4843 | """
Classes to represent the default SQL aggregate functions
"""
import copy
import warnings
from django.db.models.fields import FloatField, IntegerField
from django.db.models.lookups import RegisterLookupMixin
from django.utils.deprecation import RemovedInDjango110Warning
from django.utils.functional import cached_pr... | bsd-3-clause |
nkcr/WebIndex | app/venv/lib/python3.5/site-packages/pip/_vendor/colorama/ansi.py | 640 | 2524 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\007'
def code_to_chars(code):
return CSI + str(code) + 'm'
def set... | mit |
alexlo03/ansible | lib/ansible/module_utils/oneview.py | 23 | 18876 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
mcalmer/spacewalk | client/tools/rhncfg/config_management/rhncfg_diff_revisions.py | 10 | 2765 | #
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | gpl-2.0 |
sebrandon1/neutron | neutron/conf/wsgi.py | 9 | 1262 | # 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 req... | apache-2.0 |
zarboz/xbmc | lib/libUPnP/Neptune/Build/Tools/SCons/gcc-generic.py | 21 | 1153 | import os
def generate(env, gcc_cross_prefix=None, gcc_strict=True, gcc_stop_on_warning=None):
if gcc_stop_on_warning == None: gcc_stop_on_warning = env['stop_on_warning']
### compiler flags
if gcc_strict:
env.AppendUnique(CCFLAGS = ['-pedantic', '-Wall', '-W', '-Wundef', '-Wno-long-long'])
... | gpl-2.0 |
acourtney2015/boto | boto/iam/connection.py | 75 | 62193 | # Copyright (c) 2010-2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010-2011, Eucalyptus Systems, Inc.
#
# 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, includin... | mit |
hep-gc/glint-horizon | openstack_dashboard/dashboards/admin/hypervisors/tests.py | 7 | 2096 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 B1 Systems GmbH
#
# 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
#... | apache-2.0 |
vlvkobal/netdata | collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/low_level.py | 4 | 12093 | # SPDX-License-Identifier: MIT
"""
Low-level helpers for the SecureTransport bindings.
These are Python functions that are not directly related to the high-level APIs
but are necessary to get them to work. They include a whole bunch of low-level
CoreFoundation messing about and memory management. The concerns in this ... | gpl-3.0 |
egoid/baytree | lib/python2.7/site-packages/environ/environ.py | 3 | 26771 | """
Django-environ allows you to utilize 12factor inspired environment
variables to configure your Django application.
"""
import json
import logging
import os
import re
import sys
import warnings
try:
from django.core.exceptions import ImproperlyConfigured
except ImportError:
class ImproperlyConfigured(Except... | mit |
TintypeMolly/Yuzuki | resource/board.py | 2 | 1155 | # -*- coding: utf-8 -*-
from config.config import ARTICLE_PER_PAGE
from exception import Unauthorized
from helper.model_control import get_board, get_article_page
from helper.permission import is_anybody, can_write
from helper.resource import YuzukiResource
from helper.template import render_template
class Board(Yuzu... | mit |
mschilli87/cdshelf | messages.py | 1 | 8350 | # cdshelf message definitions
# Copyright (C) 2017 Marcel Schilling
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | agpl-3.0 |
jswope00/griffinx | common/lib/xmodule/xmodule/tests/test_graders.py | 102 | 12238 | """Grading tests"""
import unittest
from xmodule import graders
from xmodule.graders import Score, aggregate_scores
class GradesheetTest(unittest.TestCase):
'''Tests the aggregate_scores method'''
def test_weighted_grading(self):
scores = []
Score.__sub__ = lambda me, other: (me.earned - oth... | agpl-3.0 |
olapaola/olapaola-android-scripting | python/src/Lib/test/test_epoll.py | 51 | 6269 | # Copyright (c) 2001-2006 Twisted Matrix Laboratories.
#
# 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, m... | apache-2.0 |
google-code-export/pyglet | tests/font/VALIGN.py | 19 | 1049 | #!/usr/bin/env python
'''Test that font.Text vertical alignment works.
Four labels will be aligned top, center, baseline and bottom.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pyglet import gl
from pyglet import font
from . import base_text
class TEST_VALIGN(base_text.Text... | bsd-3-clause |
FedoraScientific/salome-geom | doc/salome/examples/basic_operations_ex01.py | 1 | 1302 | # Partition
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
gg = salome.ImportComponentGUI("GEOM")
# create a vertex and a vector
p0 = geompy.MakeVertex( 0., 0., 0.)
p200 = geompy.MakeVertex(200., 200., 200.)
pz = geompy.MakeVertex( ... | lgpl-2.1 |
zhenv5/scikit-learn | sklearn/metrics/cluster/tests/test_unsupervised.py | 230 | 2823 | import numpy as np
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn.metrics.cluster.unsupervised import silhouette_score
from sklearn.metrics import pairwise_distances
from sklearn.utils.testing import assert_false, assert_almost_equal
from sklearn.utils.testing import assert_raises_regexp... | bsd-3-clause |
ahu-odoo/odoo | addons/l10n_in/__init__.py | 702 | 1046 | # -*- 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... | agpl-3.0 |
ksophocleous/grpc | src/python/grpcio/grpc/framework/foundation/abandonment.py | 63 | 1822 | # Copyright 2015, 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... | bsd-3-clause |
Poppin-Tech/mitro | mitro-core/tools/txnsim.py | 25 | 1305 | #!/usr/bin/env python
import sys
import random
import heapq
DISTRIBUTION = [
341,
444,
551,
656,
765,
906,
1130,
1588,
3313,
84399
]
EVENTS_PER_MS = 5754. / 431997259
# do a simulation
MAX_TIME = 60 * 60 * 24 * 1000
if __name__ == '__main__':
scale_factor = int(sys.argv[1])
exp_lambda = (EVENTS_PER_MS * sc... | gpl-3.0 |
crazcalm/PyTN_talk_proposal | recipies/recipe1/tests/test_fib.py | 1 | 1634 | import unittest
import fib
class Testing(unittest.TestCase):
def test_testing(self):
self.assertEqual(1,1, "Of course it does!")
class Fib_(unittest.TestCase):
def setUp(self):
self.fib = fib.fib2
def basecase_num_1(self):
self.assertEqual(self.fib(1), 0, "fib num 1 is not c... | mit |
edxnercel/edx-platform | common/djangoapps/status/status.py | 48 | 1463 | """
A tiny app that checks for a status message.
"""
from django.conf import settings
from django.core.cache import cache
import json
import logging
import os
log = logging.getLogger(__name__)
def get_site_status_msg(course_id):
"""
Look for a file settings.STATUS_MESSAGE_PATH. If found, read it,
parse... | agpl-3.0 |
izgzhen/servo | tests/wpt/harness/wptrunner/browsers/b2g.py | 117 | 8016 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import tempfile
import shutil
import subprocess
import fxos_appgen
import gaiatest
import mozdevice
import mo... | mpl-2.0 |
jjscarafia/odoo | addons/website_forum/__openerp__.py | 321 | 1905 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
shakamunyi/tensorflow | tensorflow/python/kernel_tests/session_ops_test.py | 104 | 10517 | # Copyright 2015 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... | apache-2.0 |
DongjunLee/kino-bot | kino/skills/weather.py | 1 | 3681 | # -*- coding: utf-8 -*-
import arrow
import forecastio
from geopy.geocoders import Nominatim
from hbconfig import Config
from urllib import parse
from ..open_api.airkoreaPy import AirKorea
from ..slack.resource import MsgResource
from ..slack.slackbot import SlackerAdapter
from ..slack.template import MsgTemplate
f... | mit |
DemocracyClub/EveryElection | every_election/apps/organisations/boundaries/osni.py | 1 | 1622 | import json
import urllib.request
from urllib.error import HTTPError
from retry import retry
from django.contrib.gis.geos import GEOSGeometry
from storage.shapefile import convert_geom_to_multipolygon
class OsniLayer:
@retry(HTTPError, tries=2, delay=30)
def get_data_from_url(self, url):
with urllib.r... | bsd-3-clause |
SachaMPS/django-cms | cms/utils/admin.py | 22 | 4578 | # -*- coding: utf-8 -*-
import json
from django.contrib.auth import get_permission_codename
from django.contrib.sites.models import Site
from django.http import HttpResponse
from django.shortcuts import render
from django.utils.encoding import smart_str
from cms.constants import PUBLISHER_STATE_PENDING, PUBLISHER_STA... | bsd-3-clause |
183amir/gahshomar | src/GahShomar/gs_main_window.py | 1 | 10779 | #!/usr/bin/env python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: s; tab-width: 4 -*-
#
# Copyright (C) 2014 Amir Mohammadi <183.amir@gmail.com>
#
# Gahshomar 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... | gpl-3.0 |
migueldiascosta/pymatgen-db | matgendb/vv/validate.py | 1 | 25272 | """
Collection validator
"""
__author__ = "Dan Gunter"
__copyright__ = "Copyright 2012-2013, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Dan Gunter"
__email__ = "dkgunter@lbl.gov"
__status__ = "Development"
__date__ = "1/31/13"
import pymongo
import random
import re
import sys
import collections
from... | mit |
with-git/tensorflow | tensorflow/contrib/training/python/training/sampling_ops_threading_test.py | 129 | 2884 | # 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... | apache-2.0 |
al1221/ghost-openshift | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/styles/manni.py | 364 | 2374 | # -*- coding: utf-8 -*-
"""
pygments.styles.manni
~~~~~~~~~~~~~~~~~~~~~
A colorful style, inspired by the terminal highlighting style.
This is a port of the style used in the `php port`_ of pygments
by Manni. The style is called 'default' there.
:copyright: Copyright 2006-2013 by the Pygments... | mit |
dq922/PerfKitExplorer | third_party/py/dateutil/zoneinfo/__init__.py | 265 | 2575 | """
Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard python 2.3+
datetime module.
"""
from dateutil.tz import tzfile
from tarfile import TarFile
import os
__author__ = "Gustavo Niemeyer <gustavo@niemeyer.net>"
__license__ = "PSF License"
__all__ = ["setca... | apache-2.0 |
nirmeshk/oh-mainline | vendor/packages/Django/django/views/generic/edit.py | 102 | 8569 | from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
from django.views.generic.detail import (Single... | agpl-3.0 |
ctherien/pysptools | pysptools/skl/km.py | 1 | 4885 | #
#------------------------------------------------------------------------------
# Copyright (c) 2013-2014, Christian Therien
#
# 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
#
# h... | apache-2.0 |
yujikato/DIRAC | src/DIRAC/TransformationSystem/Agent/TransformationAgent.py | 1 | 30031 | """ TransformationAgent processes transformations found in the transformation database.
The following options can be set for the TransformationAgent.
.. literalinclude:: ../ConfigTemplate.cfg
:start-after: ##BEGIN TransformationAgent
:end-before: ##END
:dedent: 2
:caption: TransformationAgent options
"""
fro... | gpl-3.0 |
NeCTAR-RC/nova | nova/cells/weights/ram_by_instance_type.py | 22 | 1674 | # Copyright (c) 2012-2013 Rackspace Hosting
# 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
#
# Unles... | apache-2.0 |
svanschalkwyk/datafari | windows/python/Lib/curses/__init__.py | 108 | 1817 | """curses
The main package for curses support for Python. Normally used by importing
the package, and perhaps a particular module inside it.
import curses
from curses import textpad
curses.initscr()
...
"""
__revision__ = "$Id$"
from _curses import *
from curses.wrapper import wrapper
import os as _os... | apache-2.0 |
partofthething/home-assistant | homeassistant/helpers/device_registry.py | 1 | 29903 | """Provide a way to connect entities belonging to one device."""
from collections import OrderedDict
import logging
import time
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union, cast
import attr
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import Ev... | mit |
Dhivyap/ansible | test/units/modules/network/netvisor/test_pn_role.py | 23 | 2994 | # Copyright: (c) 2018, Pluribus Networks
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_role
from un... | gpl-3.0 |
iotile/coretools | iotilecore/test/test_schema_verify/test_dict_verifier.py | 1 | 2701 | import pytest
from iotile.core.utilities.schema_verify import BytesVerifier, DictionaryVerifier, ListVerifier, StringVerifier, IntVerifier, BooleanVerifier, LiteralVerifier, OptionsVerifier
from iotile.core.exceptions import ValidationError
@pytest.fixture
def verifier1():
ver = DictionaryVerifier('test verifier'... | gpl-3.0 |
veger/ansible | test/units/modules/storage/netapp/test_netapp_e_auditlog.py | 68 | 10758 | # (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.storage.netapp.netapp_e_auditlog import AuditLog
from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type
from units.compat import mock... | gpl-3.0 |
zhenv5/scikit-learn | sklearn/decomposition/__init__.py | 147 | 1421 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA
from .incrementa... | bsd-3-clause |
alexec/selenium | py/test/selenium/webdriver/common/element_attribute_tests.py | 65 | 12160 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
markYoungH/chromium.src | build/android/pylib/base/base_test_result.py | 9 | 5913 | # Copyright (c) 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.
"""Module containing base test results classes."""
class ResultType(object):
"""Class enumerating test types."""
PASS = 'PASS'
SKIP = 'SKIP'
FAI... | bsd-3-clause |
Ambrosys/protobuf | gtest/test/gtest_throw_on_failure_test.py | 2917 | 5766 | #!/usr/bin/env python
#
# Copyright 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... | bsd-3-clause |
ubc/edx-platform | lms/djangoapps/lti_provider/tests/test_signature_validator.py | 139 | 3804 | """
Tests for the SignatureValidator class.
"""
import ddt
from django.test import TestCase
from django.test.client import RequestFactory
from mock import patch
from lti_provider.models import LtiConsumer
from lti_provider.signature_validator import SignatureValidator
def get_lti_consumer():
"""
Helper meth... | agpl-3.0 |
wrcj12138aaa/WinObjC | deps/3rdparty/icu/icu/source/test/depstest/depstest.py | 189 | 7263 | #! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2014, International Business Machines
# Corporation and others. All Rights Reserved.
#
# file name: depstest.py
#
# created on: 2011may24
"""ICU dependency tester.
This probably works only on Linux.
The exit code is 0 if everything is fine, 1 for erro... | mit |
linjoahow/cd0505 | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/__init__.py | 603 | 6082 | ## pygame - Python Game Library
## Copyright (C) 2000-2001 Pete Shinners
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Library General Public
## License as published by the Free Software Foundation; either
## version 2 of the License, or (... | agpl-3.0 |
ralphcallaway/MavensMate-SublimeText | lib/command_helper.py | 8 | 3236 | def get_message(params, operation):
message = 'Handling requested operation...'
if operation == 'new-metadata':
message = 'Opening New Metadata UI'
elif operation == 'compile-metadata':
if 'paths' in params and len(params['paths']) == 1:
what = params['paths'][0]
if '... | gpl-3.0 |
r0balo/pelisalacarta | python/main-classic/servers/thevideome.py | 2 | 2392 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para thevideo.me
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re
from core import httptools
from core import l... | gpl-3.0 |
joshivineet/googletest | test/gtest_env_var_test.py | 2408 | 3487 | #!/usr/bin/env python
#
# Copyright 2008, 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... | bsd-3-clause |
eduNEXT/edunext-platform | lms/djangoapps/instructor_task/tests/test_tasks.py | 2 | 29965 | """
Unit tests for LMS instructor-initiated background tasks.
Runs tasks on answers to course problems to validate that code
paths actually work.
"""
import json
from functools import partial
from uuid import uuid4
import ddt
from celery.states import FAILURE, SUCCESS
from django.utils.translation import ugettext_n... | agpl-3.0 |
ebewe/mangopay2-python-sdk | mangopaysdk/tools/authenticationHelper.py | 2 | 1347 | from requests.auth import HTTPBasicAuth
from requests_oauthlib import OAuth2
from mangopaysdk.tools import enums
from mangopaysdk.configuration import Configuration
class AuthenticationHelper:
# Root/parent MangoPayApi instance that holds the OAuthToken and Configuration instance
_root = None
def __init... | mit |
ogenstad/ansible | lib/ansible/modules/network/aireos/aireos_command.py | 73 | 6929 | #!/usr/bin/python
#
# Copyright: Ansible Team
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
cprogrammer1994/ModernGL | examples/ported/hello_program.py | 1 | 1088 | import numpy as np
import _example
class Example(_example.Example):
title = 'Hello Program'
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.prog = self.ctx.program(
vertex_shader='''
#version 330
in vec2 in_vert;
vo... | mit |
ronert/cf-predict | setup.py | 1 | 1175 | #!/usr/bin/env python
"""Setup script for cf-predict."""
import setuptools
from cf_predict import __project__, __version__
try:
README = open("README.rst").read()
CHANGES = open("CHANGES.rst").read()
except IOError:
DESCRIPTION = "<placeholder>"
else:
DESCRIPTION = README + '\n' + CHANGES
setuptool... | mit |
trenton3983/Fluent_Python | 09-pythonic-obj/vector2d_v2_fmt_snippet.py | 7 | 2700 | """
A 2-dimensional vector class
>>> v1 = Vector2d(3, 4)
>>> x, y = v1
>>> x, y
(3.0, 4.0)
>>> v1
Vector2d(3.0, 4.0)
>>> v1_clone = eval(repr(v1))
>>> v1 == v1_clone
True
>>> print(v1)
(3.0, 4.0)
>>> octets = bytes(v1)
>>> octets
b'\\x00\\x00\\x00\\x00\\x00\\x00\... | mit |
endolith/numpy | numpy/distutils/fcompiler/__init__.py | 6 | 39984 | """numpy.distutils.fcompiler
Contains FCompiler, an abstract base class that defines the interface
for the numpy.distutils Fortran compiler abstraction model.
Terminology:
To be consistent, where the term 'executable' is used, it means the single
file, like 'gcc', that is executed, and should be a string. In contras... | bsd-3-clause |
deepmind/open_spiel | open_spiel/python/algorithms/double_oracle_test.py | 1 | 2223 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | apache-2.0 |
sankhesh/VTK | ThirdParty/Twisted/twisted/trial/runner.py | 28 | 26163 | # -*- test-case-name: twisted.trial.test.test_runner -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A miscellany of code used to run Trial tests.
Maintainer: Jonathan Lange
"""
__all__ = [
'TestSuite',
'DestructiveTestSuite', 'DryRunVisitor', 'ErrorHolder', 'LoggedSuite',
... | bsd-3-clause |
fabrice-lecuyer/QuantLib-SWIG | Python/examples/bermudan-swaption.py | 2 | 7897 |
# Copyright (C) 2004, 2005, 2006, 2007 StatPro Italia srl
#
# This file is part of QuantLib, a free-software/open-source library
# for financial quantitative analysts and developers - http://quantlib.org/
#
# QuantLib is free software: you can redistribute it and/or modify it under the
# terms of the QuantLib license.... | bsd-3-clause |
jamespcole/home-assistant | homeassistant/components/cloud/__init__.py | 1 | 6414 | """Component to integrate the Home Assistant cloud."""
import logging
import voluptuous as vol
from homeassistant.auth.const import GROUP_ID_ADMIN
from homeassistant.components.alexa import smart_home as alexa_sh
from homeassistant.components.google_assistant import const as ga_c
from homeassistant.const import (
... | apache-2.0 |
ODM2/ODM2StreamingDataLoader | src/wizard/view/clsDataConfigPanel.py | 1 | 7327 | import sys
import wx
#import wx.lib.agw.ultimatelistctrl as ULC
from ObjectListView import ObjectListView, ColumnDefn
import wx.lib.mixins.gridlabelrenderer as glr
from src.wizard.controller.frmVirtualList import VirtualList
from src.wizard.controller.frmVirtualGrid import VirtualGrid, GridBase
#from lib.ObjectListView... | bsd-3-clause |
amosonn/distributed | distributed/bokeh/workers/main.py | 2 | 2796 | #!/usr/bin/env python
from __future__ import print_function, division, absolute_import
import json
import os
from bokeh.io import curdoc
from bokeh.layouts import column, row
from toolz import valmap
from tornado import gen
from distributed.core import rpc
from distributed.bokeh.worker_monitor import (worker_table... | bsd-3-clause |
tedi3231/openerp | build/lib/openerp/addons/google_base_account/wizard/__init__.py | 62 | 1076 | # -*- 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... | agpl-3.0 |
saquiba2/numpytry | numpy/distutils/fcompiler/__init__.py | 152 | 38302 | """numpy.distutils.fcompiler
Contains FCompiler, an abstract base class that defines the interface
for the numpy.distutils Fortran compiler abstraction model.
Terminology:
To be consistent, where the term 'executable' is used, it means the single
file, like 'gcc', that is executed, and should be a string. In contras... | bsd-3-clause |
clemkoa/scikit-learn | sklearn/covariance/graph_lasso_.py | 7 | 27246 | """GraphLasso: sparse inverse covariance estimation with an l1-penalized
estimator.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
# Copyright: INRIA
import warnings
import operator
import sys
import time
import numpy as np
from scipy import linalg
from .empirical_covariance_ im... | bsd-3-clause |
nicememory/pie | pyglet/tests/unit/media/test_riff.py | 1 | 2225 | """
Test the internal RIFF reader.
"""
import os
import unittest
from pyglet.media.sources.riff import WaveSource
test_data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'media'))
class RiffTest(unittest.TestCase):
def test_pcm_16_11025_1ch(self):
file_name = os.path... | apache-2.0 |
pemryan/DAKOTA | packages/plplot/examples/python/x08.py | 1 | 1883 | #!/usr/bin/env python
#
# x08c.c
#
# 3-d plot demo.
from Numeric import *
import math
#import pl
import sys
import os
module_dir = "@MODULE_DIR@"
if module_dir[0] == '@':
module_dir = os.getcwd ()
sys.path.insert (0, module_dir)
XPTS = 35 # Data points in x
YPTS = 46 # Data points in y
opt = [1, 2, 3, 3]
alt ... | lgpl-2.1 |
MaxMorgenstern/EmeraldAI | EmeraldAI/Pipelines/ScopeAnalyzer/AnalyzeScope.py | 1 | 4673 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from EmeraldAI.Logic.Singleton import Singleton
from EmeraldAI.Logic.NLP.SentenceResolver import SentenceResolver
from EmeraldAI.Entities.ContextParameter import ContextParameter
from EmeraldAI.Entities.User import User
from EmeraldAI.Config.Config import Config
from EmeraldAI.... | apache-2.0 |
google/llvm-propeller | lldb/third_party/Python/module/pexpect-4.6/pexpect/popen_spawn.py | 16 | 6161 | """Provides an interface like pexpect.spawn interface using subprocess.Popen
"""
import os
import threading
import subprocess
import sys
import time
import signal
import shlex
try:
from queue import Queue, Empty # Python 3
except ImportError:
from Queue import Queue, Empty # Python 2
from .spawnbase import ... | apache-2.0 |
apyrgio/ganeti | test/py/cmdlib/testsupport/utils_mock.py | 11 | 1826 | #
#
# Copyright (C) 2013 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and ... | bsd-2-clause |
hperala/kontuwikibot | tests/upload_tests.py | 1 | 1395 | # -*- coding: utf-8 -*-
"""
Site upload test.
These tests write to the wiki.
"""
#
# (C) Pywikibot team, 2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 4d1b1ea2f42aee542722240c9618cc72b4f1bcbb $'
import os
import pywikibot
from tests import _... | mit |
zlorb/mitmproxy | mitmproxy/net/http/url.py | 4 | 3398 | import urllib.parse
from typing import Sequence
from typing import Tuple
from mitmproxy.net import check
def parse(url):
"""
URL-parsing function that checks that
- port is an integer 0-65535
- host is a valid IDNA-encoded hostname with no null-bytes
- path is valid AS... | mit |
aospcus/android_kernel_htc_flounder | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 12980 | 5411 | # SchedGui.py - Python extension for perf script, basic GUI code for
# traces drawing and overview.
#
# Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com>
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
... | gpl-2.0 |
linjoahow/2015cdaa-w11 | static/Brython3.1.1-20150328-091302/Lib/sys.py | 408 | 4998 | # hack to return special attributes
from _sys import *
from javascript import JSObject
has_local_storage=__BRYTHON__.has_local_storage
has_session_storage = __BRYTHON__.has_session_storage
has_json=__BRYTHON__.has_json
brython_debug_mode = __BRYTHON__.debug
argv = ['__main__']
base_exec_prefix = __BRYTHON__.brython_... | gpl-3.0 |
krikru/tensorflow-opencl | tensorflow/python/framework/file_system_test.py | 18 | 2120 | # Copyright 2015 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... | apache-2.0 |
NotLeet/n0tb0t | tests/unit_tests/test_commands.py | 2 | 6471 | from enum import Enum, auto
from inspect import getsourcefile
import os
import sys
from unittest.mock import Mock
import pytest
from collections import deque
current_path = os.path.abspath(getsourcefile(lambda: 0))
current_dir = os.path.dirname(current_path)
root_dir = os.path.join(current_dir, os.pardir, os.pardir)
... | gpl-3.0 |
seppius-xbmc-repo/ru | plugin.video.shura.tv/resources/lib/demjson.py | 1 | 90082 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
r""" A JSON data encoder and decoder.
This Python module implements the JSON (http://json.org/) data
encoding format; a subset of ECMAScript (aka JavaScript) for encoding
primitive data types (numbers, strings, booleans, lists, and
associative arrays) in a la... | gpl-2.0 |
bdrung/audacity | lib-src/lv2/sratom/waflib/extras/autowaf.py | 176 | 22430 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import glob
import os
import subprocess
import sys
from waflib import Configure,Context,Logs,Node,Options,Task,Utils
from waflib.TaskGen import feature,before,after
global g_i... | gpl-2.0 |
sneaker-rohit/PI2-ns-3 | src/lte/doc/source/conf.py | 93 | 7620 | # -*- coding: utf-8 -*-
#
# ns-3 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 14 09:00:39 2010.
#
# 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 co... | gpl-2.0 |
hshindo/POS-Tagging-benchmark | Theano/layer.py | 1 | 1138 | __author__ = 'hiroki'
import theano
import theano.tensor as T
import numpy as np
from nn_utils import sigmoid
class Layer(object):
def __init__(self, rand, input=None, n_input=784, n_output=10, activation=None, W=None, b=None):
self.input = input
if W is None:
W_values = np.asarray(... | mit |
yize/grunt-tps | tasks/lib/python/Lib/python2.7/distutils/command/build.py | 250 | 5437 | """distutils.command.build
Implements the Distutils 'build' command."""
__revision__ = "$Id$"
import sys, os
from distutils.util import get_platform
from distutils.core import Command
from distutils.errors import DistutilsOptionError
def show_compilers():
from distutils.ccompiler import show_compilers
show... | mit |
sinhrks/numpy | numpy/polynomial/__init__.py | 123 | 1119 | """
A sub-package for efficiently dealing with polynomials.
Within the documentation for this sub-package, a "finite power series,"
i.e., a polynomial (also referred to simply as a "series") is represented
by a 1-D numpy array of the polynomial's coefficients, ordered from lowest
order term to highest. For example, a... | bsd-3-clause |
kursitet/edx-platform | lms/djangoapps/course_api/tests/test_permissions.py | 61 | 1738 | """
Test authorization functions
"""
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from .mixins import CourseApiFactoryMixin
from ..permissions import can_view_courses_for_username
class ViewCoursesForUsernameTestCase(CourseApiFactoryMixin, TestCase):
"""
Verify func... | agpl-3.0 |
mlalic/servo | tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py | 238 | 1454 | from wptserve.handlers import HTTPException
import urllib
def main(request, response):
if request.method != "GET":
raise HTTPException(400, message="Method was not GET")
if not "id" in request.GET:
raise HTTPException(400, message="No id")
id = request.GET['id']
if "read" in request.... | mpl-2.0 |
swjtuacmer/Ranker | Ranker/venv/lib/python2.7/site-packages/wheel/test/test_tagopt.py | 326 | 5927 | """
Tests for the bdist_wheel tag options (--python-tag, --universal, and
--plat-name)
"""
import sys
import shutil
import pytest
import py.path
import tempfile
import subprocess
SETUP_PY = """\
from setuptools import setup, Extension
setup(
name="Test",
version="1.0",
author_email="author@example.com",
... | mit |
cb1234/pynet-test | pynet/learnpy_ecourse/class7/ex2_ospf_parsing.py | 4 | 1353 | #!/usr/bin/env python
'''
Open the ./OSPF_DATA/ospf_single_interface.txt and extract the interface, IP
address, area, type, cost, hello timer, and dead timer. Use regular expressions
to accomplish your extraction.
Your output should look similar to the following:
Int: GigabitEthernet0/1
IP: 172.16.13.150/29
... | apache-2.0 |
Guts/Metadator | test/test_odf_genexample.py | 1 | 12252 | # -*- coding: UTF-8 -*-
#!/usr/bin/env python
from __future__ import unicode_literals
# odfpy_gen_example.py
# http://mashupguide.net/1.0/html/ch17s04.xhtml
"""
Description: This program used odfpy to generate a simple ODF text document
odfpy: http://opendocumentfellowship.com/projects/odfpy
documentation for o... | gpl-3.0 |
Dhivyap/ansible | lib/ansible/modules/cloud/google/gcp_mlengine_model_info.py | 3 | 6467 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gpl-3.0 |
writefaruq/lionface-app | django/core/serializers/json.py | 9 | 2118 | """
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils i... | bsd-3-clause |
jonashaag/ansible | lib/ansible/cli/pull.py | 81 | 9626 | # (c) 2012, 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) any lat... | gpl-3.0 |
shepdelacreme/ansible | lib/ansible/modules/cloud/ovirt/ovirt_snapshot.py | 19 | 9982 | #!/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
#... | gpl-3.0 |
WatanabeYasumasa/edx-platform | lms/djangoapps/instructor/tests/test_legacy_download_csv.py | 5 | 3022 | """
Unit tests for instructor dashboard
Based on (and depends on) unit tests for courseware.
Notes for running by hand:
./manage.py lms --settings test test lms/djangoapps/instructor
"""
from django.test.utils import override_settings
# Need access to internal func to put users in the right group
from django.contr... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.