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 |
|---|---|---|---|---|---|
# Copyright 2015-present The Scikit Flow 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 require... | hpssjellis/forth-tensorflow | skflow-examples/z16-mnist.py | Python | mit | 3,192 |
# -*- coding: utf-8 -*-
"""
Sound Pressure Level Plugin
Copyright (C) 2018 Olaf Lüke <olaf@tinkerforge.com>
__init__.py: package initialization
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... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/sound_pressure_level/__init__.py | Python | gpl-2.0 | 965 |
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar
# Copyright 2017 MATMOZ d.o.o.
# - Matjaž Mozetič
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import purchase
| sysadminmatmoz/pmis | purchase_stock_analytic/models/__init__.py | Python | agpl-3.0 | 265 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016, 2017 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... | PaulinaLach/invenio-accounts-rest | tests/conftest.py | Python | gpl-2.0 | 12,127 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | sidzan/netforce | netforce_support/netforce_support/models/report_issue.py | Python | mit | 2,805 |
from __future__ import unicode_literals
def device_from_request(request):
"""
Determine's the device name from the request by first looking for an
overridding cookie, and if not found then matching the user agent.
Used at both the template level for choosing the template to load and
also at the ca... | webounty/mezzanine | mezzanine/utils/device.py | Python | bsd-2-clause | 2,035 |
# 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 u... | dmlc/tvm | apps/topi_recipe/gemm/gemm_int8.py | Python | apache-2.0 | 5,879 |
class Background(object):
def __init__(self, resources):
self.resources = resources
self.type = 'solid'
self.color = (255, 255, 255)
self.image = None
self.image_name = ''
def set_solid(self, color):
self.type = 'solid'
if color != self.color:
... | ProgrammaBol/wiggler | wiggler/engine/background.py | Python | gpl-3.0 | 808 |
# -*- coding: utf-8 -*-
from sdl2 import SDL_Delay,\
SDL_GetTicks,\
SDL_KEYDOWN,\
SDL_KEYUP,\
SDL_QUIT,\
SDL_Rect,\
SDL_RenderCopy,\
SDLK_ESCAPE,\
SDLK_UP,\
SDLK_DOWN,\
SDLK_RETURN,\
SDL_Quit
from sdl2.ext import Resources,\
get_events
from const import WindowSize, Col... | ep0s/soulmaster | menu.py | Python | gpl-3.0 | 4,205 |
import glob
import os
import openmc
import pytest
from tests.testing_harness import PyAPITestHarness
from tests.regression_tests import config
@pytest.fixture
def model():
# Materials
mat = openmc.Material()
mat.set_density('g/cm3', 4.5)
mat.add_nuclide('U235', 1.0)
materials = openmc.Materials... | liangjg/openmc | tests/regression_tests/trigger_statepoint_restart/test.py | Python | mit | 4,835 |
#!/usr/bin/env python2
import argparse
import difflib
import os
import subprocess
import sys
import urllib2
def main():
parser = argparse.ArgumentParser(
description='Reformats C++ source files that have changed from a given '
'git ref.')
parser.add_argument('--url',
default='https:/... | clementine-player/Clementine | dist/format.py | Python | gpl-3.0 | 2,569 |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... | rriggio/empower-runtime | empower/managers/timeseriesmanager/timeseriesmanager.py | Python | apache-2.0 | 4,835 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import inspect
import itertools
import random
import warnings
import numpy as np
from .gd import GradientDescent
from .bfgs import Lbfgs
from .cg import NonlinearConjugateGradient
from .rprop import Rprop
from .rmsprop import RmsProp
from .adadelta impo... | superbobry/climin | climin/util.py | Python | bsd-3-clause | 11,296 |
# Copyright 2013 Canonical Ltd.
# 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... | Thingee/cinder | cinder/tests/test_create_volume_flow.py | Python | apache-2.0 | 3,535 |
# encoding: utf-8
"""
Module to set up run time parameters for Clawpack.
The values set in the function setrun are then written out to data files
that will be read in by the Fortran code.
"""
from __future__ import absolute_import
from __future__ import print_function
import clawpack.geoclaw.topotools as topo
impor... | mandli/surge-examples | irene/setrun.py | Python | mit | 16,326 |
from muntjac.api import Application, Button, GridLayout, Label, Window
from muntjac.ui.button import IClickListener
class Calc(Application, IClickListener):
"""A simple calculator using Muntjac."""
def __init__(self):
super(Calc, self).__init__()
# All variables are automatically stored in... | rwl/muntjac | muntjac/demo/Calc.py | Python | apache-2.0 | 3,259 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Invoke tasks. To run a task, run ``$ invoke <COMMAND>``. To see a list of
commands, run ``$ invoke --list``.
"""
import os
import sys
import code
import json
import platform
import subprocess
import logging
from time import sleep
import invoke
from invoke import Collect... | DanielSBrown/osf.io | tasks/__init__.py | Python | apache-2.0 | 30,673 |
# Copyright 2016 gRPC 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 writing... | endlessm/chromium-browser | third_party/grpc/src/test/distrib/python/distribtest.py | Python | bsd-3-clause | 781 |
"""Simple sample showing basic usage pattern"""
import time
from dispatch import Signal
request_started = Signal(providing_args=["remote_addr"])
request_ended = Signal(providing_args=["time_start", "time_end"])
class Request(object):
def __init__(self, remote_addr):
self.remote_addr = remote_addr
... | ask/dispatch | examples/simple_sample.py | Python | bsd-3-clause | 904 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | mnick/qutebrowser | scripts/hostblock_blame.py | Python | gpl-3.0 | 2,337 |
"""
Copyright 2007 Free Software Foundation, Inc.
This file is part of GNU Radio
SPDX-License-Identifier: GPL-2.0-or-later
"""
from __future__ import absolute_import
from . import Actions
from .Constants import STATE_CACHE_SIZE
class StateCache(object):
"""
The state cache is an interface to a list to reco... | skoslowski/gnuradio | grc/gui/StateCache.py | Python | gpl-3.0 | 3,077 |
"""
From http://flask.pocoo.org/snippets/35/
"""
class ReverseProxied:
"""Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
different than what is used locally.
In nginx... | tiggerntatie/brython-server | brythonserver/reverseproxied.py | Python | mit | 1,213 |
from __future__ import print_function
import sys
import argparse
from argparse import RawTextHelpFormatter
from bashlex import parser, ast
class nodevisitor(ast.nodevisitor):
def __init__(self, positions):
self.positions = positions
def visitcommandsubstitution(self, n, command):
# log the ... | idank/bashlex | examples/commandsubstitution-remover.py | Python | gpl-3.0 | 2,193 |
#!/usr/bin/env python
############################################################################
##
## Copyright (C) 2004-2005 Trolltech AS. All rights reserved.
##
## This file is part of the example classes of the Qt Toolkit.
##
## This file may be used under the terms of the GNU General Public
## License version ... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/PySide/examples/sql/querymodel.py | Python | epl-1.0 | 4,176 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | Petr-Kovalev/nupic-win32 | py/nupic/research/TP.py | Python | gpl-3.0 | 132,913 |
__author__ = 'LT'
import numpy as np
import cvxopt.solvers
import kernel
from time import gmtime, strftime
from sklearn.metrics.pairwise import pairwise_kernels
from numpy import vstack, hstack, ones, zeros, absolute, where, divide, inf, \
delete, outer, transpose, diag, tile, arange, concatenate, empty, unique, ro... | feuerchop/increOCSVM | ocsvm.py | Python | gpl-2.0 | 80,081 |
#!/usr/bin/env python
# coding: utf-8
from __future__ import with_statement, print_function, absolute_import, division
""" Data analysis Tango device server ... for UPBL09a
"""
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Faci... | kif/UPBL09a | dahu/server.py | Python | gpl-2.0 | 11,107 |
from abc import abstractmethod, abstractproperty
from parso._compatibility import utf8_repr, encoding, py_version
from parso.utils import split_lines
def search_ancestor(node, *node_types):
"""
Recursively looks at the parents of a node and returns the first found node
that matches node_types. Returns ``... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/parso/tree.py | Python | mit | 11,302 |
# Manually imported from:
# https://github.com/Rapptz/RoboDanny/blob/master/cogs/stars.py
# DATE IMPORTED: 2017-04-14
# DATE LAST MODIFIED: 2017-05-06
# Global variables:
messageReaction = "ren" #The emoji name you want to use for initiating stars.
messageReactionCode = "<:ren:303022146513403907>" #The emoji co... | sedruk/Red-DiscordBot | cogs/stars.py | Python | gpl-3.0 | 31,755 |
# Copyright 2013-2014 MongoDB, 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 agreed to in writin... | TPopovich/mongo-connector | tests/test_util.py | Python | apache-2.0 | 1,776 |
import json
import os
import sys
def print_usage():
print """./type_from_schema <json_schema> [ARGS]
Options
--typedef <type_name>\t\t\t Displays the type as a typedef."""
def type_of_number(obj):
return "JSONNumber"
type_of_integer = type_of_number
def type_of_string(obj):
return "JSONString"
... | nomad010/typesafe_json | type_from_schema.py | Python | mit | 1,653 |
import sys
import os.path
import re
import time
from docutils import io, nodes, statemachine, utils
try:
from docutils.utils.error_reporting import ErrorString # the new way
except ImportError:
from docutils.error_reporting import ErrorString # the old way
from docutils.parsers.rst import Directive, con... | wbinventor/openmc | docs/sphinxext/notebook_sphinxext.py | Python | mit | 3,717 |
import torch
from allennlp.modules.span_extractors.span_extractor import SpanExtractor
from allennlp.modules.span_extractors.span_extractor_with_span_width_embedding import (
SpanExtractorWithSpanWidthEmbedding,
)
from allennlp.modules.time_distributed import TimeDistributed
from allennlp.nn import util
@SpanExt... | allenai/allennlp | allennlp/modules/span_extractors/self_attentive_span_extractor.py | Python | apache-2.0 | 3,955 |
from setuptools import setup
setup(name='tdwrapper',
version='0.0.1',
description='Teradata utility wrapper for Python',
url='https://github.com/changhyeoklee/tdwrapper',
author='Changhyeok Lee',
author_email='Changhyeoklee@gmail.com',
license='MIT',
packages=['tdwrapper'],
... | changhyeoklee/tdwrapper | setup.py | Python | mit | 420 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | pjdufour/geonode | geonode/people/models.py | Python | gpl-3.0 | 6,503 |
#!/usr/bin/env python3
from configparser import ConfigParser
import argparse
from flask import Flask, current_app, g, request, render_template
from flask_cors import CORS, cross_origin
import pymysql
import json
import ast
import time
import datetime
import os
if __name__ == "__main__":
parser = argparse.ArgumentPar... | chalbersma/persist_transaction | api.py | Python | gpl-3.0 | 5,275 |
from .static import StaticCalculation
from .relax import IonRelaxation
__author__ = 'Guillermo Avendano-Franco'
| MaterialsDiscovery/PyChemia | pychemia/code/abinit/task/__init__.py | Python | mit | 113 |
'''Yet another dev run at making apt better, and improving my understanding of python.
2014-Sep-27, mhw
This attempt doesn't look for a new magic bullet to avoid contending with
argparse, nor does it use it. Rather it is, so far, a simple refactoring ground
of choice functions from apt.py. Ideally each refactorin... | maphew/apt | wildlands/dapt.py | Python | gpl-2.0 | 4,005 |
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
# imports are all in this file to make moving to pyside easier in the future
# fixme: make sure not to optimize imports on this file
import sip
import os
from anki.utils import isWin, isMac
sip.... | z-jason/anki | aqt/qt.py | Python | agpl-3.0 | 1,591 |
# Django settings for django-custom-user-example project.
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.b... | aniketmaithani/django-custom-user-example | customuser/settings.py | Python | mit | 5,115 |
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2017 William H. Majoros (martiandna@gmail.com).
#==============================... | ReddyLab/1000Genomes | get-denovo-distances.py | Python | gpl-2.0 | 4,317 |
#encoding: utf-8
from . import api
from .resources.tests import Test
# 添加路由
api.add_resource(Test, '/tests') | chenke91/ckPermission | app/api_v1/routes.py | Python | mit | 118 |
# pylint: skip-file
# pylint: disable=too-many-instance-attributes
class GcloudComputeAddresses(GcloudCLI):
''' Class to wrap the gcloud compute addresses command'''
# pylint allows 5
# pylint: disable=too-many-arguments
def __init__(self,
aname=None,
desc=None,
... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/src/gcloud_compute_addresses.py | Python | apache-2.0 | 2,225 |
from . import func
from .Glitch import Glitch
class Constraints(object):
"""A container for tree topology constraints.
taxNames
A list of taxNames in the same order as in
the data or alignment, and the same order as
in other tree or trees objects.
constraintTree
... | Anaphory/p4-phylogeny | p4/Constraints.py | Python | gpl-2.0 | 1,931 |
#!/usr/bin/env python3
import logging
import json
import math
import os
from configparser import NoOptionError
from gi.repository import Gtk, Gdk, GObject
from lib.videodisplay import VideoDisplay
from lib.audiodisplay import AudioDisplay
import lib.connection as Connection
from lib.config import Config
from vocto.po... | voc/voctomix | voctogui/lib/videopreviews.py | Python | mit | 2,466 |
# Natural Language Toolkit: Combinatory Categorial Grammar
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Graeme Gange <ggange@csse.unimelb.edu.au>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import unicode_literals
import re
from collections import defaultdict
from nltk.c... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/ccg/lexicon.py | Python | gpl-2.0 | 7,509 |
#
# (c) 2016 Red Hat Inc.
#
# 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) any later version.
#
# Ansible is d... | le9i0nx/ansible | lib/ansible/plugins/action/ironware.py | Python | gpl-3.0 | 3,707 |
from scipysim.actors import SisoTestHelper, Channel, Event, LastEvent
from scipysim.actors.math import Abs
import numpy
import unittest
class AbsTests( unittest.TestCase ):
'''Test the absolute actor'''
def setUp( self ):
'''
Unit test setup code
'''
self.q_in = Channel()
... | mm318/scipysim-nogui | scipysim_tests/test_actors_math.py | Python | gpl-3.0 | 1,477 |
from rctk.widgets.control import Control
from rctk.layouts import VBox, LayoutException
from rctk.task import Task
import warnings
class Container(Control):
""" A container can contain controls. It uses a layout manager
to position them. The default layoutmanager is a gridlayout
(vertical).
... | rctk/rctk | rctk/widgets/container.py | Python | bsd-2-clause | 3,705 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied... | clovertrail/cloudinit-bis | tests/unittests/test_rh_subscription.py | Python | gpl-3.0 | 9,497 |
# -*- coding: utf-8 -*-
# © 2017 Houssine BAKKALI, Coop IT Easy
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product
| houssine78/addons | product_internal_ref/models/__init__.py | Python | agpl-3.0 | 156 |
# 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 field 'StockTransaction.subtype'
db.add_column(u'stock_stocktransaction', 'subtype', self.gf('dja... | puttarajubr/commcare-hq | corehq/ex-submodules/casexml/apps/stock/migrations/0004_auto__add_field_stocktransaction_subtype.py | Python | bsd-3-clause | 2,177 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | 0x0all/nupic | py/nupic/frameworks/opf/clamodel.py | Python | gpl-3.0 | 58,886 |
#importing integrate_html.py file
from integrate_html import*
import csv
import codecs
import re
import os
def parseCSV_getData ( file1 ): #total.csv
data = open(file1, "r")
data.readline()
data.readline()
state_map = {}
for line in data.readlines():
split = line.split(',')
stat... | ub-cse442/election-and-data-sci | make_html.py | Python | apache-2.0 | 3,302 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for assertions provided by C{SynchronousTestCase} and C{TestCase},
provided by L{twisted.trial.unittest}.
L{TestFailureTests} demonstrates that L{SynchronousTestCase.fail} works, so that
is the only method on C{twisted.trial.unittest.Sy... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/trial/test/test_assertions.py | Python | gpl-2.0 | 42,547 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.grid.grid_search import H2OGridSearch
from h2o.estimators.random_forest import H2ORandomForestEstimator
def fiftycatRF():
# Training set has only 45 categories cat1 through cat45
train = h2o.import_file(path=pyunit_utils.... | YzPaul3/h2o-3 | h2o-py/tests/testdir_algos/rf/pyunit_fiftycatRF_grid.py | Python | apache-2.0 | 852 |
import ConfigParser
import os.path
import time
import getpass
import subprocess
import argparse
import shlex
import re
import urlparse
import tempfile
import log
class textColours:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[... | stratus-ss/python_scripts | openshift_scripts/pipeline_related/common.py | Python | lgpl-3.0 | 913 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""最適化用のクラスをまとめたモジュール"""
from __future__ import print_function, unicode_literals
import logging
try:
from llvm import passes
except:
pass
from tinyc.code import (
Code, Comment, Data, Extern, Global, Label, Memory, Register, Registers)
class Optimizer(obje... | ymyzk/tinyc | tinyc/optimizer.py | Python | mit | 17,856 |
#!/usr/bin/env python3
# Copyright (c) 2014, Jesse Elwell
# All rights reserved.
#
# Redistribution and use 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
# lis... | jesseelwell/python-backup | create_backup.py | Python | bsd-3-clause | 8,442 |
#
# (C) Copyright 2015-2018, 2020 by Rocky Bernstein
# (C) Copyright 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
#
# 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 versio... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/uncompyle6/verify.py | Python | mit | 19,768 |
import socket
UDP_IP = raw_input('Host IP [Default: localhost]: ')
if not UDP_IP:
UDP_IP = 'localhost'
UDP_PORT = raw_input('Port Number [Default: 22000]: ')
if not UDP_PORT:
UDP_PORT = 22000
UDP_PORT = int(UDP_PORT)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UD... | lucaspcamargo/ufsc-siscom-sender | siscom-sender/server/UDPServer_for_SiscomSender.py | Python | gpl-3.0 | 1,546 |
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/sqlscript/interfaces.py | Python | gpl-3.0 | 1,852 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
help.py
---------------------
Date : March 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
***********************************... | michaelkirk/QGIS | python/plugins/processing/tools/help.py | Python | gpl-2.0 | 4,423 |
import flask
import unittest
from superdesk.io.subjectcodes import init_app
class SubjectsTestCase(unittest.TestCase):
def test_app_subjects(self):
app = flask.Flask(__name__)
app.api_prefix = "/test"
init_app(app)
with app.app_context():
app.subjects.register({"01000... | superdesk/superdesk-core | tests/subjectcodes_test.py | Python | agpl-3.0 | 516 |
__author__ = 'michael'
from django import forms
import models
from unobase import models as unobase_models
class BulkSelectedMixin(forms.Form):
"""
Mixin form used for bulk actions, used to determine bulk selected users.
"""
selected = forms.CharField(
widget=forms.HiddenInput(),
)
... | unomena/unobase | unobase/tagging/forms.py | Python | bsd-3-clause | 1,938 |
import html
from collections import defaultdict
from urllib.parse import urlencode, quote
from django.urls import reverse
from django.conf import settings
from django.template import Context
from django.contrib.gis.measure import D
from froide.campaign.utils import connect_foirequest
from froide.foirequest.models im... | okfde/froide-campaign | froide_campaign/providers/base.py | Python | mit | 9,736 |
"""
@package mi.instrument.seabird.sbe16plus_v2.dosta.driver
@file mi/instrument/seabird/sbe16plus_v2/dosta/driver.py
@author Dan Mergens
@brief Driver class for dissolved oxygen sensor for the sbe16plus V2 CTD instrument.
"""
import re
from mi.core.common import BaseEnum
from mi.core.log import get_logger
from mi.co... | danmergens/mi-instrument | mi/instrument/seabird/sbe16plus_v2/dosta/driver.py | Python | bsd-2-clause | 10,867 |
#!/bin/env python2.7
"""
For each line in the Shakespeare text,
CREATE a corresponding record in the database.
Each record will include the name of the character speaking,
the (absolute) line number of the phrase and the phrase itself,
trimmed of any leading or following spaces
"""
import sqlite3 # provides python wi... | mnr/DatabaseClinic-SQLite | Ch05/CREATE_shakespeare.py | Python | gpl-3.0 | 2,041 |
import os
import time
import types
import sys
from types import StringType
from collections import namedtuple
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class EnterTextEventHandler(QObject):
def __init__(self,control,model, button = None):
super(EnterTextEventHandler, self).__init__()
... | lifemapper/LmQGIS | lifemapperTools/common/lmListModel.py | Python | gpl-2.0 | 2,928 |
# -*- coding: utf-8 -*-
"""
Proxy pattern
"""
class WorldOutside(object):
@staticmethod
def access():
print "I came out over the wall!"
class Proxy:
def __init__(self):
self.busy = 'No'
self.sales = None
self.endpoint = WorldOutside()
def access(self):
pr... | xuwei0455/design_patterns | Proxy.py | Python | mit | 494 |
import gdspy
from picwriter import toolkit as tk
import picwriter.components as pc
top = gdspy.Cell("top")
wgt = pc.WaveguideTemplate(
wg_width=0.45,
clad_width=10.0,
bend_radius=60,
resist="+",
fab="ETCH",
wg_layer=1,
wg_datatype=0,
clad_layer=2,
clad_datatype=0,
)
gc1 = pc.Gratin... | DerekK88/PICwriter | docs/source/tutorial2.py | Python | mit | 2,341 |
import time
from selenium.webdriver.support.ui import Select
from draughtcraft import model
from draughtcraft.tests.selenium import TestSeleniumApp
class TestAllGrainBuilder(TestSeleniumApp):
def setUp(self):
super(TestAllGrainBuilder, self).setUp()
model.Style(
name='American IPA'... | ryanpetrello/draughtcraft | draughtcraft/tests/selenium/recipes/test_builder.py | Python | bsd-3-clause | 23,046 |
#!/usr/bin/env python
import elf
# Define section markers for various sections in elf
def elf_loadable_section_info(img):
elffile = elf.ElfFile.from_file(img)
# Sections markers for RW sections
rw_sections_start = 0
rw_sections_end = 0
# Section markers for RX and RO section combined
rx_sect... | freecores/c0or1k | tools/pyelf/elf_section_info.py | Python | gpl-3.0 | 1,362 |
#!/usr/local/bin/python2.7
##
# OOIPLACEHOLDER
#
# Copyright 2014 Raytheon Co.
##
__author__ = 'Rachel Manoni'
import os
from mi.logging import config
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.driver.moas.gl.flord_m.flord_m_glider_driver import FlordMDriver
from mi.core.versioning ... | JeffRoy/mi-dataset | mi/dataset/driver/moas/gl/flord_m/flord_m_glider_telemetered_driver.py | Python | bsd-2-clause | 834 |
"""
Django settings for css122 project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
imp... | cszc/Meet-Halfway | cs122/settings.py | Python | apache-2.0 | 3,647 |
#!/usr/bin/python
import sys
import os
import pprint
import copy
class ZoneRipper:
def __init__(self, zonename):
self.zonename = zonename
self.cfgTokens = []
self.cfgStr = ""
self.curToken = 0
self.saveToken = 0
self.zone = {}
return None
def consume(self):
_item = self.cfgTokens[s... | jwbernin/dns-sanity-checker | zoneripper.py | Python | gpl-2.0 | 6,771 |
from mpi4py import MPI
# -----------------------------------------------------------------------------
import struct as _struct
try:
from numpy import empty as _empty
def _array_new(size, typecode, init=0):
a = _empty(size, typecode)
a.fill(init)
return a
def _array_set(ary, value)... | capoe/espressopp.soap | contrib/mpi4py/mpi4py-1.3/demo/nxtval/nxtval-scalable.py | Python | gpl-3.0 | 4,142 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""Contains classes and functions that a SAML2.0 Service Provider (SP) may use
to conclude its tasks.
"""
from saml2.request import LogoutRequest
import saml2
from saml2 import saml, SAMLError
from saml2 import BINDING_HTTP_REDIRECT
from saml2 import BINDING_HTTP_POST
... | tpazderka/pysaml2 | src/saml2/client.py | Python | bsd-2-clause | 18,978 |
#
# Copyright (C) 2004 SIPfoundry Inc.
# Licensed by SIPfoundry under the GPL license.
#
# Copyright (C) 2004 SIP Forum
# Licensed to SIPfoundry under a Contributor Agreement.
#
#
# This file is part of SIP Forum User Agent Basic Test Suite which
# belongs to the SIP Forum Test Framework.
#
# SIP Forum User Agent Basic... | VoIP-co-uk/sftf | UserAgentBasicTestSuite/case507.py | Python | gpl-2.0 | 4,527 |
# 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 the... | mattjhayes/nmeta2dpae | nmeta2dpae/classifiers/payload_uri_1.py | Python | apache-2.0 | 3,329 |
"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | heracek/django-nonrel | django/core/cache/__init__.py | Python | bsd-3-clause | 6,144 |
import sys
import warnings
import itertools
import platform
import pytest
import math
from decimal import Decimal
import numpy as np
from numpy.core import umath
from numpy.random import rand, randint, randn
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_raises_regex,
assert_array_equ... | simongibbons/numpy | numpy/core/tests/test_numeric.py | Python | bsd-3-clause | 134,624 |
###################################################
# header_scenes.py
# This file contains declarations for scenes
# DO NOT EDIT THIS FILE!
###################################################
scene_name_pos = 0
passages_pos = 8
#flags
sf_indoors = 0x00000001 #The scene shouldn't have a skybox and lightin... | Sw4T/Warband-Development | mb_warband_module_system_1166/Module_system 1.166/headers/header_scenes.py | Python | mit | 768 |
"""OtpProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | NandeeshHD/Django_OTP_Twilio | OtpProject/OtpApp/urls.py | Python | gpl-2.0 | 1,080 |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.brain import BrainFileConfiguration
class BasicTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_configuration(self, arguments):
super(BasicTestClient, self).load_configur... | JustArchi/program-y | src/test/aiml_tests/underline_tests/test_underline_aiml.py | Python | mit | 2,469 |
#!/usr/bin/python
# Authors:
# Jason Gerard DeRose <jderose@redhat.com>
#
# Copyright (C) 2008 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 Soft... | hatchetation/freeipa | lite-server.py | Python | gpl-3.0 | 4,299 |
# POVME Pocket ID 1.0 is released under the GNU General Public License
# (see http://www.gnu.org/licenses/gpl.html).
# If you have any questions, comments, or suggestions, please don't hesitate to contact me,
# Jacob Durrant, at jdurrant [at] ucsd [dot] edu.
import sys
import numpy
from scipy import spatial
from sci... | POVME/POVME | POVME/POVME_pocket_id.py | Python | mit | 51,539 |
# $Id: __init__.py 4802 2006-11-12 18:02:17Z goodger $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
This is ``docutils.parsers.rst`` package. It exports a single class, `Parser`,
the reStructuredText parser.
Usage
=====
1. Create a parser::
... | spreeker/democracygame | external_apps/docutils-snapshot/docutils/parsers/rst/__init__.py | Python | bsd-3-clause | 13,825 |
from unittest import TestCase
import numpy as np
import theano
from theano import tensor as T
from teafacto.blocks.seq.rnu import GRU
class TestGRUBasic(TestCase):
def test_output_shape(self):
indim = 20
innerdim = 50
batsize = 200
seqlen = 5
data = np.random.random((bats... | lukovnikov/teafacto | test/test_gru.py | Python | mit | 3,451 |
from test_plus.test import TestCase
from bootcamp.news.models import News
from bootcamp.notifications.models import Notification, notification_handler
class NotificationsModelsTest(TestCase):
def setUp(self):
self.user = self.make_user("test_user")
self.other_user = self.make_user("other_test_use... | vitorfs/bootcamp | bootcamp/notifications/tests/test_models.py | Python | mit | 6,507 |
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in th... | dannykopping/mysql-utilities | mysql-test/t/import_parameters.py | Python | gpl-2.0 | 6,759 |
# encoding: utf-8
from tornado.testing import gen_test
from mytor import Connection
from . import BaseTestCase
class TestInit(BaseTestCase):
@gen_test
def test0(self):
connection = yield Connection(**self.PARAMS)
cursor = connection.cursor()
yield cursor.execute('SELECT 1')
da... | mosquito/mytor | tests/test_init.py | Python | mit | 421 |
import json
import logging
from math import ceil
import os
import click
import cligj
from .helpers import resolve_inout
from . import options
import rasterio
from rasterio.errors import CRSError
from rasterio.transform import Affine
from rasterio.coords import disjoint_bounds
logger = logging.getLogger('rio')
# C... | ryfeus/lambda-packs | Rasterio_osgeo_shapely_PIL_pyproj_numpy/source/rasterio/rio/rasterize.py | Python | mit | 10,025 |
class Solution:
"""
@param A: a sparse matrix
@param B: a sparse matrix
@return: the result of A * B
"""
def multiply(self, A, B):
# write your code here
na = len(A[0])
ma = len(A)
nb = len(B[0])
result = [[0 for i in range(nb)] for j in range(ma)]
... | euccas/CodingPuzzles-Python | leet/source/datastructure/sparse_matrix_multiply.py | Python | mit | 918 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 14 00:52:07 2017
@author: Shabaka
"""
import numpy as np
def draw_bs_pairs_linreg(x, y, size=1):
"""Perform pairs bootstrap for linear regression."""
# Set up array of indices to sample from: inds
inds = np.arange(len(x))
# Initialize ... | qalhata/Python-Scripts-Repo-on-Data-Science | LinReg_BS_Pairs_func.py | Python | gpl-3.0 | 724 |
from preprocess.data import ReVerbTrainRaw
import codecs
from sys import stdout
FILE = './data/reverb-train.txt'
if __name__ == '__main__':
data = ReVerbTrainRaw()
i = 0
with open(FILE, 'a') as f:
for q, a in data:
i += 1
stdout.write("\rgenerated: %d" % i)
stdo... | tinyHui/QuestionAnswering | generate_reverb_train.py | Python | mit | 413 |
"""
The iter package contains a series of 3 iterators for traversing a piece of music:
- `note_iterator.py` iterates through notes in non-decreasing time order,
- `chord_iterator.py` iterates through a song by chord, and
- `time_iterator.py` iterates through a song by time instance (what is playing at a particular mom... | jasonsbrooks/ARTIST | src/artist_generator/iter/__init__.py | Python | mit | 450 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | titasakgm/brc-stock | openerp/addons/bangkok_rubber/__init__.py | Python | agpl-3.0 | 1,022 |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from telemetry.test import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
def testGetDOMStats(self):
unittest_data_... | loopCM/chromium | tools/telemetry/telemetry/core/chrome/inspector_memory_unittest.py | Python | bsd-3-clause | 993 |
#!/usr/bin/env python
"""
Console Command
"""
import sys
import types
import os
import gc
import signal
import cmd
import logging
from threading import Thread
from .debugging import bacpypes_debugging, function_debugging, Logging, ModuleLogger
from .consolelogging import ConsoleLogHandler
from . import core
# rea... | JoelBender/bacpypes | py27/bacpypes/consolecmd.py | Python | mit | 9,792 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.