code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
'''
File : __init__.py
Author : Nadav Samet
Contact : thesamet@gmail.com
Date : 2010 Jun 17
Description : Webilder webshots plugin package.
'''
from webilder.webshots.utils import get_download_list
from webilder.webshots.utils import get_photo_stream
from webilder.webshots.utils import process_photo
def fetch... | thesamet/webilder | src/webilder/webshots/__init__.py | Python | bsd-3-clause | 445 |
from auslib.blobs.base import Blob
class WhitelistBlobV1(Blob):
jsonschema = "whitelist.yml"
def __init__(self, **kwargs):
Blob.__init__(self, **kwargs)
if "schema_version" not in self:
self["schema_version"] = 3000
def isWhitelisted(self, requestIMEI):
self.log.debug... | tieu/balrog | auslib/blobs/whitelist.py | Python | mpl-2.0 | 977 |
import platform as pf
from typing import Any, Iterable, Optional
from .metrics_core import GaugeMetricFamily, Metric
from .registry import Collector, CollectorRegistry, REGISTRY
class PlatformCollector(Collector):
"""Collector for python platform information"""
def __init__(self,
registry: ... | prometheus/client_python | prometheus_client/platform_collector.py | Python | apache-2.0 | 1,869 |
# -*- coding: utf-8 -*-
"""
radon.py - Radon and inverse radon transforms
Based on code of Justin K. Romberg
(http://www.clear.rice.edu/elec431/projects96/DSP/bpanalysis.html)
J. Gillam and Chris Griffin.
References:
-B.R. Ramesh, N. Srinivasa, K. Rajgopal, "An Algorithm for Computing
the Discrete Radon Trans... | Hiyorimi/scikit-image | skimage/transform/radon_transform.py | Python | bsd-3-clause | 17,914 |
# convolutional autoencoder
# Based on
# https://github.com/ageron/handson-ml2/blob/master/17_autoencoders_and_gans.ipynb
import superimport
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
import tensorflow as tf
from tensorflow import keras
import pyprobml_utils as pml
device... | probml/pyprobml | scripts/conv_ae_tf.py | Python | mit | 2,692 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2019 David Arroyo Menéndez
# Author: David Arroyo Menéndez <davidam@gnu.org>
# Maintainer: David Arroyo Menéndez <davidam@gnu.org>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | davidam/python-examples | scikit/qda.py | Python | gpl-3.0 | 1,179 |
import pytest
import requests
import requests_mock
from pybib import utils
from hamcrest import *
class MockRequest:
def __init__(self, code):
self.code = code
@property
def status_code(self):
return self.code
def test_handle_status_code_200():
utils.handle_status_code(MockRequest(20... | jgilchrist/pybib | tests/test_utils.py | Python | bsd-3-clause | 2,228 |
"""
Support for NX584 alarm control panels.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.nx584/
"""
import logging
import requests
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassi... | jamespcole/home-assistant | homeassistant/components/nx584/alarm_control_panel.py | Python | apache-2.0 | 3,842 |
# Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import std_pair_ext
assert std_pair_ext.foo() == (3, 5)
print "OK"
| alexa-infra/negine | thirdparty/boost-python/libs/python/example/test_std_pair.py | Python | mit | 267 |
from .Exporter import Exporter
from pyqtgraph.parametertree import Parameter
from pyqtgraph.Qt import QtGui, QtCore, QtSvg, USE_PYSIDE
import pyqtgraph as pg
import numpy as np
__all__ = ['ImageExporter']
class ImageExporter(Exporter):
Name = "Image File (PNG, TIF, JPG, ...)"
allowCopy = True
def __i... | pixlra/HARP-fork | Various/ThirdParty/pyqtgraph/exporters/ImageExporter.py | Python | gpl-3.0 | 4,274 |
import sys
import unittest
import webbrowser
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from PyQt5 import QtTest
from PyQt5 import QtCore
from unittest.mock import MagicMock
# set up import paths
import sas.qtgui.path_prepare
# Local
import sas.qtgui.Utilities.GuiUtils as GuiUtils
from sas.qtgui.Perspective... | SasView/sasview | src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingPerspectiveTest.py | Python | bsd-3-clause | 13,718 |
# -*- coding:utf8 -*-
import os
import dsf
def clone(user, repo, target_name=None, cwd=None, branch='master'):
# make sure we know where we are cloning to
if cwd is None:
cwd = os.getcwd()
if target_name is None:
target_name=repo
# this is where we are cloning to
target_dir = os.path.join(cwd, target_name)... | devsetup/devsetup_framework | _vcs/github_https.py | Python | bsd-3-clause | 929 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import pep8
class UtilTestCase(unittest.TestCase):
def test_normalize_paths(self):
cwd = os.getcwd()
self.assertEqual(pep8.normalize_paths(''), [])
self.assertEqual(pep8.normalize_paths([]), [])
self.assertEq... | SpectraLogic/samba | third_party/pep8/testsuite/test_util.py | Python | gpl-3.0 | 880 |
# Copyright (c) 2015, Nordic Semiconductor
# 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 ... | dptechnics/Espruino | targetlibs/nrf5x/nrf51_sdk/examples/dfu/experimental/master_control_panel_patch/package.py | Python | mpl-2.0 | 14,818 |
import bitcoin
from bitcoin.core import x, b2x, CMutableOutPoint, CMutableTxIn, CMutableTxOut
from bitcoin.core.script import SIGHASH_ALL, SIGHASH_ANYONECANPAY
from bitcoin.core.scripteval import VerifyScript, SCRIPT_VERIFY_P2SH
from bitcoin.wallet import CBitcoinSecret
from PyQt4.QtGui import *
from PyQt4 import QtCo... | mazaclub/hashmal | hashmal_lib/plugins/tx_builder.py | Python | gpl-3.0 | 28,425 |
import calendar
import time
import hdbfs.db
TYPE_NILL = 0
TYPE_FILE = 1000
TYPE_FILE_DUP = 1001
TYPE_FILE_VAR = 1002
TYPE_GROUP = 2000
TYPE_ALBUM = 2001
TYPE_CLASSIFIER = 2002
class LinkedDuplicateIterator:
def __init__( self, session ):
self.__session = session
self.... | hakuya/higu | lib/hdbfs/legacy/ver8rules.py | Python | bsd-2-clause | 16,841 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2022 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | gem/oq-engine | openquake/hazardlib/gsim/toro_1997.py | Python | agpl-3.0 | 7,312 |
# -*- coding: utf-8 -*-
class ResourceOptions(object):
"""
A configuration class for ``Resource``.
Provides sane defaults and the logic needed to augment these settings with
the internal ``class Meta`` used on ``Resource`` subclasses.
"""
allowed_methods = ['get', 'post', 'put', 'delete', 'pat... | codeboy/coddy-sitetools | sitetools/coddy_api/api_resource.py | Python | bsd-3-clause | 1,729 |
# -*- coding: utf-8 -*-
"""Module, which has routines for scd CLI."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import os
import os.path
import sys
import pkg_resources
import six
import scd.config
import scd.... | 9seconds/scd | scd/main.py | Python | mit | 9,197 |
Experiment(description='PL2 empiricism',
data_dir='../data/tsdlr-renamed/',
max_depth=10,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=2,
jitter_sd=0.1,
max_jobs=400,
... | ekamioka/gpss-research | experiments/2014-02-18-GPSS-add-pl2.py | Python | mit | 1,774 |
#versa.query.ast
from versa.util import column
class query(object):
'Versa query language abstract syntax tree expression instance'
def traverse(self):
yield self.left
yield self.right
def evaluate(self, ctx):
#Walk the tree and prepare the nodes
if hasattr(self, 'travers... | uogbuji/versa | tools/py/query/ast.py | Python | apache-2.0 | 4,818 |
# (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... | mckerrj/ansible | lib/ansible/playbook/helpers.py | Python | gpl-3.0 | 15,590 |
# Generated by h2py from d:\mssdk\include\winnetwk.h
WNNC_NET_MSNET = 0x00010000
WNNC_NET_LANMAN = 0x00020000
WNNC_NET_NETWARE = 0x00030000
WNNC_NET_VINES = 0x00040000
WNNC_NET_10NET = 0x00050000
WNNC_NET_LOCUS = 0x00060000
WNNC_NET_SUN_PC_NFS = 0x00070000
WNNC_NET_LANSTEP = 0x00080000
WNNC_NET_9TILES = 0x00090000
WNNC... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pywin32-218-py2.7-win32.egg/Demos/win32wnet/winnetwk.py | Python | gpl-2.0 | 3,187 |
from __future__ import unicode_literals
import os
import sys
from .prod import *
DEBUG = True
TEMPLATE_DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = (('Adi', 'adi@u.northwestern.edu'), )
# Secret key generator: https://djskgen.herokuapp.com/
# You should set your key as an envi... | adiyengar/Spirit | example/project/settings/prod_local.py | Python | mit | 781 |
# -*- coding: utf-8 -*-
import unittest
import tests.envs as envs
import pyoxford
class TestTranslator(unittest.TestCase):
def test_detect(self):
api = pyoxford.translator(envs.FILE_PATH)
result = api.detect("I'm testing translator api.")
self.assertEqual("en", result)
def test_trans... | icoxfog417/pyoxford | tests/test_translator.py | Python | mit | 508 |
# -*- 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 model 'Building'
db.create_table(u'FingerprintsREST_building', (
(u'id', self.gf('djang... | alexf101/indoor-tracking | FingerprintsREST/migrations/0001_initial.py | Python | gpl-2.0 | 12,882 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming
import sys, os
import essentia.standard as ess
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import utilFunctions as UF
import stft as STFT
def f0Yin(x, N, H, minf0, maxf0):
... | timqian/sms-tools | lectures/6-Harmonic-model/plots-code/f0Yin.py | Python | agpl-3.0 | 1,719 |
# Copyright 2014 Red Hat, 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 or agr... | stevei101/oslo.messaging | oslo_messaging/tests/test_opts.py | Python | apache-2.0 | 2,216 |
# -*- coding: utf-8 -*-
"""
sphinx.pycode.nodes
~~~~~~~~~~~~~~~~~~~
Parse tree node implementations.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
class BaseNode(object):
"""
Node superclass for both terminal and nonterminal ... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/sphinx/pycode/nodes.py | Python | apache-2.0 | 6,392 |
"""Support for fans through the SmartThings cloud API."""
from __future__ import annotations
from collections.abc import Sequence
import math
from pysmartthings import Capability
from homeassistant.components.fan import SUPPORT_SET_SPEED, FanEntity
from homeassistant.config_entries import ConfigEntry
from homeassist... | rohitranjan1991/home-assistant | homeassistant/components/smartthings/fan.py | Python | mit | 3,421 |
#
# Author: Henrique Pereira Coutada Miranda
# Tests for yambopy
# Si
#
import matplotlib
import unittest
import sys
import os
import shutil
import argparse
import subprocess
import filecmp
from yambopy import *
from qepy import *
class TestPW_Si(unittest.TestCase):
""" This class creates the input files for Si an... | henriquemiranda/yambopy | tests/test_si.py | Python | bsd-3-clause | 10,900 |
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ContractLine(models.Model):
_inherit = 'contract.line'
payment_percentage = fields.Float(string='Percentage', default=100.0)
user_id = fields.... | oihane/odoo-addons | contract_school/models/contract_line.py | Python | agpl-3.0 | 2,130 |
# -*- coding: utf8 -*-
"""
일정 하중 아래 허용응력과 안전률을 고려한 봉의 최소 직경
"""
# 수학 관련 기능을 담은 모듈을 읽어들임
import math
# 1변수 방정식의 해법을 담은 root_finding.py 의 위치를 import 경로에 추가
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.pardir, 'lab_02_root_finding')))
# 1변수 방정식의 해법을 담은 root_finding.py 의 위치를 import 경로에 추가 끝
import... | kangwonlee/ECA | lab_05_python_oop/yield.py | Python | apache-2.0 | 2,411 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
""" Modul zur Extrahierung von Text aus einer .doc-Datei """
import subprocess
import loggingModule
def doc_txt(filename):
try:
process = subprocess.Popen(
['catdoc', '-w', filename],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
... | sikienzl/TextExtractor | converter/current/docTxt.py | Python | mit | 469 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 5, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_MovingMedian/cycle_5/ar_12/test_artificial_32_Anscombe_MovingMedian_5_12_20.py | Python | bsd-3-clause | 266 |
"""No email uniqueness on database level
Revision ID: 266ab139e8ab
Revises: 1e296c7f5e8c
Create Date: 2014-07-18 14:55:17.188121
"""
# revision identifiers, used by Alembic.
revision = '266ab139e8ab'
down_revision = '1e296c7f5e8c'
from alembic import op
def upgrade():
op.drop_constraint(u'user_email_key', 'us... | phihag/adhocracy | src/adhocracy/alembic/versions/266ab139e8ab_no_email_uniqueness_on_database_level.py | Python | agpl-3.0 | 414 |
"""Tests for the resubmit_error_certificates management command. """
import ddt
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import override_settings
from mock import patch
from opaque_keys.edx.locator import CourseLocator
from six import ... | cpennington/edx-platform | lms/djangoapps/certificates/tests/test_cert_management.py | Python | agpl-3.0 | 10,475 |
"""
.. module:: artist_credit_name
The **Artist Credit Name** Model.
PostgreSQL Definition
---------------------
The :code:`artist_credit_name` table is defined in the MusicBrainz Server as:
.. code-block:: sql
CREATE TABLE artist_credit_name ( -- replicate (verbose)
artist_credit INTEGER NOT NUL... | marios-zindilis/musicbrainz-django-models | musicbrainz_django_models/models/artist_credit_name.py | Python | gpl-2.0 | 1,269 |
import arrow
from dateutil.rrule import (rrulestr, rrule, rruleset,
MO, TU, WE, TH, FR, SA, SU)
from inbox.models.event import RecurringEvent, RecurringEventOverride
from inbox.events.util import parse_rrule_datetime
from inbox.log import get_logger
log = get_logger()
# How far in the fut... | EthanBlackburn/sync-engine | inbox/events/recurring.py | Python | agpl-3.0 | 5,655 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2022 Jose Antonio Chavarría <jachavar@gmail.com>
# Copyright (c) 2020-2022 Alberto Gacías <alberto@migasfree.org>
#
# 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 Softw... | migasfree/migasfree-backend | migasfree/core/models/migas_link.py | Python | gpl-3.0 | 28,879 |
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.openid import OpenID
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from flask.ext.misaka import Misaka
from raven.contrib.flask import Sentry
import steam
app = Flask(__name_... | Smashman/mods.tf | app/__init__.py | Python | gpl-3.0 | 1,987 |
from flask import render_template
from flask.views import View
class Index(View):
def dispatch_request(self):
return render_template('index.html', komuna='prishtina')
| opendatakosovo/municipality-procurement-visualizer | gpv/views/pages/index.py | Python | gpl-2.0 | 181 |
import os
import sys
import re
from bento._config \
import \
_CLI
import six
SYS_EXECUTABLE = os.path.normpath(sys.executable)
SCRIPT_TEXT = """\
# BENTO AUTOGENERATED-CONSOLE SCRIPT
if __name__ == '__main__':
import sys
from %(module)s import %(function)s
sys.exit(%(function)s())
"""
_LAUN... | cournape/Bento | bento/commands/script_utils.py | Python | bsd-3-clause | 4,301 |
from opcodes import NOT, SUB
from rule import Rule
from z3 import BitVec, BitVecVal
"""
Rule:
SUB(~0, X) -> NOT(X)
Requirements:
"""
rule = Rule()
n_bits = 256
# Input vars
X = BitVec('X', n_bits)
# Constants
ZERO = BitVecVal(0, n_bits)
# Non optimized result
nonopt = SUB(~ZERO, X)
# Optimized result
opt = NOT(X... | ethereum/solidity | test/formal/sub_not_zero_x_to_not_x_256.py | Python | gpl-3.0 | 347 |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('VizForm')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import VizjQuery
class VizForm(VizjQuery.VizjQuery):
#======================== header ==========================... | dustcloud/dustlink | views/web/dustWeb/viz/VizForm.py | Python | bsd-3-clause | 9,108 |
#!/usr/bin/env python
"""
Copyright (c) 2011, Scott Burns
All rights reserved.
"""
from os.path import join as pj
import time
import os
from string import Template
from time import strftime
from pdb import set_trace
from warnings import warn
from .config import SpecError
import util
__version__ = "0.0"
class SPM... | EBRL/Nibble | nibble/spm.py | Python | bsd-2-clause | 29,054 |
from bears.matlab.MatlabIndentationBear import MatlabIndentationBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
MatlabIndentationBearTest = verify_local_bear(
MatlabIndentationBear,
valid_files=('if a ~= b\n a\nendif\n',
'if a ~= b\n a\nendif\n',
'if a ... | seblat/coala-bears | tests/matlab/MatlabIndentationBearTest.py | Python | agpl-3.0 | 577 |
# -*- coding: utf-8 -*-
# Copyright(c) 2016-2020 Jonas Sjöberg <autonameow@jonasjberg.com>
# Source repository: https://github.com/jonasjberg/autonameow
#
# This file is part of autonameow.
#
# autonameow is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | jonasjberg/autonameow | autonameow/extractors/metadata/__init__.py | Python | gpl-2.0 | 1,177 |
import sys
import time
from io import StringIO
from session import extract_header, Message
from IPython.utils import io, text, encoding
#-----------------------------------------------------------------------------
# Globals
#-----------------------------------------------------------------------------
#-----------... | cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/zmq/iostream.py | Python | lgpl-3.0 | 3,021 |
# -*- coding: utf-8 -*-
# Copyright 2014 Associazione Odoo Italia (<http://www.odoo-italia.org>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
| linkitspa/l10n-italy | l10n_it_pec/__init__.py | Python | agpl-3.0 | 188 |
from pyflo.components.string.string import SplitComponent
| bennyrowland/pyflo | pyflo/components/string/__init__.py | Python | mit | 58 |
# Copyright 2011 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... | google/capirca | capirca/lib/port.py | Python | apache-2.0 | 4,390 |
#
# 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 under t... | steveb/heat | heat/tests/openstack/senlin/test_node.py | Python | apache-2.0 | 7,231 |
# Copyright 2012, 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... | nwjs/chromium.src | third_party/blink/web_tests/http/tests/websocket/echo-with-no-extension_wsh.py | Python | bsd-3-clause | 2,057 |
import shutil
import os
# Take index.html and copy it to each of the lesson folders. index.html itself is only a template.
for fileName in os.listdir('.'):
if os.path.isdir(fileName):
print fileName
shutil.copy2('index.html', fileName + '/index.html') | larsiusprime/HaxePloverLearn | assets/distribute_lessons.py | Python | mit | 273 |
# Create your views here.
from django.shortcuts import render
def index(request):
return render(request, 'stream/index.html', {}); | IDEHCO3/geonode | idehco3/stream/views.py | Python | gpl-3.0 | 136 |
# Created by Pearu Peterson, September 2002
from __future__ import division, print_function, absolute_import
from numpy.testing import (assert_, assert_equal, assert_array_almost_equal,
assert_array_almost_equal_nulp, assert_array_less,
assert_allclose)
import pyt... | arokem/scipy | scipy/fft/_pocketfft/tests/test_basic.py | Python | bsd-3-clause | 35,101 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import six
from django.contrib.auth import get_user_model
from django.db.mod... | taedori81/shoop | shoop/admin/modules/users/__init__.py | Python | agpl-3.0 | 2,997 |
# Copyright (C) 2013 S. Daniel Francis <francis@sugarlabs.org>
#
# 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.
#
# Thi... | sdanielf/dictate | dictation/wordplayer.py | Python | gpl-3.0 | 2,052 |
# Big Data Smart Socket
# Copyright (C) 2016 Clemson University
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Th... | feltus/BDSS | metadata_repository/tests/unit/url_matchers/regular_expression.py | Python | gpl-2.0 | 1,363 |
# -*- coding: utf-8 -*-
import re
from pyload.plugin.Account import Account
class QuickshareCz(Account):
__name = "QuickshareCz"
__type = "account"
__version = "0.03"
__description = """Quickshare.cz account plugin"""
__license = "GPLv3"
__authors = [("zoidberg", "zoidberg@muj... | ardi69/pyload-0.4.10 | pyload/plugin/account/QuickshareCz.py | Python | gpl-3.0 | 1,274 |
"""
find out the length of the last word in a string
https://leetcode.com/problems/length-of-last-word/
date: 10/08/21
"""
def length(s):
l = list(s)
for i in range(len(l)-1,0,-1):
if l[i] == ' ':
continue
start = i
p = start
while p>=0 and l[p] != ' ':
... | entrepidea/projects | python/tutorials/algo/leetcode/easy/len_of_last_word.py | Python | gpl-3.0 | 556 |
from . import mass_reconcile
from . import base_reconciliation
from . import base_advanced_reconciliation
from . import simple_reconciliation
from . import advanced_reconciliation
from . import mass_reconcile_history
from . import res_config
| OCA/bank-statement-reconcile | account_mass_reconcile/models/__init__.py | Python | agpl-3.0 | 242 |
"""
unit tests for the sqs_events engine
"""
import pytest
import salt.engines.sqs_events as sqs_events
from tests.support.mock import MagicMock, patch
pytestmark = [
pytest.mark.skipif(
sqs_events.HAS_BOTO is False, reason="The boto library is not installed"
)
]
@pytest.fixture
def configure_loader_... | saltstack/salt | tests/pytests/unit/engines/test_sqs_events.py | Python | apache-2.0 | 2,288 |
######################################################################
# Cloud Routes Web Application
# -------------------------------------------------------------------
# Reaction Class
######################################################################
import rethinkdb as r
class Reaction(object):
def __... | codecakes/cloudroutes-service | src/web/reactions.py | Python | agpl-3.0 | 5,105 |
"""
El usuario introduce una serie indefinida de números hasta que se introduzca un cero. El programa ha de imprimir
cuántos números se han introducido, la suma de todos los números, cuántos de esos números son múltiplos de dos,
cuántos son múltiplos de tres y cuántos son múltiplos de dos y de tres.
"""
# ... | IhToN/DAW1-PRG | Ejercicios/PrimTrim/Ejercicio13.py | Python | apache-2.0 | 2,711 |
#!/usr/bin/env python3
import threading
import time
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
from gi.repository import GObject, Gst, GLib
import config
import dispatchers
import utils
from storage.blacklist import BlacklistStorage
from metareader.icecast import IcecastReader
fr... | quasoft/adblockradio | adblockradio/player.py | Python | gpl-3.0 | 9,517 |
#
# Copyright (c) 2008--2017 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... | ogajduse/spacewalk | backend/satellite_tools/exporter/exportLib.py | Python | gpl-2.0 | 53,448 |
"""
[2017-04-07] Challenge #309 [Hard] Patterns overlap
https://www.reddit.com/r/dailyprogrammer/comments/641zpj/20170407_challenge_309_hard_patterns_overlap/
Taken from practice problem for google code jam (which starts tonight)
Input consists of 2 strings, where:
* each string may include `*` wildcard(s)
* `*` wild... | DayGitH/Python-Challenges | DailyProgrammer/DP20170407C.py | Python | mit | 2,146 |
# -*- coding: utf-8 -*-
__author__ = 'jb'
class FieldRegistry(object):
_registry = {}
def add_field(self, model, field):
reg = self.__class__._registry.setdefault(model, [])
reg.append(field)
def get_fields(self, model):
return self.__class__._registry.get(model, [])
def __c... | wnt-zhp/hufce | current_user/registration.py | Python | gpl-3.0 | 393 |
import os
import sys
from pathlib import Path
from setuptools import find_packages, setup
from setuptools.command.install import install
VERSION = Path(Path(__file__).parent, "quilt3", "VERSION").read_text().strip()
def readme():
readme_short = """
Quilt manages data like code (with packages, repositories, ... | quiltdata/quilt-compiler | api/python/setup.py | Python | apache-2.0 | 3,232 |
from django.urls import path
from ..views import (
MyRequestsView,
DraftRequestsView,
FoiProjectListView,
FollowingRequestsView,
RequestSubscriptionsView,
)
urlpatterns = [
path("requests/", MyRequestsView.as_view(), name="account-requests"),
path("drafts/", DraftRequestsView.as_view(), na... | fin/froide | froide/foirequest/urls/account_urls.py | Python | mit | 630 |
#
# Copyright (C) 2011-2012 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it wi... | atodorov/anaconda | pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py | Python | gpl-2.0 | 7,380 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01/operations/_private_endpoints_operations.py | Python | mit | 24,580 |
from dragonfly import (ActionBase)
from caster.lib import utilities, control
if control.nexus().dep.NATLINK:
import natlink
class SelectiveAction(ActionBase):
def __init__(self, action, executables, negate=True):
'''
action: another Dragonfly action
executables: an array of strin... | j127/caster | caster/lib/dfplus/additions.py | Python | lgpl-3.0 | 1,102 |
# 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.
"""Provides the web interface for adding and editing sheriff rotations."""
from __future__ import print_function
from __future__ import division
from __future... | catapult-project/catapult | dashboard/dashboard/create_health_report.py | Python | bsd-3-clause | 4,261 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from onixcheck.__main__ import main
from onixcheck import data
def test_main_o3_ref_valid(capsys):
argv = [data.VALID_ONIX2_REF]
exit_code = main(argv)
out, err = capsys.readouterr()
assert 'VALID' in out
assert 'INVALID' not in err
... | titusz/onixcheck | tests/test_onixcheck.py | Python | bsd-2-clause | 1,414 |
'''
Author: Hans Erik Heggem
Email: hans.erik.heggem@gmail.com
Project: Master's Thesis - Autonomous Inspection Of Wind Blades
Repository: Master's Thesis - CV (Computer Vision)
'''
################### UNIT TEST ########################
import unittest
from Settings.TestData import TestData
from TestUnits.Test_ma... | hansehe/Wind-Blade-Inspection | TestUnits/Test_src/Test_DroneVision/Test_DroneVision.py | Python | mit | 1,087 |
from fabric.api import run, env, hosts, task, runs_once
from fabric.state import output
from fabric.utils import fastprint
from certcheck import get_hosts, get_certs_to_check, check_certs, get_weblist, check_on_web
env.hosts = get_hosts()
output.running = False
output.status = False
output.stdout = False
@task
def c... | tomaslibal/when-expires | fabfile.py | Python | gpl-3.0 | 492 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
# load admin modules
from django.contrib import admin
admin.autodiscover()
# lo... | openpolis/op-cassetto | project/cassetto/urls.py | Python | bsd-3-clause | 2,320 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Team:
# J Phani Mahesh <phanimahesh@gmail.com>
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
# Amith KK <amithkumaran@gmail.com>
# Georgi Karavasilev <motorslav@gmail.com>
# Sam Tran <samvtran@gmail.com>
# Sam Hewitt <hewittsamuel@gmail.com>
#
# Descri... | samvtran/unity-tweak-tool | develtest.py | Python | gpl-3.0 | 1,222 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import time
from flask import request
from markupsafe import escape
from wtforms.fields imp... | ThiefMaster/indico | indico/modules/events/surveys/forms.py | Python | mit | 7,764 |
"""
Django settings for screencapper project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
import dj_database_url
from decouple import Csv, config
... | peterbe/django-screencapper | screencapper/settings/base.py | Python | mpl-2.0 | 3,786 |
import numpy as np
from .utils import get_func, check_boolean, isstr, aggregate_common_doc
from .utils_numpy import aliasing, minimum_dtype, minimum_dtype_scalar
from .aggregate_numpy import _aggregate_base
def _anynan(group_idx, a, size, fill_value, dtype=None):
return _any(group_idx, np.isnan(a), size, fill_v... | ml31415/numpy-groupies | numpy_groupies/aggregate_numpy_ufunc.py | Python | bsd-2-clause | 3,703 |
#!/usr/bin/python
# encoding: utf-8
"""
sifts.py test code.
Created by Shane O'Connor 2016
"""
import sys
import os
import time
import pprint
sys.path.insert(0, os.path.join('..', '..'))
from klab import colortext
from klab.bio.sifts import SIFTS
#for pdb_id in ['1AQT', '1lmb', '1utx', '2gzu', '2pnr', '1y8p', '2q8... | Kortemme-Lab/klab | .test/bio/sifts.py | Python | mit | 867 |
#!/usr/bin/env python
###############################################################################
# Copyright (C) 1994 - 2007, Performance Dynamics Company #
# #
# This software is licensed as described in the file ... | peterlharding/PDQ | examples/Linux Magazine/spamcan2.py | Python | mit | 2,040 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Derek Carter<goozbach@friocorte.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 ... | randynobx/ansible | lib/ansible/modules/system/selinux.py | Python | gpl-3.0 | 7,214 |
# Copyright 2013 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... | hayderimran7/tempest | tempest/api/compute/servers/test_virtual_interfaces_negative.py | Python | apache-2.0 | 1,691 |
# -*- coding: utf-8 -*-
#
# config.py - Global Mycodo settings
#
import binascii
import sys
from datetime import timedelta
import os
from flask_babel import lazy_gettext
# Append proper path for other software reading this config file
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from config_translatio... | kizniche/Mycodo | mycodo/config.py | Python | gpl-3.0 | 30,449 |
import os
import shutil
from additional.signals import signal_err, signal_ok, signal_done
def uninstall():
sl_dir = '/usr/share/'
question = input('For uninstall Sanelotto enter "uninstall": ')
if question != 'uninstall':
print('Not uninstalled')
return False
if not os.access('/usr/l... | Vladimir37/Sanelotto | routes/uninstall.py | Python | mit | 862 |
import cPickle as pickle
import matplotlib.pyplot as plt
import numpy as np
nr_examples= 200
modelfilename = '../data/nnfromscratch_eq' + str(nr_examples) + '.pkl'
def activation(x):
return np.tanh(x) #1/ (1 + np.exp(-x)) -0.5 #np.tanh(x) # np.log(1 + np.exp(x))
def the_function(x):
return np.sin(2*x)
nn_... | laputian/dml | equation/nnfromscratch_eq_func.py | Python | mit | 5,297 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-22 22:46
from __future__ import unicode_literals
from django.db import migrations, models
import tests.mockapp.models
class Migration(migrations.Migration):
dependencies = [
('mockapp', '0004_load_fixtures'),
]
operations = [
... | jannon/drf-haystack | tests/mockapp/migrations/0006_mockallfield.py | Python | mit | 1,079 |
# -*- coding: utf-8 -*-
import thesportsdb
import sqlite3 as lite
import os
import sys
import xbmc
import xbmcaddon
import urllib
#TODO avoid repetition here!######
addon_id = 'script.sportscenter'
settings = xbmcaddon.Addon(id=addon_id)
addonpath = settings.getAddonInfo('path').decode('utf-8')
sys.path.append(os.path... | enen92/script.sportscenter | resources/lib/centerutils/database/sc_database.py | Python | gpl-2.0 | 12,616 |
import json
import os
import os.path as opath
import shutil
import subprocess
from codegen.datatypes import build_datatype_py, write_datatype_py
from codegen.compatibility import (
write_deprecated_datatypes,
write_graph_objs_graph_objs,
DEPRECATED_DATATYPES,
)
from codegen.figure import write_figure_class... | plotly/plotly.py | packages/python/plotly/codegen/__init__.py | Python | mit | 11,939 |
import dateparser
import random
from collections import namedtuple
import pytest
from cfme.containers.image import Image
from cfme.containers.provider import (ContainersProvider, ContainersTestItem,
refresh_and_navigate)
from cfme.utils.wait import wait_for
from cfme.configure.ta... | lkhomenk/integration_tests | cfme/tests/containers/test_containers_smartstate_analysis.py | Python | gpl-2.0 | 4,387 |
from base import BabeBase, StreamHeader, StreamFooter
# Get the tokens from https://dev.twitter.com/docs/auth/tokens-devtwittercom
# The consumer keys can be found on your application's Details
# page located at https://dev.twitter.com/apps (under "OAuth settings")
# The access tokens can be found on your applicati... | fdouetteau/PyBabe | pybabe/twitter.py | Python | bsd-3-clause | 2,291 |
# Copyright 2019, The TensorFlow Federated Authors.
#
# 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 o... | tensorflow/federated | tensorflow_federated/python/simulation/datasets/transforming_client_data_test.py | Python | apache-2.0 | 6,268 |
from demosys.resources.base import ResourceDescription
class DataDescription(ResourceDescription):
"""Describes data file to load"""
require_label = True
default_loader = 'binary'
resource_type = 'data'
def __init__(self, path=None, label=None, loader=None, **kwargs):
kwargs.upd... | Contraz/demosys-py | demosys/resources/meta.py | Python | isc | 3,198 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Finance: admin page
"""
from treeio.finance.models import Transaction, Liability, Category
from django.contrib import admin
class TransactionAdmin(admin.ModelAdmin):
""" Transaction admin """
li... | rogeriofalcone/treeio | finance/admin.py | Python | mit | 799 |
# coding: utf-8
#
# Copyright 2010 Alexandre Fiori
# based on the original Tornado by Facebook
#
# 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... | lextoumbourou/cyclone | cyclone/sse.py | Python | apache-2.0 | 3,312 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.