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 |
|---|---|---|---|---|---|
"""
Module to handle sending error reports.
"""
import roam
import roam.config
import roam.utils
errorreporting = False
try:
from raven import Client
errorreporting = True
except ImportError:
errorreporting = False
roam.utils.warning("Error reporting disabled due to import error")
def can_send():
... | skeenp/Roam | src/roam/errors.py | Python | gpl-2.0 | 854 |
# Descargar e instalar el paquete NumPy de http://sourceforge.net/projects/numpy/
# Descargar e instalar el paquete SciPy de http://sourceforge.net/projects/scipy/
import scipy
import scipy.stats.distributions as distributions
import math
import os
import time
import threading
class Execute(threading.Thread):
def __... | ComputationalReflection/weaveJ | Benchmarks/Real Applications/weaveJ/Communication_Encryption/bin/bench.py | Python | mit | 3,494 |
#!/usr/bin/python
#
# PyODConverter (Python OpenDocument Converter) v1.0.0 - 2008-05-05
#
# This script converts a document from one office format to another by
# connecting to an OpenOffice.org instance via Python-UNO bridge.
#
# Copyright (C) 2008 Mirko Nasato <mirko@artofsolving.com>
# Licensed under the GNU LGPL v2... | itkin/proselytism | lib/proselytism/converters/open_office/odconverters/pyodconverter.py | Python | mit | 5,347 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
if __name__ == '__main__':
sys.path.append('../../')
import json
import logging
import sqlite3
from gchelpers.ip.GeoDbManager import GeoDbManager
from gchelpers.dt import DateTimeHandler
GEO_MANAGER = GeoDbManager()
def splitpath(path, ... | devgc/GcHelpers | gchelpers/db/SqliteCustomFunctions.py | Python | apache-2.0 | 4,308 |
"""cubic_spline.py
Implementations of the natural (and maybe clamped) cubic spline algorithms
"""
from typing import List, Tuple
def natural_cubic_spline(n, x, a):
b = [0.0] * (n + 1)
c = [0.0] * (n + 1)
d = [0.0] * (n + 1)
u = [0.0] * n
l = [0.0] * (n + 1)
z = [0.0] * (n + 1)
# step 1
... | Jokiva/Computational-Physics | lecture 8/cubic_spline.py | Python | gpl-3.0 | 4,623 |
# -*- coding: utf-8 -*-
# Module: default
# Author: asciidisco
# Created on: 24.07.2017
# License: MIT https://goo.gl/5bMj3H
"""Setup"""
import os
import re
import sys
from setuptools import find_packages, setup
REQUIRED_PYTHON_VERSION = (2, 7)
PACKAGES = find_packages()
INSTALL_DEPENDENCIES = []
SETUP_DEPENDENCIES ... | asciidisco/plugin.video.netflix | setup.py | Python | mit | 2,870 |
import sys
import report
import reportclient
from abrtcli.i18n import _
from abrtcli.match import match_get_problems
from . import Command
class Report(Command):
aliases = ['e']
name = 'report'
description = 'report problem'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwa... | martinky82/abrt | src/cli/abrtcli/cli/report.py | Python | gpl-2.0 | 1,967 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... | bsmr-eve/Pyfa | gui/marketBrowser.py | Python | gpl-3.0 | 3,729 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | skuda/client-python | kubernetes/client/models/extensions_v1beta1_scale_spec.py | Python | apache-2.0 | 3,076 |
def count_factor(n, factor=0):
for i in range(1, int(n**0.5)+1):
if n % i == 0:
factor += 2
return factor
def nth_triangular_number(n):
return int(n+(n*(n-1))/2)
def find_triangular_number_over(k, n=0):
while count_factor(nth_triangular_number(n)) <= k:
n += 1
return nt... | higee/project_euler | 11-20/12.py | Python | mit | 439 |
from pyfmodex.enums import SOUNDGROUP_BEHAVIOR
def test_max_audible(sound_group):
assert sound_group.max_audible == -1
sound_group.max_audible = 5
assert sound_group.max_audible == 5
def test_max_audible_behavior(sound_group):
new_behavior = SOUNDGROUP_BEHAVIOR.MUTE
assert sound_group.max_audible_... | tyrylu/pyfmodex | tests/test_sound_group.py | Python | mit | 1,345 |
# !usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2017-02-12 23:40:36
# @Last modified by: Brian Cherinka
# @Last Modified time: 2017-02-19 12:44:46
from __future__ import print_function, division, absolute_import
from marvin.tests.api im... | bretthandrews/marvin | python/marvin/tests/api/test_cube.py | Python | bsd-3-clause | 2,178 |
"""
Sphinx extension to create links to Contour documents (typically requirements
items).
:contour:`1412342`
links to https://www.contourhosted.com/perspective.req?projectId=2271&docId=1412342
when CONTOUR_PROJECT_ID = 2271 in Sphinx's conf.py.
"""
import urllib
from docutils import nodes, utils
... | sprin/sphinx-contour-docs | contour_docs/contour_docs.py | Python | mit | 1,340 |
"""
EvMenu
This implements a full menu system for Evennia. It is considerably
more flexible than the older contrib/menusystem.py and also uses
menu plugin modules.
To start the menu, just import the EvMenu class from this module.
Example usage:
```python
from evennia.utils.evmenu import EvMenu
EvMenu(calle... | ergodicbreak/evennia | evennia/utils/evmenu.py | Python | bsd-3-clause | 36,641 |
from sqlalchemy import MetaData, Table, inspect
from sqlalchemy.schema import CreateTable
from rs_sqla_test_utils.utils import clean, compile_query
def table_to_ddl(engine, table):
return str(CreateTable(table)
.compile(engine))
def test_view_reflection(redshift_engine):
table_ddl = "CREATE ... | graingert/redshift_sqlalchemy | tests/test_reflection_views.py | Python | mit | 1,676 |
class PREPARED(DataClassification):
name="PREPARED"
usage = 'Applies to all "prepared" data.'
parent = "UNPREPARED"
requirement = PHU( {'{re}.*?PREPAR*?': ".*?" })
newtypes.append(PREPARED())
| pyrrho314/recipesystem | trunk/dontload-astrodata_Gemini/ADCONFIG_Gemini/classifications/status/gemdtype.PREPARED.py | Python | mpl-2.0 | 218 |
#!/usr/bin/python
from magnum import *
world = World(
RectangularMesh((10, 10, 5), (5e-9, 5e-9, 5e-9)),
Body("freelayer", Material.Co(), Cuboid((0e-9, 0e-9, 25e-9), (50e-9, 50e-9, 20e-9))),
Body("fixedlayer", Material.Co(k1=1e7), Cuboid((0e-9, 0e-9, 15e-9), (50e-9, 50e-9, 0e-9)))
)
p = 1.0, 0.0, 0.0
a_j... | MicroMagnum/MicroMagnum | examples/macro-spintorque/macro-spintorque.py | Python | gpl-3.0 | 580 |
import json
import hashlib
import requests
from optional_django.serializers import JSONEncoder
from .exceptions import ReactRenderingError
from . import conf
from .exceptions import RenderServerError
class RenderedComponent(object):
def __init__(self, markup, props):
self.markup = markup
self.prop... | arceduardvincent/python-react | react/render_server.py | Python | mit | 2,316 |
# Copyright 2017 - Nokia
#
# 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, sof... | openstack/vitrage | vitrage/tests/unit/evaluator/recipes/test_execute_mistral.py | Python | apache-2.0 | 2,750 |
import sys
import random
import numpy as np
import torch
from torchtext import data
from args import get_args
from SST1 import SST1Dataset
from utils import clean_str_sst
args = get_args()
torch.manual_seed(args.seed)
if not args.cuda:
args.gpu = -1
if torch.cuda.is_available() and args.cuda:
print("Note: You... | Impavidity/kim_cnn | main.py | Python | mit | 2,631 |
# modified by Yu Huang
from controllers.pid_controller import PIDController
import math
import numpy
class MovingToPoint2(PIDController):
"""FollowPath (i.e. move to next point) steers the robot to a predefined position in the world."""
def __init__(self, params):
"""Initialize internal variables"""
... | ZhuangER/robot_path_planning | controllers/movingtopoint2.py | Python | mit | 1,295 |
# -*- coding: utf-8 -*-
"""
Tests for gdcdatamodel.gdc_postgres_admin module
"""
import logging
import unittest
from psqlgraph import (
Edge,
Node,
PsqlGraphDriver,
)
from sqlalchemy.exc import ProgrammingError
from gdcdatamodel import gdc_postgres_admin as pgadmin
from gdcdatamodel import models
loggin... | NCI-GDC/gdcdatamodel | test/test_gdc_postgres_admin.py | Python | apache-2.0 | 6,451 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.db import models
from djangocms_text_ckeditor.fields import HTMLField
from filer.fields.image import FilerImageField
from cms.models.fields import PlaceholderField
from adminsortable.fields import SortableForeignKey
from parler... | allink/allink-apps | people/models.py | Python | bsd-3-clause | 5,649 |
#
# 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... | irinabov/debian-qpid-dispatch | tests/system_tests_drain_support.py | Python | apache-2.0 | 14,346 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction signing using the signrawtransaction* RPCs."""
from test_framework.test_framework imp... | Flowdalic/bitcoin | test/functional/rpc_createmultisig.py | Python | mit | 3,657 |
# -*- coding: utf-8 -*-
# _____________________________________________________________________________
#
# Copyright (c) 2012 Berlin Institute of Technology
# All rights reserved.
#
# Developed by: Neural Information Processing Group (NI)
# School for Electrical Engineering and Computer Science
# ... | pmeier82/BOTMpy | botmpy/test/test_common_mcfilter.py | Python | mit | 10,365 |
from osv import osv, fields
from openerp.tools.translate import _
class spree_product(osv.osv):
_name="product.product"
_inherit="product.product"
def _get_default_code(self, cr, uid, context=None):
print context
return self.pool.get('product.product').read(cr, uid, context['id'], ['de... | OpenSolutionsFinland/spree_commerce | product.py | Python | agpl-3.0 | 1,356 |
#python
import testing
setup = testing.setup_mesh_source_test("NurbsCurve")
testing.require_valid_mesh(setup.document, setup.source.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.source.get_property("output_mesh"), "mesh.source.NurbsCurve", 2)
| barche/k3d | tests/mesh/mesh.source.NurbsCurve.py | Python | gpl-2.0 | 281 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# Copyright (C) 2006-2007, TUBITAK/UEKAE
#
# 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) ... | fuxprojesi/scom | api/setup.py | Python | gpl-3.0 | 1,890 |
# orm/path_registry.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Path tracking utilities, representing mapper graph traversals.
"""
from __... | sqlalchemy/sqlalchemy | lib/sqlalchemy/orm/path_registry.py | Python | mit | 16,453 |
# -*- coding: utf-8 -*-
from functools import wraps
from pollirio import commands
def old_expose(cmd):
def inner(fn):
def wrapped(*args, **kwargs):
commands[cmd] = fn
fn(*args)
return wraps(fn)(wrapped)
return inner
def expose(cmd, args=None):
def decorator(fn):
... | dpaleino/pollirio | pollirio/modules/__init__.py | Python | mit | 1,212 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import unittest
import random
from pymatgen.util.num import abs_cap, min_max_indexes, round_to_sigfigs
__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright... | czhengsci/pymatgen | pymatgen/util/tests/test_num_utils.py | Python | mit | 2,005 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: errors.py
import mcl.status
ERR_SUCCESS = mcl.status.MCL_SUCCESS
ERR_INVALID_PARAM = mcl.status.framework.ERR_START
ERR_MARSHAL_FAILED = mcl.status.f... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/network/cmd/traceroute/errors.py | Python | unlicense | 1,801 |
from enigma import eEPGCache
from Components.Converter.Converter import Converter
from Components.Element import cached
from Components.Converter.genre import getGenreStringSub
class EventName(Converter, object):
NAME = 0
SHORT_DESCRIPTION = 1
EXTENDED_DESCRIPTION = 2
FULL_DESCRIPTION = 3
ID = 4
NAME_NOW = 5
... | OpenLD/enigma2-wetek | lib/python/Components/Converter/EventName.py | Python | gpl-2.0 | 6,891 |
#! /usr/bin/python -tt
import nose
from rhuilib.util import *
from rhuilib.rhui_testcase import *
from rhuilib.rhuimanager import *
from rhuilib.rhuimanager_cds import *
from rhuilib.rhuimanager_client import *
from rhuilib.rhuimanager_repo import *
from rhuilib.rhuimanager_sync import *
class test_tcms_90682(RHUIT... | RedHatQE/rhui-testing-tools | rhui-tests/test_rhui_tcms90682.py | Python | gpl-3.0 | 2,622 |
"""Mozilla / Netscape cookie loading / saving."""
import re, time, logging
from cookielib import (reraise_unmasked_exceptions, FileCookieJar, Cookie,
MISSING_FILENAME_TEXT)
class MozillaCookieJar(FileCookieJar):
"""
WARNING: you may want to backup your browser's cookies file if you use
this class t... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9-SunOS-i386/lib/python/lib/python2.4/_MozillaCookieJar.py | Python | gpl-2.0 | 5,794 |
#
# Copyright 2014 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | saltstack/salt | salt/modules/btrfs.py | Python | apache-2.0 | 34,445 |
#!/usr/bin/env python
# coding=utf-8
from distutils.core import setup
setup(
name = 'funcModule',
version = '1.0.0',
py_modules = ['funcModule'],
author = 'haibin',
author_email ='haibin163@163.com',
url = 'http://github.com/hibin2014',
descripthon = 'A simple printer',
)
| xOpenLee/python | HeadFirstPython/chapter2/setup.py | Python | gpl-2.0 | 302 |
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/onlinehelp/onlinehelp.py | Python | gpl-3.0 | 5,638 |
"""Test the helper objects in letsencrypt.client.plugins.apache.obj."""
import unittest
class AddrTest(unittest.TestCase):
"""Test the Addr class."""
def setUp(self):
from letsencrypt.client.plugins.apache.obj import Addr
self.addr1 = Addr.fromstring("192.168.1.1")
self.addr2 = Addr.fr... | diracdeltas/lets-encrypt-preview | letsencrypt/client/plugins/apache/tests/obj_test.py | Python | apache-2.0 | 2,620 |
#!/usr/bin/env python
# Copyright 2015 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 json
import os
import sys
import common
def main_run(args):
with common.temporary_file() as tempfile_path:
rc = common... | nwjs/chromium.src | testing/scripts/blink_lint_expectations.py | Python | bsd-3-clause | 924 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | hguemar/cinder | cinder/openstack/common/service.py | Python | apache-2.0 | 15,241 |
#SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
HIPCHAT_ADDON_KEY = 'io.close.hipchat-addon'
HIPCHAT_ADDON_NAME = 'Close.io'
HIPCHAT_ADDON_DESCRIPTION = 'A HipChat add-on to give details about a Close.io lead when its URL is mentioned in HipChat'
HIPCHAT_ADDON_VENDOR_URL = 'http://close.io'
HIPCHAT_ADDON_VENDOR_NA... | elasticsales/closeio-hipchat-addon | settings.py | Python | mit | 458 |
#Combine Join Field for MUNAME column and Add acres and Sort by MUNAME scripts together
#Join mapunit table to soils
#A. Stephens
#11/19/2014
import arcpy
arcpy.env.overwriteOutput = True
inFC = arcpy.GetParameterAsText (0) #Input Feature Class
intable = arcpy.GetParameterAsText (1) #Input Table
out_xls =... | ncss-tech/geo-pit | alena_tools/Pro__V_tools/joinmuname_add_acres_sort_muname_20141119.py | Python | gpl-2.0 | 1,366 |
import pytest
from pandas.util._validators import validate_args_and_kwargs
_fname = "func"
def test_invalid_total_length_max_length_one():
compat_args = ("foo",)
kwargs = {"foo": "FOO"}
args = ("FoO", "BaZ")
min_fname_arg_count = 0
max_length = len(compat_args) + min_fname_arg_count
actual_... | rs2/pandas | pandas/tests/util/test_validate_args_and_kwargs.py | Python | bsd-3-clause | 2,391 |
# coding=utf-8
"""point.py - Represents a generic point on a sphere as a Python object.
See documentation of class Point for details.
Ole Nielsen, ANU 2002
"""
from math import cos, sin, pi
from math import acos as unsafe_acos # this may cause a domain error
import numpy
def acos(c):
"""... | lptorres/noah-inasafe | web_api/safe/common/geodesy.py | Python | gpl-3.0 | 7,635 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000397.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000397 | BIOMD0000000397/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/env python
# Convert old config files using logM_gas to a new value of Sigma_c
import argparse
import yaml
from gas_mass_conversions import logM_to_logsigma
parser = argparse.ArgumentParser(description="Convert the value of logM_gas to Sigma_c in config.yaml files.")
parser.add_argument("--config", help="n... | iancze/JudithExcalibur | scripts/config_convert_Mgas.py | Python | mit | 987 |
# ExpenseTracker - a simple, Django based expense tracker.
# Copyright (C) 2013 Massimo Barbieri - http://www.massimobarbieri.it
#
# 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 ... | barmassimo/Expense-Tracker | src/expenses/forms.py | Python | gpl-3.0 | 901 |
from __future__ import annotations
from io import (
BytesIO,
StringIO,
)
import os
from urllib.error import HTTPError
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import DataFrame
import pandas._testing as tm
from pandas.io.xml import read_xml
"""
CHECK LIST
[x] ... | dsm054/pandas | pandas/tests/io/xml/test_xml.py | Python | bsd-3-clause | 33,896 |
# Copyright 2019, OpenCensus 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 or agreed to in w... | census-instrumentation/opencensus-python | contrib/opencensus-ext-azure/opencensus/ext/azure/trace_exporter/__init__.py | Python | apache-2.0 | 9,315 |
import pytest
from api.base.settings.defaults import API_BASE
from api_tests import utils as api_utils
from framework.auth.core import Auth
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
NodeFactory,
)
from osf.utils import permissions as osf_permissions
@pytest.mark.django_db
class L... | pattisdr/osf.io | api_tests/logs/views/test_log_detail.py | Python | apache-2.0 | 8,613 |
#
# Copyright 2009 Benjamin Mellor
#
# This file is part of Fundy.
#
# Fundy 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... | cumber/fundy | graph.py | Python | gpl-3.0 | 23,972 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TopStory.width'
db.add_column(u'djangocms_topstory_topsto... | kohout/djangocms-getaweb-topstory | djangocms_topstory/south_migrations/0006_auto__add_field_topstory_width__add_field_topstory_height.py | Python | unlicense | 5,968 |
# 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... | cg31/tensorflow | tensorflow/contrib/layers/__init__.py | Python | apache-2.0 | 2,629 |
import datetime
import pdb
from django.test import TestCase
from finance.models import *
from efinance.models import *
from students.models import *
class UtilsTestCase(TestCase):
fixtures = ['students_testdata.json']
def setUp(self):
super(UtilsTestCase, self).setUp()
#self.cuota_1 = Cuota.o... | mfalcon/edujango | students/tests/utils.py | Python | apache-2.0 | 2,679 |
"""
XX. Model inheritance
Model inheritance exists in two varieties:
- abstract base classes which are a way of specifying common
information inherited by the subclasses. They don't exist as a separate
model.
- non-abstract base classes (the default), which are models in their own
right with ... | kawamon/hue | desktop/core/ext-py/Django-1.11.29/tests/model_inheritance/models.py | Python | apache-2.0 | 4,766 |
#MenuTitle: Check glyph names
# encoding: utf-8
__doc__="""
Goes through all glyph names and looks for illegal characters.
"""
firstChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
otherChars = "0123456789._-"
legalChars = firstChars + otherChars
exceptionList = [".notdef", ".null"]
import GlyphsApp
all... | weiweihuanghuang/Glyphs-Scripts | Glyph Names/Check glyph names.py | Python | apache-2.0 | 871 |
# %load "/Users/Achilles/Documents/Tech/Scala_Spark/HackOnData/Final Project/Build a WebInterface/screen.py"
#!/usr/bin/env python
from lxml import html
import json
import requests
import json,re
from dateutil import parser as dateparser
from time import sleep
def ParseReviews(asin):
# Added Retrying
for i ... | koulakis/amazon-review-qa-analysis | modules/scripts/WebDashboard.py | Python | mit | 7,846 |
from . import base
import numpy as np
class BinaryAccuracy(base.Metric):
def compute(self, output, target, model=None):
output_classes = output.round()
target_classes = target.round()
cmp = target_classes.eq(output_classes)
total = cmp.numel()
correct = cmp.sum()
... | ynop/candle | candle/metrics/accuracy.py | Python | mit | 1,468 |
#!/usr/bin/env python
import os
config = {
"default_actions": [
'clobber',
'checkout-sources',
'get-blobs',
'update-source-manifest',
'build',
'build-symbols',
'make-updates',
'prep-upload',
'upload',
'make-socorro-json',
'uploa... | kartikgupta0909/gittest | configs/b2g/releng-fota-eng.py | Python | mpl-2.0 | 4,525 |
from crypto.hashes.hashinterface import HashInterface
from Crypto.Hash import SHA384 as libsha384
class SHA384(HashInterface):
def hashString(self, stringMessage):
sha384 = libsha384.new()
sha384.update(stringMessage.encode())
return sha384.digest()
def getDigestSize(self):
r... | bensoer/pychat | crypto/hashes/sha384.py | Python | mit | 443 |
# (c) Copyright 2016 Brocade Communications Systems 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/LICEN... | Datera/cinder | cinder/tests/unit/zonemanager/test_brcd_http_fc_zone_client.py | Python | apache-2.0 | 27,655 |
import unittest
from unittest.mock import patch
from taiga.models import Webhook, Webhooks
from taiga.requestmaker import RequestMaker
class TestWebhooks(unittest.TestCase):
@patch("taiga.models.base.ListResource._new_resource")
def test_create_webhook(self, mock_new_resource):
rm = RequestMaker("/ap... | nephila/python-taiga | tests/test_webhooks.py | Python | mit | 641 |
import os
import datetime as dt
try:
from importlib import reload
except ImportError:
try:
from imp import reload
except ImportError:
pass
import numpy as np
from numpy.testing import assert_almost_equal
import pandas as pd
import unittest
import pytest
from pvlib.location import Locatio... | uvchik/pvlib-python | pvlib/test/test_spa.py | Python | bsd-3-clause | 16,534 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-batch/azure/batch/models/pool_upgrade_os_options.py | Python | mit | 3,076 |
SHARED_SECRET = b"<PASSWORD>"
TIMEOUT = 3600 # one hour
| Virako/authapi | authapi/auth_settings.py | Python | agpl-3.0 | 56 |
#!/usr/bin/env python
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# 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.
#
... | GNS3/gns3-server | gns3server/handlers/api/controller/__init__.py | Python | gpl-3.0 | 1,234 |
from math import ceil
from django.conf import settings
from django.core.paginator import (
EmptyPage, InvalidPage, Page, PageNotAnInteger, Paginator)
class ESPaginator(Paginator):
"""
A better paginator for search results
The normal Paginator does a .count() query and then a slice. Since ES
resul... | tsl143/addons-server | src/olympia/amo/pagination.py | Python | bsd-3-clause | 3,855 |
import command_system
def hello():
message = 'Привет, друг!\nЯ новый чат-бот.'
return message, ''
hello_command = command_system.Command()
hello_command.keys = ['привет', 'hello', 'дратути', 'здравствуй', 'здравствуйте']
hello_command.description = 'Поприветствую тебя'
hello_command.process = hello
| omax83/strorinWind | commands/hello.py | Python | apache-2.0 | 384 |
#!/usr/bin/env python3
import os
import sys
import time
import pickle
import argparse
import numpy as np
import h5py
try:
from matplotlib.backends.qt_compat import QtCore, QtWidgets, QtGui, is_pyqt5
except:
from matplotlib.backends.backend_qt4agg import QtCore, QtWidgets, QtGui, is_pyqt5
if is_pyqt5():
f... | BenLand100/WbLSdaq | evdisp.py | Python | gpl-3.0 | 21,079 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-iothub/azure/mgmt/iothub/models/iot_hub_description.py | Python | mit | 2,998 |
#generic python modules
import argparse
import operator
from operator import itemgetter
import sys, os, shutil
import os.path
################################################################################################################################################
# RETRIEVE USER INPUTS
#########################... | jhelie/ff_times | ff_times.py | Python | gpl-2.0 | 32,211 |
import os
import json
from time import time
from bottle import run, get, post, template, static_file
from bottle import response, request, redirect, error
from bottle.ext.websocket import GeventWebSocketServer
from bottle.ext.websocket import websocket
COOKIE_ID = 'omm-account'
COOKIE_SECRET = '49fz0348lQk5q110hRTt2A... | Alexander-0x80/office-mood-meter | omm.py | Python | mit | 2,567 |
#$#HEADER-START
# vim:set expandtab ts=4 sw=4 ai ft=python:
#
# Reflex Configuration Event Engine
#
# Copyright (C) 2016 Brandon Gillespie
#
# This program 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... | reflexsc/reflex | src/rfxengine/__init__.py | Python | agpl-3.0 | 5,071 |
from pulp.bindings import auth, consumer, consumer_groups, repo_groups, repository
from pulp.bindings.actions import ActionsAPI
from pulp.bindings.content import OrphanContentAPI, ContentSourceAPI, ContentCatalogAPI
from pulp.bindings.event_listeners import EventListenerAPI
from pulp.bindings.server_info import ServerI... | rbramwell/pulp | bindings/pulp/bindings/bindings.py | Python | gpl-2.0 | 3,641 |
#
# Copyright (C) 2017 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 will be... | vathpela/anaconda | tests/nosetests/pyanaconda_tests/install_manager_test.py | Python | gpl-2.0 | 4,025 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/schemas/fields/uuids.py | Python | apache-2.0 | 908 |
from __future__ import unicode_literals
import re
from django.db import models
# Notification class
from django.db.models import Q
from django.utils import timezone
class Notification(models.Model):
board = models.ForeignKey("boards.Board", verbose_name=u"Board this notification belongs to", related_name="not... | diegojromerolopez/djanban | src/djanban/apps/notifications/models.py | Python | mit | 5,341 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-02-07 22:01
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | moonsly/simple_task_manager | task_list/task_list/migrations/0001_initial.py | Python | gpl-3.0 | 1,284 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2010 Søren Roug, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | ashang/calibre | src/odf/attrconverters.py | Python | gpl-3.0 | 69,460 |
import zstackwoodpecker.operations.baremetal_operations as bare_operations
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import test_stub
import os
vm = None
def test():
global vm
# Create VM
vm = test_stub.create_vm()
vm.check()
# Create Virtual BMC
... | zstackorg/zstack-woodpecker | integrationtest/vm/baremetal/test_single_baremetal_installation_no_nic_no_bond.py | Python | apache-2.0 | 2,162 |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | boweeb/nhweb | config/settings/local.py | Python | bsd-3-clause | 1,911 |
from setuptools import setup
setup(
# general meta
name='ebs-deploy',
version='2.0.1',
author='Brian C. Dilley',
author_email='brian.dilley@gmail.com',
description='Python based command line tools for managing '
'Amazon Elastic Beanstalk applications.',
platforms='any',
... | briandilley/ebs-deploy | setup.py | Python | mit | 805 |
# -*- coding: utf-8 -*-
from . import base
class TriggerApi(base.Api):
_path = 'trigger',
def __call__(self, trigger_id=None):
"""List currency info for a currency/currencies - Authenticated.
:param currency_id: (optional) Currency id.
:return: Dict(s) for a currency/currencies:
... | katakumpo/cryptsy_api | cryptsy_api/trigger.py | Python | mit | 1,109 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource)
from neuralnilm.source import (standardise, discretize, fdiff, power_and_fdiff,
... | JackKelly/neuralnilm_prototype | scripts/e549.py | Python | mit | 7,665 |
from django.contrib import admin
from flooding_base.models import Application
from flooding_base.models import Configuration
from flooding_base.models import DataSourceDummy
from flooding_base.models import DataSourceEI
from flooding_base.models import GroupConfigurationPermission
from flooding_base.models import Map
... | lizardsystem/flooding-lib | flooding_base/admin.py | Python | gpl-3.0 | 1,181 |
from hubcheck.pageobjects.po_generic_page import GenericPage
class LoginPage1(GenericPage):
def __init__(self,browser,catalog):
super(LoginPage1,self).__init__(browser,catalog)
self.path = '/login'
# load hub's classes
LoginPage_Locators = self.load_class('LoginPage_Locators')
... | codedsk/hubcheck | hubcheck/pageobjects/po_login.py | Python | mit | 1,242 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import re
import warnings
from operator import itemgetter
from tabulate import tabulate
import numpy as np
from monty.io import zopen
from monty.json import MSONable
from pymatgen import Structure, Lattice... | blondegeek/pymatgen | pymatgen/io/feff/inputs.py | Python | mit | 32,854 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from keras.datasets import mnist
from hyperemble.neural_net import VanillaNeuralNet
def test_vanilla_neural_net():
(X_train, y_train), (X_test, y_test) = mnist.load_data()
X_train = X_train.reshape(6... | hduongtrong/hyperemble | hyperemble/neural_net/tests/test_neural_net.py | Python | bsd-2-clause | 760 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013, Sascha Peilicke <sascha@peilicke.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distrib... | frispete/py2pack | py2pack/__init__.py | Python | gpl-2.0 | 14,913 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'timboektu.views.home', name='home'),
# url(r'^timboektu/', include('timboektu.foo.urls')),
... | phoxicle/timboektu | timboektu/urls.py | Python | mit | 1,283 |
#
# Foris
# Copyright (C) 2019 CZ.NIC, z.s.p.o. <http://www.nic.cz>
#
# 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.
#
... | CZ-NIC/foris | foris/config/pages/dns.py | Python | gpl-3.0 | 1,320 |
# Best of NHK - by misty 2013-2020.
# import python libraries
import urllib
import urllib2
import re
import xbmc
import xbmcplugin
import xbmcgui
import xbmcaddon
import sys
import os
import datetime
import time
import calendar
import json
from random import randrange
#print(randrange(10))
addon01 = xbmcaddon.Addon('pl... | misty-/addons | plugin.video.bestofnhk/default.py | Python | gpl-3.0 | 54,172 |
from .base import Base
class Repository(Base):
def find(self, id=None):
if id:
url = 'repositories/{0}.json'.format(id)
else:
url = 'repositories.json'
return self._do_get(url)
def find_by_name(self, repository_name):
repos = self.find()
for r... | sherzberg/python-beanstalk-api | beanstalk/api/repository.py | Python | gpl-3.0 | 1,040 |
# Natural Language Toolkit: Probabilistic Chart Parsers
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Classes and interfaces for associating prob... | bbengfort/TextBlob | textblob/nltk/parse/pchart.py | Python | mit | 18,791 |
#!/usr/bin/env python2.7
import numpy as np
import matplotlib.pyplot as plt
Freq=np.array([20,30,40,45,48,50,52,55,60,62,65,68,70,80,85,88,90,95,98,100,105,110,120,125,130,140,145,160])
Db=np.array([81.7,85.1,94,103.8,110.8,112.7,110.9,105.8,96.2,95.9,94.7,94.6,95.2,99.2,102.6,105.3,106.9,117.5,119.3,117.3,110.2,108.1... | P1R/cinves | TrabajoFinal/tubo350cm/2-DbvsFreq/F-Db-Maximos/DbvsFreq-Ampde0.5.py | Python | apache-2.0 | 628 |
"""
Pyramid security concern.
see http://docs.pylonsproject.org/projects/pyramid/en/latest/tutorials/wiki2/authorization.html
"""
import logging
from pyramid.security import Allow
from .models import DBSession, User, Group
log = logging.getLogger(__name__)
class GroupFinder(object):
"""
Method creator of ... | sayoun/pyvac | pyvac/security.py | Python | bsd-3-clause | 2,292 |
# -*- coding: utf-8 *-*
from .base import RedisBase
NOT_SET = object()
class ListCommands(RedisBase):
# LIST COMMANDS
def blpop(self, keys, timeout=0):
"""
LPOP a value off of the first non-empty list
named in the ``keys`` list.
If none of the lists in ``keys`` has a value to ... | katakumpo/niceredis | niceredis/client/list.py | Python | mit | 5,489 |
from past.builtins import basestring
import os.path
import nineml
root = os.path.abspath(os.path.join(os.path.dirname(__file__), 'catalog'))
class NineMLCatalogSpecifiedMultipleNamesError(Exception):
pass
def load(path, name=None):
"""
Retrieves a model from the catalog from the given path
"""
... | tclose/NineMLCatalog | ninemlcatalog/base.py | Python | mit | 1,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.