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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
pythoner.net
Copyright (C) 2013 PYTHONER.ORG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later versio... | yohn89/pythoner.net | pythoner/accounts/admin.py | Python | gpl-3.0 | 915 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The vyos_lldp_interfaces class
It is in this file where the current configuration (as dict)
is compared to the provided configuration (as dict) and the command set
necess... | hyperized/ansible | lib/ansible/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py | Python | gpl-3.0 | 14,964 |
"""Support for Xiaomi Mi Air Purifier and Xiaomi Mi Air Humidifier with humidifier entity."""
from enum import Enum
import logging
import math
from miio.airhumidifier import OperationMode as AirhumidifierOperationMode
from miio.airhumidifier_miot import OperationMode as AirhumidifierMiotOperationMode
from miio.airhumi... | sander76/home-assistant | homeassistant/components/xiaomi_miio/humidifier.py | Python | apache-2.0 | 15,672 |
# 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 RRgooglemaps(RPackage):
"""Overlays on Static Maps
This package serves two purposes: ... | LLNL/spack | var/spack/repos/builtin/packages/r-rgooglemaps/package.py | Python | lgpl-2.1 | 1,381 |
from sourceCode.mainProgram.models.DatabaseManipulator import DatabaseManipulator
class Turma(DatabaseManipulator):
def __init__(self, conexao):
super(Turma, self).__init__(conexao)
def getIdTurma(self, turma):
self.getCursor().execute('select id_turma from Turma where nome = "%s"' % turma)
... | Jictyvoo/FilaLanche_SENAI | sourceCode/mainProgram/models/Turma.py | Python | mit | 794 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ucum
import pyxb
import sys
from pyxb.utils import six
def ucumHTML (u):
"""Convert mixed content to UCUM's version of HTML"""
txt = []
if isinstance(u, six.text_type):
return u.strip()
for c in u.orderedContent():
... | pabigot/pyxb | examples/ucum/showunits.py | Python | apache-2.0 | 1,323 |
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | tempbottle/h-store | third_party/python/boto/rds/dbinstance.py | Python | gpl-3.0 | 10,993 |
import sys
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
hbox = QtGui.QHBoxLayout(self)
pixmap = QtGui.QPixmap("C:\Elan_Tools\ImageScripter\ProgramData\Android\ADB\platform-too... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/spyderlib/fsdgfsd.py | Python | gpl-3.0 | 688 |
"""
Tests for `ka-lite-zim` module.
"""
import pytest
from kalite_zim import kalite_zim
class TestKaliteZim(object):
@classmethod
def setup_class(cls):
pass
def test_something(self):
pass
@classmethod
def teardown_class(cls):
pass
| benjaoming/ka-lite-zim | test/test_kalite_zim.py | Python | mit | 280 |
import lxml
from utils import State
from .people import NCPersonScraper
from .bills import NCBillScraper
# from .committees import NCCommitteeScraper
class NorthCarolina(State):
scrapers = {
"people": NCPersonScraper,
# 'committees': NCCommitteeScraper,
"bills": NCBillScraper,
}
l... | sunlightlabs/openstates | scrapers/nc/__init__.py | Python | gpl-3.0 | 12,386 |
# -*- coding: utf-8 -*-
##############################################################################
# 2011 E2OpenPlugins #
# #
# This file is open source software; you can redistribute... | HDMU/e2openplugin-OpenWebif | plugin/controllers/models/control.py | Python | gpl-2.0 | 6,402 |
# Code common to build tools
import sys
import warnings
import copy
import textwrap
from numpy.distutils.misc_util import mingw32
#-------------------
# Versioning support
#-------------------
# How to change C_API_VERSION ?
# - increase C_API_VERSION value
# - record the hash for the new C API with the cversion... | abalkin/numpy | numpy/core/setup_common.py | Python | bsd-3-clause | 19,325 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-12 02:22
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('operation_finance', '0020_auto_20170711_1429'),
]
operations = [
... | michealcarrerweb/LHVent_app | operation_finance/migrations/0021_auto_20170712_0222.py | Python | mit | 519 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^question/(?P<id>\d+)/', 'qa.views.question', name='question'),
url(r'^popular/', 'qa.views.popular', name='popular'),
url(r'^$', 'qa.views.main', name='main'),
ur... | InuNora/stepic | ask/ask/urls.py | Python | gpl-2.0 | 506 |
###########################################################
#
# Copyright (c) 2005-2008, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written ... | Southpaw-TACTIC/TACTIC | src/tactic/command/ingestion_cmd.py | Python | epl-1.0 | 21,788 |
from mieli.cli import MieliCommand
from mieli.api import nexus, organization
import slugify
class Command(MieliCommand):
def __init__(self):
super(self.__class__, self).__init__()
self.register_option(
'--organization',
dest='domain',
help='Nexus organization',
... | joanma100/mieli | identity/management/commands/identity_createnexus.py | Python | agpl-3.0 | 786 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php or see LICENSE file.
# Copyright 2007-2008 Brisa Team <brisa-develop@garage.maemo.org>
""" Control Point side service implementation. Classes contained by this module
contain methods for performing actions on the service and event notifi... | henkelis/sonospy | sonospy/brisa/upnp/control_point/service.py | Python | gpl-3.0 | 21,136 |
def solution(A):
n = len(A) - 1
A.sort()
res = max(A[n] * A[n - 1] * A[n - 2], A[0] * A[1] * A[n])
return res
| chandps/CodingChallenges | cdlt/MaxProductOfThree.py | Python | mit | 126 |
from togglRound import roundToQuarterHour
from datetime import datetime
import pytz
now = datetime.utcnow()
utc = pytz.utc
def test_07MinutesRoundsDown():
tmpDt = datetime(now.year, now.month, now.day, now.hour, 7, tzinfo=utc)
expected = datetime(now.year, now.month, now.day, now.hour, tzinfo=utc)
assert... | yanigisawa/toggl-round | test.py | Python | mit | 2,743 |
from astroid import MANAGER
from astroid.builder import AstroidBuilder
def mechanize_transform(module):
fake = AstroidBuilder(MANAGER).string_build('''
class Browser(object):
def open(self, url, data=None, timeout=None):
return None
def open_novisit(self, url, data=None, timeout=None):
ret... | hkupty/python-mode | pymode/libs/pylama/lint/pylama_pylint/astroid/brain/py2mechanize.py | Python | lgpl-3.0 | 532 |
from pytrademgen import *
| airsim/trademgen | trademgen/python/__init__.py | Python | lgpl-2.1 | 26 |
class ProjectManager(object):
def create(self, project_name):
pass
def delete(self, project_name):
pass
def list_projects(self):
pass
def upload_file(self, project_name, filename):
pass
| octopus-platform/bjoern | python/octopus-tools/octopus/server/project_manager.py | Python | gpl-3.0 | 237 |
"""Implements the GPkit interface to MOSEK (version >= 9)
through python-based Optimizer API"""
import numpy as np
import mosek
from ..exceptions import (UnknownInfeasible, InvalidLicense,
PrimalInfeasible, DualInfeasible)
def optimize(*, c, A, k, p_idxs, **kwargs):
# pylint: disable=t... | hoburg/gpkit | gpkit/solvers/mosek_conif.py | Python | mit | 11,945 |
#!/usr/bin/env python3
## -*- coding: utf-8 -*-
##
## Output:
##
## $ ./src/examples/python/symbolic_emulation_2.py
## Curr ip: 40056d: push rbp
## Next ip: 0x40056eL
##
## Curr ip: 40056e: mov rax, 0x41424344
## Next ip: 0x400575L
##
## Curr ip: 400575: call rax
## Next ip: 0x41424344L
##
## Curr ip: 41424344:... | JonathanSalwan/Triton | src/examples/python/symbolic_emulation_2.py | Python | apache-2.0 | 2,068 |
from django.db import models
from osm_field.fields import LatitudeField, LongitudeField, OSMField
class CustomNamingModel(models.Model):
location = OSMField(lat_field="latitude", lon_field="longitude")
latitude = LatitudeField()
longitude = LongitudeField()
class DefaultNamingModel(models.Model):
l... | MarkusH/django-osm-field | tests/models.py | Python | mit | 1,491 |
"""
This module setting file is for settings
"""
import ConfigParser
import os
import sys
import tempfile
from PyQt4 import QtCore, QtGui
import debug
import defaults
import namecoin
import openclpow
import paths
import queues
import state
import widgets
from bmconfigparser import BMConfigParser
from helper_sql impor... | PeterSurda/PyBitmessage | src/bitmessageqt/settings.py | Python | mit | 26,832 |
# Copyright (C) 2015 by Per Unneberg
"""
SRA sample run organization
-----------------------------
"""
from . import update_config, config, sample_org, join, IOTarget, IOSampleTarget
update_config(
config, {'settings': {
'sample_organization': sample_org(IOTarget(join("{SM, [a-zA-Z0-9]+}", "{PU, [a-zA-Z0-9... | percyfal/snakemakelib-core | snakemakelib/sample/organization/sample_run_sra.py | Python | mit | 544 |
"""
An interpreter for a strange word-based language: the program is a list
of space-separated words. Most words push themselves on a stack; some
words have another action. The result is the space-separated words
from the stack.
6 7 ADD => '13' 'ADD' is a special word
7 * 5 = 7 5 MU... | oblique-labs/pyVM | rpython/jit/tl/tiny3_hotpath.py | Python | mit | 9,515 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from underthesea.util import download_component
except:
from util import download_component
# download default components
default_components = ["classification.fasttext.model"]
[download_component(component) for component in default_components]
| rain1024/underthesea | underthesea/util/data.py | Python | gpl-3.0 | 307 |
# Copyright 2019 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... | aldian/tensorflow | tensorflow/python/keras/distribute/worker_training_state_test.py | Python | apache-2.0 | 2,771 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitte... | cliffano/swaggy-jenkins | clients/python-legacy/generated/test/test_github_organization.py | Python | mit | 1,951 |
class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
size = len(nums)
if size == 0:
return 0
l = 0
r = size - 1
m = 0
while l < r:
m = l + ((r - l) >> 1)
if nums[... | hawkphantomnet/leetcode | FindMinimumInRotatedSortedArrayII/Solution.py | Python | mit | 599 |
##
# Copyright 2016 DECaF Project Group, University of Paderborn
# This file is part of the decaf orchestration framework
# All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at htt... | CN-UPB/OpenBarista | components/decaf-storage/decaf_storage/endpoint.py | Python | mpl-2.0 | 2,822 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Energy_Production_Web_Map_Project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| SavenR/Map_-_Energy_Production | manage.py | Python | mit | 276 |
import os
import re
import subprocess
import sys
from datetime import date
from pathlib import Path
from docutils import nodes
from sphinx import addnodes
import tox
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinxcontrib.autopro... | Avira/tox | docs/conf.py | Python | mit | 3,748 |
from os.path import join, getsize, basename, dirname
from posix import listdir
import re
from django.db.models.query_utils import Q
from django.http.response import JsonResponse, HttpResponse
from 族語辭典.models import 分類辭典
音檔目錄 = join(dirname(__file__), '..', '..', '好的')
def _整理詞條(詞條要求):
return list(詞條要求.values()... | Taiwanese-Corpus/kaxabu-muwalak-misa-a-ahan-bizu | 後端/族語辭典/介面.py | Python | mit | 2,841 |
#!/usr/bin/env python
# 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... | appium/python-client | appium/protocols/webdriver/can_execute_commands.py | Python | apache-2.0 | 862 |
from asyncio import Future
from collections import defaultdict
from ...base import TestBase
from ...mocking.endpoint import MockEndpointListener
from ...mocking.exit_socket import MockTunnelExitSocket
from ...mocking.ipv8 import MockIPv8
from ....messaging.anonymization.community import TunnelCommunity, TunnelSettings... | qstokkink/py-ipv8 | ipv8/test/messaging/anonymization/test_community.py | Python | lgpl-3.0 | 18,700 |
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
from RGT.XML.SVG.Attribs.transferFunctionElementAttributes import TransferFunctionElementAttributes
class BaseComponentTransferNode(BasicSvgNode, TransferFunctionElementAttributes):
def __init__(self, ownerDoc, tagName):
BasicSvgNode.__init__(self, o... | danrg/RGT-tool | src/RGT/XML/SVG/Filters/baseComponentTransferNode.py | Python | mit | 502 |
# pylint: disable=W0223
"""Video is ungraded Xmodule for support video content.
It's new improved video module, which support additional feature:
- Can play non-YouTube video sources via in-browser HTML5 video player.
- YouTube defaults to HTML5 mode from the start.
- Speed changes in both YouTube and non-YouTube vide... | TangXT/GreatCatMOOC | common/lib/xmodule/xmodule/video_module.py | Python | agpl-3.0 | 16,319 |
import tensorflow as tf
import pickle
import numpy as np
from core.Util import calculate_ious
from datasets import DataKeys
from datasets.Dataset import FileListDataset
from datasets.Loader import register_dataset
from datasets.util.BoundingBox import get_bbox_from_segmentation_mask_np
NAME = "mapillary_crop"
DEFAULT... | VisualComputingInstitute/TrackR-CNN | datasets/Mapillary/Mapillary_crop.py | Python | mit | 4,381 |
#!/usr/bin/python
import os
os.path.dirname(os.path.abspath(__file__))
import sys
import numpy
from scipy.stats import multivariate_normal
xtrain = "X_train.csv"
if(len(sys.argv) >= 2):
xtrain = sys.argv[1]
ytrain = "y_train.csv"
if(len(sys.argv) >= 3):
ytrain = sys.argv[2]
xtest = "X_test.csv"
if(len(... | xunilrj/sandbox | courses/course-edx-datamining/hw2_classification.py | Python | apache-2.0 | 2,459 |
"""Arpegio's models."""
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.template.defaultfilters import slugify, striptags
from django.utils.timezone import now
from django.db import models
@python_2_unicode_compatible
class ContentMixin(models.Model):... | arpegio-dj/arpegio | arpegio/core/models.py | Python | bsd-3-clause | 1,900 |
# Copyright 2016 Mario Graff Guerrero
# 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 wri... | mgraffg/RGP | EvoDAG/tests/test_utils.py | Python | apache-2.0 | 5,262 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/util/i18n.py | Python | gpl-3.0 | 10,735 |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2014 Jacob Mendt
Created on Jul 2, 2015
@author: mendt
'''
import os
import sys
import logging
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from sqlalchemy import create_engine
from sqlalchemy import engine_from_config
from sqlalchemy.... | slub/vk2-georeference | georeference/__init__.py | Python | gpl-3.0 | 3,706 |
from camel import DbManager
class TestSchemaVersion():
@classmethod
def setup_class(self):
self.db = DbManager.DbManager()
self.db.mysqlConnect()
def testCheckSchemaVersion(self):
result = self.db.mysqlExecuteAndReturnObject("SELECT camel_get_schema_version()")[0]
... | tomasz-galuszka/camel-db | tests/TestSchemaVersion.py | Python | apache-2.0 | 345 |
# Import a whole load of stuff
from System.IO import *
from System.Drawing import *
from System.Runtime.Remoting import *
from System.Threading import *
from System.Windows.Forms import *
from System.Xml.Serialization import *
from System import *
from Analysis.EDM import *
from DAQ.Environment import *
fro... | jstammers/EDMSuite | EDMScripts/EDMLoop_neg_slope.py | Python | mit | 14,423 |
#!/usr/bin/env python
import os, sys
import os.path, shutil
import filecmp
from glob import glob
#import gazpacho.loader.loader
import difflib
def get_diff(file1, file2):
return '\n'.join(list(
difflib.unified_diff(
open(file1).readlines(),
open(file2).readlines()
... | jmlorenzi/kmos | tests/export_test/test_import_export.py | Python | gpl-3.0 | 7,283 |
def fu<the_ref>nc(**args):
"""
:key foo: bar
:keyword baz:
""" | siosio/intellij-community | python/testData/quickdoc/KeywordArgsDescriptionRest.py | Python | apache-2.0 | 78 |
#!/usr/bin/python
import sys,os,os.path,re,json
print "Legacy script: disabled"
sys.exit()
scriptpath = os.path.dirname(sys.argv[0])
rootpath = os.path.join(scriptpath,os.path.pardir)
rootpath = os.path.abspath(rootpath)
datasrcpath = os.path.join(rootpath,'resource','reporters-db.json')
datasrc = open(datasrcpath)... | fbennett/legal-resource-registry | attic/build-data.py | Python | bsd-2-clause | 9,991 |
#! /bin/env python
from SpectrumUtils import *
from SpectrumPlots import *
import os
if __name__=="__main__":
bpath = os.environ["HOME"]+"/Desktop/"
sensRGB = load_specfile("Canon_5D_Spectral_Sensitivity.txt")
wr47b = [product_spectrum([load_specfile("Wratten_47b_Tx.txt")[0],s]) for s in sensRGB]
k5... | mpmendenhall/MPMUtils | pyUtils/Color/spectra.py | Python | gpl-3.0 | 2,066 |
# -*- coding: utf-8 -*-
import scrapy
class GSpider(scrapy.Spider):
name = "g"
allowed_domains = ["www.google.com"]
start_urls = (
'http://www.www.google.com/',
)
def parse(self, response):
pass
| lefttree/AutoTorrentCrawler | kickass/spiders/g.py | Python | mit | 234 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/data-driven-discretization-1d | pde_superresolution/duckarray_test.py | Python | apache-2.0 | 2,487 |
#-*-coding:utf-8-*-
from flask import Blueprint
services_blueprint = Blueprint(
'services',
__name__,
url_prefix = "/services"
)
from . import views
| PythonScientists/Shape | main/module/services/__init__.py | Python | apache-2.0 | 164 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 t... | PXke/invenio | invenio/legacy/bibclassify/ontology_reader.py | Python | gpl-2.0 | 43,550 |
#!/usr/bin/env python
#
# $File: simuGen.py $
#
# This file is part of simuPOP, a forward-time population genetics
# simulation environment. Please visit http://simupop.sourceforge.net
# for details.
#
# Copyright (C) 2004 - 2010 Bo Peng (bpeng@mdanderson.org)
#
# This program is free software: you can redistribute it... | BoPeng/simuPOP | docs/simuGen.py | Python | gpl-2.0 | 1,716 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | keen99/SickRage | sickbeard/notifiers/__init__.py | Python | gpl-3.0 | 3,001 |
from django import forms
from django.utils.encoding import smart_unicode
from bson.errors import InvalidId
from bson.objectid import ObjectId
class ReferenceField(forms.ChoiceField):
"""
Reference field for mongo forms. Inspired by `django.forms.models.ModelChoiceField`.
"""
def __init__(self, queryse... | mishudark/openhealt | mongoforms/fields.py | Python | gpl-3.0 | 5,397 |
# coding: utf-8
import os
import sys
import logging
from logging.handlers import RotatingFileHandler
class Log(object):
'''
only log() methods can be called.
Usage example:
import log
l = log.Log("my_module_name")
l.log()
# call my own methods.
'''
def __init__(... | crackedcd/little_scripts | cc_daemon/d/actions/log.py | Python | gpl-2.0 | 3,322 |
"""Helper utilities for QGIS python unit 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.
"""
__author__ = 'Tim... | kiith-sa/QGIS | tests/src/python/utilities.py | Python | gpl-2.0 | 7,405 |
# This file allows project-level configuration of the checkin-test system to
# set project options that are required for all developers. Machine or package
# specific options should not be placed in this file.
# This is a dictionary that specifies project-specific options for the
# checkin-test script that should be u... | mingpz2010/DMAT | benchmark/trilinos-11.12.1-Source/project-checkin-test-config.py | Python | gpl-2.0 | 2,273 |
"""
Stuff to play long WAVE files.
2015-04-22 Matt Page
2015-04-26 Added replay ability
Double buffered, using a timer to reload the DAC and a poll function to
fill up the queue.
Works well with 200ms of audio, and polled at about 100ms
"""
import wave
import pyb
from pyb import DAC
class LongWave:
"""
Cal... | MattMatic/micropython-longwave | longwave.py | Python | mit | 3,177 |
#!/usr/bin/env python
# coding=utf-8
from wtforms import form, validators, StringField, TextField, BooleanField,\
IntegerField
from tornado.web import HTTPError
class BaseForm(form.Form):
@classmethod
def from_json_with_validate(cls, json):
form = cls.from_json(json)
if not form.validat... | exherb/tvee | tvee/forms/__init__.py | Python | mit | 1,259 |
#!/usr/bin/env python
#
# =========================================================================
# This file is part of six.sicd-python
# =========================================================================
#
# (C) Copyright 2004 - 2016, MDA Information Systems LLC
#
# six.sicd-python is free software; you can... | ngageoint/six-library | six/modules/python/six/tests/makeSICDRegressionFiles.py | Python | lgpl-3.0 | 2,600 |
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns(
'',
url(r'about/$', TemplateView.as_view(template_name='about.html'),
name='about'),
url(r'faq/$', TemplateView.as_view(template_name='faq.html'),
name='faq'),
url(r'labs/$'... | chirilo/remo | remo/base/urls.py | Python | bsd-3-clause | 448 |
from __future__ import division
import math
def var(vec):
l = len(vec)
mean = sum(vec)/l
for i in xrange(l):
vec[i] = (vec[i] - mean)**2
return sum(vec)/(l-1)
def std(vec):
return math.sqrt(var(vec))
def cov(vec1, vec2):
l = len(vec1)
assert l == len(vec2)
mean1 = sum(vec1)/l
mean2 = sum(vec2)/l
result... | cwlseu/recipes | pyrecipes/pearsonsim.py | Python | gpl-3.0 | 645 |
# Doing some basic mathematics
# print string "let's see what is result of mathematical
# expr" and also print the result of 3 - 2 / 5
print "let's see what is the result of mathematical expr: 3 - 2 / 5:", 3 - 2 / 5
# print string "Also check which is greater 9 + 15 or 2 + 12"
print "Also check which is greater 9 +... | mrniranjan/python-scripts | reboot/math1.py | Python | gpl-2.0 | 728 |
import re, urllib, os.path
try:
from PIL import Image, ImageOps
except ImportError, e:
import Image, ImageOps
from unidecode import unidecode
from django.utils import simplejson
from django.conf import settings
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_laz... | xuqingkuang/tsCloud | tsCloud/core/utils.py | Python | gpl-3.0 | 4,179 |
""" Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine
This module provides a framework for the use of DNS Service Discovery
using IP multicast.
This library is free software; you can redistribute it and/or
modify it under the terms of... | EternityForest/KaithemAutomation | kaithem/src/thirdparty/zeroconf/__init__.py | Python | gpl-3.0 | 90,224 |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
{%- if cookiecutter.use_async == 'y' %}
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
{%- endif %}
from django.urls import include, path
from django.views import defaults as default_views
f... | trungdong/cookiecutter-django | {{cookiecutter.project_slug}}/config/urls.py | Python | bsd-3-clause | 2,353 |
##
# Copyright 2015-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/r/ruby.py | Python | gpl-2.0 | 2,467 |
import globus_sdk
from tests.framework import (CapturedIOTestCase,
get_client_data, get_user_data,
SDKTESTER1A_NATIVE1_AUTH_RT)
from globus_sdk.exc import AuthAPIError
class NativeAppAuthClientTests(CapturedIOTestCase):
def setUp(self):
"""
... | aaschaer/globus-sdk-python | tests/unit/test_native_client.py | Python | apache-2.0 | 3,326 |
"""Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | ViralLeadership/numpy | numpy/linalg/linalg.py | Python | bsd-3-clause | 75,737 |
import numpy as np
import gnumpy as gnp
from act_functions import Softmax, ReLU
from datetime import datetime
class DNN(object):
learning_rate = None
batch_size = 0
epochs = 0
verbose = 0
hidden_function = ReLU
output_function = Softmax
def __init__(self, layer_sizes, scale=0.05, verbose=... | ryaninhust/Apep | ada_dnn.py | Python | mit | 9,442 |
'''
supporting functions about database side group management
'''
from cloudmesh.cm_mongo import cm_mongo
from cloudmesh.experiment.group import GroupManagement
from cloudmesh.cm_mongo import cm_mongo
def add_vm_to_group_while_creating(username, groupname, vmname):
'''
add a vm to a group while the vm is bein... | rajpushkar83/cloudmesh | cloudmesh/experiment/group_usage.py | Python | apache-2.0 | 2,968 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/AB/backup/Social/TweetStream.py | Python | apache-2.0 | 1,798 |
# Copyright 2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
import itertools
import re
from ..Constants import ADVANCED_PARAM_TAB
from ..utils import to_list
from ..Messages import send_warning
from .block import Block
from ._flags import Flags
fr... | mrjacobagilbert/gnuradio | grc/core/blocks/_build.py | Python | gpl-3.0 | 5,226 |
# -*- coding: utf-8 -*-
import logging
from collections import namedtuple
from uuid import uuid4
import botocore
import ddt
import httpretty
import mock
from botocore.exceptions import ClientError
from django.core.exceptions import ValidationError
from django.db.models.signals import post_delete
from django.utils.ti... | edx/ecommerce | ecommerce/extensions/offer/tests/test_models.py | Python | agpl-3.0 | 34,776 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from shuup.notify.base import Event
from shuup_tests... | suutari/shoop | shuup_tests/notify/test_event.py | Python | agpl-3.0 | 850 |
#!/usr/bin/env python
## \file geometry.py
# \brief python package for running geometry analyses
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Original Developers: Dr. Francisco D. Palacios.
# Dr. Thomas D. Economon.
#
# SU2 Developers: Prof. Juan J. Alonso's group at ... | pawhewitt/Dev | SU2_PY/SU2/run/geometry.py | Python | lgpl-2.1 | 3,794 |
# -*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from datetime import datetime
from datetime import time as datetime_time
from dateutil import relativedelta
import babel
from odoo import api, fields, models, tools, _
from odoo.addons import decimal_precisi... | maxive/erp | addons/hr_payroll/models/hr_payslip.py | Python | agpl-3.0 | 29,061 |
"""
Forms and validation code for user registration.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.conf import settings
from signbank.settings.server_specific import *
from django.utils.safestring import mark_safe
from djan... | Signbank/NGT-signbank | signbank/registration/forms.py | Python | bsd-3-clause | 11,093 |
# Copyright 2013 Allen Institute
# This file is part of dipde
# dipde 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.
#
# dipde is dis... | nicain/dipde_dev | setup.py | Python | gpl-3.0 | 2,931 |
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - Bukti Potong PPh Pasal 26 (F.1.1.33.08)",
"version": "8.0.1.1.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com/",
"author... | open-synergy/opnsynid-l10n-indonesia | l10n_id_taxform_bukti_potong_pph_f113308/__openerp__.py | Python | agpl-3.0 | 719 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.backend.graph_info.subsystems.cloc_binary import ClocBinary
from pants.base.workunit import WorkUnitLabel
from pants.engine.fs import FilesContent, PathGlobs, PathGlo... | wisechengyi/pants | src/python/pants/backend/graph_info/tasks/cloc.py | Python | apache-2.0 | 3,847 |
from abc import ABCMeta
import numpy as np
from six.moves import xrange
import warnings
import collections
import cleverhans.utils as utils
from cleverhans.model import Model, CallableModelWrapper
_logger = utils.create_logger("cleverhans.attacks")
class Attack(object):
"""
Abstract base class for all atta... | cihangxie/cleverhans | cleverhans/attacks.py | Python | mit | 65,823 |
import boto
import settings
class OutboundEmail(object):
"""
This class sends emails through Amazon's Simple Email Service.
"""
def __init__(self, subject, body, to_addresses):
"""
:param str subject: The subject of the email.
:param str body: The body of the email to send.
... | gtaylor/dott | src/utils/email.py | Python | bsd-3-clause | 885 |
from django.conf.urls import include, url
from .views import BlogIndex, BlogDetail
from .feed import LatestPosts
urlpatterns = [
url(r'^$', BlogIndex.as_view(), name="blog"),
url(r'^feed/$', LatestPosts, name="feed_blog"),
url(r'^(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/(?P<slug>\S+)$', BlogDetail.as_view(), name=... | sheshkovsky/jaryan | blog/urls.py | Python | apache-2.0 | 337 |
#!/usr/bin/env python3
from api.configurator import Config
import sqlite3, os
if __name__ == '__main__':
config = Config()
if (config['database'].get('provider') == 'sqlite' and
config['database'].get('file') != None):
con = sqlite3.connect(config['database'].get('file'))
for line ... | petrstehlik/pyngShop | dump_db.py | Python | mit | 363 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Camptocamp (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Vincent Renaville (Camptocamp)
#
# This program is free software: you can redistribute it and/or modify
# it under ... | savoirfairelinux/account-financial-tools | account_cancel_invoice_check_voucher/account_invoice.py | Python | agpl-3.0 | 2,758 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 12 12:25:40 2017
@author: A
"""
#This code is the random forest code for the different files given
#Hopefully this works
#Reference: https://jasdumas.github.io/2016-05-04-RF-in-python/
#Begin Code:
import pandas
import numpy as np
import matplotlib.pylab ... | LighthouseHPC/lighthouse | sandbox/ml/scikit/RandomForest.py | Python | mit | 1,650 |
# 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... | DCSaunders/tensorflow | tensorflow/python/debug/wrappers/local_cli_wrapper.py | Python | apache-2.0 | 17,375 |
""" Testing the FCConditionPaserClass
"""
import unittest
from DIRAC.Resources.Catalog.FCConditionParser import FCConditionParser
class TestLogicEvaluation(unittest.TestCase):
"""Tests all the logic evaluation"""
def setUp(self):
self.fcp = FCConditionParser()
self.lfns = ["/lhcb/lfn1", "/lhc... | DIRACGrid/DIRAC | src/DIRAC/Resources/Catalog/test/Test_FCConditionParser.py | Python | gpl-3.0 | 9,368 |
class NodeType(object):
Base = 'base'
Model = 'model'
Analysis = 'analysis'
Test = 'test'
Archive = 'archive'
Macro = 'macro'
Operation = 'operation'
Seed = 'seed'
Documentation = 'documentation'
@classmethod
def executable(cls):
return [
cls.Model,
... | nave91/dbt | dbt/node_types.py | Python | apache-2.0 | 686 |
import re
from django import template
register = template.Library()
# ContentModifiers and related examples
class ContentFilter(object):
"""
Special class to register render functions that will manipulate
text content in some way. These functions are accessed by the
``modify`` filter below.
"""
... | andrewebdev/django-ostinato | ostinato/contentfilters/templatetags/content_filters.py | Python | mit | 3,218 |
# -*- coding: utf-8 -*-
import unittest
from datetime import datetime
from tempfile import NamedTemporaryFile
from dummy_spark import SparkContext
from dummy_spark import RDD
class SparkContextTests (unittest.TestCase):
TEST_RANGES = [
(0, 10, 1),
(0, 10, 2),
(0, 100, 13),
(0, ... | htssouza/DummyRDD | tests/unit/test_context.py | Python | bsd-3-clause | 5,155 |
from typing import List
class Solution:
def maximumGap(self, nums: List[int]) -> int:
| daicang/Leetcode-solutions | 164-maximum-gap.py | Python | mit | 91 |
#!/usr/bin/env python3
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""This module provides shared functionality for the systems to generate
native bind... | dart-lang/sdk | tools/dom/scripts/systemnative.py | Python | bsd-3-clause | 58,459 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012-2013, Timothy Appnel <tim@appnel.com>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/files/synchronize.py | Python | bsd-3-clause | 18,736 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.