code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... | kbrebanov/ansible | lib/ansible/modules/network/avi/avi_cloudproperties.py | Python | gpl-3.0 | 3,643 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | ppanczyk/ansible | lib/ansible/playbook/task.py | Python | gpl-3.0 | 17,944 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-pylint.py | Python | gpl-3.0 | 2,709 |
# Generated by Django 3.2.4 on 2021-06-03 07:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0015_auto_20210512_1955"),
]
operations = [
migrations.AlterField(
model_name="auditlog",
name="activity... | nijel/weblate | weblate/accounts/migrations/0016_alter_auditlog_activity.py | Python | gpl-3.0 | 1,470 |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from builtins import str
from builtins import range
from past.utils import old_div
from boututils import shell, launch, plotdata
from boutdata import collect
import numpy as np
from sys import argv
from math import sqrt, log, p... | kevinpetersavage/BOUT-dev | examples/non-local_1d/analyseboundary-Ts.py | Python | gpl-3.0 | 1,736 |
#pylint: disable=R0901,R0902,R0904
from __future__ import (absolute_import, division, print_function)
from six.moves import range
import numpy as np
import os
from PyQt4.QtGui import QSizePolicy
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from ... | wdzhou/mantid | scripts/HFIR_4Circle_Reduction/mplgraphicsview3d.py | Python | gpl-3.0 | 9,817 |
#!/usr/bin/env python3
import os
import logging
from datetime import datetime
from settings import JSONDIR
from defs import load_data
from san_env import get_apps
debug_records_flag = False
def save(appname, relations):
apps = get_apps()
for filename, modelname, filters in relations:
records = load_... | tulsluper/sanscript | apps/fc/scripts/san_db.py | Python | gpl-3.0 | 1,228 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.shopping_cart.cart import _get_cart_quotation
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settin... | patilsangram/erpnext | erpnext/shopping_cart/product_info.py | Python | gpl-3.0 | 2,040 |
import discord
import random
import aiohttp
from lxml import html as l
async def cyanideandhappiness(cmd, message, args):
comic_number = random.randint(1, 4562)
comic_url = f'http://explosm.net/comics/{comic_number}/'
async with aiohttp.ClientSession() as session:
async with session.get(comic_url... | aurora-pro/apex-sigma | sigma/plugins/fun/cyanideandhappiness.py | Python | gpl-3.0 | 720 |
# Copyright (C) 1993-2002, by Peter I. Corke
# $Log: rtfddemo.m,v $
# Revision 1.4 2002/04/02 12:26:48 pic
# Handle figures better, control echo at end of each script.
# Fix bug in calling ctraj.
#
# Revision 1.3 2002/04/01 11:47:17 pic
# General cleanup of code: help comments, see also, copyright, remnant dh/dyn
... | MediffRobotics/DeepRobotics | rpiRobotArm/InverseKine/robotics-toolbox-python1/trunk/robotics-toolbox-python/demo/fdyn.py | Python | gpl-3.0 | 1,911 |
#!/usr/bin/env python
# Tested in Python 3
# Sebastian Raschka, 2014
# An interactive command line app for
# creating a PDB file info table.
# For help, execute
# ./pdb_infotable.py --help
import bs4
import urllib
import pyprind
import pandas as pd
class Pdb(object):
def __init__(self, pdb_code):
self.c... | tieusangaka/datacollect | pdb_infotable/pdb_infotable.py | Python | gpl-3.0 | 4,974 |
"""Entities: things that exist in the world."""
from .gfx import GraphicsGroup
from .util import ir
class Entity (object):
"""A thing that exists in the world.
Entity()
Currently, an entity is just a container of graphics.
"""
def __init__ (self):
#: The :class:`World <engine.game.World>` this en... | ikn/o | game/engine/entity.py | Python | gpl-3.0 | 884 |
# -*- coding: utf-8 -*-
"""
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) any later version.
This program is distributed in... | chaosmaker/pyload | module/plugins/hoster/Ftp.py | Python | gpl-3.0 | 3,388 |
import os
import sys
# OS Specifics
ABS_WORK_DIR = os.path.join(os.getcwd(), "build")
BINARY_PATH = os.path.join(ABS_WORK_DIR, "firefox", "firefox.exe")
INSTALLER_PATH = os.path.join(ABS_WORK_DIR, "installer.zip")
XPCSHELL_NAME = 'xpcshell.exe'
EXE_SUFFIX = '.exe'
DISABLE_SCREEN_SAVER = False
ADJUST_MOUSE_AND_SCREEN =... | kartikgupta0909/build-mozharness | configs/unittests/win_unittest.py | Python | mpl-2.0 | 7,351 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import socket
import time
import sys
from Peach.publisher import Publisher
class RawEther(Publisher):
"""
A si... | MozillaSecurity/peach | Peach/Publishers/raw.py | Python | mpl-2.0 | 11,798 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
import hashlib
class message(object):
def __init__(self):
'''
... | mpurzynski/MozDef | mq/plugins/nagioshostname.py | Python | mpl-2.0 | 902 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | src/nupic/research/frameworks/vernon/mixins/sync_batchnorm.py | Python | agpl-3.0 | 1,943 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
# @author Nicolas Bessi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Genera... | akretion/bank-statement-reconcile | __unported__/statement_voucher_killer/voucher.py | Python | agpl-3.0 | 6,659 |
#!/usr/bin/env python
"""
RDF Graph Isomorphism Tester
Author: Sean B. Palmer, inamidst.com
Uses the pyrple algorithm
Requirements:
Python2.4+
http://inamidst.com/proj/rdf/ntriples.py
Usage: ./rdfdiff.py <ntriplesP> <ntriplesQ>
"""
import sys, re, urllib
import ntriples
from ntriples import bNode
ntriples.r_uri... | MjAbuz/watchdog | vendor/rdflib-2.4.0/test/rdfdiff.py | Python | agpl-3.0 | 2,002 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class QuoteItem(Document):
pass
| aruizramon/alec_erpnext | erpnext/stock/doctype/quote_item/quote_item.py | Python | agpl-3.0 | 271 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software you can redistribute it and/or modify
# it under... | numenta/nupic.research | projects/imagenet/experiments/sparse_r1.py | Python | agpl-3.0 | 5,411 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | VitalPet/bank-statement-reconcile | account_statement_operation_rule/tests/__init__.py | Python | agpl-3.0 | 1,004 |
../../../../../cms/djangoapps/contentstore/management/commands/import.py | louyihua/edx-platform | lms/djangoapps/courseware/management/commands/import.py | Python | agpl-3.0 | 72 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | nistormihai/superdesk-core | apps/publish/__init__.py | Python | agpl-3.0 | 2,426 |
##############################################################################
# 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... | EmreAtes/spack | var/spack/repos/builtin/packages/r-ampliqueso/package.py | Python | lgpl-2.1 | 2,435 |
# 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)
import functools as ft
import os
import re
import shutil
import sys
from llnl.util.link_tree import LinkTree, MergeConfli... | rspavel/spack | lib/spack/spack/filesystem_view.py | Python | lgpl-2.1 | 26,567 |
# 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 PyEasybuildFramework(PythonPackage):
"""The core of EasyBuild, a software build and instal... | iulian787/spack | var/spack/repos/builtin/packages/py-easybuild-framework/package.py | Python | lgpl-2.1 | 1,174 |
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2018 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distrib... | jhoenicke/python-trezor | trezorlib/ontology.py | Python | lgpl-3.0 | 2,134 |
#!/usr/bin/python -u
#----------------------------------------------------------------------------
# Summarizes a twogtp tournament.
#
# TODO: - Simplify stuff. The table idea seems bad, in retrospect.
# - Do we really care about which openings are won/lost?
import os, sys, getopt, re, string
from statistics imp... | yotomyoto/benzene-vanilla | tournament/summary.py | Python | lgpl-3.0 | 9,376 |
# 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/contrib/tedd.py | Python | apache-2.0 | 27,567 |
#!/usr/bin/env python # pylint: disable=too-many-lines
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) ... | andrewklau/openshift-tools | ansible/roles/lib_openshift_3.2/library/oc_version.py | Python | apache-2.0 | 33,153 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | nzlosh/st2 | st2actions/tests/unit/policies/test_concurrency_by_attr.py | Python | apache-2.0 | 17,676 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/tm/tmglobal_tmtrafficpolicy_binding.py | Python | apache-2.0 | 6,800 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from ggrc import db
from ggrc.models.mixins import CustomAttributable, BusinessObject, Timeboxed
from ggrc.models.object_document import Documentable
from ggrc.models.object_person import Personable
from ggr... | edofic/ggrc-core | src/ggrc_risks/models/threat.py | Python | apache-2.0 | 847 |
"""The tests for the Group components."""
# pylint: disable=protected-access
from collections import OrderedDict
import unittest
import homeassistant.components.group as group
from homeassistant.const import (
ATTR_ASSUMED_STATE,
ATTR_FRIENDLY_NAME,
ATTR_ICON,
STATE_HOME,
STATE_NOT_HOME,
STATE_... | nkgilley/home-assistant | tests/components/group/test_init.py | Python | apache-2.0 | 19,157 |
from fontTools.misc.py23 import strjoin, tobytes, tostr
from . import asciiTable
class table_T_S_I_V_(asciiTable.asciiTable):
def toXML(self, writer, ttFont):
data = tostr(self.data)
# removing null bytes. XXX needed??
data = data.split('\0')
data = strjoin(data)
writer.begintag("source")
writer.newline(... | google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/ttLib/tables/T_S_I_V_.py | Python | apache-2.0 | 572 |
#!/usr/bin/python
# Copyright 2017 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 ap... | bzz/kythe | .ycm_extra_conf.py | Python | apache-2.0 | 9,245 |
from _locale import (setlocale, LC_ALL, LC_CTYPE, LC_NUMERIC, localeconv, Error)
try:
from _locale import (RADIXCHAR, THOUSEP, nl_langinfo)
except ImportError:
nl_langinfo = None
import codecs
import locale
import sys
import unittest
from platform import uname
if uname().system == "Darwin":
maj, min, mic ... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test__locale.py | Python | apache-2.0 | 7,909 |
"""
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 use this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/ECS/package/scripts/service_check.py | Python | apache-2.0 | 1,514 |
from __future__ import unicode_literals
import boto.rds
import boto.vpc
from boto.exception import BotoServerError
import sure # noqa
from moto import mock_ec2_deprecated, mock_rds_deprecated
from tests.helpers import disable_on_py3
@disable_on_py3()
@mock_rds_deprecated
def test_create_database():
conn = boto... | heddle317/moto | tests/test_rds/test_rds.py | Python | apache-2.0 | 10,968 |
#!/usr/bin/env python
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
# Read X.509 CRL on stdin, print them pretty and encode back into
# original wire format.
# CRL can be generated with "openssl opens... | kawamon/hue | desktop/core/ext-py/pyasn1-modules-0.2.6/tools/crldump.py | Python | apache-2.0 | 1,086 |
import json
import seaserv
from seaserv import seafile_api
from seahub.test_utils import BaseTestCase
class BeSharedRepoTest(BaseTestCase):
def setUp(self):
self.login_as(self.admin)
def tearDown(self):
self.remove_repo()
def _add_shared_items(self):
# create repo for user
... | miurahr/seahub | tests/api/endpoints/test_be_shared_repo.py | Python | apache-2.0 | 2,485 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Base objects for csv file converters."""
from collections import defaultdict
from ggrc import settings
from ggrc.utils import structures
from ggrc.cache.memcache import MemCache
from ggrc.converters imp... | edofic/ggrc-core | src/ggrc/converters/base.py | Python | apache-2.0 | 5,472 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the MacKeeper Cache event formatter."""
import unittest
from plaso.formatters import mackeeper_cache
from tests.formatters import test_lib
class MacKeeperCacheFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the MacKeeper Cache event formatter.""... | ostree/plaso | tests/formatters/mackeeper_cache.py | Python | apache-2.0 | 1,008 |
import unittest
from streamlink.stream import StreamIOIterWrapper
class TestPluginStream(unittest.TestCase):
def test_iter(self):
def generator():
yield b"1" * 8192
yield b"2" * 4096
yield b"3" * 2048
fd = StreamIOIterWrapper(generator())
self.assertEq... | beardypig/streamlink | tests/streams/test_stream_wrappers.py | Python | bsd-2-clause | 655 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'', include('base.urls', namespace="base")),
url(r'^admin/', include(admin.site.urls)),
)
| kod3r/memex-explorer | source/memex/urls.py | Python | bsd-2-clause | 217 |
class Manager(object):
_user = None
_enabled = True
_user_required = True
def set_user_required(self, user_required):
self._user_required = user_required
def get_user_required(self):
return self._user_required
def set_user(self, user):
self._user = user
def get_u... | dz0ny/vaultier | vaultier/libs/version/context.py | Python | bsd-3-clause | 1,091 |
from copy import deepcopy
import numpy as np
from menpo.image.base import Image
from skimage.transform import pyramid_gaussian
class BooleanImage(Image):
r"""
A mask image made from binary pixels. The region of the image that is
left exposed by the mask is referred to as the 'masked region'. The
set o... | jabooth/menpo-archive | menpo/image/boolean.py | Python | bsd-3-clause | 11,453 |
from . import _ccallback_c
import ctypes
PyCFuncPtr = ctypes.CFUNCTYPE(ctypes.c_void_p).__bases__[0]
ffi = None
class CData(object):
pass
def _import_cffi():
global ffi, CData
if ffi is not None:
return
try:
import cffi
ffi = cffi.FFI()
CData = ffi.CData
except... | Eric89GXL/scipy | scipy/_lib/_ccallback.py | Python | bsd-3-clause | 6,196 |
import json
from datetime import datetime, timedelta
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue, Deferred
from vumi.utils import http_request_full
from vumi.message import TransportUserMessage
from vumi.tests.helpers import (
VumiTestCase, MessageHelper, ... | TouK/vumi | vumi/components/tests/test_message_store_api.py | Python | bsd-3-clause | 11,045 |
"""This module provides the components needed to build your own __import__
function. Undocumented functions are obsolete.
In most cases it is preferred you consider using the importlib module's
functionality over this module.
"""
# (Probably) need to stay in _imp
from _imp import (lock_held, acquire_lock, release_lo... | ms-iot/python | cpython/Lib/imp.py | Python | bsd-3-clause | 10,431 |
__author__ = 'benji'
| oldm/OldMan | oldman/validation/__init__.py | Python | bsd-3-clause | 21 |
class __WorkerPool__:
def create_webworker(self, cpuid):
## this is lazy because if the blob is created when the js is first executed,
## then it will pick all functions of `window` but they will be `undefined`
## if their definition comes after the construction of this singleton.
print 'creating blob'
## ... | pombredanne/Rusthon | src/runtime/builtins_webworker.py | Python | bsd-3-clause | 10,276 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from ....tests.helper import catch_warnings
from .. import converters
from .. import exceptions
from .. import tree
def test_reraise():
def fail():
raise RuntimeError("This failed")
try:
try:
fail()
... | funbaker/astropy | astropy/io/votable/tests/exception_test.py | Python | bsd-3-clause | 1,250 |
# 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.
import os
import sys
from telemetry.page import block_page_measurement_results
from telemetry.page import buildbot_page_measurement_results
from telemetr... | pozdnyakov/chromium-crosswalk | tools/telemetry/telemetry/page/page_measurement.py | Python | bsd-3-clause | 5,239 |
"""Base test suite for extension arrays.
These tests are intended for third-party libraries to subclass to validate
that their extension arrays and dtypes satisfy the interface. Moving or
renaming the tests should not be done lightly.
Libraries are expected to implement a few pytest fixtures to provide data
for the t... | harisbal/pandas | pandas/tests/extension/base/__init__.py | Python | bsd-3-clause | 2,015 |
from utils.ols import *
########before preproccessing
betas_before_process = apply_ols_to_subject(16, 3, r_outliers = False, smooth = False)
##average across all runs
avg_before = average_betas(betas_before_process)
## shape to 4d
avg_before = beta_2d_to_4d(avg_before)
plt.figure()
plt.imshow(avg_before[:,... | juanshishido/project-eta | code/make_plots_smoothing.py | Python | bsd-3-clause | 1,263 |
import weldnumpy as wn
import numpy as np
def assert_correct(np_a, z):
'''
common part of the check.
'''
shape = []
for s in z.shape:
shape.append(s)
shape = tuple(shape)
np_a = np.reshape(np_a, shape)
for i in range((z.shape[0])):
for j in range(z.shape[1]):
... | rahulpalamuttam/weld | examples/python/nditer/nditer_test.py | Python | bsd-3-clause | 3,542 |
"""
Example generation for the scikit learn
Generate the rst files for the examples by iterating over the python
example files.
Files that generate images should start with 'plot'
"""
from __future__ import division, print_function
from time import time
import ast
import os
import re
import shutil
import traceback
i... | Garrett-R/scikit-learn | doc/sphinxext/gen_rst.py | Python | bsd-3-clause | 38,936 |
# coding: utf-8
try:
from django.conf.urls import patterns, url, include
except ImportError:
from django.conf.urls.defaults import patterns, url, include
from django.http import HttpResponse
def dummy(request):
return HttpResponse()
urlpatterns = patterns('',
url('^api/.+/$', dummy, name='dummy'),
... | anmekin/django-httplog | test_app/urls.py | Python | bsd-3-clause | 405 |
class Solution:
# @param {integer[][]} matrix
# @param {integer} target
# @return {boolean}
def searchMatrix(self, matrix, target):
if len(matrix) == 0 or len(matrix[0]) == 0:
return False
m , n = len(matrix), len(matrix[0])
l, r = 0, m * n - 1
... | Chasego/codirit | leetcode/074-Search-a-2D-Matrix/Searcha2DMatrix_001.py | Python | mit | 608 |
# -*- coding: utf-8 -*-
# $Id: manpage.py 7485 2012-07-06 08:17:28Z grubert $
# Author: Engelbert Gruber <grubert@users.sourceforge.net>
# Copyright: This module is put into the public domain.
"""
Simple man page writer for reStructuredText.
Man pages (short for "manual pages") contain system documentation on unix-li... | ktan2020/legacy-automation | win/Lib/site-packages/docutils/writers/manpage.py | Python | mit | 35,646 |
# encoding: utf-8
"""
Core trade api for simulated and live trading.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .trade_api import TradeApi
__all__ = ['TradeApi']
| mumuwoyou/vnpy-master | vnpy/trader/gateway/tkproGateway/TradeApi/__init__.py | Python | mit | 279 |
#!/usr/bin/env python
#
# Simple IRC Bot to announce messages
#
# Code originally based on example bot and irc-bot class from
# Joel Rosdahl <joel@rosdahl.net>, author of included python-irclib.
#
"""An IRC bot to announce messages on a channel.
This is an example bot that uses the SingleServerIRCBot class from
ircb... | sdl-static/ircbot-collection | beanbot.py | Python | gpl-2.0 | 7,221 |
# Copyright (C) 2016- The University of Notre Dame This software is distributed
# under the GNU General Public License. See the file COPYING for details.
from ResourceMonitor import *
import random
import sys
# Generate syntetic resource samples according to beta(2, 5)
def beta(start, end, alpha = 2, beta = 5):
... | charleszheng44/cctools | resource_monitor/src/python/rmonitor_allocations_example.py | Python | gpl-2.0 | 2,456 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | bootswithdefer/ansible | v2/ansible/errors/__init__.py | Python | gpl-3.0 | 6,977 |
#!/usr/bin/env python
############################################################################
#
# Copyright (c) 2012-2017 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | diydrones/ardupilot | Tools/scripts/uploader.py | Python | gpl-3.0 | 45,137 |
'''
Implementation of the locally greedy approach similar with DuVerle & Predinger
(2009, 2010) (but adapted for SDRT, where the notion of adjacency includes
embedded segments)
July 2012
@author: stergos
'''
from __future__ import print_function
import sys
from .interface import Decoder
from .util import (convert_p... | kowey/attelo | attelo/decoding/greedy.py | Python | gpl-3.0 | 5,290 |
from __future__ import absolute_import
import unittest
from .datasets import *
from .test_tree import *
from .test_interop import *
from .test_seqgroup import *
from .test_phylotree import *
from .test_ncbiquery import *
from .test_arraytable import *
from .test_clustertree import *
from .test_evol import *
#from .t... | karrtikr/ete | ete3/test/test_api.py | Python | gpl-3.0 | 463 |
def add(a, b):
return a+b | 40423131/2017springcd_hw | w11/w11/add.py | Python | agpl-3.0 | 29 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import collections
from registration.models import RegistrationProfile
from django.conf import settings
from django.contrib.sites.requests import RequestSite
from django.core.exceptio... | maurizi/otm-core | opentreemap/treemap/views/user.py | Python | agpl-3.0 | 9,600 |
##############################################################################
#
# Swiss localization Direct Debit module for Odoo
# Copyright (C) 2014 Compassion (http://www.compassion.ch)
# @author: Cyril Sester <cyril.sester@outlook.com>
#
# This program is free software: you can redistribute it an... | open-net-sarl/l10n-switzerland | l10n_ch_lsv_dd/model/__init__.py | Python | agpl-3.0 | 1,173 |
"""
Tests for course_overviews app.
"""
import datetime
import ddt
import itertools
import math
import mock
import pytz
from django.utils import timezone
from lms.djangoapps.certificates.api import get_active_web_certificate
from lms.djangoapps.courseware.courses import course_image_url
from xmodule.course_metadata_u... | hamzehd/edx-platform | openedx/core/djangoapps/content/course_overviews/tests.py | Python | agpl-3.0 | 21,034 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | TODO-7.0/hr_payroll_sort_employees/__init__.py | Python | agpl-3.0 | 1,063 |
# Copyright 2013-2021 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 PyYtopt(PythonPackage):
"""Ytopt package implements search using Random Forest (SuRF), an ... | LLNL/spack | var/spack/repos/builtin/packages/py-ytopt/package.py | Python | lgpl-2.1 | 1,360 |
"""The ClimaCell integration."""
from __future__ import annotations
from datetime import timedelta
import logging
from math import ceil
from typing import Any
from pyclimacell import ClimaCellV3, ClimaCellV4
from pyclimacell.const import CURRENT, DAILY, FORECASTS, HOURLY, NOWCAST
from pyclimacell.exceptions import (
... | sander76/home-assistant | homeassistant/components/climacell/__init__.py | Python | apache-2.0 | 11,985 |
from zerver.lib.test_classes import WebhookTestCase
class OpsGenieHookTests(WebhookTestCase):
STREAM_NAME = "opsgenie"
URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "opsgenie"
def test_acknowledge_alert(self) -> None:
expected_topic = "Integr... | rht/zulip | zerver/webhooks/opsgenie/tests.py | Python | apache-2.0 | 7,350 |
# Copyright (c) 2015 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | rahulunair/nova | nova/scheduler/weights/disk.py | Python | apache-2.0 | 1,534 |
#!/usr/bin/env python
# Finds all tasks and task outputs on the dependency paths from the given downstream task T
# up to the given source/upstream task S (optional). If the upstream task is not given,
# all upstream tasks on all dependancy paths of T will be returned.
# Terms:
# if the execution of Task T depends ... | Tarrasch/luigi | luigi/tools/deps.py | Python | apache-2.0 | 4,717 |
# -*- coding: utf-8 -*-
import os
import urllib
import uuid
import ssl
from pymongo import MongoClient
import requests
from bs4 import BeautifulSoup
from addons.wiki import settings as wiki_settings
from addons.wiki.exceptions import InvalidVersionError
# MongoDB forbids field names that begin with "$" or contain ".... | erinspace/osf.io | addons/wiki/utils.py | Python | apache-2.0 | 7,881 |
"""Urls for the Zinnia entries"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.entries import EntryDetail
urlpatterns = patterns(
'',
url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
EntryDetail.as_view(),
name='zinnia_ent... | pczhaoyun/obtainfo | zinnia/urls/entries.py | Python | apache-2.0 | 335 |
from recipyGui import recipyGui
from os import remove
from flask.ext.testing import TestCase
from tinydb import TinyDB
from dateutil.parser import parse
import six
class TestRecipyGui(TestCase):
def create_app(self):
self.dbName = 'recipyGui/tests/test.json'
recipyGui.config['tinydb'] = self.dbNam... | github4ry/recipy | recipyGui/tests/test_recipyGui.py | Python | apache-2.0 | 5,698 |
#
# 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... | spektom/incubator-airflow | airflow/models/variable.py | Python | apache-2.0 | 4,960 |
from django.utils.timezone import get_fixed_timezone
from zerver.lib.test_classes import ZulipTestCase
from analytics.lib.counts import CountStat
from analytics.views import time_range
from datetime import datetime, timedelta
class TestTimeRange(ZulipTestCase):
def test_time_range(self):
# type: () -> No... | cosmicAsymmetry/zulip | analytics/tests/test_views.py | Python | apache-2.0 | 2,009 |
#!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | grpc/grpc-ios | native_src/third_party/googletest/googletest/test/googletest-env-var-test.py | Python | apache-2.0 | 4,173 |
import os.path
import unittest
from contextlib import contextmanager
from unittest.mock import MagicMock, patch
from streamlink import PluginError, Streamlink
from streamlink.plugin.plugin import UserInputRequester
from streamlink_cli.console import ConsoleUserInputRequester
from tests.plugin.testplugin import TestPlu... | chhe/streamlink | tests/test_plugins_input.py | Python | bsd-2-clause | 2,688 |
"""
.. _ex-publication-figure:
===================================
Make figures more publication ready
===================================
In this example, we show several use cases to take MNE plots and
customize them for a more publication-ready look.
"""
# Authors: Eric Larson <larson.eric.d@gmail.com>
# ... | olafhauk/mne-python | examples/visualization/plot_publication_figure.py | Python | bsd-3-clause | 11,270 |
from matplotlib import pyplot
from shapely.geometry import LineString
from descartes import PolygonPatch
from figures import SIZE, BLUE, GRAY, set_limits, plot_line
line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])
fig = pyplot.figure(1, figsize=SIZE, dpi=90)
# 1
ax = fig.add_subplot(121)
plot_li... | jdmcbr/Shapely | docs/code/buffer.py | Python | bsd-3-clause | 1,095 |
"""Tests for vumi.middleware.tagger."""
import re
from vumi.middleware.tagger import TaggingMiddleware
from vumi.message import TransportUserMessage
from vumi.tests.helpers import VumiTestCase
class TestTaggingMiddleware(VumiTestCase):
DEFAULT_CONFIG = {
'incoming': {
'addr_pattern': r'^\d+... | TouK/vumi | vumi/middleware/tests/test_tagger.py | Python | bsd-3-clause | 5,053 |
"""
html page utils
"""
import urlparse, re
from scrapely.htmlpage import parse_html, HtmlTagType
ABSURLRE = re.compile("^https?\:\/\/")
DOCTYPERE = re.compile("<!DOCTYPE.*?>", re.S | re.I)
def _is_abs_url(url):
return bool(ABSURLRE.match(url))
def insert_base_url(html, base):
"""
Inserts the given base ... | lodow/portia-proxy | slybot/slybot/baseurl.py | Python | bsd-3-clause | 2,098 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.utils.modules import try_import
from .forms import LocationForm
from .models import Location
def get_model(name):
"""
"""
for type in Location.subclasses():
if type._meta.module_name == name:
return type
raise Sta... | caktus/rapidsms | rapidsms/contrib/locations/utils.py | Python | bsd-3-clause | 1,402 |
import datetime
from io import StringIO
from wsgiref.util import FileWrapper
from django import forms
from django.contrib import admin
from django.contrib.admin import BooleanFieldListFilter
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.c... | atul-bhouraskar/django | tests/admin_views/admin.py | Python | bsd-3-clause | 36,442 |
# -*- coding: utf-8 -*
from __future__ import unicode_literals
import os
from django.test import TestCase
from django.core import serializers
from django.conf import settings
from wagtail.wagtailimages.blocks import ImageChooserBlock
from .utils import get_test_image_file, Image
class TestImageChooserBlock(TestCa... | gogobook/wagtail | wagtail/wagtailimages/tests/test_blocks.py | Python | bsd-3-clause | 1,867 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | apps/test/test-1.py | Python | bsd-3-clause | 3,907 |
# run from root sources directory: python Scripts/vera++/vera++.py
import os
ignoredEndings = []
ignoredContent = [
"CMakeFiles",
"MyGUI_UString",
"pugixml",
"sigslot",
"Wrappers",
"MyGUI_KeyCode.h:58",
"InputConverter.h:896",
"MyGUI_RTTLayer.h:21",
"HotKeyManager.cpp:44",
"HotKeyManager.cpp:45",
"Common/Ba... | Anomalous-Software/mygui | Scripts/vera++/vera++.py | Python | mit | 1,126 |
from __future__ import absolute_import
import os
import re
import sys
from distutils import log
import xml.dom.pulldom
import shlex
import locale
import codecs
import unicodedata
import warnings
from setuptools.compat import unicode, PY2
from setuptools.py31compat import TemporaryDirectory
from xml.sax.s... | aliyun/oss-ftp | python27/win32/Lib/site-packages/setuptools/svn_utils.py | Python | mit | 18,855 |
"""Small helper class to provide a small slice of a stream.
This class reads ahead to detect if we are at the end of the stream.
"""
class BufferedStream(object):
"""Buffers a stream, reading ahead to determine if we're at the end.
:type stream: readable file-like object
:param stream: the stream to b... | ininex/geofire-python | resource/lib/python2.7/site-packages/gcloud/streaming/buffered_stream.py | Python | mit | 2,444 |
"""Nearest Neighbor Regression"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ulg.ac... | asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/neighbors/regression.py | Python | mit | 11,000 |
## Count the number of sales per month in our order history.
## Imports
import csv
from operator import add
from datetime import datetime
from StringIO import StringIO
from collections import namedtuple
from pyspark import SparkConf, SparkContext
## Helper constants
DATE_FMT = "%Y-%m-%d %H:%M:%S" # 2013-09-16 12:23:... | nvoron23/hadoop-fundamentals | spark/sales.py | Python | mit | 1,793 |
# -*- coding: 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 'Project.version_privacy_level'
db.add_column('projects_project', 'version_privacy_level',
... | d0ugal/readthedocs.org | readthedocs/projects/migrations/0028_add_version_default_privacy.py | Python | mit | 9,508 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.