code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
"""Microbenchmark for function call overhead.
This measures simple function calls that are not methods, do not use varargs or
kwargs, and do not use tuple unpacking.
"""
# Python imports
#import optparse
import time
# Local imports
import util
def foo(a, b, c, d):
# 20 calls
bar(a, b... | kikocorreoso/brython | www/benchmarks/performance/bm_call_simple.py | Python | bsd-3-clause | 3,712 |
from __future__ import print_function
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
# Mail-related stuff
from builtins import str
from builtins import object
import smtplib
import time
import json
from email.mime.multipart import MIMEMul... | sibis-platform/sibispy | sibis_email.py | Python | bsd-3-clause | 9,495 |
"""
=============================
Straight line Hough transform
=============================
The Hough transform in its simplest form is a method to detect straight lines.
In the following example, we construct an image with a line intersection. We
then use the `Hough transform <http://en.wikipedia.org/wiki/Hough_t... | rjeli/scikit-image | doc/examples/edges/plot_line_hough_transform.py | Python | bsd-3-clause | 4,764 |
"""
Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
plugin.
These tests are currently only supported when running against Darwin
targets.
"""
from __future__ import print_function
import lldb
import os
import re
from lldbsuite.test import decorators
from lldbsuite.test import lldbtest
fro... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py | Python | bsd-3-clause | 5,073 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The spm module provides basic functions for interfacing with matlab
and spm to access spm tools.
Change directory to provide relative paths for doctests
>>> import os
>>... | mick-d/nipype | nipype/interfaces/spm/model.py | Python | bsd-3-clause | 45,177 |
from django.core.management.base import BaseCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_') or not k.isupper()):
"""Convert a module namespace to a Python dictionary."""
return {k: repr(getattr(module, k)) for k in dir(module) if not omittable(k)}
class Command(BaseCommand):
hel... | theo-l/django | django/core/management/commands/diffsettings.py | Python | bsd-3-clause | 3,370 |
from datetime import timedelta
from time import time
import warnings
from gdbn.dbn import buildDBN
from gdbn import activationFunctions
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
warnings.warn("""
The nolearn... | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/nolearn-0.5/nolearn/dbn.py | Python | bsd-3-clause | 16,813 |
"""Utility module for creating transformation matrices
Basically this gives you the ability to construct
transformation matrices without needing OpenGL
or similar run-time engines. The result is that
design-time utilities can process files without
trading dependencies on a particular run-time.
This code is originall... | menpo/vrml97 | vrml/vrml97/transformmatrix.py | Python | bsd-3-clause | 11,368 |
import getpass
from django.core.management.base import BaseCommand
from hc.accounts.forms import SignupForm
from hc.accounts.views import _make_user
class Command(BaseCommand):
help = """Create a super-user account."""
def handle(self, *args, **options):
email = None
password = None
... | healthchecks/healthchecks | hc/accounts/management/commands/createsuperuser.py | Python | bsd-3-clause | 1,226 |
from django.utils.datetime_safe import datetime
from django.utils.translation import ugettext_lazy as _
from poradnia.users.models import User
def users_total(*args, **kwargs):
return User.objects.count()
users_total.name = _("Users total")
users_total.description = _("Number of users registered total")
def ... | watchdogpolska/poradnia.siecobywatelska.pl | poradnia/users/metric.py | Python | bsd-3-clause | 1,040 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
from os.path import dirname
from os.path import join
from setuptools import find_packages
from setuptools import setup
# requirements
with open('requirements.txt') as f:
required = f.read().splitlines()
with open(join(dirname(__file__), 'pyrcmd3/VERSION'), 'rb') a... | marreta-sources/pyrcmd3 | setup.py | Python | bsd-3-clause | 1,533 |
#########################################################################
# Copyright (C) 2007, 2008, 2009
# Alex Clemesha <alex@clemesha.org> & Dorian Raymer <deldotdr@gmail.com>
#
# This module is part of codenode, and is distributed under the terms
# of the BSD License: http://www.opensource.org/licenses/bsd-li... | ccordoba12/codenode | codenode/frontend/bookshelf/urls.py | Python | bsd-3-clause | 1,059 |
import unittest
from django.db import connections
from wp_frontman.models import Site, Blog
from wp_frontman.wp_helpers import month_archives, year_archives
from wp_frontman.tests.utils import MultiBlogMixin
class HelpersArchivesTestCase(MultiBlogMixin, unittest.TestCase):
def setUp(self):
super(He... | ludoo/wpkit | attic/ngfrontman/wp_frontman/tests/test_helpers_archives.py | Python | bsd-3-clause | 1,742 |
from behave import *
# Unique to Scenario: User cancels attempt to request new account
@when('I cancel the request account form')
def impl(context):
context.browser.find_by_css('.cancel').first.click()
| nlhkabu/connect | bdd/features/steps/request_account.py | Python | bsd-3-clause | 208 |
# Copyright (c) 2015 Microsoft Corporation
"""
>>> from z3 import *
>>> b = BitVec('b', 16)
>>> Extract(12, 2, b).sexpr()
'((_ extract 12 2) b)'
>>> Extract(12, 2, b)
Extract(12, 2, b)
>>> SignExt(10, b).sexpr()
'((_ sign_extend 10) b)'
>>> SignExt(10, b)
SignExt(10, b)
>>> ZeroExt(10, b).sexpr()
'((_ zero_extend 10) ... | dstaple/z3test | regressions/python/bug.2.py | Python | mit | 551 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Magic Encode
This module tries to convert an UTF-8 string to an encoded string for the printer.
It uses trial and error in order to guess the right codepage.
The code is based on the encoding-code in py-xml-escpos by @fvdsn.
:author: `Patrick Kanzler <dev@pkanzler.de>`_
... | belono/python-escpos | src/escpos/magicencode.py | Python | mit | 10,963 |
import time
time.sleep(0.25)
contents = clipboard.get_selection()
retCode, abbr = dialog.input_dialog("New Abbreviation", "Choose an abbreviation for the new phrase")
if retCode == 0:
if len(contents) > 20:
title = contents[0:17] + "..."
else:
title = contents
folder = engine.get_folder("My ... | andresgomezvidal/autokey_scripts | data/Scripts/Sample_Scripts/Abbreviation from selection.py | Python | mit | 391 |
DEBUG = True
DISCOVERY_SERVICE_URL = 'localhost:6100/discoveryservice'
| pwgn/microtut | commentservice/settings.py | Python | mit | 72 |
# encoding: utf-8
"""Definition of french pronoun related features"""
from __future__ import unicode_literals
PERSONAL = "personal"
SPECIAL_PERSONAL = "special_personal"
SNUMERAL = "snumeral"
POSSESSIVE = "possessive"
DEMONSTRATIV = "demonstrativ"
RELATIVE = "relative"
INTERROGATIVE = "interrogative"
INDEFINITE = "... | brouberol/pynlg | pynlg/lexicon/feature/pronoun/fr.py | Python | mit | 332 |
import kol.Error as Error
from GenericRequest import GenericRequest
from kol.manager import PatternManager
from kol.util import Report
class SendMessageRequest(GenericRequest):
def __init__(self, session, message):
super(SendMessageRequest, self).__init__(session)
self.url = session.serverURL + "se... | KevZho/buffbot | kol/request/SendMessageRequest.py | Python | mit | 2,734 |
# -*- coding: utf-8 -*-
#
# openMVG documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 30 11:05:58 2013.
#
# 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.
#
# A... | Smozeley/openMVG | docs/sphinx/rst/conf.py | Python | mit | 10,634 |
import time
import pytest
from redis.client import Redis
from redis.exceptions import LockError, LockNotOwnedError
from redis.lock import Lock
from .conftest import _get_client
@pytest.mark.onlynoncluster
class TestLock:
@pytest.fixture()
def r_decoded(self, request):
return _get_client(Redis, requ... | mozillazg/redis-py-doc | tests/test_lock.py | Python | mit | 7,948 |
from django.apps import AppConfig
class DownloadConfig(AppConfig):
name = 'download'
| abhijithanilkumar/ns-3-AppStore | src/download/apps.py | Python | mit | 91 |
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | GrimRanger/GeneticAlgorithm | helps/deap/deap-master/examples/ga/onemax.py | Python | mit | 5,221 |
import gym
import gym.wrappers
import gym.envs
import gym.spaces
import traceback
import logging
try:
from gym.wrappers.monitoring import logger as monitor_logger
monitor_logger.setLevel(logging.WARNING)
except Exception as e:
traceback.print_exc()
import os
import os.path as osp
from rllab.envs.base imp... | brain-research/mirage-rl-qprop | rllab/envs/gym_env.py | Python | mit | 4,134 |
# coding=utf-8
"""
The Lists API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/
Schema: https://api.mailchimp.com/schema/3.0/Lists/Instance.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
from mailchimp3.entities.listabusereports... | charlesthk/python-mailchimp | mailchimp3/entities/lists.py | Python | mit | 12,424 |
"""
The MIT License
Copyright (c) 2009 Vic Fryzel
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... | oauth-xx/python-oauth2 | tests/test_oauth.py | Python | mit | 28,822 |
from hamper.interfaces import ChatCommandPlugin, Command
try:
# Python 2
import HTMLParser
html = HTMLParser.HTMLParser()
except ImportError:
# Python 3
import html.parser
html = html.parser.HTMLParser()
import re
import requests
import json
class Lookup(ChatCommandPlugin):
name = 'looku... | iankronquist/hamper | hamper/plugins/dictionary.py | Python | mit | 3,376 |
import pytest
from collections import namedtuple
import jenkinsapi
from jenkinsapi.plugins import Plugins
from jenkinsapi.utils.requester import Requester
from jenkinsapi.jenkins import Jenkins
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.job import Job
from jenkinsapi.custom_exceptions import Jenkin... | salimfadhley/jenkinsapi | jenkinsapi_tests/unittests/test_jenkins.py | Python | mit | 12,493 |
# -*- coding: utf-8 -*-
""" S3 Logging Facility
@copyright: (c) 2014 Sahana Software Foundation
@license: MIT
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
rest... | devinbalkind/eden | modules/s3log.py | Python | mit | 11,312 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ProcessingResults.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... | medspx/QGIS | python/plugins/processing/core/ProcessingResults.py | Python | gpl-2.0 | 1,611 |
# Miro - an RSS based video player application
# Copyright (C) 2010, 2011
# Participatory Culture Foundation
#
# 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... | debugger06/MiroX | tv/extensions/watchhistory/__init__.py | Python | gpl-2.0 | 1,599 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012 CERN.
#
# Invenio 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... | CERNDocumentServer/invenio | modules/miscutil/lib/jsonutils.py | Python | gpl-2.0 | 3,590 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_colors_stddev.py
------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
**********************... | alexbruy/QGIS | python/plugins/processing/algs/grass7/ext/r_colors_stddev.py | Python | gpl-2.0 | 3,090 |
#! /usr/bin/python
# a script to preare PiSi source tarball from svn
# author: exa
#TODO: arguments for svn snapshot with rev number, or a tag to override default
import sys
import os
import shutil
def run(cmd):
print 'running', cmd
os.system(cmd)
sys.path.insert(0, '.')
import pisi
if not os.path.exists('s... | Pardus-Linux/pisi | scripts/svndist.py | Python | gpl-2.0 | 709 |
# coding=UTF-8
__author__ = 'wanghongfei'
import mysql.connector, sys
CLEAR_DB = False
args = sys.argv[1:]
if len(args) == 1:
if args[0] == 'clear':
CLEAR_DB = True
else:
print 'wrong parameter!'
sys.exit(1)
config = {
'user': 'root',
'password': '111111',
'host': 'localh... | lankeren/taolijie | script/insert-data.py | Python | gpl-3.0 | 9,304 |
from django.core.urlresolvers import reverse
from decision_test_case import DecisionTestCase
from publicweb.forms import DecisionForm
from mock import patch
from django.dispatch.dispatcher import Signal
from django.db.models import signals
from publicweb.models import Decision, decision_signal_handler
# TODO: This cla... | aptivate/econsensus | django/econsensus/publicweb/tests/edit_decision_test.py | Python | gpl-3.0 | 1,773 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'PrivatePost.text_html'
db.add_column(u'mp_privatepost', '... | Florianboux/zds-site | zds/mp/migrations/0002_auto__add_field_privatepost_text_html.py | Python | gpl-3.0 | 6,206 |
from scipy import stats
N=stats.norm
print N.mean() # 0
print N.var() # 1
xi = N.isf(0.95)
print xi # -1.64485
N.cdf(xi) # Vérification : 0.05
# Graphiques de la fonction de densité et la cumulative.
P=plot(N.cdf,x,-10,10)
Q=plot(N.pdf,x,-10,10,color="red")
show(P+Q)
| LaurentClaessens/mazhe | tex/frido/code_sage2.py | Python | gpl-3.0 | 306 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# 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 Licens... | sysadmin75/ansible-modules-core | utilities/logic/wait_for.py | Python | gpl-3.0 | 20,316 |
#!/usr/bin/env python
########################################################################
# File : dirac-proxy-init.py
# Author : Adrian Casajus
###########################################################from DIRAC.Core.Base import Script#############
import sys
import DIRAC
from DIRAC.Core.Base import Script
... | Andrew-McNab-UK/DIRAC | FrameworkSystem/scripts/dirac-proxy-get-uploaded-info.py | Python | gpl-3.0 | 2,416 |
#
# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import struct
import numpy
import six
from gnuradio import gru... | jdemel/gnuradio | gr-digital/python/digital/packet_utils.py | Python | gpl-3.0 | 27,833 |
# Copyright (C) 2008-2009 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | jeromeLB/client175 | metadata/speex.py | Python | gpl-3.0 | 1,397 |
"""
Dictzone
@website https://dictzone.com/
@provide-api no
@using-api no
@results HTML (using search portal)
@stable no (HTML can change)
@parse url, title, content
"""
import re
from lxml import html
from searx.utils import is_valid_lang
from searx.url_utils import urljoin
categories = ... | potato/searx | searx/engines/dictzone.py | Python | agpl-3.0 | 1,645 |
import rdflib
from rdflib.graph import ConjunctiveGraph as Graph
from rdflib import plugin
from rdflib.store import Store, NO_STORE, VALID_STORE
from rdflib.namespace import Namespace
from rdflib.term import Literal
from rdflib.term import URIRef
from tempfile import mkdtemp
from gstudio.models import *
def rdf_descri... | gnowledge/ncert_nroer | gstudio/testloop.py | Python | agpl-3.0 | 1,908 |
import os
import pathlib2
import logging
import yaml
import sys
import networkx as nx
from collections import namedtuple
import argparse
TRAVIS_BUILD_DIR = os.environ.get("TRAVIS_BUILD_DIR")
DOCKER_PATH_ROOT = pathlib2.Path(TRAVIS_BUILD_DIR, "docker", "build")
CONFIG_FILE_PATH = pathlib2.Path(TRAVIS_BUILD_DIR, "util",... | karimdamak123/configuration2 | util/parsefiles.py | Python | agpl-3.0 | 13,776 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.campaigns.models.catalog_filters import (
CategoryFilter, ProductFilter, Pr... | suutari-ai/shoop | shuup/campaigns/admin_module/forms/_catalog_filters.py | Python | agpl-3.0 | 734 |
"""
ACE message types for the calendar_sync module.
"""
from openedx.core.djangoapps.ace_common.message import BaseMessageType
class CalendarSync(BaseMessageType):
def __init__(self, *args, **kwargs):
super(CalendarSync, self).__init__(*args, **kwargs)
self.options['transactional'] = True
| edx-solutions/edx-platform | openedx/features/calendar_sync/message_types.py | Python | agpl-3.0 | 315 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | xlqian/navitia | source/tyr/migrations/env.py | Python | agpl-3.0 | 3,771 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlXmlLibxml(PerlPackage):
"""This module is an interface to libxml2, providing XML and H... | iulian787/spack | var/spack/repos/builtin/packages/perl-xml-libxml/package.py | Python | lgpl-2.1 | 1,155 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyUrllib3(PythonPackage):
"""HTTP library with thread-safe connection pooling, file post, ... | iulian787/spack | var/spack/repos/builtin/packages/py-urllib3/package.py | Python | lgpl-2.1 | 1,658 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/py-qtawesome/package.py | Python | lgpl-2.1 | 1,759 |
# This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# 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://... | flamableconcrete/androguard | androguard/decompiler/dad/control_flow.py | Python | lgpl-3.0 | 13,166 |
# -*- coding: utf-8 -*-
"""This file contains the airport plist plugin in Plaso."""
from plaso.events import plist_event
from plaso.parsers import plist
from plaso.parsers.plist_plugins import interface
__author__ = 'Joaquin Moreno Garijo (Joaquin.MorenoGarijo.2013@live.rhul.ac.uk)'
class AirportPlugin(interface.P... | ostree/plaso | plaso/parsers/plist_plugins/airport.py | Python | apache-2.0 | 1,452 |
toptenants_resource = {
"_links": {
"self": {
"href": "/usagedata/toptenants"
}
},
"_embedded": {
"tenants": [
]
},
}
tenant_resource = {
"ranking": 0,
"tenantId": 0,
"vmsActiveNum": 0,
"ramAllocatedTot": 0,
"vcpuAllocatedTot": 0,
"ram... | attybro/FIWARELab-monitoringAPI | monitoringProxy/model/usagedata_resources.py | Python | apache-2.0 | 424 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | python/tvm/topi/nn/dilate.py | Python | apache-2.0 | 2,530 |
# -*- encoding: utf-8 -*-
#
# 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, so... | NeCTAR-RC/ceilometer | ceilometer/storage/sqlalchemy/migrate_repo/versions/034_drop_dump_tables.py | Python | apache-2.0 | 1,278 |
import orjson
from zerver.lib.send_email import FromAddress
from zerver.lib.test_classes import WebhookTestCase
from zerver.models import Recipient, get_realm, get_user_by_delivery_email
from zerver.webhooks.teamcity.view import MISCONFIGURED_PAYLOAD_TYPE_ERROR_MESSAGE
class TeamCityHookTests(WebhookTestCase):
S... | eeshangarg/zulip | zerver/webhooks/teamcity/tests.py | Python | apache-2.0 | 4,058 |
# 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 unde... | openstack/senlin | senlin/db/utils.py | Python | apache-2.0 | 1,415 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... | AnshulYADAV007/Lean | Algorithm.Python/IndicatorSuiteAlgorithm.py | Python | apache-2.0 | 10,805 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | lcy-seso/models | fluid/neural_machine_translation/rnn_search/no_attention_model.py | Python | apache-2.0 | 4,829 |
# Zulip's OpenAPI-based API documentation system is documented at
# https://zulip.readthedocs.io/en/latest/documentation/api.html
#
# This file contains helper functions for generating cURL examples
# based on Zulip's OpenAPI definitions, as well as test setup and
# fetching of appropriate parameter values to use whe... | punchagan/zulip | zerver/openapi/curl_param_value_generators.py | Python | apache-2.0 | 11,278 |
#!/usr/bin/env python
#
# Copyright 2017 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 ... | tst-ahernandez/earthenterprise | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/geecheck_tests/user_tests/fusion_version_test.py | Python | apache-2.0 | 2,649 |
# Copyright 2010 OpenStack LLC.
# 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 b... | superstack/nova | nova/tests/api/openstack/test_accounts.py | Python | apache-2.0 | 4,537 |
# 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 a... | YanTangZhai/tf | tensorflow/python/kernel_tests/reduction_ops_test.py | Python | apache-2.0 | 24,486 |
import sys, json
import random, os, subprocess
from twisted.internet import reactor
from twisted.web import server, resource
from twisted.web.static import File
from twisted.python import log
from datetime import datetime
import urllib, urllib2
import logging
import re
from sensei_client import *
PARSER_AGENT_PORT = ... | DataDog/sensei | clients/python/sensei/sensei_ql_proxy.py | Python | apache-2.0 | 3,753 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 - Mirantis, 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 requir... | dmitryilyin/mistral | mistral/utils/__init__.py | Python | apache-2.0 | 2,765 |
# 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... | ppwwyyxx/tensorflow | tensorflow/python/distribute/values_test.py | Python | apache-2.0 | 56,467 |
from __future__ import absolute_import
from django.conf import settings
from django.core.mail import EmailMessage
from typing import Any, Mapping, Optional, Text
from zerver.lib.actions import internal_send_message
from zerver.lib.send_email import FromAddress
from zerver.lib.redis_utils import get_redis_client
from ... | vaidap/zulip | zerver/lib/feedback.py | Python | apache-2.0 | 3,063 |
#!/bin/env python
import os
import re
import sys
ws = re.compile(r'-')
f = open("list.txt")
names = f.readlines()
f.close()
for name in names:
name = name[0:-1]
newname = ""
for token in ws.split(name):
newname += token[0].upper()
newname += token[1:]
cmd = "cp %s %s" % (name,newname)
p... | wh81752/flaka | opt/rename.py | Python | apache-2.0 | 351 |
# Copyright (c) 2007-2019 UShareSoft, 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 requi... | emuus/hammr | hammr/utils/scan_utils.py | Python | apache-2.0 | 1,969 |
"""Test the Z-Wave over MQTT config flow."""
from homeassistant import config_entries, setup
from homeassistant.components.ozw.config_flow import TITLE
from homeassistant.components.ozw.const import DOMAIN
from tests.async_mock import patch
from tests.common import MockConfigEntry
async def test_user_create_entry(ha... | sdague/home-assistant | tests/components/ozw/test_config_flow.py | Python | apache-2.0 | 1,943 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any, Dict, List
from .template_parser import (
tokenize,
Token,
is_django_block_tag,
)
from six.moves import range
import os
def pretty_print_html(html, num_spaces=4):
# type: (str, int) -> str
# We us... | christi3k/zulip | tools/lib/pretty_print.py | Python | apache-2.0 | 8,553 |
# 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... | kobejean/tensorflow | tensorflow/contrib/data/python/kernel_tests/filter_dataset_op_test.py | Python | apache-2.0 | 2,828 |
# Copyright 2012 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011,2012 Akira YOSHIYAMA <akirayoshiyama@gmail.com>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "Lic... | openstack/swift | swift/common/middleware/s3api/s3token.py | Python | apache-2.0 | 17,603 |
"""
Helper module that will enable lazy imports of Cocoa wrapper items.
This should improve startup times and memory usage, at the cost
of not being able to use 'from Cocoa import *'
"""
__all__ = ('ObjCLazyModule',)
import sys
import re
import struct
from objc import lookUpClass, getClassList, nosuchclass_error, lo... | albertz/music-player | mac/pyobjc-core/Lib/objc/_lazyimport.py | Python | bsd-2-clause | 10,756 |
# this: every_hour.py
# by: Poul Staugaard (poul(dot)staugaard(at)gmail...)
# URL: http://code.google.com/p/giewiki
# ver.: 1.13
import cgi
import codecs
import datetime
import difflib
import glob
import hashlib
import logging
import os
import re
import urllib
import urlparse
import uuid
import xml.do... | wangjun/giewiki | every_hour.py | Python | bsd-2-clause | 4,271 |
from lino.api import dd
class Persons(dd.Table):
model = 'app.Person'
column_names = 'name *'
detail_layout = """
id name
owned_places managed_places
VisitsByPerson
MealsByPerson
"""
class Places(dd.Table):
model = 'app.Place'
detail_layout = """
id name ceo
owners
... | lino-framework/book | lino_book/projects/nomti/app/desktop.py | Python | bsd-2-clause | 979 |
"""Test module for wiring with invalid type of marker for attribute injection."""
from dependency_injector.wiring import Closing
service = Closing["service"]
| rmk135/dependency_injector | tests/unit/samples/wiringstringids/module_invalid_attr_injection.py | Python | bsd-3-clause | 161 |
from datadog import initialize, api
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
# Get a downtime
api.Downtime.get(2910)
| jhotta/documentation | code_snippets/api-monitor-get-downtime.py | Python | bsd-3-clause | 224 |
import os
import cStringIO as StringIO
git_binary = "git"
verbose_mode = False
try:
from subprocess import Popen, PIPE
def run_cmd(cmd):
p = Popen(cmd, shell=True,
stdin=PIPE, stdout=PIPE, stderr=PIPE,
close_fds=True)
return p.stdin, p.stdout, p.stderr
e... | slonopotamus/git_svn_server | GitSvnServer/vcs/git/data.py | Python | bsd-3-clause | 2,086 |
# -*- coding: utf-8 -*-
from functools import update_wrapper
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from cms import constants
from cms.utils.compat.urls import urljoin
__a... | samirasnoun/django_cms_gallery_image | cms/utils/conf.py | Python | bsd-3-clause | 9,303 |
# Copyright (c) 2012 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.
"""Runs Apple's SunSpider JavaScript benchmark."""
import collections
import json
import os
from telemetry.core import util
from telemetry.page import ... | jing-bao/pa-chromium | tools/perf/perf_tools/sunspider.py | Python | bsd-3-clause | 1,597 |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
- Use mailhog for emails
{% else %}
- Use console backend for emails
{% endif %}
- Add Django Debug Toolbar
- Add django-extensions as app
"""
import socket
import os
from .common... | schacki/cookiecutter-django | {{cookiecutter.project_slug}}/config/settings/local.py | Python | bsd-3-clause | 2,678 |
# (C) Datadog, Inc. 2014-2016
# (C) Cory Watson <cory@stripe.com> 2015-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from collections import defaultdict
from urlparse import urlparse
import re
# 3rd party
import requests
# project
from checks import AgentCheck
DEFAULT_MAX... | varlib1/servermall | go_expvar/check.py | Python | bsd-3-clause | 8,833 |
# Copyright (c) 2017,2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
===============================
Sigma to Pressure Interpolation
===============================
By using `metpy.calc.log_interp`, data with sigma as the vertical coordinate... | metpy/MetPy | v1.1/_downloads/0f93e682cc461be360e2fd037bf1fb7e/sigma_to_pressure_interpolation.py | Python | bsd-3-clause | 3,493 |
#
# cocos2d
# http://cocos2d.org
#
from __future__ import division, print_function, unicode_literals
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from cocos.director import director
from cocos.layer import Layer, ColorLayer
from cocos.scene import Scene
from cocos.scenes.tra... | Alwnikrotikz/los-cocos | samples/demo_transitions.py | Python | bsd-3-clause | 4,303 |
class PlasmaException(Exception):
pass
class IncompleteAtomicData(PlasmaException):
def __init__(self, atomic_data_name):
message = ('The current plasma calculation requires {0}, '
'which is not provided by the given atomic data'.format(
atomic_data_name))
super(P... | rajul/tardis | tardis/plasma/exceptions.py | Python | bsd-3-clause | 640 |
# 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.
"""Presubmit script for mojo
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into... | zhangxq5012/sky_engine | mojo/PRESUBMIT.py | Python | bsd-3-clause | 11,467 |
from energenie import switch_off
switch_off()
| rjw57/energenie | examples/simple/off.py | Python | bsd-3-clause | 47 |
"""
WSGI config for {{ cookiecutter.project_name }} project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via t... | aeikenberry/cookiecutter-django-rest-babel | {{cookiecutter.project_slug}}/config/wsgi.py | Python | bsd-3-clause | 2,232 |
# -*- coding: utf-8 -*-
import os
import sys
try:
from gluon import current
except ImportError:
print >> sys.stderr, """
The installed version of Web2py is too old -- it does not define current.
Please upgrade Web2py to a more recent version.
"""
# Version of 000_config.py
# Increment this if t... | sahana/Turkey | modules/s3_update_check.py | Python | mit | 13,160 |
__title__ = 'pif.exceptions'
__author__ = 'Artur Barseghyan'
__copyright__ = 'Copyright (c) 2013 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('InvalidRegistryItemType',)
class InvalidRegistryItemType(ValueError):
"""
Raised when an attempt is made to register an item in the registry which does... | djabber/Dashboard | bottle/dash/local/lib/pif-0.7/src/pif/exceptions.py | Python | mit | 352 |
"""
Logger for the spectroscopic toolkit packge
Goal: Use decorators to log each command in full
Author: Adam Ginsburg
Created: 03/17/2011
"""
import os
import time
class Logger(object):
"""
Logger object. Should be initiated on import.
"""
def __init__(self, filename):
"""
Open a l... | keflavich/pyspeckit-obsolete | pyspeckit/spectrum/logger.py | Python | mit | 1,211 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2011 - 2014 by Wilbert Berendsen
#
# 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
... | dliessi/frescobaldi | frescobaldi_app/autocomplete/util.py | Python | gpl-2.0 | 1,994 |
from django.db import models
import useraccounts
from librehatti.catalog.models import Product
from librehatti.catalog.models import ModeOfPayment
from librehatti.catalog.models import Surcharge
from django.contrib.auth.models import User
from librehatti.config import _BUYER
from librehatti.config import _DELIVERY_... | sofathitesh/TCCReports | src/librehatti/bills/models.py | Python | gpl-2.0 | 3,184 |
#!/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
import pkg_resources
pkg_resources.require("TurboGears")
from turbogears import update_config, start_server
import cherrypy, os, time
cherrypy.lowercase_api = True
from os.path import *
import sys
import datetime
from date... | joshmoore/openmicroscopy | components/validator/WebApp/start-validator.py | Python | gpl-2.0 | 2,476 |
#
# Copyright (c) 2008--2015 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... | xkollar/spacewalk | client/tools/rhnpush/rhnpush_confmanager.py | Python | gpl-2.0 | 4,950 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | wonder-sk/QGIS | python/plugins/processing/script/AddScriptFromFileAction.py | Python | gpl-2.0 | 3,158 |
#
# Karaka Skype-XMPP Gateway: Python package metadata
# <http://www.vipadia.com/products/karaka.html>
#
# Copyright (C) 2008-2009 Vipadia Limited
# Richard Mortier <mort@vipadia.com>
# Neil Stratford <neils@vipadia.com>
#
## This program is free software; you can redistribute it and/or
## modify it under the terms of... | gaka13/karaka | karaka/api/__init__.py | Python | gpl-2.0 | 896 |