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 |
|---|---|---|---|---|---|
# cfg80211 P2P Device
# Copyright (c) 2013, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import time
from wpasupplicant import WpaSupplicant
from test_p2p_grpform import go_neg_pin_authorized... | aelarabawy/hostap | tests/hwsim/test_p2p_device.py | Python | gpl-2.0 | 2,999 |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
import numpy as np
from scipy.sparse import diag... | michaellaier/pymor | src/pymortests/solver.py | Python | bsd-2-clause | 2,123 |
# coding=utf8
import logging
import img_setting
import random
import time
import json
import re
import os
import execjs
import cv2
import numpy as np
import requests
import datetime
from selenium import webdriver
from w3lib.html import remove_tags
from lib.mp.base import Base
from control.db.redis_mgr import RedisA... | Svolcano/python_exercise | spiders/toutiao.py | Python | mit | 23,463 |
# -*- coding: utf-8 -*-
# Author: Charbel Jacquin
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or ... | Antiun/partner-contact | partner_relations/tests/test_partner_relations.py | Python | agpl-3.0 | 3,090 |
'''
Created on 2012-11-05
A simple script that reads a WRF and NARR data and displays it in a proper geographic projection;
application here is plotting precipitation in the inner WRF domain.
@author: Andre R. Erler
'''
## includes
# matplotlib config: size etc.
import numpy as np
import matplotlib.pylab as pyl
impo... | aerler/WRF-Projects | src/archive/plotInnerNARRprecip2.py | Python | gpl-3.0 | 7,069 |
# -*- coding: utf-8 -*-
# Maestro Music Manager - https://github.com/maestromusic/maestro
# Copyright (C) 2009-2015 Martin Altmayer, Michael Helmling
#
# 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 Foun... | maestromusic/maestro | maestro/plugins/renamer/gui.py | Python | gpl-3.0 | 9,088 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2020 RERO
# Copyright (C) 2020 UCLouvain
#
# 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 Software Foundation, version 3 of the License.
#
# This program ... | rero/reroils-app | tests/api/patrons/test_patrons_permissions.py | Python | gpl-2.0 | 3,347 |
import pickle
import pandas as pd
import numpy as np
from multiprocessing import Pool
from dynamic_time_warping import dtw_distance_c
from extract_features import extract_features_pca
from docopt import docopt
__doc__ = """
Usage: k_means_classify.py FILE [-d HD5_FILE] [-p PICKLE_FILE]
... | bastibe/MusicTagger | k_means_classify.py | Python | bsd-3-clause | 3,974 |
# -*- coding: utf-8 -*-
import functools
from cachecontrol.cache import DictCache
from cachecontrol.controller import CacheController
from cachecontrol.filewrapper import CallbackFileWrapper
from requests_middleware import BaseMiddleware
INVALIDATING_METHODS = set(['PUT', 'DELETE'])
class CacheMiddleware(BaseMid... | jmcarp/requests-middleware | requests_middleware/contrib/cachecontrolware.py | Python | mit | 2,470 |
# -*- coding: utf-8 -*-
"""
Copyright 2013 Ryan Olson
This file is part of CloudApp.
CloudApp 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 versio... | ryanolson/CloudApp | cloudapp/identity.py | Python | gpl-3.0 | 3,128 |
#!/usr/bin/python
import sys, os
if len(sys.argv) not in [2,3] or not os.path.exists(os.path.abspath(sys.argv[1])) or (len(sys.argv) == 3 and sys.argv[2] != "1"):
print "Usage: $ python job_combiner_2.py [indir] [bootstrap flag = 1]";
sys.exit();
indir = os.path.abspath(sys.argv[1]);
bs_flag = False;
if len(sys.arg... | gwct/core | legacy/core2/dev/job_combiner_raxml.py | Python | gpl-3.0 | 3,723 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | jakesyl/fail2ban | config/action.d/badips.py | Python | gpl-2.0 | 10,122 |
from django.views.generic.base import TemplateView
class ArticlesView(TemplateView):
template_name = 'blog/articles.html'
articles = ArticlesView.as_view()
| kottenator/my-little-blog | src/project/blog/views.py | Python | mit | 163 |
import time
class HitCounter:
def __init__(self):
self.__hits = 0
self.__start_time = time.time()
def __call__(self, *args):
self.__hits+=1
def __str__(self):
delta = time.time() - self.__start_time
return "Total: %d hits/s: %.2f" % (self.__hits, self.__hits / delta)
| porn-libre/my-libre-cam | qwebirc/util/hitcounter.py | Python | agpl-3.0 | 310 |
#!/usr/bin/env python
"""
This script will create a class that will be used to get informaton about GFS,
GFS2, and filesystem resources in the cluster.conf.
@author : Shane Bradley
@contact : sbradley@redhat.com
@version : 2.17
@copyright : GPLv2
"""
import re
import os.path
import logging
import textwrap
... | sbradley7777/sx | lib/sx/plugins/lib/clusterha/clusterhastorage.py | Python | gpl-2.0 | 33,535 |
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contract 89233218CNA000001 #
... | CSD-Public/stonix | src/stonix_resources/ui_dylan_pyqt5_main_listview.py | Python | gpl-2.0 | 25,596 |
# 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 |
from nose import tools
from aws_sign.v4.util import safe_encode
class TestSafeEncode(object):
def test_unicode(self):
before = u'howdy'
after = safe_encode(before)
expected = b'howdy'
tools.assert_equal(after, expected)
tools.assert_equal(type(after), type(expected))
... | nfcharles/python-aws-sign | aws_sign/test/v4/util_tests.py | Python | mit | 751 |
"""consolidate permissions
Revision ID: 71beb6c29063
Revises: 1c82f25a268e
Create Date: 2019-06-07 16:17:12.909645
"""
# revision identifiers, used by Alembic.
revision = '71beb6c29063'
down_revision = '1c82f25a268e'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgr... | adsabs/biblib-service | alembic/versions/71beb6c29063_consolidate_permissions.py | Python | mit | 1,914 |
from setuptools import setup
setup(name='YourAppName',
version='1.0',
description='OpenShift App',
author='Your Name',
author_email='example@example.com',
url='http://www.python.org/sigs/distutils-sig/',
install_requires=['Django==1.4.5',],
)
| dhirajt/dtc | setup.py | Python | gpl-3.0 | 280 |
from time import time
from django.utils.encoding import smart_text
from stdnet.odm import session
from stdnet import odm
class TTLBackendQueryClassWrapper(object):
def __init__(self, query_class):
self.query_class = query_class
def __call__(self, obj, **kwargs):
return TTLBackendQueryWrapper(... | jbking/django-stdnet | src/djangostdnet/ttl.py | Python | mit | 3,118 |
# setup for py.test
import os
import pytest
import easypost
TEST_API_KEY = os.environ["TEST_API_KEY"]
PROD_API_KEY = os.environ["PROD_API_KEY"]
def pytest_sessionstart(session):
# this is for local unit testing with google appengine, otherwise you get a
# 'No api proxy found for service "urlfetch"' respon... | dsanders11/easypost-python | tests/conftest.py | Python | mit | 1,864 |
#
# ApplicationInsights-Docker
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
# 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 wi... | Microsoft/ApplicationInsights-Docker | python/appinsights/dockercollector.py | Python | mit | 9,677 |
from copy import deepcopy
import unittest
import sys
class LibTest(unittest.TestCase):
# python2 默认字符编码是 ascii
def test_defaultEncoding(self):
self.assertEqual(sys.getdefaultencoding(), 'utf-8')
def test_defaultEncode(self):
u = b'\xe4\xbd\xa0\xe5\xa5\xbd'
self.assertEqual(str(typ... | wyvernnot/learn_python_through_unittest | tests/LibTest.py | Python | mit | 621 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2016 CERN.
#
# INSPIRE 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... | jacenkow/inspire-next | inspirehep/modules/disambiguation/ext.py | Python | gpl-2.0 | 1,584 |
#!/usr/bin/env python
#
# Copyright 2015 clowwindy
#
# 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 ... | vanish87/shadowsocks | shadowsocks/crypto/util.py | Python | apache-2.0 | 4,712 |
import leather
line_data = [
(0, 1),
(2, 5),
(4, 4),
(8, 3)
]
dot_data = [
(1, 3),
(2, 5),
(6, 9),
(10, 4)
]
leather.theme.title_font_family = 'Comic Sans MS'
leather.theme.legend_font_family = 'Comic Sans MS'
leather.theme.tick_font_family = 'Comic Sans MS'
leather.theme.default_seri... | onyxfish/leather | examples/theme.py | Python | mit | 480 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wave
import requests
from requests.auth import HTTPBasicAuth
import pyaudio
import rospy
class VoiceText(object):
"""
Speech synthesizer by VoiceText Web API
"""
URL = 'https://api.voicetext.jp/v1/tts'
CHUNK = 1024
_audio = pyaudio.PyAudio... | youtalk/youtalk_ros_pkg | voicetext/src/voicetext/__init__.py | Python | apache-2.0 | 4,894 |
# Copyright 2011 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... | fabian4/trove | trove/extensions/routes/mysql.py | Python | apache-2.0 | 2,852 |
# Copyright 2014 PressLabs SRL
#
# 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,... | rowhit/gitfs | tests/utils/test_args.py | Python | apache-2.0 | 3,028 |
from __future__ import division
import simpy
from numpy import random
from util import SimpyMixin
__all__ = ['User']
USER_LEVELS = ['admin', 'priviledged', 'basic']
USER_LEVEL_FREQUENCIES = [0.07, 0.13, 0.8]
class User(SimpyMixin, object):
"""
A network user.
"""
def __init__(self, network, leve... | sanbales/dacdam | dacdam/user.py | Python | mit | 1,068 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, get_datetime, get_time, getdate
from dateutil.relativedelta import relativedelta
from e... | aruizramon/alec_erpnext | erpnext/projects/doctype/time_log/time_log.py | Python | agpl-3.0 | 10,160 |
from functools import wraps
def instance_required(func):
@wraps(func)
def inner(self, *args, **kwargs):
if self.instance is None:
raise TypeError("Can't call %s with a non-instance manager" % func.__name__)
return func(self, *args, **kwargs)
return inner
| hwbuluo/django-vote | vote/utils.py | Python | bsd-2-clause | 296 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Blocking module for Odoo
# Copyright (C) 2014-2015 ACSONE SA/NV (http://acsone.eu)
# @author Adrien Peiffer <adrien.peiffer@acsone.eu>
#
# This program is free software: you can redis... | Antiun/bank-payment | account_payment_blocking/tests/test_account_banking_payment_blocking.py | Python | agpl-3.0 | 3,875 |
import gtk
import pango
import bot_procman.sheriff as sheriff
import bot_procman.sheriff_gtk.command_model as cm
import bot_procman.sheriff_gtk.sheriff_dialogs as sd
class SheriffCommandTreeView(gtk.TreeView):
def __init__(self, _sheriff, cmds_ts):
super(SheriffCommandTreeView, self).__init__(cmds_ts)
... | patmarion/libbot | bot2-procman/python/src/bot_procman/sheriff_gtk/command_treeview.py | Python | lgpl-3.0 | 19,583 |
from pathlib import Path
from vint.asset import get_asset_path
from vint.linting.config.config_file_source import ConfigFileSource
PROJECT_CONFIG_FILENAMES = [
'.vintrc.yaml',
'.vintrc.yml',
'.vintrc',
]
VOID_CONFIG_PATH = get_asset_path('void_config.yaml')
class ConfigProjectSource(ConfigFileSource):
... | RianFuro/vint | vint/linting/config/config_project_source.py | Python | mit | 769 |
# -*- Mode: Python; test-case-name: flumotion.test.test_common_xdg -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified... | flumotion-mirror/flumotion | flumotion/common/xdg.py | Python | lgpl-2.1 | 2,891 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gst._gst.py | Python | gpl-3.0 | 1,335 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013 CERN.
#
# Invenio 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... | Lilykos/invenio | invenio/testsuite/test_utils_pagination.py | Python | gpl-2.0 | 2,174 |
# Copyright 2011-2012 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | eethomas/eucalyptus | clc/eucadmin/eucadmin/describeproperties.py | Python | gpl-3.0 | 4,368 |
from . import views
class ViewSetMixin(object):
@classmethod
def as_func(cls, actions=None, **initkwargs):
cls.suffix =None
if not actions:
raise TypeError("Actions cannot be empty")
def view(*args, **kwargs):
self = cls(**initkwargs)
self.action_m... | cderwin/maps | api/shared/rest/viewsets.py | Python | mit | 1,146 |
from MaKaC.plugins import getModules, initModule
modules = {}
topModule = None
def getRHByTag(self, tag):
"""Do the link between url handlers and request handlers"""
for mod in self.modules.values():
for RH in mod.__dict__.keys():
try:
if mod.__dict__[RH]._requestTag == ta... | belokop-an/agenda-tools | code/MaKaC/plugins/EPayment/worldPay/webinterface/rh/__init__.py | Python | gpl-2.0 | 548 |
""" Core classes and functions for the Iterative Importance Sampling after Annan and Hargreaves
References
----------
Annan, J. D., & Hargreaves, J. C. (2010). Efficient identification of
ocean thermodynamics in a physical/biogeochemical ocean model with an iterative
Importance Sampling method. Ocean Modelling, 32(3... | perrette/iis | iis/core.py | Python | mit | 29,549 |
"""
WSGI config for chuck 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | clay584/chuck | chuck/chuck/wsgi.py | Python | mit | 387 |
#!/usr/bin/python3
from sympy import *
init_printing()
q00, q01, q02, q03 = symbols('q_00 q_01 q_02 q_03')
q11, q12, q13 = symbols('q_11 q_12 q_13')
q22, q23 = symbols('q_22 q_23')
q33 = symbols('q_33')
allQ = [q00, q01, q02, q03, q11, q12, q13, q22, q23, q33]
Pix0, Pix1, Pix2, Pix3 = symbols('zR_x0, zR_x1, zR_x2, ... | ciechowoj/calibration | report/equations/equations.py | Python | mit | 2,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import time
import random
import socket
import SocketServer
import socketpool
import nntp
import os
from lib.info import bcolors
class NNTPClientConnector(socketpool.Connector, nntp.NNTPClient):
def __init__(self, host, port, backend_mod, pool=None, username... | veryhumble/nntpproxy-docker | nntproxy/nntproxy.py | Python | apache-2.0 | 6,558 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/neighbors/neighbor/afi_safis/afi_safi/ipv4_labeled_unicast/__init__.py | Python | apache-2.0 | 12,320 |
import pyjd
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Controls import VerticalDemoSlider
from pyjamas import Window
from pyjamas.Timer import Timer
from textconsole import TextWindow
from Screen import Screen
try:
import pyjslib
except:
pass
import sys
def slider_app():
b = VerticalDemoS... | spaceone/pyjs | examples/shell/Shell.py | Python | apache-2.0 | 2,568 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb
import csv
import ConfigParser
from sys import argv
import os
import datetime as dt
# Config file
Config = ConfigParser.ConfigParser()
Config.read('export.cfg')
def remove_oldfile():
dirPath = "%s" % (ConfigSectionMap("log")['path'])
fileList = os.li... | vinc3nt/osc_radiator_monitoring | export/export.py | Python | unlicense | 5,109 |
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_removal_priority = fi... | Vauxoo/stock-logistics-warehouse | stock_removal_location_by_priority/models/res_config_settings.py | Python | agpl-3.0 | 598 |
from setuptools import setup
setup(name='pypeerassets',
version='0.2.6',
description='Python implementation of the PeerAssets protocol.',
keywords=["blockchain", "digital asset", "protocol"],
url='https://github.com/peerassets/pypeerassets',
author='PeerAssets',
author_email='peerch... | backpacker69/pypeerassets | setup.py | Python | bsd-3-clause | 507 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import pytest
from ... | jtrobec/pants | tests/python/pants_test/tasks/test_scalastyle_integration.py | Python | apache-2.0 | 2,603 |
from __future__ import print_function, absolute_import
from setuptools import setup, find_packages, Extension, Command
from setuptools.command.build_ext import build_ext
from setuptools.command.egg_info import egg_info
from distutils.file_util import copy_file
from distutils.dir_util import mkpath, remove_tree
from dis... | googlefonts/ots-python | setup.py | Python | bsd-3-clause | 9,371 |
# -*- coding: utf-8 -*-
"""Survey Controller"""
from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context,validate
from tg.i18n import ugettext as _, lazy_ugettext as l_
#from tg.exceptions import HTTPFound
from tg import predicates
from pollandsurvey import model
#from pollandsurvey.controller... | tongpa/PollSurveyWeb | pollandsurvey/controllers/script/imagescontroller.py | Python | gpl-2.0 | 4,189 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('packages', '__first__'),
('swid', '0002_rename_to_version_str'),
]
operations = [
migrations.AddField(
m... | strongswan/strongTNC | apps/swid/migrations/0003_tag_version.py | Python | agpl-3.0 | 479 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
distribution = Gumbel(2.0, -0.5)
print "Distribution ", repr(distribution)
print "Distribution ", distribution
# Is this distribution elliptical ?
print "Ellipt... | dbarbier/ot-svn | python/test/t_Gumbel_std.py | Python | gpl-3.0 | 4,935 |
class _CmdMeta:
desc = None
show = True
admin = False
def tmpl_data(self):
return {
'desc': self.desc,
}
class TSAdmJobQCmd:
name = None
log = None
db = None
jobq = None
env_id = None
runbg = True
meta = None
def __init__(self, name, wapp,... | jctincan/tsadm-webapp | tsadm/jobq/cmd.py | Python | bsd-3-clause | 2,701 |
# (C) British Crown Copyright 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any later ve... | ghislainp/iris | lib/iris/tests/unit/fileformats/grib/test_save_messages.py | Python | gpl-3.0 | 2,686 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
class Calcs(object):
"""
Objects of type Calcs have two methods for numerical calculations, and
an attribute of 'zero' which is set to 0
"""
def __init__(self):
self.zero = 0
def add_o... | kunalj101/Data-Science-45min-Intros | python-unittest/mathy.py | Python | unlicense | 668 |
import sys
import tnetstring
import zmq
if len(sys.argv) < 3:
print 'usage: %s [pub_spec] [pull_spec]' % sys.argv[0]
sys.exit(1)
pub_spec = sys.argv[1]
pull_spec = sys.argv[2]
zmq_context = zmq.Context()
pull_sock = zmq_context.socket(zmq.PULL)
pull_sock.bind(pull_spec)
pub_sock = zmq_context.socket(zmq.XPUB)
pu... | webhost/pushpin | tools/sourcebroker.py | Python | agpl-3.0 | 1,014 |
#!/usr/bin/env python
#coding:utf-8
import commands
import os
import base
class SystemStat(object):
'系统基本性能数据收集'
def __init__(self,interval = 30 , cpu_core = True ):
self.interval = interval
self.cpu_core = cpu_core
def _read_cpu_usage(self):
'''
从/proc/stat 读取CPU状态
返回值为列表: [ ['cpu', 'total_value','use_... | secisland/HostMonitor | system.py | Python | gpl-2.0 | 4,072 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# Generated by Django 1.9 on 2016-05-03 02:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payments', '0002_auto_20160425_0316'),
]
operat... | Pinecast/pinecast | payments/migrations/0003_tipevent_stripe_charge.py | Python | apache-2.0 | 506 |
#######################################################################
# Name: scoping.__init__.py
# Purpose: Meta-model / scope providers.
# Author: Pierre Bayerl
# License: MIT License
#######################################################################
import glob
import os
import errno
from os.path import join... | igordejanovic/textX | textx/scoping/__init__.py | Python | mit | 12,938 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from segwit import send_to_witness
from test_framework.test_framework import BitcoinTestFramework
from test_fr... | svost/bitcoin | qa/rpc-tests/bumpfee.py | Python | mit | 14,241 |
from __future__ import absolute_import, division, print_function
import pytest
from numpy.testing import (assert_almost_equal, assert_array_equal,
assert_array_almost_equal)
import MDAnalysis
from MDAnalysisTests.datafiles import Martini_membrane_gro
from MDAnalysisTests.datafiles import GR... | MDAnalysis/pmda | pmda/test/test_leaflet.py | Python | gpl-2.0 | 2,881 |
__pretty_app_name__ = "Gonvert"
__app_name__ = "gonvert"
__version__ = "1.1.6"
__build__ = 0
__app_magic__ = 0xdeadbeef
PROFILE_STARTUP = False
IS_MAEMO = True
| epage/Gonvert | gonvert/constants.py | Python | gpl-2.0 | 161 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 by Brendt Wohlberg <brendt@ieee.org>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
"""ADMM algorithm for the CMO... | alphacsc/alphacsc | alphacsc/other/sporco/sporco/admm/cmod.py | Python | bsd-3-clause | 8,925 |
__author__ = 'Luke Merrett'
from setuptools import setup, find_packages
setup(
name="badgernote",
packages=find_packages(),
install_requires=['peewee', 'argparse'],
author="Luke Merrett",
author_email="lukeamerrett@gmail.com",
url='https://github.com/lukemerrett/BadgerNote',
license="GPL",... | lukemerrett/BadgerNote | setup.py | Python | gpl-2.0 | 323 |
# -*- coding: utf-8 -*-
# providerbootstrapper.py
# Copyright (C) 2013 LEAP
#
# 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 ver... | andrejb/bitmask_client | src/leap/bitmask/provider/providerbootstrapper.py | Python | gpl-3.0 | 16,068 |
# Copyright (C) 2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
# See COPYING for license information.
import os
import time
import datetime
import re
import glob
import ConfigParser
from . import config
from . import constants
from . import userdir
from .msg import common_debug, common_warn, common_err, common_error, ... | ingted/crmsh | modules/history.py | Python | gpl-2.0 | 58,119 |
import os
import sys
import traceback
from _pydev_bundle.pydev_imports import xmlrpclib, _queue, Exec
from _pydev_bundle._pydev_calltip_util import get_description
from _pydev_imps._pydev_saved_modules import thread
from _pydevd_bundle import pydevd_vars
from _pydevd_bundle import pydevd_xml
from _pydevd_bundle.pydevd... | idea4bsd/idea4bsd | python/helpers/pydev/_pydev_bundle/pydev_console_utils.py | Python | apache-2.0 | 21,706 |
"""Support for Arris TG2492LG router."""
from typing import List
from arris_tg2492lg import ConnectBox, Device
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD
import homeassist... | tboyce021/home-assistant | homeassistant/components/arris_tg2492lg/device_tracker.py | Python | apache-2.0 | 2,010 |
"""
WSGI config for oshc 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.7/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_M... | tapasweni-pathak/OpenSourceHelpCommunity.github.io | oshc/oshc/wsgi.py | Python | mit | 383 |
from django.core.management.base import BaseCommand, CommandError
from elasticsearch import Elasticsearch
from elasticsearch import exceptions as ESExceptions
class Command(BaseCommand):
help = 'Purge the Elasticsearch index'
def handle(self, *args, **options):
self.stdout.write('Purging the ES')
es = Elasticse... | bio-tools/biotoolsregistry | backend/elixir/management/commands/es_purge.py | Python | gpl-3.0 | 688 |
""" Functions for handling the execution of a pipeline graph
"""
import logging
from dask import delayed
logger = logging.getLogger(__name__)
def delay_pipeline(pipeline, pipe):
""" Return a ``dask.delayed`` pipeline ready to execute
Args:
pipeline (list[Task]): A list of curried ``Task`` ready to ... | c11/yatsm | yatsm/pipeline/_exec.py | Python | mit | 776 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for ColorRamps.
.. note:: 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.
"""
__auth... | timlinux/QGIS | tests/src/python/test_qgscolorramp.py | Python | gpl-2.0 | 34,538 |
from pyramid.view import view_config
from sqlalchemy.exc import DBAPIError
import urllib2
@view_config(route_name='home', renderer='templates/index.mako')
def home(request):
response = urllib2.urlopen('http://witr.rit.edu/static/live.m3u')
response = response.read()
print response
return {'response'... | emollient/WITRapp | witrapp/witrapp/views.py | Python | gpl-2.0 | 458 |
#!/usr/bin/python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | tectronics/squires | squires.py | Python | apache-2.0 | 48,485 |
from django.conf import settings
import pymongo
DATA_FIELDS = {
'ffiec': [
#'diff',
'avg',
'high',
'low',
],
'naccrra': [
'center_4',
'center_infant',
#'center_school',
'family_4',
'family_infant',
#'family_school',
],
... | sunlightlabs/upwardly | src/movingup/data.py | Python | bsd-3-clause | 1,835 |
import os
from . import _errprint
import ts3lib
from ts3defines import (FileListType, ERROR_ok, ERROR_database_empty_result,
ERROR_file_transfer_complete, ChannelProperties)
import pytson
from pytsonui import setupUi
import ts3client
from pluginhost import PluginHost
from signalslot import Si... | pathmann/pyTSon | ressources/python/ts3widgets/filetransfer.py | Python | gpl-3.0 | 50,831 |
from struct import unpack, calcsize
from StataTypes import MissingValue, Variable
class Reader(object):
""".dta file reader"""
_header = {}
_data_location = 0
_col_sizes = ()
_has_string_data = False
_missing_values = False
TYPE_MAP = range(251)+list('bhlfd')
MISSING_VALUES = { 'b': (... | jquacinella/IS607_Project | PyDTA/StataTools.py | Python | gpl-2.0 | 6,749 |
from unittest.mock import patch
from feincms.module.page.models import Page
from masterfirefoxos.base.admin import PageAdmin
@patch('masterfirefoxos.base.admin.copy_tree')
@patch('masterfirefoxos.base.admin.PageAdmin.message_user')
def test_copy_tree_action_empty_queryset(mock_message_user, mock_copy_tree):
pag... | craigcook/masterfirefoxos | masterfirefoxos/base/tests/test_admin.py | Python | mpl-2.0 | 876 |
__author__ = 'nicholasclarke'
import os
import sys
from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager
from pdfminer.pdfpage import PDFPage
from pdfminer.converter import XMLConverter
from pdfminer.layout import LAParams
def parse_pdfs(pdf_filenames):
# Set parameters
pagenos = set()
max... | nicholasgodfreyclarke/Finance-Analysis | Parse_Pdf.py | Python | mit | 1,947 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | ibelie/typy | typy/google/protobuf/internal/encoder.py | Python | mit | 27,483 |
# Copyright 2018 Google 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, s... | vam-google/google-cloud-java | utilities/stage_sites.py | Python | apache-2.0 | 2,013 |
# -*- coding: UTF-8 -*-
from django import forms
from apps.registro.models import Anexo
class VerificacionDatosExtensionAulicaForm(forms.Form):
unidad_educativa_id = forms.CharField(widget=forms.HiddenInput())
dato_verificacion = forms.CharField(widget=forms.HiddenInput())
return_url = forms.CharField(widget=for... | MERegistro/meregistro | meregistro/apps/registro/forms/VerificacionDatosExtensionAulicaForm.py | Python | bsd-3-clause | 1,000 |
# -*- coding: utf-8 -*-
"""
Copyright 2015 Basho Technologies, Inc.
This file is provided to you 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 require... | bmess/riak-python-client | riak/tests/test_search.py | Python | apache-2.0 | 7,512 |
import re
from bs4 import BeautifulSoup
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selen... | ketanmukadam/StockData | stockdata/SDscraper.py | Python | gpl-3.0 | 6,501 |
from __future__ import unicode_literals
import os
import re
from django.utils import six
from django.utils.six.moves import range
from reviewboard.diffviewer.processors import (filter_interdiff_opcodes,
post_process_filtered_equals)
class MoveRange(object):
"""Sto... | 1tush/reviewboard | reviewboard/diffviewer/opcode_generator.py | Python | mit | 25,175 |
import zlib
input_data = b'Some repeated text.\n' * 1024
template = '{:>5} {:>5}'
print(template.format('Level', 'Size'))
print(template.format('-----', '----'))
for i in range(0, 10):
data = zlib.compress(input_data, i)
print(template.format(i, len(data)))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_data_compression_and_archiving/zlib_compresslevel.py | Python | apache-2.0 | 271 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RProdlim(RPackage):
"""Product-Limit Estimation for Censored Event History Analysis. Fast ... | iulian787/spack | var/spack/repos/builtin/packages/r-prodlim/package.py | Python | lgpl-2.1 | 1,248 |
# -*- 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... | realgo/luigi | luigi/target.py | Python | apache-2.0 | 8,746 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Ole Krause-Sparmann
# 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
# -*- coding: u... | pombredanne/NearPy | nearpy/storage/storage_redis.py | Python | mit | 7,216 |
from PySide.QtCore import QObject
class IComboEntry(QObject):
def __init__(self, title):
super(IComboEntry, self).__init__()
self._title = title
@property
def title(self):
return self._title
class IText1(QObject):
def __init__(self, text):
super(IText1, self).__init_... | nichollyn/libspark | aggregation/example/text/myinterfaces.py | Python | gpl-2.0 | 774 |
#!/usr/bin/python
#import math
import pysal
from pysal.cg.standalone import get_shared_segments
__author__ = "Sergio J. Rey <srey@asu.edu> "
__all__ = ["QUEEN", "ROOK", "ContiguityWeights_binning",
"ContiguityWeightsPolygons"]
import time
# delta to get buckets right
DELTA = 0.000001
QUEE... | spreg-git/pysal | pysal/weights/_contW_binning.py | Python | bsd-3-clause | 14,793 |
import logging
from ibmsecurity.utilities import tools
try:
basestring
except NameError:
basestring = (str, bytes)
logger = logging.getLogger(__name__)
# URI for this module
uri = "/iam/access/v8/audit"
requires_modules = ["mga", "federation"]
requires_version = None
def get(isamAppliance, check_mode=False... | IBM-Security/ibmsecurity | ibmsecurity/isam/base/audit_configuration.py | Python | apache-2.0 | 8,126 |
#!/usr/bin/env python
__author__ = "Michael J. Harms"
__date__ = "110113"
__version__= "0.3"
__description__ = \
"""
A Tkinterface that allows users to fit Aviv experimental data in an intuitive
and robust way.
"""
# Import python standard modules
import sys, os
# Import Tk modules
try:
from Tkinter import *
... | pansapiens/process-aviv | processAviv.py | Python | gpl-3.0 | 25,744 |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class ProductPropimgUploadRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.id = None
self.image = None
self.position = None
self.product_id = None
... | CooperLuan/devops.notes | taobao/top/api/rest/ProductPropimgUploadRequest.py | Python | mit | 460 |
# test_files.py
import unittest2 as unittest
from graphviz.files import File, Source
class TestBase(unittest.TestCase):
def setUp(self):
self.file = File()
def test_format(self):
with self.assertRaisesRegexp(ValueError, 'format'):
self.file.format = 'spam'
def test_engine(... | gregelin/graphviz | tests/test_files.py | Python | mit | 1,631 |
import logging
logger = logging.getLogger('')
formatter = logging.Formatter('[%(asctime)s %(module)s %(funcName)s] %(levelname)s - %(message)s')
ch = logging.StreamHandler()
ch.setFormatter(formatter)
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)
| rmcat/bwstreams | src/log.py | Python | mit | 269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.