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 |
|---|---|---|---|---|---|
""" ProgressBar
Example:
.. UIExample:: 100
from flexx import app, event, ui
class Example(ui.Widget):
def init(self):
with ui.HBox():
self.b1 = ui.Button(flex=0, text='Less')
self.b2 = ui.Button(flex=0, text='More')
self.prog = ui.Progres... | zoofIO/flexx | flexx/ui/widgets/_progressbar.py | Python | bsd-2-clause | 3,268 |
import tensorflow as tf
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W, padding='SAME'):
return tf.nn.conv2d(x, W, strides=[... | iwegner/MITK | Modules/Biophotonics/python/iMC/regression/tensorflow_estimator.py | Python | bsd-3-clause | 3,199 |
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""PyCrypto RC4 implementation."""
from .cryptomath import *
from .rc4 import *
if pycryptoLoaded:
import Crypto.Cipher.ARC4
def new(key):
return PyCrypto_RC4(key)
class PyCrypto_RC4(RC4):
... | martinez-zea/tts | tlslite/utils/pycrypto_rc4.py | Python | gpl-3.0 | 796 |
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
install_requires = [
'requests==2.8.1... | technoarch-softwares/linkedin-auth | setup.py | Python | bsd-2-clause | 1,410 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# 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 your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/Animation/D6.py | Python | lgpl-2.1 | 2,961 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 16:33:34 2015
@author: ajaver
"""
import os
import numpy as np
import pandas as pd
import tables
from scipy.spatial.distance import cdist
from tierpsy.helper.misc import TimeCounter, print_flush, TABLE_FILTERS
def assignBlobTraj(trajectories_file, max_allowed_dist=... | ljschumacher/tierpsy-tracker | tierpsy/analysis/traj_join/joinBlobsTrajectories.py | Python | mit | 15,842 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SGDRegressor" , "freidman2" , "hive")
| antoinecarme/sklearn2sql_heroku | tests/regression/freidman2/ws_freidman2_SGDRegressor_hive_code_gen.py | Python | bsd-3-clause | 127 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-05-05 14:32:46
# @Author : moling (365024424@qq.com)
# @Link : #
# @Version : 0.1
import logging
import os
from aiohttp import web
from jinja2 import Environment, FileSystemLoader
from config import COOKIE_NAME, COOKIE_KEY
from app.frame import add_ro... | moling3650/mblog | www/app/__init__.py | Python | mit | 2,122 |
"""
Future implementation for the prompt_toolkit eventloop.
"""
from __future__ import unicode_literals, print_function
from .base import EventLoop
from .context import get_context_id, context
from .defaults import get_event_loop
import sys
__all__ = [
'Future',
'InvalidStateError',
]
class InvalidStateError... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/prompt_toolkit/eventloop/future.py | Python | mit | 6,560 |
# Generated by Django 3.1.3 on 2021-01-06 19:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0010_auto_20201213_1314"),
]
operations = [
migrations.AlterField(
model_name="auditlog",
name="activity... | nijel/weblate | weblate/accounts/migrations/0011_auto_20210106_1903.py | Python | gpl-3.0 | 1,374 |
import json
from django.http import HttpResponse
from django.views.generic import TemplateView
class JSONResponseMixin(object):
"""
A mixin that can be used to render a JSON response.
"""
response_class = HttpResponse
def render_to_response(self, context, **response_kwargs):
"""
... | rubydhash/webradius | webradius-project/lib/djangoutils/jsonutils.py | Python | lgpl-2.1 | 1,649 |
"""
Useful constants used in this project
"""
# use for spider JSON output
NAME_KEY = 'name'
ID_KEY = 'id'
PRICE_KEY = 'price'
LINK_KEY = 'link' | wriggityWrecked/WebScraping | constants.py | Python | apache-2.0 | 145 |
from django.db import models
from django.contrib.auth.models import User
from cms.models import CMSPlugin
class ContestPlugin(CMSPlugin):
title = models.CharField(max_length=255)
class Prediction(models.Model):
user = models.ForeignKey(User)
date = models.DateTimeField(auto_now_add=True)
class Week(model... | ISIFoundation/influenzanet-website | apps/contest/models.py | Python | agpl-3.0 | 514 |
"""Collection of bulk systems.
From this paper:
Philipp Haas, Fabien Tran, Peter Blaha
Calculation of the lattice constant of solids with semilocal functionals
Phys. Rev. B 79, 085104 (2009)
dx.doi.org/10.1103/PhysRevB.79.085104
Data extracted to csv files with:
* lattice constant::
pdftotext -... | grhawk/ASE | tools/ase/test/tasks/htb.py | Python | gpl-2.0 | 18,943 |
#
# Copyright 2015-2019, Institute for Systems Biology
#
# 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 ... | isb-cgc/ISB-CGC-Webapp | scripts/isb_auth.py | Python | apache-2.0 | 4,266 |
# -*- coding: utf-8 -*-
import unittest
from framework import TestCase
from earth.tag import Tag
class TestTagCase(TestCase):
def test_tag(self):
# ADD
tag_name = '娱乐'
tag = Tag.add(name=tag_name)
assert tag_name == tag.name
assert hasattr(tag, 'id')
# GET
... | tottily/terabithia | monster/test_tag.py | Python | apache-2.0 | 1,202 |
#!/usr/bin/env python
import gtk
class FontSelectionDialog(gtk.FontSelectionDialog):
def __init__(self):
gtk.FontSelectionDialog.__init__(self, title=None)
self.set_title("FontSelectionDialog")
self.connect("response", self.on_response)
def on_response(self, dialog, response):
... | Programmica/pygtk-tutorial | examples/fontselectiondialog.py | Python | cc0-1.0 | 479 |
# Generated by Django 2.0.4 on 2018-06-14 23:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tickets', '0005_auto_20180430_1931'),
]
operations = [
migrations.AddField(
model_name='ticket',
name='cleared_at',
... | IntegratedAlarmSystem-Group/ias-webserver | tickets/migrations/0006_auto_20180614_2303.py | Python | lgpl-3.0 | 626 |
from unittest import TestCase
from safepickle.types.tuple import TupleType
from safepickle.encoding import encode, decode
class TestTuple(TestCase):
def test_tuple(self):
""" Asserts tuple type is handled as expected
"""
obj = (1, 2)
type_ = TupleType()
encoding = type_.e... | nioinnovation/safepickle | safepickle/types/tests/test_tuple.py | Python | apache-2.0 | 416 |
#!/usr/bin/python
"""Perform preprocessing and generate raytrace exec scripts for one focal plane.
For documentation using the python_control for ImSim/PhoSim version <= v.3.0.x,
see README.v3.0.x.txt.
For documentation using the python_control for ImSim/PhoSim version == v.3.2.x,
see README.txt.
The behavior of th... | lsst-sims/sims_phosim_pythoncontrol | fullFocalplane.py | Python | gpl-3.0 | 11,426 |
from syncloudlib.linux import useradd
def test_useradd():
assert True | syncloud/lib | test/test_linux.py | Python | gpl-3.0 | 74 |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | zouzhberk/ambaridemo | demo-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/storm_upgrade.py | Python | apache-2.0 | 6,720 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ctrlaltdel/neutrinator | vendor/openstack/tests/functional/network/v2/test_security_group_rule.py | Python | gpl-3.0 | 2,605 |
import get,set,delete | ArnossArnossi/checkmate | checkmate/management/commands/props/__init__.py | Python | agpl-3.0 | 21 |
# neubot/handler.py
#
# Copyright (c) 2010-2012 Simone Basso <bassosimone@gmail.com>,
# NEXA Center for Internet & Society at Politecnico di Torino
#
# This file is part of Neubot <http://www.neubot.org/>.
#
# Neubot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publi... | neubot/neubot-client | neubot/handler.py | Python | gpl-3.0 | 2,381 |
from pathlib import Path
import pytest
import pylint.extensions.empty_comment as empty_comment
@pytest.fixture(scope="module")
def checker():
return empty_comment.CommentChecker
@pytest.fixture(scope="module")
def enable():
return ["empty-comment"]
@pytest.fixture(scope="module")
def disable():
retu... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/extensions/test_empty_comment.py | Python | mit | 781 |
#!/usr/bin/env python
import roslib
roslib.load_manifest('hri_api')
import math
from geometry_msgs.msg import Point
class GeomMath(object):
@staticmethod
def distance_between(p1, p2):
return math.sqrt(p1.x*p2.x + p1.y*p2.y + p1.z*p2.z)
@staticmethod
def is_infront_of(p1, p2):
if p1.x ... | jdddog/hri | hri_api/src/hri_api/math/geom_math.py | Python | bsd-3-clause | 723 |
# -*- coding: utf-8 -*-
import sys
sys.path.insert(0, 'libs')
import urllib2
from datetime import datetime as dt
import logging
from time import mktime
import bs4
import feedparser
from collections import defaultdict
import models
#from google.appengine.api import urlfetch
#urlfetch.set_default_fetch_deadline(45)
... | kasparg/lawcats | parsers/rss_parse.py | Python | gpl-3.0 | 13,320 |
from typing import Any, List, TypeVar
import numpy as np
import numpy.typing as npt
_SCT = TypeVar("_SCT", bound=np.generic)
def func1(ar: npt.NDArray[_SCT], a: int) -> npt.NDArray[_SCT]:
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
AR_b: npt.NDArray[np.bool_]... | simongibbons/numpy | numpy/typing/tests/data/reveal/twodim_base.py | Python | bsd-3-clause | 3,981 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
import Queue
import xbmcgui
from .get_metadata import GetMetadataThread
from .fill_metadata_queue import FillMetadataQueue
from .process_metadata import ProcessMetadataThread
... | croneter/PlexKodiConnect | resources/lib/library_sync/full_sync.py | Python | gpl-2.0 | 13,934 |
# -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# ... | zeffii/SoundPetal | flow_nodes_index.py | Python | gpl-3.0 | 2,430 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | camradal/ansible | lib/ansible/plugins/callback/skippy.py | Python | gpl-3.0 | 1,317 |
from __future__ import division
import matplotlib
matplotlib.use('Qt4Agg')
from matplotlib import pyplot as plt
plt.style.use('fivethirtyeight')
import numpy as np
from funzo.domains.gridworld import GridWorld, GridWorldMDP
from funzo.domains.gridworld import GRewardLFA, GTransition, GReward
from funzo.planners.dp... | makokal/funzo | examples/gridworld/gridworld_birl.py | Python | mit | 2,673 |
from django.conf.urls import url, include
from modular_blocks import ModuleApp, TemplateTagBlock, modules
from . import urls
class CarpoolingModule(ModuleApp):
app_name = 'cov'
name = 'cov'
urls = url(r'^carpooling/', include(urls))
templatetag_blocks = [
TemplateTagBlock(
name='... | rezometz/django-paiji2-carpooling | paiji2_carpooling/modular.py | Python | agpl-3.0 | 464 |
'''
Created on 15/07/2017
Class Main das Referencias.
Esta e a class que vai nos permitir inserir, editar e vizualizar os dados das tabelas de referencia,
A class abre um Dialog/form com:
TVMain: table view que vai nos permitir vizualizar os dados contidos no model
LEPesquisar: um lineEdit que vai servir de au... | InUrSys/PescArt2.0 | src/Tabelas/frmMainRef.py | Python | gpl-3.0 | 25,640 |
from django.contrib.auth.models import Permission
from django.db import connections
from django.shortcuts import render
from django.db import transaction
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework.decorators import permission_classes, api_view
from rest_fra... | devashishsharma2302/testing-heroku-deployment | squealy/views.py | Python | mit | 11,267 |
import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.s... | younglim/hats-ci | robot_automation/src/logs.py | Python | gpl-3.0 | 3,513 |
# This module contains a class for storing data in an XML tree:
#
# TypedStore: this class combines a XML schema file (XSD-like) with an XML tree in
# which values are stored.
# Value types are obtained from the schema definition. Additionally, the TypedStore
# supports (conditional) hiding of nodes, notificati... | BoldingBruggeman/gotm | gui.py/xmlstore/xmlstore.py | Python | gpl-2.0 | 127,433 |
import os
import re
import string
import mimetypes
from hashlib import sha1, md5
from uuid import uuid4
from io import BytesIO
from urllib import request as urllibr
from http import client as httpclient
from urllib.parse import quote, splitport
from http.cookiejar import CookieJar, Cookie
from http.cookies import Simpl... | quantmind/pulsar | pulsar/utils/httpurl.py | Python | bsd-3-clause | 18,331 |
# Copyright 2008-2009 Dan Collins
#
#
# This 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.
#
# And is distributed in the hope that it... | badbytes/pymeg | mswtools/vistadbscan.py | Python | gpl-3.0 | 1,005 |
#!/usr/bin/env python3
"""
Created on 10 Dec 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
from scs_core.data.str import Str
# --------------------------------------------------------------------------------------------------------------------
value = {"a": 1, "b": 2}
print(Str.collection(va... | south-coast-science/scs_core | tests/data/datum_format_test.py | Python | mit | 541 |
# -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure <ian.eure@gmail.com>
#
| ieure/yar | yar/devices/__init__.py | Python | bsd-3-clause | 87 |
# -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE file
"""
from cdo import Cdo
from pycmbs.data import Data
import tempfile as tempfile
import copy
import glob
import os
import sys
import numpy as np
from pycmbs.benchmarking ... | pygeo/pycmbs | pycmbs/benchmarking/models/mpi_esm.py | Python | mit | 41,720 |
#!/usr/bin/env python
#coding:utf-8
import os
HOME="/Users/wupeijin/code3/django-tornado"
# home_app=os.path.join(HOME,"mysite/mysite/cheungssh/")
dest_asset_dir="/Users/wupeijin/code3/django-tornado/tmp"
download_dir="/Users/wupeijin/code3/django-tornado/download"
upload_dir="/Users/wupeijin/code3/django-tornado/uploa... | jinjin123/devops2.0 | devops/ops/views/ssh_settings.py | Python | mit | 671 |
#!/usr/bin/env python
# Script that generates some fake data for our library
import os, sys
sys.path.append(os.getcwd())
import django; django.setup()
import random
from django.utils import timezone
from stacks.models import Author, Book, LoanedBook
from libraryusers.models import LibraryUser
from faker import Facto... | jacinda/djangocon2015-admin-talk | library/scripts/generate_random_library.py | Python | gpl-2.0 | 2,331 |
"""
Simple diff FIR linear filter LV2 plugin with AudioLazy.
"""
class Metadata:
author = "Danilo de Jesus da Silva Bellini"
author_homepage = "http://github.com/danilobellini"
author_email = "@".join(["danilo.bellini", "gmail.com"])
license = "GPLv3"
name = "Diff"
uri = author_homepage + "/lz2lv2/diff"... | danilobellini/lz2lv2 | diff.py | Python | gpl-3.0 | 465 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.filesystem import Filesystem as GenericFilesystem
class Filesystem(GenericFilesystem):
... | glaudsonml/kurgan-ai | tools/sqlmap/plugins/dbms/access/filesystem.py | Python | apache-2.0 | 746 |
import numpy as np
import pandas as pd
from IPython import embed
from keras.models import load_model
from keras import backend as K
from qlknn.models.ffnn import determine_settings, _prescale, clip_to_bounds
def rmse(y_true, y_pred):
return K.sqrt(K.mean(K.square( y_true-y_pred )))
class KerasNDNN():
def __i... | Karel-van-de-Plassche/QLKNN-develop | qlknn/models/kerasmodel.py | Python | mit | 7,180 |
#!/usr/bin/env python
"""
Created by howie.hu at 2018/5/28.
"""
import asyncio
import os
import sys
import pytest
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from owllook.spiders.heiyan_novel_info import HYNovelInfoItem
HTML = """
<!doctype html>
<!--[if lt IE 7]><html class="no-j... | howie6879/novels-search | tests/test_heiyan_novel_info.py | Python | apache-2.0 | 2,784 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | Axam/nsx-web | nailgun/nailgun/test/integration/test_network_configuration.py | Python | apache-2.0 | 20,114 |
import sys
import os
sys.path.insert(0, os.path.abspath(".."))
import time
from PyQt5 import QtCore, QtGui, QtWidgets, uic
import pyqtgraph
import threading
from multiprocessing import Pipe
import pickle
from automatedbrewery.HeatControl import HeatController
from automatedbrewery.RTDSensor import tempSensors
from au... | Bobstin/AutomatedBrewery | calibrations/PIDCalibration.py | Python | mit | 12,559 |
#!/usr/bin/python
#
# File : runtests.py
# Created : 14-Jul-2011
# By : atrilla
#
# Testing script
#
# Copyright (c) 2011 Alexandre Trilla
#
# This file is part of VSMpy.
#
# You should have received a copy of the rights granted with this
# distribution of VSMpy. See LICENCE.
#
import vsmpy.v... | atrilla/vsmpy | test/runtests.py | Python | mit | 926 |
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (C) 2020 Daniel Standage <daniel.standage@gmail.com>
#
# This file is part of tag (http://github.com/standage/tag) and is licensed
# under the BSD 3-clause license: see LICENSE.
# ------------------------... | standage/tag | tag/cli/pep2nuc.py | Python | bsd-3-clause | 2,702 |
"""
This file contains tasks that are designed to perform background operations on the
running state of a course.
"""
import json
from collections import OrderedDict
from datetime import datetime
from django.conf import settings
from eventtracking import tracker
from itertools import chain
from time import time
import... | edcast-inc/edx-platform-edcast | lms/djangoapps/instructor_task/tasks_helper.py | Python | agpl-3.0 | 64,173 |
#!/usr/bin/python
from lxml import html
import requests
INIT_FIELDS = [ 'endpoint_url', \
'resource_url', \
'xpath' ]
'''
Encapsulates an endpoint to RESTful api service
'''
class Endpoint(object):
def __init__(self, params):
for field in INIT_FIELDS:
if field not in params:
raise EndpointExceptio... | alextbok/deployable-scraper-api | src/endpoint.py | Python | apache-2.0 | 1,013 |
import marketing_campaign_activity | smartforceplus/SmartForceplus | .local/share/Odoo/addons/8.0/entity_sms_campaign/__init__.py | Python | agpl-3.0 | 34 |
from typing import (
Any,
Callable,
ClassVar,
Generic,
List,
Optional,
Sequence,
Tuple,
TypeVar,
)
import typing_extensions
TimedFunction = Callable[..., Any]
class MultiTimerObject(typing_extensions.Protocol):
functions: List[TimedFunction]
def repeat(
self, dom... | Peilonrayz/graphtimer | src/graphtimer/types.py | Python | mit | 1,284 |
import base64
import os
from passlib.context import CryptContext
from pyramid.authentication import (
BasicAuthAuthenticationPolicy as _BasicAuthAuthenticationPolicy,
)
from pyramid.path import (
DottedNameResolver,
caller_package,
)
from contentbase import ROOT
CRYPT_CONTEXT = __name__ + ':crypt_context'
... | kidaa/encoded | src/encoded/authentication.py | Python | mit | 4,355 |
in_python = ''
| snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/test/completion/stub_folder/with_stub_folder/python_only.py | Python | gpl-3.0 | 15 |
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from teachers.models import Teacher, TeacherClass, Entry
from core.utils import CORSResource
class TeacherResource(CORSResource, ModelResource):
class Meta:
queryset = Teacher.objects.all()
resource_... | trawick/edurepo | src/edurepo/teachers/api.py | Python | apache-2.0 | 1,524 |
__doc__ = """CiscoMemoryPool
models memory pools from a Cisco IOS device
"""
from Products.DataCollector.plugins.CollectorPlugin \
import SnmpPlugin, GetTableMap
from Products.DataCollector.plugins.DataMaps \
import MultiArgs, RelationshipMap, ObjectMap
class CiscoMemoryPool(SnmpPlugin):
maptype = 'Mem... | daviswr/ZenPacks.daviswr.Cisco.IOS.Memory | ZenPacks/daviswr/Cisco/IOS/Memory/modeler/plugins/daviswr/snmp/CiscoMemoryPool.py | Python | mit | 3,164 |
##############################################################################
#
# Copyright Zope Foundation 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 SOFTWARE IS ... | johankaito/fufuka | microblog/venv/lib/python2.7/site-packages/kazoo/tests/util.py | Python | apache-2.0 | 3,657 |
"""A generic class to build line-oriented command interpreters.
Interpreters constructed with this class obey the following conventions:
1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
of characters in the identchars member.
3. A ... | remybaranx/qtaste | tools/jython/lib/Lib/cmd.py | Python | gpl-3.0 | 12,108 |
''' Unit tests for utils
'''
import collections
import numpy as np
import nose.tools
import mir_eval
from mir_eval import util
def test_interpolate_intervals():
"""Check that an interval set is interpolated properly, with boundaries
conditions and out-of-range values.
"""
labels = list('abc')
in... | bmcfee/mir_eval | tests/test_util.py | Python | mit | 11,123 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pwn import *
from libformatstr import FormatStr
#from funcy import silent
context(arch='i386',os='linux',timeout=2)
level = 4
host = 'vortex.labs.overthewire.org'
user = 'vortex%i' % level
chal = 'vortex%i' % level
password = args['PASSWORD']
passfil... | sigma-random/pwntools-write-ups | wargames/overthewire-vortex/level4/win.py | Python | mit | 2,851 |
#!/usr/bin/env python
"""
Do the initial installation and configuration of the DIRAC MySQL server
"""
from __future__ import print_function
from DIRAC.Core.Base import Script
Script.disableCS()
Script.setUsageMessage( '\n'.join( ['Stop DIRAC component using runsvctrl utility',
'Usage... | fstagni/DIRAC | FrameworkSystem/scripts/dirac-stop-component.py | Python | gpl-3.0 | 1,302 |
from blogging.tag_lib import parse_content
from blogging.models import BlogContent, BlogParent, BlogContentType
import json
import os
def convert_tags(blog,tag_name,fd):
tag = {}
# tag['name'] = tag_name + '_tag'
tag['name'] = tag_name
content = parse_content(blog,tag)
if len(content) > 0:
... | PirateLearner/pi | PirateLearner/blogging/db_migrate.py | Python | gpl-2.0 | 2,332 |
# 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 | google-cloud-clients/google-cloud-texttospeech/synth.py | Python | apache-2.0 | 1,663 |
# -*- coding: utf-8 -*-
"""Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, 2017, 2018, 2019, 2020 Caleb Bell
<Caleb.Andrew.Bell@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (t... | CalebBell/fluids | fluids/core.py | Python | mit | 78,285 |
def extractNekocchiblogWordpressCom(item):
'''
Parser for 'nekocchiblog.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
(... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNekocchiblogWordpressCom.py | Python | bsd-3-clause | 564 |
# -*- coding: utf-8 -*-
from schedulestorage import Storage
from dbasterisk import DbAsterisk
from scheduling import choosers, Scheduling
import datetime
from yamlns import namespace as ns
class PbxAsterisk(object):
def __init__(self, path, *dbargs, **dbkwd):
self.storage = Storage(path)
self.db ... | Som-Energia/somenergia-phonetimetable | tomatic/pbxasterisk.py | Python | gpl-3.0 | 1,702 |
"""Tests for Codecov API interface."""
from agithub import base as agithub_base
import unittest
from unittest import mock
import env
from apis import codecov
class TestCodecovApi(unittest.TestCase):
def setUp(self):
super(TestCodecovApi, self).setUp()
mock.patch.object(
env, 'get', side_effect={... | ampproject/amp-github-apps | project-metrics/metrics_service/apis/codecov_test.py | Python | apache-2.0 | 1,772 |
"""
This file is part of imdb-data-parser.
imdb-data-parser 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.
imdb-data-parser is dis... | dedeler/imdb-data-parser | idp/utils/loggerinitializer.py | Python | gpl-3.0 | 1,740 |
# -*- coding: utf-8 -*-
# pylint: disable=C0111
# pylint: disable=C0302
import uctypes
from micropython import const
from bluetooth_low_energy.protocols.hci import HCI_MAX_PAYLOAD_SIZE
OCF_HAL_GET_FW_BUILD_NUMBER = const(0x0000)
OCF_HAL_WRITE_CONFIG_DATA = const(0x000C)
OCF_HAL_READ_CONFIG_DATA = const(0x000D)
OCF_HA... | dmazzella/uble | bluetooth_low_energy/protocols/hci/vendor_specifics/st_microelectronics/bluenrg_ms/cmd.py | Python | mit | 39,745 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Urwid unicode character processing tables
# Copyright (C) 2004-2011 Ian Ward
#
# 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; e... | bk2204/urwid | urwid/old_str_util.py | Python | lgpl-2.1 | 10,013 |
from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import *
from nose.plugins.attrib import attr
class TestRegions(cloudstackTestCase):
"""Test Regions - basic region creation
"""
@classmethod
... | remibergsma/cosmic | cosmic-core/test/integration/smoke/test_regions.py | Python | apache-2.0 | 2,270 |
"""Constants for Stream component."""
DOMAIN = 'stream'
ATTR_ENDPOINTS = 'endpoints'
ATTR_STREAMS = 'streams'
ATTR_KEEPALIVE = 'keepalive'
OUTPUT_FORMATS = ['hls']
FORMAT_CONTENT_TYPE = {
'hls': 'application/vnd.apple.mpegurl'
}
AUDIO_SAMPLE_RATE = 44100
| nugget/home-assistant | homeassistant/components/stream/const.py | Python | apache-2.0 | 263 |
# test super with multiple inheritance
class A:
def foo(self):
print('A.foo')
class B:
def foo(self):
print('B.foo')
class C(A, B):
def foo(self):
print('C.foo')
super().foo()
C().foo()
| infinnovation/micropython | tests/basics/class_super_multinherit.py | Python | mit | 234 |
import pytest
from typing import *
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from marshmallow import ValidationError
# == Common use cases ==
@dataclass_json
@dataclass
class C1:
f1: Union[int, str]
@dataclass_json
@dataclass
class C2:
f1: Union[int, Dict[str, float]]
@... | lidatong/dataclasses-json | tests/test_union.py | Python | mit | 3,904 |
# yadt-config-rpm-maker
# Copyright (C) 2011-2013 Immobilien Scout GmbH
#
# 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 l... | yadt/yadt-config-rpm-maker | src/config_rpm_maker/utilities/profiler.py | Python | gpl-3.0 | 4,724 |
from pathlib import Path
import pytest
from unittest.mock import MagicMock, patch
from robot_server.service.protocol import errors
from robot_server.service.protocol.manager import ProtocolManager, UploadFile
from robot_server.service.protocol.protocol import UploadedProtocolMeta, \
UploadedProtocol
@pytest.fix... | Opentrons/labware | robot-server/tests/service/protocol/test_manager.py | Python | apache-2.0 | 4,736 |
"""
Sponge Knowledge Base
Blinking LED
Raspberry Pi: Make sure that your Raspberry Pi is not powered! Then connect Grove LED to GPIO via a 4-pin connector:
- BLACK wire goes on PIN#14 (Ground),
- RED wire goes on PIN#02 (DC Power 5V),
- YELLOW wire goes on PIN#12 (GPIO18/GPIO_GEN1),
- WHITE wire goes on PIN#06 (Ground)... | softelnet/sponge | sponge-rpi-pi4j/examples/rpi-pi4j/pi4j_led_blink.py | Python | apache-2.0 | 830 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2018 CERN.
#
# CERN Analysis Preservation Framework 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... | tiborsimko/analysis-preservation.cern.ch | cap/modules/user/errors.py | Python | gpl-2.0 | 1,215 |
import collections
import contextlib
import copy
import gzip
import json
import logging
import os
import tempfile
import urllib.parse
import uuid
import zipfile
import boto3
import botocore.exceptions
import bs4
import dns.exception
import dns.resolver
import kazoo.client
import pytest
import requests
import retrying
... | movicha/dcos | packages/dcos-integration-test/extra/integration_test.py | Python | apache-2.0 | 79,003 |
import shlex
import time
class Plugin(object):
def __init__(self):
pass
class Debug(Plugin):
def __init__(self):
super(Debug, self).__init__()
self._prefix = shlex.split("gdb --batch --quiet -ex run -ex \"bt\" -ex quit --args")
def on_program_init(self, program, **kwargs):
... | lukacu/ignition | ignition/plugin.py | Python | mit | 1,491 |
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | cpatrick/ITK-RemoteIO | Examples/Registration/ImageRegistration5.py | Python | apache-2.0 | 6,093 |
import os
import unittest
from vsg.rules import iteration_scheme
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_101_test_input.vhd'))
dIndentMap = utils.read_indent_file()
lExpected = []
lExpected.ap... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/iteration_scheme/test_rule_101.py | Python | gpl-3.0 | 1,275 |
from django import forms
from nose.tools import eq_
import test_utils
from . import user, profile
from ..adapters import (KumaAccountAdapter, USERNAME_CHARACTERS,
USERNAME_EMAIL)
from ..forms import UserProfileEditForm
class TestUserProfileEditForm(test_utils.TestCase):
def test_usernam... | mastizada/kuma | kuma/users/tests/test_forms.py | Python | mpl-2.0 | 3,616 |
# Copyright (C) 2013 Project Hatohol
#
# This file is part of Hatohol.
#
# Hatohol 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.
#
# ... | project-hatohol/hatohol-14.12 | client/hatohol/models.py | Python | gpl-2.0 | 3,386 |
""":mod:`wand.font` --- Fonts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.3.0
:class:`Font` is an object which takes the :attr:`~Font.path` of font file,
:attr:`~Font.size`, :attr:`~Font.color`, and whether to use
:attr:`~Font.antialias`\\ ing. If you want to use font by its name rather
than the file path, use... | dahlia/wand | wand/font.py | Python | mit | 4,021 |
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2016-2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, WHET... | pgbidkar/vsphere-automation-sdk-python | samples/vsphere/common/vim/vmdk.py | Python | mit | 2,080 |
from bokeh.plotting import figure, output_file, show
p = figure(width=400, height=400)
p.circle(2, 3, radius=.5, alpha=0.5)
output_file('out.html')
show(p)
| Serulab/Py4Bio | code/ch14/basiccircle.py | Python | mit | 157 |
from .base import StructuredModel
from .crf import CRF
from .grid_crf import GridCRF, DirectionalGridCRF
from .graph_crf import GraphCRF
from .chain_crf import ChainCRF
from .latent_grid_crf import LatentGridCRF, LatentDirectionalGridCRF
from .latent_graph_crf import LatentGraphCRF
from .latent_node_crf import LatentNo... | d-mittal/pystruct | pystruct/models/__init__.py | Python | bsd-2-clause | 822 |
from osgeo import ogr
def addField(shapefile,field):
source = ogr.Open(shapefile, 1)
layer = source.GetLayer()
layer_defn = layer.GetLayerDefn()
new_field = ogr.FieldDefn(field, ogr.OFTInteger)
layer.CreateField(new_field)
source = None
# addField('A_Roads.shp','example') add the 'example' field to A_Roads shapef... | zero-point/hackattack | addField.py | Python | mit | 324 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pymongo
class MongoClient:
""" mongodb client """
def __init__(self, host = "localhost", port = 27017, dbName = "test", debug = False):
self.host = host
self.port = port
self.conn = pymongo.MongoClient(host, port)
se... | huangby/javaweb | pythonfile/util/mongo.py | Python | epl-1.0 | 1,780 |
#!/usr/bin/env python
import os
import numpy as np
import nibabel as nib
import sklearn as skl
import pandas as pd
from sklearn.svm import LinearSVC
from sklearn.decomposition import PCA
import random
from sklearn import datasets, linear_model
from xml.dom import minidom
import lib_IO
training_samples = 278
test_sam... | tobiagru/ML | src/predict.py | Python | gpl-3.0 | 4,147 |
import shutil
from nose.tools import *
from holland.lib.lvm import LogicalVolume
from holland.lib.lvm.snapshot import *
from tests.constants import *
class TestSnapshot(object):
def setup(self):
self.tmpdir = tempfile.mkdtemp()
def teardown(self):
shutil.rmtree(self.tmpdir)
def test_snap... | m00dawg/holland | plugins/holland.lib.lvm/tests/xfs/test_snapshot.py | Python | bsd-3-clause | 1,824 |
import time
class FPS_counter:
def __init__(self, limit=0):
self._time = time.time() # seconds since epoch
self._dt = 0 # seconds
self._min_dt = 1 / limit if limit > 0 else 0
self._limited = False
def _get_dt(self):
return time.time() - self._time
d... | ngcm/interactive-fluid-demo | util/FPS_counter.py | Python | mit | 987 |
# This file is part of 'NTLM Authorization Proxy Server'
# Copyright 2001 Dmitry A. Rozmanov <dima@xenon.spb.ru>
#
# NTLM APS 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 Licens... | nka11/KaraCos-Desktop | py/utils/ntlmaps/logger.py | Python | gpl-3.0 | 1,681 |
#!/usr/bin/python
import sys
def push(stack_list, input):
stack_list.append(input)
def pop(stack_array):
if len(stack_array) == 0:
return 0
else:
value = stack_array.pop()
return value
def peep(stack_array):
value = len(stack_array)
if value == 0:
return 0
else... | RGU5Android/PythonLectureNotes | HomeWork/10-06-14/stack.py | Python | gpl-2.0 | 1,993 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.