code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | flgiordano/netcash | +/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/runtimes/python_compat.py | Python | bsd-3-clause | 5,347 |
"""A multi-producer, multi-consumer queue."""
from time import time as _time
#try:
import threading as _threading
#except ImportError:
# import dummy_threading as _threading
from collections import deque
import heapq
__all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue']
class Empty(Exception):
"E... | google/grumpy | third_party/stdlib/Queue.py | Python | apache-2.0 | 8,584 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2018 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | amjames/psi4 | psi4/driver/qcdb/molparse/chgmult.py | Python | lgpl-3.0 | 26,251 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 Julien Danjou <julien@danjou.info>
#
# 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/license... | stackforge/blazar | blazar/utils/service.py | Python | apache-2.0 | 2,893 |
#!/usr/bin/env python3
import logging
from app import app, logger
root = logging.getLogger()
root.setLevel(logging.DEBUG)
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)
if __name__ == '__main__':
logger.warn("This is a debugging configuration. Run with the gunicorn script to run in production.")... | KanColleTool/kcsrv | kcsrv.py | Python | mit | 361 |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManage... | andydandy74/ClockworkForDynamo | nodes/0.7.x/python/CurtainSystem.ByFace.py | Python | mit | 850 |
"""This example using a PasswordInput is purely for demonstration.
Putting a password plaintext in a CustomJS is not advised since it would expose the password.
"""
from bokeh.models.widgets import PasswordInput, TextInput, PreText, Button
from bokeh.layouts import column, row
from bokeh.plotting import show, output_... | Ziqi-Li/bknqgis | bokeh/examples/howto/using_password_input.py | Python | gpl-2.0 | 1,515 |
#!/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... | JVenberg/PokemonGo-Bot-Desktop | pywin/Lib/platform.py | Python | mit | 51,537 |
"""
A module for converting numbers or color arguments to *RGB* or *RGBA*
*RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the
range 0-1.
This module includes functions and classes for color specification
conversions, and for mapping numbers to colors in a 1-D array of
colors called a colormap. Color... | ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/matplotlib/colors.py | Python | gpl-2.0 | 44,182 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Command Line Client}.
"""
import argparse
from entropy.i18n import _
from entropy.output import TextInterface
from entropy.cache import Entro... | Sabayon/entropy | client/solo/commands/yell.py | Python | gpl-2.0 | 2,897 |
import sys
from hoplite.exceptions import JobFailedError
def run(config, status):
address = "10.2.1.1"
uuid = "5"
# Get an arbitrary traceback to use for testing
try:
raise TypeError()
except:
test_traceback = sys.exc_info()[2]
previous_exception = {
"type": "Test Type... | ni/hoplite | tests/test_resources/test_jobs_package/test_jobs_package/throw_job_failed_exception.py | Python | mit | 493 |
import os
from pandas import DataFrame
from cave.analyzer.base_analyzer import BaseAnalyzer
from cave.utils.helpers import check_for_features
from cave.utils.hpbandster_helpers import format_budgets
class FeatureImportance(BaseAnalyzer):
def __init__(self,
runscontainer,
):
... | automl/SpySMAC | cave/analyzer/feature_analysis/feature_importance.py | Python | bsd-3-clause | 2,224 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Martin Raspaud
# Author(s):
# Martin Raspaud <martin.raspaud@smhi.se>
# 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, eit... | pytroll/pytroll-collectors | pytroll_collectors/s3stalker.py | Python | gpl-3.0 | 5,789 |
# Copyright (c) 2018, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
# Rename and reload the Land Unit and Linked Land Unit doctypes
if frappe.db.table_e... | gsnbng/erpnext | erpnext/patches/v11_0/merge_land_unit_with_location.py | Python | agpl-3.0 | 2,375 |
# ===========================================================================
#
# Library: PyCTK
# Filename: test_axeswidget.py
#
# Copyright (c) 2015 Lamond Lab
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ... | lamondlab/pyctk | tests/test_axeswidget.py | Python | apache-2.0 | 1,326 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-dataplex | samples/generated_samples/dataplex_v1_generated_dataplex_service_list_lakes_async.py | Python | apache-2.0 | 1,491 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import webnotes.utils
from webnotes.utils import cstr
from webnotes import _
class DocType():
def __init__(self, d, dl):
self.do... | saurabh6790/medapp | support/doctype/newsletter/newsletter.py | Python | agpl-3.0 | 4,556 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any la... | kamal-gade/rockstor-core | src/rockstor/storageadmin/views/samba.py | Python | gpl-3.0 | 5,842 |
# 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 inspect
EXPECT_TESTS_COVER_FUNCTION = 'EXPECT_TESTS_COVER_FUNCTION'
def covers(coverage_path_function):
"""Allows annotation of a Test generator f... | shishkander/recipes-py | recipe_engine/third_party/expect_tests/util.py | Python | bsd-3-clause | 903 |
# coding=utf-8
# the inclusion of the tests module is not meant to offer best practices for
# testing in general, but rather to support the `find_packages` example in
# setup.py that excludes installing the "tests" package
def test_success():
assert True
| eyesee1/python-pinballmap | tests/test_simple.py | Python | mit | 261 |
# python 3 has different package names
try: from cStringIO import StringIO
except ImportError: from io import StringIO
from unittest import TestCase
import functools
from tornado.testing import AsyncTestCase
from tornado.httpclient import HTTPRequest, HTTPResponse
from tornado_stub_client.collection import RequestCol... | venmo/tornado-stub-client | tests/test_client.py | Python | mit | 2,106 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- encoding: utf-8 -*-
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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
#
#... | citrix-openstack-build/ironic | ironic/db/sqlalchemy/migrate_repo/versions/004_rename_ifaces_to_ports.py | Python | apache-2.0 | 1,050 |
from django.test import TestCase
from api.models import UsernameSnippet
class TestUsernameSnippet(TestCase):
@classmethod
def setUpTestData(cls):
UsernameSnippet.objects.create(available=True)
def test_existence(self):
u = UsernameSnippet.objects.first()
self.assertIsInstance(u, UsernameSnippet)
self.ass... | jeremyphilemon/uniqna | api/tests/test_models.py | Python | bsd-3-clause | 459 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | dennisobrien/bokeh | bokeh/sampledata/tests/test_commits.py | Python | bsd-3-clause | 1,961 |
# Copyright 2013 Mirantis Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | eayunstack/python-neutronclient | neutronclient/neutron/v2_0/lb/vip.py | Python | apache-2.0 | 3,623 |
# Copyright 2013: Intel Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | varunarya10/rally | tests/unit/benchmark/scenarios/neutron/test_utils.py | Python | apache-2.0 | 18,043 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Branch.pushed'
db.add_column('editor_branch', 'pushed', self.gf('django.db.models.fields.B... | alex/readthedocs.org | readthedocs/editor/migrations/0002_auto__add_field_branch_pushed__add_field_branch_title__add_field_branc.py | Python | mit | 8,041 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class NumberTestCase(Integratio... | tysonholub/twilio-python | tests/integration/pricing/v2/voice/test_number.py | Python | mit | 1,884 |
# -*- coding: utf-8 -*-
import repy
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name=repy.__pkgname__,
version=repy.__version__,
description="Python Regex cli tool",
author_name=repy.__author_name__,
author_email=repy.__author_email__,
... | Grokzen/repy | setup.py | Python | mit | 1,433 |
# -*- coding: latin-1 -*-
"""
SimpleGUICS2Pygame package (January 8, 2014)
It is primarily a standard Python_ (2 **and** 3) module
reimplementing the SimpleGUI particular module of CodeSkulptor_
(a browser Python interpreter).
Require Pygame_
(except for the Timer class)
(`Unofficial Windows Binaries`_)
(and must be... | moehuster/python | SimpleGUICS2Pygame/__init__.py | Python | gpl-2.0 | 2,379 |
# -*- coding: utf-8 -*-
# The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
# Michaël Peeters and Gilles Van Assche. For more information, feedback or
# questions, please refer to our website: http://keccak.noekeon.org/
#
# Implementation by Renaud Bauvin,
# hereby denoted as "the implementer".
#
# ... | vinayps/cs205_project | code/Keccak.py | Python | gpl-3.0 | 13,828 |
# Copyright 2015 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | sniperganso/python-manilaclient | manilaclient/tests/functional/test_shares_metadata.py | Python | apache-2.0 | 5,486 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/training/saving/functional_saver_test.py | Python | apache-2.0 | 5,040 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import json
from c7n.exceptions import PolicyValidationError
class StructureParser:
"""Provide fast validation and inspection of a policy file.
Intent is to provide more humane validation for top level errors
instead of prin... | thisisshi/cloud-custodian | c7n/structure.py | Python | apache-2.0 | 3,895 |
from __future__ import unicode_literals, absolute_import
from .token import Token
# Math
ADD = Token('+')
SUB = Token('-')
MUL = Token('*')
DIV = Token('/')
MOD = Token('%')
POW = Token('^')
# Comparison
EQ = Token('=')
NEQ = Token('<>')
LT = Token('<')
GT = Token('>')
LTE = Token('<=')
GTE = Token('>=')
# Boolean
... | bruth/cypher | cypher/operators.py | Python | bsd-2-clause | 772 |
# Author: Denis A. Engemann <d.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
from nose.tools import assert_equal, assert_raises
from mne import io, Epochs, read_events, pick_types
from mne.utils import requires_sklearn
from mne.decoding import compute_ems
data_dir = op.join(op.dirname(__file_... | wronk/mne-python | mne/decoding/tests/test_ems.py | Python | bsd-3-clause | 2,002 |
# This file is part of pybgen.
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Louis-Philippe Lemieux Perreault
#
# 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, includi... | lemieuxl/pybgen | pybgen/tests/test_pybgen.py | Python | mit | 15,033 |
# -*- coding: utf-8 -*-
#Copyright (c) 2007, Playful Invention Company
#Copyright (c) 2008-10, Walter Bender
#Copyright (c) 2009-10 Raúl Gutiérrez Segalés
#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... | max630/turtleart-hacks | TurtleArt/tawindow.py | Python | mit | 103,114 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-23 13:30
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("jobs", "0032_sparkjobrun_ready_at")]
operations = [
migrations.RenameField(
model_na... | mozilla/telemetry-analysis-service | atmo/jobs/migrations/0033_rename_scheduled_date.py | Python | mpl-2.0 | 405 |
import time
class Session(object):
time_limit = 20 * 60 # in seconds
student_id = None
can_invoke_api = False
def __init__(self, user, sess_id):
self.user = user
self.sess_id = sess_id
self.last_accessed = time.time()
def __get_timeout(self):
return self.last_acce... | dvshka/focus-api | focus/session.py | Python | gpl-3.0 | 764 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
:py:mod:`__init__.py` - Initialization
--------------------------------------
'''
from __future__ import division, print_function, absolute_import, unicode_literals
from .tess import *
#: The string that identifies individual targets for this mission
IDSTRING = 'TIC'... | rodluger/everest | everest/missions/tess/__init__.py | Python | mit | 842 |
# -*- coding: utf-8 -*-
from django.contrib.sites.models import Site
from django.conf import settings
def get_site_url(request, slash=False):
domain = Site.objects.get_current().domain
protocol = 'https' if request.is_secure() else 'http'
root = "%s://%s" % (protocol, domain)
if slash:
root +=... | noirbizarre/django-absolute | absolute/context_processors.py | Python | lgpl-3.0 | 703 |
# Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... | mhrivnak/pulp | client_consumer/pulp/client/consumer/config.py | Python | gpl-2.0 | 4,554 |
# coding=utf-8
"""
The MEA method consist of the two followings steps:
-Estimate the value of the row and col systematic errors, independently for every plate of the assay, by solving the
system of linear equations/
-Adjust the measurement of all compounds located in rows and col of the plate affected by the sy... | ArnaudKOPP/TransCellAssay | TransCellAssay/Stat/Normalization/MatrixErrorAmendment.py | Python | gpl-3.0 | 4,043 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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 Foundati... | IfcOpenShell/IfcOpenShell | src/blenderbim/test/tool/test_root.py | Python | lgpl-3.0 | 5,658 |
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from django.views.generic.base import View, TemplateView
from django.views import generic
from django.shortcuts import render_to_response
from django.template import RequestContext, load... | awalin/rwis | views.py | Python | lgpl-3.0 | 4,395 |
import unittest
from katas.kyu_8.multiply import multiply
class MultiplyTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(multiply(3, 4), 12)
def test_equals_2(self):
self.assertEqual(multiply(10, 10), 100)
| the-zebulan/CodeWars | tests/kyu_8_tests/test_multiply.py | Python | mit | 254 |
# ###
# Copyright (c) 2010 Konstantinos Spyropoulos <inigo.aldana@gmail.com>
#
# This file is part of inimailbot
#
# inimailbot 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, ... | edu-zamora/inimailbot | cron_updater.py | Python | gpl-3.0 | 2,032 |
__author__ = 'MegabytePhreak'
import argparse
from .systemrdl.preprocessor import preprocess_mode, preprocess
from .systemrdl.rdl_parser import RdlParser
import re
from .config import Config
import colorize
from logger import logger
preprocessor_mode_map = {
'auto': preprocess_mode.AUTO,
'none': preprocess_... | MegabytePhreak/rdl | rdlcompiler/__init__.py | Python | mit | 3,729 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xhtml/BodyTag.py | Python | gpl-3.0 | 1,051 |
import tkinter as tk
from tkinter import ttk
import sys
class GUI(object):
def __init__(self, master, cmd):
object.__init__(self)
self.master = master
self.cmd = cmd
# Create elements
self.frame = ttk.Frame(self.master)
self.button = ttk.Button(self.frame, text='Te... | oystein-hr/tkinter-gui-commands | class_example.py | Python | mit | 982 |
from django import forms
from wagtail.admin.widgets import AdminDateTimeInput
from wagtail.documents.forms import BaseDocumentForm
from wagtail.images.forms import BaseImageForm
class OverriddenWidget(forms.Widget):
pass
class AlternateImageForm(BaseImageForm):
form_only_field = forms.DateTimeField()
... | zerolab/wagtail | wagtail/tests/testapp/media_forms.py | Python | bsd-3-clause | 796 |
# Copyright (C) 2008, Benjamin Berg <benjamin@sipsolutions.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Th... | nemesiscodex/JukyOS-sugar | src/jarabe/view/tabbinghandler.py | Python | gpl-2.0 | 5,177 |
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
from frappe.utils import add_days, today
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
from erpnext.accounts.doctype.cost_center_allocation.cost_center_allocatio... | almeidapaulopt/erpnext | erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py | Python | gpl-3.0 | 4,690 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-02 05:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | mtzirkel/leakyskiff | quiz/multichoice/migrations/0001_initial.py | Python | mit | 1,525 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | afrolov1/nova | nova/tests/objects/test_objects.py | Python | apache-2.0 | 36,028 |
import abc
import pprint
import six
def _decode_plain_type(value_type, buf):
if value_type == 'int8':
return buf.getInt8()
elif value_type == 'int16':
return buf.getInt16()
elif value_type == 'int32':
return buf.getInt32()
elif value_type == 'int64':
return buf.getInt64... | toddpalino/kafka-tools | kafka/tools/protocol/responses/__init__.py | Python | apache-2.0 | 2,328 |
"""Purge old data helper."""
from datetime import timedelta
import logging
import homeassistant.util.dt as dt_util
from .util import session_scope
_LOGGER = logging.getLogger(__name__)
def purge_old_data(instance, purge_days, repack):
"""Purge events and states older than purge_days ago."""
from .models im... | fbradyirl/home-assistant | homeassistant/components/recorder/purge.py | Python | apache-2.0 | 1,430 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .envconf import *
from .path import *
__version__ = '0.3.5'
| achedeuzot/django-envconf | envconf/__init__.py | Python | mit | 131 |
#!/usr/bin/env python
#
# Copyright (C) 2017 - Massachusetts Institute of Technology (MIT)
#
# 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 License, or
# (at your option... | azariven/BioSig_SEAS | bin/test/test_SEAS_import.py | Python | gpl-3.0 | 1,357 |
from server import app
app.run()
| billyoverton/demerit-manager | run_server.py | Python | gpl-2.0 | 33 |
# Copyright 2012-2017, Damian Johnson and The Tor Project
# See LICENSE for licensing information
import io
import re
import time
import stem
import stem.control
import stem.descriptor.router_status_entry
import stem.response
import stem.version
from stem.util import str_type, int_type, connection, log, str_tools, t... | ewongbb/stem | stem/response/events.py | Python | lgpl-3.0 | 49,087 |
#
# 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
# ... | dragorosson/heat | heat/engine/resources/aws/cfn/wait_condition_handle.py | Python | apache-2.0 | 2,334 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mycroft AI 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 ... | linuxipho/mycroft-core | mycroft/util/lang/format_nl.py | Python | apache-2.0 | 12,272 |
# -*- coding: utf-8 -*-
r'''
werkzeug.script
~~~~~~~~~~~~~~~
.. admonition:: Deprecated Functionality
``werkzeug.script`` is deprecated without replacement functionality.
Python's command line support improved greatly with :mod:`argparse`
and a bunch of alternative modules.
Most ... | joshfriend/werkzeug | werkzeug/script.py | Python | bsd-3-clause | 11,671 |
class Lib:
def hello(self):
print 'Hello from lib1'
def kw_from_lib1(self):
pass
| eric-stanley/robotframework | atest/testdata/test_libraries/dir_for_libs/lib1/Lib.py | Python | apache-2.0 | 107 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-03 15:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | valdergallo/raidmanager | raid/migrations/0001_initial.py | Python | mit | 3,751 |
def check_num(e):
try:
return int(e)
except ValueError:
return 0
def sumUpNumbers(inputString):
arr = []
for e in re.findall(r"[^\W\d_]+|\d+",inputString):
arr.append(check_num(e))
return sum(arr)
| emirot/codefights | intro/sumUpNumbers.py | Python | apache-2.0 | 222 |
# 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 ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/aio/operations/_express_route_links_operations.py | Python | mit | 8,718 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | larsbutler/swift | swift/obj/server.py | Python | apache-2.0 | 55,588 |
from harr import *
import Image
import numpy as np
img = load('sky1024px.jpg')
rcoeffs = haar_2d(to_float(img[0]))
gcoeffs = haar_2d(to_float(img[1]))
bcoeffs = haar_2d(to_float(img[2]))
rstrong_coeffs = keep_ratio(rcoeffs, .0025)
gstrong_coeffs = keep_ratio(gcoeffs, .0025)
bstrong_coeffs = keep_ratio(bcoeffs, .0025)
... | nbingham1/reconstruction | old/harr_test.py | Python | gpl-3.0 | 507 |
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://ete.cgenomics.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public ... | csc8630Spring2014/Clusterizer | ete2/treeview/qt4_rect_render.py | Python | mit | 3,941 |
from energyPATHWAYS.database import CsvDatabase
from energyPATHWAYS.schema import load_data_objects
if __name__ == '__main__':
dbname = '171112_US'
testPostgres = False
db = CsvDatabase.get_database(pathname=dbname)
scenario = 'foo' # TBD: not yet implemented
load_data_objects(scenario)
p... | energyPATHWAYS/energyPATHWAYS | model_building_tools/gen_classes/test_classes.py | Python | mit | 334 |
import os
from selenium import webdriver
from django.test import LiveServerTestCase
from dcbase.tests import BaseTestCase
from dcbase.tests.browser.pages.loginPage import LoginPage
class BrowserTestCase(LiveServerTestCase, BaseTestCase):
_pageClass = None
_browser = None
_windowWidth = 1024
_windowHe... | tctimmeh/dc-django-base | dcbase/tests/browser/browserTestCase.py | Python | mit | 2,291 |
import logging
import threading
import sys
from libs import Leap
from core.listeners import LeapListener
class LeapMotionListenerThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
# set this thread as a daemon to terminate when the
# main program terminates.
... | jerechua/LeapBoard | core/threads.py | Python | mit | 753 |
from six import PY3
import sys
import unittest
from six.moves import StringIO
from io import BytesIO
from robot.result import ExecutionResult
from robot.reporting.outputwriter import OutputWriter
from robot.utils import XmlWriter
from robot.utils.asserts import assert_equals
from robot.utils import ET, ETSource
fro... | userzimmermann/robotframework-python3 | utest/result/test_resultserializer.py | Python | apache-2.0 | 1,897 |
"""This file implements the gym environment of minitaur.
"""
import math
import random
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
os.sys.path.insert(0, parentdir)
from gym import spaces
import nump... | MadManRises/Madgine | shared/bullet3-2.89/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_ball_gym_env.py | Python | mit | 5,864 |
# Module: UnitTests.tUtils.py
# Version: 0.1
# Author: Aaron Sharp
# Date: 06/25/2015
#
# The purpose of this module is to provide unit tests for Utils
import unittest
from UnitTests.Helper import Mock
import os
from copy import copy
import Utils.CD
import Utils.Resources
import Utils.MacbookProResources
import Utils.... | sharpa/OMWare | UnitTests/tUtils.py | Python | gpl-2.0 | 6,805 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class TokenTestCase(Integration... | tysonholub/twilio-python | tests/integration/api/v2010/account/test_token.py | Python | mit | 2,152 |
import gc
import upywraptest
def TestRefCount(getObject):
simpleCollection = upywraptest.SimpleCollection()
simpleCollection.Add(getObject())
for i in range(20):
if simpleCollection.Reference(0) == 1:
print('collect did reclaim object', i)
break
gc.collect()
else:
print('collect did not... | stinos/micropython-wrap | tests/py/classref.py | Python | mit | 412 |
def print_title():
print ('\n' * 80 + '*' * 80 + """
_____ __ .__ __________ __
/ \ ____ _____/ |_|__| ____ ____\______ \ _____/ |_
/ \ / \_/ __ \ / \ __\ |/ _ \ / \| | _// _ \ __\\
/ Y \ ___/| | \ | | ( <_> ) | \ | ( ... | MyBagofTricks/MentionBot | modules/messages.py | Python | gpl-2.0 | 2,011 |
r"""
This module contains specific inner product matrices for the different bases in
the Chebyshev family of the second kind.
A naming convention is used for the first capital letter for all matrices.
The first letter refers to type of matrix.
- Mass matrices start with `B`
- One derivative start with `C`
... | spectralDNS/shenfun | shenfun/chebyshevu/matrices.py | Python | bsd-2-clause | 8,007 |
from addondev import initializer
import os
# Initialize mock kodi environment
initializer(os.path.join(os.path.dirname(os.path.dirname(__file__)), "script.module.codequick"))
| willforde/script.module.codequick | tests/__init__.py | Python | gpl-2.0 | 176 |
# Markov Logic Networks - Grounding
#
# (C) 2013 by Daniel Nyga (nyga@cs.tum.edu)
#
# 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 ri... | danielnyga/pracmln | python3/pracmln/mln/grounding/bpll.py | Python | bsd-2-clause | 23,873 |
# Do not delete - marks this directory as a python package.
#
# 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 t... | mbroadst/debian-qpid-python | qpid_tests/broker_0_8/__init__.py | Python | apache-2.0 | 913 |
#!/usr/bin/env python
## \file adjoint.py
# \brief python package for running adjoint problems
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com).
# Dr. Thomas D. Economon (economon@stanford.edu).
#
# SU... | cspode/SU2 | SU2_PY/SU2/run/adjoint.py | Python | lgpl-2.1 | 4,118 |
import os
import boto3
from chalice import Chalice
from chalicelib import db
app = Chalice(app_name='mytodo')
app.debug = True
_DB = None
def get_app_db():
global _DB
if _DB is None:
_DB = db.DynamoDBTodo(
boto3.resource('dynamodb').Table(
os.environ['APP_TABLE_NAME'])
... | aws-samples/chalice-workshop | code/todo-app/part1/04-add-auth/app.py | Python | apache-2.0 | 1,143 |
'''
Created on Feb 4, 2013
@author: atadych
'''
from xml.etree import ElementTree
import sys
import numpy
def isodd(num):
return num & 1 and True or False
class CptNodesHolder:
'''
Parses xdsl file and holds all the nodes as dictionary
'''
def __init__(self, filename=None):
#dictionary o... | FunctionLab/function | flib/core/xdsl.py | Python | gpl-3.0 | 5,740 |
class PermissionDenied(Exception):
def __init__(self, detail=None):
self.detail = detail
class NotFound(Exception):
def __init__(self, detail=None):
self.detail = detail
class BadRequest(Exception):
def __init__(self, detail=None):
self.detail = detail
| renalreg/radar | radar/exceptions.py | Python | agpl-3.0 | 293 |
from django.http import HttpResponseRedirect
from satchmo_store.shop.models import Order, OrderStatus
from signals import pending_order_confirmed
def _dumb_success(controller):
"""
Stripped-down implementation of `ConfirmController._onSuccess()`:
- removed check for whether order has been paid in full
... | rctay/satchmo-payment-dumb | utils.py | Python | bsd-3-clause | 1,133 |
# #
# Copyright 2012-2014 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | gc3-uzh-ch/easybuild-framework | easybuild/tools/testing.py | Python | gpl-2.0 | 11,926 |
"""
Tree_Words.py
Description
-----------
Concatenates words processed by pennconverter.jar into sentences
Usage:
Concatenate
-----------
Concatenate('Test.txt')
Si Kai Lee 06/03/2015
"""
import re
def Concatenate(filename):
F = open(filename, "r")
Input = F.readlines()
# print Input
F.close
... | atechnicolorskye/PTB-Unconverter | Trees_Words.py | Python | gpl-2.0 | 777 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Convert schema to sql create table command
"""
import sys
from yaml import safe_load
from sherlock.common.redshift_schema import RedShiftLogSchema
class InvalidAttribute(Exception):
pass
class NameConflict(Exception):
pass
def mk_create_table_sql_cmd(name, ... | Yelp/mycroft | mycroft/sherlock/tools/schema2sql.py | Python | mit | 1,553 |
"""
A formulation in original variables of a wedding seating problem
Authors: Stuart Mitchell 2010
"""
import pulp
try:
import path
except ImportError:
pass
try:
import src.dippy as dippy
from src.dippy import DipSolStatOptimal
except ImportError:
import coinor.dippy as di... | tkralphs/Dip | Dip/src/dippy/examples/wedding/wedding.py | Python | epl-1.0 | 5,083 |
#!/usr/bin/env python
#
# Copyright 2008 Google 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 ... | m-lab/mlab-ns | server/mapreduce/lib/graphy/formatters.py | Python | apache-2.0 | 6,837 |
__all__ = ['atleast_1d','atleast_2d','atleast_3d','vstack','hstack',
'column_stack','row_stack', 'dstack','array_split','split','hsplit',
'vsplit','dsplit','apply_over_axes','expand_dims',
'apply_along_axis', 'kron', 'tile', 'get_array_wrap']
import numpy.core.numeric as _nx
from numpy... | houseind/robothon | GlyphProofer/dist/GlyphProofer.app/Contents/Resources/lib/python2.6/numpy/lib/shape_base.py | Python | mit | 28,902 |
#!/usr/bin/env python3
from build import ninja_common
build = ninja_common.Build("auv_math/libquat")
build.build_c_shared('quat', ['quat.c'])
| cuauv/software | auv_math/libquat/configure.py | Python | bsd-3-clause | 144 |
#!/usr/bin/env python3
# Copyright (c) 2014 Pawel Rozlach, Brainly.com sp. z o.o.
#
# 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 re... | vespian/inventory_tool | inventory_tool/validators.py | Python | apache-2.0 | 8,724 |
import base64
def model_instance_id_to_base64(instance):
return base64_encode(f'{instance.__class__.__name__}Node:{instance.id}')
def base64_encode(string):
return base64.b64encode(bytes(string, 'utf-8')).decode('utf-8')
| pity7736/olimpiadas | utils/__init__.py | Python | gpl-3.0 | 233 |
__author__ = "Tiago Gomes"
__license__ = "GPL"
__version__ = "0.0.1"
__email__ = "tiago.gomes@ufms.br"
import matplotlib.pyplot as plt
def ler_modelos(arquivo):
x = []
y = []
dataset = open(arquivo, 'r')
for line in dataset:
line = line.strip()
X, Y = line.split(',')
x.app... | gomes310/1D_Velocity_Model | 1DVelocityModel.py | Python | gpl-3.0 | 1,468 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.