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 |
|---|---|---|---|---|---|
# -*- 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... | gvb/odoo | addons/sale/sale.py | Python | agpl-3.0 | 71,046 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Financial contributors: Hasa SA, Open Net SA,
# Prisme Solutions Informatique SA, Quod SA
#
# This program is free software: you... | odoousers2014/LibrERP | l10n_ch_payment_slip/wizard/bvr_import.py | Python | agpl-3.0 | 13,953 |
from facts import FactRules
from sympy.core.compatibility import cmp
class CycleDetected(Exception):
"""(internal) used to detect cycles when evaluating assumptions
through prerequisites
"""
pass
class AssumeMeths(object):
""" Define default assumption methods.
AssumeMeths should be used... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sympy/core/assumptions.py | Python | agpl-3.0 | 12,183 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo Addon, Open Source Management Solution
# Copyright (C) 2014-now Equitania Software GmbH(<http://www.equitania.de>).
#
# This program is free software: you can redistribute it and/or modify
# it un... | equitania/myodoo-addons-v10 | eq_website_quote/__init__.py | Python | agpl-3.0 | 1,002 |
import datetime
from django import template
from registration.models import RegistrationProfile
register = template.Library()
@register.simple_tag
def get_volunteer_number():
volunteers = RegistrationProfile.objects.all().count()
return volunteers
| koolfreak/volunteer_planner | scheduler/templatetags/number_registrations.py | Python | agpl-3.0 | 260 |
# 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... | titusfortner/selenium | py/selenium/webdriver/support/wait.py | Python | apache-2.0 | 4,895 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetClicksForLink
# Returns the number of clicks on a single Bitly link.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you... | jordanemedlock/psychtruths | temboo/core/Library/Bitly/LinkMetrics/GetClicksForLink.py | Python | apache-2.0 | 5,517 |
# 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... | DaanHoogland/cloudstack | systemvm/debian/opt/cloud/bin/cs_forwardingrules.py | Python | apache-2.0 | 3,239 |
"""Allow users to set and activate scenes."""
from __future__ import annotations
import logging
from typing import Any, NamedTuple
import voluptuous as vol
from homeassistant import config as conf_util
from homeassistant.components.light import ATTR_TRANSITION
from homeassistant.components.scene import DOMAIN as SCE... | lukas-hetzenecker/home-assistant | homeassistant/components/homeassistant/scene.py | Python | apache-2.0 | 9,460 |
# Copyright 2017 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/eager/imperative_grad.py | Python | apache-2.0 | 3,071 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2013 Contributor
#
# 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 Li... | jrha/aquilon | upgrade/1.4.5/aquilon/aqdb/model/building.py | Python | apache-2.0 | 2,077 |
# -*- coding: utf-8 -*-
import os
from future.moves.urllib.parse import quote
import uuid
import ssl
from pymongo import MongoClient
import requests
from django.apps import apps
from addons.wiki import settings as wiki_settings
from addons.wiki.exceptions import InvalidVersionError
from osf.utils.permissions import A... | mfraezz/osf.io | addons/wiki/utils.py | Python | apache-2.0 | 7,955 |
#
# 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... | Acehaidrey/incubator-airflow | airflow/providers/amazon/aws/hooks/sns.py | Python | apache-2.0 | 3,748 |
# 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... | benoitsteiner/tensorflow-opencl | tensorflow/python/ops/nn.py | Python | apache-2.0 | 4,256 |
#!/usr/bin/python
#
# 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 b... | wubr2000/googleads-python-lib | examples/dfp/v201502/label_service/get_all_labels.py | Python | apache-2.0 | 1,648 |
# 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... | rew4332/tensorflow | tensorflow/contrib/layers/python/layers/feature_column_ops_test.py | Python | apache-2.0 | 66,277 |
# Copyright 2016 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 ... | googleads/googleads-python-lib | examples/adwords/v201809/basic_operations/__init__.py | Python | apache-2.0 | 631 |
'''
Adapted from https://github.com/tornadomeet/ResNet/blob/master/symbol_resnet.py
(Original author Wei Wu) by Antti-Pekka Hynninen
Implementing the original resnet ILSVRC 2015 winning network from:
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun. "Deep Residual Learning for Image Recognition"
'''
import mxnet as ... | coder-james/mxnet | example/image-classification/symbols/resnet-v1.py | Python | apache-2.0 | 8,907 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import socket
import unittest
import warnings
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip import HAS_GEOIP
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.test import ign... | cloudera/hue | desktop/core/ext-py/Django-1.11.29/tests/gis_tests/test_geoip.py | Python | apache-2.0 | 6,866 |
#
# Unit Tests for the colors.py functions
#
# Rajul Srivastava (rajul09@gmail.com)
#
import unittest
import logging
import numpy as np
import ginga.colors
class TestError(Exception):
pass
class TestColors(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger("TestColors")
self.color_list_... | rupak0577/ginga | ginga/tests/test_colors.py | Python | bsd-3-clause | 4,797 |
from __future__ import division, print_function, absolute_import
import sys
from numpy.testing import *
import numpy.linalg as linalg
def random(size):
return rand(*size)
class TestSolve(TestCase):
def bench_random(self):
basic_solve = linalg.solve
print()
print(' Solving system... | sargas/scipy | scipy/linalg/benchmarks/bench_basic.py | Python | bsd-3-clause | 4,065 |
import time
from importlib import import_module
from django.conf import settings
from django.contrib.sessions.backends.base import UpdateError
from django.shortcuts import redirect
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
class SessionMiddleware(object):
def __i... | vincepandolfo/django | django/contrib/sessions/middleware.py | Python | bsd-3-clause | 3,093 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import
from .build_response import BuildResponse # noqa
from .pod_response import PodResponse # noqa
| bfontecc007/osbs-client | osbs/build/__init__.py | Python | bsd-3-clause | 314 |
"""
=========================================================================
2 samples permutation test on source data with spatio-temporal clustering
=========================================================================
Tests if the source space data are significantly different between
2 groups of subjects (simu... | teonlamont/mne-python | tutorials/plot_stats_cluster_spatio_temporal_2samp.py | Python | bsd-3-clause | 4,494 |
from __future__ import print_function
import side_effect
def useless_function(first, second):
print("I have the wrong number of arguments.")
def function(frame, bp_loc, dict):
side_effect.bktptcmd = "function was here"
def another_function(frame, bp_loc, extra_args, dict):
se_value = extra_args.GetValueF... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/functionalities/breakpoint/breakpoint_command/bktptcmd.py | Python | bsd-3-clause | 812 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import time
from flexget import plugin
from flexget.event import event
from flexget.utils.log import log_once
from flexget.utils.titles.movie import MoviePa... | qk4l/Flexget | flexget/plugins/parsers/parser_internal.py | Python | mit | 1,607 |
import inspect
from biicode.client.shell.biistream import Color
class ToolCatalog(dict):
def __init__(self, main_class, tools):
dict.__init__(self)
self.main_class = main_class
# dict from tool group name to set of classes
for c in tools:
self[c.group] = c
self.... | drodri/client | command/tool_catalog.py | Python | mit | 2,824 |
"""
Support for functionality to have conversations with Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/conversation/
"""
import logging
import re
import warnings
import voluptuous as vol
from homeassistant import core
from homeassista... | leoc/home-assistant | homeassistant/components/conversation.py | Python | mit | 2,231 |
#!/usr/bin/python
'Finite difference RTM as a linear operator'
import os, sys, tempfile, subprocess
import rsf.prog, rsf.path
# Madagascar bin directory
bindir=os.path.join(rsf.prog.RSFROOT,'bin')
# Madagascar DATAPATH
datapath=rsf.path.datapath().rstrip('/')
# Madagascar commands
cp=os.path.join(bindir,'sfcp')
rtm... | TobbeTripitaka/src | user/zhiguang/Mfdlsrtm.py | Python | gpl-2.0 | 715 |
#!/usr/bin/python3
# This script will compare the versions of ebuilds in the funtoo portage tree against
# the versions of ebuilds in the target portage tree. Any higher versions in the
# target Portage tree will be printed to stdout.
import portage.versions
import os,sys
import subprocess
import json
from merge_ut... | Tassie-Tux/funtoo-overlay | funtoo/scripts/gentoo-compare-json.py | Python | gpl-2.0 | 4,518 |
import random
import struct
########################################################################################################################
class base_primitive (object):
'''
The primitive base class implements common functionality shared across most primitives.
'''
def __init__ (self):
... | cirosantilli/sulley | sulley/primitives.py | Python | gpl-2.0 | 32,873 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | jainaman224/zenodo | zenodo/modules/deposit/minters.py | Python | gpl-2.0 | 2,471 |
# Natural Language Toolkit: Dispersion Plots
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A utility for displaying lexical dispersion.
"""
def dispersion_plot(text, words, ignore_case=False, title="Lexic... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/draw/dispersion.py | Python | gpl-2.0 | 1,744 |
#!/usr/bin/env python
import sys
import time
from hypertable.thriftclient import *
from hyperthrift.gen.ttypes import *
if (len(sys.argv) < 2):
print sys.argv[0], "<hql>"
sys.exit(1);
try:
client = ThriftClient("localhost", 15867)
namespace = client.open_namespace("/")
res = client.hql_query(namespace, s... | hypertable/hypertable | tests/integration/thrift-table-refresh/thrift_hql.py | Python | gpl-3.0 | 438 |
"""
Tests related to the cohorting feature.
"""
from uuid import uuid4
from .helpers import BaseDiscussionMixin
from .helpers import CohortTestMixin
from ..helpers import UniqueCourseTest
from ...pages.lms.auto_auth import AutoAuthPage
from ...fixtures.course import (CourseFixture, XBlockFixtureDesc)
from ...pages.lm... | UQ-UQx/edx-platform_lti | common/test/acceptance/tests/discussion/test_cohorts.py | Python | agpl-3.0 | 5,771 |
##############################################################################
# Copyright (c) 2013-2018, 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... | krafczyk/spack | var/spack/repos/builtin/packages/perl-font-ttf/package.py | Python | lgpl-2.1 | 1,568 |
def pow(a, b, mod):
res = 1
while b > 0:
if b & 1 != 0:
res = res * a % mod
a = a * a % mod
b >>= 1
return res
print(1024 == pow(2, 10, 1000000007))
| animesh0353/codelibrary | python/pow.py | Python | unlicense | 198 |
from nose.tools import * # flake8: noqa
from django.db.models import Q
from tests.base import AdminTestCase
from osf_tests.factories import SubjectFactory
from osf.models import Subject
from osf.models.preprint_provider import rules_to_subjects
from admin.base.utils import get_subject_rules
import logging
logger... | aaxelb/osf.io | admin_tests/base/test_utils.py | Python | apache-2.0 | 3,856 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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 l... | eric-stanley/robotframework | src/robot/model/stats.py | Python | apache-2.0 | 6,017 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... | jtrobec/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_scrooge_gen.py | Python | apache-2.0 | 4,867 |
from django.conf.urls import url
from dojo.engagement import views
urlpatterns = [
# engagements and calendar
url(r'^calendar$', views.engagement_calendar, name='calendar'),
url(r'^calendar/engagements$', views.engagement_calendar, name='engagement_calendar'),
url(r'^engagement$', views.engagement, n... | Prakhash/security-tools | external/django-DefectDojo-1.2.1/dojo/engagement/urls.py | Python | apache-2.0 | 2,035 |
# -*- coding: utf-8 -*-
###############################################################################
#
# DeleteWaterLog
# Deletes a specified water log entry.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | jordanemedlock/psychtruths | temboo/core/Library/Fitbit/Foods/DeleteWaterLog.py | Python | apache-2.0 | 4,732 |
# 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
# d... | dklyle/trove-dashboard | trove_dashboard/enabled/_1710_database_panel_group.py | Python | apache-2.0 | 913 |
"""Produce contact map for Figure 5D from the PySB publication"""
from __future__ import print_function
import pysb.integrate
import pysb.util
import numpy as np
import scipy.optimize
import scipy.interpolate
import matplotlib.pyplot as plt
import os
import sys
import inspect
from earm.lopez_embedded import model
#... | LoLab-VU/pysb | pysb/examples/paper_figures/fig6.py | Python | bsd-2-clause | 9,204 |
import mock
from django_images.models import Thumbnail
from taggit.models import Tag
from tastypie.exceptions import Unauthorized
from tastypie.test import ResourceTestCase
from .helpers import ImageFactory, PinFactory, UserFactory
from ..models import Pin, Image
from ...users.models import User
__all__ = ['ImageRe... | supervacuo/pinry | pinry/core/tests/api.py | Python | bsd-2-clause | 10,976 |
from django.conf import settings
from django.contrib import admin
if 'django.contrib.auth' in settings.INSTALLED_APPS:
from tastypie.models import ApiKey
class ApiKeyInline(admin.StackedInline):
model = ApiKey
extra = 0
ABSTRACT_APIKEY = getattr(settings, 'TASTYPIE_ABSTRACT_APIKEY', Fals... | rtucker-mozilla/WhistlePig | vendor-local/lib/python/tastypie/admin.py | Python | bsd-3-clause | 582 |
#------------------------------------------------------------------------------
# Copyright (c) 2010, Enthought Inc
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
#
# Author: Enthought Inc
# Description: <Enthought pyface code editor>
#------------------------... | pankajp/pyface | pyface/ui/qt4/code_editor/gutters.py | Python | bsd-3-clause | 3,820 |
# -*- coding: utf-8 -*-
"""
tests.basic
~~~~~~~~~~~~~~~~~~~~~
The basic functionality.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import re
import uuid
import time
import flask
import pickle
from datetime import datetime
from threading ... | tangfeng1/flask | tests/test_basic.py | Python | bsd-3-clause | 42,900 |
#File to read the data from mysql and push into CSV.
# Python imports
import datetime as dt
import csv
import copy
import os
import pickle
# 3rd party imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# QSTK imports
from QSTK.qstkutil import qsdateutil as du
import QSTK.qstkutil.DataEvol... | wogsland/QSTK | build/lib.linux-x86_64-2.7/Bin/Data_CSV.py | Python | bsd-3-clause | 3,301 |
import unittest
from scrabble import score
class WordTest(unittest.TestCase):
def test_invalid_word_scores_zero(self):
self.assertEqual(0, score(''))
self.assertEqual(0, score(' \t\n'))
self.assertEqual(0, score('hous3'))
self.assertEqual(0, score('wo rd'))
def test_scores_ve... | wobh/xpython | scrabble-score/scrabble_score_test.py | Python | mit | 826 |
from django.conf.urls import patterns, url
from polls import views
urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'),
url(r'^(?P<... | kwailamchan/programming-languages | python/django/polls/pollsite/polls/urls.py | Python | mit | 374 |
# Copyright 2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['ArgumentParser']
try:
from argparse import ArgumentParser
except ImportError:
# Compatibility with Python 2.6 and 3.1
from optparse import OptionGroup, OptionParser
from portage.localization import _... | nullishzero/Portage | pym/portage/util/_argparse.py | Python | gpl-2.0 | 1,300 |
# 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... | ikoula/cloudstack | test/integration/component/test_vpc_network_pfrules.py | Python | gpl-2.0 | 43,341 |
#!/usr/bin/env python
'''
Copyright (C) 2007
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.
This program is distributed in t... | piksels-and-lines-orchestra/inkscape | share/extensions/extrude.py | Python | gpl-2.0 | 3,989 |
#!/usr/bin/env python
from ecl.summary import EclSum
OIL_PRICES = {
"2010-01-01": 78.33,
"2010-02-01": 76.39,
"2010-03-01": 81.20,
"2010-04-01": 84.29,
"2010-05-01": 73.74,
"2010-06-01": 75.34,
"2010-07-01": 76.32,
"2010-08-01": 76.60,
"2010-09-01": 75.24,
"2010-10-01": 81.89,
... | joakim-hove/ert | test-data/local/snake_oil_structure/snake_oil/jobs/snake_oil_npv.py | Python | gpl-3.0 | 2,757 |
# 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 model 'Follow'
db.create_table('actstream_follow', (
('id', self.gf('django.db.models... | hzlf/openbroadcast | website/apps/actstream/migrations/0001_initial.py | Python | gpl-3.0 | 7,890 |
import unittest
from datetime import datetime
from flask import url_for
from app import current_app as app
from app.helpers.data import save_to_db
from app.models.call_for_papers import CallForPaper
from tests.unittests.object_mother import ObjectMother
from tests.unittests.utils import OpenEventTestCase
class Test... | Achint08/open-event-orga-server | tests/unittests/views/guest/test_guest_event_page.py | Python | gpl-3.0 | 7,240 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Commands for reading and manipulating snapshots."""
from googlecloudsdk.calliope import base
class Snapshots(base.Group):
"""List, describe, and delete Google Compute Engine snapshots."""
Snapshots.detailed_help = {
'brief': 'List, describe, and delete Goo... | harshilasu/LinkurApp | y/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/snapshots/__init__.py | Python | gpl-3.0 | 353 |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
log = CPLog(__name__)
class Automation(Plugin):
def __init__(self):
addEvent('app.load', self.setCrons)
if n... | coolbombom/CouchPotatoServer | couchpotato/core/plugins/automation/main.py | Python | gpl-3.0 | 1,352 |
import unittest
from PySide.QtCore import QSizeF
from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
from helper import TimedQApplication
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
w.setWidget(QPushButton(name))
w.setMi... | M4rtinK/pyside-android | tests/QtGui/bug_972.py | Python | lgpl-2.1 | 1,124 |
# Copyright (c) 2018 Kevin Weiss, for HAW Hamburg <kevin.weiss@haw-hamburg.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
"""@package PyToAPI
This module handles parsing of information from RI... | lazytech-org/RIOT | tests/periph_uart/tests/periph_uart_if.py | Python | lgpl-2.1 | 1,079 |
import pilasengine
# Permite que este ejemplo funcion incluso si no has instalado pilas.
import sys
sys.path.insert(0, "..")
pilas = pilasengine.iniciar()
mono = pilas.actores.Mono(y=-100)
def cuando_cambia_escala(valor):
mono.escala = valor * 2
deslizador_escala = pilas.interfaz.Deslizador(y=50)
deslizador_esca... | fsalamero/pilas | pilasengine/ejemplos/ejemplos_a_revisar/deslizador.py | Python | lgpl-3.0 | 842 |
tutorial_tests = """
Let's try a simple generator:
>>> def f():
... yield 1
... yield 2
>>> for i in f():
... print(i)
1
2
>>> g = f()
>>> next(g)
1
>>> next(g)
2
"Falling off the end" stops the generator:
>>> next(g)
Traceback (most recent call last... | cnsoft/kbengine-cocos2dx | kbe/src/lib/python/Lib/test/test_generators.py | Python | lgpl-3.0 | 50,722 |
'''
Analysis plugin for supporting WorkspaceEmulators during analysis pass.
Finds and connects Switch Cases, most specifically from Microsoft.
'''
import envi
import envi.archs.i386 as e_i386
import vivisect
import vivisect.analysis.generic.codeblocks as vagc
def analyzeJmp(amod, emu, op, starteip):
'''
Top ... | imjonsnooow/vivisect | vivisect/analysis/generic/switchcase.py | Python | apache-2.0 | 5,920 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | roopali8/tempest | tempest/services/compute/json/images_client.py | Python | apache-2.0 | 5,390 |
"""Tests for acme.challenges."""
import unittest
import mock
import OpenSSL
import requests
from six.moves.urllib import parse as urllib_parse # pylint: disable=import-error
from acme import errors
from acme import jose
from acme import test_util
CERT = test_util.load_comparable_cert('cert.pem')
KEY = jose.JWKRSA... | mitnk/letsencrypt | acme/acme/challenges_test.py | Python | apache-2.0 | 15,928 |
# Copyright 2017 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... | alshedivat/tensorflow | tensorflow/python/data/experimental/ops/random_ops.py | Python | apache-2.0 | 1,886 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | akash1808/tempest | tempest/api/compute/volumes/test_volumes_get.py | Python | apache-2.0 | 3,025 |
from __future__ import division, print_function, absolute_import
import numpy
import pandas
from numpy.random.mtrand import RandomState
from sklearn.metrics.pairwise import pairwise_distances
from hep_ml import commonutils
from hep_ml.commonutils import weighted_quantile, build_normalizer, \
compute_cut_for_effici... | anaderi/hep_ml | tests/test_commonutils.py | Python | apache-2.0 | 5,407 |
"""Routines to help recognizing sound files.
Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.
The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- nu... | yotchang4s/cafebabepy | src/main/python/sndhdr.py | Python | bsd-3-clause | 7,088 |
# pylint:disable-msg=R0201
"""docstring"""
__revision__ = ''
class Interface:
"""base class for interfaces"""
class IMachin(Interface):
"""docstring"""
def truc(self):
"""docstring"""
def troc(self, argument):
"""docstring"""
class Correct1:
"""docstring"""
__implemen... | dbbhattacharya/kitsune | vendor/packages/pylint/test/input/func_interfaces.py | Python | bsd-3-clause | 1,802 |
#!/usr/bin/python
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2016 Intel Corporation.
#
# 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 l... | whbruce/upm | examples/python/bmx055.py | Python | mit | 2,781 |
"""Test that `yield` or `yield from` can't be used inside an async function."""
# pylint: disable=missing-docstring, unused-variable
async def good_coro():
def _inner():
yield 42
yield from [1, 2, 3]
async def bad_coro():
yield 42
yield from [1, 2, 3] # [yield-inside-async-func... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/y/yield_inside_async_function_py36.py | Python | mit | 327 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
def connect_sqs(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""Return async connection to Amazon SQS."""
from .sqs.connection import AsyncSQSConnection
return AsyncSQSConnection(
aws_access_key_id, ... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/kombu/async/aws/__init__.py | Python | mit | 358 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | tomsilver/nupic | nupic/regions/CLAClassifierRegion.py | Python | gpl-3.0 | 9,996 |
from nose.tools import * # noqa
import mock
from boto.s3.connection import * # noqa
from tests.base import OsfTestCase, get_default_metaschema
from tests.factories import ProjectFactory
from framework.auth import Auth
from website.addons.base.testing import models
from website.addons.s3.model import S3NodeSettings
... | rdhyee/osf.io | website/addons/s3/tests/test_model.py | Python | apache-2.0 | 3,529 |
"""Support for Nanoleaf Lights."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR,
ATTR_TRANSITION, PLATFORM_SCHEMA, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_TRANSIT... | MartinHjelmare/home-assistant | homeassistant/components/nanoleaf/light.py | Python | apache-2.0 | 6,951 |
from __future__ import absolute_import
from __future__ import print_function
import filecmp
import os
import ujson
from django.core import mail
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict, List
from zerver.lib.actions import do_ch... | dawran6/zulip | zerver/tests/test_bots.py | Python | apache-2.0 | 33,314 |
from typing import Optional, Set, Text
import re
# Match multi-word string between @** ** or match any one-word
# sequences after @
find_mentions = r'(?<![^\s\'\"\(,:<])@(\*\*[^\*]+\*\*|all|everyone)'
user_group_mentions = r'(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)'
wildcards = ['all', 'everyone']
def user_mention_matches... | mahim97/zulip | zerver/lib/mention.py | Python | apache-2.0 | 1,137 |
from __future__ import unicode_literals
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import get_current_site
from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from django_images.models import Thumbnail
from taggit.models import Tag
from .... | supervacuo/pinry | pinry/core/feeds.py | Python | bsd-2-clause | 4,918 |
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy as sp
from warnings import warn
from scipy.sparse import issparse
import numbers
from ..external... | waterponey/scikit-learn | sklearn/ensemble/iforest.py | Python | bsd-3-clause | 11,906 |
from __future__ import unicode_literals
import codecs
import os
import shutil
import tempfile
import unittest
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.contrib.staticfiles import storage
from django.contrib.staticfiles.management.commands import collectstatic
fr... | indevgr/django | tests/staticfiles_tests/test_management.py | Python | bsd-3-clause | 14,449 |
from doit.action import CmdAction
def task_hello():
"""hello cmd """
def create_cmd_string():
return "echo hi"
return {
'actions': [CmdAction(create_cmd_string)],
'verbosity': 2,
}
| wangpanjun/doit | doc/tutorial/cmd_from_callable.py | Python | mit | 228 |
from app.config.cplog import CPLog
from app.lib.provider.movie.base import movieBase
from imdb import IMDb
from urllib import quote_plus
from urllib2 import URLError
import cherrypy
import os
import urllib2
log = CPLog(__name__)
class theMovieDb(movieBase):
"""Api for theMovieDb"""
apiUrl = 'http://api.themo... | lechat/CouchPotato | app/lib/provider/movie/sources/theMovieDb.py | Python | gpl-3.0 | 5,746 |
# Gnome15 - Suite of tools for the Logitech G series keyboards and headsets
# Copyright (C) 2010 Brett Smith <tanktarta@blueyonder.co.uk>
#
# 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, e... | achilleas-k/gnome15 | src/plugins/sysmon/sysmon.py | Python | gpl-3.0 | 18,178 |
# -*- 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... | addition-it-solutions/project-all | addons/account/wizard/account_chart.py | Python | agpl-3.0 | 5,123 |
"""
Specific overrides to the base prod settings to make development easier.
"""
from os.path import abspath, dirname, join
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
# Don't use S3 in devstack, fall back to filesystem
del DEFAULT_FILE_STORAGE
MEDIA_ROOT = "/edx/var/edxapp/uploads"
... | ahmadiga/min_edx | lms/envs/devstack.py | Python | agpl-3.0 | 7,967 |
#!/usr/bin/python
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | soumyanishan/azure-linux-extensions | OSPatching/patch/centosPatching.py | Python | apache-2.0 | 770 |
"""The Energy integration."""
from __future__ import annotations
from homeassistant.components import frontend
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery
from homeassistant.helpers.typing import ConfigType
from . import websocket_api
from .const import DOMAIN
from .data i... | jawilson/home-assistant | homeassistant/components/energy/__init__.py | Python | apache-2.0 | 1,029 |
# 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... | grani/grpc | src/python/grpcio_health_checking/grpc_health/v1/health.py | Python | bsd-3-clause | 2,629 |
# Copyright (c) 2019 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.
from absl import app
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.suppo... | ric2b/Vivaldi-browser | chromium/chrome/test/enterprise/e2e/policy/allow_deleting_browser_history/allow_deleting_browser_history_webdriver_test.py | Python | bsd-3-clause | 1,991 |
import unittest, StringIO, robotparser
from test import test_support
from urllib2 import urlopen, HTTPError
class RobotTestCase(unittest.TestCase):
def __init__(self, index, parser, url, good, agent):
unittest.TestCase.__init__(self)
if good:
self.str = "RobotTest(%d, good, %s)" % (inde... | ianyh/heroku-buildpack-python-opencv | vendor/.heroku/lib/python2.7/test/test_robotparser.py | Python | mit | 6,753 |
"""SCons.Tool.gfortran
Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran
2003 compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
... | stonekyx/binary | vendor/scons-local-2.3.4/SCons/Tool/gfortran.py | Python | gpl-3.0 | 2,256 |
import os.path, string, posix, pyvms
#
#
IDIR = ['swig_root:[source.swig]', 'swig_root:[source.doh.include]',
'swig_root:[source.include]', 'swig_root:[source.preprocessor]']
def new_file(fg, dirname):
global IDIR
fn = 'swig_root:[vms.scripts]compil_' + os.path.basename(dirname) + '.com'
print >>... | DGA-MI-SSI/YaCo | deps/swig-3.0.7/vms/genbuild.py | Python | gpl-3.0 | 4,052 |
# 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... | reneploetz/mesos | src/python/cli_new/lib/cli/plugins/base.py | Python | apache-2.0 | 5,461 |
# Copyright (c) 2012-2016 Seafile Ltd.
from django.contrib import admin
# Register your models here.
| miurahr/seahub | seahub/role_permissions/admin.py | Python | apache-2.0 | 102 |
# 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... | shishaochen/TensorFlow-0.8-Win | third_party/grpc/src/python/grpcio/tests/unit/_adapter/_low_test.py | Python | apache-2.0 | 13,085 |
# 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 optparse
import os
import platform
import shutil
import subprocess
import sys
import tempfile
import unittest
import zipfile
from telemetry.util impo... | guorendong/iridium-browser-ubuntu | tools/telemetry/telemetry/util/find_dependencies_unittest.py | Python | bsd-3-clause | 2,648 |
# Copyright 2017 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.
from .code_generator_info import CodeGeneratorInfo
from .composition_parts import WithCodeGeneratorInfo
from .composition_parts import WithComponent
from .co... | chromium/chromium | third_party/blink/renderer/bindings/scripts/web_idl/typedef.py | Python | bsd-3-clause | 1,678 |
import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.safestring import SafeData, mark_safe
from django.utils import six
class Message... | doismellburning/django | django/contrib/messages/storage/cookie.py | Python | bsd-3-clause | 6,545 |