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 |
|---|---|---|---|---|---|
# Import the SlideSet base class
import math
from ..slidesets import RemarkSlideSet
##
# A special set of slides for creating cover page and contents
class MergeCoverSet(RemarkSlideSet):
##
# Extract the valid parameters for this object
@staticmethod
def validParams():
params = RemarkSlideSet.validParams(... | jinmm1992/moose | python/PresentationBuilder/slidesets/MergeCoverSet.py | Python | lgpl-2.1 | 1,263 |
from unittest import mock
import uuid
from django.test import TestCase
from django.conf import settings
from foobar import api, enums, models
from foobar.wallet import api as wallet_api
from utils.exceptions import InvalidTransition
from shop.tests.factories import ProductFactory
from wallet.tests.factories import Wall... | uppsaladatavetare/foobar-api | src/foobar/tests/test_api.py | Python | mit | 17,101 |
__all__ = [
'DEFAULT',
# registration decorators
'gcode_dialect',
'word_dialect',
# dialects
'linuxcnc',
'reprap',
]
# Registration decorators
from .mapping import gcode_dialect
from .mapping import word_dialect
# Dialects
from . import linuxcnc
from . import reprap
_DEFAULT = 'linuxc... | fragmuffin/pygcode | src/pygcode/dialects/__init__.py | Python | gpl-3.0 | 968 |
# ----------------------------------------------------------------------------
# Copyright (c) 2005-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/utils/hooks/win32.py | Python | gpl-3.0 | 1,876 |
"""
A left-corner parser.
"""
import pyactr as actr
from ete3 import Tree
environment = actr.Environment(focus_position=(320, 180))
actr.chunktype("parsing_goal",
"task stack_top stack_bottom parsed_word right_frontier")
actr.chunktype("parse_state",
"node_cat mother daughter1 daughter2... | jakdot/pyactr | tutorials/forbook/code/ch4_leftcorner_parser.py | Python | gpl-3.0 | 9,243 |
class Error(Exception):
"""Base exception for this package"""
message = None
def __str__(self):
return str(self.message)
class UplinkBuilderError(Error):
"""Something went wrong while building a service."""
message = "`%s`: %s"
def __init__(self, class_name, definition_name, error)... | prkumar/uplink | uplink/exceptions.py | Python | mit | 652 |
# Copyright 2013-2021 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 PyPyscreeze(PythonPackage):
"""PyScreeze can take screenshots, save them to files, and
... | LLNL/spack | var/spack/repos/builtin/packages/py-pyscreeze/package.py | Python | lgpl-2.1 | 879 |
# This file provides the installation of the python library 'gfdl'
# Suggested installation procedure:
# $ cd $GFDL_BASE/src/extra/python
# $ pip install -e .
# This installs the package in *development mode* i.e. any changes you make to the python files
# or any additional files you add will be immediately... | Alexander-P/Isca | src/extra/python/setup.py | Python | gpl-3.0 | 922 |
# evolve.utils
# Helper functions
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Sat May 03 00:16:21 2014 -0400
#
# Copyright (C) 2014 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: utils.py [] benjamin@bengfort.com $
"""
Helper functions
"""
#####################################... | mclumd/swarm-simulator | evolve/utils.py | Python | mit | 2,768 |
from echidna.util import root_help
import rat
from ROOT import RAT
from ROOT import TChain
import math
import echidna.core.spectra as spectra
def _scint_weights(times, T):
"""**CURRENTLY DISABLED**
This method applies to the scintillator backgrounds.
It produces the list of weights relative to each time ... | EdLeming/echidna | echidna/core/fill_spectrum.py | Python | mit | 10,569 |
#!/usr/bin/env python
import os
import random
import matplotlib
import matplotlib.pyplot as plt
def main():
value = 100
values = [value]
steps = 10000
for i in xrange(steps):
if random.randint(0, 1) == 1:
choose = 1
else:
choose = -1
value += choose
values.append(value)
plt.plo... | tobegit3hub/ml_implementation | others/random_walk/random_walk.py | Python | mit | 400 |
import os, tempfile
from seamless.highlevel import Context, Cell
ctx = Context()
ctx.transform = lambda a,b: a + b
ctx.transform.a = 2
ctx.transform.b = 3
ctx.translate()
ctx.transform.example.a = 0
ctx.transform.example.b = 0
ctx.result = ctx.transform
ctx.result.celltype = "plain"
ctx.compute()
print(ctx.result.valu... | sjdv1982/seamless | tests/highlevel/transformer-compiled-error.py | Python | mit | 1,166 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0034_manual_migrate_file_paths'),
]
operations = [
migrations.RemoveField(
model_name='resourcefile',
name='fed_resource_file_na... | hydroshare/hydroshare | hs_core/migrations/0035_remove_deprecated_fields.py | Python | bsd-3-clause | 475 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/tools/gcs_test/python/gcs_smoke.py | Python | apache-2.0 | 10,353 |
from ciscoconfparse import CiscoConfParse
config_cfg = CiscoConfParse("cisco_ipsec.txt")
cr_map_entries = config_cfg.find_objects_w_child(parentspec=r"^crypto map CRYPTO", childspec=r"pfs group2")
print cr_map_entries
| Paricitoi/python_4_eng | python_week1/week1_ex9.py | Python | gpl-3.0 | 222 |
#!/usr/bin/env python
# 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.
import json
import logging
import os
import re
import shutil
import subprocess
import sys
import tempfile
from proc_maps import Pr... | pozdnyakov/chromium-crosswalk | tools/find_runtime_symbols/prepare_symbol_info.py | Python | bsd-3-clause | 7,786 |
import playlist as pl
class AudioPlaylist(pl.Playlist):
def __init__(self, alias, path, name, type, itemType):
pl.Playlist.__init__(self, alias, path, name, type, itemType, 'music')
| kamisama91/service.skin.smartplaylist.widgets | audioPlaylist.py | Python | gpl-2.0 | 208 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Locaweb.
# 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/license... | vijayendrabvs/hap | neutron/tests/unit/test_iptables_manager.py | Python | apache-2.0 | 28,031 |
#
# Copyright 2014 Infoxchange Australia
#
# 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... | infoxchange/docker-forklift | forklift/services/satellite.py | Python | apache-2.0 | 1,716 |
#!/usr/bin/env python2
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# ... | carlesfernandez/pybombs | mod_pybombs/inventory.py | Python | gpl-3.0 | 3,106 |
from __future__ import division
import os
import math
import cmath
from ejpi import operation
from ejpi import plugin_utils
_NAME = "Trigonometry"
_ICON = "trig.png"
_MAP = {
"name": _NAME,
"keys": {
(0, 0): {
"CENTER": {"action": "7", "type": "text", "text": "7", },
"SOUTH": {"action": "[sinh]", "type": ... | epage/ejpi | ejpi/plugins/trig.py | Python | lgpl-2.1 | 5,907 |
#!/usr/bin/env python
"""
Show how to make date plots in matplotlib using date tick locators and
formatters. See major_minor_demo1.py for more information on
controlling major and minor ticks
All matplotlib date plotting is done by converting date instances into
days since the 0001-01-01 UTC. The conversion, tick lo... | ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/mpl_examples/api/date_demo.py | Python | gpl-2.0 | 1,735 |
"""
Helper methods for `philu_overrides` app
"""
import json
from datetime import datetime
import pytz
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from common.lib.mandrill_client.client import MandrillClient
from lms.djangoapps.courseware.courses import get_course_by_id
fro... | philanthropy-u/edx-platform | lms/djangoapps/philu_overrides/helpers.py | Python | agpl-3.0 | 12,087 |
#!/usr/bin/env python3
import argparse
import io
import zipfile
from collections import defaultdict
from datetime import date
oboInOwl = {
"SynonymTypeProperty": "synonym_type_property",
"hasAlternativeId": "has_alternative_id",
"hasBroadSynonym": "has_broad_synonym",
"hasDbXref": "database_cross_ref... | obophenotype/ncbitaxon | src/ncbitaxon.py | Python | bsd-3-clause | 12,475 |
import tensorflow as tf
from networks.network import Network
from fcn.config import cfg
zero_out_module = tf.load_op_library('lib/triplet_flow_loss/triplet_flow_loss.so')
class custom_network(Network):
def __init__(self):
self.inputs = cfg.INPUT
# self.input_format = input_format
self.num... | daweim0/Just-some-image-features | lib/networks/net_labeled_concat_features_shallower.py | Python | mit | 12,807 |
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
import datetime
import operator
import urllib
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.db.models import Q
from django.db.models.signals import post_save
from django.dispa... | tnemis/staging-server | emis_account/models.py | Python | mit | 15,738 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CMSRedirect'
db.create_table('cms_redirects_cmsredirect', (
('id', self.gf('dj... | aptivate/djangocms-redirects | cms_redirects/migrations/0001_initial.py | Python | bsd-3-clause | 5,967 |
from __future__ import unicode_literals
import six
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from chamber.models import SmartModel
from chamber.utils import remove_accent
from ats_sms_operator.config import ATS_... | druids/django-ats-sms-operator | ats_sms_operator/models.py | Python | lgpl-3.0 | 5,291 |
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. 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 ob... | nexusriot/cinder | cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_7mode.py | Python | apache-2.0 | 20,108 |
from server import database
from server.constants import TargetType
from server.exceptions import ClientError, ArgumentError
from . import mod_only
__all__ = [
'ooc_cmd_disemvowel',
'ooc_cmd_undisemvowel',
'ooc_cmd_shake',
'ooc_cmd_unshake'
]
@mod_only()
def ooc_cmd_disemvowel(client, arg):
"""
... | Attorney-Online-Engineering-Task-Force/tsuserver3 | server/commands/fun.py | Python | agpl-3.0 | 3,101 |
#!/usr/bin/env python3
from multiprocessing import Process
import socket
import struct
MCAST_GRP = '239.255.255.250'
MCAST_PORT = 1900
HOST_IP = socket.gethostbyname(socket.getfqdn())
HOST_PORT = 52235
msearch_string = 'urn:dial-multiscreen-org:service:dial:1'
msearch_response = """HTTP/1.1 200 OK
LOCATION: http://{ip... | davidpuzey/dial-youtube | dial.py | Python | gpl-2.0 | 1,758 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
translate.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | m-kuhn/QGIS | python/plugins/processing/algs/gdal/translate.py | Python | gpl-2.0 | 6,812 |
"""distutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution)."""
import os
import sys
from types import *
from glob import glob
from warnings import warn
from distutils.core import Command
from distutils import dir_util, dep_util, file_util, archive_util
from distutils.text_file... | yotchang4s/cafebabepy | src/main/python/distutils/command/sdist.py | Python | bsd-3-clause | 17,826 |
from django.conf.urls import url
from provider import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^new/$', views.new, name='new'),
url(r'^(?P<provider_id>\d+)/$', views.view, name='view'),
url(r'^(?P<provider_id>\d+)/edit/$', views.edit, name='edit'),
url(r'^(?P<provider_id>... | zyphrus/fetch-django | provider/urls.py | Python | mit | 537 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
from pant... | square/pants | src/python/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py | Python | apache-2.0 | 3,486 |
"""
Illustrates "point label" functionality.
"""
import matplotlib.pyplot as plt
from mpldatacursor import datacursor
labels = ['a', 'b', 'c', 'd', 'e', 'f']
x = [0, 0.05, 1, 2, 3, 4]
# All points on this figure will point labels.
fig, ax = plt.subplots()
ax.plot(x, x, 'ro')
ax.margins(0.1)
datacursor(axes=ax, point_... | joferkington/mpldatacursor | examples/labeled_points_example.py | Python | mit | 559 |
from haystack import indexes
from common.models import Person, CustomPage, NewsArticle, Job
class PersonIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
first_name = indexes.CharField(model_attr='first_name')
last_name = indexes.CharField(model_attr... | baylee-d/cos.io | common/search_indexes.py | Python | apache-2.0 | 1,112 |
from tfs import *
from pylab import *
from numpy import *
import glob, os
import nibabel as nib
matplotlib.interactive(True)
session = tf.InteractiveSession()
dataPath = './corpusCallosum/'
# Class to serve up segmented images
def computePad(dims,depth):
y1=y2=x1=x2=0;
y,x = [numpy.ceil(dims[i]/float(2**depth))... | robb-brown/IntroToDeepLearning | 6_MRISegmentation/ccseg.py | Python | mit | 4,404 |
# -*-coding: utf-8 -*-
from zope.interface import implementer
from ..interfaces import (
IResourceType,
)
from ..resources import (
ResourceTypeBase,
)
@implementer(IResourceType)
class PersonsCategoriesResource(ResourceTypeBase):
__name__ = 'persons_categories'
@property
def allowed_assign(sel... | mazvv/travelcrm | travelcrm/resources/persons_categories.py | Python | gpl-3.0 | 344 |
from nestedg.data import unknown
from nestedg.model import Model
from .body import Body, Blood
from .clothing import ClothingSet
class Person(Model):
@classmethod
def children_classes(cls):
yield Body
yield unknown.Psyche
yield ClothingSet
@classmethod
def _generate_name(cls):... | d2emon/generator-pack | src/factories/nestedg/data/people/__init__.py | Python | gpl-3.0 | 1,510 |
"""Z-Wave Constants."""
ATTR_NODE_ID = "node_id"
ATTR_VALUE_ID = "value_id"
ATTR_OBJECT_ID = "object_id"
ATTR_NAME = "name"
ATTR_SCENE_ID = "scene_id"
ATTR_BASIC_LEVEL = "basic_level"
NETWORK_READY_WAIT_SECS = 30
SERVICE_ADD_NODE = "add_node"
SERVICE_ADD_NODE_SECURE = "add_node_secure"
SERVICE_REMOVE_NODE = "remove_n... | leoc/home-assistant | homeassistant/components/zwave/const.py | Python | mit | 9,260 |
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | JioCloud/neutron | neutron/tests/functional/agent/linux/test_ovsdb_monitor.py | Python | apache-2.0 | 4,453 |
from swampy.TurtleWorld import *
import math
#def polygon( t, length, n ):
#max_cir_angle = 360
#angle = max_cir_angle / n
#for i in range( n ):
#fd( t, length )
#lt( t, angle )
def polyline ( t, length, n, angle ):
"""
Draws n line segments with the given length and
angle betw... | hacpai/reading-lists | Think Python/mypolygon.py | Python | bsd-2-clause | 1,219 |
from ml import pipeline
if __name__ == '__main__':
pipeline.init(pipeline, 'housing', "general")
pipeline.Run()
result = pipeline.Output('data_featureselection->2', to_json=True)
print(result)
#Y = pipeline.Predict('dog.jpg', True)
#print(Y)
| deepakkumar1984/sia-cog | test/testpipeline.py | Python | mit | 272 |
# -*By- coding: utf-8 -*-
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.contrib.auth.models import User
from time import time
from django.utils import timezone
from django.utils.safestring import mark_safe
def upload_file_name(instance, filenam... | danasp/Ticketraker_light | ticketracker_light/models.py | Python | gpl-2.0 | 4,135 |
import dredd_hooks as hooks
import imp
import os
import json
import uuid
import pprint
#if you want to import another module for use in this workflow
utils = imp.load_source("utils",os.path.join(os.getcwd(),'utils.py'))
###############################################################################
###################... | benneely/duke-data-service-dredd | dredd/dredd_scripts/15_provenance_activities.py | Python | gpl-3.0 | 1,964 |
import argparse
import cPickle
import theano.tensor as T
from theano.sandbox.cuda.var import CudaNdarraySharedVariable
import numpy as np
import copy
import theano
from pynet.model import AutoEncoder
import pynet.layer as layers
floatX = theano.config.floatX
parser = argparse.ArgumentParser(description='''Convert gp... | hycis/Pynet | scripts/gpu_ae_to_cpu_ae.py | Python | apache-2.0 | 2,055 |
import re
import logging
import csv
import os
from StringIO import StringIO
from projects.exceptions import ProjectImportError
from vcs_support.backends.github import GithubContributionBackend
from vcs_support.base import BaseVCS, VCSVersion
log = logging.getLogger(__name__)
class Backend(BaseVCS):
supports_tag... | dirn/readthedocs.org | readthedocs/vcs_support/backends/git.py | Python | mit | 6,947 |
#!/usr/bin/python
#Indiegogo & Kickstarter Tracker with Unicorn Hat
#Put your IGG url below
iggURL = "https://www.indiegogo.com/projects/ryanteck-budget-robotics-kit-for-raspberry-pi/x/6492676"
#Or put your KS URL below
ksURL = "https://www.kickstarter.com/projects/pimoroni/flotilla-for-raspberry-pi-making-for-everyon... | ryanteck/UnicornTracker | unicornTracker.py | Python | gpl-3.0 | 4,094 |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | harterj/moose | modules/porous_flow/doc/content/modules/porous_flow/tests/heat_advection/heat_advection.py | Python | lgpl-2.1 | 2,227 |
import json
import requests
from django.utils import timezone
from pytz import timezone as tz
from apps.contribution.models import Repository, RepositoryLanguage
from apps.mommy import schedule
from apps.mommy.registry import Task
git_domain = "https://api.github.com"
class UpdateRepositories(Task):
@staticme... | dotKom/onlineweb4 | apps/contribution/mommy.py | Python | mit | 4,206 |
# -*- coding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2016 Rooms For (Hong Kong) Limited T/A OSCG
# <https://www.odoo-asia.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publishe... | rfhk/ykt-training | stock_project_search_old/__openerp__.py | Python | agpl-3.0 | 1,380 |
# -*- coding: utf-8 -*-
from . import res_partner
| incaser/incaser-odoo-addons | partner_vat_split/models/__init__.py | Python | agpl-3.0 | 50 |
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from unittest import TestCase
from sklearn.datasets.samples_generator import make_spd_matrix
from sklearn import hmm
from sklearn import mixture
from sklearn.utils.extmath import logsumexp
from sklearn.utils import check_random... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sklearn/tests/test_hmm.py | Python | agpl-3.0 | 26,383 |
# -*- encoding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext as _
from students.tipos import *
from finance.models import CustomUser, Cuota, UnicoPago, Pago, ServicioSuscripto, Persona
from efinance.models import Empleado
from django.core.urlresolvers import reverse
from datet... | mfalcon/edujango | students/models.py | Python | apache-2.0 | 5,144 |
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import assert_raises, assert_equals, assert_almost_equals
from ....models.classes import MatrixPreferenceDataModel, \
MatrixBooleanPrefDataModel
from ..item_strategies import ItemsNeighborhoodStrategy, AllPossibleItemsStrategy
from ..... | imouren/crab | scikits/crab/recommenders/knn/tests/test_classes.py | Python | bsd-3-clause | 26,670 |
# -*- coding: utf-8 -*-
""" Sahana Eden Disaster Victim Registration Model
@copyright: 2012-15 (c) Sahana Software Foundation
@license: MIT
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... | anurag-ks/eden | modules/s3db/dvr.py | Python | mit | 12,049 |
# Generated by Django 2.2.24 on 2021-06-29 13:16
from django.db import migrations
from django.db.models import Min
from corehq.util.django_migrations import skip_on_fresh_install
def _reset_date_modified(model_name):
@skip_on_fresh_install
def _reset_date(apps, schema_editor):
model = apps.get_model... | dimagi/commcare-hq | corehq/apps/sms/migrations/0051_reset_modified_on.py | Python | bsd-3-clause | 873 |
from __future__ import absolute_import, unicode_literals
import unittest
from mopidy.mpd.exceptions import (
MpdAckError, MpdNoCommand, MpdNotImplemented, MpdPermissionError,
MpdSystemError, MpdUnknownCommand)
class MpdExceptionsTest(unittest.TestCase):
def test_key_error_wrapped_in_mpd_ack_error(self):... | priestd09/mopidy | tests/mpd/test_exceptions.py | Python | apache-2.0 | 2,135 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
import sys
import glob
import re
# read version.py file to get version and metadata information
here = os.path.abspath(os.path.dirname(__file__))
version_py = os.path.join(here, "src/t80sched/core/version.py")
execfile(v... | tribeiro/chimera-t80sched | setup.py | Python | gpl-2.0 | 1,104 |
#!/usr/bin/env python3
# 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 "Lic... | sekikn/bigtop | bigtop-packages/src/charm/hadoop/layer-hadoop-resourcemanager/tests/01-basic-deployment.py | Python | apache-2.0 | 1,381 |
#!/usr/bin/env python
#
# $Id: put.py,v 1.2 2005-01-27 04:24:40 jsommers Exp $
#
import httplib, socket, sys, getopt
def usage(proggie):
print "usage: ", proggie, "[-h <host> -i <infile> -o <targetfile>]"
sys.exit(0)
try:
opts,args = getopt.getopt(sys.argv[1:], "h:i:o:", [])
except getopt.GetoptError,e:... | jsommers/harpoon | cli/put.py | Python | gpl-2.0 | 1,126 |
#!/usr/bin/env python
#
# Original code from - https://github.com/Clete2/NessusReport, modded by Lee Baird
# John Kim - additional modification completed to support UTF-8, support cli help, renaming output files
# Thanks to Securicon, LLC. for sponsoring development
import csv
import datetime
import re
import sys
impo... | EricSB/discover | parsers/parse-nessus.py | Python | mit | 6,845 |
from algorithms.structures.disjoint_set import DisjointSet
def test_disjoint_set():
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
ds = DisjointSet(a)
assert ds.find_set(1) != ds.find_set(2)
ds.union(1, 2)
assert ds.find_set(1) == ds.find_set(2)
assert ds.find_set(1) != ds.find_set(3)
ds.union(2, 3)
... | vadimadr/python-algorithms | tests/test_disjoint_set.py | Python | mit | 407 |
from django.contrib import messages
from django.contrib.auth.models import User
from django.contrib.messages.views import SuccessMessageMixin
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import HttpR... | revaxl/library | staff/views.py | Python | mit | 7,621 |
"""Wrappers for forwarding stdout/stderr over zmq"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import threading
import time
import uuid
from io import StringIO, UnsupportedOperation
import zmq
from zmq.eventloop.ioloop import IOLoop
from .session ... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/IPython/kernel/zmq/iostream.py | Python | bsd-3-clause | 8,129 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | alberts/check_mk | web/htdocs/bi.py | Python | gpl-2.0 | 76,013 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module is part of the Clemson ACM Auto Grader
Copyright (c) 2016, Robert Underwood
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistribut... | robertu94/autograder | autograder/source/update.py | Python | bsd-2-clause | 4,236 |
from Screens.Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Components.FileList import FileList
from Components.Sources.StaticText import StaticText
from Components.MediaPlayer import PlayList
from Components.config import config, getConfigListEntry, ConfigSubsection, configfile, ConfigText, Conf... | noox-/stbgui-1 | lib/python/Plugins/Extensions/MediaPlayer/settings.py | Python | gpl-2.0 | 4,818 |
#!/usr/bin/python3
from mobileapi import app
import os
# By placing our config in ENV variables we can adjust them
# in production with differnet values
# This sets defaults that are good for development
APP_PORT = 5017 # We are using 5017 for the Mobile API
APP_DEBUG = True
# Now let's see if production wants ove... | roguefalcon/rpi_docker_images | hackmt_2018_code/mobileapi/run.py | Python | gpl-3.0 | 563 |
import relayManager
import dronekit
class ShotManager():
def __init__(self):
# see the shotlist in app/shots/shots.p
print "init"
def Start(self, vehicle):
self.vehicle = vehicle
# Initialize relayManager
self.relayManager = relayManager.RelayManager(self)
target = '... | mapossum/SeymourSolo | tester.py | Python | gpl-3.0 | 495 |
"""
sphinx.search.tr
~~~~~~~~~~~~~~~~
Turkish search language: includes the JS Turkish stemmer.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from typing import Dict, Set
import snowballstemmer
from sphinx.search import SearchLangua... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/sphinx/search/tr.py | Python | apache-2.0 | 678 |
from mpd import MPDClient
from select import select
import time, re
import argparse
class MPDBookmark(object):
def __init__(self, host="localhost", port=6600, password=None,
motif="Podcast", field="album"):
self.client = MPDClient()
try:
self.client.connect(host, port)... | RaoulChartreuse/mpd_bookmark | mpd_bookmark.py | Python | gpl-2.0 | 4,058 |
print "Hello world!"
print "master"
print "test"
| dys152/jdtest | jd.py | Python | apache-2.0 | 49 |
# -*- coding: utf-8 -*-
"""QGIS Unit test utils for provider tests.
.. 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.
"... | SebDieBln/QGIS | tests/src/python/providertestbase.py | Python | gpl-2.0 | 22,341 |
import random
import threading
import time
import unittest
from traits.api import Enum, HasStrictTraits
from traits.util.async_trait_wait import wait_for_condition
class TrafficLights(HasStrictTraits):
colour = Enum('Green', 'Amber', 'Red', 'RedAndAmber')
_next_colour = {
'Green': 'Amber',
... | burnpanck/traits | traits/util/tests/test_async_trait_wait.py | Python | bsd-3-clause | 2,297 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from docopt import docopt
from models import ChecklistTemplate, Checklist, User
from app import app
__doc__ = """utils.py
Usage:
utils.py delete (checklist | template) <owner> <slug>
utils.py admin <username> (grant | revoke)
utils.py createuser <username>
"... | ojii/checklists.ojii.ch | utils.py | Python | bsd-3-clause | 1,159 |
#!/usr/bin/env python
# Copyright 2014 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | dhootha/ActionLauncherApi | api/javadoc-scripts/tweak_javadoc_html.py | Python | apache-2.0 | 2,517 |
"""Sigmoid
"""
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
X = tf.placeholder(tf.float32)
with tf.name_scope('Sigmoid'):
fx = tf.sigmoid(X)
tf.summary.scalar("f(x)", tf.squeeze(fx))
init = tf.global_variables_initializer()
with tf.Session() as sess:
# Output graph
me... | KarateJB/Python.Practice | src/TensorFlow/venv/Lab/Tutorials/Activation/Sigmoid.py | Python | mit | 1,078 |
# 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... | Juniper/nova | nova/api/openstack/compute/server_diagnostics.py | Python | apache-2.0 | 3,069 |
"""
@author: Fabrice Douchant
@contact: vamp.higher@gmail.com
@license: GNU GPLv3 (LICENSE.txt)
mylogging is a module that provides standard logging configuration.
It will log into console (stdout, stderr), file (rotating), smtp for exception.
You should use it once in your program like this:
from myPyApps import my... | fdouchant/myPyApps | myPyApps/mylogging.py | Python | gpl-3.0 | 5,351 |
"""
Django settings for becours project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | eedf/becours | becours/settings.py | Python | mit | 3,562 |
import os
zeeman_data_root = '../../zeeman_data'
csv_files = [os.path.join(zeeman_data_root, i)
for i in os.listdir(zeeman_data_root) if i.endswith('.csv')]
csv_data = {}
for name in csv_files:
with open(name) as f:
data = list(zip(*[[float(i) for i in line.strip().split(',')]
... | JonNRb/physics506 | src/zeeman/data.py | Python | mit | 1,228 |
# coding=utf-8
# Copyright 2013 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/li... | ruyang/ironic | ironic/tests/unit/conductor/test_task_manager.py | Python | apache-2.0 | 49,512 |
# -*- coding: utf-8 -*-
"""
Allele frequency calculations.
See also the examples at:
- http://nbviewer.ipython.org/github/alimanfoo/anhima/blob/master/examples/af.ipynb
""" # noqa
from __future__ import division, print_function, absolute_import
# third party dependencies
import numpy as np
# internal dependen... | alimanfoo/anhima | anhima/af.py | Python | mit | 23,513 |
from sites import Site
# import urllib
import requests
import datetime
from bs4 import BeautifulSoup
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
FROM_ADDR = "rbl-check@umbc.edu"
class SiteList(object):
def __init__(self, list_url):
self.list_url = list_url
... | jeefberkey/rblcheck | list_gatherer.py | Python | apache-2.0 | 4,954 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the update tool."""
from __future__ import unicode_literals
import os
import sys
import unittest
from tools import update
from tests import test_lib
@unittest.skipIf(
os.environ.get('TRAVIS_OS_NAME') == 'osx',
'TLS 1.2 not supported by macOS on Tr... | rgayon/l2tdevtools | tests/update.py | Python | apache-2.0 | 2,954 |
# -*- coding: utf-8 -*-
# Copyright (c) 2003 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to enter the data for a switch operation.
"""
from __future__ import unicode_literals
from PyQt5.QtWidgets import QDialog
from .Ui_SvnSwitchDialog import Ui_SvnSwitchDialog
class Svn... | davy39/eric | Plugins/VcsPlugins/vcsSubversion/SvnSwitchDialog.py | Python | gpl-3.0 | 1,777 |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^$', views.post_list),
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail),
url(r'^post/new/$', views.post_new, name='post_new'),
url(r'^post/(?P<pk>[0-9]+)/edit/$', views.post_edit, name='post_edit'),
url(r'^drafts/$', views.post_d... | pyladiespoa/site | blog/urls.py | Python | gpl-2.0 | 512 |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Chilledheart/chromium | tools/telemetry/third_party/gsutilz/third_party/oauth2client/tests/test_crypt.py | Python | bsd-3-clause | 2,865 |
#!/usr/bin/python
import os
import requests
import json
import subprocess
import time
def userInput(config):
def defaultValue(config, key):
return config[key] if key in config else ""
res = {}
invalid = {}
res['user_name'] = raw_input("your GitHub username (default = " + defaultValue(config, 'user_name') + "): ... | kau-masa/Komi_SmartAlarmClock | local_demo.py | Python | bsd-3-clause | 3,511 |
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | intel-analytics/BigDL | python/friesian/example/wnd/train/convert_train.py | Python | apache-2.0 | 1,560 |
"""
Shared methods for Index subclasses backed by ExtensionArray.
"""
from __future__ import annotations
from typing import (
Hashable,
TypeVar,
)
import numpy as np
from pandas._typing import ArrayLike
from pandas.compat.numpy import function as nv
from pandas.util._decorators import (
cache_readonly,
... | gfyoung/pandas | pandas/core/indexes/extension.py | Python | bsd-3-clause | 14,958 |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
from pyxb.exceptions_ import *
import unittest
import pyxb.binding.datatypes as xsd
class _TestIntegerType (object):
"""Base class for testing any datatype that descends from integer.
... | CantemoInternal/pyxb | tests/datatypes/test-IntegerTypes.py | Python | apache-2.0 | 4,944 |
import unittest
import time
from datetime import datetime
from app import create_app, db
from app.models import User, AnonymousUser, Role, Permission, Follow
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
... | caser789/xuejiao-blog | tests/test_user_model.py | Python | mit | 6,887 |
# Authors:
# Thierry Bordaz <tbordaz@redhat.com>
#
# Copyright (C) 2014 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | apophys/freeipa | ipaserver/plugins/baseuser.py | Python | gpl-3.0 | 33,160 |
#!/usr/bin/env python
"""Certificate Transparency log client."""
| raffaelespazzoli/origin | vendor/github.com/google/certificate-transparency/python/ct/__init__.py | Python | apache-2.0 | 66 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-01 00:39
from __future__ import unicode_literals
from django.db import migrations
import versatileimagefield.fields
class Migration(migrations.Migration):
dependencies = [
('products', '0016_auto_20160601_0035'),
]
operations = [
... | libretees/libreshop | libreshop/products/migrations/0017_auto_20160601_0039.py | Python | gpl-3.0 | 567 |
import json
import os
import psycopg2 as dbapi2
import re
from flask import Flask, request, render_template, redirect
from flask.helpers import url_for
app = Flask(__name__)
class activities:
def saveevent(config):
event_name = None
event_location = None
event_date = None
event_ca... | itucsdb1601/itucsdb1601 | events.py | Python | gpl-3.0 | 3,125 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | luogangyi/bcec-nova | nova/openstack/common/db/sqlalchemy/session.py | Python | apache-2.0 | 34,679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.