code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from Source import Source
from Components.Element import cached
from Components.SystemInfo import SystemInfo
from enigma import eServiceReference
StreamServiceList = []
class StreamService(Source):
def __init__(self, navcore):
Source.__init__(self)
self.ref = None
self.__service = None
self.navcore = navcore... | Dima73/enigma2 | lib/python/Components/Sources/StreamService.py | Python | gpl-2.0 | 2,074 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | hryamzik/ansible | lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py | Python | gpl-3.0 | 6,414 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
google_drive_authorization_code = fields.Char(string='Authorization Code')
google_drive... | Aravinthu/odoo | addons/google_drive/models/res_config_settings.py | Python | agpl-3.0 | 1,634 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | caio2k/RIDE | src/robotide/lib/robot/output/librarylogger.py | Python | apache-2.0 | 2,175 |
import warnings
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib.auth.backends.ModelBackend'
def s... | towerjoo/mindsbook | django/contrib/auth/tests/auth_backends.py | Python | bsd-3-clause | 9,952 |
from SimpleCV import Camera, Image, Color, TemporalColorTracker, ROI, Display
import matplotlib.pyplot as plt
cam = Camera(1)
tct = TemporalColorTracker()
img = cam.getImage()
roi = ROI(img.width*0.45,img.height*0.45,img.width*0.1,img.height*0.1,img)
tct.train(cam,roi=roi,maxFrames=250,pkWndw=20)
# Matplot Lib exampl... | beni55/SimpleCV | SimpleCV/MachineLearning/TestTemporalColorTracker.py | Python | bsd-3-clause | 1,136 |
"""Extension argument processing code
"""
__all__ = ['Message', 'NamespaceMap', 'no_default', 'registerNamespaceAlias',
'OPENID_NS', 'BARE_NS', 'OPENID1_NS', 'OPENID2_NS', 'SREG_URI',
'IDENTIFIER_SELECT']
import copy
import warnings
import urllib
from openid import oidutil
from openid import kvf... | gquirozbogner/contentbox-master | third_party/openid/message.py | Python | apache-2.0 | 21,795 |
# Copyright 2016 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
from cpp_namespace_environment import CppNamespaceEnvironment
from model import Model, UnixName
from schema_loader import SchemaLoader
def _Gene... | scheib/chromium | tools/json_schema_compiler/namespace_resolver.py | Python | bsd-3-clause | 2,904 |
from __future__ import division, absolute_import, print_function
import sys
import collections
import pickle
import warnings
from os import path
import numpy as np
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal, assert_array_equal,
assert_array_almost_equal, assert_raises, asser... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/numpy/core/tests/test_records.py | Python | mit | 15,635 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | percyfal/luigi | test/cmdline_test.py | Python | apache-2.0 | 8,267 |
# coding: utf-8
# In[ ]:
#练习一:文本加密解密(先看有关ASCII码的相关知识以及码表,查维基百科或百度百科)
#输入:一个txt文件(假设全是字母的英文词,每个单词之间用单个空格隔开,假设单词最长为10个字母)
#加密:得到每个单词的长度 n ,随机生成一个9位的数字,将 n-1 与这个9位的数字连接,形成一个10位的数字,
#作为密匙 key 。依照 key 中各个数字对单词中每一个对应位置的字母进行向后移位(例:如过 key 中某数字为 2 ,
#对应该位置的字母为 a ,加密则应移位成 c ,如果超过 z ,则回到 A 处继续移位),对长度不到10的单词,移位后,
#将移位后的单词利用随机字母... | ZMMzhangmingming/liupengyuan.github.io | chapter2/homework/computer/5-10/201611680890-5.10.py | Python | mit | 1,296 |
#!/usr/bin/env python
# File created Sept 29, 2010
from __future__ import division
__author__ = "William Walters"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["William Walters", "Greg Caporaso"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "William Walters"
__email__ = "William.... | ssorgatem/qiime | qiime/truncate_fasta_qual_files.py | Python | gpl-2.0 | 6,323 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import shutil
import tempfile
from telemetry import decorators
from telemetry.testing import options_for_unittests
from telemetry.testing import page_test_t... | axinging/chromium-crosswalk | tools/perf/measurements/skpicture_printer_unittest.py | Python | bsd-3-clause | 1,305 |
from __future__ import print_function
import soco
""" Prints the name of each discovered player in the network. """
for zone in soco.discover():
print(zone.player_name)
| dundeemt/SoCo | examples/commandline/discover.py | Python | mit | 175 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import os
import re
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth import REDIRECT_FIELD_NAME, S... | bikong2/django | tests/auth_tests/test_views.py | Python | bsd-3-clause | 45,028 |
# -*- coding: utf-8 -*-
import os
from operator import itemgetter
from gluon.storage import Storage
from gluon.dal import DAL, Field, Row
DBHOST = os.environ.get('DBHOST', 'localhost')
DATABASE_URI = 'mysql://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world' % DBHOST
class Dal(object):
def __init__(self, table... | ashawnbandy-te-tfb/FrameworkBenchmarks | frameworks/Python/web2py/app/standard/modules/database.py | Python | bsd-3-clause | 2,330 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 1 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.store.basic_con... | drxaero/calibre | src/calibre/gui2/store/stores/archive_org_plugin.py | Python | gpl-3.0 | 1,689 |
from fabric.api import *
import fabric.contrib.project as project
import os
import shutil
import sys
import SocketServer
from pelican.server import ComplexHTTPRequestHandler
# Local path configuration (can be absolute or relative to fabfile)
env.deploy_path = 'output'
DEPLOY_PATH = env.deploy_path
# Remote server co... | oscarvarto/oscarvarto.github.io | fabfile.py | Python | apache-2.0 | 2,437 |
import os.path
import sys
import re
import warnings
import cx_Oracle
from django.db import connection, models
from django.db.backends.util import truncate_name
from django.core.management.color import no_style
from django.db.models.fields import NOT_PROVIDED
from django.db.utils import DatabaseError
# I... | edisonlz/fruit | web_project/base/site-packages/south/db/oracle.py | Python | apache-2.0 | 12,431 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create a scene with one of each ... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Rendering/Core/Testing/Python/pickCells.py | Python | gpl-3.0 | 16,540 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | Ehtaga/account-financial-reporting | account_financial_report_horizontal/report/report_financial.py | Python | agpl-3.0 | 2,192 |
#!/usr/bin/env python
# Copyright (C) 2017 Francisco Acosta <francisco.acosta@inria.fr>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
sys.path.append(os.path.join(os.enviro... | dailab/RIOT | tests/xtimer_usleep/tests/01-run.py | Python | lgpl-2.1 | 1,745 |
import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
self.obj = ArcGISSwmIO(test_file, 'r')
def test_close(se... | badjr/pysal | pysal/core/IOHandlers/tests/test_arcgis_swm.py | Python | bsd-3-clause | 1,219 |
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
import codecs
from pattern.vector import Document, PORTER, LEMMA
# A Document is a "bag-of-words" that splits a string into words and counts them.
# A list of words or dictionary of (word, count)-items can also be given.
# Words ... | krishna11888/ai | third_party/pattern/examples/05-vector/01-document.py | Python | gpl-2.0 | 3,205 |
"""
CMSIS-DAP Interface Firmware
Copyright (c) 2009-2013 ARM Limited
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 la... | flyhung/CMSIS-DAP | tools/get_binary.py | Python | apache-2.0 | 1,166 |
"""
Read/Write AMQP frames over network transports.
2009-01-14 Barry Pederson <bp@barryp.org>
"""
# Copyright (C) 2009 Barry Pederson <bp@barryp.org>
#
# 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 Softwa... | mzdaniel/oh-mainline | vendor/packages/amqplib/amqplib/client_0_8/transport.py | Python | agpl-3.0 | 7,349 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013-2015 Noviat nv/sa (www.noviat.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | damdam-s/account-financial-tools | account_move_line_search_extension/__init__.py | Python | agpl-3.0 | 1,056 |
# -*- coding: utf-8 -*-
from odoo.tests.common import HttpCase
from odoo.exceptions import ValidationError
class AccountingTestCase(HttpCase):
""" This class extends the base TransactionCase, in order to test the
accounting with localization setups. It is configured to run the tests after
the installation ... | Aravinthu/odoo | addons/account/tests/account_test_classes.py | Python | agpl-3.0 | 2,749 |
from sentry.testutils.cases import RuleTestCase
from sentry.rules.conditions.first_seen_event import FirstSeenEventCondition
class FirstSeenEventConditionTest(RuleTestCase):
rule_cls = FirstSeenEventCondition
def test_applies_correctly(self):
rule = self.get_rule()
self.assertPasses(rule, se... | felixbuenemann/sentry | tests/sentry/rules/conditions/test_first_seen_event.py | Python | bsd-3-clause | 407 |
"""
Contains CheesePreprocessor
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#----------... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbconvert/exporters/tests/cheese.py | Python | bsd-2-clause | 1,485 |
"""generated file, don't modify or your data will be lost"""
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
pass
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/logilab/__init__.py | Python | agpl-3.0 | 155 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2017 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import absolute_import
import os
import re
import sys
try:
import ssl
except ImportError: # pragma: no cover
s... | RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_vendor/distlib/compat.py | Python | gpl-3.0 | 41,408 |
name1_0_1_0_0_4_0 = None
name1_0_1_0_0_4_1 = None
name1_0_1_0_0_4_2 = None
name1_0_1_0_0_4_3 = None
name1_0_1_0_0_4_4 = None | asedunov/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_0/_pkg1_0_1/_pkg1_0_1_0/_pkg1_0_1_0_0/_mod1_0_1_0_0_4.py | Python | apache-2.0 | 128 |
import datetime
from decimal import Decimal
import types
import six
def is_protected_type(obj):
"""Determine if the object instance is of a protected type.
Objects of protected types are preserved as-is when passed to
force_unicode(strings_only=True).
"""
return isinstance(obj, (
six.inte... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/external/org_mozilla_bleach/bleach/encoding.py | Python | bsd-2-clause | 2,277 |
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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/LI... | nikesh-mahalka/cinder | cinder/tests/unit/fake_hp_client_exceptions.py | Python | apache-2.0 | 3,077 |
# -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.six import PY3
from ansible.utils.unsafe_proxy imp... | azaghal/ansible | test/units/utils/test_unsafe_proxy.py | Python | gpl-3.0 | 3,234 |
#!/usr/bin/env python
"""Sample Input Reader for map job."""
import random
import string
import time
from mapreduce import context
from mapreduce import errors
from mapreduce import operation
from mapreduce.api import map_job
# pylint: disable=invalid-name
# Counter name for number of bytes read.
COUNTER_IO_READ_BYT... | sahiljain/catapult | third_party/mapreduce/mapreduce/api/map_job/sample_input_reader.py | Python | bsd-3-clause | 3,468 |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, N... | octocoin-project/octocoin | qa/rpc-tests/bip65-cltv-p2p.py | Python | mit | 6,411 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Kairo Araujo <kairo@kairo.eti.br>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version':... | andmos/ansible | lib/ansible/modules/packaging/os/installp.py | Python | gpl-3.0 | 9,242 |
"""Local settings and globals."""
import sys
from os.path import normpath, join
from .base import *
# Import secrets -- not needed
#sys.path.append(
# abspath(join(PROJECT_ROOT, '../secrets/TimelineJS/stg'))
#)
#from secrets import *
# Set static URL
STATIC_URL = '/static' | deenjohn/TimelineJS | website/core/settings/loc.py | Python | mpl-2.0 | 279 |
# 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.
"""Presubmit script for Chromium browser resources.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about t... | guorendong/iridium-browser-ubuntu | ui/resources/resource_check/resource_scale_factors.py | Python | bsd-3-clause | 4,859 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | jeffery9/mixprint_addons | stock_location/procurement_pull.py | Python | agpl-3.0 | 6,951 |
def f(x):
"""
Returns
-------
object
"""
return 42 | smmribeiro/intellij-community | python/testData/intentions/returnTypeInNewNumpyDocString_after.py | Python | apache-2.0 | 75 |
# cs.???? = currentstate, any variable on the status tab in the planner can be used.
# Script = options are
# Script.Sleep(ms)
# Script.ChangeParam(name,value)
# Script.GetParam(name)
# Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO'
# Script.WaitFor(string,timeout)
# Script.SendRC(chan... | vizual54/MissionPlanner | Scripts/example1.py | Python | gpl-3.0 | 1,491 |
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/contrib/gis/measure.py | Python | artistic-2.0 | 12,272 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | loulich/Couchpotato | libs/guessit/transfo/guess_video_rexps.py | Python | gpl-3.0 | 1,837 |
#!/usr/bin/env python
#
# 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) any later version.
#
# Ansible is distributed in the hope that it will b... | EvanK/ansible | test/integration/targets/vault/faux-editor.py | Python | gpl-3.0 | 1,212 |
# $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst import Directive
from docutils.parsers.rst import states, di... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/docutils/parsers/rst/directives/admonitions.py | Python | gpl-2.0 | 2,413 |
#!/usr/bin/env python
import os
import re
import subprocess
import sys
import tempfile
CC = "gcc"
CFLAGS = "-fmax-errors=4 -std=c99 -pipe -D_POSIX_C_SOURCE=200809L -W -Wall -Wno-unused-variable -Wno-unused-parameter -Wno-unused-label -Wno-unused-value -Wno-unused-but-set-variable -Wno-unused-function -Wno-main".split... | wm4/boringlang | run_tests.py | Python | isc | 5,430 |
# ignore-together.py - a distributed ignore list engine for IRC.
from __future__ import print_function
import os
import sys
import yaml
weechat_is_fake = False
try:
import weechat
except:
class FakeWeechat:
def command(self, cmd):
print(cmd)
weechat = FakeWeechat()
weechat_is_fak... | kaniini/ignore-together | ignoretogether.py | Python | isc | 3,250 |
import re
from exchange.constants import (
CURRENCIES,
CURRENCY_NAMES,
DEFAULT_CURRENCY,
CURRENCY_EUR,
CURRENCY_UAH,
CURRENCY_USD,
CURRENCY_SESSION_KEY)
def round_number(value, decimal_places=2, down=False):
assert decimal_places > 0
factor = 1.0 ** decimal_places
sign = -1 ... | pmaigutyak/mp-shop | exchange/utils.py | Python | isc | 1,571 |
"""
Util classes
------------
Classes which represent data types useful for the package pySpatialTools.
"""
## Spatial elements collectors
from spatialelements import SpatialElementsCollection, Locations
## Membership relations
from Membership import Membership
| tgquintela/pySpatialTools | pySpatialTools/utils/util_classes/__init__.py | Python | mit | 266 |
"""
This module is to support *bbox_inches* option in savefig command.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import warnings
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D
def adjust_bbox(fig, bbox_inches, fixe... | yavalvas/yav_com | build/matplotlib/lib/matplotlib/tight_bbox.py | Python | mit | 2,604 |
# -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after monochromator,
:ref:`type 2 of global normalization<globalNorm>`. ... | kklmn/xrt | examples/withShadow/04_06/04_dE_VCM_bending.py | Python | mit | 4,894 |
from django.db import models
import warnings
from django.utils import timezone
import requests
from image_cropping import ImageRatioField
class CompMember(models.Model):
"""A member of compsoc"""
class Meta:
verbose_name = 'CompSoc Member'
verbose_name_plural = 'CompSoc Members'
index = ... | compsoc-ssc/compsocssc | general/models.py | Python | mit | 2,517 |
import complexism as cx
import complexism.agentbased.statespace as ss
import epidag as dag
dbp = cx.read_dbp_script(cx.load_txt('../scripts/SIR_BN.txt'))
pc = dag.quick_build_parameter_core(cx.load_txt('../scripts/pSIR.txt'))
dc = dbp.generate_model('M1', **pc.get_samplers())
ag = ss.StSpAgent('Helen', dc['Sus'], pc... | TimeWz667/Kamanian | example/OOP/O2.4 SS, Single agent model.py | Python | mit | 446 |
from __future__ import division, print_function
from abc import ABCMeta, abstractmethod
import matplotlib as mpl
mpl.use('TkAgg')
from matplotlib.ticker import MaxNLocator, Formatter, Locator
from matplotlib.widgets import Slider, Button
import matplotlib.patches as patches
import matplotlib.pyplot as plt
from matplotl... | vaquerizaslab/tadtool | tadtool/plot.py | Python | mit | 28,848 |
import cProfile
from pathlib import Path
def main(args, results_dir: Path, scenario_dir: Path):
try:
scenario_dir.mkdir(parents=True)
except FileExistsError:
pass
cProfile.runctx(
'from dmprsim.scenarios.python_profile import main;'
'main(args, results_dir, scenario_dir)',
... | reisub-de/dmpr-simulator | dmprsim/analyze/profile_core.py | Python | mit | 432 |
from django.http import HttpResponse
from django.core.servers.basehttp import FileWrapper
from django.contrib.auth.models import User
from django.shortcuts import render_to_response, redirect, get_object_or_404
from requests import get
from urllib import urlretrieve
from common.models import Repository
from common.ut... | vault/bugit | viewer/views.py | Python | mit | 3,804 |
"""
The MIT License (MIT)
Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the... | louisq/staticguru | utility/jdk_override.py | Python | mit | 1,445 |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 16:29:34 2017
@author: ishort
"""
import math
""" procedure to generate Gaussian of unit area when passed a FWHM"""
#IDL: PRO GAUSS2,FWHM,LENGTH,NGAUS
def gauss2(fwhm, length):
#length=length*1l & FWHM=FWHM*1l
#NGAUS=FLTARR(LENGTH)
... | sevenian3/ChromaStarPy | Gauss2.py | Python | mit | 996 |
from . import config
from django.shortcuts import render
from mwoauth import ConsumerToken, Handshaker, tokens
def requests_handshaker():
consumer_key = config.OAUTH_CONSUMER_KEY
consumer_secret = config.OAUTH_CONSUMER_SECRET
consumer_token = ConsumerToken(consumer_key, consumer_secret)
return Handsha... | harej/requestoid | authentication.py | Python | mit | 819 |
# -*- coding: utf-8 -*-
""" Request Management System - Controllers """
prefix = request.controller
resourcename = request.function
if prefix not in deployment_settings.modules:
session.error = T("Module disabled!")
redirect(URL(r=request, c="default", f="index"))
# Options Menu (available in all Functions'... | ptressel/sahana-eden-madpub | controllers/rms.py | Python | mit | 6,228 |
import array
import numbers
real_types = [numbers.Real]
int_types = [numbers.Integral]
iterable_types = [set, list, tuple, array.array]
try:
import numpy
except ImportError:
pass
else:
real_types.extend([numpy.float32, numpy.float64])
int_types.extend([numpy.int32, numpy.int64])
iterable_types.app... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.util/src/openmdao/util/typegroups.py | Python | mit | 558 |
#Attribute set in both superclass and subclass
class C(object):
def __init__(self):
self.var = 0
class D(C):
def __init__(self):
self.var = 1 # self.var will be overwritten
C.__init__(self)
#Attribute set in both superclass and subclass
class E(object):
def __init__(self):
... | github/codeql | python/ql/test/query-tests/Classes/overwriting-attribute/overwriting_attribute.py | Python | mit | 451 |
import pymongo
def connect ():
'''
Create the connection to the MongoDB and create 3 collections needed
'''
try:
# Create the connection to the local host
conn = pymongo.MongoClient()
print 'MongoDB Connection Successful'
except pymongo.errors.ConnectionFailure, err:
... | Macemann/Georgetown-Capstone | app/db/connect.py | Python | mit | 493 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in t... | Ginfung/FSSE | Metrics/gd.py | Python | mit | 1,445 |
import unittest
from unittest import skip
from decimal import Decimal
from cnab240 import errors
from cnab240.bancos import itau
from tests.data import get_itau_data_from_file
class TestRegistro(unittest.TestCase):
def setUp(self):
itau_data = get_itau_data_from_file()
self.header_arquivo = it... | Trust-Code/python-cnab | tests/test_registro.py | Python | mit | 4,409 |
#!/usr/bin/env python3
#
# Copyright (c) 2017 Nick Douma
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | LordGaav/notification-scripts | slack.py | Python | mit | 3,578 |
# -*- coding: utf-8 -*-
"""The initialization file for the Pywikibot framework."""
#
# (C) Pywikibot team, 2008-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__release__ = '2.0b3'
__version__ = '$Id$'
__url__ = 'https://www.mediawiki.org/wiki/Speci... | icyflame/batman | pywikibot/__init__.py | Python | mit | 26,823 |
# test_eng.py
# Copyright (c) 2013-2016 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0103,C0111,C0302,E0611,R0913,R0915,W0108,W0212
# Standard library imports
import functools
import sys
import pytest
from numpy import array, ndarray
# Putil imports
import putil.eng
from putil.test import AE, AI,... | pmacosta/putil | tests/test_eng.py | Python | mit | 40,156 |
import logging
from abc import ABCMeta, abstractmethod
from collections import deque
from typing import List, Union, Iterable, Sequence
log = logging.getLogger(__name__)
class NoSensorsFoundException(RuntimeError):
pass
class Controller(metaclass=ABCMeta):
@abstractmethod
def run(self):
raise N... | vrga/pyFanController | pyfc/common.py | Python | mit | 4,243 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaughter2Woman_ConnectedLHS
"""
# Flag this instance as compiled now
self.is_... | levilucio/SyVOLT | ExFamToPerson/contracts/unit/HUnitDaughter2Woman_ConnectedLHS.py | Python | mit | 2,107 |
#David Hickox
#Feb 15 17
#Squares (counter update)
#descriptions, description, much descripticve
#variables
# limit, where it stops
# num, sentry variable
#creates array if needbe
#array = [[0 for x in range(h)] for y in range(w)]
#imports date time and curency handeling because i hate string formating (this tak... | dwhickox/NCHS-Programming-1-Python-Programs | Chap 3/Squares.py | Python | mit | 778 |
from datetime import datetime
from zipfile import ZipFile
from io import BytesIO
from lxml import etree
from docxgen import *
from docxgen import nsmap
from . import check_tag
def test_init():
doc = Document()
check_tag(doc.doc, ['document', 'body'])
check_tag(doc.body, ['body'])
def test_save():
doc ... | kunxi/docxgen | tests/test_docx.py | Python | mit | 2,167 |
# -*- coding: utf-8 -*-
"""
将json文件中的数据存到数据库中
"""
import requests
import json
import os
from word.models import (Word, EnDefinition, CnDefinition, Audio, Pronunciation, Example, Note)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print(BASE_DIR)
def process_data(data):
data = data... | HideMode/ShanBay | data/script.py | Python | mit | 1,642 |
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.core.management import call_command
from django.db import models, connections, transaction
from django.urls import reverse
from django_tenants.clone import CloneSchema
from .postgresql_backend.base import _check_sc... | tomturner/django-tenants | django_tenants/models.py | Python | mit | 9,732 |
from nintendo import dauth, switch
from anynet import http
import pytest
CHALLENGE_REQUEST = \
"POST /v6/challenge HTTP/1.1\r\n" \
"Host: 127.0.0.1:12345\r\n" \
"User-Agent: libcurl (nnDauth; 16f4553f-9eee-4e39-9b61-59bc7c99b7c8; SDK 12.3.0.0)\r\n" \
"Accept: */*\r\n" \
"X-Nintendo-PowerState: FA\r\n... | Kinnay/NintendoClients | tests/test_dauth.py | Python | mit | 2,095 |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 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 addressindex generation and fetching
#
import binascii
from test_framework.messages import COI... | thelazier/dash | test/functional/feature_addressindex.py | Python | mit | 15,001 |
import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells=(c1, c2, c3))
assert u.name == 'cool'
cells = set... | wbinventor/openmc | tests/unit_tests/test_universe.py | Python | mit | 2,900 |
from datetime import datetime
from flask import Blueprint, render_template
from flask_cas import login_required
from timecard.api import current_period_start
from timecard.models import config, admin_required
admin_views = Blueprint('admin', __name__, url_prefix='/admin', template_folder='templates')
@admin_views.... | justinbot/timecard | timecard/admin/views.py | Python | mit | 885 |
"""
Django settings for keyman project.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | htlcnn/pyrevitscripts | HTL.tab/Test.panel/Test.pushbutton/keyman/keyman/keyman/settings.py | Python | mit | 3,109 |
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa
# Crypto and Cryptodome have same API
if random():
from Crypto.PublicKey import DSA
from Crypto.PublicKey import RSA
else:
from Cryptodome.PublicKey import DSA
from Cryptodome.PublicKey import RS... | github/codeql | python/ql/test/query-tests/Security/CWE-326-WeakCryptoKey/weak_crypto.py | Python | mit | 2,155 |
import re
import urllib
import hashlib
from django import template
from django.conf import settings
URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?',
re.IGNORECASE)
EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$',
re.IGNORECASE)
GRAVATAR_URL_PREFIX = 'http... | santa4nt/django-gravatar | django_gravatar/templatetags/gravatar_tags.py | Python | mit | 4,346 |
"""Test."""
import pytest
TM_TABLE = [
([0, 1, 1, 0, 1], True),
([0], True),
([1], False),
([0, 1, 0, 0], False),
]
@pytest.mark.parametrize("n, result", TM_TABLE)
def test_is_thue_morse(n, result):
"""Test."""
from is_thue_morse import is_thue_morse
assert is_thue_morse(n) == result
| rrustia/code-katas | src/test_is_thue_morse.py | Python | mit | 318 |
from fastapi.testclient import TestClient
from docs_src.request_files.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/files/": {
"post": {
"responses": {
... | tiangolo/fastapi | tests/test_tutorial/test_request_files/test_tutorial001.py | Python | mit | 6,215 |
import matplotlib.pyplot as plt
import numpy as np
def logHist(X, N=30,fig=None, noclear=False, pdf=False, **kywds):
'''
Plot logarithmic histogram or probability density function from
sampled data.
Args:
X (numpy.ndarray): 1-D array of sampled values
N (Optional[int]): Number of bins ... | dsavransky/miscpy | miscpy/PlotFun/logHist.py | Python | mit | 1,435 |
from __future__ import unicode_literals
from django.utils import six
import pytest
from nicedjango.utils.compact_csv import CsvReader
@pytest.fixture
def stream():
csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8')
return six.StringIO(csv)
def test_reader_raw(stream):
r = CsvRea... | katakumpo/nicedjango | tests/test_compact_csv_reader.py | Python | mit | 1,175 |
"""
WSGI config for readbacks project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readbacks.settings")
from django.co... | argybarg/readbacks | readbacks/wsgi.py | Python | mit | 393 |
from pxl_object import PxlObject
from pxl_vector import PxlVector
class PxlSprite(PxlObject):
def __init__(self, size, position):
pass
| desk467/pyxel | src/pxl_sprite.py | Python | mit | 150 |
"""
Test suite for the embedded <script> extraction
"""
from BeautifulSoup import BeautifulSoup
from nose.tools import raises, eq_
from csxj.datasources.parser_tools import media_utils
from csxj.datasources.parser_tools import twitter_utils
from tests.datasources.parser_tools import test_twitter_utils
def make_soup(... | sevas/csxj-crawler | tests/datasources/parser_tools/test_media_utils.py | Python | mit | 4,676 |
import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __init__ hat takes self and *** parameter.",
"class %%%... | peterhogan/python | oop_test.py | Python | mit | 2,018 |
# vim: set fileencoding=utf-8 :
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from ... | lpancescu/atlas-lint | setup.py | Python | mit | 3,767 |
from .game import Board
for i in range(10):
Board.all()
print(i)
| jorgebg/tictactoe | time.py | Python | mit | 74 |
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_height_above_sea_level',
'water_surface_height_ab... | ioos/comt | python/pyugrid_test.py | Python | mit | 3,158 |
#!/usr/bin/python
""" fanhaorename.py
"""
import os
import os.path
import logging
import fileorganizer
from fileorganizer import _helper
from fileorganizer.replacename import _replacename
__author__ = "Jack Chang <wei0831@gmail.com>"
def _tagHelper(tag):
""" TODO
"""
result = ""
for c in tag:
... | wei0831/fileorganizer | fileorganizer/fanhaorename.py | Python | mit | 2,156 |
import unittest
from app.commands.file_command import FileCommand
class TestFileCommand(unittest.TestCase):
def setUp(self):
self.window = WindowSpy()
self.settings = PluginSettingsStub()
self.sublime = SublimeSpy()
self.os_path = OsPathSpy()
# SUT
self.command = ... | ldgit/remote-phpunit | tests/app/commands/test_file_command.py | Python | mit | 7,821 |
# -*- coding: utf-8 -*-
from flask import Blueprint
from jotonce.api import route
from jotonce.passphrases.models import Passphrase
bp = Blueprint('passphrase', __name__, url_prefix='/passphrase')
@route(bp, '/')
def get():
p = Passphrase.get_random()
return {"results": p}
| nficano/jotonce.com | jotonce/api/passphrases.py | Python | mit | 285 |
import numpy as np
from pycqed.analysis import measurement_analysis as ma
from pycqed.analysis_v2 import measurement_analysis as ma2
from pycqed.measurement import sweep_functions as swf
from pycqed.measurement import detector_functions as det
MC_instr = None
VNA_instr = None
def acquire_single_linear_frequency_span... | DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/VNA_module.py | Python | mit | 12,353 |
from asyncio import coroutine
import pytest
from aiohttp import HttpBadRequest, HttpMethodNotAllowed
from fluentmock import create_mock
from aiohttp_rest import RestEndpoint
class CustomEndpoint(RestEndpoint):
def get(self):
pass
def patch(self):
pass
@pytest.fixture
def endpoint():
r... | atbentley/aiohttp-rest | tests/test_endpoint.py | Python | mit | 2,542 |